[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/libs/kotext/styles
From:       Thomas Zander <zander () kde ! org>
Date:       2010-12-18 9:44:15
Message-ID: 20101218094415.CC3693E203 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1207480 by zander:

Parse invalid odf a bit more sanely.

Make sure that invalid formatted or negative values are rejected.

 M  +9 -6      KoParagraphStyle.cpp  


--- trunk/koffice/libs/kotext/styles/KoParagraphStyle.cpp #1207479:1207480
@@ -1080,15 +1080,18 @@
     if (!lineHeight.isEmpty()) {
         if (lineHeight != "normal") {
             if (lineHeight.indexOf('%') > -1) { // percent value
-                setLineHeightPercent(lineHeight.remove('%').toInt());
+                const int lh = lineHeight.remove('%').toInt();
+                if (lh > 0) // invalid conversions are 0, negative heights are invalid too.
+                    setLineHeightPercent(lh);
+            } else  { // fixed value
+                const qreal lh = KoUnit::parseValue(lineHeight);
+                if (lh > 0) // invalid conversions are 0, negative heights are invalid too.
+                    setLineHeightAbsolute(lh);
             }
-            else  { // fixed value
-                setLineHeightAbsolute(KoUnit::parseValue(lineHeight));
+        } else {
+            normalLineHeight = true;
             }
         }
-        else
-            normalLineHeight = true;
-    }
     else {
         const QString lineSpacing(styleStack.property(KoXmlNS::style, "line-spacing"));
         if (!lineSpacing.isEmpty()) {    // 3.11.3
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic