profile
viewpoint
Yukihiro "Matz" Matsumoto matz Ruby Association,NaCl,Heroku,Etc. Matsue, Japan

matz/streem 4413

prototype of stream based programming language

matz/mruby 85

Lightweight Ruby

matz/mail 7

A Really Ruby Mail Library

matz/csv_parser 2

Simple CSV parser written in C

matz/lockfree-queue 1

A simple lock-free queue implementation.

matz/mruby-onig-regexp 0

mrbgem of 鬼雲's Regular Expression

matz/qmk_firmware 0

keyboard controller firmware for Atmel AVR and ARM USB families

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha 0301d8a89bb802b04a5d34a1c2376875338d3655

Fix integer boundary check before `float` to `time_t` casting.

view details

push time in 6 days

push eventmruby/mruby

David Siaw

commit sha 36efc3365086c80c72faa27fe7192e089b457b49

include time.h for ios

view details

Yukihiro "Matz" Matsumoto

commit sha 736ea1f5c71a7e79b6c83b27c96c88ccaba08d2d

Merge pull request #4941 from davidsiaw/mac-compat Include time.h for ios

view details

push time in 12 days

PR merged mruby/mruby

Include time.h for ios

An as-of-yet incomplete project of mine embedding mruby in iOS has revealed that struct timeval on recent versions of Darwin iOS is defined in sys/time.h.

This should have a minimal impact on other platforms.

<details> If you wish to have a test for this I will be able to produce one in time. Currently I use a very hacked up xcode project file that includes a set of C files generated by mrbgems, and the project file is not fit for general consumption because it only includes a very specific set of mrbgems.

Once I have a working project file generation tool I will share it and this problem will become obvious, or if you have a minimal project using iOS you can see this issue.

I may be doing it wrong and could have been a build setting away from making mruby compile on iOS without this change, and would gladly take advice on how to proceed.

+1 -0

0 comment

1 changed file

davidsiaw

pr closed time in 12 days

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha 6d9109bf70e2a86537ac3e1f1ea6053aab96132b

Use simple search for short strings in `mrb_memsearch_qs`; close #4940 Differences from the PR #4940: * Use simple search for short strings only. * "short" means `m+n` is shorter than `MRB_QS_SHORT_STRING_LENGTH`. * The current default value for `MRB_QS_SHORT_STRING_LENGTH` is 2048.

view details

Yukihiro "Matz" Matsumoto

commit sha ffb55e51f11ee87e71a1241c1e0aa59d96dd07bb

Add explicit type cast to return value from `mrmchr`; ref #4940 C++ is stricter in implicit type casting.

view details

push time in 15 days

PR closed mruby/mruby

Add `MRB_USE_SMALL_STRING_SEARCH` configuration
  • Switches the used string search algorithm to Naive Algorithm
  • Slows down
  • "Call stack memory" usage can probably be reduced to less than 10% (in 32-bit CPU mode, you can expect to reduce usage from more than 1 kilobyte to less than 50 bytes)
+23 -0

0 comment

3 changed files

dearblue

pr closed time in 15 days

push eventmruby/mruby

dearblue

commit sha 8020374d6b8b5d2d31acc0dfec8c2273b6d22e76

Fix builds for old mingw in mruby-socket; ref #4914

view details

Yukihiro "Matz" Matsumoto

commit sha 3c67d9b1c0e4970db1d88fccdf7f26c781aa2c5f

Merge pull request #4938 from dearblue/socket-mingw Fix builds for old mingw in mruby-socket; ref #4914

view details

push time in 17 days

PR merged mruby/mruby

Fix builds for old mingw in mruby-socket; ref #4914
+14 -7

0 comment

3 changed files

dearblue

pr closed time in 17 days

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha c8f4d72302e43678384c1e04702ba10ed2567a3d

Move fallback definitions of `FLT_EPSILON` etc. after `#include <mruby/value.h>` that includes `float.h`. It allows definitions from native headers.

view details

Yukihiro "Matz" Matsumoto

commit sha f34623fb03d142e30a1b258dda857d7235401f7c

Fix arena index type from `mrb_int` to just `int`.

view details

Yukihiro "Matz" Matsumoto

commit sha 10c2b7ee1c2783498efa14a41648cbd8a7a99453

Remove unnecessary use of `uint16_t` in `symbol.c`.

view details

Yukihiro "Matz" Matsumoto

commit sha c0a6439a693f77be1c4ef77620be00c8433d8da1

Avoid implicit integer casting in `backtrace.c` and `hash.c`.

view details

Yukihiro "Matz" Matsumoto

commit sha 724c90f3699c721113c0c575a8aac0d3ba2895a6

Avoid casting warning from `mrb_int` to `int` in `io.c`.

view details

Yukihiro "Matz" Matsumoto

commit sha db64bd42d358425250d05b02a0880702da2cea87

Add explicit casting in `file.c` to silence warnings.

view details

push time in 18 days

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha 7771c215e494cf1f4b30a96bf1603014cc75ff2a

Removed junk. My cat stepped on the keyboard at the last moment before the commit.

view details

push time in 20 days

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha ff5d1914abef2a0595bdf6f7692dbf30dc7acda8

Remove unused local variable `mid`; ref #4936

view details

push time in 20 days

CommitCommentEvent

issue commentmruby/mruby

Mruby build issue with latest version

May I close this issue?

Zogoo

comment created time in 21 days

push eventmruby/mruby

dearblue

commit sha 69619aeeb1434c30565ff1229897cf5b1af462da

Support bit flags for `IO.open` Note that this bit flags are not compatible with the native flags defined in `#include <fcntl.h>`.

view details

Yukihiro "Matz" Matsumoto

commit sha e7e999414cd651f6251d5a1452aa3aff827dc01a

Merge pull request #4873 from dearblue/open-flags Support bit flags for `IO.open`

view details

push time in 21 days

PR merged mruby/mruby

Support bit flags for `IO.open`

Note that this bit flags are not compatible with the native flags defined in #include <fcntl.h>.

+151 -88

0 comment

4 changed files

dearblue

pr closed time in 21 days

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha 364c47610f6349bc3059ff6435d856438befec17

Fixed backtrace message for top-level blocks; fix #4936 In top-level, `mid` is `NULL`. We used to ignore 'mid` update for `NULL`.

view details

push time in 21 days

issue closedmruby/mruby

The method name becomes `call` in backtrace inside a block outside a method

mruby

$ bin/mruby -e '1.times{raise}'
trace (most recent call last):
	[2] -e:1
	[1] mrblib/numeric.rb:77:in times
-e:1:in call: RuntimeError

Ruby

$ ruby -e '1.times{raise}'
Traceback (most recent call last):
	2: from -e:1:in `<main>'
	1: from -e:1:in `times'
-e:1:in `block in <main>': unhandled exception

closed time in 21 days

shuujii

pull request commentmruby/mruby

Fix take over file scope variables with `mruby` and `mirb` command

@dearblue It works as CRuby (1) on my box.

dearblue

comment created time in a month

issue commentmruby/mruby

Mruby build issue with latest version

The first error (concerning _mrb_sym2str) was caused by the version mismatch between ngx_mruby and mruby. You have to recompile both ngx_mruby and mruby. The second error is a mystery. I believe clang ld is kind enough to show the missing symbols. Could you show the whole error messages?

Zogoo

comment created time in a month

push eventmruby/mruby

Hiroshi Mimaki

commit sha e24b4a1e196a6c5113175d2ee88aa00285545ddf

Delete duplicated `Array#delete_if`.

view details

Hiroshi Mimaki

commit sha 7d9a49efab426c8b61f71860be56c3f379e5c1b3

Delete duplicated `Array#delete_if` test.

view details

Yukihiro "Matz" Matsumoto

commit sha 59464f35285e65598bca94ad9e77be6848a8e8be

Merge pull request #4935 from mimaki/delete-duplicated-Array-delete_if Delete duplicated `Array#delete_if`.

view details

push time in a month

pull request commentmruby/mruby

Integrate `Fixnum` class into `Integer` class

I have a plan to change Fixnum into Integer in mruby3.0. I will merge this PR in mruby3.0.

dearblue

comment created time in a month

issue commentmruby/mruby

What is the preffered way to call super(args) from C API?

Thank you for understanding. mruby has tighter restrictions.

dmajkic

comment created time in a month

issue commentmruby/mruby

What is the preffered way to call super(args) from C API?

It can be a workaround, but not ideal. mrb_funcall also causes recursive VM calls. When SuperClass is a third-party library, you cannot help doing this workaround. You have to be aware of the drawbacks of recursive VM calls.

  • Potential context-switching problems when you use fibers.
  • Potential system stack overflow by deep (VM) recursion.
dmajkic

comment created time in a month

pull request commentmruby/mruby

Enable `MRB_GC_STRESS` test on CI

Understood. Done in f7abda14.

shuujii

comment created time in a month

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha ff57c0278fe7c2b83231fa40e0284e6685a29ee7

Remove broken `MRB_INT16` configuration option.

view details

Yukihiro "Matz" Matsumoto

commit sha f7abda14370e6341dad180da3d04f8f2f4ff0cf0

Remove `debug` target from `travis_config.rb`.

view details

push time in a month

pull request commentmruby/mruby

Enable `MRB_GC_STRESS` test on CI

It's not intentional. Should I remove debug target from travis_config.rb?

shuujii

comment created time in a month

issue closedmruby/mruby

What is the preffered way to call super(args) from C API?

What is the preffered way to call super(arg) from C API?

In MRI we have rb_call_super(). Is there an equivalent in mruby API?

closed time in a month

dmajkic

issue commentmruby/mruby

What is the preffered way to call super(args) from C API?

We didn't provide the counterpart of rb_call_super() in mruby intentionally. We don't want dynamic dispatch from within C functions to avoid recursive VM calls. You can either:

  • call C function that implements the super method
  • or implement the method in Ruby

You may want to implement the part of the method in C. Usually, those functions start with __ (e.g. __update_hash) are C part of the methods.

dmajkic

comment created time in a month

issue commentmruby/mruby

integer underflow in ary_expand_capa in src/array.c:215

We have already checked. ASAN warns in malloc before returning NULL. That is the problem.

sleicasper

comment created time in a month

CommitCommentEvent

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha 2742ded32fe18f88833d76b297f5c2170b6880c3

Fixed wrong condition in #4926 fix.

view details

push time in a month

CommitCommentEvent

issue commentmruby/mruby

integer underflow in ary_expand_capa in src/array.c:215

This is not integer underflow. It's just specifying a big number for array allocation. This is kind of a tough problem to stop ASAN error. Usually, we have no way to get the allocation limit except for just calling malloc() and see if it returns NULL. That means there's no way to avoid this ASAN warning.

I just don't know how to treat this error. I'd rather vote for no-bug for this case.

sleicasper

comment created time in a month

issue closedmruby/mruby

stack overflow in mrb_str_len_to_dbl in src/string.c:2542

build mruby in ubuntu18.04 64 bit with ASAN poc:

a=0
b="asdfasdfasdf adaf asdf asdfa sdf asdfasdfasdfa sdf"
c={1=>1, 2=>"foo", "foo"=>nil, nil=> nil}
d=[1,nil," sdfg"]
srand(1337)
a = d.prepend(c,c,){||  }
d = d.reverse(){||  }
b = b.rstrip(){||  }
a = d.join(){||  }
a = d.Float(a,){||  }

result:

==312==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fff44aed8c6 at pc 0x000000605489 bp 0x7fff44aed850 sp 0x7fff44aed848
WRITE of size 1 at 0x7fff44aed8c6 thread T0
    #0 0x605488 in mrb_str_len_to_dbl /home/casper/targets/gramma/mruby/dbg/BUILD/src/string.c:2542:12
    #1 0x6037d9 in mrb_str_to_dbl /home/casper/targets/gramma/mruby/dbg/BUILD/src/string.c:2576:10
    #2 0x65a8eb in mrb_Float /home/casper/targets/gramma/mruby/dbg/BUILD/src/object.c:560:35
    #3 0x7dd373 in mrb_f_float /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-kernel-ext/src/kernel.c:134:10
    #4 0x59356f in mrb_vm_exec /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:1444:18
    #5 0x583324 in mrb_vm_run /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:947:12
    #6 0x5da14f in mrb_top_run /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:2850:12
    #7 0x6a450d in mrb_load_exec /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-compiler/core/parse.y:6438:7
    #8 0x6a521d in mrb_load_file_cxt /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-compiler/core/parse.y:6447:10
    #9 0x4f24ff in main /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:327:11
    #10 0x7f81ecde2b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #11 0x41c479 in _start (/home/casper/targets/gramma/mruby/dbg/fuzzrun/mruby+0x41c479)

Address 0x7fff44aed8c6 is located in stack of thread T0 at offset 102 in frame
    #0 0x604a3f in mrb_str_len_to_dbl /home/casper/targets/gramma/mruby/dbg/BUILD/src/string.c:2493

  This frame has 4 object(s):
    [32, 102) 'buf' (line 2494) <== Memory access at offset 102 overflows this variable
    [144, 152) 'end' (line 2497)
    [176, 192) 'x' (line 2506)
    [208, 224) 'tmp' (line 2509)
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow /home/casper/targets/gramma/mruby/dbg/BUILD/src/string.c:2542:12 in mrb_str_len_to_dbl
Shadow bytes around the buggy address:
  0x100068955ac0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100068955ad0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100068955ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100068955af0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100068955b00: 00 00 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1
