[FFmpeg-devel] [PATCH 4/8] avformat/flacdec: Return correct error-codes on read-failure
Michael Niedermayer
michael at niedermayer.cc
Thu Feb 6 17:01:24 EET 2025
On Wed, Feb 05, 2025 at 03:20:30PM +0100, Tomas Härdin wrote:
>
> flacdec.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
> da53ae8bb59c5ee934cc7ba809955e0446168675 0004-avformat-flacdec-Return-correct-error-codes-on-read-.patch
> From c81e350d5419cf02f029ce006d94f257bc18fb97 Mon Sep 17 00:00:00 2001
> From: Ulrik <ulrikm at spotify.com>
> Date: Thu, 26 Jan 2023 17:51:02 +0100
> Subject: [PATCH 4/8] avformat/flacdec: Return correct error-codes on
> read-failure
>
> Forward errors from `avio_read` directly. When `avio_read` sees EOF before
> expected bytes can be read, consistently return `AVERROR_INVALIDDATA`
>
> We used to return `AVERROR(AVERROR_INVALIDDATA)` when failing to read
> metadata block headers. `AVERROR_INVALIDDATA` is already negative, so
> wrapping in `AVERROR` leads to double-negation.
>
> We used to return `AVERROR(EIO)` when failing to read extended metadata.
> However, many times, the IO-layer is not at fault, the input data is simply
> corrupted (truncated), so we return `AVERROR_INVALIDDATA` here as well.
>
> ---
>
> Tomas: changed to use AVERROR_EOF
> ---
> libavformat/flacdec.c | 16 ++++++++++++----
> 1 file changed, 12 insertions(+), 4 deletions(-)
should be fine / LGTM
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
When the tyrant has disposed of foreign enemies by conquest or treaty, and
there is nothing more to fear from them, then he is always stirring up
some war or other, in order that the people may require a leader. -- Plato
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250206/6adb0b31/attachment.sig>
More information about the ffmpeg-devel
mailing list