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-19 21:32:23 +0200
commita91bee5ecaa6c42dfb49f24c39feefb42f09b1cf (patch)
tree1d56de978819ba9b7d39e4656d04cf547302df7d
parent646576295228c7b8b6e5ffc758aabe8ccec9ccec (diff)
don't crash with unknown out color space
Change-Id: Ib066ff1fad686d611a86510e768b1109ef7a5e75 (cherry picked from commit 7aa2f8c75d7bda103748fa73766a30fd77e50c16) Reviewed-on: https://gerrit.libreoffice.org/18640 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 9762e5a2fb10..a9ddddc3124b 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();