1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2026-06-14 08:44:40 +02:00

avformat/rsd: reject short ADPCM_THP extradata reads

Use ffio_read_size() to enforce exact-length reads of the per-channel
ADPCM_THP coefficient tables. Previously the return value of
avio_read() was unchecked, silently accepting truncated extradata.

(cherry picked from commit 06d19d000d)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Weidong Wang
2026-03-14 13:18:41 -05:00
committed by Michael Niedermayer
parent 1182428dc0
commit 54ff4bdbf4
+4 -3
View File
@@ -22,6 +22,7 @@
#include "libavutil/intreadwrite.h"
#include "avformat.h"
#include "avio.h"
#include "avio_internal.h"
#include "demux.h"
#include "internal.h"
@@ -131,9 +132,9 @@ static int rsd_read_header(AVFormatContext *s)
return ret;
for (i = 0; i < par->ch_layout.nb_channels; i++) {
if (avio_feof(pb))
return AVERROR_EOF;
avio_read(s->pb, st->codecpar->extradata + 32 * i, 32);
ret = ffio_read_size(s->pb, st->codecpar->extradata + 32 * i, 32);
if (ret < 0)
return ret;
avio_skip(s->pb, 8);
}
break;