9678 Commits

Author SHA1 Message Date
Hiroshi Mimaki 1c09046c13 Update release date. 2.0.0 2018-12-11 10:52:20 +09:00
Hiroshi Mimaki 716e7b815f Fixed missing comma in mruby/mirb usage. 2018-12-11 09:37:23 +09:00
Hiroshi Mimaki e3ae0e4f29 Merge branch 'master' into stable 2018-11-27 09:09:20 +09:00
Yukihiro "Matz" Matsumoto 26475d0a78 Update doc/limitations.md for argument destructuring. 2018-11-25 18:03:27 +09:00
Yukihiro "Matz" Matsumoto 762f682b80 Allow destructuring in formal arguments.
e.g.
```
def m(a,(b,c),d); p [a,b,c,d]; end
m(1,[2,3],4)  # => [1,2,3,4]
```

mruby limitation:
Destructured arguments (`b` and `c` in above example) cannot be accessed
from the default expression of optional arguments and keyword arguments,
since actual assignment is done after the evaluation of those default
expressions. Thus:

```
def f(a,(b,c),d=b)
  p [a,b,c,d]
end
f(1,[2,3])
```

raises `NoMethodError` for `b` in mruby.
2018-11-25 09:07:49 +09:00
Yukihiro "Matz" Matsumoto e6b72b2121 Remove redundant rules from parse.y. 2018-11-25 07:30:32 +09:00
Yukihiro "Matz" Matsumoto 7ed9bb3bd3 Fix wrong number of arguments in Array#fetch; fix #4170 2018-11-25 06:05:07 +09:00
Yukihiro "Matz" Matsumoto e2e6554b56 Protect from exceptions raised outside of mrb_vm_run().
It can happen if signals are used (e.g. from `mruby-alarm` gem).
2018-11-25 06:05:07 +09:00
Yukihiro "Matz" Matsumoto 91bf55bbe5 Remove do { ... } while(0) hacks from MRB_TRY macros.
Because it can swallow `break` etc. if they are used in loops.
2018-11-25 06:05:07 +09:00
Hiroshi Mimaki 0711c861ca Fix mruby-socket test failure on MinGW. 2018-11-22 09:49:00 +09:00
Yukihiro "Matz" Matsumoto b158f26f0c Merge pull request #4168 from robfors/doc
Add documentation to mrb_load_irep
2018-11-21 12:16:07 +09:00
Rob Fors c9a66d4c41 Update documentation to mrb_load_irep 2018-11-20 21:27:03 -05:00
Yukihiro "Matz" Matsumoto 68c5384830 Update version number; fix #4165 2018-11-20 10:43:34 +09:00
Yukihiro "Matz" Matsumoto ec19c34a20 Fixed a bug in mirb heredoc handling; fix #3989 2018-11-20 10:39:34 +09:00
Yukihiro "Matz" Matsumoto f1eeaad84a Stop special treating of \r in the lexer; fix #4132 2018-11-20 09:35:38 +09:00
Yukihiro "Matz" Matsumoto 86d102350b Restrict total recursion number of ecall(); fix #3789 2018-11-20 09:14:34 +09:00
Yukihiro "Matz" Matsumoto afd46eccd1 Add -fpermissive to C++ compiler flags. 2018-11-19 17:11:59 +09:00
Yukihiro "Matz" Matsumoto 65a2c2082d Call mrb_str_to_str from mrb_string_value_ptr for compatibility. 2018-11-19 17:11:19 +09:00
Yukihiro "Matz" Matsumoto 53e2df3e93 Restore mrb_string_type function for compatibility. 2018-11-19 16:13:26 +09:00
Yukihiro "Matz" Matsumoto c308a149f0 Add Hash type check for OP_KARG and OP_KEY_P; ref #4166 2018-11-19 15:35:59 +09:00
Yukihiro "Matz" Matsumoto 423f872c84 Need to keep rooms for empty splat; fix #4166 2018-11-19 15:26:19 +09:00
Yukihiro "Matz" Matsumoto 87ffab5713 Adjust codedump output format; ref #4166 2018-11-19 15:25:42 +09:00
Yukihiro "Matz" Matsumoto 9516731329 Use type checking mrb_to_str instead of converting mrb_str_to_str. 2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto c022e4643f Avoid assignments from type checking String#__to_str. 2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto 610bcc88c2 Removed to_hash conversion method. 2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto 698f5f707c Removed to_ary conversion method. 2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto 5bbcea9b3b Removed try_convert method from Array and Hash. 2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto b5d43a16a3 Removed String#try_convert method from mruby-string-ext gem.
Because `try_convert` method rarely used in production. For mruby users,
we have `__to_str` utility method to check string type.
2018-11-19 12:08:28 +09:00
Yukihiro "Matz" Matsumoto ff08856fe3 Remove implicit conversion using to_str method; fix #3854
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-19 12:05:46 +09:00
Yukihiro "Matz" Matsumoto afca99a40b Remove implicit conversion using to_int method.
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-19 11:28:51 +09:00
Yukihiro "Matz" Matsumoto 426c1f9e0b fix non-ASCII comment. 2018-11-19 11:28:03 +09:00
Yukihiro "Matz" Matsumoto 0a0cc5a217 Check method existence for Enumerators; fix #3920
The issue #3920 was fixed but the fundamental flaw of lack of stack
depth check along with fibers still remains, even though it's not
easy to cause the issue.  Use `MRB_GC_FIXED_ARENA` to avoid the issue
for workaround.

