Closed
Description
Description
In #20530 we switched to using SSCHECK() instead of SSGROW(). This introduced a regresssion and exposed that SSCHECK() does not actually do what it looks like, and does not guarantee that the stack will hold the desired elements after it executes. (Which is pretty strange really.)
Steps to Reproduce
from: #20530 (comment)
Run this under valgrind:
$_ = "x" x 1000;
my $pat = '(.)' x 200;
$pat = qr/($pat)+/;
m/$pat/;
Expected behavior
We should not overflow. See #20824
Perl configuration
This is the configuration from a built version of the patch in #20824 which fixes this problem.
$ ./perl -Ilib -V
Summary of my perl5 (revision 5 version 37 subversion 9) configuration:
Local Commit: b98001c8430e0402997a363600e22bdc037f1a96
Ancestor: 81d9b321946a5fdd8db818f5c8d138728d21423c
Platform:
osname=linux
osvers=5.14.0-1057-oem
archname=x86_64-linux-thread-multi
uname='linux oncidium 5.14.0-1057-oem #64-ubuntu smp mon jan 23 17:02:19 utc 2023 x86_64 x86_64 x86_64 gnulinux '
config_args='-Dusethreads -Doptimize=-g -d -Dusedevel -Dcc=ccache gcc -Dld=gcc -DDEBUGGING'
hint=recommended
useposix=true
d_sigaction=define
useithreads=define
usemultiplicity=define
use64bitint=define
use64bitall=define
uselongdouble=undef
usemymalloc=n
default_inc_excludes_dot=define
Compiler:
cc='gcc'
ccflags ='-D_REENTRANT -D_GNU_SOURCE -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
optimize='-g'
cppflags='-D_REENTRANT -D_GNU_SOURCE -fwrapv -DDEBUGGING -fno-strict-aliasing -pipe -fstack-protector-strong -I/usr/local/include'
ccversion=''
gccversion='12.2.1 20230218'
gccosandvers=''
intsize=4
longsize=8
ptrsize=8
doublesize=8
byteorder=12345678
doublekind=3
d_longlong=define
longlongsize=8
d_longdbl=define
longdblsize=16
longdblkind=3
ivtype='long'
ivsize=8
nvtype='double'
nvsize=8
Off_t='off_t'
lseeksize=8
alignbytes=8
prototype=define
Linker and Libraries:
ld='gcc'
ldflags =' -fstack-protector-strong -L/usr/local/lib'
libpth=/usr/local/lib /home/yorton/install/gcc-12/lib /usr/lib/x86_64-linux-gnu /usr/lib /usr/lib64
libs=-lpthread -ldl -lm -lcrypt -lutil -lc
perllibs=-lpthread -ldl -lm -lcrypt -lutil -lc
libc=libc-2.31.so
so=so
useshrplib=false
libperl=libperl.a
gnulibc_version='2.31'
Dynamic Linking:
dlsrc=dl_dlopen.xs
dlext=so
d_dlsymun=undef
ccdlflags='-Wl,-E'
cccdlflags='-fPIC'
lddlflags='-shared -g -L/usr/local/lib -fstack-protector-strong'
Characteristics of this binary (from libperl):
Compile-time options:
DEBUGGING
HAS_TIMES
MULTIPLICITY
PERLIO_LAYERS
PERL_COPY_ON_WRITE
PERL_DONT_CREATE_GVSV
PERL_HASH_FUNC_SIPHASH13
PERL_HASH_USE_SBOX32
PERL_MALLOC_WRAP
PERL_OP_PARENT
PERL_PRESERVE_IVUV
PERL_TRACK_MEMPOOL
PERL_USE_DEVEL
PERL_USE_SAFE_PUTENV
USE_64_BIT_ALL
USE_64_BIT_INT
USE_ITHREADS
USE_LARGE_FILES
USE_LOCALE
USE_LOCALE_COLLATE
USE_LOCALE_CTYPE
USE_LOCALE_NUMERIC
USE_LOCALE_TIME
USE_PERLIO
USE_PERL_ATOF
USE_REENTRANT_API
USE_THREAD_SAFE_LOCALE
Locally applied patches:
386638a2b4294c7af449dcfdf670df85dedbd92a
725e4a6205afc87be9ae92412474d39b08624dc8
0d357e63ea9b2b6cfc184c98e44b12ff1a9f3184
6c2b27ece1fe862309ee16d66bddd388fb7af6ba
828bae551a7fc07a99c6bf42fdae003f7929d080
251efb6a81241db52213170f7c1d2ab003d91bb3
b98001c8430e0402997a363600e22bdc037f1a96
Built under linux
Compiled at Feb 20 2023 04:44:25
%ENV:
PERLBREW_CONFIGURE_FLAGS="-de -Dcc=ccache\ gcc -Dld=gcc"
PERLBREW_HOME="/home/yorton/.perlbrew"
PERLBREW_MANPATH="/home/yorton/perl5/perlbrew/perls/perl-5.34.1/man"
PERLBREW_PATH="/home/yorton/perl5/perlbrew/bin:/home/yorton/perl5/perlbrew/perls/perl-5.34.1/bin"
PERLBREW_PERL="perl-5.34.1"
PERLBREW_ROOT="/home/yorton/perl5/perlbrew"
PERLBREW_SHELLRC_VERSION="0.88"
PERLBREW_VERSION="0.88"
@INC:
lib
/usr/local/lib/perl5/site_perl/5.37.9/x86_64-linux-thread-multi
/usr/local/lib/perl5/site_perl/5.37.9
/usr/local/lib/perl5/5.37.9/x86_64-linux-thread-multi
/usr/local/lib/perl5/5.37.9
Metadata
Metadata
Assignees
Labels
No labels