1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-12-23 12:43:46 +02:00

avformat/argo_{asf,brp}: fix potential segfault in ff_argo_asf_fill_stream()

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
This commit is contained in:
Zane van Iperen 2020-09-25 23:03:46 +10:00
parent ff5fcd0be0
commit ebfed56858
No known key found for this signature in database
GPG Key ID: 68616B2D8AC4DCC5
3 changed files with 7 additions and 7 deletions

View File

@ -75,17 +75,17 @@ void ff_argo_asf_parse_chunk_header(ArgoASFChunkHeader *hdr, const uint8_t *buf)
hdr->flags = AV_RL32(buf + 16); hdr->flags = AV_RL32(buf + 16);
} }
int ff_argo_asf_fill_stream(AVStream *st, const ArgoASFFileHeader *fhdr, int ff_argo_asf_fill_stream(AVFormatContext *s, AVStream *st, const ArgoASFFileHeader *fhdr,
const ArgoASFChunkHeader *ckhdr) const ArgoASFChunkHeader *ckhdr)
{ {
if (ckhdr->num_samples != ASF_SAMPLE_COUNT) { if (ckhdr->num_samples != ASF_SAMPLE_COUNT) {
av_log(st, AV_LOG_ERROR, "Invalid sample count. Got %u, expected %d\n", av_log(s, AV_LOG_ERROR, "Invalid sample count. Got %u, expected %d\n",
ckhdr->num_samples, ASF_SAMPLE_COUNT); ckhdr->num_samples, ASF_SAMPLE_COUNT);
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
if ((ckhdr->flags & ASF_CF_ALWAYS1) != ASF_CF_ALWAYS1 || (ckhdr->flags & ASF_CF_ALWAYS0) != 0) { if ((ckhdr->flags & ASF_CF_ALWAYS1) != ASF_CF_ALWAYS1 || (ckhdr->flags & ASF_CF_ALWAYS0) != 0) {
avpriv_request_sample(st, "Nonstandard flags (0x%08X)", ckhdr->flags); avpriv_request_sample(s, "Nonstandard flags (0x%08X)", ckhdr->flags);
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
} }
@ -116,7 +116,7 @@ int ff_argo_asf_fill_stream(AVStream *st, const ArgoASFFileHeader *fhdr,
if (st->codecpar->bits_per_raw_sample != 16) { if (st->codecpar->bits_per_raw_sample != 16) {
/* The header allows for these, but I've never seen any files with them. */ /* The header allows for these, but I've never seen any files with them. */
avpriv_request_sample(st, "Non 16-bit samples"); avpriv_request_sample(s, "Non 16-bit samples");
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
} }
@ -212,7 +212,7 @@ static int argo_asf_read_header(AVFormatContext *s)
ff_argo_asf_parse_chunk_header(&asf->ckhdr, buf); ff_argo_asf_parse_chunk_header(&asf->ckhdr, buf);
return ff_argo_asf_fill_stream(st, &asf->fhdr, &asf->ckhdr); return ff_argo_asf_fill_stream(s, st, &asf->fhdr, &asf->ckhdr);
} }
static int argo_asf_read_packet(AVFormatContext *s, AVPacket *pkt) static int argo_asf_read_packet(AVFormatContext *s, AVPacket *pkt)

View File

@ -65,7 +65,7 @@ enum {
void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t *buf); void ff_argo_asf_parse_file_header(ArgoASFFileHeader *hdr, const uint8_t *buf);
int ff_argo_asf_validate_file_header(AVFormatContext *s, const ArgoASFFileHeader *hdr); int ff_argo_asf_validate_file_header(AVFormatContext *s, const ArgoASFFileHeader *hdr);
void ff_argo_asf_parse_chunk_header(ArgoASFChunkHeader *hdr, const uint8_t *buf); void ff_argo_asf_parse_chunk_header(ArgoASFChunkHeader *hdr, const uint8_t *buf);
int ff_argo_asf_fill_stream(AVStream *st, const ArgoASFFileHeader *fhdr, int ff_argo_asf_fill_stream(AVFormatContext *s, AVStream *st, const ArgoASFFileHeader *fhdr,
const ArgoASFChunkHeader *ckhdr); const ArgoASFChunkHeader *ckhdr);
#endif /* AVFORMAT_ARGO_ASF_H */ #endif /* AVFORMAT_ARGO_ASF_H */

View File

@ -289,7 +289,7 @@ static int argo_brp_read_header(AVFormatContext *s)
ff_argo_asf_parse_chunk_header(&brp->basf.ckhdr, buf); ff_argo_asf_parse_chunk_header(&brp->basf.ckhdr, buf);
if ((ret = ff_argo_asf_fill_stream(st, &hdr->extradata.basf, &brp->basf.ckhdr)) < 0) if ((ret = ff_argo_asf_fill_stream(s, st, &hdr->extradata.basf, &brp->basf.ckhdr)) < 0)
return ret; return ret;
/* Convert ms to samples. */ /* Convert ms to samples. */