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

Re: [PATCH v2] fuzz: add new oss-fuzz fuzzer for date.c / date.h

From
Junio C Hamano <gitster@pobox.com>
Date
Nov 13, 2023, 23:27 UTC
Message-ID
<xmqqzfzh44jw.fsf@gitster.g>
In-Reply-To
<20231113183509.GA3838361@coredump.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 19 quoted lines
> On Mon, Nov 13, 2023 at 04:22:48PM +0000, Arthur Chan via GitGitGadget wrote:
>
>> +	str = (char *)malloc(size + 1);
>> +	if (!str)
>> +		return 0;
>> +	memcpy(str, data, size);
>> +	str[size] = '\0';
>
> Is it important that we avoid calling die() if the malloc fails here?
>
> The usual way to write this in our code base is just:
>
>   str = xmemdupz(data, size);
>
> It's not entirely a style thing; we sometimes audit the code base
> looking for computations on malloc sizes (for integer overflows) as well
> as sites that should be using xmalloc and are not. Obviously we can
> exclude oss-fuzz/ from such audits, but if there's no reason not to
> prefer our usual style, it's one less thing to worry about.
Good point.  Thanks.
Previous: Jeff KingNext: Junio C Hamano
Message 6 of 10 in “fuzz: add new oss-fuzz fuzzer for date.c / date.h”
  1. fuzz: add new oss-fuzz fuzzer for date.c / date.hArthur Chan via GitGitGadget, Nov 11, 2023
  2. Junio C HamanoNov 12, 2023
  3. Junio C HamanoNov 12, 2023
  4. fuzz: add new oss-fuzz fuzzer for date.c / date.hArthur Chan via GitGitGadget, Nov 13, 2023
  5. Jeff KingNov 13, 2023
  6. Junio C HamanoNov 13, 2023
  7. Junio C HamanoNov 13, 2023
  8. fuzz: add new oss-fuzz fuzzer for date.c / date.hArthur Chan via GitGitGadget, Nov 14, 2023
  9. Junio C HamanoNov 14, 2023
  10. fuzz: add new oss-fuzz fuzzer for date.c / date.hArthur Chan via GitGitGadget, Nov 17, 2023

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.