[Nasm-devel] [PATCH] preproc: prohibit unmacro while macro expansion

Cyrill Gorcunov gorcunov at gmail.com
Wed Dec 30 14:17:33 PST 2020


On Thu, Dec 31, 2020 at 01:01:54AM +0300, Igor Munkin wrote:
> If macro is undefined while it's being expanded, use after free occurs,
> since the MMacro instance is released, but it is still used to proceed
> the expansion.
> 
> This change forbids macro undefinition and fatal error is raised if this
> macro is being processed by NASM preprocessor.
> 
> Consider the following example:
> | $ cat test.asm
> | %macro m 0
> | %unmacro m 0
> | %endmacro
> | m
> | $ ./nasm test.asm
> | test.asm:4: fatal: `%unmacro' can't undefine the macro being expanded
> 
> Fixes BR3392531 and BR3392716.
> 
> Signed-off-by: Igor Munkin <imun at cpan.org>

Thanks Igor! The patch looks good to me. I'll review it more carefully
in a couple of days, but from a glance looks exactly what we need.


More information about the Nasm-devel mailing list