[Nasm-bugs] [Bug 3392762] Heap use-after-free while using %clear inside a macro.

noreply-nasm at dev.nasm.us noreply-nasm at dev.nasm.us
Sun Jun 6 03:09:06 PDT 2021


https://bugzilla.nasm.us/show_bug.cgi?id=3392762

--- Comment #4 from Marco <mvanotti at protonmail.com> ---
Hi Peter,

I have some time to give this a go. Here is a patch fixing this issue, and a
few related smaller issues (for example, the %clear all never ever worked. It
just loops endlessly on my computer). It still needs tests, but I have a couple
of test cases that I can add, once I figure out how nasm tests work :)

Please take a look when you have some time:
https://github.com/netwide-assembler/nasm/commit/54b579b04b2a8c1dbf6a7acf1e26037a78e7a509

While looking at it, I noticed that there is some room for improvement in the
handling of the %clear arguments. In particular, it seems to be possible to do
something like %clear all all all all all all all all (etc), and something like
%clear local defines global defines

The documentation mentions that the context should be at the start (if
present).

With that in mind, the code can be simplified a bit. Like parsing first the
context, then the rest of the parameters, and finally, making a single call to
do_clear, checking for the mmacros expansion beforehand.

-- 
You are receiving this mail because:
You are watching all bug changes.
You are on the CC list for the bug.


More information about the Nasm-bugs mailing list