This is an automated email from the git hooks/post-receive script. Git pushed a commit to branch release/8.0 in repository ffmpeg.
commit 5bef4dd635048600ffb9527726a2cc5c4e8c1a4d Author: Dale Curtis <[email protected]> AuthorDate: Wed Apr 22 23:46:14 2026 +0000 Commit: Michael Niedermayer <[email protected]> CommitDate: Sun Jun 14 04:58:58 2026 +0200 [Wave] Fix issues with unaligned metadata chunks. Fixes corruption issues with the sample in this PR. Signed-off-by: Dale Curtis <[email protected]> (cherry picked from commit 5bbc00c05d6e78542d09bb56c55759ce6b53c139) Signed-off-by: Michael Niedermayer <[email protected]> --- libavformat/wavdec.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/libavformat/wavdec.c b/libavformat/wavdec.c index d7a84e3fd7..6d5d8fcef8 100644 --- a/libavformat/wavdec.c +++ b/libavformat/wavdec.c @@ -131,11 +131,11 @@ static int64_t next_tag(AVIOContext *pb, uint32_t *tag, int big_endian) } /* RIFF chunks are always at even offsets relative to where they start. */ -static int64_t wav_seek_tag(WAVDemuxContext * wav, AVIOContext *s, int64_t offset, int whence) +static int64_t wav_seek_tag(WAVDemuxContext * wav, AVIOContext *s, int64_t offset) { offset += offset < INT64_MAX && offset + wav->unaligned & 1; - return avio_seek(s, offset, whence); + return avio_seek(s, offset, SEEK_SET); } /* return the size of the found tag */ @@ -144,13 +144,16 @@ static int64_t find_tag(WAVDemuxContext * wav, AVIOContext *pb, uint32_t tag1) unsigned int tag; int64_t size; + if (avio_tell(pb) + wav->unaligned & 1) + avio_skip(pb, 1); + for (;;) { if (avio_feof(pb)) return AVERROR_EOF; size = next_tag(pb, &tag, wav->rifx); if (tag == tag1) break; - wav_seek_tag(wav, pb, size, SEEK_CUR); + avio_skip(pb, size + (size & 1)); } return size; } @@ -422,7 +425,7 @@ static int wav_read_header(AVFormatContext *s) for (;;) { AVStream *vst; size = next_tag(pb, &tag, wav->rifx); - next_tag_ofs = avio_tell(pb) + size; + next_tag_ofs = avio_tell(pb) + size + (size & 1); if (avio_feof(pb)) break; @@ -454,10 +457,12 @@ static int wav_read_header(AVFormatContext *s) } if (rf64 || bw64) { - next_tag_ofs = wav->data_end = av_sat_add64(avio_tell(pb), data_size); - } else if (size != 0xFFFFFFFF) { + wav->data_end = av_sat_add64(avio_tell(pb), data_size); + next_tag_ofs = wav->data_end + (data_size & 1); + } else if (size > 0 && size != 0xFFFFFFFF) { data_size = size; - next_tag_ofs = wav->data_end = size ? next_tag_ofs : INT64_MAX; + wav->data_end = avio_tell(pb) + size; + next_tag_ofs = wav->data_end + (size & 1); } else { av_log(s, AV_LOG_WARNING, "Ignoring maximum wav data size, " "file may be invalid\n"); @@ -599,7 +604,7 @@ static int wav_read_header(AVFormatContext *s) /* seek to next tag unless we know that we'll run into EOF */ if ((avio_size(pb) > 0 && next_tag_ofs >= avio_size(pb)) || - wav_seek_tag(wav, pb, next_tag_ofs, SEEK_SET) < 0) { + wav_seek_tag(wav, pb, next_tag_ofs) < 0) { break; } } _______________________________________________ ffmpeg-cvslog mailing list -- [email protected] To unsubscribe send an email to [email protected]
