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

Re: [PATCH] packfile: Correct zlib buffer handling

From
Eric Sunshine <sunshine@sunshineco.com>
Date
May 25, 2018, 23:36 UTC
Message-ID
<CAPig+cS=7EbGviDYoNFNF-CrMfCY4mySQoWX3JtJBhbNf105sw@mail.gmail.com>
In-Reply-To
<20180525231713.23047-1-lintonrjeremy@gmail.com>
On Fri, May 25, 2018 at 7:17 PM, Jeremy Linton <lintonrjeremy@gmail.com> wrote:
Show 13 quoted lines
> The buffer being passed to zlib includes a null terminator that
> git needs to keep in place. unpack_compressed_entry() attempts to
> detect the case that the source buffer hasn't been fully consumed
> by checking to see if the destination buffer has been over consumed.
>
> This yields two problems, first a single byte overrun won't be detected
> properly because the Z_STREAM_END will then be set, but the null
> terminator will have been overwritten. The other problem is that
> more recent zlib patches have been poisoning the unconsumed portions
> of the buffers which also overwrites the null, while correctly
> returning length and status.
>
> Lets rely on the fact that the source buffer will only be fully
s/Lets/Let's/
> consumed when the when the destination buffer is inflated to the
s/when the when the/when the/
Show 5 quoted lines
> correct size. We can do this by passing zlib the correct buffer size
> and properly checking the return status. The latter check actually
> already exists if the buffer size is correct.
>
> Signed-off-by: Jeremy Linton <lintonrjeremy@gmail.com>
Previous: Jeremy LintonNext: Todd Zullinger
Message 2 of 3 in “packfile: Correct zlib buffer handling”
  1. packfile: Correct zlib buffer handlingJeremy Linton, May 25, 2018
  2. Eric SunshineMay 25, 2018
  3. Todd ZullingerMay 26, 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.