[Libreoffice-commits] core.git: 2 commits - filter/source

Caolán McNamara caolanm at redhat.com
Tue Feb 14 11:35:20 UTC 2017


 filter/source/graphicfilter/iras/iras.cxx |   19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

New commits:
commit dfc58d2db77c205e5829d557045eb8f6801a664d
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 14 11:33:44 2017 +0000

    check data needed to fulfil ras claims before allocating
    
    Change-Id: Ifdd820e4ea4287f97cc07cb86c0a180d06081449

diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx
index 3fb27e5..30d618e 100644
--- a/filter/source/graphicfilter/iras/iras.cxx
+++ b/filter/source/graphicfilter/iras/iras.cxx
@@ -168,6 +168,14 @@ bool RASReader::ReadRAS(Graphic & rGraphic)
     if (!bOk)
         return false;
 
+    if (mnType != RAS_TYPE_BYTE_ENCODED) //simple raw format
+    {
+        if (m_rRAS.remainingSize() < static_cast<sal_uInt64>(mnHeight) * mnWidth * mnDepth / 8)
+        {
+            return false;
+        }
+    }
+
     Bitmap aBmp(Size(mnWidth, mnHeight), mnDstBitsPerPix);
     Bitmap::ScopedWriteAccess pAcc(aBmp);
     if (pAcc == nullptr)
@@ -178,6 +186,7 @@ bool RASReader::ReadRAS(Graphic & rGraphic)
         pAcc->SetPalette(aPalette);
     }
 
+
     // Bitmap-Daten einlesen
     mbStatus = ImplReadBody(pAcc.get());
 
@@ -191,7 +200,7 @@ bool RASReader::ImplReadHeader()
 {
     m_rRAS.ReadInt32(mnWidth).ReadInt32(mnHeight).ReadInt32(mnDepth).ReadInt32(mnImageDatSize).ReadInt32(mnType).ReadInt32(mnColorMapType).ReadInt32(mnColorMapSize);
 
-    if (mnWidth <= 0 || mnHeight <= 0 || mnImageDatSize <= 0 || !m_rRAS.good())
+    if (!m_rRAS.good() || mnWidth <= 0 || mnHeight <= 0 || mnImageDatSize <= 0)
         mbStatus = false;
 
     switch ( mnDepth )
@@ -223,7 +232,6 @@ bool RASReader::ImplReadHeader()
     return mbStatus;
 }
 
-
 bool RASReader::ImplReadBody(BitmapWriteAccess * pAcc)
 {
     sal_Int32 x, y;
commit 5e4fb242789f619b66fad4392df4079f6c4863dc
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Tue Feb 14 10:41:24 2017 +0000

    this is already checked for
    
    Change-Id: I01af66bfdcbee0a3d63a17c0a19fdd3c02d4acdc

diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx
index 1cc6cd2..3fb27e5 100644
--- a/filter/source/graphicfilter/iras/iras.cxx
+++ b/filter/source/graphicfilter/iras/iras.cxx
@@ -105,13 +105,6 @@ bool RASReader::ReadRAS(Graphic & rGraphic)
     if ( !mbStatus )
         return false;
 
-    if (mnDstBitsPerPix != 1 &&
-        mnDstBitsPerPix != 8 &&
-        mnDstBitsPerPix != 24)
-    {
-        return false;
-    }
-
     bool bPalette(false);
     BitmapPalette aPalette;
 


More information about the Libreoffice-commits mailing list