From 59771b8f7f6c4126e26b17249e4e5f5127c171f5 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sun, 2 Feb 2025 00:46:23 +0100 Subject: [PATCH] xml_lpm_fuzzer: Mark variables external_entity{,_size} as global --- expat/fuzz/xml_lpm_fuzzer.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/expat/fuzz/xml_lpm_fuzzer.cpp b/expat/fuzz/xml_lpm_fuzzer.cpp index ec4f39d9..8f371cb1 100644 --- a/expat/fuzz/xml_lpm_fuzzer.cpp +++ b/expat/fuzz/xml_lpm_fuzzer.cpp @@ -42,8 +42,8 @@ #include "src/libfuzzer/libfuzzer_macro.h" static const char* g_encoding = nullptr; -static const char* external_entity = nullptr; -static size_t external_entity_size = 0; +static const char* g_external_entity = nullptr; +static size_t g_external_entity_size = 0; void SetEncoding(const xml_lpm_fuzzer::Encoding& e) { switch (e) { @@ -326,11 +326,11 @@ ExternalEntityRefHandler(XML_Parser parser, const XML_Char *context, TouchString(systemId); TouchString(publicId); - if (external_entity) { + if (g_external_entity) { XML_Parser ext_parser = XML_ExternalEntityParserCreate(parser, context, g_encoding); - rc = Parse(ext_parser, (const XML_Char*)external_entity, - external_entity_size, 1); + rc = Parse(ext_parser, (const XML_Char*)g_external_entity, + g_external_entity_size, 1); XML_ParserFree(ext_parser); } @@ -382,7 +382,7 @@ void InitializeParser(XML_Parser parser) { } DEFINE_TEXT_PROTO_FUZZER(const xml_lpm_fuzzer::Testcase& testcase) { - external_entity = nullptr; + g_external_entity = nullptr; if (!testcase.actions_size()) { return; @@ -423,8 +423,8 @@ DEFINE_TEXT_PROTO_FUZZER(const xml_lpm_fuzzer::Testcase& testcase) { break; case xml_lpm_fuzzer::Action::kExternalEntity: - external_entity = action.external_entity().data(); - external_entity_size = action.external_entity().size(); + g_external_entity = action.external_entity().data(); + g_external_entity_size = action.external_entity().size(); break; default: