Bug #17934
closedclipboard gem fail on Ruby 3.0.1
Description
gem install clipboard (Which was used well in Ruby 2.XX):
Fetching clipboard-1.3.5.gem
Successfully installed clipboard-1.3.5
Parsing documentation for clipboard-1.3.5
Installing ri documentation for clipboard-1.3.5
Done installing documentation for clipboard after 0 seconds
1 gem installed
content of D:/R/hike/test.rb:
frozen_string_literal: true¶
require 'clipboard'
Clipboard.copy('content')
After run test.rb:
D:/Ruby/lib/ruby/gems/3.0.0/gems/clipboard-1.3.5/lib/clipboard/windows.rb:76:in put_bytes': invalid memory write at address=0x0000000000000000 (FFI::NullPointerError) from D:/Ruby/lib/ruby/gems/3.0.0/gems/clipboard-1.3.5/lib/clipboard/windows.rb:76:in
copy'
from D:/Ruby/lib/ruby/gems/3.0.0/gems/clipboard-1.3.5/lib/clipboard.rb:62:in copy' from D:/R/hike/test.rb:3:in
'
Files
Updated by xtkoba (Tee KOBAYASHI) over 3 years ago
Feel free to report it to https://github.com/ffi/ffi/issues. (BTW it is reproducible for me.)
Updated by Eregon (Benoit Daloze) over 3 years ago
More likely to be an issue of https://github.com/janlelis/clipboard
The error means the clipboard gem tries to write to the NULL address, which is a bug.
Updated by xtkoba (Tee KOBAYASHI) over 3 years ago
Indeed.
And this seems to be another instance of LLP64 issues which wrongfully assume sizeof(long) == sizeof(void *)
. Running on i386-mingw32 works as expected.
(Edited. LLP64, not ILP32.)
Updated by jeremyevans0 (Jeremy Evans) over 3 years ago
- Status changed from Open to Third Party's Issue
Updated by fitmap (Justin Peal) over 3 years ago
- File clipboard.Rb clipboard.Rb added
- File ClipboardTest.rb ClipboardTest.rb added
In Windows x64, SIZE_T and HGLOBAL (and other handles) in Fiddle shoule be map to void*(64 bits), not uint(32 bits).
So gem clipboard V1.3.5 got a pointor failure.
Attachment fix this bug, just for Windows platform.