summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-09-16 15:10:18 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-09-16 15:34:23 +0100
commit7aa2f8c75d7bda103748fa73766a30fd77e50c16 (patch)
tree84cd4699fe76eee8a5ab708c071ae235e62ae284
parent42468f9f979d0d21ad406af8ddc4135380fff63d (diff)
don't crash with unknown out color space
Change-Id: Ib066ff1fad686d611a86510e768b1109ef7a5e75
-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 8ced5ab28ca6..c8f27b987aea 100644
--- a/vcl/source/filter/jpeg/jpegc.cxx
+++ b/vcl/source/filter/jpeg/jpegc.cxx
@@ -103,7 +103,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();