Check if `mruby-pack` template count overflow; fix #3942

parent b43c1464
...@@ -1050,6 +1050,9 @@ alias: ...@@ -1050,6 +1050,9 @@ alias:
count = ch - '0'; count = ch - '0';
while (tmpl->idx < tlen && isdigit(tptr[tmpl->idx])) { while (tmpl->idx < tlen && isdigit(tptr[tmpl->idx])) {
count = count * 10 + (tptr[tmpl->idx++] - '0'); count = count * 10 + (tptr[tmpl->idx++] - '0');
if (count < 0) {
mrb_raisef(mrb, E_RUNTIME_ERROR, "too big template length");
}
} }
continue; /* special case */ continue; /* special case */
} else if (ch == '*') { } else if (ch == '*') {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment