AOMediaCodec / libavif

libavif - Library for encoding and decoding .avif files
Other
1.52k stars 191 forks source link

1.0.3: test suite fails with SIGSEGV in `avifcodectest` unit #1992

Open kloczek opened 7 months ago

kloczek commented 7 months ago

Looks like one unit is failing with SIGSEGV

[tkloczko@pers-jacek x86_64-redhat-linux-gnu]$ "/home/tkloczko/rpmbuild/BUILD/libavif-1.0.3/x86_64-redhat-linux-gnu/tests/avifcodectest"
Running main() from /home/tkloczko/rpmbuild/BUILD/googletest-1.14.0/googletest/src/gtest_main.cc
[==========] Running 9 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 9 tests from All/CodecTest
[ RUN      ] All/CodecTest.EncodeDecode/0
[       OK ] All/CodecTest.EncodeDecode/0 (67 ms)
[ RUN      ] All/CodecTest.EncodeDecode/1
[       OK ] All/CodecTest.EncodeDecode/1 (59 ms)
[ RUN      ] All/CodecTest.EncodeDecode/2
/home/tkloczko/rpmbuild/BUILD/libavif-1.0.3/tests/gtest/avifcodectest.cc:21: Skipped
Codec unavailable, skip test.

[  SKIPPED ] All/CodecTest.EncodeDecode/2 (0 ms)
[ RUN      ] All/CodecTest.EncodeDecode/3
[       OK ] All/CodecTest.EncodeDecode/3 (15 ms)
[ RUN      ] All/CodecTest.EncodeDecode/4
[       OK ] All/CodecTest.EncodeDecode/4 (12 ms)
[ RUN      ] All/CodecTest.EncodeDecode/5
/home/tkloczko/rpmbuild/BUILD/libavif-1.0.3/tests/gtest/avifcodectest.cc:21: Skipped
Codec unavailable, skip test.

[  SKIPPED ] All/CodecTest.EncodeDecode/5 (0 ms)
[ RUN      ] All/CodecTest.EncodeDecode/6
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:       SVT-AV1 Encoder Lib v1.8.0
Svt[info]: SVT [build]  :       GCC 14.0.1 20240127 (Red Hat 14.0.1-0)   64 bit
Svt[info]: LIB Build date: Feb  2 2024 17:40:11
Svt[info]: -------------------------------------------
Svt[info]: Number of logical cores available: 1
Svt[info]: Number of PPCS 74
Svt[info]: [asm level on system : up to avx512]
Svt[info]: [asm level selected : up to avx2]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile   tier (auto)     level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator               : 64 / 64 / 60000 / 1000
Svt[info]: SVT [config]: bit-depth / color format                                       : 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct                                    : 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type                      : 321 / 32 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor                                         : CRF / 6
Svt[info]: -------------------------------------------
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:       SVT-AV1 Encoder Lib v1.8.0
Svt[info]: SVT [build]  :       GCC 14.0.1 20240127 (Red Hat 14.0.1-0)   64 bit
Svt[info]: LIB Build date: Feb  2 2024 17:40:11
Svt[info]: -------------------------------------------
Svt[info]: Number of logical cores available: 1
Svt[info]: Number of PPCS 74
Svt[info]: [asm level on system : up to avx512]
Svt[info]: [asm level selected : up to avx2]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile   tier (auto)     level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator               : 64 / 64 / 60000 / 1000
Svt[info]: SVT [config]: bit-depth / color format                                       : 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct                                    : 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type                      : 321 / 32 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor                                         : CRF / 6
Svt[info]: -------------------------------------------
Segmentation fault (core dumped)
[tkloczko@pers-jacek x86_64-redhat-linux-gnu]$ gdb /home/tkloczko/rpmbuild/BUILD/libavif-1.0.3/x86_64-redhat-linux-gnu/tests/avifcodectest
GNU gdb (GDB) G2V 13.2-8.fc35
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
    <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/tkloczko/rpmbuild/BUILD/libavif-1.0.3/x86_64-redhat-linux-gnu/tests/avifcodectest...
