From 8479515072890b4fcd1b5008d88ce6c279d78986 Mon Sep 17 00:00:00 2001 From: "mrbkap%gmail.com" Date: Fri, 26 Aug 2005 18:34:41 +0000 Subject: [PATCH] bug 305883: Protect against the empty XML list to fix a crash when emitting code for |<>|. Also fix the decompiler to handle XMLLists correctly. r=brendan --- js/src/jsemit.c | 2 +- js/src/jsopcode.c | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/js/src/jsemit.c b/js/src/jsemit.c index 67b62b4f463d..3dfaf5a728c0 100644 --- a/js/src/jsemit.c +++ b/js/src/jsemit.c @@ -4709,7 +4709,7 @@ js_EmitTree(JSContext *cx, JSCodeGenerator *cg, JSParseNode *pn) } JS_ASSERT(pn->pn_type == TOK_XMLLIST || pn->pn_count != 0); - switch (pn->pn_head->pn_type) { + switch (pn->pn_head ? pn->pn_head->pn_type : TOK_XMLLIST) { case TOK_XMLETAGO: JS_ASSERT(0); /* FALL THROUGH */ diff --git a/js/src/jsopcode.c b/js/src/jsopcode.c index 5ca85370ce2c..6d75b40d1969 100644 --- a/js/src/jsopcode.c +++ b/js/src/jsopcode.c @@ -2560,8 +2560,12 @@ Decompile(SprintStack *ss, jsbytecode *pc, intN nb) quoteAttr = JS_FALSE; break; - case JSOP_TOXML: case JSOP_TOXMLLIST: + todo = Sprint(&ss->sprinter, "<>%s", POP_STR()); + inXML = JS_FALSE; + break; + + case JSOP_TOXML: inXML = JS_FALSE; /* fall through */