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

Re: [PATCH 1/4] apply: plug a leak in apply_data

From
Rubén Justo <rjusto@gmail.com>
Date
Apr 22, 2024, 22:04 UTC
Message-ID
<78f38e0f-7456-42d7-b0d1-887944bb01c9@gmail.com>
In-Reply-To
<74a6465c-01b6-4a65-8491-751244d37c82@gmail.com>
On Mon, Apr 22, 2024 at 04:41:18PM +0100, Phillip Wood wrote:
Show 20 quoted lines
> On 21/04/2024 11:28, Rubén Justo wrote:
> > Plug a leak we have since cfb6f9acc3 (apply: accept -3/--3way command
> > line option, 2012-05-08).
> 
> Looking at that commit I see
> 
> -        if (apply_fragments(&image, patch) < 0)
> -                return -1; /* note with --reject this succeeds. */
> +        if (apply_fragments(&image, patch) < 0) {
> +                /* Note: with --reject, apply_fragments() returns 0 */
> +                if (!threeway || try_threeway(&image, patch, st, ce) < 0)
> +                        return -1;
> +        }
> 
> So the leak existed before that commit. Indeed it looks
> like the leak predates the introduction of struct image in b94f2eda99
> (builtin-apply.c: make it more line oriented, 2008-01-26) and when
> the patch does not apply we have been leaking the buffer passed to
> apply_fragments() since the beginning of the builtin apply added in
> ac6245e31a3 (Builtin git-apply., 2006-05-23)
You are very right.

I saw that commit. I reviewed again my notes and I recorded the hash of the previous hop; the one that my message, incorrectly, refers to. I'll reroll to fix it.

Thank you very much for your attention.
Previous: Phillip WoodNext: Junio C Hamano
Message 6 of 19 in “mark t3701-add-interactive.sh as leak-free”
  1. 0/4 mark t3701-add-interactive.sh as leak-freeRubén Justo, Apr 21, 2024
  2. 2/4 add-interactive: plug a leak in get_untracked_filesRubén Justo, Apr 21, 2024
  3. Junio C HamanoApr 22, 2024
  4. 1/4 apply: plug a leak in apply_dataRubén Justo, Apr 21, 2024
  5. Phillip WoodApr 22, 2024
  6. Rubén JustoApr 22, 2024
  7. Junio C HamanoApr 22, 2024
  8. 3/4 add-patch: plug a leak handling the '/' commandRubén Justo, Apr 21, 2024
  9. 4/4 add: plug a leak on interactive_addRubén Justo, Apr 21, 2024
  10. Phillip WoodApr 22, 2024
  11. Rubén JustoApr 22, 2024
  12. Patrick SteinhardtApr 22, 2024
  13. Junio C HamanoApr 22, 2024
  14. 0/4 mark t3701-add-interactive.sh as leak-freeRubén Justo, Apr 22, 2024
  15. 1/4 apply: plug a leak in apply_dataRubén Justo, Apr 22, 2024
  16. 2/4 add-interactive: plug a leak in get_untracked_filesRubén Justo, Apr 22, 2024
  17. 3/4 add-patch: plug a leak handling the '/' commandRubén Justo, Apr 22, 2024
  18. 4/4 add: plug a leak on interactive_addRubén Justo, Apr 22, 2024
  19. Junio C HamanoApr 22, 2024

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.