[Privoxy-devel] PATCH for pcre2 support
Fabian Keil
fk at fabiankeil.de
Thu Mar 9 11:57:37 CET 2023
Gagan Sidhu <broly at mac.com> wrote on 2023-03-08 at 11:45:27:
> i’ve updated the patch because i stupidly used the dummy variable, which i didn’t pay attention to.
>
> i create a new variable but the rest of the behaviour should be the same.
>
> i also call pcre2_error_message so that the character string is returned instead of just using what was there.
Thanks a lot for working on this, Gagan.
Looks like there are quite a few warnings:
fk at t520 ~/git/privoxy $gmake
cc -c -pipe -fstack-protector-all -ggdb -Wshadow -Wconversion -I/usr/local/include/ -pthread -Wall actions.c -o actions.o
[...]
cc -c -pipe -fstack-protector-all -ggdb -Wshadow -Wconversion -I/usr/local/include/ -pthread -Wall pcrs.c -o pcrs.o
pcrs.c:669:20: warning: incompatible pointer types passing 'const char **' to parameter of type 'int *' [-Wincompatible-pointer-types]
&error, errptr, NULL);
^~~~~~
/usr/local/include/pcre2.h:935:1: note: passing argument to parameter here
PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
^
/usr/local/include/pcre2.h:924:31: note: expanded from macro 'PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS'
PCRE2_MATCH_CONTEXT_FUNCTIONS \
^
/usr/local/include/pcre2.h:650:57: note: expanded from macro '\
PCRE2_COMPILE_FUNCTIONS'
*pcre2_compile(PCRE2_SPTR, PCRE2_SIZE, uint32_t, int *, PCRE2_SIZE *, \
^
pcrs.c:669:28: warning: incompatible pointer types passing 'int *' to parameter of type 'size_t *' (aka 'unsigned long *') [-Wincompatible-pointer-types]
&error, errptr, NULL);
^~~~~~
/usr/local/include/pcre2.h:935:1: note: passing argument to parameter here
PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
^
/usr/local/include/pcre2.h:924:31: note: expanded from macro 'PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS'
PCRE2_MATCH_CONTEXT_FUNCTIONS \
^
/usr/local/include/pcre2.h:650:71: note: expanded from macro '\
PCRE2_COMPILE_FUNCTIONS'
*pcre2_compile(PCRE2_SPTR, PCRE2_SIZE, uint32_t, int *, PCRE2_SIZE *, \
^
pcrs.c:668:100: warning: implicit conversion changes signedness: 'int' to 'uint32_t' (aka 'unsigned int') [-Wsign-conversion]
newjob->pattern = pcre2_compile((const unsigned char *) pattern, PCRE2_ZERO_TERMINATED, newjob->options,
~~~~~~~~~~~~~ ~~~~~~~~^~~~~~~
pcrs.c:872:51: warning: passing 'const char *' to parameter of type 'PCRE2_SPTR8' (aka 'const unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
while ((submatches = pcre2_match(job->pattern, subject, (int)subject_length, offset, 0, dummy, NULL)) > 0)
^~~~~~~
/usr/local/include/pcre2.h:935:1: note: passing argument to parameter here
PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS
^
/usr/local/include/pcre2.h:926:30: note: expanded from macro 'PCRE2_TYPES_STRUCTURES_AND_FUNCTIONS'
PCRE2_PATTERN_INFO_FUNCTIONS \
^
/usr/local/include/pcre2.h:682:45: note: expanded from macro '\
PCRE2_MATCH_FUNCTIONS'
pcre2_match(const pcre2_code *, PCRE2_SPTR, PCRE2_SIZE, PCRE2_SIZE, \
^
pcrs.c:872:81: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
while ((submatches = pcre2_match(job->pattern, subject, (int)subject_length, offset, 0, dummy, NULL)) > 0)
~~~~~~~~~~~ ^~~~~~
pcrs.c:872:60: warning: implicit conversion changes signedness: 'int' to 'size_t' (aka 'unsigned long') [-Wsign-conversion]
while ((submatches = pcre2_match(job->pattern, subject, (int)subject_length, offset, 0, dummy, NULL)) > 0)
~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~
pcrs.c:907:29: warning: incompatible pointer types assigning to 'pcre2_match_data_8 *' (aka 'struct pcre2_real_match_data_8 *') from 'pcrs_match *' [-Wincompatible-pointer-types]
if (NULL == (dummy = (pcrs_match *)realloc(matches, (size_t)max_matches * sizeof(pcrs_match))))
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
pcrs.c:912:18: warning: incompatible pointer types assigning to 'pcrs_match *' from 'pcre2_match_data_8 *' (aka 'struct pcre2_real_match_data_8 *') [-Wincompatible-pointer-types]
matches = dummy;
^ ~~~~~
pcrs.c:854:49: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'uint32_t' (aka 'unsigned int') [-Wshorten-64-to-32]
if (NULL == (dummy = pcre2_match_data_create((size_t)max_matches, NULL)))
~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~~~~
pcrs.c:882:42: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
matches[i].submatch_offset[k] = offsets[2 * k];
~ ^~~~~~~~~~~~~~
pcrs.c:899:61: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
matches[i].submatch_offset[PCRS_MAX_SUBMATCHES + 1] = offsets[1];
~ ^~~~~~~~~~
pcrs.c:926:19: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
offset = offsets[1];
~ ^~~~~~~~~~
12 warnings generated.
While briefly testing it I noticed the CGI pages (http://p.p/)
no longer work:
fk at t520 ~ $curl --head https://p.p/
HTTP/1.1 200 Connection established
HTTP/1.1 200 OK
Content-Length: 0
Content-Type: text/html
Cache-Control: no-cache
Date: Thu, 09 Mar 2023 10:56:17 GMT
Last-Modified: Thu, 09 Mar 2023 10:56:17 GMT
Expires: Sat, 17 Jun 2000 12:00:00 GMT
Pragma: no-cache
Fabian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.privoxy.org/pipermail/privoxy-devel/attachments/20230309/a7b99c98/attachment.bin>
More information about the Privoxy-devel
mailing list