diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-02-23 14:10:15 +0000 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-02-23 14:10:15 +0000 |
commit | 825d31d5f11364bea4184cabb538f8b6575d5795 (patch) | |
tree | 5155e6682eb4fa943392531972c5b71a4ef6c18d /vcl/unx | |
parent | 84cc2688f429ef915810a3799f46ae98293096a6 (diff) |
ensure ppd translation indexes are valid
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/generic/printer/ppdparser.cxx | 12 |
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; } } |