| Summary: | [PATCH] [testcase] Formatting of large roman numbers leads to undefined behavior | ||
|---|---|---|---|
| Product: | [Applications] konqueror | Reporter: | Roland Illig <roland.illig> |
| Component: | khtml | Assignee: | Konqueror Bugs <konqueror-bugs-null> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | maksim |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | NetBSD pkgsrc | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | testcase | ||
Thanks for the patch. Any place on the web actually use that, or should I stop being lazy and make a testcase? ;-) Created attachment 14102 [details]
testcase
Forgot to confirm. 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 > 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 < 1) return QString::number(number);
+ if (number < 1 || number > 3999) return QString::number(number);
QString roman;
static const QChar ldigits[] = { 'i', 'v', 'x', 'l', 'c', 'd', 'm' };
static const QChar udigits[] = { 'I', 'V', 'X', 'L', 'C', 'D', 'M' };
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 |
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 < 1) return QString::number(number); + if (number < 1 || number > 3999) return QString::number(number); QString roman; static const QChar ldigits[] = { 'i', 'v', 'x', 'l', 'c', 'd', 'm' }; static const QChar udigits[] = { 'I', 'V', 'X', 'L', 'C', 'D', 'M' };