[vlc-commits] fix overflowing shifts (cid #1346922, cid #1253066)

Francois Cartegnie git at videolan.org
Fri Jan 1 21:35:39 CET 2016


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jan  1 21:34:44 2016 +0100| [bffe61d55f0aa068808d488d7a9b7731b98c78e3] | committer: Francois Cartegnie

fix overflowing shifts (cid #1346922, cid #1253066)

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

 include/vlc_bits.h            |    2 +-
 modules/packetizer/hevc_nal.c |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/vlc_bits.h b/include/vlc_bits.h
index 947a9d0..7f6b67a 100644
--- a/include/vlc_bits.h
+++ b/include/vlc_bits.h
@@ -234,7 +234,7 @@ static inline uint32_t bs_read_ue( bs_t * bs )
 {
     int32_t i = 0;
 
-    while( bs_read1( bs ) == 0 && bs->p < bs->p_end && i < 32 )
+    while( bs_read1( bs ) == 0 && bs->p < bs->p_end && i < 31 )
         i++;
 
     return (1 << i) - 1 + bs_read( bs, i );
diff --git a/modules/packetizer/hevc_nal.c b/modules/packetizer/hevc_nal.c
index 6edd64c..24f12ff 100644
--- a/modules/packetizer/hevc_nal.c
+++ b/modules/packetizer/hevc_nal.c
@@ -1003,7 +1003,7 @@ static bool hevc_get_picture_CtbsYsize( const hevc_sequence_parameter_set_t *p_s
 {
     const unsigned int MinCbLog2SizeY = p_sps->log2_min_luma_coding_block_size_minus3 + 3;
     const unsigned int CtbLog2SizeY = MinCbLog2SizeY + p_sps->log2_diff_max_min_luma_coding_block_size;
-    if( CtbLog2SizeY > 32 )
+    if( CtbLog2SizeY > 31 )
         return false;
     const unsigned int CtbSizeY = 1 << CtbLog2SizeY;
     *p_w = (p_sps->pic_width_in_luma_samples - 1) / CtbSizeY + 1;



More information about the vlc-commits mailing list