Project

General

Profile

Actions

Bug #17934

closed

clipboard gem fail on Ruby 3.0.1

Added by fitmap (Justin Peal) over 3 years ago. Updated over 3 years ago.

Status:
Third Party's Issue
Assignee:
-
Target version:
-
ruby -v:
ruby 3.0.1p64 (2021-04-05 revision 0fb782ee38) [x64-mingw32]
[ruby-core:104139]

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

clipboard.Rb (4.66 KB) clipboard.Rb fitmap (Justin Peal), 06/03/2021 10:12 AM
ClipboardTest.rb (1.18 KB) ClipboardTest.rb fitmap (Justin Peal), 06/03/2021 10:14 AM

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.)

Actions #4

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

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.

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0