[FFmpeg-devel] [PATCH 2/4] avformat/oggdec: Don't skip over data whose checksum is used
Andreas Rheinhardt
ffmpegagent at gmail.com
Sat Jul 12 00:28:52 EEST 2025
From: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
The behavior of the ffio_*_checksum feature is not well defined
when using avio_skip(). The code in oggdec.c relied on the skipped
data (four bytes) to be checksummed, which is mostly true
because short_seek_threshold is 32768 by default, so that
avio_seek() will normally read data instead of calling the
underlying seek function. Yet this has two problems:
a) It relies on implementation details of avio_seek().
b) There is an exception, namely if the AVIO_FLAG_DIRECT is set.
In this case the underlying seek function (if set) is always
called and the data is skipped, leading to CRC errors.
So don't skip the data.
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at outlook.com>
---
libavformat/oggdec.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libavformat/oggdec.c b/libavformat/oggdec.c
index da3ef815db..9dc2c62035 100644
--- a/libavformat/oggdec.c
+++ b/libavformat/oggdec.c
@@ -370,7 +370,7 @@ static int ogg_read_page(AVFormatContext *s, int *sid, int probing)
flags = avio_r8(bc);
gp = avio_rl64(bc);
serial = avio_rl32(bc);
- avio_skip(bc, 4); /* seq */
+ avio_rl32(bc); /* seq */
crc_tmp = ffio_get_checksum(bc);
crc = avio_rb32(bc);
--
ffmpeg-codebot
More information about the ffmpeg-devel
mailing list