<html><head></head><body><div class="gmail_quote">Le 4 juillet 2017 10:16:41 GMT+03:00, Shaleen Jain <shaleen.jain95@gmail.com> a écrit :<blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<pre class="k9mail">According to the spec calloc can return a NULL or a unique pointer<br />value if either of the arguments are 0 depending on the implementation.<br /><br />Add a guard to prevent member access if we get a non-null pointer in<br />the above case.<br />---<br /> modules/demux/stl.c | 2 ++<br /> 1 file changed, 2 insertions(+)<br /><br />diff --git a/modules/demux/stl.c b/modules/demux/stl.c<br />index 9a0d5a131e..9d27a79458 100644<br />--- a/modules/demux/stl.c<br />+++ b/modules/demux/stl.c<br />@@ -243,6 +243,8 @@ static int Open(vlc_object_t *object)<br />     const mtime_t program_start = ParseTextTimeCode(&header[256], fps);<br />     const size_t tti_count = ParseInteger(&header[238], 5);<br />     msg_Dbg(demux, "Detected EBU STL : CCT=%d TTI=%zu start=%8.8s %"PRId64, cct, tti_count, &header[256], program_start);<br />+    if(!tti_count)<br />+        return VLC_EGENERIC;<br /> <br />     demux_sys_t *sys = malloc(sizeof(*sys));<br />     if(!sys)</pre></blockquote></div><br clear="all">I am confused by the description here. If 0 elements is a valid situation, then the error predicate is wrong as NULL would be conditionally valid return.<br>
-- <br>
Rémi Denis-Courmont<br>
Typed on an inconvenient virtual keyboard</body></html>