[FFmpeg-cvslog] lavc/utils: improve feedback in case of invalid packet size

Stefano Sabatini git at videolan.org
Wed Jun 26 23:31:24 CEST 2013


ffmpeg | branch: master | Stefano Sabatini <stefasab at gmail.com> | Wed Jun 26 17:05:57 2013 +0200| [47c9887ecaa764006cf661a6446b3533472f6a6e] | committer: Stefano Sabatini

lavc/utils: improve feedback in case of invalid packet size

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=47c9887ecaa764006cf661a6446b3533472f6a6e
---

 libavcodec/utils.c |    9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index 97d066f..9fe3a16 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -1395,8 +1395,13 @@ free_and_end:
 
 int ff_alloc_packet2(AVCodecContext *avctx, AVPacket *avpkt, int size)
 {
-    if (size < 0 || avpkt->size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
-        av_log(avctx, AV_LOG_ERROR, "Size %d invalid\n", size);
+    if (avpkt->size < 0) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid negative user packet size %d\n", avpkt->size);
+        return AVERROR(EINVAL);
+    }
+    if (size < 0 || size > INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE) {
+        av_log(avctx, AV_LOG_ERROR, "Invalid minimum required packet size %d (max allowed is %d)\n",
+               size, INT_MAX - FF_INPUT_BUFFER_PADDING_SIZE);
         return AVERROR(EINVAL);
     }
 



More information about the ffmpeg-cvslog mailing list