]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/atrac3.c
Check rc_buffer_size value using integer arithmetic
[ffmpeg] / libavcodec / atrac3.c
index 3ac747ccfd64891a18cf7edd1c6f91a7ec27b8cb..8ccba0bc701a7fba45231211d51ad76f7d80d843 100644 (file)
@@ -827,8 +827,12 @@ static int atrac3_decode_frame(AVCodecContext *avctx,
     const uint8_t* databuf;
     int16_t* samples = data;
 
-    if (buf_size < avctx->block_align)
+    if (buf_size < avctx->block_align) {
+        av_log(avctx, AV_LOG_ERROR,
+               "Frame too small (%d bytes). Truncated file?\n", buf_size);
+        *data_size = 0;
         return buf_size;
+    }
 
     /* Check if we need to descramble and what buffer to pass on. */
     if (q->scrambled_stream) {