]> git.sesse.net Git - ffmpeg/commitdiff
avformat/westwood_audenc: Check for, not assert on invalid data
authorAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Mon, 26 Apr 2021 12:48:33 +0000 (14:48 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@outlook.com>
Mon, 26 Apr 2021 14:46:37 +0000 (16:46 +0200)
Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
libavformat/westwood_audenc.c

index 4ec905b088e5961b7f59133e5084d987d49622de..490f2ee26061940984f00fba55745ee46eac1295 100644 (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);