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

Re: [PATCH 0/2] Fix crashes due to real_pathdup() potentially returning NULL

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Mar 9, 2017, 11:26 UTC
Message-ID
<alpine.DEB.2.20.1703091224360.3767@virtualbox>
In-Reply-To
<20170308161742.lpbf6gn6qhoex7et@sigill.intra.peff.net>
Hi Peff,
On Wed, 8 Mar 2017, Jeff King wrote:
Show 10 quoted lines
> On Wed, Mar 08, 2017 at 04:43:27PM +0100, Johannes Schindelin wrote:
> 
> > We may want to consider fast-tracking this into v2.12.1, and to that
> > end, I would appreciate code reviews that focus on the correctness of
> > this patch and that try to consider undesired side effects.
> 
> I don't see how it could be not-correct, in the sense that every caller
> now passes the die_on_error flag (restoring the original behavior)
> except for the one which clearly checks for a NULL return immediately
> afterward.

Indeed. The principal reason why I extended the function signature was so that any bugs would become obvious.

Show 8 quoted lines
> The only exception would be if there were new calls to real_pathdup()
> that did not originally use real_path(). But:
> 
>   # 7241764076 introduced real_pathdup
>   git log -Sreal_pathdup 7241764076..
> 
> shows only one other introduction, and it's just duplicating an existing
> call.

Thanks for digging that up. I really only looked at the existing code in `master` to figure out whether the return values were checked against NULL or not.

Show 5 quoted lines
> It's possible that some of these _could_ handle the error case more
> gracefully (I already fixed one such case in 3a1345af2). But even if
> we wanted to do so, that should come separately on top of this patch.
> This can go to 'maint' as a regression fix, and then that gives a stable
> base for making potential improvements.
Fully agree.

Thank you for the thorough review, Johannes

Previous: Jeff King
Message 10 of 10 in “Fix crashes due to real_pathdup() potentially returning NULL”
  1. 0/2 Fix crashes due to real_pathdup() potentially returning NULLJohannes Schindelin, Mar 8, 2017
  2. 2/2 Fix callsites of real_pathdup() that wanted it to die on errorJohannes Schindelin, Mar 8, 2017
  3. René ScharfeMar 8, 2017
  4. Brandon WilliamsMar 8, 2017
  5. Junio C HamanoMar 8, 2017
  6. Johannes SchindelinMar 9, 2017
  7. René ScharfeMar 9, 2017
  8. 1/2 Demonstrate NULL pointer access with invalid GIT_WORK_TREEJohannes Schindelin, Mar 8, 2017
  9. Jeff KingMar 8, 2017
  10. Johannes SchindelinMar 9, 2017

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.