]> git.ipfire.org Git - thirdparty/git.git/commit
sequencer: detect author name errors in read_author_script()
authorJeff King <peff@peff.net>
Mon, 3 Oct 2022 17:35:02 +0000 (13:35 -0400)
committerJunio C Hamano <gitster@pobox.com>
Mon, 3 Oct 2022 18:05:53 +0000 (11:05 -0700)
commit45350aeb11e0d8b5f76a121dfb9fc053af8e6042
treee6163c41dad76727a461c6f3bebe7997d88c23f8
parent359da658ae32d9a7e5e93ac173fc221352b62917
sequencer: detect author name errors in read_author_script()

As we parse the author-script file, we check for missing or duplicate
lines for GIT_AUTHOR_NAME, etc. But after reading the whole file, our
final error conditional checks "date_i" twice and "name_i" not at all.
This not only leads to us failing to abort, but we may do an
out-of-bounds read on the string_list array.

The bug goes back to 442c36bd08 (am: improve author-script error
reporting, 2018-10-31), though the code was soon after moved to this
spot by bcd33ec25f (add read_author_script() to libgit, 2018-10-31).
It was presumably just a typo in 442c36bd08.

We'll add test coverage for all the error cases here, though only the
GIT_AUTHOR_NAME ones fail (even in a vanilla build they segfault
consistently, but certainly with SANITIZE=address).

Reported-by: Michael V. Scovetta <michael.scovetta@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sequencer.c
t/t3438-rebase-broken-files.sh [new file with mode: 0755]