From 939465c40902d72e0c05d4f3a27ee67e4a007ed7 Mon Sep 17 00:00:00 2001 From: Albert Astals Cid <aacid@kde.org> Date: Tue, 19 Sep 2017 21:19:03 +0200 Subject: Fix crash in broken files Bug #102854 Index: poppler-0.48.0/poppler/Stream.cc =================================================================== --- poppler-0.48.0.orig/poppler/Stream.cc +++ poppler-0.48.0/poppler/Stream.cc @@ -470,11 +470,10 @@ ImageStream::ImageStream(Stream *strA, i } else { imgLineSize = nVals; } - if (width > INT_MAX / nComps) { - // force a call to gmallocn(-1,...), which will throw an exception + if (nComps <= 0 || width > INT_MAX / nComps) { imgLineSize = -1; } - imgLine = (Guchar *)gmallocn(imgLineSize, sizeof(Guchar)); + imgLine = (Guchar *)gmallocn_checkoverflow(imgLineSize, sizeof(Guchar)); } imgIdx = nVals; }