This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
perl5.git
7 years agoUse NOT_REACHED for the impossible case.
Jarkko Hietaniemi [Fri, 30 May 2014 01:24:47 +0000 (21:24 -0400)]
Use NOT_REACHED for the impossible case.

The default case really is impossible because all the valid
enums values are already covered in the switch.

The NOT_REACHED; is for the compiler (from perl.h),
the /* NOTREACHED */ is for static analyzers.

7 years agoperlre: Clarify /x eol can't be escaped
Karl Williamson [Mon, 19 May 2014 22:36:33 +0000 (16:36 -0600)]
perlre: Clarify /x eol can't be escaped

7 years agot/run/locale.t: Skip some tests for some shells
Karl Williamson [Tue, 13 May 2014 23:31:39 +0000 (17:31 -0600)]
t/run/locale.t: Skip some tests for some shells

Some sh programs don't accept changes of environment variables like
LC_ALL to invalid values.  For these the tests aren't testing what they
think they are, so change them to just return the expected value, so
they will pass.  This effectively skips the tests when run on these
shells.  See http://nntp.perl.org/group/perl.perl5.porters/214503

7 years agot/run/locale.t: Rmv obsolete complicated idiom
Karl Williamson [Tue, 13 May 2014 23:08:24 +0000 (17:08 -0600)]
t/run/locale.t: Rmv obsolete complicated idiom

See http://nntp.perl.org/group/perl.perl5.porters/213369

7 years agot/test.pl: Use existing variable instead of recalculating
Karl Williamson [Tue, 6 May 2014 22:26:05 +0000 (16:26 -0600)]
t/test.pl: Use existing variable instead of recalculating

If the current platform is ascii is available already in a variable.
Use that instead of inventing a different paradigm.

7 years agoXS-APItest/t/handy.t: Change output message
Karl Williamson [Fri, 15 Mar 2013 17:50:35 +0000 (11:50 -0600)]
XS-APItest/t/handy.t: Change output message

On EBCDIC platforms, the output is not in terms of \N{U+}; change text
to \x{ }

7 years agomktables: Add comment
Karl Williamson [Sat, 22 Feb 2014 23:36:28 +0000 (16:36 -0700)]
mktables: Add comment

7 years agoPATCH: [perl #121630]: perlpod clarification
Karl Williamson [Mon, 28 Apr 2014 20:10:37 +0000 (14:10 -0600)]
PATCH: [perl #121630]: perlpod clarification

7 years agot/lib/charnames/alias: Add comment
Karl Williamson [Thu, 24 Apr 2014 15:30:07 +0000 (09:30 -0600)]
t/lib/charnames/alias: Add comment

7 years agot/re/charset.t: Fix comment, test names
Karl Williamson [Tue, 22 Apr 2014 03:27:37 +0000 (21:27 -0600)]
t/re/charset.t: Fix comment, test names

Some of the test names have hard-coded values that are wrong.  This uses
a calculated value.

7 years agoRevert "mktables: Remove obsolete sort constraint"
Karl Williamson [Wed, 30 Apr 2014 02:18:42 +0000 (20:18 -0600)]
Revert "mktables: Remove obsolete sort constraint"

This reverts commit cf13ddc5efb78ce6d588441978947303e5baf1d8,
and adds a comment as to why.

7 years agomktables: Add regenerated header to file
Karl Williamson [Wed, 28 May 2014 03:23:34 +0000 (21:23 -0600)]
mktables: Add regenerated header to file

This file is generated by mktables, so any changes made to it are lost.
Add the standard header for such files to it.

7 years agoRemove deprecated 'PL_sv_objcount'
Karl Williamson [Wed, 9 Apr 2014 00:46:25 +0000 (18:46 -0600)]
Remove deprecated 'PL_sv_objcount'

This was scheduled to be removed in 5.20, but was forgotten.

7 years agoutf8.c: Silence compiler warning
Karl Williamson [Fri, 30 May 2014 00:43:21 +0000 (18:43 -0600)]
utf8.c: Silence compiler warning

This was brought to my attention by Jarkko Hietaniemi.  The compiler was
complaining that a variable could be used uninitialized.  In practice
this doesn't happen, as it would only happen on bad data, and Perl
itself generates the data used.  (I suppose if the data got corrupted,
it could happen.)  This commit initializes the value unconditionally,
which allows a conditional setting of it to be removed.

7 years agoutf8.c: Move static function to embed.fnc
Karl Williamson [Fri, 30 May 2014 00:41:58 +0000 (18:41 -0600)]
utf8.c: Move static function to embed.fnc

This automatically generates assertions for pointer arguments, etc.

7 years agoUnify the "fall-through" lint annotation.
Jarkko Hietaniemi [Fri, 30 May 2014 00:41:22 +0000 (20:41 -0400)]
Unify the "fall-through" lint annotation.

Used by linters (static checkers), and also good for human readers.

Even though "FALL THROUGH" seems to be the most common, e.g BSD lint
manual only knows "FALLTHROUGH" (or "FALLTHRU").

7 years agoOnly prototype should_warn_nl under PERL_CORE.
Craig A. Berry [Thu, 29 May 2014 22:08:37 +0000 (17:08 -0500)]
Only prototype should_warn_nl under PERL_CORE.

Otherwise the prototype is seen in places where the function
itself is not defined, which is illegal for inline functions.

Follow-up to 7cb3f9598b37fc.

7 years agoGive caretx.c an explicit rule in vms/descrip_mms.template.
Craig A. Berry [Thu, 29 May 2014 21:46:19 +0000 (16:46 -0500)]
Give caretx.c an explicit rule in vms/descrip_mms.template.

Without an explicit rule it gets build with CFLAGS rather than
CORECFLAGS, which could make it miss important things, such as
PERL_CORE being defined.

7 years agoActually define SS_NOPRIV.
Craig A. Berry [Thu, 29 May 2014 21:44:11 +0000 (16:44 -0500)]
Actually define SS_NOPRIV.

Because in cd52bc19d9de6bc we made it just like all the others
except for the fact that the others already existed and this
one didn't.

7 years agoFurther simplify the sockatmark().
Jarkko Hietaniemi [Thu, 29 May 2014 21:36:41 +0000 (17:36 -0400)]
Further simplify the sockatmark().

(And do not assign the fd in PREINIT.)

7 years agoBuild fixes for Win32 after the Coverity smoke.
Jarkko Hietaniemi [Thu, 29 May 2014 20:56:28 +0000 (16:56 -0400)]
Build fixes for Win32 after the Coverity smoke.

(for 375ed12a42c6092b1af1d8e395bf3dadd9a66e48)

7 years agoGet rid of "grep empty(sub)expression" noise.
Jarkko Hietaniemi [Thu, 29 May 2014 19:16:47 +0000 (15:16 -0400)]
Get rid of "grep empty(sub)expression" noise.

In OS X (and assumedly *BSD) Configure output starts with:

grep empty(sub)expression

apparently because plain 'grep' understands the 'os\(/\|\)2'
somewhat differently (BRE vs ERE, RTFM re_format(7))

Cure: redirect the stderr of grep to stdout (which is then promptly
redirected to /dev/null).  The grep will still fail, and not take
the OS/2 (or DJGPP) branch.

7 years agoWe cannot assert(sv) since sv can be validly null
Jarkko Hietaniemi [Thu, 29 May 2014 19:14:34 +0000 (15:14 -0400)]
We cannot assert(sv) since sv can be validly null
(see the top of the function), but we can test it.

7 years agoDevel::PPPort 3.24 from CPAN.
Jarkko Hietaniemi [Thu, 29 May 2014 18:17:18 +0000 (14:17 -0400)]
Devel::PPPort 3.24 from CPAN.

7 years agoNo more x2p.
Jarkko Hietaniemi [Thu, 29 May 2014 17:56:35 +0000 (13:56 -0400)]
No more x2p.

7 years agoVersion bumping thanks to the Coverity deluge.
Jarkko Hietaniemi [Thu, 29 May 2014 17:52:25 +0000 (13:52 -0400)]
Version bumping thanks to the Coverity deluge.

7 years agoFollowup to 316ebaf (aka perl #121894).
Jarkko Hietaniemi [Thu, 29 May 2014 17:24:36 +0000 (13:24 -0400)]
Followup to 316ebaf (aka perl #121894).

Adding asserts to more spots.

Fix for Coverity perl5 CIDs 28962,28968,28969:
CID ...: Dereference after null check (FORWARD_NULL)
var_deref_op: Dereferencing null pointer p->q

7 years agoBump version for Devel::Peek
Karl Williamson [Thu, 29 May 2014 17:33:10 +0000 (11:33 -0600)]
Bump version for Devel::Peek

Commit 316ebaf2966c5b6fd47a9d1dc6fb64fcbd262379 changed this module
without changing the version number

7 years agofcntl receiving -1 from fileno, fcntl failing.
Jarkko Hietaniemi [Thu, 29 May 2014 16:36:28 +0000 (12:36 -0400)]
fcntl receiving -1 from fileno, fcntl failing.

(Also very few spots of negative numgroups for getgroups(),
and fgetc() return, but almost all checking is for fcntl.)

(merged fix for perl #121743 and perl #121745: hopefully
picked up all the fixes-to-fixes from the ticket...)

Fix for Coverity perl5 CIDs 28990..29003,29005..29011,29013,
45354,45363,49926:

Argument cannot be negative (NEGATIVE_RETURNS) fd is
passed to a parameter that cannot be negative.

and CIDs 29004, 29012:
Argument cannot be negative (NEGATIVE_RETURNS)
num_groups is passed to a parameter that cannot be negative

and because of CIDs 29005 and 29006 also CID 28924.

In the first set of issues a fd is retrieved from PerlIO_fileno, and
that is then used in places like fstat(), fchown(), dup(), etc.,
without checking whether the fd is valid (>=0).

In the second set of issues a potentially negative
number is potentially passed to getgroups().

The CIDs 29005 and 29006 were a bit messy: fixing them needed also
resolving CID 28924 where the return value of fstat() was ignored,
and for completeness adding two croak calls (with perldiag updates):
a bit of a waste since it's suidperl code.

7 years agoInsert asserts to paths suspected by Coverity.
Jarkko Hietaniemi [Thu, 29 May 2014 15:37:56 +0000 (11:37 -0400)]
Insert asserts to paths suspected by Coverity.

Coverity suspects paths like this:

(1)

  p = foo();
  if (!p) p = bar();
  baz(p->q);

since it cannot prove that p is always non-NULL at the dereference.

(2) Or simply something like:

  mg = mg_find(...);
  foo(mg->blah);

Since mg_find() can fail returning NULL.

Adding assert() calls before the dereferences.  Testing with -DDEBUGGING.
Hopefully there are regular smokes doing the same.

[perl #121894]

Fix for Coverity perl5 CIDs 28950,28952..28955,28964,28967,28970..28795,49921:
CID ...: Dereference after null check (FORWARD_NULL)
var_deref_op: Dereferencing null pointer p->q

(TODO: Coverity perl5 CIDs 28962,28968,28969: the same issue, but would
conflict with already in-flight changes, prepare catch-up patch later.)
---
 dist/Data-Dumper/Dumper.xs | 1 +
 dump.c                     | 1 +
 ext/Devel-Peek/Peek.xs     | 1 +
 ext/XS-APItest/APItest.xs  | 1 +
 mg.c                       | 2 ++
 mro.c                      | 4 +++-
 op.c                       | 4 ++++
 perlio.c                   | 1 +
 pp_hot.c                   | 5 +++--
 regcomp.c                  | 3 +++
 regexec.c                  | 5 ++++-
 universal.c                | 2 +-
 util.c                     | 4 +++-
 13 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/dist/Data-Dumper/Dumper.xs b/dist/Data-Dumper/Dumper.xs
index 12c4ebd..23e0cf4 100644
--- a/dist/Data-Dumper/Dumper.xs
+++ b/dist/Data-Dumper/Dumper.xs
@@ -641,6 +641,7 @@ DD_dump(pTHX_ SV *val, const char *name, STRLEN namelen, SV *retval, HV *seenhv,
      else {
        sv_pattern = val;
      }
+     assert(sv_pattern);
      rval = SvPV(sv_pattern, rlen);
      rend = rval+rlen;
      slash = rval;
diff --git a/dump.c b/dump.c
index 59be3e0..c2d72fd 100644
--- a/dump.c
+++ b/dump.c
@@ -471,6 +471,7 @@ Perl_sv_peek(pTHX_ SV *sv)
   finish:
     while (unref--)
  sv_catpv(t, ")");
+    /* XXX when is sv ever NULL? */
     if (TAINTING_get && SvTAINTED(sv))
  sv_catpv(t, " [tainted]");
     return SvPV_nolen(t);
diff --git a/ext/Devel-Peek/Peek.xs b/ext/Devel-Peek/Peek.xs
index 679efa5..b20fa94 100644
--- a/ext/Devel-Peek/Peek.xs
+++ b/ext/Devel-Peek/Peek.xs
@@ -450,6 +450,7 @@ PPCODE:
 BOOT:
 {
     CV * const cv = get_cvn_flags("Devel::Peek::Dump", 17, 0);
+    assert(cv);
     cv_set_call_checker(cv, S_ck_dump, (SV *)cv);

     XopENTRY_set(&my_xop, xop_name, "Dump");
diff --git a/ext/XS-APItest/APItest.xs b/ext/XS-APItest/APItest.xs
index a51924d..18ba381 100644
--- a/ext/XS-APItest/APItest.xs
+++ b/ext/XS-APItest/APItest.xs
@@ -2096,6 +2096,7 @@ newCONSTSUB(stash, name, flags, sv)
                break;
         }
         EXTEND(SP, 2);
+        assert(mycv);
         PUSHs( CvCONST(mycv) ? &PL_sv_yes : &PL_sv_no );
         PUSHs((SV*)CvGV(mycv));

diff --git a/mg.c b/mg.c
index 76912bd..7f3339a 100644
--- a/mg.c
+++ b/mg.c
@@ -1675,6 +1675,7 @@ Perl_magic_clearisa(pTHX_ SV *sv, MAGIC *mg)
     same function. */
  mg = mg_find(mg->mg_obj, PERL_MAGIC_isa);

+    assert(mg);
     if (SvTYPE(mg->mg_obj) == SVt_PVAV) { /* multiple stashes */
  SV **svp = AvARRAY((AV *)mg->mg_obj);
  I32 items = AvFILLp((AV *)mg->mg_obj) + 1;
@@ -3437,6 +3438,7 @@ Perl_magic_copycallchecker(pTHX_ SV *sv, MAGIC *mg, SV *nsv,

     sv_magic(nsv, &PL_sv_undef, mg->mg_type, NULL, 0);
     nmg = mg_find(nsv, mg->mg_type);
+    assert(nmg);
     if (nmg->mg_flags & MGf_REFCOUNTED) SvREFCNT_dec(nmg->mg_obj);
     nmg->mg_ptr = mg->mg_ptr;
     nmg->mg_obj = SvREFCNT_inc_simple(mg->mg_obj);
diff --git a/mro.c b/mro.c
index 1b37ca7..ccf4bf4 100644
--- a/mro.c
+++ b/mro.c
@@ -638,12 +638,14 @@ Perl_mro_isa_changed_in(pTHX_ HV* stash)
                       hv_storehek(mroisarev, namehek, &PL_sv_yes);
                 }

-                if((SV *)isa != &PL_sv_undef)
+                if ((SV *)isa != &PL_sv_undef) {
+                    assert(namehek);
                     mro_clean_isarev(
                      isa, HEK_KEY(namehek), HEK_LEN(namehek),
                      HvMROMETA(revstash)->isa, HEK_HASH(namehek),
                      HEK_UTF8(namehek)
                     );
+                }
             }
         }
     }
diff --git a/op.c b/op.c
index 796cb03..79621ce 100644
--- a/op.c
+++ b/op.c
@@ -2907,6 +2907,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp)
      S_cant_declare(aTHX_ o);
  } else if (attrs) {
      GV * const gv = cGVOPx_gv(cUNOPo->op_first);
+     assert(PL_parser);
      PL_parser->in_my = FALSE;
      PL_parser->in_my_stash = NULL;
      apply_attrs(GvSTASH(gv),
@@ -2929,6 +2930,7 @@ S_my_kid(pTHX_ OP *o, OP *attrs, OP **imopsp)
     else if (attrs && type != OP_PUSHMARK) {
  HV *stash;

+        assert(PL_parser);
  PL_parser->in_my = FALSE;
  PL_parser->in_my_stash = NULL;

@@ -10229,6 +10231,7 @@ Perl_ck_split(pTHX_ OP *o)
  op_append_elem(OP_SPLIT, o, newDEFSVOP());

     kid = kid->op_sibling;
+    assert(kid);
     scalar(kid);

     if (!kid->op_sibling)
@@ -10902,6 +10905,7 @@ Perl_cv_set_call_checker(pTHX_ CV *cv, Perl_call_checker ckfun, SV *ckobj)
  MAGIC *callmg;
  sv_magic((SV*)cv, &PL_sv_undef, PERL_MAGIC_checkcall, NULL, 0);
  callmg = mg_find((SV*)cv, PERL_MAGIC_checkcall);
+ assert(callmg);
  if (callmg->mg_flags & MGf_REFCOUNTED) {
      SvREFCNT_dec(callmg->mg_obj);
      callmg->mg_flags &= ~MGf_REFCOUNTED;
diff --git a/perlio.c b/perlio.c
index d4c43d0..e6ff9e4 100644
--- a/perlio.c
+++ b/perlio.c
@@ -2225,6 +2225,7 @@ PerlIOBase_dup(pTHX_ PerlIO *f, PerlIO *o, CLONE_PARAMS *param, int flags)
  PerlIO_funcs * const self = PerlIOBase(o)->tab;
  SV *arg = NULL;
  char buf[8];
+ assert(self);
  PerlIO_debug("PerlIOBase_dup %s f=%p o=%p param=%p\n",
       self ? self->name : "(Null)",
       (void*)f, (void*)o, (void*)param);
diff --git a/pp_hot.c b/pp_hot.c
index 2cccc48..9c9d1e9 100644
--- a/pp_hot.c
+++ b/pp_hot.c
@@ -3078,6 +3078,7 @@ S_method_common(pTHX_ SV* meth, U32* hashp)
  const HE* const he = hv_fetch_ent(stash, meth, 0, *hashp);
  if (he) {
      gv = MUTABLE_GV(HeVAL(he));
+     assert(stash);
      if (isGV(gv) && GvCV(gv) &&
  (!GvCVGEN(gv) || GvCVGEN(gv)
                   == (PL_sub_generation + HvMROMETA(stash)->cache_gen)))
@@ -3085,9 +3086,9 @@ S_method_common(pTHX_ SV* meth, U32* hashp)
  }
     }

+    assert(stash || packsv);
     gv = gv_fetchmethod_sv_flags(stash ? stash : MUTABLE_HV(packsv),
-              meth, GV_AUTOLOAD | GV_CROAK);
-
+                                 meth, GV_AUTOLOAD | GV_CROAK);
     assert(gv);

     return isGV(gv) ? MUTABLE_SV(GvCV(gv)) : MUTABLE_SV(gv);
diff --git a/regcomp.c b/regcomp.c
index eaee604..3d49827 100644
--- a/regcomp.c
+++ b/regcomp.c
@@ -2007,6 +2007,7 @@ S_make_trie(pTHX_ RExC_state_t *pRExC_state, regnode *startbranch,
     });

     re_trie_maxbuff = get_sv(RE_TRIE_MAXBUF_NAME, 1);
+    assert(re_trie_maxbuff);
     if (!SvIOK(re_trie_maxbuff)) {
         sv_setiv(re_trie_maxbuff, RE_TRIE_MAXBUF_INIT);
     }
@@ -14920,6 +14921,7 @@ S_set_ANYOF_arg(pTHX_ RExC_state_t* const pRExC_state,
  av_store(av, 0, (runtime_defns)
  ? SvREFCNT_inc(runtime_defns) : &PL_sv_undef);
  if (swash) {
+     assert(cp_list);
      av_store(av, 1, swash);
      SvREFCNT_dec_NN(cp_list);
  }
@@ -16609,6 +16611,7 @@ S_dumpuntil(pTHX_ const regexp *r, const regnode *start, const regnode *node,
         last= plast;

     while (PL_regkind[op] != END && (!last || node < last)) {
+        assert(node);
  /* While that wasn't END last time... */
  NODE_ALIGN(node);
  op = OP(node);
diff --git a/regexec.c b/regexec.c
index 362390b..ffab4f2 100644
--- a/regexec.c
+++ b/regexec.c
@@ -7010,6 +7010,8 @@ no_silent:
                 sv_commit = &PL_sv_yes;
             sv_yes_mark = &PL_sv_no;
         }
+        assert(sv_err);
+        assert(sv_mrk);
         sv_setsv(sv_err, sv_commit);
         sv_setsv(sv_mrk, sv_yes_mark);
     }
@@ -7620,6 +7622,7 @@ Perl__get_regclass_nonbitmap_data(pTHX_ const regexp *prog,
                     *only_utf8_locale_ptr = ary[2];
                 }
                 else {
+                    assert(only_utf8_locale_ptr);
                     *only_utf8_locale_ptr = NULL;
                 }

@@ -7641,7 +7644,7 @@ Perl__get_regclass_nonbitmap_data(pTHX_ const regexp *prog,
      }
      else if (doinit && ((si && si != &PL_sv_undef)
                                  || (invlist && invlist != &PL_sv_undef))) {
-
+ assert(si);
  sw = _core_swash_init("utf8", /* the utf8 package */
        "", /* nameless */
        si,
diff --git a/universal.c b/universal.c
index a29696d..65e02df 100644
--- a/universal.c
+++ b/universal.c
@@ -67,7 +67,7 @@ S_isa_lookup(pTHX_ HV *stash, const char * const name, STRLEN len, U32 flags)
     if (our_stash) {
  HEK *canon_name = HvENAME_HEK(our_stash);
  if (!canon_name) canon_name = HvNAME_HEK(our_stash);
-
+ assert(canon_name);
  if (hv_common(isa, NULL, HEK_KEY(canon_name), HEK_LEN(canon_name),
        HEK_FLAGS(canon_name),
        HV_FETCH_ISEXISTS, NULL, HEK_HASH(canon_name))) {
diff --git a/util.c b/util.c
index b90abe5..cd0afb6 100644
--- a/util.c
+++ b/util.c
@@ -850,15 +850,17 @@ Perl_fbm_instr(pTHX_ unsigned char *big, unsigned char *bigend, SV *littlestr, U

     {
  const MAGIC *const mg = mg_find(littlestr, PERL_MAGIC_bm);
- const unsigned char * const table = (const unsigned char *) mg->mg_ptr;
  const unsigned char *oldlittle;

+ assert(mg);
+
  --littlelen; /* Last char found by table lookup */

  s = big + littlelen;
  little += littlelen; /* last char */
  oldlittle = little;
  if (s < bigend) {
+     const unsigned char * const table = (const unsigned char *) mg->mg_ptr;
      I32 tmp;

    top2:
--
1.8.5.2 (Apple Git-48)

7 years agobump version on NDBM_File
David Mitchell [Thu, 29 May 2014 15:28:12 +0000 (16:28 +0100)]
bump version on NDBM_File

7 years agoO_BINARY versus O_TEXT.
Jarkko Hietaniemi [Thu, 29 May 2014 15:18:24 +0000 (11:18 -0400)]
O_BINARY versus O_TEXT.

O_BINARY and O_TEXT can be either different (mostly in Windowsy platforms,
and in some hybrids, and then they can be either effective or no-ops);
or equal (in UNIXy platforms, no-ops).  If they are no-ops, and especially
if one or both of them are zeros, one cannot even test for them (bit-and),
without introducing dead/non-sensical code.

[perl #121739]

Fix for Coverity perl5 CID 28948:
Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement mode[ix++] = 'b';

7 years agoStrengthen the ix zero min-clamping to panic.
Jarkko Hietaniemi [Thu, 29 May 2014 15:09:48 +0000 (11:09 -0400)]
Strengthen the ix zero min-clamping to panic.

Currently the ix cannot ever be less than zero (detected by Coverity).
Furthermore, it probably should never get less than zero, so panic if
that ever happens.

[perl #121897]

Fix for Coverity perl5 CID 28946:
at_least: At condition ix < 0, the value of ix must be at least 0.
dead_error_condition: The condition ix < 0 cannot be true.
Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement ix = 0;

7 years agoMakefile.SH: Module::Build is no longer there, stop copying it
Brian Fraser [Thu, 29 May 2014 11:47:31 +0000 (13:47 +0200)]
Makefile.SH: Module::Build is no longer there, stop copying it

This only affected 'make test' for cross-compilation builds; in
those, we try to copy files relevant to 'make test' to the target
system.

Since Module::Build is no longer part of the core, no need to
try to copy it over.

7 years agomake regen for uconfig.h
Brian Fraser [Thu, 29 May 2014 11:28:00 +0000 (13:28 +0200)]
make regen for uconfig.h

7 years agoFix for [perl #121963] 5.20.0-RC1 can't compile on Android
Brian Fraser [Thu, 29 May 2014 10:58:52 +0000 (12:58 +0200)]
Fix for [perl #121963] 5.20.0-RC1 can't compile on Android

On some native android builds, this was causing warnings and
possibly build errors before Config.pm was generated.

7 years agoSH_PATH should be $targetsh, not $sh
Brian Fraser [Thu, 29 May 2014 10:54:59 +0000 (12:54 +0200)]
SH_PATH should be $targetsh, not $sh

Due to a small oversight, this was reverted in the last metaconfig
update, and was preventing backticks/system/exec/two-arg-pipe-open
from working in some Android devices.

7 years agoMax size of the flop operator range.
Jarkko Hietaniemi [Thu, 29 May 2014 15:00:31 +0000 (11:00 -0400)]
Max size of the flop operator range.

Firstly, rename {max,j} -> {j,n} since j as the count is very confusing.

The j > SSize_t_MAX cannot (usually) fire.

(1) If the IV and SSize_t are the same (very likely) the count (an IV)
simply cannot be larger than the max of SSize_t.

(2) If IV is larger than SSize_t (e.g. long longs for IVs but only
32-bit pointers available) the count could conceivably be larger than
the max of SSize_t, but we still need to correctly dance around the
max: the signed maxima are tricky since the behavior of overflow is
undefined.

(3) The IV cannot be smaller than than SSize_t (e.g. I32 for IV but
64-bit pointers available): IV is supposed to be large enough to
contain pointers).

NOTE: this logic only protects against the wraparound, not against
an OOM: we will run out of memory long before we create (even)
SSize_t_MAX SVs. There is nothing magical about SSize_t as such,
except that it is a likely wraparound spot.

Fix for Coverity perl5 CID 28933:
Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
result_independent_of_operands: j > 9223372036854775807L
/* (ssize_t)(~((size_t)0) >> 1) */ is always false regardless of
The values of its operands. This occurs as the logical operand of if.

7 years agoUse system default locale only if there is one.
Jarkko Hietaniemi [Thu, 29 May 2014 14:40:02 +0000 (10:40 -0400)]
Use system default locale only if there is one.

(Currently, only Win32 has one.)

[perl #121865]

Fix for Coverity perl5 CID 28949:
Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement
name = system_default_locale;

7 years agoprintf %s, cast appropriately.
Jarkko Hietaniemi [Thu, 29 May 2014 14:34:28 +0000 (10:34 -0400)]
printf %s, cast appropriately.

[perl #121881]

Fix for Coverity perl5 CID 29050:
Printf arg type mismatch (PW.PRINTF_ARG_MISMATCH)
printf_arg_mismatch: argument is incompatible with corresponding
format string conversion

7 years agoUnused dTHX, even under threads.
Jarkko Hietaniemi [Thu, 29 May 2014 14:26:54 +0000 (10:26 -0400)]
Unused dTHX, even under threads.

[perl #121882].

Fix for Coverity perl5 CID 49935:
Unused pointer value (UNUSED_VALUE)
returned_pointer: Pointer my_perl returned by
pthread_getspecific(PL_thr_key) is never used.

7 years ago __APPLE__ is not Apple, use PERL_DARWIN instead.
Jarkko Hietaniemi [Thu, 29 May 2014 14:21:58 +0000 (10:21 -0400)]
 __APPLE__ is not Apple, use PERL_DARWIN instead.

See hints/darwin.sh for details.

7 years agoReindent the block. Whitespace-only change.
Jarkko Hietaniemi [Thu, 29 May 2014 14:17:51 +0000 (10:17 -0400)]
Reindent the block. Whitespace-only change.

Followup to 99e8c5.

7 years agoFix false nesting.
Jarkko Hietaniemi [Thu, 29 May 2014 14:13:08 +0000 (10:13 -0400)]
Fix false nesting.

[perl #121744]

Fix for Coverity perl5 CID 29014:
Nesting level does not match indentation (NESTING_INDENT_MISMATCH)

(Reindentation of the whole "if (!PL_use_safe_putenv)" block will follow.)

7 years agoUV casting to avoid intermediate sign extension.
Jarkko Hietaniemi [Thu, 29 May 2014 14:01:13 +0000 (10:01 -0400)]
UV casting to avoid intermediate sign extension.

[perl #121746]

Fix for Coverity perl5 CIDs 29069, 29070, 29071:
Unintended sign extension: ... ... if ... U8 (8 bits unsigned) ... 32
bits, signed ...  64 bits, unsigned ... is greater than 0x7FFFFFFF,
the upper bits of the result will all be 1.

7 years agoRemove x2p
Leon Timmermans [Wed, 21 May 2014 11:56:54 +0000 (13:56 +0200)]
Remove x2p

This removes find2perl, s2p and a2p from core. They have all been
released to CPAN as separate distributions.

7 years agoStandardize spelling of program name on American English.
Doug Bell [Thu, 29 May 2014 12:23:42 +0000 (08:23 -0400)]
Standardize spelling of program name on American English.

For: https://rt.perl.org/Ticket/Display.html?id=121978

7 years agotemporary fix for [perl #121975] COW speedup lost after e8c6a474
Yves Orton [Thu, 29 May 2014 09:33:56 +0000 (11:33 +0200)]
temporary fix for [perl #121975] COW speedup lost after e8c6a474

Disable use of Perl_safesysmalloc_size by default. Only use it when PERL_USE_MALLOC_SIZE is defined.

Using Perl_safesysmalloc_size() perl cannot tell a deliberately preallocated buffer
which we probably dont want to COW from a malloc() preallocated buffer where we probably
dont care. Hopefully this fixes the slowdown observed on some platforms.

7 years agoQuad_t and Uquad_t cannot unpack as NVs.
Jarkko Hietaniemi [Tue, 6 May 2014 16:50:55 +0000 (12:50 -0400)]
Quad_t and Uquad_t cannot unpack as NVs.

If IVSIZE >= 8, a Quad_t is always >= IV_MIN, and <= IV_MAX, and an
Uquad_t is always (>= 0 aka UV_MIN and) <= UV_MAX; they cannot escape
their quadness and be NVs.  (This logic may fail if Quad_t is not 8
bytes, but then other things would no doubt fail.)

Also tighten the logic by adding HAS_QUAD, also for the pack case.

Fix for Coverity perl5 CID 28942.

7 years agosi_names access one past the end.
Jarkko Hietaniemi [Fri, 9 May 2014 22:49:25 +0000 (18:49 -0400)]
si_names access one past the end.

Fix for Coverity perl5 CID 45359.

7 years agocleanup on commit "Pseudo-fork dups arg array on argless calls"
Daniel Dragan [Tue, 29 Apr 2014 16:27:42 +0000 (12:27 -0400)]
cleanup on commit "Pseudo-fork dups arg array on argless calls"

less branching, less cpu intructions, easier to read

7 years agoput va_end() in the right place
Tony Cook [Thu, 22 May 2014 01:05:59 +0000 (11:05 +1000)]
put va_end() in the right place

7 years agobump $PerlIO::via::VERSION to 0.15
Tony Cook [Tue, 20 May 2014 05:06:16 +0000 (15:06 +1000)]
bump $PerlIO::via::VERSION to 0.15

7 years agoadd va_end() calls where missing for a va_start() or va_end().
Jarkko Hietaniemi [Wed, 23 Apr 2014 16:53:42 +0000 (12:53 -0400)]
add va_end() calls where missing for a va_start() or va_end().

Fix for Coverity perl5 CIDs 29225, 29226, 29227, 29228, 29229: Missing
varargs init or cleanup (VARARGS) missing va_end: va_end was not
called for foo.

Use of va_args must be finished off with va_end (in other words,
use of va_start or va_copy must be bracketed off with va_end).
In most platforms va_end is a no-op, but in some platforms it is
required for proper cleanup (or face stack smash, or memory leak).

Tony: move va_start() out of the declaration block

7 years agoremove comment that no longer applies
Tony Cook [Wed, 21 May 2014 00:45:58 +0000 (10:45 +1000)]
remove comment that no longer applies

7 years agobump $XS::APItest::VERSION to 0.61
Tony Cook [Tue, 20 May 2014 05:06:33 +0000 (15:06 +1000)]
bump $XS::APItest::VERSION to 0.61

7 years agoPointers set but then (immediately or very shortly) overwritten.
Jarkko Hietaniemi [Sat, 26 Apr 2014 01:52:54 +0000 (21:52 -0400)]
Pointers set but then (immediately or very shortly) overwritten.

Fix for Coverity perl5 CIDs 29203, 29207, 29211, 29214, 29217, 29218,
29222: Unused pointer value (UNUSED_VALUE) Pointer foo returned by
bar() is overwritten.

7 years agoUninitialized tmbuf.
Jarkko Hietaniemi [Wed, 7 May 2014 13:26:52 +0000 (09:26 -0400)]
Uninitialized tmbuf.

Fix for Coverity perl5 CID 29088: Uninitialized scalar variable (UNINIT)
uninit_use: Using uninitialized value tmbuf.tm_year.

There is a code path that can lead to accessing uninitialized tmbuf:
when the too-small or too-large time inputs to gmtime/localtime
happen.

- make it so that the tm_year is used only on successful code path:
  pp_sys.c
- add the gmtime failed / localtime failed errors to perldiag:
  pod/perldiag.pod
- test those errors: t/op/time.t

7 years agofd closes for failure paths.
Jarkko Hietaniemi [Wed, 7 May 2014 13:30:35 +0000 (09:30 -0400)]
fd closes for failure paths.

Fix for Coverity perl5 CIDs 29053, 29055, 29057: Resource leak (RESOURCE_LEAK)
leaked_handle: Handle variable fd going out of scope leaks the handle.

7 years agoMake UINT64_C()/INT64_C() available anytime HAS_QUAD is defined
Tony Cook [Thu, 29 May 2014 04:39:26 +0000 (14:39 +1000)]
Make UINT64_C()/INT64_C() available anytime HAS_QUAD is defined

Prevent the failure for 32-bit builds on C89 compilers introduced in
f4e3fd268af3.

7 years agoRevert "Upgrade Digest::SHA from version 5.88 to 5.91"
Karl Williamson [Thu, 29 May 2014 01:19:03 +0000 (19:19 -0600)]
Revert "Upgrade Digest::SHA from version 5.88 to 5.91"

This reverts commit d3013bbfc3b14e06bdc794c44d15e95024343369,
because it is breaking blead compiles of C++ because it is using 'class'
as a formal parameter, and that is a reserved word in C++

7 years agoRevert "Upgrade Term::Cap from version 1.15 to 1.16"
Karl Williamson [Wed, 28 May 2014 23:15:30 +0000 (17:15 -0600)]
Revert "Upgrade Term::Cap from version 1.15 to 1.16"

This reverts commit 60d2b2aebfceab38ad669bac181bb68e42c05cb2.
because we are getting test failures in blead:

../cpan/podlators/t/basic.t                                     (Wstat: 256 Tests: 15 Failed: 1)
  Failed test:  15
  Non-zero exit status: 1
../cpan/podlators/t/termcap.t                                   (Wstat: 512 Tests: 4 Failed: 2)
  Failed tests:  3-4
  Non-zero exit status: 2

I only bisected the first test to this commit, but it seems likely that
the second test is from it too.  We'll know soon enough

7 years agoDoug Bell is now a perl author
Tony Cook [Tue, 13 May 2014 01:05:56 +0000 (11:05 +1000)]
Doug Bell is now a perl author

7 years agomove given/when ~~ note below item introducing it
Doug Bell [Tue, 13 May 2014 00:50:41 +0000 (10:50 +1000)]
move given/when ~~ note below item introducing it

The note explaining to use $c ~~ $_ instead of $_ ~~ $c was put under the item
introducing all binary operators, and not the one mentioning the explicit
smartmatch operator.

7 years agoFixes for running a clean minitest (at least in OS X). - detect POSIX locale support...
Jarkko Hietaniemi [Sat, 19 Apr 2014 19:38:40 +0000 (15:38 -0400)]
Fixes for running a clean minitest (at least in OS X). - detect POSIX locale support differently: t/op/lc.t, t/uni/fold.t - detect PerlIO::scalar differently: t/op/pwent.t - bail out earlier if no dscl: t/op/op/pwent.t - avoid wide character warning: t/op/tr.t

7 years agoGrammatical correction.
James E Keenan [Thu, 29 May 2014 01:04:05 +0000 (03:04 +0200)]
Grammatical correction.

7 years agoperldelta for e16b8d1b7d43, 32f4893f37f4
Tony Cook [Thu, 29 May 2014 00:48:04 +0000 (10:48 +1000)]
perldelta for e16b8d1b7d4332f4893f37f4

7 years agoFix RT #62052: Math::BigFloat -> bdiv() in list context
pjacklam [Tue, 15 Apr 2014 21:03:18 +0000 (23:03 +0200)]
Fix RT #62052: Math::BigFloat -> bdiv() in list context

In list context, Math::BigFloat -> bdiv() returns the quotient and remainder.
By convention, this means that the quotient and remainder, q and r, after
dividing x by y, satisfies x = q*y + r. The current behaviour is to return x/y
and r, which do not satisfy this relation, and - more importantly - is not what
people expect.

dist/Math-BigInt/lib/Math/BigFloat.pm: Patched to fix this bug.

t/bigfltpm.inc and t/upgrade.inc: Fixed test cases to match the new behaviour.

7 years agoFix RT #43692: Math::BigFloat -> blog() is sometimes incorrect
pjacklam [Tue, 15 Apr 2014 15:57:02 +0000 (17:57 +0200)]
Fix RT #43692: Math::BigFloat -> blog() is sometimes incorrect

dist/Math-BigInt/lib/Math/BigFloat.pm: Patched as suggested in RT #43692.
blog(x) would sometimes return blog(2*x) when the accuracy was greater than
70 digits.

t/biglog.t: Fixed incorrect use of ok(). Edited a test case so it fails without
this patch.

7 years agoperldelta for 945313f0aee2, c4885710b2c3
Tony Cook [Thu, 29 May 2014 00:18:32 +0000 (10:18 +1000)]
perldelta for 945313f0aee2c4885710b2c3

7 years agobump dist/Math-BigInt/ $VERSIONs
Tony Cook [Tue, 13 May 2014 00:21:57 +0000 (10:21 +1000)]
bump dist/Math-BigInt/ $VERSIONs

7 years agoSync Math-BigInt blead vs. CPAN
Peter John Acklam [Wed, 9 Apr 2014 09:46:01 +0000 (11:46 +0200)]
Sync Math-BigInt blead vs. CPAN

Some POD changes, and a version number increase for consistency between all
.pm files, were accidentally included in the CPAN release of Math-BigInt
before they were included in blead. This patch gets the modules in sync.

7 years agoAdd comment about tmpnam().
Jarkko Hietaniemi [Wed, 28 May 2014 18:11:12 +0000 (14:11 -0400)]
Add comment about tmpnam().

7 years ago[perl #121431] - Document test.valgrind in perlhacktips.pod
Matthew Horsfall (alh) [Wed, 28 May 2014 17:53:19 +0000 (13:53 -0400)]
[perl #121431] - Document test.valgrind in perlhacktips.pod

7 years agoFix for Coverity perl5 CID 29068: Insecure temporary file (SECURE_TEMP) secure_temp...
Jarkko Hietaniemi [Thu, 24 Apr 2014 16:23:18 +0000 (12:23 -0400)]
Fix for Coverity perl5 CID 29068: Insecure temporary file (SECURE_TEMP) secure_temp: Calling mkstemp() without securely setting umask first.

The umask used for mkstemp should be secure, but umask 0600 has been
the required umask only since POSIX.1-2008.  In glibc 2.06 and earlier
the default was 0666, which is not secure.  And no explicit knowledge
of how well non-glibc platforms implement mkstemp.  Better err on the
side security, so set the umask temporarily to 0600, and then restore it.

7 years agoAnnotate intentional case fallthrough, or add breaks.
Jarkko Hietaniemi [Sun, 4 May 2014 23:44:24 +0000 (19:44 -0400)]
Annotate intentional case fallthrough, or add breaks.

Fix suspicious (*) switch cases found by Coverity by
annotating with either "/* FALLTHROUGH */" or adding a break;

The FALLTHROUGH was much more common, but the break turned
out to be the right choice in three spots.  All changes tested
to work.

(*) suspicious = case1 + code + case2, and neither flow control
(like break) nor fallthrough annotation between code and case2.

Fix for Coverity perl5 CIDs 28977..28989, 45353.

7 years agoFix for Coverity perl5 CID 28936: Wrong operator used (CONSTANT_EXPRESSION_RESULT)
Jarkko Hietaniemi [Fri, 25 Apr 2014 12:25:52 +0000 (08:25 -0400)]
Fix for Coverity perl5 CID 28936: Wrong operator used (CONSTANT_EXPRESSION_RESULT)

operator_confusion: ret->flags | 0x10 is always 1/true regardless of
the values of its operand. This occurs as the logical first operand of '&&'.
Did you intend to use '&' rather than '|'?

(confirmed by Karl Williamson)

7 years agoslen may be uninitialized.
Jarkko Hietaniemi [Wed, 7 May 2014 13:25:04 +0000 (09:25 -0400)]
slen may be uninitialized.

Fix for Coverity perl5 CID 29081: Uninitialized scalar
variable (UNINIT) uninit_use_in_call: Using uninitialized value slen when
calling Perl_croak.

If all fails, slen hasn't been set, and croak will be called with that.

7 years agoLeaked string in failure path.
Jarkko Hietaniemi [Wed, 7 May 2014 13:22:16 +0000 (09:22 -0400)]
Leaked string in failure path.

Fix for Coverity perl5 CID 29058: Resource leak
(RESOURCE_LEAK) leaked_storage: Variable codeset going out of scope leaks the
storage it points to.

The savepv-ed codeset was not freed in failure path.
(The save_input_locale is freed just few lines later.)

7 years ago[perl #121976] - Fix typo in pod
Matthew Horsfall (alh) [Wed, 28 May 2014 17:03:10 +0000 (13:03 -0400)]
[perl #121976] - Fix typo in pod

7 years ago[perl #121431] Add support for test.valgrind parallel testing.
Matthew Horsfall (alh) [Thu, 13 Mar 2014 12:39:48 +0000 (05:39 -0700)]
[perl #121431] Add support for test.valgrind parallel testing.

Output for each test will be printed inline when it finishes.

Sample usage (loud):

  TEST_JOBS=9 make test.valgrind

Sample usage (quiet):

  VG_OPTS='-q --leak-check=no --show-reachable=no' TEST_JOBS=9 make test.valgrind

7 years agoMove the PERL_GCC_BRACE_GROUPS_FORBIDDEN earlier.
Jarkko Hietaniemi [Wed, 28 May 2014 16:46:05 +0000 (12:46 -0400)]
Move the PERL_GCC_BRACE_GROUPS_FORBIDDEN earlier.

The PERL_UNUSED_RESULT needs it to avoid using the brace groups
when going -pedantic.

7 years agoRemove +x from Term::ANSIColor test files.
Nicholas Clark [Wed, 28 May 2014 16:38:14 +0000 (18:38 +0200)]
Remove +x from Term::ANSIColor test files.

Commit 5e64492f6452260c seems to have accidentally changed the mode of the
files.

7 years agoBump module versions following commit 3800c3188602fdac.
Nicholas Clark [Wed, 28 May 2014 16:36:18 +0000 (18:36 +0200)]
Bump module versions following commit 3800c3188602fdac.

7 years agoUpdate Term-ANSIColor to CPAN version 4.03
Chris 'BinGOs' Williams [Wed, 28 May 2014 15:38:12 +0000 (16:38 +0100)]
Update Term-ANSIColor to CPAN version 4.03

  [DELTA]

Term::ANSIColor 4.03 (2014-03-23)

    Switch the module build system to Module::Build, but still generate a
    Makefile.PL file for backward compatibility and for the use of Perl
    core.

    Fix typo in SYNOPSIS (colorstrip example) and duplicated word.
    Thanks, Olivier MenguĂ© and David Steinbrunner.  (#85480, #94006)

    Skip POD and some other style tests unless doing automated or release
    testing.  Skip POD spelling, coverage, and Perl::Critic tests unless
    doing author testing.  Use the Lancaster Consensus environment
    variables instead of RRA_MAINTAINER_TESTS.  (#93474)

    Add SEE ALSO reference to Win32::Console::ANSI.  (#87295)

7 years agoUpdated META files for CPAN-Meta upgrade
Chris 'BinGOs' Williams [Wed, 28 May 2014 15:25:32 +0000 (16:25 +0100)]
Updated META files for CPAN-Meta upgrade

7 years agoUpdate CPAN-Meta to CPAN version 2.141170
Chris 'BinGOs' Williams [Wed, 28 May 2014 15:21:19 +0000 (16:21 +0100)]
Update CPAN-Meta to CPAN version 2.141170

  [DELTA]

2.141170  2014-04-27 13:03:37-04:00 America/New_York

  [ADDED]

  - Added ability for CPAN::Meta::Converter to convert metadata fragments
    (incomplete portions of a metadata structure)

  [CHANGED]

  - Optimized internal use of JSON for datastructure cloning

  [FIXED]

  - Removed dependency on List::Util 1.33

  [DOCUMENTED]

  - Clarified language around 'dynamic_config' in the Spec

7 years agoUpgrade Unicode::Normalize from version 1.17 to 1.18
Steve Hay [Wed, 28 May 2014 13:39:41 +0000 (14:39 +0100)]
Upgrade Unicode::Normalize from version 1.17 to 1.18

7 years agoUpgrade Unicode::Collate from version 1.04 to 1.07
Steve Hay [Wed, 28 May 2014 11:37:53 +0000 (12:37 +0100)]
Upgrade Unicode::Collate from version 1.04 to 1.07

7 years agoUpgrade Term::Cap from version 1.15 to 1.16
Steve Hay [Wed, 28 May 2014 11:31:16 +0000 (12:31 +0100)]
Upgrade Term::Cap from version 1.15 to 1.16

7 years agoUpgrade Digest::SHA from version 5.88 to 5.91
Steve Hay [Wed, 28 May 2014 13:28:13 +0000 (14:28 +0100)]
Upgrade Digest::SHA from version 5.88 to 5.91

7 years agoTrailing comma in enum is not C89.
Jarkko Hietaniemi [Wed, 28 May 2014 15:43:53 +0000 (11:43 -0400)]
Trailing comma in enum is not C89.

7 years agoUse STRUCT_OFFSET() instead raw C99 offsetof().
Jarkko Hietaniemi [Wed, 28 May 2014 15:32:34 +0000 (11:32 -0400)]
Use STRUCT_OFFSET() instead raw C99 offsetof().

That is, offsetof() is available only iff not C89 pedantic gcc.

(Socket.xs needs fixing, too, but it's cpan/Socket.)

7 years agog++ cleanups.
Jarkko Hietaniemi [Wed, 28 May 2014 15:09:23 +0000 (11:09 -0400)]
g++ cleanups.

regcomp.c:11083: warning: suggest a space before ';' or explicit braces around empty body in 'for' statement

locale.c:1113: warning: comparison between signed and unsigned integer expressions

7 years agoUINT64_C/INT64_C logic shuffling.
Jarkko Hietaniemi [Wed, 28 May 2014 14:41:16 +0000 (10:41 -0400)]
UINT64_C/INT64_C logic shuffling.

(1) Prefer the native int/long over long long (not in C89!) or __int64.
(2) Define them only if necessary, they might be defined in <stdint.h> by C99
(3) However, note the C99.  They might not be available in strict C89.
(4) In OS X they are defined with ULL/LL, which will not be
    to the liking of C89 pedantic gcc.

7 years agoUse UINT64_C for UV constants.
Jarkko Hietaniemi [Wed, 28 May 2014 13:32:34 +0000 (09:32 -0400)]
Use UINT64_C for UV constants.

7 years agoHide the VMS error identifier SS$_NOPRIV, as customary.
Jarkko Hietaniemi [Wed, 28 May 2014 13:24:14 +0000 (09:24 -0400)]
Hide the VMS error identifier SS$_NOPRIV, as customary.

7 years agoOff-by-one in PL_fold_locale use.
Jarkko Hietaniemi [Wed, 7 May 2014 13:19:00 +0000 (09:19 -0400)]
Off-by-one in PL_fold_locale use.

Fix for Coverity perl5 CID 29033: Out-of-bounds read
 (OVERRUN) overrun-local: Overrunning array PL_fold_locale of 256 bytes at
 byte offset 256 using index c1 (which evaluates to 256).

- the "c1 > 256" was off-by-one, it needed to be "c1 > 255",
  it could have caused the PL_fold_locale to be accessed one past the end,
  at offset 256, but we have dodged the bullet thanks to the regex engine
  optimizing the bad case away before we hit it (analysis by Karl Williamson):
  regexec.c
- comment fixes (pointed out by Karl Williamson): regexec.c
- add tests to nail down the behaviour of fold matching
  for the last of Latin-1 (0xFF, lowercase which curiously does not have
  uppercase within Latin-1). and the first pure Unicode: t/re/pat.t

7 years agoCannot rotl u32 (hek_hash) by 64 bits.
Jarkko Hietaniemi [Tue, 13 May 2014 12:18:05 +0000 (08:18 -0400)]
Cannot rotl u32 (hek_hash) by 64 bits.

Fix for Coverity perl5 CID 28935:
Operands don't affect result (CONSTANT_EXPRESSION_RESULT)
result_independent_of_operands: (unsigned long)entry->hent_hek->hek_hash >> 47 /* 64 - 17 */ is 0 regardless of the values of its operands. This occurs as the bitwise second operand of '|'.

7 years agofix sv_usepvn_flags's docs
Daniel Dragan [Wed, 14 May 2014 08:08:13 +0000 (04:08 -0400)]
fix sv_usepvn_flags's docs

Newx != malloc, mixing Newx and malloc leads to heap corruption on some
builds like Win32, use the official Perl API for allocating memory.