cleaner blocking code

thanks kleis!
This commit is contained in:
John Cupitt 2022-06-11 15:37:27 +01:00
parent 399fba2124
commit c7baa4535a
2 changed files with 7 additions and 10 deletions

View File

@ -1313,13 +1313,9 @@ vips_block_untrusted_set_operation( VipsOperationClass *class, gboolean *state )
{ {
g_assert( VIPS_IS_OPERATION_CLASS( class ) ); g_assert( VIPS_IS_OPERATION_CLASS( class ) );
if( class->flags & VIPS_OPERATION_UNTRUSTED ) { if( class->flags & VIPS_OPERATION_UNTRUSTED )
GTypeClass *type_class = (GTypeClass *) class; vips_operation_block_set( G_OBJECT_CLASS_NAME( class ),
GType gtype = type_class->g_type; *state );
const char *name = g_type_name( gtype );
vips_operation_block_set( name, *state );
}
return( NULL ); return( NULL );
} }

View File

@ -196,9 +196,10 @@
* @VIPS_OPERATION_DEPRECATED means this is an old operation kept in vips for * @VIPS_OPERATION_DEPRECATED means this is an old operation kept in vips for
* compatibility only and should be hidden from users. * compatibility only and should be hidden from users.
* *
* @VIPS_OPERATION_UNTRUSTED means the operation depends on external libraries which have * @VIPS_OPERATION_UNTRUSTED means the operation depends on external libraries
* not been hardened against attack. It should probably not be used on untrusted input. * which have not been hardened against attack. It should probably not be used
* Use vips_operation_block_untrusted() to block all untrusted operations. * on untrusted input. Use vips_block_untrusted_set() to block all
* untrusted operations.
* *
* @VIPS_OPERATION_BLOCKED means the operation is prevented from executing. Use * @VIPS_OPERATION_BLOCKED means the operation is prevented from executing. Use
* vips_operation_block_set() to enable and disable groups of operations. * vips_operation_block_set() to enable and disable groups of operations.