Skip to content

Commit

Permalink
Fix #18667 - division by zero in the macho parser ##bin
Browse files Browse the repository at this point in the history
  • Loading branch information
radare committed May 7, 2021
1 parent 518bf66 commit a07dedb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions libr/bin/p/bin_mach0.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* radare - LGPL - Copyright 2009-2019 - pancake */
/* radare - LGPL - Copyright 2009-2021 - pancake */

#include <r_types.h>
#include <r_util.h>
Expand Down Expand Up @@ -771,7 +771,10 @@ static void rebase_buffer(struct MACH0_(obj_t) *obj, ut64 off, RIODesc *fd, ut8
if (!obj->chained_starts[i]) {
continue;
}
ut64 page_size = obj->chained_starts[i]->page_size;
int page_size = obj->chained_starts[i]->page_size;
if (page_size < 1) {
page_size = 4096;
}
ut64 start = obj->segs[i].fileoff;
ut64 end = start + obj->segs[i].filesize;
if (end >= off && start <= eob) {
Expand Down

0 comments on commit a07dedb

Please sign in to comment.