instruction
stringclasses 1
value | input
stringlengths 31
235k
| output
class label 2
classes |
---|---|---|
Categorize the following code snippet as vulnerable or not. True or False | static void dissect_rtp_hext_rfc5215_twobytes ( tvbuff_t * parent_tvb , guint id_offset , guint8 id , tvbuff_t * tvb , packet_info * pinfo , proto_tree * rtp_hext_tree ) {
proto_item * ti = NULL ;
proto_tree * rtp_hext_rfc5285_tree = NULL ;
guint ext_offset = 0 , start_ext_offset ;
while ( ext_offset + 2 < tvb_length ( tvb ) ) {
guint8 ext_id ;
guint8 ext_length ;
tvbuff_t * subtvb = NULL ;
start_ext_offset = ext_offset ;
while ( tvb_get_guint8 ( tvb , ext_offset ) == 0 ) {
if ( ext_offset + 2 >= tvb_length ( tvb ) ) return ;
ext_offset ++ ;
}
if ( ext_offset > start_ext_offset ) proto_tree_add_item ( rtp_hext_tree , hf_rtp_padding_data , tvb , ext_offset , ext_offset - start_ext_offset , ENC_NA ) ;
ext_id = tvb_get_guint8 ( tvb , ext_offset ) ;
ext_length = tvb_get_guint8 ( tvb , ext_offset + 1 ) ;
if ( rtp_hext_tree ) {
ti = proto_tree_add_text ( rtp_hext_tree , tvb , ext_offset , ext_length + 2 , "RFC 5285 Header Extension (Two-Byte Header)" ) ;
rtp_hext_rfc5285_tree = proto_item_add_subtree ( ti , ett_hdr_ext_rfc5285 ) ;
proto_tree_add_uint ( rtp_hext_rfc5285_tree , hf_rtp_ext_rfc5285_appbits , parent_tvb , id_offset + 1 , 1 , id & 0x000F ) ;
proto_tree_add_uint ( rtp_hext_rfc5285_tree , hf_rtp_ext_rfc5285_id , tvb , ext_offset , 1 , ext_id ) ;
proto_tree_add_uint ( rtp_hext_rfc5285_tree , hf_rtp_ext_rfc5285_length , tvb , ext_offset + 1 , 1 , ext_length ) ;
}
ext_offset += 2 ;
subtvb = tvb_new_subset ( tvb , ext_offset , ext_length , ext_length ) ;
if ( ext_length && ! dissector_try_uint ( rtp_hdr_ext_rfc5285_dissector_table , ext_id , subtvb , pinfo , rtp_hext_rfc5285_tree ) ) {
proto_tree_add_item ( rtp_hext_rfc5285_tree , hf_rtp_ext_rfc5285_data , subtvb , 0 , ext_length , ENC_NA ) ;
}
ext_offset += ext_length ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static uint get_table_structure ( char * table , char * db , char * table_type , char * ignore_flag ) {
my_bool init = 0 , delayed , write_data , complete_insert ;
my_ulonglong num_fields ;
char * result_table , * opt_quoted_table ;
const char * insert_option ;
char name_buff [ NAME_LEN + 3 ] , table_buff [ NAME_LEN * 2 + 3 ] ;
char table_buff2 [ NAME_LEN * 2 + 3 ] , query_buff [ QUERY_LENGTH ] ;
const char * show_fields_stmt = "SELECT `COLUMN_NAME` AS `Field`, " "`COLUMN_TYPE` AS `Type`, " "`IS_NULLABLE` AS `Null`, " "`COLUMN_KEY` AS `Key`, " "`COLUMN_DEFAULT` AS `Default`, " "`EXTRA` AS `Extra`, " "`COLUMN_COMMENT` AS `Comment` " "FROM `INFORMATION_SCHEMA`.`COLUMNS` WHERE " "TABLE_SCHEMA = '%s' AND TABLE_NAME = '%s'" ;
FILE * sql_file = md_result_file ;
int len ;
my_bool is_log_table ;
MYSQL_RES * result ;
MYSQL_ROW row ;
DBUG_ENTER ( "get_table_structure" ) ;
DBUG_PRINT ( "enter" , ( "db: %s table: %s" , db , table ) ) ;
* ignore_flag = check_if_ignore_table ( table , table_type ) ;
delayed = opt_delayed ;
if ( delayed && ( * ignore_flag & IGNORE_INSERT_DELAYED ) ) {
delayed = 0 ;
verbose_msg ( "-- Warning: Unable to use delayed inserts for table '%s' " "because it's of type %s\n" , table , table_type ) ;
}
complete_insert = 0 ;
if ( ( write_data = ! ( * ignore_flag & IGNORE_DATA ) ) ) {
complete_insert = opt_complete_insert ;
if ( ! insert_pat_inited ) {
insert_pat_inited = 1 ;
init_dynamic_string_checked ( & insert_pat , "" , 1024 , 1024 ) ;
}
else dynstr_set_checked ( & insert_pat , "" ) ;
}
insert_option = ( ( delayed && opt_ignore ) ? " DELAYED IGNORE " : delayed ? " DELAYED " : opt_ignore ? " IGNORE " : "" ) ;
verbose_msg ( "-- Retrieving table structure for table %s...\n" , table ) ;
len = my_snprintf ( query_buff , sizeof ( query_buff ) , "SET SQL_QUOTE_SHOW_CREATE=%d" , ( opt_quoted || opt_keywords ) ) ;
if ( ! create_options ) strmov ( query_buff + len , "/*!40102 ,SQL_MODE=concat(@@sql_mode, _utf8 ',NO_KEY_OPTIONS,NO_TABLE_OPTIONS,NO_FIELD_OPTIONS') */" ) ;
result_table = quote_name ( table , table_buff , 1 ) ;
opt_quoted_table = quote_name ( table , table_buff2 , 0 ) ;
if ( opt_order_by_primary ) order_by = primary_key_fields ( result_table ) ;
if ( ! opt_xml && ! mysql_query_with_error_report ( mysql , 0 , query_buff ) ) {
if ( ! opt_no_create_info ) {
char buff [ 20 + FN_REFLEN ] ;
MYSQL_FIELD * field ;
my_snprintf ( buff , sizeof ( buff ) , "show create table %s" , result_table ) ;
if ( switch_character_set_results ( mysql , "binary" ) || mysql_query_with_error_report ( mysql , & result , buff ) || switch_character_set_results ( mysql , default_charset ) ) DBUG_RETURN ( 0 ) ;
if ( path ) {
if ( ! ( sql_file = open_sql_file_for_table ( table , O_WRONLY ) ) ) DBUG_RETURN ( 0 ) ;
write_header ( sql_file , db ) ;
}
if ( strcmp ( table_type , "VIEW" ) == 0 ) print_comment ( sql_file , 0 , "\n--\n-- Temporary table structure for view %s\n--\n\n" , result_table ) ;
else print_comment ( sql_file , 0 , "\n--\n-- Table structure for table %s\n--\n\n" , result_table ) ;
if ( opt_drop ) {
if ( ! general_log_or_slow_log_tables ( db , table ) ) fprintf ( sql_file , "DROP TABLE IF EXISTS %s;
\n" , opt_quoted_table ) ;
check_io ( sql_file ) ;
}
field = mysql_fetch_field_direct ( result , 0 ) ;
if ( strcmp ( field -> name , "View" ) == 0 ) {
char * scv_buff = NULL ;
my_ulonglong n_cols ;
verbose_msg ( "-- It's a view, create dummy table for view\n" ) ;
if ( ( row = mysql_fetch_row ( result ) ) && ( scv_buff = row [ 1 ] ) ) scv_buff = my_strdup ( scv_buff , MYF ( 0 ) ) ;
mysql_free_result ( result ) ;
my_snprintf ( query_buff , sizeof ( query_buff ) , "SHOW FIELDS FROM %s" , result_table ) ;
if ( switch_character_set_results ( mysql , "binary" ) || mysql_query_with_error_report ( mysql , & result , query_buff ) || switch_character_set_results ( mysql , default_charset ) ) {
if ( mysql_errno ( mysql ) == ER_VIEW_INVALID ) fprintf ( sql_file , "\n-- failed on view %s: %s\n\n" , result_table , scv_buff ? scv_buff : "" ) ;
my_free ( scv_buff ) ;
DBUG_RETURN ( 0 ) ;
}
else my_free ( scv_buff ) ;
n_cols = mysql_num_rows ( result ) ;
if ( 0 != n_cols ) {
if ( n_cols >= 1000 ) fprintf ( stderr , "-- Warning: Creating a stand-in table for view %s may" " fail when replaying the dump file produced because " "of the number of columns exceeding 1000. Exercise " "caution when replaying the produced dump file.\n" , table ) ;
if ( opt_drop ) {
fprintf ( sql_file , "/*!50001 DROP VIEW IF EXISTS %s*/;
\n" , opt_quoted_table ) ;
check_io ( sql_file ) ;
}
fprintf ( sql_file , "SET @saved_cs_client = @@character_set_client;
\n" "SET character_set_client = utf8;
\n" "/*!50001 CREATE TABLE %s (\n" , result_table ) ;
row = mysql_fetch_row ( result ) ;
fprintf ( sql_file , " %s tinyint NOT NULL" , quote_name ( row [ 0 ] , name_buff , 0 ) ) ;
while ( ( row = mysql_fetch_row ( result ) ) ) {
fprintf ( sql_file , ",\n %s tinyint NOT NULL" , quote_name ( row [ 0 ] , name_buff , 0 ) ) ;
}
fprintf ( sql_file , "\n) ENGINE=MyISAM */;
\n" "SET character_set_client = @saved_cs_client;
\n" ) ;
check_io ( sql_file ) ;
}
mysql_free_result ( result ) ;
if ( path ) my_fclose ( sql_file , MYF ( MY_WME ) ) ;
seen_views = 1 ;
DBUG_RETURN ( 0 ) ;
}
row = mysql_fetch_row ( result ) ;
is_log_table = general_log_or_slow_log_tables ( db , table ) ;
if ( is_log_table ) row [ 1 ] += 13 ;
if ( opt_compatible_mode & 3 ) {
fprintf ( sql_file , is_log_table ? "CREATE TABLE IF NOT EXISTS %s;
\n" : "%s;
\n" , row [ 1 ] ) ;
}
else {
fprintf ( sql_file , "/*!40101 SET @saved_cs_client = @@character_set_client */;
\n" "/*!40101 SET character_set_client = utf8 */;
\n" "%s%s;
\n" "/*!40101 SET character_set_client = @saved_cs_client */;
\n" , is_log_table ? "CREATE TABLE IF NOT EXISTS " : "" , row [ 1 ] ) ;
}
check_io ( sql_file ) ;
mysql_free_result ( result ) ;
}
my_snprintf ( query_buff , sizeof ( query_buff ) , "show fields from %s" , result_table ) ;
if ( mysql_query_with_error_report ( mysql , & result , query_buff ) ) {
if ( path ) my_fclose ( sql_file , MYF ( MY_WME ) ) ;
DBUG_RETURN ( 0 ) ;
}
if ( write_data ) {
if ( opt_replace_into ) dynstr_append_checked ( & insert_pat , "REPLACE " ) ;
else dynstr_append_checked ( & insert_pat , "INSERT " ) ;
dynstr_append_checked ( & insert_pat , insert_option ) ;
dynstr_append_checked ( & insert_pat , "INTO " ) ;
dynstr_append_checked ( & insert_pat , opt_quoted_table ) ;
if ( complete_insert ) {
dynstr_append_checked ( & insert_pat , " (" ) ;
}
else {
dynstr_append_checked ( & insert_pat , " VALUES " ) ;
if ( ! extended_insert ) dynstr_append_checked ( & insert_pat , "(" ) ;
}
}
while ( ( row = mysql_fetch_row ( result ) ) ) {
if ( complete_insert ) {
if ( init ) {
dynstr_append_checked ( & insert_pat , ", " ) ;
}
init = 1 ;
dynstr_append_checked ( & insert_pat , quote_name ( row [ SHOW_FIELDNAME ] , name_buff , 0 ) ) ;
}
}
num_fields = mysql_num_rows ( result ) ;
mysql_free_result ( result ) ;
}
else {
verbose_msg ( "%s: Warning: Can't set SQL_QUOTE_SHOW_CREATE option (%s)\n" , my_progname_short , mysql_error ( mysql ) ) ;
my_snprintf ( query_buff , sizeof ( query_buff ) , show_fields_stmt , db , table ) ;
if ( mysql_query_with_error_report ( mysql , & result , query_buff ) ) DBUG_RETURN ( 0 ) ;
if ( ! opt_no_create_info ) {
if ( path ) {
if ( ! ( sql_file = open_sql_file_for_table ( table , O_WRONLY ) ) ) DBUG_RETURN ( 0 ) ;
write_header ( sql_file , db ) ;
}
print_comment ( sql_file , 0 , "\n--\n-- Table structure for table %s\n--\n\n" , result_table ) ;
if ( opt_drop ) fprintf ( sql_file , "DROP TABLE IF EXISTS %s;
\n" , result_table ) ;
if ( ! opt_xml ) fprintf ( sql_file , "CREATE TABLE %s (\n" , result_table ) ;
else print_xml_tag ( sql_file , "\t" , "\n" , "table_structure" , "name=" , table , NullS ) ;
check_io ( sql_file ) ;
}
if ( write_data ) {
if ( opt_replace_into ) dynstr_append_checked ( & insert_pat , "REPLACE " ) ;
else dynstr_append_checked ( & insert_pat , "INSERT " ) ;
dynstr_append_checked ( & insert_pat , insert_option ) ;
dynstr_append_checked ( & insert_pat , "INTO " ) ;
dynstr_append_checked ( & insert_pat , result_table ) ;
if ( complete_insert ) dynstr_append_checked ( & insert_pat , " (" ) ;
else {
dynstr_append_checked ( & insert_pat , " VALUES " ) ;
if ( ! extended_insert ) dynstr_append_checked ( & insert_pat , "(" ) ;
}
}
while ( ( row = mysql_fetch_row ( result ) ) ) {
ulong * lengths = mysql_fetch_lengths ( result ) ;
if ( init ) {
if ( ! opt_xml && ! opt_no_create_info ) {
fputs ( ",\n" , sql_file ) ;
check_io ( sql_file ) ;
}
if ( complete_insert ) dynstr_append_checked ( & insert_pat , ", " ) ;
}
init = 1 ;
if ( complete_insert ) dynstr_append_checked ( & insert_pat , quote_name ( row [ SHOW_FIELDNAME ] , name_buff , 0 ) ) ;
if ( ! opt_no_create_info ) {
if ( opt_xml ) {
print_xml_row ( sql_file , "field" , result , & row , NullS ) ;
continue ;
}
if ( opt_keywords ) fprintf ( sql_file , " %s.%s %s" , result_table , quote_name ( row [ SHOW_FIELDNAME ] , name_buff , 0 ) , row [ SHOW_TYPE ] ) ;
else fprintf ( sql_file , " %s %s" , quote_name ( row [ SHOW_FIELDNAME ] , name_buff , 0 ) , row [ SHOW_TYPE ] ) ;
if ( row [ SHOW_DEFAULT ] ) {
fputs ( " DEFAULT " , sql_file ) ;
unescape ( sql_file , row [ SHOW_DEFAULT ] , lengths [ SHOW_DEFAULT ] ) ;
}
if ( ! row [ SHOW_NULL ] [ 0 ] ) fputs ( " NOT NULL" , sql_file ) ;
if ( row [ SHOW_EXTRA ] [ 0 ] ) fprintf ( sql_file , " %s" , row [ SHOW_EXTRA ] ) ;
check_io ( sql_file ) ;
}
}
num_fields = mysql_num_rows ( result ) ;
mysql_free_result ( result ) ;
if ( ! opt_no_create_info ) {
char buff [ 20 + FN_REFLEN ] ;
uint keynr , primary_key ;
my_snprintf ( buff , sizeof ( buff ) , "show keys from %s" , result_table ) ;
if ( mysql_query_with_error_report ( mysql , & result , buff ) ) {
if ( mysql_errno ( mysql ) == ER_WRONG_OBJECT ) {
fputs ( "\t\t<options Comment=\"view\" />\n" , sql_file ) ;
goto continue_xml ;
}
fprintf ( stderr , "%s: Can't get keys for table %s (%s)\n" , my_progname_short , result_table , mysql_error ( mysql ) ) ;
if ( path ) my_fclose ( sql_file , MYF ( MY_WME ) ) ;
DBUG_RETURN ( 0 ) ;
}
keynr = 0 ;
primary_key = INT_MAX ;
while ( ( row = mysql_fetch_row ( result ) ) ) {
if ( atoi ( row [ 3 ] ) == 1 ) {
keynr ++ ;
# ifdef FORCE_PRIMARY_KEY if ( atoi ( row [ 1 ] ) == 0 && primary_key == INT_MAX ) primary_key = keynr ;
# endif if ( ! strcmp ( row [ 2 ] , "PRIMARY" ) ) {
primary_key = keynr ;
break ;
}
}
}
mysql_data_seek ( result , 0 ) ;
keynr = 0 ;
while ( ( row = mysql_fetch_row ( result ) ) ) {
if ( opt_xml ) {
print_xml_row ( sql_file , "key" , result , & row , NullS ) ;
continue ;
}
if ( atoi ( row [ 3 ] ) == 1 ) {
if ( keynr ++ ) putc ( ')' , sql_file ) ;
if ( atoi ( row [ 1 ] ) ) fprintf ( sql_file , ",\n KEY %s (" , quote_name ( row [ 2 ] , name_buff , 0 ) ) ;
else if ( keynr == primary_key ) fputs ( ",\n PRIMARY KEY (" , sql_file ) ;
else fprintf ( sql_file , ",\n UNIQUE %s (" , quote_name ( row [ 2 ] , name_buff , 0 ) ) ;
}
else putc ( ',' , sql_file ) ;
fputs ( quote_name ( row [ 4 ] , name_buff , 0 ) , sql_file ) ;
if ( row [ 7 ] ) fprintf ( sql_file , " (%s)" , row [ 7 ] ) ;
check_io ( sql_file ) ;
}
mysql_free_result ( result ) ;
if ( ! opt_xml ) {
if ( keynr ) putc ( ')' , sql_file ) ;
fputs ( "\n)" , sql_file ) ;
check_io ( sql_file ) ;
}
if ( create_options ) {
char show_name_buff [ NAME_LEN * 2 + 2 + 24 ] ;
my_snprintf ( buff , sizeof ( buff ) , "show table status like %s" , quote_for_like ( table , show_name_buff ) ) ;
if ( mysql_query_with_error_report ( mysql , & result , buff ) ) {
if ( mysql_errno ( mysql ) != ER_PARSE_ERROR ) {
verbose_msg ( "-- Warning: Couldn't get status information for " "table %s (%s)\n" , result_table , mysql_error ( mysql ) ) ;
}
}
else if ( ! ( row = mysql_fetch_row ( result ) ) ) {
fprintf ( stderr , "Error: Couldn't read status information for table %s (%s)\n" , result_table , mysql_error ( mysql ) ) ;
}
else {
if ( opt_xml ) print_xml_row ( sql_file , "options" , result , & row , NullS ) ;
else {
fputs ( "/*!" , sql_file ) ;
print_value ( sql_file , result , row , "engine=" , "Engine" , 0 ) ;
print_value ( sql_file , result , row , "" , "Create_options" , 0 ) ;
print_value ( sql_file , result , row , "comment=" , "Comment" , 1 ) ;
fputs ( " */" , sql_file ) ;
check_io ( sql_file ) ;
}
}
mysql_free_result ( result ) ;
}
continue_xml : if ( ! opt_xml ) fputs ( ";
\n" , sql_file ) ;
else fputs ( "\t</table_structure>\n" , sql_file ) ;
check_io ( sql_file ) ;
}
}
if ( complete_insert ) {
dynstr_append_checked ( & insert_pat , ") VALUES " ) ;
if ( ! extended_insert ) dynstr_append_checked ( & insert_pat , "(" ) ;
}
if ( sql_file != md_result_file ) {
fputs ( "\n" , sql_file ) ;
write_footer ( sql_file ) ;
my_fclose ( sql_file , MYF ( MY_WME ) ) ;
}
DBUG_RETURN ( ( uint ) num_fields ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void gsm_a_dtap_cc_stat_init ( new_stat_tap_ui * new_stat , new_stat_tap_gui_init_cb gui_callback , void * gui_data ) {
gsm_a_stat_init ( new_stat , gui_callback , gui_data , "GSM A-I/F DTAP Call Control Statistics" , gsm_a_dtap_msg_cc_strings ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void timeout_correct ( struct event_base * base , struct timeval * tv ) {
struct event * * pev ;
unsigned int size ;
struct timeval off ;
if ( use_monotonic ) return ;
gettime ( base , tv ) ;
if ( evutil_timercmp ( tv , & base -> event_tv , >= ) ) {
base -> event_tv = * tv ;
return ;
}
event_debug ( ( "%s: time is running backwards, corrected" , __func__ ) ) ;
evutil_timersub ( & base -> event_tv , tv , & off ) ;
pev = base -> timeheap . p ;
size = base -> timeheap . n ;
for ( ;
size -- > 0 ;
++ pev ) {
struct timeval * ev_tv = & ( * * pev ) . ev_timeout ;
evutil_timersub ( ev_tv , & off , ev_tv ) ;
}
base -> event_tv = * tv ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static size_t read_uncompressed_header ( VP9Decoder * pbi , struct vp9_read_bit_buffer * rb ) {
VP9_COMMON * const cm = & pbi -> common ;
size_t sz ;
int i ;
cm -> last_frame_type = cm -> frame_type ;
if ( vp9_rb_read_literal ( rb , 2 ) != VP9_FRAME_MARKER ) vpx_internal_error ( & cm -> error , VPX_CODEC_UNSUP_BITSTREAM , "Invalid frame marker" ) ;
cm -> profile = read_profile ( rb ) ;
if ( cm -> profile >= MAX_PROFILES ) vpx_internal_error ( & cm -> error , VPX_CODEC_UNSUP_BITSTREAM , "Unsupported bitstream profile" ) ;
cm -> show_existing_frame = vp9_rb_read_bit ( rb ) ;
if ( cm -> show_existing_frame ) {
const int frame_to_show = cm -> ref_frame_map [ vp9_rb_read_literal ( rb , 3 ) ] ;
if ( frame_to_show < 0 || cm -> frame_bufs [ frame_to_show ] . ref_count < 1 ) vpx_internal_error ( & cm -> error , VPX_CODEC_UNSUP_BITSTREAM , "Buffer %d does not contain a decoded frame" , frame_to_show ) ;
ref_cnt_fb ( cm -> frame_bufs , & cm -> new_fb_idx , frame_to_show ) ;
pbi -> refresh_frame_flags = 0 ;
cm -> lf . filter_level = 0 ;
cm -> show_frame = 1 ;
return 0 ;
}
cm -> frame_type = ( FRAME_TYPE ) vp9_rb_read_bit ( rb ) ;
cm -> show_frame = vp9_rb_read_bit ( rb ) ;
cm -> error_resilient_mode = vp9_rb_read_bit ( rb ) ;
if ( cm -> frame_type == KEY_FRAME ) {
if ( ! vp9_read_sync_code ( rb ) ) vpx_internal_error ( & cm -> error , VPX_CODEC_UNSUP_BITSTREAM , "Invalid frame sync code" ) ;
if ( cm -> profile > PROFILE_1 ) cm -> bit_depth = vp9_rb_read_bit ( rb ) ? BITS_12 : BITS_10 ;
cm -> color_space = ( COLOR_SPACE ) vp9_rb_read_literal ( rb , 3 ) ;
if ( cm -> color_space != SRGB ) {
vp9_rb_read_bit ( rb ) ;
if ( cm -> profile >= PROFILE_1 ) {
cm -> subsampling_x = vp9_rb_read_bit ( rb ) ;
cm -> subsampling_y = vp9_rb_read_bit ( rb ) ;
vp9_rb_read_bit ( rb ) ;
}
else {
cm -> subsampling_y = cm -> subsampling_x = 1 ;
}
}
else {
if ( cm -> profile >= PROFILE_1 ) {
cm -> subsampling_y = cm -> subsampling_x = 0 ;
vp9_rb_read_bit ( rb ) ;
}
else {
vpx_internal_error ( & cm -> error , VPX_CODEC_UNSUP_BITSTREAM , "RGB not supported in profile 0" ) ;
}
}
pbi -> refresh_frame_flags = ( 1 << REF_FRAMES ) - 1 ;
for ( i = 0 ;
i < REFS_PER_FRAME ;
++ i ) {
cm -> frame_refs [ i ] . idx = cm -> new_fb_idx ;
cm -> frame_refs [ i ] . buf = get_frame_new_buffer ( cm ) ;
}
setup_frame_size ( cm , rb ) ;
}
else {
cm -> intra_only = cm -> show_frame ? 0 : vp9_rb_read_bit ( rb ) ;
cm -> reset_frame_context = cm -> error_resilient_mode ? : vp9_rb_read_literal ( rb , 2 ) ;
if ( cm -> intra_only ) {
if ( ! vp9_read_sync_code ( rb ) ) vpx_internal_error ( & cm -> error , VPX_CODEC_UNSUP_BITSTREAM , "Invalid frame sync code" ) ;
pbi -> refresh_frame_flags = vp9_rb_read_literal ( rb , REF_FRAMES ) ;
cm -> color_space = BT_601 ;
cm -> subsampling_y = cm -> subsampling_x = 1 ;
setup_frame_size ( cm , rb ) ;
}
else {
pbi -> refresh_frame_flags = vp9_rb_read_literal ( rb , REF_FRAMES ) ;
for ( i = 0 ;
i < REFS_PER_FRAME ;
++ i ) {
const int ref = vp9_rb_read_literal ( rb , REF_FRAMES_LOG2 ) ;
const int idx = cm -> ref_frame_map [ ref ] ;
RefBuffer * const ref_frame = & cm -> frame_refs [ i ] ;
ref_frame -> idx = idx ;
ref_frame -> buf = & cm -> frame_bufs [ idx ] . buf ;
cm -> ref_frame_sign_bias [ LAST_FRAME + i ] = vp9_rb_read_bit ( rb ) ;
}
setup_frame_size_with_refs ( cm , rb ) ;
cm -> allow_high_precision_mv = vp9_rb_read_bit ( rb ) ;
cm -> interp_filter = read_interp_filter ( rb ) ;
for ( i = 0 ;
i < REFS_PER_FRAME ;
++ i ) {
RefBuffer * const ref_buf = & cm -> frame_refs [ i ] ;
vp9_setup_scale_factors_for_frame ( & ref_buf -> sf , ref_buf -> buf -> y_crop_width , ref_buf -> buf -> y_crop_height , cm -> width , cm -> height ) ;
if ( vp9_is_scaled ( & ref_buf -> sf ) ) vp9_extend_frame_borders ( ref_buf -> buf ) ;
}
}
}
if ( ! cm -> error_resilient_mode ) {
cm -> coding_use_prev_mi = 1 ;
cm -> refresh_frame_context = vp9_rb_read_bit ( rb ) ;
cm -> frame_parallel_decoding_mode = vp9_rb_read_bit ( rb ) ;
}
else {
cm -> coding_use_prev_mi = 0 ;
cm -> refresh_frame_context = 0 ;
cm -> frame_parallel_decoding_mode = 1 ;
}
cm -> frame_context_idx = vp9_rb_read_literal ( rb , FRAME_CONTEXTS_LOG2 ) ;
if ( frame_is_intra_only ( cm ) || cm -> error_resilient_mode ) vp9_setup_past_independence ( cm ) ;
setup_loopfilter ( & cm -> lf , rb ) ;
setup_quantization ( cm , & pbi -> mb , rb ) ;
setup_segmentation ( & cm -> seg , rb ) ;
setup_tile_info ( cm , rb ) ;
sz = vp9_rb_read_literal ( rb , 16 ) ;
if ( sz == 0 ) vpx_internal_error ( & cm -> error , VPX_CODEC_CORRUPT_FRAME , "Invalid header size" ) ;
return sz ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static Dwarf_Unsigned dwarf_elf_object_access_get_section_count ( void * obj_in ) {
dwarf_elf_object_access_internals_t * obj = ( dwarf_elf_object_access_internals_t * ) obj_in ;
return obj -> section_count ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int vlc_decode_block ( MimicContext * ctx , int num_coeffs , int qscale ) {
int16_t * block = ctx -> dct_block ;
unsigned int pos ;
ctx -> dsp . clear_block ( block ) ;
block [ 0 ] = get_bits ( & ctx -> gb , 8 ) << 3 ;
for ( pos = 1 ;
pos < num_coeffs ;
pos ++ ) {
uint32_t vlc , num_bits ;
int value ;
int coeff ;
vlc = get_vlc2 ( & ctx -> gb , ctx -> vlc . table , ctx -> vlc . bits , 3 ) ;
if ( ! vlc ) return 0 ;
if ( vlc == - 1 ) return AVERROR_INVALIDDATA ;
pos += vlc & 15 ;
num_bits = vlc >> 4 ;
if ( pos >= 64 ) return AVERROR_INVALIDDATA ;
value = get_bits ( & ctx -> gb , num_bits ) ;
coeff = vlcdec_lookup [ num_bits ] [ value ] ;
if ( pos < 3 ) coeff <<= 4 ;
else coeff = ( coeff * qscale ) / 1001 ;
block [ ctx -> scantable . permutated [ pos ] ] = coeff ;
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_FeatureDescriptor ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 852 "./asn1/h225/h225.cnf" void * priv_data = actx -> private_data ;
actx -> private_data = gef_ctx_alloc ( NULL , "FeatureDescriptor" ) ;
offset = dissect_h225_GenericData ( tvb , offset , actx , tree , hf_index ) ;
# line 855 "./asn1/h225/h225.cnf" actx -> private_data = priv_data ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int connect_to_db ( char * host , char * user , char * passwd ) {
char buff [ 20 + FN_REFLEN ] ;
DBUG_ENTER ( "connect_to_db" ) ;
verbose_msg ( "-- Connecting to %s...\n" , host ? host : "localhost" ) ;
mysql_init ( & mysql_connection ) ;
if ( opt_compress ) mysql_options ( & mysql_connection , MYSQL_OPT_COMPRESS , NullS ) ;
# ifdef HAVE_OPENSSL if ( opt_use_ssl ) mysql_ssl_set ( & mysql_connection , opt_ssl_key , opt_ssl_cert , opt_ssl_ca , opt_ssl_capath , opt_ssl_cipher ) ;
mysql_options ( & mysql_connection , MYSQL_OPT_SSL_VERIFY_SERVER_CERT , ( char * ) & opt_ssl_verify_server_cert ) ;
# endif if ( opt_protocol ) mysql_options ( & mysql_connection , MYSQL_OPT_PROTOCOL , ( char * ) & opt_protocol ) ;
# ifdef HAVE_SMEM if ( shared_memory_base_name ) mysql_options ( & mysql_connection , MYSQL_SHARED_MEMORY_BASE_NAME , shared_memory_base_name ) ;
# endif mysql_options ( & mysql_connection , MYSQL_SET_CHARSET_NAME , default_charset ) ;
if ( opt_plugin_dir && * opt_plugin_dir ) mysql_options ( & mysql_connection , MYSQL_PLUGIN_DIR , opt_plugin_dir ) ;
if ( opt_default_auth && * opt_default_auth ) mysql_options ( & mysql_connection , MYSQL_DEFAULT_AUTH , opt_default_auth ) ;
mysql = & mysql_connection ;
if ( ! mysql_real_connect ( & mysql_connection , host , user , passwd , NULL , opt_mysql_port , opt_mysql_unix_port , 0 ) ) {
DB_error ( & mysql_connection , "when trying to connect" ) ;
DBUG_RETURN ( 1 ) ;
}
if ( ( mysql_get_server_version ( & mysql_connection ) < 40100 ) || ( opt_compatible_mode & 3 ) ) {
opt_set_charset = 0 ;
server_supports_switching_charsets = FALSE ;
}
mysql -> reconnect = 0 ;
my_snprintf ( buff , sizeof ( buff ) , "/*!40100 SET @@SQL_MODE='%s' */" , compatible_mode_normal_str ) ;
if ( mysql_query_with_error_report ( mysql , 0 , buff ) ) DBUG_RETURN ( 1 ) ;
if ( opt_tz_utc ) {
my_snprintf ( buff , sizeof ( buff ) , "/*!40103 SET TIME_ZONE='+00:00' */" ) ;
if ( mysql_query_with_error_report ( mysql , 0 , buff ) ) DBUG_RETURN ( 1 ) ;
}
DBUG_RETURN ( 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_T_h223AnnexADoubleFlag ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_T_h223AnnexADoubleFlag , T_h223AnnexADoubleFlag_choice , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void crypto_policy_set_rtcp_default ( crypto_policy_t * p ) {
p -> cipher_type = AES_ICM ;
p -> cipher_key_len = 30 ;
p -> auth_type = HMAC_SHA1 ;
p -> auth_key_len = 20 ;
p -> auth_tag_len = 10 ;
p -> sec_serv = sec_serv_conf_and_auth ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | SplineChar * PSCharStringToSplines ( uint8 * type1 , int len , struct pscontext * context , struct pschars * subrs , struct pschars * gsubrs , const char * name ) {
int is_type2 = context -> is_type2 ;
real stack [ 50 ] ;
int sp = 0 , v ;
real transient [ 32 ] ;
SplineChar * ret = SplineCharCreate ( 2 ) ;
SplinePointList * cur = NULL , * oldcur = NULL ;
RefChar * r1 , * r2 , * rlast = NULL ;
DBasePoint current ;
real dx , dy , dx2 , dy2 , dx3 , dy3 , dx4 , dy4 , dx5 , dy5 , dx6 , dy6 ;
SplinePoint * pt ;
struct substate {
unsigned char * type1 ;
int len ;
int subnum ;
}
pcstack [ 11 ] ;
int pcsp = 0 ;
StemInfo * hint , * hp ;
real pops [ 30 ] ;
int popsp = 0 ;
int base , polarity ;
real coord ;
struct pschars * s ;
int hint_cnt = 0 ;
StemInfo * activeh = NULL , * activev = NULL , * sameh ;
HintMask * pending_hm = NULL ;
HintMask * counters [ 96 ] ;
int cp = 0 ;
real unblended [ 2 ] [ MmMax ] ;
int last_was_b1 = false , old_last_was_b1 ;
if ( ! is_type2 && context -> instance_count > 1 ) memset ( unblended , 0 , sizeof ( unblended ) ) ;
ret -> name = copy ( name ) ;
ret -> unicodeenc = - 1 ;
ret -> width = ( int16 ) 0x8000 ;
if ( name == NULL ) name = "unnamed" ;
ret -> manualhints = true ;
current . x = current . y = 0 ;
while ( len > 0 ) {
if ( sp > 48 ) {
LogError ( _ ( "Stack got too big in %s\n" ) , name ) ;
sp = 48 ;
}
base = 0 ;
-- len ;
if ( ( v = * type1 ++ ) >= 32 ) {
if ( v <= 246 ) {
stack [ sp ++ ] = v - 139 ;
}
else if ( v <= 250 ) {
stack [ sp ++ ] = ( v - 247 ) * 256 + * type1 ++ + 108 ;
-- len ;
}
else if ( v <= 254 ) {
stack [ sp ++ ] = - ( v - 251 ) * 256 - * type1 ++ - 108 ;
-- len ;
}
else {
int val = ( * type1 << 24 ) | ( type1 [ 1 ] << 16 ) | ( type1 [ 2 ] << 8 ) | type1 [ 3 ] ;
stack [ sp ++ ] = val ;
type1 += 4 ;
len -= 4 ;
if ( is_type2 ) {
# ifndef PSFixed_Is_TTF stack [ sp - 1 ] /= 65536. ;
# else int mant = val & 0xffff ;
stack [ sp - 1 ] = ( val >> 16 ) + mant / 65536. ;
# endif }
}
}
else if ( v == 28 ) {
stack [ sp ++ ] = ( short ) ( ( type1 [ 0 ] << 8 ) | type1 [ 1 ] ) ;
type1 += 2 ;
len -= 2 ;
}
else if ( v == 12 ) {
old_last_was_b1 = last_was_b1 ;
last_was_b1 = false ;
v = * type1 ++ ;
-- len ;
switch ( v ) {
case 0 : if ( is_type2 ) LogError ( _ ( "%s\'s dotsection operator is deprecated for Type2\n" ) , name ) ;
sp = 0 ;
break ;
case 1 : if ( sp < 6 ) LogError ( _ ( "Stack underflow on vstem3 in %s\n" ) , name ) ;
if ( is_type2 ) LogError ( _ ( "%s\'s vstem3 operator is not supported for Type2\n" ) , name ) ;
sameh = NULL ;
if ( ! is_type2 ) sameh = SameH ( ret -> vstem , stack [ 0 ] + ret -> lsidebearing , stack [ 1 ] , unblended , 0 ) ;
hint = HintNew ( stack [ 0 ] + ret -> lsidebearing , stack [ 1 ] ) ;
hint -> hintnumber = sameh != NULL ? sameh -> hintnumber : hint_cnt ++ ;
if ( activev == NULL ) activev = hp = hint ;
else {
for ( hp = activev ;
hp -> next != NULL ;
hp = hp -> next ) ;
hp -> next = hint ;
hp = hint ;
}
sameh = NULL ;
if ( ! is_type2 ) sameh = SameH ( ret -> vstem , stack [ 2 ] + ret -> lsidebearing , stack [ 3 ] , unblended , 0 ) ;
hp -> next = HintNew ( stack [ 2 ] + ret -> lsidebearing , stack [ 3 ] ) ;
hp -> next -> hintnumber = sameh != NULL ? sameh -> hintnumber : hint_cnt ++ ;
if ( ! is_type2 ) sameh = SameH ( ret -> vstem , stack [ 4 ] + ret -> lsidebearing , stack [ 5 ] , unblended , 0 ) ;
hp -> next -> next = HintNew ( stack [ 4 ] + ret -> lsidebearing , stack [ 5 ] ) ;
hp -> next -> next -> hintnumber = sameh != NULL ? sameh -> hintnumber : hint_cnt ++ ;
if ( ! is_type2 && hp -> next -> next -> hintnumber < 96 ) {
if ( pending_hm == NULL ) pending_hm = chunkalloc ( sizeof ( HintMask ) ) ;
( * pending_hm ) [ hint -> hintnumber >> 3 ] |= 0x80 >> ( hint -> hintnumber & 0x7 ) ;
( * pending_hm ) [ hint -> next -> hintnumber >> 3 ] |= 0x80 >> ( hint -> next -> hintnumber & 0x7 ) ;
( * pending_hm ) [ hint -> next -> next -> hintnumber >> 3 ] |= 0x80 >> ( hint -> next -> next -> hintnumber & 0x7 ) ;
}
hp = hp -> next -> next ;
sp = 0 ;
break ;
case 2 : if ( sp < 6 ) LogError ( _ ( "Stack underflow on hstem3 in %s\n" ) , name ) ;
if ( is_type2 ) LogError ( _ ( "%s\'s vstem3 operator is not supported for Type2\n" ) , name ) ;
sameh = NULL ;
if ( ! is_type2 ) sameh = SameH ( ret -> hstem , stack [ 0 ] , stack [ 1 ] , unblended , 0 ) ;
hint = HintNew ( stack [ 0 ] , stack [ 1 ] ) ;
hint -> hintnumber = sameh != NULL ? sameh -> hintnumber : hint_cnt ++ ;
if ( activeh == NULL ) activeh = hp = hint ;
else {
for ( hp = activeh ;
hp -> next != NULL ;
hp = hp -> next ) ;
hp -> next = hint ;
hp = hint ;
}
sameh = NULL ;
if ( ! is_type2 ) sameh = SameH ( ret -> hstem , stack [ 2 ] , stack [ 3 ] , unblended , 0 ) ;
hp -> next = HintNew ( stack [ 2 ] , stack [ 3 ] ) ;
hp -> next -> hintnumber = sameh != NULL ? sameh -> hintnumber : hint_cnt ++ ;
sameh = NULL ;
if ( ! is_type2 ) sameh = SameH ( ret -> hstem , stack [ 4 ] , stack [ 5 ] , unblended , 0 ) ;
hp -> next -> next = HintNew ( stack [ 4 ] , stack [ 5 ] ) ;
hp -> next -> next -> hintnumber = sameh != NULL ? sameh -> hintnumber : hint_cnt ++ ;
if ( ! is_type2 && hp -> next -> next -> hintnumber < 96 ) {
if ( pending_hm == NULL ) pending_hm = chunkalloc ( sizeof ( HintMask ) ) ;
( * pending_hm ) [ hint -> hintnumber >> 3 ] |= 0x80 >> ( hint -> hintnumber & 0x7 ) ;
( * pending_hm ) [ hint -> next -> hintnumber >> 3 ] |= 0x80 >> ( hint -> next -> hintnumber & 0x7 ) ;
( * pending_hm ) [ hint -> next -> next -> hintnumber >> 3 ] |= 0x80 >> ( hint -> next -> next -> hintnumber & 0x7 ) ;
}
hp = hp -> next -> next ;
sp = 0 ;
break ;
case 6 : seac : if ( sp < 5 ) LogError ( _ ( "Stack underflow on seac in %s\n" ) , name ) ;
if ( is_type2 ) {
if ( v == 6 ) LogError ( _ ( "%s\'s SEAC operator is invalid for Type2\n" ) , name ) ;
else LogError ( _ ( "%s\'s SEAC-like endchar operator is deprecated for Type2\n" ) , name ) ;
}
r1 = RefCharCreate ( ) ;
r2 = RefCharCreate ( ) ;
r2 -> transform [ 0 ] = 1 ;
r2 -> transform [ 3 ] = 1 ;
r2 -> transform [ 4 ] = stack [ 1 ] - ( stack [ 0 ] - ret -> lsidebearing ) ;
r2 -> transform [ 5 ] = stack [ 2 ] ;
r1 -> transform [ 0 ] = 1 ;
r1 -> transform [ 3 ] = 1 ;
r1 -> adobe_enc = stack [ 3 ] ;
r2 -> adobe_enc = stack [ 4 ] ;
if ( stack [ 3 ] < 0 || stack [ 3 ] >= 256 || stack [ 4 ] < 0 || stack [ 4 ] >= 256 ) {
LogError ( _ ( "Reference encoding out of bounds in %s\n" ) , name ) ;
r1 -> adobe_enc = 0 ;
r2 -> adobe_enc = 0 ;
}
r1 -> next = r2 ;
if ( rlast != NULL ) rlast -> next = r1 ;
else ret -> layers [ ly_fore ] . refs = r1 ;
ret -> changedsincelasthinted = true ;
rlast = r2 ;
sp = 0 ;
break ;
case 7 : if ( sp < 4 ) LogError ( _ ( "Stack underflow on sbw in %s\n" ) , name ) ;
if ( is_type2 ) LogError ( _ ( "%s\'s sbw operator is not supported for Type2\n" ) , name ) ;
ret -> lsidebearing = stack [ 0 ] ;
ret -> width = stack [ 2 ] ;
sp = 0 ;
break ;
case 5 : case 9 : case 14 : case 26 : if ( sp < 1 ) LogError ( _ ( "Stack underflow on unary operator in %s\n" ) , name ) ;
switch ( v ) {
case 5 : stack [ sp - 1 ] = ( stack [ sp - 1 ] == 0 ) ;
break ;
case 9 : if ( stack [ sp - 1 ] < 0 ) stack [ sp - 1 ] = - stack [ sp - 1 ] ;
break ;
case 14 : stack [ sp - 1 ] = - stack [ sp - 1 ] ;
break ;
case 26 : stack [ sp - 1 ] = sqrt ( stack [ sp - 1 ] ) ;
break ;
default : break ;
}
break ;
case 3 : case 4 : case 10 : case 11 : case 12 : case 15 : case 24 : if ( sp < 2 ) LogError ( _ ( "Stack underflow on binary operator in %s\n" ) , name ) ;
else switch ( v ) {
case 3 : stack [ sp - 2 ] = ( stack [ sp - 1 ] != 0 && stack [ sp - 2 ] != 0 ) ;
break ;
case 4 : stack [ sp - 2 ] = ( stack [ sp - 1 ] != 0 || stack [ sp - 2 ] != 0 ) ;
break ;
case 10 : stack [ sp - 2 ] += stack [ sp - 1 ] ;
break ;
case 11 : stack [ sp - 2 ] -= stack [ sp - 1 ] ;
break ;
case 12 : stack [ sp - 2 ] /= stack [ sp - 1 ] ;
break ;
case 24 : stack [ sp - 2 ] *= stack [ sp - 1 ] ;
break ;
case 15 : stack [ sp - 2 ] = ( stack [ sp - 1 ] == stack [ sp - 2 ] ) ;
break ;
default : break ;
}
-- sp ;
break ;
case 22 : if ( sp < 4 ) LogError ( _ ( "Stack underflow on ifelse in %s\n" ) , name ) ;
else {
if ( stack [ sp - 2 ] > stack [ sp - 1 ] ) stack [ sp - 4 ] = stack [ sp - 3 ] ;
sp -= 3 ;
}
break ;
case 23 : do {
stack [ sp ] = ( rand ( ) / ( RAND_MAX - 1 ) ) ;
}
while ( stack [ sp ] == 0 || stack [ sp ] > 1 ) ;
++ sp ;
break ;
case 16 : if ( is_type2 ) LogError ( _ ( "Type2 fonts do not support the Type1 callothersubrs operator" ) ) ;
if ( sp < 2 || sp < 2 + stack [ sp - 2 ] ) {
LogError ( _ ( "Stack underflow on callothersubr in %s\n" ) , name ) ;
sp = 0 ;
}
else {
int tot = stack [ sp - 2 ] , i , k , j ;
popsp = 0 ;
for ( k = sp - 3 ;
k >= sp - 2 - tot ;
-- k ) pops [ popsp ++ ] = stack [ k ] ;
switch ( ( int ) stack [ sp - 1 ] ) {
case 3 : {
ret -> manualhints = false ;
ret -> hstem = HintsAppend ( ret -> hstem , activeh ) ;
activeh = NULL ;
ret -> vstem = HintsAppend ( ret -> vstem , activev ) ;
activev = NULL ;
}
break ;
case 1 : {
is_type2 = false ;
if ( cur != NULL ) {
oldcur = cur ;
cur -> next = NULL ;
}
else LogError ( _ ( "Bad flex subroutine in %s\n" ) , name ) ;
}
break ;
case 2 : {
;
}
break ;
case 0 : if ( oldcur != NULL ) {
SplinePointList * spl = oldcur -> next ;
if ( spl != NULL && spl -> next != NULL && spl -> next -> next != NULL && spl -> next -> next -> next != NULL && spl -> next -> next -> next -> next != NULL && spl -> next -> next -> next -> next -> next != NULL && spl -> next -> next -> next -> next -> next -> next != NULL ) {
BasePoint old_nextcp , mid_prevcp , mid , mid_nextcp , end_prevcp , end ;
old_nextcp = spl -> next -> first -> me ;
mid_prevcp = spl -> next -> next -> first -> me ;
mid = spl -> next -> next -> next -> first -> me ;
mid_nextcp = spl -> next -> next -> next -> next -> first -> me ;
end_prevcp = spl -> next -> next -> next -> next -> next -> first -> me ;
end = spl -> next -> next -> next -> next -> next -> next -> first -> me ;
cur = oldcur ;
if ( cur != NULL && cur -> first != NULL && ( cur -> first != cur -> last || cur -> first -> next == NULL ) ) {
cur -> last -> nextcp = old_nextcp ;
cur -> last -> nonextcp = false ;
pt = chunkalloc ( sizeof ( SplinePoint ) ) ;
pt -> hintmask = pending_hm ;
pending_hm = NULL ;
pt -> prevcp = mid_prevcp ;
pt -> me = mid ;
pt -> nextcp = mid_nextcp ;
CheckMake ( cur -> last , pt ) ;
SplineMake3 ( cur -> last , pt ) ;
cur -> last = pt ;
pt = chunkalloc ( sizeof ( SplinePoint ) ) ;
pt -> prevcp = end_prevcp ;
pt -> me = end ;
pt -> nonextcp = true ;
CheckMake ( cur -> last , pt ) ;
SplineMake3 ( cur -> last , pt ) ;
cur -> last = pt ;
}
else LogError ( _ ( "No previous point on path in curveto from flex 0 in %s\n" ) , name ) ;
}
else {
pt = chunkalloc ( sizeof ( SplinePoint ) ) ;
pt -> me . x = pops [ 1 ] ;
pt -> me . y = pops [ 0 ] ;
pt -> noprevcp = true ;
pt -> nonextcp = true ;
SplinePointListFree ( oldcur -> next ) ;
oldcur -> next = NULL ;
spl = NULL ;
cur = oldcur ;
if ( cur != NULL && cur -> first != NULL && ( cur -> first != cur -> last || cur -> first -> next == NULL ) ) {
CheckMake ( cur -> last , pt ) ;
SplineMake3 ( cur -> last , pt ) ;
cur -> last = pt ;
}
else LogError ( _ ( "No previous point on path in lineto from flex 0 in %s\n" ) , name ) ;
}
-- popsp ;
cur -> next = NULL ;
SplinePointListsFree ( spl ) ;
oldcur = NULL ;
}
else LogError ( _ ( "Bad flex subroutine in %s\n" ) , name ) ;
is_type2 = context -> is_type2 ;
break ;
case 14 : case 15 : case 16 : case 17 : case 18 : {
int cnt = stack [ sp - 1 ] - 13 ;
if ( cnt == 5 ) cnt = 6 ;
if ( context -> instance_count == 0 ) LogError ( _ ( "Attempt to use a multiple master subroutine in a non-mm font in %s.\n" ) , name ) ;
else if ( tot != cnt * context -> instance_count ) LogError ( _ ( "Multiple master subroutine called with the wrong number of arguments in %s.\n" ) , name ) ;
else {
if ( cnt == 1 && ! is_type2 ) {
if ( sp - 2 - tot >= 1 && ( ! old_last_was_b1 || stack [ 0 ] != Blend ( unblended [ 1 ] , context ) ) ) {
unblended [ 0 ] [ 0 ] = stack [ 0 ] ;
for ( i = 1 ;
i < context -> instance_count ;
++ i ) unblended [ 0 ] [ i ] = 0 ;
}
else memcpy ( unblended , unblended + 1 , context -> instance_count * sizeof ( real ) ) ;
for ( j = 0 ;
j < context -> instance_count ;
++ j ) unblended [ 1 ] [ j ] = stack [ sp - 2 - tot + j ] ;
}
else if ( cnt == 2 && ! is_type2 ) {
unblended [ 0 ] [ 0 ] = stack [ sp - 2 - tot ] ;
unblended [ 1 ] [ 0 ] = stack [ sp - 2 - tot + 1 ] ;
for ( i = 0 ;
i < 2 ;
++ i ) for ( j = 1 ;
j < context -> instance_count ;
++ j ) unblended [ i ] [ j ] = stack [ sp - 2 - tot + 2 + i * ( context -> instance_count - 1 ) + ( j - 1 ) ] ;
}
popsp = 0 ;
for ( i = 0 ;
i < cnt ;
++ i ) {
double sum = stack [ sp - 2 - tot + i ] ;
for ( j = 1 ;
j < context -> instance_count ;
++ j ) sum += context -> blend_values [ j ] * stack [ sp - 2 - tot + cnt + i * ( context -> instance_count - 1 ) + j - 1 ] ;
pops [ cnt - 1 - popsp ++ ] = sum ;
}
}
}
break ;
}
sp = k + 1 ;
}
break ;
case 20 : if ( sp < 2 ) LogError ( _ ( "Too few items on stack for put in %s\n" ) , name ) ;
else if ( stack [ sp - 1 ] < 0 || stack [ sp - 1 ] >= 32 ) LogError ( _ ( "Reference to transient memory out of bounds in put in %s\n" ) , name ) ;
else {
transient [ ( int ) stack [ sp - 1 ] ] = stack [ sp - 2 ] ;
sp -= 2 ;
}
break ;
case 21 : if ( sp < 1 ) LogError ( _ ( "Too few items on stack for get in %s\n" ) , name ) ;
else if ( stack [ sp - 1 ] < 0 || stack [ sp - 1 ] >= 32 ) LogError ( _ ( "Reference to transient memory out of bounds in put in %s\n" ) , name ) ;
else stack [ sp - 1 ] = transient [ ( int ) stack [ sp - 1 ] ] ;
break ;
case 17 : if ( popsp <= 0 ) LogError ( _ ( "Pop stack underflow on pop in %s\n" ) , name ) ;
else stack [ sp ++ ] = pops [ -- popsp ] ;
break ;
case 18 : if ( sp > 0 ) -- sp ;
break ;
case 27 : if ( sp >= 1 ) {
stack [ sp ] = stack [ sp - 1 ] ;
++ sp ;
}
break ;
case 28 : if ( sp >= 2 ) {
real temp = stack [ sp - 1 ] ;
stack [ sp - 1 ] = stack [ sp - 2 ] ;
stack [ sp - 2 ] = temp ;
}
break ;
case 29 : if ( sp >= 1 ) {
int index = stack [ -- sp ] ;
if ( index < 0 || sp < index + 1 ) LogError ( _ ( "Index out of range in %s\n" ) , name ) ;
else {
stack [ sp ] = stack [ sp - index - 1 ] ;
++ sp ;
}
}
break ;
case 30 : if ( sp >= 2 ) {
int j = stack [ sp - 1 ] , N = stack [ sp - 2 ] ;
if ( N > sp || j >= N || j < 0 || N < 0 ) LogError ( _ ( "roll out of range in %s\n" ) , name ) ;
else if ( j == 0 || N == 0 ) ;
else {
real * temp = malloc ( N * sizeof ( real ) ) ;
int i ;
for ( i = 0 ;
i < N ;
++ i ) temp [ i ] = stack [ sp - N + i ] ;
for ( i = 0 ;
i < N ;
++ i ) stack [ sp - N + i ] = temp [ ( i + j ) % N ] ;
free ( temp ) ;
}
}
break ;
case 33 : if ( is_type2 ) LogError ( _ ( "Type2 fonts do not support the Type1 setcurrentpoint operator" ) ) ;
if ( sp < 2 ) LogError ( _ ( "Stack underflow on setcurrentpoint in %s\n" ) , name ) ;
else {
current . x = stack [ 0 ] ;
current . y = stack [ 1 ] ;
}
sp = 0 ;
break ;
case 34 : case 35 : case 36 : case 37 : dy = dy3 = dy4 = dy5 = dy6 = 0 ;
dx = stack [ base ++ ] ;
if ( v != 34 ) dy = stack [ base ++ ] ;
dx2 = stack [ base ++ ] ;
dy2 = stack [ base ++ ] ;
dx3 = stack [ base ++ ] ;
if ( v != 34 && v != 36 ) dy3 = stack [ base ++ ] ;
dx4 = stack [ base ++ ] ;
if ( v != 34 && v != 36 ) dy4 = stack [ base ++ ] ;
dx5 = stack [ base ++ ] ;
if ( v == 34 ) dy5 = - dy2 ;
else dy5 = stack [ base ++ ] ;
switch ( v ) {
real xt , yt ;
case 35 : dx6 = stack [ base ++ ] ;
dy6 = stack [ base ++ ] ;
break ;
case 34 : dx6 = stack [ base ++ ] ;
break ;
case 36 : dx6 = stack [ base ++ ] ;
dy6 = - dy - dy2 - dy5 ;
break ;
case 37 : xt = dx + dx2 + dx3 + dx4 + dx5 ;
yt = dy + dy2 + dy3 + dy4 + dy5 ;
if ( xt < 0 ) xt = - xt ;
if ( yt < 0 ) yt = - yt ;
if ( xt > yt ) {
dx6 = stack [ base ++ ] ;
dy6 = - dy - dy2 - dy3 - dy4 - dy5 ;
}
else {
dy6 = stack [ base ++ ] ;
dx6 = - dx - dx2 - dx3 - dx4 - dx5 ;
}
break ;
}
if ( cur != NULL && cur -> first != NULL && ( cur -> first != cur -> last || cur -> first -> next == NULL ) ) {
current . x = rint ( ( current . x + dx ) * 1024 ) / 1024 ;
current . y = rint ( ( current . y + dy ) * 1024 ) / 1024 ;
cur -> last -> nextcp . x = current . x ;
cur -> last -> nextcp . y = current . y ;
cur -> last -> nonextcp = false ;
current . x = rint ( ( current . x + dx2 ) * 1024 ) / 1024 ;
current . y = rint ( ( current . y + dy2 ) * 1024 ) / 1024 ;
pt = chunkalloc ( sizeof ( SplinePoint ) ) ;
pt -> hintmask = pending_hm ;
pending_hm = NULL ;
pt -> prevcp . x = current . x ;
pt -> prevcp . y = current . y ;
current . x = rint ( ( current . x + dx3 ) * 1024 ) / 1024 ;
current . y = rint ( ( current . y + dy3 ) * 1024 ) / 1024 ;
pt -> me . x = current . x ;
pt -> me . y = current . y ;
pt -> nonextcp = true ;
CheckMake ( cur -> last , pt ) ;
SplineMake3 ( cur -> last , pt ) ;
cur -> last = pt ;
current . x = rint ( ( current . x + dx4 ) * 1024 ) / 1024 ;
current . y = rint ( ( current . y + dy4 ) * 1024 ) / 1024 ;
cur -> last -> nextcp . x = current . x ;
cur -> last -> nextcp . y = current . y ;
cur -> last -> nonextcp = false ;
current . x = rint ( ( current . x + dx5 ) * 1024 ) / 1024 ;
current . y = rint ( ( current . y + dy5 ) * 1024 ) / 1024 ;
pt = chunkalloc ( sizeof ( SplinePoint ) ) ;
pt -> prevcp . x = current . x ;
pt -> prevcp . y = current . y ;
current . x = rint ( ( current . x + dx6 ) * 1024 ) / 1024 ;
current . y = rint ( ( current . y + dy6 ) * 1024 ) / 1024 ;
pt -> me . x = current . x ;
pt -> me . y = current . y ;
pt -> nonextcp = true ;
CheckMake ( cur -> last , pt ) ;
SplineMake3 ( cur -> last , pt ) ;
cur -> last = pt ;
}
else LogError ( _ ( "No previous point on path in flex operator in %s\n" ) , name ) ;
sp = 0 ;
break ;
default : LogError ( _ ( "Uninterpreted opcode 12,%d in %s\n" ) , v , name ) ;
break ;
}
}
else {
last_was_b1 = false ;
switch ( v ) {
case 1 : case 18 : base = 0 ;
if ( ( sp & 1 ) && ret -> width == ( int16 ) 0x8000 ) ret -> width = stack [ 0 ] ;
if ( sp & 1 ) base = 1 ;
if ( sp - base < 2 ) LogError ( _ ( "Stack underflow on hstem in %s\n" ) , name ) ;
coord = 0 ;
hp = NULL ;
if ( activeh != NULL ) for ( hp = activeh ;
hp -> next != NULL ;
hp = hp -> next ) ;
while ( sp - base >= 2 ) {
sameh = NULL ;
if ( ! is_type2 ) sameh = SameH ( ret -> hstem , stack [ base ] + coord , stack [ base + 1 ] , unblended , context -> instance_count ) ;
hint = HintNew ( stack [ base ] + coord , stack [ base + 1 ] ) ;
hint -> hintnumber = sameh != NULL ? sameh -> hintnumber : hint_cnt ++ ;
if ( ! is_type2 && context -> instance_count != 0 ) {
hint -> u . unblended = chunkalloc ( sizeof ( real [ 2 ] [ MmMax ] ) ) ;
memcpy ( hint -> u . unblended , unblended , sizeof ( real [ 2 ] [ MmMax ] ) ) ;
}
if ( activeh == NULL ) activeh = hint ;
else hp -> next = hint ;
hp = hint ;
if ( ! is_type2 && hint -> hintnumber < 96 ) {
if ( pending_hm == NULL ) pending_hm = chunkalloc ( sizeof ( HintMask ) ) ;
( * pending_hm ) [ hint -> hintnumber >> 3 ] |= 0x80 >> ( hint -> hintnumber & 0x7 ) ;
}
base += 2 ;
coord = hint -> start + hint -> width ;
}
sp = 0 ;
break ;
case 19 : case 20 : case 3 : case 23 : base = 0 ;
if ( cur == NULL || v == 3 || v == 23 ) {
if ( ( sp & 1 ) && is_type2 && ret -> width == ( int16 ) 0x8000 ) {
ret -> width = stack [ 0 ] ;
}
if ( sp & 1 ) base = 1 ;
if ( sp - base < 2 && v != 19 && v != 20 ) LogError ( _ ( "Stack underflow on vstem in %s\n" ) , name ) ;
coord = ret -> lsidebearing ;
hp = NULL ;
if ( activev != NULL ) for ( hp = activev ;
hp -> next != NULL ;
hp = hp -> next ) ;
while ( sp - base >= 2 ) {
sameh = NULL ;
if ( ! is_type2 ) sameh = SameH ( ret -> vstem , stack [ base ] + coord , stack [ base + 1 ] , unblended , context -> instance_count ) ;
hint = HintNew ( stack [ base ] + coord , stack [ base + 1 ] ) ;
hint -> hintnumber = sameh != NULL ? sameh -> hintnumber : hint_cnt ++ ;
if ( ! is_type2 && context -> instance_count != 0 ) {
hint -> u . unblended = chunkalloc ( sizeof ( real [ 2 ] [ MmMax ] ) ) ;
memcpy ( hint -> u . unblended , unblended , sizeof ( real [ 2 ] [ MmMax ] ) ) ;
}
if ( ! is_type2 && hint -> hintnumber < 96 ) {
if ( pending_hm == NULL ) pending_hm = chunkalloc ( sizeof ( HintMask ) ) ;
( * pending_hm ) [ hint -> hintnumber >> 3 ] |= 0x80 >> ( hint -> hintnumber & 0x7 ) ;
}
if ( activev == NULL ) activev = hint ;
else hp -> next = hint ;
hp = hint ;
base += 2 ;
coord = hint -> start + hint -> width ;
}
sp = 0 ;
}
if ( v == 19 || v == 20 ) {
int bytes = ( hint_cnt + 7 ) / 8 ;
if ( bytes > sizeof ( HintMask ) ) bytes = sizeof ( HintMask ) ;
if ( v == 19 ) {
ret -> hstem = HintsAppend ( ret -> hstem , activeh ) ;
activeh = NULL ;
ret -> vstem = HintsAppend ( ret -> vstem , activev ) ;
activev = NULL ;
if ( pending_hm == NULL ) pending_hm = chunkalloc ( sizeof ( HintMask ) ) ;
memcpy ( pending_hm , type1 , bytes ) ;
}
else if ( cp < sizeof ( counters ) / sizeof ( counters [ 0 ] ) ) {
counters [ cp ] = chunkalloc ( sizeof ( HintMask ) ) ;
memcpy ( counters [ cp ] , type1 , bytes ) ;
++ cp ;
}
if ( bytes != hint_cnt / 8 ) {
int mask = 0xff >> ( hint_cnt & 7 ) ;
if ( type1 [ bytes - 1 ] & mask ) LogError ( _ ( "Hint mask (or counter mask) with too many hints in %s\n" ) , name ) ;
}
type1 += bytes ;
len -= bytes ;
}
break ;
case 14 : if ( ( sp & 1 ) && is_type2 && ret -> width == ( int16 ) 0x8000 ) ret -> width = stack [ 0 ] ;
if ( context -> painttype != 2 ) closepath ( cur , is_type2 ) ;
pcsp = 0 ;
if ( sp == 4 ) {
stack [ 4 ] = stack [ 3 ] ;
stack [ 3 ] = stack [ 2 ] ;
stack [ 2 ] = stack [ 1 ] ;
stack [ 1 ] = stack [ 0 ] ;
stack [ 0 ] = 0 ;
sp = 5 ;
goto seac ;
}
else if ( sp == 5 ) {
stack [ 0 ] = 0 ;
goto seac ;
}
goto done ;
break ;
case 13 : if ( sp < 2 ) LogError ( _ ( "Stack underflow on hsbw in %s\n" ) , name ) ;
ret -> lsidebearing = stack [ 0 ] ;
current . x = stack [ 0 ] ;
ret -> width = stack [ 1 ] ;
sp = 0 ;
break ;
case 9 : sp = 0 ;
closepath ( cur , is_type2 ) ;
break ;
case 21 : case 22 : case 4 : if ( is_type2 ) {
if ( ( ( v == 21 && sp == 3 ) || ( v != 21 && sp == 2 ) ) && ret -> width == ( int16 ) 0x8000 ) ret -> width = stack [ 0 ] ;
if ( v == 21 && sp > 2 ) {
stack [ 0 ] = stack [ sp - 2 ] ;
stack [ 1 ] = stack [ sp - 1 ] ;
sp = 2 ;
}
else if ( v != 21 && sp > 1 ) {
stack [ 0 ] = stack [ sp - 1 ] ;
sp = 1 ;
}
if ( context -> painttype != 2 ) closepath ( cur , true ) ;
}
case 5 : case 6 : case 7 : polarity = 0 ;
base = 0 ;
while ( base < sp ) {
dx = dy = 0 ;
if ( v == 5 || v == 21 ) {
if ( sp < base + 2 ) {
LogError ( _ ( "Stack underflow on rlineto/rmoveto in %s\n" ) , name ) ;
break ;
}
dx = stack [ base ++ ] ;
dy = stack [ base ++ ] ;
}
else if ( ( v == 6 && ! ( polarity & 1 ) ) || ( v == 7 && ( polarity & 1 ) ) || v == 22 ) {
if ( sp <= base ) {
LogError ( _ ( "Stack underflow on hlineto/hmoveto in %s\n" ) , name ) ;
break ;
}
dx = stack [ base ++ ] ;
}
else {
if ( sp <= base ) {
LogError ( _ ( "Stack underflow on vlineto/vmoveto in %s\n" ) , name ) ;
break ;
}
dy = stack [ base ++ ] ;
}
++ polarity ;
current . x = rint ( ( current . x + dx ) * 1024 ) / 1024 ;
current . y = rint ( ( current . y + dy ) * 1024 ) / 1024 ;
pt = chunkalloc ( sizeof ( SplinePoint ) ) ;
pt -> hintmask = pending_hm ;
pending_hm = NULL ;
pt -> me . x = current . x ;
pt -> me . y = current . y ;
pt -> noprevcp = true ;
pt -> nonextcp = true ;
if ( v == 4 || v == 21 || v == 22 ) {
if ( cur != NULL && cur -> first == cur -> last && cur -> first -> prev == NULL && is_type2 ) {
cur -> first -> me . x = current . x ;
cur -> first -> me . y = current . y ;
SplinePointFree ( pt ) ;
}
else {
SplinePointList * spl = chunkalloc ( sizeof ( SplinePointList ) ) ;
spl -> first = spl -> last = pt ;
if ( cur != NULL ) cur -> next = spl ;
else ret -> layers [ ly_fore ] . splines = spl ;
cur = spl ;
}
break ;
}
else {
if ( cur != NULL && cur -> first != NULL && ( cur -> first != cur -> last || cur -> first -> next == NULL ) ) {
CheckMake ( cur -> last , pt ) ;
SplineMake3 ( cur -> last , pt ) ;
cur -> last = pt ;
}
else LogError ( _ ( "No previous point on path in lineto in %s\n" ) , name ) ;
if ( ! is_type2 ) break ;
}
}
sp = 0 ;
break ;
case 25 : base = 0 ;
while ( sp > base + 6 ) {
current . x = rint ( ( current . x + stack [ base ++ ] ) * 1024 ) / 1024 ;
current . y = rint ( ( current . y + stack [ base ++ ] ) * 1024 ) / 1024 ;
if ( cur != NULL ) {
pt = chunkalloc ( sizeof ( SplinePoint ) ) ;
pt -> hintmask = pending_hm ;
pending_hm = NULL ;
pt -> me . x = current . x ;
pt -> me . y = current . y ;
pt -> noprevcp = true ;
pt -> nonextcp = true ;
CheckMake ( cur -> last , pt ) ;
SplineMake3 ( cur -> last , pt ) ;
cur -> last = pt ;
}
}
case 24 : case 8 : case 31 : case 30 : case 27 : case 26 : polarity = 0 ;
while ( sp > base + 2 ) {
dx = dy = dx2 = dy2 = dx3 = dy3 = 0 ;
if ( v == 8 || v == 25 || v == 24 ) {
if ( sp < 6 + base ) {
LogError ( _ ( "Stack underflow on rrcurveto in %s\n" ) , name ) ;
base = sp ;
}
else {
dx = stack [ base ++ ] ;
dy = stack [ base ++ ] ;
dx2 = stack [ base ++ ] ;
dy2 = stack [ base ++ ] ;
dx3 = stack [ base ++ ] ;
dy3 = stack [ base ++ ] ;
}
}
else if ( v == 27 ) {
if ( sp < 4 + base ) {
LogError ( _ ( "Stack underflow on hhcurveto in %s\n" ) , name ) ;
base = sp ;
}
else {
if ( ( sp - base ) & 1 ) dy = stack [ base ++ ] ;
dx = stack [ base ++ ] ;
dx2 = stack [ base ++ ] ;
dy2 = stack [ base ++ ] ;
dx3 = stack [ base ++ ] ;
}
}
else if ( v == 26 ) {
if ( sp < 4 + base ) {
LogError ( _ ( "Stack underflow on hhcurveto in %s\n" ) , name ) ;
base = sp ;
}
else {
if ( ( sp - base ) & 1 ) dx = stack [ base ++ ] ;
dy = stack [ base ++ ] ;
dx2 = stack [ base ++ ] ;
dy2 = stack [ base ++ ] ;
dy3 = stack [ base ++ ] ;
}
}
else if ( ( v == 31 && ! ( polarity & 1 ) ) || ( v == 30 && ( polarity & 1 ) ) ) {
if ( sp < 4 + base ) {
LogError ( _ ( "Stack underflow on hvcurveto in %s\n" ) , name ) ;
base = sp ;
}
else {
dx = stack [ base ++ ] ;
dx2 = stack [ base ++ ] ;
dy2 = stack [ base ++ ] ;
dy3 = stack [ base ++ ] ;
if ( sp == base + 1 ) dx3 = stack [ base ++ ] ;
}
}
else {
if ( sp < 4 + base ) {
LogError ( _ ( "Stack underflow on vhcurveto in %s\n" ) , name ) ;
base = sp ;
}
else {
dy = stack [ base ++ ] ;
dx2 = stack [ base ++ ] ;
dy2 = stack [ base ++ ] ;
dx3 = stack [ base ++ ] ;
if ( sp == base + 1 ) dy3 = stack [ base ++ ] ;
}
}
++ polarity ;
if ( cur != NULL && cur -> first != NULL && ( cur -> first != cur -> last || cur -> first -> next == NULL ) ) {
current . x = rint ( ( current . x + dx ) * 1024 ) / 1024 ;
current . y = rint ( ( current . y + dy ) * 1024 ) / 1024 ;
cur -> last -> nextcp . x = current . x ;
cur -> last -> nextcp . y = current . y ;
cur -> last -> nonextcp = false ;
current . x = rint ( ( current . x + dx2 ) * 1024 ) / 1024 ;
current . y = rint ( ( current . y + dy2 ) * 1024 ) / 1024 ;
pt = chunkalloc ( sizeof ( SplinePoint ) ) ;
pt -> hintmask = pending_hm ;
pending_hm = NULL ;
pt -> prevcp . x = current . x ;
pt -> prevcp . y = current . y ;
current . x = rint ( ( current . x + dx3 ) * 1024 ) / 1024 ;
current . y = rint ( ( current . y + dy3 ) * 1024 ) / 1024 ;
pt -> me . x = current . x ;
pt -> me . y = current . y ;
pt -> nonextcp = true ;
CheckMake ( cur -> last , pt ) ;
SplineMake3 ( cur -> last , pt ) ;
cur -> last = pt ;
}
else LogError ( _ ( "No previous point on path in curveto in %s\n" ) , name ) ;
}
if ( v == 24 ) {
current . x = rint ( ( current . x + stack [ base ++ ] ) * 1024 ) / 1024 ;
current . y = rint ( ( current . y + stack [ base ++ ] ) * 1024 ) / 1024 ;
if ( cur != NULL ) {
pt = chunkalloc ( sizeof ( SplinePoint ) ) ;
pt -> hintmask = pending_hm ;
pending_hm = NULL ;
pt -> me . x = current . x ;
pt -> me . y = current . y ;
pt -> noprevcp = true ;
pt -> nonextcp = true ;
CheckMake ( cur -> last , pt ) ;
SplineMake3 ( cur -> last , pt ) ;
cur -> last = pt ;
}
}
sp = 0 ;
break ;
case 29 : case 10 : if ( sp < 1 ) {
LogError ( _ ( "Stack underflow on callsubr in %s\n" ) , name ) ;
break ;
}
else if ( pcsp > 10 ) {
LogError ( _ ( "Too many subroutine calls in %s\n" ) , name ) ;
break ;
}
s = subrs ;
if ( v == 29 ) s = gsubrs ;
if ( s != NULL ) stack [ sp - 1 ] += s -> bias ;
if ( s == NULL || stack [ sp - 1 ] >= s -> cnt || stack [ sp - 1 ] < 0 || s -> values [ ( int ) stack [ sp - 1 ] ] == NULL ) LogError ( _ ( "Subroutine number out of bounds in %s\n" ) , name ) ;
else {
pcstack [ pcsp ] . type1 = type1 ;
pcstack [ pcsp ] . len = len ;
pcstack [ pcsp ] . subnum = stack [ sp - 1 ] ;
++ pcsp ;
type1 = s -> values [ ( int ) stack [ sp - 1 ] ] ;
len = s -> lens [ ( int ) stack [ sp - 1 ] ] ;
}
if ( -- sp < 0 ) sp = 0 ;
break ;
case 11 : if ( pcsp < 1 ) LogError ( _ ( "return when not in subroutine in %s\n" ) , name ) ;
else {
-- pcsp ;
type1 = pcstack [ pcsp ] . type1 ;
len = pcstack [ pcsp ] . len ;
}
break ;
case 16 : {
int cnt , i , j ;
if ( context -> instance_count == 0 ) LogError ( _ ( "Attempt to use a multiple master subroutine in a non-mm font.\n" ) ) ;
else if ( sp < 1 || sp < context -> instance_count * stack [ sp - 1 ] + 1 ) LogError ( _ ( "Too few items on stack for blend in %s\n" ) , name ) ;
else {
if ( ! context -> blend_warn ) {
LogError ( _ ( "Use of obsolete blend operator.\n" ) ) ;
context -> blend_warn = true ;
}
cnt = stack [ sp - 1 ] ;
sp -= context -> instance_count * stack [ sp - 1 ] + 1 ;
for ( i = 0 ;
i < cnt ;
++ i ) {
for ( j = 1 ;
j < context -> instance_count ;
++ j ) stack [ sp + i ] += context -> blend_values [ j ] * stack [ sp + cnt + i * ( context -> instance_count - 1 ) + j - 1 ] ;
}
sp += cnt ;
}
}
break ;
default : LogError ( _ ( "Uninterpreted opcode %d in %s\n" ) , v , name ) ;
break ;
}
}
}
done : if ( pcsp != 0 ) LogError ( _ ( "end of subroutine reached with no return in %s\n" ) , name ) ;
SCCategorizePoints ( ret ) ;
ret -> hstem = HintsAppend ( ret -> hstem , activeh ) ;
activeh = NULL ;
ret -> vstem = HintsAppend ( ret -> vstem , activev ) ;
activev = NULL ;
if ( cp != 0 ) {
int i ;
ret -> countermasks = malloc ( cp * sizeof ( HintMask ) ) ;
ret -> countermask_cnt = cp ;
for ( i = 0 ;
i < cp ;
++ i ) {
memcpy ( & ret -> countermasks [ i ] , counters [ i ] , sizeof ( HintMask ) ) ;
chunkfree ( counters [ i ] , sizeof ( HintMask ) ) ;
}
}
if ( ! is_type2 && ! context -> painttype ) for ( cur = ret -> layers [ ly_fore ] . splines ;
cur != NULL ;
cur = cur -> next ) if ( cur -> first -> prev == NULL ) {
CheckMake ( cur -> last , cur -> first ) ;
SplineMake3 ( cur -> last , cur -> first ) ;
cur -> last = cur -> first ;
}
for ( cur = ret -> layers [ ly_fore ] . splines ;
cur != NULL ;
cur = cur -> next ) SplineSetReverse ( cur ) ;
if ( ret -> hstem == NULL && ret -> vstem == NULL ) ret -> manualhints = false ;
if ( ! is_type2 && context -> instance_count != 0 ) {
UnblendFree ( ret -> hstem ) ;
UnblendFree ( ret -> vstem ) ;
}
ret -> hstem = HintCleanup ( ret -> hstem , true , context -> instance_count ) ;
ret -> vstem = HintCleanup ( ret -> vstem , true , context -> instance_count ) ;
SCGuessHHintInstancesList ( ret , ly_fore ) ;
SCGuessVHintInstancesList ( ret , ly_fore ) ;
ret -> hconflicts = StemListAnyConflicts ( ret -> hstem ) ;
ret -> vconflicts = StemListAnyConflicts ( ret -> vstem ) ;
if ( context -> instance_count == 1 && ! ret -> hconflicts && ! ret -> vconflicts ) SCClearHintMasks ( ret , ly_fore , false ) ;
HintsRenumber ( ret ) ;
if ( name != NULL && strcmp ( name , ".notdef" ) != 0 ) ret -> widthset = true ;
return ( ret ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static KeydbResourceType rt_from_file ( const char * filename , int * r_found , int * r_openpgp ) {
u32 magic ;
unsigned char verbuf [ 4 ] ;
FILE * fp ;
KeydbResourceType rt = KEYDB_RESOURCE_TYPE_NONE ;
* r_found = * r_openpgp = 0 ;
fp = fopen ( filename , "rb" ) ;
if ( fp ) {
* r_found = 1 ;
if ( fread ( & magic , 4 , 1 , fp ) == 1 ) {
if ( magic == 0x13579ace || magic == 0xce9a5713 ) ;
else if ( fread ( & verbuf , 4 , 1 , fp ) == 1 && verbuf [ 0 ] == 1 && fread ( & magic , 4 , 1 , fp ) == 1 && ! memcmp ( & magic , "KBXf" , 4 ) ) {
if ( ( verbuf [ 3 ] & 0x02 ) ) * r_openpgp = 1 ;
rt = KEYDB_RESOURCE_TYPE_KEYBOX ;
}
else rt = KEYDB_RESOURCE_TYPE_KEYRING ;
}
else rt = KEYDB_RESOURCE_TYPE_KEYRING ;
fclose ( fp ) ;
}
return rt ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void nonrd_pick_partition ( VP9_COMP * cpi , const TileInfo * const tile , TOKENEXTRA * * tp , int mi_row , int mi_col , BLOCK_SIZE bsize , int * rate , int64_t * dist , int do_recon , int64_t best_rd , PC_TREE * pc_tree ) {
const SPEED_FEATURES * const sf = & cpi -> sf ;
const VP9EncoderConfig * const oxcf = & cpi -> oxcf ;
VP9_COMMON * const cm = & cpi -> common ;
MACROBLOCK * const x = & cpi -> mb ;
MACROBLOCKD * const xd = & x -> e_mbd ;
const int ms = num_8x8_blocks_wide_lookup [ bsize ] / 2 ;
TOKENEXTRA * tp_orig = * tp ;
PICK_MODE_CONTEXT * ctx = & pc_tree -> none ;
int i ;
BLOCK_SIZE subsize = bsize ;
int this_rate , sum_rate = 0 , best_rate = INT_MAX ;
int64_t this_dist , sum_dist = 0 , best_dist = INT64_MAX ;
int64_t sum_rd = 0 ;
int do_split = bsize >= BLOCK_8X8 ;
int do_rect = 1 ;
const int force_horz_split = ( mi_row + ms >= cm -> mi_rows ) ;
const int force_vert_split = ( mi_col + ms >= cm -> mi_cols ) ;
const int xss = x -> e_mbd . plane [ 1 ] . subsampling_x ;
const int yss = x -> e_mbd . plane [ 1 ] . subsampling_y ;
int partition_none_allowed = ! force_horz_split && ! force_vert_split ;
int partition_horz_allowed = ! force_vert_split && yss <= xss && bsize >= BLOCK_8X8 ;
int partition_vert_allowed = ! force_horz_split && xss <= yss && bsize >= BLOCK_8X8 ;
( void ) * tp_orig ;
assert ( num_8x8_blocks_wide_lookup [ bsize ] == num_8x8_blocks_high_lookup [ bsize ] ) ;
if ( sf -> auto_min_max_partition_size ) {
partition_none_allowed &= ( bsize <= sf -> max_partition_size && bsize >= sf -> min_partition_size ) ;
partition_horz_allowed &= ( ( bsize <= sf -> max_partition_size && bsize > sf -> min_partition_size ) || force_horz_split ) ;
partition_vert_allowed &= ( ( bsize <= sf -> max_partition_size && bsize > sf -> min_partition_size ) || force_vert_split ) ;
do_split &= bsize > sf -> min_partition_size ;
}
if ( sf -> use_square_partition_only ) {
partition_horz_allowed &= force_horz_split ;
partition_vert_allowed &= force_vert_split ;
}
if ( partition_none_allowed ) {
nonrd_pick_sb_modes ( cpi , tile , mi_row , mi_col , & this_rate , & this_dist , bsize , ctx ) ;
ctx -> mic . mbmi = xd -> mi [ 0 ] -> mbmi ;
ctx -> skip_txfm [ 0 ] = x -> skip_txfm [ 0 ] ;
ctx -> skip = x -> skip ;
if ( this_rate != INT_MAX ) {
int pl = partition_plane_context ( xd , mi_row , mi_col , bsize ) ;
this_rate += cpi -> partition_cost [ pl ] [ PARTITION_NONE ] ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , this_rate , this_dist ) ;
if ( sum_rd < best_rd ) {
int64_t stop_thresh = 4096 ;
int64_t stop_thresh_rd ;
best_rate = this_rate ;
best_dist = this_dist ;
best_rd = sum_rd ;
if ( bsize >= BLOCK_8X8 ) pc_tree -> partitioning = PARTITION_NONE ;
stop_thresh >>= 8 - ( b_width_log2 ( bsize ) + b_height_log2 ( bsize ) ) ;
stop_thresh_rd = RDCOST ( x -> rdmult , x -> rddiv , 0 , stop_thresh ) ;
if ( ! x -> e_mbd . lossless && best_rd < stop_thresh_rd ) {
do_split = 0 ;
do_rect = 0 ;
}
}
}
}
store_pred_mv ( x , ctx ) ;
sum_rd = 0 ;
if ( do_split ) {
int pl = partition_plane_context ( xd , mi_row , mi_col , bsize ) ;
sum_rate += cpi -> partition_cost [ pl ] [ PARTITION_SPLIT ] ;
subsize = get_subsize ( bsize , PARTITION_SPLIT ) ;
for ( i = 0 ;
i < 4 && sum_rd < best_rd ;
++ i ) {
const int x_idx = ( i & 1 ) * ms ;
const int y_idx = ( i >> 1 ) * ms ;
if ( mi_row + y_idx >= cm -> mi_rows || mi_col + x_idx >= cm -> mi_cols ) continue ;
load_pred_mv ( x , ctx ) ;
nonrd_pick_partition ( cpi , tile , tp , mi_row + y_idx , mi_col + x_idx , subsize , & this_rate , & this_dist , 0 , best_rd - sum_rd , pc_tree -> split [ i ] ) ;
if ( this_rate == INT_MAX ) {
sum_rd = INT64_MAX ;
}
else {
sum_rate += this_rate ;
sum_dist += this_dist ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
}
}
if ( sum_rd < best_rd ) {
best_rate = sum_rate ;
best_dist = sum_dist ;
best_rd = sum_rd ;
pc_tree -> partitioning = PARTITION_SPLIT ;
}
else {
if ( sf -> less_rectangular_check ) do_rect &= ! partition_none_allowed ;
}
}
if ( partition_horz_allowed && do_rect ) {
subsize = get_subsize ( bsize , PARTITION_HORZ ) ;
if ( sf -> adaptive_motion_search ) load_pred_mv ( x , ctx ) ;
nonrd_pick_sb_modes ( cpi , tile , mi_row , mi_col , & this_rate , & this_dist , subsize , & pc_tree -> horizontal [ 0 ] ) ;
pc_tree -> horizontal [ 0 ] . mic . mbmi = xd -> mi [ 0 ] -> mbmi ;
pc_tree -> horizontal [ 0 ] . skip_txfm [ 0 ] = x -> skip_txfm [ 0 ] ;
pc_tree -> horizontal [ 0 ] . skip = x -> skip ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
if ( sum_rd < best_rd && mi_row + ms < cm -> mi_rows ) {
load_pred_mv ( x , ctx ) ;
nonrd_pick_sb_modes ( cpi , tile , mi_row + ms , mi_col , & this_rate , & this_dist , subsize , & pc_tree -> horizontal [ 1 ] ) ;
pc_tree -> horizontal [ 1 ] . mic . mbmi = xd -> mi [ 0 ] -> mbmi ;
pc_tree -> horizontal [ 1 ] . skip_txfm [ 0 ] = x -> skip_txfm [ 0 ] ;
pc_tree -> horizontal [ 1 ] . skip = x -> skip ;
if ( this_rate == INT_MAX ) {
sum_rd = INT64_MAX ;
}
else {
int pl = partition_plane_context ( xd , mi_row , mi_col , bsize ) ;
this_rate += cpi -> partition_cost [ pl ] [ PARTITION_HORZ ] ;
sum_rate += this_rate ;
sum_dist += this_dist ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
}
}
if ( sum_rd < best_rd ) {
best_rd = sum_rd ;
best_rate = sum_rate ;
best_dist = sum_dist ;
pc_tree -> partitioning = PARTITION_HORZ ;
}
}
if ( partition_vert_allowed && do_rect ) {
subsize = get_subsize ( bsize , PARTITION_VERT ) ;
if ( sf -> adaptive_motion_search ) load_pred_mv ( x , ctx ) ;
nonrd_pick_sb_modes ( cpi , tile , mi_row , mi_col , & this_rate , & this_dist , subsize , & pc_tree -> vertical [ 0 ] ) ;
pc_tree -> vertical [ 0 ] . mic . mbmi = xd -> mi [ 0 ] -> mbmi ;
pc_tree -> vertical [ 0 ] . skip_txfm [ 0 ] = x -> skip_txfm [ 0 ] ;
pc_tree -> vertical [ 0 ] . skip = x -> skip ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
if ( sum_rd < best_rd && mi_col + ms < cm -> mi_cols ) {
load_pred_mv ( x , ctx ) ;
nonrd_pick_sb_modes ( cpi , tile , mi_row , mi_col + ms , & this_rate , & this_dist , subsize , & pc_tree -> vertical [ 1 ] ) ;
pc_tree -> vertical [ 1 ] . mic . mbmi = xd -> mi [ 0 ] -> mbmi ;
pc_tree -> vertical [ 1 ] . skip_txfm [ 0 ] = x -> skip_txfm [ 0 ] ;
pc_tree -> vertical [ 1 ] . skip = x -> skip ;
if ( this_rate == INT_MAX ) {
sum_rd = INT64_MAX ;
}
else {
int pl = partition_plane_context ( xd , mi_row , mi_col , bsize ) ;
this_rate += cpi -> partition_cost [ pl ] [ PARTITION_VERT ] ;
sum_rate += this_rate ;
sum_dist += this_dist ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
}
}
if ( sum_rd < best_rd ) {
best_rate = sum_rate ;
best_dist = sum_dist ;
best_rd = sum_rd ;
pc_tree -> partitioning = PARTITION_VERT ;
}
}
( void ) best_rd ;
* rate = best_rate ;
* dist = best_dist ;
if ( best_rate == INT_MAX ) return ;
subsize = get_subsize ( bsize , pc_tree -> partitioning ) ;
fill_mode_info_sb ( cm , x , mi_row , mi_col , bsize , subsize , pc_tree ) ;
if ( best_rate < INT_MAX && best_dist < INT64_MAX && do_recon ) {
int output_enabled = ( bsize == BLOCK_64X64 ) ;
if ( ( oxcf -> aq_mode == COMPLEXITY_AQ ) && cm -> seg . update_map ) {
vp9_select_in_frame_q_segment ( cpi , mi_row , mi_col , output_enabled , best_rate ) ;
}
if ( oxcf -> aq_mode == CYCLIC_REFRESH_AQ ) vp9_cyclic_refresh_set_rate_and_dist_sb ( cpi -> cyclic_refresh , best_rate , best_dist ) ;
encode_sb_rt ( cpi , tile , tp , mi_row , mi_col , output_enabled , bsize , pc_tree ) ;
}
if ( bsize == BLOCK_64X64 ) {
assert ( tp_orig < * tp ) ;
assert ( best_rate < INT_MAX ) ;
assert ( best_dist < INT64_MAX ) ;
}
else {
assert ( tp_orig == * tp ) ;
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | int xmlHashRemoveEntry ( xmlHashTablePtr table , const xmlChar * name , xmlHashDeallocator f ) {
return ( xmlHashRemoveEntry3 ( table , name , NULL , NULL , f ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void exsltNodeSetFunction ( xmlXPathParserContextPtr ctxt , int nargs ) {
if ( nargs != 1 ) {
xmlXPathSetArityError ( ctxt ) ;
return ;
}
if ( xmlXPathStackIsNodeSet ( ctxt ) ) {
xsltFunctionNodeSet ( ctxt , nargs ) ;
return ;
}
else {
xmlDocPtr fragment ;
xsltTransformContextPtr tctxt = xsltXPathGetTransformContext ( ctxt ) ;
xmlNodePtr txt ;
xmlChar * strval ;
xmlXPathObjectPtr obj ;
fragment = xsltCreateRVT ( tctxt ) ;
if ( fragment == NULL ) {
xsltTransformError ( tctxt , NULL , tctxt -> inst , "exsltNodeSetFunction: Failed to create a tree fragment.\n" ) ;
tctxt -> state = XSLT_STATE_STOPPED ;
return ;
}
xsltRegisterLocalRVT ( tctxt , fragment ) ;
strval = xmlXPathPopString ( ctxt ) ;
txt = xmlNewDocText ( fragment , strval ) ;
xmlAddChild ( ( xmlNodePtr ) fragment , txt ) ;
obj = xmlXPathNewNodeSet ( txt ) ;
if ( obj == NULL ) {
xsltTransformError ( tctxt , NULL , tctxt -> inst , "exsltNodeSetFunction: Failed to create a node set object.\n" ) ;
tctxt -> state = XSLT_STATE_STOPPED ;
}
else {
xsltExtensionInstructionResultRegister ( tctxt , obj ) ;
}
if ( strval != NULL ) xmlFree ( strval ) ;
valuePush ( ctxt , obj ) ;
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void pk_transaction_install_signature ( PkTransaction * transaction , GVariant * params , GDBusMethodInvocation * context ) {
gboolean ret ;
const gchar * key_id ;
const gchar * package_id ;
PkSigTypeEnum sig_type ;
g_autoptr ( GError ) error = NULL ;
g_return_if_fail ( PK_IS_TRANSACTION ( transaction ) ) ;
g_return_if_fail ( transaction -> priv -> tid != NULL ) ;
g_variant_get ( params , "(u&s&s)" , & sig_type , & key_id , & package_id ) ;
g_debug ( "InstallSignature method called: %s, %s, %s" , pk_sig_type_enum_to_string ( sig_type ) , key_id , package_id ) ;
if ( ! pk_backend_is_implemented ( transaction -> priv -> backend , PK_ROLE_ENUM_INSTALL_SIGNATURE ) ) {
g_set_error ( & error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_NOT_SUPPORTED , "InstallSignature not supported by backend" ) ;
pk_transaction_set_state ( transaction , PK_TRANSACTION_STATE_ERROR ) ;
goto out ;
}
ret = pk_transaction_strvalidate ( key_id , & error ) ;
if ( ! ret ) {
pk_transaction_set_state ( transaction , PK_TRANSACTION_STATE_ERROR ) ;
goto out ;
}
ret = pk_package_id_check ( package_id ) ;
if ( ! ret && ! g_str_has_prefix ( package_id , ";
;
;
" ) ) {
g_set_error ( & error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID , "The package id '%s' is not valid" , package_id ) ;
pk_transaction_set_state ( transaction , PK_TRANSACTION_STATE_ERROR ) ;
goto out ;
}
transaction -> priv -> cached_package_id = g_strdup ( package_id ) ;
transaction -> priv -> cached_key_id = g_strdup ( key_id ) ;
pk_transaction_set_role ( transaction , PK_ROLE_ENUM_INSTALL_SIGNATURE ) ;
ret = pk_transaction_obtain_authorization ( transaction , PK_ROLE_ENUM_INSTALL_SIGNATURE , & error ) ;
if ( ! ret ) {
pk_transaction_set_state ( transaction , PK_TRANSACTION_STATE_ERROR ) ;
goto out ;
}
out : pk_transaction_dbus_return ( context , error ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static cmsBool WriteMPECurve ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , void * Cargo , cmsUInt32Number n , cmsUInt32Number SizeOfTag ) {
_cmsStageToneCurvesData * Curves = ( _cmsStageToneCurvesData * ) Cargo ;
return WriteSegmentedCurve ( io , Curves -> TheCurves [ n ] ) ;
cmsUNUSED_PARAMETER ( SizeOfTag ) ;
cmsUNUSED_PARAMETER ( self ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void super_block_yrd ( VP9_COMP * cpi , MACROBLOCK * x , int * rate , int64_t * distortion , int * skip , int64_t * psse , BLOCK_SIZE bs , int64_t txfm_cache [ TX_MODES ] , int64_t ref_best_rd ) {
MACROBLOCKD * xd = & x -> e_mbd ;
int64_t sse ;
int64_t * ret_sse = psse ? psse : & sse ;
assert ( bs == xd -> mi [ 0 ] . src_mi -> mbmi . sb_type ) ;
if ( cpi -> sf . tx_size_search_method == USE_LARGESTALL || xd -> lossless ) {
vpx_memset ( txfm_cache , 0 , TX_MODES * sizeof ( int64_t ) ) ;
choose_largest_tx_size ( cpi , x , rate , distortion , skip , ret_sse , ref_best_rd , bs ) ;
}
else {
choose_tx_size_from_rd ( cpi , x , rate , distortion , skip , ret_sse , txfm_cache , ref_best_rd , bs ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( PrefsFunctionalTest , TestImageContentSettings ) {
ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , embedded_test_server ( ) -> GetURL ( "/settings/image_page.html" ) ) ;
bool result = false ;
std : : string script = "for (i=0;
i < document.images.length;
i++) {
" " if ((document.images[i].naturalWidth != 0) &&" " (document.images[i].naturalHeight != 0)) {
" " window.domAutomationController.send(true);
" " }
" "}
" "window.domAutomationController.send(false);
" ;
EXPECT_TRUE ( content : : ExecuteScriptAndExtractBool ( browser ( ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) , script , & result ) ) ;
EXPECT_TRUE ( result ) ;
browser ( ) -> profile ( ) -> GetPrefs ( ) -> SetInteger ( content_settings : : WebsiteSettingsRegistry : : GetInstance ( ) -> Get ( CONTENT_SETTINGS_TYPE_IMAGES ) -> default_value_pref_name ( ) , CONTENT_SETTING_BLOCK ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , embedded_test_server ( ) -> GetURL ( "/settings/image_page.html" ) ) ;
result = false ;
EXPECT_TRUE ( content : : ExecuteScriptAndExtractBool ( browser ( ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) , script , & result ) ) ;
EXPECT_FALSE ( result ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int get_file_info ( const char * filename , OUT UpnpFileInfo * info ) {
int code ;
struct stat s ;
FILE * fp ;
int rc = 0 ;
time_t aux_LastModified ;
struct tm date ;
char buffer [ ASCTIME_R_BUFFER_SIZE ] ;
UpnpFileInfo_set_ContentType ( info , NULL ) ;
code = stat ( filename , & s ) ;
if ( code == - 1 ) return - 1 ;
if ( S_ISDIR ( s . st_mode ) ) UpnpFileInfo_set_IsDirectory ( info , TRUE ) ;
else if ( S_ISREG ( s . st_mode ) ) UpnpFileInfo_set_IsDirectory ( info , FALSE ) ;
else return - 1 ;
fp = fopen ( filename , "r" ) ;
UpnpFileInfo_set_IsReadable ( info , fp != NULL ) ;
if ( fp ) fclose ( fp ) ;
UpnpFileInfo_set_FileLength ( info , s . st_size ) ;
UpnpFileInfo_set_LastModified ( info , s . st_mtime ) ;
rc = get_content_type ( filename , info ) ;
aux_LastModified = UpnpFileInfo_get_LastModified ( info ) ;
UpnpPrintf ( UPNP_INFO , HTTP , __FILE__ , __LINE__ , "file info: %s, length: %lld, last_mod=%s readable=%d\n" , filename , ( long long ) UpnpFileInfo_get_FileLength ( info ) , web_server_asctime_r ( http_gmtime_r ( & aux_LastModified , & date ) , buffer ) , UpnpFileInfo_get_IsReadable ( info ) ) ;
return rc ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void dumpnames ( struct alltabs * at , SplineFont * sf , enum fontformat format ) {
int i , j ;
struct ttflangname dummy , * cur , * useng = NULL ;
struct macname * mn ;
struct other_names * on , * onn ;
NamTab nt ;
struct otfname * otfn ;
struct otffeatname * fn ;
memset ( & nt , 0 , sizeof ( nt ) ) ;
nt . encoding_name = at -> map -> enc ;
nt . format = format ;
nt . applemode = at -> applemode ;
nt . strings = tmpfile ( ) ;
if ( ( format >= ff_ttf && format <= ff_otfdfont ) && ( at -> gi . flags & ttf_flag_symbol ) ) nt . format = ff_ttfsym ;
memset ( & dummy , 0 , sizeof ( dummy ) ) ;
for ( cur = sf -> names ;
cur != NULL ;
cur = cur -> next ) {
if ( cur -> lang == 0x409 ) {
dummy = * cur ;
useng = cur ;
break ;
}
}
DefaultTTFEnglishNames ( & dummy , sf ) ;
for ( i = 0 ;
i < ttf_namemax ;
++ i ) if ( dummy . names [ i ] != NULL ) AddEncodedName ( & nt , dummy . names [ i ] , 0x409 , i ) ;
for ( cur = sf -> names ;
cur != NULL ;
cur = cur -> next ) {
if ( cur -> lang != 0x409 ) for ( i = 0 ;
i < ttf_namemax ;
++ i ) if ( cur -> names [ i ] != NULL ) AddEncodedName ( & nt , cur -> names [ i ] , cur -> lang , i ) ;
}
if ( at -> feat_name != NULL ) {
for ( i = 0 ;
at -> feat_name [ i ] . strid != 0 ;
++ i ) {
for ( mn = at -> feat_name [ i ] . mn ;
mn != NULL ;
mn = mn -> next ) AddMacName ( & nt , mn , at -> feat_name [ i ] . strid ) ;
}
}
for ( on = at -> other_names ;
on != NULL ;
on = onn ) {
for ( mn = on -> mn ;
mn != NULL ;
mn = mn -> next ) AddMacName ( & nt , mn , on -> strid ) ;
onn = on -> next ;
chunkfree ( on , sizeof ( * on ) ) ;
}
if ( at -> fontstyle_name_strid != 0 && sf -> fontstyle_name != NULL ) {
for ( otfn = sf -> fontstyle_name ;
otfn != NULL ;
otfn = otfn -> next ) AddEncodedName ( & nt , otfn -> name , otfn -> lang , at -> fontstyle_name_strid ) ;
}
for ( fn = sf -> feat_names ;
fn != NULL ;
fn = fn -> next ) {
for ( otfn = fn -> names ;
otfn != NULL ;
otfn = otfn -> next ) AddEncodedName ( & nt , otfn -> name , otfn -> lang , fn -> nid ) ;
}
qsort ( nt . entries , nt . cur , sizeof ( NameEntry ) , compare_entry ) ;
at -> name = tmpfile ( ) ;
putshort ( at -> name , 0 ) ;
putshort ( at -> name , nt . cur ) ;
putshort ( at -> name , ( 3 + nt . cur * 6 ) * sizeof ( int16 ) ) ;
for ( i = 0 ;
i < nt . cur ;
++ i ) {
putshort ( at -> name , nt . entries [ i ] . platform ) ;
putshort ( at -> name , nt . entries [ i ] . specific ) ;
putshort ( at -> name , nt . entries [ i ] . lang ) ;
putshort ( at -> name , nt . entries [ i ] . strid ) ;
putshort ( at -> name , nt . entries [ i ] . len ) ;
putshort ( at -> name , nt . entries [ i ] . offset ) ;
}
if ( ! ttfcopyfile ( at -> name , nt . strings , ( 3 + nt . cur * 6 ) * sizeof ( int16 ) , "name-data" ) ) at -> error = true ;
at -> namelen = ftell ( at -> name ) ;
if ( ( at -> namelen & 3 ) != 0 ) for ( j = 4 - ( at -> namelen & 3 ) ;
j > 0 ;
-- j ) putc ( '\0' , at -> name ) ;
for ( i = 0 ;
i < ttf_namemax ;
++ i ) if ( useng == NULL || dummy . names [ i ] != useng -> names [ i ] ) free ( dummy . names [ i ] ) ;
free ( nt . entries ) ;
free ( at -> feat_name ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline unsigned long realpath_cache_key ( const char * path , int path_len ) {
register unsigned long h ;
const char * e = path + path_len ;
for ( h = 2166136261U ;
path < e ;
) {
h *= 16777619 ;
h ^= * path ++ ;
}
return h ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | PHP_FUNCTION ( locale_get_display_script ) {
get_icu_disp_value_src_php ( LOC_SCRIPT_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void do_chmod_file ( struct st_command * command ) {
long mode = 0 ;
int err_code ;
static DYNAMIC_STRING ds_mode ;
static DYNAMIC_STRING ds_file ;
const struct command_arg chmod_file_args [ ] = {
{
"mode" , ARG_STRING , TRUE , & ds_mode , "Mode of file(octal) ex. 0660" }
, {
"filename" , ARG_STRING , TRUE , & ds_file , "Filename of file to modify" }
}
;
DBUG_ENTER ( "do_chmod_file" ) ;
check_command_args ( command , command -> first_argument , chmod_file_args , sizeof ( chmod_file_args ) / sizeof ( struct command_arg ) , ' ' ) ;
if ( ds_mode . length != 4 || str2int ( ds_mode . str , 8 , 0 , INT_MAX , & mode ) == NullS ) die ( "You must write a 4 digit octal number for mode" ) ;
DBUG_PRINT ( "info" , ( "chmod %o %s" , ( uint ) mode , ds_file . str ) ) ;
err_code = chmod ( ds_file . str , mode ) ;
if ( err_code < 0 ) err_code = 1 ;
handle_command_error ( command , err_code , errno ) ;
dynstr_free ( & ds_mode ) ;
dynstr_free ( & ds_file ) ;
DBUG_VOID_RETURN ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_pvfs_meta_attr_dfiles ( tvbuff_t * tvb , proto_tree * tree , int offset , packet_info * pinfo ) {
guint32 dfile_count , i ;
dfile_count = tvb_get_letohl ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_pvfs_dfile_count , tvb , offset , 4 , dfile_count ) ;
offset += 4 ;
for ( i = 0 ;
i < dfile_count ;
i ++ ) offset = dissect_pvfs_fh ( tvb , offset , pinfo , tree , "handle" , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline guint32 gst_asf_demux_get_uint32 ( guint8 * * p_data , guint64 * p_size ) {
guint32 ret ;
g_assert ( * p_size >= 4 ) ;
ret = GST_READ_UINT32_LE ( * p_data ) ;
* p_data += sizeof ( guint32 ) ;
* p_size -= sizeof ( guint32 ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int archive_read_format_ar_bid ( struct archive_read * a , int best_bid ) {
const void * h ;
( void ) best_bid ;
if ( ( h = __archive_read_ahead ( a , 8 , NULL ) ) == NULL ) return ( - 1 ) ;
if ( memcmp ( h , "!<arch>\n" , 8 ) == 0 ) {
return ( 64 ) ;
}
return ( - 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int try_shrink_lower ( MAIN_WINDOW_REC * window , int count ) {
MAIN_WINDOW_REC * shrink_win ;
shrink_win = mainwindows_find_lower ( window ) ;
if ( shrink_win != NULL ) {
int ok ;
GSList * shrink_list , * tmp ;
MAIN_WINDOW_REC * win ;
ok = TRUE ;
shrink_list = mainwindows_get_line ( shrink_win ) ;
for ( tmp = shrink_list ;
tmp != NULL ;
tmp = tmp -> next ) {
win = tmp -> data ;
if ( MAIN_WINDOW_TEXT_HEIGHT ( win ) - count < WINDOW_MIN_SIZE ) {
ok = FALSE ;
break ;
}
}
if ( ok ) {
GSList * grow_list ;
grow_list = mainwindows_get_line ( window ) ;
for ( tmp = shrink_list ;
tmp != NULL ;
tmp = tmp -> next ) {
win = tmp -> data ;
win -> first_line += count ;
}
for ( tmp = grow_list ;
tmp != NULL ;
tmp = tmp -> next ) {
win = tmp -> data ;
win -> last_line += count ;
}
mainwindows_resize_two ( grow_list , shrink_list , count ) ;
g_slist_free ( grow_list ) ;
}
g_slist_free ( shrink_list ) ;
return ok ;
}
return FALSE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | QEMU_BUILD_BUG_ON ( XSAVE_BYTE_OFFSET ( word_offset ) != offsetof ( X86XSaveArea , field ) ) ASSERT_OFFSET ( XSAVE_FCW_FSW , legacy . fcw ) ;
ASSERT_OFFSET ( XSAVE_FTW_FOP , legacy . ftw ) ;
ASSERT_OFFSET ( XSAVE_CWD_RIP , legacy . fpip ) ;
ASSERT_OFFSET ( XSAVE_CWD_RDP , legacy . fpdp ) ;
ASSERT_OFFSET ( XSAVE_MXCSR , legacy . mxcsr ) ;
ASSERT_OFFSET ( XSAVE_ST_SPACE , legacy . fpregs ) ;
ASSERT_OFFSET ( XSAVE_XMM_SPACE , legacy . xmm_regs ) ;
ASSERT_OFFSET ( XSAVE_XSTATE_BV , header . xstate_bv ) ;
ASSERT_OFFSET ( XSAVE_YMMH_SPACE , avx_state ) ;
ASSERT_OFFSET ( XSAVE_BNDREGS , bndreg_state ) ;
ASSERT_OFFSET ( XSAVE_BNDCSR , bndcsr_state ) ;
ASSERT_OFFSET ( XSAVE_OPMASK , opmask_state ) ;
ASSERT_OFFSET ( XSAVE_ZMM_Hi256 , zmm_hi256_state ) ;
ASSERT_OFFSET ( XSAVE_Hi16_ZMM , hi16_zmm_state ) ;
ASSERT_OFFSET ( XSAVE_PKRU , pkru_state ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void read_bundle ( GetBitContext * gb , BinkContext * c , int bundle_num ) {
int i ;
if ( bundle_num == BINK_SRC_COLORS ) {
for ( i = 0 ;
i < 16 ;
i ++ ) read_tree ( gb , & c -> col_high [ i ] ) ;
c -> col_lastval = 0 ;
}
if ( bundle_num != BINK_SRC_INTRA_DC && bundle_num != BINK_SRC_INTER_DC ) read_tree ( gb , & c -> bundle [ bundle_num ] . tree ) ;
c -> bundle [ bundle_num ] . cur_dec = c -> bundle [ bundle_num ] . cur_ptr = c -> bundle [ bundle_num ] . data ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static bool pickoneauth ( struct auth * pick ) {
bool picked ;
unsigned long avail = pick -> avail & pick -> want ;
picked = TRUE ;
if ( avail & CURLAUTH_NEGOTIATE ) pick -> picked = CURLAUTH_NEGOTIATE ;
else if ( avail & CURLAUTH_DIGEST ) pick -> picked = CURLAUTH_DIGEST ;
else if ( avail & CURLAUTH_NTLM ) pick -> picked = CURLAUTH_NTLM ;
else if ( avail & CURLAUTH_NTLM_WB ) pick -> picked = CURLAUTH_NTLM_WB ;
else if ( avail & CURLAUTH_BASIC ) pick -> picked = CURLAUTH_BASIC ;
else {
pick -> picked = CURLAUTH_PICKNONE ;
picked = FALSE ;
}
pick -> avail = CURLAUTH_NONE ;
return picked ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int vp9_get_qindex ( const struct segmentation * seg , int segment_id , int base_qindex ) {
if ( vp9_segfeature_active ( seg , segment_id , SEG_LVL_ALT_Q ) ) {
const int data = vp9_get_segdata ( seg , segment_id , SEG_LVL_ALT_Q ) ;
const int seg_qindex = seg -> abs_delta == SEGMENT_ABSDATA ? data : base_qindex + data ;
return clamp ( seg_qindex , 0 , MAXQ ) ;
}
else {
return base_qindex ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | mbfl_string * mbfl_buffer_converter_feed_result ( mbfl_buffer_converter * convd , mbfl_string * string , mbfl_string * result ) {
if ( convd == NULL || string == NULL || result == NULL ) {
return NULL ;
}
mbfl_buffer_converter_feed ( convd , string ) ;
if ( convd -> filter1 != NULL ) {
mbfl_convert_filter_flush ( convd -> filter1 ) ;
}
if ( convd -> filter2 != NULL ) {
mbfl_convert_filter_flush ( convd -> filter2 ) ;
}
result -> no_encoding = convd -> to -> no_encoding ;
return mbfl_memory_device_result ( & convd -> device , result ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static spl_filesystem_object * spl_filesystem_object_create_type ( int ht , spl_filesystem_object * source , int type , zend_class_entry * ce , zval * return_value TSRMLS_DC ) {
spl_filesystem_object * intern ;
zend_bool use_include_path = 0 ;
zval * arg1 , * arg2 ;
zend_error_handling error_handling ;
zend_replace_error_handling ( EH_THROW , spl_ce_RuntimeException , & error_handling TSRMLS_CC ) ;
switch ( source -> type ) {
case SPL_FS_INFO : case SPL_FS_FILE : break ;
case SPL_FS_DIR : if ( ! source -> u . dir . entry . d_name [ 0 ] ) {
zend_throw_exception_ex ( spl_ce_RuntimeException , 0 TSRMLS_CC , "Could not open file" ) ;
zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
return NULL ;
}
}
switch ( type ) {
case SPL_FS_INFO : ce = ce ? ce : source -> info_class ;
zend_update_class_constants ( ce TSRMLS_CC ) ;
return_value -> value . obj = spl_filesystem_object_new_ex ( ce , & intern TSRMLS_CC ) ;
Z_TYPE_P ( return_value ) = IS_OBJECT ;
spl_filesystem_object_get_file_name ( source TSRMLS_CC ) ;
if ( ce -> constructor -> common . scope != spl_ce_SplFileInfo ) {
MAKE_STD_ZVAL ( arg1 ) ;
ZVAL_STRINGL ( arg1 , source -> file_name , source -> file_name_len , 1 ) ;
zend_call_method_with_1_params ( & return_value , ce , & ce -> constructor , "__construct" , NULL , arg1 ) ;
zval_ptr_dtor ( & arg1 ) ;
}
else {
intern -> file_name = estrndup ( source -> file_name , source -> file_name_len ) ;
intern -> file_name_len = source -> file_name_len ;
intern -> _path = spl_filesystem_object_get_path ( source , & intern -> _path_len TSRMLS_CC ) ;
intern -> _path = estrndup ( intern -> _path , intern -> _path_len ) ;
}
break ;
case SPL_FS_FILE : ce = ce ? ce : source -> file_class ;
zend_update_class_constants ( ce TSRMLS_CC ) ;
return_value -> value . obj = spl_filesystem_object_new_ex ( ce , & intern TSRMLS_CC ) ;
Z_TYPE_P ( return_value ) = IS_OBJECT ;
spl_filesystem_object_get_file_name ( source TSRMLS_CC ) ;
if ( ce -> constructor -> common . scope != spl_ce_SplFileObject ) {
MAKE_STD_ZVAL ( arg1 ) ;
MAKE_STD_ZVAL ( arg2 ) ;
ZVAL_STRINGL ( arg1 , source -> file_name , source -> file_name_len , 1 ) ;
ZVAL_STRINGL ( arg2 , "r" , 1 , 1 ) ;
zend_call_method_with_2_params ( & return_value , ce , & ce -> constructor , "__construct" , NULL , arg1 , arg2 ) ;
zval_ptr_dtor ( & arg1 ) ;
zval_ptr_dtor ( & arg2 ) ;
}
else {
intern -> file_name = source -> file_name ;
intern -> file_name_len = source -> file_name_len ;
intern -> _path = spl_filesystem_object_get_path ( source , & intern -> _path_len TSRMLS_CC ) ;
intern -> _path = estrndup ( intern -> _path , intern -> _path_len ) ;
intern -> u . file . open_mode = "r" ;
intern -> u . file . open_mode_len = 1 ;
if ( ht && zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "|sbr" , & intern -> u . file . open_mode , & intern -> u . file . open_mode_len , & use_include_path , & intern -> u . file . zcontext ) == FAILURE ) {
zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
intern -> u . file . open_mode = NULL ;
intern -> file_name = NULL ;
zval_dtor ( return_value ) ;
Z_TYPE_P ( return_value ) = IS_NULL ;
return NULL ;
}
if ( spl_filesystem_file_open ( intern , use_include_path , 0 TSRMLS_CC ) == FAILURE ) {
zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
zval_dtor ( return_value ) ;
Z_TYPE_P ( return_value ) = IS_NULL ;
return NULL ;
}
}
break ;
case SPL_FS_DIR : zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
zend_throw_exception_ex ( spl_ce_RuntimeException , 0 TSRMLS_CC , "Operation not supported" ) ;
return NULL ;
}
zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
return NULL ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void Pass2Encode ( VP9_COMP * cpi , size_t * size , uint8_t * dest , unsigned int * frame_flags ) {
cpi -> allow_encode_breakout = ENCODE_BREAKOUT_ENABLED ;
vp9_rc_get_second_pass_params ( cpi ) ;
encode_frame_to_data_rate ( cpi , size , dest , frame_flags ) ;
vp9_twopass_postencode_update ( cpi ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int dvvideo_close ( AVCodecContext * c ) {
DVVideoContext * s = c -> priv_data ;
if ( s -> picture . data [ 0 ] ) c -> release_buffer ( c , & s -> picture ) ;
return 0 ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | struct qemud_client_stream * remoteFindClientStream ( struct qemud_client * client , virStreamPtr st ) {
struct qemud_client_stream * stream = client -> streams ;
while ( stream ) {
if ( stream -> st == st ) return stream ;
stream = stream -> next ;
}
return NULL ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void init_error_log_mutex ( ) {
mysql_mutex_init ( key_LOCK_error_log , & LOCK_error_log , MY_MUTEX_INIT_FAST ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gint dissect_sep ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , gint offset , guint32 interface_id , guint32 adapter_id , guint32 chandle ) {
proto_tree * sep_tree ;
proto_item * sep_item ;
guint i_sep = 1 ;
guint media_type ;
guint type ;
guint seid ;
guint in_use ;
guint items ;
guint32 direction ;
direction = ( pinfo -> p2p_dir == P2P_DIR_SENT ) ? P2P_DIR_RECV : P2P_DIR_SENT ;
items = tvb_reported_length_remaining ( tvb , offset ) / 2 ;
while ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) {
seid = tvb_get_guint8 ( tvb , offset ) ;
in_use = seid & 0x02 ;
seid = seid >> 2 ;
media_type = tvb_get_guint8 ( tvb , offset + 1 ) >> 4 ;
type = ( tvb_get_guint8 ( tvb , offset + 1 ) & 0x08 ) >> 3 ;
sep_item = proto_tree_add_none_format ( tree , hf_btavdtp_acp_sep , tvb , offset , 2 , "ACP SEP [%u - %s %s] item %u/%u" , seid , val_to_str_const ( media_type , media_type_vals , "unknown" ) , val_to_str_const ( type , sep_type_vals , "unknown" ) , i_sep , items ) ;
sep_tree = proto_item_add_subtree ( sep_item , ett_btavdtp_sep ) ;
proto_tree_add_item ( sep_tree , hf_btavdtp_sep_seid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( sep_tree , hf_btavdtp_sep_inuse , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( sep_tree , hf_btavdtp_sep_rfa0 , tvb , offset , 1 , ENC_NA ) ;
offset += 1 ;
proto_tree_add_item ( sep_tree , hf_btavdtp_sep_media_type , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( sep_tree , hf_btavdtp_sep_type , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( sep_tree , hf_btavdtp_sep_rfa1 , tvb , offset , 1 , ENC_NA ) ;
if ( ! pinfo -> fd -> flags . visited ) {
sep_entry_t * sep_data ;
wmem_tree_key_t key [ 7 ] ;
guint32 frame_number = pinfo -> num ;
key [ 0 ] . length = 1 ;
key [ 0 ] . key = & interface_id ;
key [ 1 ] . length = 1 ;
key [ 1 ] . key = & adapter_id ;
key [ 2 ] . length = 1 ;
key [ 2 ] . key = & chandle ;
key [ 3 ] . length = 1 ;
key [ 3 ] . key = & direction ;
key [ 4 ] . length = 1 ;
key [ 4 ] . key = & seid ;
key [ 5 ] . length = 1 ;
key [ 5 ] . key = & frame_number ;
key [ 6 ] . length = 0 ;
key [ 6 ] . key = NULL ;
sep_data = wmem_new ( wmem_file_scope ( ) , sep_entry_t ) ;
sep_data -> seid = seid ;
sep_data -> type = type ;
sep_data -> media_type = media_type ;
sep_data -> int_seid = 0 ;
sep_data -> codec = - 1 ;
sep_data -> content_protection_type = 0 ;
if ( in_use ) {
sep_data -> state = SEP_STATE_IN_USE ;
}
else {
sep_data -> state = SEP_STATE_FREE ;
}
wmem_tree_insert32_array ( sep_list , key , sep_data ) ;
}
offset += 1 ;
i_sep += 1 ;
}
col_append_fstr ( pinfo -> cinfo , COL_INFO , " - items: %u" , items ) ;
return offset ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_pvfs2_mgmt_event_mon_request ( tvbuff_t * tvb , proto_tree * tree , int offset , packet_info * pinfo _U_ ) {
proto_tree_add_item ( tree , hf_pvfs_mgmt_perf_mon_request_event_count , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static guint16 de_tp_ue_test_loop_mode ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len _U_ , gchar * add_string _U_ , int string_len _U_ ) {
guint32 curr_offset ;
guchar oct ;
guint8 lb_setup_length , i , j ;
guint16 value ;
proto_tree * subtree ;
curr_offset = offset ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
proto_tree_add_item ( tree , hf_gsm_a_dtap_ue_test_loop_mode , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
curr_offset += 1 ;
switch ( oct & 0x03 ) {
case 0 : {
lb_setup_length = tvb_get_guint8 ( tvb , curr_offset ) ;
curr_offset += 1 ;
for ( i = 0 , j = 0 ;
( i < lb_setup_length ) && ( j < 4 ) ;
i += 3 , j ++ ) {
subtree = proto_tree_add_subtree_format ( tree , tvb , curr_offset , 3 , ett_ue_test_loop_mode , NULL , "LB setup RB IE: %d" , j + 1 ) ;
value = tvb_get_ntohs ( tvb , curr_offset ) ;
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_uplink_rlc_sdu_size , tvb , curr_offset , 2 , value , "%d bits" , value ) ;
curr_offset += 2 ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_radio_bearer , tvb , curr_offset , 1 , ENC_NA ) ;
curr_offset += 1 ;
}
break ;
}
case 2 : oct = tvb_get_guint8 ( tvb , curr_offset ) ;
curr_offset += 1 ;
proto_tree_add_uint ( tree , hf_gsm_a_dtap_mbms_short_transmission_identity , tvb , curr_offset , 1 , ( oct & 0x1f ) + 1 ) ;
break ;
}
return ( curr_offset - offset ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int put_info ( const char * str , INFO_TYPE info_type , uint error , const char * sqlstate ) {
FILE * file = ( info_type == INFO_ERROR ? stderr : stdout ) ;
static int inited = 0 ;
if ( status . batch ) {
if ( info_type == INFO_ERROR ) {
( void ) fflush ( file ) ;
fprintf ( file , "ERROR" ) ;
if ( error ) {
if ( sqlstate ) ( void ) fprintf ( file , " %d (%s)" , error , sqlstate ) ;
else ( void ) fprintf ( file , " %d" , error ) ;
}
if ( status . query_start_line && line_numbers ) {
( void ) fprintf ( file , " at line %lu" , status . query_start_line ) ;
if ( status . file_name ) ( void ) fprintf ( file , " in file: '%s'" , status . file_name ) ;
}
( void ) fprintf ( file , ": %s\n" , str ) ;
( void ) fflush ( file ) ;
if ( ! ignore_errors ) return 1 ;
}
else if ( info_type == INFO_RESULT && verbose > 1 ) tee_puts ( str , file ) ;
if ( unbuffered ) fflush ( file ) ;
return info_type == INFO_ERROR ? - 1 : 0 ;
}
if ( ! opt_silent || info_type == INFO_ERROR ) {
if ( ! inited ) {
# ifdef HAVE_SETUPTERM int errret ;
have_curses = setupterm ( ( char * ) 0 , 1 , & errret ) != ERR ;
# endif inited = 1 ;
}
if ( info_type == INFO_ERROR ) {
if ( ! opt_nobeep ) {
# ifdef _WIN32 MessageBeep ( MB_ICONWARNING ) ;
# else putchar ( '\a' ) ;
# endif }
my_vidattr ( A_STANDOUT ) ;
if ( error ) {
if ( sqlstate ) ( void ) tee_fprintf ( file , "ERROR %d (%s)" , error , sqlstate ) ;
else ( void ) tee_fprintf ( file , "ERROR %d" , error ) ;
}
else tee_fputs ( "ERROR" , file ) ;
if ( status . query_start_line && line_numbers ) {
( void ) fprintf ( file , " at line %lu" , status . query_start_line ) ;
if ( status . file_name ) ( void ) fprintf ( file , " in file: '%s'" , status . file_name ) ;
}
tee_fputs ( ": " , file ) ;
}
else my_vidattr ( A_BOLD ) ;
( void ) tee_puts ( str , file ) ;
my_vidattr ( A_NORMAL ) ;
}
if ( unbuffered ) fflush ( file ) ;
return info_type == INFO_ERROR ? ( ignore_errors ? - 1 : 1 ) : 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_pbb_tlvblock ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , guint offset , guint maxoffset , gint8 addrCount , guint tlvCat ) {
guint16 tlvblockLength ;
guint tlvblockEnd ;
proto_tree * tlvblock_tree = NULL ;
proto_tree * tlv_tree = NULL ;
proto_tree * tlv_flags_tree = NULL ;
proto_tree * tlvValue_tree = NULL ;
proto_item * tlvBlock_item = NULL ;
proto_item * tlv_item = NULL ;
proto_item * tlvFlags_item = NULL ;
proto_item * tlvValue_item = NULL ;
proto_item * ti = NULL ;
int tlvCount = 0 ;
int hf_packetbb_tlv_type = 0 ;
const value_string * tlv_type_vals = NULL ;
if ( maxoffset < offset + 2 ) {
proto_tree_add_expert_format ( tree , pinfo , & ei_packetbb_error , tvb , offset , maxoffset - offset , "Not enough octets for minimal tlvblock" ) ;
return maxoffset ;
}
tlvblockLength = tvb_get_ntohs ( tvb , offset ) ;
tlvblockEnd = offset + 2 + tlvblockLength ;
if ( maxoffset < tlvblockEnd ) {
proto_tree_add_expert_format ( tree , pinfo , & ei_packetbb_error , tvb , offset , maxoffset - offset , "Not enough octets for tlvblock" ) ;
return maxoffset ;
}
tlvBlock_item = proto_tree_add_item ( tree , hf_packetbb_tlvblock , tvb , offset , tlvblockEnd - offset , ENC_NA ) ;
tlvblock_tree = proto_item_add_subtree ( tlvBlock_item , ett_packetbb_tlvblock ) ;
proto_tree_add_item ( tlvblock_tree , hf_packetbb_tlvblock_length , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset += 2 ;
while ( offset < tlvblockEnd ) {
guint tlvStart , tlvLength ;
guint8 tlvType , tlvFlags , tlvExtType , indexStart , indexEnd ;
guint16 length = 0 ;
tlvStart = offset ;
tlvType = tvb_get_guint8 ( tvb , offset ++ ) ;
tlvFlags = tvb_get_guint8 ( tvb , offset ++ ) ;
indexStart = 0 ;
indexEnd = addrCount ? ( addrCount - 1 ) : 0 ;
tlvExtType = 0 ;
if ( ( tlvFlags & TLV_HAS_TYPEEXT ) != 0 ) {
tlvExtType = tvb_get_guint8 ( tvb , offset ++ ) ;
}
if ( ( tlvFlags & TLV_HAS_SINGLEINDEX ) != 0 ) {
indexStart = indexEnd = tvb_get_guint8 ( tvb , offset ++ ) ;
}
else if ( ( tlvFlags & TLV_HAS_MULTIINDEX ) != 0 ) {
indexStart = tvb_get_guint8 ( tvb , offset ++ ) ;
indexEnd = tvb_get_guint8 ( tvb , offset ++ ) ;
}
if ( ( tlvFlags & TLV_HAS_VALUE ) != 0 ) {
if ( ( tlvFlags & TLV_HAS_EXTLEN ) != 0 ) {
length = tvb_get_ntohs ( tvb , offset ++ ) ;
}
else {
length = tvb_get_guint8 ( tvb , offset ++ ) ;
}
}
tlvLength = offset - tlvStart + length ;
offset = tlvStart ;
tlv_item = proto_tree_add_item ( tlvBlock_item , hf_packetbb_tlv , tvb , tlvStart , tlvLength , ENC_NA ) ;
tlv_tree = proto_item_add_subtree ( tlv_item , ett_packetbb_tlv [ tlvType ] ) ;
if ( tlvCat == TLV_CAT_PACKET ) {
hf_packetbb_tlv_type = hf_packetbb_pkttlv_type ;
tlv_type_vals = pkttlv_type_vals ;
}
else if ( tlvCat == TLV_CAT_MESSAGE ) {
hf_packetbb_tlv_type = hf_packetbb_msgtlv_type ;
tlv_type_vals = msgtlv_type_vals ;
}
else {
hf_packetbb_tlv_type = hf_packetbb_addrtlv_type ;
tlv_type_vals = addrtlv_type_vals ;
}
if ( ( tlvFlags & TLV_HAS_TYPEEXT ) == 0 ) {
proto_item_append_text ( tlv_item , " (%s)" , val_to_str_const ( tlvType , tlv_type_vals , "Unknown type" ) ) ;
}
else {
proto_item_append_text ( tlv_item , " (%s / %d)" , val_to_str_const ( tlvType , tlv_type_vals , "Unknown type" ) , tlvExtType ) ;
}
proto_tree_add_item ( tlv_tree , hf_packetbb_tlv_type , tvb , offset ++ , 1 , ENC_BIG_ENDIAN ) ;
tlvFlags_item = proto_tree_add_item ( tlv_tree , hf_packetbb_tlv_flags , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
tlv_flags_tree = proto_item_add_subtree ( tlvFlags_item , ett_packetbb_tlv_flags ) ;
proto_tree_add_item ( tlv_flags_tree , hf_packetbb_tlv_flags_hastypext , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tlv_flags_tree , hf_packetbb_tlv_flags_hassingleindex , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tlv_flags_tree , hf_packetbb_tlv_flags_hasmultiindex , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tlv_flags_tree , hf_packetbb_tlv_flags_hasvalue , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tlv_flags_tree , hf_packetbb_tlv_flags_hasextlen , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tlv_flags_tree , hf_packetbb_tlv_flags_hasmultivalue , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
if ( ( tlvFlags & TLV_HAS_TYPEEXT ) != 0 ) {
proto_tree_add_item ( tlv_tree , hf_packetbb_tlv_typeext , tvb , offset ++ , 1 , ENC_BIG_ENDIAN ) ;
}
if ( addrCount > 0 ) {
if ( ( tlvFlags & TLV_HAS_SINGLEINDEX ) != 0 ) {
proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_indexstart , tvb , offset ++ , 1 , indexStart ) ;
ti = proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_indexend , tvb , offset , 0 , indexEnd ) ;
proto_item_append_text ( ti , " (implicit)" ) ;
}
else if ( ( tlvFlags & TLV_HAS_MULTIINDEX ) != 0 ) {
proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_indexstart , tvb , offset ++ , 1 , indexStart ) ;
proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_indexend , tvb , offset ++ , 1 , indexEnd ) ;
}
else {
ti = proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_indexstart , tvb , offset , 0 , indexStart ) ;
proto_item_append_text ( ti , " (implicit)" ) ;
ti = proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_indexend , tvb , offset , 0 , indexEnd ) ;
proto_item_append_text ( ti , " (implicit)" ) ;
}
}
if ( ( tlvFlags & TLV_HAS_VALUE ) != 0 ) {
if ( ( tlvFlags & TLV_HAS_EXTLEN ) != 0 ) {
proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_length , tvb , offset , 2 , length ) ;
offset += 2 ;
}
else {
proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_length , tvb , offset ++ , 1 , length ) ;
}
}
else {
ti = proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_length , tvb , offset , 0 , 0 ) ;
proto_item_append_text ( ti , " (implicit)" ) ;
}
if ( length > 0 ) {
tlvValue_item = proto_tree_add_item ( tlv_tree , hf_packetbb_tlv_value , tvb , offset , length , ENC_NA ) ;
if ( ( tlvFlags & TLV_HAS_MULTIVALUE ) == 0 ) {
offset += length ;
}
else {
int i ;
guint c = indexEnd - indexStart + 1 ;
if ( c > 0 ) {
tlvValue_tree = proto_item_add_subtree ( tlvValue_item , ett_packetbb_tlv_value ) ;
for ( i = indexStart ;
i <= indexEnd ;
i ++ ) {
proto_tree_add_item ( tlvValue_tree , hf_packetbb_tlv_multivalue , tvb , offset , length / c , ENC_NA ) ;
offset += ( length / c ) ;
}
}
}
}
tlvCount ++ ;
}
proto_item_append_text ( tlvBlock_item , " (%d TLVs)" , tlvCount ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int main_secondary_decompress_check ( main_file * file , uint8_t * input_buf , size_t input_size , size_t * nread ) {
int ret ;
usize_t i ;
usize_t try_read = min ( input_size , XD3_ALLOCSIZE ) ;
size_t check_nread = 0 ;
uint8_t check_buf [ XD3_ALLOCSIZE ] ;
const main_extcomp * decompressor = NULL ;
if ( ( ret = main_file_read ( file , check_buf , try_read , & check_nread , "input read failed" ) ) ) {
return ret ;
}
if ( file -> flags & RD_DECOMPSET ) {
decompressor = file -> compressor ;
}
else {
for ( i = 0 ;
i < SIZEOF_ARRAY ( extcomp_types ) ;
i += 1 ) {
const main_extcomp * decomp = & extcomp_types [ i ] ;
if ( check_nread > decomp -> magic_size ) {
int skip_this_type = ( decomp -> flags & RD_NONEXTERNAL ) && ( file -> flags & RD_NONEXTERNAL ) ;
if ( skip_this_type ) {
continue ;
}
if ( memcmp ( check_buf , decomp -> magic , decomp -> magic_size ) == 0 ) {
decompressor = decomp ;
break ;
}
}
}
}
if ( decompressor != NULL ) {
if ( ! option_quiet ) {
XPR ( NT "externally compressed input: %s %s%s < %s\n" , decompressor -> decomp_cmdname , decompressor -> decomp_options , ( option_force2 ? " -f" : "" ) , file -> filename ) ;
if ( file -> flags & RD_MAININPUT ) {
XPR ( NT "WARNING: the encoder is automatically decompressing the input file;
\n" ) ;
XPR ( NT "WARNING: the decoder will automatically recompress the output file;
\n" ) ;
XPR ( NT "WARNING: this may result in different compressed data and checksums\n" ) ;
XPR ( NT "WARNING: despite being identical data;
if this is an issue, use -D\n" ) ;
XPR ( NT "WARNING: to avoid decompression and/or use -R to avoid recompression\n" ) ;
XPR ( NT "WARNING: and/or manually decompress the input file;
if you know the\n" ) ;
XPR ( NT "WARNING: compression settings that will produce identical output\n" ) ;
XPR ( NT "WARNING: you may set those flags using the environment (e.g., GZIP=-9)\n" ) ;
}
}
file -> size_known = 0 ;
return main_input_decompress_setup ( decompressor , file , input_buf , input_size , check_buf , XD3_ALLOCSIZE , check_nread , nread ) ;
}
( * nread ) = 0 ;
if ( check_nread == try_read ) {
ret = main_file_read ( file , input_buf + try_read , input_size - try_read , nread , "input read failed" ) ;
}
memcpy ( input_buf , check_buf , check_nread ) ;
( * nread ) += check_nread ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int parse_CAggregSpec ( tvbuff_t * tvb , int offset , proto_tree * parent_tree , proto_tree * pad_tree , const char * fmt , ... ) {
proto_item * item ;
proto_tree * tree ;
va_list ap ;
guint8 type ;
guint32 ccAlias , idColumn ;
const char * txt ;
va_start ( ap , fmt ) ;
txt = wmem_strdup_vprintf ( wmem_packet_scope ( ) , fmt , ap ) ;
va_end ( ap ) ;
tree = proto_tree_add_subtree ( parent_tree , tvb , offset , 0 , ett_CAggregSpec , & item , txt ) ;
type = tvb_get_guint8 ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_mswsp_caggregspec_type , tvb , offset , 1 , type ) ;
proto_item_append_text ( item , "type: %u" , type ) ;
offset += 1 ;
offset = parse_padding ( tvb , offset , 4 , pad_tree , "padding" ) ;
ccAlias = tvb_get_letohl ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_mswsp_caggregspec_ccalias , tvb , offset , 1 , ccAlias ) ;
offset += 4 ;
proto_tree_add_item ( tree , hf_mswsp_caggregspec_alias , tvb , offset , 2 * ccAlias , ENC_LITTLE_ENDIAN | ENC_UCS_2 ) ;
offset += 2 * ccAlias ;
idColumn = tvb_get_letohl ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_mswsp_caggregspec_idcolumn , tvb , offset , 1 , idColumn ) ;
offset += 4 ;
proto_item_set_end ( item , tvb , offset ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void lsp2lpc ( int16_t * lpc ) {
int f1 [ LPC_ORDER / 2 + 1 ] ;
int f2 [ LPC_ORDER / 2 + 1 ] ;
int i , j ;
for ( j = 0 ;
j < LPC_ORDER ;
j ++ ) {
int index = lpc [ j ] >> 7 ;
int offset = lpc [ j ] & 0x7f ;
int temp1 = cos_tab [ index ] << 16 ;
int temp2 = ( cos_tab [ index + 1 ] - cos_tab [ index ] ) * ( ( offset << 8 ) + 0x80 ) << 1 ;
lpc [ j ] = - ( av_sat_dadd32 ( 1 << 15 , temp1 + temp2 ) >> 16 ) ;
}
f1 [ 0 ] = 1 << 28 ;
f1 [ 1 ] = ( lpc [ 0 ] << 14 ) + ( lpc [ 2 ] << 14 ) ;
f1 [ 2 ] = lpc [ 0 ] * lpc [ 2 ] + ( 2 << 28 ) ;
f2 [ 0 ] = 1 << 28 ;
f2 [ 1 ] = ( lpc [ 1 ] << 14 ) + ( lpc [ 3 ] << 14 ) ;
f2 [ 2 ] = lpc [ 1 ] * lpc [ 3 ] + ( 2 << 28 ) ;
for ( i = 2 ;
i < LPC_ORDER / 2 ;
i ++ ) {
f1 [ i + 1 ] = f1 [ i - 1 ] + MULL2 ( f1 [ i ] , lpc [ 2 * i ] ) ;
f2 [ i + 1 ] = f2 [ i - 1 ] + MULL2 ( f2 [ i ] , lpc [ 2 * i + 1 ] ) ;
for ( j = i ;
j >= 2 ;
j -- ) {
f1 [ j ] = MULL2 ( f1 [ j - 1 ] , lpc [ 2 * i ] ) + ( f1 [ j ] >> 1 ) + ( f1 [ j - 2 ] >> 1 ) ;
f2 [ j ] = MULL2 ( f2 [ j - 1 ] , lpc [ 2 * i + 1 ] ) + ( f2 [ j ] >> 1 ) + ( f2 [ j - 2 ] >> 1 ) ;
}
f1 [ 0 ] >>= 1 ;
f2 [ 0 ] >>= 1 ;
f1 [ 1 ] = ( ( lpc [ 2 * i ] << 16 >> i ) + f1 [ 1 ] ) >> 1 ;
f2 [ 1 ] = ( ( lpc [ 2 * i + 1 ] << 16 >> i ) + f2 [ 1 ] ) >> 1 ;
}
for ( i = 0 ;
i < LPC_ORDER / 2 ;
i ++ ) {
int64_t ff1 = f1 [ i + 1 ] + f1 [ i ] ;
int64_t ff2 = f2 [ i + 1 ] - f2 [ i ] ;
lpc [ i ] = av_clipl_int32 ( ( ( ff1 + ff2 ) << 3 ) + ( 1 << 15 ) ) >> 16 ;
lpc [ LPC_ORDER - i - 1 ] = av_clipl_int32 ( ( ( ff1 - ff2 ) << 3 ) + ( 1 << 15 ) ) >> 16 ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | extern int name ( int , locale_t ) __THROW __exctype_l ( isalnum_l ) ;
__exctype_l ( isalpha_l ) ;
__exctype_l ( iscntrl_l ) ;
__exctype_l ( isdigit_l ) ;
__exctype_l ( islower_l ) ;
__exctype_l ( isgraph_l ) ;
__exctype_l ( isprint_l ) ;
__exctype_l ( ispunct_l ) ;
__exctype_l ( isspace_l ) ;
__exctype_l ( isupper_l ) | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static bool misc_enable_needed ( void * opaque ) {
X86CPU * cpu = opaque ;
CPUX86State * env = & cpu -> env ;
return env -> msr_ia32_misc_enable != MSR_IA32_MISC_ENABLE_DEFAULT ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void calcrdslopes ( jpc_enc_cblk_t * cblk ) {
jpc_enc_pass_t * endpasses ;
jpc_enc_pass_t * pass0 ;
jpc_enc_pass_t * pass1 ;
jpc_enc_pass_t * pass2 ;
jpc_flt_t slope0 ;
jpc_flt_t slope ;
jpc_flt_t dd ;
long dr ;
endpasses = & cblk -> passes [ cblk -> numpasses ] ;
pass2 = cblk -> passes ;
slope0 = 0 ;
while ( pass2 != endpasses ) {
pass0 = 0 ;
for ( pass1 = cblk -> passes ;
pass1 != endpasses ;
++ pass1 ) {
dd = pass1 -> cumwmsedec ;
dr = pass1 -> end ;
if ( pass0 ) {
dd -= pass0 -> cumwmsedec ;
dr -= pass0 -> end ;
}
if ( dd <= 0 ) {
pass1 -> rdslope = JPC_BADRDSLOPE ;
if ( pass1 >= pass2 ) {
pass2 = & pass1 [ 1 ] ;
}
continue ;
}
if ( pass1 < pass2 && pass1 -> rdslope <= 0 ) {
continue ;
}
if ( ! dr ) {
assert ( pass0 ) ;
pass0 -> rdslope = 0 ;
break ;
}
slope = dd / dr ;
if ( pass0 && slope >= slope0 ) {
pass0 -> rdslope = 0 ;
break ;
}
pass1 -> rdslope = slope ;
if ( pass1 >= pass2 ) {
pass2 = & pass1 [ 1 ] ;
}
pass0 = pass1 ;
slope0 = slope ;
}
}
# if 0 for ( pass0 = cblk -> passes ;
pass0 != endpasses ;
++ pass0 ) {
if ( pass0 -> rdslope > 0.0 ) {
jas_eprintf ( "pass %02d nmsedec=%lf dec=%lf end=%d %lf\n" , pass0 - cblk -> passes , fixtodbl ( pass0 -> nmsedec ) , pass0 -> wmsedec , pass0 -> end , pass0 -> rdslope ) ;
}
}
# endif } | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static ulmbcs_byte_t FindLMBCSUniRange ( UChar uniChar ) {
const struct _UniLMBCSGrpMap * pTable = UniLMBCSGrpMap ;
while ( uniChar > pTable -> uniEndRange ) {
pTable ++ ;
}
if ( uniChar >= pTable -> uniStartRange ) {
return pTable -> GrpType ;
}
return ULMBCS_GRP_UNICODE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int com_nowarnings ( String * buffer __attribute__ ( ( unused ) ) , char * line __attribute__ ( ( unused ) ) ) {
show_warnings = 0 ;
put_info ( "Show warnings disabled." , INFO_INFO ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int quit ( ) {
kadm5_ret_t retval ;
if ( locked ) {
retval = kadm5_unlock ( handle ) ;
if ( retval ) {
com_err ( "quit" , retval , _ ( "while unlocking locked database" ) ) ;
return 1 ;
}
locked = 0 ;
}
kadm5_destroy ( handle ) ;
if ( ccache_name != NULL ) {
fprintf ( stderr , "\n\a\a\a%s" , _ ( "Administration credentials NOT DESTROYED.\n" ) ) ;
}
krb5_klog_close ( context ) ;
krb5_free_context ( context ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void i_defer_frees ( gs_memory_t * mem , int defer ) {
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static ssize_t usbdev_read ( struct file * file , char __user * buf , size_t nbytes , loff_t * ppos ) {
struct usb_dev_state * ps = file -> private_data ;
struct usb_device * dev = ps -> dev ;
ssize_t ret = 0 ;
unsigned len ;
loff_t pos ;
int i ;
pos = * ppos ;
usb_lock_device ( dev ) ;
if ( ! connected ( ps ) ) {
ret = - ENODEV ;
goto err ;
}
else if ( pos < 0 ) {
ret = - EINVAL ;
goto err ;
}
if ( pos < sizeof ( struct usb_device_descriptor ) ) {
struct usb_device_descriptor temp_desc ;
memcpy ( & temp_desc , & dev -> descriptor , sizeof ( dev -> descriptor ) ) ;
le16_to_cpus ( & temp_desc . bcdUSB ) ;
le16_to_cpus ( & temp_desc . idVendor ) ;
le16_to_cpus ( & temp_desc . idProduct ) ;
le16_to_cpus ( & temp_desc . bcdDevice ) ;
len = sizeof ( struct usb_device_descriptor ) - pos ;
if ( len > nbytes ) len = nbytes ;
if ( copy_to_user ( buf , ( ( char * ) & temp_desc ) + pos , len ) ) {
ret = - EFAULT ;
goto err ;
}
* ppos += len ;
buf += len ;
nbytes -= len ;
ret += len ;
}
pos = sizeof ( struct usb_device_descriptor ) ;
for ( i = 0 ;
nbytes && i < dev -> descriptor . bNumConfigurations ;
i ++ ) {
struct usb_config_descriptor * config = ( struct usb_config_descriptor * ) dev -> rawdescriptors [ i ] ;
unsigned int length = le16_to_cpu ( config -> wTotalLength ) ;
if ( * ppos < pos + length ) {
unsigned alloclen = le16_to_cpu ( dev -> config [ i ] . desc . wTotalLength ) ;
len = length - ( * ppos - pos ) ;
if ( len > nbytes ) len = nbytes ;
if ( alloclen > ( * ppos - pos ) ) {
alloclen -= ( * ppos - pos ) ;
if ( copy_to_user ( buf , dev -> rawdescriptors [ i ] + ( * ppos - pos ) , min ( len , alloclen ) ) ) {
ret = - EFAULT ;
goto err ;
}
}
* ppos += len ;
buf += len ;
nbytes -= len ;
ret += len ;
}
pos += length ;
}
err : usb_unlock_device ( dev ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static bool parse_otherName ( chunk_t * blob , int level0 , id_type_t * type ) {
asn1_parser_t * parser ;
chunk_t object ;
int objectID ;
int oid = OID_UNKNOWN ;
bool success = FALSE ;
parser = asn1_parser_create ( otherNameObjects , * blob ) ;
parser -> set_top_level ( parser , level0 ) ;
while ( parser -> iterate ( parser , & objectID , & object ) ) {
switch ( objectID ) {
case ON_OBJ_ID_TYPE : oid = asn1_known_oid ( object ) ;
break ;
case ON_OBJ_VALUE : switch ( oid ) {
case OID_XMPP_ADDR : if ( ! asn1_parse_simple_object ( & object , ASN1_UTF8STRING , parser -> get_level ( parser ) + 1 , "xmppAddr" ) ) {
goto end ;
}
break ;
case OID_USER_PRINCIPAL_NAME : if ( asn1_parse_simple_object ( & object , ASN1_UTF8STRING , parser -> get_level ( parser ) + 1 , "msUPN" ) ) {
* blob = object ;
* type = ID_RFC822_ADDR ;
}
else {
goto end ;
}
break ;
}
break ;
default : break ;
}
}
success = parser -> success ( parser ) ;
end : parser -> destroy ( parser ) ;
return success ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void vga_draw_line8 ( VGACommonState * s1 , uint8_t * d , const uint8_t * s , int width ) {
uint32_t * palette ;
int x ;
palette = s1 -> last_palette ;
width >>= 3 ;
for ( x = 0 ;
x < width ;
x ++ ) {
( ( uint32_t * ) d ) [ 0 ] = palette [ s [ 0 ] ] ;
( ( uint32_t * ) d ) [ 1 ] = palette [ s [ 1 ] ] ;
( ( uint32_t * ) d ) [ 2 ] = palette [ s [ 2 ] ] ;
( ( uint32_t * ) d ) [ 3 ] = palette [ s [ 3 ] ] ;
( ( uint32_t * ) d ) [ 4 ] = palette [ s [ 4 ] ] ;
( ( uint32_t * ) d ) [ 5 ] = palette [ s [ 5 ] ] ;
( ( uint32_t * ) d ) [ 6 ] = palette [ s [ 6 ] ] ;
( ( uint32_t * ) d ) [ 7 ] = palette [ s [ 7 ] ] ;
d += 32 ;
s += 8 ;
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void dissect_zcl_appl_stats_log_queue_rsp ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) {
gint list_len ;
proto_tree_add_item ( tree , hf_zbee_zcl_appl_stats_log_queue_size , tvb , * offset , 1 , ENC_NA ) ;
* offset += 1 ;
list_len = tvb_reported_length_remaining ( tvb , * offset ) ;
if ( list_len > 0 ) {
while ( * offset < ( guint ) list_len ) {
proto_tree_add_item ( tree , hf_zbee_zcl_appl_stats_log_id , tvb , * offset , 4 , ENC_LITTLE_ENDIAN ) ;
* offset += 4 ;
}
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int test_copy_to ( const char * from , const char * to ) {
char buf [ TESTBUFSIZE ] ;
int ret ;
snprintf_func ( buf , TESTBUFSIZE , "cp -f %s %s" , from , to ) ;
if ( ( ret = system ( buf ) ) != 0 ) {
return XD3_INTERNAL ;
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int evdns_resolv_conf_parse ( int flags , const char * const filename ) {
struct stat st ;
int fd , n , r ;
u8 * resolv ;
char * start ;
int err = 0 ;
log ( EVDNS_LOG_DEBUG , "Parsing resolv.conf file %s" , filename ) ;
fd = open ( filename , O_RDONLY ) ;
if ( fd < 0 ) {
evdns_resolv_set_defaults ( flags ) ;
return 1 ;
}
if ( fstat ( fd , & st ) ) {
err = 2 ;
goto out1 ;
}
if ( ! st . st_size ) {
evdns_resolv_set_defaults ( flags ) ;
err = ( flags & DNS_OPTION_NAMESERVERS ) ? 6 : 0 ;
goto out1 ;
}
if ( st . st_size > 65535 ) {
err = 3 ;
goto out1 ;
}
resolv = ( u8 * ) malloc ( ( size_t ) st . st_size + 1 ) ;
if ( ! resolv ) {
err = 4 ;
goto out1 ;
}
n = 0 ;
while ( ( r = read ( fd , resolv + n , ( size_t ) st . st_size - n ) ) > 0 ) {
n += r ;
if ( n == st . st_size ) break ;
assert ( n < st . st_size ) ;
}
if ( r < 0 ) {
err = 5 ;
goto out2 ;
}
resolv [ n ] = 0 ;
start = ( char * ) resolv ;
for ( ;
;
) {
char * const newline = strchr ( start , '\n' ) ;
if ( ! newline ) {
resolv_conf_parse_line ( start , flags ) ;
break ;
}
else {
* newline = 0 ;
resolv_conf_parse_line ( start , flags ) ;
start = newline + 1 ;
}
}
if ( ! server_head && ( flags & DNS_OPTION_NAMESERVERS ) ) {
evdns_nameserver_ip_add ( "127.0.0.1" ) ;
err = 6 ;
}
if ( flags & DNS_OPTION_SEARCH && ( ! global_search_state || global_search_state -> num_domains == 0 ) ) {
search_set_from_hostname ( ) ;
}
out2 : free ( resolv ) ;
out1 : close ( fd ) ;
return err ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
H264Context * h = avctx -> priv_data ;
AVFrame * pict = data ;
int buf_index = 0 ;
Picture * out ;
int i , out_idx ;
int ret ;
h -> flags = avctx -> flags ;
if ( buf_size == 0 ) {
out : h -> cur_pic_ptr = NULL ;
h -> first_field = 0 ;
out = h -> delayed_pic [ 0 ] ;
out_idx = 0 ;
for ( i = 1 ;
h -> delayed_pic [ i ] && ! h -> delayed_pic [ i ] -> f . key_frame && ! h -> delayed_pic [ i ] -> mmco_reset ;
i ++ ) if ( h -> delayed_pic [ i ] -> poc < out -> poc ) {
out = h -> delayed_pic [ i ] ;
out_idx = i ;
}
for ( i = out_idx ;
h -> delayed_pic [ i ] ;
i ++ ) h -> delayed_pic [ i ] = h -> delayed_pic [ i + 1 ] ;
if ( out ) {
out -> reference &= ~ DELAYED_PIC_REF ;
ret = output_frame ( h , pict , out ) ;
if ( ret < 0 ) return ret ;
* got_frame = 1 ;
}
return buf_index ;
}
if ( h -> is_avc && buf_size >= 9 && buf [ 0 ] == 1 && buf [ 2 ] == 0 && ( buf [ 4 ] & 0xFC ) == 0xFC && ( buf [ 5 ] & 0x1F ) && buf [ 8 ] == 0x67 ) {
int cnt = buf [ 5 ] & 0x1f ;
const uint8_t * p = buf + 6 ;
while ( cnt -- ) {
int nalsize = AV_RB16 ( p ) + 2 ;
if ( nalsize > buf_size - ( p - buf ) || p [ 2 ] != 0x67 ) goto not_extra ;
p += nalsize ;
}
cnt = * ( p ++ ) ;
if ( ! cnt ) goto not_extra ;
while ( cnt -- ) {
int nalsize = AV_RB16 ( p ) + 2 ;
if ( nalsize > buf_size - ( p - buf ) || p [ 2 ] != 0x68 ) goto not_extra ;
p += nalsize ;
}
return ff_h264_decode_extradata ( h , buf , buf_size ) ;
}
not_extra : buf_index = decode_nal_units ( h , buf , buf_size , 0 ) ;
if ( buf_index < 0 ) return AVERROR_INVALIDDATA ;
if ( ! h -> cur_pic_ptr && h -> nal_unit_type == NAL_END_SEQUENCE ) {
av_assert0 ( buf_index <= buf_size ) ;
goto out ;
}
if ( ! ( avctx -> flags2 & CODEC_FLAG2_CHUNKS ) && ! h -> cur_pic_ptr ) {
if ( avctx -> skip_frame >= AVDISCARD_NONREF || buf_size >= 4 && ! memcmp ( "Q264" , buf , 4 ) ) return buf_size ;
av_log ( avctx , AV_LOG_ERROR , "no frame!\n" ) ;
return AVERROR_INVALIDDATA ;
}
if ( ! ( avctx -> flags2 & CODEC_FLAG2_CHUNKS ) || ( h -> mb_y >= h -> mb_height && h -> mb_height ) ) {
if ( avctx -> flags2 & CODEC_FLAG2_CHUNKS ) decode_postinit ( h , 1 ) ;
field_end ( h , 0 ) ;
* got_frame = 0 ;
if ( h -> next_output_pic && ( h -> next_output_pic -> recovered ) ) {
if ( ! h -> next_output_pic -> recovered ) h -> next_output_pic -> f . flags |= AV_FRAME_FLAG_CORRUPT ;
ret = output_frame ( h , pict , h -> next_output_pic ) ;
if ( ret < 0 ) return ret ;
* got_frame = 1 ;
if ( CONFIG_MPEGVIDEO ) {
ff_print_debug_info2 ( h -> avctx , h -> next_output_pic , pict , h -> er . mbskip_table , & h -> low_delay , h -> mb_width , h -> mb_height , h -> mb_stride , 1 ) ;
}
}
}
assert ( pict -> buf [ 0 ] || ! * got_frame ) ;
return get_consumed_bytes ( buf_index , buf_size ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int nntp_date ( struct NntpServer * nserv , time_t * now ) {
if ( nserv -> hasDATE ) {
struct NntpData nntp_data ;
char buf [ LONG_STRING ] ;
struct tm tm ;
memset ( & tm , 0 , sizeof ( tm ) ) ;
nntp_data . nserv = nserv ;
nntp_data . group = NULL ;
mutt_str_strfcpy ( buf , "DATE\r\n" , sizeof ( buf ) ) ;
if ( nntp_query ( & nntp_data , buf , sizeof ( buf ) ) < 0 ) return - 1 ;
if ( sscanf ( buf , "111 %4d%2d%2d%2d%2d%2d%*s" , & tm . tm_year , & tm . tm_mon , & tm . tm_mday , & tm . tm_hour , & tm . tm_min , & tm . tm_sec ) == 6 ) {
tm . tm_year -= 1900 ;
tm . tm_mon -- ;
* now = timegm ( & tm ) ;
if ( * now >= 0 ) {
mutt_debug ( 1 , "server time is %lu\n" , * now ) ;
return 0 ;
}
}
}
time ( now ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_MultiplePayloadStreamCapability ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_MultiplePayloadStreamCapability , MultiplePayloadStreamCapability_sequence ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gpgme_error_t gpgsm_delete ( void * engine , gpgme_key_t key , int allow_secret ) {
engine_gpgsm_t gpgsm = engine ;
gpgme_error_t err ;
char * fpr = key -> subkeys ? key -> subkeys -> fpr : NULL ;
char * linep = fpr ;
char * line ;
int length = 8 ;
if ( ! fpr ) return gpg_error ( GPG_ERR_INV_VALUE ) ;
while ( * linep ) {
length ++ ;
if ( * linep == '%' || * linep == ' ' || * linep == '+' ) length += 2 ;
linep ++ ;
}
length ++ ;
line = malloc ( length ) ;
if ( ! line ) return gpg_error_from_syserror ( ) ;
strcpy ( line , "DELKEYS " ) ;
linep = & line [ 8 ] ;
while ( * fpr ) {
switch ( * fpr ) {
case '%' : * ( linep ++ ) = '%' ;
* ( linep ++ ) = '2' ;
* ( linep ++ ) = '5' ;
break ;
case ' ' : * ( linep ++ ) = '%' ;
* ( linep ++ ) = '2' ;
* ( linep ++ ) = '0' ;
break ;
case '+' : * ( linep ++ ) = '%' ;
* ( linep ++ ) = '2' ;
* ( linep ++ ) = 'B' ;
break ;
default : * ( linep ++ ) = * fpr ;
break ;
}
fpr ++ ;
}
* linep = '\0' ;
gpgsm_clear_fd ( gpgsm , OUTPUT_FD ) ;
gpgsm_clear_fd ( gpgsm , INPUT_FD ) ;
gpgsm_clear_fd ( gpgsm , MESSAGE_FD ) ;
gpgsm -> inline_data = NULL ;
err = start ( gpgsm , line ) ;
free ( line ) ;
return err ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int gdev_x_close ( gx_device_X * xdev ) {
if ( xdev -> ghostview ) gdev_x_send_event ( xdev , xdev -> DONE ) ;
if ( xdev -> vinfo ) {
XFree ( ( char * ) xdev -> vinfo ) ;
xdev -> vinfo = NULL ;
}
gdev_x_free_colors ( xdev ) ;
if ( xdev -> cmap != DefaultColormapOfScreen ( xdev -> scr ) ) XFreeColormap ( xdev -> dpy , xdev -> cmap ) ;
if ( xdev -> gc ) XFreeGC ( xdev -> dpy , xdev -> gc ) ;
XCloseDisplay ( xdev -> dpy ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void kvm_put_apicbase ( X86CPU * cpu , uint64_t value ) {
int ret ;
ret = kvm_put_one_msr ( cpu , MSR_IA32_APICBASE , value ) ;
assert ( ret == 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( TemplateURLParserTest , TestPostSuggestion ) {
ParamFilterImpl filter ( std : : string ( ) , "Mozilla" ) ;
ASSERT_NO_FATAL_FAILURE ( ParseFile ( "post_suggestion.xml" , & filter ) ) ;
ASSERT_TRUE ( template_url_ ) ;
EXPECT_EQ ( ASCIIToUTF16 ( "Yahoo" ) , template_url_ -> short_name ( ) ) ;
EXPECT_TRUE ( template_url_ -> url_ref ( ) . SupportsReplacement ( SearchTermsData ( ) ) ) ;
EXPECT_TRUE ( template_url_ -> suggestions_url ( ) . empty ( ) ) ;
EXPECT_EQ ( "http://search.yahoo.com/search?p={
searchTerms}
&ei=UTF-8" , template_url_ -> url ( ) ) ;
ASSERT_EQ ( 1U , template_url_ -> input_encodings ( ) . size ( ) ) ;
EXPECT_EQ ( "UTF-8" , template_url_ -> input_encodings ( ) [ 0 ] ) ;
EXPECT_EQ ( GURL ( "http://search.yahoo.com/favicon.ico" ) , template_url_ -> favicon_url ( ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int sunrast_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
const uint8_t * buf_end = avpkt -> data + avpkt -> size ;
AVFrame * const p = data ;
unsigned int w , h , depth , type , maptype , maplength , stride , x , y , len , alen ;
uint8_t * ptr ;
const uint8_t * bufstart = buf ;
int ret ;
if ( avpkt -> size < 32 ) return AVERROR_INVALIDDATA ;
if ( AV_RB32 ( buf ) != RAS_MAGIC ) {
av_log ( avctx , AV_LOG_ERROR , "this is not sunras encoded data\n" ) ;
return AVERROR_INVALIDDATA ;
}
w = AV_RB32 ( buf + 4 ) ;
h = AV_RB32 ( buf + 8 ) ;
depth = AV_RB32 ( buf + 12 ) ;
type = AV_RB32 ( buf + 20 ) ;
maptype = AV_RB32 ( buf + 24 ) ;
maplength = AV_RB32 ( buf + 28 ) ;
buf += 32 ;
if ( type == RT_FORMAT_TIFF || type == RT_FORMAT_IFF || type == RT_EXPERIMENTAL ) {
av_log_ask_for_sample ( avctx , "unsupported (compression) type\n" ) ;
return AVERROR_PATCHWELCOME ;
}
if ( type > RT_FORMAT_IFF ) {
av_log ( avctx , AV_LOG_ERROR , "invalid (compression) type\n" ) ;
return AVERROR_INVALIDDATA ;
}
if ( av_image_check_size ( w , h , 0 , avctx ) ) {
av_log ( avctx , AV_LOG_ERROR , "invalid image size\n" ) ;
return AVERROR_INVALIDDATA ;
}
if ( maptype == RMT_RAW ) {
av_log_ask_for_sample ( avctx , "unsupported colormap type\n" ) ;
return AVERROR_PATCHWELCOME ;
}
if ( maptype > RMT_RAW ) {
av_log ( avctx , AV_LOG_ERROR , "invalid colormap type\n" ) ;
return AVERROR_INVALIDDATA ;
}
switch ( depth ) {
case 1 : avctx -> pix_fmt = AV_PIX_FMT_MONOWHITE ;
break ;
case 8 : avctx -> pix_fmt = maplength ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_GRAY8 ;
break ;
case 24 : avctx -> pix_fmt = ( type == RT_FORMAT_RGB ) ? AV_PIX_FMT_RGB24 : AV_PIX_FMT_BGR24 ;
break ;
default : av_log ( avctx , AV_LOG_ERROR , "invalid depth\n" ) ;
return AVERROR_INVALIDDATA ;
}
if ( w != avctx -> width || h != avctx -> height ) avcodec_set_dimensions ( avctx , w , h ) ;
if ( ( ret = ff_get_buffer ( avctx , p , 0 ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
p -> pict_type = AV_PICTURE_TYPE_I ;
if ( buf_end - buf < maplength ) return AVERROR_INVALIDDATA ;
if ( depth != 8 && maplength ) {
av_log ( avctx , AV_LOG_WARNING , "useless colormap found or file is corrupted, trying to recover\n" ) ;
}
else if ( maplength ) {
unsigned int len = maplength / 3 ;
if ( maplength % 3 || maplength > 768 ) {
av_log ( avctx , AV_LOG_WARNING , "invalid colormap length\n" ) ;
return AVERROR_INVALIDDATA ;
}
ptr = p -> data [ 1 ] ;
for ( x = 0 ;
x < len ;
x ++ , ptr += 4 ) * ( uint32_t * ) ptr = ( buf [ x ] << 16 ) + ( buf [ len + x ] << 8 ) + buf [ len + len + x ] ;
}
buf += maplength ;
ptr = p -> data [ 0 ] ;
stride = p -> linesize [ 0 ] ;
len = ( depth * w + 7 ) >> 3 ;
alen = len + ( len & 1 ) ;
if ( type == RT_BYTE_ENCODED ) {
int value , run ;
uint8_t * end = ptr + h * stride ;
x = 0 ;
while ( ptr != end && buf < buf_end ) {
run = 1 ;
if ( buf_end - buf < 1 ) return AVERROR_INVALIDDATA ;
if ( ( value = * buf ++ ) == RLE_TRIGGER ) {
run = * buf ++ + 1 ;
if ( run != 1 ) value = * buf ++ ;
}
while ( run -- ) {
if ( x < len ) ptr [ x ] = value ;
if ( ++ x >= alen ) {
x = 0 ;
ptr += stride ;
if ( ptr == end ) break ;
}
}
}
}
else {
for ( y = 0 ;
y < h ;
y ++ ) {
if ( buf_end - buf < len ) break ;
memcpy ( ptr , buf , len ) ;
ptr += stride ;
buf += alen ;
}
}
* got_frame = 1 ;
return buf - bufstart ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void nautilus_file_operations_extract_files ( GList * files , GFile * destination_directory , GtkWindow * parent_window , NautilusExtractCallback done_callback , gpointer done_callback_data ) {
ExtractJob * extract_job ;
g_autoptr ( GTask ) task = NULL ;
extract_job = op_job_new ( ExtractJob , parent_window ) ;
extract_job -> source_files = g_list_copy_deep ( files , ( GCopyFunc ) g_object_ref , NULL ) ;
extract_job -> destination_directory = g_object_ref ( destination_directory ) ;
extract_job -> done_callback = done_callback ;
extract_job -> done_callback_data = done_callback_data ;
inhibit_power_manager ( ( CommonJob * ) extract_job , _ ( "Extracting Files" ) ) ;
if ( ! nautilus_file_undo_manager_is_operating ( ) ) {
extract_job -> common . undo_info = nautilus_file_undo_info_extract_new ( files , destination_directory ) ;
}
task = g_task_new ( NULL , extract_job -> common . cancellable , extract_task_done , extract_job ) ;
g_task_set_task_data ( task , extract_job , NULL ) ;
g_task_run_in_thread ( task , extract_task_thread_func ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void fts_build_parse_content_type ( struct fts_mail_build_context * ctx , const struct message_header_line * hdr ) {
struct rfc822_parser_context parser ;
string_t * content_type ;
if ( ctx -> content_type != NULL ) return ;
rfc822_parser_init ( & parser , hdr -> full_value , hdr -> full_value_len , NULL ) ;
rfc822_skip_lwsp ( & parser ) ;
T_BEGIN {
content_type = t_str_new ( 64 ) ;
( void ) rfc822_parse_content_type ( & parser , content_type ) ;
ctx -> content_type = str_lcase ( i_strdup ( str_c ( content_type ) ) ) ;
}
T_END ;
rfc822_parser_deinit ( & parser ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_set_rd_speed_thresholds ( VP9_COMP * cpi ) {
int i ;
RD_OPT * const rd = & cpi -> rd ;
SPEED_FEATURES * const sf = & cpi -> sf ;
for ( i = 0 ;
i < MAX_MODES ;
++ i ) rd -> thresh_mult [ i ] = cpi -> oxcf . mode == BEST ? - 500 : 0 ;
if ( sf -> adaptive_rd_thresh ) {
rd -> thresh_mult [ THR_NEARESTMV ] = 300 ;
rd -> thresh_mult [ THR_NEARESTG ] = 300 ;
rd -> thresh_mult [ THR_NEARESTA ] = 300 ;
}
else {
rd -> thresh_mult [ THR_NEARESTMV ] = 0 ;
rd -> thresh_mult [ THR_NEARESTG ] = 0 ;
rd -> thresh_mult [ THR_NEARESTA ] = 0 ;
}
rd -> thresh_mult [ THR_DC ] += 1000 ;
rd -> thresh_mult [ THR_NEWMV ] += 1000 ;
rd -> thresh_mult [ THR_NEWA ] += 1000 ;
rd -> thresh_mult [ THR_NEWG ] += 1000 ;
rd -> thresh_mult [ THR_NEWMV ] += sf -> elevate_newmv_thresh ;
rd -> thresh_mult [ THR_NEARMV ] += 1000 ;
rd -> thresh_mult [ THR_NEARA ] += 1000 ;
rd -> thresh_mult [ THR_COMP_NEARESTLA ] += 1000 ;
rd -> thresh_mult [ THR_COMP_NEARESTGA ] += 1000 ;
rd -> thresh_mult [ THR_TM ] += 1000 ;
rd -> thresh_mult [ THR_COMP_NEARLA ] += 1500 ;
rd -> thresh_mult [ THR_COMP_NEWLA ] += 2000 ;
rd -> thresh_mult [ THR_NEARG ] += 1000 ;
rd -> thresh_mult [ THR_COMP_NEARGA ] += 1500 ;
rd -> thresh_mult [ THR_COMP_NEWGA ] += 2000 ;
rd -> thresh_mult [ THR_ZEROMV ] += 2000 ;
rd -> thresh_mult [ THR_ZEROG ] += 2000 ;
rd -> thresh_mult [ THR_ZEROA ] += 2000 ;
rd -> thresh_mult [ THR_COMP_ZEROLA ] += 2500 ;
rd -> thresh_mult [ THR_COMP_ZEROGA ] += 2500 ;
rd -> thresh_mult [ THR_H_PRED ] += 2000 ;
rd -> thresh_mult [ THR_V_PRED ] += 2000 ;
rd -> thresh_mult [ THR_D45_PRED ] += 2500 ;
rd -> thresh_mult [ THR_D135_PRED ] += 2500 ;
rd -> thresh_mult [ THR_D117_PRED ] += 2500 ;
rd -> thresh_mult [ THR_D153_PRED ] += 2500 ;
rd -> thresh_mult [ THR_D207_PRED ] += 2500 ;
rd -> thresh_mult [ THR_D63_PRED ] += 2500 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | proto_item * proto_tree_add_item ( proto_tree * tree , int hfindex , tvbuff_t * tvb , const gint start , gint length , const guint encoding ) {
register header_field_info * hfinfo ;
PROTO_REGISTRAR_GET_NTH ( hfindex , hfinfo ) ;
return proto_tree_add_item_new ( tree , hfinfo , tvb , start , length , encoding ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | unsigned int vp9_sub_pixel_variance ## W ## x ## H ## _c ( const uint8_t * src , int src_stride , int xoffset , int yoffset , const uint8_t * dst , int dst_stride , unsigned int * sse ) {
uint16_t fdata3 [ ( H + 1 ) * W ] ;
uint8_t temp2 [ H * W ] ;
var_filter_block2d_bil_first_pass ( src , fdata3 , src_stride , 1 , H + 1 , W , BILINEAR_FILTERS_2TAP ( xoffset ) ) ;
var_filter_block2d_bil_second_pass ( fdata3 , temp2 , W , W , H , W , BILINEAR_FILTERS_2TAP ( yoffset ) ) ;
return vp9_variance ## W ## x ## H ## _c ( temp2 , W , dst , dst_stride , sse ) ;
\ }
# define SUBPIX_AVG_VAR ( W , H ) unsigned int vp9_sub_pixel_avg_variance ## W ## x ## H ## _c ( const uint8_t * src , int src_stride , int xoffset , int yoffset , const uint8_t * dst , int dst_stride , unsigned int * sse , const uint8_t * second_pred ) {
uint16_t fdata3 [ ( H + 1 ) * W ] ;
uint8_t temp2 [ H * W ] ;
DECLARE_ALIGNED_ARRAY ( 16 , uint8_t , temp3 , H * W ) ;
var_filter_block2d_bil_first_pass ( src , fdata3 , src_stride , 1 , H + 1 , W , BILINEAR_FILTERS_2TAP ( xoffset ) ) ;
var_filter_block2d_bil_second_pass ( fdata3 , temp2 , W , W , H , W , BILINEAR_FILTERS_2TAP ( yoffset ) ) ;
vp9_comp_avg_pred ( temp3 , second_pred , W , H , temp2 , W ) ;
return vp9_variance ## W ## x ## H ## _c ( temp3 , W , dst , dst_stride , sse ) ;
\ }
void vp9_get16x16var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) {
variance ( src_ptr , source_stride , ref_ptr , ref_stride , 16 , 16 , sse , sum ) ;
}
void vp9_get8x8var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) {
variance ( src_ptr , source_stride , ref_ptr , ref_stride , 8 , 8 , sse , sum ) ;
}
unsigned int vp9_mse16x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 16 , 16 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse16x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 16 , 8 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse8x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 8 , 16 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse8x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 8 , 8 , sse , & sum ) ;
return * sse ;
}
VAR ( 4 , 4 ) SUBPIX_VAR ( 4 , 4 ) SUBPIX_AVG_VAR ( 4 , 4 ) VAR ( 4 , 8 ) SUBPIX_VAR ( 4 , 8 ) SUBPIX_AVG_VAR ( 4 , 8 ) VAR ( 8 , 4 ) SUBPIX_VAR ( 8 , 4 ) SUBPIX_AVG_VAR ( 8 , 4 ) VAR ( 8 , 8 ) SUBPIX_VAR ( 8 , 8 ) SUBPIX_AVG_VAR ( 8 , 8 ) VAR ( 8 , 16 ) SUBPIX_VAR ( 8 , 16 ) SUBPIX_AVG_VAR ( 8 , 16 ) VAR ( 16 , 8 ) SUBPIX_VAR ( 16 , 8 ) SUBPIX_AVG_VAR ( 16 , 8 ) VAR ( 16 , 16 ) SUBPIX_VAR ( 16 , 16 ) SUBPIX_AVG_VAR ( 16 , 16 ) VAR ( 16 , 32 ) SUBPIX_VAR ( 16 , 32 ) SUBPIX_AVG_VAR ( 16 , 32 ) VAR ( 32 , 16 ) SUBPIX_VAR ( 32 , 16 ) SUBPIX_AVG_VAR ( 32 , 16 ) VAR ( 32 , 32 ) SUBPIX_VAR ( 32 , 32 ) SUBPIX_AVG_VAR ( 32 , 32 ) VAR ( 32 , 64 ) SUBPIX_VAR ( 32 , 64 ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void test_left_join_view ( ) {
MYSQL_STMT * stmt ;
int rc , i ;
const char * query = "select t1.a, v1.x from t1 left join v1 on (t1.a= v1.x);
" ;
myheader ( "test_left_join_view" ) ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS t1,v1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "DROP VIEW IF EXISTS v1,t1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE t1 (a int)" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "insert into t1 values (1), (2), (3)" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "create view v1 (x) as select a from t1 where a > 1" ) ;
myquery ( rc ) ;
stmt = mysql_stmt_init ( mysql ) ;
rc = mysql_stmt_prepare ( stmt , query , strlen ( query ) ) ;
check_execute ( stmt , rc ) ;
for ( i = 0 ;
i < 3 ;
i ++ ) {
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
rc = my_process_stmt_result ( stmt ) ;
DIE_UNLESS ( 3 == rc ) ;
}
mysql_stmt_close ( stmt ) ;
rc = mysql_query ( mysql , "DROP VIEW v1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "DROP TABLE t1" ) ;
myquery ( rc ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void var_set ( const char * var_name , const char * var_name_end , const char * var_val , const char * var_val_end ) {
int digit , env_var = 0 ;
VAR * v ;
DBUG_ENTER ( "var_set" ) ;
DBUG_PRINT ( "enter" , ( "var_name: '%.*s' = '%.*s' (length: %d)" , ( int ) ( var_name_end - var_name ) , var_name , ( int ) ( var_val_end - var_val ) , var_val , ( int ) ( var_val_end - var_val ) ) ) ;
if ( * var_name != '$' ) env_var = 1 ;
else var_name ++ ;
digit = * var_name - '0' ;
if ( ! ( digit < 10 && digit >= 0 ) ) {
v = var_obtain ( var_name , ( uint ) ( var_name_end - var_name ) ) ;
}
else v = var_reg + digit ;
eval_expr ( v , var_val , ( const char * * ) & var_val_end ) ;
if ( env_var ) {
if ( v -> int_dirty ) {
sprintf ( v -> str_val , "%d" , v -> int_val ) ;
v -> int_dirty = false ;
v -> str_val_len = strlen ( v -> str_val ) ;
}
DBUG_ASSERT ( v -> name [ v -> name_len ] == 0 ) ;
setenv ( v -> name , v -> str_val , 1 ) ;
}
DBUG_VOID_RETURN ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline char * w_newword ( size_t * actlen , size_t * maxlen ) {
* actlen = * maxlen = 0 ;
return NULL ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline uint16_t cpu_to_be16 ( uint16_t v ) {
return bswap16 ( v ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int mime_parse_rfc822_date_fastcase ( const char * buf , int length , struct tm * tp ) {
unsigned int three_char_wday , three_char_mon ;
ink_assert ( length >= 29 ) ;
ink_assert ( ! is_ws ( buf [ 0 ] ) ) ;
ink_assert ( buf [ 3 ] == ',' ) ;
tp -> tm_wday = - 1 ;
three_char_wday = ( buf [ 0 ] << 16 ) | ( buf [ 1 ] << 8 ) | buf [ 2 ] ;
if ( three_char_wday <= 0x53756E ) {
if ( three_char_wday == 0x467269 ) {
tp -> tm_wday = 5 ;
}
else if ( three_char_wday == 0x4D6F6E ) {
tp -> tm_wday = 1 ;
}
else if ( three_char_wday == 0x536174 ) {
tp -> tm_wday = 6 ;
}
else if ( three_char_wday == 0x53756E ) {
tp -> tm_wday = 0 ;
}
}
else {
if ( three_char_wday == 0x546875 ) {
tp -> tm_wday = 4 ;
}
else if ( three_char_wday == 0x547565 ) {
tp -> tm_wday = 2 ;
}
else if ( three_char_wday == 0x576564 ) {
tp -> tm_wday = 3 ;
}
}
if ( tp -> tm_wday < 0 ) {
tp -> tm_wday = day_names_dfa -> match ( buf , length ) ;
if ( tp -> tm_wday < 0 ) {
return 0 ;
}
}
tp -> tm_mday = ( buf [ 5 ] - '0' ) * 10 + ( buf [ 6 ] - '0' ) ;
tp -> tm_mon = - 1 ;
three_char_mon = ( buf [ 8 ] << 16 ) | ( buf [ 9 ] << 8 ) | buf [ 10 ] ;
if ( three_char_mon <= 0x4A756C ) {
if ( three_char_mon <= 0x446563 ) {
if ( three_char_mon == 0x417072 ) {
tp -> tm_mon = 3 ;
}
else if ( three_char_mon == 0x417567 ) {
tp -> tm_mon = 7 ;
}
else if ( three_char_mon == 0x446563 ) {
tp -> tm_mon = 11 ;
}
}
else {
if ( three_char_mon == 0x466562 ) {
tp -> tm_mon = 1 ;
}
else if ( three_char_mon == 0x4A616E ) {
tp -> tm_mon = 0 ;
}
else if ( three_char_mon == 0x4A756C ) {
tp -> tm_mon = 6 ;
}
}
}
else {
if ( three_char_mon <= 0x4D6179 ) {
if ( three_char_mon == 0x4A756E ) {
tp -> tm_mon = 5 ;
}
else if ( three_char_mon == 0x4D6172 ) {
tp -> tm_mon = 2 ;
}
else if ( three_char_mon == 0x4D6179 ) {
tp -> tm_mon = 4 ;
}
}
else {
if ( three_char_mon == 0x4E6F76 ) {
tp -> tm_mon = 10 ;
}
else if ( three_char_mon == 0x4F6374 ) {
tp -> tm_mon = 9 ;
}
else if ( three_char_mon == 0x536570 ) {
tp -> tm_mon = 8 ;
}
}
}
if ( tp -> tm_mon < 0 ) {
tp -> tm_mon = month_names_dfa -> match ( buf , length ) ;
if ( tp -> tm_mon < 0 ) {
return 0 ;
}
}
tp -> tm_year = ( ( buf [ 12 ] - '0' ) * 1000 + ( buf [ 13 ] - '0' ) * 100 + ( buf [ 14 ] - '0' ) * 10 + ( buf [ 15 ] - '0' ) ) - 1900 ;
tp -> tm_hour = ( buf [ 17 ] - '0' ) * 10 + ( buf [ 18 ] - '0' ) ;
tp -> tm_min = ( buf [ 20 ] - '0' ) * 10 + ( buf [ 21 ] - '0' ) ;
tp -> tm_sec = ( buf [ 23 ] - '0' ) * 10 + ( buf [ 24 ] - '0' ) ;
if ( ( buf [ 19 ] != ':' ) || ( buf [ 22 ] != ':' ) ) {
return 0 ;
}
return 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int in_bitmapped_pack ( struct object_list * roots ) {
while ( roots ) {
struct object * object = roots -> item ;
roots = roots -> next ;
if ( find_pack_entry_one ( object -> oid . hash , bitmap_git . pack ) > 0 ) return 1 ;
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void rv34_mc_2mv ( RV34DecContext * r , const int block_type ) {
int weighted = ! r -> rv30 && block_type != RV34_MB_B_BIDIR && r -> weight1 != 8192 ;
rv34_mc ( r , block_type , 0 , 0 , 0 , 2 , 2 , 0 , r -> rv30 , weighted , r -> rdsp . put_pixels_tab , r -> rdsp . put_chroma_pixels_tab ) ;
if ( ! weighted ) {
rv34_mc ( r , block_type , 0 , 0 , 0 , 2 , 2 , 1 , r -> rv30 , 0 , r -> rdsp . avg_pixels_tab , r -> rdsp . avg_chroma_pixels_tab ) ;
}
else {
rv34_mc ( r , block_type , 0 , 0 , 0 , 2 , 2 , 1 , r -> rv30 , 1 , r -> rdsp . put_pixels_tab , r -> rdsp . put_chroma_pixels_tab ) ;
rv4_weight ( r ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline void int8x8_fmul_int32 ( float * dst , const int8_t * src , int scale ) {
float fscale = scale / 16.0 ;
int i ;
for ( i = 0 ;
i < 8 ;
i ++ ) dst [ i ] = src [ i ] * fscale ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int32_t u_sprintf_pad_and_justify ( void * context , const u_printf_spec_info * info , const UChar * result , int32_t resultLen ) {
u_localized_print_string * output = ( u_localized_print_string * ) context ;
int32_t written = 0 ;
int32_t lengthOfResult = resultLen ;
resultLen = ufmt_min ( resultLen , output -> available ) ;
if ( info -> fWidth != - 1 && resultLen < info -> fWidth ) {
int32_t paddingLeft = info -> fWidth - resultLen ;
int32_t outputPos = output -> len - output -> available ;
if ( paddingLeft + resultLen > output -> available ) {
paddingLeft = output -> available - resultLen ;
if ( paddingLeft < 0 ) {
paddingLeft = 0 ;
}
}
written += paddingLeft ;
if ( info -> fLeft ) {
written += u_sprintf_write ( output , result , resultLen ) ;
u_memset ( & output -> str [ outputPos + resultLen ] , info -> fPadChar , paddingLeft ) ;
output -> available -= paddingLeft ;
}
else {
u_memset ( & output -> str [ outputPos ] , info -> fPadChar , paddingLeft ) ;
output -> available -= paddingLeft ;
written += u_sprintf_write ( output , result , resultLen ) ;
}
}
else {
written = u_sprintf_write ( output , result , resultLen ) ;
}
if ( written >= 0 && lengthOfResult > written ) {
return lengthOfResult ;
}
return written ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | unsigned int vp9_sub_pixel_variance ## W ## x ## H ## _c ( const uint8_t * src , int src_stride , int xoffset , int yoffset , const uint8_t * dst , int dst_stride , unsigned int * sse ) {
uint16_t fdata3 [ ( H + 1 ) * W ] ;
uint8_t temp2 [ H * W ] ;
var_filter_block2d_bil_first_pass ( src , fdata3 , src_stride , 1 , H + 1 , W , BILINEAR_FILTERS_2TAP ( xoffset ) ) ;
var_filter_block2d_bil_second_pass ( fdata3 , temp2 , W , W , H , W , BILINEAR_FILTERS_2TAP ( yoffset ) ) ;
return vp9_variance ## W ## x ## H ## _c ( temp2 , W , dst , dst_stride , sse ) ;
\ }
# define SUBPIX_AVG_VAR ( W , H ) unsigned int vp9_sub_pixel_avg_variance ## W ## x ## H ## _c ( const uint8_t * src , int src_stride , int xoffset , int yoffset , const uint8_t * dst , int dst_stride , unsigned int * sse , const uint8_t * second_pred ) {
uint16_t fdata3 [ ( H + 1 ) * W ] ;
uint8_t temp2 [ H * W ] ;
DECLARE_ALIGNED_ARRAY ( 16 , uint8_t , temp3 , H * W ) ;
var_filter_block2d_bil_first_pass ( src , fdata3 , src_stride , 1 , H + 1 , W , BILINEAR_FILTERS_2TAP ( xoffset ) ) ;
var_filter_block2d_bil_second_pass ( fdata3 , temp2 , W , W , H , W , BILINEAR_FILTERS_2TAP ( yoffset ) ) ;
vp9_comp_avg_pred ( temp3 , second_pred , W , H , temp2 , W ) ;
return vp9_variance ## W ## x ## H ## _c ( temp3 , W , dst , dst_stride , sse ) ;
\ }
void vp9_get16x16var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) {
variance ( src_ptr , source_stride , ref_ptr , ref_stride , 16 , 16 , sse , sum ) ;
}
void vp9_get8x8var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) {
variance ( src_ptr , source_stride , ref_ptr , ref_stride , 8 , 8 , sse , sum ) ;
}
unsigned int vp9_mse16x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 16 , 16 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse16x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 16 , 8 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse8x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 8 , 16 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse8x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 8 , 8 , sse , & sum ) ;
return * sse ;
}
VAR ( 4 , 4 ) SUBPIX_VAR ( 4 , 4 ) SUBPIX_AVG_VAR ( 4 , 4 ) VAR ( 4 , 8 ) SUBPIX_VAR ( 4 , 8 ) SUBPIX_AVG_VAR ( 4 , 8 ) VAR ( 8 , 4 ) SUBPIX_VAR ( 8 , 4 ) SUBPIX_AVG_VAR ( 8 , 4 ) VAR ( 8 , 8 ) SUBPIX_VAR ( 8 , 8 ) SUBPIX_AVG_VAR ( 8 , 8 ) VAR ( 8 , 16 ) SUBPIX_VAR ( 8 , 16 ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( FullscreenControllerInteractiveTest , DISABLED_BrowserFullscreenExit ) {
ASSERT_NO_FATAL_FAILURE ( ToggleBrowserFullscreen ( true ) ) ;
AddTabAtIndex ( 0 , GURL ( url : : kAboutBlankURL ) , PAGE_TRANSITION_TYPED ) ;
ASSERT_NO_FATAL_FAILURE ( ToggleTabFullscreen ( true ) ) ;
ASSERT_NO_FATAL_FAILURE ( ToggleBrowserFullscreen ( false ) ) ;
ASSERT_FALSE ( browser ( ) -> window ( ) -> IsFullscreen ( ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_sad ## m ## x ## n ## x4d_c ( const uint8_t * src , int src_stride , const uint8_t * const refs [ ] , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < 4 ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , refs [ i ] , ref_stride ) ;
\ }
sadMxN ( 64 , 64 ) sadMxNxK ( 64 , 64 , 3 ) sadMxNxK ( 64 , 64 , 8 ) sadMxNx4D ( 64 , 64 ) sadMxN ( 64 , 32 ) sadMxNx4D ( 64 , 32 ) sadMxN ( 32 , 64 ) sadMxNx4D ( 32 , 64 ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static const gchar * get_register_name_from_address ( guint64 addr , gboolean * is_custom_register , u3v_conv_info_t * u3v_conv_info ) {
const gchar * address_string = NULL ;
guint32 offset_address ;
if ( is_custom_register != NULL ) {
* is_custom_register = FALSE ;
}
if ( addr < 0x10000 ) {
offset_address = ( guint32 ) addr ;
address_string = try_val_to_str ( offset_address , bootstrap_register_names_abrm ) ;
}
if ( u3v_conv_info && u3v_conv_info -> sbrm_addr != 0 && ( addr >= u3v_conv_info -> sbrm_addr ) ) {
offset_address = ( guint32 ) ( addr - u3v_conv_info -> sbrm_addr ) ;
address_string = try_val_to_str ( offset_address , bootstrap_register_names_sbrm ) ;
}
if ( u3v_conv_info && u3v_conv_info -> sirm_addr != 0 && ( addr >= u3v_conv_info -> sirm_addr ) ) {
offset_address = ( guint32 ) ( addr - u3v_conv_info -> sirm_addr ) ;
address_string = try_val_to_str ( offset_address , bootstrap_register_names_sirm ) ;
}
if ( u3v_conv_info && u3v_conv_info -> eirm_addr != 0 && ( addr >= u3v_conv_info -> eirm_addr ) ) {
offset_address = ( guint32 ) ( addr - u3v_conv_info -> eirm_addr ) ;
address_string = try_val_to_str ( offset_address , bootstrap_register_names_eirm ) ;
}
if ( ! address_string ) {
address_string = wmem_strdup_printf ( wmem_packet_scope ( ) , "[Addr:0x%016" G_GINT64_MODIFIER "X]" , addr ) ;
if ( is_custom_register != NULL ) {
* is_custom_register = TRUE ;
}
}
return address_string ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int ReadInt ( ArchiveHandle * AH ) {
int res = 0 ;
int bv , b ;
int sign = 0 ;
int bitShift = 0 ;
if ( AH -> version > K_VERS_1_0 ) sign = ( * AH -> ReadBytePtr ) ( AH ) ;
for ( b = 0 ;
b < AH -> intSize ;
b ++ ) {
bv = ( * AH -> ReadBytePtr ) ( AH ) & 0xFF ;
if ( bv != 0 ) res = res + ( bv << bitShift ) ;
bitShift += 8 ;
}
if ( sign ) res = - res ;
return res ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp8_set_speed_features ( VP8_COMP * cpi ) {
SPEED_FEATURES * sf = & cpi -> sf ;
int Mode = cpi -> compressor_speed ;
int Speed = cpi -> Speed ;
int i ;
VP8_COMMON * cm = & cpi -> common ;
int last_improved_quant = sf -> improved_quant ;
int ref_frames ;
for ( i = 0 ;
i < MAX_MODES ;
i ++ ) {
cpi -> mode_check_freq [ i ] = 0 ;
}
cpi -> mb . mbs_tested_so_far = 0 ;
sf -> RD = 1 ;
sf -> search_method = NSTEP ;
sf -> improved_quant = 1 ;
sf -> improved_dct = 1 ;
sf -> auto_filter = 1 ;
sf -> recode_loop = 1 ;
sf -> quarter_pixel_search = 1 ;
sf -> half_pixel_search = 1 ;
sf -> iterative_sub_pixel = 1 ;
sf -> optimize_coefficients = 1 ;
sf -> use_fastquant_for_pick = 0 ;
sf -> no_skip_block4x4_search = 1 ;
sf -> first_step = 0 ;
sf -> max_step_search_steps = MAX_MVSEARCH_STEPS ;
sf -> improved_mv_pred = 1 ;
for ( i = 0 ;
i < MAX_MODES ;
i ++ ) sf -> thresh_mult [ i ] = 0 ;
ref_frames = 1 ;
if ( cpi -> ref_frame_flags & VP8_LAST_FRAME ) ref_frames ++ ;
if ( cpi -> ref_frame_flags & VP8_GOLD_FRAME ) ref_frames ++ ;
if ( cpi -> ref_frame_flags & VP8_ALTR_FRAME ) ref_frames ++ ;
if ( Mode == 0 ) Speed = 0 ;
else if ( Mode == 2 ) Speed = RT ( Speed ) ;
else {
if ( Speed > 5 ) Speed = 5 ;
Speed = GOOD ( Speed ) ;
}
sf -> thresh_mult [ THR_ZERO1 ] = sf -> thresh_mult [ THR_NEAREST1 ] = sf -> thresh_mult [ THR_NEAR1 ] = sf -> thresh_mult [ THR_DC ] = 0 ;
sf -> thresh_mult [ THR_ZERO2 ] = sf -> thresh_mult [ THR_ZERO3 ] = sf -> thresh_mult [ THR_NEAREST2 ] = sf -> thresh_mult [ THR_NEAREST3 ] = sf -> thresh_mult [ THR_NEAR2 ] = sf -> thresh_mult [ THR_NEAR3 ] = speed_map ( Speed , thresh_mult_map_znn ) ;
sf -> thresh_mult [ THR_V_PRED ] = sf -> thresh_mult [ THR_H_PRED ] = speed_map ( Speed , thresh_mult_map_vhpred ) ;
sf -> thresh_mult [ THR_B_PRED ] = speed_map ( Speed , thresh_mult_map_bpred ) ;
sf -> thresh_mult [ THR_TM ] = speed_map ( Speed , thresh_mult_map_tm ) ;
sf -> thresh_mult [ THR_NEW1 ] = speed_map ( Speed , thresh_mult_map_new1 ) ;
sf -> thresh_mult [ THR_NEW2 ] = sf -> thresh_mult [ THR_NEW3 ] = speed_map ( Speed , thresh_mult_map_new2 ) ;
sf -> thresh_mult [ THR_SPLIT1 ] = speed_map ( Speed , thresh_mult_map_split1 ) ;
sf -> thresh_mult [ THR_SPLIT2 ] = sf -> thresh_mult [ THR_SPLIT3 ] = speed_map ( Speed , thresh_mult_map_split2 ) ;
cpi -> mode_check_freq [ THR_ZERO1 ] = cpi -> mode_check_freq [ THR_NEAREST1 ] = cpi -> mode_check_freq [ THR_NEAR1 ] = cpi -> mode_check_freq [ THR_TM ] = cpi -> mode_check_freq [ THR_DC ] = 0 ;
cpi -> mode_check_freq [ THR_ZERO2 ] = cpi -> mode_check_freq [ THR_ZERO3 ] = cpi -> mode_check_freq [ THR_NEAREST2 ] = cpi -> mode_check_freq [ THR_NEAREST3 ] = speed_map ( Speed , mode_check_freq_map_zn2 ) ;
cpi -> mode_check_freq [ THR_NEAR2 ] = cpi -> mode_check_freq [ THR_NEAR3 ] = speed_map ( Speed , mode_check_freq_map_near2 ) ;
cpi -> mode_check_freq [ THR_V_PRED ] = cpi -> mode_check_freq [ THR_H_PRED ] = cpi -> mode_check_freq [ THR_B_PRED ] = speed_map ( Speed , mode_check_freq_map_vhbpred ) ;
cpi -> mode_check_freq [ THR_NEW1 ] = speed_map ( Speed , mode_check_freq_map_new1 ) ;
cpi -> mode_check_freq [ THR_NEW2 ] = cpi -> mode_check_freq [ THR_NEW3 ] = speed_map ( Speed , mode_check_freq_map_new2 ) ;
cpi -> mode_check_freq [ THR_SPLIT1 ] = speed_map ( Speed , mode_check_freq_map_split1 ) ;
cpi -> mode_check_freq [ THR_SPLIT2 ] = cpi -> mode_check_freq [ THR_SPLIT3 ] = speed_map ( Speed , mode_check_freq_map_split2 ) ;
Speed = cpi -> Speed ;
switch ( Mode ) {
# if ! ( CONFIG_REALTIME_ONLY ) case 0 : sf -> first_step = 0 ;
sf -> max_step_search_steps = MAX_MVSEARCH_STEPS ;
break ;
case 1 : case 3 : if ( Speed > 0 ) {
sf -> optimize_coefficients = 0 ;
sf -> use_fastquant_for_pick = 1 ;
sf -> no_skip_block4x4_search = 0 ;
sf -> first_step = 1 ;
}
if ( Speed > 2 ) {
sf -> improved_quant = 0 ;
sf -> improved_dct = 0 ;
sf -> recode_loop = 2 ;
}
if ( Speed > 3 ) {
sf -> auto_filter = 1 ;
sf -> recode_loop = 0 ;
sf -> RD = 0 ;
}
if ( Speed > 4 ) {
sf -> auto_filter = 0 ;
}
break ;
# endif case 2 : sf -> optimize_coefficients = 0 ;
sf -> recode_loop = 0 ;
sf -> auto_filter = 1 ;
sf -> iterative_sub_pixel = 1 ;
sf -> search_method = NSTEP ;
if ( Speed > 0 ) {
sf -> improved_quant = 0 ;
sf -> improved_dct = 0 ;
sf -> use_fastquant_for_pick = 1 ;
sf -> no_skip_block4x4_search = 0 ;
sf -> first_step = 1 ;
}
if ( Speed > 2 ) sf -> auto_filter = 0 ;
if ( Speed > 3 ) {
sf -> RD = 0 ;
sf -> auto_filter = 1 ;
}
if ( Speed > 4 ) {
sf -> auto_filter = 0 ;
sf -> search_method = HEX ;
sf -> iterative_sub_pixel = 0 ;
}
if ( Speed > 6 ) {
unsigned int sum = 0 ;
unsigned int total_mbs = cm -> MBs ;
int thresh ;
unsigned int total_skip ;
int min = 2000 ;
if ( cpi -> oxcf . encode_breakout > 2000 ) min = cpi -> oxcf . encode_breakout ;
min >>= 7 ;
for ( i = 0 ;
i < min ;
i ++ ) {
sum += cpi -> mb . error_bins [ i ] ;
}
total_skip = sum ;
sum = 0 ;
for ( ;
i < 1024 ;
i ++ ) {
sum += cpi -> mb . error_bins [ i ] ;
if ( 10 * sum >= ( unsigned int ) ( cpi -> Speed - 6 ) * ( total_mbs - total_skip ) ) break ;
}
i -- ;
thresh = ( i << 7 ) ;
if ( thresh < 2000 ) thresh = 2000 ;
if ( ref_frames > 1 ) {
sf -> thresh_mult [ THR_NEW1 ] = thresh ;
sf -> thresh_mult [ THR_NEAREST1 ] = thresh >> 1 ;
sf -> thresh_mult [ THR_NEAR1 ] = thresh >> 1 ;
}
if ( ref_frames > 2 ) {
sf -> thresh_mult [ THR_NEW2 ] = thresh << 1 ;
sf -> thresh_mult [ THR_NEAREST2 ] = thresh ;
sf -> thresh_mult [ THR_NEAR2 ] = thresh ;
}
if ( ref_frames > 3 ) {
sf -> thresh_mult [ THR_NEW3 ] = thresh << 1 ;
sf -> thresh_mult [ THR_NEAREST3 ] = thresh ;
sf -> thresh_mult [ THR_NEAR3 ] = thresh ;
}
sf -> improved_mv_pred = 0 ;
}
if ( Speed > 8 ) sf -> quarter_pixel_search = 0 ;
if ( cm -> version == 0 ) {
cm -> filter_type = NORMAL_LOOPFILTER ;
if ( Speed >= 14 ) cm -> filter_type = SIMPLE_LOOPFILTER ;
}
else {
cm -> filter_type = SIMPLE_LOOPFILTER ;
}
if ( Speed >= 15 ) sf -> half_pixel_search = 0 ;
vpx_memset ( cpi -> mb . error_bins , 0 , sizeof ( cpi -> mb . error_bins ) ) ;
}
;
if ( cpi -> pass == 1 ) {
sf -> improved_quant = 0 ;
sf -> optimize_coefficients = 0 ;
sf -> improved_dct = 0 ;
}
if ( cpi -> sf . search_method == NSTEP ) {
vp8_init3smotion_compensation ( & cpi -> mb , cm -> yv12_fb [ cm -> lst_fb_idx ] . y_stride ) ;
}
else if ( cpi -> sf . search_method == DIAMOND ) {
vp8_init_dsmotion_compensation ( & cpi -> mb , cm -> yv12_fb [ cm -> lst_fb_idx ] . y_stride ) ;
}
if ( cpi -> sf . improved_dct ) {
cpi -> mb . short_fdct8x4 = vp8_short_fdct8x4 ;
cpi -> mb . short_fdct4x4 = vp8_short_fdct4x4 ;
}
else {
cpi -> mb . short_fdct8x4 = vp8_short_fdct8x4 ;
cpi -> mb . short_fdct4x4 = vp8_short_fdct4x4 ;
}
cpi -> mb . short_walsh4x4 = vp8_short_walsh4x4 ;
if ( cpi -> sf . improved_quant ) {
cpi -> mb . quantize_b = vp8_regular_quantize_b ;
cpi -> mb . quantize_b_pair = vp8_regular_quantize_b_pair ;
}
else {
cpi -> mb . quantize_b = vp8_fast_quantize_b ;
cpi -> mb . quantize_b_pair = vp8_fast_quantize_b_pair ;
}
if ( cpi -> sf . improved_quant != last_improved_quant ) vp8cx_init_quantizer ( cpi ) ;
if ( cpi -> sf . iterative_sub_pixel == 1 ) {
cpi -> find_fractional_mv_step = vp8_find_best_sub_pixel_step_iteratively ;
}
else if ( cpi -> sf . quarter_pixel_search ) {
cpi -> find_fractional_mv_step = vp8_find_best_sub_pixel_step ;
}
else if ( cpi -> sf . half_pixel_search ) {
cpi -> find_fractional_mv_step = vp8_find_best_half_pixel_step ;
}
else {
cpi -> find_fractional_mv_step = vp8_skip_fractional_mv_step ;
}
if ( cpi -> sf . optimize_coefficients == 1 && cpi -> pass != 1 ) cpi -> mb . optimize = 1 ;
else cpi -> mb . optimize = 0 ;
if ( cpi -> common . full_pixel ) cpi -> find_fractional_mv_step = vp8_skip_fractional_mv_step ;
# ifdef SPEEDSTATS frames_at_speed [ cpi -> Speed ] ++ ;
# endif } | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void * spl_ptr_llist_pop ( spl_ptr_llist * llist TSRMLS_DC ) {
void * data ;
spl_ptr_llist_element * tail = llist -> tail ;
if ( tail == NULL ) {
return NULL ;
}
if ( tail -> prev ) {
tail -> prev -> next = NULL ;
}
else {
llist -> head = NULL ;
}
llist -> tail = tail -> prev ;
llist -> count -- ;
data = tail -> data ;
if ( llist -> dtor ) {
llist -> dtor ( tail TSRMLS_CC ) ;
}
tail -> data = NULL ;
SPL_LLIST_DELREF ( tail ) ;
return data ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void dissect_zcl_appl_ctrl_signal_state_rsp ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) {
static const int * flags [ ] = {
& hf_zbee_zcl_appl_ctrl_rem_en_flags , & hf_zbee_zcl_appl_ctrl_status2 , NULL }
;
proto_tree_add_item ( tree , hf_zbee_zcl_appl_ctrl_appl_status , tvb , * offset , 1 , ENC_NA ) ;
* offset += 1 ;
proto_tree_add_bitmask ( tree , tvb , * offset , hf_zbee_zcl_appl_ctrl_rem_en_flags_raw , ett_zbee_zcl_appl_ctrl_flags , flags , ENC_NA ) ;
* offset += 1 ;
proto_tree_add_item ( tree , hf_zbee_zcl_appl_ctrl_status2_array , tvb , * offset , 3 , ENC_BIG_ENDIAN ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_ServiceControlDescriptor ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h225_ServiceControlDescriptor , ServiceControlDescriptor_choice , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int action_cancel_handler ( TSCont contp , TSEvent event , void * ) {
if ( event == TS_EVENT_IMMEDIATE ) {
SDK_RPRINT ( SDK_ActionCancel_test , "TSActionCancel" , "TestCase1" , TC_PASS , "ok" ) ;
* SDK_ActionCancel_pstatus = REGRESSION_TEST_PASSED ;
}
else if ( event == TS_EVENT_TIMEOUT ) {
SDK_RPRINT ( SDK_ActionCancel_test , "TSActionCancel" , "TestCase1" , TC_FAIL , "bad action" ) ;
* SDK_ActionCancel_pstatus = REGRESSION_TEST_FAILED ;
}
else {
SDK_RPRINT ( SDK_ActionCancel_test , "TSActionCancel" , "TestCase1" , TC_FAIL , "bad event" ) ;
* SDK_ActionCancel_pstatus = REGRESSION_TEST_FAILED ;
}
TSContDestroy ( contp ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean nbd_accept ( QIOChannel * ioc , GIOCondition cond , gpointer opaque ) {
QIOChannelSocket * cioc ;
cioc = qio_channel_socket_accept ( QIO_CHANNEL_SOCKET ( ioc ) , NULL ) ;
if ( ! cioc ) {
return TRUE ;
}
if ( state >= TERMINATE ) {
object_unref ( OBJECT ( cioc ) ) ;
return TRUE ;
}
nb_fds ++ ;
nbd_update_server_watch ( ) ;
nbd_client_new ( newproto ? NULL : exp , cioc , tlscreds , NULL , nbd_client_closed ) ;
object_unref ( OBJECT ( cioc ) ) ;
return TRUE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int uwsgi_php_request ( struct wsgi_request * wsgi_req ) {
char real_filename [ PATH_MAX + 1 ] ;
char * path_info = NULL ;
size_t real_filename_len = 0 ;
struct stat php_stat ;
char * filename = NULL ;
int force_empty_script_name = 0 ;
zend_file_handle file_handle ;
# ifdef ZTS TSRMLS_FETCH ( ) ;
# endif SG ( server_context ) = ( void * ) wsgi_req ;
if ( uwsgi_parse_vars ( wsgi_req ) ) {
return - 1 ;
}
char * orig_path_info = wsgi_req -> path_info ;
uint16_t orig_path_info_len = wsgi_req -> path_info_len ;
if ( uphp . docroot ) {
wsgi_req -> document_root = uphp . docroot ;
}
else if ( ! wsgi_req -> document_root_len ) {
wsgi_req -> document_root = uwsgi . cwd ;
}
else {
char * sanitized_docroot = ecalloc ( 1 , PATH_MAX + 1 ) ;
if ( ! uwsgi_expand_path ( wsgi_req -> document_root , wsgi_req -> document_root_len , sanitized_docroot ) ) {
efree ( sanitized_docroot ) ;
return - 1 ;
}
wsgi_req -> document_root = sanitized_docroot ;
}
wsgi_req -> document_root_len = strlen ( wsgi_req -> document_root ) ;
if ( uphp . app ) {
# ifdef UWSGI_PCRE struct uwsgi_regexp_list * bypass = uphp . app_bypass ;
while ( bypass ) {
if ( uwsgi_regexp_match ( bypass -> pattern , bypass -> pattern_extra , wsgi_req -> uri , wsgi_req -> uri_len ) >= 0 ) {
goto oldstyle ;
}
bypass = bypass -> next ;
}
# endif strcpy ( real_filename , uphp . app ) ;
if ( wsgi_req -> path_info_len == 1 && wsgi_req -> path_info [ 0 ] == '/' ) {
goto appready ;
}
if ( uphp . app_qs ) {
size_t app_qs_len = strlen ( uphp . app_qs ) ;
size_t qs_len = wsgi_req -> path_info_len + app_qs_len ;
if ( wsgi_req -> query_string_len > 0 ) {
qs_len += 1 + wsgi_req -> query_string_len ;
}
char * qs = ecalloc ( 1 , qs_len + 1 ) ;
memcpy ( qs , uphp . app_qs , app_qs_len ) ;
memcpy ( qs + app_qs_len , wsgi_req -> path_info , wsgi_req -> path_info_len ) ;
if ( wsgi_req -> query_string_len > 0 ) {
char * ptr = qs + app_qs_len + wsgi_req -> path_info_len ;
* ptr = '&' ;
memcpy ( ptr + 1 , wsgi_req -> query_string , wsgi_req -> query_string_len ) ;
}
wsgi_req -> query_string = qs ;
wsgi_req -> query_string_len = qs_len ;
}
appready : wsgi_req -> path_info = "" ;
wsgi_req -> path_info_len = 0 ;
force_empty_script_name = 1 ;
goto secure2 ;
}
# ifdef UWSGI_PCRE oldstyle : # endif filename = uwsgi_concat4n ( wsgi_req -> document_root , wsgi_req -> document_root_len , "/" , 1 , wsgi_req -> path_info , wsgi_req -> path_info_len , "" , 0 ) ;
if ( uwsgi_php_walk ( wsgi_req , filename , wsgi_req -> document_root , wsgi_req -> document_root_len , & path_info ) ) {
free ( filename ) ;
if ( uphp . fallback || uphp . fallback2 ) {
if ( uphp . fallback ) {
filename = uwsgi_str ( uphp . fallback ) ;
}
else {
filename = uwsgi_concat2n ( wsgi_req -> document_root , strlen ( wsgi_req -> document_root ) , uphp . fallback2 , strlen ( uphp . fallback2 ) ) ;
wsgi_req -> script_name = uphp . fallback2 ;
wsgi_req -> script_name_len = strlen ( uphp . fallback2 ) ;
}
if ( uphp . fallback_qs ) {
size_t fqs_len = strlen ( uphp . fallback_qs ) ;
size_t new_qs_len = orig_path_info_len + fqs_len + 1 + wsgi_req -> query_string_len ;
char * new_qs = ecalloc ( 1 , new_qs_len + 1 ) ;
memcpy ( new_qs , uphp . fallback_qs , fqs_len ) ;
new_qs [ fqs_len ] = '=' ;
memcpy ( new_qs + fqs_len + 1 , orig_path_info , orig_path_info_len ) ;
if ( wsgi_req -> query_string_len ) {
new_qs [ fqs_len + 1 + orig_path_info_len ] = '&' ;
memcpy ( new_qs + fqs_len + 2 + orig_path_info_len , wsgi_req -> query_string , wsgi_req -> query_string_len ) ;
}
wsgi_req -> query_string = new_qs ;
wsgi_req -> query_string_len = new_qs_len ;
}
}
else {
uwsgi_404 ( wsgi_req ) ;
return - 1 ;
}
}
if ( path_info ) {
wsgi_req -> path_info = path_info ;
wsgi_req -> path_info_len = orig_path_info_len - ( path_info - orig_path_info ) ;
}
else {
wsgi_req -> path_info = "" ;
wsgi_req -> path_info_len = 0 ;
}
if ( ! realpath ( filename , real_filename ) ) {
free ( filename ) ;
uwsgi_404 ( wsgi_req ) ;
return - 1 ;
}
free ( filename ) ;
real_filename_len = strlen ( real_filename ) ;
if ( uphp . allowed_docroot ) {
struct uwsgi_string_list * usl = uphp . allowed_docroot ;
while ( usl ) {
if ( ! uwsgi_starts_with ( real_filename , real_filename_len , usl -> value , usl -> len ) ) {
goto secure ;
}
usl = usl -> next ;
}
uwsgi_403 ( wsgi_req ) ;
uwsgi_log ( "PHP security error: %s is not under an allowed docroot\n" , real_filename ) ;
return - 1 ;
}
else if ( uphp . docroot ) {
if ( ! uwsgi_starts_with ( real_filename , real_filename_len , uphp . docroot , uphp . docroot_len ) ) {
goto secure ;
}
uwsgi_403 ( wsgi_req ) ;
uwsgi_log ( "PHP security error: %s is not under the default docroot\n" , real_filename ) ;
return - 1 ;
}
secure : if ( stat ( real_filename , & php_stat ) ) {
uwsgi_404 ( wsgi_req ) ;
return UWSGI_OK ;
}
if ( S_ISDIR ( php_stat . st_mode ) ) {
if ( orig_path_info_len == 0 || ( orig_path_info_len > 0 && orig_path_info [ orig_path_info_len - 1 ] != '/' ) ) {
wsgi_req -> path_info = orig_path_info ;
wsgi_req -> path_info_len = orig_path_info_len ;
uwsgi_redirect_to_slash ( wsgi_req ) ;
return UWSGI_OK ;
}
struct uwsgi_string_list * upi = uphp . index ;
real_filename [ real_filename_len ] = '/' ;
real_filename_len ++ ;
int found = 0 ;
while ( upi ) {
if ( real_filename_len + upi -> len + 1 < PATH_MAX ) {
memcpy ( real_filename + real_filename_len , upi -> value , upi -> len + 1 ) ;
if ( ! access ( real_filename , R_OK ) ) {
found = 1 ;
break ;
}
}
upi = upi -> next ;
}
if ( ! found ) {
uwsgi_404 ( wsgi_req ) ;
return UWSGI_OK ;
}
real_filename_len = strlen ( real_filename ) ;
}
if ( uphp . allowed_ext ) {
struct uwsgi_string_list * usl = uphp . allowed_ext ;
while ( usl ) {
if ( real_filename_len >= usl -> len ) {
if ( ! uwsgi_strncmp ( real_filename + ( real_filename_len - usl -> len ) , usl -> len , usl -> value , usl -> len ) ) {
goto secure2 ;
}
}
usl = usl -> next ;
}
uwsgi_403 ( wsgi_req ) ;
uwsgi_log ( "PHP security error: %s does not end with an allowed extension\n" , real_filename ) ;
return - 1 ;
}
secure2 : wsgi_req -> file = real_filename ;
wsgi_req -> file_len = strlen ( wsgi_req -> file ) ;
if ( uphp . allowed_scripts ) {
struct uwsgi_string_list * usl = uphp . allowed_scripts ;
while ( usl ) {
if ( ! uwsgi_strncmp ( wsgi_req -> file , wsgi_req -> file_len , usl -> value , usl -> len ) ) {
goto secure3 ;
}
usl = usl -> next ;
}
uwsgi_403 ( wsgi_req ) ;
uwsgi_log ( "PHP security error: %s is not an allowed script\n" , real_filename ) ;
return - 1 ;
}
secure3 : if ( force_empty_script_name ) {
wsgi_req -> script_name = "" ;
wsgi_req -> script_name_len = 0 ;
}
else if ( ! uphp . fallback2 ) {
wsgi_req -> script_name = orig_path_info ;
if ( path_info ) {
wsgi_req -> script_name_len = path_info - orig_path_info ;
}
else {
wsgi_req -> script_name_len = orig_path_info_len ;
}
}
# ifdef UWSGI_DEBUG uwsgi_log ( "php filename = %s script_name = %.*s (%d) document_root = %.*s (%d)\n" , real_filename , wsgi_req -> script_name_len , wsgi_req -> script_name , wsgi_req -> script_name_len , wsgi_req -> document_root_len , wsgi_req -> document_root , wsgi_req -> document_root_len ) ;
# endif SG ( request_info ) . request_uri = estrndup ( wsgi_req -> uri , wsgi_req -> uri_len ) ;
SG ( request_info ) . request_method = estrndup ( wsgi_req -> method , wsgi_req -> method_len ) ;
SG ( request_info ) . proto_num = 1001 ;
SG ( request_info ) . query_string = estrndup ( wsgi_req -> query_string , wsgi_req -> query_string_len ) ;
SG ( request_info ) . content_length = wsgi_req -> post_cl ;
SG ( request_info ) . content_type = estrndup ( wsgi_req -> content_type , wsgi_req -> content_type_len ) ;
SG ( sapi_headers ) . http_response_code = 200 ;
SG ( request_info ) . path_translated = wsgi_req -> file ;
file_handle . type = ZEND_HANDLE_FILENAME ;
file_handle . filename = real_filename ;
file_handle . free_filename = 0 ;
file_handle . opened_path = NULL ;
if ( php_request_startup ( TSRMLS_C ) == FAILURE ) {
uwsgi_500 ( wsgi_req ) ;
return - 1 ;
}
struct uwsgi_string_list * usl = NULL ;
uwsgi_foreach ( usl , uphp . exec_before ) {
if ( zend_eval_string_ex ( usl -> value , NULL , "uWSGI php exec before" , 1 TSRMLS_CC ) == FAILURE ) goto end ;
}
php_execute_script ( & file_handle TSRMLS_CC ) ;
uwsgi_foreach ( usl , uphp . exec_after ) {
if ( zend_eval_string_ex ( usl -> value , NULL , "uWSGI php exec after" , 1 TSRMLS_CC ) == FAILURE ) goto end ;
}
end : php_request_shutdown ( NULL ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int user_cert_trusted_ca ( struct ssh * ssh , struct passwd * pw , struct sshkey * key , struct sshauthopt * * authoptsp ) {
char * ca_fp , * principals_file = NULL ;
const char * reason ;
struct sshauthopt * principals_opts = NULL , * cert_opts = NULL ;
struct sshauthopt * final_opts = NULL ;
int r , ret = 0 , found_principal = 0 , use_authorized_principals ;
if ( authoptsp != NULL ) * authoptsp = NULL ;
if ( ! sshkey_is_cert ( key ) || options . trusted_user_ca_keys == NULL ) return 0 ;
if ( ( ca_fp = sshkey_fingerprint ( key -> cert -> signature_key , options . fingerprint_hash , SSH_FP_DEFAULT ) ) == NULL ) return 0 ;
if ( ( r = sshkey_in_file ( key -> cert -> signature_key , options . trusted_user_ca_keys , 1 , 0 ) ) != 0 ) {
debug2 ( "%s: CA %s %s is not listed in %s: %s" , __func__ , sshkey_type ( key -> cert -> signature_key ) , ca_fp , options . trusted_user_ca_keys , ssh_err ( r ) ) ;
goto out ;
}
if ( ( principals_file = authorized_principals_file ( pw ) ) != NULL ) {
if ( match_principals_file ( ssh , pw , principals_file , key -> cert , & principals_opts ) ) found_principal = 1 ;
}
if ( ! found_principal && match_principals_command ( ssh , pw , key , & principals_opts ) ) found_principal = 1 ;
use_authorized_principals = principals_file != NULL || options . authorized_principals_command != NULL ;
if ( ! found_principal && use_authorized_principals ) {
reason = "Certificate does not contain an authorized principal" ;
goto fail_reason ;
}
if ( use_authorized_principals && principals_opts == NULL ) fatal ( "%s: internal error: missing principals_opts" , __func__ ) ;
if ( sshkey_cert_check_authority ( key , 0 , 1 , use_authorized_principals ? NULL : pw -> pw_name , & reason ) != 0 ) goto fail_reason ;
if ( ( cert_opts = sshauthopt_from_cert ( key ) ) == NULL ) {
reason = "Invalid certificate options" ;
goto fail_reason ;
}
if ( auth_authorise_keyopts ( ssh , pw , cert_opts , 0 , "cert" ) != 0 ) {
reason = "Refused by certificate options" ;
goto fail_reason ;
}
if ( principals_opts == NULL ) {
final_opts = cert_opts ;
cert_opts = NULL ;
}
else {
if ( auth_authorise_keyopts ( ssh , pw , principals_opts , 0 , "principals" ) != 0 ) {
reason = "Refused by certificate principals options" ;
goto fail_reason ;
}
if ( ( final_opts = sshauthopt_merge ( principals_opts , cert_opts , & reason ) ) == NULL ) {
fail_reason : error ( "%s" , reason ) ;
auth_debug_add ( "%s" , reason ) ;
goto out ;
}
}
verbose ( "Accepted certificate ID \"%s\" (serial %llu) signed by " "%s CA %s via %s" , key -> cert -> key_id , ( unsigned long long ) key -> cert -> serial , sshkey_type ( key -> cert -> signature_key ) , ca_fp , options . trusted_user_ca_keys ) ;
if ( authoptsp != NULL ) {
* authoptsp = final_opts ;
final_opts = NULL ;
}
ret = 1 ;
out : sshauthopt_free ( principals_opts ) ;
sshauthopt_free ( cert_opts ) ;
sshauthopt_free ( final_opts ) ;
free ( principals_file ) ;
free ( ca_fp ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void qemu_tcg_init_vcpu ( CPUState * cpu ) {
if ( ! tcg_cpu_thread ) {
cpu -> thread = g_malloc0 ( sizeof ( QemuThread ) ) ;
cpu -> halt_cond = g_malloc0 ( sizeof ( QemuCond ) ) ;
qemu_cond_init ( cpu -> halt_cond ) ;
tcg_halt_cond = cpu -> halt_cond ;
qemu_thread_create ( cpu -> thread , qemu_tcg_cpu_thread_fn , cpu , QEMU_THREAD_JOINABLE ) ;
# ifdef _WIN32 cpu -> hThread = qemu_thread_get_handle ( cpu -> thread ) ;
# endif while ( ! cpu -> created ) {
qemu_cond_wait ( & qemu_cpu_cond , & qemu_global_mutex ) ;
}
tcg_cpu_thread = cpu -> thread ;
}
else {
cpu -> thread = tcg_cpu_thread ;
cpu -> halt_cond = tcg_halt_cond ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void relocate_doit ( void * a ) {
struct relocate_args * args = ( struct relocate_args * ) a ;
_dl_relocate_object ( args -> l , args -> l -> l_scope , args -> reloc_mode , 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( BookmarkBubbleSignInDelegateTest , OnSignInLinkClicked ) {
ReplaceBlank ( browser ( ) ) ;
int starting_tab_count = browser ( ) -> tab_strip_model ( ) -> count ( ) ;
scoped_ptr < BookmarkBubbleDelegate > delegate ;
delegate . reset ( new BookmarkBubbleSignInDelegate ( browser ( ) ) ) ;
delegate -> OnSignInLinkClicked ( ) ;
if ( kHasProfileChooser ) {
EXPECT_TRUE ( ProfileChooserView : : IsShowing ( ) ) ;
EXPECT_EQ ( starting_tab_count , browser ( ) -> tab_strip_model ( ) -> count ( ) ) ;
}
else {
EXPECT_EQ ( starting_tab_count + 1 , browser ( ) -> tab_strip_model ( ) -> count ( ) ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int evdns_server_request_respond ( struct evdns_server_request * _req , int err ) {
struct server_request * req = TO_SERVER_REQUEST ( _req ) ;
struct evdns_server_port * port = req -> port ;
int r ;
if ( ! req -> response ) {
if ( ( r = evdns_server_request_format_response ( req , err ) ) < 0 ) return r ;
}
r = sendto ( port -> socket , req -> response , req -> response_len , 0 , ( struct sockaddr * ) & req -> addr , req -> addrlen ) ;
if ( r < 0 ) {
int sock_err = last_error ( port -> socket ) ;
if ( ! error_is_eagain ( sock_err ) ) return - 1 ;
if ( port -> pending_replies ) {
req -> prev_pending = port -> pending_replies -> prev_pending ;
req -> next_pending = port -> pending_replies ;
req -> prev_pending -> next_pending = req -> next_pending -> prev_pending = req ;
}
else {
req -> prev_pending = req -> next_pending = req ;
port -> pending_replies = req ;
port -> choked = 1 ;
( void ) event_del ( & port -> event ) ;
event_set ( & port -> event , port -> socket , ( port -> closing ? 0 : EV_READ ) | EV_WRITE | EV_PERSIST , server_port_ready_callback , port ) ;
if ( event_add ( & port -> event , NULL ) < 0 ) {
log ( EVDNS_LOG_WARN , "Error from libevent when adding event for DNS server" ) ;
}
}
return 1 ;
}
if ( server_request_free ( req ) ) return 0 ;
if ( port -> pending_replies ) server_port_flush ( port ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int matroska_aac_profile ( char * codec_id ) {
static const char * const aac_profiles [ ] = {
"MAIN" , "LC" , "SSR" }
;
int profile ;
for ( profile = 0 ;
profile < FF_ARRAY_ELEMS ( aac_profiles ) ;
profile ++ ) if ( strstr ( codec_id , aac_profiles [ profile ] ) ) break ;
return profile + 1 ;
} | 0False
|