diff options
author | Johannes Schindelin <johannes.schindelin@gmx.de> | 2019-05-21 17:50:21 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-05-28 17:51:01 (GMT) |
commit | 7877ac3d7b8ae84981c9c2fa86a4f3701ade4510 (patch) | |
tree | cd055af4468045db9e353ebc0ff8adf067ac4f67 /builtin | |
parent | aeb582a98374c094361cba1bd756dc6307432c42 (diff) | |
download | git-7877ac3d7b8ae84981c9c2fa86a4f3701ade4510.zip git-7877ac3d7b8ae84981c9c2fa86a4f3701ade4510.tar.gz git-7877ac3d7b8ae84981c9c2fa86a4f3701ade4510.tar.bz2 |
bisect--helper: verify HEAD could be parsed before continuing
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/bisect--helper.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/bisect--helper.c b/builtin/bisect--helper.c index e7325fe..1fbe156 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; |