Commit Graph

25 Commits

Author SHA1 Message Date
Carlo Marcelo Arenas Belón 14dbc6e6ec
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>
2022-01-06 14:46:43 +01:00
Carlo Marcelo Arenas Belón eb42305f07
jit: avoid integer wraparound in stack size definition (#42)
pcre2_jit_stack_create() allows the user to indicate how big of a
stack size JIT should be able to allocate and use, using a size_t
variable which should be able to hold bigger values than reasonable.

Internally, the value is rounded to the next 8K, but if the value
is unreasonable large, would overflow and could result in a smaller
than expected stack or a maximun size that is smaller than the
minimum..

Avoid the overflow by checking the value and failing early, and
while at it make the check clearer while documenting the failure
mode.

Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
2021-11-19 09:23:46 +01:00
Zoltán Herczeg 384620a172 JIT compiler update. 2020-08-27 06:19:17 +00:00
Zoltán Herczeg 09984bb0e4 The JIT stack should be freed when the low-level stack allocation fails. 2020-01-24 08:28:23 +00:00
Philip.Hazel bebd2d48bf Final file updates for 10.21 release. 2016-01-12 14:44:34 +00:00
Zoltán Herczeg 4161891b42 Fix compiler errors when JIT is not enabled. 2015-03-06 12:49:18 +00:00
Zoltán Herczeg 94802eb0d9 Remove computing the JIT read-only data size in advance and use on-demand memory allocation. 2015-03-06 07:41:36 +00:00
Philip.Hazel 161cd17ba0 Move context argument to last in pcre2_jit_stack_create(). 2014-11-28 12:46:16 +00:00
Philip.Hazel bcf59568aa Typos in non-JIT compile mode. 2014-11-11 10:21:23 +00:00
Zoltán Herczeg 7d9caa5b41 The pcre2_jit_stack_assign is changed to use the matching context. 2014-11-06 14:37:09 +00:00
Philip.Hazel 08e3107cbe Changed jit_stack_alloc to jit_stack_create. 2014-11-03 17:13:00 +00:00
Philip.Hazel 56805a1246 Remove some unused code and a spurious comment and reword one message. 2014-10-25 14:28:43 +00:00
Philip.Hazel b23ec7e1f5 More per-function documentation; revised perltest.sh replaces perltest.pl. 2014-10-25 14:16:46 +00:00
Philip.Hazel 722817013c Fix several bugs concerned with different configurations. 2014-10-15 15:57:49 +00:00
Zoltán Herczeg a6302442f2 Fix JIT test issues when PCRE2 configured in various modes. 2014-10-13 06:43:00 +00:00
Zoltán Herczeg 0907fc6e92 Support for JIT code free and small partial match optimization. 2014-10-09 10:06:19 +00:00
Zoltán Herczeg 62746ceb10 Several small JIT fixes. 2014-10-08 08:57:26 +00:00
Philip.Hazel cc463c76a3 Call _pcre2_jit_free from pcre2_code_free. 2014-10-07 13:07:20 +00:00
Zoltán Herczeg 386b47eabe More JIT fixes. 2014-10-05 06:20:41 +00:00
Zoltán Herczeg 648695e262 Minor fixes. RunTest 1 now works with JIT. 2014-10-04 17:05:21 +00:00
Zoltán Herczeg 4fda5bba36 PCRE2 successfully compiles with --enable-jit now. 2014-09-30 07:06:48 +00:00
Philip.Hazel 7efba85b56 Change lengths to PCRE2_SIZE and revise OP_RECURSE processing. 2014-08-16 09:46:58 +00:00
Philip.Hazel 55967f9a4f Preparatory work for JIT. 2014-08-08 18:18:18 +00:00
Philip.Hazel 06ba06c763 Refactor the framework for revised API. 2014-04-18 15:37:56 +00:00
Philip.Hazel f4174bab90 Create dummy framework for all functions and programs. 2014-03-07 17:28:52 +00:00