open-watcom / open-watcom-v2

Open Watcom V2.0 - Source code repository, Wiki, Latest Binary build, Archived builds including all installers for download.
Other
983 stars 160 forks source link

WASM crash in TASM compatibility mode, uninitialized pointer dereference in PROC argument handling code #767

Open nxd51 opened 2 years ago

nxd51 commented 2 years ago

Open Watcom assembler supports several TASM ideal mode features, including procedures. However, at least the 32-bit Windows version of the assembler very often crashes if the assembly code contains procedures with arguments. I have attached a simple test case (renamed to .TXT) that uses the syntax causing a crash. It should be assembled using the following switches: -0 -mm -zcm=tasm .

I did some investigation, and I think I have found the cause of the bug: function proc_exam (in direct.c) does not initialize the "sym" field of the "paranode" structure , yet this pointer is later dereferenced in function WritePrologue. According to my tests, this bug was already present in Open Watcom 1.9. wa_crash.txt

jmalak commented 2 years ago

Handling of symbols in WASM need rework. There are multiple problem with de-refferencing symbol. This is one of them.