diff options
| author | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-01-11 17:51:11 +0900 |
|---|---|---|
| committer | Yukihiro "Matz" Matsumoto <[email protected]> | 2017-01-11 17:51:11 +0900 |
| commit | e1ff71029f95e3274136263adbdc51c662ec52de (patch) | |
| tree | cb0d8e878444c193b3b3e2265ee8ce6f5a0d751c /src/string.c | |
| parent | 06b2e6a76c562b7a83669d0ffe7e4ac43a2636db (diff) | |
| download | mruby-e1ff71029f95e3274136263adbdc51c662ec52de.tar.gz mruby-e1ff71029f95e3274136263adbdc51c662ec52de.zip | |
String#replace should check replacing string; fix #3374
This issue was reported by https://hackerone.com/tunz
Diffstat (limited to 'src/string.c')
| -rw-r--r-- | src/string.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/string.c b/src/string.c index b4746545a..d6bdd6975 100644 --- a/src/string.c +++ b/src/string.c @@ -519,6 +519,7 @@ str_replace(mrb_state *mrb, struct RString *s1, struct RString *s2) long len; check_frozen(mrb, s1); + if (s1 == s2) return mrb_obj_value(s1); len = RSTR_LEN(s2); if (RSTR_SHARED_P(s1)) { str_decref(mrb, s1->as.heap.aux.shared); |
