Skip to content

Commit

Permalink
Fix out-of-bounds read in debug dump_obj function
Browse files Browse the repository at this point in the history
The read of `reverse_nesting_order` was unconditional regardless
of whether the object was really a composite object or not.
  • Loading branch information
drcaramelsyrup committed May 5, 2023
1 parent 547c34d commit 424bcdd
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions parser.c
Original file line number Diff line number Diff line change
Expand Up @@ -485,11 +485,11 @@ dump_obj(FILE* f, obj_t* obj) {
if (type <= OT_LAST_PRIMITIVE) {
dump_primitive_obj(f, obj);
fputc('\n', f);
}

obj_composite_t* cobj = (obj_composite_t*)(void*)obj;
for (; cobj; cobj = cobj->reverse_nesting_order) {
dump_composite_obj(f, cobj);
} else {
obj_composite_t* cobj = (obj_composite_t*)(void*)obj;
for (; cobj; cobj = cobj->reverse_nesting_order) {
dump_composite_obj(f, cobj);
}
}
}

Expand Down

0 comments on commit 424bcdd

Please sign in to comment.