Skip to content

Commit 121ab15

Browse files
authored
Fix null pointer dereference in yasm_section_bcs_append (yasm#263)
1 parent 9defefa commit 121ab15

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

libyasm/section.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,10 @@ yasm_bytecode *
629629
yasm_section_bcs_append(yasm_section *sect, yasm_bytecode *bc)
630630
{
631631
if (bc) {
632+
if (!sect) {
633+
yasm_error_set(YASM_ERROR_VALUE, "Attempt to append bytecode to a NULL section or with a NULL bytecode");
634+
return NULL;
635+
}
632636
if (bc->callback) {
633637
bc->section = sect; /* record parent section */
634638
STAILQ_INSERT_TAIL(&sect->bcs, bc, link);

0 commit comments

Comments
 (0)