git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: H Z <shiyuyuranzh@gmail.com>
To: git@vger.kernel.org
Subject: Re: Subject: Memory Leak vulnerability in reftable/readwrite_test.c
Date: Sat, 1 Mar 2025 14:10:34 +0800	[thread overview]
Message-ID: <CAAJd+fbNhGa5Pe4x-_rbwXVoye9uBD45zoJtu7riiW7GfnU1Cg@mail.gmail.com> (raw)
In-Reply-To: <CAAJd+fZSUiiUm05D_eO3HS7p=WoxAWSZo51dUNjyGjUNJBvyGg@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]

Also, here's the code path that leads to that memory leak
vulnerability, which I've represented with an image.

H Z <shiyuyuranzh@gmail.com> 于2025年3月1日周六 14:07写道:
>
> Hi, I have found a potential memory leak bug in
> reftable/readwrite_test.c and would like to report it to the
> maintainers. Can you please help me to check it? Thank you for your
> effort and patience!
>
> Below is the execution sequence of the program that may produce the bug.
>
> First, in file src/wrapper.c, function xstrdup allocates memory at
> line 40 and returns at line 43.
> Second, in the file reftable/reader.c, the function init_reader calls
> the function xstrdup on line 202 to allocate memory for r->name, which
> is the formal parameter of the function init_reader.
> Third, in file reftable/readwrite_test.c, function
> test_corrupt_table_empty calls function init_reader on line 935 with
> &rd passed as the first argument, causing rd->name to be allocated
> memory. rd->name is not freed, which would cause the memory leak
> vulnerability.
>
> Thank you very much for reading and I look forward to hearing from you!

[-- Attachment #2: image.png --]
[-- Type: image/png, Size: 193692 bytes --]

  reply	other threads:[~2025-03-01  6:10 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-01  6:07 Subject: Memory Leak vulnerability in reftable/readwrite_test.c H Z
2025-03-01  6:10 ` H Z [this message]
2025-03-01 11:31 ` René Scharfe
2025-03-01 11:34   ` H Z
2025-03-04  6:33   ` Jeff King
2025-03-04  7:39     ` H Z
2025-03-04 16:11     ` [PATCH v2] reftable: release name on reftable_reader_new() error René Scharfe

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

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

  git send-email \
    --in-reply-to=CAAJd+fbNhGa5Pe4x-_rbwXVoye9uBD45zoJtu7riiW7GfnU1Cg@mail.gmail.com \
    --to=shiyuyuranzh@gmail.com \
    --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.
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).