Re: [FFmpeg-devel] [PATCH] avformat/aacdec: resync to the next aac sample on invalid data instead of aborting
On 7/20/2019 12:41 PM, James Almer wrote: > On 7/20/2019 12:33 PM, Carl Eugen Hoyos wrote: >> >> >> >>> Am 20.07.2019 um 15:13 schrieb James Almer : >>> >>> Should fix ticket #6634 >>> >>> Signed-off-by: James Almer >>> --- >>> libavformat/aacdec.c | 44 +--- >>> 1 file changed, 29 insertions(+), 15 deletions(-) >>> >>> diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c >>> index 8a5450880b..5b00b3f664 100644 >>> --- a/libavformat/aacdec.c >>> +++ b/libavformat/aacdec.c >>> @@ -80,10 +80,31 @@ static int adts_aac_probe(const AVProbeData *p) >>> return 0; >>> } >>> >>> +static int adts_aac_resync(AVFormatContext *s) >>> +{ >>> +uint16_t state; >>> + >>> +// skip data until an ADTS frame is found >>> +state = avio_r8(s->pb); >>> +while (!avio_feof(s->pb) && avio_tell(s->pb) < s->probesize) { >>> +state = (state << 8) | avio_r8(s->pb); >>> +if ((state >> 4) != 0xFFF) >>> +continue; >>> +avio_seek(s->pb, -2, SEEK_CUR); >>> +break; >>> +} >>> +if (s->pb->eof_reached) >>> +return AVERROR_EOF; >>> +if ((state >> 4) != 0xFFF) >>> +return AVERROR_INVALIDDATA; >>> + >>> +return 0; >>> +} >> >> Given the importance of this fix, splitting it may make sense. >> >> Anyway, thank you! >> >> Carl Eugen > > Will split and push later today. Thanks. Pushed. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/aacdec: resync to the next aac sample on invalid data instead of aborting
On 7/20/2019 12:33 PM, Carl Eugen Hoyos wrote: > > > >> Am 20.07.2019 um 15:13 schrieb James Almer : >> >> Should fix ticket #6634 >> >> Signed-off-by: James Almer >> --- >> libavformat/aacdec.c | 44 +--- >> 1 file changed, 29 insertions(+), 15 deletions(-) >> >> diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c >> index 8a5450880b..5b00b3f664 100644 >> --- a/libavformat/aacdec.c >> +++ b/libavformat/aacdec.c >> @@ -80,10 +80,31 @@ static int adts_aac_probe(const AVProbeData *p) >> return 0; >> } >> >> +static int adts_aac_resync(AVFormatContext *s) >> +{ >> +uint16_t state; >> + >> +// skip data until an ADTS frame is found >> +state = avio_r8(s->pb); >> +while (!avio_feof(s->pb) && avio_tell(s->pb) < s->probesize) { >> +state = (state << 8) | avio_r8(s->pb); >> +if ((state >> 4) != 0xFFF) >> +continue; >> +avio_seek(s->pb, -2, SEEK_CUR); >> +break; >> +} >> +if (s->pb->eof_reached) >> +return AVERROR_EOF; >> +if ((state >> 4) != 0xFFF) >> +return AVERROR_INVALIDDATA; >> + >> +return 0; >> +} > > Given the importance of this fix, splitting it may make sense. > > Anyway, thank you! > > Carl Eugen Will split and push later today. Thanks. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".
Re: [FFmpeg-devel] [PATCH] avformat/aacdec: resync to the next aac sample on invalid data instead of aborting
> Am 20.07.2019 um 15:13 schrieb James Almer : > > Should fix ticket #6634 > > Signed-off-by: James Almer > --- > libavformat/aacdec.c | 44 +--- > 1 file changed, 29 insertions(+), 15 deletions(-) > > diff --git a/libavformat/aacdec.c b/libavformat/aacdec.c > index 8a5450880b..5b00b3f664 100644 > --- a/libavformat/aacdec.c > +++ b/libavformat/aacdec.c > @@ -80,10 +80,31 @@ static int adts_aac_probe(const AVProbeData *p) > return 0; > } > > +static int adts_aac_resync(AVFormatContext *s) > +{ > +uint16_t state; > + > +// skip data until an ADTS frame is found > +state = avio_r8(s->pb); > +while (!avio_feof(s->pb) && avio_tell(s->pb) < s->probesize) { > +state = (state << 8) | avio_r8(s->pb); > +if ((state >> 4) != 0xFFF) > +continue; > +avio_seek(s->pb, -2, SEEK_CUR); > +break; > +} > +if (s->pb->eof_reached) > +return AVERROR_EOF; > +if ((state >> 4) != 0xFFF) > +return AVERROR_INVALIDDATA; > + > +return 0; > +} Given the importance of this fix, splitting it may make sense. Anyway, thank you! Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".