John Hawthorn 443e2ec27d Replace tombstone when converting AR to ST hash
[Bug #21170]

st_table reserves -1 as a special hash value to indicate that an entry
has been deleted. So that that's a valid value to be returned from the
hash function, do_hash replaces -1 with 0 so that it is not mistaken for
the sentinel.

Previously, when upgrading an AR table to an ST table,
rb_st_add_direct_with_hash was used which did not perform the same
conversion, this could lead to a hash in a broken state where one if its
entries which was supposed to exist being marked as a tombstone.

The hash could then become further corrupted when the ST table required
resizing as the falsely tombstoned entry would be skipped but it would
be counted in num entries, leading to an uninitialized entry at index
15.

In most cases this will be really rare, unless using a very poorly
implemented custom hash function.

This also adds two debug assertions, one that st_add_direct_with_hash
does not receive the reserved hash value, and a second in
rebuild_table_with, which ensures that after we rebuild/compact a table
it contains the expected number of elements.

Co-authored-by: Alan Wu <alanwu@ruby-lang.org>
2025-03-05 14:05:24 -08:00
2025-03-04 18:58:10 +09:00
2025-02-24 10:47:58 +01:00
2025-01-16 12:35:21 +09:00
2025-01-07 13:29:35 +09:00
2025-01-20 15:48:08 +01:00
2025-01-03 11:42:53 -05:00
2025-03-03 11:17:14 +09:00
2025-01-02 11:03:04 -05:00
2025-01-31 15:41:56 +09:00
2025-02-19 09:47:28 -05:00
2025-02-13 08:53:02 +09:00
GPL
2025-03-04 09:22:19 -05:00
2025-01-24 10:44:24 -05:00
2025-01-08 09:11:59 -05:00
2025-01-11 01:22:26 +09:00
2025-03-03 11:17:14 +09:00
2025-01-09 19:24:27 +09:00
2025-01-30 18:19:53 +09:00
2025-02-27 13:00:34 +09:00
2025-03-03 11:17:14 +09:00
2024-12-13 06:22:13 +09:00
2024-11-30 00:03:07 +09:00
2025-03-03 11:17:14 +09:00
2024-11-08 17:39:19 -08:00
2024-11-13 10:29:07 +01:00
2025-02-23 10:37:36 +09:00
2024-12-17 11:58:00 +09:00
2024-12-04 13:59:54 +09:00
2025-01-24 11:07:20 -05:00
2024-11-08 18:02:46 +09:00

Actions Status: MinGW Actions Status: Ubuntu Actions Status: Windows Travis Status

What is Ruby?

Ruby is an interpreted object-oriented programming language often used for web development. It also offers many scripting features to process plain text and serialized files, or manage system tasks. It is simple, straightforward, and extensible.

Features of Ruby

  • Simple Syntax
  • Normal Object-oriented Features (e.g. class, method calls)
  • Advanced Object-oriented Features (e.g. mix-in, singleton-method)
  • Operator Overloading
  • Exception Handling
  • Iterators and Closures
  • Garbage Collection
  • Dynamic Loading of Object Files (on some architectures)
  • Highly Portable (works on many Unix-like/POSIX compatible platforms as well as Windows, macOS, etc.) cf. https://docs.ruby-lang.org/en/master/maintainers_md.html#label-Platform+Maintainers

How to get Ruby

For a complete list of ways to install Ruby, including using third-party tools like rvm, see:

https://www.ruby-lang.org/en/downloads/

You can download release packages and the snapshot of the repository. If you want to download whole versions of Ruby, please visit https://www.ruby-lang.org/en/downloads/releases/.

Download with Git

The mirror of the Ruby source tree can be checked out with the following command:

$ git clone https://github.com/ruby/ruby.git

There are some other branches under development. Try the following command to see the list of branches:

$ git ls-remote https://github.com/ruby/ruby.git

You may also want to use https://git.ruby-lang.org/ruby.git (actual master of Ruby source) if you are a committer.

How to build

See Building Ruby

Ruby home page

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

Documentation

Mailing list

There is a mailing list to discuss Ruby. To subscribe to this list, please send the following phrase:

join

in the mail subject (not body) to the address ruby-talk-request@ml.ruby-lang.org.

Copying

See the file COPYING.

Feedback

Questions about the Ruby language can be asked on the Ruby-Talk mailing list or on websites like https://stackoverflow.com.

Bugs should be reported at https://bugs.ruby-lang.org. Read "Reporting Issues" for more information.

Contributing

See "Contributing to Ruby", which includes setup and build instructions.

The Author

Ruby was originally designed and developed by Yukihiro Matsumoto (Matz) in 1995.

matz@ruby-lang.org

Description
Languages
Ruby 58.9%
C 29.5%
Rust 6.1%
C++ 2.9%
Yacc 0.9%
Other 1.6%