summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Support
diff options
context:
space:
mode:
authorThomas Finch <tfinch@apple.com>2019-11-11 20:48:28 -0800
committerDon Hinton <hintonda@gmail.com>2019-11-11 20:48:28 -0800
commitac385ca63fe8bc283d7f5be213319cc3b930b4cc (patch)
tree807885a84d47f74548b4287a6f682f96411c8312 /llvm/lib/Support
parent6ebec32b1265af646b039150b2df790c610a20fe (diff)
downloadbcm5719-llvm-ac385ca63fe8bc283d7f5be213319cc3b930b4cc.tar.gz
bcm5719-llvm-ac385ca63fe8bc283d7f5be213319cc3b930b4cc.zip
Fix null dereference in yaml::Document::skip
Summary: The attached test case replicates a null dereference crash in `yaml::Document::skip()`. This was fixed by adding a check and early return in the method. Reviewers: Bigcheese, hintonda, beanz Reviewed By: hintonda Subscribers: hiraditya, dexonsmith, llvm-commits Tags: #llvm Differential Revision: https://reviews.llvm.org/D69974
Diffstat (limited to 'llvm/lib/Support')
-rw-r--r--llvm/lib/Support/YAMLParser.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Support/YAMLParser.cpp b/llvm/lib/Support/YAMLParser.cpp
index 333648dae2b..d17e7b227f4 100644
--- a/llvm/lib/Support/YAMLParser.cpp
+++ b/llvm/lib/Support/YAMLParser.cpp
@@ -2288,8 +2288,8 @@ Document::Document(Stream &S) : stream(S), Root(nullptr) {
bool Document::skip() {
if (stream.scanner->failed())
return false;
- if (!Root)
- getRoot();
+ if (!Root && !getRoot())
+ return false;
Root->skip();
Token &T = peekNext();
if (T.Kind == Token::TK_StreamEnd)
OpenPOWER on IntegriCloud