[Nasm-bugs] [Bug 3392474] New: Endless while loop inside assemble_file function
noreply-nasm at gorcunov.org
noreply-nasm at gorcunov.org
Mon Apr 23 08:17:50 PDT 2018
https://bugzilla.nasm.us/show_bug.cgi?id=3392474
Bug ID: 3392474
Summary: Endless while loop inside assemble_file function
Product: NASM
Version: 2.14 (development)
Hardware: All
OS: All
Status: OPEN
Severity: normal
Priority: Medium
Component: Assembler
Assignee: nobody at nasm.us
Reporter: mudongliangabcd at gmail.com
CC: gorcunov at gmail.com, hpa at zytor.com, nasm-bugs at nasm.us
Obtained from: Build from source archive using configure
Created attachment 411635
--> https://bugzilla.nasm.us/attachment.cgi?id=411635&action=edit
PoC to make nasm hang
With crafted file, the following while loop never stops as line will never be
NULL.
1233 while ((line = preproc->getline())) {
1234 globallineno++;
...
In pp_getline(preproc->getline) function, the last assignment is
5215 line = detoken(tline, true);
...
In detoken function, line is assigned by
1308 p = line = nasm_malloc(len + 1);
>From nasm_malloc implementation, it will never return NULL.
53 void *nasm_calloc(size_t size, size_t nelem)
54 {
55 void *p = calloc(size, nelem);
56 if (!p)
57 nasm_fatal(ERR_NOFILE, "out of memory");
58 return p;
59 }
60
So the while loop inside assemble_file function will never stop.
--
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