svx/source/gallery2/codec.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit 910d67e442953f7da669157fe678f764c9623121
Author:     Caolán McNamara <caolan.mcnam...@collabora.com>
AuthorDate: Mon Nov 4 11:37:13 2024 +0000
Commit:     Caolán McNamara <caolan.mcnam...@collabora.com>
CommitDate: Mon Nov 4 14:06:27 2024 +0100

    check stream state
    
    Change-Id: Ic79b14565e4c84cfeb8ce87994ed45fcb45df4a3
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/176005
    Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com>
    Tested-by: Jenkins

diff --git a/svx/source/gallery2/codec.cxx b/svx/source/gallery2/codec.cxx
index 19e2a92cb548..76cf35c74023 100644
--- a/svx/source/gallery2/codec.cxx
+++ b/svx/source/gallery2/codec.cxx
@@ -38,7 +38,7 @@ bool GalleryCodec::IsCoded( SvStream& rStm, sal_uInt32& 
rVersion )
 
     rStm.ReadUChar( cByte1 ).ReadUChar( cByte2 ).ReadUChar( cByte3 
).ReadUChar( cByte4 ).ReadUChar( cByte5 ).ReadUChar( cByte6 );
 
-    if ( cByte1 == 'S' && cByte2 == 'V' && cByte3 == 'R' && cByte4 == 'L' && 
cByte5 == 'E' && ( cByte6 == '1' || cByte6 == '2' ) )
+    if (rStm.good() && cByte1 == 'S' && cByte2 == 'V' && cByte3 == 'R' && 
cByte4 == 'L' && cByte5 == 'E' && ( cByte6 == '1' || cByte6 == '2' ) )
     {
         rVersion = ( ( cByte6 == '1' ) ? 1 : 2 );
         bRet = true;

Reply via email to