[FFmpeg-devel] [PATCH] Mark truncated packets as corrupt in av_get_packet.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Apr 30 22:58:50 CEST 2012


Signed-off-by: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
---
 libavformat/utils.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index d6e7f69..d9dc2fb 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -297,6 +297,7 @@ int ffio_limit(AVIOContext *s, int size)
 int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
 {
     int ret;
+    int orig_size = size;
     size= ffio_limit(s, size);
 
     ret= av_new_packet(pkt, size);
@@ -311,6 +312,8 @@ int av_get_packet(AVIOContext *s, AVPacket *pkt, int size)
         av_free_packet(pkt);
     else
         av_shrink_packet(pkt, ret);
+    if (pkt->size < orig_size)
+        pkt->flags |= AV_PKT_FLAG_CORRUPT;
 
     return ret;
 }
-- 
1.7.10



More information about the ffmpeg-devel mailing list