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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Sep 3 10:04:55 UTC 2021


 vcl/source/filter/GraphicFormatDetector.cxx |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

New commits:
commit c06bc8cf1b3e1057eb846605b61570bb1f3713da
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Sep 2 20:16:39 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Sep 3 12:04:22 2021 +0200

    ofz: MemorySanitizer: use-of-uninitialized-value
    
    Change-Id: I6a8dd39528038fbcc496e56d6fcefc4ec8db68cf
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121536
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/vcl/source/filter/GraphicFormatDetector.cxx b/vcl/source/filter/GraphicFormatDetector.cxx
index df7cc1fb03d4..264e6d9136c6 100644
--- a/vcl/source/filter/GraphicFormatDetector.cxx
+++ b/vcl/source/filter/GraphicFormatDetector.cxx
@@ -299,13 +299,17 @@ bool isPCT(SvStream& rStream, sal_uLong nStreamPos, sal_uLong nStreamLen)
         rStream.ReadInt16(y1).ReadInt16(x1).ReadInt16(y2).ReadInt16(x2);
         rStream.SetEndian(oldNumberFormat); // reset format
 
+        // read version op
+        rStream.ReadBytes(sBuf, 3);
+
+        if (!rStream.good())
+            break;
+
         if (x1 > x2 || y1 > y2 || // bad bdbox
             (x1 == x2 && y1 == y2) || // 1 pixel picture
             x2 - x1 > 2048 || y2 - y1 > 2048) // picture abnormally big
             bdBoxOk = false;
 
-        // read version op
-        rStream.ReadBytes(sBuf, 3);
         // see http://developer.apple.com/legacy/mac/library/documentation/mac/pdf/Imaging_With_QuickDraw/Appendix_A.pdf
         // normal version 2 - page A23 and A24
         if (sBuf[0] == 0x00 && sBuf[1] == 0x11 && sBuf[2] == 0x02)


More information about the Libreoffice-commits mailing list