[Nasm-bugs] [Bug 3392604] New: git nasm: segmentation fault when lmacros numdef is used

noreply-nasm at gorcunov.org noreply-nasm at gorcunov.org
Tue Aug 20 05:32:32 PDT 2019


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

            Bug ID: 3392604
           Summary: git nasm: segmentation fault when lmacros numdef is
                    used
           Product: NASM
           Version: 2.15 (development)
          Hardware: All
                OS: All
            Status: OPEN
          Severity: blocker
          Priority: Medium
         Component: Assembler
          Assignee: nobody at nasm.us
          Reporter: pushbx at 38.de
                CC: chang.seok.bae at intel.com, gorcunov at gmail.com,
                    hpa at zytor.com, nasm-bugs at nasm.us
     Obtained from: Built from git using configure

I stripped down the lmacros1.mac file to just the definition of the numdef
multi-line macro, as well as the defaulting state variable. Any usage of numdef
seems to crash NASM. This is with
https://repo.or.cz/nasm.git/commitdiff/a1a844697daabe0e8c493c6abada8049431b7fd2

tests$ cat test.asm
%if 0

NASM macro collection
Public Domain by C. Masloch, 2008-2012
Intended for 86 Mode programs.

%endif


                ; Define a numeric definition for conditional assembly
                ;
                ; Instead of:
                ; %ifdef DEFINE
                ; use:
                ; %if _DEFINE
                ;
                ; %1 = Definition name. Will get an additional underscore
prefix
                ; %2 = Value to assign if not defined (defaults to 0)
                ; %3 = Value to assign if defined, but no number (defaults to
1)
        %imacro numdef 1-3.nolist 0,1
%ifnum __DEFAULTED_%1
 %if __lMACROS1_MAC__DEFAULTING && __DEFAULTED_%1
  %undef _%1                    ; cause defaulting to take effect again
  %if __DEFAULTED_%1 == 2       ; defaulted to third parameter?
   %define _%1                  ; cause alternative defaulting to take effect
again
  %endif
 %endif
%endif
%ifdef _%1
 %ifnnum _%1
  %assign _%1 %3                ; i.e. "-d_DEFINE" option on NASM's command
line
  %if __lMACROS1_MAC__DEFAULTING
   %assign __DEFAULTED_%1 2     ; note alternative defaulting occurred
  %endif
 %endif                         ;  (if option was "-d_DEFINE=0", it's left as
zero)
 %if __lMACROS1_MAC__DEFAULTING
  %ifnnum __DEFAULTED_%1
   %assign __DEFAULTED_%1 0     ; note no defaulting occurred
  %endif
 %endif
%else                           ; If not defined (no option on NASM's command
line)
 %assign _%1 %2                 ;  then assign to zero
 %if __lMACROS1_MAC__DEFAULTING
  %assign __DEFAULTED_%1 1      ; note defaulting occurred
 %endif
%endif
        %endmacro


%assign __lMACROS1_MAC__DEFAULTING 0
        %imacro defaulting 0-1.nolist 1
%ifidni %1,toggle
 %assign __lMACROS1_MAC__DEFAULTING !__lMACROS1_MAC__DEFAULTING
%else
 %assign __lMACROS1_MAC__DEFAULTING !!(%1)
%endif
        %endmacro

        numdef _lMACROS1_MAC__CPU_DEFAULTS
tests$ nasm -v
NASM version 2.15rc0 compiled on Aug 20 2019
tests$ nasm -I ../ test.asm
Segmentation fault (core dumped)
tests$ oldnasm -v
NASM version 2.15rc0 compiled on Dec 28 2018
tests$ oldnasm -I ../ test.asm
tests$

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


More information about the Nasm-bugs mailing list