=>0x100068955b10: 00 00 00 00 00 00 00 00[06]f2 f2 f2 f2 f2 00 f2
  0x100068955b20: f2 f2 f8 f8 f2 f2 f8 f8 f3 f3 f3 f3 00 00 00 00
  0x100068955b30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100068955b40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100068955b50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x100068955b60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==312==ABORTING

closed time in a month

sleicasper

issue commentmruby/mruby

stack overflow in mrb_str_len_to_dbl in src/string.c:2542

Fixed by 2124b9b4

sleicasper

comment created time in a month

issue closedmruby/mruby

heap use after free in hash_slice in mrbgems/mruby-hash-ext/src/hash-ext.c:61

build mruby in ubuntu18.04 64 bit with ASAN

poc:

a=0
b="asdfasdfasdf adaf asdf asdfa sdf asdfasdfasdfa sdf"
c={1=>1, 2=>"foo", "foo"=>nil, nil=> nil}
d=[1,nil," sdfg"]
srand(1337)
a = d.instance_eval(){||  }
a = c.slice(c,c,a,c,c,d,d,c,c,a,a,c,b,a,c,c,a,d,d,b,a,a,a,c,d,b,a,d,a,a,d,d,c,c,a,d,a,a,b,d,b,c,c,a,c,c,c,a,c,b,d,d,b,b,d,a,c,c,a,c,a,c,c,c,c,b,c,a,d,b,d,c,b,d,a,b,a,a,d,b,a,a,a,d,c,b,b,c,a,c,b,b,c,d,a,d,b,b,c,a,a,d,b,b,c,d,d,c,a,a,a,d,a,d,d,c,c,b,c,){||  }

result:

==47556==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d000000af0 at pc 0x0000004a8122 bp 0x7ffeb5a96a50 sp 0x7ffeb5a96200
READ of size 16 at 0x61d000000af0 thread T0
    #0 0x4a8121 in __asan_memcpy /home/casper/fuzz/fuzzdeps/llvm-9.0.0.src/projects/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cc:22
    #1 0x7be22c in hash_slice /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-hash-ext/src/hash-ext.c:61:21
    #2 0x59356f in mrb_vm_exec /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:1444:18
    #3 0x583324 in mrb_vm_run /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:947:12
    #4 0x5da14f in mrb_top_run /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:2850:12
    #5 0x6a450d in mrb_load_exec /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-compiler/core/parse.y:6438:7
    #6 0x6a521d in mrb_load_file_cxt /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-compiler/core/parse.y:6447:10
    #7 0x4f24ff in main /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:327:11
    #8 0x7f3a58255b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #9 0x41c479 in _start (/home/casper/targets/gramma/mruby/dbg/fuzzrun/mruby+0x41c479)

0x61d000000af0 is located 112 bytes inside of 2048-byte region [0x61d000000a80,0x61d000001280)
freed by thread T0 here:
    #0 0x4a9388 in realloc /home/casper/fuzz/fuzzdeps/llvm-9.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:164
    #1 0x543a35 in mrb_default_allocf /home/casper/targets/gramma/mruby/dbg/BUILD/src/state.c:56:12
    #2 0x4f56ab in mrb_realloc_simple /home/casper/targets/gramma/mruby/dbg/BUILD/src/gc.c:209:8
    #3 0x4f5dae in mrb_realloc /home/casper/targets/gramma/mruby/dbg/BUILD/src/gc.c:223:8
    #4 0x575629 in stack_extend_alloc /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:203:27
    #5 0x575158 in mrb_stack_extend /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:224:5
    #6 0x578f57 in mrb_funcall_with_block /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:500:5
    #7 0x576ce5 in mrb_funcall_argv /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:539:10
    #8 0x576786 in mrb_funcall /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:400:10
    #9 0x65d032 in mrb_eql /home/casper/targets/gramma/mruby/dbg/BUILD/src/object.c:639:10
    #10 0x670138 in ht_hash_equal /home/casper/targets/gramma/mruby/dbg/BUILD/src/hash.c:126:22
    #11 0x660f09 in ht_get /home/casper/targets/gramma/mruby/dbg/BUILD/src/hash.c:458:11
    #12 0x6629c5 in mrb_hash_fetch /home/casper/targets/gramma/mruby/dbg/BUILD/src/hash.c:728:7
    #13 0x7be48e in hash_slice /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-hash-ext/src/hash-ext.c:64:11
    #14 0x59356f in mrb_vm_exec /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:1444:18
    #15 0x583324 in mrb_vm_run /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:947:12
    #16 0x5da14f in mrb_top_run /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:2850:12
    #17 0x6a450d in mrb_load_exec /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-compiler/core/parse.y:6438:7
    #18 0x6a521d in mrb_load_file_cxt /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-compiler/core/parse.y:6447:10
    #19 0x4f24ff in main /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:327:11
    #20 0x7f3a58255b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310

previously allocated by thread T0 here:
    #0 0x4a9388 in realloc /home/casper/fuzz/fuzzdeps/llvm-9.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:164
    #1 0x543a35 in mrb_default_allocf /home/casper/targets/gramma/mruby/dbg/BUILD/src/state.c:56:12
    #2 0x4f56ab in mrb_realloc_simple /home/casper/targets/gramma/mruby/dbg/BUILD/src/gc.c:209:8
    #3 0x4f5dae in mrb_realloc /home/casper/targets/gramma/mruby/dbg/BUILD/src/gc.c:223:8
    #4 0x4f6563 in mrb_malloc /home/casper/targets/gramma/mruby/dbg/BUILD/src/gc.c:245:10
    #5 0x4f6608 in mrb_calloc /home/casper/targets/gramma/mruby/dbg/BUILD/src/gc.c:263:9
    #6 0x57a507 in stack_init /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:131:28
    #7 0x577be9 in mrb_funcall_with_block /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:461:7
    #8 0x5774fc in mrb_funcall_with_block /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:439:13
    #9 0x576ce5 in mrb_funcall_argv /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:539:10
    #10 0x63e56b in mrb_obj_new /home/casper/targets/gramma/mruby/dbg/BUILD/src/class.c:1553:5
    #11 0x5e4894 in mrb_exc_new_str /home/casper/targets/gramma/mruby/dbg/BUILD/src/error.c:31:10
    #12 0x5f00df in mrb_init_exception /home/casper/targets/gramma/mruby/dbg/BUILD/src/error.c:574:20
    #13 0x6c4c94 in mrb_init_core /home/casper/targets/gramma/mruby/dbg/BUILD/src/init.c:42:3
    #14 0x5439cb in mrb_open_core /home/casper/targets/gramma/mruby/dbg/BUILD/src/state.c:43:3
    #15 0x543a9c in mrb_open_allocf /home/casper/targets/gramma/mruby/dbg/BUILD/src/state.c:71:20
    #16 0x543a6a in mrb_open /home/casper/targets/gramma/mruby/dbg/BUILD/src/state.c:63:20
    #17 0x4f0cea in main /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:253:20
    #18 0x7f3a58255b96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310

