You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
avcodec/wmaenc: Check extradata allocations
Fixes CID1257842 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
@@ -60,11 +60,15 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
|||||||
flags2 = 1;
|
flags2 = 1;
|
||||||
if (avctx->codec->id == AV_CODEC_ID_WMAV1) {
|
if (avctx->codec->id == AV_CODEC_ID_WMAV1) {
|
||||||
extradata = av_malloc(4);
|
extradata = av_malloc(4);
|
||||||
|
if (!extradata)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
avctx->extradata_size = 4;
|
avctx->extradata_size = 4;
|
||||||
AV_WL16(extradata, flags1);
|
AV_WL16(extradata, flags1);
|
||||||
AV_WL16(extradata + 2, flags2);
|
AV_WL16(extradata + 2, flags2);
|
||||||
} else if (avctx->codec->id == AV_CODEC_ID_WMAV2) {
|
} else if (avctx->codec->id == AV_CODEC_ID_WMAV2) {
|
||||||
extradata = av_mallocz(10);
|
extradata = av_mallocz(10);
|
||||||
|
if (!extradata)
|
||||||
|
return AVERROR(ENOMEM);
|
||||||
avctx->extradata_size = 10;
|
avctx->extradata_size = 10;
|
||||||
AV_WL32(extradata, flags1);
|
AV_WL32(extradata, flags1);
|
||||||
AV_WL16(extradata + 4, flags2);
|
AV_WL16(extradata + 4, flags2);
|
||||||
|
Reference in New Issue
Block a user