New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bleadperl v5.25.10-81-gd69c43040e breaks JV/App-PDF-Link-0.18.tar.gz #15936
Comments
From @andkbisect d69c430 is the first bad commit Perl_do_vecget(): change offset arg to STRLEN type rt-cpan https://rt.cpan.org/Ticket/Display.html?id=120801 perl -V Summary of my perl5 (revision 5 version 25 subversion 11) configuration: Characteristics of this binary (from libperl): -- |
From @iabynOn Thu, Mar 30, 2017 at 09:41:01PM -0700, Andreas J. Koenig via RT wrote:
That commit changed how vec() behaves in maybe-lvalue context with a (1) $x = vec($s,-1,8); (1) is documented to return 0, and this is unchanged (3a) has changed. Previously it would set $x to 0, now it croaks. vec() in lvalue and maybe-lvalue context works by returning a SVt_PVLV The reason for the change is that xlvu_targoff is of type STRLEN which I guess I could change it so that only the minimum possible checking is In the longer term, maybe change SVt_PVLV's targoff and targlen to be -- |
The RT System itself - Status changed from 'new' to 'open' |
From @iabynOn Fri, Mar 31, 2017 at 11:37:54AM +0100, Dave Mitchell wrote:
Instead I went for the approach of checking early, but only flagging the commit 1b92e69 vec(): defer lvalue out-of-range croaking -- |
From @ilmariDave Mitchell <davem@iabyn.com> writes:
How about using named constants for the flag values, like this? Inline Patchdiff --git a/doop.c b/doop.c
index 18bc067d93..53ce47d454 100644
--- a/doop.c
+++ b/doop.c
@@ -920,8 +920,8 @@ Perl_do_vecset(pTHX_ SV *sv)
/* some out-of-range errors have been deferred if/until the LV is
* actually written to: f(vec($s,-1,8)) is not always fatal */
if (errflags) {
- assert(!(errflags & ~(1|4)));
- if (errflags & 1)
+ assert(!(errflags & ~(LVf_NEG_OFF|LVf_OUT_OF_RANGE)));
+ if (errflags & LVf_NEG_OFF)
Perl_croak_nocontext("Negative offset to vec in lvalue context");
Perl_croak_nocontext("Out of memory!");
}
diff --git a/mg.c b/mg.c
index 969d183d6a..d5ab040134 100644
--- a/mg.c
+++ b/mg.c
@@ -2197,8 +2197,8 @@ Perl_magic_getsubstr(pTHX_ SV *sv, MAGIC *mg)
const char * const tmps = SvPV_const(lsv,len);
STRLEN offs = LvTARGOFF(sv);
STRLEN rem = LvTARGLEN(sv);
- const bool negoff = LvFLAGS(sv) & 1;
- const bool negrem = LvFLAGS(sv) & 2;
+ const bool negoff = LvFLAGS(sv) & LVf_NEG_OFF;
+ const bool negrem = LvFLAGS(sv) & LVf_NEG_LEN;
PERL_ARGS_ASSERT_MAGIC_GETSUBSTR;
PERL_UNUSED_ARG(mg);
@@ -2229,8 +2229,8 @@ Perl_magic_setsubstr(pTHX_ SV *sv, MAGIC *mg)
SV * const lsv = LvTARG(sv);
STRLEN lvoff = LvTARGOFF(sv);
STRLEN lvlen = LvTARGLEN(sv);
- const bool negoff = LvFLAGS(sv) & 1;
- const bool neglen = LvFLAGS(sv) & 2;
+ const bool negoff = LvFLAGS(sv) & LVf_NEG_OFF;
+ const bool neglen = LvFLAGS(sv) & LVf_NEG_LEN;
PERL_ARGS_ASSERT_MAGIC_SETSUBSTR;
PERL_UNUSED_ARG(mg);
@@ -2311,7 +2311,7 @@ Perl_magic_getvec(pTHX_ SV *sv, MAGIC *mg)
PERL_UNUSED_ARG(mg);
/* non-zero errflags implies deferred out-of-range condition */
- assert(!(errflags & ~(1|4)));
+ assert(!(errflags & ~(LVf_NEG_OFF|LVf_OUT_OF_RANGE)));
sv_setuv(sv, errflags ? 0 : do_vecget(lsv, LvTARGOFF(sv), LvTARGLEN(sv)));
return 0;
diff --git a/pp.c b/pp.c
index cc4cb59f7d..4ed6b850a3 100644
--- a/pp.c
+++ b/pp.c
@@ -3377,11 +3377,11 @@ PP(pp_substr)
LvTARGOFF(ret) =
pos1_is_uv || pos1_iv >= 0
? (STRLEN)(UV)pos1_iv
- : (LvFLAGS(ret) |= 1, (STRLEN)(UV)-pos1_iv);
+ : (LvFLAGS(ret) |= LVf_NEG_OFF, (STRLEN)(UV)-pos1_iv);
LvTARGLEN(ret) =
len_is_uv || len_iv > 0
? (STRLEN)(UV)len_iv
- : (LvFLAGS(ret) |= 2, (STRLEN)(UV)-len_iv);
+ : (LvFLAGS(ret) |= LVf_NEG_LEN, (STRLEN)(UV)-len_iv);
PUSHs(ret); /* avoid SvSETMAGIC here */
RETURN;
@@ -3488,12 +3488,12 @@ PP(pp_vec)
/* avoid a large UV being wrapped to a negative value */
if (SvIOK_UV(offsetsv) && SvUVX(offsetsv) > (UV)IV_MAX)
- errflags = 4; /* out of range */
+ errflags = LVf_OUT_OF_RANGE;
else if (iv < 0)
- errflags = (1|4); /* negative offset, out of range */
+ errflags = (LVf_NEG_OFF|LVf_OUT_OF_RANGE);
#if PTRSIZE < IVSIZE
else if (iv > Size_t_MAX)
- errflags = 4; /* out of range */
+ errflags = LVf_OUT_OF_RANGE;
#endif
else
offset = (STRLEN)iv;
diff --git a/sv.h b/sv.h
index 5e9c5b6881..18e230516f 100644
--- a/sv.h
+++ b/sv.h
@@ -1402,6 +1402,10 @@ object type. Exposed to perl code via Internals::SvREADONLY().
#define LvTARGLEN(sv) ((XPVLV*) SvANY(sv))->xlv_targlen
#define LvFLAGS(sv) ((XPVLV*) SvANY(sv))->xlv_flags
+#define LVf_NEG_OFF 0x1
+#define LVf_NEG_LEN 0x2
+#define LVf_OUT_OF_RANGE 0x4
+
#define IoIFP(sv) (sv)->sv_u.svu_fp
#define IoOFP(sv) ((XPVIO*) SvANY(sv))->xio_ofp
#define IoDIRP(sv) ((XPVIO*) SvANY(sv))->xio_dirp
--
-- |
From @iabynOn Fri, Mar 31, 2017 at 03:14:41PM +0100, Dagfinn Ilmari Mannsåker wrote:
I intend to after 5.26.0; but in this late stage of code freeze I'm -- |
App-PDF-Link is doing fine on CPANtesters, so this ticket is closable. |
Migrated from rt.perl.org#131083 (status was 'open')
Searchable as RT131083$
The text was updated successfully, but these errors were encountered: