[poppler] poppler/JPEG2000Stream.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed May 22 23:02:07 UTC 2019


 poppler/JPEG2000Stream.cc |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

New commits:
commit 89a5367d49b2556a2635dbb6d48d6a6b182a2c6c
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu May 23 00:54:29 2019 +0200

    JPEG2000Stream: fail gracefully if not all components have the same WxH
    
    I think this is just a mistake, or at least the only file we have with
    this scenario is a fuzzed one

diff --git a/poppler/JPEG2000Stream.cc b/poppler/JPEG2000Stream.cc
index 15bbcae4..0eea3a2d 100644
--- a/poppler/JPEG2000Stream.cc
+++ b/poppler/JPEG2000Stream.cc
@@ -4,7 +4,7 @@
 //
 // A JPX stream decoder using OpenJPEG
 //
-// Copyright 2008-2010, 2012, 2017, 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright 2008-2010, 2012, 2017-2019 Albert Astals Cid <aacid at kde.org>
 // Copyright 2011 Daniel Glöckner <daniel-gl at gmx.net>
 // Copyright 2014, 2016 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright 2013, 2014 Adrian Johnson <ajohnson at redneon.com>
@@ -253,6 +253,12 @@ void JPXStream::init()
         close();
         break;
       }
+      const int componentPixels = priv->image->comps[component].w * priv->image->comps[component].h;
+      if (componentPixels != priv->npixels) {
+        error(errSyntaxWarning, -1, "Component {0:d} has different WxH than component 0", component);
+        close();
+        break;
+      }
       unsigned char *cdata = (unsigned char *)priv->image->comps[component].data;
       int adjust = 0;
       int depth = priv->image->comps[component].prec;


More information about the poppler mailing list