summaryrefslogtreecommitdiffhomepage
path: root/src/error.c
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2017-08-11 09:21:47 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2017-08-11 09:21:47 +0900
commit3e075a7b6c6082aa728c9fd093e42be862bbf700 (patch)
tree2ada33f234151e2f7b0236beda3a74ad156c702d /src/error.c
parent68470bef862f14501ff0d8a3a6ac78ea38ab383b (diff)
downloadmruby-3e075a7b6c6082aa728c9fd093e42be862bbf700.tar.gz
mruby-3e075a7b6c6082aa728c9fd093e42be862bbf700.zip
Should not call `to_str` in `mrb_vformat`; fix #3773
Diffstat (limited to 'src/error.c')
-rw-r--r--src/error.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/error.c b/src/error.c
index 062282719..cd771dc2d 100644
--- a/src/error.c
+++ b/src/error.c
@@ -269,9 +269,12 @@ mrb_vformat(mrb_state *mrb, const char *format, va_list ap)
if (c == '%') {
if (*p == 'S') {
+ mrb_value val;
+
size = p - b - 1;
mrb_ary_push(mrb, ary, mrb_str_new(mrb, b, size));
- mrb_ary_push(mrb, ary, va_arg(ap, mrb_value));
+ val = va_arg(ap, mrb_value);
+ mrb_ary_push(mrb, ary, mrb_obj_as_string(mrb, val));
b = p + 1;
}
}