9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] inflatezlib/readpng bug
@ 2003-07-19  1:48 andrey mirtchovski
  0 siblings, 0 replies; only message in thread
From: andrey mirtchovski @ 2003-07-19  1:48 UTC (permalink / raw)
  To: 9fans

I can't catch this one. Having spent the afternoon trying to hunt it, I'll
report it without a fix, sorry.

The bug is, basically, png(1) can't display png images larger than 0x8000
bytes (+ headers).

To illustrate the bug try on your machine:

	resample -x 1024 -y 1024 /lib/face/48x48x4/g/glenda.1 | topng | png

you will get a 'header said 1024 rows; data goes further' error message.


If, however, the png images are smaller than 0x8000 (like the normal
glenda image, or even resampled at 512x512) png displays them fine. The
number 0x8000(+headers) is significant, because that's the chunk size
that inflate() in libflate will process in a single run. With compressed
images larger than that inflatezlib()'s (readpng uses inflatezlib() which
calls inflate()) write/read functions will be called more than once and the
bug will be triggered.

Note that deflatezlib() used by topng works fine -- large images created
with it are read fine everywhere else.

Why do I think it's the library and not png.c itself? If you change png.c
and topng.c to use inflate/deflate instead of inflatezlib/deflatezlib,
leaving everything else intacs, the example above will succeed.

andrey



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2003-07-19  1:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-07-19  1:48 [9fans] inflatezlib/readpng bug andrey mirtchovski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).