Re: [PATCH v2] range-diff: don't segfault with mode-only changes

2019-10-09 Thread Uwe Kleine-König
would lead to range-diff segfaulting when there are mode-only changes > in a range. > > Move the error handling and completing of the struct into the > 'parse_git_diff_header' function, so other callers can take advantage > of it. This fixes the segfault in 'git range

Re: [PATCH v2] range-diff: don't segfault with mode-only changes

2019-10-08 Thread Johannes Schindelin
o range-diff segfaulting when there are mode-only changes > in a range. > > Move the error handling and completing of the struct into the > 'parse_git_diff_header' function, so other callers can take advantage > of it. This fixes the segfault in 'git range-diff'.

[PATCH v2] range-diff: don't segfault with mode-only changes

2019-10-08 Thread Thomas Gummerer
ng and completing of the struct into the 'parse_git_diff_header' function, so other callers can take advantage of it. This fixes the segfault in 'git range-diff'. Reported-by: Uwe Kleine-König Signed-off-by: Thomas Gummerer --- Thanks Junio and Dscho for your reviews. I decided to l

Re: [PATCH v2] upload-pack commit graph segfault fix

2019-09-12 Thread Taylor Blau
On Thu, Sep 12, 2019 at 10:41:22AM -0400, Jeff King wrote: > Here's a re-roll of my "disable commit graph more gently" fix. Versus > v1: Thanks for sending a re-roll. I deployed this out to all of our servers running git at GitHub, and it seems to be working fine. For what it's worth, I don't hav

Re: [PATCH v2] upload-pack commit graph segfault fix

2019-09-12 Thread Jeff King
On Thu, Sep 12, 2019 at 10:41:22AM -0400, Jeff King wrote: > Here's a re-roll of my "disable commit graph more gently" fix. Versus > v1: > > - I've included a preparatory patch that speeds up > prepare_commit_graph(). It's not strictly related, but there's a > textual dependency. It cou

[PATCH v2] upload-pack commit graph segfault fix

2019-09-12 Thread Jeff King
Here's a re-roll of my "disable commit graph more gently" fix. Versus v1: - I've included a preparatory patch that speeds up prepare_commit_graph(). It's not strictly related, but there's a textual dependency. It could be easily spun off to its own series. - a comment points out that

Re: git name-rev segfault

2019-07-29 Thread Tamas Papp
Thanks for letting me know and for the corrections too. Cheers, tamas On 7/29/19 9:50 PM, Jeff King wrote: On Mon, Jul 29, 2019 at 04:19:47PM +0200, Tamas Papp wrote: Generate 100k file into a repository: #!/bin/bash rm -rf .git test.file git init git config user.email a@b git config use

Re: git name-rev segfault

2019-07-29 Thread Jeff King
On Mon, Jul 29, 2019 at 04:19:47PM +0200, Tamas Papp wrote: > Generate 100k file into a repository: > > #!/bin/bash > > rm -rf .git test.file > git init > git config user.email a@b > git config user.name c > > time for i in {1..10} > do >   [ $((i % 2)) -eq 1 ] && echo $i>test.file || echo

git name-rev segfault

2019-07-29 Thread Tamas Papp
hi All, We ran into a segfault with all version of command line git. We are able to reproduce this issue by this way: Generate 100k file into a repository: #!/bin/bash rm -rf .git test.file git init git config user.email a@b git config user.name c time for i in {1..10} do   [ $((i % 2

Re: git segfault in tag verify (patch included)

2019-07-16 Thread Junio C Hamano
Jeff King writes: > Something like: > > for (line = buf; *line; line = next) { > next = strchrnul(line, '\n'); > > ... do stuff ... > /* find a space within the line */ > space = memchr(line, ' ', next - line); > } I am not sure about the memchr() thing, but "prepare

Re: git segfault in tag verify (patch included)

