[FFmpeg-devel] [PATCH] libaformat: fix incorrect handling of incomplete AVBPrint.
Nicolas George
george at nsup.org
Thu Jul 27 20:33:09 EEST 2023
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.
(The dynamic buffer writer of the AVWriter API makes it much harder to
forget checking. But AVWriter is currently in limbo waiting for this
project to reaffirm its orientation.)
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20230727/89d14331/attachment.sig>
More information about the ffmpeg-devel
mailing list