summaryrefslogtreecommitdiff
path: root/pp.h
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2015-03-24 07:29:55 +0000
committerHugo van der Sanden <hv@crypt.org>2015-03-25 01:01:23 +0000
commitff36bb50a704e1926451063369ace915b3074f06 (patch)
tree17cbe8c6e13cca6ca9e7185eb3e2fc0870ad67b3 /pp.h
parent2fcbb74a67c62e89b625fc824fcddb7de6519a28 (diff)
downloadperl-ff36bb50a704e1926451063369ace915b3074f06.tar.gz
fix signed/unsigned mismatch in (M)EXTEND
A large enough allocation request could wrap, causing MEXTEND to decide the stack was already big enough.
Diffstat (limited to 'pp.h')
-rw-r--r--pp.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/pp.h b/pp.h
index 003d7af340..828b7a2820 100644
--- a/pp.h
+++ b/pp.h
@@ -278,21 +278,21 @@ Does not use C<TARG>. See also C<XPUSHu>, C<mPUSHu> and C<PUSHu>.
} STMT_END
/* Same thing, but update mark register too. */
# define MEXTEND(p,n) STMT_START { \
- const int markoff = mark - PL_stack_base; \
+ const SSize_t markoff = mark - PL_stack_base; \
sp = stack_grow(sp,p,(SSize_t) (n)); \
mark = PL_stack_base + markoff; \
PERL_UNUSED_VAR(sp); \
} STMT_END
#else
# define EXTEND(p,n) STMT_START { \
- if (UNLIKELY(PL_stack_max - p < (int)(n))) { \
+ if (UNLIKELY(PL_stack_max - p < (SSize_t)(n))) { \
sp = stack_grow(sp,p,(SSize_t) (n)); \
PERL_UNUSED_VAR(sp); \
} } STMT_END
/* Same thing, but update mark register too. */
# define MEXTEND(p,n) STMT_START { \
- if (UNLIKELY(PL_stack_max - p < (int)(n))) { \
- const int markoff = mark - PL_stack_base; \
+ if (UNLIKELY(PL_stack_max - p < (SSize_t)(n))) { \
+ const SSize_t markoff = mark - PL_stack_base; \
sp = stack_grow(sp,p,(SSize_t) (n)); \
mark = PL_stack_base + markoff; \
PERL_UNUSED_VAR(sp); \