On Wed, Feb 04, 2015 at 02:01:16AM -0300, James Almer wrote: > Signed-off-by: James Almer <jamr...@gmail.com> > --- > I made it abort only if AV_EF_EXPLODE is also set like we do when decoding > audio frames, but maybe aborting if the header or seek table are damaged > should be the default behaviour. Chances are a file with a broken header is > unplayable after all. > > Thoughts? > > libavformat/tta.c | 28 ++++++++++++++++++---------- > 1 file changed, 18 insertions(+), 10 deletions(-) > > diff --git a/libavformat/tta.c b/libavformat/tta.c > index 5789e5b..45dfee9 100644 > --- a/libavformat/tta.c > +++ b/libavformat/tta.c > @@ -64,7 +64,8 @@ static int tta_read_header(AVFormatContext *s) > start_offset = avio_tell(s->pb); > if (start_offset < 0) > return start_offset; > - ffio_init_checksum(s->pb, tta_check_crc, UINT32_MAX); > + if (s->error_recognition & AV_EF_CRCCHECK) > + ffio_init_checksum(s->pb, tta_check_crc, UINT32_MAX); > if (avio_rl32(s->pb) != AV_RL32("TTA1")) > return AVERROR_INVALIDDATA; > > @@ -83,10 +84,13 @@ static int tta_read_header(AVFormatContext *s) > return AVERROR_INVALIDDATA; > } > > - crc = ffio_get_checksum(s->pb) ^ UINT32_MAX; > - if (crc != avio_rl32(s->pb)) { > - av_log(s, AV_LOG_ERROR, "Header CRC error\n"); > - return AVERROR_INVALIDDATA; > + if (s->error_recognition & AV_EF_CRCCHECK) { > + crc = ffio_get_checksum(s->pb) ^ UINT32_MAX; > + if (crc != avio_rl32(s->pb)) { > + av_log(s, AV_LOG_ERROR, "Header CRC error\n"); > + if (s->error_recognition & AV_EF_EXPLODE) > + return AVERROR_INVALIDDATA; > + } > }
this code would skip avio_rl32() and affect the filepos after it same for the later hunk [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel