New Defects reported by Coverity Scan for git
A message that is not in the archive (sent off-list or not yet received): [email protected]
Not sure what triggered the new finding of coverity as seen below as the parse_commit() was not touched. Junios series regarding the merge base optimization touches a bit of code nearby though.
Do we want to replace the unchecked places of parse_commit with parse_commit_or_die ?
Thanks,
Stefan
_________________________________________________________
*** CID 1374088: Error handling issues (CHECKED_RETURN) /commit.c: 913 in mark_redundant()
907
908 work = xcalloc(cnt, sizeof(*work)); 909 redundant = xcalloc(cnt, 1); 910 ALLOC_ARRAY(filled_index, cnt - 1);
911
912 for (i = 0; i < cnt; i++)
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
CID 1374088: Error handling issues (
CHECKED_RETURN)
Calling "parse_commit" without checking return value (as is done elsewhere 37 out of 45 times).
913 parse_commit(array[i]);
914 for (i = 0; i < cnt; i++) {
915 struct commit_list *common;
916
917 if (redundant[i])
918 continue;
Quoted 6 lines · Stefan Beller
Not sure what triggered the new finding of coverity as seen below as the
parse_commit()was not touched. Junios series regarding the merge base optimization touches a bit of code nearby though.Do we want to replace the unchecked places of
parse_commitwithparse_commit_or_die?
The reason parse_commit() would fail at this point would be because the repository is corrupt, I do not think it would hurt to do such a change.
I agree that it is curious why it shows up as a "new defect", though.
By the way, do you know who is managing the service on our end (e.g. approving new people to be "defect viewer")? The site seems to think I have the power to manage others' subscription, which I do not think I have (I do not go to the site myself). As it spewed quite a many false positives into my mailbox in the past, I do not pay very close attention to these reports these days, but I still read the e-mailed reports every once in a while.
Thanks.
Quoted 13 lines · Junio C Hamano
Quoted 6 lines · Stefan Beller
Not sure what triggered the new finding of coverity as seen below as the
parse_commit()was not touched. Junios series regarding the merge base optimization touches a bit of code nearby though.Do we want to replace the unchecked places of
parse_commitwithparse_commit_or_die?The reason
parse_commit()would fail at this point would be because the repository is corrupt, I do not think it would hurt to do such a change.
Quoted 5 lines
I agree that it is curious why it shows up as a "new defect", though.
By the way, do you know who is managing the service on our end (e.g. approving new people to be "defect viewer")?
I do it most of the time, but I did not start managing it. And I have been pretty lax/liberal about handing out rights to do stuff, because I did not want to tip on anyone's toes giving to few rights and thereby annoying them.
I see that some of these emails may be inconvenient to you, I can change your role to defect viewer/contributor if you prefer.
Thanks,
Stefan
Quoted 4 lines · Stefan Beller
I do it most of the time, but I did not start managing it. And I have been pretty lax/liberal about handing out rights to do stuff, because I did not want to tip on anyone's toes giving to few rights and thereby annoying them.
Good to know that you have been managing it; I was mostly worried about not having anybody managing it (i.e. imagining Coverity nominated/volunteered me as manager with everybody else as viewers) and the new viewer requests get totally ignored by the project as the whole.
Quoted 2 lines
I see that some of these emails may be inconvenient to you, I can change your role to defect viewer/contributor if you prefer.
It is not a huge inconvenience to me, because any piece of e-mail that is addressed directly to gitster@ without CC'ing to git@vger and is not a follow-up to any earlier message goes to a separate lowest-priority mailbox that I rarely look at. But if it is easy to recategorize me, please do so.
Thanks.
PATCH 1/1 commit parsing: replace unchecked parse_commit by parse_commit_or_die
The reason parse_commit() would fail at these points would be because the repository is corrupt.
This was noticed by coverity.
---
developed on pu as that's where coverity spotted it.
I have no overview if these areas are being worked on. (It may clash with at least jc/merge-base-fp-only)
Thanks,
Stefan
builtin/blame.c | 2 +- builtin/describe.c | 4 ++-- builtin/name-rev.c | 2 +- builtin/show-branch.c | 4 ++-- commit.c | 2 +- fetch-pack.c | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-)
builtin/blame.c +1 -1
@@ -1801,7 +1801,7 @@ static void assign_blame(struct scoreboard *sb, int opt)* so hold onto it in the meantime. */ origin_incref (suspect); -parse_commit (commit); +parse_commit_or_die (commit);if (reverse || (!(commit->object.flags &UNINTERESTING ) && !(revs->max_age !=-1 && commit->date < revs->max_age)))
builtin/describe.c +2 -2
@@ -199,7 +199,7 @@ static unsigned long finish_depth_computation( best->depth++;while (parents) {struct commit *p = parents->item; -parse_commit (p); +parse_commit_or_die (p);if (!(p->object.flags &SEEN ))commit_list_insert_by_date (p, list); p->object.flags |= c->object.flags;
@@ -322,7 +322,7 @@ static void describe(const char *arg, int last_one) }while (parents) {struct commit *p = parents->item; -parse_commit (p); +parse_commit_or_die (p);if (!(p->object.flags &SEEN ))commit_list_insert_by_date (p, &list); p->object.flags |= c->object.flags;
builtin/name-rev.c +1 -1
@@ -29,7 +29,7 @@ static void name_rev(struct commit *commit,struct commit_list *parents;int parent_number =1 ; -parse_commit (commit); +parse_commit_or_die (commit);if (commit->date < cutoff)return ;
builtin/show-branch.c +2 -2
@@ -218,7 +218,7 @@ static void join_revs(struct commit_list **list_p, parents = parents->next;if ((this_flag & flags) == flags)continue ; -parse_commit (p); +parse_commit_or_die (p);if (mark_seen (p, seen_p) && !still_interesting) extra--; p->object.flags |= flags;
@@ -835,7 +835,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)if (!commit)die (_ ("cannot find commit %s (%s)" ), ref_name[num_rev],oid_to_hex (&revkey)); -parse_commit (commit); +parse_commit_or_die (commit);mark_seen (commit, &seen);/* rev#0 uses bit REV_SHIFT, rev#1 uses bit REV_SHIFT+1,
commit.c +1 -1
@@ -910,7 +910,7 @@ static void mark_redundant(struct commit **array, int cnt)ALLOC_ARRAY (filled_index, cnt -1 );for (i =0 ; i < cnt; i++) -parse_commit (array[i]); +parse_commit_or_die (array[i]);for (i =0 ; i < cnt; i++) {struct commit_list *common;
fetch-pack.c +1 -1
@@ -159,7 +159,7 @@ static const unsigned char *get_rev(void)return NULL ; commit =prio_queue_get (&rev_list); -parse_commit (commit); +parse_commit_or_die (commit); parents = commit->parents; commit->object.flags |=POPPED ;
Signature · 1 line
2.10.1.448.g862ec83.dirty
Quoted 6 lines · Junio C Hamano
Good to know that you have been managing it; I was mostly worried about not having anybody managing it (i.e. imagining Coverity nominated/volunteered me as manager with everybody else as viewers) and the new viewer requests get totally ignored by the project as the whole.
No, I have been paying attention, but in case I suddenly stop contributing to the git project I thought it's better to have a couple of people there.
Quoted 9 lines
Quoted 3 lines
I see that some of these emails may be inconvenient to you, I can change your role to defect viewer/contributor if you prefer.
It is not a huge inconvenience to me, because any piece of e-mail that is addressed directly to gitster@ without CC'ing to git@vger and is not a follow-up to any earlier message goes to a separate lowest-priority mailbox that I rarely look at. But if it is easy to recategorize me, please do so.
done.
Quoted 7 lines · Stefan Beller
Quoted 2 lines
By the way, do you know who is managing the service on our end (e.g. approving new people to be "defect viewer")?
I do it most of the time, but I did not start managing it. And I have been pretty lax/liberal about handing out rights to do stuff, because I did not want to tip on anyone's toes giving to few rights and thereby annoying them.
I also do this, though I admit with more urgency when I recognize the name as somebody who has showed up on the git list.
I wish there was a flag to simply make the results public. There is no point in anybody logging in just to view them, but I don't think Coverity makes that an option.
-Peff
Quoted 5 lines · Jeff King
Quoted 3 lines · Stefan Beller
Quoted 2 lines
By the way, do you know who is managing the service on our end (e.g. approving new people to be "defect viewer")?
Quoted 7 lines
Quoted 4 lines
I do it most of the time, but I did not start managing it. And I have been pretty lax/liberal about handing out rights to do stuff, because I did not want to tip on anyone's toes giving to few rights and thereby annoying them.
I also do this, though I admit with more urgency when I recognize the name as somebody who has showed up on the git list.
Well, then huge thanks to both of you.
Quoted 3 lines · Stefan Beller
Not sure what triggered the new finding of coverity as seen below as the
parse_commit()was not touched. Junios series regarding the merge base optimization touches a bit of code nearby though.
I have noticed that "old" problems sometimes reappear when nearby code changes. I assume that they have some kind of heuristic to identify the location of a defect, that it probably includes the line number in the file, and that it can be fooled by too much code appearing nearby.
-Peff