summaryrefslogtreecommitdiffhomepage
path: root/src
AgeCommit message (Collapse)Author
2019-01-14Merge pull request #4222 from shuujii/use-g-instead-of-eYukihiro "Matz" Matsumoto
Use `%g` instead of `%e` for float representation in dump format
2019-01-13Use 2 digits exponent format for `printf` family on old MSVCKOBAYASHI Shuji
For conforming C standard.
2019-01-13Improve compatibility to CRuby for `Float#to_s`KOBAYASHI Shuji
Bfore: Float::INFINITY.to_s #=> "inf" 50.0.to_s #=> "50" 1e20.to_s #=> "1e+20" After / CRuby: Float::INFINITY.to_s #=> "Infinity" 50.0.to_s #=> "50.0" 1e20.to_s #=> "1.0e+20"
2019-01-11Use `%g` instead of `%e` for float representation in dump formatKOBAYASHI Shuji
`%g` use shorter representation than `%e`.
2019-01-10Remove duplicate code in numeric.cKOBAYASHI Shuji
2019-01-08Fix dump/load float leteral evaluate to infinityKOBAYASHI Shuji
Example: # example.rb p(2e308) p(-2e308) Good: $ bin/mruby example.rb inf -inf Bad: $ bin/mrbc example.rb $ bin/mruby -b example.mrb 0 -0 Cause: Float infinity representation is `inf` on dump and it is converted by corresponding `String#to_f` on load. Treatment: - Introduce new representations (`i`: +infinity, `I`: -infinity) - Allow old representations (`inf`, `-inf`, `infinity`, `-infinity`) too - Raise error for unknown representations (use corresponding `Kernel#Float`)
2019-01-04Integrate mrblib/float.rb into src/numeric.cKOBAYASHI Shuji
- Avoid hack for `MRB_WITHOUT_FLOAT` in build scripts - Avoid runtime dispatch for `MRB_WITHOUT_FLOAT`
2019-01-04Remove unused local variable `n` in `range_initialize`; #4213Yukihiro "Matz" Matsumoto
2019-01-04Merge pull request #4213 from shuujii/range-rafactorYukihiro "Matz" Matsumoto
range: Refactor range.h/range.c
2019-01-03range: Refactor range.h/range.cKOBAYASHI Shuji
Functions order, name, linkage and so on.
2019-01-03Remove `Kernel#class_defined?` which is not available in CRuby; #3829Yukihiro "Matz" Matsumoto
2019-01-01range: Embed edges in RRange on boxing environment.KOBAYASHI Shuji
[Breaking changes] Developers must use following APIs for accessing attributes of RRange because RRange structure depends on boxing setting. - mrb_range_beg - mrb_range_end - mrb_range_excl_p
2018-12-23Suppress a struct initializer warningKOBAYASHI Shuji
Suppress a compiler (clang) warning bellow: src/vm.c:104:38: warning: suggest braces around initialization of subobject [-Wmissing-braces] const mrb_value mrb_value_zero = { 0 }; ^ {}
2018-12-17Merge pull request #4189 from sdottaka/fix-mrb_ary_clearYukihiro "Matz" Matsumoto
Make mrb_ary_clear() function callable from C again
2018-12-17Small refactoring of #4188Yukihiro "Matz" Matsumoto
2018-12-17Recover `#to_int`; ref #4177Yukihiro "Matz" Matsumoto
We have removed implicit conversion to strings using `to_int`. But some users still using `to_int` as a typical integer method, i.e. they do string check by code like: `obj.respond_to?(:to_int)`. So we have recovered the method.
2018-12-17Recover `String#to_str`; ref #4177Yukihiro "Matz" Matsumoto
We have removed implicit conversion to strings using `to_str`. But some people still using `to_str` as a typical string method, i.e. they do string check by code like: `obj.respond_to?(:to_str)`. So we have recovered the method.
2018-12-15Make mrb_ary_clear() function callable from C againTakashi Sawanaka
2018-12-14Add `mrb_hash_size()` function.dearblue
2018-12-11Avoid using floating point number for HT_SEG_INCREASE_RATIO; ref #4182Yukihiro "Matz" Matsumoto
2018-12-11Rename `ht_foreach_func` to `mrb_hash_foreach_func`.Yukihiro "Matz" Matsumoto
2018-12-11Add `mrb_` prefix to `iv_foreach_func`.Yukihiro "Matz" Matsumoto
2018-12-11Add new API `mrb_iv_foreach()` to iterate over instance variables.Yukihiro "Matz" Matsumoto
2018-12-11Update `iv_foreach()` function.Yukihiro "Matz" Matsumoto
* return `void` instead of `mrb_bool'. * non zero return value from `func` breaks the loop. * no longer remove items on negative return value from `func`.
2018-12-11Update comments.Yukihiro "Matz" Matsumoto
2018-12-11Add API function `mrb_hash_foreach()` to iterate over items in a hash.Yukihiro "Matz" Matsumoto
2018-12-10Need to clear stack before invoking a block; fix #4181Yukihiro "Matz" Matsumoto
2018-11-20Restrict total recursion number of `ecall()`; fix #3789Yukihiro "Matz" Matsumoto
2018-11-19Call `mrb_str_to_str` from `mrb_string_value_ptr` for compatibility.Yukihiro "Matz" Matsumoto
2018-11-19Restore `mrb_string_type` function for compatibility.Yukihiro "Matz" Matsumoto
2018-11-19Add Hash type check for `OP_KARG` and `OP_KEY_P`; ref #4166Yukihiro "Matz" Matsumoto
2018-11-19Adjust codedump output format; ref #4166Yukihiro "Matz" Matsumoto
2018-11-19Use type checking `mrb_to_str` instead of converting `mrb_str_to_str`.Yukihiro "Matz" Matsumoto
2018-11-19Removed `to_hash` conversion method.Yukihiro "Matz" Matsumoto
2018-11-19Removed `to_ary` conversion method.Yukihiro "Matz" Matsumoto
2018-11-19Remove implicit conversion using `to_str` method; fix #3854Yukihiro "Matz" Matsumoto
We have added internal convenience method `__to_str` which does string type check. The issue #3854 was fixed but fundamental flaw of lack of stack depth check along with fibers still remains. Use `MRB_GC_FIXED_ARENA` for workaround.
2018-11-19Remove implicit conversion using `to_int` method.Yukihiro "Matz" Matsumoto
The ISO standard does not include implicit type conversion using `to_int`. This implicit conversion often causes vulnerability. There will be no more attacks like #4120. In addition, we have added internal convenience method `__to_int` which does type check and conversion (from floats).
2018-11-19The current context may be changed in `mrb_vm_exec`; ref #3668 #4104Yukihiro "Matz" Matsumoto
2018-11-19Protect Fiber from GC in `ecall()`; fix #4104Yukihiro "Matz" Matsumoto
2018-11-19Improve Hash table using variable sized segments.Yukihiro "Matz" Matsumoto
2018-11-16The key or value object could be reclaimed by GC; fix #4164Yukihiro "Matz" Matsumoto
The GC may occur between `sg_shift` and `mrb_assoc_new`, in which case `key` and `value` could be freed even tough they are still alive. The issue is found and fixed by https://hackerone.com/hexodus
2018-11-15The saved `pc` from `ERR_PC_SET` was wrong; fix #4138Yukihiro "Matz" Matsumoto
The saving `pc` position should be beginning of the instruction. But after `mruby 2.0` byte code modification, the `pc` variable points the beginning of the next instruction. We save the previous position in a local variable `pc0`.
2018-11-15Rename local variables in `mrb_debug_info_append_file`Yukihiro "Matz" Matsumoto
2018-11-15Simplify argument parsing; ref #4161Yukihiro "Matz" Matsumoto
2018-11-15Silence `-fsanitize=undefined` warning in `src/enum.c`; fix #4161Yukihiro "Matz" Matsumoto
2018-11-15Remove `filename`&`lines` from `mrb_irep` struct.Yukihiro "Matz" Matsumoto
This patch slightly reduce memory consumption (2% for my test).
2018-11-15Small renaming refactor in `dump.c`Yukihiro "Matz" Matsumoto
2018-11-07Wrong pool data length for negative floating value in a mrb file.Hiroshi Mimaki
2018-11-05Fixed wrong `ArgumentError` with keyword arguments; fix #4159Yukihiro "Matz" Matsumoto
2018-11-05Fixed a bug in argument number check with kwargs; fix #4159Yukihiro "Matz" Matsumoto