[2.x] JPEG: Handle errors when saving with libjpeg #432
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back 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.
SDL2 version of #431, which should be merged first (but this is the version that I have actually tested). Please cherry-pick to release-2.8.x if accepted.