1. 10 Feb, 2021 1 commit
    • KOBAYASHI Shuji's avatar
      Fix heap-buffer-overflow for small `Hash` (HT) in `Hash#rehash` · 28eb6271
      KOBAYASHI Shuji authored
      ### Example
      
      ##### example.rb
      
      ```ruby
      h = {}
      (1..17).each{h[_1] = _1}
      (1..16).each{h.delete(_1)}
      h.rehash
      ```
      
      ##### ASAN report
      
      ```console
      $ bin/mruby example.rb
      ==52587==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x602000006998 at pc 0x55a29cddf96b bp 0x7fff7b1b1720 sp 0x7fff7b1b1710
      READ of size 4 at 0x602000006998 thread T0
          #0 0x55a29cddf96a in ib_it_next /mruby/src/hash.c:639
          #1 0x55a29cde2ca2 in ht_rehash /mruby/src/hash.c:900
          #2 0x55a29cde379f in h_rehash /mruby/src/hash.c:996
          #3 0x55a29cde7f3d in mrb_hash_rehash /mruby/src/hash.c:1735
          #4 0x55a29ce77b62 in mrb_vm_exec /mruby/src/vm.c:1451
          #5 0x55a29ce5fa88 in mrb_vm_run /mruby/src/vm.c:981
          #6 0x55a29ceb87e1 in mrb_top_run /mruby/src/vm.c:2874
          #7 0x55a29cf36bdf in mrb_load_exec mrbgems/mruby-compiler/core/parse.y:6805
          #8 0x55a29cf36f25 in mrb_load_detect_file_cxt mrbgems/mruby-compiler/core/parse.y:6848
          #9 0x55a29cdba0a2 in main /mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:347
          #10 0x7f24ef43b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
          #11 0x55a29cdb4a6d in _start (/mruby/bin/mruby+0x2a3a6d)
      
      0x602000006998 is located 0 bytes to the right of 8-byte region [0x602000006990,0x602000006998)
      allocated by thread T0 here:
          #0 0x7f24f01cfffe in __interceptor_realloc (/lib/x86_64-linux-gnu/libasan.so.5+0x10dffe)
          #1 0x55a29ceb9440 in mrb_default_allocf /mruby/src/state.c:68
          #2 0x55a29cdba747 in mrb_realloc_simple /mruby/src/gc.c:228
          #3 0x55a29cdba928 in mrb_realloc /mruby/src/gc.c:242
          #4 0x55a29cde12e5 in ht_init /mruby/src/hash.c:749
          #5 0x55a29cde2b8e in ht_rehash /mruby/src/hash.c:897
          #6 0x55a29cde379f in h_rehash /mruby/src/hash.c:996
          #7 0x55a29cde7f3d in mrb_hash_rehash /mruby/src/hash.c:1735
          #8 0x55a29ce77b62 in mrb_vm_exec /mruby/src/vm.c:1451
          #9 0x55a29ce5fa88 in mrb_vm_run /mruby/src/vm.c:981
          #10 0x55a29ceb87e1 in mrb_top_run /mruby/src/vm.c:2874
          #11 0x55a29cf36bdf in mrb_load_exec mrbgems/mruby-compiler/core/parse.y:6805
          #12 0x55a29cf36f25 in mrb_load_detect_file_cxt mrbgems/mruby-compiler/core/parse.y:6848
          #13 0x55a29cdba0a2 in main /mruby/mrbgems/mruby-bin-mruby/tools/mruby/mruby.c:347
          #14 0x7f24ef43b0b2 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x270b2)
      ```
      28eb6271
  2. 09 Feb, 2021 1 commit
  3. 08 Feb, 2021 2 commits
  4. 07 Feb, 2021 6 commits
  5. 06 Feb, 2021 12 commits
  6. 05 Feb, 2021 11 commits
  7. 04 Feb, 2021 4 commits
    • Yukihiro "Matz" Matsumoto's avatar
      Merge pull request #5319 from shuujii/check-if-.pi-build-rules-are-defined · 043fe9d9
      Yukihiro "Matz" Matsumoto authored
      Check if `.pi` build rules are defined
      043fe9d9
    • KOBAYASHI Shuji's avatar
      Check if `.pi` build rules are defined · 67a28b56
      KOBAYASHI Shuji authored
      `.pi` files are created for `.o` files that `build.products` depends on, but
      an error will occur if the build rule is unknown, so add a check.
      
      I don't think this situation would normally arise. However, in
      `mattn/mruby-onig-regexp`, when using bundled onigmo, onigmo's `.o` files
      are added to dependency of `libmruby.a` in the second and subsequent builds,
      and mruby does not know the build rule, so the following error had occured.
      
      ```console
      rake aborted!
      Don't know how to build task '/mruby/build/host/mrbgems/mruby-onig-regexp/onigmo-6.2.0/libonig_objs/ascii.pi' (See the list of available tasks with `rake --tasks`)
      ```
      67a28b56
    • Yukihiro "Matz" Matsumoto's avatar
      Merge pull request #5318 from shuujii/fix-breakage-where-builds-except-host-dont-refer-mrbc-in-host · 6f354322
      Yukihiro "Matz" Matsumoto authored
      Fix breakage where builds except `host` don't refer` mrbc` in `host`
      6f354322
    • KOBAYASHI Shuji's avatar
      Fix breakage where builds except `host` don't refer` mrbc` in `host` · f92c1f1b
      KOBAYASHI Shuji authored
      Build error occurred under the following conditions.
      
      * `host` build is presym enabled and unspecified `mruby-bin-mrbc` gem.
      * Build except `host` unspecified `mruby-bin-mrbc` gem and mrbcfile.
      
      ### Example
      
      #### Build configuration
      
      ```ruby
      MRuby::Build.new{|conf| conf.toolchain}
      MRuby::Build.new("host2"){|conf| conf.toolchain}
      ```
      
      #### Error
      
      ```console
      rake aborted!
      external mrbc or mruby-bin-mrbc gem in current('host2') or 'host' build is required
      /mruby/lib/mruby/build.rb:326:in `mrbcfile'
      /mruby/tasks/mrblib.rake:9:in `block in <top (required)>'
      /mruby/lib/mruby/build.rb:18:in `instance_eval'
      /mruby/lib/mruby/build.rb:18:in `block in each_target'
      /mruby/lib/mruby/build.rb:17:in `each'
      /mruby/lib/mruby/build.rb:17:in `each_target'
      /mruby/tasks/mrblib.rake:1:in `<top (required)>'
      /mruby/Rakefile:27:in `load'
      /mruby/Rakefile:27:in `<top (required)>'
      ```
      f92c1f1b
  8. 03 Feb, 2021 2 commits
  9. 02 Feb, 2021 1 commit