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.
Asked
Active
Viewed 66 times
0

bobeff
- 3,543
- 3
- 34
- 62
-
Doesn't `libjpeg` library sources have tests? – जलजनक Mar 28 '22 at 14:16
-
Pass the functions handling the structured data some invalid data. – Eugene Sh. Mar 28 '22 at 14:20
-
How about writing a wrapper to call the native libjpeg, and doing a mock in your testing code? – Ji Bin Mar 28 '22 at 14:21
1 Answers
0
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.

bobeff
- 3,543
- 3
- 34
- 62