Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#193 Crash when experiencing a JPEG2000 decoding error

open
nobody
None
5
2010-05-03
2010-05-03
G. Myers
No

Under Linux I attempted to read a bad JPEG 2000 file which resulted in a crash (glibc: double free or corruption). The following message is displayed, followed by a stack trace:

alignment failed
jpc_dec_decodepkts failed
error: cannot decode code stream

NOTE: The same message is displayed in Windows, but a crash does not occur.

I traced trough ilLoadImage(), ilLoadJp2(), and ilLoadJp2F(). In ilLoadJp2F() there is a call to iLoadJp2Internal() which is followed by a call to jas_stream_close(). In iLoadJp2Internal(), if the call to jas_image_decode() fails then jas_stream_close() is called and the function returns. However, upon returning jas_stream_close() will get called a second time which leads to the crash.

Please see the attached patch which fixes this bug.

Discussion

  • G. Myers
    G. Myers
    2010-05-03

     
    Attachments
  • Matěj Týč
    Matěj Týč
    2010-05-06

    Hello,
    thank you very much for your patches, they are going to be reviewed and most likely will become part of the next (pre)release

    Could you please give us your full name for the AUTHORS file?
    Regards,
    Matej