(gdb) r
Starting program: /home/tkloczko/rpmbuild/BUILD/libavif-1.0.3/x86_64-redhat-linux-gnu/tests/avifcodectest
warning: Unable to open "librpm.so.9" (librpm.so.9: cannot open shared object file: No such file or directory), missing debuginfos notifications will not be displayed
Missing separate debuginfo for /lib64/libgtest_main.so.1.14.0.
The debuginfo package for this file is probably broken.
Missing separate debuginfo for /lib64/libgtest.so.1.14.0.
The debuginfo package for this file is probably broken.
Missing separate debuginfo for /lib64/libstdc++.so.6.
The debuginfo package for this file is probably broken.
Missing separate debuginfo for /lib64/libm.so.6.
The debuginfo package for this file is probably broken.
Missing separate debuginfo for /lib64/libc.so.6.
The debuginfo package for this file is probably broken.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Missing separate debuginfo for /lib64/libdav1d.so.7.
The debuginfo package for this file is probably broken.
Missing separate debuginfo for /lib64/librav1e.so.0.
The debuginfo package for this file is probably broken.
Missing separate debuginfo for /lib64/libSvtAv1Enc.so.1.
The debuginfo package for this file is probably broken.
Missing separate debuginfo for /lib64/libaom.so.3.
The debuginfo package for this file is probably broken.
Missing separate debuginfo for /lib64/libgcc_s.so.1.
The debuginfo package for this file is probably broken.
Missing separate debuginfo for /lib64/libvmaf.so.3.
The debuginfo package for this file is probably broken.
Running main() from /home/tkloczko/rpmbuild/BUILD/googletest-1.14.0/googletest/src/gtest_main.cc
[==========] Running 9 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 9 tests from All/CodecTest
[ RUN      ] All/CodecTest.EncodeDecode/0
[       OK ] All/CodecTest.EncodeDecode/0 (91 ms)
[ RUN      ] All/CodecTest.EncodeDecode/1
[       OK ] All/CodecTest.EncodeDecode/1 (60 ms)
[ RUN      ] All/CodecTest.EncodeDecode/2
/home/tkloczko/rpmbuild/BUILD/libavif-1.0.3/tests/gtest/avifcodectest.cc:21: Skipped
Codec unavailable, skip test.

[  SKIPPED ] All/CodecTest.EncodeDecode/2 (0 ms)
[ RUN      ] All/CodecTest.EncodeDecode/3
[New Thread 0x7ffff65ff6c0 (LWP 2931429)]
[New Thread 0x7ffff63fe6c0 (LWP 2931430)]
[       OK ] All/CodecTest.EncodeDecode/3 (16 ms)
[ RUN      ] All/CodecTest.EncodeDecode/4
[Thread 0x7ffff63fe6c0 (LWP 2931430) exited]
[New Thread 0x7ffff63fe6c0 (LWP 2931431)]
[Thread 0x7ffff65ff6c0 (LWP 2931429) exited]
[New Thread 0x7ffff65ff6c0 (LWP 2931432)]
[       OK ] All/CodecTest.EncodeDecode/4 (12 ms)
[ RUN      ] All/CodecTest.EncodeDecode/5
/home/tkloczko/rpmbuild/BUILD/libavif-1.0.3/tests/gtest/avifcodectest.cc:21: Skipped
Codec unavailable, skip test.

