From ec4c32a8921fc72e855f2ca8ec608af499dc34d2 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 7 Feb 2014 21:08:10 +0100 Subject: Fix for Bug #1275443 (Including picture results in crash). Fixed bugs: - https://launchpad.net/bugs/1275443 (bzr r13006) --- src/extension/internal/image-resolution.cpp | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/extension/internal/image-resolution.cpp') diff --git a/src/extension/internal/image-resolution.cpp b/src/extension/internal/image-resolution.cpp index aee46aaba..18eb97f80 100644 --- a/src/extension/internal/image-resolution.cpp +++ b/src/extension/internal/image-resolution.cpp @@ -322,6 +322,12 @@ void ImageResolution::readjfif(char const *fn) { y_ = cinfo.Y_density * 2.54; ok_ = true; } + /* According to http://www.jpeg.org/public/jfif.pdf (page 7): + * "Xdensity and Ydensity should always be non-zero". + * but in some cases, they are (see LP bug #1275443) */ + if (x_ == 0 or y_ == 0) { + ok_ = false; + } } jpeg_destroy_decompress(&cinfo); fclose(ifd); -- cgit v1.2.3