Actions
Bug #10853
closedinspect.claer dumps core
Description
$ ruby -e 'inspect.clear'
*** Error in `ruby': munmap_chunk(): invalid pointer: 0x00007fd20ed64fe7 ***
Aborted (core dumped)
str_discard attempts to free a C literal string, which causes core dump.
It must check STR_NOFREE.
diff --git a/string.c b/string.c
index 5de795a..d810213 100644
--- a/string.c
+++ b/string.c
@@ -1662,7 +1662,7 @@ static inline void
str_discard(VALUE str)
{
str_modifiable(str);
- if (!STR_SHARED_P(str) && !STR_EMBED_P(str)) {
+ if (!STR_EMBED_P(str) && !FL_TEST(str, STR_SHARED|STR_NOFREE)) {
ruby_sized_xfree(STR_HEAP_PTR(str), STR_HEAP_SIZE(str));
RSTRING(str)->as.heap.ptr = 0;
RSTRING(str)->as.heap.len = 0;
--
Yusuke Endoh mame@ruby-lang.org
Updated by mame (Yusuke Endoh) over 9 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
Applied in changeset r49586.
-
string.c (str_discard): does not free for STR_NOFREE string.
[Bug #10853][ruby-core:68110] -
bootstraptest/test_string.rb: test for above.
Updated by mame (Yusuke Endoh) over 9 years ago
- Backport changed from 2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED
Updated by naruse (Yui NARUSE) over 9 years ago
- Backport changed from 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: REQUIRED to 2.0.0: DONTNEED, 2.1: DONTNEED, 2.2: DONE
ruby_2_2 r49621 merged revision(s) 49586.
Actions
Like0
Like0Like0Like0