Bug 1425826 - prevent null pointer dereference in BinASTParser::parseBlockStatementAux. r?jorendorff draft
authorAndi-Bogdan Postelnicu <bpostelnicu@mozilla.com>
Thu, 21 Dec 2017 10:57:55 +0200
changeset 713901 b260f8e1d8988b29f6c6398c7e523073f0f82dff
parent 713235 1624b88874765bf57e9feba176d30149c748d9d2
child 744473 fa703332e8b446c004728bda74de5f674502e1d7
push id93796
push userbmo:bpostelnicu@mozilla.com
push dateThu, 21 Dec 2017 09:01:13 +0000
reviewersjorendorff
bugs1425826
milestone59.0a1
Bug 1425826 - prevent null pointer dereference in BinASTParser::parseBlockStatementAux. r?jorendorff MozReview-Commit-ID: FMIfHez97Yd
js/src/frontend/BinSource.cpp
--- a/js/src/frontend/BinSource.cpp
+++ b/js/src/frontend/BinSource.cpp
@@ -330,17 +330,17 @@ BinASTParser::parseBlockStatementAux(con
             break;
           default:
             return raiseInvalidField("BlockStatement", field);
         }
     }
 
     // In case of absent optional fields, inject default values.
     if (!body)
-        body = factory_.newStatementList(tokenizer_->pos());
+        TRY_VAR(body, factory_.newStatementList(tokenizer_->pos()));
 
     MOZ_TRY_VAR(body, appendDirectivesToBody(body, directives));
 
     ParseNode* result;
     if (kind == BinKind::Program) {
         result = body;
     } else {
         TRY_DECL(bindings, NewLexicalScopeData(cx_, scope, alloc_, parseContext_));