diff options
author | Caolán McNamara <caolanm@redhat.com> | 2014-10-14 13:41:01 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2014-10-14 17:13:45 +0100 |
commit | 2e234939874575a41673b3ceb4a759afa3b333aa (patch) | |
tree | 55d12ddb3f1f375700a4555583b3ebd97e82e8c7 /filter | |
parent | aeea1cab4300371797fc1283c1e8623fa8238908 (diff) |
check for short reads
Change-Id: I98a7d77cabe0207ff2b0190ccef47b87d1552930
Diffstat (limited to 'filter')
-rw-r--r-- | filter/source/graphicfilter/icgm/cgm.cxx | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx index cc27666f1f2a..7f17fd466290 100644 --- a/filter/source/graphicfilter/icgm/cgm.cxx +++ b/filter/source/graphicfilter/icgm/cgm.cxx @@ -662,7 +662,8 @@ bool CGM::Write( SvStream& rIStm ) mnParaSize = 0; mpSource = mpBuf; - rIStm.Read( mpSource, 2 ); + if (rIStm.Read(mpSource, 2) != 2) + return false; mnEscape = ImplGetUI16(); mnElementClass = mnEscape >> 12; mnElementID = ( mnEscape & 0x0fe0 ) >> 5; @@ -670,12 +671,16 @@ bool CGM::Write( SvStream& rIStm ) if ( mnElementSize == 31 ) { - rIStm.Read( mpSource + mnParaSize, 2 ); + if (rIStm.Read(mpSource + mnParaSize, 2) != 2) + return false; mnElementSize = ImplGetUI16(); } mnParaSize = 0; - if ( mnElementSize ) - rIStm.Read( mpSource + mnParaSize, mnElementSize ); + if (mnElementSize) + { + if (rIStm.Read(mpSource + mnParaSize, mnElementSize) != mnElementSize) + return false; + } if ( mnElementSize & 1 ) rIStm.SeekRel( 1 ); |