[  SKIPPED ] All/CodecTest.EncodeDecode/5 (0 ms)
[ RUN      ] All/CodecTest.EncodeDecode/6
[Thread 0x7ffff65ff6c0 (LWP 2931432) exited]
Svt[info]: [Thread 0x7ffff63fe6c0 (LWP 2931431) exited]
-------------------------------------------
Svt[info]: SVT [version]:       SVT-AV1 Encoder Lib v1.8.0
Svt[info]: SVT [build]  :       GCC 14.0.1 20240127 (Red Hat 14.0.1-0)   64 bit
Svt[info]: LIB Build date: Feb  2 2024 17:40:11
Svt[info]: -------------------------------------------
Svt[info]: Number of logical cores available: 1
Svt[info]: Number of PPCS 74
Svt[info]: [asm level on system : up to avx512]
Svt[info]: [asm level selected : up to avx2]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile   tier (auto)     level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator               : 64 / 64 / 60000 / 1000
Svt[info]: SVT [config]: bit-depth / color format                                       : 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct                                    : 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type                      : 321 / 32 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor                                         : CRF / 6
Svt[info]: -------------------------------------------
[New Thread 0x7ffff63fe6c0 (LWP 2931433)]
[New Thread 0x7ffff65ff6c0 (LWP 2931434)]
[New Thread 0x7ffff5e2b6c0 (LWP 2931435)]
[New Thread 0x7ffff5d2a6c0 (LWP 2931436)]
[New Thread 0x7ffff5c296c0 (LWP 2931437)]
[New Thread 0x7ffff5b286c0 (LWP 2931438)]
[New Thread 0x7ffff5a276c0 (LWP 2931439)]
[New Thread 0x7ffff59266c0 (LWP 2931440)]
[New Thread 0x7ffff58256c0 (LWP 2931441)]
[New Thread 0x7ffff57246c0 (LWP 2931442)]
[New Thread 0x7ffff56236c0 (LWP 2931443)]
[New Thread 0x7ffff55226c0 (LWP 2931444)]
[New Thread 0x7ffff54216c0 (LWP 2931445)]
[New Thread 0x7ffff53206c0 (LWP 2931446)]
[New Thread 0x7ffff521f6c0 (LWP 2931447)]
[New Thread 0x7ffff511e6c0 (LWP 2931448)]
Svt[info]: -------------------------------------------
Svt[info]: SVT [version]:       SVT-AV1 Encoder Lib v1.8.0
Svt[info]: SVT [build]  :       GCC 14.0.1 20240127 (Red Hat 14.0.1-0)   64 bit
Svt[info]: LIB Build date: Feb  2 2024 17:40:11
Svt[info]: -------------------------------------------
Svt[info]: Number of logical cores available: 1
Svt[info]: Number of PPCS 74
Svt[info]: [asm level on system : up to avx512]
Svt[info]: [asm level selected : up to avx2]
Svt[info]: -------------------------------------------
Svt[info]: SVT [config]: main profile   tier (auto)     level (auto)
Svt[info]: SVT [config]: width / height / fps numerator / fps denominator               : 64 / 64 / 60000 / 1000
Svt[info]: SVT [config]: bit-depth / color format                                       : 8 / YUV420
Svt[info]: SVT [config]: preset / tune / pred struct                                    : 10 / PSNR / random access
Svt[info]: SVT [config]: gop size / mini-gop size / key-frame type                      : 321 / 32 / key frame
Svt[info]: SVT [config]: BRC mode / rate factor                                         : CRF / 6
Svt[info]: -------------------------------------------
[New Thread 0x7ffff4c4b6c0 (LWP 2931449)]
[New Thread 0x7ffff4b4a6c0 (LWP 2931450)]
[New Thread 0x7ffff4a496c0 (LWP 2931451)]
[New Thread 0x7ffff49486c0 (LWP 2931452)]
[New Thread 0x7ffff48476c0 (LWP 2931453)]
[New Thread 0x7ffff47466c0 (LWP 2931454)]
[New Thread 0x7ffff46456c0 (LWP 2931455)]
[New Thread 0x7ffff45446c0 (LWP 2931456)]
[New Thread 0x7ffff44436c0 (LWP 2931457)]
[New Thread 0x7ffff43426c0 (LWP 2931458)]
[New Thread 0x7ffff42416c0 (LWP 2931459)]
[New Thread 0x7ffff41406c0 (LWP 2931460)]
[New Thread 0x7fffeffff6c0 (LWP 2931461)]
[New Thread 0x7fffefefe6c0 (LWP 2931462)]
[New Thread 0x7fffefdfd6c0 (LWP 2931463)]
[New Thread 0x7fffefcfc6c0 (LWP 2931464)]

