From: Junio C Hamano Date: Mon, 12 Jan 2026 14:54:07 GMT Subject: Re: [PATCH v5 2/7] packfile: always declare object info to be OI_PACKED Message-ID: In-Reply-To: <20260112-b4-pks-odb-read-object-info-improvements-v5-2-9a6124e95bf2@pks.im> Patrick Steinhardt writes: > 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. > Reported-by: Matt Smiley > Signed-off-by: Patrick Steinhardt > --- > 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;