[FFmpeg-devel] [PATCH] libaformat: fix incorrect handling of incomplete AVBPrint.

Reimar Döffinger Reimar.Doeffinger at gmx.de
Thu Jul 27 20:42:06 EEST 2023



> On 27 Jul 2023, at 19:33, Nicolas George <george at nsup.org> wrote:
> 
> Reimar.Doeffinger at gmx.de (12023-07-23):
>> From: Reimar Döffinger <Reimar.Doeffinger at gmx.de>
>> 
>> Change some internal APIs a bit to make it harder to make
>> such mistakes.
>> In particular, have the read chunk functions return an error
>> when the result is incomplete.
>> This might be less flexible, but since there has been no
>> use-case for that so far, avoiding coding mistakes seems better.
>> Add a function to queue a AVBPrint directly (ff_subtitles_queue_insert_bprint).
>> Also fixes a leak in lrcdec when ff_subtitles_queue_insert fails.
>> ---
>> libavformat/assdec.c         |  4 +++-
>> libavformat/lrcdec.c         |  7 ++++++-
>> libavformat/mpsubdec.c       |  5 +++--
>> libavformat/realtextdec.c    |  6 +++++-
>> libavformat/samidec.c        |  6 +++++-
>> libavformat/srtdec.c         |  4 +++-
>> libavformat/subtitles.c      | 17 +++++++++++++----
>> libavformat/subtitles.h      | 14 ++++++++++++--
>> libavformat/tedcaptionsdec.c |  2 +-
>> libavformat/webvttdec.c      |  4 +++-
>> 10 files changed, 54 insertions(+), 15 deletions(-)
> 
> Sorry I forgot I meant to review. These changes look for the best,
> except 
> 
>> +    if (!av_bprint_is_complete(event)) return NULL;
> 
>> +        if (i == INT_MAX) return AVERROR_INVALIDDATA;
> 
> … which do not follow the coding style.

Thanks, sent a new version with that updated, plus a fix for a typo
in the commit message.



More information about the ffmpeg-devel mailing list