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

Re: parse_object does check_sha1_signature but not parse_object_buffer?

From
Mike Hommey <mh@glandium.org>
Date
Feb 2, 2016, 02:06 UTC
Message-ID
<20160202020611.GA30613@glandium.org>
In-Reply-To
<20160202015701.GA30444@glandium.org>
On Tue, Feb 02, 2016 at 10:57:01AM +0900, Mike Hommey wrote:
Show 23 quoted lines
> Hi,
> 
> You might or might not be aware of this thread:
> https://groups.google.com/forum/#!topic/binary-transparency/f-BI4o8HZW0
> 
> Anyways, this got me to take a look around, and I noticed that
> parse_object does SHA-1 validation through check_sha1_signature. What
> surprised me is that parse_object_buffer doesn't. So we end up with
> inconsistent behavior across commands:
> 
> $ git init
> $ echo a > a ; echo b > b
> $ git add a b
> $ git cat-file blob 78981922613b2afb6025042ff6bd878ac1994e85
> a
> $ cp -f .git/objects/61/780798228d17af2d34fce4cfbdf35556832472 .git/objects/78/981922613b2afb6025042ff6bd878ac1994e85
> $ git cat-file blob 78981922613b2afb6025042ff6bd878ac1994e85
> b
> $ git show 78981922613b2afb6025042ff6bd878ac1994e85
> error: sha1 mismatch 78981922613b2afb6025042ff6bd878ac1994e85
> fatal: bad object 78981922613b2afb6025042ff6bd878ac1994e85
> 
> Shouldn't parse_object_buffer also do check_sha1_signature?
Well, except cat-file doesn't use parse_object_buffer either...
Mike
Previous: Mike HommeyNext: Junio C Hamano
Message 2 of 7 in “parse_object does check_sha1_signature but not parse_object_buffer?”
  1. Mike HommeyFeb 2, 2016
  2. Mike HommeyFeb 2, 2016
  3. Junio C HamanoFeb 2, 2016
  4. Mike HommeyFeb 2, 2016
  5. Junio C HamanoFeb 2, 2016
  6. Jeff KingFeb 4, 2016
  7. Junio C HamanoFeb 4, 2016

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.