Itseez/opencv — pull request #3313 by lurkingrobbert (2014-10-07 14:25:46+00:00)
Title: Process libjpeg errors the OpenCV way

Errors from libjpeg, specifically "Corrupted JPEG data" messages, are printed to stderr by the default error handler, making those errors uncatchable. By overwriting the output_message method as suggested by the libjpeg docs we can handle those errors like regular OpenCV errors.