|
|
f6ea51 |
From 62e6b70574842d7f2c547d33c85c50228522f685 Mon Sep 17 00:00:00 2001
|
|
|
f6ea51 |
From: Marc-Philip <marc-philip.werner@sap.com>
|
|
|
f6ea51 |
Date: Sun, 8 Apr 2018 12:15:29 -0600
|
|
|
f6ea51 |
Subject: [PATCH] PATCH: [perl #133074] 5.26.1: some coverity fixes
|
|
|
f6ea51 |
MIME-Version: 1.0
|
|
|
f6ea51 |
Content-Type: text/plain; charset=UTF-8
|
|
|
f6ea51 |
Content-Transfer-Encoding: 8bit
|
|
|
f6ea51 |
|
|
|
f6ea51 |
we have some coverity code scans here. They have found this
|
|
|
f6ea51 |
uninilialized variable in pp.c and the integer overrun in toke.c.
|
|
|
f6ea51 |
Though it might be possible that these are false positives (no
|
|
|
f6ea51 |
reasonable control path gets there), it's good to mute the scan here to
|
|
|
f6ea51 |
see the real problems easier.
|
|
|
f6ea51 |
|
|
|
f6ea51 |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
f6ea51 |
---
|
|
|
f6ea51 |
pp.c | 1 +
|
|
|
f6ea51 |
toke.c | 8 ++++----
|
|
|
f6ea51 |
2 files changed, 5 insertions(+), 4 deletions(-)
|
|
|
f6ea51 |
|
|
|
f6ea51 |
diff --git a/pp.c b/pp.c
|
|
|
f6ea51 |
index 5524131658..d777ae4309 100644
|
|
|
f6ea51 |
--- a/pp.c
|
|
|
f6ea51 |
+++ b/pp.c
|
|
|
f6ea51 |
@@ -3727,6 +3727,7 @@ PP(pp_ucfirst)
|
|
|
f6ea51 |
if (! slen) { /* If empty */
|
|
|
f6ea51 |
need = 1; /* still need a trailing NUL */
|
|
|
f6ea51 |
ulen = 0;
|
|
|
f6ea51 |
+ *tmpbuf = '\0';
|
|
|
f6ea51 |
}
|
|
|
f6ea51 |
else if (DO_UTF8(source)) { /* Is the source utf8? */
|
|
|
f6ea51 |
doing_utf8 = TRUE;
|
|
|
f6ea51 |
diff --git a/toke.c b/toke.c
|
|
|
f6ea51 |
index 3405dc6c89..fc87252bb1 100644
|
|
|
f6ea51 |
--- a/toke.c
|
|
|
f6ea51 |
+++ b/toke.c
|
|
|
f6ea51 |
@@ -9052,7 +9052,7 @@ S_pending_ident(pTHX)
|
|
|
f6ea51 |
HEK * const stashname = HvNAME_HEK(stash);
|
|
|
f6ea51 |
SV * const sym = newSVhek(stashname);
|
|
|
f6ea51 |
sv_catpvs(sym, "::");
|
|
|
f6ea51 |
- sv_catpvn_flags(sym, PL_tokenbuf+1, tokenbuf_len - 1, (UTF ? SV_CATUTF8 : SV_CATBYTES ));
|
|
|
f6ea51 |
+ sv_catpvn_flags(sym, PL_tokenbuf+1, tokenbuf_len > 0 ? tokenbuf_len - 1 : 0, (UTF ? SV_CATUTF8 : SV_CATBYTES ));
|
|
|
f6ea51 |
pl_yylval.opval = newSVOP(OP_CONST, 0, sym);
|
|
|
f6ea51 |
pl_yylval.opval->op_private = OPpCONST_ENTERED;
|
|
|
f6ea51 |
if (pit != '&')
|
|
|
f6ea51 |
@@ -9080,7 +9080,7 @@ S_pending_ident(pTHX)
|
|
|
f6ea51 |
&& PL_lex_state != LEX_NORMAL
|
|
|
f6ea51 |
&& !PL_lex_brackets)
|
|
|
f6ea51 |
{
|
|
|
f6ea51 |
- GV *const gv = gv_fetchpvn_flags(PL_tokenbuf + 1, tokenbuf_len - 1,
|
|
|
f6ea51 |
+ GV *const gv = gv_fetchpvn_flags(PL_tokenbuf + 1, tokenbuf_len > 0 ? tokenbuf_len - 1 : 0,
|
|
|
f6ea51 |
( UTF ? SVf_UTF8 : 0 ) | GV_ADDMG,
|
|
|
f6ea51 |
SVt_PVAV);
|
|
|
f6ea51 |
if ((!gv || ((PL_tokenbuf[0] == '@') ? !GvAV(gv) : !GvHV(gv)))
|
|
|
f6ea51 |
@@ -9097,11 +9097,11 @@ S_pending_ident(pTHX)
|
|
|
f6ea51 |
/* build ops for a bareword */
|
|
|
f6ea51 |
pl_yylval.opval = newSVOP(OP_CONST, 0,
|
|
|
f6ea51 |
newSVpvn_flags(PL_tokenbuf + 1,
|
|
|
f6ea51 |
- tokenbuf_len - 1,
|
|
|
f6ea51 |
+ tokenbuf_len > 0 ? tokenbuf_len - 1 : 0,
|
|
|
f6ea51 |
UTF ? SVf_UTF8 : 0 ));
|
|
|
f6ea51 |
pl_yylval.opval->op_private = OPpCONST_ENTERED;
|
|
|
f6ea51 |
if (pit != '&')
|
|
|
f6ea51 |
- gv_fetchpvn_flags(PL_tokenbuf+1, tokenbuf_len - 1,
|
|
|
f6ea51 |
+ gv_fetchpvn_flags(PL_tokenbuf+1, tokenbuf_len > 0 ? tokenbuf_len - 1 : 0,
|
|
|
f6ea51 |
(PL_in_eval ? GV_ADDMULTI : GV_ADD)
|
|
|
f6ea51 |
| ( UTF ? SVf_UTF8 : 0 ),
|
|
|
f6ea51 |
((PL_tokenbuf[0] == '$') ? SVt_PV
|
|
|
f6ea51 |
--
|
|
|
f6ea51 |
2.14.3
|
|
|
f6ea51 |
|