mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Check if the value is fixnum before mrb_funcall(); fix #3476
The issue is reported by https://hackerone.com/aerodudrizzt
This commit is contained in:
+2
-2
@@ -959,8 +959,8 @@ mrb_str_cmp_m(mrb_state *mrb, mrb_value str1)
|
||||
else {
|
||||
mrb_value tmp = mrb_funcall(mrb, str2, "<=>", 1, str1);
|
||||
|
||||
if (mrb_nil_p(tmp)) return mrb_nil_value();
|
||||
if (!mrb_fixnum(tmp)) {
|
||||
if (!mrb_nil_p(tmp)) return mrb_nil_value();
|
||||
if (!mrb_fixnum_p(tmp)) {
|
||||
return mrb_funcall(mrb, mrb_fixnum_value(0), "-", 1, tmp);
|
||||
}
|
||||
result = -mrb_fixnum(tmp);
|
||||
|
||||
Reference in New Issue
Block a user