[cups.bugs] [LOW] STR #3868: cups: GIF reader incorrect initialization of LZW decoder table
Tomas Hoger
thoger at redhat.com
Mon Jun 20 09:31:32 PDT 2011
DO NOT REPLY TO THIS MESSAGE. INSTEAD, POST ANY RESPONSES TO THE LINK BELOW.
[STR New]
I've noticed following in the code initializing LZW decoding table in the
GIF reader code:
584 /*
585 * Wipe the decompressor table...
586 */
587
588 fresh = 1;
589
590 for (i = 0; i < clear_code; i ++)
591 {
592 table[0][i] = 0;
593 table[1][i] = i;
594 }
595
596 for (; i < 4096; i ++)
597 table[0][i] = table[1][0] = 0;
It seems line 597 is supposed to be doing table[1][i], just as is done
when re-initializing table after seeing clear_code:
621 if (code == clear_code)
622 {
623 for (i = 0; i < clear_code; i ++)
624 {
625 table[0][i] = 0;
626 table[1][i] = i;
627 }
628
629 for (; i < 4096; i ++)
630 table[0][i] = table[1][i] = 0;
This bug is rather cosmetic one, as table[][] is calloc()ed shortly before
being initialized. Given that, initialization can be reduced to omit line
592 and the whole second loop, probably at some code readability cost.
Link: http://www.cups.org/str.php?L3868
Version: 1.4.6
More information about the cups
mailing list