summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-09-16 15:10:18 +0100
committerAndras Timar <andras.timar@collabora.com>2015-09-17 21:45:29 +0200
commitdef698fddb611e1c8ed4fa5a36f3eb39299fba44 (patch)
tree134f00321bb0352573e6d8d3ff0137b6c46e1e40
parentab6a83bc4cb13976ed2971502c2a4cc827151a7f (diff)
don't crash with unknown out color space
Change-Id: Ib066ff1fad686d611a86510e768b1109ef7a5e75 (cherry picked from commit 7aa2f8c75d7bda103748fa73766a30fd77e50c16) Reviewed-on: https://gerrit.libreoffice.org/18641 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
-rw-r--r--vcl/qa/cppunit/graphicfilter/data/jpg/fail/crash-1.jpgbin0 -> 443 bytes
-rw-r--r--vcl/source/filter/jpeg/jpegc.cxx8
2 files changed, 7 insertions, 1 deletions
diff --git a/vcl/qa/cppunit/graphicfilter/data/jpg/fail/crash-1.jpg b/vcl/qa/cppunit/graphicfilter/data/jpg/fail/crash-1.jpg
new file mode 100644
index 000000000000..e783bd33ee5a
--- /dev/null
+++ b/vcl/qa/cppunit/graphicfilter/data/jpg/fail/crash-1.jpg
Binary files differ
diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx
index 411b17bd1644..25b98fb36df2 100644
--- a/vcl/source/filter/jpeg/jpegc.cxx
+++ b/vcl/source/filter/jpeg/jpegc.cxx
@@ -94,7 +94,13 @@ void ReadJPEG( JPEGReader* pJPEGReader, void* pInputStream, long* pLines,
else if ( cinfo.jpeg_color_space == JCS_YCCK )
cinfo.out_color_space = JCS_CMYK;
- OSL_ASSERT(cinfo.out_color_space == JCS_CMYK || cinfo.out_color_space == JCS_GRAYSCALE || cinfo.out_color_space == JCS_RGB);
+ if (cinfo.out_color_space != JCS_CMYK &&
+ cinfo.out_color_space != JCS_GRAYSCALE &&
+ cinfo.out_color_space != JCS_RGB)
+ {
+ SAL_WARN("vcl.filter", "jpg with unknown out color space, forcing to rgb");
+ cinfo.out_color_space = JCS_RGB;
+ }
/* change scale for preview import */
long nPreviewWidth = previewSize.Width();