Thread 1 "avifcodectest" received signal SIGSEGV, Segmentation fault.
0x00007ffff6c7eac1 in svt_memcpy_small.lto_priv () from /lib64/libSvtAv1Enc.so.1
(gdb) bt full
#0  0x00007ffff6c7eac1 in svt_memcpy_small.lto_priv () from /lib64/libSvtAv1Enc.so.1
No symbol table info available.
#1  0x00007ffff6d41bad in svt_av1_enc_send_picture () from /lib64/libSvtAv1Enc.so.1
No symbol table info available.
#2  0x00007ffff7fa33d6 in svtCodecEncodeImage (codec=0x55555557b0a0, encoder=0x55555557e7e0, image=<optimized out>, alpha=1, tileRowsLog2=<optimized out>, tileColsLog2=<optimized out>,
    quantizer=<optimized out>, encoderChanges=<optimized out>, disableLaggedOutput=<optimized out>, addImageFlags=<optimized out>, output=<optimized out>)
    at /home/tkloczko/rpmbuild/BUILD/libavif-1.0.3/src/codec_svt.c:223
        result = AVIF_RESULT_UNKNOWN_ERROR
        color_format = <optimized out>
        input_buffer = 0x555558631710
        res = <optimized out>
        y_shift = <optimized out>
        cleanup = <optimized out>
        input_picture_buffer = <optimized out>
        bytesPerPixel = <optimized out>
        frame_type = <optimized out>
#3  0x00007ffff7fa4baa in avifEncoderAddImageInternal (encoder=encoder@entry=0x55555557e7e0, gridCols=gridCols@entry=1, gridRows=gridRows@entry=1,
    cellImages=cellImages@entry=0x7fffffffd838, durationInTimescales=durationInTimescales@entry=1, addImageFlags=<optimized out>, addImageFlags@entry=2)
    at /home/tkloczko/rpmbuild/BUILD/libavif-1.0.3/src/write.c:1308
        cellImage = 0x7fffe8000ee0
        paddedCellImage = 0x0
        quantizer = <optimized out>
        encodeResult = <optimized out>
        item = <optimized out>
        itemIndex = <optimized out>
        cellCount = <optimized out>
        firstCell = <optimized out>
        bottomRightCell = <optimized out>
        tileWidth = 64
        tileHeight = <optimized out>
        gridWidth = <optimized out>
        gridHeight = <optimized out>
        codecType = <optimized out>
        encoderChanges = <optimized out>
        frame = <optimized out>
#4  0x00007ffff7fa5263 in avifEncoderAddImage (encoder=encoder@entry=0x55555557e7e0, image=<optimized out>, durationInTimescales=durationInTimescales@entry=1,
    addImageFlags=addImageFlags@entry=2) at /home/tkloczko/rpmbuild/BUILD/libavif-1.0.3/src/write.c:1343
No locals.
#5  0x00007ffff7fa85c0 in avifEncoderWrite (encoder=0x55555557e7e0, image=<optimized out>, output=0x7fffffffd9a0) at /home/tkloczko/rpmbuild/BUILD/libavif-1.0.3/src/write.c:2255
        addImageResult = <optimized out>
#6  0x0000555555560517 in libavif::(anonymous namespace)::CodecTest_EncodeDecode_Test::TestBody (this=<optimized out>) at /usr/include/c++/14/bits/unique_ptr.h:193
        gtest_ar = {success_ = true, message_ = {
            _M_t = {<std::__uniq_ptr_impl<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::default_delete<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {
                _M_t = {<std::_Tuple_impl<0, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, std::default_delete<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<std::_Tuple_impl<1, std::default_delete<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >> = {<std::_Head_base<1, std::default_delete<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, true>> = {
                        _M_head_impl = {<No data fields>}}, <No data fields>}, <std::_Head_base<0, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >*, false>> = {_M_head_impl = 0x0}, <No data fields>}, <No data fields>}}, <No data fields>}}}
        encoding_codec = AVIF_CODEC_CHOICE_SVT
        decoding_codec = AVIF_CODEC_CHOICE_AOM
        image = {_M_t = {<std::__uniq_ptr_impl<avifImage, void (*)(avifImage*)>> = {
              _M_t = {<std::_Tuple_impl<0, avifImage*, void (*)(avifImage*)>> = {<std::_Tuple_impl<1, void (*)(avifImage*)>> = {<std::_Head_base<1, void (*)(avifImage*), false>> = {
                      _M_head_impl = 0x7ffff7f92e60 <avifImageDestroy>}, <No data fields>}, <std::_Head_base<0, avifImage*, false>> = {
                    _M_head_impl = 0x7fffe8000ee0}, <No data fields>}, <No data fields>}}, <No data fields>}}
        encoder = <optimized out>
        encoded = {<avifRWData> = {data = 0x0, size = 0}, <No data fields>}
        decoder = <optimized out>
        decoded = {_M_t = {<std::__uniq_ptr_impl<avifImage, void (*)(avifImage*)>> = {
--Type <RET> for more, q to quit, c to continue without paging--
              _M_t = {<std::_Tuple_impl<0, avifImage*, void (*)(avifImage*)>> = {<std::_Tuple_impl<1, void (*)(avifImage*)>> = {<std::_Head_base<1, void (*)(avifImage*), false>> = {
                      _M_head_impl = 0x7fff00000000}, <No data fields>}, <std::_Head_base<0, avifImage*, false>> = {
                    _M_head_impl = 0x7ffff0002790}, <No data fields>}, <No data fields>}}, <No data fields>}}
