mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-29 22:00:58 +02:00
avcodec/dxva2_*: Initialize dxva_data_ptr
Related: CID1591888 Uninitialized scalar variable Related: CID1591925 Uninitialized pointer read Related: CID1591933 Uninitialized scalar variable Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
parent
1d6a2aebae
commit
189bc840b0
@ -354,7 +354,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
|
||||
const AV1DecContext *h = avctx->priv_data;
|
||||
AVDXVAContext *ctx = DXVA_CONTEXT(avctx);
|
||||
struct av1_dxva2_picture_context *ctx_pic = h->cur_frame.hwaccel_picture_private;
|
||||
void *dxva_data_ptr;
|
||||
void *dxva_data_ptr = NULL;
|
||||
uint8_t *dxva_data;
|
||||
unsigned dxva_size;
|
||||
unsigned padding;
|
||||
@ -382,7 +382,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
|
||||
|
||||
dxva_data = dxva_data_ptr;
|
||||
|
||||
if (ctx_pic->bitstream_size > dxva_size) {
|
||||
if (!dxva_data || ctx_pic->bitstream_size > dxva_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Bitstream size exceeds hardware buffer");
|
||||
return -1;
|
||||
}
|
||||
|
@ -248,7 +248,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
|
||||
const HEVCFrame *current_picture = h->cur_frame;
|
||||
struct hevc_dxva2_picture_context *ctx_pic = current_picture->hwaccel_picture_private;
|
||||
DXVA_Slice_HEVC_Short *slice = NULL;
|
||||
void *dxva_data_ptr;
|
||||
void *dxva_data_ptr = NULL;
|
||||
uint8_t *dxva_data, *current, *end;
|
||||
unsigned dxva_size;
|
||||
void *slice_data;
|
||||
@ -278,6 +278,9 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!dxva_data_ptr)
|
||||
return -1;
|
||||
|
||||
dxva_data = dxva_data_ptr;
|
||||
current = dxva_data;
|
||||
end = dxva_data + dxva_size;
|
||||
|
@ -160,7 +160,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
|
||||
s->cur_pic.ptr->hwaccel_picture_private;
|
||||
const int is_field = s->picture_structure != PICT_FRAME;
|
||||
const unsigned mb_count = s->mb_width * (s->mb_height >> is_field);
|
||||
void *dxva_data_ptr;
|
||||
void *dxva_data_ptr = NULL;
|
||||
uint8_t *dxva_data, *current, *end;
|
||||
unsigned dxva_size;
|
||||
unsigned i;
|
||||
@ -186,6 +186,9 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!dxva_data_ptr)
|
||||
return -1;
|
||||
|
||||
dxva_data = dxva_data_ptr;
|
||||
current = dxva_data;
|
||||
end = dxva_data + dxva_size;
|
||||
|
@ -197,7 +197,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
|
||||
const unsigned start_code_size = avctx->codec_id == AV_CODEC_ID_VC1 ? sizeof(start_code) : 0;
|
||||
const unsigned mb_count = s->mb_width * (s->mb_height >> v->field_mode);
|
||||
DXVA_SliceInfo *slice = NULL;
|
||||
void *dxva_data_ptr;
|
||||
void *dxva_data_ptr = NULL;
|
||||
uint8_t *dxva_data, *current, *end;
|
||||
unsigned dxva_size;
|
||||
unsigned padding;
|
||||
@ -224,6 +224,9 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!dxva_data_ptr)
|
||||
return -1;
|
||||
|
||||
dxva_data = dxva_data_ptr;
|
||||
current = dxva_data;
|
||||
end = dxva_data + dxva_size;
|
||||
|
@ -172,7 +172,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
|
||||
const VP9SharedContext *h = avctx->priv_data;
|
||||
AVDXVAContext *ctx = DXVA_CONTEXT(avctx);
|
||||
struct vp9_dxva2_picture_context *ctx_pic = h->frames[CUR_FRAME].hwaccel_picture_private;
|
||||
void *dxva_data_ptr;
|
||||
void *dxva_data_ptr = NULL;
|
||||
uint8_t *dxva_data;
|
||||
unsigned dxva_size;
|
||||
unsigned padding;
|
||||
@ -200,7 +200,7 @@ static int commit_bitstream_and_slice_buffer(AVCodecContext *avctx,
|
||||
|
||||
dxva_data = dxva_data_ptr;
|
||||
|
||||
if (ctx_pic->slice.SliceBytesInBuffer > dxva_size) {
|
||||
if (!dxva_data || ctx_pic->slice.SliceBytesInBuffer > dxva_size) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Failed to build bitstream");
|
||||
return -1;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user