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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Dec 22 14:08:44 UTC 2020


 filter/source/graphicfilter/itga/itga.cxx |   15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

New commits:
commit 45175d655ad3773df1c006182108cf25e87b1091
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue Dec 22 10:33:46 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Dec 22 15:07:41 2020 +0100

    oss-fuzz: tgafuzzer doesn't pass sanity check
    
    Step #5:     #6 0x63cce7f in __cxa_throw (/tmp/not-out/tgafuzzer+0x63cce7f)
    Step #5:     #7 0x4f13aa in SvStream::ReadUInt16(unsigned short&) (/tmp/not-out/tgafuzzer+0x4f13aa)
    Step #5:     #8 0x1d8d9c5 in (anonymous namespace)::TGAReader::ImplReadHeader() (/tmp/not-out/tgafuzzer+0x1d8d9c5)
    Step #5:     #9 0x1d8c9ca in (anonymous namespace)::TGAReader::ReadTGA(Graphic&) (/tmp/not-out/tgafuzzer+0x1d8c9ca)
    Step #5:     #10 0x1d8c598 in itgGraphicImport (/tmp/not-out/tgafuzzer+0x1d8c598)
    
    Change-Id: I1b01435d07d5e553e2941b402d4820836a9dce15
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108158
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx
index beec1bc8781e..bbaee08117eb 100644
--- a/filter/source/graphicfilter/itga/itga.cxx
+++ b/filter/source/graphicfilter/itga/itga.cxx
@@ -18,9 +18,10 @@
  */
 
 
+#include <sal/log.hxx>
+#include <tools/stream.hxx>
 #include <vcl/graph.hxx>
 #include <vcl/BitmapTools.hxx>
-#include <tools/stream.hxx>
 #include <memory>
 
 class FilterConfigItem;
@@ -785,7 +786,17 @@ itgGraphicImport( SvStream & rStream, Graphic & rGraphic, FilterConfigItem* )
 {
     TGAReader aTGAReader(rStream);
 
-    return aTGAReader.ReadTGA(rGraphic);
+    bool bRet;
+    try
+    {
+        bRet = aTGAReader.ReadTGA(rGraphic);
+    }
+    catch (const SvStreamEOFException&)
+    {
+        SAL_WARN("filter.tga", "EOF");
+        bRet = false;
+    }
+    return bRet;
 }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */


More information about the Libreoffice-commits mailing list