Update FSFW #25
@ -165,7 +165,7 @@ ReturnValue_t DleEncoder::decodeStreamEscaped(const uint8_t *sourceStream, size_
|
|||||||
if (sourceStream[encodedIndex++] != STX_CHAR) {
|
if (sourceStream[encodedIndex++] != STX_CHAR) {
|
||||||
return DECODING_ERROR;
|
return DECODING_ERROR;
|
||||||
}
|
}
|
||||||
while ((encodedIndex < sourceStreamLen)
|
while ((encodedIndex < sourceStreamLen - 1)
|
||||||
and (decodedIndex < maxDestStreamlen)
|
and (decodedIndex < maxDestStreamlen)
|
||||||
and (sourceStream[encodedIndex] != ETX_CHAR)
|
and (sourceStream[encodedIndex] != ETX_CHAR)
|
||||||
and (sourceStream[encodedIndex] != STX_CHAR)) {
|
and (sourceStream[encodedIndex] != STX_CHAR)) {
|
||||||
|
@ -218,5 +218,10 @@ TEST_CASE("DleEncoder" , "[DleEncoder]") {
|
|||||||
REQUIRE(result == static_cast<int>(DleEncoder::DECODING_ERROR));
|
REQUIRE(result == static_cast<int>(DleEncoder::DECODING_ERROR));
|
||||||
|
|
||||||
dleEncoder.setEscapeMode(true);
|
dleEncoder.setEscapeMode(true);
|
||||||
|
testArray1EncodedFaulty = TEST_ARRAY_1_ENCODED_ESCAPED;
|
||||||
|
testArray1EncodedFaulty[5] = 0;
|
||||||
|
result = dleEncoder.decode(testArray1EncodedFaulty.data(), testArray1EncodedFaulty.size(),
|
||||||
|
&readLen, buffer.data(), buffer.size(), &encodedLen);
|
||||||
|
REQUIRE(result == static_cast<int>(DleEncoder::DECODING_ERROR));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user