SUMMARY: AddressSanitizer: heap-use-after-free /home/casper/fuzz/fuzzdeps/llvm-9.0.0.src/projects/compiler-rt/lib/asan/asan_interceptors_memintrinsics.cc:22 in __asan_memcpy
Shadow bytes around the buggy address:
  0x0c3a7fff8100: fd fd fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3a7fff8110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3a7fff8120: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3a7fff8130: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3a7fff8140: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c3a7fff8150: fd fd fd fd fd fd fd fd fd fd fd fd fd fd[fd]fd
  0x0c3a7fff8160: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c3a7fff8170: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c3a7fff8180: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c3a7fff8190: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c3a7fff81a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==47556==ABORTING

closed time in a month

sleicasper

issue commentmruby/mruby

heap use after free in hash_slice in mrbgems/mruby-hash-ext/src/hash-ext.c:61

Fixed along with #4926

sleicasper

comment created time in a month

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha 2124b9b4c95e66e63b1eb26a8dab49753b82fd6c

Fix buffer overflow in `mrb_str_len_to_dbl`. Issue 19902: mruby:mruby_fuzzer: Stack-buffer-overflow in mrb_str_len_to_dbl

view details

Yukihiro "Matz" Matsumoto

commit sha dc86e35cac6d4fd1825cf2572c83e0f82736f0d1

Add `MRB_WITHOUT_FLOAT` guard to `<math.h>`.

view details

Yukihiro "Matz" Matsumoto

commit sha fc8fb41451b07b3fda0726ba80e88e509ad02452

Small refactoring in `hash_slice`; ref #4926

view details

Yukihiro "Matz" Matsumoto

commit sha 70e574689664c10ed2c47581999cc2ce3e3c5afb

Fixed wrong condition for copying arguments on stack; fix #4926 This bug was introduced in 694089f to address #4832

view details

push time in a month

issue closedmruby/mruby

heap use after free in hash_values_at in mrbgems/mruby-hash-ext/src/hash-ext.c:33

compile mruby in ubuntu18.04 64 bit with ASAN.

poc:

a=0
b="asdfasdfasdf adaf asdf asdfa sdf asdfasdfasdfa sdf"
c={1=>1, 2=>"foo", "foo"=>nil, nil=> nil}
d=[1,nil," sdfg"]
srand(1337)
a = c.values_at(b,a,b,d,c,a,d,d,c,d,b,b,b,b,d,c,a,c,a,d,d,b,a,c,d,c,c,b,c,a,a,b,d,b,d,c,c,a,a,b,c,a,d,c,b,b,c,c,d,a,c,d,d,a,c,b,a,d,b,b,b,a,c,b,d,a,a,a,b,a,b,b,a,a,d,a,b,b,c,b,c,d,a,b,a,b,c,a,b,d,c,b,b,d,b,a,d,c,c,d,a,d,c,a,c,c,a,b,d,c,a,d,a,b,c,d,b,c,d,a){||  }
==96660==ERROR: AddressSanitizer: heap-use-after-free on address 0x61d000000af0 at pc 0x0000007bd8e8 bp 0x7fffffff09b0 sp 0x7fffffff09a8
READ of size 8 at 0x61d000000af0 thread T0
[New process 96922]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
process 96922 is executing new program: /home/casper/fuzz/fuzzdeps/llvm9/bin/llvm-symbolizer
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    #0 0x7bd8e7 in hash_values_at /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-hash-ext/src/hash-ext.c:33:31
    #1 0x59356f in mrb_vm_exec /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:1444:18
    #2 0x583324 in mrb_vm_run /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:947:12
    #3 0x5da14f in mrb_top_run /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:2850:12
    #4 0x6a450d in mrb_load_exec /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-compiler/core/parse.y:6438:7
    #5 0x6a521d in mrb_load_file_cxt /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-compiler/core/parse.y:6447:10
    #6 0x4f24ff in main /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:327:11
    #7 0x7ffff6a9bb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310
    #8 0x41c479 in _start (/home/casper/targets/gramma/mruby/dbg/fuzzrun/mruby+0x41c479)

0x61d000000af0 is located 112 bytes inside of 2048-byte region [0x61d000000a80,0x61d000001280)
freed by thread T0 here:
    #0 0x4a9388 in realloc /home/casper/fuzz/fuzzdeps/llvm-9.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:164
    #1 0x543a35 in mrb_default_allocf /home/casper/targets/gramma/mruby/dbg/BUILD/src/state.c:56:12
    #2 0x4f56ab in mrb_realloc_simple /home/casper/targets/gramma/mruby/dbg/BUILD/src/gc.c:209:8
    #3 0x4f5dae in mrb_realloc /home/casper/targets/gramma/mruby/dbg/BUILD/src/gc.c:223:8
    #4 0x575629 in stack_extend_alloc /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:203:27
    #5 0x575158 in mrb_stack_extend /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:224:5
    #6 0x578f57 in mrb_funcall_with_block /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:500:5
    #7 0x576ce5 in mrb_funcall_argv /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:539:10
    #8 0x576786 in mrb_funcall /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:400:10
    #9 0x65d032 in mrb_eql /home/casper/targets/gramma/mruby/dbg/BUILD/src/object.c:639:10
    #10 0x670138 in ht_hash_equal /home/casper/targets/gramma/mruby/dbg/BUILD/src/hash.c:126:22
    #11 0x660f09 in ht_get /home/casper/targets/gramma/mruby/dbg/BUILD/src/hash.c:458:11
    #12 0x660276 in mrb_hash_get /home/casper/targets/gramma/mruby/dbg/BUILD/src/hash.c:711:7
    #13 0x7bd97b in hash_values_at /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-hash-ext/src/hash-ext.c:33:31
    #14 0x59356f in mrb_vm_exec /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:1444:18
    #15 0x583324 in mrb_vm_run /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:947:12
    #16 0x5da14f in mrb_top_run /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:2850:12
    #17 0x6a450d in mrb_load_exec /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-compiler/core/parse.y:6438:7
    #18 0x6a521d in mrb_load_file_cxt /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-compiler/core/parse.y:6447:10
    #19 0x4f24ff in main /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:327:11
    #20 0x7ffff6a9bb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310

