[l2h] Image conversion

jos jos at w3k.org
Thu Feb 16 20:15:51 CET 2006


At 04:40 AM 2/16/2006, Shigeharu TAKENO wrote:

>In <32fc6cec0602152010p59aee0efo4c7483f6e0b02127 at mail.gmail.com>,
>Julius Smith <julius.smith at gmail.com> wrote:
>|
>| > /usr/bin/ppmquant -floyd 256 </tmp/l2h16891/p17166.pnm | 
>/usr/bin/pnmtopng -interlace >! img577.png
>| ...
>| pnmremap failed, rc=13
>| Segmentation fault
>
>This seems to be an error of pnmtopng (13 = SIGPIPE). Please
>check pnmtopng. My pnmtopng of netpbm-10.30 also does not run
>correctly, so I am now using it of netpbm-10.26 (on Solaris 9).

Apparently pnmtopng (from netpbm-10.31) gets a random segmentation 
fault, even when not reading a pipe:

 > pnmquant 256 < /tmp/l2h1789/p5124.pnm > foo.pnm
 > /usr/bin/pnmtopng -interlace < foo.pnm >! img3356.png
pnmtopng: 16 colors found
 > /usr/bin/pnmtopng -interlace < foo.pnm >! img3356.png
pnmtopng: 16 colors found
 > /usr/bin/pnmtopng -interlace < foo.pnm >! img3356.png
Segmentation fault
 > /usr/bin/pnmtopng -interlace < foo.pnm >! img3356.png
pnmtopng: 16 colors found
 > /usr/bin/pnmtopng -interlace < foo.pnm >! img3356.png
Segmentation fault
 > /usr/bin/pnmtopng -interlace < foo.pnm >! img3356.png
Segmentation fault
 > /usr/bin/pnmtopng -interlace < foo.pnm >! img3356.png
pnmtopng: 16 colors found
 > /usr/bin/pnmtopng -interlace < foo.pnm >! img3356.png
pnmtopng: 16 colors found

That's three segmentation faults in eight trials.

I ran it under gdb and found that the crash is in rawmemchr() from 
/lib/libc.so.6:

 > gdb /usr/bin/pnmtopng
(gdb) set args -interlace < foo.pnm >! img3356.png
(gdb) r
Starting program: /usr/bin/pnmtopng -interlace < foo.pnm >! img3356.png
Reading symbols from shared object read from target memory...(no 
debugging symbols found)...done.
Loaded system supplied DSO at 0xf50000
(no debugging symbols found) ...

Program received signal SIGSEGV, Segmentation fault.
0x0088a6b0 in rawmemchr () from /lib/libc.so.6

Recompiling for debugging with "-O0 -g" made the problem go away 
completely.  It appears turning off optimization (normally "-O3") 
makes the problem go away.  The next step is to compile "-g -O3" and 
track down the bug, but at least there seems to be a workaround for 
now.  I've now converted several hundred images without a single failure.

Julius



More information about the latex2html mailing list