summaryrefslogtreecommitdiffstats
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2012-02-23 14:10:15 +0000
committerCaolán McNamara <caolanm@redhat.com>2012-02-23 14:10:15 +0000
commit825d31d5f11364bea4184cabb538f8b6575d5795 (patch)
tree5155e6682eb4fa943392531972c5b71a4ef6c18d /vcl
parentRemove unused code as listed in unusedcode.easy (diff)
downloadcore-825d31d5f11364bea4184cabb538f8b6575d5795.tar.gz
core-825d31d5f11364bea4184cabb538f8b6575d5795.zip
ensure ppd translation indexes are valid
Diffstat (limited to 'vcl')
-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 22d73db50b91..bbb31f0514ef 100644
--- a/vcl/unx/generic/printer/ppdparser.cxx
+++ b/vcl/unx/generic/printer/ppdparser.cxx
@@ -1097,9 +1097,14 @@ void PPDParser::parse( ::std::list< rtl::OString >& rLines )
{
aLine = aLine.copy(1);
nTransPos = aLine.indexOf('"');
+ if (nTransPos == -1)
+ nTransPos = aLine.getLength();
aValue = String( aLine.copy( 0, nTransPos ), RTL_TEXTENCODING_MS_1252 );
- // after the second doublequote can follow a / and a translation
- aValueTranslation = handleTranslation( aLine.copy( nTransPos+2 ), bIsGlobalizedLine );
+ if (nTransPos+2 < aLine.getLength())
+ {
+ // after the second doublequote can follow a / and a translation
+ aValueTranslation = handleTranslation( aLine.copy( nTransPos+2 ), bIsGlobalizedLine );
+ }
// check for quoted value
if( aOption.Len() &&
aUniKey.CompareToAscii( "JCL", 3 ) != COMPARE_EQUAL )
@@ -1125,7 +1130,8 @@ void PPDParser::parse( ::std::list< rtl::OString >& rLines )
if (nTransPos == -1)
nTransPos = aLine.getLength();
aValue = String( aLine.copy( 0, nTransPos ), RTL_TEXTENCODING_MS_1252 );
- aValueTranslation = handleTranslation( aLine.copy( nTransPos+1 ), bIsGlobalizedLine );
+ if (nTransPos+1 < aLine.getLength())
+ aValueTranslation = handleTranslation( aLine.copy( nTransPos+1 ), bIsGlobalizedLine );
eType = eString;
}
}