git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ingy dot Net <ingy@ingy.net>
To: git@vger.kernel.org
Subject: [BUG] git crashes on simple rev-parse incantation
Date: Thu, 1 Sep 2022 14:15:46 -0700	[thread overview]
Message-ID: <CAHJtQJ4uJc2_upHvc-SWVpA3OX2Lpu-XspswGTTDLgXWjG-Gew@mail.gmail.com> (raw)

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

             reply	other threads:[~2022-09-01 21:16 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-01 21:15 Ingy dot Net [this message]
2022-09-02  4:28 ` [BUG] git crashes on simple rev-parse incantation Ø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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAHJtQJ4uJc2_upHvc-SWVpA3OX2Lpu-XspswGTTDLgXWjG-Gew@mail.gmail.com \
    --to=ingy@ingy.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).