summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authoralexandre184 <110398901+alexandre184@users.noreply.github.com>2023-07-15 09:36:53 +0200
committerGitHub <noreply@github.com>2023-07-15 16:36:53 +0900
commite5825de7c9f07e4f7bd2b83ce8973e19a4652916 (patch)
tree92b04125daca166707c5465402469603d33fb619 /string.c
parentf15123c34ce80f3928612befe2a9aaf4c9d27fda (diff)
[Bug #19769] Fix range of size 1 in `String#tr`
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/8080 Merged-By: nobu <nobu@ruby-lang.org>
Diffstat (limited to 'string.c')
-rw-r--r--string.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/string.c b/string.c
index af0668e4b2..9cc4dfd3ce 100644
--- a/string.c
+++ b/string.c
@@ -7714,8 +7714,10 @@ trnext(struct tr *t, rb_encoding *enc)
}
continue; /* not reached */
}
- t->gen = 1;
- t->max = c;
+ else if (t->now < c) {
+ t->gen = 1;
+ t->max = c;
+ }
}
}
return t->now;