From b6c26ee1bde0f48a4d915cb15c64578800cf8097 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Fri, 2 Jan 2026 11:40:53 +0100 Subject: [PATCH 1/3] add crash file --- .../fuzz-crash/crash-ef635709a2489083534cd422e6a089daab23ec64 | 1 + 1 file changed, 1 insertion(+) create mode 100644 test/cli/fuzz-crash/crash-ef635709a2489083534cd422e6a089daab23ec64 diff --git a/test/cli/fuzz-crash/crash-ef635709a2489083534cd422e6a089daab23ec64 b/test/cli/fuzz-crash/crash-ef635709a2489083534cd422e6a089daab23ec64 new file mode 100644 index 00000000000..6274e3a27a1 --- /dev/null +++ b/test/cli/fuzz-crash/crash-ef635709a2489083534cd422e6a089daab23ec64 @@ -0,0 +1 @@ +#pragma asm \ No newline at end of file From dbc792d06a6f175069cde44c2d90267b138ab68f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Fri, 2 Jan 2026 11:40:21 +0100 Subject: [PATCH 2/3] add test --- test/testpreprocessor.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/testpreprocessor.cpp b/test/testpreprocessor.cpp index 781f6b6cf35..e0472d121a1 100644 --- a/test/testpreprocessor.cpp +++ b/test/testpreprocessor.cpp @@ -362,6 +362,8 @@ class TestPreprocessor : public TestFixture { TEST_CASE(standard); TEST_CASE(writeLocations); + + TEST_CASE(pragmaAsm); } template @@ -2773,6 +2775,12 @@ class TestPreprocessor : public TestFixture { "} ;", processed); } + + void pragmaAsm() + { + const char code[] = "#pragma asm"; + ASSERT_THROW_INTERNAL(getcodeforcfg(settingsDefault, *this, code, "", "test.cpp"), InternalError::SYNTAX); + } }; REGISTER_TEST(TestPreprocessor) From a2dd7a5bee1f8ca39b1b6dfeab8bc83de387b2ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludvig=20Gunne=20Lindstr=C3=B6m?= Date: Fri, 2 Jan 2026 11:40:28 +0100 Subject: [PATCH 3/3] fix #14352 --- lib/preprocessor.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/preprocessor.cpp b/lib/preprocessor.cpp index b10ff859ad6..d99914357b4 100644 --- a/lib/preprocessor.cpp +++ b/lib/preprocessor.cpp @@ -1058,6 +1058,7 @@ void Preprocessor::simplifyPragmaAsmPrivate(simplecpp::TokenList &tokenList) continue; const simplecpp::Token *endasm = tok3; + bool foundEndasm = false; while ((endasm = endasm->next) != nullptr) { if (endasm->op != '#' || sameline(endasm,endasm->previousSkipComments())) continue; @@ -1069,9 +1070,13 @@ void Preprocessor::simplifyPragmaAsmPrivate(simplecpp::TokenList &tokenList) continue; while (sameline(endasm,endasm3)) endasm = endasm->next; + foundEndasm = true; break; } + if (!foundEndasm) + throw InternalError(nullptr, "syntax error: missing #pragma endasm", InternalError::SYNTAX); + const simplecpp::Token * const tok4 = tok3->next; tok->setstr("asm"); const_cast(tok2)->setstr("(");