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

[BUG] git crashes on simple rev-parse incantation

From
INIngy dot Net <ingy@ingy.net>
Date
Sep 1, 2022, 21:15 UTC
Message-ID
<CAHJtQJ4uJc2_upHvc-SWVpA3OX2Lpu-XspswGTTDLgXWjG-Gew@mail.gmail.com>

$ git --version git version 2.34.1 $ uname -a Linux zed 5.15.0-48-generic #54-Ubuntu SMP Fri Aug 26 13:26:29 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux

I get:

$ git rev-parse --parseopt -- <<<$'x\n--\n=, x\n' fatal: Out of memory, malloc failed (tried to allocate 18446744073709551615 bytes)

---- Here's a less cryptic that fails the same way:

OPTS_SPEC="\ some-command [<options>] <args>...

some-command does foo and bar! -- h,help show the help =,equal nooooooooooooo! "

echo "$OPTS_SPEC" |
  git rev-parse --parseopt --

---- '=' as a short form in the opts spec seems to be the culprit.

I was trying to see what short options could be parsed like '-9', '-_', '-+', etc.

In addition to '=', '!' and '*' also cause crashes. I tested all the other ascii punctuation and didn't see crashes.

Next: Øystein Walle
Message 1 of 14 in “[BUG] git crashes on simple rev-parse incantation”
  1. Ingy dot NetSep 1, 2022
  2. Øystein WalleSep 2, 2022
  3. rev-parse: Detect missing opt-specØystein Walle, Sep 2, 2022
  4. Eric SunshineSep 2, 2022
  5. rev-parse: Detect missing opt-specØystein Walle, Sep 2, 2022
  6. Eric SunshineSep 2, 2022
  7. SZEDER GáborSep 2, 2022
  8. Junio C HamanoSep 2, 2022
  9. rev-parse --parseopt: detect missing opt-specØystein Walle, Sep 2, 2022
  10. rev-parse --parseopt: detect missing opt-specØystein Walle, Sep 2, 2022
  11. Junio C HamanoSep 2, 2022
  12. SZEDER GáborSep 2, 2022
  13. Junio C HamanoSep 2, 2022
  14. Jeff KingSep 2, 2022

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.