summaryrefslogtreecommitdiff
path: root/filter/source/graphicfilter/icgm/cgm.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'filter/source/graphicfilter/icgm/cgm.cxx')
-rw-r--r--filter/source/graphicfilter/icgm/cgm.cxx8
1 files changed, 4 insertions, 4 deletions
diff --git a/filter/source/graphicfilter/icgm/cgm.cxx b/filter/source/graphicfilter/icgm/cgm.cxx
index 30804b06845f..d15923084ccc 100644
--- a/filter/source/graphicfilter/icgm/cgm.cxx
+++ b/filter/source/graphicfilter/icgm/cgm.cxx
@@ -101,7 +101,7 @@ sal_uInt32 CGM::GetBackGroundColor()
sal_uInt32 CGM::ImplGetUI16( sal_uInt32 /*nAlign*/ )
{
sal_uInt8* pSource = mpSource + mnParaSize;
- if (pSource + 2 > mpEndValidSource)
+ if (mpEndValidSource - pSource < 2)
throw css::uno::Exception("attempt to read past end of input", nullptr);
mnParaSize += 2;
return ( pSource[ 0 ] << 8 ) + pSource[ 1 ];
@@ -115,7 +115,7 @@ sal_uInt8 CGM::ImplGetByte( sal_uInt32 nSource, sal_uInt32 nPrecision )
sal_Int32 CGM::ImplGetI( sal_uInt32 nPrecision )
{
sal_uInt8* pSource = mpSource + mnParaSize;
- if (pSource + nPrecision > mpEndValidSource)
+ if (static_cast<sal_uIntPtr>(mpEndValidSource - pSource) < nPrecision)
throw css::uno::Exception("attempt to read past end of input", nullptr);
mnParaSize += nPrecision;
switch( nPrecision )
@@ -147,7 +147,7 @@ sal_Int32 CGM::ImplGetI( sal_uInt32 nPrecision )
sal_uInt32 CGM::ImplGetUI( sal_uInt32 nPrecision )
{
sal_uInt8* pSource = mpSource + mnParaSize;
- if (pSource + nPrecision > mpEndValidSource)
+ if (static_cast<sal_uIntPtr>(mpEndValidSource - pSource) < nPrecision)
throw css::uno::Exception("attempt to read past end of input", nullptr);
mnParaSize += nPrecision;
switch( nPrecision )
@@ -202,7 +202,7 @@ double CGM::ImplGetFloat( RealPrecision eRealPrecision, sal_uInt32 nRealSize )
const bool bCompatible = false;
#endif
- if (mpSource + mnParaSize + nRealSize > mpEndValidSource)
+ if (static_cast<sal_uIntPtr>(mpEndValidSource - (mpSource + mnParaSize)) < nRealSize)
throw css::uno::Exception("attempt to read past end of input", nullptr);
if ( bCompatible )