[FFmpeg-devel] [PATCH 1/3] avformat/fifo: assert on disallowed message type and state combinations

Marton Balint cus at passwd.hu
Sun Feb 19 17:57:35 EET 2017


On Sun, 12 Feb 2017, Marton Balint wrote:

>
> On Thu, 9 Feb 2017, Marton Balint wrote:
>
>> Fixes Coverity CID 1396277.
>>
>> Signed-off-by: Marton Balint <cus at passwd.hu>
>> ---
>> libavformat/fifo.c | 5 ++++-
>> 1 file changed, 4 insertions(+), 1 deletion(-)
>>
>> diff --git a/libavformat/fifo.c b/libavformat/fifo.c
>> index 8f525e5..2cbe5c5 100644
>> --- a/libavformat/fifo.c
>> +++ b/libavformat/fifo.c
>> @@ -19,6 +19,7 @@
>>  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
>>  */
>> 
>> +#include "libavutil/avassert.h"
>> #include "libavutil/opt.h"
>> #include "libavutil/time.h"
>> #include "libavutil/thread.h"
>> @@ -207,7 +208,7 @@ static int fifo_thread_write_trailer(FifoThreadContext 
> *ctx)
>> 
>> static int fifo_thread_dispatch_message(FifoThreadContext *ctx, FifoMessage 
> *msg)
>> {
>> -    int ret;
>> +    int ret = AVERROR(EINVAL);
>>
>>     if (!ctx->header_written) {
>>         ret = fifo_thread_write_header(ctx);
>> @@ -217,6 +218,7 @@ static int 
> fifo_thread_dispatch_message(FifoThreadContext *ctx, FifoMessage *msg
>>
>>     switch(msg->type) {
>>     case FIFO_WRITE_HEADER:
>> +        av_assert0(ret >= 0);
>>         return ret;
>>     case FIFO_WRITE_PACKET:
>>         return fifo_thread_write_packet(ctx, &msg->pkt);
>> @@ -224,6 +226,7 @@ static int 
> fifo_thread_dispatch_message(FifoThreadContext *ctx, FifoMessage *msg
>>         return fifo_thread_flush_output(ctx);
>>     }
>> 
>> +    av_assert0(0);
>>     return AVERROR(EINVAL);
>> }
>>
>
> Ping...
>

Pushed this as well.

Regards,
Marton


More information about the ffmpeg-devel mailing list