summaryrefslogtreecommitdiff
path: root/lib/ObjectYAML/MachOYAML.cpp
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2019-10-23 17:51:42 +0000
committerDimitry Andric <dim@FreeBSD.org>2019-10-23 17:51:42 +0000
commit1d5ae1026e831016fc29fd927877c86af904481f (patch)
tree2cdfd12620fcfa5d9e4a0389f85368e8e36f63f9 /lib/ObjectYAML/MachOYAML.cpp
parente6d1592492a3a379186bfb02bd0f4eda0669c0d5 (diff)
Notes
Diffstat (limited to 'lib/ObjectYAML/MachOYAML.cpp')
-rw-r--r--lib/ObjectYAML/MachOYAML.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/ObjectYAML/MachOYAML.cpp b/lib/ObjectYAML/MachOYAML.cpp
index d12f12cf44350..0f7cd1e1495cb 100644
--- a/lib/ObjectYAML/MachOYAML.cpp
+++ b/lib/ObjectYAML/MachOYAML.cpp
@@ -287,6 +287,15 @@ void MappingTraits<MachOYAML::Section>::mapping(IO &IO,
IO.mapRequired("reserved1", Section.reserved1);
IO.mapRequired("reserved2", Section.reserved2);
IO.mapOptional("reserved3", Section.reserved3);
+ IO.mapOptional("content", Section.content);
+}
+
+StringRef
+MappingTraits<MachOYAML::Section>::validate(IO &IO,
+ MachOYAML::Section &Section) {
+ if (Section.content && Section.size < Section.content->binary_size())
+ return "Section size must be greater than or equal to the content size";
+ return {};
}
void MappingTraits<MachO::build_tool_version>::mapping(