This is an archive of the discontinued LLVM Phabricator instance.

[yaml2obj] - Don't crash on invalid inputs.
ClosedPublic

Authored by grimar on Apr 24 2019, 4:03 AM.

Details

Summary

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

The reason for the crash is almost the same to one fixed in D59964,
which fixed it for en empty inputs. But as was mentioned in comments,
fix should have been done in yaml::Input instead.

This patch does that and fixes a crash that I faced
(I updated the test case accordingly).

Diff Detail

Repository
rL LLVM

Event Timeline

grimar created this revision.Apr 24 2019, 4:03 AM
grimar added a subscriber: plotfi.
compnerd accepted this revision.Apr 24 2019, 10:13 AM

Great! Thanks for fixing this. The original change was to mitigate the crashes, and this is definitely the right way to address this. This seems to also be more conforming to the YAML specification.

This revision is now accepted and ready to land.Apr 24 2019, 10:13 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptApr 25 2019, 2:59 AM
Herald added a subscriber: kristina. · View Herald Transcript
llvm/trunk/lib/Support/YAMLTraits.cpp