diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2014-12-28 20:16:17 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2015-01-04 20:52:36 +0000 |
commit | aac36db32db5c70dbe001d08604b930384033d7c (patch) | |
tree | b5a8b26420c928da94bd65b5c0f62d6cd3fa1df6 | |
parent | fc3bc11324f87d8254924c076d82c74b97520c68 (diff) |
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@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
(cherry picked from commit ba4b5741db25ff3b76a8d10d8f3745dfc1973749)
(cherry picked from commit cda3b8767fd8f5b43b1043852e9f90fd17a129f4)
-rw-r--r-- | vcl/source/filter/ixpm/xpmread.cxx | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx index 04bc86645a8d..bd190489864e 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 ) ) |