I am writing a multithreaded stream decoding application and testing in valgrind to check for leaks and such and I noticed the following invalid reads (see below). Since the errors are not frequent and I do not have a pattern to easily reproduce, it is hard to further debug this. The streams themselves may be corrupted but I would expect that should not break ffmpeg. Is there any way to validate for valid frames received with av_read_frame before passing them to avcodec_decode_audio3 ( I am checking the return value of read_frame, but that does not ensure a valid frame is in there ) ? I am following the avcodec_decode_audio3 warnings ( like allocating extra FF_INPUT_BUFFER_PADDING_SIZE, alignments and such), although I am not sure how can I satisfy this one : "The end of the input buffer avpkt->data should be set to 0 to ensure that no overreading happens for damaged MPEG streams" (my packets are retrieved by av_read_frame) ...
Any recommendations ? Thread 14: ==00:01:46:59.325 14351== Invalid read of size 4 ==00:01:46:59.325 14351== at 0x8341E35: get_bits (get_bits.h:285) ==00:01:46:59.325 14351== by 0x8341C6C: mp_decode_layer1 (mpegaudiodec.c:683) ==00:01:46:59.325 14351== by 0x8345876: mp_decode_frame (mpegaudiodec.c:1715) ==00:01:46:59.325 14351== by 0x8345DDF: decode_frame (mpegaudiodec.c:1816) ==00:01:46:59.325 14351== Address 0x4464973 is 339 bytes inside a block of size 342 alloc'd ==00:01:46:59.325 14351== at 0x4005046: memalign (vg_replace_malloc.c:581) ==00:01:46:59.325 14351== by 0x40050A0: posix_memalign (vg_replace_malloc.c:709) ==00:01:46:59.325 14351== by 0x858CF0B: av_malloc (mem.c:90) ==00:01:46:59.325 14351== by 0x819BD1D: av_dup_packet (avpacket.c:130) ==00:01:46:59.324 14351== Thread 10: ==00:01:46:59.324 14351== Invalid read of size 4 ==00:01:46:59.324 14351== at 0x8341E35: get_bits (get_bits.h:285) ==00:01:46:59.324 14351== by 0x8342407: mp_decode_layer2 (mpegaudiodec.c:806) ==00:01:46:59.324 14351== by 0x8345899: mp_decode_frame (mpegaudiodec.c:1719) ==00:01:46:59.324 14351== by 0x8345DDF: decode_frame (mpegaudiodec.c:1816) ==00:01:46:59.324 14351== Address 0x42a0bbb is 3 bytes after a block of size 248 alloc'd ==00:01:46:59.324 14351== at 0x4005046: memalign (vg_replace_malloc.c:581) ==00:01:46:59.325 14351== by 0x40050A0: posix_memalign (vg_replace_malloc.c:709) ==00:01:46:59.325 14351== by 0x858CF0B: av_malloc (mem.c:90) ==00:01:46:59.325 14351== by 0x819BD1D: av_dup_packet (avpacket.c:130) _______________________________________________ Libav-user mailing list [email protected] http://ffmpeg.org/mailman/listinfo/libav-user
