summaryrefslogtreecommitdiff
path: root/vcl/unx/generic/printer/ppdparser.cxx
diff options
context:
space:
mode:
authorNorbert Thiebaud <nthiebaud@gmail.com>2014-09-11 19:05:19 +0200
committerNorbert Thiebaud <nthiebaud@gmail.com>2014-09-12 01:45:30 +0200
commitf5d3114cc4b62f95bcd3ce3a5a1d859a69603269 (patch)
treede26d778c13fdf7cd31ab9f91f3196eab61b3efb /vcl/unx/generic/printer/ppdparser.cxx
parent5500c51e9bddcf3bb4356ac3e69f4df1043df6c9 (diff)
vcl: protect against out-of-bound access of empty OUString
Change-Id: If2671ba0547eb69fce7005f5427dcd175a5c29a2
Diffstat (limited to 'vcl/unx/generic/printer/ppdparser.cxx')
-rw-r--r--vcl/unx/generic/printer/ppdparser.cxx12
1 files changed, 9 insertions, 3 deletions
diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 606fd550da97..e8e2a7803fd2 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -887,8 +887,14 @@ void PPDParser::parse( ::std::list< OString >& rLines )
sal_Int32 nPos = aKey.indexOf('/');
if (nPos != -1)
aKey = aKey.copy(0, nPos);
- aKey = aKey.copy(1); // remove the '*'
-
+ if(!aKey.isEmpty())
+ {
+ aKey = aKey.copy(1); // remove the '*'
+ }
+ if(aKey.isEmpty())
+ {
+ continue;
+ }
if ((aKey == "CloseUI") ||
(aKey == "JCLCloseUI") ||
(aKey == "OpenGroup") ||
@@ -1245,7 +1251,7 @@ void PPDParser::parseConstraint( const OString& rLine )
for( int i = 0; i < nTokens; i++ )
{
OUString aToken = GetCommandLineToken( i, aLine );
- if( aToken[ 0 ] == '*' )
+ if( !aToken.isEmpty() && aToken[ 0 ] == '*' )
{
aToken = aToken.replaceAt( 0, 1, "" );
if( aConstraint.m_pKey1 )