summaryrefslogtreecommitdiff
path: root/embed.fnc
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2017-03-15 14:35:59 +0000
committerDavid Mitchell <davem@iabyn.com>2017-03-17 14:13:40 +0000
commitd69c43040e4967294b1195ecfdc4acf0f74b5958 (patch)
tree239ab78aa25726bed3e85e66a6a9e6677d5102f9 /embed.fnc
parent7e337d2de5bfdccdeeb8d3f2f24f559ff905770a (diff)
downloadperl-d69c43040e4967294b1195ecfdc4acf0f74b5958.tar.gz
Perl_do_vecget(): change offset arg to STRLEN type
... and fix up its caller, pp_vec(). This is part of a fix for RT #130915. pp_vec() is responsible for extracting out the offset and size from SVs on the stack, and then calling do_vecget() with those values. (Sometimes the call is done indirectly by storing the offset in the LvTARGOFF() field of a SVt_PVLV, then later Perl_magic_getvec() passes the LvTARGOFF() value to do_vecget().) Now SvCUR, SvLEN and LvTARGOFF are all of type STRLEN (a.k.a Size_t), while the offset arg of do_vecget() is of type SSize_t (i.e. there's a signed/unsigned mismatch). It makes more sense to make the arg of type STRLEN. So that is what this commit does. At the same time this commit fixes up pp_vec() to handle all the possibilities where the offset value can't fit into a STRLEN, returning 0 or croaking accordingly, so that do_vecget() is never called with a truncated or wrapped offset. The next commit will fix up the internals of do_vecget() and do_vecset(), which have to worry about offset*(2^n) wrapping or being > SvCUR(). This commit is based on an earlier proposed fix by Aaron Crane.
Diffstat (limited to 'embed.fnc')
-rw-r--r--embed.fnc2
1 files changed, 1 insertions, 1 deletions
diff --git a/embed.fnc b/embed.fnc
index 3a68a3538f..654dad9998 100644
--- a/embed.fnc
+++ b/embed.fnc
@@ -491,7 +491,7 @@ pR |Off_t |do_tell |NN GV* gv
: Defined in doop.c, used only in pp.c
p |I32 |do_trans |NN SV* sv
: Used in my.c and pp.c
-p |UV |do_vecget |NN SV* sv|SSize_t offset|int size
+p |UV |do_vecget |NN SV* sv|STRLEN offset|int size
: Defined in doop.c, used only in mg.c (with /* XXX slurp this routine */)
p |void |do_vecset |NN SV* sv
: Defined in doop.c, used only in pp.c