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

Re: [PATCH v2 4/4] ref-filter: use oid_object_info() to get object

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 17, 2018, 22:17 UTC
Message-ID
<xmqqtvoxld68.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<CAL21BmnDqv9yib5Vqh4q7zj1hd_bmhO+xnDVJBi-zM0Cqtsevw@mail.gmail.com>
Оля Тележная  <olyatelezhnaya@gmail.com> writes:
Show 7 quoted lines
>> Hmph, doesn't this belong to the previous step?  In other words,
>> isn't the result of applying 1-3/4 has a bug that can leave eaten
>> uninitialized (and base decision to free(buf) later on it), and
>> isn't this change a fix for it?
>
> Oh. I was thinking that it was new bug created by me. Now I see that
> previously we had the same problem.
The original said something like:
	int eaten;
	void *buf = get_obj(..., &eaten);
	...
	if (!eaten)
		free(buf);

and get_obj() left eaten untouched when it returned NULL. As a random uninitialized cruft in eaten that happened to be "true" would just cause free(NULL) on many archs, there was no practical problem in such a code, but it is undefined behaviour nevertheless.

And the previous step made it a bit more alarming ;-)
Previous: Оля Тележная
Message 7 of 7 in “ref-filter: add info_source to valid_atom”
  1. 1/4 ref-filter: add info_source to valid_atomOlga Telezhnaya, Jul 13, 2018
  2. 2/4 ref-filter: fill empty fields with empty valuesOlga Telezhnaya, Jul 13, 2018
  3. 3/4 ref-filter: merge get_obj and get_objectOlga Telezhnaya, Jul 13, 2018
  4. 4/4 ref-filter: use oid_object_info() to get objectOlga Telezhnaya, Jul 13, 2018
  5. Junio C HamanoJul 16, 2018
  6. Оля ТележнаяJul 17, 2018
  7. Junio C HamanoJul 17, 2018

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.