Skip to content

Commit

Permalink
Update PCRE2 to v10.42
Browse files Browse the repository at this point in the history
  • Loading branch information
ltrzesniewski committed Dec 26, 2022
1 parent 3334cd4 commit 19f416c
Show file tree
Hide file tree
Showing 120 changed files with 13,504 additions and 7,225 deletions.
2 changes: 1 addition & 1 deletion src/PCRE/132html
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ while (<STDIN>)
die "*** Processing abandoned\n";
}

# Instead of .br, relevent "literal" sections are enclosed in .nf/.fi.
# Instead of .br, relevant "literal" sections are enclosed in .nf/.fi.

elsif (/^\.nf/)
{
Expand Down
77 changes: 59 additions & 18 deletions src/PCRE/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@
# build in one go.
# 2021-08-28 PH increased minimum version
# 2021-08-28 PH added test for realpath()

PROJECT(PCRE2 C)
# 2022-12-10 PH added support for pcre2posix_test

# Increased minimum to 2.8.5 to support GNUInstallDirs.
# Increased minimum to 3.0.0 because older than 2.8.12 is deprecated.
CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0)
# Increased minimum to 3.1 to support imported targets.
CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
PROJECT(PCRE2 C)

# Set policy CMP0026 to avoid warnings for the use of LOCATION in
# GET_TARGET_PROPERTY. This should no longer be required.
Expand Down Expand Up @@ -382,7 +382,13 @@ IF(PCRE2_SUPPORT_UNICODE)
ENDIF(PCRE2_SUPPORT_UNICODE)

IF(PCRE2_SUPPORT_JIT)
SET(SUPPORT_JIT 1)
SET(SUPPORT_JIT 1)
IF(UNIX)
FIND_PACKAGE(Threads REQUIRED)
IF(CMAKE_USE_PTHREADS_INIT)
SET(REQUIRE_PTHREAD 1)
ENDIF(CMAKE_USE_PTHREADS_INIT)
ENDIF(UNIX)
ENDIF(PCRE2_SUPPORT_JIT)

IF(PCRE2_SUPPORT_JIT_SEALLOC)
Expand Down Expand Up @@ -652,6 +658,8 @@ IF(MINGW AND BUILD_SHARED_LIBS)
ENDIF(MINGW AND BUILD_SHARED_LIBS)

IF(MSVC AND BUILD_SHARED_LIBS)
SET(dll_pdb_files ${PROJECT_BINARY_DIR}/pcre2-posix.pdb ${dll_pdb_files})
SET(dll_pdb_debug_files ${PROJECT_BINARY_DIR}/pcre2-posixd.pdb ${dll_pdb_debug_files})
IF (EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
SET(PCRE2_SOURCES ${PCRE2_SOURCES} pcre2.rc)
ENDIF(EXISTS ${PROJECT_SOURCE_DIR}/pcre2.rc)
Expand Down Expand Up @@ -697,6 +705,10 @@ IF(PCRE2_BUILD_PCRE2_8)
VERSION ${LIBPCRE2_8_VERSION}
SOVERSION ${LIBPCRE2_8_SOVERSION})
TARGET_COMPILE_DEFINITIONS(pcre2-8-static PUBLIC PCRE2_STATIC)
TARGET_INCLUDE_DIRECTORIES(pcre2-8-static PUBLIC ${PROJECT_BINARY_DIR})
IF(REQUIRE_PTHREAD)
TARGET_LINK_LIBRARIES(pcre2-8-static Threads::Threads)
ENDIF(REQUIRE_PTHREAD)
SET(targets ${targets} pcre2-8-static)
ADD_LIBRARY(pcre2-posix-static STATIC ${PCRE2POSIX_HEADERS} ${PCRE2POSIX_SOURCES})
SET_TARGET_PROPERTIES(pcre2-posix-static PROPERTIES
Expand All @@ -707,6 +719,7 @@ IF(PCRE2_BUILD_PCRE2_8)
SOVERSION ${LIBPCRE2_POSIX_SOVERSION})
TARGET_LINK_LIBRARIES(pcre2-posix-static pcre2-8-static)
TARGET_COMPILE_DEFINITIONS(pcre2-posix-static PUBLIC PCRE2_STATIC)
TARGET_INCLUDE_DIRECTORIES(pcre2-posix-static PUBLIC ${PROJECT_BINARY_DIR})
SET(targets ${targets} pcre2-posix-static)

