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

Re: [PATCH v2] sha1_name: fix uninitialized memory errors

From
Junio C Hamano <gitster@pobox.com>
Date
Feb 28, 2018, 21:06 UTC
Message-ID
<xmqqr2p4kemp.fsf@gitster-ct.c.googlers.com>
In-Reply-To
<ce8421bb-4519-c4e5-ff0a-98ae532d764b@gmail.com>
Derrick Stolee <stolee@gmail.com> writes:
Show 10 quoted lines
>> I do not think they are wrong, but aren't the latter two somewhat
>> redundant?  "num" is p->num_objects, and we call (first+1)th element
>> only after we see (first < num - 1), i.e. first+1 < num, and the
>> access to (first-1)th is done only when first > 0.  The first one,
>> i.e. when first points at where we _would_ find it if it existed,
>> can access "first" that could be p->num_objects, so the change there
>> makes sense, though.
>
> Yes. But I'd rather keep the blocks consistent and use the return
> value of nth_packed_object_oid() when possible.
Sure, I do not think anybody minds; I just wanted a sanity check.
Thansk.
Previous: Derrick Stolee
Message 14 of 14 in “Use of uninitialised value of size 8 in sha1_name.c”
  1. Christian CouderFeb 26, 2018
  2. Jeff KingFeb 26, 2018
  3. Christian CouderFeb 26, 2018
  4. Derrick StoleeFeb 26, 2018
  5. Christian CouderFeb 26, 2018
  6. sha1_name: fix uninitialized memory errorsDerrick Stolee, Feb 26, 2018
  7. Jeff KingFeb 26, 2018
  8. sha1_name: fix uninitialized memory errorsDerrick Stolee, Feb 27, 2018
  9. Jeff KingFeb 27, 2018
  10. Junio C HamanoFeb 27, 2018
  11. Jeff KingFeb 27, 2018
  12. Junio C HamanoFeb 28, 2018
  13. Derrick StoleeFeb 28, 2018
  14. Junio C HamanoFeb 28, 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.