CWE
787 119
Advisory Published
CVE Published
Updated

CVE-2011-2896: Buffer Overflow

First published: Wed Aug 03 2011(Updated: )

GIF image file format readers in various open source projects are based on the GIF decoder implementation written by David Koblas. This implementation contains a bug in the LZW decompressor, causing it to in correctly handle compressed streams that contain code words that were not yet added to the decompression table. LZW decompression has a special case (a KwKwK string) when code word may match the first free entry in the decompression table. The implementation used in this GIF reading code allows code words not only matching, but also exceeding the first free entry. This problem is identical to a bug found in BSD compress (<a href="https://access.redhat.com/security/cve/CVE-2011-2895">CVE-2011-2895</a>, <a class="bz_bug_link bz_status_CLOSED bz_closed bz_public " title="CLOSED ERRATA - CVE-2011-2895 BSD compress LZW decoder buffer overflow" href="show_bug.cgi?id=727624">bug #727624</a>), but given the unclear relationship between BSD compress and GIF decoder code bases, separate CVE is used here. Several projects refer to pbmplus as the source form where GIF reading code was taken: <a href="http://www.acme.com/software/pbmplus/">http://www.acme.com/software/pbmplus/</a> In pbmplus version of the code, the flaw can be found in LWZReadByte(): if (code &gt;= max_code) { *sp++ = firstcode; code = oldcode; } This allows creating a loop in the decompression table, which leads to an "infinite" loop: while (code &gt;= clear_code) { *sp++ = table[1][code]; if (code == table[0][code]) pm_error("circular table entry BIG ERROR"); code = table[0][code]; } where: #define MAX_LWZ_BITS 12 static int table[2][(1&lt;&lt; MAX_LWZ_BITS)]; static int stack[(1&lt;&lt;(MAX_LWZ_BITS))*2], *sp; sp = stack; This results in stack[] buffer overflow. If table[][] is located above stack[], stack[] overflow may further modify decoding table and break infinite loop.

Credit: secalert@redhat.com

Affected SoftwareAffected VersionHow to fix
Swi-prolog Swi-prolog<=5.10.4
Apple Cups<=1.4.6
GIMP GIMP<=2.6.11

Never miss a vulnerability like this again

Sign up to SecAlerts for real-time vulnerability data matched to your software, aggregated from hundreds of sources.

Reference Links

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2024 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203