previously allocated by thread T0 here:
    #0 0x4a9388 in realloc /home/casper/fuzz/fuzzdeps/llvm-9.0.0.src/projects/compiler-rt/lib/asan/asan_malloc_linux.cc:164
    #1 0x543a35 in mrb_default_allocf /home/casper/targets/gramma/mruby/dbg/BUILD/src/state.c:56:12
    #2 0x4f56ab in mrb_realloc_simple /home/casper/targets/gramma/mruby/dbg/BUILD/src/gc.c:209:8
    #3 0x4f5dae in mrb_realloc /home/casper/targets/gramma/mruby/dbg/BUILD/src/gc.c:223:8
    #4 0x4f6563 in mrb_malloc /home/casper/targets/gramma/mruby/dbg/BUILD/src/gc.c:245:10
    #5 0x4f6608 in mrb_calloc /home/casper/targets/gramma/mruby/dbg/BUILD/src/gc.c:263:9
    #6 0x57a507 in stack_init /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:131:28
    #7 0x577be9 in mrb_funcall_with_block /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:461:7
    #8 0x5774fc in mrb_funcall_with_block /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:439:13
    #9 0x576ce5 in mrb_funcall_argv /home/casper/targets/gramma/mruby/dbg/BUILD/src/vm.c:539:10
    #10 0x63e56b in mrb_obj_new /home/casper/targets/gramma/mruby/dbg/BUILD/src/class.c:1553:5
    #11 0x5e4894 in mrb_exc_new_str /home/casper/targets/gramma/mruby/dbg/BUILD/src/error.c:31:10
    #12 0x5f00df in mrb_init_exception /home/casper/targets/gramma/mruby/dbg/BUILD/src/error.c:574:20
    #13 0x6c4c94 in mrb_init_core /home/casper/targets/gramma/mruby/dbg/BUILD/src/init.c:42:3
    #14 0x5439cb in mrb_open_core /home/casper/targets/gramma/mruby/dbg/BUILD/src/state.c:43:3
    #15 0x543a9c in mrb_open_allocf /home/casper/targets/gramma/mruby/dbg/BUILD/src/state.c:71:20
    #16 0x543a6a in mrb_open /home/casper/targets/gramma/mruby/dbg/BUILD/src/state.c:63:20
    #17 0x4f0cea in main /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:253:20
    #18 0x7ffff6a9bb96 in __libc_start_main /build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:310

SUMMARY: AddressSanitizer: heap-use-after-free /home/casper/targets/gramma/mruby/dbg/BUILD/mrbgems/mruby-hash-ext/src/hash-ext.c:33:31 in hash_values_at
Shadow bytes around the buggy address:
  0x0c3a7fff8100: fd fd fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3a7fff8110: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3a7fff8120: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3a7fff8130: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
  0x0c3a7fff8140: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x0c3a7fff8150: fd fd fd fd fd fd fd fd fd fd fd fd fd fd[fd]fd
  0x0c3a7fff8160: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c3a7fff8170: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c3a7fff8180: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c3a7fff8190: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
  0x0c3a7fff81a0: fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd fd
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==96660==ABORTING
[Inferior 2 (process 96922) exited normally]

closed time in a month

sleicasper

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha dbba0ca517ad0c32cdd7f0bd68de9c35145e1735

`p->locals` may be `NULL` when error occurs before the point. This is reported by oss-fuzz: Issue 19886: mruby:mruby_fuzzer: Potential-null-reference in setup_numparams

view details

push time in a month

create barnchmruby/mruby

branch : build-by-make

created branch time in a month

issue commentmruby/mruby

Recursive loop - DOS

As I said before, PoC code loops infinitely.

  • there's no ensureputs method, so it raises NoMethodError
  • the NoMethodError exception was caught by rescue
  • retry restarts from the beginning of the statement (and forms an infinite loop)

We don't call it a hang. Try Ctrl-C. Am I missing something?

RootUp

comment created time in a month

CommitCommentEvent

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha afad9391734998df4f76a6f7108278d2aa2599a0

Check memory boundary in `mrb_str_len_to_dbl`.

view details

push time in a month

issue commentmruby/mruby

Recursive loop - DOS

It seems to be an infinite loop. Could you elaborate on why you considered this as a DOS?

RootUp

comment created time in a month

CommitCommentEvent
CommitCommentEvent

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha 59756aef149dd70d74146526c70679c47cab0811

Need to preserve the original input string in `mrb_str_len_to_dbl`.

view details

Yukihiro "Matz" Matsumoto

commit sha c60bccaa9422d28e4d74e6f4cdb4781adcaa50c7

Check remaining string length before access to avoid OOB access.

view details

Yukihiro "Matz" Matsumoto

commit sha 3e4e10ffb6576aacf66b6648242e0454ca85c2fd

`"0x10".to_f` should be `0`, not `16.0`; fix #4924

view details

push time in a month

issue closedmruby/mruby

`String#to_f` should not allow hexdecimal format

$ ruby -e 'p "0x10".to_f'
0.0
$ mruby -e 'p "0x10".to_f'
16

closed time in a month

shuujii

PR merged mruby/mruby

Implement `File#size` and `File#truncate`
+116 -1

0 comment

2 changed files

dearblue

pr closed time in a month

push eventmruby/mruby

dearblue

commit sha 6d9ac89f925e83bd7ca25e04190f264bea600831

Implement `File#size` and `File#truncate`

view details

Yukihiro "Matz" Matsumoto

commit sha ca71eb7eef3395098ee3b9e16fd8c4114f74a74c

Merge branch 'file-size-truncate' of https://github.com/dearblue/mruby into dearblue-file-size-truncate

view details

Yukihiro "Matz" Matsumoto

commit sha b545f62aebb38bb4dedf5e7ba1e4b780db14441e

Avoid Boxing/Unboxing of file descriptors; ref #4872

view details

Yukihiro "Matz" Matsumoto

commit sha 874797f36fe1ad459d9b678cddcd77c11afb76f1

Merge branch 'dearblue-file-size-truncate'

view details

push time in a month

pull request commentmruby/mruby

Avoid creating temporary objects in `read_irep_record_1()`

111045e is my attempt to address this issue that:

  • Avoid creating temporary strings
  • Do not change the binary format
  • "1\x002".to_f works OK
  • Float("0x10") now works
dearblue

comment created time in a month

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha 111045ecada16d3c047b90a26a1ec0af06e5a323

Avoid creating temporary objects in `read_irep_record_1`; close #4920 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.

view details

Yukihiro "Matz" Matsumoto

commit sha 2532e625edc2457447369e36e2ecf7882d872ef9

Refactor `mrb_cstr_to_dbl`; ref #4920

view details

Yukihiro "Matz" Matsumoto

commit sha ccf28775b896e7cf772657eacd8727de25c3a0f4

Fix `mrb_str_len_to_dbl` to support Hexadecimal like `0x10`.

view details

push time in a month

PR closed mruby/mruby

Avoid creating temporary objects in `read_irep_record_1()`

Since the irep pool element is now NUL terminated, break compatibility for mruby binary format.

+20 -21

3 comments

4 changed files

dearblue

pr closed time in a month

issue commentmruby/mruby

mruby -v hangs in macos 10.14.6

Thank you for the right answer @shuujii

scalefree

comment created time in a month

issue closedmruby/mruby

mruby -v hangs in macos 10.14.6

Just installed mruby 2.1.0 via rbenv, set it to global. Running ruby -v gives me mruby 2.1.0 (2019-11-19) then hangs. If I ^Zthen fg it terminates & I get the following message:

00001 NODE_SCOPE: 00001 NODE_BEGIN: irep 0x7fdc134073a0 nregs=2 nlocals=1 pools=0 syms=0 reps=0 iseq=5 file: - 1 000 OP_LOADNIL R1 1 002 OP_RETURN R1 1 004 OP_STOP

closed time in a month

scalefree

push eventmruby/mruby

dearblue

commit sha 541185ef144e78f8040ffee731547ab86c845f17

Fix ainfo with keyword arguments; fix #4921

view details

Yukihiro "Matz" Matsumoto

commit sha 282f907f1bf172b60043f886020f1051e127b446

Merge pull request #4923 from dearblue/kwargs-block Fix ainfo with keyword arguments; fix #4921

view details

push time in a month

issue closedmruby/mruby

undefined method 'call' when yielding from method accepting kwargs

The following program raises an error on mruby 2.1.0 (on both OS X and on a esp32 based device). I can also reproduce with mruby head ( d6b89868 )

class Foo
  def run(bar:)
    yield 1
  end
end

b = Foo.new
b.run(bar:1000) {|value| puts value}

The error raised is

trace (most recent call last):
	[0] test.rb:8
	[1] test.rb:3:in arun
test.rb:3: undefined method 'call' (NoMethodError)

and is triggered by the yield line.

The error goes away I change the signature of run method to def run(bar) or def run(**args).

Please ask if there anymore information I can provide to help reproduce this.

closed time in a month

fcheung

PR merged mruby/mruby

Fix ainfo with keyword arguments; fix #4921
+1 -1

0 comment

1 changed file

dearblue

pr closed time in a month

pull request commentmruby/mruby

Avoid creating temporary objects in `read_irep_record_1()`

I like the idea, but I worry about the compatibility issue. Let me investigate the idea for a while.

dearblue

comment created time in a month

push eventmruby/mruby

dearblue

commit sha 00f5c92149a4e015bfb2dbdfbcd890aa2e65e801

Call `va_end()` before return The behavior when returning from a function without `va_end()` is undefined.

view details

Yukihiro "Matz" Matsumoto

commit sha d82e91898df4c1dbdab0b62738adc89d78d4b3fc

Merge pull request #4917 from dearblue/va_end Call `va_end()` before return

view details

push time in 2 months

PR merged mruby/mruby

Call `va_end()` before return

The behavior when returning from a function without va_end() is undefined.

+3 -1

0 comment

1 changed file

dearblue

pr closed time in 2 months

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha 9174b18f34cdee25fdf8433ee33642932b06a445

Rename `mrb_num_args_error` to `mrb_argnum_error`; ref #4863

view details

push time in 2 months

push eventmruby/mruby

KOBAYASHI Shuji

commit sha 81de1f159ce97821e16a127d600bffe1aa724bde

Add `mrb_num_args_error()` for "wrong number of arguments" error To unify the style of messages.

view details

Yukihiro "Matz" Matsumoto

commit sha b9c78c3fccf0917a8f4b05e02b79d80eeb83982d

Merge pull request #4863 from shuujii/add-mrb_num_args_error-for-wrong-number-of-arguments-error Add `mrb_num_args_error()` for "wrong number of arguments" error

view details

push time in 2 months

push eventmruby/mruby

KOBAYASHI Shuji

commit sha 40b8490fa4c0fc46783ff0d6baf68d251a5cd22b

Revert "SHARED string is not required when sharing POOL string" (75949836) 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" ```

view details

Yukihiro "Matz" Matsumoto

commit sha 021f228f9db6ac789eafd817d0e9a89e90d4529f

Merge pull request #4919 from shuujii/revert-SHARED-string-is-not-required-when-sharing-POOL-string Revert "SHARED string is not required when sharing POOL string" (75949836)

view details

push time in 2 months

PR merged mruby/mruby

Revert "SHARED string is not required when sharing POOL string" (75949836)

Because literal pool may be released by GC.

Example:

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"
+2 -2

1 comment

1 changed file

shuujii

pr closed time in 2 months

push eventmruby/mruby

dearblue

commit sha 7ed26ead9b204f0ee8941381c7ea83ffaf9e80f5

Integrate `i` and `arg_i` in `mrb_get_args()` The behavior of these two variables is the same.

view details

Yukihiro "Matz" Matsumoto

commit sha 7247e4cf1b7bbf298e19f42b990f5e12b4af4e06

Merge pull request #4918 from dearblue/sync-vars Integrate `i` and `arg_i` in `mrb_get_args()`

view details

push time in 2 months

PR merged mruby/mruby

Integrate `i` and `arg_i` in `mrb_get_args()`

The behavior of these two variables is the same.

+16 -35

0 comment

1 changed file

dearblue

pr closed time in 2 months

push eventmruby/mruby

dearblue

commit sha 20d3882469ff33bdca2d1eef4fbd991ececfcb14

Do not include `stdint.h` before `mruby.h`; ref #4750

view details

Yukihiro "Matz" Matsumoto

commit sha b49bc17f48a8e5e76c091e7e77cee720df478431

Merge pull request #4916 from dearblue/stdint Do not include `stdint.h` before `mruby.h`; ref #4750

view details

push time in 2 months

PR merged mruby/mruby

Do not include `stdint.h` before `mruby.h`; ref #4750

MRB_WITHOUT_FLOAT is undefined, and if you build it as C ++ ABI for MRB_DISABLE_STDIO or Windows, the situation will be the same as #4750. So I will fix it.

I borrowed it from take-cheeze's without permission, but I am able to confirm it in the log data by GithubActions: https://github.com/take-cheeze/mruby/runs/360977783#step:4:833

+0 -1

0 comment

1 changed file

dearblue

