Skip to content

Commit

Permalink
Added check for value of byte to be written in memset.
Browse files Browse the repository at this point in the history
  • Loading branch information
mariaKt committed Oct 17, 2023
1 parent 658b799 commit cf23df9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions runtime/strings/bytes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,11 @@ SortBytes hook_BYTES_memset(SortBytes b, SortInt start, SortInt count, SortInt v
ustart, ucount, input_len);
}
int v = mpz_get_si(value);
if ((v < -128) || (v > 127)) {
KLLVM_HOOK_INVALID_ARGUMENT(
"Not a valid value for a byte in memset: v={}",
v);
}
memset(b->data + ustart, v, ucount);
return b;
}
Expand Down

0 comments on commit cf23df9

Please sign in to comment.