Files
git/reftable
Johannes Schindelin dfb899a959 reftable/block: check deflateInit() return value
block_writer_init() allocates a z_stream and calls deflateInit()
to prepare it for compressing log records. The return value of
deflateInit() is silently discarded. If zlib initialization fails
(e.g., Z_MEM_ERROR when the system is under memory pressure), the
z_stream is left in an undefined state.

Subsequent deflate() calls in block_writer_finish() then operate
on this uninitialized stream. Depending on the zlib
implementation, this can produce silently corrupted compressed
data (which would be written to the reftable file and discovered
only when a later reader fails to inflate) or crash outright.

The function already uses REFTABLE_ZLIB_ERROR for deflate()
failures later in the code path (lines 171, 199), so returning
the same error code for deflateInit() failure is consistent.

Pointed out by Coverity.

Assisted-by: Claude Opus 4.6
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2026-08-05 13:08:35 -07:00
..
2025-04-29 14:21:30 -07:00
2025-04-29 14:21:30 -07:00
2026-06-26 08:27:19 -07:00
2026-06-26 08:27:19 -07:00
2026-06-08 00:21:35 +09:00
2026-07-13 08:27:26 -07:00
2026-06-26 08:27:19 -07:00