[Libreoffice-commits] core.git: Branch 'libreoffice-5-4' - starmath/source

Caolán McNamara caolanm at redhat.com
Mon Sep 18 10:27:50 UTC 2017


 starmath/source/smdetect.cxx |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit e577828583bbebc1fbfdb8960aa45a0b634cd5f8
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Sun Sep 17 14:22:45 2017 +0100

    valgrind: Conditional jump or move depends on uninitialised value
    
     Conditional jump or move depends on uninitialised value(s)
        at 0x4C3535E: strstr (vg_replace_strmem.c:1623)
        by 0x4FCD9E59: SmFilterDetect::detect(com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue>&) (smdetect.cxx:102)
        by 0x41A1A774: filter::config::TypeDetection::impl_askDetectService(rtl::OUString const&, utl::MediaDescriptor&) (typedetection.cxx:1038)
    
    Change-Id: I2f98fd3f7799f34cb5bd9242379ce6440645034d
    Reviewed-on: https://gerrit.libreoffice.org/42381
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 64aa36e8b999ea4dcad69904da941705effad618)
    Reviewed-on: https://gerrit.libreoffice.org/42386
    Reviewed-by: Michael Stahl <mstahl at redhat.com>
    Tested-by: Michael Stahl <mstahl at redhat.com>

diff --git a/starmath/source/smdetect.cxx b/starmath/source/smdetect.cxx
index 55283530e86a..8e2953b34227 100644
--- a/starmath/source/smdetect.cxx
+++ b/starmath/source/smdetect.cxx
@@ -93,12 +93,12 @@ OUString SAL_CALL SmFilterDetect::detect( Sequence< PropertyValue >& lDescriptor
         // stuff I hope?
         static const sal_uInt16 nBufferSize = 200;
         char aBuffer[nBufferSize+1];
-        aBuffer[nBufferSize] = 0;
         pInStrm->Seek( STREAM_SEEK_TO_BEGIN );
         pInStrm->StartReadingUnicodeText( RTL_TEXTENCODING_DONTKNOW ); // avoid BOM marker
         sal_uLong nBytesRead = pInStrm->ReadBytes( aBuffer, nBufferSize );
         if (nBytesRead >= 6)
         {
+            aBuffer[nBytesRead] = 0;
             bool bIsMathType = false;
             if (0 == strncmp( "<?xml", aBuffer, 5))
                 bIsMathType = (strstr( aBuffer, "<math>" ) ||


More information about the Libreoffice-commits mailing list