Closed smcv closed 4 months ago
The Windows CI build says:
D:/a/SDL_image/SDL_image/src/IMG_jpg.c:489:18: error: variable 'jpeg_surface' might be clobbered by 'longjmp' or 'vfork' [-Werror=clobbered]
Maybe we should separate longjmp handling and the rest like we did for libpng code in https://github.com/libsdl-org/SDL_image/commit/3e42a4fb0138f1f2522c43a9e1cda41d24c2a21c (followed by minor simplification https://github.com/libsdl-org/SDL_image/commit/135bec7c30a00703b3c1a6aab04743ab522262fe) (also applied to SDL2 branch)
OK, how's this?
Looks good, I think. We should do the same to the load function too.
We should do the same to the load function too.
Ideally yes, but I'd prefer that sort of refactoring not to be a blocker for a crash fix.
@slouken ?
Looks good!
We should adapt to SDL2 too and do the same for loader function as well, later.
We should adapt to SDL2 too
That was #432 (which is actually the version I wrote first)
and do the same for loader function as well, later
JPEG: Factor out the middle of IMG_SaveJPG_RW_jpeglib
No functional change intended. We'll need to use setjmp() in this function in a subsequent commit, so ensure that its state doesn't include any local variables that are used both "above" and "below" the stack level at which we will call setjmp().
JPEG: Add error-recovery when saving with libjpeg
Because we have set up libjpeg to use my_error_exit, we need to call setjmp() before the first time it might possibly call longjmp(). Otherwise, on error we'll do a non-local goto to an uninitialized pointer and crash.
SDL3 version of #432. Untested (there's no SDL3 in the scout SDK yet) but the only difference is the name of a constant.