Re: [PATCH 03/23] pack-bitmap: bounds-check size of cache extension
- From
Jeff King <peff@peff.net>
- Date
- Nov 13, 2020, 22:11 UTC
- Message-ID
- <20201113221111.GA783373@coredump.intra.peff.net>
- In-Reply-To
- <X67/aExL78Fxyobl@nand.local>
On Fri, Nov 13, 2020 at 04:49:28PM -0500, Taylor Blau wrote:
Show 11 quoted lines
> Thanks for your patient explanation. This hunk should instead read:
>
> + size_t header_size = sizeof(*header) - GIT_MAX_RAWSZ + the_hash_algo->rawsz;
>
> - if (index->map_size < sizeof(*header) + the_hash_algo->rawsz)
> + if (index->map_size < header_size + the_hash_algo->rawsz)
> return error("Corrupted bitmap index (missing header data)");
>
> That error might not necessarily be right (it could say "missing header
> or trailer data"), though. I'm open to if you think it should be
> changed or not.Yeah, I agree it's misleading. In the idx code path we just say "%s is too small", which is more accurate.
-Peff