apache / arrow-nanoarrow

Helpers for Arrow C Data & Arrow C Stream interfaces
https://arrow.apache.org/nanoarrow
Apache License 2.0
174 stars 38 forks source link

test: Fix meson build and clean up some warnings #595

Closed WillAyd closed 2 months ago

WillAyd commented 2 months ago

The meson build is broken without this dependency. Also fixed up a few warnings around unused variables and the use of uninitialized struct members

WillAyd commented 2 months ago

Not really familiar with the IPC code or Run End Encoding, but looks like the UBSAN running in the meson build picks up that we are calling memcpy with a NULL dst argument somewhere in the stack:

../src/nanoarrow/common/inline_buffer.h:294:3: runtime error: null pointer passed as argument 1, which is declared to never be null
    #0 0x7abd950d3ff9 in ArrowBufferAppendFill ../src/nanoarrow/common/inline_buffer.h:294
    #1 0x7abd950d9a2b in ArrowIpcEncoderBuildContiguousBodyBufferCallback ../src/nanoarrow/ipc/encoder.c:511
    #2 0x7abd950da36b in ArrowIpcEncoderEncodeRecordBatchImpl ../src/nanoarrow/ipc/encoder.c:546
    #3 0x7abd950dac34 in ArrowIpcEncoderEncodeRecordBatch ../src/nanoarrow/ipc/encoder.c:590
    #4 0x7abd950db1a5 in ArrowIpcEncoderEncodeSimpleRecordBatch ../src/nanoarrow/ipc/encoder.c:622
    #5 0x6531f7d04f6d in ArrowTypeParameterizedTestFixture_NanoarrowIpcNanoarrowArrayRoundtrip_Test::TestBody() ../src/nanoarrow/ipc/decoder_test.cc:815
    #6 0x6531f7f1e93b in void testing::internal::HandleSehExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../subprojects/googletest-1.14.0/googletest/src/gtest.cc:2612
    #7 0x6531f7ef698a in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ../subprojects/googletest-1.14.0/googletest/src/gtest.cc:2648
    #8 0x6531f7e3f9b5 in testing::Test::Run() ../subprojects/googletest-1.14.0/googletest/src/gtest.cc:2687
    #9 0x6531f7e43a3e in testing::TestInfo::Run() ../subprojects/googletest-1.14.0/googletest/src/gtest.cc:2836
    #10 0x6531f7e4877b in testing::TestSuite::Run() ../subprojects/googletest-1.14.0/googletest/src/gtest.cc:3015
    #11 0x6531f7e93e22 in testing::internal::UnitTestImpl::RunAllTests() ../subprojects/googletest-1.14.0/googletest/src/gtest.cc:5920
    #12 0x6531f7f24673 in bool testing::internal::HandleSehExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../subprojects/googletest-1.14.0/googletest/src/gtest.cc:2612
    #13 0x6531f7efd21a in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) ../subprojects/googletest-1.14.0/googletest/src/gtest.cc:2648
    #14 0x6531f7e8676b in testing::UnitTest::Run() ../subprojects/googletest-1.14.0/googletest/src/gtest.cc:5484
    #15 0x6531f7f756ca in RUN_ALL_TESTS() ../subprojects/googletest-1.14.0/googletest/include/gtest/gtest.h:2317
    #16 0x6531f7f75497 in main ../subprojects/googletest-1.14.0/googletest/src/gtest_main.cc:64
    #17 0x7abd91c29d8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #18 0x7abd91c29e3f in __libc_start_main_impl ../csu/libc-start.c:392
    #19 0x6531f7ccf924 in _start (/home/willayd/clones/arrow-nanoarrow/builddir/nanoarrow-ipc-decoder-test+0x42f924)

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../src/nanoarrow/common/inline_buffer.h:294:3 in