Commit 89a5367d authored by Albert Astals Cid's avatar Albert Astals Cid

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
parent 65adf225
......@@ -4,7 +4,7 @@
//
// A JPX stream decoder using OpenJPEG
//
// Copyright 2008-2010, 2012, 2017, 2018 Albert Astals Cid <aacid@kde.org>
// Copyright 2008-2010, 2012, 2017-2019 Albert Astals Cid <aacid@kde.org>
// Copyright 2011 Daniel Glöckner <daniel-gl@gmx.net>
// Copyright 2014, 2016 Thomas Freitag <Thomas.Freitag@alfa.de>
// Copyright 2013, 2014 Adrian Johnson <ajohnson@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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment