[FFmpeg-cvslog] avcodec/dxva2: Initialize dxva_size and check it

Michael Niedermayer git at videolan.org
Sun Jan 5 01:29:26 EET 2025


ffmpeg | branch: release/2.8 | Michael Niedermayer <michael at niedermayer.cc> | Sun May 26 22:13:28 2024 +0200| [5bb78848704295bcc8cef2e46e5d127c2c19a923] | committer: Michael Niedermayer

avcodec/dxva2: Initialize dxva_size and check it

Related: CID1591878 Uninitialized scalar variable
Related: CID1591928 Uninitialized pointer read

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit c8c59e99295f9ef572b5d6f0fd9075bb2b79acbd)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5bb78848704295bcc8cef2e46e5d127c2c19a923
---

 libavcodec/dxva2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/dxva2.c b/libavcodec/dxva2.c
index f31c5e262b..c2f7ac9060 100644
--- a/libavcodec/dxva2.c
+++ b/libavcodec/dxva2.c
@@ -56,7 +56,7 @@ int ff_dxva2_commit_buffer(AVCodecContext *avctx,
                            unsigned type, const void *data, unsigned size,
                            unsigned mb_count)
 {
-    void     *dxva_data;
+    void     *dxva_data = NULL;
     unsigned dxva_size;
     int      result;
     HRESULT hr = 0;
@@ -78,7 +78,7 @@ int ff_dxva2_commit_buffer(AVCodecContext *avctx,
                type, hr);
         return -1;
     }
-    if (size <= dxva_size) {
+    if (dxva_data && size <= dxva_size) {
         memcpy(dxva_data, data, size);
 
 #if CONFIG_D3D11VA



More information about the ffmpeg-cvslog mailing list