diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-10-03 14:10:31 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-10-03 17:03:41 +0200 |
commit | 7dbb98bf18a8431f6063c4e9bf7b3fa21867e78c (patch) | |
tree | b96857c1010b282ae22f09d3431fa17c3f4df72d | |
parent | 2b6385a9f58e9f8adfd406e087186eb0cbba700b (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.cxx | 7 |
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 ) { |