Status: New
Owner: ----

New issue 775 by vlovich: ScriptData::Precompile crashes when given a String handle
http://code.google.com/p/v8/issues/detail?id=775

When called with a String handle that isn't an external string, the following code eventually gets called:

v8::internal::PreParse w/ stream = NULL
v8::internal::Parser::PreParseProgram w/ stream = NULL
v8::internal::Scanner::Initialize(Handle<String> source,
                         unibrow::CharacterStream* stream,
                         ParserLanguage language) w/ stream = NULL

v8::internal::Scanner::Init w/ stream = NULL

This gets into the third conditional w/ a NULL stream & crashes when Advance() is scalled on the scanner in that function.

The fix I came up with is:

    if (!stream && !source.is_null()) {
        Initialize(source, start_position, end_position, language);
        return;
    }

within the else condition in Scanner::Init.

The reason I did it this way & not changing PreCompile to call Initialize that properly initializes w/ a safe_string_input_buffer_ is so that there's no performance hit if it is an external string (otherwise safe_string_input_buffer_ is always initialized & reads 256 bytes unnecessarily).

--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to