[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10421: fix bug in interpretation of
From: |
Sandro Santilli |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10421: fix bug in interpretation of array property names, add a TODO for optimization opportunity |
Date: |
Sun, 14 Dec 2008 02:10:00 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10421
committer: Sandro Santilli <address@hidden>
branch nick: trunk
timestamp: Sun 2008-12-14 02:10:00 +0100
message:
fix bug in interpretation of array property names, add a TODO for
optimization opportunity
modified:
libcore/array.cpp
testsuite/actionscript.all/array.as
=== modified file 'libcore/array.cpp'
--- a/libcore/array.cpp 2008-11-28 08:23:30 +0000
+++ b/libcore/array.cpp 2008-12-14 01:10:00 +0000
@@ -578,6 +578,14 @@
{
const std::string& nameString = _vm.getStringTable().value(name);
+ // Anything not in [0-9] makes this an invalid index
+ if ( nameString.find_first_not_of("0123456789") != std::string::npos )
+ {
+ return -1;
+ }
+
+ // TODO: do we need all this noise ? atol(3) should do !
+
as_value temp;
temp.set_string(nameString);
double value = temp.to_number();
=== modified file 'testsuite/actionscript.all/array.as'
--- a/testsuite/actionscript.all/array.as 2008-09-16 17:45:03 +0000
+++ b/testsuite/actionscript.all/array.as 2008-12-14 01:10:00 +0000
@@ -335,15 +335,15 @@
c[-3] = "minus three";
check_equals (c[0], "zero");
-xcheck_equals (c[1], "one");
+check_equals (c[1], "one");
check_equals (c[1.1], "one point one");
-xcheck_equals (c[1.9], undefined);
+check_equals (c[1.9], undefined);
check_equals (c[-3], "minus three");
check_equals (c[-3.7], undefined);
c[-2147483648] = "lowest int";
check_equals (c[0], "zero");
-xcheck_equals (c[1], "one");
+check_equals (c[1], "one");
// This appears to invalidate integer indices, but
// not non-integer ones.
@@ -379,12 +379,12 @@
c[-3] = "minus three";
check_equals (c[0], "zero");
-xcheck_equals (c[1], "one");
+check_equals (c[1], "one");
// No problem...
c[0xffffffff + 1] = "too high";
check_equals (c[0], "zero");
-xcheck_equals (c[1], "one");
+check_equals (c[1], "one");
check_equals (c[0xffffffff], undefined);
check_equals (c[0xffffffff + 1], "too high");
@@ -394,7 +394,7 @@
// Also no problem. Looks like a fairly crappy bug to me.
c[-2147483650] = "still lower";
check_equals (c[0], "zero");
-xcheck_equals (c[1], "one");
+check_equals (c[1], "one");
xcheck_equals (c.length, 2147483647);
@@ -405,7 +405,7 @@
str += i + ": " + c[i] + "; ";
}
-xcheck_equals(str, "-2147483650: still lower; 2.95147905179353e+20: much too
high; 4294967296: too high; -3: minus three; 1.1: one point one; 3: three; 2:
two; 1: one; 0: zero; ");
+check_equals(str, "-2147483650: still lower; 2.95147905179353e+20: much too
high; 4294967296: too high; -3: minus three; 1.1: one point one; 3: three; 2:
two; 1: one; 0: zero; ");
// Getting 'holes' crawls the inheritance chain !
Array.prototype[3] = 3;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10421: fix bug in interpretation of array property names, add a TODO for optimization opportunity,
Sandro Santilli <=