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
5.26.1: some coverity findings in pp.c and toke.c #16495
Comments
From marc-philip.werner@sap.comCreated by marc-philip.werner@sap.comThis is a bug report for perl from marc-philip.werner@sap.com, ----------------------------------------------------------------- I'm attaching a patchfile. Best Regards Perl Info
|
From marc-philip.werner@sap.comcoverity_5.26.1.patchdiff -Naur perl-5.26.1.orig/pp.c perl-5.26.1/pp.c
--- perl-5.26.1.orig/pp.c 2017-08-23 20:22:51.000000000 +0000
+++ perl-5.26.1/pp.c 2017-11-27 15:18:24.000000000 +0000
@@ -3811,6 +3811,7 @@
if (! slen) { /* If empty */
need = 1; /* still need a trailing NUL */
ulen = 0;
+ *tmpbuf = '\0';
}
else if (DO_UTF8(source)) { /* Is the source utf8? */
doing_utf8 = TRUE;
diff -Naur perl-5.26.1.orig/toke.c perl-5.26.1/toke.c
--- perl-5.26.1.orig/toke.c 2017-07-18 23:00:00.000000000 +0000
+++ perl-5.26.1/toke.c 2017-11-27 15:33:36.000000000 +0000
@@ -8943,7 +8943,7 @@
HEK * const stashname = HvNAME_HEK(stash);
SV * const sym = newSVhek(stashname);
sv_catpvs(sym, "::");
- sv_catpvn_flags(sym, PL_tokenbuf+1, tokenbuf_len - 1, (UTF ? SV_CATUTF8 : SV_CATBYTES ));
+ sv_catpvn_flags(sym, PL_tokenbuf+1, tokenbuf_len > 0 ? tokenbuf_len - 1 : 0, (UTF ? SV_CATUTF8 : SV_CATBYTES ));
pl_yylval.opval = newSVOP(OP_CONST, 0, sym);
pl_yylval.opval->op_private = OPpCONST_ENTERED;
if (pit != '&')
@@ -8971,7 +8971,7 @@
&& PL_lex_state != LEX_NORMAL
&& !PL_lex_brackets)
{
- GV *const gv = gv_fetchpvn_flags(PL_tokenbuf + 1, tokenbuf_len - 1,
+ GV *const gv = gv_fetchpvn_flags(PL_tokenbuf + 1, tokenbuf_len > 0 ? tokenbuf_len - 1 : 0,
( UTF ? SVf_UTF8 : 0 ) | GV_ADDMG,
SVt_PVAV);
if ((!gv || ((PL_tokenbuf[0] == '@') ? !GvAV(gv) : !GvHV(gv)))
@@ -8988,11 +8988,11 @@
/* build ops for a bareword */
pl_yylval.opval = newSVOP(OP_CONST, 0,
newSVpvn_flags(PL_tokenbuf + 1,
- tokenbuf_len - 1,
+ tokenbuf_len > 0 ? tokenbuf_len - 1 : 0,
UTF ? SVf_UTF8 : 0 ));
pl_yylval.opval->op_private = OPpCONST_ENTERED;
if (pit != '&')
- gv_fetchpvn_flags(PL_tokenbuf+1, tokenbuf_len - 1,
+ gv_fetchpvn_flags(PL_tokenbuf+1, tokenbuf_len > 0 ? tokenbuf_len - 1 : 0,
(PL_in_eval ? GV_ADDMULTI : GV_ADD)
| ( UTF ? SVf_UTF8 : 0 ),
((PL_tokenbuf[0] == '$') ? SVt_PV
|
From marc-philip.werner@sap.comFrom: marc-philip.werner@sap.com This is a bug report for perl from marc-philip.werner@sap.com, Hi, I'm attaching a patchfile. Best Regards Flags: Site configuration information for perl 5.26.1: Configured by sap at Thu Dec 7 10:39:47 CET 2017. Summary of my perl5 (revision 5 version 26 subversion 1) configuration: @INC for perl 5.26.1: Environment for perl 5.26.1: |
From marc-philip.werner@sap.comcoverity_5.26.1.patchdiff -Naur perl-5.26.1.orig/pp.c perl-5.26.1/pp.c
--- perl-5.26.1.orig/pp.c 2017-08-23 20:22:51.000000000 +0000
+++ perl-5.26.1/pp.c 2017-11-27 15:18:24.000000000 +0000
@@ -3811,6 +3811,7 @@
if (! slen) { /* If empty */
need = 1; /* still need a trailing NUL */
ulen = 0;
+ *tmpbuf = '\0';
}
else if (DO_UTF8(source)) { /* Is the source utf8? */
doing_utf8 = TRUE;
diff -Naur perl-5.26.1.orig/toke.c perl-5.26.1/toke.c
--- perl-5.26.1.orig/toke.c 2017-07-18 23:00:00.000000000 +0000
+++ perl-5.26.1/toke.c 2017-11-27 15:33:36.000000000 +0000
@@ -8943,7 +8943,7 @@
HEK * const stashname = HvNAME_HEK(stash);
SV * const sym = newSVhek(stashname);
sv_catpvs(sym, "::");
- sv_catpvn_flags(sym, PL_tokenbuf+1, tokenbuf_len - 1, (UTF ? SV_CATUTF8 : SV_CATBYTES ));
+ sv_catpvn_flags(sym, PL_tokenbuf+1, tokenbuf_len > 0 ? tokenbuf_len - 1 : 0, (UTF ? SV_CATUTF8 : SV_CATBYTES ));
pl_yylval.opval = newSVOP(OP_CONST, 0, sym);
pl_yylval.opval->op_private = OPpCONST_ENTERED;
if (pit != '&')
@@ -8971,7 +8971,7 @@
&& PL_lex_state != LEX_NORMAL
&& !PL_lex_brackets)
{
- GV *const gv = gv_fetchpvn_flags(PL_tokenbuf + 1, tokenbuf_len - 1,
+ GV *const gv = gv_fetchpvn_flags(PL_tokenbuf + 1, tokenbuf_len > 0 ? tokenbuf_len - 1 : 0,
( UTF ? SVf_UTF8 : 0 ) | GV_ADDMG,
SVt_PVAV);
if ((!gv || ((PL_tokenbuf[0] == '@') ? !GvAV(gv) : !GvHV(gv)))
@@ -8988,11 +8988,11 @@
/* build ops for a bareword */
pl_yylval.opval = newSVOP(OP_CONST, 0,
newSVpvn_flags(PL_tokenbuf + 1,
- tokenbuf_len - 1,
+ tokenbuf_len > 0 ? tokenbuf_len - 1 : 0,
UTF ? SVf_UTF8 : 0 ));
pl_yylval.opval->op_private = OPpCONST_ENTERED;
if (pit != '&')
- gv_fetchpvn_flags(PL_tokenbuf+1, tokenbuf_len - 1,
+ gv_fetchpvn_flags(PL_tokenbuf+1, tokenbuf_len > 0 ? tokenbuf_len - 1 : 0,
(PL_in_eval ? GV_ADDMULTI : GV_ADD)
| ( UTF ? SVf_UTF8 : 0 ),
((PL_tokenbuf[0] == '$') ? SVt_PV
|
@khwilliamson - Status changed from 'new' to 'open' |
From @khwilliamsonThanks for the report and patch. Applied to blead as commit |
@khwilliamson - Status changed from 'open' to 'pending release' |
From @khwilliamsonOn 04/05/2018 09:35 PM, Marc-Philip (via RT) wrote:
This is a duplicate of #133073, I merged this into that |
From @khwilliamsonThank you for filing this report. You have helped make Perl better. With the release yesterday of Perl 5.28.0, this and 185 other issues have been Perl 5.28.0 may be downloaded via: If you find that the problem persists, feel free to reopen this ticket. |
@khwilliamson - Status changed from 'pending release' to 'resolved' |
Migrated from rt.perl.org#133073 (status was 'resolved')
Searchable as RT133073$
The text was updated successfully, but these errors were encountered: