summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2020-05-19 08:57:31 +0200
committerStephan Bergmann <sbergman@redhat.com>2020-05-19 09:57:57 +0200
commitfc1d1acd518a9937c2501242dae2af4530b52fe7 (patch)
treeec7aab25350b5bab5f0856061c3fce78eceb098a /vcl
parent8209c2569f5726f9ed29f75d30efdccb94f98fe5 (diff)
Avoid UB when calling setjmp
The C standard (and thus by reference also the C++ standard) has very picky constraints how invocations of the setjmp macro need to appear to not cause undefined behavior. Change-Id: I09418de340a044e4309261bae9816ca746700858 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94474 Tested-by: Jenkins Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/filter/jpeg/jpegc.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx
index ced814e2fccb..c1fbb535a8e4 100644
--- a/vcl/source/filter/jpeg/jpegc.cxx
+++ b/vcl/source/filter/jpeg/jpegc.cxx
@@ -469,7 +469,13 @@ void Transform(void* pInputStream, void* pOutputStream, long nAngle)
JpegDecompressOwner aDecompressOwner;
JpegCompressOwner aCompressOwner;
- if (setjmp(aSourceError.setjmp_buffer) || setjmp(aDestinationError.setjmp_buffer))
+ if (setjmp(aSourceError.setjmp_buffer))
+ {
+ jpeg_destroy_decompress(&aSourceInfo);
+ jpeg_destroy_compress(&aDestinationInfo);
+ return;
+ }
+ if (setjmp(aDestinationError.setjmp_buffer))
{
jpeg_destroy_decompress(&aSourceInfo);
jpeg_destroy_compress(&aDestinationInfo);