Issue #12662 has been updated by Rocco Carbone.


I am confused. My C (please note C) program core dumps and libruby gives me an indication I found an error in Ruby an please report and I have to protect?

I am writing a pure C application (C not Ruby) using libruby to benchmark the Ruby's hash implementation versus other languages (PHP, Python, Lua, Perl, TCL).

All plain C. Are you sure I have to protect or I have to patch my own Ruby in order to return NULL in the event the key is not found in the hash table?

No Ruby yet, only C. SIGSEGV is inside Ruby lib not in my code yet.

/rocco

----------------------------------------
Bug #12662: rb_hash_fetch() Segmentation fault on an empty hash table
https://bugs.ruby-lang.org/issues/12662#change-60055

* Author: Rocco Carbone
* Status: Rejected
* Priority: Normal
* Assignee: 
* ruby -v: ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
* Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
----------------------------------------
I am writing HTM (Hash Table Machine - a C benchmark program for hash table) and libruby aborts with

ruby: [BUG] Segmentation fault at 0x00000000000018
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]

while attempting to get an entry from an empty hash table.

Attached is a simple program that reproduces the bug.

Hope it helps.

ciao

/rocco

---Files--------------------------------
ruby-bug.c (652 Bytes)


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

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