[PATCH] Fix segfault for insane ident line

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Today when I push a long run repository, git complains:

    $ git push -u github master:doc-tech
    Counting objects: 5575, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (2560/2560), done.
    remote: error: object b798e3ffca56af58c2a7728d75027212a558b6d3:invalid author/committer line - missing space before email
    remote: fatal: Error in object
    error: pack-objects died of signal 13
    error: failed to push some refs to ...

When I check the commit, git will segfault:

    $ git show b798e3ffca56af58c2a7728d75027212a558b6d3
    Segmentation fault: 11

But git v1.8.1 works without difficulty, only with a suspect datetime.

    $ gitv1.8.1 log -1 b798e3ffca56af58c2a7728d75027212a558b6d3
    commit b798e3ffca56af58c2a7728d75027212a558b6d3
    Author: leiweiwei<leiww@xxxxxxxxxxxx>
    Date:   Thu Jan 1 00:00:00 1970 +0000
    
        add blog/typo.mm.

Detail of this commit. (Note that username and email is insane.)

    $ gitv1.8.1 cat-file commit b798e3ffca56af58c2a7728d75027212a558b6d3
    tree a1fcf9257bfbcd75f8c9aa931d1e89dbc60ae308
    parent 566f0a6489316db9c9dd12bfda51ffc75a24a9b0
    author leiweiwei<leiww@xxxxxxxxxxxx> <leiweiwei<leiww@xxxxxxxxxxxx>> 1261964093 +0800
    committer leiweiwei<leiww@xxxxxxxxxxxx> <leiweiwei<leiww@xxxxxxxxxxxx>> 1261964093 +0800
    
    add blog/typo.mm.

Because git v1.8.1 is good and v1.8.2 is bad, so I run a `git bisect` on it,
then I find this issue was was introduced in v1.8.1-rc1-7-g3c020bd.

    commit 3c020bd528d5dc320b82bd787670edfe6695f097
    Author: Antoine Pelisse <apelisse@xxxxxxxxx>
    Date:   Sat Jan 5 22:26:38 2013 +0100
    
        Use split_ident_line to parse author and committer
        
        Currently blame.c::get_acline(), pretty.c::pp_user_info() and
        shortlog.c::insert_one_record() are parsing author name, email, time
        and tz themselves.
        
        Use ident.c::split_ident_line() for better code reuse.
        
        Signed-off-by: Antoine Pelisse <apelisse@xxxxxxxxx>
        Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>

Backtrace for this segfault:

    (gdb) bt
    #0  0x00007fff8d8959ae in strtoul_l ()
    #1  0x000000010012da4a in pp_user_info ()
    #2  0x000000010012f811 in pp_header ()
    #3  0x000000010012f546 in pretty_print_commit ()
    #4  0x000000010010dd1f in show_log ()
    #5  0x000000010010e601 in log_tree_commit ()
    #6  0x00000001000565f1 in cmd_log_walk ()
    #7  0x0000000100056c5c in cmd_show ()
    #8  0x0000000100002710 in run_builtin ()
    #9  0x0000000100001717 in handle_internal_command ()
    #10 0x0000000100001f39 in run_argv ()
    #11 0x000000010000155d in main ()

This patch can fix it.

Jiang Xin (1):
  Fix segfault for insane ident line

 builtin/blame.c | 14 +++++++++++---
 pretty.c        |  9 +++++++--
 2 files changed, 18 insertions(+), 5 deletions(-)

-- 
1.8.2.1.348.gb94490b

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]