This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
assert() that the pointer passed to Perl_sv_chop() lies within the
[perl5.git] / sv.c
diff --git a/sv.c b/sv.c
index 6ac3408..cdae779 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -4401,6 +4401,10 @@ Perl_sv_chop(pTHX_ register SV *const sv, register const char *const ptr)
     }
     assert(ptr > SvPVX_const(sv));
     SV_CHECK_THINKFIRST(sv);
+    if (SvLEN(sv))
+       assert(delta <= SvLEN(sv));
+    else
+       assert(delta <= SvCUR(sv));
 
     if (!SvOOK(sv)) {
        if (!SvLEN(sv)) { /* make copy of shared string */