[#119670] [Ruby master Feature#20859] Make Base64 to core class — "hsbt (Hiroshi SHIBATA) via ruby-core" <ruby-core@...>

Issue #20859 has been reported by hsbt (Hiroshi SHIBATA).

8 messages 2024/11/01

[#119683] [Ruby master Feature#20861] Add an environment variable for tuning the default thread quantum — "tenderlovemaking (Aaron Patterson) via ruby-core" <ruby-core@...>

Issue #20861 has been reported by tenderlovemaking (Aaron Patterson).

24 messages 2024/11/01

[#119724] [Ruby master Bug#20863] `zlib.c` calls `rb_str_set_len` and `rb_str_modify_expand`(and others) without holding the GVL. — "ioquatix (Samuel Williams) via ruby-core" <ruby-core@...>

Issue #20863 has been reported by ioquatix (Samuel Williams).

8 messages 2024/11/05

[#119726] [Ruby master Feature#20864] Support `error:` keyword to `Kernel#warn` — "ioquatix (Samuel Williams) via ruby-core" <ruby-core@...>

Issue #20864 has been reported by ioquatix (Samuel Williams).

14 messages 2024/11/05

[#119741] [Ruby master Bug#20869] IO buffer handling is inconsistent when seeking — "javanthropus (Jeremy Bopp) via ruby-core" <ruby-core@...>

Issue #20869 has been reported by javanthropus (Jeremy Bopp).

13 messages 2024/11/05

[#119751] [Ruby master Bug#20871] Including methods in Enumerable doesn't make them available in Array — "sanderd17 (Sander Deryckere) via ruby-core" <ruby-core@...>

Issue #20871 has been reported by sanderd17 (Sander Deryckere).

13 messages 2024/11/05

[#119769] [Ruby master Feature#20875] Atomic initialization for Ractor local storage — "ko1 (Koichi Sasada) via ruby-core" <ruby-core@...>

Issue #20875 has been reported by ko1 (Koichi Sasada).

12 messages 2024/11/06

[#119801] [Ruby master Feature#20878] A new C API to create a String by adopting a pointer: `rb_enc_str_adopt(const char *ptr, long len, long capa, rb_encoding *enc)` — "byroot (Jean Boussier) via ruby-core" <ruby-core@...>

Issue #20878 has been reported by byroot (Jean Boussier).

32 messages 2024/11/07

[#119852] [Ruby master Feature#20882] Provide Boolean(...) — "getajobmike (Mike Perham) via ruby-core" <ruby-core@...>

Issue #20882 has been reported by getajobmike (Mike Perham).

12 messages 2024/11/08

[#119881] [Ruby master Feature#20884] reserve "Ruby" toplevel module for Ruby language — "Dan0042 (Daniel DeLorme) via ruby-core" <ruby-core@...>

Issue #20884 has been reported by Dan0042 (Daniel DeLorme).

8 messages 2024/11/12

[#119897] [Ruby master Bug#20890] MacOS 15.1, Macbook pro 2024 m4, YJIT: Kernel Panic on network access, works w/o YJIT — "markus_d (Markus Doits) via ruby-core" <ruby-core@...>

Issue #20890 has been reported by markus_d (Markus Doits).

24 messages 2024/11/12

[#119988] [Ruby master Bug#20904] 3.4.0-preview2: Building miniruby.exe fails for mswin32 — "jun66j5 (Jun Omae) via ruby-core" <ruby-core@...>

Issue #20904 has been reported by jun66j5 (Jun Omae).

11 messages 2024/11/22

[#120002] [Ruby master Bug#20908] Ruby extension builds fail with GCC 15 which defaults to -std=gnu23 — "thesamesam (Sam James) via ruby-core" <ruby-core@...>

SXNzdWUgIzIwOTA4IGhhcyBiZWVuIHJlcG9ydGVkIGJ5IHRoZXNhbWVzYW0gKFNhbSBKYW1lcyku

7 messages 2024/11/25

[#120016] [Ruby master Feature#20912] Move warning when redefining object_id to __id__ — "jhawthorn (John Hawthorn) via ruby-core" <ruby-core@...>

SXNzdWUgIzIwOTEyIGhhcyBiZWVuIHJlcG9ydGVkIGJ5IGpoYXd0aG9ybiAoSm9obiBIYXd0aG9y

11 messages 2024/11/27

[#120027] [Ruby master Misc#20913] Proposal: Adding Jeremy Evans and Burdette Lamar to www.ruby-lang.org's English Editorial Team — "st0012 (Stan Lo) via ruby-core" <ruby-core@...>

Issue #20913 has been reported by st0012 (Stan Lo).

6 messages 2024/11/27

[#120043] [Ruby master Bug#20919] IO#seek does not clear the character buffer in some cases while transcoding — "javanthropus (Jeremy Bopp) via ruby-core" <ruby-core@...>

Issue #20919 has been reported by javanthropus (Jeremy Bopp).

7 messages 2024/11/28

[ruby-core:119780] [Ruby master Bug#20745] IO::Buffer#copy triggers UB when src/dest buffers overlap

From: "ioquatix (Samuel Williams) via ruby-core" <ruby-core@...>
Date: 2024-11-06 20:58:25 UTC
List: ruby-core #119780
Issue #20745 has been updated by ioquatix (Samuel Williams).


Thanks for your work and research about the performance cost.

----------------------------------------
Bug #20745: IO::Buffer#copy triggers UB when src/dest buffers overlap
https://bugs.ruby-lang.org/issues/20745#change-110448

* Author: hanazuki (Kasumi Hanazuki)
* Status: Closed
* Assignee: ioquatix (Samuel Williams)
* ruby -v: ruby 3.4.0dev (2024-09-15T01:06:11Z master 532af89e3b) +PRISM [x86_64-linux]
* Backport: 3.1: UNKNOWN, 3.2: UNKNOWN, 3.3: UNKNOWN
----------------------------------------
The current implementation of `IO::Buffer#copy` uses `memcpy` to copy data between the two memory regions. `memcpy` has a requirement that the source and destination must not overlap; otherwise the behavior is undefined.

When copying between the same instance of `IO::Buffer` (or slices sharing the same underlying memory), the rule can be violated, and the data is corrupted with some libc implementation / architecture combinations (note that Alpine uses musl libc).
```shell-session
% docker run --platform=linux/amd64 --rm ruby:3.3.5-alpine3.20 ruby -e 'b=IO::Buffer.new(10); b.set_string("0123456789"); b.copy(b, 3, 7, 0); p b'
-e:1: warning: IO::Buffer is experimental and both the Ruby and C interface may change in the future!
#<IO::Buffer 0x00007fb439d2c450+10 INTERNAL>
0x00000000  30 31 32 30 31 32 30 31 32 30                   0120120120

% docker run --platform=linux/arm64 --rm ruby:3.3.5-alpine3.20 ruby -e 'b=IO::Buffer.new(10); b.set_string("0123456789"); b.copy(b, 3, 7, 0); p b'
-e:1: warning: IO::Buffer is experimental and both the Ruby and C interface may change in the future!
#<IO::Buffer 0x00007fcc5c580360+10 INTERNAL>
0x00000000  30 31 32 30 31 32 33 34 35 36                   0120123456
```

Copying "0123456789" three bytes behind onto itself, "0120123456" is the expected result.

---

This error can also be detected with ASAN.
```shell-session
% CXX=clang++ CC=clang ./configure cppflags="-fsanitize=address -fno-omit-frame-pointer" optflags=-O0 LDFLAGS="-fsanitize=address -fno-omit-frame-pointer"

% ./ruby -e 'b=IO::Buffer.new(10); b.copy(b, 0, 9, 1)'
`RubyGems' were not loaded.
`error_highlight' was not loaded.
`did_you_mean' was not loaded.
`syntax_suggest' was not loaded.
-e:1: warning: IO::Buffer is experimental and both the Ruby and C interface may change in the future!
=================================================================
==1655425==ERROR: AddressSanitizer: memcpy-param-overlap: memory ranges [0x5020000107b0,0x5020000107b9) and [0x5020000107b1, 0x5020000107ba) overlap
    #0 0x55dcfbb72d90 in __asan_memcpy (/home/kasumi/.local/src/github.com/ruby/ruby/ruby+0x1fdd90) (BuildId: 2591ca8e9e713537a8f388383df19d1f4284b722)
    #1 0x55dcfbcb31e3 in ruby_nonempty_memcpy /home/kasumi/.local/src/github.com/ruby/ruby/./include/ruby/internal/memory.h:662:16
    #2 0x55dcfbcb3867 in io_buffer_memcpy /home/kasumi/.local/src/github.com/ruby/ruby/io_buffer.c:2347:5
    #3 0x55dcfbcb354a in io_buffer_copy_from /home/kasumi/.local/src/github.com/ruby/ruby/io_buffer.c:2384:5
    #4 0x55dcfbcafd2f in io_buffer_copy /home/kasumi/.local/src/github.com/ruby/ruby/io_buffer.c:2490:12
    #5 0x55dcfc0b955f in ractor_safe_call_cfunc_m1 /home/kasumi/.local/src/github.com/ruby/ruby/./vm_insnhelper.c:3597:12
    #6 0x55dcfc09ca28 in vm_call_cfunc_with_frame_ /home/kasumi/.local/src/github.com/ruby/ruby/./vm_insnhelper.c:3788:11
    #7 0x55dcfc09cf2a in vm_call_cfunc_with_frame /home/kasumi/.local/src/github.com/ruby/ruby/./vm_insnhelper.c:3834:12
    #8 0x55dcfc09c0e9 in vm_call_cfunc_other /home/kasumi/.local/src/github.com/ruby/ruby/./vm_insnhelper.c:3860:16
    #9 0x55dcfc081811 in vm_call_cfunc /home/kasumi/.local/src/github.com/ruby/ruby/./vm_insnhelper.c:3942:12
    #10 0x55dcfc07f347 in vm_call_method_each_type /home/kasumi/.local/src/github.com/ruby/ruby/./vm_insnhelper.c:4766:16
    #11 0x55dcfc07ebc2 in vm_call_method /home/kasumi/.local/src/github.com/ruby/ruby/./vm_insnhelper.c:4892:20
    #12 0x55dcfc02d9a4 in vm_call_general /home/kasumi/.local/src/github.com/ruby/ruby/./vm_insnhelper.c:4936:12
    #13 0x55dcfc02fb24 in vm_sendish /home/kasumi/.local/src/github.com/ruby/ruby/./vm_insnhelper.c:5955:15
    #14 0x55dcfc03eb00 in vm_exec_core /home/kasumi/.local/src/github.com/ruby/ruby/insns.def:898:11
    #15 0x55dcfc0306a2 in rb_vm_exec /home/kasumi/.local/src/github.com/ruby/ruby/vm.c:2564:22
    #16 0x55dcfc06ee9f in rb_iseq_eval_main /home/kasumi/.local/src/github.com/ruby/ruby/vm.c:2830:11
    #17 0x55dcfbbb7a84 in rb_ec_exec_node /home/kasumi/.local/src/github.com/ruby/ruby/eval.c:281:9
    #18 0x55dcfbbb74b2 in ruby_run_node /home/kasumi/.local/src/github.com/ruby/ruby/eval.c:319:30
    #19 0x55dcfbbaf81e in rb_main /home/kasumi/.local/src/github.com/ruby/ruby/./main.c:43:12
    #20 0x55dcfbbaf699 in main /home/kasumi/.local/src/github.com/ruby/ruby/./main.c:62:12
    #21 0x7fb604914db9 in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
    #22 0x7fb604914e74 in __libc_start_main csu/../csu/libc-start.c:360:3
    #23 0x55dcfbad8fe0 in _start (/home/kasumi/.local/src/github.com/ruby/ruby/ruby+0x163fe0) (BuildId: 2591ca8e9e713537a8f388383df19d1f4284b722)
[snip]
```



-- 
https://bugs.ruby-lang.org/
 ______________________________________________
 ruby-core mailing list -- ruby-core@ml.ruby-lang.org
 To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org
 ruby-core info -- https://ml.ruby-lang.org/mailman3/lists/ruby-core.ml.ruby-lang.org/


In This Thread

Prev Next