1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* string.c (tr_trans): cast to unsigned char after dereference

a pointer to a char to avoid SEGV with "\377".tr("a", "b").
  on FreeBSD/amd64.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13872 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2007-11-10 14:53:26 +00:00
parent c585a9eba1
commit 098a563935
2 changed files with 7 additions and 1 deletions

View file

@ -1,3 +1,9 @@
Sat Nov 10 23:50:31 2007 Tanaka Akira <akr@fsij.org>
* string.c (tr_trans): cast to unsigned char after dereference
a pointer to a char to avoid SEGV with "\377".tr("a", "b").
on FreeBSD/amd64.
Sat Nov 10 23:08:53 2007 Tanaka Akira <akr@fsij.org>
* configure.in, common.mk, Makefile.in: don't generate

View file

@ -3475,7 +3475,7 @@ tr_trans(VALUE str, VALUE src, VALUE repl, int sflag)
}
else if (rb_enc_mbmaxlen(enc) == 1) {
while (s < send) {
c = *s;
c = (unsigned char)*s;
if (trans[c] >= 0) {
if (!cflag) {
c = FIX2INT(trans[c]);