# HG changeset patch # User bertrand # Date 990365081 0 # Node ID a88b87750b8a6d53164d2cfa9a65cbd1a117545d # Parent 80698f8030b9bedfd363ec8dc93782baf8bbb766 Fixed crashing while reading the content description for some ASF file. diff -r 80698f8030b9 -r a88b87750b8a asfheader.c --- a/asfheader.c Sun May 20 13:06:33 2001 +0000 +++ b/asfheader.c Sun May 20 13:24:41 2001 +0000 @@ -84,6 +84,7 @@ // the variable string is modify in this function void pack_asf_string(char* string, int length) { int i,j; + if( string==NULL ) return; for( i=0, j=0; istream,(char*) &contenth,sizeof(contenth)); // extract the title - string=(char*)malloc(contenth.title_size); - stream_read(demuxer->stream, string, contenth.title_size); - print_asf_string("\n Title: ", string, contenth.title_size); + if( contenth.title_size!=0 ) { + string=(char*)malloc(contenth.title_size); + stream_read(demuxer->stream, string, contenth.title_size); + print_asf_string("\n Title: ", string, contenth.title_size); + } // extract the author - string=(char*)realloc((void*)string, contenth.author_size); - stream_read(demuxer->stream, string, contenth.author_size); - print_asf_string(" Author: ", string, contenth.author_size); + if( contenth.author_size!=0 ) { + string=(char*)realloc((void*)string, contenth.author_size); + stream_read(demuxer->stream, string, contenth.author_size); + print_asf_string(" Author: ", string, contenth.author_size); + } // extract the copyright - string=(char*)realloc((void*)string, contenth.copyright_size); - stream_read(demuxer->stream, string, contenth.copyright_size); - print_asf_string(" Copyright: ", string, contenth.copyright_size); + if( contenth.copyright_size!=0 ) { + string=(char*)realloc((void*)string, contenth.copyright_size); + stream_read(demuxer->stream, string, contenth.copyright_size); + print_asf_string(" Copyright: ", string, contenth.copyright_size); + } // extract the comment - string=(char*)realloc((void*)string, contenth.comment_size); - stream_read(demuxer->stream, string, contenth.comment_size); - print_asf_string(" Comment: ", string, contenth.comment_size); + if( contenth.comment_size!=0 ) { + string=(char*)realloc((void*)string, contenth.comment_size); + stream_read(demuxer->stream, string, contenth.comment_size); + print_asf_string(" Comment: ", string, contenth.comment_size); + } // extract the rating - string=(char*)realloc((void*)string, contenth.rating_size); - stream_read(demuxer->stream, string, contenth.rating_size); - print_asf_string(" Rating: ", string, contenth.rating_size); + if( contenth.rating_size!=0 ) { + string=(char*)realloc((void*)string, contenth.rating_size); + stream_read(demuxer->stream, string, contenth.rating_size); + print_asf_string(" Rating: ", string, contenth.rating_size); + } printf("\n"); free(string); }