#7  0x00007ffff7f5d25f in void testing::internal::HandleExceptionsInMethodIfSupported<testing::Test, void>(testing::Test*, void (testing::Test::*)(), char const*) ()
   from /lib64/libgtest.so.1.14.0
No symbol table info available.
#8  0x00007ffff7f5d51e in testing::Test::Run() () from /lib64/libgtest.so.1.14.0
No symbol table info available.
#9  0x00007ffff7f5d8f5 in testing::TestInfo::Run() () from /lib64/libgtest.so.1.14.0
No symbol table info available.
#10 0x00007ffff7f5e50f in testing::TestSuite::Run() () from /lib64/libgtest.so.1.14.0
No symbol table info available.
#11 0x00007ffff7f6e2d0 in testing::internal::UnitTestImpl::RunAllTests() () from /lib64/libgtest.so.1.14.0
No symbol table info available.
#12 0x00007ffff7f5dc07 in bool testing::internal::HandleExceptionsInMethodIfSupported<testing::internal::UnitTestImpl, bool>(testing::internal::UnitTestImpl*, bool (testing::internal::UnitTestImpl::*)(), char const*) () from /lib64/libgtest.so.1.14.0
No symbol table info available.
#13 0x00007ffff7f5de2c in testing::UnitTest::Run() () from /lib64/libgtest.so.1.14.0
No symbol table info available.
#14 0x00007ffff7fb3116 in main () from /lib64/libgtest_main.so.1.14.0
No symbol table info available.
#15 0x00007ffff795a088 in __libc_start_call_main () from /lib64/libc.so.6
No symbol table info available.
#16 0x00007ffff795a14b in __libc_start_main_impl () from /lib64/libc.so.6
No symbol table info available.
#17 0x0000555555558615 in _start ()
No symbol table info available.

I'm using gcc 14 from Fedora rawhide.

y-guyon commented 7 months ago

Thank you for the report.

I was not able to reproduce the issue with

git clone https://github.com/AOMediaCodec/libavif.git
cd libavif 
git checkout ecf2dfc
cd ext && ./aom.cmd && ./svt.cmd && ./googletest.cmd && cd ..
cmake -S . -B build \
 -DAVIF_BUILD_TESTS=ON \
 -DAVIF_ENABLE_GTEST=ON \
 -DAVIF_LOCAL_GTEST=ON \
 -DAVIF_CODEC_AOM=ON \
 -DAVIF_LOCAL_AOM=ON \
 -DAVIF_CODEC_SVT=ON \
 -DAVIF_LOCAL_SVT=ON \
 -DCMAKE_BUILD_TYPE=Debug \
 -DBUILD_SHARED_LIBS=OFF
cmake --build build --parallel
cd build
ctest . -R avifcodectest -VV

-- The C compiler identification is GNU 13.2.0 ... Svt[info]: SVT [version]: SVT-AV1 Encoder Lib v1.6.0 Svt[info]: SVT [build] : Debian Clang 16.0.6 (16) 64 bit avifcodectest .................... Passed 0.09 sec

Same with svt-av1 v1.7.0 like at main.

However with v1.8.0:

Svt[info]: SVT [version]: SVT-AV1 Encoder Lib v1.8.0 Svt[info]: SVT [build] : Debian Clang 16.0.6 (16) 64 bit avifcodectest ....................***Exception: SegFault 0.13 sec


I filed https://gitlab.com/AOMediaCodec/SVT-AV1/-/issues/2146.
In the meantime can you use another version of SVT-AV1 or another codec?

y-guyon commented 7 months ago

I also reproduced the issue at HEAD 3ead1f3e99112871af0c52d4dc57a144d662b8cd.