[vlc-commits] codec: hxxx_helper fix null-deref

Thomas Guillem git at videolan.org
Wed Feb 21 08:51:11 CET 2018


vlc/vlc-3.0 | branch: master | Thomas Guillem <thomas at gllm.fr> | Sun Feb 18 17:38:27 2018 +0100| [4109bf3210595c4996416ba1c0a69cdff86f4960] | committer: Thomas Guillem

codec: hxxx_helper fix null-deref

Check hevc_sps before using it.

Fix CD fe790998-dba9-411b-b8ac-6e2954c7e9a0

(cherry picked from commit c8941dc6d891f28383bdc6836bb56c393f593d6d)
Signed-off-by: Thomas Guillem <thomas at gllm.fr>

> http://git.videolan.org/gitweb.cgi/vlc/vlc-3.0.git/?a=commit;h=4109bf3210595c4996416ba1c0a69cdff86f4960
---

 modules/codec/hxxx_helper.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/codec/hxxx_helper.c b/modules/codec/hxxx_helper.c
index 1ff27db011..1a04d0962c 100644
--- a/modules/codec/hxxx_helper.c
+++ b/modules/codec/hxxx_helper.c
@@ -862,7 +862,7 @@ hxxx_helper_get_current_picture_size(const struct hxxx_helper *hh,
     else if(hh->i_codec == VLC_CODEC_HEVC)
     {
         const struct hxxx_helper_nal *hsps = &hh->hevc.sps_list[hh->hevc.i_current_sps];
-        if(hsps && hevc_get_picture_size(hsps->hevc_sps, p_w, p_h, p_vw, p_vh))
+        if(hsps && hsps->hevc_sps && hevc_get_picture_size(hsps->hevc_sps, p_w, p_h, p_vw, p_vh))
             return VLC_SUCCESS;
     }
     return VLC_EGENERIC;
@@ -885,7 +885,7 @@ hxxx_helper_get_current_sar(const struct hxxx_helper *hh, int *p_num, int *p_den
     {
         const struct hxxx_helper_nal *hsps = &hh->hevc.sps_list[hh->hevc.i_current_sps];
         unsigned num, den;
-        if(hsps && hevc_get_aspect_ratio(hsps->hevc_sps, &num, &den))
+        if(hsps && hsps->hevc_sps && hevc_get_aspect_ratio(hsps->hevc_sps, &num, &den))
         {
             *p_num = num;
             *p_den = den;
@@ -951,7 +951,7 @@ hxxx_helper_get_colorimetry(const struct hxxx_helper *hh,
         case VLC_CODEC_HEVC:
         {
             const struct hxxx_helper_nal *hsps = &hh->hevc.sps_list[hh->hevc.i_current_sps];
-            if (hsps == NULL)
+            if (hsps == NULL || hsps->hevc_sps == NULL)
                 return VLC_EGENERIC;
 
             return hevc_get_colorimetry(hsps->hevc_sps, p_primaries, p_transfer,



More information about the vlc-commits mailing list