Skip to content

Commit

Permalink
Handle out-of-memory case for parsePreshader
Browse files Browse the repository at this point in the history
  • Loading branch information
flibitijibibo committed Jun 5, 2023
1 parent d6820fe commit 117873b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions mojoshader.c
Original file line number Diff line number Diff line change
Expand Up @@ -3964,6 +3964,10 @@ const MOJOSHADER_preshader *MOJOSHADER_parsePreshader(const unsigned char *buf,

// We need just enough Context for allocators and error state.
Context *ctx = build_context(NULL, NULL, buf, buflen, NULL, 0, NULL, 0, m, f, d);
if (ctx == NULL)
{
return retval; // !!! FIXME: Out of memory struct for MOJOSHADER_preshader
}
parse_preshader(ctx, ctx->tokens, ctx->tokencount);
if (!isfail(ctx))
{
Expand Down

0 comments on commit 117873b

Please sign in to comment.