[vlc-commits] demux: pes: change pts bitfield check

Francois Cartegnie git at videolan.org
Fri Nov 24 18:20:15 CET 2017


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Fri Nov 24 16:23:01 2017 +0100| [38227a2d61f311f588a7a6489fcdee38388a2c39] | committer: Francois Cartegnie

demux: pes: change pts bitfield check

allows incorrect 0010 (pts only) timestamp header
for 11 signaling (pts+dts)

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

 modules/demux/mpeg/pes.h | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/modules/demux/mpeg/pes.h b/modules/demux/mpeg/pes.h
index 4a9befd0b7..b5bc18fdd6 100644
--- a/modules/demux/mpeg/pes.h
+++ b/modules/demux/mpeg/pes.h
@@ -22,10 +22,13 @@
 
 static inline bool ExtractPESTimestamp( const uint8_t *p_data, uint8_t i_flags, mtime_t *ret )
 {
-    i_flags = (i_flags << 4) | 0x01; /* check marker bits, and i_flags = b 0010, 0011 or 0001 */
-    if((p_data[0] & 0xF1) != i_flags ||
+    /* !warn broken muxers set incorrect flags. see #17773 and #19140 */
+    /* check marker bits, and i_flags = b 0010, 0011 or 0001 */
+    if((p_data[0] & 0xC1) != 0x01 ||
        (p_data[2] & 0x01) != 0x01 ||
-       (p_data[4] & 0x01) != 0x01)
+       (p_data[4] & 0x01) != 0x01 ||
+       (p_data[0] & 0x30) == 0 || /* at least needs one bit */
+       (p_data[0] >> 5) > i_flags ) /* needs flags 1x => 1x or flags 01 => 01 */
         return false;
 
 



More information about the vlc-commits mailing list