Skip to content

Commit

Permalink
Prevent division by zero.
Browse files Browse the repository at this point in the history
Under specific test cases, the application could crash with a
floating point exception.
  • Loading branch information
WhatTheFuzz committed Dec 16, 2022
1 parent 932f329 commit c7a4d33
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/operator.c
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,10 @@ void opdiv(struct result* presult, struct result* parg)
presult->flags |= parg->flags;
checktype(presult, L_ABSOLUTE);
checktype(parg, L_ABSOLUTE);
presult->value /= parg->value;
if (parg->value != 0)
{
presult->value /= parg->value;
}
}

void oprlist(struct result* presult, struct result* parg)
Expand Down

0 comments on commit c7a4d33

Please sign in to comment.