vcl/source/filter/jpeg/Exif.cxx |    9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

New commits:
commit f335e5b73193912a2ceda2e577093e80e98e27a7
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Oct 10 21:43:25 2025 +0100
Commit:     Adolfo Jayme Barrientos <[email protected]>
CommitDate: Sun Oct 12 21:08:14 2025 +0200

    ofz Use-of-uninitialized-value
    
    Change-Id: I3dfc1296e174d6751300991f214e99b09d745e5c
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/192189
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <[email protected]>

diff --git a/vcl/source/filter/jpeg/Exif.cxx b/vcl/source/filter/jpeg/Exif.cxx
index 469281bdcc85..8d4ee9388029 100644
--- a/vcl/source/filter/jpeg/Exif.cxx
+++ b/vcl/source/filter/jpeg/Exif.cxx
@@ -81,13 +81,12 @@ void Exif::write(SvStream& rStream)
 
 bool Exif::processJpeg(SvStream& rStream, bool bSetValue)
 {
-    sal_uInt16  aMagic16;
-    sal_uInt16  aLength;
-
     sal_uInt64 aSize = rStream.TellEnd();
     rStream.Seek(STREAM_SEEK_TO_BEGIN);
 
     rStream.SetEndian( SvStreamEndian::BIG );
+
+    sal_uInt16 aMagic16(0);
     rStream.ReadUInt16( aMagic16 );
 
     // Compare JPEG magic bytes
@@ -101,9 +100,8 @@ bool Exif::processJpeg(SvStream& rStream, bool bSetValue)
     while(true)
     {
         sal_uInt8 aMarker = 0xD9;
-        sal_Int32 aCount;
 
-        for (aCount = 0; aCount < 7; aCount++)
+        for (sal_Int32 aCount = 0; aCount < 7; aCount++)
         {
             rStream.ReadUChar( aMarker );
             if (aMarker != 0xFF)
@@ -116,6 +114,7 @@ bool Exif::processJpeg(SvStream& rStream, bool bSetValue)
             }
         }
 
+        sal_uInt16 aLength(0);
         rStream.ReadUInt16( aLength );
 
         if (aLength < 8 || aLength > rStream.remainingSize())

Reply via email to