[vlc-commits] packetizer: hevc: check id range in getter

Francois Cartegnie git at videolan.org
Tue Oct 3 12:11:39 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Mon Oct  2 15:56:58 2017 +0200| [5f3ca90a5f3f0e42b984bcd0e1a9b0ac59e12e63] | committer: Francois Cartegnie

packetizer: hevc: check id range in getter

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

 modules/packetizer/hevc_nal.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index 944412a1ed..5c53de5b7b 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -522,10 +522,22 @@ bool hevc_get_xps_id(const uint8_t *p_buf, size_t i_buf, uint8_t *pi_id)
     bs_t bs;
     bs_init(&bs, &p_buf[2], i_buf - 2);
     if(i_nal_type == HEVC_NAL_PPS)
+    {
         *pi_id = bs_read_ue( &bs );
+        if(*pi_id > HEVC_PPS_ID_MAX)
+            return false;
+    }
     else
+    {
         *pi_id = bs_read( &bs, 4 );
-
+        if(i_nal_type == HEVC_NAL_SPS)
+        {
+            if(*pi_id > HEVC_SPS_ID_MAX)
+                return false;
+        }
+        else if(*pi_id > HEVC_VPS_ID_MAX)
+            return false;
+    }
     return true;
 }
 



More information about the vlc-commits mailing list