new PNGReadWriter with libpng support

Jens Lincke jens at
Wed Nov 22 18:51:56 UTC 2006

Andreas Raab schrieb:
> All I find in there is
> PNGReadWriter2>>primPNGReadImageFromByteArray: source onForm: form
>     self primitiveFailed
primPNGReadImageFromByteArray: source onForm: form
    <primitive: 'primPNGReadImageFromByteArrayonForm' module: 
    self primitiveFailed

> I'm a little confused to see statements like here in the plugin:
>    formPix isNil ifTrue: [formPix := 1].
this is an artifact of the translation from c to slang
the line came from the JPEGPlugin:
formPix = (255 << 24) | (buffer[0][i+rOff] << 16) | (buffer[0][i+gOff] 
<< 8) | buffer[0][i+bOff];
                                if (formPix == 0) formPix = 1;
> this should be translated to isNil(formPix) and as far as I am aware 
> there is no such function available anywhere. Also, it seems as if 
> there are some serious hazards for decoding the PNG data - the code 
> doesn't set a limit for the source of input when decoding so I presume 
> libpng will simply fall over and break (possibly corrupting Squeak 
> memory) if you give it partial input?
there is an error handler for png errors, which will return to squeak, 
but no other checks.

More information about the Squeak-dev mailing list