[vlc-commits] hevc_nal: add nuh_layer constraint for decoding

Francois Cartegnie git at videolan.org
Tue Dec 22 17:49:54 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Dec 22 14:12:07 2015 +0100| [0457a2b225b713e5bb9933043491fbcffbc9b4bd] | committer: Francois Cartegnie

hevc_nal: add nuh_layer constraint for decoding

Content for layer >= 63 is unspecified

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

 modules/packetizer/hevc_nal.c |   13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index caf2a67..e7cf7a3 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -678,8 +678,10 @@ void hevc_rbsp_release_vps( hevc_video_parameter_set_t *p_vps )
                 bs.pf_forward = hxxx_bsfw_ep3b_to_rbsp;  /* Does the emulated 3bytes conversion to rbsp */ \
             } \
             else (void) i_bitflow;\
-            bs_skip( &bs, 16 ); /* Skip nal_unit_header */ \
-            if( !decode( &bs, p_hevctype ) ) \
+            bs_skip( &bs, 7 ); /* nal_unit_header */ \
+            uint8_t i_nuh_layer_id = bs_read( &bs, 6 ); \
+            bs_skip( &bs, 3 ); /* !nal_unit_header */ \
+            if( i_nuh_layer_id > 62 || !decode( &bs, p_hevctype ) ) \
             { \
                 release( p_hevctype ); \
                 p_hevctype = NULL; \
@@ -1122,8 +1124,11 @@ hevc_slice_segment_header_t * hevc_decode_slice_header( const uint8_t *p_buf, si
             bs.pf_forward = hxxx_bsfw_ep3b_to_rbsp;  /* Does the emulated 3bytes conversion to rbsp */
         }
         else (void) i_bitflow;
-        bs_skip( &bs, 16 ); /* Skip nal_unit_header */
-        if( !hevc_parse_slice_segment_header_rbsp( &bs, i_nal_type, pp_sps, pp_pps, p_sh ) )
+        bs_skip( &bs, 7 ); /* nal_unit_header */
+        uint8_t i_nuh_layer_id = bs_read( &bs, 6 );
+        bs_skip( &bs, 3 ); /* !nal_unit_header */
+        if( i_nuh_layer_id > 62 ||
+           !hevc_parse_slice_segment_header_rbsp( &bs, i_nal_type, pp_sps, pp_pps, p_sh ) )
         {
             hevc_rbsp_release_slice_header( p_sh );
             p_sh = NULL;



More information about the vlc-commits mailing list