[vlc-commits] vlc_bits: bs_skip ovfw (fix #17985)

Francois Cartegnie git at videolan.org
Tue Feb 7 18:53:51 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Tue Feb  7 18:51:49 2017 +0100| [7df8c931d63d9b392681211663b13c6e559f69f4] | committer: Francois Cartegnie

vlc_bits: bs_skip ovfw (fix #17985)

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

 include/vlc_bits.h | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/vlc_bits.h b/include/vlc_bits.h
index 1df9322..018e306 100644
--- a/include/vlc_bits.h
+++ b/include/vlc_bits.h
@@ -162,10 +162,12 @@ static inline void bs_skip( bs_t *s, ssize_t i_count )
 
     if( s->i_left <= 0 )
     {
-        const int i_bytes = ( -s->i_left + 8 ) / 8;
-
+        const size_t i_bytes = 1 + s->i_left / -8;
         bs_forward( s, i_bytes );
-        s->i_left += 8 * i_bytes;
+        if( i_bytes * 8 < i_bytes /* ofw */ )
+            s->i_left = i_bytes;
+        else
+            s->i_left += 8 * i_bytes;
     }
 }
 



More information about the vlc-commits mailing list