aboutsummaryrefslogtreecommitdiffstats
path: root/asm
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2020-12-31 16:50:25 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2020-12-31 16:50:25 +0300
commit79ac0d686dbf99758c9589fc4db6be4a2c5476e4 (patch)
treebad97d0ed402fdebf2b63d3fe6015e9c566b47a1 /asm
parentdc4a6194265962f288b73cca8097b850283bfb5f (diff)
parentf95c7e983c00d6b9f46fde7c702c0e5351b7dffa (diff)
downloadnasm-79ac0d686dbf99758c9589fc4db6be4a2c5476e4.tar.gz
nasm-79ac0d686dbf99758c9589fc4db6be4a2c5476e4.tar.xz
nasm-79ac0d686dbf99758c9589fc4db6be4a2c5476e4.zip
Merge branch 'nasm-2.15.xx'
* nasm-2.15.xx: preproc: prohibit unmacro while macro expansion
Diffstat (limited to 'asm')
-rw-r--r--asm/preproc.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/asm/preproc.c b/asm/preproc.c
index 69543174..ab229c9c 100644
--- a/asm/preproc.c
+++ b/asm/preproc.c
@@ -4330,6 +4330,19 @@ issue_error:
goto done;
}
mmac_p = (MMacro **) hash_findi(&mmacros, spec.name, NULL);
+
+ /* Check the macro to be undefined is not being expanded */
+ list_for_each(l, istk->expansion) {
+ if (l->finishes == *mmac_p) {
+ nasm_nonfatal("`%%unmacro' can't undefine the macro being expanded");
+ /*
+ * Do not release the macro instance to avoid using the freed
+ * memory while proceeding the expansion.
+ */
+ goto done;
+ }
+ }
+
while (mmac_p && *mmac_p) {
mmac = *mmac_p;
if (mmac->casesense == spec.casesense &&