From 079a6074425a85369ed7d045765398a30c5e20db Mon Sep 17 00:00:00 2001 From: "erik.corry@gmail.com" Date: Wed, 8 Oct 2008 08:05:14 +0000 Subject: [PATCH] Fix incorrect short cut test that assumed ASCII strings could be Latin1. Review URL: http://codereview.chromium.org/6542 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@468 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/runtime.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/runtime.cc b/src/runtime.cc index 42cf7b4..4fe5fe8 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -1086,7 +1086,11 @@ static int BoyerMooreHorspoolIndexOf(Vector subject, // Notice: Doesn't include last character. for (int i = p < m ? m - p : 0; i < m - 1; i++) { uc32 c = pattern[i]; - if (sizeof(schar) == 1 && c > 255) return -1; + if (sizeof(schar) == 1 && + sizeof(pchar) > 1 && + c > String::kMaxAsciiCharCode) { + return -1; + } bad_char_map[c & kBMHSignificantBitsMask] = m - 1 - i; } -- 2.7.4