summaryrefslogtreecommitdiff
path: root/scope.h
diff options
context:
space:
mode:
authorTony Cook <tony@develop-help.com>2022-11-14 14:00:38 +1100
committerJames E Keenan <jkeenan@cpan.org>2022-11-18 17:51:43 -0500
commit0507844a31371da4dbf9136341e30487e5a9b5a8 (patch)
treed2c8f3b0202bf3652fca4b664700c85105e8d053 /scope.h
parentdecc3ce8213259c446820ae1f87d793000287fd4 (diff)
downloadperl-0507844a31371da4dbf9136341e30487e5a9b5a8.tar.gz
relax the assertion in SSPTR() and SSPTRt()
I added assertions in SSPTR() and SSPTRt() to try to ensure the new SSize_t result from SSNEW*() wouldn't be truncated, but this was too strict, requiring that the size matched exactly. Relax this to allow the input offset to be the same or larger than SSize_t. Fixes #20504.
Diffstat (limited to 'scope.h')
-rw-r--r--scope.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/scope.h b/scope.h
index 3d643a3df6..4acd9a9186 100644
--- a/scope.h
+++ b/scope.h
@@ -283,8 +283,8 @@ casts it to a pointer of that C<type>.
(I32)(align - ((size_t)((caddr_t)&PL_savestack[PL_savestack_ix]) % align)) % align)
#define SSNEWat(n,t,align) SSNEWa((n)*sizeof(t), align)
-#define SSPTR(off,type) (assert(sizeof(off) == sizeof(SSize_t)), (type) ((char*)PL_savestack + off))
-#define SSPTRt(off,type) (assert(sizeof(off) == sizeof(SSize_t)), (type*) ((char*)PL_savestack + off))
+#define SSPTR(off,type) (assert(sizeof(off) >= sizeof(SSize_t)), (type) ((char*)PL_savestack + off))
+#define SSPTRt(off,type) (assert(sizeof(off) >= sizeof(SSize_t)), (type*) ((char*)PL_savestack + off))
#define save_freesv(op) save_pushptr((void *)(op), SAVEt_FREESV)
#define save_mortalizesv(op) save_pushptr((void *)(op), SAVEt_MORTALIZESV)