diff options
author | Caolán McNamara <caolanm@redhat.com> | 2017-09-25 09:03:49 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2017-09-25 10:09:26 +0100 |
commit | 651e1f6cda04468394c65c2fd88d915902ac0306 (patch) | |
tree | 1ec44627d4bf0d6767a3196d3533a6abff15897f | |
parent | 00d247353e793ed3348b013212a9f838615b8203 (diff) |
ofz: divide-by-zero
Change-Id: Ie9a21a1432a98af3dca9a397057b7887ff30375f
-rw-r--r-- | filter/source/graphicfilter/itiff/itiff.cxx | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index 083143600fc0..7298da030cc6 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -1345,11 +1345,21 @@ bool TIFFReader::ReadTIFF(SvStream & rTIFF, Graphic & rGraphic ) else nPlanes = nSamplesPerPixel; + bStatus = nPlanes != 0; + } + + sal_uInt32 nDiv = GetRowsPerStrip() + 1; + + if ( bStatus ) + { + bStatus = (nDiv != 0); + } + + if ( bStatus ) + { if ( ( nFillOrder == 2 ) && ( nCompression != 5 ) ) // in the LZW mode bits are already being inverted bByteSwap = true; - - nStripsPerPlane = ( nImageLength - 1 ) / GetRowsPerStrip() + 1; - bStatus = nPlanes != 0; + nStripsPerPlane = ( nImageLength - 1 ) / nDiv; } if ( bStatus ) |