Issue #17860 has been reported by edipofederle (=C9dipo F=E9derle).

----------------------------------------
Bug #17860: Segmentation fault when trying to  grab blocks of memory using =
Fiddle
https://bugs.ruby-lang.org/issues/17860

* Author: edipofederle (=C9dipo F=E9derle)
* Status: Open
* Priority: Normal
* ruby -v: ruby 3.1.0dev (2021-04-09T04:59:46Z master 582f4bc188) [x86_64-d=
arwin20]
* Backport: 2.6: UNKNOWN, 2.7: UNKNOWN, 3.0: UNKNOWN
----------------------------------------
Reproduce process

**ruby version:** ruby 3.1.0dev (2021-04-09T04:59:46Z master 582f4bc188) [x=
86_64-darwin20]


Install ruby with:

```
$ git clone git / github.com:ruby/ruby.git
$ cd ruby
$ autoconf
$ ./configure --prefix=3D$PWD/local
$ make
$ make install =

```

create a test.rb file with:

```
require 'fiddle'
str =3D "Hello world!"
str_ptr_int =3D str.object_id << 1

str_ptr =3D Fiddle::Pointer.new str_ptr_int
str_ptr.to_i =3D=3D str_ptr_int

r_basic =3D str_ptr[0, Fiddle::SIZEOF_LONG*2]
```

Inside compiled `ruby` directly run: =


`$  ./local/bin/ruby test.rb`




-- =

https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=3Dunsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>