[Libreoffice-commits] .: vcl/unx

Caolán McNamara caolan at kemper.freedesktop.org
Thu Feb 23 06:10:55 PST 2012


 vcl/unx/generic/printer/ppdparser.cxx |   12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

New commits:
commit 825d31d5f11364bea4184cabb538f8b6575d5795
Author: Caolán McNamara <caolanm at redhat.com>
Date:   Thu Feb 23 14:10:15 2012 +0000

    ensure ppd translation indexes are valid

diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx
index 22d73db..bbb31f0 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;
             }
         }


More information about the Libreoffice-commits mailing list