Skip to content

Commit

Permalink
Refactor marshal.c
Browse files Browse the repository at this point in the history
  • Loading branch information
ttxine committed Oct 14, 2023
1 parent 3973ec4 commit 8985597
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions librz/bin/format/pyc/marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -679,29 +679,23 @@ static pyc_object *get_ascii_object_generic(RzBinPycObj *pyc, RzBuffer *buffer,

static pyc_object *get_ascii_object(RzBinPycObj *pyc, RzBuffer *buffer) {
bool error = false;
ut32 n = 0;

n = get_ut32(buffer, &error);
ut32 n = get_ut32(buffer, &error);
if (n > ST32_MAX) {
RZ_LOG_ERROR("bad marshal data (string size out of range)\n");
return NULL;
}
if (error) {
} else if (error) {
return NULL;
}
return get_ascii_object_generic(pyc, buffer, n, true);
}

static pyc_object *get_ascii_interned_object(RzBinPycObj *pyc, RzBuffer *buffer) {
bool error = false;
ut32 n;

n = get_ut32(buffer, &error);
ut32 n = get_ut32(buffer, &error);
if (n > ST32_MAX) {
RZ_LOG_ERROR("bad marshal data (string size out of range)\n");
return NULL;
}
if (error) {
} else if (error) {
return NULL;
}
return get_ascii_object_generic(pyc, buffer, n, true);
Expand Down

0 comments on commit 8985597

Please sign in to comment.