[vlc-commits] vlc_block_helper: fix offset peek

Francois Cartegnie git at videolan.org
Sat Jul 22 01:44:34 CEST 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Jul 21 22:40:14 2017 +0200| [306f551e21984d6ea12b6c98bc30762dbc211a7e] | committer: Francois Cartegnie

vlc_block_helper: fix offset peek

returned incomplete peeks

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

 include/vlc_block_helper.h | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/include/vlc_block_helper.h b/include/vlc_block_helper.h
index d4e9a4bd0d..4071c2b54d 100644
--- a/include/vlc_block_helper.h
+++ b/include/vlc_block_helper.h
@@ -231,13 +231,9 @@ static inline int block_SkipByte( block_bytestream_t *p_bytestream )
 static inline int block_PeekOffsetBytes( block_bytestream_t *p_bytestream,
     size_t i_peek_offset, uint8_t *p_data, size_t i_data )
 {
-    /* Check we have that much data, ignoring read offset */
-    if( p_bytestream->i_total < i_peek_offset ||
-        p_bytestream->i_total - i_peek_offset < i_data )
-    {
-        /* Not enough data, bail out */
+    const size_t i_remain = block_BytestreamRemaining( p_bytestream );
+    if( i_remain < i_data + i_peek_offset )
         return VLC_EGENERIC;
-    }
 
     /* Find the right place */
     size_t i_offset = p_bytestream->i_block_offset;



More information about the vlc-commits mailing list