Re: [PATCH v2] crypto: asymmetric_keys - bound PE section ranges in pefile_parse_binary

From: Dan Carpenter

Date: Thu Dec 03 2026 - 03:03:30 EST


On Sat, Aug 15, 2026 at 01:45:30PM +0200, Fabrice Derepas wrote:
> Since we are now centralising section-table sanity in pefile_parse_binary(),
> the natural fix is to reject n_sections == 0 there as well, e.g. by folding
> it into the existing bound:
>
> if (ctx->n_sections == 0 ||
> ctx->n_sections > (ctx->header_size - cursor) / sizeof(*sec))
> return -ELIBBAD;
>
> A PE with zero sections is malformed (a signed kernel/EFI image always has
> at least one), so rejecting it at parse is safe and closes the
> ZERO_SIZE_PTR write too. I will include that in v3 and cover it in the KUnit
> case.
>
> Do you prefer it folded into this patch, or kept as a separate fix for the
> canon[0] write? Either way I will respin as v3 with the KUnit case once you
> let me know.
>

It's been a few months... What's the status on this?

regards,
dan carpenter