diff options
| author | Yukihiro Matsumoto <[email protected]> | 2012-06-14 00:03:36 +0900 |
|---|---|---|
| committer | Yukihiro Matsumoto <[email protected]> | 2012-06-14 00:03:36 +0900 |
| commit | 6f670785c5deea79e78abd965de466a1d344e77a (patch) | |
| tree | 58f29f7039718afd4de45e03eb8b3fe614f64e0c /src/class.c | |
| parent | a58761787bc419cdcb08f9ad4d7795cfc1588fc3 (diff) | |
| download | mruby-6f670785c5deea79e78abd965de466a1d344e77a.tar.gz mruby-6f670785c5deea79e78abd965de466a1d344e77a.zip | |
mrb_get_args(i) should check range of float values
Diffstat (limited to 'src/class.c')
| -rw-r--r-- | src/class.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/class.c b/src/class.c index fe0a2b530..ee6cf78f4 100644 --- a/src/class.c +++ b/src/class.c @@ -542,7 +542,14 @@ mrb_get_args(mrb_state *mrb, const char *format, ...) *p = mrb_fixnum(*sp); break; case MRB_TT_FLOAT: - *p = (mrb_int)mrb_float(*sp); + { + mrb_float f = mrb_float(*sp); + + if (!FIXABLE(f)) { + mrb_raise(mrb, E_RANGE_ERROR, "float too big for int"); + } + *p = (mrb_int)f; + } break; case MRB_TT_FALSE: *p = 0; |
