You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xmlgraphics.apache.org by vh...@apache.org on 2009/04/20 12:23:33 UTC

svn commit: r766643 - in /xmlgraphics/commons/trunk: src/java/org/apache/xmlgraphics/fonts/Glyphs.java status.xml

Author: vhennebert
Date: Mon Apr 20 10:23:32 2009
New Revision: 766643

URL: http://svn.apache.org/viewvc?rev=766643&view=rev
Log:
Bugfix: glyph names starting with 'u' but not in the 'official' glyph list could cause a StringIndexOutOfBoundsException because they were parsed as u1234-like unicode values.

Modified:
    xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/fonts/Glyphs.java
    xmlgraphics/commons/trunk/status.xml

Modified: xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/fonts/Glyphs.java
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/fonts/Glyphs.java?rev=766643&r1=766642&r2=766643&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/fonts/Glyphs.java (original)
+++ xmlgraphics/commons/trunk/src/java/org/apache/xmlgraphics/fonts/Glyphs.java Mon Apr 20 10:23:32 2009
@@ -393,10 +393,18 @@
                         pos += 4;
                     }
                 } else if (token.startsWith("u")) {
-                    if (token.length() > 7) {
+                    if (token.length() > 5) {
                         //TODO: Unicode scalar values greater than FFFF are currently not supported
                         return null;
                     }
+                    if (token.length() < 5) {
+                        /*
+                         * This is not in the form of 'u1234' --probably a
+                         * non-official glyph name that isn't listed in the
+                         * unicode map.
+                         */
+                        return null;
+                    }
                     try {
                         sb.append(hexToChar(token.substring(1, 5)));
                     } catch (NumberFormatException nfe) {

Modified: xmlgraphics/commons/trunk/status.xml
URL: http://svn.apache.org/viewvc/xmlgraphics/commons/trunk/status.xml?rev=766643&r1=766642&r2=766643&view=diff
==============================================================================
--- xmlgraphics/commons/trunk/status.xml (original)
+++ xmlgraphics/commons/trunk/status.xml Mon Apr 20 10:23:32 2009
@@ -40,6 +40,10 @@
   </contexts>
   <changes>
     <release version="Trunk" date="n/a">
+      <action context="Code" dev="VH" type="fix">
+        Bugfix: glyph names starting with ‘u’ but not in the ‘official’ glyph list could cause a 
+        StringIndexOutOfBoundsException because they were parsed as u1234-like unicode values.
+      </action>
       <action context="Code" dev="JM" type="add">
         Added 60 seconds expiration for invalid URIs in the image cache to recover from
         temporarily unavailable images.



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: commits-help@xmlgraphics.apache.org