diff options
author | Araz Iusubov <[email protected]> | 2025-06-04 10:36:34 +0200 |
---|---|---|
committer | Tong Wu <[email protected]> | 2025-06-08 21:24:25 +0800 |
commit | 49e52ca24ff93702188375c058c20e7db4ff0cb5 (patch) | |
tree | cdcd894b3dfe55513b6114ba3e5db1e78c107eed | |
parent | be46370941405fb04402d96373a53e2a1846f3ac (diff) |
avcodec/d3d12va_encode: fix l0 reference count limit
Prevents potential null pointer dereference when querying
MaxL1ReferencesForB from codec-specific support structures
during GOP structure initialization.
Signed-off-by: Tong Wu <[email protected]>
-rw-r--r-- | libavcodec/d3d12va_encode.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/d3d12va_encode.c b/libavcodec/d3d12va_encode.c index 4d738200fe..e24a5b8d24 100644 --- a/libavcodec/d3d12va_encode.c +++ b/libavcodec/d3d12va_encode.c @@ -1088,13 +1088,15 @@ static int d3d12va_encode_init_gop_structure(AVCodecContext *avctx) switch (ctx->codec->d3d12_codec) { case D3D12_VIDEO_ENCODER_CODEC_H264: ref_l0 = FFMIN(support.PictureSupport.pH264Support->MaxL0ReferencesForP, - support.PictureSupport.pH264Support->MaxL1ReferencesForB); + support.PictureSupport.pH264Support->MaxL1ReferencesForB ? + support.PictureSupport.pH264Support->MaxL1ReferencesForB : UINT_MAX); ref_l1 = support.PictureSupport.pH264Support->MaxL1ReferencesForB; break; case D3D12_VIDEO_ENCODER_CODEC_HEVC: ref_l0 = FFMIN(support.PictureSupport.pHEVCSupport->MaxL0ReferencesForP, - support.PictureSupport.pHEVCSupport->MaxL1ReferencesForB); + support.PictureSupport.pHEVCSupport->MaxL1ReferencesForB ? + support.PictureSupport.pHEVCSupport->MaxL1ReferencesForB : UINT_MAX); ref_l1 = support.PictureSupport.pHEVCSupport->MaxL1ReferencesForB; break; |