[bTSstream-devel] [Git][videolan/bitstream][master] scte104: Add bounds checking to validate functions

Christophe Massiot (@cmassiot) gitlab at videolan.org
Mon Nov 15 17:36:25 UTC 2021



Christophe Massiot pushed to branch master at VideoLAN / bitstream


Commits:
bad5510e by Kieran Kunhya at 2021-10-03T18:09:06+01:00
scte104: Add bounds checking to validate functions

- - - - -


1 changed file:

- scte/104.h


Changes:

=====================================
scte/104.h
=====================================
@@ -275,9 +275,11 @@ static inline uint8_t *scte104s_get_data(const uint8_t *p, uint16_t *pi_size)
     return (uint8_t *)&p[13];
 }
 
-static inline bool scte104s_validate(const uint8_t *p)
+static inline bool scte104s_validate(const uint8_t *p, const int buf_size)
 {
     uint16_t i_size = scte104_get_size(p);
+    if (buf_size < i_size)
+        return false;
     if (i_size < SCTE104S_HEADER_SIZE)
         return false;
 
@@ -405,9 +407,11 @@ static inline uint8_t *scte104m_get_op(const uint8_t *p, uint8_t i_op)
     return (uint8_t *)p;
 }
 
-static inline bool scte104m_validate(const uint8_t *p)
+static inline bool scte104m_validate(const uint8_t *p, const int buf_size)
 {
     uint16_t i_size = scte104_get_size(p);
+    if (buf_size < i_size)
+        return false;
     if (i_size < SCTE104M_HEADER_SIZE + SCTE104T_HEADER_SIZE)
         return false;
 



View it on GitLab: https://code.videolan.org/videolan/bitstream/-/commit/bad5510ec180ecd4fb856e3ff63812d8f8496e4a

-- 
View it on GitLab: https://code.videolan.org/videolan/bitstream/-/commit/bad5510ec180ecd4fb856e3ff63812d8f8496e4a
You're receiving this email because of your account on code.videolan.org.




More information about the biTStream-devel mailing list