mirror of
https://github.com/open-simh/simtools.git
synced 2026-01-13 23:36:03 +00:00
Fix a use-after-free. Found by Don North.
Also adjust test case to include this code. Fixes #2.
This commit is contained in:
parent
433e8ecda6
commit
c771c875cb
@ -469,13 +469,15 @@ static int assemble(
|
||||
}
|
||||
|
||||
my_searchenv(name, "INCLUDE", hitfile, sizeof(hitfile));
|
||||
free(name);
|
||||
|
||||
if (hitfile[0] == '\0') {
|
||||
report(stack->top, "Unable to find .INCLUDE file \"%s\"\n", name);
|
||||
free(name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
free(name);
|
||||
|
||||
incl = new_file_stream(hitfile);
|
||||
if (incl == NULL) {
|
||||
report(stack->top, "Unable to open .INCLUDE file \"%s\"\n", hitfile);
|
||||
|
||||
@ -48,7 +48,12 @@ test-include.mac:15: ***ERROR Bad .INCLUDE file name
|
||||
16 .include =incl.mac= ; looks like assignment
|
||||
test-include.mac:17: ***ERROR Invalid expression
|
||||
17 000012 000000G 000000 .include :incl.mac: ; looks like a label
|
||||
17
|
||||
18
|
||||
19 ; this is an error: file does not existst
|
||||
20
|
||||
test-include.mac:21: ***ERROR Unable to find .INCLUDE file "does-not-exist.mac"
|
||||
21 .include "does-not-exist.mac"
|
||||
21
|
||||
|
||||
|
||||
Symbol table
|
||||
|
||||
@ -15,3 +15,7 @@
|
||||
.include <incl.mac<
|
||||
.include =incl.mac= ; looks like assignment
|
||||
.include :incl.mac: ; looks like a label
|
||||
|
||||
; this is an error: file does not existst
|
||||
|
||||
.include "does-not-exist.mac"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user