rmcilroy / octane-benchmark

Automatically exported from code.google.com/p/octane-benchmark
0 stars 0 forks source link

Out of bounds array access in Regexp #21

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
The Regexp benchmark has an out-of-bounds error that results in checking 
whether "undefined" matches some regular expression. The problem is that the 
arrays s45 and s46 have a different length, but they are always used together, 
assuming that their lengths are the same. As a result, line 77 passes 
"undefined" to RegExp.exec(), which results in an array that contains the 
string "undefined" multiple times.

The problem doesn't crash the benchmark but it's doing a nonsense computation. 
To fix the problem, just change the number of variants in one of the two arrays 
s45 and s46, so that they have the same length.

Attached is a patch with a fix. 

Original issue reported on code.google.com by mich...@binaervarianz.de on 5 Jun 2014 at 4:33

Attachments: