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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Tue Aug 31 09:48:00 UTC 2021


 vcl/source/filter/imet/ios2met.cxx |   13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

New commits:
commit 203cc17337702e0ae50d120aae1e18f8ce649ee7
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Aug 30 12:53:15 2021 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Tue Aug 31 11:47:26 2021 +0200

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

diff --git a/vcl/source/filter/imet/ios2met.cxx b/vcl/source/filter/imet/ios2met.cxx
index aaf6f0fd2282..5be33dbc6f55 100644
--- a/vcl/source/filter/imet/ios2met.cxx
+++ b/vcl/source/filter/imet/ios2met.cxx
@@ -2343,7 +2343,6 @@ void OS2METReader::ReadImageData(sal_uInt16 nDataID, sal_uInt16 nDataLen)
 
 void OS2METReader::ReadFont(sal_uInt16 nFieldSize)
 {
-    sal_uInt8 nByte, nTripType, nTripType2;
     OSFont * pF=new OSFont;
     pF->pSucc=pFontList; pFontList=pF;
     pF->nID=0;
@@ -2353,17 +2352,21 @@ void OS2METReader::ReadFont(sal_uInt16 nFieldSize)
     auto nPos=pOS2MET->Tell();
     auto nMaxPos = nPos + nFieldSize;
     pOS2MET->SeekRel(2); nPos+=2;
-    while (nPos<nMaxPos && pOS2MET->GetError()==ERRCODE_NONE) {
-        pOS2MET->ReadUChar( nByte );
+    while (nPos<nMaxPos && pOS2MET->good()) {
+        sal_uInt8 nByte(0);
+        pOS2MET->ReadUChar(nByte);
         sal_uInt16 nLen = static_cast<sal_uInt16>(nByte) & 0x00ff;
         if (nLen == 0)
         {
             pOS2MET->SetError(SVSTREAM_FILEFORMAT_ERROR);
             ErrorCode=4;
         }
+        sal_uInt8 nTripType(0);
         pOS2MET->ReadUChar( nTripType );
         switch (nTripType) {
             case 0x02:
+            {
+                sal_uInt8 nTripType2(0);
                 pOS2MET->ReadUChar( nTripType2 );
                 switch (nTripType2) {
                     case 0x84:   // Font name
@@ -2381,7 +2384,10 @@ void OS2METReader::ReadFont(sal_uInt16 nFieldSize)
                     }
                 }
                 break;
+            }
             case 0x24:   // Icid
+            {
+                sal_uInt8 nTripType2(0);
                 pOS2MET->ReadUChar( nTripType2 );
                 switch (nTripType2) {
                     case 0x05:   //Icid
@@ -2390,6 +2396,7 @@ void OS2METReader::ReadFont(sal_uInt16 nFieldSize)
                         break;
                 }
                 break;
+            }
             case 0x20:   // Font Binary GCID
                 break;
             case 0x1f: { // Font Attributes


More information about the Libreoffice-commits mailing list