<p>See comment further down.</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code>+static int MP4_ReadBox_HMMT( stream_t *p_stream, MP4_Box_t *p_box )
+{
+ MP4_Box_data_HMMT_t *p_hmmt;
+ MP4_READBOX_ENTER( MP4_Box_data_HMMT_t, MP4_FreeBox_HMMT );
+
+ if( i_read < 5 )
+ MP4_READBOX_EXIT( 0 );
+
+ p_hmmt = p_box->data.p_hmmt;
+
+ MP4_GET4BYTES( p_hmmt->i_chapter_count );
+
+ if( ( i_read / sizeof(uint32_t) ) < p_hmmt->i_chapter_count )
+ MP4_READBOX_EXIT( 0 );
+
+ /* Cameras are allowing a maximum of 100 tags */
+ if( p_hmmt->i_chapter_count > 100 )
+ p_hmmt->i_chapter_count = 100;
+
+ p_hmmt->i_chapter_start = calloc( p_hmmt->i_chapter_count, sizeof(uint32_t) );
+ if( p_hmmt->i_chapter_start == NULL )
+ MP4_READBOX_EXIT( 0 );</code></pre>
</blockquote>
<p>NITPICKING: <code>malloc</code> is enough, there is no need to zero out the allocated memory ( since you know that you will write to every element of it ).</p>
<blockquote style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;color:#500050">
<pre><code>+
+ for( uint32_t i = 0; i < p_hmmt->i_chapter_count; i++ )
+ {
+ MP4_GET4BYTES( p_hmmt->i_chapter_start[i] );
+ }
+
+#ifdef MP4_VERBOSE
+ msg_Dbg( p_stream, "read box: \"HMMT\" %d HiLight tags", p_hmmt->i_chapter_count );
+#endif
+
+ MP4_READBOX_EXIT( 1 );
+}</code></pre>
</blockquote>