mirror of
https://github.com/netwide-assembler/nasm.git
synced 2025-09-22 10:43:39 -04:00
BR3079550: NASM crash on run-time for OMF output format
We could have accessed malloc'ed data on external symbols in obj and ieee output formats. Fix it by using nasm_zalloc. Reported-by: Jiri Malak Patch-by: Jiri Malak Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
This commit is contained in:
@@ -372,7 +372,7 @@ static void ieee_deflabel(char *name, int32_t segment,
|
||||
i = segment / 2;
|
||||
eb = ebhead;
|
||||
if (!eb) {
|
||||
eb = *ebtail = nasm_malloc(sizeof(*eb));
|
||||
eb = *ebtail = nasm_zalloc(sizeof(*eb));
|
||||
eb->next = NULL;
|
||||
ebtail = &eb->next;
|
||||
}
|
||||
@@ -380,7 +380,7 @@ static void ieee_deflabel(char *name, int32_t segment,
|
||||
if (eb && eb->next)
|
||||
eb = eb->next;
|
||||
else {
|
||||
eb = *ebtail = nasm_malloc(sizeof(*eb));
|
||||
eb = *ebtail = nasm_zalloc(sizeof(*eb));
|
||||
eb->next = NULL;
|
||||
ebtail = &eb->next;
|
||||
}
|
||||
|
@@ -993,7 +993,7 @@ static void obj_deflabel(char *name, int32_t segment,
|
||||
i = segment / 2;
|
||||
eb = ebhead;
|
||||
if (!eb) {
|
||||
eb = *ebtail = nasm_malloc(sizeof(*eb));
|
||||
eb = *ebtail = nasm_zalloc(sizeof(*eb));
|
||||
eb->next = NULL;
|
||||
ebtail = &eb->next;
|
||||
}
|
||||
@@ -1001,7 +1001,7 @@ static void obj_deflabel(char *name, int32_t segment,
|
||||
if (eb && eb->next)
|
||||
eb = eb->next;
|
||||
else {
|
||||
eb = *ebtail = nasm_malloc(sizeof(*eb));
|
||||
eb = *ebtail = nasm_zalloc(sizeof(*eb));
|
||||
eb->next = NULL;
|
||||
ebtail = &eb->next;
|
||||
}
|
||||
|
Reference in New Issue
Block a user