IF(MSVC)
Expand All @@ -723,15 +736,20 @@ IF(PCRE2_BUILD_PCRE2_8)

IF(BUILD_SHARED_LIBS)
ADD_LIBRARY(pcre2-8-shared SHARED ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
TARGET_INCLUDE_DIRECTORIES(pcre2-8-shared PUBLIC ${PROJECT_BINARY_DIR})
SET_TARGET_PROPERTIES(pcre2-8-shared PROPERTIES
COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8
MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_8_MACHO_COMPATIBILITY_VERSION}"
MACHO_CURRENT_VERSION "${LIBPCRE2_8_MACHO_CURRENT_VERSION}"
VERSION ${LIBPCRE2_8_VERSION}
SOVERSION ${LIBPCRE2_8_SOVERSION}
OUTPUT_NAME pcre2-8)
IF(REQUIRE_PTHREAD)
TARGET_LINK_LIBRARIES(pcre2-8-shared Threads::Threads)
ENDIF(REQUIRE_PTHREAD)
SET(targets ${targets} pcre2-8-shared)
ADD_LIBRARY(pcre2-posix-shared SHARED ${PCRE2POSIX_HEADERS} ${PCRE2POSIX_SOURCES})
TARGET_INCLUDE_DIRECTORIES(pcre2-posix-shared PUBLIC ${PROJECT_BINARY_DIR})
SET_TARGET_PROPERTIES(pcre2-posix-shared PROPERTIES
COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=8
MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_POSIX_MACHO_COMPATIBILITY_VERSION}"
Expand All @@ -741,6 +759,8 @@ IF(PCRE2_BUILD_PCRE2_8)
OUTPUT_NAME pcre2-posix)
TARGET_LINK_LIBRARIES(pcre2-posix-shared pcre2-8-shared)
SET(targets ${targets} pcre2-posix-shared)
SET(dll_pdb_files ${PROJECT_BINARY_DIR}/pcre2-8.pdb ${dll_pdb_files})
SET(dll_pdb_debug_files ${PROJECT_BINARY_DIR}/pcre2-8d.pdb ${dll_pdb_debug_files})

