| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
These macros are defined as NOOP outside USE_ITHREADS, so there's no
point in guarding them with it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
RT #130841
In general code, change this idiom:
PL_foo_max += size;
Renew(PL_foo, PL_foo_max, foo_t);
to
Renew(PL_foo, PL_foo_max + size, foo_t);
PL_foo_max += size;
so that if Renew dies, PL_foo_max won't be left hanging.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Due to the rewritten CRT in this version of Visual C++ it is no longer
possible (or at least not at all easy) to make use of the ioinfo struct,
which commit b47a847f62 (re-)introduced in order to fix RT#120091/118059.
Therefore, we effectively revert commit b47a847f62 for VS2015 onwards on
the basis that being able to build with VS2015 onwards is more important
than the RT#120091/118059 bug fix. This does unfortunately mean that perls
built with <=VS2013 will not be compatible with perls built with >=VS2015,
but they may well not have been compatible anyway because of the CRT
rewrite, and certainly wouldn't be compatible if perl builds with VS2015
were not supported!
See RT#125714 for more discussion about this.
|
|
|
|
| |
Except under cpan/ and dist/
|
|
|
|
| |
For: RT #130195
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
C++11 requires space between the end of a string literal and a macro, so
that a feature can unambiguously be added to the language. Starting in
g++ 6.2, the compiler emits a warning when there isn't a space
(presumably so that future versions can support C++11). Unfortunately
there are many such instances in the perl core. This commit fixes
those, including those in ext/, but individual commits will be used for
the other modules, those in dist/ and cpan/.
This commit also inserts space at the end of a macro before a string
literal, even though that is not deprecated, and removes useless ""
literals following a macro (instead of inserting a blank). The result
is easier to read, making the macro stand out, and be clearer as to the
intention.
Code and modules included with the Perl core need to be compilable using
C++. This is so that perl can be embedded in C++ programs. (Actually,
only the hdr files need to be so compilable, but it would be hard to
test that just the hdrs are compilable.) So we need to accommodate
changes to the C++ language.
|
|
|
|
|
|
|
| |
See thread starting at
<6E741FE88A7C4E428528A0AAAB94D735B65C65@DFLE10.ent.ti.com>
(The commiter made some white space changes to the patch)
|
|
|
|
| |
The return was returning after va_start but before va_end.
|
| |
|
|
|
|
|
| |
This includes under taint, just as other -D switches write to stderr
when taint is on.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
With commit v5.21.0-67-g60f7fc1, perl started setting umask to 0600
before calling mkstemp(3), and then restoring it afterwards. This is
wrong as it tells open(2) to strip the owner read and write bits from
the given mode before applying it, rather than the intended negation of
leaving only those bits in place.
On modern systems which call open(2) with mode 0600 in mkstemp(3),
this clears all the created temporary file permissions. However,
any systems that use mode 0666 in mkstemp(3) (like ancient versions
of glibc) now create a file with permissions 0066, leaving world
read and write permission regardless of current umask.
Using umask 0177 instead fixes this.
Bug: https://rt.perl.org/Ticket/Display.html?id=127322
|
|
|
|
|
|
|
|
| |
This patch uses the fdclose() function from FreeBSD if it
is available. It is based on the original patch supplied
by Mariusz Zaborski <oshogbo@FreeBSD.org> in the RT ticket.
The next patch will add Configure support for HAS_FDCLOSE.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Before: clang -Wthread-safety found the flow quite suspect:
one conditional mutex lock, with two conditional unlocks.
The code *looked* like the being okay logic-wise now, but
rather fragile, so let's make it clearer and more solid
by hoisting the locking earlier.
This is a fd close, this should not be a performance sensitive spot.
And it's in PerlIOStdio, so it should be pretty dead anyway.
perlio.c:3283:18: warning: mutex 'PL_perlio_mutex' is not held on every path through here [-Wthread-safety-analysis]
result = PerlSIO_fclose(stdio);
perlio.c:3299:6: warning: releasing mutex 'PL_perlio_mutex' that was not held [-Wthread-safety-analysis]
MUTEX_UNLOCK(&PL_perlio_mutex);
|
|
|
|
|
| |
perlio.c:2232:2: warning: releasing mutex 'PL_perlio_mutex' that was not held [-Wthread-safety-analysis]
MUTEX_UNLOCK(&PL_perlio_mutex);
|
|
|
|
|
|
| |
Under some circumstances IRIX stdio fgetc() and fread() set the errno
to ENOENT, which makes no sense according to either IRIX or POSIX docs.
Just clear such an errno.
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Configuring with perlio has been the only option since dd35fa16610
in 2011, first released in 5.16.0. Yet we have still have had all
this dead code for stdio support cluttering up the sources and
dulling the machetes of anyone who wants to do further work on
perlio or someone (like me) who just stumbles on some code that
looks like it needs fixing but isn't worth the time since the
compiler will never see it.
Leave a vestigial perlsdio.h since its presence is hard-coded in
a number of places.
|
|
|
|
|
|
| |
Coverity CID 104779.
Follow-up on Coverity CID 28973, and the respective commit 316ebaf2.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
An empty cpan/.dir-locals.el stops Emacs using the core defaults for
code imported from CPAN.
Committer's work:
To keep t/porting/cmp_version.t and t/porting/utils.t happy, $VERSION needed
to be incremented in many files, including throughout dist/PathTools.
perldelta entry for module updates.
Add two Emacs control files to MANIFEST; re-sort MANIFEST.
For: RT #124119.
|
|
|
|
| |
Extracted from patch submitted by Lajos Veres in RT #123693.
|
|
|
|
| |
In particular, remove all instances of 'assert(0);'.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This API elevates the amount of ABI compatibility protection between XS
modules and the interp. It also makes each boot XSUB smaller in machine
code by removing function calls and factoring out code into the new
Perl_xs_handshake and Perl_xs_epilog functions.
sv.c :
- revise padlist duping code to reduce code bloat/asserts on DEBUGGING
ext/DynaLoader/dlutils.c :
- disable version checking so interp startup is faster, ABI mismatches are
impossible because DynaLoader is never available as a shared library
ext/XS-APItest/XSUB-redefined-macros.xs :
- "" means dont check the version, so switch to " " to make the test in
xsub_h.t pass, see ML thread "XS_APIVERSION_BOOTCHECK and XS_VERSION
is CPP defined but "", mow what?"
ext/re/re.xs :
- disable API version checking until #123007 is resolved
ParseXS/Utilities.pm :
109-standard_XS_defs.t :
- remove context from S_croak_xs_usage similar to core commit cb077ed296 .
CvGV doesn't need a context until 5.21.4 and commit ae77754ae2 and
by then core's croak_xs_uage API has been long available and this
backport doesn't need to account for newer perls
- fix test where lack of having PERL_IMPLICIT_CONTEXT caused it to fail
|
|
|
|
|
|
| |
If f is NULL, SvPV and Perl_get_context are unnecessarily executed. Fix
it for efficiency. Move 2nd dTHX to the scope where it is first used
similar to commit 2bcd6579c4 .
|
| |
|
|
|
|
|
|
|
|
| |
but under -DPERL_GLOBAL_STRUCT_PRIVATE, most PerlIO_funcs objects
and pointers are const, so cast to match the function parameter.
This was broken by f814d560e84f which changed from looking up the
layer by the name in tab (or osLayer) to adding those directly.
|
|
|
|
|
|
|
|
|
|
| |
Obsolete as of commit fcf2db383b , prior to that commit, PerlIO_find_layer
was needed to convert a PerlIO_funcs * (var osLayer) to a SV * since
PL_def_layerlist wasn't a PerlIO_list_t * but a AV *. After that commit
PerlIO_find_layer returns a PerlIO_funcs *, and we start with a
PerlIO_funcs * (var osLayer), so PerlIO_find_layer is redundant.
Also _NN a stack arg for smaller code.
|
|
|
|
|
|
|
|
|
|
| |
IoIFP will be assigned to again in say_false block. This redundant code is
from commit 6e21c824d9 perl 4.0 patch 6.
in PerlIO_allocate replace a duplicate block with a goto
in PerlIO_resolve_layers replace a func call with a macro, this couldn't
have been using magic due to the previous SvROK
|
| |
|
|
|
|
|
|
|
|
| |
You need to configure with g++ *and* -Accflags=-DPERL_GLOBAL_STRUCT
or -Accflags=-DPERL_GLOBAL_STRUCT_PRIVATE to see any difference.
(g++ does not do the "post-annotation" form of "unused".)
The version code has some of these issues, reported upstream.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The same logic but with more safety checks is already defined for
PerlSIO_ungetc in iperlsys.h, so DRY says we should just use that.
Also, that definition in iperlsys.h really depends on the library
we are using, not the compiler. And there is only one viable C
library on VMS and it ships with the OS, so it's really just an
OS dependency.
N.B. While it may be something of a fool's errand to maintain the
stdio layer, deleting redundant code can only be a good thing,
possibly enabling further refactoring and clean-up.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The mode++ was essential in allowing 'rb' for the PerlIO_open() flags.
Without the mode++ the 'b' was left unprocessed and this caused
the oflags to become bogus.
Compress::Bzip2 caught this: https://rt.perl.org/Ticket/Display.html?id=122012
(also Unicode::Map8, Text::Scan, and otehrs)
While doing this, realized that for the "O_BINARY versus O_TEXT" it's
probably the clearest to test for the non-zero-ness of those two flags.
(Is there any "unit testing" of PerlIO? In this case it would be:
PerlIO_open -> PerlIO_openn -> PerlIOBuf_open -> PerlIOUnix_open ->
PerlIOUnix_oflags with mode of "rb")
|
|
|
|
|
|
|
| |
(1) Enhance its description.
(2) Simplify it: define only if has warn_unused_result.
(3) Make it use STMT_START { ... } STMT_END to be less GNU-extensiony.
(4) Redo 04783dc7 ("fix 'ignoring return value' compiler warnings") with it.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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';
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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
|
|
|
|
|
|
| |
Fix for Coverity perl5 CIDs 29203, 29207, 29211, 29214, 29217, 29218,
29222: Unused pointer value (UNUSED_VALUE) Pointer foo returned by
bar() is overwritten.
|
|
|
|
|
| |
Fix for Coverity perl5 CIDs 29053, 29055, 29057: Resource leak (RESOURCE_LEAK)
leaked_handle: Handle variable fd going out of scope leaks the handle.
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
|
|
| |
(RETURN_LOCAL) use_invalid: Using mode, which points to an out-of-scope variable tmode.
Duplicate the PerlIOBase_pushed call so that the tmode is in scope.
|
|
|
|
|
| |
This was mostly for XS functions defined in the core, but also
for a handful of functions in the :stdio layer.
|
|
|
|
| |
This was spotted by Daniel Dragan on the thread for #120591
|
|
|
|
|
| |
With this, open($fh, undef) will now work on systems without
a /tmp (or equivalent) where TMPDIR is not set.
|
|
|
|
|
|
|
|
|
|
|
| |
The last Perl release that built with -Dusesfio was v5.8.0, and even that
failed many regression tests. Every subsequent release fails to build, and
in the decade that has passed we have had no bug reports about this. So it's
safe to delete all the code. The Configure related code will be purged in a
subsequent commit.
2 references to sfio intentionally remain in fakesdio.h and nostdio.h, as
these appear to be for using its stdio API-compatibility layer.
|
|
|
|
|
|
|
| |
One hunk of commit de009b76d60bdeb8 (April 2005) makes a variable const,
which is then assigned to. This is in sfio-specific code, so was not noticed.
This change was merged to maint-5.8 as part of commit f1c3982b668c9e30 (Sep
2005).
|
|
|
|
|
|
|
|
|
|
|
| |
Various system functions like write() are marked with the
__warn_unused_result__ attribute, which causes an 'ignoring return value'
warning to be emitted, even if the function call result is cast to (void).
The generic solution seems to be
int rc = write(...);
PERL_UNUSED_VAR(rc);
|
|
|
|
|
|
|
| |
Actually, most of this commit is adding (void) to various function returns
where we know its ok to ignore the return value. This doesn't actually
silence the -Wunused-result warning (thanks a bundle gcc), but at least
it marks our intentions.
|