|
In case of files provided in ticket problem occured in libjpeg's jpeg_start_decompress(to be more specofic- inside it's _jinit_color_deconverter()) because if cinfo's out_color_space is RGB, then jpeg_color_space can't be JCS_YCCK (JCS_YCCK jpeg_color_space is possible for JCS_CMYK out_color_space). So when the combination of RGB and JCS_YCCK was encountered, jpeglib called ERREXIT() inside which exit() was called and viewer crashed.
- Checking for this combination before calling jpeg_start_decompress() would solve this problem in this specific case, but there are a lot of possible error combinations which cause libjpeg to exit and thus crash viewer, so copypasting checks from it into viewer code would be cumbersome, uneffective and ugly. So another approach was used instead- by default libjpeg calls exit() after encountering an error, but user can provide his own error handling function instead. on_jpeg_error() function was added in fix for this. It sets true a boolean flag that is used to determine whether there were errors in getImageDimensionsJpeg(), and this function's return value depends on it.
|