winebuild: Add more checks to protect against corrupted resource files.

This commit is contained in:
Alexandre Julliard 2010-07-20 16:04:51 +02:00
parent b486c50523
commit 58dddbed23
1 changed files with 4 additions and 0 deletions

View File

@ -220,8 +220,12 @@ static void load_next_resource( DLLSPEC *spec )
res->data_size = get_dword();
hdr_size = get_dword();
if (hdr_size & 3) fatal_error( "%s header size not aligned\n", input_buffer_filename );
if (hdr_size < 32) fatal_error( "%s invalid header size %u\n", input_buffer_filename, hdr_size );
res->data = input_buffer + input_buffer_pos - 2*sizeof(unsigned int) + hdr_size;
if ((const unsigned char *)res->data < input_buffer ||
(const unsigned char *)res->data >= input_buffer + input_buffer_size)
fatal_error( "%s invalid header size %u\n", input_buffer_filename, hdr_size );
get_string( &res->type );
get_string( &res->name );
if (input_buffer_pos & 2) get_word(); /* align to dword boundary */