Skip to content

Commit

Permalink
add assertion to prevent stack corruption in XSUB
Browse files Browse the repository at this point in the history
We should not be able to return negative offsets from the stack in
XSUBs.
  • Loading branch information
preaction authored and iabyn committed Oct 2, 2015
1 parent 052a7c7 commit 9e77582
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions XSUB.h
Expand Up @@ -327,6 +327,7 @@ Rethrows a previously caught exception. See L<perlguts/"Exception Handling">.
#define XSRETURN(off) \
STMT_START { \
const IV tmpXSoff = (off); \
assert(tmpXSoff >= 0);\
PL_stack_sp = PL_stack_base + ax + (tmpXSoff - 1); \
return; \
} STMT_END
Expand Down

0 comments on commit 9e77582

Please sign in to comment.