pr closed time in 2 months

Pull request review commentmruby/mruby

Call `va_end()` before return

 mrb_get_args(mrb_state *mrb, const char *format, ...)   if (!c && argc > i) {     mrb_raise(mrb, E_ARGUMENT_ERROR, "wrong number of arguments");   }++finish:   va_end(ap);-  return i;+  return argc;

Is there any reason to replace i with argc here? We checked i == argc before jumping to finish.

dearblue

comment created time in 2 months

push eventmruby/mruby

Yukihiro "Matz" Matsumoto

commit sha 943fbb2beafd5c9d6d39fb653135bded84531b3c

Allow `here-doc` in the middle of Hash expressions; fix #4815

view details

Yukihiro "Matz" Matsumoto

commit sha fd1cff77358c00a49f791405285899ede30cdf54

Fixed wrong usages of `mrb_get_args` in `vformat.c`.

view details

push time in 2 months

issue closedmruby/mruby

Parser rejects some heredoc in hash literal

The following code fragments are accepted by MRI but rejected by mruby. I found it quite inconvenient that long multiline strings cannot be directly included in a hash.

{a: <<X,
X
b: 1}

{a: <<X, b:
X
1}

Tested on cc54257d

closed time in 2 months

hanazuki

push eventmruby/mruby

KOBAYASHI Shuji

commit sha b493229a23a0f2df62b9fbbcb9279eec84d9c272

Silence GCC warning in `time.c` on Travis CI Silence the following warnings: ``` /mruby/mrbgems/mruby-time/src/time.c:260:55: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] if ((MRB_INT_MAX > MRB_TIME_MAX && i > 0 && i > MRB_TIME_MAX) || ^ ```

view details

Yukihiro "Matz" Matsumoto

commit sha 28c8e29c4d01c4b859d51f61d83ccddcd3eac447

Merge pull request #4915 from shuujii/silence-GCC-warning-in-time.c-on-Travis-CI Silence GCC warning in `time.c` on Travis CI

view details

push time in 2 months

PR merged mruby/mruby

Silence GCC warning in `time.c` on Travis CI

Silence the following warnings:

