pcre2/doc
Carlo Marcelo Arenas Belón ae4e6261e5
match: avoid crash if subject NULL and PCRE2_ZERO_TERMINATED (#53)
* pcre2_match: avoid crash if subject NULL and PCRE2_ZERO_TERMINATED

When length of subject is PCRE2_ZERO_TERMINATED strlen is used
to calculate its size, which will trigger a crash if subject is
also NULL.

Move the NULL check before strlen on it would be used, and make
sure or dependent variables are set after the NULL validation
as well.

While at it, fix a typo in a debug flag in the same file, which
is otherwise unrelated and make sure the full section of constrain
checks can be identified clearly using the leading comment alone.

* pcre2_dfa_match: avoid crash if subject NULL and PCRE2_ZERO_TERMINATED

When length of subject is PCRE2_ZERO_TERMINATED strlen is used
to calculate its size, which will trigger a crash if subject is
also NULL.

Move the NULL check before the detection for subject sizes to
avoid this issue.

* pcre2_substitute: avoid crash if subject or replacement are NULL

The underlying pcre2_match() function will validate the subject if
needed, but will crash when length is PCRE2_ZERO_TERMINATED or if
subject == NULL and pcre2_match() is not being called because
match_data was provided.

The replacement parameter is missing NULL checks, and so currently
allows for an equivalent response to "" if rlength == 0.

Restrict all other cases to avoid strlen(NULL) crashes in the same
way that is done for subject, but also make sure to reject invalid
length values as early as possible.
2021-11-27 16:49:31 +00:00
..
html Local updates consequent on ocumentation patches (PR#47). 2021-11-27 16:32:52 +00:00
index.html.src Add the pcre2_maketables_free() function. 2019-09-03 14:16:07 +00:00
pcre2-config.1 More draft documentation. 2014-09-28 17:39:28 +00:00
pcre2-config.txt Documentation update. 2019-06-22 16:36:15 +00:00
pcre2.3 Doc file tidies for 10.38-RC1 2021-08-31 17:14:42 +01:00
pcre2.txt Local updates consequent on ocumentation patches (PR#47). 2021-11-27 16:32:52 +00:00
pcre2_callout_enumerate.3 Documentation update. 2017-03-23 19:24:16 +00:00
pcre2_code_copy.3 Add pcre2_code_copy_with_tables(). 2016-11-22 15:37:02 +00:00
pcre2_code_copy_with_tables.3 File tidies for 10.23-RC1 2017-01-16 17:40:47 +00:00
pcre2_code_free.3 Documentation update for NULL arguments. 2018-06-28 16:26:03 +00:00
pcre2_compile.3 Source tidies (trailing spaces) etc. for 10.34-RC1. 2019-10-17 16:39:38 +00:00
pcre2_compile_context_copy.3 More per-function documentation; revised perltest.sh replaces perltest.pl. 2014-10-25 14:16:46 +00:00
pcre2_compile_context_create.3 More per-function documentation; revised perltest.sh replaces perltest.pl. 2014-10-25 14:16:46 +00:00
pcre2_compile_context_free.3 Documentation update for NULL arguments. 2018-06-28 16:26:03 +00:00
pcre2_config.3 Add PCRE2_CONFIG_COMPILED_WIDTHS and PCRE2_CONFIG_NEVER_BACKSLASH_C. 2017-09-16 11:39:38 +00:00
pcre2_convert_context_copy.3 Document experimental pattern conversion functions and remove unimplemented 2017-07-12 16:34:49 +00:00
pcre2_convert_context_create.3 Document experimental pattern conversion functions and remove unimplemented 2017-07-12 16:34:49 +00:00
pcre2_convert_context_free.3 File tidies and documentation update for 10.32-RC1 Release Candidate. 2018-08-13 11:57:09 +00:00
pcre2_converted_pattern_free.3 File tidies and documentation update for 10.32-RC1 Release Candidate. 2018-08-13 11:57:09 +00:00
pcre2_dfa_match.3 Doc file tidies for 10.38-RC1 2021-08-31 17:14:42 +01:00
pcre2_general_context_copy.3 More per-function documentation; revised perltest.sh replaces perltest.pl. 2014-10-25 14:16:46 +00:00
pcre2_general_context_create.3 More per-function documentation; revised perltest.sh replaces perltest.pl. 2014-10-25 14:16:46 +00:00
pcre2_general_context_free.3 Documentation update for NULL arguments. 2018-06-28 16:26:03 +00:00
pcre2_get_error_message.3 Documentation update. 2017-03-24 16:53:38 +00:00
pcre2_get_mark.3 Source tidies and version etc. updates for 10.31-RC1. 2018-01-13 16:53:02 +00:00
pcre2_get_match_data_size.3 Source tidies (trailing spaces) etc. for 10.34-RC1. 2019-10-17 16:39:38 +00:00
pcre2_get_ovector_count.3 More per-function documentation; revised perltest.sh replaces perltest.pl. 2014-10-25 14:16:46 +00:00
pcre2_get_ovector_pointer.3 More per-function documentation; revised perltest.sh replaces perltest.pl. 2014-10-25 14:16:46 +00:00
pcre2_get_startchar.3 More documentation 2014-10-25 15:51:01 +00:00
pcre2_jit_compile.3 Source tidies (trailing spaces) etc. for 10.34-RC1. 2019-10-17 16:39:38 +00:00
pcre2_jit_free_unused_memory.3 Fix documentation typos and upgrade documentation checking script. 2020-04-24 16:05:36 +00:00
pcre2_jit_match.3 Documentation update. 2020-02-11 16:37:08 +00:00
pcre2_jit_stack_assign.3 File tidies and documentation update for 10.32-RC1 Release Candidate. 2018-08-13 11:57:09 +00:00
pcre2_jit_stack_create.3 jit: avoid integer wraparound in stack size definition (#42) 2021-11-19 09:23:46 +01:00
pcre2_jit_stack_free.3 File tidies and documentation update for 10.32-RC1 Release Candidate. 2018-08-13 11:57:09 +00:00
pcre2_maketables.3 Correct tables argument data type for pcre2_set_character_tables() and fix 2019-07-28 15:58:24 +00:00
pcre2_maketables_free.3 Add the pcre2_maketables_free() function. 2019-09-03 14:16:07 +00:00
pcre2_match.3 More file tidies for 10.33-RC1 2019-03-04 18:07:04 +00:00
pcre2_match_context_copy.3 More per-function documentation; revised perltest.sh replaces perltest.pl. 2014-10-25 14:16:46 +00:00
pcre2_match_context_create.3 More per-function documentation; revised perltest.sh replaces perltest.pl. 2014-10-25 14:16:46 +00:00
pcre2_match_context_free.3 Documentation update for NULL arguments. 2018-06-28 16:26:03 +00:00
pcre2_match_data_create.3 Documentation update to clarify ovector usage with DFA matching. 2021-08-28 16:25:59 +01:00
pcre2_match_data_create_from_pattern.3 Documentation update to clarify ovector usage with DFA matching. 2021-08-28 16:25:59 +01:00
pcre2_match_data_free.3 More file tidies for 10.33-RC1 2019-03-04 18:07:04 +00:00
pcre2_pattern_convert.3 Document experimental pattern conversion functions and remove unimplemented 2017-07-12 16:34:49 +00:00
pcre2_pattern_info.3 Fix two identical documentation typos. 2019-02-14 16:07:14 +00:00
pcre2_serialize_decode.3 File tidies and documentation update for 10.32-RC1 Release Candidate. 2018-08-13 11:57:09 +00:00
pcre2_serialize_encode.3 File tidies and documentation update for 10.32-RC1 Release Candidate. 2018-08-13 11:57:09 +00:00
pcre2_serialize_free.3 File tidies and documentation update for 10.32-RC1 Release Candidate. 2018-08-13 11:57:09 +00:00
pcre2_serialize_get_number_of_codes.3 File tidies and documentation update for 10.32-RC1 Release Candidate. 2018-08-13 11:57:09 +00:00
pcre2_set_bsr.3 More per-function documentation; revised perltest.sh replaces perltest.pl. 2014-10-25 14:16:46 +00:00
pcre2_set_callout.3 Documentation update. 2017-03-25 17:50:54 +00:00
pcre2_set_character_tables.3 File tidies for 10.35-RC1 release candidate. 2020-04-15 16:34:36 +00:00
pcre2_set_compile_extra_options.3 doc: formatting/typo fixes to documentation (#47) 2021-11-27 16:27:49 +00:00
pcre2_set_compile_recursion_guard.3 Add user data to recursion guard; get ready for RC1 (again) 2014-11-26 16:51:53 +00:00
pcre2_set_depth_limit.3 Documentation update. 2017-03-25 17:50:54 +00:00
pcre2_set_glob_escape.3 Document experimental pattern conversion functions and remove unimplemented 2017-07-12 16:34:49 +00:00
pcre2_set_glob_separator.3 Typos in documentation and comments noted by Jason Hood. 2018-06-17 14:13:28 +00:00
pcre2_set_heap_limit.3 Typos in documentation and comments noted by Jason Hood. 2018-06-17 14:13:28 +00:00
pcre2_set_match_limit.3 More per-function documentation; revised perltest.sh replaces perltest.pl. 2014-10-25 14:16:46 +00:00
pcre2_set_max_pattern_length.3 Documentation clarification 2016-10-05 16:06:10 +00:00
pcre2_set_newline.3 Code tidies for 10.30-RC1 release candidate. 2017-07-19 16:04:15 +00:00
pcre2_set_offset_limit.3 Documentation for offset limits. 2015-09-22 16:51:11 +00:00
pcre2_set_parens_nest_limit.3 More per-function documentation; revised perltest.sh replaces perltest.pl. 2014-10-25 14:16:46 +00:00
pcre2_set_recursion_limit.3 Code tidies for 10.30-RC1 release candidate. 2017-07-19 16:04:15 +00:00
pcre2_set_recursion_memory_management.3 Documentation update. 2017-03-25 17:50:54 +00:00
pcre2_set_substitute_callout.3 Upgrade the as yet unreleased substitute callout facility. 2018-11-12 16:02:01 +00:00
pcre2_substitute.3 doc: formatting/typo fixes to documentation (#47) 2021-11-27 16:27:49 +00:00
pcre2_substring_copy_byname.3 File tidies for 10.00-RC2. 2014-12-19 09:55:25 +00:00
pcre2_substring_copy_bynumber.3 Improve interfaces to substring functions, and fix bugs. 2014-12-13 17:43:26 +00:00
pcre2_substring_free.3 Documentation update for NULL arguments. 2018-06-28 16:26:03 +00:00
pcre2_substring_get_byname.3 File tidies for 10.00-RC2. 2014-12-19 09:55:25 +00:00
pcre2_substring_get_bynumber.3 Improve interfaces to substring functions, and fix bugs. 2014-12-13 17:43:26 +00:00
pcre2_substring_length_byname.3 A lot more documentation. 2014-10-21 16:33:30 +00:00
pcre2_substring_length_bynumber.3 Improvements for substring handling with partial matches. 2014-12-22 17:33:10 +00:00
pcre2_substring_list_free.3 File tidies and documentation update for 10.32-RC1 Release Candidate. 2018-08-13 11:57:09 +00:00
pcre2_substring_list_get.3 A lot more documentation. 2014-10-21 16:33:30 +00:00
pcre2_substring_nametable_scan.3 Allow non-ASCII in group names when UTF is set; revise group naming terminology 2019-02-06 18:11:36 +00:00
pcre2_substring_number_from_name.3 Changed jit_stack_alloc to jit_stack_create. 2014-11-03 17:13:00 +00:00
pcre2api.3 match: avoid crash if subject NULL and PCRE2_ZERO_TERMINATED (#53) 2021-11-27 16:49:31 +00:00
pcre2build.3 improve on 'auto' mode for DISABLE_PERCENT_ZT (#28) 2021-10-29 14:29:47 +01:00
pcre2callout.3 More file tidies for 10.33-RC1 2019-03-04 18:07:04 +00:00
pcre2compat.3 Lock out \K in lookaround assertions by default, but provide an option to 2021-08-30 16:57:44 +01:00
pcre2convert.3 Fix option name in pcre2convert docs 2021-10-17 19:29:44 +02:00
pcre2demo.3 Doc file tidies for 10.38-RC1 2021-08-31 17:14:42 +01:00
pcre2grep.1 Add --allow-lookaround-bsk to pcre2grep 2021-08-31 16:24:25 +01:00
pcre2grep.txt Add --allow-lookaround-bsk to pcre2grep 2021-08-31 16:24:25 +01:00
pcre2jit.3 Fix some documentation typos. 2021-06-14 10:53:18 +00:00
pcre2limits.3 Allow non-ASCII in group names when UTF is set; revise group naming terminology 2019-02-06 18:11:36 +00:00
pcre2matching.3 Documentation update to clarify ovector usage with DFA matching. 2021-08-28 16:25:59 +01:00
pcre2partial.3 Fix documentation typos and upgrade documentation checking script. 2020-04-24 16:05:36 +00:00
pcre2pattern.3 doc: formatting/typo fixes to documentation (#47) 2021-11-27 16:27:49 +00:00
pcre2perform.3 Allow non-ASCII in group names when UTF is set; revise group naming terminology 2019-02-06 18:11:36 +00:00
pcre2posix.3 Final file tidies for 10.37-RC1 2021-04-28 16:44:51 +00:00
pcre2sample.3 Documentation detrail and make HTML for 10.22-RC1. 2016-06-29 16:52:05 +00:00
pcre2serialize.3 File tidies and documentation update for 10.32-RC1 Release Candidate. 2018-08-13 11:57:09 +00:00
pcre2syntax.3 Update to Unicode 14.0.0 (#29) 2021-10-29 14:44:17 +01:00
pcre2test.1 doc: formatting/typo fixes to documentation (#47) 2021-11-27 16:27:49 +00:00
pcre2test.txt Local updates consequent on ocumentation patches (PR#47). 2021-11-27 16:32:52 +00:00
pcre2unicode.3 File tidies for 10.35-RC1 release candidate. 2020-04-15 16:34:36 +00:00