From e0b27db6526fc890d05870e92f4265b9a0e30180 Mon Sep 17 00:00:00 2001 From: Stephen Heumann Date: Mon, 24 Oct 2022 21:05:50 -0500 Subject: [PATCH] Do not try to interpret non-identifier tokens as pragma names. This could access arbitrary memory locations, and could theoretically cause misbehavior including falsely recognizing the token as a pragma or accessing a softswitch/IO location. --- Scanner.pas | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Scanner.pas b/Scanner.pas index dc28aff..8684a00 100644 --- a/Scanner.pas +++ b/Scanner.pas @@ -3328,6 +3328,11 @@ if ch in ['a','d','e','i','l','p','u','w'] then begin if token.name^ = 'pragma' then begin if tskipping then goto 2; NextToken; + if token.class <> identifier then begin + if (lint & lintPragmas) <> 0 then + Error(110); + goto 2; + end; {if} if token.name^ = 'keep' then DoKeep else if token.name^ = 'debug' then begin