From 5f42436e02a531e0cfbb7a64377af19095b8db39 Mon Sep 17 00:00:00 2001 From: Sebastian Pipping Date: Sun, 2 Feb 2025 00:55:08 +0100 Subject: [PATCH] xml_lpm_fuzzer: Fix mistaken use of XML_Char --- expat/fuzz/xml_lpm_fuzzer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/expat/fuzz/xml_lpm_fuzzer.cpp b/expat/fuzz/xml_lpm_fuzzer.cpp index 11de0567..4e2a5658 100644 --- a/expat/fuzz/xml_lpm_fuzzer.cpp +++ b/expat/fuzz/xml_lpm_fuzzer.cpp @@ -108,7 +108,7 @@ void InitializeParser(XML_Parser parser); // We want a parse function that supports resumption, so that we can cover the // suspend/resume code. -enum XML_Status Parse(XML_Parser parser, const XML_Char* input, int input_len, +enum XML_Status Parse(XML_Parser parser, const char* input, int input_len, int is_final) { enum XML_Status status = XML_Parse(parser, input, input_len, is_final); while (status == XML_STATUS_SUSPENDED) { @@ -329,7 +329,7 @@ ExternalEntityRefHandler(XML_Parser parser, const XML_Char *context, if (g_external_entity) { XML_Parser ext_parser = XML_ExternalEntityParserCreate(parser, context, g_encoding); - rc = Parse(ext_parser, (const XML_Char*)g_external_entity, + rc = Parse(ext_parser, g_external_entity, g_external_entity_size, 1); XML_ParserFree(ext_parser); } @@ -403,7 +403,7 @@ DEFINE_TEXT_PROTO_FUZZER(const xml_lpm_fuzzer::Testcase& testcase) { switch (action.action_case()) { case xml_lpm_fuzzer::Action::kChunk: if (XML_STATUS_ERROR == Parse(parser, - (const XML_Char*)action.chunk().data(), + action.chunk().data(), action.chunk().size(), 0)) { // Force a reset after parse error. XML_ParserReset(parser, g_encoding); @@ -411,7 +411,7 @@ DEFINE_TEXT_PROTO_FUZZER(const xml_lpm_fuzzer::Testcase& testcase) { break; case xml_lpm_fuzzer::Action::kLastChunk: - Parse(parser, (const XML_Char*)action.last_chunk().data(), + Parse(parser, action.last_chunk().data(), action.last_chunk().size(), 1); XML_ParserReset(parser, g_encoding); InitializeParser(parser);