Re: [PATCH v5 2/7] packfile: always declare object info to be OI_PACKED
Patrick Steinhardt <ps@pks.im> writes:
Show 15 quoted lines
> Note that this also fixes a segfault introduced in 8c1b84bc97
> (streaming: move logic to read packed objects streams into backend,
> 2025-11-23), which refactors how we stream packed objects. The intent is
> to only read packed objects in case they are stored non-deltified as
> we'd otherwise have to deflate them first. But the check for whether or
> not the object is stored as a delta was unconditionally done via
> `oi.u.packed.is_delta`, which is only valid in case `oi.whence` is
> `OI_PACKED`. But under some circumstances we got `OI_DBCACHED` here,
> which means that none of the `oi.u.packed` fields were initialized at
> all. Consequently, we assumed the object was not stored as a delta, and
> then try to read the object from `oi.u.packed.pack`, which is a `NULL`
> pointer and thus causes a segfault.
>
> Add a test case for this issue so that this cannot regress in the
> future anymore.
Great. Thanks. Will requeue.
Show 18 quoted lines
> Reported-by: Matt Smiley <msmiley@gitlab.com>
> Signed-off-by: Patrick Steinhardt <ps@pks.im>
> ---
> odb.h | 1 -
> packfile.c | 3 +--
> t/t5003-archive-zip.sh | 34 ++++++++++++++++++++++++++++++++++
> 3 files changed, 35 insertions(+), 3 deletions(-)
>
> diff --git a/odb.h b/odb.h
> index 014cd9585a..73b0b87ad5 100644
> --- a/odb.h
> +++ b/odb.h
> @@ -330,7 +330,6 @@ struct object_info {
> OI_CACHED,
> OI_LOOSE,
> OI_PACKED,
> - OI_DBCACHED
> } whence;