Skip to content

Commit

Permalink
Catch overflow in header size
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisJefferson committed Sep 23, 2023
1 parent 0fb705c commit a57d6f4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/code.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,10 @@ Stat NewStatOrExpr(CodeState * cs, UInt type, UInt size, UInt line)
StatHeader * header = STAT_HEADER(cs, stat);
header->line = line;
header->size = size;
// check size fits inside header
if (header->size != size) {
Panic("Function too large");
}
header->type = type;
RegisterStatWithHook(GET_GAPNAMEID_BODY(cs->currBody), line, type);
// return the new statement
Expand Down

0 comments on commit a57d6f4

Please sign in to comment.