]> git.sesse.net Git - ffmpeg/blobdiff - libavformat/idroqdec.c
avcodec: Mark some codecs with threadsafe init as such
[ffmpeg] / libavformat / idroqdec.c
index b66427968f810a708ae56c27b1d20e663da58abe..8fd67a6818b37c0c0742bb57e3603100948b41a0 100644 (file)
@@ -157,6 +157,9 @@ static int roq_read_packet(AVFormatContext *s,
             chunk_size = AV_RL32(&preamble[2]) + RoQ_CHUNK_PREAMBLE_SIZE * 2 +
                 codebook_size;
 
+            if (chunk_size > INT_MAX)
+                return AVERROR_INVALIDDATA;
+
             /* rewind */
             avio_seek(pb, codebook_offset, SEEK_SET);
 
@@ -219,8 +222,10 @@ static int roq_read_packet(AVFormatContext *s,
             pkt->pos= avio_tell(pb);
             ret = avio_read(pb, pkt->data + RoQ_CHUNK_PREAMBLE_SIZE,
                 chunk_size);
-            if (ret != chunk_size)
+            if (ret != chunk_size) {
+                av_packet_unref(pkt);
                 ret = AVERROR(EIO);
+            }
 
             packet_read = 1;
             break;