From 7b0e27a6981014313a9f30486a0b4d2e0a3ebde3 Mon Sep 17 00:00:00 2001 From: Snild Dolkow Date: Thu, 28 Sep 2023 13:06:39 +0200 Subject: [PATCH] tests: Replace invalid entity expansion in test_alloc_nested_entities %pe2; would ultimately expand to a plain "ABCDEF...", which is not valid in this context. This was not normally hit, since the test would get its expected XML_ERROR_NO_MEMORY before expanding this far. With g_chunkSize=0 and EXPAT_CONTEXT_BYTES=OFF, the number of allocs required to reach that point becomes *just* low enough to reach the final expansion, making the test fail with a very unexpected syntax error. Nesting %pe2; in another entity declaration avoids the problem. --- expat/tests/alloc_tests.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/expat/tests/alloc_tests.c b/expat/tests/alloc_tests.c index 40d0d121..534bec04 100644 --- a/expat/tests/alloc_tests.c +++ b/expat/tests/alloc_tests.c @@ -18,6 +18,7 @@ Copyright (c) 2019 David Loffredo Copyright (c) 2020 Tim Gates Copyright (c) 2021 Donghee Na + Copyright (c) 2023 Sony Corporation / Snild Dolkow Licensed under the MIT license: Permission is hereby granted, free of charge, to any person obtaining @@ -1645,7 +1646,7 @@ START_TEST(test_alloc_nested_entities) { "ABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOPABCDEFGHIJKLMNOP" "'>\n" "\n" - "%pe2;", + "", "Memory Fail not faulted", NULL, XML_ERROR_NO_MEMORY}; /* Causes an allocation error in a nested storeEntityValue() */