Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SEP parsing crash #4175

Merged
merged 1 commit into from
Feb 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions librz/bin/p/bin_xtr_sep64.c
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,9 @@ static RzBinXtrData *oneshot_buffer(RzBin *bin, RzBuffer *b, int idx) {
if (!bin->cur->xtr_obj) {
bin->cur->xtr_obj = sep64_xtr_ctx_new(b);
}
if (!bin->cur->xtr_obj) {
return NULL;
}
RSepXtr64Ctx *ctx = bin->cur->xtr_obj;

RSepSlice64 *slice = sep64_xtr_ctx_get_slice(ctx, b, idx);
Expand All @@ -198,22 +201,22 @@ static RzBinXtrData *oneshot_buffer(RzBin *bin, RzBuffer *b, int idx) {

static RzList /*<RzBinXtrData *>*/ *oneshotall_buffer(RzBin *bin, RzBuffer *b) {
RzBinXtrData *data = oneshot_buffer(bin, b, 0);
if (data) {
int narch = data->file_count;
RzList *res = rz_list_newf(rz_bin_xtrdata_free);
if (!res) {
rz_bin_xtrdata_free(data);
return NULL;
}
if (!data) {
return NULL;
}
int narch = data->file_count;
RzList *res = rz_list_newf(rz_bin_xtrdata_free);
if (!res) {
rz_bin_xtrdata_free(data);
return NULL;
}
rz_list_append(res, data);
int i;
for (i = 1; data && i < narch; i++) {
data = oneshot_buffer(bin, b, i);
rz_list_append(res, data);
int i;
for (i = 1; data && i < narch; i++) {
data = oneshot_buffer(bin, b, i);
rz_list_append(res, data);
}
return res;
}
return NULL;
return res;
}

static RSepXtr64Ctx *sep64_xtr_ctx_new(RzBuffer *buf) {
Expand Down
Loading