[Zlib-devel] known bugs in distance-checking code?

Glenn Randers-Pehrson <glennrp> glennrp at comcast.net
Wed Feb 23 14:28:43 EST 2005


Gilles Vollant wrote:
> 
> It is a real choice for mozilla team don't use zlib 1.2.x with all speed
> improvement?

Probably not.  I've been attempting to make a patch that would fill the
buffer
with zeroes instead of issuing an error message:

in inffast.c, around line 179, change code to read

                    if (op > whave) {
#if 0
                        strm->msg = (char *)"invalid distance too far
back";
                        state->mode = BAD;
                        break;
#else /* kludge to accept old buggy PNG files */
                        do {
                            PUP(out) = (unsigned char)'\0';
                            --dist;
                            --bits;
                            --beg;
                            --len;
                           } while (--op > whave);
#endif
                    }  

but this only dumps core, whether I use libpng or libmng to read one of
the buggy PNGs. #:-(
what am I missing?

Glenn




More information about the Zlib-devel mailing list