]> granicus.if.org Git - llvm/commit
Detect malformed YAML sequence in yaml::Input::beginSequence()
authorJustin Bogner <mail@justinbogner.com>
Mon, 2 Mar 2015 17:26:43 +0000 (17:26 +0000)
committerJustin Bogner <mail@justinbogner.com>
Mon, 2 Mar 2015 17:26:43 +0000 (17:26 +0000)
commit97cc07352bdd1999691c61479c5e80e24033ac4d
tree4b54a0903b2a69fe09a7cdd7537ba3f1035648c1
parent9680c9c1a807af5b9007b5cfe5fa5bf184a5ad36
Detect malformed YAML sequence in yaml::Input::beginSequence()

When reading a yaml::SequenceTraits object, YAMLIO does not report an
error if the yaml item is not a sequence. Instead, YAMLIO reads an
empty sequence. For example:

---
seq:
    foo: 1
    bar: 2
...

If `seq` is a SequenceTraits object, then reading the above yaml will
yield `seq` as an empty sequence.

Fix this to report an error for the above mapping ("not a sequence")

Patch by William Fisher. Thanks!

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@230976 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Support/YAMLTraits.cpp
unittests/Support/YAMLIOTest.cpp