Commit c69d0735 authored by Laurent Aimar's avatar Laurent Aimar

* libavi.c: improved parsing of some corrupted files.

parent 75cd9924
......@@ -2,7 +2,7 @@
* libavi.c :
*****************************************************************************
* Copyright (C) 2001 VideoLAN
* $Id: libavi.c,v 1.9 2002/12/06 16:34:06 sam Exp $
* $Id: libavi.c,v 1.10 2002/12/16 13:04:36 fenrir Exp $
* Authors: Laurent Aimar <fenrir@via.ecp.fr>
*
* This program is free software; you can redistribute it and/or modify
......@@ -270,7 +270,8 @@ static int AVI_ChunkReadCommon( input_thread_t *p_input,
p_chk->common.p_next = NULL;
#ifdef AVI_DEBUG
msg_Dbg( p_input,
"Found Chunk fourcc:%c%c%c%c size:"I64Fd" pos:"I64Fd,
"Found Chunk fourcc:%8.8x (%c%c%c%c) size:"I64Fd" pos:"I64Fd,
p_chk->common.i_chunk_fourcc,
AVIFOURCC_PRINT( p_chk->common.i_chunk_fourcc ),
p_chk->common.i_chunk_size,
p_chk->common.i_chunk_pos );
......@@ -356,12 +357,17 @@ static int AVI_ChunkRead_list( input_thread_t *p_input,
}
}
AVI_SkipBytes( p_input, 12 );
if( AVI_SkipBytes( p_input, 12 ) )
{
msg_Err( p_input, "cannot enter chunk" );
return VLC_EGENERIC;
}
#ifdef AVI_DEBUG
msg_Dbg( p_input,
"found LIST chunk: \'%c%c%c%c\'",
AVIFOURCC_PRINT( p_container->list.i_type ) );
#endif
msg_Dbg( p_input, "<list \'%c%c%c%c\'>", AVIFOURCC_PRINT( p_container->list.i_type ) );
for( ; ; )
{
p_chk = malloc( sizeof( avi_chunk_t ) );
......@@ -391,6 +397,7 @@ static int AVI_ChunkRead_list( input_thread_t *p_input,
}
}
msg_Dbg( p_input, "</list \'%c%c%c%c\'>", AVIFOURCC_PRINT( p_container->list.i_type ) );
return VLC_SUCCESS;
}
......@@ -799,6 +806,11 @@ int _AVI_ChunkRead( input_thread_t *p_input,
msg_Warn( p_input, "cannot read one chunk" );
return VLC_EGENERIC;
}
if( p_chk->common.i_chunk_fourcc == VLC_FOURCC( 0, 0, 0, 0 ) )
{
msg_Warn( p_input, "found null fourcc chunk (corrupted file?)" );
return VLC_EGENERIC;
}
p_chk->common.p_father = p_father;
i_index = AVI_ChunkFunctionFind( p_chk->common.i_chunk_fourcc );
......
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