code
qt4/components/extended_panels.cpp: Improved some dagerous string
parsing code. This whole function looks very ad hoc to me at the
moment and should be rewritten in a more robust way. In particular
this function will misbehave if a video filter exists whose name is a
substring of another video filter. This change here just makes it less
likely to crash...
- memmove( psz_parser, psz_parser + strlen(psz_name) +
- (*(psz_parser + strlen(psz_name)) == ':' ? 1 : 0 ),
- strlen(psz_parser + strlen(psz_name)) + 1 );
+ if( *(psz_parser + strlen(psz_name)) == ':' )
+ {
+ memmove( psz_parser, psz_parser + strlen(psz_name) + 1,
+ strlen(psz_parser + strlen(psz_name) + 1 ) + 1 );
+ }
+ else
+ {
+ *psz_parser = '\0';
+ }
/* Remove trailing : : */
/* Remove trailing : : */
- if( *(psz_string+strlen(psz_string ) -1 ) == ':' )
+ if( strlen( psz_string ) > 0 &&
+ *( psz_string + strlen( psz_string ) -1 ) == ':' )
- *(psz_string+strlen(psz_string ) -1 ) = '\0';
+ *( psz_string + strlen( psz_string ) -1 ) = '\0';
- }
- else
- {
- free( psz_string );
- return;
- }
+ }
+ else
+ {
+ free( psz_string );
+ return;
+ }
}
/* Vout is not kept, so put that in the config */
config_PutPsz( p_intf, "video-filter", psz_string );
}
/* Vout is not kept, so put that in the config */
config_PutPsz( p_intf, "video-filter", psz_string );
struct config_chain_t *p_cfg =
p_vout->p_vfilters_cfg[p_vout->i_vfilters_cfg];
config_ChainDestroy( p_cfg );
struct config_chain_t *p_cfg =
p_vout->p_vfilters_cfg[p_vout->i_vfilters_cfg];
config_ChainDestroy( p_cfg );
- free( p_vout->psz_vfilters[p_vout->i_vfilters_cfg] );
+ if( p_vout->psz_vfilters[p_vout->i_vfilters_cfg] )
+ {
+ free( p_vout->psz_vfilters[p_vout->i_vfilters_cfg] );
+ p_vout->psz_vfilters[p_vout->i_vfilters_cfg] = NULL;
+ }
}
p_vout->i_vfilters_cfg = 0;
if( psz_vfilters && *psz_vfilters )
}
p_vout->i_vfilters_cfg = 0;
if( psz_vfilters && *psz_vfilters )