/mruby/mrbgems/mruby-time/src/time.c:260:55: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  if ((MRB_INT_MAX > MRB_TIME_MAX && i > 0 && i > MRB_TIME_MAX) ||
                                                ^
+1 -1

0 comment

1 changed file

shuujii

pr closed time in 2 months

push eventmruby/mruby

dearblue

commit sha 93d0e5d9fbfb81e5cb39a707ec633f80374b85ad

Fix builds for modern mingw; fix #4869 What I intended to fix in #4869 was a patch for an old MinGW. Recent MinGWs have their own `mkstemp()` function. I knew this after checking the patch #4903.

view details

Yukihiro "Matz" Matsumoto

commit sha 83e502b847ee180cda59984ed004f0375b2cd1ef

Merge pull request #4914 from dearblue/fix-4869 Fix builds for modern mingw; fix #4869

view details

push time in 2 months

PR merged mruby/mruby

Fix builds for modern mingw; fix #4869

What I intended to fix in #4869 was a patch for an old MinGW. Recent MinGWs have their own mkstemp() function. I knew this after checking the patch #4903.


For your reference, the commits added to MinGW are also shown:

  • mingw32: (2014-12-02) https://osdn.net/projects/mingw/scm/git/mingw-org-wsl/commits/ed7dcf1eb8b2fefb647b45a3f472524bb63fd870
  • mingw-w64: (2015-01-07) https://sourceforge.net/p/mingw-w64/mingw-w64/ci/f713f639f6f017371c5176f4deab07d1a92473b4/

MinGW provided by the official package of FreeBSD is old. (I did not know this....)

+9 -1

0 comment

1 changed file

dearblue

pr closed time in 2 months

push eventmruby/mruby

KOBAYASHI Shuji

commit sha b96fa664b07618e823130d8e33ef9797a38f5d31

Use `rake` instead of `minirake` in `.gitlab-ci.yml` There was an error in the `.gitlab-ci.yml` generation script, so it was also fixed.

view details

Yukihiro "Matz" Matsumoto

commit sha 5e519cdbb5410ae0919cf6458cff392d7f019511

Merge pull request #4913 from shuujii/use-rake-instead-of-minirake-in-.gitlab-ci.yml Use `rake` instead of `minirake` in `.gitlab-ci.yml`

view details

push time in 2 months

PR merged mruby/mruby

Use `rake` instead of `minirake` in `.gitlab-ci.yml`

There was an error in the .gitlab-ci.yml generation script, so it was also fixed.

+1628 -428

0 comment

2 changed files

shuujii

pr closed time in 2 months

push eventmruby/mruby

KOBAYASHI Shuji

commit sha b97ebf2aebceaa464c8c8ecdf44eb36ffd590506

Avoid unneeded directory creation during `rake -T`, etc.

view details

Yukihiro "Matz" Matsumoto

commit sha 4327f369404e1c0adc5e3e7e59fe4916341ab685

Merge pull request #4912 from shuujii/avoid-unneeded-directory-creation-during-rake--T-etc Avoid unneeded directory creation during `rake -T`, etc.

view details

push time in 2 months

push eventmruby/mruby

KOBAYASHI Shuji

commit sha bb98fd78c3d14c550187a96b9ed6975e8b719a68

Use `Rake.verbose` instead of `$verbose` and `$pp_show` in build scripts The incompatibility that the commands of `FileUtils` origin output verbose by default due to the changes in d8a5163b and 26e6e75b is also fixed.

view details

Yukihiro "Matz" Matsumoto

commit sha e9de5a7a5c71e52c675abc421340c3dab72d3e85

Merge pull request #4911 from shuujii/use-Rake.verbose-instead-of-verbose-and-pp_show Use `Rake.verbose` instead of `$verbose` and `$pp_show` in build scripts

view details

push time in 2 months

PR merged mruby/mruby

Use `Rake.verbose` instead of `$verbose` and `$pp_show` in build scripts

The incompatibility that the commands of FileUtils origin output verbose by default due to the changes in d8a5163b and 26e6e75b is also fixed.

+5 -24

0 comment

4 changed files

shuujii

pr closed time in 2 months

push eventmruby/mruby

KOBAYASHI Shuji

commit sha 26e6e75ba6a59bc77c80a6ce5d207626cfed91a6

Use Rake DSL instead of commands of `FileUtils` - Respect `--verbose(-v)` and `--dry-run(-n)` options. - Silence warnings to keyword arguments on Ruby 2.7.

view details

Yukihiro "Matz" Matsumoto

commit sha d2f34a845514d45e9651a87d445e2d1bdabe680a

Merge pull request #4910 from shuujii/use-Rake-DSL-instead-of-commands-of-FileUtils Use Rake DSL instead of commands of `FileUtils`

view details

push time in 2 months

PR merged mruby/mruby

Use Rake DSL instead of commands of `FileUtils`
  • Respect --verbose(-v) and --dry-run(-n) options.
  • Silence warnings to keyword arguments on Ruby 2.7.
+27 -28

0 comment

12 changed files

shuujii

pr closed time in 2 months

PR closed mruby/mruby

Enable `MRB_GC_STRESS` test on CI

The debug build target (MRB_GC_STRESS is enabled) on CI have been compiled but not tested so far. However, I think testing with MRB_GC_STRESS is effective (in fact, I found #4907 bug).

Therefore, I integrated debug and full-debug build targets to enable MRB_GC_STRESS testing. Testing with MRB_GC_STRESS takes a little time, but compiling takes more time, so CI execution time does not increase due to decrease of build target.

+3 -29

1 comment

2 changed files

shuujii

pr closed time in 2 months

pull request commentmruby/mruby

Enable `MRB_GC_STRESS` test on CI

PR merged.

shuujii

comment created time in 2 months

issue closedmruby/mruby

Can't call method like numbered parameter inside class statement

Ruby

$ ruby -e 'def _1; :m end; class A; p _1 end'
-e:1: warning: `_1' is reserved for numbered parameter; consider another name
:m

mruby

$ mruby -e 'def _1; :m end; class A; p _1 end'
-e:1:29: warning: numbered parameter in nested block
-e:1:29: numbered parameter outside block

closed time in 2 months

shuujii

issue commentmruby/mruby

Can't call method like numbered parameter inside class statement

Closed by 06e09fc. Commit message was wrong.

shuujii

comment created time in 2 months

issue closedmruby/mruby

Can't parse method argument like numbered parameter

Ruby

$ ruby -e 'def m(_1) _1 end; p m(:m)'
-e:1: warning: `_1' is reserved for numbered parameter; consider another name
:m

mruby

$ mruby -e 'def m(_1) _1 end; p m(:m)'
-e:1:8: warning: numbered parameter in nested block
-e:1:8: syntax error, unexpected tNUMPARAM, expecting ')'
-e:1:8: numbered parameter outside block

closed time in 2 months

shuujii

push eventmruby/mruby

KOBAYASHI Shuji

commit sha 716102fff38f4067d9b9fcf6bb0ff9e6dbd78105

Enable `MRB_GC_STRESS` test on CI The `debug` build target (`MRB_GC_STRESS` is enabled) on CI have been compiled but not tested so far. However, I think testing with `MRB_GC_STRESS` is effective (in fact, I found #4907 bug). Therefore, I integrated `debug` and `full-debug` build targets to enable `MRB_GC_STRESS` testing. Testing with `MRB_GC_STRESS` takes a little time, but compiling takes more time, so CI execution time does not increase due to decrease of build target.

view details

Yukihiro "Matz" Matsumoto

commit sha 7e6355975eff730c1fefc414fbf7c9d0bacbef01

Prohibit numbered parameters as method arguments; fix #4892 As of CRuby2.7 it is only warned. `mruby` prohibits explicitly to implement the future Ruby3 behavior.

view details

Yukihiro "Matz" Matsumoto

commit sha ed8491cde671e01ac77ead6f8fefee073bc0a9af

Numbered parameters: usually linked list uses `cdr` for links.

view details

Yukihiro "Matz" Matsumoto

commit sha d8a5163b24489bc0ff046e13a67fdc3feb01f7cd

Support `-v` flag of `rake`; close #4887 The patch was originally written by @take-cheese. I have fixed the conflict caused by `minirake` deletion - @matz.

view details

Yukihiro "Matz" Matsumoto

commit sha ff16331754cd63c54279592fe4be77991bb6327d

Allow non numbered-parameter identifier like `_1` outside of blocks. But it causes warnings as CRuby does; fix #4892 fix #489

view details

Yukihiro "Matz" Matsumoto

commit sha d15e56dab03f2295dd1d9ecc2e22c6f0ce53e0e3

Prohibit assignment to numbered parameters. It is stricter than CRuby but confusing anyway.

view details

Yukihiro "Matz" Matsumoto

commit sha 03244b52a0624e823ae5e338ecf72a868da08ef2

Revert "Enable sanitizer in travis test"; ref #4864 `gcc` sanitizer does not work on some environment (namely my localhost). Although it works on Travis, it is not convenient that tests fail on the local host. We keep sanitizer tests on the local (using `clang`). This reverts commit 9cde967321fe4bf200d4451859ead57b06e73027.

view details

push time in 2 months

PR closed mruby/mruby

Support `-v` flag of rake
+6 -0

0 comment

2 changed files

take-cheeze

pr closed time in 2 months

push eventmruby/mruby

take-cheeze

commit sha 9cde967321fe4bf200d4451859ead57b06e73027

Enable sanitizer in travis test

view details

Yukihiro "Matz" Matsumoto

commit sha ef6805f599c19634809158da42ad7059ef0a9c5d

Merge pull request #4864 from take-cheeze/enable_sanitizer_travis Enable sanitizer in travis test

view details

push time in 2 months

PR merged mruby/mruby

Enable sanitizer in travis test
+8 -3

1 comment

1 changed file

take-cheeze

pr closed time in 2 months

pull request commentmruby/mruby

Introduce Encoding core mrbgem

The PR is not very useful for mruby, since it does not convert encoding at all. What is the motivation behind the PR? Compatibility?

take-cheeze

comment created time in 2 months

pull request commentmruby/mruby

fix outputs of Kernel.#puts and IO#puts when args include Array class or subclass

I consider this behavior as a design mistake in the early stage. I need more time to make a big decision to follow the ISO or fix the mistake. For the moment, please use puts *ary.

ak-mochi

comment created time in 2 months

issue commentmruby/mruby

Cygwin compile error

We have merged #4905. Did the problem disappear?

kishima

comment created time in 2 months

push eventmruby/mruby

KOBAYASHI Shuji

commit sha 0b2d54f4f1d66a0b00625dcc634966d67c29b8b8

Fix potentially use of wrong method cache #### 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.

view details

Yukihiro "Matz" Matsumoto

commit sha d6b898685f5e6efeb3b4cadac60237d3c26abc38

Merge pull request #4907 from shuujii/fix-poteltially-use-of-wrong-method-cache Fix potentially use of wrong method cache

view details

push time in 2 months

PR merged mruby/mruby

Fix potentially use of wrong method cache

Example (with MRB_METHOD_CACHE)

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.

+12 -6

1 comment

3 changed files

shuujii

pr closed time in 2 months

more