From 2eae9f8a3f6bc68ae2f9893cc5d82eeb75f88153 Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Thu, 10 Dec 2015 13:22:14 -0500 Subject: [PATCH] Bug 1231224 part 4 - Fix TokenStream::getDirective to check append() return value. r=jwalden --- js/src/frontend/TokenStream.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/js/src/frontend/TokenStream.cpp b/js/src/frontend/TokenStream.cpp index 709d99bb8cd8..c4ecd668f317 100644 --- a/js/src/frontend/TokenStream.cpp +++ b/js/src/frontend/TokenStream.cpp @@ -877,13 +877,15 @@ TokenStream::getDirective(bool isMultiline, bool shouldWarnDeprecated, ungetChar('*'); break; } - tokenbuf.append(c); + if (!tokenbuf.append(c)) + return false; } - if (tokenbuf.empty()) + if (tokenbuf.empty()) { // The directive's URL was missing, but this is not quite an // exception that we should stop and drop everything for. return true; + } size_t length = tokenbuf.length();