summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authorkosako <kosako@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-29 10:55:27 +0000
committerkosako <kosako@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-10-29 10:55:27 +0000
commitab984108d7f37ecd70e7d51b819a2f996d3ec834 (patch)
treeb5f3e4fed3126a95151b254838652638b3aca326 /regexec.c
parent92d805753bf9264d35bb6ac44a740f71898654ab (diff)
fix offset value in STATE_CHECK_BUFF_INIT()
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@11235 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/regexec.c b/regexec.c
index 1e31cd6038..ba2a1b1cd4 100644
--- a/regexec.c
+++ b/regexec.c
@@ -390,7 +390,8 @@ typedef struct {
#define STATE_CHECK_BUFF_INIT(msa, str_len, offset, state_num) do { \
if ((state_num) > 0 && str_len >= STATE_CHECK_STRING_THRESHOLD_LEN) {\
- int size = ((int )((str_len) + 1) * (state_num) + 7) / 8;\
+ unsigned int size = (unsigned int )(((str_len) + 1) * (state_num) + 7) >> 3;\
+ offset = ((offset) * (state_num)) >> 3;\
if (size > 0 && offset < size && size < STATE_CHECK_BUFF_MAX_SIZE) {\
if (size >= STATE_CHECK_BUFF_MALLOC_THRESHOLD_SIZE) \
(msa).state_check_buff = (void* )xmalloc(size);\