diff options
author | David Mitchell <davem@iabyn.com> | 2018-11-21 12:09:45 +0000 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2018-11-21 12:09:45 +0000 |
commit | 9ba9a28aaea66bad2de041880a2c4210a911dda6 (patch) | |
tree | 0e15fdfff99a1c95fb771be734d4616f94aa0223 /hv.c | |
parent | 59592778585db09866cbb37a7ab04eefc07b4df4 (diff) | |
download | perl-9ba9a28aaea66bad2de041880a2c4210a911dda6.tar.gz |
S_hv_delete_common(): avoid undefined behaviour
ASAN -fsanitize-undefined was tripping on the second of these two lines:
svp = AvARRAY(isa);
end = svp + AvFILLp(isa)+1;
In the case where svp is NULL and AvFILLp(isa) is -1, the first addition
is undefined behaviour. Add the 1 first, so that it becomes
svp + (-1+1), which is safe.
Diffstat (limited to 'hv.c')
-rw-r--r-- | hv.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1295,7 +1295,7 @@ S_hv_delete_common(pTHX_ HV *hv, SV *keysv, const char *key, STRLEN klen, SV **svp, **end; strip_magic: svp = AvARRAY(isa); - end = svp + AvFILLp(isa)+1; + end = svp + (AvFILLp(isa)+1); while (svp < end) { if (*svp) mg_free_type(*svp, PERL_MAGIC_isaelem); |