[yaml2obj] - Don't crash on invalid inputs.
authorGeorge Rimar <grimar@accesssoftek.com>
Thu, 25 Apr 2019 09:59:55 +0000 (09:59 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Thu, 25 Apr 2019 09:59:55 +0000 (09:59 +0000)
commit45d042ed961a04b641eac99584b045de27388708
tree670437cf48e6a91a3efadbd6b07681738b60ec9d
parent4b7d3c48317c064e6a7048f7eee14677f1fddcc5
[yaml2obj] - Don't crash on invalid inputs.

yaml2obj might crash on invalid input when unable to parse the YAML.

Recently a crash with a very similar nature was fixed for an empty files.
This patch revisits the fix and does it in yaml::Input instead.
It seems to be more correct way to handle such situation.

With that crash for invalid inputs is also fixed now.

Differential revision: https://reviews.llvm.org/D61059

llvm-svn: 359178
llvm/lib/ObjectYAML/ObjectYAML.cpp
llvm/lib/Support/YAMLTraits.cpp
llvm/test/tools/yaml2obj/empty-or-invalid-doc.yaml [moved from llvm/test/tools/yaml2obj/empty.yaml with 54% similarity]
llvm/tools/yaml2obj/yaml2obj.cpp