From 6d428e0dc92a1055f42f991f47664308d81fdde2 Mon Sep 17 00:00:00 2001 From: emteere <47253321+emteere@users.noreply.github.com> Date: Mon, 12 Jun 2023 21:17:24 +0000 Subject: [PATCH] GP-3541 Fixed pragma parsing with embedded comma outside of parentheses --- .../Base/src/main/javacc/ghidra/app/util/cparser/C/C.jj | 2 +- .../src/test/resources/ghidra/app/util/cparser/CParserTest.h | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/Ghidra/Features/Base/src/main/javacc/ghidra/app/util/cparser/C/C.jj b/Ghidra/Features/Base/src/main/javacc/ghidra/app/util/cparser/C/C.jj index 83d9c47357c..0c558bf4dd6 100644 --- a/Ghidra/Features/Base/src/main/javacc/ghidra/app/util/cparser/C/C.jj +++ b/Ghidra/Features/Base/src/main/javacc/ghidra/app/util/cparser/C/C.jj @@ -1922,7 +1922,7 @@ void PragmaSpecifier() : { { LOOKAHEAD(3) PragmaSpecifier() | - id= ( | | )* + id= ( | | | )* ([ [ (ds1=PragmaConstant())+ [ ( ds2=PragmaConstant() ) [ ( ds3=PragmaConstant() ) [ ( PragmaConstant() )+ ] ] ] ] ] ) { if (id.image.equals("pack") && ds1 != null) { diff --git a/Ghidra/Features/Base/src/test/resources/ghidra/app/util/cparser/CParserTest.h b/Ghidra/Features/Base/src/test/resources/ghidra/app/util/cparser/CParserTest.h index 27717692a46..08a2a243c05 100644 --- a/Ghidra/Features/Base/src/test/resources/ghidra/app/util/cparser/CParserTest.h +++ b/Ghidra/Features/Base/src/test/resources/ghidra/app/util/cparser/CParserTest.h @@ -176,6 +176,9 @@ int (__stdcall * GetSectionBlock) ( #pragma region Input compatibility macros +// nothing will parse after this line if the this fails + #pragma test for, pragma, with, commas outside parens + #pragma warning(disable) #pragma warning(disable:4035 4793) // re-enable below