From d0be09322d127e7d517851db38c764d57fbab2dc Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 21 Oct 2014 17:20:15 +0100 Subject: coverity#1242908 Untrusted value as argument Change-Id: If9dd92c361d406c435329d29870dc8bb07a8ba7b --- filter/source/graphicfilter/ipcx/ipcx.cxx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx index 283cdeb18f0c..af82bd3d748d 100644 --- a/filter/source/graphicfilter/ipcx/ipcx.cxx +++ b/filter/source/graphicfilter/ipcx/ipcx.cxx @@ -217,6 +217,13 @@ void PCXReader::ImplReadBody(BitmapWriteAccess * pAcc) sal_uLong nLastPercent = 0; sal_uInt8 nDat = 0, nCol = 0; + //sanity check there is enough data before trying allocation + if (nPlanes > m_rPCX.remainingSize() / nBytesPerPlaneLin) + { + nStatus = false; + return; + } + for( np = 0; np < nPlanes; np++ ) pPlane[ np ] = new sal_uInt8[ nBytesPerPlaneLin ]; -- cgit