summaryrefslogtreecommitdiffstats
path: root/llvm/tools/yaml2obj/yaml2obj.cpp
diff options
context:
space:
mode:
authorGeorge Rimar <grimar@accesssoftek.com>2019-04-25 09:59:55 +0000
committerGeorge Rimar <grimar@accesssoftek.com>2019-04-25 09:59:55 +0000
commit45d042ed961a04b641eac99584b045de27388708 (patch)
tree670437cf48e6a91a3efadbd6b07681738b60ec9d /llvm/tools/yaml2obj/yaml2obj.cpp
parent4b7d3c48317c064e6a7048f7eee14677f1fddcc5 (diff)
downloadbcm5719-llvm-45d042ed961a04b641eac99584b045de27388708.tar.gz
bcm5719-llvm-45d042ed961a04b641eac99584b045de27388708.zip
[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
Diffstat (limited to 'llvm/tools/yaml2obj/yaml2obj.cpp')
-rw-r--r--llvm/tools/yaml2obj/yaml2obj.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/llvm/tools/yaml2obj/yaml2obj.cpp b/llvm/tools/yaml2obj/yaml2obj.cpp
index ef35458a8f0..f2266401da7 100644
--- a/llvm/tools/yaml2obj/yaml2obj.cpp
+++ b/llvm/tools/yaml2obj/yaml2obj.cpp
@@ -86,11 +86,7 @@ int main(int argc, char **argv) {
if (!Buf)
return 1;
- StringRef Buffer = Buf.get()->getBuffer();
- if (Buffer.trim().size() == 0)
- error("yaml2obj: Error opening '" + Input + "': Empty File.");
- yaml::Input YIn(Buffer);
-
+ yaml::Input YIn(Buf.get()->getBuffer());
int Res = convertYAML(YIn, Out->os());
if (Res == 0)
Out->keep();
OpenPOWER on IntegriCloud