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

Re: [PATCH v2 4/4] convert: use size_t for text statistics and ident counts

From
Elia Pinto <gitter.spiros@gmail.com>
Date
Oct 31, 2026, 10:16 UTC
Message-ID
<20261031101619.172770-2-gitter.spiros@gmail.com>
In-Reply-To
<auSDKKHJONZjx2LX@pks.im>
On Fri, Oct 30, 2026 at 12:44:40PM +0100, Patrick Steinhardt wrote:
Show 7 quoted lines
> > gather_stats() counts NULs, CRs, LFs, CRLFs and (non)printable
> > characters in "unsigned" fields of struct text_stat, and
> > count_ident() counts "$Id$" markers in an "int". Now that the buffer
> > sizes they work on are size_t, a large enough buffer overflows them.
>
> This sounds a bit too deterministic: it doesn't necessarily overflow
> them, but the possibility exists in theory.

Indeed, it's a theoretical possibility rather than something that automatically happens. In v3 I've adjusted it to say "large inputs can overflow these counters".

Show 8 quoted lines
>
> > Unlike the previous patches, this is not specific to LLP64: "unsigned"
> > [...]
> > as needed.
>
> These paragraphs very much read like AI to me. I would appreciate a
> human touch, also to demonstrate that a human was involved between us
> and the AI that tries to understand what was done.

You're completely right. I used AI tooling to help draft that commit message, and it definitely shows. Fair cop.

To clarify my involvement: I review the code, check the cases, run the tests, and take full responsibility for what gets submitted. But the wording here missed the mark. For v3 I rewrote the message myself, keeping it much shorter, focusing on a single example (lone LFs), and dropping the heavy-handed explanations.

Show 6 quoted lines
>
> > Use size_t for all of them, and compute the size hint in
> > ident_to_worktree() with st_add() and st_mult(), so that it dies
> > instead of wrapping around.
>
> That's awfully specific.

Agreed, it spells out the implementation details which are already obvious from the diff. In v3 I've simplified it to just state that the size hint is checked for overflow.

>
> The patch itself looks good to me, thanks.

Thanks for the careful review! v3 will follow shortly in the same thread.

Elia
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 16 of 23 in “use size_t for a few more object and buffer sizes”
  1. 0/3 use size_t for a few more object and buffer sizesElia Pinto, Oct 21, 2026
  2. 1/3 odb: use size_t for the length of objects to writeElia Pinto, Oct 21, 2026
  3. Patrick SteinhardtOct 21, 2026
  4. 2/3 diff: use size_t for the allocation size of word-diff buffersElia Pinto, Oct 21, 2026
  5. Patrick SteinhardtOct 21, 2026
  6. 3/3 convert: use size_t for buffer sizesElia Pinto, Oct 21, 2026
  7. Patrick SteinhardtOct 21, 2026
  8. 0/4 use size_t for a few more object and buffer sizesElia Pinto, Oct 30, 2026
  9. 1/4 odb: use size_t for the length of objects to writeElia Pinto, Oct 30, 2026
  10. Patrick SteinhardtOct 30, 2026
  11. Elia PintoOct 31, 2026
  12. 2/4 diff: use size_t for the allocation size of word-diff buffersElia Pinto, Oct 30, 2026
  13. 3/4 convert: use size_t for buffer sizesElia Pinto, Oct 30, 2026
  14. 4/4 convert: use size_t for text statistics and ident countsElia Pinto, Oct 30, 2026
  15. Patrick SteinhardtOct 30, 2026
  16. Elia PintoOct 31, 2026
  17. Patrick SteinhardtNov 2, 2026
  18. Junio C HamanoNov 2, 2026
  19. 0/4 use size_t for a few more object and buffer sizesElia Pinto, Oct 31, 2026
  20. 1/4 odb: use size_t for the length of objects to writeElia Pinto, Oct 31, 2026
  21. 2/4 diff: use size_t for the allocation size of word-diff buffersElia Pinto, Oct 31, 2026
  22. 3/4 convert: use size_t for buffer sizesElia Pinto, Oct 31, 2026
  23. 4/4 convert: use size_t for text statistics and ident countsElia Pinto, Oct 31, 2026

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.