summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNARUSE, Yui <naruse@airemix.jp>2023-01-19 11:59:43 +0900
committerNARUSE, Yui <naruse@airemix.jp>2023-01-19 11:59:43 +0900
commit686b38f83e70b3e1796092c71dd0b7dc2206b118 (patch)
tree60af8b39f89c182ae7d77e7c3efbde3a5f5c3639
parent1a2447ac9925e7794a7c5aa07960ad4de08e6aca (diff)
downloadruby-686b38f83e70b3e1796092c71dd0b7dc2206b118.tar.gz
merge revision(s) d8ef0a98c670449b20436947f5ebbd327ed5ab0d: [Backport #19319]
[Bug #19319] Fix crash in rb_str_casemap The following code crashes on my machine: ``` GC.stress = true str = "testing testing testing" puts str.capitalize ``` We need to ensure that the object `buffer_anchor` remains on the stack so it does not get GC'd. --- string.c | 2 ++ 1 file changed, 2 insertions(+)
-rw-r--r--string.c2
-rw-r--r--version.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/string.c b/string.c
index 6fd165cd5a..fc5629638c 100644
--- a/string.c
+++ b/string.c
@@ -7329,6 +7329,8 @@ rb_str_casemap(VALUE source, OnigCaseFoldType *flags, rb_encoding *enc)
DATA_PTR(buffer_anchor) = 0;
mapping_buffer_free(current_buffer);
+ RB_GC_GUARD(buffer_anchor);
+
/* TODO: check about string terminator character */
str_enc_copy(target, source);
/*ENC_CODERANGE_SET(mapped, cr);*/
diff --git a/version.h b/version.h
index e334ced0da..41ec61e156 100644
--- a/version.h
+++ b/version.h
@@ -11,7 +11,7 @@
# define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR
#define RUBY_VERSION_TEENY 0
#define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR
-#define RUBY_PATCHLEVEL 13
+#define RUBY_PATCHLEVEL 14
#include "ruby/version.h"
#include "ruby/internal/abi.h"