mirror of
https://mirror.skon.top/https://github.com/FFmpeg/FFmpeg
synced 2026-04-20 12:50:49 +08: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.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user