Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#1053 closed defect (invalid)

Crash on avcodec_default_release_buffer

Reported by: Lastique Owned by:
Priority: important Component: avcodec
Version: 0.10 Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

When allocating an internal buffer for an audio frame, audio_get_buffer in libavcodec/utils.c does not increment buffer_count. This results in incorrect behavior of avcodec_default_release_buffer (it attempts to FFSWAP InternalBuffer when buf is NULL) for this frame and consequently a crash with SIGSEGV.

Please, find a simple test case attached that reproduce the problem. Compiled with the following command line:

gcc -o av_internal_buf_crash -lavcodec -lavutil av_internal_buf_crash.c

Attachments (1)

av_internal_buf_crash.c (887 bytes ) - added by Lastique 12 years ago.
A test case to reproduce the problem.

Download all attachments as: .zip

Change History (3)

by Lastique, 12 years ago

Attachment: av_internal_buf_crash.c added

A test case to reproduce the problem.

comment:1 by Michael Niedermayer, 12 years ago

Resolution: invalid
Status: newclosed

Why do you call a function that starts with assert(video) on a audio frame ?
ive made sure that the assert is always checked so this produces a clearer error instead of just crashing. And yes the API is not well documented, patches that improve this are welcome.
Iam closing this as invalid, as it seems a misuse of API, but dont hesitate to reopen if you need to call several get buffer and thus release buffer in a decoder. And sorry for the late awnser dunno why ive missed this issue

comment:2 by Lastique, 12 years ago

Thanks for the answer. The assert didn't work since I was using a release build available in my Linux distribution. I've already changed my code to not use internal buffers for audio.

Note: See TracTickets for help on using tickets.