summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2014-10-21 17:20:15 +0100
committerCaolán McNamara <caolanm@redhat.com>2014-10-21 17:23:17 +0100
commitd0be09322d127e7d517851db38c764d57fbab2dc (patch)
tree69507d8fd47de181debb7adf4880e1e4c864c572
parent29474c7a227050b16fc341bdf7df68112793a23d (diff)
coverity#1242908 Untrusted value as argument
Change-Id: If9dd92c361d406c435329d29870dc8bb07a8ba7b
-rw-r--r--filter/source/graphicfilter/ipcx/ipcx.cxx7
1 files changed, 7 insertions, 0 deletions
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 ];