$ 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.