avformat/westwood_audenc: Check for, not assert on invalid data

Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2021-04-26 14:48:33 +02:00
parent a6d4ea285c
commit a64d4de0d4
1 changed files with 2 additions and 1 deletions

View File

@ -103,7 +103,8 @@ static int wsaud_write_packet(AVFormatContext *ctx, AVPacket *pkt)
AVIOContext *pb = ctx->pb;
AUDMuxContext *a = ctx->priv_data;
av_assert1(pkt->size < UINT16_MAX && (pkt->size * 4) < UINT16_MAX);
if (pkt->size > UINT16_MAX / 4)
return AVERROR_INVALIDDATA;
/* Assumes ADPCM since this muxer doesn't support SND1 or PCM format. */
avio_wl16(pb, pkt->size);
avio_wl16(pb, pkt->size * 4);