| Age | Commit message (Collapse) | Author |
|
|
|
In top-level, `mid` is `NULL`. We used to ignore 'mid` update for `NULL`.
|
|
|
|
This bug was introduced in 694089f to address #4832
|
|
|
|
Issue 19902: mruby:mruby_fuzzer: Stack-buffer-overflow in mrb_str_len_to_dbl
|
|
|
|
|
|
|
|
|
|
|
|
|
|
The basic idea of this change is from @dearblue.
Note: the arguments of `mrb_str_pool()` have changed, but the function
is provided for internal use (No `MRB_API`). So basically you don't have
to worry about the change.
|
|
The behavior when returning from a function without `va_end()` is
undefined.
|
|
|
|
shuujii/add-mrb_num_args_error-for-wrong-number-of-arguments-error
Add `mrb_num_args_error()` for "wrong number of arguments" error
|
|
Because literal pool may be released by GC.
#### Example:
```ruby
s1 = eval('"abcdefghijklmnopqrstuvwxyz01"')
GC.start
p s1 #=> "\x00\x00\x00\x00\x00\x00\x00\x90\x00\x00\x00\x00\x00\x00\x00\x90\x03\x00stuvwxyz01"
```
|
|
Integrate `i` and `arg_i` in `mrb_get_args()`
|
|
The behavior of these two variables is the same.
|
|
|
|
#### Example (with `MRB_METHOD_CACHE`)
```ruby
GC.start
c = Class.new
p c #=> #<Class:0x7fd6a180e790>
c.new #=> cache `c.new`
c = nil
GC.start #=> `c` is GCed
r = Range.dup
p r #=> #<Class:0x7fd6a180e790>
# [same pointer as `c`]
r.new(2, 3) #=> ArgumentError: 'initialize':
# wrong number of arguments (2 for 0)
# [`c.new` is called instead of `r.new`]
```
#### Cause
An entry of method cache is identified by class pointer and method
id. However, reusing memory after GC may create a class with the same
pointer as the cached class.
#### Treatment
Cleared method caches of the class when the class is GCed.
|
|
If `mrb_sym` is smaller than `int`, it is promoted to `int`.
|
|
|
|
shuujii/remove-location-info-from-Exception-inspect
Remove location info from `Exception#inspect`
|
|
The following improvements are made according to Ruby's behavior:
- Match location number to index.
- Remove duplicate most recent call output.
- Fix that first call is not output when array (unpacked) backtrace.
### Example
```ruby
def a; raise "error!" end
def b; a end
begin
b
rescue => e
e.backtrace if ARGV[0] == "unpack" # unpack backtrace
raise e
end
```
#### Before this patch:
```
$ bin/mruby example.rb unpack
trace (most recent call last):
[0] example.rb:2:in b
[1] example.rb:1:in a
example.rb:1: error! (RuntimeError)
```
#### After this patch:
```
$ bin/mruby example.rb unpack
trace (most recent call last):
[2] example.rb:4
[1] example.rb:2:in b
example.rb:1:in a: error! (RuntimeError)
```
|
|
`struct backtrace_location` is created only in `each_backtrace()`, and
the `filename` field will never be null (it will be `(unknown)` if null).
|
|
Because location info (file name and line number) is kept in the backtrace,
it should not be kept in the result of `inspect` (and the exception object
itself), I think.
### Example
```ruby
# example.rb
begin
raise "err"
rescue => e
p e
end
```
#### Before this patch:
```
$ bin/mruby example.rb
example.rb:2: err (RuntimeError)
```
#### After this patch:
```
$ bin/mruby example.rb
err (RuntimeError)
```
|
|
The `#prepend_features` and `#module_function` methods are not haves for
class objects.
|
|
#### Before this patch:
```
$ mruby -e '[].each(1){}' #=> no error
```
#### After this patch:
```
$ mruby -e '[].each(1){}' #=> ArgumentError: wrong number of arguments
```
|
|
To unify the style of messages.
|
|
#### Before this patch:
```ruby
Integer("1_ ") #=> 1
```
#### After this patch (same as Ruby):
```ruby
Integer("1_ ") #=> ArgumentError
```
|
|
#### Before this patch:
```ruby
Integer("_1") #=> 1
"_1".to_i #=> 1
```
#### After this patch (same as Ruby):
```ruby
Integer("_1") #=> ArgumentError
"_1".to_i #=> 0
```
|
|
shuujii/fix-that-String-to_f-accepts-consecutive-_-as-a-numeric-expression
Fix that `String#to_f` accepts consecutive `_` as a numeric expression
|
|
Consecutive `_` is not allowed as a numeric expression:
1_2__3 #=> SyntaxError
Float("1_2__3") #=> ArgumentError
Integer("1_2__3") #=> ArgumentError
"1_2__3".to_i #=> 12
But `String#to_f` accept it, so I fixed the issue.
Before this patch:
"1_2__3".to_f #=> 123
After this patch:
"1_2__3".to_f #=> 12
|
|
|
|
Fix keyword arguments not be obtained with `mrb_get_args()`; Fix #4754
|
|
#### Before this patch:
```
$ bin/mruby -e 'Float("1_a")'
-e:1: invalid string for float(a) (ArgumentError)
```
#### After this patch:
```
$ bin/mruby -e 'Float("1_a")'
-e:1: invalid string for float("1_a") (ArgumentError)
```
|
|
If ":" is after "|" and there is no "?" or "*", the keyword argument
could not be obtained and it was not initialized with `undef`.
For example: "|oo:"
|
|
* The allocated memory is guaranteed to be aligned for any data type (it was
not guaranteed when string type is embed).
* Make allocation size exactly specified size (does not allocate space for a
null byte).
|
|
Add assertion to `RVALUE` size
|
|
The bit width terminology is unified to `BIT` according to `MRB_INT_BIT`
and `CHAR_BIT`. Also the bit position terminology is unified to `BIT_POS`.
|
|
|
|
Previously, `mrb_int` was used as the type that represents the buffer size
on memory, but the sizes of `RString` and `RArray` exceed 6 words when
`MRB_INT64` is enabled on 32-bit CPU.
I don't think it is necessary to be able to represent the buffer size on
memory that exceeds the virtual address space. Therefore, for this purpose,
introduce `mrb_ssize` which doesn't exceed the sizes of `mrb_int` and
pointer.
I think all `mrb_int` used for this purpose should be changed to
`mrb_ssize`, but currently only the members of the structures (`RString`,
`mrb_shared_string`, `RArray` and `mrb_shared_array`) are changed.
|
|
- Keep `MRB_STR_ASCII` flag.
- Avoid a string object creation.
|
|
Fix argument specs to `Kernel`
|
|
This feature was reverted from Ruby 2.7.
|
|
|
|
|
|
|
|
|