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

Michael Niedermayer michaelni at gmx.at
Mon Apr 30 23:59:12 CEST 2012


On Mon, Apr 30, 2012 at 10:58:50PM +0200, Reimar Döffinger wrote:
> 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;
>  

this sets the flag wrong for mp3 and similar demuxers as they read
fixed size packets which are unrelated to the actual frames of the
stream

not sure how to solve this best, but i wanted to point the issue out

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Frequently ignored awnser#1 FFmpeg bugs should be sent to our bugtracker. User
questions about the command line tools should be sent to the ffmpeg-user ML.
And questions about how to use libav* should be sent to the libav-user ML.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120430/062aec30/attachment.asc>


More information about the ffmpeg-devel mailing list