Skip to content

Commit 3a32cfc

Browse files
committed
fix type of S_clear_yystack()
Functions registered with SAVEDESTRUCTOR_X must be of type 'void (pTHX_ void *)' because that's how scope.c stores and calls them. Should fix this ASan error: scope.c:1537:13: runtime error: call to function S_clear_yystack through pointer to incorrect function type 'void (*)(struct interpreter *, void *)'
1 parent a7eccf4 commit 3a32cfc

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

perly.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,12 @@ do { \
220220
* parse stack, thus avoiding leaks if we die */
221221

222222
static void
223-
S_clear_yystack(pTHX_ const yy_parser *parser)
223+
S_clear_yystack(pTHX_ void *arg)
224224
{
225-
yy_stack_frame *ps = parser->ps;
225+
/* arg must be void * for this function to be compatible with
226+
SAVEDESTRUCTOR_X/any_dxptr */
227+
const yy_parser *parser = (const yy_parser *)arg;
228+
yy_stack_frame *ps = parser->ps;
226229
int i = 0;
227230

228231
if (!parser->stack)

0 commit comments

Comments
 (0)