Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • bob.io.image bob.io.image
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 2
    • Issues 2
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • bobbob
  • bob.io.imagebob.io.image
  • Issues
  • #15
Closed
Open
Issue created Jul 26, 2016 by André Anjos@andre.anjos💬Owner

png error handling is incorrect/error message is misleading

Created by: siebenkopf

I have lately seen errors (Exceptions) while reading png images. The error message I got was

PNG: error while setting error handling (function setjmp(png_jmpbuf(()))

which are issued somewhere here: https://github.com/bioidiap/bob.io.image/blob/master/bob/io/image/cpp/png.cpp#L235

However, when reading about the setjmp function, this function is a bit twisted. It returns 0 while setting the function, while non-zero when the function is actually called caused by another error. I have read a bit more about error handling using libpng, (e.g., how to set up a proper error handler), but I haven't yet found a good solution on how to raise C++ exceptions without leaving memory leaks.

Anyways, currently there is no way to know, why libpng raised the error. The given error message does not explain anything. There seems to be a better way (where we actually get a pointer to the error message): http://www.libpng.org/pub/png/libpng-1.2.5-manual.html#section-5 but I don't see, how we can exit cleanly form user_error_fn without leaving the memory allocated here: https://github.com/bioidiap/bob.io.image/blob/master/bob/io/image/cpp/png.cpp#L222 and cleaned here: https://github.com/bioidiap/bob.io.image/blob/master/bob/io/image/cpp/png.cpp#L234 leaking.

Any idea?

Assignee
Assign to
Time tracking