After this patch, `obj.to_enum` raises `ArgumentError` if the object
does not respond to the enumerating method. This is incompatible to
CRuby but I think this behavior is better and CRuby should be updated
to behave like this.
2018-11-19 10:57:07 +09:00
Yukihiro "Matz" Matsumoto 31a961acf1 The current context may be changed in mrb_vm_exec; ref #3668 #4104 2018-11-19 09:50:31 +09:00
Yukihiro "Matz" Matsumoto cab6b0f39b Protect Fiber from GC in ecall(); fix #4104 2018-11-19 09:49:20 +09:00
Yukihiro "Matz" Matsumoto 25d390d6cc Improve Hash table using variable sized segments. 2018-11-19 09:30:15 +09:00
Yukihiro "Matz" Matsumoto 180b73fec4 The key or value object could be reclaimed by GC; fix #4164
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-16 01:04:57 +09:00
Yukihiro "Matz" Matsumoto 0a022f7b8d The saved pc from ERR_PC_SET was wrong; fix #4138
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-15 23:34:32 +09:00
Yukihiro "Matz" Matsumoto 418ad65db4 Fixed a bug in continuous read of target files; ref #4138
Line number information in a compiled file was wrong.
2018-11-15 23:34:32 +09:00
Yukihiro "Matz" Matsumoto 7e3e8d8ed5 Shrink file name table size to uint16_t; ref #4138 2018-11-15 23:34:32 +09:00
Yukihiro "Matz" Matsumoto faf51f82c7 Rename local variables in mrb_debug_info_append_file 2018-11-15 23:34:32 +09:00
Yukihiro "Matz" Matsumoto 56db3cf3eb Simplify argument parsing; ref #4161 2018-11-15 21:01:56 +09:00
Yukihiro "Matz" Matsumoto f39f428ed4 Silence -fsanitize=undefined warning in src/enum.c; fix #4161 2018-11-15 21:01:56 +09:00
Yukihiro "Matz" Matsumoto 61f49690e4 Remove filename&lines from mrb_irep struct.
This patch slightly reduce memory consumption (2% for my test).
2018-11-15 21:01:56 +09:00
Yukihiro "Matz" Matsumoto 1bea1e2050 Small renaming refactor in dump.c 2018-11-15 19:24:45 +09:00
Yukihiro "Matz" Matsumoto 485955eccc String#{squeeze,delete,count} to use bitmap for matching; ref #4163 2018-11-15 04:51:27 +09:00
Yukihiro "Matz" Matsumoto 4550f4e381 Pattern length may overflow uint16_t; fixed #4163
The issue is reported by `https://hackerone.com/dgaletic`.
2018-11-15 02:03:54 +09:00
Yukihiro "Matz" Matsumoto c3188cac43 Merge pull request #4160 from mimaki/wrong-negative-float-in-mrb
Wrong pool data length for negative floating value in a mrb file.
2018-11-07 18:22:13 +09:00
Hiroshi Mimaki 7d7f9feee7 Wrong pool data length for negative floating value in a mrb file. 2018-11-07 17:20:18 +09:00
Yukihiro "Matz" Matsumoto d25ebec988 Fixed wrong ArgumentError with keyword arguments; fix #4159 2018-11-05 21:52:17 +09:00
Yukihiro "Matz" Matsumoto d47003aea4 Fixed a bug in argument number check with kwargs; fix #4159 2018-11-05 07:44:25 +09:00