summaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorPeter Zhu <peter@peterzhu.ca>2023-05-23 13:45:44 -0400
committerPeter Zhu <peter@peterzhu.ca>2023-05-23 15:27:56 -0400
commita86f798fc2e979ea83ec55744f906b2a816c8681 (patch)
tree897aff087429971d6e7532572a42e46a759338fa /internal
parent061e01ee5088b491ab702a567eb0d5bed1c5d429 (diff)
Fix crash when replacing ST hash with AR hash
With VWA, AR hashes are much larger than ST hashes. Hash#replace attempts to directly copy the contents of AR hashes into ST hashes so there will be memory corruption caused by writing past the end of memory. This commit changes it so that if a ST hash is being replaced with an AR hash it will insert each element into the ST hash.
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/7846
Diffstat (limited to 'internal')
-rw-r--r--internal/hash.h1
1 files changed, 0 insertions, 1 deletions
diff --git a/internal/hash.h b/internal/hash.h
index 248a53429d..3874abeaa5 100644
--- a/internal/hash.h
+++ b/internal/hash.h
@@ -179,7 +179,6 @@ static inline void
RHASH_ST_CLEAR(VALUE h)
{
memset(RHASH_ST_TABLE(h), 0, sizeof(st_table));
- FL_UNSET_RAW(h, RHASH_ST_TABLE_FLAG);
}
static inline unsigned