Commit 311d867d authored by dearblue's avatar dearblue

Fix `mrb_vformat()` crashes with `MRB_INT16`

If `MRB_INT16` is specified, the variable length argument `mrb_int` is
converted to `int`.
parent bb7eccc9
......@@ -326,7 +326,11 @@ mrb_vformat(mrb_state *mrb, const char *format, va_list ap)
len = 1;
goto L_cat;
case 'd': case 'i':
#if MRB_INT_MAX < INT_MAX
i = (mrb_int)va_arg(ap, int);
#else
i = *p == 'd' ? (mrb_int)va_arg(ap, int) : va_arg(ap, mrb_int);
#endif
obj = mrb_fixnum_value(i);
goto L_cat_obj;
#ifndef MRB_WITHOUT_FLOAT
......
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