From ee619fb344c7e8f491e09bd256df7f8567af9bef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= Date: Thu, 23 Feb 2017 11:05:40 +0000 Subject: [PATCH] ofz: don't read data that isn't there Change-Id: I7fdcb78bde8f650c1a57d34177d8993a6d8a0a2f --- filter/source/graphicfilter/itiff/itiff.cxx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index 12aee89023e5..807756a561bd 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -995,6 +995,12 @@ bool TIFFReader::ConvertScanline(sal_Int32 nY) { sal_uInt32 nByteCount = nImageWidth >> 3; + sal_uInt32 nBytesNeeded = nByteCount; + if (nImageWidth & 7) + ++nBytesNeeded; + if (pt + nBytesNeeded > ptend) + return false; + if ( bByteSwap ) { sal_Int32 nx = 0;