Skip to content

Commit 2345cf0

Browse files
ekotikantirs
authored andcommitted
Clean up PL_strtab hash with NULL in perl_destruct
As it's not required to pre-allocate PL_strtab hash before perl_construct() and PL_strtab is not initialized with NULL by default, SIGSEGV could happen in certain circumstances. Particularly, when application links libperl and runs perl several times. After the first run PL_strtab remains unitialized in perl_construct() as it was not cleared in perl_destruct() and it contains garbage and the next initialization in perl_construct() is skipped because !PL_strtab check is skipped. See also: c82f488 (Allow custom PL_strtab hash in perl_construct.)
1 parent d6f09a8 commit 2345cf0

File tree

2 files changed

+2
-0
lines changed

2 files changed

+2
-0
lines changed

AUTHORS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,6 +1223,7 @@ Robert Spier <[email protected]>
12231223
Roberto C. Sanchez <[email protected]>
12241224
Robin Barker <[email protected]>
12251225
Robin Houston <[email protected]>
1226+
Robin Ragged <[email protected]>
12261227
Rocco Caputo <[email protected]>
12271228
Roderick Schertler <[email protected]>
12281229
Rodger Anderson <[email protected]>

perl.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1389,6 +1389,7 @@ perl_destruct(pTHXx)
13891389
HvTOTALKEYS(PL_strtab) = 0;
13901390
}
13911391
SvREFCNT_dec(PL_strtab);
1392+
PL_strtab = NULL;
13921393

13931394
#ifdef USE_ITHREADS
13941395
/* free the pointer tables used for cloning */

0 commit comments

Comments
 (0)