]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
compression/tests: Fix possible out of bound access CID:1517301
authorVinit Agnihotri <vagnihot@redhat.com>
Fri, 8 Aug 2025 12:23:14 +0000 (17:53 +0530)
committerMartin Schwenke <martins@samba.org>
Mon, 11 Aug 2025 22:59:26 +0000 (22:59 +0000)
This would fix additional coverity issue:1517285

Signed-off-by: Vinit Agnihotri <vagnihot@redhat.com>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Autobuild-User(master): Martin Schwenke <martins@samba.org>
Autobuild-Date(master): Mon Aug 11 22:59:26 UTC 2025 on atb-devel-224

lib/compression/tests/test_lzxpress_plain.c

index 1c147932d40d68f8e10850e1d1e764199b40ed15..44b8f9085119975171c3b6ffe6381e1ddd374cc8 100644 (file)
@@ -363,6 +363,11 @@ static ssize_t attempt_round_trip(TALLOC_CTX *mem_ctx,
                                             comp_written,
                                             decompressed.data,
                                             decompressed.length);
+       if (decomp_written <= 0) {
+               talloc_free(tmp_ctx);
+               return -1;
+       }
+
        debug_end_timer("decompress", original.length);
        if (save_name != NULL && LZX_DEBUG_FILES) {
                char s[300];