<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>22321</bug_id>
          
          <creation_ts>2008-11-17 12:48:11 -0800</creation_ts>
          <short_desc>SVGFonts and SVGRootInlineBox broken for RTL text (fonts-glyph-02-t.svg causes an ASSERT)</short_desc>
          <delta_ts>2008-11-18 04:43:09 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>SVG</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>PC</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>18830</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Holger Freyther">zecke</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>99085</commentid>
    <comment_count>0</comment_count>
    <who name="Holger Freyther">zecke</who>
    <bug_when>2008-11-17 12:48:11 -0800</bug_when>
    <thetext>Revision r31310 introduced extraCharsAvailable to be able to do ligatures, etc. There is a slight bug that leads to create a String from UChar* which reads beyond the bounds.

SVGTextRunWalker::walk
   ASSERT(to + from == run.length());
   ^^^^
   const int endOfScanRange = to + m_walkerData.extraCharsAvailable;
   for (int i = from; i &lt; to; ++i) {
       characterLookupRange = endOfScanRange - i;
       String lookupString(run.data(i), characterLookupRange);
                                        ^^^^ &lt;- out of bounds now



SVGRootInlineBox::buildLayoutInformationForTextBox
  int extraCharsAvailable = length - i - 1;
  if (textBox-&gt;direction() == RTL) {
            glyphWidth = svgTextBox-&gt;calculateGlyphWidth(style, textBox-&gt;end() - i, extraCharsAvailable, charsConsumed, glyphName);
            glyphHeight = svgTextBox-&gt;calculateGlyphHeight(style, textBox-&gt;end() - i, extraCharsAvailable);
            unicodeStr = String(textBox-&gt;textObject()-&gt;text()-&gt;characters() + textBox-&gt;end() - i, charsConsumed);

extraCharsAvailable is wrong, or at least wrong in the future. In SVGFont it gets treated as how many chars are available to the right.. but in the first iteration in the above loop:
   i = 0
   textBox-&gt;end() == length-1;

but we travel the text from right to left. This means in the first loop there is not extra char available?! in the next one...?


Also SVGInlineTextBox::calculateGlyphWidth looks really weird:
   A Text run with size one is created but we pass the extraCharsAvailable... this will work for LTR text but with RTL text (as in the above test case) we will read out of the bounds of the string.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99086</commentid>
    <comment_count>1</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-11-17 12:52:12 -0800</bug_when>
    <thetext>Per svn log, this is tracked as bug 18830.

*** This bug has been marked as a duplicate of 18830 ***</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99088</commentid>
    <comment_count>2</comment_count>
      <attachid>25223</attachid>
    <who name="Holger Freyther">zecke</who>
    <bug_when>2008-11-17 12:56:09 -0800</bug_when>
    <thetext>Created attachment 25223
Fix the symptopms.... 

Setting the review flag out of selfish motives to make sure people see that bug and poke me into the right direction.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99147</commentid>
    <comment_count>3</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2008-11-18 03:52:32 -0800</bug_when>
    <thetext>This bug is showing up in review queue, can the review flag be cleared now?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>99149</commentid>
    <comment_count>4</comment_count>
      <attachid>25223</attachid>
    <who name="Holger Freyther">zecke</who>
    <bug_when>2008-11-18 04:43:09 -0800</bug_when>
    <thetext>Comment on attachment 25223
Fix the symptopms.... 

Clearing review flag... it is a duplicate and mitz knows the issue for quite some time.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>25223</attachid>
            <date>2008-11-17 12:56:09 -0800</date>
            <delta_ts>2008-11-18 04:43:09 -0800</delta_ts>
            <desc>Fix the symptopms.... </desc>
            <filename>fix-symptoms.diff</filename>
            <type>text/plain</type>
            <size>677</size>
            <attacher name="Holger Freyther">zecke</attacher>
            
              <data encoding="base64">ZGlmZiAtLWdpdCBhL1dlYkNvcmUvc3ZnL1NWR0ZvbnQuY3BwIGIvV2ViQ29yZS9zdmcvU1ZHRm9u
dC5jcHAKaW5kZXggMTRhZDVlYS4uODhjY2Q0NiAxMDA2NDQKLS0tIGEvV2ViQ29yZS9zdmcvU1ZH
Rm9udC5jcHAKKysrIGIvV2ViQ29yZS9zdmcvU1ZHRm9udC5jcHAKQEAgLTI3MCw3ICsyNzAsNyBA
QCBzdHJ1Y3QgU1ZHVGV4dFJ1bldhbGtlciB7CiAgICAgICAgICAgICAvLyBleHRlbmRlZCB0byB0
aGUgbi10aCBuZXh0IGNoYXJhY3RlciAod2hlcmUgbiBpcyAnY2hhcmFjdGVyTG9va3VwUmFuZ2Un
KSwgdG8gY2hlY2sgZm9yIGFueSBwb3NzaWJsZSBsaWdhdHVyZS4KICAgICAgICAgICAgIGNoYXJh
Y3Rlckxvb2t1cFJhbmdlID0gZW5kT2ZTY2FuUmFuZ2UgLSBpOwogCi0gICAgICAgICAgICBTdHJp
bmcgbG9va3VwU3RyaW5nKHJ1bi5kYXRhKGkpLCBjaGFyYWN0ZXJMb29rdXBSYW5nZSk7CisgICAg
ICAgICAgICBTdHJpbmcgbG9va3VwU3RyaW5nKHJ1bi5kYXRhKGkpLCBzdGQ6Om1pbihjaGFyYWN0
ZXJMb29rdXBSYW5nZSwgcnVuLmxlbmd0aCgpLWkpKTsKICAgICAgICAgICAgIFZlY3RvcjxTVkdH
bHlwaElkZW50aWZpZXI+IGdseXBoczsKICAgICAgICAgICAgIGlmIChoYXZlQWx0R2x5cGgpCiAg
ICAgICAgICAgICAgICAgZ2x5cGhzLmFwcGVuZChhbHRHbHlwaElkZW50aWZpZXIpOwo=
</data>

          </attachment>
      

    </bug>

</bugzilla>