1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-24 20:06:11 +02:00

bisect--helper: verify HEAD could be parsed before continuing

In 06f5608c14 (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>
This commit is contained in:
Johannes Schindelin 2019-05-21 10:50:21 -07:00 committed by Junio C Hamano
parent aeb582a983
commit 7877ac3d7b

View File

@ -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;