[vlc-commits] packetizer: a52: fix divbyzero (fix #18002)

Francois Cartegnie git at videolan.org
Fri Feb 10 14:46:15 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Feb 10 14:45:10 2017 +0100| [e197c9f57c635983dae3763a69b3f3a7031fa78e] | committer: Francois Cartegnie

packetizer: a52: fix divbyzero (fix #18002)

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

 modules/packetizer/a52.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/modules/packetizer/a52.h b/modules/packetizer/a52.h
index 73370c5..2280119 100644
--- a/modules/packetizer/a52.h
+++ b/modules/packetizer/a52.h
@@ -161,7 +161,7 @@ static inline int vlc_a52_header_ParseAc3( vlc_a52_header_t *p_header,
     p_header->i_channels = popcount(p_header->i_channels_conf
                                     & AOUT_CHAN_PHYSMASK);
 
-    const unsigned i_rate_shift = __MAX(i_bsid, 8) - 8;
+    const unsigned i_rate_shift = VLC_CLIP(i_bsid, 8, 11) - 8;
     p_header->i_bitrate = (pi_frmsizcod_bitrates[i_frmsizcod >> 1] * 1000)
                         >> i_rate_shift;
     p_header->i_rate = pi_fscod_samplerates[i_fscod] >> i_rate_shift;



More information about the vlc-commits mailing list