Re: [PATCH v6 15/22] object-file.c: guard against future bugs in loose_object_info()
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Sep 17, 2021, 02:35 UTC
- Message-ID
- <YUP+5W9rAWwNQ23t@nand.local>
- In-Reply-To
- <patch-v6-15.22-3fb660ff944-20210907T104559Z-avarab@gmail.com>
On Tue, Sep 07, 2021 at 12:58:10PM +0200, Ævar Arnfjörð Bjarmason wrote:
Show 9 quoted lines
> An earlier version of the preceding commit had a subtle bug where our > "type_scratch" (later assigned to "oi->typep") would be uninitialized > and used in the "!allow_unknown" case, at which point it would contain > a nonsensical value if we'd failed to call parse_loose_header(). > > The preceding commit introduced "parsed_header" variable to check for > this case, but I think we can do better, let's carry a "oi_header" > variable initially set to NULL, and only set it to "oi" once we're > past parse_loose_header().
Everything in this patch seems OK to me.
For what it's worth, I think that this could likely have been folded into the previous commit. I was just a little surprised to see parsed_header go away after I had just a minute or two again spent time thinking about what it was for.
Thanks, Taylor