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

Re: [PATCH 2/4] archive-tar: fix pax extended header length calculation

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Aug 17, 2019, 18:03 UTC
Message-ID
<CAPig+cRi5uUKHGNB+DezAMaQ6R27U-5Xyy3bUE2c=W0CoyPkVQ@mail.gmail.com>
In-Reply-To
<4b04cf3f-966a-3aa9-6a30-7ac3a234e1ed@web.de>
On Sat, Aug 17, 2019 at 12:24 PM René Scharfe <l.s.r@web.de> wrote:
> A pax extended header records starts with a decimal number.  Its value
s/records/record/
> is the length of the whole record, including its own length.
>
> The calculation of that number if strbuf_append_ext_header() is off by
s/if/in/
Show 14 quoted lines
> one in case the length of the rest is close to a higher order of
> magnitude.  This affects paths and link targets a bit shorter than 1000,
> 10000, 100000 etc. characters -- paths with a length of up to 100 fit
> into the tar header and don't need a pax extended header.
>
> The mistake has been present since the function was added by ae64bbc18c
> ("tar-tree: Introduce write_entry()", 2006-03-25).
>
> Account for digits added to len during the loop and keep incrementing
> until we have enough space for len and the rest.  The crucial change is
> to check against the current value of len before each iteration, instead
> of against its value before the loop.
>
> Signed-off-by: René Scharfe <l.s.r@web.de>
Previous: René ScharfeNext: René Scharfe
Message 4 of 7 in “fix pax extended header length calculation”
  1. 0/4 fix pax extended header length calculationRené Scharfe, Aug 17, 2019
  2. 1/4 archive-tar: report wrong pax extended header lengthRené Scharfe, Aug 17, 2019
  3. 2/4 archive-tar: fix pax extended header length calculationRené Scharfe, Aug 17, 2019
  4. Eric SunshineAug 17, 2019
  5. 3/4 archive-tar: use size_t in strbuf_append_ext_header()René Scharfe, Aug 17, 2019
  6. 4/4 archive-tar: turn length miscalculation warning into BUGRené Scharfe, Aug 17, 2019
  7. brian m. carlsonAug 17, 2019

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.