sierravmd: limit packetsize to the amount that could be read.
Fixes huge allocations. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -30,6 +30,7 @@
|
|||||||
#include "libavutil/intreadwrite.h"
|
#include "libavutil/intreadwrite.h"
|
||||||
#include "avformat.h"
|
#include "avformat.h"
|
||||||
#include "internal.h"
|
#include "internal.h"
|
||||||
|
#include "avio_internal.h"
|
||||||
|
|
||||||
#define VMD_HEADER_SIZE 0x0330
|
#define VMD_HEADER_SIZE 0x0330
|
||||||
#define BYTES_PER_FRAME_RECORD 16
|
#define BYTES_PER_FRAME_RECORD 16
|
||||||
@@ -246,6 +247,8 @@ static int vmd_read_packet(AVFormatContext *s,
|
|||||||
/* position the stream (will probably be there already) */
|
/* position the stream (will probably be there already) */
|
||||||
avio_seek(pb, frame->frame_offset, SEEK_SET);
|
avio_seek(pb, frame->frame_offset, SEEK_SET);
|
||||||
|
|
||||||
|
if(ffio_limit(pb, frame->frame_size) != frame->frame_size)
|
||||||
|
return AVERROR(EIO);
|
||||||
if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD))
|
if (av_new_packet(pkt, frame->frame_size + BYTES_PER_FRAME_RECORD))
|
||||||
return AVERROR(ENOMEM);
|
return AVERROR(ENOMEM);
|
||||||
pkt->pos= avio_tell(pb);
|
pkt->pos= avio_tell(pb);
|
||||||
|
Reference in New Issue
Block a user