summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2018-12-28 13:05:36 +0100
committerDavid Tardon <dtardon@redhat.com>2018-12-28 13:05:36 +0100
commitac478ec40afbded9c2f9dd14519caf575ed72af9 (patch)
treed5bba2bae2c5d65651b3570c3d47e49d2f6a7495
parent325b61ab177abb4328dafa36eb99391b9afb5fcd (diff)
ofz#8328 avoid reading past the end of data buffer
Change-Id: I20d9f1aa723dc113e62ae7014bfaa1a61df693d2
-rw-r--r--src/lib/CDRStylesCollector.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/CDRStylesCollector.cpp b/src/lib/CDRStylesCollector.cpp
index 2dfeba2..2cc3647 100644
--- a/src/lib/CDRStylesCollector.cpp
+++ b/src/lib/CDRStylesCollector.cpp
@@ -127,9 +127,9 @@ void libcdr::CDRStylesCollector::collectBmp(unsigned imageId, unsigned colorMode
k++;
}
}
- else if (bpp == 32)
+ else if (bpp == 32 && lineWidth >= 4)
{
- while (i < lineWidth && k < width)
+ while (i < lineWidth - 3 && k < width)
{
unsigned c = (bitmap[j*lineWidth+i+3] << 24) | (bitmap[j*lineWidth+i+2] << 16) | (bitmap[j*lineWidth+i+1] << 8) | (bitmap[j*lineWidth+i]);
i += 4;