* [PATCH 0/2] Fix two issues pointed out by Coverity
@ 2019-05-21 17:50 Johannes Schindelin via GitGitGadget
2019-05-21 17:50 ` [PATCH 1/2] rebase: replace incorrect logical negation by correct bitwise one Johannes Schindelin via GitGitGadget
2019-05-21 17:50 ` [PATCH 2/2] bisect--helper: verify HEAD could be parsed before continuing Johannes Schindelin via GitGitGadget
0 siblings, 2 replies; 4+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-05-21 17:50 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano
I looked very briefly over the issues pointed out by Coverity, and decided
to pluck these two low-hanging pieces of fruit.
Johannes Schindelin (2):
rebase: replace incorrect logical negation by correct bitwise one
bisect--helper: verify HEAD could be parsed before continuing
builtin/bisect--helper.c | 5 ++++-
builtin/rebase.c | 2 +-
2 files changed, 5 insertions(+), 2 deletions(-)
base-commit: aa25c82427ae70aebf3b8f970f2afd54e9a2a8c6
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-221%2Fdscho%2Faddress-coverity-reports-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-221/dscho/address-coverity-reports-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/221
--
gitgitgadget
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH 1/2] rebase: replace incorrect logical negation by correct bitwise one
2019-05-21 17:50 [PATCH 0/2] Fix two issues pointed out by Coverity Johannes Schindelin via GitGitGadget
@ 2019-05-21 17:50 ` Johannes Schindelin via GitGitGadget
2019-05-28 18:25 ` Junio C Hamano
2019-05-21 17:50 ` [PATCH 2/2] bisect--helper: verify HEAD could be parsed before continuing Johannes Schindelin via GitGitGadget
1 sibling, 1 reply; 4+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-05-21 17:50 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Johannes Schindelin
From: Johannes Schindelin <johannes.schindelin@gmx.de>
In bff014dac7d9 (builtin rebase: support the `verbose` and `diffstat`
options, 2018-09-04), we added a line that wanted to remove the
`REBASE_DIFFSTAT` bit from the flags, but it used an incorrect negation.
Found by Coverity.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
builtin/rebase.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/rebase.c b/builtin/rebase.c
index ba3a574e40..db6ca9bd7d 100644
--- a/builtin/rebase.c
+++ b/builtin/rebase.c
@@ -1203,7 +1203,7 @@ static int rebase_config(const char *var, const char *value, void *data)
if (git_config_bool(var, value))
opts->flags |= REBASE_DIFFSTAT;
else
- opts->flags &= !REBASE_DIFFSTAT;
+ opts->flags &= ~REBASE_DIFFSTAT;
return 0;
}
--
gitgitgadget
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] bisect--helper: verify HEAD could be parsed before continuing
2019-05-21 17:50 [PATCH 0/2] Fix two issues pointed out by Coverity Johannes Schindelin via GitGitGadget
2019-05-21 17:50 ` [PATCH 1/2] rebase: replace incorrect logical negation by correct bitwise one Johannes Schindelin via GitGitGadget
@ 2019-05-21 17:50 ` Johannes Schindelin via GitGitGadget
1 sibling, 0 replies; 4+ messages in thread
From: Johannes Schindelin via GitGitGadget @ 2019-05-21 17:50 UTC (permalink / raw)
To: git; +Cc: Junio C Hamano, Johannes Schindelin
From: Johannes Schindelin <johannes.schindelin@gmx.de>
In 06f5608c14e6 (bisect--helper: `bisect_start` shell function partially
in C, 2019-01-02), we introduced a call to `get_oid()` and did not check
whether it succeeded before using its output.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
builtin/bisect--helper.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c
index e7325fe37f..1fbe156e67 100644
--- a/builtin/bisect--helper.c
+++ b/builtin/bisect--helper.c
@@ -570,7 +570,10 @@ static int bisect_start(struct bisect_terms *terms, int no_checkout,
write_file(git_path_bisect_start(), "%s\n", start_head.buf);
if (no_checkout) {
- get_oid(start_head.buf, &oid);
+ if (get_oid(start_head.buf, &oid) < 0) {
+ retval = error(_("invalid ref: '%s'"), start_head.buf);
+ goto finish;
+ }
if (update_ref(NULL, "BISECT_HEAD", &oid, NULL, 0,
UPDATE_REFS_MSG_ON_ERR)) {
retval = -1;
--
gitgitgadget
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] rebase: replace incorrect logical negation by correct bitwise one
2019-05-21 17:50 ` [PATCH 1/2] rebase: replace incorrect logical negation by correct bitwise one Johannes Schindelin via GitGitGadget
@ 2019-05-28 18:25 ` Junio C Hamano
0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2019-05-28 18:25 UTC (permalink / raw)
To: Johannes Schindelin via GitGitGadget; +Cc: git, Johannes Schindelin
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> In bff014dac7d9 (builtin rebase: support the `verbose` and `diffstat`
> options, 2018-09-04), we added a line that wanted to remove the
> `REBASE_DIFFSTAT` bit from the flags, but it used an incorrect negation.
>
> Found by Coverity.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> builtin/rebase.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/builtin/rebase.c b/builtin/rebase.c
> index ba3a574e40..db6ca9bd7d 100644
> --- a/builtin/rebase.c
> +++ b/builtin/rebase.c
> @@ -1203,7 +1203,7 @@ static int rebase_config(const char *var, const char *value, void *data)
> if (git_config_bool(var, value))
> opts->flags |= REBASE_DIFFSTAT;
> else
> - opts->flags &= !REBASE_DIFFSTAT;
> + opts->flags &= ~REBASE_DIFFSTAT;
> return 0;
> }
Obviously correct. Thanks.
At this point in the codeflow, the .flags field is not touched by
parse_options() yet, the configuration codepath only touches that
field for REBASE_DIFFSTAT, and because REBASE_DIFFSTAT is not 0,
"[rebase] stat = no", which would want only the REBASE_DIFFSTAT bit
cleared in the word, can afford to instead assign 0 to the whole
word without causing any damage, which is funny way for this bug to
be hidden for a long time...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-05-28 18:25 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-21 17:50 [PATCH 0/2] Fix two issues pointed out by Coverity Johannes Schindelin via GitGitGadget
2019-05-21 17:50 ` [PATCH 1/2] rebase: replace incorrect logical negation by correct bitwise one Johannes Schindelin via GitGitGadget
2019-05-28 18:25 ` Junio C Hamano
2019-05-21 17:50 ` [PATCH 2/2] bisect--helper: verify HEAD could be parsed before continuing Johannes Schindelin via GitGitGadget
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).