Fix oobread in the xcoff64 parser ##crash

This commit is contained in:
pancake 2023-04-12 18:07:13 +02:00
parent 90dc5c64f7
commit 3456d0d16e
2 changed files with 3 additions and 0 deletions

View File

@ -321,3 +321,4 @@ Watch until the end!
Don't forget to subscribe!
Ah shit, here we go again.
Checking whether this software can be played...
Will it blend?

View File

@ -88,6 +88,8 @@ static bool r_bin_xcoff64_init_scn_hdr(RBinXCoff64Obj *obj) {
ut64 offset = sizeof (struct xcoff64_hdr) + obj->hdr.f_opthdr;
size = obj->hdr.f_nscns * sizeof (struct xcoff64_scn_hdr);
if (offset > obj->size || offset + size > obj->size || size < 0) {
obj->hdr.f_nscns = 0;
obj->scn_hdrs = NULL;
return false;
}
obj->scn_hdrs = calloc (1, size + sizeof (struct xcoff64_scn_hdr));