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

New commits:
commit ba4b5741db25ff3b76a8d10d8f3745dfc1973749
Author: Markus Mohrhard <markus.mohrh...@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 <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

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 ) )
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to