Mark truncated packets as corrupt in av_get_packet.

Manually remove that flag again for formats that read an arbitrary
amount of data and thus truncation is not an error.

Signed-off-by: Reimar Döffinger <Reimar.Doeffinger@gmx.de>
This commit is contained in:
Reimar Döffinger
2012-04-30 22:58:27 +02:00
parent 75f847aa6b
commit 7effbee66c
9 changed files with 12 additions and 0 deletions

View File

@ -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;
}