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:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user