c++cerror-handlinglibjpeglibjpeg-turbo

How to call libjpeg API in an erroneous way?


I want to test my error handling code when using the libjpeg but I cannot find a suitable call which to produce an error. If I simply pass a nullptr to some of the calls expecting a pointer to a structure then the library just crashes. I want to find a statement that calls the set in the jpeg_error_mgr's error_exit function.


Solution

  • I managed to produce an error when calling libjpeg's functions on jpeg_compress_struct or jpeg_decompress_struct without first calling the jpeg_create_compress or jpeg_create_decompress functions respectively.