vlc | branch: master | Jean-Baptiste Kempf <[email protected]> | Sun May 22 20:41:28 2016 +0200| [d3f54b2a369741591885dee9b9c80b2bac54d431] | committer: Jean-Baptiste Kempf
WMV: define 24 as the HEADER_SIZE define and use it > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d3f54b2a369741591885dee9b9c80b2bac54d431 --- modules/demux/asf/libasf.c | 48 ++++++++++++++++++++++---------------------- modules/demux/asf/libasf.h | 1 + 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/modules/demux/asf/libasf.c b/modules/demux/asf/libasf.c index 7d5feaa..7cf75d8 100644 --- a/modules/demux/asf/libasf.c +++ b/modules/demux/asf/libasf.c @@ -123,7 +123,7 @@ static int ASF_ReadObjectCommon( stream_t *s, asf_object_t *p_obj ) asf_object_common_t *p_common = &p_obj->common; const uint8_t *p_peek; - if( stream_Peek( s, &p_peek, 24 ) < 24 ) + if( stream_Peek( s, &p_peek, ASF_OBJECT_COMMON_SIZE ) < ASF_OBJECT_COMMON_SIZE ) return VLC_EGENERIC; ASF_GetGUID( &p_common->i_object_id, p_peek ); @@ -167,8 +167,8 @@ static int ASF_NextObject( stream_t *s, asf_object_t *p_obj, uint64_t i_boundary { if( p_obj->common.p_father->common.i_object_pos + p_obj->common.p_father->common.i_object_size < - p_obj->common.i_object_pos + p_obj->common.i_object_size + 24 ) - /* 24 is min size of an object */ + p_obj->common.i_object_pos + p_obj->common.i_object_size + ASF_OBJECT_COMMON_SIZE ) + /* ASF_OBJECT_COMMON_SIZE is min size of an object */ { return VLC_EGENERIC; } @@ -193,7 +193,7 @@ static int ASF_ReadObject_Header( stream_t *s, asf_object_t *p_obj ) if( stream_Peek( s, &p_peek, 30 ) < 30 ) return VLC_EGENERIC; - p_hdr->i_sub_object_count = GetDWLE( p_peek + 24 ); + p_hdr->i_sub_object_count = GetDWLE( p_peek + ASF_OBJECT_COMMON_SIZE ); p_hdr->i_reserved1 = p_peek[28]; p_hdr->i_reserved2 = p_peek[29]; p_hdr->p_first = NULL; @@ -234,7 +234,7 @@ static int ASF_ReadObject_Data( stream_t *s, asf_object_t *p_obj ) if( stream_Peek( s, &p_peek, 50 ) < 50 ) return VLC_EGENERIC; - ASF_GetGUID( &p_data->i_file_id, p_peek + 24 ); + ASF_GetGUID( &p_data->i_file_id, p_peek + ASF_OBJECT_COMMON_SIZE ); p_data->i_total_data_packets = GetQWLE( p_peek + 40 ); p_data->i_reserved = GetWLE( p_peek + 48 ); @@ -261,7 +261,7 @@ static int ASF_ReadObject_Index( stream_t *s, asf_object_t *p_obj ) __MAX( (int64_t)p_index->i_object_size, 56 ) ) return VLC_SUCCESS; - ASF_GetGUID( &p_index->i_file_id, p_peek + 24 ); + ASF_GetGUID( &p_index->i_file_id, p_peek + ASF_OBJECT_COMMON_SIZE ); p_index->i_index_entry_time_interval = GetQWLE( p_peek + 40 ); p_index->i_max_packet_count = GetDWLE( p_peek + 48 ); p_index->i_index_entry_count = GetDWLE( p_peek + 52 ); @@ -311,7 +311,7 @@ static int ASF_ReadObject_file_properties( stream_t *s, asf_object_t *p_obj ) if( stream_Peek( s, &p_peek, 104 ) < 104 ) return VLC_EGENERIC; - ASF_GetGUID( &p_fp->i_file_id, p_peek + 24 ); + ASF_GetGUID( &p_fp->i_file_id, p_peek + ASF_OBJECT_COMMON_SIZE ); p_fp->i_file_size = GetQWLE( p_peek + 40 ); p_fp->i_creation_date = GetQWLE( p_peek + 48 ); p_fp->i_data_packets_count = GetQWLE( p_peek + 56 ); @@ -365,7 +365,7 @@ static int ASF_ReadObject_metadata( stream_t *s, asf_object_t *p_obj ) __MAX( (int64_t)p_meta->i_object_size, 26 ) ) return VLC_EGENERIC; - p_meta->i_record_entries_count = GetWLE( p_peek + 24 ); + p_meta->i_record_entries_count = GetWLE( p_peek + ASF_OBJECT_COMMON_SIZE ); p_data = p_peek + 26; @@ -469,7 +469,7 @@ static int ASF_ReadObject_header_extension( stream_t *s, asf_object_t *p_obj ) { return VLC_EGENERIC; } - ASF_GetGUID( &p_he->i_reserved1, p_peek + 24 ); + ASF_GetGUID( &p_he->i_reserved1, p_peek + ASF_OBJECT_COMMON_SIZE ); p_he->i_reserved2 = GetWLE( p_peek + 40 ); p_he->i_header_extension_size = GetDWLE( p_peek + 42 ); if( p_he->i_header_extension_size ) @@ -537,7 +537,7 @@ static int ASF_ReadObject_stream_properties( stream_t *s, asf_object_t *p_obj ) if( ( i_peek = stream_Peek( s, &p_peek, p_sp->i_object_size ) ) < 78 ) return VLC_EGENERIC; - ASF_GetGUID( &p_sp->i_stream_type, p_peek + 24 ); + ASF_GetGUID( &p_sp->i_stream_type, p_peek + ASF_OBJECT_COMMON_SIZE ); ASF_GetGUID( &p_sp->i_error_correction_type, p_peek + 40 ); p_sp->i_time_offset = GetQWLE( p_peek + 56 ); p_sp->i_type_specific_data_length = GetDWLE( p_peek + 64 ); @@ -622,7 +622,7 @@ static int ASF_ReadObject_codec_list( stream_t *s, asf_object_t *p_obj ) if( ( i_peek = stream_Peek( s, &p_peek, p_cl->i_object_size ) ) < 44 ) return VLC_EGENERIC; - ASF_GetGUID( &p_cl->i_reserved, p_peek + 24 ); + ASF_GetGUID( &p_cl->i_reserved, p_peek + ASF_OBJECT_COMMON_SIZE ); p_cl->i_codec_entries_count = GetDWLE( p_peek + 40 ); p_data = p_peek + 44; @@ -725,7 +725,7 @@ static int ASF_ReadObject_content_description(stream_t *s, asf_object_t *p_obj) if( ( i_peek = stream_Peek( s, &p_peek, p_cd->i_object_size ) ) < 34 ) return VLC_EGENERIC; - p_data = p_peek + 24; + p_data = p_peek + ASF_OBJECT_COMMON_SIZE; i_title = ASF_READ2(); i_artist = ASF_READ2(); @@ -777,7 +777,7 @@ static int ASF_ReadObject_language_list(stream_t *s, asf_object_t *p_obj) if( ( i_peek = stream_Peek( s, &p_peek, p_ll->i_object_size ) ) < 26 ) return VLC_EGENERIC; - p_data = &p_peek[24]; + p_data = &p_peek[ASF_OBJECT_COMMON_SIZE]; p_ll->i_language = ASF_READ2(); if( p_ll->i_language > 0 ) @@ -827,7 +827,7 @@ static int ASF_ReadObject_stream_bitrate_properties( stream_t *s, if( ( i_peek = stream_Peek( s, &p_peek, p_sb->i_object_size ) ) < 26 ) return VLC_EGENERIC; - p_data = &p_peek[24]; + p_data = &p_peek[ASF_OBJECT_COMMON_SIZE]; p_sb->i_bitrate = ASF_READ2(); if( p_sb->i_bitrate > ASF_MAX_STREAMNUMBER ) @@ -870,13 +870,13 @@ static int ASF_ReadObject_extended_stream_properties( stream_t *s, if( ( i_peek = stream_Peek( s, &p_peek, p_esp->i_object_size ) ) < 88 ) return VLC_EGENERIC; - p_data = &p_peek[24]; + p_data = &p_peek[ASF_OBJECT_COMMON_SIZE]; p_esp->i_start_time = GetQWLE( &p_data[0] ); p_esp->i_end_time = GetQWLE( &p_data[8] ); p_esp->i_data_bitrate = GetDWLE( &p_data[16] ); p_esp->i_buffer_size = GetDWLE( &p_data[20] ); - p_esp->i_initial_buffer_fullness = GetDWLE( &p_data[24] ); + p_esp->i_initial_buffer_fullness = GetDWLE( &p_data[ASF_OBJECT_COMMON_SIZE] ); p_esp->i_alternate_data_bitrate = GetDWLE( &p_data[28] ); p_esp->i_alternate_buffer_size = GetDWLE( &p_data[32] ); p_esp->i_alternate_initial_buffer_fullness = GetDWLE( &p_data[36] ); @@ -1014,7 +1014,7 @@ static int ASF_ReadObject_advanced_mutual_exclusion( stream_t *s, if( ( i_peek = stream_Peek( s, &p_peek, p_ae->i_object_size ) ) < 42 ) return VLC_EGENERIC; - p_data = &p_peek[24]; + p_data = &p_peek[ASF_OBJECT_COMMON_SIZE]; if( !ASF_HAVE( 16 + 2 * sizeof(uint16_t) ) ) /* at least one entry */ return VLC_EGENERIC; @@ -1072,7 +1072,7 @@ static int ASF_ReadObject_stream_prioritization( stream_t *s, if( ( i_peek = stream_Peek( s, &p_peek, p_sp->i_object_size ) ) < 26 ) return VLC_EGENERIC; - p_data = &p_peek[24]; + p_data = &p_peek[ASF_OBJECT_COMMON_SIZE]; p_sp->i_priority_count = ASF_READ2(); @@ -1122,7 +1122,7 @@ static int ASF_ReadObject_bitrate_mutual_exclusion( stream_t *s, asf_object_t *p if( ( i_peek = stream_Peek( s, &p_peek, p_ex->i_object_size ) ) < 42 ) return VLC_EGENERIC; - p_data = &p_peek[24]; + p_data = &p_peek[ASF_OBJECT_COMMON_SIZE]; if( !ASF_HAVE( 16 + 2 * sizeof(uint16_t) ) ) /* at least one entry */ return VLC_EGENERIC; @@ -1184,7 +1184,7 @@ static int ASF_ReadObject_extended_content_description( stream_t *s, if( ( i_peek = stream_Peek( s, &p_peek, p_ec->i_object_size ) ) < 26 ) return VLC_EGENERIC; - p_data = &p_peek[24]; + p_data = &p_peek[ASF_OBJECT_COMMON_SIZE]; p_ec->i_count = ASF_READ2(); p_ec->ppsz_name = calloc( p_ec->i_count, sizeof(char*) ); @@ -1293,10 +1293,10 @@ static int ASF_ReadObject_marker(stream_t *s, asf_object_t *p_obj) const uint8_t *p_peek, *p_data; int i_peek; - if( ( i_peek = stream_Peek( s, &p_peek, p_mk->i_object_size ) ) < 24 ) + if( ( i_peek = stream_Peek( s, &p_peek, p_mk->i_object_size ) ) < ASF_OBJECT_COMMON_SIZE ) return VLC_EGENERIC; - p_data = &p_peek[24]; + p_data = &p_peek[ASF_OBJECT_COMMON_SIZE]; ASF_GetGUID( &p_mk->i_reserved1, p_data ); ASF_SKIP( 16 ); @@ -1366,7 +1366,7 @@ static int ASF_ReadObject_XXX(stream_t *s, asf_object_t *p_obj) if( ( i_peek = stream_Peek( s, &p_peek, p_XX->i_object_size ) ) < XXX ) return VLC_EGENERIC; - p_data = &p_peek[24]; + p_data = &p_peek[ASF_OBJECT_COMMON_SIZE]; #ifdef ASF_DEBUG msg_Dbg( s, @@ -1465,7 +1465,7 @@ static int ASF_ReadObject( stream_t *s, asf_object_t *p_obj, p_obj->common.p_next = NULL; p_obj->common.p_last = NULL; - if( p_obj->common.i_object_size < 24 ) + if( p_obj->common.i_object_size < ASF_OBJECT_COMMON_SIZE ) { msg_Warn( s, "found a corrupted asf object (size<24)" ); return VLC_EGENERIC; diff --git a/modules/demux/asf/libasf.h b/modules/demux/asf/libasf.h index 3e11e45..b6079eb 100644 --- a/modules/demux/asf/libasf.h +++ b/modules/demux/asf/libasf.h @@ -23,6 +23,7 @@ #define VLC_ASF_LIBASF_H_ #define ASF_MAX_STREAMNUMBER 127 +#define ASF_OBJECT_COMMON_SIZE 24 /***************************************************************************** * Structure needed for decoder _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
