Bug 458679, patch from Gary Kwong, r=myself, a.1.9.0.5=dveditz

git-svn-id: svn://10.0.0.236/trunk@254996 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
igor%mir2.org 2008-11-12 09:43:11 +00:00
parent 8378ce12e0
commit 63e2a5ee3d

View File

@ -813,6 +813,8 @@ GetXMLEntity(JSContext *cx, JSTokenStream *ts)
/* Put the entity, including the '&' already scanned, in ts->tokenbuf. */
offset = PTRDIFF(ts->tokenbuf.ptr, ts->tokenbuf.base, jschar);
FastAppendChar(&ts->tokenbuf, '&');
if (!STRING_BUFFER_OK(&ts->tokenbuf))
return JS_FALSE;
while ((c = GetChar(ts)) != ';') {
if (c == EOF || c == '\n') {
js_ReportCompileErrorNumber(cx, ts, NULL, JSREPORT_ERROR,
@ -820,6 +822,8 @@ GetXMLEntity(JSContext *cx, JSTokenStream *ts)
return JS_FALSE;
}
FastAppendChar(&ts->tokenbuf, (jschar) c);
if (!STRING_BUFFER_OK(&ts->tokenbuf))
return JS_FALSE;
}
/* Let length be the number of jschars after the '&', including the ';'. */
@ -905,6 +909,8 @@ badncr:
msg = JSMSG_BAD_XML_NCR;
bad:
/* No match: throw a TypeError per ECMA-357 10.3.2.1 step 8(a). */
JS_ASSERT(STRING_BUFFER_OK(&ts->tokenbuf));
JS_ASSERT(PTRDIFF(ts->tokenbuf.ptr, bp, jschar) >= 1);
bytes = js_DeflateString(cx, bp + 1,
PTRDIFF(ts->tokenbuf.ptr, bp, jschar) - 1);
if (bytes) {