Skip Menu |

This queue is for tickets about the Sentinel CPAN distribution.

Report information
The Basics
Id: 118188
Status: patched
Priority: 0/
Queue: Sentinel

People
Owner: Nobody in particular
Requestors: RANDIR [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Update stack handling
Here are two patches. First one ensures that we always have enough room on the stack when pushing values to it. Second one removes unnecessary stack update - there's no stack access after it.
=== modified file 'lib/Sentinel.xs' --- lib/Sentinel.xs 2016-09-29 22:17:14 +0000 +++ lib/Sentinel.xs 2016-09-30 17:09:41 +0000 @@ -33,8 +33,10 @@ SAVETMPS; PUSHMARK(SP); - if(ctx->obj) + if(ctx->obj) { + EXTEND(SP, 1); PUSHs(ctx->obj); + } PUTBACK; if(ctx->obj && SvPOK(ctx->get_cb)) @@ -65,8 +67,12 @@ SAVETMPS; PUSHMARK(SP); - if(ctx->obj) + if(ctx->obj) { + EXTEND(SP, 2); PUSHs(ctx->obj); + } else { + EXTEND(SP, 1); + } PUSHs(sv); PUTBACK; @@ -156,6 +162,7 @@ SvREFCNT_dec(payload); } + if (!items) EXTEND(SP, 1); PUSHs(retval); XSRETURN(1);
=== modified file 'lib/Sentinel.xs' --- lib/Sentinel.xs 2016-09-30 17:09:41 +0000 +++ lib/Sentinel.xs 2016-09-30 17:11:41 +0000 @@ -82,8 +82,6 @@ else call_sv(ctx->set_cb, G_VOID); - SPAGAIN; - FREETMPS; LEAVE; }
Thanks. Applied, via some minor edits. -- Paul Evans