diff options
author | Oleksij Rempel <linux@rempel-privat.de> | 2018-11-20 21:07:14 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2018-11-21 09:08:09 +0100 |
commit | d0d3ca42feda308e07d29c50ba868e770a899814 (patch) | |
tree | 6b3e38f6e3ae89e7344b9b6253f022ebdece7421 | |
parent | 765aac64a94dae761de2a7af48eeaa4dcf25e973 (diff) | |
download | barebox-d0d3ca42feda308e07d29c50ba868e770a899814.tar.gz barebox-d0d3ca42feda308e07d29c50ba868e770a899814.tar.xz |
lib: lodepng: remove useless test
Either the condition 'code_ll==(unsigned int)(-1)' is redundant or the
array 'LENGTHBASE[29]' is accessed at index 4294967038, which is out of
bounds.
On other hand this condition is tested within other scope:
"if(code_ll >= FIRST_LENGTH_CODE_INDEX && code_ll <= LAST_LENGTH_CODE_INDEX)"
with is already limited to (code_ll >= 257 && code_ll <= 285),
so it can't be -1 any way.
Signed-off-by: Oleksij Rempel <linux@rempel-privat.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r-- | lib/gui/lodepng.c | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/gui/lodepng.c b/lib/gui/lodepng.c index ba21cd235f..fa8980883b 100644 --- a/lib/gui/lodepng.c +++ b/lib/gui/lodepng.c @@ -1168,13 +1168,7 @@ static unsigned inflateHuffmanBlock(ucvector* out, const unsigned char* in, size code_d = huffmanDecodeSymbol(in, bp, &tree_d, inbitlength); if(code_d > 29) { - if(code_ll == (unsigned)(-1)) /*huffmanDecodeSymbol returns (unsigned)(-1) in case of error*/ - { - /*return error code 10 or 11 depending on the situation that happened in huffmanDecodeSymbol - (10=no endcode, 11=wrong jump outside of tree)*/ - error = (*bp) > inlength * 8 ? 10 : 11; - } - else error = 18; /*error: invalid distance code (30-31 are never used)*/ + error = 18; /*error: invalid distance code (30-31 are never used)*/ break; } distance = DISTANCEBASE[code_d]; |