rev-parse: check lookup'ed commit references for NULL
Commits 2122f8b9 ("rev-parse: Add support for the ^! and ^@ syntax", 2008-07-26) and 3dd4e732 ("Teach rev-parse the ... syntax.", 2006-07-04) taught rev-parse new syntax, and used lookup_commit_reference() as part of their logic. Neither usage checked the returned commit to see if it was non-NULL before using it. Check for NULL and ensure an appropriate error is reported to the user. Reported by Florian Weimer and Todd Zullinger. Helped-by: NJeff King <peff@peff.net> Signed-off-by: NElijah Newren <newren@gmail.com> Reviewed-by: NJeff King <peff@peff.net> Signed-off-by: NJunio C Hamano <gitster@pobox.com>
Showing
想要评论请 注册 或 登录