bump svg header test to first 300 bytes

to allow for longer comment lines
This commit is contained in:
John Cupitt 2016-10-20 09:31:35 +01:00
parent d9c335fd91
commit 0518e290f6
1 changed files with 4 additions and 3 deletions

View File

@ -467,11 +467,12 @@ vips_foreign_load_svg_is_a_buffer( const void *buf, size_t len )
* <svg xmlns="http://www.w3.org/2000/svg" ...
*
* But there can be a doctype in there too. And case and whitespace can
* vary a lot. And the <?xml can be missing.
* vary a lot. And the <?xml can be missing. And you can have a comment
* before the <svg line.
*
* Simple rules:
* - first 24 chars are plain ascii
* - first 200 chars contain "<svg", upper or lower case.
* - first 300 chars contain "<svg", upper or lower case.
*
* We could rsvg_handle_new_from_data() on the buffer, but that can be
* horribly slow for large documents.
@ -482,7 +483,7 @@ vips_foreign_load_svg_is_a_buffer( const void *buf, size_t len )
if( !isascii( str[i] ) )
return( FALSE );
for( i = 0; i < 250 && i < len - 5; i++ )
for( i = 0; i < 300 && i < len - 5; i++ )
if( g_ascii_strncasecmp( str + i, "<svg", 4 ) == 0 )
return( TRUE );