The cmd_show loop resolves tags by showing them, then pointing the object to the 'tagged' member. However, this object is not fully initialized; it only contains the SHA1. (This resulted in a segfault if there were two levels of tags.) We apply parse_object to get a full object.
Noticed by Kalle Olavi Niemitalo on IRC.
Signed-off-by: Thomas Rast <trast@student.ethz.ch> ---
I'm not 100% sure this is the right fix; I just had a quick stab at the code, made a fix and tested it. It probably leaks memory too, not sure if this is a problem.
- Thomas
builtin-log.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Show changes to builtin-log.c +1 −1
diff --git a/builtin-log.c b/builtin-log.c index 9817d6f..9979e37 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -360,7 +360,7 @@ int cmd_show(int argc, const char **argv, const char *prefix) t->tag, diff_get_color_opt(&rev.diffopt, DIFF_RESET)); ret = show_object(o->sha1, 1, &rev); - objects[i].item = (struct object *)t->tagged; + objects[i].item = parse_object(t->tagged->sha1); i--; break; }
-- 1.5.6.1.246.g5fc88.dirty