Rework guid for fuzzing
There's a lot of places we do guid comparisons against lists of known
guids. Break these out into helper functions to help not duplicate the
fuzzing logic in a lot of places, and allow us to fuzz these places
appropriately.
Change-Id: I76c79cd62ccc95feb2609d5098db546f740711e1
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/ir-parse.c b/ir-parse.c
index 34cc085..e599b68 100644
--- a/ir-parse.c
+++ b/ir-parse.c
@@ -174,16 +174,12 @@
//Find the correct section type, and parse.
int section_converted = 0;
- for (size_t i = 0; i < section_definitions_len; i++) {
- if (guid_equal(section_definitions[i].Guid,
- &descriptor->SectionType) &&
- section_definitions[i].ToCPER != NULL) {
- ir = json_object_object_get(
- section, section_definitions[i].ShortName);
- section_definitions[i].ToCPER(ir, out);
- section_converted = 1;
- break;
- }
+ CPER_SECTION_DEFINITION *definition =
+ select_section_by_guid(&descriptor->SectionType);
+ if (definition != NULL) {
+ ir = json_object_object_get(section, definition->ShortName);
+ definition->ToCPER(ir, out);
+ section_converted = 1;
}
//If unknown GUID, so read as a base64 unknown section.