ClosestStorm / v8cgi

Automatically exported from code.google.com/p/v8cgi
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

exception thrown std::out_of_range #6

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. scons v8path=../../V8/trunk/ fcgi=0 gd=0 mysql=0 module=0
conffile=./v8cgi.conf
2. cd example/
3. ./example.js

What is the expected output? 
the ouput generated by example.js

What do you see instead?
./example.js 
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::erase

Using latest trunks of v8cgi and v8 (on April 19, 2009)

Maybe related to previous issue i opened ?

Original issue reported on code.google.com by holisme on 19 Apr 2009 at 9:03

GoogleCodeExporter commented 9 years ago
the bug happens in js_path.cc, line 40, in function
std::string path_normalize(std::string path, std::string base)

all cases are not properly handled.

Original comment by holisme on 19 Apr 2009 at 9:34

GoogleCodeExporter commented 9 years ago
please use
pos -= 1;
instead of 
pos -= 2;

in js_path.cc :

case '/':
case '\\':
    if (state == 0) { state = 1; }
    if (state == 2) { 
        pos -= 1;
        result.erase(pos, 2);
    }
    break;

Original comment by holisme on 19 Apr 2009 at 10:26

GoogleCodeExporter commented 9 years ago
sorry i was not clear enough : the above correction is necessary when using
a path like : ./v8cgi.conf
pos -= 2; is a bug
pos -= 1; fixes it.

Original comment by holisme on 20 Apr 2009 at 6:19

GoogleCodeExporter commented 9 years ago
Fixed in revision 433. Thanks for a report!

Original comment by ondrej.zara on 20 Apr 2009 at 6:33