git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] git-check-ignore: Segmentation fault
@ 2013-02-19  5:24 Zoltan Klinger
  2013-02-19 13:40 ` Adam Spiers
  0 siblings, 1 reply; 27+ messages in thread
From: Zoltan Klinger @ 2013-02-19  5:24 UTC (permalink / raw)
  To: GIT Mailing-list; +Cc: Adam Spiers

Hi there,

The new git-check-ignore command seg faults when
    (1) it is called with single dot path name at $GIT_DIR level  _AND_
    (2) and .gitignore has at least one directory pattern.

Git version: 1.8.2.rc0.16.g20a599e

Reproduce the bug:
    $ git --version
    git version 1.8.2.rc0.16.g20a599e
    $ mkdir test
    $ cd test
    $ git init
    $ git check-ignore .  # All good, no errors here
    $ echo "dirpattern/" > .gitignore
    $ git check-ignore .
    Segmentation fault (core dumped)

The segmentation fault is actually caused by hash_name(const char
*name, int namelen) function in name-hash.c when the 'name' argument
is an empty stringi and namelen is 0.

The empty string comes from a call to the prefix_path(prefix, len,
path) function in setup.c. In this instance arguments 'prefix' is
NULL, 'len' is 0 and 'path' is "." .

Cheers,
Zoltan

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2013-02-22 17:24 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-19  5:24 [BUG] git-check-ignore: Segmentation fault Zoltan Klinger
2013-02-19 13:40 ` Adam Spiers
2013-02-19 14:06   ` [PATCH 1/2] t0008: document test_expect_success_multi Adam Spiers
2013-02-19 14:06     ` [PATCH 2/2] check-ignore.c: fix segfault with '.' argument from repo root Adam Spiers
2013-02-19 17:54       ` Junio C Hamano
2013-02-19 19:07         ` Adam Spiers
2013-02-19 19:21           ` [PATCH v2 2/2] check-ignore.c, dir.c: " Adam Spiers
2013-02-19 19:59             ` Junio C Hamano
2013-02-19 22:03               ` Junio C Hamano
2013-02-20  1:57                 ` Adam Spiers
2013-02-20  2:47                   ` Junio C Hamano
2013-02-20 12:43                     ` Adam Spiers
2013-02-20  1:30               ` Adam Spiers
2013-02-19 19:56           ` Re* [PATCH 2/2] check-ignore.c: " Junio C Hamano
2013-02-20  2:00             ` Adam Spiers
2013-02-20  2:53               ` Junio C Hamano
2013-02-20 10:47                 ` Adam Spiers
2013-02-21 20:15                   ` Junio C Hamano
2013-02-21 20:17                     ` [PATCH 1/2] format-patch: rename "no_inline" field Junio C Hamano
2013-02-21 20:26                     ` [PATCH 2/2] format-patch: --inline-single Junio C Hamano
2013-02-21 23:13                       ` Jeff King
2013-02-21 23:41                         ` Junio C Hamano
2013-02-21 23:47                           ` Junio C Hamano
2013-02-22 15:32                         ` Adam Spiers
2013-02-22 16:47                         ` Junio C Hamano
2013-02-22 17:23                           ` Jeff King
2013-02-19 17:37     ` [PATCH 1/2] t0008: document test_expect_success_multi Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).