avformat/fifo: assert on disallowed message type and state combinations
Fixes Coverity CID 1396277. Signed-off-by: Marton Balint <cus@passwd.hu>
This commit is contained in:
parent
b921b3b42b
commit
8985e4af2b
@ -19,6 +19,7 @@
|
|||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include "libavutil/avassert.h"
|
||||||
#include "libavutil/opt.h"
|
#include "libavutil/opt.h"
|
||||||
#include "libavutil/time.h"
|
#include "libavutil/time.h"
|
||||||
#include "libavutil/thread.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)
|
static int fifo_thread_dispatch_message(FifoThreadContext *ctx, FifoMessage *msg)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret = AVERROR(EINVAL);
|
||||||
|
|
||||||
if (!ctx->header_written) {
|
if (!ctx->header_written) {
|
||||||
ret = fifo_thread_write_header(ctx);
|
ret = fifo_thread_write_header(ctx);
|
||||||
@ -217,6 +218,7 @@ static int fifo_thread_dispatch_message(FifoThreadContext *ctx, FifoMessage *msg
|
|||||||
|
|
||||||
switch(msg->type) {
|
switch(msg->type) {
|
||||||
case FIFO_WRITE_HEADER:
|
case FIFO_WRITE_HEADER:
|
||||||
|
av_assert0(ret >= 0);
|
||||||
return ret;
|
return ret;
|
||||||
case FIFO_WRITE_PACKET:
|
case FIFO_WRITE_PACKET:
|
||||||
return fifo_thread_write_packet(ctx, &msg->pkt);
|
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);
|
return fifo_thread_flush_output(ctx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
av_assert0(0);
|
||||||
return AVERROR(EINVAL);
|
return AVERROR(EINVAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user