threads / discuss / 59748

[BUG_REPORT] `git submodule update` segfaults

Subject: [BUG_REPORT] `git submodule update` segfaults

## tl;dr

One message between May 16, 2023 and May 16, 2023.

replies: 0people: 1as markdown or json

Tribo Dar· May 16, 2023, 08:23 UTC · lore

What did you do before the bug happened? (Steps to reproduce your issue) Ran `git submodule update` after commenting out the url field in both .gitmodules and the corresponding section for the submodule in .git/config.

What did you expect to happen? (Expected behavior) Graceful handling of the situation.

What happened instead? (Actual behavior) Segmentation fault.

Anything else you want to add: The segfault results from `sub->url` being NULL here (actual segfault comes a couple calls further): https://github.com/git/git/blob/0df2c180904f6b709766f9c24669a9d01543f915/builtin/submodule--helper.c#LL2027C1-L2027C1

Possibly relevant: a similar snippet being properly protected against null-pointer dereferencing: https://github.com/git/git/blob/0df2c180904f6b709766f9c24669a9d01543f915/builtin/submodule--helper.c#L1243

← back to recent threads