mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
mruby-pack/pack.c (read_tmpl): check integer overflow before casting.
This commit is contained in:
@@ -1306,7 +1306,7 @@ alias:
|
||||
if (ISDIGIT(ch)) {
|
||||
char *e;
|
||||
mrb_int n;
|
||||
if (!mrb_read_int(tptr+tmpl->idx, tptr+tlen, &e, &n)) {
|
||||
if (!mrb_read_int(tptr+tmpl->idx, tptr+tlen, &e, &n) || INT_MAX < n) {
|
||||
mrb_raise(mrb, E_RUNTIME_ERROR, "too big template length");
|
||||
}
|
||||
count = (int)n;
|
||||
|
||||
Reference in New Issue
Block a user