[bTSstream-devel] add descs_validate_desc

Christophe Massiot git at videolan.org
Mon Apr 27 12:37:50 CEST 2015


bitstream | branch: master | Christophe Massiot <cmassiot at openheadend.tv> | Mon Apr 27 12:37:38 2015 +0200| [9b514243613cffd2bdef5c49fe613d5b640a8411] | committer: Christophe Massiot

add descs_validate_desc

> http://git.videolan.org/gitweb.cgi/bitstream.git/?a=commit;h=9b514243613cffd2bdef5c49fe613d5b640a8411
---

 mpeg/psi/descriptors.h |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/mpeg/psi/descriptors.h b/mpeg/psi/descriptors.h
index bb1d4fb..ff472be 100644
--- a/mpeg/psi/descriptors.h
+++ b/mpeg/psi/descriptors.h
@@ -189,6 +189,14 @@ static inline uint8_t *descs_get_desc(uint8_t *p_descs, uint16_t n)
                           descs_get_length(p_descs), n);
 }
 
+static inline bool descs_validate_desc(const uint8_t *p_descs,
+                                       const uint8_t *p_desc,
+                                       uint8_t i_desclength)
+{
+    uint16_t i_descs_length = descs_get_length(p_descs);
+    return (p_desc + i_desclength <= p_descs + i_descs_length);
+}
+
 static inline bool descs_validate(const uint8_t *p_descs)
 {
     return descl_validate(p_descs + DESCS_HEADER_SIZE,



More information about the biTStream-devel mailing list