diff options
author | Yusuke Endoh <mame@ruby-lang.org> | 2022-11-08 23:36:14 +0900 |
---|---|---|
committer | Yusuke Endoh <mame@ruby-lang.org> | 2022-11-09 23:21:26 +0900 |
commit | 14845ab4ffccc317a08629f4503c87ee97621c0b (patch) | |
tree | 07a36a831c57fe8c96197ab32eb0bdda468c92b6 /regexec.c | |
parent | 537286d0bb5021afe188cfba6100772bb0285e06 (diff) |
Ensure that the table size for CACHE_MATCH fits with int
Currently, the keys for CACHE_MATCH are handled as an `int` type. So we
should make sure the table size are smaller than the range of `int`.
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -3842,7 +3842,7 @@ match_at(regex_t* reg, const UChar* str, const UChar* end, size_t len = (end - str) + 1; size_t match_cache_size8 = (size_t)msa->num_cache_opcode * len; /* overflow check */ - if (match_cache_size8 / len != (size_t)msa->num_cache_opcode) { + if (match_cache_size8 >= INT_MAX_LIMIT) { return ONIGERR_MEMORY; } size_t match_cache_size = (match_cache_size8 >> 3) + (match_cache_size8 & 7 ? 1 : 0); |