ae4e6261e5
* 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. |
||
---|---|---|
cmake | ||
doc | ||
m4 | ||
maint | ||
src | ||
testdata | ||
.gitignore | ||
132html | ||
AUTHORS | ||
CMakeLists.txt | ||
COPYING | ||
ChangeLog | ||
CheckMan | ||
CleanTxt | ||
Detrail | ||
HACKING | ||
LICENCE | ||
Makefile.am | ||
NEWS | ||
NON-AUTOTOOLS-BUILD | ||
PrepareRelease | ||
README | ||
README.md | ||
RunGrepTest | ||
RunGrepTest.bat | ||
RunTest | ||
RunTest.bat | ||
autogen.sh | ||
config-cmake.h.in | ||
configure.ac | ||
index.md | ||
libpcre2-8.pc.in | ||
libpcre2-16.pc.in | ||
libpcre2-32.pc.in | ||
libpcre2-posix.pc.in | ||
pcre2-config.in | ||
pcre2_fuzzer.dict | ||
pcre2_fuzzer.options | ||
perltest.sh |
README.md
PCRE2 - Perl-Compatible Regular Expressions
The PCRE2 library is a set of C functions that implement regular expression pattern matching using the same syntax and semantics as Perl 5. PCRE2 has its own native API, as well as a set of wrapper functions that correspond to the POSIX regular expression API. The PCRE2 library is free, even for building proprietary software. It comes in three forms, for processing 8-bit, 16-bit, or 32-bit code units, in either literal or UTF encoding.
PCRE2 was first released in 2015 to replace the API in the original PCRE library, which is now obsolete and no longer maintained. As well as a more flexible API, the code of PCRE2 has been much improved since the fork.
Download
As well as downloading from the GitHub site, you can download PCRE2 or the older, unmaintained PCRE1 library from an unofficial mirror at SourceForge.
You can check out the PCRE2 source code via Git or Subversion:
git clone https://github.com/PhilipHazel/pcre2.git
svn co https://github.com/PhilipHazel/pcre2.git
Contributed Ports
If you just need the command-line PCRE2 tools on Windows, precompiled binary versions are available at this Rexegg page.
A PCRE2 port for z/OS, a mainframe operating system which uses EBCDIC as its default character encoding, can be found at http://www.cbttape.org (File 939).
Documentation
You can read the PCRE2 documentation here.
Comparisons to Perl's regular expression semantics can be found in the community authored Wikipedia entry for PCRE.
There is a curated summary of changes for each PCRE release, copies of documentation from older releases, and other useful information from the third party authored RexEgg PCRE Documentation and Change Log page.
Contact
To report a problem with the PCRE2 library, or to make a feature request, please use the PCRE2 GitHub issues tracker. There is a mailing list for discussion of PCRE2 issues and development at pcre2-dev@googlegroups.com, which is where any announcements will be made. You can browse the list archives.