diff options
| author | Michael Niedermayer <[email protected]> | 2011-12-16 06:02:14 +0100 |
|---|---|---|
| committer | Michael Niedermayer <[email protected]> | 2012-01-03 18:28:45 +0100 |
| commit | aed8e8f9f3aed29699f845b2a67a5b94f8dd2614 (patch) | |
| tree | 57a8495060e4d803e4d037a25e302b8b0a3d5b95 | |
| parent | 349cca9f12e2290b27bba99627c8e4a8f8cdce7d (diff) | |
thp: simplify overallocate checks.
Signed-off-by: Michael Niedermayer <[email protected]>
(cherry picked from commit a0009754442b339dd6f07f8fe4f803f272866912)
Signed-off-by: Michael Niedermayer <[email protected]>
| -rw-r--r-- | libavformat/thp.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/libavformat/thp.c b/libavformat/thp.c index 0b244ef2d8..bd7e60965b 100644 --- a/libavformat/thp.c +++ b/libavformat/thp.c @@ -26,7 +26,6 @@ typedef struct ThpDemuxContext { int version; - unsigned data_size; int first_frame; int first_framesz; int last_frame; @@ -74,9 +73,9 @@ static int thp_read_header(AVFormatContext *s, thp->fps = av_d2q(av_int2flt(avio_rb32(pb)), INT_MAX); thp->framecnt = avio_rb32(pb); thp->first_framesz = avio_rb32(pb); - thp->data_size = avio_rb32(pb); - if(fsize>0 && (!thp->data_size || fsize < thp->data_size)) - thp->data_size= fsize; + pb->maxsize = avio_rb32(pb); + if(fsize>0 && (!pb->maxsize || fsize < pb->maxsize)) + pb->maxsize= fsize; thp->compoff = avio_rb32(pb); avio_rb32(pb); /* offsetDataOffset. */ @@ -163,10 +162,6 @@ static int thp_read_packet(AVFormatContext *s, avio_rb32(pb); /* Previous total size. */ size = avio_rb32(pb); /* Total size of this frame. */ - if(thp->data_size && avio_tell(pb) + size > thp->data_size) { - av_log(s, AV_LOG_ERROR, "Video packet truncated\n"); - size= thp->data_size - avio_tell(pb); - } /* Store the audiosize so the next time this function is called, the audio can be read. */ @@ -183,11 +178,6 @@ static int thp_read_packet(AVFormatContext *s, pkt->stream_index = thp->video_stream_index; } else { - if(thp->data_size && avio_tell(pb) + thp->audiosize > thp->data_size){ - av_log(s, AV_LOG_ERROR, "Audio packet truncated\n"); - thp->audiosize= thp->data_size - avio_tell(pb); - } - ret = av_get_packet(pb, pkt, thp->audiosize); if (ret != thp->audiosize) { av_free_packet(pkt); |
