From: luke.gru@... Date: 2019-06-18T19:48:07+00:00 Subject: [ruby-core:93229] [Ruby trunk Bug#15937] Segmentation fault when String#initialize given same string with capacity field Issue #15937 has been updated by luke-gru (Luke Gruber). NOTE: I didn't attach a patch or proof of concept fix because I don't know how you want to handle this edge case. The easiest thing would just be to return the original string in `rb_str_init` and not honor the capacity change here. ---------------------------------------- Bug #15937: Segmentation fault when String#initialize given same string with capacity field https://bugs.ruby-lang.org/issues/15937#change-78679 * Author: luke-gru (Luke Gruber) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.4: UNKNOWN, 2.5: UNKNOWN, 2.6: UNKNOWN ---------------------------------------- Reproduction steps: string buffer corruption: ```ruby s = "mystring" s.__send__(:initialize, s, capacity: 1000) puts s ``` segfault: ```ruby s = "mystring that can't be embedded because it's too long and therefore must be allocated" s.__send__(:initialize, s, capacity: 1000) ``` Thanks for your time :) -- https://bugs.ruby-lang.org/ Unsubscribe: