git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [BUG] git crashes on simple rev-parse incantation
@ 2022-09-01 21:15 Ingy dot Net
  2022-09-02  4:28 ` Øystein Walle
  2022-09-02  5:06 ` [PATCH] rev-parse: Detect missing opt-spec Øystein Walle
  0 siblings, 2 replies; 14+ messages in thread
From: Ingy dot Net @ 2022-09-01 21:15 UTC (permalink / raw)
  To: git

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

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

end of thread, other threads:[~2022-09-02 21:29 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-01 21:15 [BUG] git crashes on simple rev-parse incantation Ingy dot Net
2022-09-02  4:28 ` Øystein Walle
2022-09-02  5:06 ` [PATCH] rev-parse: Detect missing opt-spec Øystein Walle
2022-09-02  5:46   ` Eric Sunshine
2022-09-02  6:39     ` [PATCH v2] " Øystein Walle
2022-09-02  7:15       ` Eric Sunshine
2022-09-02  6:47   ` [PATCH] " SZEDER Gábor
2022-09-02 16:27     ` Junio C Hamano
2022-09-02 17:59       ` [PATCH] rev-parse --parseopt: detect " Øystein Walle
2022-09-02 18:01         ` Øystein Walle
2022-09-02 18:45           ` Junio C Hamano
2022-09-02 21:00         ` SZEDER Gábor
2022-09-02 21:29           ` Junio C Hamano
2022-09-02 17:13   ` [PATCH] rev-parse: Detect " Jeff King

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