diff --git a/doc/pcre2api.3 b/doc/pcre2api.3 index 1100e59af..ec9c1caba 100644 --- a/doc/pcre2api.3 +++ b/doc/pcre2api.3 @@ -1296,8 +1296,9 @@ documentation for more details. .sp PCRE2_CONFIG_JITTARGET .sp -The \fIwhere\fP argument should point to a buffer that is at least 64 code -units long. (The exact length required can be found by calling +The \fIwhere\fP argument should point to a buffer that is at least +.\" DEFINE PCRE2_JITTARGET_BUFFSIZE_LIMIT +71 code units long. (The exact length required can be found by calling \fBpcre2_config()\fP with \fBwhere\fP set to NULL.) The buffer is filled with a string that contains the name of the architecture for which the JIT compiler is configured, for example "x86 32bit (little endian + unaligned)". If JIT support diff --git a/maint/LintMan b/maint/LintMan index 924e9533d..fa103bba8 100755 --- a/maint/LintMan +++ b/maint/LintMan @@ -14,7 +14,7 @@ use vars qw /$opt_verbose/; my $file; my %defs; -foreach $file ("../src/config.h.generic") +foreach $file ("../src/config.h.generic", "../src/pcre2_api_internal.h") { open (INCLUDE, $file) or die "Failed to open include $file\n"; diff --git a/maint/UpdateAlways b/maint/UpdateAlways index da428dc9c..d0aeea44c 100755 --- a/maint/UpdateAlways +++ b/maint/UpdateAlways @@ -19,7 +19,8 @@ # Detrail A Perl script that removes trailing spaces from files. -# LintMan A Perl script that lints man pages looking for inconsistencies. +# LintMan A Perl script that lints man pages looking for inconsistencies +# in numerical configuration or API values. # doc/index.html.src # A file that is copied as index.html into the doc/html directory diff --git a/src/pcre2_api_internal.h b/src/pcre2_api_internal.h new file mode 100644 index 000000000..0b0e4b4c7 --- /dev/null +++ b/src/pcre2_api_internal.h @@ -0,0 +1,48 @@ +/************************************************* +* Perl-Compatible Regular Expressions * +*************************************************/ + +/* PCRE2 is a library of functions to support regular expressions whose syntax +and semantics are as close as possible to those of the Perl 5 language. + + Written by Philip Hazel + Original API code Copyright (c) 1997-2012 University of Cambridge + New API code Copyright (c) 2016-2024 University of Cambridge + +----------------------------------------------------------------------------- +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + * Neither the name of the University of Cambridge nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN +CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) +ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE +POSSIBILITY OF SUCH DAMAGE. +----------------------------------------------------------------------------- +*/ + +#ifndef PCRE2_API_INTERNAL_H_IDEMPOTENT_GUARD +#define PCRE2_API_INTERNAL_H_IDEMPOTENT_GUARD + +#define PCRE2_JITTARGET_BUFFSIZE_LIMIT 71 /* sljit */ + +#endif /* PCRE2_API_INTERNAL_H_IDEMPOTENT_GUARD */ + +/* End of pcre2_api_internal.h */ diff --git a/src/pcre2_jit_test.c b/src/pcre2_jit_test.c index 1fc44db5b..7790b5542 100644 --- a/src/pcre2_jit_test.c +++ b/src/pcre2_jit_test.c @@ -51,6 +51,7 @@ POSSIBILITY OF SUCH DAMAGE. #define PCRE2_CODE_UNIT_WIDTH 0 #include "pcre2.h" +#include "pcre2_api_internal.h" /* Letter characters: @@ -1228,11 +1229,11 @@ static int regression_tests(void) #endif #if defined SUPPORT_PCRE2_8 - PCRE2_UCHAR8 cpu_info[128]; + PCRE2_UCHAR8 cpu_info[PCRE2_JITTARGET_BUFFSIZE_LIMIT]; #elif defined SUPPORT_PCRE2_16 - PCRE2_UCHAR16 cpu_info[128]; + PCRE2_UCHAR16 cpu_info[PCRE2_JITTARGET_BUFFSIZE_LIMIT]; #elif defined SUPPORT_PCRE2_32 - PCRE2_UCHAR32 cpu_info[128]; + PCRE2_UCHAR32 cpu_info[PCRE2_JITTARGET_BUFFSIZE_LIMIT]; #endif #if defined SUPPORT_UNICODE && ((defined(SUPPORT_PCRE2_8) + defined(SUPPORT_PCRE2_16) + defined(SUPPORT_PCRE2_32)) >= 2) int return_value; diff --git a/src/pcre2test.c b/src/pcre2test.c index 3242b5ce7..3ab3116c1 100644 --- a/src/pcre2test.c +++ b/src/pcre2test.c @@ -314,6 +314,7 @@ needs to be when compiling one of the libraries). */ #include "pcre2.h" #include "pcre2posix.h" #include "pcre2_internal.h" +#include "pcre2_api_internal.h" /* We need access to some of the data tables that PCRE2 uses. The previous definition of PCRE2_PCRE2TEST makes some minor changes in the files. The @@ -3046,7 +3047,7 @@ fprintf(f, "Unicode version %s", buf); static void print_jit_target(FILE *f) { -char buf[VERSION_SIZE]; +char buf[PCRE2_JITTARGET_BUFFSIZE_LIMIT]; config_str(PCRE2_CONFIG_JITTARGET, buf); fputs(buf, f); }