jit: use correct type when checking for max value (#73)
eb42305f
(jit: avoid integer wraparound in stack size definition (#42),
2021-11-19) introduces a check to avoid an integer overflow when
allocating stack size for JIT.
Unfortunately the maximum value was using PCRE2_SIZE_MAX, eventhough
the variable is of type size_t, so correct it.
Practically; the issue shouldn't affect the most common configurations
where both values are the same, and it will be unlikely that there would
be a configuration where PCRE2_SIZE_MAX > SIZE_MAX, hence the mistake
is unlikely to have reintroduced the original bug and this change should
be therefore mostly equivalent.
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
This commit is contained in:
parent
80205ee2a0
commit
14dbc6e6ec
|
@ -135,7 +135,7 @@ return NULL;
|
||||||
|
|
||||||
pcre2_jit_stack *jit_stack;
|
pcre2_jit_stack *jit_stack;
|
||||||
|
|
||||||
if (startsize == 0 || maxsize == 0 || maxsize > PCRE2_SIZE_MAX - STACK_GROWTH_RATE)
|
if (startsize == 0 || maxsize == 0 || maxsize > SIZE_MAX - STACK_GROWTH_RATE)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (startsize > maxsize)
|
if (startsize > maxsize)
|
||||||
startsize = maxsize;
|
startsize = maxsize;
|
||||||
|
|
Loading…
Reference in New Issue