summaryrefslogtreecommitdiff
path: root/libavformat/mspdec.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/mspdec.c')
-rw-r--r--libavformat/mspdec.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/mspdec.c b/libavformat/mspdec.c
index b81d835a63..4845eb3729 100644
--- a/libavformat/mspdec.c
+++ b/libavformat/mspdec.c
@@ -70,11 +70,12 @@ static int msp_read_header(AVFormatContext *s)
if (st->codecpar->codec_id == AV_CODEC_ID_RAWVIDEO) {
cntx->packet_size = av_image_get_buffer_size(st->codecpar->format, st->codecpar->width, st->codecpar->height, 1);
- if (cntx->packet_size < 0)
- return cntx->packet_size;
} else
cntx->packet_size = 2 * st->codecpar->height;
+ if (cntx->packet_size <= 0)
+ return cntx->packet_size < 0 ? cntx->packet_size : AVERROR_INVALIDDATA;
+
return 0;
}