diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-01-06 22:27:39 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2020-01-06 22:27:39 +0900 |
| commit | 3e4e10ffb6576aacf66b6648242e0454ca85c2fd (patch) | |
| tree | 3ce8f2e73a64ff8b2b965e13155ffa344476de5b /src/string.c | |
| parent | c60bccaa9422d28e4d74e6f4cdb4781adcaa50c7 (diff) | |
| download | mruby-3e4e10ffb6576aacf66b6648242e0454ca85c2fd.tar.gz mruby-3e4e10ffb6576aacf66b6648242e0454ca85c2fd.zip | |
`"0x10".to_f` should be `0`, not `16.0`; fix #4924
Diffstat (limited to 'src/string.c')
| -rw-r--r-- | src/string.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c index 01f7d9efa..bf11ed668 100644 --- a/src/string.c +++ b/src/string.c @@ -2505,6 +2505,7 @@ mrb_str_len_to_dbl(mrb_state *mrb, const char *s, size_t len, mrb_bool badcheck) if (pend - p > 2 && p[0] == '0' && (p[1] == 'x' || p[1] == 'X')) { mrb_value x; + if (!badcheck) return 0.0; x = mrb_str_len_to_inum(mrb, p, pend-p, 0, badcheck); if (mrb_fixnum_p(x)) d = (double)mrb_fixnum(x); |
