diff options
| author | Alex Lorenz <arphaman@gmail.com> | 2015-05-06 23:21:29 +0000 |
|---|---|---|
| committer | Alex Lorenz <arphaman@gmail.com> | 2015-05-06 23:21:29 +0000 |
| commit | 74b63ebd53c292d95388b2159b26fb510af3ae3f (patch) | |
| tree | e09cb9f9ab8a85bff89db08331fe2ef0f889893f /llvm/unittests/Support/YAMLParserTest.cpp | |
| parent | 2777d8874541335b96c7f23ec2e33e6491e6d170 (diff) | |
| download | llvm-74b63ebd53c292d95388b2159b26fb510af3ae3f.zip llvm-74b63ebd53c292d95388b2159b26fb510af3ae3f.tar.gz llvm-74b63ebd53c292d95388b2159b26fb510af3ae3f.tar.bz2 | |
YAML: Fix crash in the skip method of KeyValueNode class.
This commit changes the 'skip' method in the 'KeyValueNode' class
to ensure that it doesn't dereference a null pointer when calling
the 'skip' method of its value child node. It also adds a unittest
that ensures that the crash doesn't occur.
This change is motivated by a patch that implements parsing
of YAML block scalars (http://reviews.llvm.org/D9503), as one
of the unittests in that patch triggered this problem.
llvm-svn: 236669
Diffstat (limited to 'llvm/unittests/Support/YAMLParserTest.cpp')
| -rw-r--r-- | llvm/unittests/Support/YAMLParserTest.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/llvm/unittests/Support/YAMLParserTest.cpp b/llvm/unittests/Support/YAMLParserTest.cpp index 823a0d6..918c205 100644 --- a/llvm/unittests/Support/YAMLParserTest.cpp +++ b/llvm/unittests/Support/YAMLParserTest.cpp @@ -141,6 +141,10 @@ TEST(YAMLParser, HandlesEndOfFileGracefully) { ExpectParseError("In object hitting EOF", "{\"\""); } +TEST(YAMLParser, HandlesNullValuesInKeyValueNodesGracefully) { + ExpectParseError("KeyValueNode with null value", "test: '"); +} + // Checks that the given string can be parsed into an identical string inside // of an array. static void ExpectCanParseString(StringRef String) { |
