summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-10-03 14:10:31 +0100
committerCaolán McNamara <caolanm@redhat.com>2017-10-03 17:03:41 +0200
commit7dbb98bf18a8431f6063c4e9bf7b3fa21867e78c (patch)
treeb96857c1010b282ae22f09d3431fa17c3f4df72d
parent2b6385a9f58e9f8adfd406e087186eb0cbba700b (diff)
ofz#3540: oom move compression size test earlier
Change-Id: I1ca4f08ef526498cf08665f2b23d56095d5f1323 Reviewed-on: https://gerrit.libreoffice.org/43082 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--filter/source/graphicfilter/itiff/itiff.cxx7
1 files changed, 7 insertions, 0 deletions
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx
index e9f07689387c..0e27706c8fde 100644
--- a/filter/source/graphicfilter/itiff/itiff.cxx
+++ b/filter/source/graphicfilter/itiff/itiff.cxx
@@ -1433,6 +1433,13 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic )
if (nStart > nEndOfFile)
bStatus = false;
}
+
+ if (bStatus)
+ {
+ sal_uLong nTargetBits = nImageWidth * nBitsPerSample * nSamplesPerPixel / nPlanes;
+ if (nTargetBits > SAL_MAX_UINT16)
+ bStatus = false;
+ }
}
else if ( nCompression == 5 )
{