Skip to content
Permalink
Browse files
Under MRB_INT64, width may be bigger than INT_MAX; fix #3665
  • Loading branch information
matz committed May 25, 2017
1 parent 9bca887 commit 3ef97e3dd9fdd31ecca30d04d0fc3783ca8dab58
Showing 1 changed file with 3 additions and 0 deletions.
@@ -1034,6 +1034,9 @@ mrb_str_format(mrb_state *mrb, int argc, const mrb_value *argv, mrb_value fmt)
if ((flags & FWIDTH) && need < width)
need = width;

if (need < 0) {
mrb_raise(mrb, E_ARGUMENT_ERROR, "width too big");
}
FILL(' ', need);
if (flags & FMINUS) {
if (sign)

0 comments on commit 3ef97e3

Please sign in to comment.