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

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>119352</bug_id>
          
          <creation_ts>2006-01-02 01:17:37 +0000</creation_ts>
          <short_desc>[PATCH] [testcase] Formatting of large roman numbers leads to undefined behavior</short_desc>
          <delta_ts>2006-01-19 18:59:01 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>konqueror</product>
          <component>khtml</component>
          <version>unspecified</version>
          <rep_platform>NetBSD pkgsrc</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Roland Illig">roland.illig</reporter>
          <assigned_to name="Konqueror Bugs">konqueror-bugs-null</assigned_to>
          <cc>maksim</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>402984</commentid>
    <comment_count>0</comment_count>
    <who name="Roland Illig">roland.illig</who>
    <bug_when>2006-01-02 01:17:37 +0000</bug_when>
    <thetext>Version:            (using KDE KDE 3.5.0)
Installed from:    NetBSD pkgsrc
Compiler:          any 

This patch fixes the undefined behavior when formatting big numbers in
roman.

--- khtml/rendering/enumerate.cpp.orig  Mon Oct 10 17:06:06 2005
+++ khtml/rendering/enumerate.cpp       Sun Jan  1 22:07:12 2006
@@ -34,7 +34,7 @@ namespace Enumerate {
 
 QString toRoman( int number, bool upper )
 {
-    if (number &lt; 1) return QString::number(number);
+    if (number &lt; 1 || number &gt; 3999) return QString::number(number);
     QString roman;
     static const QChar ldigits[] = { &apos;i&apos;, &apos;v&apos;, &apos;x&apos;, &apos;l&apos;, &apos;c&apos;, &apos;d&apos;, &apos;m&apos; };
     static const QChar udigits[] = { &apos;I&apos;, &apos;V&apos;, &apos;X&apos;, &apos;L&apos;, &apos;C&apos;, &apos;D&apos;, &apos;M&apos; };</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>402985</commentid>
    <comment_count>1</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2006-01-02 01:21:58 +0000</bug_when>
    <thetext>Thanks for the patch. Any place on the web actually use that, or should I stop being lazy and make a testcase? ;-)
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>402988</commentid>
    <comment_count>2</comment_count>
      <attachid>14102</attachid>
    <who name="Thiago Macieira">thiago</who>
    <bug_when>2006-01-02 01:35:07 +0000</bug_when>
    <thetext>Created attachment 14102
testcase</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>402989</commentid>
    <comment_count>3</comment_count>
    <who name="Thiago Macieira">thiago</who>
    <bug_when>2006-01-02 01:35:40 +0000</bug_when>
    <thetext>Forgot to confirm.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>407470</commentid>
    <comment_count>4</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2006-01-19 18:53:06 +0000</bug_when>
    <thetext>SVN commit 500228 by orlovich:

Apply patch from Roland Illig (roland dot illig at the host gmx with tld de) 
to behave sanely for Roman counters &gt; 4000
BUG:119352



 M  +1 -1      enumerate.cpp  


--- branches/KDE/3.5/kdelibs/khtml/rendering/enumerate.cpp #500227:500228
@@ -34,7 +34,7 @@
 
 QString toRoman( int number, bool upper )
 {
-    if (number &lt; 1) return QString::number(number);
+    if (number &lt; 1 || number &gt; 3999) return QString::number(number);
     QString roman;
     static const QChar ldigits[] = { &apos;i&apos;, &apos;v&apos;, &apos;x&apos;, &apos;l&apos;, &apos;c&apos;, &apos;d&apos;, &apos;m&apos; };
     static const QChar udigits[] = { &apos;I&apos;, &apos;V&apos;, &apos;X&apos;, &apos;L&apos;, &apos;C&apos;, &apos;D&apos;, &apos;M&apos; };
</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>407472</commentid>
    <comment_count>5</comment_count>
    <who name="Maksim Orlovich">maksim</who>
    <bug_when>2006-01-19 18:59:00 +0000</bug_when>
    <thetext>SVN commit 500230 by orlovich:

Regression test for #119352
CCBUG:119352


 A             baseline/unsorted/119352.html-dom  
 AM            baseline/unsorted/119352.html-dump.png  
 A             baseline/unsorted/119352.html-render  
 A             tests/unsorted/119352.html  


** trunk/tests/khtmltests/regression/baseline/unsorted/119352.html-dump.png #property svn:mime-type
   + application/octet-stream
</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>14102</attachid>
            <date>2006-01-02 01:35:07 +0000</date>
            <delta_ts>2006-01-02 01:35:07 +0000</delta_ts>
            <desc>testcase</desc>
            <filename>test.html</filename>
            <type>text/html</type>
            <size>427</size>
            <attacher name="Thiago Macieira">thiago</attacher>
            
              <data encoding="base64">PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPCFET0NUWVBFIGh0bWwgCiAg
ICAgUFVCTElDICItLy9XM0MvL0RURCBYSFRNTCAxLjAgVHJhbnNpdGlvbmFsLy9FTiIKICAgICAi
RFREL3hodG1sMS10cmFuc2l0aW9uYWwuZHRkIj4KPGh0bWwgeG1sbnM9Imh0dHA6Ly93d3cudzMu
b3JnLzE5OTkveGh0bWwiIHhtbDpsYW5nPSJlbiIgbGFuZz0iZW4iPgogIDxoZWFkPgogICAgPHRp
dGxlPnRlc3RjYXNlPC90aXRsZT4KICA8L2hlYWQ+CiAgPGJvZHk+CiAgICA8b2wgc3RhcnQ9IjM5
OTgiIHR5cGU9IkkiPgogICAgICA8bGk+Mzk5ODwvbGk+CiAgICAgIDxsaT4zOTk5PC9saT4KICAg
ICAgPGxpPjQwMDA8L2xpPgogICAgICA8bGk+NDAwMTwvbGk+CiAgICAgIDxsaT40MDAyPC9saT4K
ICAgIDwvb2w+CiAgPC9ib2R5Pgo8L2h0bWw+Cg==
</data>

          </attachment>
      

    </bug>

</bugzilla>