diff --git a/string.c b/string.c index a28d682a84..7c3a790fa3 100644 --- a/string.c +++ b/string.c @@ -344,6 +344,10 @@ fstr_update_callback(st_data_t *key, st_data_t *value, st_data_t data, int exist if (rb_objspace_garbage_object_p(str)) { arg->fstr = Qundef; + // When RSTRING_FSTR strings are swept, they call `st_delete`. + // To avoid a race condition if an equivalent string was inserted + // we must remove the flag immediately. + FL_UNSET_RAW(str, RSTRING_FSTR); return ST_DELETE; } diff --git a/version.h b/version.h index ecddbf549c..cc73220a98 100644 --- a/version.h +++ b/version.h @@ -11,7 +11,7 @@ # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 7 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 131 +#define RUBY_PATCHLEVEL 132 #include "ruby/version.h" #include "ruby/internal/abi.h"