Skip to content

Commit

Permalink
signalDecoder.cpp
Browse files Browse the repository at this point in the history
possible overflow fixed #80 #62
  • Loading branch information
sidey79 committed Dec 5, 2017
1 parent 6116d89 commit 7dd5515
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/_micro-api/libraries/signalDecoder/src/signalDecoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ inline void SignalDetectorClass::doDetect()


}
for (uint8_t i = messageLen - 1; i >= 0 && histo[pattern_pos] > 0; --i)
for (uint8_t i = messageLen - 1 ; i >= 0 && histo[pattern_pos] > 0 && messageLen>0; --i)
{
if (message[i] == pattern_pos) // Finde den letzten Verweis im Array auf den Index der gleich ueberschrieben wird
{
Expand Down Expand Up @@ -884,6 +884,8 @@ bool SignalDecoderClass::validSequence(const int * a, const int * b)

void SignalDetectorClass::calcHisto(const uint8_t startpos, uint8_t endpos)
{
if (messageLen == 0) return;

for (uint8_t i = 0; i<maxNumPattern; ++i)
{
histo[i] = 0;
Expand Down

0 comments on commit 7dd5515

Please sign in to comment.