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

Markus Mohrhard markus.mohrhard at collabora.co.uk
Sun Jan 4 12:52:09 PST 2015


 vcl/source/filter/ixpm/xpmread.cxx |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit cda3b8767fd8f5b43b1043852e9f90fd17a129f4
Author: Markus Mohrhard <markus.mohrhard at collabora.co.uk>
Date:   Sun Dec 28 20:16:17 2014 +0100

    check size before looking into the string
    
    Found by Asan. e.g moz233272-2.xpm
    
    Change-Id: Ic563db41dbd4ce7250492e99f3e48a203cfdcf00
    Reviewed-on: https://gerrit.libreoffice.org/13686
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit ba4b5741db25ff3b76a8d10d8f3745dfc1973749)

diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx
index 3b4b562..81c13f2 100644
--- a/vcl/source/filter/ixpm/xpmread.cxx
+++ b/vcl/source/filter/ixpm/xpmread.cxx
@@ -22,6 +22,7 @@
 #include "rgbtable.hxx"
 #define _XPMPRIVATE
 #include "xpmread.hxx"
+#include <cstring>
 
 XPMReader::XPMReader(SvStream& rStm)
     : mrIStm(rStm)
@@ -342,7 +343,8 @@ bool XPMReader::ImplGetColSub( sal_uInt8* pDest )
             {
                 if ( pRGBTable[ i ].name == NULL )
                     break;
-                if ( pRGBTable[ i ].name[ mnParaSize ] == 0 )
+                if ( std::strlen(pRGBTable[i].name) > mnParaSize &&
+                        pRGBTable[ i ].name[ mnParaSize ] == 0 )
                 {
                     if ( ImplCompare ( (unsigned char*)pRGBTable[ i ].name,
                             mpPara, mnParaSize, XPMCASENONSENSITIVE ) )


More information about the Libreoffice-commits mailing list