git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fix segfault for insane ident line

From
Jiang Xin <worldhello.net@gmail.com>
Date
Apr 25, 2013, 10:32 UTC
Message-ID
<cover.1366885748.git.worldhello.net@gmail.com>
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@bj.ossxp.com>
    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@bj.ossxp.com> <leiweiwei<leiww@bj.ossxp.com>> 1261964093 +0800
    committer leiweiwei<leiww@bj.ossxp.com> <leiweiwei<leiww@bj.ossxp.com>> 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@gmail.com>
    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@gmail.com>
        Signed-off-by: Junio C Hamano <gitster@pobox.com>
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
Next: Jiang Xin
Message 1 of 3 in “Fix segfault for insane ident line”
  1. Fix segfault for insane ident lineJiang Xin, Apr 25, 2013
  2. Fix segfault for insane ident lineJiang Xin, Apr 25, 2013
  3. Jiang XinApr 25, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.