]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-compression: test_lz4_chunk_size() - Check return values of ()
authorMarco Bettini <marco.bettini@open-xchange.com>
Mon, 9 Mar 2026 10:09:29 +0000 (10:09 +0000)
committertimo.sirainen <timo.sirainen@open-xchange.com>
Tue, 10 Mar 2026 21:52:39 +0000 (21:52 +0000)
Found by coverity, id 42237, Error handling issues

src/lib-compression/test-compression.c

index c515b8fa1aea0ae75beddabebf9b713b7bfb940c..a81c36d6f00c0e0d126cfb4695a68b5ca1ffc7c5 100644 (file)
@@ -1077,8 +1077,8 @@ static void test_lz4_chunk_size(void)
                                              sizeof(lz4_chunk_crash_01));
        input = lz4->create_istream(file_input);
        i_stream_unref(&file_input);
-       i_stream_read(input);
 
+       test_assert(i_stream_read(input) == -1);
        test_assert(input->eof);
        test_assert(input->stream_errno != 0);
        const char *error = i_stream_get_error(input);
@@ -1090,8 +1090,8 @@ static void test_lz4_chunk_size(void)
                                              sizeof(lz4_chunk_crash_02));
        input = lz4->create_istream(file_input);
        i_stream_unref(&file_input);
-       i_stream_read(input);
 
+       test_assert(i_stream_read(input) == -1);
        test_assert(input->eof);
        test_assert(input->stream_errno != 0);
        error = i_stream_get_error(input);
@@ -1103,9 +1103,9 @@ static void test_lz4_chunk_size(void)
                                              sizeof(lz4_chunk_eof_03));
        input = lz4->create_istream(file_input);
        i_stream_unref(&file_input);
-       i_stream_read(input);
 
        /* no error, but no content either */
+       test_assert(i_stream_read(input) == -1);
        test_assert(input->eof);
        test_assert(input->stream_errno == 0);