author | Brandon Casey <drafnel@gmail.com> | |
Mon, 27 Sep 2010 17:29:45 +0000 (12:29 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 27 Sep 2010 17:39:54 +0000 (10:39 -0700) | ||
commit | 6355e505bacf0a12a5de77bcd0c1198e74ad340b | |
tree | c1e13fda5177484fa34872ff4dc9cba2245f5df3 | tree | snapshot |
parent | 9027fa9eb7df606b6658dd48a40bb993ce222ddd | commit | diff |
builtin/revert.c: don't dereference a NULL pointer
cherry-pick will segfault when transplanting a root commit if the --ff
option is used. This happens because the "parent" pointer is set to NULL
when the commit being cherry-picked has no parents. Later, when "parent"
is dereferenced, the cherry-pick segfaults.
Fix this by checking whether "parent" is NULL before dereferencing it and
add a test for this case of cherry-picking a root commit with --ff.
Reported-by: Zbyszek Szmek <zbyszek@in.waw.pl>
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
cherry-pick will segfault when transplanting a root commit if the --ff
option is used. This happens because the "parent" pointer is set to NULL
when the commit being cherry-picked has no parents. Later, when "parent"
is dereferenced, the cherry-pick segfaults.
Fix this by checking whether "parent" is NULL before dereferencing it and
add a test for this case of cherry-picking a root commit with --ff.
Reported-by: Zbyszek Szmek <zbyszek@in.waw.pl>
Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/revert.c | diff | blob | history | |
t/t3506-cherry-pick-ff.sh | diff | blob | history |