2019-07-16 Thread Jeff King
On Tue, Jul 16, 2019 at 11:20:48AM -0700, Junio C Hamano wrote: > That is this thing. > > static void parse_gpg_output(struct signature_check *sigc) > { > const char *buf = sigc->gpg_status; > const char *line, *next; > int i, j; >

Re: git segfault in tag verify (patch included)

2019-07-16 Thread Steven Roberts
Thanks. I hope this works ok for you (see attached). On Tue, Jul 16, 2019 at 11:20 AM Junio C Hamano wrote: > > Steven Roberts writes: > > > I believe I have found an off-by-one error in git. > > > > Please see https://marc.info/?l=openbsd-ports&m=156326783610123&w=2 > > That is this thing. > >

Re: git segfault in tag verify (patch included)

2019-07-16 Thread Junio C Hamano
Steven Roberts writes: > I believe I have found an off-by-one error in git. > > Please see https://marc.info/?l=openbsd-ports&m=156326783610123&w=2 That is this thing. static void parse_gpg_output(struct signature_check *sigc) { const char *buf = sigc->gpg_status

git segfault in tag verify (patch included)

2019-07-16 Thread Steven Roberts
Hi, I believe I have found an off-by-one error in git. Please see https://marc.info/?l=openbsd-ports&m=156326783610123&w=2

Re: new segfault in master (6a6c0f10a70a6eb1)

2019-05-11 Thread Duy Nguyen
On Sun, May 12, 2019 at 6:02 AM Jeff King wrote: > > On Sat, May 11, 2019 at 06:31:20PM -0400, Jeff King wrote: > > > On Sat, May 11, 2019 at 08:57:11PM +, Eric Wong wrote: > > > > > This test-tool submodule segfault seems new. Noticed it while > &g

Re: new segfault in master (6a6c0f10a70a6eb1)

2019-05-11 Thread Jeff King
On Sat, May 11, 2019 at 06:31:20PM -0400, Jeff King wrote: > On Sat, May 11, 2019 at 08:57:11PM +, Eric Wong wrote: > > > This test-tool submodule segfault seems new. Noticed it while > > checking dmesg for other things. > > Yeah, I hadn't seen it befo

Re: new segfault in master (6a6c0f10a70a6eb1)

2019-05-11 Thread Jeff King
On Sat, May 11, 2019 at 08:57:11PM +, Eric Wong wrote: > This test-tool submodule segfault seems new. Noticed it while > checking dmesg for other things. Yeah, I hadn't seen it before. It's almost certainly the expect_failure added in 2b1257e463 (t/helper: add test-submo

new segfault in master (6a6c0f10a70a6eb1)

2019-05-11 Thread Eric Wong
This test-tool submodule segfault seems new. Noticed it while checking dmesg for other things. There's also "name-rev HEAD~4000" (bottom), which is old, I think... Core was generated by `$WT/t/helper/test-tool submodule-nested-repo-config submodule sub'. Program terminated

[PATCH v3 3/8] commit-graph: fix segfault on e.g. "git status"

2019-03-25 Thread Ævar Arnfjörð Bjarmason
When core.commitGraph=true is set, various common commands now consult the commit graph. Because the commit-graph code is very trusting of its input data, it's possibly to construct a graph that'll cause an immediate segfault on e.g. "status" (and e.g. "log", &quo

[PATCH v3 0/8] commit-graph: segfault & other fixes for broken graphs

2019-03-25 Thread Ævar Arnfjörð Bjarmason
(8): commit-graph tests: split up corrupt_graph_and_verify() commit-graph tests: test a graph that's too small commit-graph: fix segfault on e.g. "git status" commit-graph: don't early exit(1) on e.g. "git status" commit-graph: don't pass filename to load_commit_graph

Re: [PATCH v2 0/8] commit-graph: segfault & other fixes for broken graphs

2019-03-15 Thread Ævar Arnfjörð Bjarmason
On Fri, Mar 15 2019, Eric Sunshine wrote: > On Thu, Mar 14, 2019 at 5:47 PM Ævar Arnfjörð Bjarmason > wrote: >> I fixed a test to avoid the pattern a0a630192d >> (t/check-non-portable-shell: detect "FOO=bar shell_func", 2018-07-13) >> tests for. The new pattern is more obvious. >> >> As an asid

Re: [PATCH v2 0/8] commit-graph: segfault & other fixes for broken graphs

2019-03-15 Thread Eric Sunshine
On Thu, Mar 14, 2019 at 5:47 PM Ævar Arnfjörð Bjarmason wrote: > I fixed a test to avoid the pattern a0a630192d > (t/check-non-portable-shell: detect "FOO=bar shell_func", 2018-07-13) > tests for. The new pattern is more obvious. > > As an aside I don't get how that doesn't work as intended from t

[PATCH v2 3/8] commit-graph: fix segfault on e.g. "git status"

2019-03-14 Thread Ævar Arnfjörð Bjarmason
When core.commitGraph=true is set, various common commands now consult the commit graph. Because the commit-graph code is very trusting of its input data, it's possibly to construct a graph that'll cause an immediate segfault on e.g. "status" (and e.g. "log", &quo

[PATCH v2 0/8] commit-graph: segfault & other fixes for broken graphs

2019-03-14 Thread Ævar Arnfjörð Bjarmason
8): commit-graph tests: split up corrupt_graph_and_verify() commit-graph tests: test a graph that's too small commit-graph: fix segfault on e.g. "git status" commit-graph: don't early exit(1) on e.g. "git status" commit-graph: don't pass filename to

[PATCH 3/8] commit-graph: fix segfault on e.g. "git status"

2019-02-21 Thread Ævar Arnfjörð Bjarmason
When core.commitGraph=true is set, various common commands now consult the commit graph. Because the commit-graph code is very trusting of its input data, it's possibly to construct a graph that'll cause an immediate segfault on e.g. "status" (and e.g. "log", &quo

[PATCH 0/8] commit-graph: segfault & other fixes for broken graphs

2019-02-21 Thread Ævar Arnfjörð Bjarmason
required for testing it (unless you're on NetBSD). Instrumenting the commit-graph tests reveals that if you have a broken commit-graph git will either segfault or abort early with cryptic errors on such basic commands as "status". Furthemore, if our graph is corrupt and we've s

Re: [PATCH v3] list-objects.c: don't segfault for missing cmdline objects

2018-12-05 Thread Junio C Hamano
Matthew DeVore writes: > When a command is invoked with both --exclude-promisor-objects, > --objects-edge-aggressive, and a missing object on the command line, > the rev_info.cmdline array could get a NULL pointer for the value of > an 'item' field. Prevent dereferencing of a NULL pointer in that

[PATCH v3] list-objects.c: don't segfault for missing cmdline objects

2018-12-05 Thread Matthew DeVore
When a command is invoked with both --exclude-promisor-objects, --objects-edge-aggressive, and a missing object on the command line, the rev_info.cmdline array could get a NULL pointer for the value of an 'item' field. Prevent dereferencing of a NULL pointer in that situation. Properly handle --ig

Re: [PATCH v2] list-objects.c: don't segfault for missing cmdline objects

2018-10-28 Thread Junio C Hamano
Matthew DeVore writes: > When a command is invoked with both --exclude-promisor-objects, > --objects-edge-aggressive, and a missing object on the command line, > the rev_info.cmdline array could get a NULL pointer for the value of > an 'item' field. Prevent dereferencing of a NULL pointer in that

[PATCH v2] list-objects.c: don't segfault for missing cmdline objects

2018-10-25 Thread Matthew DeVore
When a command is invoked with both --exclude-promisor-objects, --objects-edge-aggressive, and a missing object on the command line, the rev_info.cmdline array could get a NULL pointer for the value of an 'item' field. Prevent dereferencing of a NULL pointer in that situation. There are a few othe

[PATCH 0/3] Fix gc segfault

2018-10-16 Thread Jameson Miller via GitGitGadget
cc8aca797dbd7d2be3b67458ff880ed45cddf Published-As: https://github.com/gitgitgadget/git/releases/tags/pr-47%2Fjamill%2Ffix-gc-segfault-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-47/jamill/fix-gc-segfault-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/47 -- gitgitgadget

Re: [BUG] Segfault in "git submodule"

2018-10-01 Thread Raymond Jennings
I instructed downstream to update their repository. On Mon, Oct 1, 2018 at 2:31 PM Raymond Jennings wrote: > > Yes, git 2.16.4 to be exact. > > I upgraded to 2.19 after ~arch keywording the package on gentoo and > that fixed it. > On Mon, Oct 1, 2018 at 12:19 PM Stefan Beller wrote: > > > > On Sa

Re: [BUG] Segfault in "git submodule"

2018-10-01 Thread Raymond Jennings
Yes, git 2.16.4 to be exact. I upgraded to 2.19 after ~arch keywording the package on gentoo and that fixed it. On Mon, Oct 1, 2018 at 12:19 PM Stefan Beller wrote: > > On Sat, Sep 29, 2018 at 9:43 AM Raymond Jennings wrote: > > > > I have a repo, but it appears to be specific to staging area st

Re: [BUG] Segfault in "git submodule"

2018-10-01 Thread Stefan Beller
On Sat, Sep 29, 2018 at 9:43 AM Raymond Jennings wrote: > > I have a repo, but it appears to be specific to staging area state. > It only segfaults when I have a certain file deleted. > > Where do you want me to upload it? > On Sat, Sep 29, 2018 at 8:34 AM Duy Nguyen wrote: > > > > On Sat, Sep 29

Re: [BUG] Segfault in "git submodule"

2018-09-29 Thread Raymond Jennings
I have a repo, but it appears to be specific to staging area state. It only segfaults when I have a certain file deleted. Where do you want me to upload it? On Sat, Sep 29, 2018 at 8:34 AM Duy Nguyen wrote: > > On Sat, Sep 29, 2018 at 5:31 PM Ævar Arnfjörð Bjarmason > wrote: > > > #1 refs_resol

Re: [BUG] Segfault in "git submodule"

2018-09-29 Thread Duy Nguyen
On Sat, Sep 29, 2018 at 5:31 PM Ævar Arnfjörð Bjarmason wrote: > > #1 refs_resolve_ref_unsafe (refs=0x0, > > refname=refname@entry=0x55e863062253 "HEAD", > > resolve_flags=resolve_flags@entry=1, oid=oid@entry=0x7ffdc834b1c0, > > flags=flags@entry=0x7ffdc834b1bc) at refs.c:1493 refs is NULL. It l

Re: [BUG] Segfault in "git submodule"

2018-09-29 Thread Ævar Arnfjörð Bjarmason
On Sat, Sep 29 2018, Raymond Jennings wrote: > [New LWP 19644] > [Thread debugging using libthread_db enabled] > Using host libthread_db library "/lib64/libthread_db.so.1". > Core was generated by `git submodule--helper status'. > Program terminated with signal SIGSEGV, Segmentation fault. > #0

[BUG] Segfault in "git submodule"

2018-09-29 Thread Raymond Jennings
[New LWP 19644] [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib64/libthread_db.so.1". Core was generated by `git submodule--helper status'. Program terminated with signal SIGSEGV, Segmentation fault. #0 refs_read_raw_ref (type=, referent=, oid=, refname=, ref_st

Re: Segfault in master due to 4fbcca4eff

2018-09-21 Thread Ævar Arnfjörð Bjarmason
On Fri, Sep 21 2018, Jeff King wrote: > On Sat, Sep 22, 2018 at 01:37:17AM +0200, Ævar Arnfjörð Bjarmason wrote: > >> > Thanks, both of you ;-). I was aware of the issue and proposed fix >> > but forgot about it when merging things down to 'master'. Sorry >> > about that. >> >> Just a follow-

Re: Segfault in master due to 4fbcca4eff

2018-09-21 Thread Jeff King
On Sat, Sep 22, 2018 at 01:37:17AM +0200, Ævar Arnfjörð Bjarmason wrote: > > Thanks, both of you ;-). I was aware of the issue and proposed fix > > but forgot about it when merging things down to 'master'. Sorry > > about that. > > Just a follow-up question, in your merge commit you just pushed

Re: Segfault in master due to 4fbcca4eff

2018-09-21 Thread Ævar Arnfjörð Bjarmason
0bf9103c-9377-506b-7ad7-e5273d8e9...@gmail.com/T/#u >>>> >>>> [2] https://public-inbox.org/git/pull.39.git.gitgitgad...@gmail.com/ >>>> >>>> [3] >>>> https://public-inbox.org/git/8d6061de-1654-577c-40c6-211dbd03a...@gmail.com/ >>>

Re: Segfault in master due to 4fbcca4eff

2018-09-21 Thread Junio C Hamano
-inbox.org/git/pull.39.git.gitgitgad...@gmail.com/ >>> >>> [3] >>> https://public-inbox.org/git/8d6061de-1654-577c-40c6-211dbd03a...@gmail.com/ >> Thanks and sorry for the duplicate report. I can confirm that applying >> the v2 of that fixes the segfault for the tes

Re: Segfault in master due to 4fbcca4eff

2018-09-21 Thread Derrick Stolee
that applying the v2 of that fixes the segfault for the test case I posted. Thanks for the report! You are a good dogfooder. Thanks, -Stolee

Re: Segfault in master due to 4fbcca4eff

2018-09-21 Thread Ævar Arnfjörð Bjarmason
upload-pack: make reachable() more generic >>> + commit-reach: move commit_contains from ref-filter >>> + commit-reach: move ref_newer from remote.c >>> + commit.h: remove method declarations >>> + commit-reach: move walk methods from commit.c >>> >

Re: Segfault in master due to 4fbcca4eff

2018-09-21 Thread Derrick Stolee
ained a bunch of new tests to cover them, and then being improved. There's a segfault now in master when fetching because of 4fbcca4eff ("commit-reach: make can_all_from_reach... linear", 2018-07-20). I have not had time to debug this, or found an easy isolated test case, but this sc

Segfault in master due to 4fbcca4eff

2018-09-21 Thread Ævar Arnfjörð Bjarmason
ory reachability has been shuffled, > obtained a bunch of new tests to cover them, and then being > improved. There's a segfault now in master when fetching because of 4fbcca4eff ("commit-reach: make can_all_from_reach... linear", 2018-07-20). I have not had time to debug

[PATCHv2 0/2] Fix rerere segfault with specially crafted merge

2018-09-11 Thread Elijah Newren
This series documents and fixes a rerere segfault (dating back to git-2.7.0) when a merge strategy makes the last entry in the index be at stage 1. Changes since last version: - In my last submission I only had the code fix and no testcase; I even commented in the commit message that the

[PATCHv2 1/2] t4200: demonstrate rerere segfault on specially crafted merge

2018-09-11 Thread Elijah Newren
Signed-off-by: Elijah Newren --- t/t4200-rerere.sh | 29 + 1 file changed, 29 insertions(+) diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh index 65da74c766..f9294b7677 100755 --- a/t/t4200-rerere.sh +++ b/t/t4200-rerere.sh @@ -577,4 +577,33 @@ test_expect_success

Re: [PATCH 2/3] t/helper/test-delta: segfault on OOB access

2018-08-29 Thread Jeff King
On Wed, Aug 29, 2018 at 05:46:21PM -0400, Jeff King wrote: > > I think even with ASAN, you'd still need read_in_full() or an mmap() > > wrapper that fiddles with the ASAN shadow, because mmap() always maps > > whole pages: > > > > $ cat mmap-read-asan-blah.c > > #include > > #include > > int ma

Re: [PATCH 2/3] t/helper/test-delta: segfault on OOB access

2018-08-29 Thread Jeff King
On Wed, Aug 29, 2018 at 11:40:41PM +0200, Jann Horn wrote: > > If we want to detect this kind of thing in tests, we should probably be > > relying on tools like ASan, which would cover all mmaps. > > > > It would be nice if there was a low-cost way to detect this in > > production use, but it look

Re: [PATCH 2/3] t/helper/test-delta: segfault on OOB access

2018-08-29 Thread Jann Horn
On Wed, Aug 29, 2018 at 11:34 PM Jeff King wrote: > > On Wed, Aug 29, 2018 at 10:58:56PM +0200, Jann Horn wrote: > > > This ensures that any attempts to access memory directly after the input > > buffer or delta buffer in a delta test will cause a segmentation fault. > > > > Inspired by vsftpd. >

Re: [PATCH 2/3] t/helper/test-delta: segfault on OOB access

2018-08-29 Thread Jeff King
On Wed, Aug 29, 2018 at 10:58:56PM +0200, Jann Horn wrote: > This ensures that any attempts to access memory directly after the input > buffer or delta buffer in a delta test will cause a segmentation fault. > > Inspired by vsftpd. Neat trick, but it seems funny to protect this one buffer in non

[PATCH 2/3] t/helper/test-delta: segfault on OOB access

2018-08-29 Thread Jann Horn
This ensures that any attempts to access memory directly after the input buffer or delta buffer in a delta test will cause a segmentation fault. Inspired by vsftpd. Signed-off-by: Jann Horn --- t/helper/test-delta.c | 78 +-- 1 file changed, 53 insertions

Re: [BUG] 'git ls-files --no-exclude' segfault & co

2018-08-06 Thread Jeff King
On Mon, Aug 06, 2018 at 06:07:06PM +0200, SZEDER Gábor wrote: > 'git ls-files' has the options '--exclude', '--exclude-from', > '--exclude-per-directory', and '--exclude-standard', which all work > fine. However, it also allows the negated version of all these four > options, and they definitely

[BUG] 'git ls-files --no-exclude' segfault & co

2018-08-06 Thread SZEDER Gábor
'git ls-files' has the options '--exclude', '--exclude-from', '--exclude-per-directory', and '--exclude-standard', which all work fine. However, it also allows the negated version of all these four options, and they definitely don't work very well: $ git ls-files --no-exclude Segmentation fau

Re: BUG: Segfault on "git pull" on "bad object HEAD"

2018-07-11 Thread Junio C Hamano
Jeff King writes: > So I feel like the right answer here is probably this: > > diff --git a/wt-status.c b/wt-status.c > index d1c05145a4..5fcaa3d0f8 100644 > --- a/wt-status.c > +++ b/wt-status.c > @@ -2340,7 +2340,16 @@ int has_uncommitted_changes(int ignore_submodules) > if (ignore_submod

Re: BUG: Segfault on "git pull" on "bad object HEAD"

2018-07-11 Thread Duy Nguyen
.8.0 (didn't test back > further). I'm not familiar with the status / diff code, so I'm not sure > where the assertion should be added. > > This came up in the wild due to a user with a corrupt repo (don't know > how it got corrupt) trying "git pull" and seeing git segfault. -- Duy

Re: BUG: Segfault on "git pull" on "bad object HEAD"

2018-07-11 Thread Jeff King
On Wed, Jul 11, 2018 at 01:00:57PM +0200, Ævar Arnfjörð Bjarmason wrote: > This segfaults, but should print an error instead, have a repo with a > corrupt HEAD: > > ( > rm -rf /tmp/git && > git clone --single-branch --branch todo g...@github.com:git/git.git > /tmp/git && >

BUG: Segfault on "git pull" on "bad object HEAD"

2018-07-11 Thread Ævar Arnfjörð Bjarmason
lloc = 0, objects = 0x0} (gdb) This has been an issue since at least v2.8.0 (didn't test back further). I'm not familiar with the status / diff code, so I'm not sure where the assertion should be added. This came up in the wild due to a user with a corrupt repo (don't know how it got corrupt) trying "git pull" and seeing git segfault.

Re: BUG: rev-parse segfault with invalid input

2018-05-23 Thread Todd Zullinger
Hi, Elijah Newren wrote: > Thanks for the detailed report. This apparently goes back to > git-1.6.0 with commit 2122f8b963d4 ("rev-parse: Add support for the ^! > and ^@ syntax", 2008-07-26). We aren't checking that the commit from > lookup_commit_reference() is non-NULL before proceeding. Look

Re: BUG: rev-parse segfault with invalid input

2018-05-23 Thread Elijah Newren
On Wed, May 23, 2018 at 12:52 PM, Todd Zullinger wrote: > Hi, > > Certain invalid input causes git rev-parse to crash rather > than return a 'fatal: ambiguous argument ...' error. > > This was reported against the Fedora git package: > > https://bugzilla.redhat.com/1581678 > > Simple reproduct

BUG: rev-parse segfault with invalid input

2018-05-23 Thread Todd Zullinger
Hi, Certain invalid input causes git rev-parse to crash rather than return a 'fatal: ambiguous argument ...' error. This was reported against the Fedora git package: https://bugzilla.redhat.com/1581678 Simple reproduction recipe and analysis, from the bug: $ git init Initialized em

Re: [PATCH 0/2] fix a segfault in get_main_ref_store()

2018-05-18 Thread Johannes Schindelin
Hi Peff, On Fri, 18 May 2018, Jeff King wrote: > I stumbled across a BUG() today. But interestingly, in the current tip > of master it actually segfaults instead! This fixes the segfault (back > into a BUG(), and then fixes the caller to avoid the BUG() in the first > place).

[PATCH 0/2] fix a segfault in get_main_ref_store()

2018-05-18 Thread Jeff King
I stumbled across a BUG() today. But interestingly, in the current tip of master it actually segfaults instead! This fixes the segfault (back into a BUG(), and then fixes the caller to avoid the BUG() in the first place). [1/2]: get_main_ref_store: BUG() when outside a repository [2/2

Re: [PATCH] git-svn: control destruction order to avoid segfault

2018-01-30 Thread Junio C Hamano
romising. > > Thanks for confirming it works on other systems. > Pull request and patch below: > > The following changes since commit 5be1f00a9a701532232f57958efab4be8c959a29: > > First batch after 2.16 (2018-01-23 13:21:10 -0800) > > are available in the Git repository a

[PATCH] git-svn: control destruction order to avoid segfault

2018-01-29 Thread Eric Wong
other systems. Pull request and patch below: The following changes since commit 5be1f00a9a701532232f57958efab4be8c959a29: First batch after 2.16 (2018-01-23 13:21:10 -0800) are available in the Git repository at: git://bogomips.org/git-svn.git svn-branch-segfault

Re: [PATCH] mailinfo: avoid segfault when can't open files

2018-01-24 Thread Jeff King
On Wed, Jan 24, 2018 at 01:51:31PM -0300, Juan F. Codagnone wrote: > > As for the patch itself, it looks correct but I saw two style nits: > > Thanks for the detailed review! I'm sorry about the style nits. I > focused on the tabs and braces. Next time I will take additional > attention. No prob

[PATCH v1] mailinfo: avoid segfault when can't open files

2018-01-24 Thread Juan F. Codagnone
If or files can't be opened, then mailinfo() returns an error before it even initializes mi->p_hdr_data or mi->s_hdr_data. When cmd_mailinfo() then calls clear_mailinfo(), we dereference the NULL pointers trying to free their contents. Signed-off-by: Juan F. Codagnone Reviewed-by: Jeff King --

Re: [PATCH] mailinfo: avoid segfault when can't open files

2018-01-24 Thread Juan F. Codagnone
On Wed, Jan 24, 2018 at 1:02 AM, Jeff King wrote: > > On Tue, Jan 23, 2018 at 11:54:17PM -0300, Juan F. Codagnone wrote: ... > > > But given the lack of callers, it may not be worth the effort. So I'm OK > with this solution. It may be worth giving an abbreviated version of the > above explanation

Re: [PATCH] mailinfo: avoid segfault when can't open files

2018-01-23 Thread Jeff King
On Tue, Jan 23, 2018 at 11:54:17PM -0300, Juan F. Codagnone wrote: > If or files can't be opened, clear_mailinfo crash as > it follows NULL pointers. > > Can be reproduced using `git mailinfo . .` Thanks for finding this. Looking at the offending code and your solution, it looks like: 1. m

[PATCH] mailinfo: avoid segfault when can't open files

2018-01-23 Thread Juan F. Codagnone
If or files can't be opened, clear_mailinfo crash as it follows NULL pointers. Can be reproduced using `git mailinfo . .` Signed-off-by: Juan F. Codagnone --- mailinfo.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/mailinfo.c b/mailinfo.c index a89db22ab..035

[PATCH] bisect: fix a regression causing a segfault

2018-01-03 Thread Ævar Arnfjörð Bjarmason
In 7c117184d7 ("bisect: fix off-by-one error in `best_bisection_sorted()`", 2017-11-05) the more careful logic dealing with freeing p->next in 50e62a8e70 ("rev-list: implement --bisect-all", 2007-10-22) was removed. Restore the more careful check to avoid segfaulting. Ideally this would come with

Re: Segfault

2018-01-02 Thread Andrew Tsykhonya
I made: $git stash $git checkout $git stash pop - crash here. changes were applied, but index.lock was not removed. The issue appeared only once, I haven't seen it before and cannot reproduce it now. Thanks, updated git to 2.15.1. 2017-12-31 10:59 GMT+02:00 Eric Sunshine : > On Fri, Dec 29, 201

Re: Segfault

2017-12-31 Thread Eric Sunshine
On Fri, Dec 29, 2017 at 4:04 AM, Andrew Tsykhonya wrote: > git stash pop resulted in crash: > /usr/local/Cellar/git/2.10.2/libexec/git-core/git-stash: line 470: > 14946 Segmentation fault: 11 git merge-recursive $b_tree -- $c_tree > $w_tree > although, the changes have been applied successfully.

Segfault

2017-12-29 Thread Andrew Tsykhonya
git stash pop resulted in crash: /usr/local/Cellar/git/2.10.2/libexec/git-core/git-stash: line 470: 14946 Segmentation fault: 11 git merge-recursive $b_tree -- $c_tree $w_tree although, the changes have been applied successfully.

[PATCH v2 2/2] grep: fix segfault under -P + PCRE2 <=10.30 + (*NO_JIT)

2017-11-23 Thread Ævar Arnfjörð Bjarmason
Fix a bug in the compilation of PCRE2 patterns under JIT (the most common runtime configuration). Any pattern with a (*NO_JIT) verb would segfault in any currently released PCRE2 version: $ git grep -P '(*NO_JIT)hi.*there' Segmentation fault That this segfaulted was a bug in PC

Re: [PATCH 2/2] grep: fix segfault under -P + PCRE2 + (*NO_JIT)

2017-11-23 Thread Ævar Arnfjörð Bjarmason
On Wed, Nov 22 2017, Eric Sunshine jotted: > On Wed, Nov 22, 2017 at 8:36 AM, Ævar Arnfjörð Bjarmason > wrote: >> Fix a bug in the compilation of PCRE2 patterns under JIT (the most >> common runtime configuration), any pattern with a (*NO_JIT) verb would >> segfault. T

Re: [PATCH 2/2] grep: fix segfault under -P + PCRE2 + (*NO_JIT)

2017-11-23 Thread Simon Ruderich
ith 0. If we > + * then proceed to call pcre2_jit_match() further down > + * the line instead of pcre2_match() we'll segfault. > + */ > + patinforet = pcre2_pattern_info(p->pcre2_pattern, > PCRE2_INFO_JITSIZE, &jits

Re: [PATCH 2/2] grep: fix segfault under -P + PCRE2 + (*NO_JIT)

2017-11-22 Thread Eric Sunshine
On Wed, Nov 22, 2017 at 8:36 AM, Ævar Arnfjörð Bjarmason wrote: > Fix a bug in the compilation of PCRE2 patterns under JIT (the most > common runtime configuration), any pattern with a (*NO_JIT) verb would > segfault. This bug dates back to my 94da9193a6 ("grep: add support for &g

[PATCH 2/2] grep: fix segfault under -P + PCRE2 + (*NO_JIT)

2017-11-22 Thread Ævar Arnfjörð Bjarmason
Fix a bug in the compilation of PCRE2 patterns under JIT (the most common runtime configuration), any pattern with a (*NO_JIT) verb would segfault. This bug dates back to my 94da9193a6 ("grep: add support for PCRE v2", 2017-06-01): $ git grep -P '(*NO_JIT)hi.*there' Se

[PATCH v5 1/6] environment.c: fix potential segfault by get_git_common_dir()

2017-04-24 Thread Nguyễn Thái Ngọc Duy
setup_git_env() must be called before this function to initialize git_common_dir so that it returns a non NULL string. And it must return a non NULL string or segfault can happen because all callers expect so. It does not do so explicitly though and depends on get_git_dir() being called first

Re: [PATCH] pathspec: fix segfault in clear_pathspec

2017-04-10 Thread Duy Nguyen
On Sat, Apr 8, 2017 at 2:29 AM, Brandon Williams wrote: > In 'clear_pathspec()' the incorrect index parameter is used to bound an > inner-loop which is used to free a 'struct attr_match' value field. > Using the incorrect index parameter (in addition to being incorrect) > occasionally causes segme

Re: [PATCH] pathspec: fix segfault in clear_pathspec

2017-04-07 Thread Stefan Beller
On Fri, Apr 7, 2017 at 12:29 PM, Brandon Williams wrote: > In 'clear_pathspec()' the incorrect index parameter is used to bound an > inner-loop which is used to free a 'struct attr_match' value field. > Using the incorrect index parameter (in addition to being incorrect) > occasionally causes segm

[PATCH] pathspec: fix segfault in clear_pathspec

2017-04-07 Thread Brandon Williams
In 'clear_pathspec()' the incorrect index parameter is used to bound an inner-loop which is used to free a 'struct attr_match' value field. Using the incorrect index parameter (in addition to being incorrect) occasionally causes segmentation faults when attempting to free an invalid pointer. Fix t

RE: Segfault on git for Windows

2017-04-05 Thread Rémi Galan Alfonso
8676 > > This command worked (return status is 0 and no error message). > > > > However following `git add **.hpp` and `git status` segfault with no > > additional message: > > $ git status > > Segmentation fault > > I think this is the

Re: Segfault on git for Windows

2017-04-05 Thread Johannes Schindelin
cpp > Which is quite a big amount of files (partly because of external > dependencies which would have been smart to exclude, but it's done). > $ find -type f -name "**.cpp" | wc -l > 8676 > This command worked (return status is 0 and no error message). > > How

Segfault on git for Windows

2017-04-05 Thread Rémi Galan Alfonso
.cpp Which is quite a big amount of files (partly because of external dependencies which would have been smart to exclude, but it's done). $ find -type f -name "**.cpp" | wc -l 8676 This command worked (return status is 0 and no error message). However following `git add **.hpp` and

[PATCH v4 1/5] environment.c: fix potential segfault by get_git_common_dir()

2017-04-04 Thread Nguyễn Thái Ngọc Duy
setup_git_env() must be called before this function to initialize git_common_dir so that it returns a non NULL string. And it must return a non NULL string or segfault can happen because all callers expect so. It does not do so explicitly though and depends on get_git_dir() being called first

Re: [PATCHv2] pickaxe: fix segfault with '-S<...> --pickaxe-regex'

2017-03-21 Thread Johannes Schindelin
Hi Gábor, On Sat, 18 Mar 2017, SZEDER Gábor wrote: > 'git {log,diff,...} -S<...> --pickaxe-regex' can segfault as a result of > out-of-bounds memory reads. > > diffcore-pickaxe.c:contains() looks for all matches of the given regex > in a buffer in a loop, advancin

Re: [PATCH v3 1/4] environment.c: fix potential segfault by get_git_common_dir()

2017-03-19 Thread Duy Nguyen
On Sun, Mar 19, 2017 at 12:54 AM, Junio C Hamano wrote: > Nguyễn Thái Ngọc Duy writes: > >> setup_git_env() must be called before this function to initialize >> git_common_dir so that it returns a non NULL string. And it must return >> a non NULL string or segfaul

Re: [PATCH] pickaxe: fix segfault with '-S<...> --pickaxe-regex'

2017-03-18 Thread Junio C Hamano
Junio C Hamano writes: > Interestingly, the new test fails (with the patch) under prove but > not when run from the shell (i.e. "cd t && sh t4062-diff-pickaxe.sh"). Sorry, false alarm.

Re: [PATCH] pickaxe: fix segfault with '-S<...> --pickaxe-regex'

2017-03-18 Thread Junio C Hamano
Interestingly, the new test fails (with the patch) under prove but not when run from the shell (i.e. "cd t && sh t4062-diff-pickaxe.sh").

[PATCHv2] pickaxe: fix segfault with '-S<...> --pickaxe-regex'

2017-03-18 Thread SZEDER Gábor
'git {log,diff,...} -S<...> --pickaxe-regex' can segfault as a result of out-of-bounds memory reads. diffcore-pickaxe.c:contains() looks for all matches of the given regex in a buffer in a loop, advancing the buffer pointer to the end of the last match in each iteration. Whe

Re: [PATCH v3 1/4] environment.c: fix potential segfault by get_git_common_dir()

2017-03-18 Thread Junio C Hamano
Nguyễn Thái Ngọc Duy writes: > setup_git_env() must be called before this function to initialize > git_common_dir so that it returns a non NULL string. And it must return > a non NULL string or segfault can happen because all callers expect so. > > Normally if somebody has cal

Re: [PATCH] pickaxe: fix segfault with '-S<...> --pickaxe-regex'

2017-03-18 Thread SZEDER Gábor
xpect_success '-G matches' ' > test 4096-zeroes.txt = "$(cat out)" > ' > > +test_expect_success '-S --pickaxe-regex' ' > + git diff --name-only -S0 --pickaxe-regex HEAD^ >out && > + verbose test 4096-zeroes.txt = "$(cat out)" > +' > + > test_done Hang on, this new test does fail because of a segfault _with_ the fix on Travis 64bit Linux and OSX builds. Oh, well.

[PATCH] pickaxe: fix segfault with '-S<...> --pickaxe-regex'

2017-03-18 Thread SZEDER Gábor
'git {log,diff,...} -S<...> --pickaxe-regex' can segfault as a result of out-of-bounds memory reads. diffcore-pickaxe.c:contains() looks for all matches of the given regex in a buffer in a loop, advancing the buffer pointer to the end of the last match in each iteration. Whe

[PATCH v3 1/4] environment.c: fix potential segfault by get_git_common_dir()

2017-03-18 Thread Nguyễn Thái Ngọc Duy
setup_git_env() must be called before this function to initialize git_common_dir so that it returns a non NULL string. And it must return a non NULL string or segfault can happen because all callers expect so. Normally if somebody has called get_git_dir(), or set_git_dir() then setup_git_env() is

Re: [PATCH] run-command: fix segfault when cleaning forked async process

2017-03-17 Thread Brandon Williams
On 03/17, Jeff King wrote: > Callers of the run-command API may mark a child as > "clean_on_exit"; it gets added to a list and killed when the > main process dies. Since commit 46df6906f > (execv_dashed_external: wait for child on signal death, > 2017-01-06), we respect an extra "wait_after_clean"

Re: [PATCH] run-command: fix segfault when cleaning forked async process

2017-03-17 Thread Jonathan Nieder
Jeff King wrote: > Reported-by: Brandon Williams > Signed-off-by: Jeff King Reviewed-by: Jonathan Nieder Thanks.

[PATCH] run-command: fix segfault when cleaning forked async process

2017-03-17 Thread Jeff King
Callers of the run-command API may mark a child as "clean_on_exit"; it gets added to a list and killed when the main process dies. Since commit 46df6906f (execv_dashed_external: wait for child on signal death, 2017-01-06), we respect an extra "wait_after_clean" flag, which we expect to find in the

  1   2   3   4   >