Commit ba3a2185 authored by Francois Cartegnie's avatar Francois Cartegnie

demux: mp4: absolute pos is unsigned

parent a55c3005
...@@ -244,7 +244,8 @@ static int MP4_ReadBoxContainerChildrenIndexed( stream_t *p_stream, ...@@ -244,7 +244,8 @@ static int MP4_ReadBoxContainerChildrenIndexed( stream_t *p_stream,
return 0; return 0;
} }
off_t i_end = p_container->i_pos + p_container->i_size; uint64_t i_end = p_container->i_pos + p_container->i_size;
int i_tell;
do do
{ {
...@@ -263,7 +264,8 @@ static int MP4_ReadBoxContainerChildrenIndexed( stream_t *p_stream, ...@@ -263,7 +264,8 @@ static int MP4_ReadBoxContainerChildrenIndexed( stream_t *p_stream,
/* chain this box with the father and the other at same level */ /* chain this box with the father and the other at same level */
MP4_BoxAddChild( p_container, p_box ); MP4_BoxAddChild( p_container, p_box );
if( p_container->i_size && stream_Tell( p_stream ) == i_end ) i_tell = stream_Tell( p_stream );
if( p_container->i_size && i_tell >= 0 && (unsigned)i_tell == i_end )
break; break;
if( p_box->i_type == i_last_child ) if( p_box->i_type == i_last_child )
...@@ -274,7 +276,8 @@ static int MP4_ReadBoxContainerChildrenIndexed( stream_t *p_stream, ...@@ -274,7 +276,8 @@ static int MP4_ReadBoxContainerChildrenIndexed( stream_t *p_stream,
} while( MP4_NextBox( p_stream, p_box ) == 1 ); } while( MP4_NextBox( p_stream, p_box ) == 1 );
if ( p_container->i_size && stream_Tell( p_stream ) != i_end ) i_tell = stream_Tell( p_stream );
if ( p_container->i_size && i_tell >= 0 && (unsigned)i_tell != i_end )
MP4_Seek( p_stream, i_end ); MP4_Seek( p_stream, i_end );
return 1; return 1;
...@@ -4003,7 +4006,7 @@ static MP4_Box_t *MP4_ReadBox( stream_t *p_stream, MP4_Box_t *p_father ) ...@@ -4003,7 +4006,7 @@ static MP4_Box_t *MP4_ReadBox( stream_t *p_stream, MP4_Box_t *p_father )
if( !(MP4_Box_Function[i_index].MP4_ReadBox_function)( p_stream, p_box ) ) if( !(MP4_Box_Function[i_index].MP4_ReadBox_function)( p_stream, p_box ) )
{ {
off_t i_end = p_box->i_pos + p_box->i_size; uint64_t i_end = p_box->i_pos + p_box->i_size;
MP4_BoxFree( p_stream, p_box ); MP4_BoxFree( p_stream, p_box );
MP4_Seek( p_stream, i_end ); /* Skip the failed box */ MP4_Seek( p_stream, i_end ); /* Skip the failed box */
return NULL; return NULL;
......
...@@ -1489,7 +1489,7 @@ typedef struct MP4_Box_s MP4_Box_t; ...@@ -1489,7 +1489,7 @@ typedef struct MP4_Box_s MP4_Box_t;
/* the most basic structure */ /* the most basic structure */
struct MP4_Box_s struct MP4_Box_s
{ {
off_t i_pos; /* absolute position */ uint64_t i_pos; /* absolute position */
uint32_t i_type; uint32_t i_type;
uint32_t i_shortsize; uint32_t i_shortsize;
......
...@@ -4037,7 +4037,7 @@ static MP4_Box_t * LoadNextChunk( demux_t *p_demux ) ...@@ -4037,7 +4037,7 @@ static MP4_Box_t * LoadNextChunk( demux_t *p_demux )
return p_chunk; return p_chunk;
} }
static bool BoxExistsInRootTree( MP4_Box_t *p_root, uint32_t i_type, off_t i_pos ) static bool BoxExistsInRootTree( MP4_Box_t *p_root, uint32_t i_type, uint64_t i_pos )
{ {
while ( p_root ) while ( p_root )
{ {
...@@ -5125,7 +5125,8 @@ static int DemuxAsLeaf( demux_t *p_demux ) ...@@ -5125,7 +5125,8 @@ static int DemuxAsLeaf( demux_t *p_demux )
if ( p_sys->context.i_current_box_type != ATOM_mdat ) if ( p_sys->context.i_current_box_type != ATOM_mdat )
{ {
if ( ! BoxExistsInRootTree( p_sys->p_root, p_sys->context.i_current_box_type, stream_Tell( p_demux->s ) ) ) const int i_tell = stream_Tell( p_demux->s );
if ( i_tell >= 0 && ! BoxExistsInRootTree( p_sys->p_root, p_sys->context.i_current_box_type, (uint64_t)i_tell ) )
{// only if !b_probed ?? {// only if !b_probed ??
MP4_Box_t *p_vroot = LoadNextChunk( p_demux ); MP4_Box_t *p_vroot = LoadNextChunk( p_demux );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment