From a5c811591ff25fef3f3fd2b6ae09eaa6eeb7e5bd Mon Sep 17 00:00:00 2001 From: noxiouz Date: Tue, 7 Apr 2026 16:29:56 +0100 Subject: [PATCH] sd-journal: skip full decompression when caller only checks field existence When both ret_data and ret_size are NULL after decompress_startswith() has confirmed the field matches, skip the decompress_blob() call. This avoids decompressing potentially large payloads (e.g. inline coredumps) just to discard the result. Co-developed-by: Claude Opus 4.6 --- src/libsystemd/sd-journal/journal-file.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/libsystemd/sd-journal/journal-file.c b/src/libsystemd/sd-journal/journal-file.c index 363df258a17..235f4712245 100644 --- a/src/libsystemd/sd-journal/journal-file.c +++ b/src/libsystemd/sd-journal/journal-file.c @@ -1965,6 +1965,10 @@ static int maybe_decompress_payload( *ret_size = 0; return 0; } + + /* Caller only wants to check field existence, skip full decompression */ + if (!ret_data && !ret_size) + return 1; } r = decompress_blob(compression, payload, size, &f->compress_buffer, &rsize, 0); -- 2.47.3