[PATCH v1 9/9] lib: lodepng: remove useless test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxxxx>
---
 lib/gui/lodepng.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/lib/gui/lodepng.c b/lib/gui/lodepng.c
index 9cc59d709..78a34db47 100644
--- a/lib/gui/lodepng.c
+++ b/lib/gui/lodepng.c
@@ -1140,13 +1140,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];
-- 
2.17.1


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux