Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ruby: 3.7 segfaults on BytesValue#to_json #5911

Closed
fables-tales opened this issue Mar 18, 2019 · 0 comments
Closed

Ruby: 3.7 segfaults on BytesValue#to_json #5911

fables-tales opened this issue Mar 18, 2019 · 0 comments
Assignees
Labels

Comments

@fables-tales
Copy link
Contributor

What version of protobuf and what language are you using?
Version: v3.7.0 & Master
Language: Ruby

What operating system (Linux, Windows, ...) and version?
OS X 10.14.3

What runtime / compiler are you using (e.g., python version or gcc version)
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]

What did you do?
Steps to reproduce the behavior:

curl http://2.gravatar.com/avatar/8ca3202a7c4591caa91e66cf4ad4b116?s=1000 > sam.jpg
ruby -e 'require "google/protobuf"; require "google/protobuf/wrappers_pb"; Google::Protobuf::BytesValue.new(value: File.open("sam.jpg", "rb").read).to_json'

What did you expect to see
Not a segfault, but instead some JSON output for this value.

What did you see instead?
The ruby virtual machine segfaults

/Users/samphippen/.gem/ruby/2.5.3/gems/google-protobuf-3.7.0-universal-darwin/lib/google/protobuf/message_exts.rb:44: [BUG] Segmentation fault at 0x00007ffee028c000
ruby 2.5.3p105 (2018-10-18 revision 65156) [x86_64-darwin18]

-- Crash Report log information --------------------------------------------
   See Crash Report log file under the one of following:
     * ~/Library/Logs/DiagnosticReports
     * /Library/Logs/DiagnosticReports
   for more details.
Don't forget to include the above Crash Report log file in bug reports.

-- Control frame information -----------------------------------------------
c:0004 p:---- s:0017 e:000016 CFUNC  :encode_json
c:0003 p:0014 s:0011 e:000010 METHOD /Users/samphippen/.gem/ruby/2.5.3/gems/google-protobuf-3.7.0-universal-darwin/lib/google/protobuf/message_exts.rb:44
c:0002 p:0048 s:0006 e:000005 EVAL   -e:1 [FINISH]
c:0001 p:0000 s:0003 E:001170 (none) [FINISH]

-- Ruby level backtrace information ----------------------------------------
-e:1:in `<main>'
/Users/samphippen/.gem/ruby/2.5.3/gems/google-protobuf-3.7.0-universal-darwin/lib/google/protobuf/message_exts.rb:44:in `to_json'
/Users/samphippen/.gem/ruby/2.5.3/gems/google-protobuf-3.7.0-universal-darwin/lib/google/protobuf/message_exts.rb:44:in `encode_json'

-- Machine register context ------------------------------------------------
 rax: 0x0000000000000043 rbx: 0x0000000000000037 rcx: 0x000000000000004e
 rdx: 0x000000010ff04dc4 rdi: 0x0000000000034b37 rsi: 0x000000010fec8c40
 rbp: 0x00007ffee0289700 rsp: 0x00007ffee0285850  r8: 0x0000000000000000
  r9: 0x0000000000000001 r10: 0x0000000000000002 r11: 0x0000000000000002
 r12: 0x00007ffee028c000 r13: 0x00007fd36a7a9440 r14: 0x00000000000398fb
 r15: 0x00007ffee0289a30 rip: 0x000000010feb3def rfl: 0x0000000000010203

-- C level backtrace information -------------------------------------------

(c level backtrace information is not populated)

Anything else we should know about your project / environment

This was first reproduced while building examples for the google ads ruby client library, where our MediaImage proto uses a bytesvalue to wrap an image to upload, the provided image is a test image we were using to reproduce the behavior. My LDAP is samphippen@ if you need to reach out for any google confidential stuff :)

@TeBoring TeBoring self-assigned this Mar 18, 2019
@TeBoring TeBoring added the ruby label Mar 18, 2019
@TeBoring TeBoring added this to the v3.7.0 milestone Mar 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants