From 825d31d5f11364bea4184cabb538f8b6575d5795 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Thu, 23 Feb 2012 14:10:15 +0000 Subject: ensure ppd translation indexes are valid --- vcl/unx/generic/printer/ppdparser.cxx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'vcl/unx') 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; } } -- cgit