You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
=================================================================
==1855009==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x62a000005200 at pc 0x000000492e8a bp 0x7fffffffdc70 sp 0x7fffffffd438
READ of size 34359738352 at 0x62a000005200 thread T0
#0 0x492e89 in __asan_memcpy (~/a.out+0x492e89)
#1 0x54dcfb in match ~/pcre2/src/pcre2_match.c:887:5
#2 0x500568 in pcre2_match_8 ~/pcre2/src/pcre2_match.c:7289:8
#3 0x4c3406 in main ~/a.c:21:3
#4 0x7ffff7c45082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
#5 0x41b2fd in _start (~/a.out+0x41b2fd)
0x62a000005200 is located 0 bytes to the right of 20480-byte region [0x62a000000200,0x62a000005200)
allocated by thread T0 here:
#0 0x493a3d in malloc (~/a.out+0x493a3d)
#1 0x4fe83d in pcre2_match_8 ~/pcre2/src/pcre2_match.c:6848:28
#2 0x4c3406 in main ~/a.c:21:3
#3 0x7ffff7c45082 in __libc_start_main /build/glibc-SzIz7B/glibc-2.31/csu/../csu/libc-start.c:308:16
SUMMARY: AddressSanitizer: heap-buffer-overflow (~/a.out+0x492e89) in __asan_memcpy
Could you help us to verify this issue? Thanks!
The text was updated successfully, but these errors were encountered:
You are quite right. Nice catch. Thank you. As there is no mechanism for returning errors other than malloc() failure from pcre2_match_data_create(), and I don't think any real cases need more than 65535 capturing pairs, I have made pcre2_match_data_create() impose a silent upper limit of 65536. This is just in time for 10.42.
Hi, we seem to see a buffer overflow caused by an unmatch integer type in
pcre2_match_data_create
, in which (https://github.com/PCRE2Project/pcre2/blob/master/src/pcre2_match_data.c#L60) theoveccount
is anuint32
but theyield->oveccount
(https://github.com/PCRE2Project/pcre2/blob/master/src/pcre2_match_data.c#L65) is anuint16
, so when its value is something like0x10000
,yield->oveccount
would be overflowed to0
and cause some heap buffer overflow later, here is an example:And its ASAN report is:
Could you help us to verify this issue? Thanks!
The text was updated successfully, but these errors were encountered: