Unverified Commit ef8621cb authored by Yukihiro "Matz" Matsumoto's avatar Yukihiro "Matz" Matsumoto Committed by GitHub

Merge pull request #4885 from shuujii/fix-potentially-crash-in-%n-of-mrb_vformat-with-64-bit-int

Fix potentially crash in `%n` of `mrb_vformat()` with 64-bit `int`
parents 19fa77dd e8299a89
...@@ -302,7 +302,11 @@ mrb_vformat(mrb_state *mrb, const char *format, va_list ap) ...@@ -302,7 +302,11 @@ mrb_vformat(mrb_state *mrb, const char *format, va_list ap)
mrb_gc_arena_restore(mrb, ai); mrb_gc_arena_restore(mrb, ai);
break; break;
case 'n': case 'n':
#if UINT32_MAX < INT_MAX
obj = mrb_symbol_value((mrb_sym)va_arg(ap, int));
#else
obj = mrb_symbol_value(va_arg(ap, mrb_sym)); obj = mrb_symbol_value(va_arg(ap, mrb_sym));
#endif
goto L_cat_obj; goto L_cat_obj;
case 's': case 's':
chars = va_arg(ap, char*); chars = va_arg(ap, char*);
......
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