IF(MINGW)
IF(NON_STANDARD_LIB_PREFIX)
Expand All @@ -766,13 +786,17 @@ ENDIF(PCRE2_BUILD_PCRE2_8)
IF(PCRE2_BUILD_PCRE2_16)
IF(BUILD_STATIC_LIBS)
ADD_LIBRARY(pcre2-16-static STATIC ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
TARGET_INCLUDE_DIRECTORIES(pcre2-16-static PUBLIC ${PROJECT_BINARY_DIR})
SET_TARGET_PROPERTIES(pcre2-16-static PROPERTIES
COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=16
MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
VERSION ${LIBPCRE2_16_VERSION}
SOVERSION ${LIBPCRE2_16_SOVERSION})
TARGET_COMPILE_DEFINITIONS(pcre2-16-static PUBLIC PCRE2_STATIC)
IF(REQUIRE_PTHREAD)
TARGET_LINK_LIBRARIES(pcre2-16-static Threads::Threads)
ENDIF(REQUIRE_PTHREAD)
SET(targets ${targets} pcre2-16-static)

IF(MSVC)
Expand All @@ -787,14 +811,20 @@ IF(PCRE2_BUILD_PCRE2_16)

IF(BUILD_SHARED_LIBS)
ADD_LIBRARY(pcre2-16-shared SHARED ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
TARGET_INCLUDE_DIRECTORIES(pcre2-16-shared PUBLIC ${PROJECT_BINARY_DIR})
SET_TARGET_PROPERTIES(pcre2-16-shared PROPERTIES
COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=16
MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
VERSION ${LIBPCRE2_16_VERSION}
SOVERSION ${LIBPCRE2_16_SOVERSION}
OUTPUT_NAME pcre2-16)
IF(REQUIRE_PTHREAD)
TARGET_LINK_LIBRARIES(pcre2-16-shared Threads::Threads)
ENDIF(REQUIRE_PTHREAD)
SET(targets ${targets} pcre2-16-shared)
SET(dll_pdb_files ${PROJECT_BINARY_DIR}/pcre2-16.pdb ${dll_pdb_files})
SET(dll_pdb_debug_files ${PROJECT_BINARY_DIR}/pcre2-16d.pdb ${dll_pdb_debug_files})

IF(MINGW)
IF(NON_STANDARD_LIB_PREFIX)
Expand All @@ -818,13 +848,17 @@ ENDIF(PCRE2_BUILD_PCRE2_16)
IF(PCRE2_BUILD_PCRE2_32)
IF(BUILD_STATIC_LIBS)
ADD_LIBRARY(pcre2-32-static STATIC ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
TARGET_INCLUDE_DIRECTORIES(pcre2-32-static PUBLIC ${PROJECT_BINARY_DIR})
SET_TARGET_PROPERTIES(pcre2-32-static PROPERTIES
COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=32
MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
VERSION ${LIBPCRE2_32_VERSION}
SOVERSION ${LIBPCRE2_32_SOVERSION})
TARGET_COMPILE_DEFINITIONS(pcre2-32-static PUBLIC PCRE2_STATIC)
IF(REQUIRE_PTHREAD)
TARGET_LINK_LIBRARIES(pcre2-32-static Threads::Threads)
ENDIF(REQUIRE_PTHREAD)
SET(targets ${targets} pcre2-32-static)

IF(MSVC)
Expand All @@ -839,14 +873,20 @@ IF(PCRE2_BUILD_PCRE2_32)

IF(BUILD_SHARED_LIBS)
ADD_LIBRARY(pcre2-32-shared SHARED ${PCRE2_HEADERS} ${PCRE2_SOURCES} ${PROJECT_BINARY_DIR}/config.h)
TARGET_INCLUDE_DIRECTORIES(pcre2-32-shared PUBLIC ${PROJECT_BINARY_DIR})
SET_TARGET_PROPERTIES(pcre2-32-shared PROPERTIES
COMPILE_DEFINITIONS PCRE2_CODE_UNIT_WIDTH=32
MACHO_COMPATIBILITY_VERSION "${LIBPCRE2_32_MACHO_COMPATIBILITY_VERSION}"
MACHO_CURRENT_VERSION "${LIBPCRE2_32_MACHO_CURRENT_VERSION}"
VERSION ${LIBPCRE2_32_VERSION}
SOVERSION ${LIBPCRE2_32_SOVERSION}
OUTPUT_NAME pcre2-32)
IF(REQUIRE_PTHREAD)
TARGET_LINK_LIBRARIES(pcre2-32-shared Threads::Threads)
ENDIF(REQUIRE_PTHREAD)
SET(targets ${targets} pcre2-32-shared)
SET(dll_pdb_files ${PROJECT_BINARY_DIR}/pcre2-32.pdb ${dll_pdb_files})
SET(dll_pdb_debug_files ${PROJECT_BINARY_DIR}/pcre2-32d.pdb ${dll_pdb_debug_files})

IF(MINGW)
IF(NON_STANDARD_LIB_PREFIX)
Expand Down Expand Up @@ -902,10 +942,16 @@ IF(PCRE2_BUILD_TESTS)
ENDIF(PCRE2_BUILD_PCRE2_32)
TARGET_LINK_LIBRARIES(pcre2test ${PCRE2TEST_LIBS} ${PCRE2TEST_LINKER_FLAGS})

IF(PCRE2_BUILD_PCRE2_8)
ADD_EXECUTABLE(pcre2posix_test src/pcre2posix_test.c)
SET(targets ${targets} pcre2posix_test)
TARGET_LINK_LIBRARIES(pcre2posix_test pcre2-posix pcre2-8)
ENDIF(PCRE2_BUILD_PCRE2_8)

IF(PCRE2_SUPPORT_JIT)
ADD_EXECUTABLE(pcre2_jit_test src/pcre2_jit_test.c)
SET(targets ${targets} pcre2_jit_test)
SET(PCRE2_JIT_TEST_LIBS )
SET(PCRE2_JIT_TEST_LIBS)
IF(PCRE2_BUILD_PCRE2_8)
LIST(APPEND PCRE2_JIT_TEST_LIBS pcre2-8)
ENDIF(PCRE2_BUILD_PCRE2_8)
Expand Down Expand Up @@ -1017,6 +1063,11 @@ echo RunTest.bat tests successfully completed
ADD_TEST(pcre2_jit_test pcre2_jit_test)
ENDIF(PCRE2_SUPPORT_JIT)

IF(PCRE2_BUILD_PCRE2_8)
ADD_TEST(pcre2posix_test pcre2posix_test)
ENDIF(PCRE2_BUILD_PCRE2_8)


ENDIF(PCRE2_BUILD_TESTS)

# Installation
Expand Down Expand Up @@ -1053,18 +1104,8 @@ INSTALL(FILES ${man3} DESTINATION man/man3)
INSTALL(FILES ${html} DESTINATION share/doc/pcre2/html)

IF(MSVC AND INSTALL_MSVC_PDB)
INSTALL(FILES ${PROJECT_BINARY_DIR}/pcre2-8.pdb
${PROJECT_BINARY_DIR}/pcre2-16.pdb
${PROJECT_BINARY_DIR}/pcre2-32.pdb
${PROJECT_BINARY_DIR}/pcre2-posix.pdb
DESTINATION bin
CONFIGURATIONS RelWithDebInfo)
INSTALL(FILES ${PROJECT_BINARY_DIR}/pcre2-8d.pdb
${PROJECT_BINARY_DIR}/pcre2-16d.pdb
${PROJECT_BINARY_DIR}/pcre2-32d.pdb
${PROJECT_BINARY_DIR}/pcre2-posixd.pdb
DESTINATION bin
CONFIGURATIONS Debug)
INSTALL(FILES ${dll_pdb_files} DESTINATION bin CONFIGURATIONS RelWithDebInfo)
INSTALL(FILES ${dll_pdb_debug_files} DESTINATION bin CONFIGURATIONS Debug)
ENDIF(MSVC AND INSTALL_MSVC_PDB)

# Help, only for nice output
Expand Down
129 changes: 121 additions & 8 deletions src/PCRE/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,118 @@
Change Log for PCRE2
--------------------
Change Log for PCRE2 - see also the Git log
-------------------------------------------


Version 10.42 11-December-2022
------------------------------

1. Change 19 of 10.41 wasn't quite right; it put the definition of a default,
empty value for PCRE2_CALL_CONVENTION in src/pcre2posix.c instead of
src/pcre2posix.h, which meant that programs that included pcre2posix.h but not
pcre2.h failed to compile.

2. To catch similar issues to the above in future, a new small test program
that includes pcre2posix.h but not pcre2.h has been added to the test suite.

3. When the -S option of pcre2test was used to set a stack size greater than
the allowed maximum, the error message displayed the hard limit incorrectly.
This was pointed out on GitHub pull request #171, but the suggested patch
didn't cope with all cases. Some further modification was required.

4. Supplying an ovector count of more than 65535 to pcre2_match_data_create()
caused a crash because the field in the match data block is only 16 bits. A
maximum of 65535 is now silently applied.

5. Merged @carenas patch #175 which fixes #86 - segfault on aarch64 (ARM),


Version 10.41 06-December-2022
------------------------------

1. Add fflush() before and after a fork callout in pcre2grep to get its output
to be the same on all systems. (There were previously ordering differences in
Alpine Linux).

2. Merged patch from @carenas (GitHub #110) for pthreads support in CMake.

3. SSF scorecards grumbled about possible overflow in an expression in
pcre2test. It never would have overflowed in practice, but some casts have been
added and at the some time there's been some tidying of fprints that output
size_t values.

4. PR #94 showed up an unused enum in pcre2_convert.c, which is now removed.

5. Minor code re-arrangement to remove gcc warning about realloc() in
pcre2test.

6. Change a number of int variables that hold buffer and line lengths in
pcre2grep to PCRE2_SIZE (aka size_t).

7. Added an #ifdef to cut out a call to PRIV(jit_free) when JIT is not
supported (even though that function would do nothing in that case) at the
request of a user who doesn't even want to link with pcre_jit_compile.o. Also
tidied up an untidy #ifdef arrangement in pcre2test.

8. Fixed an issue in the backtracking optimization of character repeats in
JIT. Furthermore optimize star repetitions, not just plus repetitions.

9. Removed the use of an initial backtracking frames vector on the system stack
in pcre2_match() so that it now always uses the heap. (In a multi-thread
environment with very small stacks there had been an issue.) This also is
tidier for JIT matching, which didn't need that vector. The heap vector is now
remembered in the match data block and re-used if that block itself is re-used.
It is freed with the match data block.

10. Adjusted the find_limits code in pcre2test to work with change 9 above.

11. Added find_limits_noheap to pcre2test, because the heap limits are now
different in different environments and so cannot be included in the standard
tests.

12. Created a test for pcre2_match() heap processing that is not part of the
tests run by 'make check', but can be run manually. The current output is from
a 64-bit system.

13. Implemented -Z aka --null in pcre2grep.

14. A minor change to pcre2test and the addition of several new pcre2grep tests
have improved LCOV coverage statistics. At the same time, code in pcre2grep and
elsewhere that can never be obeyed in normal testing has been excluded from
coverage.

15. Fixed a bug in pcre2grep that could cause an extra newline to be written
after output generaed by --output.

16. If a file has a .bz2 extension but is not in fact compressed, pcre2grep
should process it as a plain text file. A bug stopped this happening; now fixed
and added to the tests.

17. When pcre2grep was running not in UTF mode, if a string specified by
--output or obtained from a callout in a pattern contained a character (byte)
greater than 127, it was incorrectly output in UTF-8 format.

18. Added some casts after warnings from Clang sanitize.

19. Merged patch from cbouc (GitHub #139): 4 function prototypes were missing
PCRE2_CALL_CONVENTION in src/pcre2posix.h. All function prototypes returning
pointers had out of place PCRE2_CALL_CONVENTION in src/pcre2.h.*. These
produced errors when building for Windows with #define PCRE2_CALL_CONVENTION
__stdcall.

20. A negative repeat value in a pcre2test subject line was not being
diagnosed, leading to infinite looping.

21. Updated RunGrepTest to discard the warning that Bash now gives when setting
LC_CTYPE to a bad value (because older versions didn't).

22. Updated pcre2grep so that it behaves like GNU grep when matching more than
one pattern and a later pattern matches at an earlier point in the subject when
the matched substrings are being identified by colour or by offsets.

23. Updated the PrepareRelease script so that the man page that it makes for
the pcre2demo demonstration program is more standard and does not cause errors
when processed by lexgrog or mandb -c (GitHub issue #160).

24. The JIT compiler was updated.


Version 10.40 15-April-2022
Expand Down Expand Up @@ -92,7 +205,7 @@ pattern, the optimizing "must be present for a match" character check was not
being flagged as caseless, causing some matches that should have succeeded to
fail.

23. Fixed a unicode properrty matching issue in JIT. The character was not
23. Fixed a unicode property matching issue in JIT. The character was not
fully read in caseless matching.

24. Fixed an issue affecting recursions in JIT caused by duplicated data
Expand All @@ -119,10 +232,10 @@ Version 10.39 29-October-2021
honoured if chosen.

prtdiff_t is signed, so use a signed type instead, and make sure
that an appropiate width is chosen if pointers are 64bit wide and
that an appropriate width is chosen if pointers are 64bit wide and
long is not (ex: Windows 64bit).

IMHO removing the cast (and therefore the positibilty of truncation)
IMHO removing the cast (and therefore the possibilty of truncation)
make the code cleaner and the fallback is likely portable enough
with all 64-bit POSIX systems doing LP64 except for Windows.

Expand Down Expand Up @@ -173,7 +286,7 @@ Version 10.38 01-October-2021
-----------------------------

1. Fix invalid single character repetition issues in JIT when the repetition
is inside a capturing bracket and the bracket is preceeded by character
is inside a capturing bracket and the bracket is preceded by character
literals.

2. Installed revised CMake configuration files provided by Jan-Willem Blokland.
Expand Down Expand Up @@ -413,7 +526,7 @@ now correctly backtracked, so this unnecessary restriction has been removed.

7. Added PCRE2_SUBSTITUTE_MATCHED.

8. Added (?* and (?<* as synonms for (*napla: and (*naplb: to match another
8. Added (?* and (?<* as synonyms for (*napla: and (*naplb: to match another
regex engine. The Perl regex folks are aware of this usage and have made a note
about it.

Expand Down Expand Up @@ -844,7 +957,7 @@ Patch by Guillem Jover.
warnings were reported.

38. Using the clang compiler with sanitizing options causes runtime complaints
about truncation for statments such as x = ~x when x is an 8-bit value; it
about truncation for statements such as x = ~x when x is an 8-bit value; it
seems to compute ~x as a 32-bit value. Changing such statements to x = 255 ^ x
gets rid of the warnings. There were also two missing casts in pcre2test.

Expand Down
Loading

0 comments on commit 19f416c

Please sign in to comment.