summaryrefslogtreecommitdiff
path: root/encoding.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-08 18:41:47 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-12-08 18:41:47 +0000
commitcde5b2a9cf6934bd5fe006be31d6a09901609c13 (patch)
tree06f3d4287eafff768b4a1e3c25a91cb308724547 /encoding.c
parent6c6cf008cd8df085b9402439c3c14963d8cc422a (diff)
* encoding.c (rb_enc_mbclen): return 1 if underlying implementation
returns a length longer than e-p. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'encoding.c')
-rw-r--r--encoding.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/encoding.c b/encoding.c
index 540aa88701..e902f6db0e 100644
--- a/encoding.c
+++ b/encoding.c
@@ -486,7 +486,8 @@ int
rb_enc_mbclen(const char *p, const char *e, rb_encoding *enc)
{
int n = ONIGENC_PRECISE_MBC_ENC_LEN(enc, (UChar*)p, (UChar*)e);
- if (MBCLEN_CHARFOUND(n))
+ n = MBCLEN_CHARFOUND(n);
+ if (0 < n && n <= e-p)
return n;
else
return 1;