[Libav-user] "Segmentation fault" When encoding H264 video frame
M N
assemblerx86 at yandex.com
Wed Sep 14 22:51:35 EEST 2016
14.09.2016, 18:36, "Carl Eugen Hoyos" <ceffmpeg at gmail.com>:
> This still needs a debug version of libavcodec, things will be much
> easier for you if you use a static library that you compiled yourself.
> (./configure --enable-gpl --enable-libx264 && make)
>
> And consider to fix the other issues valgrind reports.
>
> Carl Eugen
> _______________________________________________
> Libav-user mailing list
> Libav-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/libav-user
OK, I have built FFMPEG with debug support, gpl and x264 flags were already enabled though.
Here is the NEW Valgrind output:
*************************************
==6685== Memcheck, a memory error detector
==6685== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==6685== Using Valgrind-3.10.1 and LibVEX; rerun with -h for copyright info
==6685== Command: ./out
==6685==
0
==6685== Invalid write of size 8
==6685== at 0x4013EA: main (main.c:49)
==6685== Address 0xcb95d10 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x401405: main (main.c:51)
==6685== Address 0xcb95d10 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid write of size 8
==6685== at 0x40145D: main (main.c:59)
==6685== Address 0xcb95d60 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x401478: main (main.c:61)
==6685== Address 0xcb95d10 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x4014C1: main (main.c:63)
==6685== Address 0xcb95d10 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x40151A: main (main.c:73)
==6685== Address 0xcb95d10 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x401540: main (main.c:74)
==6685== Address 0xcb95d60 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x40155B: main (main.c:74)
==6685== Address 0xcb95d60 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x401582: main (main.c:76)
==6685== Address 0xcb95d60 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x40159D: main (main.c:76)
==6685== Address 0xcb95d10 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x4015C4: main (main.c:77)
==6685== Address 0xcb95d60 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x4015DF: main (main.c:77)
==6685== Address 0xcb95d10 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x401606: main (main.c:78)
==6685== Address 0xcb95d60 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x401621: main (main.c:78)
==6685== Address 0xcb95d10 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x40165A: main (main.c:82)
==6685== Address 0xcb95d60 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x4016E2: main (main.c:87)
==6685== Address 0xcb95d60 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x4016FD: main (main.c:87)
==6685== Address 0xcb95d10 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x4018F1: main (main.c:104)
==6685== Address 0xcb95d10 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x401931: main (main.c:107)
==6685== Address 0xcb95d10 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x401963: main (main.c:108)
==6685== Address 0xcb95d60 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
[libx264 @ 0xcb9e440] broken ffmpeg default settings detected
[libx264 @ 0xcb9e440] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0xcb9e440] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0xcb9e440] speed presets are listed in x264 --help
[libx264 @ 0xcb9e440] profile is optional; x264 defaults to high
1
==6685== Invalid read of size 8
==6685== at 0x40149A: main (main.c:61)
==6685== Address 0xcb95d18 is 6 bytes after a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x40172B: main (main.c:90)
==6685== Address 0xcb95d68 is 6 bytes after a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x401746: main (main.c:90)
==6685== Address 0xcb95d68 is 6 bytes after a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x40176D: main (main.c:91)
==6685== Address 0xcb95d68 is 6 bytes after a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x401788: main (main.c:91)
==6685== Address 0xcb95d18 is 6 bytes after a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x4017AF: main (main.c:92)
==6685== Address 0xcb95d68 is 6 bytes after a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x4017CA: main (main.c:92)
==6685== Address 0xcb95d18 is 6 bytes after a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x4017F3: main (main.c:93)
==6685== Address 0xcb95d68 is 6 bytes after a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x40180E: main (main.c:93)
==6685== Address 0xcb95d68 is 6 bytes after a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x40183E: main (main.c:95)
==6685== Address 0xcb95d68 is 6 bytes after a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x40186C: main (main.c:96)
==6685== Address 0xcb95d68 is 6 bytes after a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x4018A5: main (main.c:97)
==6685== Address 0xcb95d68 is 6 bytes after a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x4018C0: main (main.c:97)
==6685== Address 0xcb95d68 is 6 bytes after a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
done
Write header 0: Success
==6685== Invalid read of size 8
==6685== at 0x401D9A: main (main.c:157)
==6685== Address 0xcb95d10 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x401313: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x401DD8: main (main.c:159)
==6685== Address 0xcb95d60 is 0 bytes inside a block of size 2 alloc'd
==6685== at 0x4C29F40: malloc (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==6685== by 0x40132E: main (main.c:31)
==6685==
==6685== Invalid read of size 8
==6685== at 0x5297EB0: avcodec_encode_video2 (utils.c:2173)
==6685== by 0x401DF0: main (main.c:159)
==6685== Address 0x48 is not stack'd, malloc'd or (recently) free'd
==6685==
==6685==
==6685== Process terminating with default action of signal 11 (SIGSEGV)
==6685== Access not within mapped region at address 0x48
==6685== at 0x5297EB0: avcodec_encode_video2 (utils.c:2173)
==6685== by 0x401DF0: main (main.c:159)
==6685== If you believe this happened as a result of a stack
==6685== overflow in your program's main thread (unlikely but
==6685== possible), you can try to increase the size of the
==6685== main thread stack using the --main-stacksize= flag.
==6685== The main thread stack size used in this run was 8388608.
==6685==
==6685== HEAP SUMMARY:
==6685== in use at exit: 3,782,903 bytes in 482 blocks
==6685== total heap usage: 1,005 allocs, 523 frees, 10,004,233 bytes allocated
==6685==
==6685== LEAK SUMMARY:
==6685== definitely lost: 0 bytes in 0 blocks
==6685== indirectly lost: 0 bytes in 0 blocks
==6685== possibly lost: 51,360 bytes in 15 blocks
==6685== still reachable: 3,731,543 bytes in 467 blocks
==6685== suppressed: 0 bytes in 0 blocks
==6685== Rerun with --leak-check=full to see details of leaked memory
==6685==
==6685== For counts of detected and suppressed errors, rerun with: -v
==6685== ERROR SUMMARY: 45 errors from 36 contexts (suppressed: 0 from 0)
Killed
*************************************
And here is the NEW GDB output with backtracing:
*************************************
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
0
[New Thread 0x7ffff0726700 (LWP 7724)]
[New Thread 0x7fffeff25700 (LWP 7725)]
[New Thread 0x7fffef724700 (LWP 7726)]
[New Thread 0x7fffeef23700 (LWP 7727)]
[New Thread 0x7fffee722700 (LWP 7728)]
[New Thread 0x7fffedf21700 (LWP 7729)]
[New Thread 0x7fffed720700 (LWP 7730)]
[libx264 @ 0x7e0830] broken ffmpeg default settings detected
[libx264 @ 0x7e0830] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0x7e0830] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0x7e0830] speed presets are listed in x264 --help
[libx264 @ 0x7e0830] profile is optional; x264 defaults to high
1
done
Write header 0: Success
Program received signal SIGSEGV, Segmentation fault.
avcodec_encode_video2 (avctx=0x7e0830, avpkt=0x7fffffffdbe0, frame=0x7a3a60,
got_packet_ptr=0x7fffffffdb1c)
at /usr/src/debug/media-video/ffmpeg-2.8.6/ffmpeg-2.8.6/libavcodec/utils.c:2173
2173 if(CONFIG_FRAME_THREAD_ENCODER &&
(gdb) bt
#0 avcodec_encode_video2 (avctx=0x7e0830, avpkt=0x7fffffffdbe0,
frame=0x7a3a60, got_packet_ptr=0x7fffffffdb1c)
at /usr/src/debug/media-video/ffmpeg-2.8.6/ffmpeg-2.8.6/libavcodec/utils.c:2173
#1 0x0000000000401df1 in main () at main.c:159
*************************************
More information about the Libav-user
mailing list