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 parse_reset_branch ( const char * arg ) { struct branch * b ; b = lookup_branch ( arg ) ; if ( b ) { hashclr ( b -> sha1 ) ; hashclr ( b -> branch_tree . versions [ 0 ] . sha1 ) ; hashclr ( b -> branch_tree . versions [ 1 ] . sha1 ) ; if ( b -> branch_tree . tree ) { release_tree_content_recursive ( b -> branch_tree . tree ) ; b -> branch_tree . tree = NULL ; } } else b = new_branch ( arg ) ; read_next_command ( ) ; parse_from ( b ) ; if ( command_buf . len > 0 ) unread_command_buf = 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void bn_mul_comba8 ( BN_ULONG * r , BN_ULONG * a , BN_ULONG * b ) { BN_ULONG c1 , c2 , c3 ; c1 = 0 ; c2 = 0 ; c3 = 0 ; mul_add_c ( a [ 0 ] , b [ 0 ] , c1 , c2 , c3 ) ; r [ 0 ] = c1 ; c1 = 0 ; mul_add_c ( a [ 0 ] , b [ 1 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 1 ] , b [ 0 ] , c2 , c3 , c1 ) ; r [ 1 ] = c2 ; c2 = 0 ; mul_add_c ( a [ 2 ] , b [ 0 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 1 ] , b [ 1 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 0 ] , b [ 2 ] , c3 , c1 , c2 ) ; r [ 2 ] = c3 ; c3 = 0 ; mul_add_c ( a [ 0 ] , b [ 3 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 1 ] , b [ 2 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 2 ] , b [ 1 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 3 ] , b [ 0 ] , c1 , c2 , c3 ) ; r [ 3 ] = c1 ; c1 = 0 ; mul_add_c ( a [ 4 ] , b [ 0 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 3 ] , b [ 1 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 2 ] , b [ 2 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 1 ] , b [ 3 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 0 ] , b [ 4 ] , c2 , c3 , c1 ) ; r [ 4 ] = c2 ; c2 = 0 ; mul_add_c ( a [ 0 ] , b [ 5 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 1 ] , b [ 4 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 2 ] , b [ 3 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 3 ] , b [ 2 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 4 ] , b [ 1 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 5 ] , b [ 0 ] , c3 , c1 , c2 ) ; r [ 5 ] = c3 ; c3 = 0 ; mul_add_c ( a [ 6 ] , b [ 0 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 5 ] , b [ 1 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 4 ] , b [ 2 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 3 ] , b [ 3 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 2 ] , b [ 4 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 1 ] , b [ 5 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 0 ] , b [ 6 ] , c1 , c2 , c3 ) ; r [ 6 ] = c1 ; c1 = 0 ; mul_add_c ( a [ 0 ] , b [ 7 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 1 ] , b [ 6 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 2 ] , b [ 5 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 3 ] , b [ 4 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 4 ] , b [ 3 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 5 ] , b [ 2 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 6 ] , b [ 1 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 7 ] , b [ 0 ] , c2 , c3 , c1 ) ; r [ 7 ] = c2 ; c2 = 0 ; mul_add_c ( a [ 7 ] , b [ 1 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 6 ] , b [ 2 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 5 ] , b [ 3 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 4 ] , b [ 4 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 3 ] , b [ 5 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 2 ] , b [ 6 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 1 ] , b [ 7 ] , c3 , c1 , c2 ) ; r [ 8 ] = c3 ; c3 = 0 ; mul_add_c ( a [ 2 ] , b [ 7 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 3 ] , b [ 6 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 4 ] , b [ 5 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 5 ] , b [ 4 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 6 ] , b [ 3 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 7 ] , b [ 2 ] , c1 , c2 , c3 ) ; r [ 9 ] = c1 ; c1 = 0 ; mul_add_c ( a [ 7 ] , b [ 3 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 6 ] , b [ 4 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 5 ] , b [ 5 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 4 ] , b [ 6 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 3 ] , b [ 7 ] , c2 , c3 , c1 ) ; r [ 10 ] = c2 ; c2 = 0 ; mul_add_c ( a [ 4 ] , b [ 7 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 5 ] , b [ 6 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 6 ] , b [ 5 ] , c3 , c1 , c2 ) ; mul_add_c ( a [ 7 ] , b [ 4 ] , c3 , c1 , c2 ) ; r [ 11 ] = c3 ; c3 = 0 ; mul_add_c ( a [ 7 ] , b [ 5 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 6 ] , b [ 6 ] , c1 , c2 , c3 ) ; mul_add_c ( a [ 5 ] , b [ 7 ] , c1 , c2 , c3 ) ; r [ 12 ] = c1 ; c1 = 0 ; mul_add_c ( a [ 6 ] , b [ 7 ] , c2 , c3 , c1 ) ; mul_add_c ( a [ 7 ] , b [ 6 ] , c2 , c3 , c1 ) ; r [ 13 ] = c2 ; c2 = 0 ; mul_add_c ( a [ 7 ] , b [ 7 ] , c3 , c1 , c2 ) ; r [ 14 ] = c3 ; r [ 15 ] = c1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void pdf_run_Tr ( fz_context * ctx , pdf_processor * proc , int render ) { pdf_run_processor * pr = ( pdf_run_processor * ) proc ; pdf_gstate * gstate = pr -> gstate + pr -> gtop ; gstate -> text . render = render ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
guint16 de_mid ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo , guint32 offset , guint len , gchar * add_string , int string_len ) { guint8 oct ; guint32 curr_offset ; guint32 value ; gboolean odd ; const gchar * digit_str ; proto_item * ti ; curr_offset = offset ; oct = tvb_get_guint8 ( tvb , curr_offset ) ; switch ( oct & 0x07 ) { case 0 : proto_tree_add_item ( tree , hf_gsm_a_unused , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_gsm_a_odd_even_ind , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_gsm_a_mobile_identity_type , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; if ( add_string ) g_snprintf ( add_string , string_len , " - No Identity Code" ) ; curr_offset ++ ; if ( len > 1 ) { expert_add_info ( pinfo , tree , & ei_gsm_a_format_not_supported ) ; } curr_offset += len - 1 ; break ; case 3 : case 1 : odd = oct & 0x08 ; proto_tree_add_item ( tree , hf_gsm_a_id_dig_1 , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_gsm_a_odd_even_ind , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_gsm_a_mobile_identity_type , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; if ( ( oct & 0x07 ) == 3 ) { digit_str = tvb_bcd_dig_to_wmem_packet_str ( tvb , curr_offset , len - ( curr_offset - offset ) , NULL , TRUE ) ; proto_tree_add_string_format ( tree , hf_gsm_a_imeisv , tvb , curr_offset , len - ( curr_offset - offset ) , digit_str , "BCD Digits: %s" , digit_str ) ; } else { digit_str = dissect_e212_imsi ( tvb , pinfo , tree , curr_offset , len - ( curr_offset - offset ) , TRUE ) ; } if ( sccp_assoc && ! sccp_assoc -> calling_party ) { sccp_assoc -> calling_party = wmem_strdup_printf ( wmem_file_scope ( ) , ( ( oct & 0x07 ) == 3 ) ? "IMEISV: %s" : "IMSI: %s" , digit_str ) ; } if ( add_string ) g_snprintf ( add_string , string_len , " - %s (%s)" , ( ( oct & 0x07 ) == 3 ) ? "IMEISV" : "IMSI" , digit_str ) ; curr_offset += len - ( curr_offset - offset ) ; if ( ! odd ) { proto_tree_add_item ( tree , hf_gsm_a_filler , tvb , curr_offset - 1 , 1 , ENC_NA ) ; } break ; case 2 : proto_tree_add_uint_format_value ( tree , hf_gsm_a_identity_digit1 , tvb , curr_offset , 1 , oct , "%c" , Dgt1_9_bcd . out [ ( oct & 0xf0 ) >> 4 ] ) ; proto_tree_add_item ( tree , hf_gsm_a_odd_even_ind , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_gsm_a_mobile_identity_type , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; if ( curr_offset - offset >= len ) return ( curr_offset - offset ) ; digit_str = tvb_bcd_dig_to_wmem_packet_str ( tvb , curr_offset , len - ( curr_offset - offset ) , NULL , TRUE ) ; proto_tree_add_string_format ( tree , hf_gsm_a_imei , tvb , curr_offset , len - ( curr_offset - offset ) , digit_str , "BCD Digits: %s" , digit_str ) ; if ( add_string ) g_snprintf ( add_string , string_len , " - IMEI (%s)" , digit_str ) ; curr_offset += len - ( curr_offset - offset ) ; break ; case 4 : proto_tree_add_item ( tree , hf_gsm_a_unused , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_gsm_a_odd_even_ind , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_gsm_a_mobile_identity_type , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; curr_offset ++ ; value = tvb_get_ntohl ( tvb , curr_offset ) ; proto_tree_add_uint ( tree , hf_gsm_a_tmsi , tvb , curr_offset , 4 , value ) ; if ( add_string ) g_snprintf ( add_string , string_len , " - TMSI/P-TMSI (0x%04x)" , value ) ; curr_offset += 4 ; break ; case 5 : proto_tree_add_bits_item ( tree , hf_gsm_a_spare_bits , tvb , curr_offset << 3 , 2 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_gsm_a_mbs_ses_id_ind , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_gsm_a_tmgi_mcc_mnc_ind , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_gsm_a_odd_even_ind , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_gsm_a_mobile_identity_type , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; curr_offset ++ ; proto_tree_add_item ( tree , hf_gsm_a_mbs_service_id , tvb , curr_offset , 3 , ENC_BIG_ENDIAN ) ; curr_offset += 3 ; if ( ( oct & 0x10 ) == 0x10 ) { curr_offset = dissect_e212_mcc_mnc ( tvb , pinfo , tree , curr_offset , E212_NONE , TRUE ) ; } if ( ( oct & 0x20 ) == 0x20 ) { proto_tree_add_item ( tree , hf_gsm_a_mbs_session_id , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; curr_offset ++ ; } break ; default : proto_tree_add_item ( tree , hf_gsm_a_odd_even_ind , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; ti = proto_tree_add_item ( tree , hf_gsm_a_mobile_identity_type , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ; expert_add_info_format ( pinfo , ti , & ei_gsm_a_mobile_identity_type , "Unknown format %u" , ( oct & 0x07 ) ) ; if ( add_string ) g_snprintf ( add_string , string_len , " - Format Unknown" ) ; curr_offset += len ; break ; } EXTRANEOUS_DATA_CHECK ( len , curr_offset - offset , pinfo , & ei_gsm_a_extraneous_data ) ; return ( curr_offset - offset ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_bug9478 ( ) { MYSQL_STMT * stmt ; MYSQL_BIND my_bind [ 1 ] ; char a [ 6 ] ; ulong a_len ; int rc , i ; DBUG_ENTER ( "test_bug9478" ) ; myheader ( "test_bug9478" ) ; mysql_query ( mysql , "drop table if exists t1" ) ; mysql_query ( mysql , "create table t1 (id integer not null primary key, " " name varchar(20) not null)" ) ; rc = mysql_query ( mysql , "insert into t1 (id, name) values " " (1, 'aaa'), (2, 'bbb'), (3, 'ccc')" ) ; myquery ( rc ) ; stmt = open_cursor ( "select name from t1 where id=2" ) ; memset ( my_bind , 0 , sizeof ( my_bind ) ) ; my_bind [ 0 ] . buffer_type = MYSQL_TYPE_STRING ; my_bind [ 0 ] . buffer = ( char * ) a ; my_bind [ 0 ] . buffer_length = sizeof ( a ) ; my_bind [ 0 ] . length = & a_len ; mysql_stmt_bind_result ( stmt , my_bind ) ; for ( i = 0 ; i < 5 ; i ++ ) { rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; rc = mysql_stmt_fetch ( stmt ) ; check_execute ( stmt , rc ) ; if ( ! opt_silent && i == 0 ) printf ( "Fetched row: %s\n" , a ) ; rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; rc = mysql_stmt_fetch ( stmt ) ; check_execute ( stmt , rc ) ; if ( ! opt_silent && i == 0 ) printf ( "Fetched row: %s\n" , a ) ; rc = mysql_stmt_fetch ( stmt ) ; DIE_UNLESS ( rc == MYSQL_NO_DATA ) ; { char buff [ 8 ] ; int4store ( buff , stmt -> stmt_id ) ; buff [ 4 ] = 1 ; rc = ( ( * mysql -> methods -> advanced_command ) ( mysql , COM_STMT_FETCH , ( uchar * ) buff , sizeof ( buff ) , 0 , 0 , 1 , NULL ) || ( * mysql -> methods -> read_query_result ) ( mysql ) ) ; DIE_UNLESS ( rc ) ; if ( ! opt_silent && i == 0 ) printf ( "Got error (as expected): %s\n" , mysql_error ( mysql ) ) ; } rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; rc = mysql_stmt_fetch ( stmt ) ; check_execute ( stmt , rc ) ; if ( ! opt_silent && i == 0 ) printf ( "Fetched row: %s\n" , a ) ; rc = mysql_stmt_reset ( stmt ) ; check_execute ( stmt , rc ) ; rc = mysql_stmt_fetch ( stmt ) ; DIE_UNLESS ( rc && mysql_stmt_errno ( stmt ) ) ; if ( ! opt_silent && i == 0 ) printf ( "Got error (as expected): %s\n" , mysql_stmt_error ( stmt ) ) ; } rc = mysql_stmt_close ( stmt ) ; DIE_UNLESS ( rc == 0 ) ; stmt = open_cursor ( "select name from t1" ) ; mysql_stmt_bind_result ( stmt , my_bind ) ; for ( i = 0 ; i < 5 ; i ++ ) { DBUG_PRINT ( "loop" , ( "i: %d" , i ) ) ; rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; rc = mysql_stmt_fetch ( stmt ) ; check_execute ( stmt , rc ) ; if ( ! opt_silent && i == 0 ) printf ( "Fetched row: %s\n" , a ) ; rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; while ( ! ( rc = mysql_stmt_fetch ( stmt ) ) ) { if ( ! opt_silent && i == 0 ) printf ( "Fetched row: %s\n" , a ) ; } DIE_UNLESS ( rc == MYSQL_NO_DATA ) ; rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; rc = mysql_stmt_fetch ( stmt ) ; check_execute ( stmt , rc ) ; if ( ! opt_silent && i == 0 ) printf ( "Fetched row: %s\n" , a ) ; rc = mysql_stmt_reset ( stmt ) ; check_execute ( stmt , rc ) ; rc = mysql_stmt_fetch ( stmt ) ; DIE_UNLESS ( rc && mysql_stmt_errno ( stmt ) ) ; if ( ! opt_silent && i == 0 ) printf ( "Got error (as expected): %s\n" , mysql_stmt_error ( stmt ) ) ; } rc = mysql_stmt_close ( stmt ) ; DIE_UNLESS ( rc == 0 ) ; rc = mysql_query ( mysql , "drop table t1" ) ; myquery ( rc ) ; DBUG_VOID_RETURN ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static uint8_t pfkey_proto_to_xfrm ( uint8_t proto ) { return proto == IPSEC_PROTO_ANY ? 0 : proto ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static CURLcode glob_fixed ( URLGlob * glob , char * fixed , size_t len ) { URLPattern * pat = & glob -> pattern [ glob -> size ] ; pat -> type = UPTSet ; pat -> content . Set . size = 1 ; pat -> content . Set . ptr_s = 0 ; pat -> globindex = - 1 ; pat -> content . Set . elements = malloc ( sizeof ( char * ) ) ; if ( ! pat -> content . Set . elements ) return GLOBERROR ( "out of memory" , 0 , CURLE_OUT_OF_MEMORY ) ; pat -> content . Set . elements [ 0 ] = malloc ( len + 1 ) ; if ( ! pat -> content . Set . elements [ 0 ] ) return GLOBERROR ( "out of memory" , 0 , CURLE_OUT_OF_MEMORY ) ; memcpy ( pat -> content . Set . elements [ 0 ] , fixed , len ) ; pat -> content . Set . elements [ 0 ] [ len ] = 0 ; return CURLE_OK ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void buildtablestructures ( struct alltabs * at , SplineFont * sf , enum fontformat format ) { int i ; int ebdtpos , eblcpos ; struct ttf_table * tab ; if ( format == ff_otf || format == ff_otfcid ) { at -> tabdir . version = CHR ( 'O' , 'T' , 'T' , 'O' ) ; # ifdef FONTFORGE_CONFIG_APPLE_ONLY_TTF } else if ( at -> applemode && ! at -> opentypemode ) { at -> tabdir . version = CHR ( 't' , 'r' , 'u' , 'e' ) ; # endif } else { at -> tabdir . version = 0x00010000 ; } i = 0 ; if ( at -> base != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'B' , 'A' , 'S' , 'E' ) ; at -> tabdir . tabs [ i ] . data = at -> base ; at -> tabdir . tabs [ i ++ ] . length = at -> baselen ; } if ( at -> bsln != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'b' , 's' , 'l' , 'n' ) ; at -> tabdir . tabs [ i ] . data = at -> bsln ; at -> tabdir . tabs [ i ++ ] . length = at -> bslnlen ; } if ( at -> bdf != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'B' , 'D' , 'F' , ' ' ) ; at -> tabdir . tabs [ i ] . data = at -> bdf ; at -> tabdir . tabs [ i ++ ] . length = at -> bdflen ; } if ( format == ff_otf || format == ff_otfcid ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'C' , 'F' , 'F' , ' ' ) ; at -> tabdir . tabs [ i ] . length = at -> cfflen ; at -> tabdir . tabs [ i ++ ] . data = at -> cfff ; } if ( at -> dsigf != NULL ) { ebdtpos = i ; at -> tabdir . tabs [ i ] . tag = CHR ( 'D' , 'S' , 'I' , 'G' ) ; at -> tabdir . tabs [ i ] . length = at -> dsiglen ; at -> tabdir . tabs [ i ++ ] . data = at -> dsigf ; } if ( at -> bdat != NULL && ( at -> msbitmaps || at -> otbbitmaps ) ) { ebdtpos = i ; at -> tabdir . tabs [ i ] . tag = CHR ( 'E' , 'B' , 'D' , 'T' ) ; at -> tabdir . tabs [ i ] . length = at -> bdatlen ; at -> tabdir . tabs [ i ++ ] . data = at -> bdat ; } if ( at -> bloc != NULL && ( at -> msbitmaps || at -> otbbitmaps ) ) { eblcpos = i ; at -> tabdir . tabs [ i ] . tag = CHR ( 'E' , 'B' , 'L' , 'C' ) ; at -> tabdir . tabs [ i ] . data = at -> bloc ; at -> tabdir . tabs [ i ++ ] . length = at -> bloclen ; } if ( at -> ebsc != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'E' , 'B' , 'S' , 'C' ) ; at -> tabdir . tabs [ i ] . data = at -> ebsc ; at -> tabdir . tabs [ i ++ ] . length = at -> ebsclen ; } if ( at -> fftmf != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'F' , 'F' , 'T' , 'M' ) ; at -> tabdir . tabs [ i ] . data = at -> fftmf ; at -> tabdir . tabs [ i ++ ] . length = at -> fftmlen ; } if ( at -> gdef != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'G' , 'D' , 'E' , 'F' ) ; at -> tabdir . tabs [ i ] . data = at -> gdef ; at -> tabdir . tabs [ i ++ ] . length = at -> gdeflen ; } if ( at -> gpos != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'G' , 'P' , 'O' , 'S' ) ; at -> tabdir . tabs [ i ] . data = at -> gpos ; at -> tabdir . tabs [ i ++ ] . length = at -> gposlen ; } if ( at -> gsub != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'G' , 'S' , 'U' , 'B' ) ; at -> tabdir . tabs [ i ] . data = at -> gsub ; at -> tabdir . tabs [ i ++ ] . length = at -> gsublen ; } if ( at -> jstf != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'J' , 'S' , 'T' , 'F' ) ; at -> tabdir . tabs [ i ] . data = at -> jstf ; at -> tabdir . tabs [ i ++ ] . length = at -> jstflen ; } if ( at -> os2f != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'O' , 'S' , '/' , '2' ) ; at -> tabdir . tabs [ i ] . data = at -> os2f ; at -> tabdir . tabs [ i ++ ] . length = at -> os2len ; } if ( at -> pfed != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'P' , 'f' , 'E' , 'd' ) ; at -> tabdir . tabs [ i ] . data = at -> pfed ; at -> tabdir . tabs [ i ++ ] . length = at -> pfedlen ; } if ( at -> tex != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'T' , 'e' , 'X' , ' ' ) ; at -> tabdir . tabs [ i ] . data = at -> tex ; at -> tabdir . tabs [ i ++ ] . length = at -> texlen ; } if ( at -> math != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'M' , 'A' , 'T' , 'H' ) ; at -> tabdir . tabs [ i ] . data = at -> math ; at -> tabdir . tabs [ i ++ ] . length = at -> mathlen ; } if ( at -> vorgf != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'V' , 'O' , 'R' , 'G' ) ; at -> tabdir . tabs [ i ] . data = at -> vorgf ; at -> tabdir . tabs [ i ++ ] . length = at -> vorglen ; } if ( at -> acnt != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'a' , 'c' , 'n' , 't' ) ; at -> tabdir . tabs [ i ] . data = at -> acnt ; at -> tabdir . tabs [ i ++ ] . length = at -> acntlen ; } if ( at -> bdat != NULL && at -> applebitmaps ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'b' , 'd' , 'a' , 't' ) ; if ( ! at -> msbitmaps ) { at -> tabdir . tabs [ i ] . data = at -> bdat ; at -> tabdir . tabs [ i ++ ] . length = at -> bdatlen ; } else { at -> tabdir . tabs [ i ] . data = NULL ; at -> tabdir . tabs [ i ] . dup_of = ebdtpos ; at -> tabdir . tabs [ i ++ ] . length = at -> tabdir . tabs [ ebdtpos ] . length ; } } if ( format == ff_none && at -> applebitmaps ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'b' , 'h' , 'e' , 'd' ) ; at -> tabdir . tabs [ i ] . data = at -> headf ; at -> tabdir . tabs [ i ++ ] . length = at -> headlen ; } if ( at -> bloc != NULL && at -> applebitmaps ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'b' , 'l' , 'o' , 'c' ) ; if ( ! at -> msbitmaps ) { at -> tabdir . tabs [ i ] . data = at -> bloc ; at -> tabdir . tabs [ i ++ ] . length = at -> bloclen ; } else { at -> tabdir . tabs [ i ] . data = NULL ; at -> tabdir . tabs [ i ] . dup_of = eblcpos ; at -> tabdir . tabs [ i ++ ] . length = at -> tabdir . tabs [ eblcpos ] . length ; } } if ( at -> cmap != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'c' , 'm' , 'a' , 'p' ) ; at -> tabdir . tabs [ i ] . data = at -> cmap ; at -> tabdir . tabs [ i ++ ] . length = at -> cmaplen ; } if ( format != ff_otf && format != ff_otfcid && format != ff_none ) { if ( at -> cvtf != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'c' , 'v' , 't' , ' ' ) ; at -> tabdir . tabs [ i ] . data = at -> cvtf ; at -> tabdir . tabs [ i ++ ] . length = at -> cvtlen ; } } if ( at -> feat != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'f' , 'e' , 'a' , 't' ) ; at -> tabdir . tabs [ i ] . data = at -> feat ; at -> tabdir . tabs [ i ++ ] . length = at -> featlen ; } if ( at -> fpgmf != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'f' , 'p' , 'g' , 'm' ) ; at -> tabdir . tabs [ i ] . data = at -> fpgmf ; at -> tabdir . tabs [ i ++ ] . length = at -> fpgmlen ; } if ( at -> gaspf != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'g' , 'a' , 's' , 'p' ) ; at -> tabdir . tabs [ i ] . data = at -> gaspf ; at -> tabdir . tabs [ i ++ ] . length = at -> gasplen ; } if ( at -> gi . glyphs != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'g' , 'l' , 'y' , 'f' ) ; at -> tabdir . tabs [ i ] . data = at -> gi . glyphs ; at -> tabdir . tabs [ i ++ ] . length = at -> gi . glyph_len ; } if ( at -> hdmxf != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'h' , 'd' , 'm' , 'x' ) ; at -> tabdir . tabs [ i ] . data = at -> hdmxf ; at -> tabdir . tabs [ i ++ ] . length = at -> hdmxlen ; } if ( format != ff_none || ! at -> applebitmaps ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'h' , 'e' , 'a' , 'd' ) ; at -> tabdir . tabs [ i ] . data = at -> headf ; at -> tabdir . tabs [ i ++ ] . length = at -> headlen ; } if ( format != ff_none || ! at -> applemode ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'h' , 'h' , 'e' , 'a' ) ; at -> tabdir . tabs [ i ] . data = at -> hheadf ; at -> tabdir . tabs [ i ++ ] . length = at -> hheadlen ; } else if ( at -> hheadf != NULL ) { fclose ( at -> hheadf ) ; at -> hheadf = NULL ; } if ( format != ff_none || ! at -> applemode ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'h' , 'm' , 't' , 'x' ) ; at -> tabdir . tabs [ i ] . data = at -> gi . hmtx ; at -> tabdir . tabs [ i ++ ] . length = at -> gi . hmtxlen ; } if ( at -> kern != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'k' , 'e' , 'r' , 'n' ) ; at -> tabdir . tabs [ i ] . data = at -> kern ; at -> tabdir . tabs [ i ++ ] . length = at -> kernlen ; } if ( at -> lcar != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'l' , 'c' , 'a' , 'r' ) ; at -> tabdir . tabs [ i ] . data = at -> lcar ; at -> tabdir . tabs [ i ++ ] . length = at -> lcarlen ; } if ( at -> loca != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'l' , 'o' , 'c' , 'a' ) ; at -> tabdir . tabs [ i ] . data = at -> loca ; at -> tabdir . tabs [ i ++ ] . length = at -> localen ; } at -> tabdir . tabs [ i ] . tag = CHR ( 'm' , 'a' , 'x' , 'p' ) ; at -> tabdir . tabs [ i ] . data = at -> maxpf ; at -> tabdir . tabs [ i ++ ] . length = at -> maxplen ; if ( at -> morx != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'm' , 'o' , 'r' , 'x' ) ; at -> tabdir . tabs [ i ] . data = at -> morx ; at -> tabdir . tabs [ i ++ ] . length = at -> morxlen ; } if ( at -> name != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'n' , 'a' , 'm' , 'e' ) ; at -> tabdir . tabs [ i ] . data = at -> name ; at -> tabdir . tabs [ i ++ ] . length = at -> namelen ; } if ( at -> opbd != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'o' , 'p' , 'b' , 'd' ) ; at -> tabdir . tabs [ i ] . data = at -> opbd ; at -> tabdir . tabs [ i ++ ] . length = at -> opbdlen ; } if ( at -> post != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'p' , 'o' , 's' , 't' ) ; at -> tabdir . tabs [ i ] . data = at -> post ; at -> tabdir . tabs [ i ++ ] . length = at -> postlen ; } if ( format != ff_otf && format != ff_otfcid && format != ff_none ) { if ( at -> prepf != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'p' , 'r' , 'e' , 'p' ) ; at -> tabdir . tabs [ i ] . data = at -> prepf ; at -> tabdir . tabs [ i ++ ] . length = at -> preplen ; } } if ( at -> prop != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'p' , 'r' , 'o' , 'p' ) ; at -> tabdir . tabs [ i ] . data = at -> prop ; at -> tabdir . tabs [ i ++ ] . length = at -> proplen ; } if ( at -> vheadf != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'v' , 'h' , 'e' , 'a' ) ; at -> tabdir . tabs [ i ] . data = at -> vheadf ; at -> tabdir . tabs [ i ++ ] . length = at -> vheadlen ; at -> tabdir . tabs [ i ] . tag = CHR ( 'v' , 'm' , 't' , 'x' ) ; at -> tabdir . tabs [ i ] . data = at -> gi . vmtx ; at -> tabdir . tabs [ i ++ ] . length = at -> gi . vmtxlen ; } if ( at -> fvar != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'f' , 'v' , 'a' , 'r' ) ; at -> tabdir . tabs [ i ] . data = at -> fvar ; at -> tabdir . tabs [ i ++ ] . length = at -> fvarlen ; } if ( at -> gvar != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'g' , 'v' , 'a' , 'r' ) ; at -> tabdir . tabs [ i ] . data = at -> gvar ; at -> tabdir . tabs [ i ++ ] . length = at -> gvarlen ; } if ( at -> cvar != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'c' , 'v' , 'a' , 'r' ) ; at -> tabdir . tabs [ i ] . data = at -> cvar ; at -> tabdir . tabs [ i ++ ] . length = at -> cvarlen ; } if ( at -> avar != NULL ) { at -> tabdir . tabs [ i ] . tag = CHR ( 'a' , 'v' , 'a' , 'r' ) ; at -> tabdir . tabs [ i ] . data = at -> avar ; at -> tabdir . tabs [ i ++ ] . length = at -> avarlen ; } if ( i >= MAX_TAB ) IError ( "Miscalculation of number of tables needed. Up sizeof tabs array in struct tabdir in ttf.h" ) ; for ( tab = sf -> ttf_tab_saved ; tab != NULL && i < MAX_TAB ; tab = tab -> next ) { at -> tabdir . tabs [ i ] . tag = tab -> tag ; at -> tabdir . tabs [ i ] . data = tab -> temp ; at -> tabdir . tabs [ i ++ ] . length = tab -> len ; } if ( tab != NULL ) IError ( "Some user supplied tables omitted. Up sizeof tabs array in struct tabdir in ttf.h" ) ; at -> tabdir . numtab = i ; at -> tabdir . searchRange = ( i < 16 ? 8 : i < 32 ? 16 : i < 64 ? 32 : 64 ) * 16 ; at -> tabdir . entrySel = ( i < 16 ? 3 : i < 32 ? 4 : i < 64 ? 5 : 6 ) ; at -> tabdir . rangeShift = at -> tabdir . numtab * 16 - at -> tabdir . searchRange ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static uint64_t pxa2xx_cm_read ( void * opaque , hwaddr addr , unsigned size ) { PXA2xxState * s = ( PXA2xxState * ) opaque ; switch ( addr ) { case CCCR : case CKEN : case OSCC : return s -> cm_regs [ addr >> 2 ] ; case CCSR : return s -> cm_regs [ CCCR >> 2 ] | ( 3 << 28 ) ; default : printf ( "%s: Bad register " REG_FMT "\n" , __FUNCTION__ , addr ) ; break ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static Cost other_operands_eval_cost ( PlannerInfo * root , List * qinfos ) { Cost qual_arg_cost = 0 ; ListCell * lc ; foreach ( lc , qinfos ) { IndexQualInfo * qinfo = ( IndexQualInfo * ) lfirst ( lc ) ; QualCost index_qual_cost ; cost_qual_eval_node ( & index_qual_cost , qinfo -> other_operand , root ) ; qual_arg_cost += index_qual_cost . startup + index_qual_cost . per_tuple ; } return qual_arg_cost ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gchar * qio_channel_websock_date_str ( void ) { struct tm tm ; time_t now = time ( NULL ) ; char datebuf [ 128 ] ; gmtime_r ( & now , & tm ) ; strftime ( datebuf , sizeof ( datebuf ) , "%a, %d %b %Y %H:%M:%S GMT" , & tm ) ; return g_strdup ( datebuf ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_rsl_ie_ch_desc ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset , gboolean is_mandatory ) { proto_item * ti ; proto_tree * ie_tree ; guint length ; guint8 ie_id ; if ( is_mandatory == FALSE ) { ie_id = tvb_get_guint8 ( tvb , offset ) ; if ( ie_id != RSL_IE_CH_DESC ) return offset ; } ie_tree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_ie_ch_desc , & ti , "Channel description IE" ) ; proto_tree_add_item ( ie_tree , hf_rsl_ie_id , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; length = tvb_get_guint8 ( tvb , offset ) ; proto_item_set_len ( ti , length + 2 ) ; proto_tree_add_item ( ie_tree , hf_rsl_ie_length , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; proto_tree_add_item ( ie_tree , hf_rsl_group_channel_description , tvb , offset , length , ENC_NA ) ; offset = offset + length ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static TRBCCode xhci_evaluate_slot ( XHCIState * xhci , unsigned int slotid , uint64_t pictx ) { dma_addr_t ictx , octx ; uint32_t ictl_ctx [ 2 ] ; uint32_t iep0_ctx [ 5 ] ; uint32_t ep0_ctx [ 5 ] ; uint32_t islot_ctx [ 4 ] ; uint32_t slot_ctx [ 4 ] ; trace_usb_xhci_slot_evaluate ( slotid ) ; assert ( slotid >= 1 && slotid <= xhci -> numslots ) ; ictx = xhci_mask64 ( pictx ) ; octx = xhci -> slots [ slotid - 1 ] . ctx ; DPRINTF ( "xhci: input context at " DMA_ADDR_FMT "\n" , ictx ) ; DPRINTF ( "xhci: output context at " DMA_ADDR_FMT "\n" , octx ) ; xhci_dma_read_u32s ( xhci , ictx , ictl_ctx , sizeof ( ictl_ctx ) ) ; if ( ictl_ctx [ 0 ] != 0x0 || ictl_ctx [ 1 ] & ~ 0x3 ) { DPRINTF ( "xhci: invalid input context control %08x %08x\n" , ictl_ctx [ 0 ] , ictl_ctx [ 1 ] ) ; return CC_TRB_ERROR ; } if ( ictl_ctx [ 1 ] & 0x1 ) { xhci_dma_read_u32s ( xhci , ictx + 32 , islot_ctx , sizeof ( islot_ctx ) ) ; DPRINTF ( "xhci: input slot context: %08x %08x %08x %08x\n" , islot_ctx [ 0 ] , islot_ctx [ 1 ] , islot_ctx [ 2 ] , islot_ctx [ 3 ] ) ; xhci_dma_read_u32s ( xhci , octx , slot_ctx , sizeof ( slot_ctx ) ) ; slot_ctx [ 1 ] &= ~ 0xFFFF ; slot_ctx [ 1 ] |= islot_ctx [ 1 ] & 0xFFFF ; slot_ctx [ 2 ] &= ~ 0xFF00000 ; slot_ctx [ 2 ] |= islot_ctx [ 2 ] & 0xFF000000 ; DPRINTF ( "xhci: output slot context: %08x %08x %08x %08x\n" , slot_ctx [ 0 ] , slot_ctx [ 1 ] , slot_ctx [ 2 ] , slot_ctx [ 3 ] ) ; xhci_dma_write_u32s ( xhci , octx , slot_ctx , sizeof ( slot_ctx ) ) ; } if ( ictl_ctx [ 1 ] & 0x2 ) { xhci_dma_read_u32s ( xhci , ictx + 64 , iep0_ctx , sizeof ( iep0_ctx ) ) ; DPRINTF ( "xhci: input ep0 context: %08x %08x %08x %08x %08x\n" , iep0_ctx [ 0 ] , iep0_ctx [ 1 ] , iep0_ctx [ 2 ] , iep0_ctx [ 3 ] , iep0_ctx [ 4 ] ) ; xhci_dma_read_u32s ( xhci , octx + 32 , ep0_ctx , sizeof ( ep0_ctx ) ) ; ep0_ctx [ 1 ] &= ~ 0xFFFF0000 ; ep0_ctx [ 1 ] |= iep0_ctx [ 1 ] & 0xFFFF0000 ; DPRINTF ( "xhci: output ep0 context: %08x %08x %08x %08x %08x\n" , ep0_ctx [ 0 ] , ep0_ctx [ 1 ] , ep0_ctx [ 2 ] , ep0_ctx [ 3 ] , ep0_ctx [ 4 ] ) ; xhci_dma_write_u32s ( xhci , octx + 32 , ep0_ctx , sizeof ( ep0_ctx ) ) ; } return CC_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int TSAcceptorIDGet ( TSAcceptor acceptor ) { NetAccept * na = reinterpret_cast < NetAccept * > ( acceptor ) ; return na ? na -> id : - 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static char * create_delimiter ( char * query , char * delimiter_buff , int delimiter_max_size ) { int proposed_length ; char * presence ; delimiter_buff [ 0 ] = '; ' ; for ( proposed_length = 2 ; proposed_length < delimiter_max_size ; delimiter_max_size ++ ) { delimiter_buff [ proposed_length - 1 ] = '; ' ; delimiter_buff [ proposed_length ] = '\0' ; presence = strstr ( query , delimiter_buff ) ; if ( presence == NULL ) { return delimiter_buff ; } } return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
const char * TSHttpServerStateNameLookup ( TSServerState state ) { return HttpDebugNames : : get_server_state_name ( static_cast < HttpTransact : : ServerState_t > ( state ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int selinux_binder_transaction ( struct task_struct * from , struct task_struct * to ) { u32 mysid = current_sid ( ) ; u32 fromsid = task_sid ( from ) ; u32 tosid = task_sid ( to ) ; int rc ; if ( mysid != fromsid ) { rc = avc_has_perm ( mysid , fromsid , SECCLASS_BINDER , BINDER__IMPERSONATE , NULL ) ; if ( rc ) return rc ; } return avc_has_perm ( fromsid , tosid , SECCLASS_BINDER , BINDER__CALL , NULL ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void PNGAPI png_set_pHYs ( png_structp png_ptr , png_infop info_ptr , png_uint_32 res_x , png_uint_32 res_y , int unit_type ) { png_debug1 ( 1 , "in %s storage function" , "pHYs" ) ; if ( png_ptr == NULL || info_ptr == NULL ) return ; info_ptr -> x_pixels_per_unit = res_x ; info_ptr -> y_pixels_per_unit = res_y ; info_ptr -> phys_unit_type = ( png_byte ) unit_type ; info_ptr -> valid |= PNG_INFO_pHYs ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static bool contain_leaked_vars_walker ( Node * node , void * context ) { if ( node == NULL ) return false ; switch ( nodeTag ( node ) ) { case T_Var : case T_Const : case T_Param : case T_ArrayRef : case T_ArrayExpr : case T_FieldSelect : case T_FieldStore : case T_NamedArgExpr : case T_BoolExpr : case T_RelabelType : case T_CollateExpr : case T_CaseExpr : case T_CaseTestExpr : case T_RowExpr : case T_MinMaxExpr : case T_NullTest : case T_BooleanTest : case T_List : break ; case T_FuncExpr : case T_OpExpr : case T_DistinctExpr : case T_NullIfExpr : case T_ScalarArrayOpExpr : case T_CoerceViaIO : case T_ArrayCoerceExpr : if ( check_functions_in_node ( node , contain_leaked_vars_checker , context ) && contain_var_clause ( node ) ) return true ; break ; case T_RowCompareExpr : { RowCompareExpr * rcexpr = ( RowCompareExpr * ) node ; ListCell * opid ; ListCell * larg ; ListCell * rarg ; forthree ( opid , rcexpr -> opnos , larg , rcexpr -> largs , rarg , rcexpr -> rargs ) { Oid funcid = get_opcode ( lfirst_oid ( opid ) ) ; if ( ! get_func_leakproof ( funcid ) && ( contain_var_clause ( ( Node * ) lfirst ( larg ) ) || contain_var_clause ( ( Node * ) lfirst ( rarg ) ) ) ) return true ; } } break ; case T_CurrentOfExpr : return false ; default : return true ; } return expression_tree_walker ( node , contain_leaked_vars_walker , context ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int sb_finish_set_opts ( struct super_block * sb ) { struct superblock_security_struct * sbsec = sb -> s_security ; struct dentry * root = sb -> s_root ; struct inode * root_inode = d_backing_inode ( root ) ; int rc = 0 ; if ( sbsec -> behavior == SECURITY_FS_USE_XATTR ) { if ( ! ( root_inode -> i_opflags & IOP_XATTR ) ) { printk ( KERN_WARNING "SELinux: (dev %s, type %s) has no " "xattr support\n" , sb -> s_id , sb -> s_type -> name ) ; rc = - EOPNOTSUPP ; goto out ; } rc = __vfs_getxattr ( root , root_inode , XATTR_NAME_SELINUX , NULL , 0 ) ; if ( rc < 0 && rc != - ENODATA ) { if ( rc == - EOPNOTSUPP ) printk ( KERN_WARNING "SELinux: (dev %s, type " "%s) has no security xattr handler\n" , sb -> s_id , sb -> s_type -> name ) ; else printk ( KERN_WARNING "SELinux: (dev %s, type " "%s) getxattr errno %d\n" , sb -> s_id , sb -> s_type -> name , - rc ) ; goto out ; } } if ( sbsec -> behavior > ARRAY_SIZE ( labeling_behaviors ) ) printk ( KERN_ERR "SELinux: initialized (dev %s, type %s), unknown behavior\n" , sb -> s_id , sb -> s_type -> name ) ; sbsec -> flags |= SE_SBINITIALIZED ; if ( selinux_is_sblabel_mnt ( sb ) ) sbsec -> flags |= SBLABEL_MNT ; rc = inode_doinit_with_dentry ( root_inode , root ) ; spin_lock ( & sbsec -> isec_lock ) ; next_inode : if ( ! list_empty ( & sbsec -> isec_head ) ) { struct inode_security_struct * isec = list_entry ( sbsec -> isec_head . next , struct inode_security_struct , list ) ; struct inode * inode = isec -> inode ; list_del_init ( & isec -> list ) ; spin_unlock ( & sbsec -> isec_lock ) ; inode = igrab ( inode ) ; if ( inode ) { if ( ! IS_PRIVATE ( inode ) ) inode_doinit ( inode ) ; iput ( inode ) ; } spin_lock ( & sbsec -> isec_lock ) ; goto next_inode ; } spin_unlock ( & sbsec -> isec_lock ) ; out : return rc ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int locking_available ( void ) { struct active_request_slot * slot ; struct slot_results results ; struct strbuf in_buffer = STRBUF_INIT ; struct buffer out_buffer = { STRBUF_INIT , 0 } ; struct curl_slist * dav_headers = NULL ; struct xml_ctx ctx ; int lock_flags = 0 ; char * escaped ; escaped = xml_entities ( repo -> url ) ; strbuf_addf ( & out_buffer . buf , PROPFIND_SUPPORTEDLOCK_REQUEST , escaped ) ; free ( escaped ) ; dav_headers = curl_slist_append ( dav_headers , "Depth: 0" ) ; dav_headers = curl_slist_append ( dav_headers , "Content-Type: text/xml" ) ; slot = get_active_slot ( ) ; slot -> results = & results ; curl_setup_http ( slot -> curl , repo -> url , DAV_PROPFIND , & out_buffer , fwrite_buffer ) ; curl_easy_setopt ( slot -> curl , CURLOPT_HTTPHEADER , dav_headers ) ; curl_easy_setopt ( slot -> curl , CURLOPT_FILE , & in_buffer ) ; if ( start_active_slot ( slot ) ) { run_active_slot ( slot ) ; if ( results . curl_result == CURLE_OK ) { XML_Parser parser = XML_ParserCreate ( NULL ) ; enum XML_Status result ; ctx . name = xcalloc ( 10 , 1 ) ; ctx . len = 0 ; ctx . cdata = NULL ; ctx . userFunc = handle_lockprop_ctx ; ctx . userData = & lock_flags ; XML_SetUserData ( parser , & ctx ) ; XML_SetElementHandler ( parser , xml_start_tag , xml_end_tag ) ; result = XML_Parse ( parser , in_buffer . buf , in_buffer . len , 1 ) ; free ( ctx . name ) ; if ( result != XML_STATUS_OK ) { fprintf ( stderr , "XML error: %s\n" , XML_ErrorString ( XML_GetErrorCode ( parser ) ) ) ; lock_flags = 0 ; } XML_ParserFree ( parser ) ; if ( ! lock_flags ) error ( "no DAV locking support on %s" , repo -> url ) ; } else { error ( "Cannot access URL %s, return code %d" , repo -> url , results . curl_result ) ; lock_flags = 0 ; } } else { error ( "Unable to start PROPFIND request on %s" , repo -> url ) ; } strbuf_release ( & out_buffer . buf ) ; strbuf_release ( & in_buffer ) ; curl_slist_free_all ( dav_headers ) ; return lock_flags ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static off_t dnsname_to_labels ( u8 * const buf , size_t buf_len , off_t j , const char * name , const int name_len , struct dnslabel_table * table ) { const char * end = name + name_len ; int ref = 0 ; u16 _t ; # define APPEND16 ( x ) do { if ( j + 2 > ( off_t ) buf_len ) goto overflow ; _t = htons ( x ) ; memcpy ( buf + j , & _t , 2 ) ; j += 2 ; } while ( 0 ) # define APPEND32 ( x ) do { if ( j + 4 > ( off_t ) buf_len ) goto overflow ; _t32 = htonl ( x ) ; memcpy ( buf + j , & _t32 , 4 ) ; j += 4 ; } while ( 0 ) if ( name_len > 255 ) return - 2 ; for ( ; ; ) { const char * const start = name ; if ( table && ( ref = dnslabel_table_get_pos ( table , name ) ) >= 0 ) { APPEND16 ( ref | 0xc000 ) ; return j ; } name = strchr ( name , '.' ) ; if ( ! name ) { const unsigned int label_len = end - start ; if ( label_len > 63 ) return - 1 ; if ( ( size_t ) ( j + label_len + 1 ) > buf_len ) return - 2 ; if ( table ) dnslabel_table_add ( table , start , j ) ; buf [ j ++ ] = label_len ; memcpy ( buf + j , start , end - start ) ; j += end - start ; break ; } else { const unsigned int label_len = name - start ; if ( label_len > 63 ) return - 1 ; if ( ( size_t ) ( j + label_len + 1 ) > buf_len ) return - 2 ; if ( table ) dnslabel_table_add ( table , start , j ) ; buf [ j ++ ] = label_len ; memcpy ( buf + j , start , name - start ) ; j += name - start ; name ++ ; } } if ( ! j || buf [ j - 1 ] ) buf [ j ++ ] = 0 ; return j ; overflow : return ( - 2 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void decode2x2 ( GetBitContext * gb , uint8_t * dst , int linesize ) { int i , j , v [ 2 ] ; switch ( get_bits ( gb , 2 ) ) { case 1 : v [ 0 ] = get_bits ( gb , 8 ) ; for ( j = 0 ; j < 2 ; j ++ ) memset ( dst + j * linesize , v [ 0 ] , 2 ) ; break ; case 2 : v [ 0 ] = get_bits ( gb , 8 ) ; v [ 1 ] = get_bits ( gb , 8 ) ; for ( j = 0 ; j < 2 ; j ++ ) for ( i = 0 ; i < 2 ; i ++ ) dst [ j * linesize + i ] = v [ get_bits1 ( gb ) ] ; break ; case 3 : for ( j = 0 ; j < 2 ; j ++ ) for ( i = 0 ; i < 2 ; i ++ ) dst [ j * linesize + i ] = get_bits ( gb , 8 ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void virtio_pci_notify ( void * opaque , uint16_t vector ) { VirtIOPCIProxy * proxy = opaque ; if ( msix_enabled ( & proxy -> pci_dev ) ) msix_notify ( & proxy -> pci_dev , vector ) ; else qemu_set_irq ( proxy -> pci_dev . irq [ 0 ] , proxy -> vdev -> isr & 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorJSONAddUSBDeviceMatch ( qemuMonitorPtr mon ATTRIBUTE_UNUSED , int vendor ATTRIBUTE_UNUSED , int product ATTRIBUTE_UNUSED ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "usb_add not suppported in JSON mode" ) ) ; return - 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void linear_perm ( int16_t * out , int16_t * in , int n_blocks , int size ) { int block_size = size_blocks ; int i ; for ( i = 0 ; i < size ; i ++ ) out [ i ] = block_size * ( in [ i ] % n_blocks ) + in [ i ] / n_blocks ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void prplcb_conn_progress ( PurpleConnection * gc , const char * text , size_t step , size_t step_count ) { struct im_connection * ic = purple_ic_by_gc ( gc ) ; imcb_log ( ic , "%s" , text ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean lacks_mime_list ( NautilusFile * file ) { return ! file -> details -> mime_list_is_up_to_date ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void convert_to_icc_base ( fz_context * ctx , fz_colorspace * srcs , float * src_f , float * des_f ) { float temp_f [ FZ_MAX_COLORS ] ; fz_colorspace * base_cs = srcs -> get_base ( srcs ) ; if ( fz_colorspace_is_icc ( ctx , base_cs ) || fz_colorspace_is_cal ( ctx , base_cs ) || fz_colorspace_is_lab ( ctx , base_cs ) ) srcs -> to_ccs ( ctx , srcs , src_f , des_f ) ; else { srcs -> to_ccs ( ctx , srcs , src_f , temp_f ) ; convert_to_icc_base ( ctx , base_cs , temp_f , des_f ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void gx_ttfExport__Point ( ttfExport * self , FloatPoint * p , bool bOnCurve , bool bNewPath ) { }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int rate_control ( AVCodecContext * avctx , void * arg ) { SliceArgs * slice_dat = arg ; VC2EncContext * s = slice_dat -> ctx ; const int top = slice_dat -> bits_ceil ; const int bottom = slice_dat -> bits_floor ; int quant_buf [ 2 ] = { - 1 , - 1 } ; int quant = slice_dat -> quant_idx , step = 1 ; int bits_last , bits = count_hq_slice ( slice_dat , quant ) ; while ( ( bits > top ) || ( bits < bottom ) ) { const int signed_step = bits > top ? + step : - step ; quant = av_clip ( quant + signed_step , 0 , s -> q_ceil - 1 ) ; bits = count_hq_slice ( slice_dat , quant ) ; if ( quant_buf [ 1 ] == quant ) { quant = FFMAX ( quant_buf [ 0 ] , quant ) ; bits = quant == quant_buf [ 0 ] ? bits_last : bits ; break ; } step = av_clip ( step / 2 , 1 , ( s -> q_ceil - 1 ) / 2 ) ; quant_buf [ 1 ] = quant_buf [ 0 ] ; quant_buf [ 0 ] = quant ; bits_last = bits ; } slice_dat -> quant_idx = av_clip ( quant , 0 , s -> q_ceil - 1 ) ; slice_dat -> bytes = SSIZE_ROUND ( bits >> 3 ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int absdiff_thresh ( BLOCK_SIZE bs , int increase_denoising ) { ( void ) bs ; return 3 + ( increase_denoising ? 1 : 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ngx_int_t create_request ( ngx_http_request_t * r ) { u_char ch ; const char * helper_agent_request_socket_password_data ; unsigned int helper_agent_request_socket_password_len ; u_char buf [ sizeof ( "4294967296" ) + 1 ] ; size_t len , size , key_len , val_len ; const u_char * app_type_string ; size_t app_type_string_len ; int server_name_len ; ngx_str_t escaped_uri ; ngx_str_t * union_station_filters = NULL ; void * tmp ; ngx_uint_t i , n ; ngx_buf_t * b ; ngx_chain_t * cl , * body ; ngx_list_part_t * part ; ngx_table_elt_t * header ; ngx_http_script_code_pt code ; ngx_http_script_engine_t e , le ; ngx_http_core_srv_conf_t * cscf ; passenger_loc_conf_t * slcf ; passenger_context_t * context ; ngx_http_script_len_code_pt lcode ; cscf = ngx_http_get_module_srv_conf ( r , ngx_http_core_module ) ; slcf = ngx_http_get_module_loc_conf ( r , ngx_http_passenger_module ) ; context = ngx_http_get_module_ctx ( r , ngx_http_passenger_module ) ; if ( context == NULL ) { return NGX_HTTP_INTERNAL_SERVER_ERROR ; } app_type_string = ( const u_char * ) pp_get_app_type_name ( context -> app_type ) ; app_type_string_len = strlen ( ( const char * ) app_type_string ) + 1 ; escaped_uri . len = * ngx_escape_uri ( NULL , r -> uri . data , r -> uri . len , NGX_ESCAPE_URI ) + r -> uri . len ; escaped_uri . data = ngx_pnalloc ( r -> pool , escaped_uri . len + 1 ) ; escaped_uri . data [ escaped_uri . len ] = '\0' ; ngx_escape_uri ( escaped_uri . data , r -> uri . data , r -> uri . len , NGX_ESCAPE_URI ) ; len = 0 ; if ( r -> headers_in . content_length_n >= 0 ) { len += sizeof ( "CONTENT_LENGTH" ) + uint_to_str ( r -> headers_in . content_length_n , buf , sizeof ( buf ) ) + 1 ; } len += sizeof ( "DOCUMENT_ROOT" ) + context -> public_dir . len + 1 ; if ( context -> base_uri . len > 0 ) { len += sizeof ( "SCRIPT_NAME" ) + context -> base_uri . len + 1 ; len += sizeof ( "RAILS_RELATIVE_URL_ROOT" ) + context -> base_uri . len + 1 ; len += sizeof ( "PATH_INFO" ) + escaped_uri . len - context -> base_uri . len + 1 ; } else { len += sizeof ( "SCRIPT_NAME" ) + sizeof ( "" ) ; len += sizeof ( "PATH_INFO" ) + escaped_uri . len + 1 ; } len += sizeof ( "REQUEST_URI" ) + escaped_uri . len + 1 ; if ( r -> args . len > 0 ) { len += 1 + r -> args . len ; } if ( r -> headers_in . host != NULL ) { tmp = memchr ( r -> headers_in . host -> value . data , ':' , r -> headers_in . host -> value . len ) ; if ( tmp == NULL ) { server_name_len = r -> headers_in . host -> value . len ; } else { server_name_len = ( int ) ( ( const u_char * ) tmp - r -> headers_in . host -> value . data ) ; } } else { server_name_len = cscf -> server_name . len ; } len += sizeof ( "SERVER_NAME" ) + server_name_len + 1 ; if ( r -> headers_in . content_type != NULL && r -> headers_in . content_type -> value . len > 0 ) { len += sizeof ( "CONTENT_TYPE" ) + r -> headers_in . content_type -> value . len + 1 ; } # if ( NGX_HTTP_SSL ) if ( r -> http_connection -> ssl ) { len += sizeof ( "HTTPS" ) + sizeof ( "on" ) ; } # endif len += slcf -> options_cache . len ; len += sizeof ( "PASSENGER_APP_TYPE" ) + app_type_string_len ; if ( slcf -> union_station_filters != NGX_CONF_UNSET_PTR && slcf -> union_station_filters -> nelts > 0 ) { len += sizeof ( "UNION_STATION_FILTERS" ) ; union_station_filters = ( ngx_str_t * ) slcf -> union_station_filters -> elts ; for ( i = 0 ; i < slcf -> union_station_filters -> nelts ; i ++ ) { if ( i != 0 ) { len ++ ; } len += union_station_filters [ i ] . len ; } len ++ ; } if ( slcf -> vars_len ) { ngx_memzero ( & le , sizeof ( ngx_http_script_engine_t ) ) ; ngx_http_script_flush_no_cacheable_variables ( r , slcf -> flushes ) ; le . flushed = 1 ; le . ip = slcf -> vars_len -> elts ; le . request = r ; while ( * ( uintptr_t * ) le . ip ) { lcode = * ( ngx_http_script_len_code_pt * ) le . ip ; key_len = lcode ( & le ) ; for ( val_len = 0 ; * ( uintptr_t * ) le . ip ; val_len += lcode ( & le ) ) { lcode = * ( ngx_http_script_len_code_pt * ) le . ip ; } le . ip += sizeof ( uintptr_t ) ; len += key_len + val_len ; } } if ( slcf -> upstream_config . pass_request_headers ) { part = & r -> headers_in . headers . part ; header = part -> elts ; for ( i = 0 ; ; i ++ ) { if ( i >= part -> nelts ) { if ( part -> next == NULL ) { break ; } part = part -> next ; header = part -> elts ; i = 0 ; } if ( ! header_is_transfer_encoding ( & header [ i ] . key ) && ! header_contains_non_alphanumdash ( & header [ i ] . key ) ) { len += sizeof ( "HTTP_" ) - 1 + header [ i ] . key . len + 1 + header [ i ] . value . len + 1 ; } } } helper_agent_request_socket_password_data = pp_agents_starter_get_request_socket_password ( pp_agents_starter , & helper_agent_request_socket_password_len ) ; size = helper_agent_request_socket_password_len + len + 10 + 1 + 1 ; b = ngx_create_temp_buf ( r -> pool , size ) ; if ( b == NULL ) { return NGX_ERROR ; } cl = ngx_alloc_chain_link ( r -> pool ) ; if ( cl == NULL ) { return NGX_ERROR ; } cl -> buf = b ; b -> last = ngx_copy ( b -> last , helper_agent_request_socket_password_data , helper_agent_request_socket_password_len ) ; b -> last = ngx_snprintf ( b -> last , 10 , "%ui" , len ) ; * b -> last ++ = ( u_char ) ':' ; if ( r -> headers_in . content_length_n >= 0 ) { b -> last = ngx_copy ( b -> last , "CONTENT_LENGTH" , sizeof ( "CONTENT_LENGTH" ) ) ; b -> last = ngx_snprintf ( b -> last , 10 , "%O" , r -> headers_in . content_length_n ) ; * b -> last ++ = ( u_char ) 0 ; } b -> last = ngx_copy ( b -> last , "DOCUMENT_ROOT" , sizeof ( "DOCUMENT_ROOT" ) ) ; b -> last = ngx_copy ( b -> last , context -> public_dir . data , context -> public_dir . len + 1 ) ; if ( context -> base_uri . len > 0 ) { b -> last = ngx_copy ( b -> last , "SCRIPT_NAME" , sizeof ( "SCRIPT_NAME" ) ) ; b -> last = ngx_copy ( b -> last , context -> base_uri . data , context -> base_uri . len + 1 ) ; b -> last = ngx_copy ( b -> last , "RAILS_RELATIVE_URL_ROOT" , sizeof ( "RAILS_RELATIVE_URL_ROOT" ) ) ; b -> last = ngx_copy ( b -> last , context -> base_uri . data , context -> base_uri . len + 1 ) ; b -> last = ngx_copy ( b -> last , "PATH_INFO" , sizeof ( "PATH_INFO" ) ) ; b -> last = ngx_copy ( b -> last , escaped_uri . data + context -> base_uri . len , escaped_uri . len - context -> base_uri . len ) ; b -> last = ngx_copy ( b -> last , "" , 1 ) ; } else { b -> last = ngx_copy ( b -> last , "SCRIPT_NAME" , sizeof ( "SCRIPT_NAME" ) ) ; b -> last = ngx_copy ( b -> last , "" , sizeof ( "" ) ) ; b -> last = ngx_copy ( b -> last , "PATH_INFO" , sizeof ( "PATH_INFO" ) ) ; b -> last = ngx_copy ( b -> last , escaped_uri . data , escaped_uri . len ) ; b -> last = ngx_copy ( b -> last , "" , 1 ) ; } b -> last = ngx_copy ( b -> last , "REQUEST_URI" , sizeof ( "REQUEST_URI" ) ) ; b -> last = ngx_copy ( b -> last , escaped_uri . data , escaped_uri . len ) ; if ( r -> args . len > 0 ) { b -> last = ngx_copy ( b -> last , "?" , 1 ) ; b -> last = ngx_copy ( b -> last , r -> args . data , r -> args . len ) ; } b -> last = ngx_copy ( b -> last , "" , 1 ) ; b -> last = ngx_copy ( b -> last , "SERVER_NAME" , sizeof ( "SERVER_NAME" ) ) ; if ( r -> headers_in . host != NULL ) { b -> last = ngx_copy ( b -> last , r -> headers_in . host -> value . data , server_name_len ) ; } else { b -> last = ngx_copy ( b -> last , cscf -> server_name . data , server_name_len ) ; } b -> last = ngx_copy ( b -> last , "" , 1 ) ; if ( r -> headers_in . content_type != NULL && r -> headers_in . content_type -> value . len > 0 ) { b -> last = ngx_copy ( b -> last , "CONTENT_TYPE" , sizeof ( "CONTENT_TYPE" ) ) ; b -> last = ngx_copy ( b -> last , r -> headers_in . content_type -> value . data , r -> headers_in . content_type -> value . len ) ; b -> last = ngx_copy ( b -> last , "" , 1 ) ; } # if ( NGX_HTTP_SSL ) if ( r -> http_connection -> ssl ) { b -> last = ngx_copy ( b -> last , "HTTPS" , sizeof ( "HTTPS" ) ) ; b -> last = ngx_copy ( b -> last , "on" , sizeof ( "on" ) ) ; } # endif b -> last = ngx_copy ( b -> last , slcf -> options_cache . data , slcf -> options_cache . len ) ; b -> last = ngx_copy ( b -> last , "PASSENGER_APP_TYPE" , sizeof ( "PASSENGER_APP_TYPE" ) ) ; b -> last = ngx_copy ( b -> last , app_type_string , app_type_string_len ) ; if ( slcf -> union_station_filters != NGX_CONF_UNSET_PTR && slcf -> union_station_filters -> nelts > 0 ) { b -> last = ngx_copy ( b -> last , "UNION_STATION_FILTERS" , sizeof ( "UNION_STATION_FILTERS" ) ) ; for ( i = 0 ; i < slcf -> union_station_filters -> nelts ; i ++ ) { if ( i != 0 ) { b -> last = ngx_copy ( b -> last , "\1" , 1 ) ; } b -> last = ngx_copy ( b -> last , union_station_filters [ i ] . data , union_station_filters [ i ] . len ) ; } b -> last = ngx_copy ( b -> last , "\0" , 1 ) ; } if ( slcf -> vars_len ) { ngx_memzero ( & e , sizeof ( ngx_http_script_engine_t ) ) ; e . ip = slcf -> vars -> elts ; e . pos = b -> last ; e . request = r ; e . flushed = 1 ; le . ip = slcf -> vars_len -> elts ; while ( * ( uintptr_t * ) le . ip ) { lcode = * ( ngx_http_script_len_code_pt * ) le . ip ; ( void ) lcode ( & le ) ; for ( val_len = 0 ; * ( uintptr_t * ) le . ip ; val_len += lcode ( & le ) ) { lcode = * ( ngx_http_script_len_code_pt * ) le . ip ; } le . ip += sizeof ( uintptr_t ) ; while ( * ( uintptr_t * ) e . ip ) { code = * ( ngx_http_script_code_pt * ) e . ip ; code ( ( ngx_http_script_engine_t * ) & e ) ; } e . ip += sizeof ( uintptr_t ) ; } b -> last = e . pos ; } if ( slcf -> upstream_config . pass_request_headers ) { part = & r -> headers_in . headers . part ; header = part -> elts ; for ( i = 0 ; ; i ++ ) { if ( i >= part -> nelts ) { if ( part -> next == NULL ) { break ; } part = part -> next ; header = part -> elts ; i = 0 ; } if ( header_contains_non_alphanumdash ( & header [ i ] . key ) ) { continue ; } if ( header_is_transfer_encoding ( & header [ i ] . key ) ) { continue ; } b -> last = ngx_cpymem ( b -> last , "HTTP_" , sizeof ( "HTTP_" ) - 1 ) ; for ( n = 0 ; n < header [ i ] . key . len ; n ++ ) { ch = header [ i ] . key . data [ n ] ; if ( ch >= 'a' && ch <= 'z' ) { ch &= ~ 0x20 ; } else if ( ch == '-' ) { ch = '_' ; } * b -> last ++ = ch ; } * b -> last ++ = ( u_char ) 0 ; b -> last = ngx_copy ( b -> last , header [ i ] . value . data , header [ i ] . value . len ) ; * b -> last ++ = ( u_char ) 0 ; } } * b -> last ++ = ( u_char ) ',' ; if ( slcf -> upstream_config . pass_request_body ) { body = r -> upstream -> request_bufs ; r -> upstream -> request_bufs = cl ; while ( body ) { b = ngx_alloc_buf ( r -> pool ) ; if ( b == NULL ) { return NGX_ERROR ; } ngx_memcpy ( b , body -> buf , sizeof ( ngx_buf_t ) ) ; cl -> next = ngx_alloc_chain_link ( r -> pool ) ; if ( cl -> next == NULL ) { return NGX_ERROR ; } cl = cl -> next ; cl -> buf = b ; body = body -> next ; } b -> flush = 1 ; } else { r -> upstream -> request_bufs = cl ; } cl -> next = NULL ; return NGX_OK ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int snmp_seq_open ( struct inode * inode , struct file * file ) { return single_open_net ( inode , file , snmp_seq_show ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void temporal_filter_iterate_c ( VP9_COMP * cpi , YV12_BUFFER_CONFIG * * frames , int frame_count , int alt_ref_index , int strength , struct scale_factors * scale ) { int byte ; int frame ; int mb_col , mb_row ; unsigned int filter_weight ; int mb_cols = cpi -> common . mb_cols ; int mb_rows = cpi -> common . mb_rows ; int mb_y_offset = 0 ; int mb_uv_offset = 0 ; DECLARE_ALIGNED_ARRAY ( 16 , unsigned int , accumulator , 16 * 16 * 3 ) ; DECLARE_ALIGNED_ARRAY ( 16 , uint16_t , count , 16 * 16 * 3 ) ; MACROBLOCKD * mbd = & cpi -> mb . e_mbd ; YV12_BUFFER_CONFIG * f = frames [ alt_ref_index ] ; uint8_t * dst1 , * dst2 ; DECLARE_ALIGNED_ARRAY ( 16 , uint8_t , predictor , 16 * 16 * 3 ) ; const int mb_uv_height = 16 >> mbd -> plane [ 1 ] . subsampling_y ; const int mb_uv_width = 16 >> mbd -> plane [ 1 ] . subsampling_x ; uint8_t * input_buffer [ MAX_MB_PLANE ] ; int i ; for ( i = 0 ; i < MAX_MB_PLANE ; i ++ ) input_buffer [ i ] = mbd -> plane [ i ] . pre [ 0 ] . buf ; for ( mb_row = 0 ; mb_row < mb_rows ; mb_row ++ ) { cpi -> mb . mv_row_min = - ( ( mb_row * 16 ) + ( 17 - 2 * VP9_INTERP_EXTEND ) ) ; cpi -> mb . mv_row_max = ( ( cpi -> common . mb_rows - 1 - mb_row ) * 16 ) + ( 17 - 2 * VP9_INTERP_EXTEND ) ; for ( mb_col = 0 ; mb_col < mb_cols ; mb_col ++ ) { int i , j , k ; int stride ; vpx_memset ( accumulator , 0 , 16 * 16 * 3 * sizeof ( accumulator [ 0 ] ) ) ; vpx_memset ( count , 0 , 16 * 16 * 3 * sizeof ( count [ 0 ] ) ) ; cpi -> mb . mv_col_min = - ( ( mb_col * 16 ) + ( 17 - 2 * VP9_INTERP_EXTEND ) ) ; cpi -> mb . mv_col_max = ( ( cpi -> common . mb_cols - 1 - mb_col ) * 16 ) + ( 17 - 2 * VP9_INTERP_EXTEND ) ; for ( frame = 0 ; frame < frame_count ; frame ++ ) { const int thresh_low = 10000 ; const int thresh_high = 20000 ; if ( frames [ frame ] == NULL ) continue ; mbd -> mi [ 0 ] -> bmi [ 0 ] . as_mv [ 0 ] . as_mv . row = 0 ; mbd -> mi [ 0 ] -> bmi [ 0 ] . as_mv [ 0 ] . as_mv . col = 0 ; if ( frame == alt_ref_index ) { filter_weight = 2 ; } else { int err = temporal_filter_find_matching_mb_c ( cpi , frames [ alt_ref_index ] -> y_buffer + mb_y_offset , frames [ frame ] -> y_buffer + mb_y_offset , frames [ frame ] -> y_stride ) ; filter_weight = err < thresh_low ? 2 : err < thresh_high ? 1 : 0 ; } if ( filter_weight != 0 ) { temporal_filter_predictors_mb_c ( mbd , frames [ frame ] -> y_buffer + mb_y_offset , frames [ frame ] -> u_buffer + mb_uv_offset , frames [ frame ] -> v_buffer + mb_uv_offset , frames [ frame ] -> y_stride , mb_uv_width , mb_uv_height , mbd -> mi [ 0 ] -> bmi [ 0 ] . as_mv [ 0 ] . as_mv . row , mbd -> mi [ 0 ] -> bmi [ 0 ] . as_mv [ 0 ] . as_mv . col , predictor , scale , mb_col * 16 , mb_row * 16 ) ; vp9_temporal_filter_apply ( f -> y_buffer + mb_y_offset , f -> y_stride , predictor , 16 , 16 , strength , filter_weight , accumulator , count ) ; vp9_temporal_filter_apply ( f -> u_buffer + mb_uv_offset , f -> uv_stride , predictor + 256 , mb_uv_width , mb_uv_height , strength , filter_weight , accumulator + 256 , count + 256 ) ; vp9_temporal_filter_apply ( f -> v_buffer + mb_uv_offset , f -> uv_stride , predictor + 512 , mb_uv_width , mb_uv_height , strength , filter_weight , accumulator + 512 , count + 512 ) ; } } dst1 = cpi -> alt_ref_buffer . y_buffer ; stride = cpi -> alt_ref_buffer . y_stride ; byte = mb_y_offset ; for ( i = 0 , k = 0 ; i < 16 ; i ++ ) { for ( j = 0 ; j < 16 ; j ++ , k ++ ) { unsigned int pval = accumulator [ k ] + ( count [ k ] >> 1 ) ; pval *= fixed_divide [ count [ k ] ] ; pval >>= 19 ; dst1 [ byte ] = ( uint8_t ) pval ; byte ++ ; } byte += stride - 16 ; } dst1 = cpi -> alt_ref_buffer . u_buffer ; dst2 = cpi -> alt_ref_buffer . v_buffer ; stride = cpi -> alt_ref_buffer . uv_stride ; byte = mb_uv_offset ; for ( i = 0 , k = 256 ; i < mb_uv_height ; i ++ ) { for ( j = 0 ; j < mb_uv_width ; j ++ , k ++ ) { int m = k + 256 ; unsigned int pval = accumulator [ k ] + ( count [ k ] >> 1 ) ; pval *= fixed_divide [ count [ k ] ] ; pval >>= 19 ; dst1 [ byte ] = ( uint8_t ) pval ; pval = accumulator [ m ] + ( count [ m ] >> 1 ) ; pval *= fixed_divide [ count [ m ] ] ; pval >>= 19 ; dst2 [ byte ] = ( uint8_t ) pval ; byte ++ ; } byte += stride - mb_uv_width ; } mb_y_offset += 16 ; mb_uv_offset += mb_uv_width ; } mb_y_offset += 16 * ( f -> y_stride - mb_cols ) ; mb_uv_offset += mb_uv_height * f -> uv_stride - mb_uv_width * mb_cols ; } for ( i = 0 ; i < MAX_MB_PLANE ; i ++ ) mbd -> plane [ i ] . pre [ 0 ] . buf = input_buffer [ i ] ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void set_fixed_partitioning ( VP9_COMP * cpi , const TileInfo * const tile , MODE_INFO * * mi_8x8 , int mi_row , int mi_col , BLOCK_SIZE bsize ) { VP9_COMMON * const cm = & cpi -> common ; const int mis = cm -> mi_stride ; const int row8x8_remaining = tile -> mi_row_end - mi_row ; const int col8x8_remaining = tile -> mi_col_end - mi_col ; int block_row , block_col ; MODE_INFO * mi_upper_left = cm -> mi + mi_row * mis + mi_col ; int bh = num_8x8_blocks_high_lookup [ bsize ] ; int bw = num_8x8_blocks_wide_lookup [ bsize ] ; assert ( ( row8x8_remaining > 0 ) && ( col8x8_remaining > 0 ) ) ; if ( ( col8x8_remaining >= MI_BLOCK_SIZE ) && ( row8x8_remaining >= MI_BLOCK_SIZE ) ) { for ( block_row = 0 ; block_row < MI_BLOCK_SIZE ; block_row += bh ) { for ( block_col = 0 ; block_col < MI_BLOCK_SIZE ; block_col += bw ) { int index = block_row * mis + block_col ; mi_8x8 [ index ] = mi_upper_left + index ; mi_8x8 [ index ] -> mbmi . sb_type = bsize ; } } } else { set_partial_b64x64_partition ( mi_upper_left , mis , bh , bw , row8x8_remaining , col8x8_remaining , bsize , mi_8x8 ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void parse_profile_level_id ( AVFormatContext * s , PayloadContext * h264_data , const char * value ) { char buffer [ 3 ] ; uint8_t profile_idc ; uint8_t profile_iop ; uint8_t level_idc ; buffer [ 0 ] = value [ 0 ] ; buffer [ 1 ] = value [ 1 ] ; buffer [ 2 ] = '\0' ; profile_idc = strtol ( buffer , NULL , 16 ) ; buffer [ 0 ] = value [ 2 ] ; buffer [ 1 ] = value [ 3 ] ; profile_iop = strtol ( buffer , NULL , 16 ) ; buffer [ 0 ] = value [ 4 ] ; buffer [ 1 ] = value [ 5 ] ; level_idc = strtol ( buffer , NULL , 16 ) ; av_log ( s , AV_LOG_DEBUG , "RTP Profile IDC: %x Profile IOP: %x Level: %x\n" , profile_idc , profile_iop , level_idc ) ; h264_data -> profile_idc = profile_idc ; h264_data -> profile_iop = profile_iop ; h264_data -> level_idc = level_idc ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
gcry_error_t gcry_sexp_new ( gcry_sexp_t * retsexp , const void * buffer , size_t length , int autodetect ) { return gcry_sexp_create ( retsexp , ( void * ) buffer , length , autodetect , NULL ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void e1000e_intrmgr_initialize_all_timers ( E1000ECore * core , bool create ) { int i ; core -> radv . delay_reg = RADV ; core -> rdtr . delay_reg = RDTR ; core -> raid . delay_reg = RAID ; core -> tadv . delay_reg = TADV ; core -> tidv . delay_reg = TIDV ; core -> radv . delay_resolution_ns = E1000_INTR_DELAY_NS_RES ; core -> rdtr . delay_resolution_ns = E1000_INTR_DELAY_NS_RES ; core -> raid . delay_resolution_ns = E1000_INTR_DELAY_NS_RES ; core -> tadv . delay_resolution_ns = E1000_INTR_DELAY_NS_RES ; core -> tidv . delay_resolution_ns = E1000_INTR_DELAY_NS_RES ; core -> radv . core = core ; core -> rdtr . core = core ; core -> raid . core = core ; core -> tadv . core = core ; core -> tidv . core = core ; core -> itr . core = core ; core -> itr . delay_reg = ITR ; core -> itr . delay_resolution_ns = E1000_INTR_THROTTLING_NS_RES ; for ( i = 0 ; i < E1000E_MSIX_VEC_NUM ; i ++ ) { core -> eitr [ i ] . core = core ; core -> eitr [ i ] . delay_reg = EITR + i ; core -> eitr [ i ] . delay_resolution_ns = E1000_INTR_THROTTLING_NS_RES ; } if ( ! create ) { return ; } core -> radv . timer = timer_new_ns ( QEMU_CLOCK_VIRTUAL , e1000e_intrmgr_on_timer , & core -> radv ) ; core -> rdtr . timer = timer_new_ns ( QEMU_CLOCK_VIRTUAL , e1000e_intrmgr_on_timer , & core -> rdtr ) ; core -> raid . timer = timer_new_ns ( QEMU_CLOCK_VIRTUAL , e1000e_intrmgr_on_timer , & core -> raid ) ; core -> tadv . timer = timer_new_ns ( QEMU_CLOCK_VIRTUAL , e1000e_intrmgr_on_timer , & core -> tadv ) ; core -> tidv . timer = timer_new_ns ( QEMU_CLOCK_VIRTUAL , e1000e_intrmgr_on_timer , & core -> tidv ) ; core -> itr . timer = timer_new_ns ( QEMU_CLOCK_VIRTUAL , e1000e_intrmgr_on_throttling_timer , & core -> itr ) ; for ( i = 0 ; i < E1000E_MSIX_VEC_NUM ; i ++ ) { core -> eitr [ i ] . timer = timer_new_ns ( QEMU_CLOCK_VIRTUAL , e1000e_intrmgr_on_msix_throttling_timer , & core -> eitr [ i ] ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const u_char * print_sl_change ( netdissect_options * ndo , const char * str , register const u_char * cp ) { register u_int i ; if ( ( i = * cp ++ ) == 0 ) { i = EXTRACT_16BITS ( cp ) ; cp += 2 ; } ND_PRINT ( ( ndo , " %s%d" , str , i ) ) ; return ( cp ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_T_payloadDescriptor ( 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_payloadDescriptor , T_payloadDescriptor_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline int put_words ( OHCIState * ohci , dma_addr_t addr , uint16_t * buf , int num ) { int i ; addr += ohci -> localmem_base ; for ( i = 0 ; i < num ; i ++ , buf ++ , addr += sizeof ( * buf ) ) { uint16_t tmp = cpu_to_le16 ( * buf ) ; if ( dma_memory_write ( ohci -> as , addr , & tmp , sizeof ( tmp ) ) ) { return - 1 ; } } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static UBool U_CALLCONV lenient8IteratorHasNext ( UCharIterator * iter ) { return iter -> reservedField != 0 || iter -> start < iter -> limit ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_QOSType ( 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_QOSType , QOSType_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void ber_reset ( BerElement * ber , int was_writing ) { assert ( ber != NULL ) ; assert ( LBER_VALID ( ber ) ) ; if ( was_writing ) { ber -> ber_end = ber -> ber_ptr ; ber -> ber_ptr = ber -> ber_buf ; } else { ber -> ber_ptr = ber -> ber_end ; } ber -> ber_rwptr = NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int selinux_inode_symlink ( struct inode * dir , struct dentry * dentry , const char * name ) { return may_create ( dir , dentry , SECCLASS_LNK_FILE ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int test_no_output ( xd3_stream * stream , int ignore ) { int ret ; char buf [ TESTBUFSIZE ] ; test_setup ( ) ; snprintf_func ( buf , TESTBUFSIZE , "touch %s && chmod 0000 %s" , TEST_NOPERM_FILE , TEST_NOPERM_FILE ) ; if ( ( ret = do_cmd ( stream , buf ) ) ) { return ret ; } if ( ( ret = test_make_inputs ( stream , NULL , NULL ) ) ) { return ret ; } snprintf_func ( buf , TESTBUFSIZE , "%s -q -f -e %s %s" , program_name , TEST_TARGET_FILE , TEST_NOPERM_FILE ) ; if ( ( ret = do_fail ( stream , buf ) ) ) { return ret ; } snprintf_func ( buf , TESTBUFSIZE , "%s -J -e %s %s" , program_name , TEST_TARGET_FILE , TEST_NOPERM_FILE ) ; if ( ( ret = do_cmd ( stream , buf ) ) ) { return ret ; } snprintf_func ( buf , TESTBUFSIZE , "%s -e %s %s" , program_name , TEST_TARGET_FILE , TEST_DELTA_FILE ) ; if ( ( ret = do_cmd ( stream , buf ) ) ) { return ret ; } snprintf_func ( buf , TESTBUFSIZE , "%s -q -f -d %s %s" , program_name , TEST_DELTA_FILE , TEST_NOPERM_FILE ) ; if ( ( ret = do_fail ( stream , buf ) ) ) { return ret ; } snprintf_func ( buf , TESTBUFSIZE , "%s -J -d %s %s" , program_name , TEST_DELTA_FILE , TEST_NOPERM_FILE ) ; if ( ( ret = do_cmd ( stream , buf ) ) ) { return ret ; } test_cleanup ( ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int vp9_full_pixel_diamond ( const VP9_COMP * cpi , MACROBLOCK * x , MV * mvp_full , int step_param , int sadpb , int further_steps , int do_refine , const vp9_variance_fn_ptr_t * fn_ptr , const MV * ref_mv , MV * dst_mv ) { MV temp_mv ; int thissme , n , num00 = 0 ; int bestsme = cpi -> diamond_search_sad ( x , & cpi -> ss_cfg , mvp_full , & temp_mv , step_param , sadpb , & n , fn_ptr , ref_mv ) ; if ( bestsme < INT_MAX ) bestsme = vp9_get_mvpred_var ( x , & temp_mv , ref_mv , fn_ptr , 1 ) ; * dst_mv = temp_mv ; if ( n > further_steps ) do_refine = 0 ; while ( n < further_steps ) { ++ n ; if ( num00 ) { num00 -- ; } else { thissme = cpi -> diamond_search_sad ( x , & cpi -> ss_cfg , mvp_full , & temp_mv , step_param + n , sadpb , & num00 , fn_ptr , ref_mv ) ; if ( thissme < INT_MAX ) thissme = vp9_get_mvpred_var ( x , & temp_mv , ref_mv , fn_ptr , 1 ) ; if ( num00 > further_steps - n ) do_refine = 0 ; if ( thissme < bestsme ) { bestsme = thissme ; * dst_mv = temp_mv ; } } } if ( do_refine ) { const int search_range = 8 ; MV best_mv = * dst_mv ; thissme = cpi -> refining_search_sad ( x , & best_mv , sadpb , search_range , fn_ptr , ref_mv ) ; if ( thissme < INT_MAX ) thissme = vp9_get_mvpred_var ( x , & best_mv , ref_mv , fn_ptr , 1 ) ; if ( thissme < bestsme ) { bestsme = thissme ; * dst_mv = best_mv ; } } return bestsme ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
const uint8_t * ff_h263_find_resync_marker ( const uint8_t * restrict p , const uint8_t * restrict end ) { assert ( p < end ) ; end -= 2 ; p ++ ; for ( ; p < end ; p += 2 ) { if ( ! * p ) { if ( ! p [ - 1 ] && p [ 1 ] ) return p - 1 ; else if ( ! p [ 1 ] && p [ 2 ] ) return p ; } } return end + 2 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static hb_bool_t hb_icu_unicode_decompose ( hb_unicode_funcs_t * ufuncs HB_UNUSED , hb_codepoint_t ab , hb_codepoint_t * a , hb_codepoint_t * b , void * user_data HB_UNUSED ) { # if U_ICU_VERSION_MAJOR_NUM >= 49 { UChar decomposed [ 4 ] ; int len ; UErrorCode icu_err = U_ZERO_ERROR ; len = unorm2_getRawDecomposition ( normalizer , ab , decomposed , ARRAY_LENGTH ( decomposed ) , & icu_err ) ; if ( U_FAILURE ( icu_err ) || len < 0 ) return false ; len = u_countChar32 ( decomposed , len ) ; if ( len == 1 ) { U16_GET_UNSAFE ( decomposed , 0 , * a ) ; * b = 0 ; return * a != ab ; } else if ( len == 2 ) { len = 0 ; U16_NEXT_UNSAFE ( decomposed , len , * a ) ; U16_NEXT_UNSAFE ( decomposed , len , * b ) ; } return true ; } # endif UChar utf16 [ 2 ] , normalized [ 2 * HB_UNICODE_MAX_DECOMPOSITION_LEN + 1 ] ; unsigned int len ; hb_bool_t ret , err ; UErrorCode icu_err ; len = 0 ; err = false ; U16_APPEND ( utf16 , len , ARRAY_LENGTH ( utf16 ) , ab , err ) ; if ( err ) return false ; icu_err = U_ZERO_ERROR ; len = unorm_normalize ( utf16 , len , UNORM_NFD , 0 , normalized , ARRAY_LENGTH ( normalized ) , & icu_err ) ; if ( U_FAILURE ( icu_err ) ) return false ; len = u_countChar32 ( normalized , len ) ; if ( len == 1 ) { U16_GET_UNSAFE ( normalized , 0 , * a ) ; * b = 0 ; ret = * a != ab ; } else if ( len == 2 ) { len = 0 ; U16_NEXT_UNSAFE ( normalized , len , * a ) ; U16_NEXT_UNSAFE ( normalized , len , * b ) ; UChar recomposed [ 20 ] ; icu_err = U_ZERO_ERROR ; unorm_normalize ( normalized , len , UNORM_NFC , 0 , recomposed , ARRAY_LENGTH ( recomposed ) , & icu_err ) ; if ( U_FAILURE ( icu_err ) ) return false ; hb_codepoint_t c ; U16_GET_UNSAFE ( recomposed , 0 , c ) ; if ( c != * a && c != ab ) { * a = c ; * b = 0 ; } ret = true ; } else { U16_PREV_UNSAFE ( normalized , len , * b ) ; UChar recomposed [ 18 * 2 ] ; icu_err = U_ZERO_ERROR ; len = unorm_normalize ( normalized , len , UNORM_NFC , 0 , recomposed , ARRAY_LENGTH ( recomposed ) , & icu_err ) ; if ( U_FAILURE ( icu_err ) ) return false ; if ( unlikely ( u_countChar32 ( recomposed , len ) != 1 ) ) return false ; U16_GET_UNSAFE ( recomposed , 0 , * a ) ; ret = true ; } return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vp9_rc_update_rate_correction_factors ( VP9_COMP * cpi , int damp_var ) { const VP9_COMMON * const cm = & cpi -> common ; int correction_factor = 100 ; double rate_correction_factor = get_rate_correction_factor ( cpi ) ; double adjustment_limit ; int projected_size_based_on_q = 0 ; if ( cpi -> rc . is_src_frame_alt_ref ) return ; vp9_clear_system_state ( ) ; projected_size_based_on_q = estimate_bits_at_q ( cm -> frame_type , cm -> base_qindex , cm -> MBs , rate_correction_factor , cm -> bit_depth ) ; if ( projected_size_based_on_q > 0 ) correction_factor = ( 100 * cpi -> rc . projected_frame_size ) / projected_size_based_on_q ; switch ( damp_var ) { case 0 : adjustment_limit = 0.75 ; break ; case 1 : adjustment_limit = 0.375 ; break ; case 2 : default : adjustment_limit = 0.25 ; break ; } if ( correction_factor > 102 ) { correction_factor = ( int ) ( 100 + ( ( correction_factor - 100 ) * adjustment_limit ) ) ; rate_correction_factor = ( rate_correction_factor * correction_factor ) / 100 ; if ( rate_correction_factor > MAX_BPB_FACTOR ) rate_correction_factor = MAX_BPB_FACTOR ; } else if ( correction_factor < 99 ) { correction_factor = ( int ) ( 100 - ( ( 100 - correction_factor ) * adjustment_limit ) ) ; rate_correction_factor = ( rate_correction_factor * correction_factor ) / 100 ; if ( rate_correction_factor < MIN_BPB_FACTOR ) rate_correction_factor = MIN_BPB_FACTOR ; } set_rate_correction_factor ( cpi , rate_correction_factor ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void search_set_from_hostname ( void ) { char hostname [ HOST_NAME_MAX + 1 ] , * domainname ; search_postfix_clear ( ) ; if ( gethostname ( hostname , sizeof ( hostname ) ) ) return ; domainname = strchr ( hostname , '.' ) ; if ( ! domainname ) return ; search_postfix_add ( domainname ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_MediaChannelCapability ( 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_MediaChannelCapability , MediaChannelCapability_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static unsigned long write_no_reuse_object ( struct sha1file * f , struct object_entry * entry , unsigned long limit , int usable_delta ) { unsigned long size , datalen ; unsigned char header [ 10 ] , dheader [ 10 ] ; unsigned hdrlen ; enum object_type type ; void * buf ; struct git_istream * st = NULL ; if ( ! usable_delta ) { if ( entry -> type == OBJ_BLOB && entry -> size > big_file_threshold && ( st = open_istream ( entry -> idx . sha1 , & type , & size , NULL ) ) != NULL ) buf = NULL ; else { buf = read_sha1_file ( entry -> idx . sha1 , & type , & size ) ; if ( ! buf ) die ( _ ( "unable to read %s" ) , sha1_to_hex ( entry -> idx . sha1 ) ) ; } free ( entry -> delta_data ) ; entry -> delta_data = NULL ; entry -> z_delta_size = 0 ; } else if ( entry -> delta_data ) { size = entry -> delta_size ; buf = entry -> delta_data ; entry -> delta_data = NULL ; type = ( allow_ofs_delta && entry -> delta -> idx . offset ) ? OBJ_OFS_DELTA : OBJ_REF_DELTA ; } else { buf = get_delta ( entry ) ; size = entry -> delta_size ; type = ( allow_ofs_delta && entry -> delta -> idx . offset ) ? OBJ_OFS_DELTA : OBJ_REF_DELTA ; } if ( st ) datalen = size ; else if ( entry -> z_delta_size ) datalen = entry -> z_delta_size ; else datalen = do_compress ( & buf , size ) ; hdrlen = encode_in_pack_object_header ( type , size , header ) ; if ( type == OBJ_OFS_DELTA ) { off_t ofs = entry -> idx . offset - entry -> delta -> idx . offset ; unsigned pos = sizeof ( dheader ) - 1 ; dheader [ pos ] = ofs & 127 ; while ( ofs >>= 7 ) dheader [ -- pos ] = 128 | ( -- ofs & 127 ) ; if ( limit && hdrlen + sizeof ( dheader ) - pos + datalen + 20 >= limit ) { if ( st ) close_istream ( st ) ; free ( buf ) ; return 0 ; } sha1write ( f , header , hdrlen ) ; sha1write ( f , dheader + pos , sizeof ( dheader ) - pos ) ; hdrlen += sizeof ( dheader ) - pos ; } else if ( type == OBJ_REF_DELTA ) { if ( limit && hdrlen + 20 + datalen + 20 >= limit ) { if ( st ) close_istream ( st ) ; free ( buf ) ; return 0 ; } sha1write ( f , header , hdrlen ) ; sha1write ( f , entry -> delta -> idx . sha1 , 20 ) ; hdrlen += 20 ; } else { if ( limit && hdrlen + datalen + 20 >= limit ) { if ( st ) close_istream ( st ) ; free ( buf ) ; return 0 ; } sha1write ( f , header , hdrlen ) ; } if ( st ) { datalen = write_large_blob_data ( st , f , entry -> idx . sha1 ) ; close_istream ( st ) ; } else { sha1write ( f , buf , datalen ) ; free ( buf ) ; } return hdrlen + datalen ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
METHOD ( certificate_t , equals , bool , private_x509_cert_t * this , certificate_t * other ) { chunk_t encoding ; bool equal ; if ( this == ( private_x509_cert_t * ) other ) { return TRUE ; } if ( other -> get_type ( other ) != CERT_X509 ) { return FALSE ; } if ( other -> equals == ( void * ) equals ) { return chunk_equals ( this -> encoding , ( ( private_x509_cert_t * ) other ) -> encoding ) ; } if ( ! other -> get_encoding ( other , CERT_ASN1_DER , & encoding ) ) { return FALSE ; } equal = chunk_equals ( this -> encoding , encoding ) ; free ( encoding . ptr ) ; return equal ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static err_status_t srtp_unprotect_rtcp_aead ( srtp_t ctx , srtp_stream_ctx_t * stream , void * srtcp_hdr , unsigned int * pkt_octet_len ) { srtcp_hdr_t * hdr = ( srtcp_hdr_t * ) srtcp_hdr ; uint32_t * enc_start ; uint32_t * trailer ; unsigned int enc_octet_len = 0 ; uint8_t * auth_tag = NULL ; err_status_t status ; int tag_len ; unsigned int tmp_len ; uint32_t seq_num ; v128_t iv ; uint32_t tseq ; tag_len = auth_get_tag_length ( stream -> rtcp_auth ) ; trailer = ( uint32_t * ) ( ( char * ) hdr + * pkt_octet_len - sizeof ( srtcp_trailer_t ) ) ; enc_octet_len = * pkt_octet_len - ( octets_in_rtcp_header + sizeof ( srtcp_trailer_t ) ) ; auth_tag = ( uint8_t * ) hdr + * pkt_octet_len - tag_len - sizeof ( srtcp_trailer_t ) ; if ( * ( ( unsigned char * ) trailer ) & SRTCP_E_BYTE_BIT ) { enc_start = ( uint32_t * ) hdr + uint32s_in_rtcp_header ; } else { enc_octet_len = 0 ; enc_start = NULL ; } seq_num = ntohl ( * trailer ) & SRTCP_INDEX_MASK ; debug_print ( mod_srtp , "srtcp index: %x" , seq_num ) ; status = rdb_check ( & stream -> rtcp_rdb , seq_num ) ; if ( status ) { return status ; } srtp_calc_aead_iv_srtcp ( stream , & iv , seq_num , hdr ) ; status = cipher_set_iv ( stream -> rtcp_cipher , & iv , direction_decrypt ) ; if ( status ) { return err_status_cipher_fail ; } if ( enc_start ) { status = cipher_set_aad ( stream -> rtcp_cipher , ( uint8_t * ) hdr , octets_in_rtcp_header ) ; if ( status ) { return ( err_status_cipher_fail ) ; } } else { status = cipher_set_aad ( stream -> rtcp_cipher , ( uint8_t * ) hdr , ( * pkt_octet_len - tag_len - sizeof ( srtcp_trailer_t ) ) ) ; if ( status ) { return ( err_status_cipher_fail ) ; } } tseq = htonl ( * trailer ) ; status = cipher_set_aad ( stream -> rtcp_cipher , ( uint8_t * ) & tseq , sizeof ( srtcp_trailer_t ) ) ; if ( status ) { return ( err_status_cipher_fail ) ; } if ( enc_start ) { status = cipher_decrypt ( stream -> rtcp_cipher , ( uint8_t * ) enc_start , & enc_octet_len ) ; if ( status ) { return status ; } } else { tmp_len = tag_len ; status = cipher_decrypt ( stream -> rtcp_cipher , ( uint8_t * ) auth_tag , & tmp_len ) ; if ( status ) { return status ; } } * pkt_octet_len -= ( tag_len + sizeof ( srtcp_trailer_t ) ) ; if ( stream -> direction != dir_srtp_receiver ) { if ( stream -> direction == dir_unknown ) { stream -> direction = dir_srtp_receiver ; } else { srtp_handle_event ( ctx , stream , event_ssrc_collision ) ; } } if ( stream == ctx -> stream_template ) { srtp_stream_ctx_t * new_stream ; status = srtp_stream_clone ( ctx -> stream_template , hdr -> ssrc , & new_stream ) ; if ( status ) { return status ; } new_stream -> next = ctx -> stream_list ; ctx -> stream_list = new_stream ; stream = new_stream ; } rdb_add_index ( & stream -> rtcp_rdb , seq_num ) ; return err_status_ok ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
const char * gcry_sexp_nth_data ( const gcry_sexp_t list , int number , size_t * datalen ) { return sexp_nth_data ( list , number , datalen ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_T_standardOid ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 727 "../../asn1/h245/h245.cnf" const gchar * standard_oid_str = NULL ; gef_ctx_t * gefx ; offset = dissect_per_object_identifier_str ( tvb , offset , actx , tree , hf_index , & standard_oid_str ) ; gefx = gef_ctx_get ( actx -> private_data ) ; if ( gefx ) gefx -> id = standard_oid_str ; if ( strcmp ( standard_oid_str , "0.0.8.235.0.3.76" ) == 0 ) { if ( upcoming_channel ) upcoming_channel -> srtp_flag = TRUE ; } if ( ! h245_lc_dissector && strcmp ( standard_oid_str , "0.0.8.245.1.1.1" ) == 0 ) h245_lc_dissector = amr_handle ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int64_t vp9_rd_pick_inter_mode_sb ( VP9_COMP * cpi , MACROBLOCK * x , const TileInfo * const tile , int mi_row , int mi_col , int * returnrate , int64_t * returndistortion , BLOCK_SIZE bsize , PICK_MODE_CONTEXT * ctx , int64_t best_rd_so_far ) { VP9_COMMON * const cm = & cpi -> common ; RD_OPT * const rd_opt = & cpi -> rd ; MACROBLOCKD * const xd = & x -> e_mbd ; MB_MODE_INFO * const mbmi = & xd -> mi [ 0 ] . src_mi -> mbmi ; const struct segmentation * const seg = & cm -> seg ; struct macroblockd_plane * const pd = xd -> plane ; PREDICTION_MODE this_mode ; MV_REFERENCE_FRAME ref_frame , second_ref_frame ; unsigned char segment_id = mbmi -> segment_id ; int comp_pred , i , k ; int_mv frame_mv [ MB_MODE_COUNT ] [ MAX_REF_FRAMES ] ; struct buf_2d yv12_mb [ 4 ] [ MAX_MB_PLANE ] ; int_mv single_newmv [ MAX_REF_FRAMES ] = { { 0 } } ; INTERP_FILTER single_inter_filter [ MB_MODE_COUNT ] [ MAX_REF_FRAMES ] ; int single_skippable [ MB_MODE_COUNT ] [ MAX_REF_FRAMES ] ; static const int flag_list [ 4 ] = { 0 , VP9_LAST_FLAG , VP9_GOLD_FLAG , VP9_ALT_FLAG } ; int64_t best_rd = best_rd_so_far ; int64_t best_tx_rd [ TX_MODES ] ; int64_t best_tx_diff [ TX_MODES ] ; int64_t best_pred_diff [ REFERENCE_MODES ] ; int64_t best_pred_rd [ REFERENCE_MODES ] ; int64_t best_filter_rd [ SWITCHABLE_FILTER_CONTEXTS ] ; int64_t best_filter_diff [ SWITCHABLE_FILTER_CONTEXTS ] ; MB_MODE_INFO best_mbmode ; int best_mode_skippable = 0 ; int midx , best_mode_index = - 1 ; unsigned int ref_costs_single [ MAX_REF_FRAMES ] , ref_costs_comp [ MAX_REF_FRAMES ] ; vp9_prob comp_mode_p ; int64_t best_intra_rd = INT64_MAX ; unsigned int best_pred_sse = UINT_MAX ; PREDICTION_MODE best_intra_mode = DC_PRED ; int rate_uv_intra [ TX_SIZES ] , rate_uv_tokenonly [ TX_SIZES ] ; int64_t dist_uv [ TX_SIZES ] ; int skip_uv [ TX_SIZES ] ; PREDICTION_MODE mode_uv [ TX_SIZES ] ; const int intra_cost_penalty = * vp9_dc_quant ( cm -> base_qindex , cm -> y_dc_delta_q , cm -> bit_depth ) ; int best_skip2 = 0 ; uint8_t ref_frame_skip_mask [ 2 ] = { 0 } ; uint16_t mode_skip_mask [ MAX_REF_FRAMES ] = { 0 } ; int mode_skip_start = cpi -> sf . mode_skip_start + 1 ; const int * const rd_threshes = rd_opt -> threshes [ segment_id ] [ bsize ] ; const int * const rd_thresh_freq_fact = rd_opt -> thresh_freq_fact [ bsize ] ; int mode_threshold [ MAX_MODES ] ; int * mode_map = rd_opt -> mode_map [ bsize ] ; const int mode_search_skip_flags = cpi -> sf . mode_search_skip_flags ; vp9_zero ( best_mbmode ) ; x -> skip_encode = cpi -> sf . skip_encode_frame && x -> q_index < QIDX_SKIP_THRESH ; estimate_ref_frame_costs ( cm , xd , segment_id , ref_costs_single , ref_costs_comp , & comp_mode_p ) ; for ( i = 0 ; i < REFERENCE_MODES ; ++ i ) best_pred_rd [ i ] = INT64_MAX ; for ( i = 0 ; i < TX_MODES ; i ++ ) best_tx_rd [ i ] = INT64_MAX ; for ( i = 0 ; i < SWITCHABLE_FILTER_CONTEXTS ; i ++ ) best_filter_rd [ i ] = INT64_MAX ; for ( i = 0 ; i < TX_SIZES ; i ++ ) rate_uv_intra [ i ] = INT_MAX ; for ( i = 0 ; i < MAX_REF_FRAMES ; ++ i ) x -> pred_sse [ i ] = INT_MAX ; for ( i = 0 ; i < MB_MODE_COUNT ; ++ i ) { for ( k = 0 ; k < MAX_REF_FRAMES ; ++ k ) { single_inter_filter [ i ] [ k ] = SWITCHABLE ; single_skippable [ i ] [ k ] = 0 ; } } * returnrate = INT_MAX ; for ( ref_frame = LAST_FRAME ; ref_frame <= ALTREF_FRAME ; ++ ref_frame ) { x -> pred_mv_sad [ ref_frame ] = INT_MAX ; if ( cpi -> ref_frame_flags & flag_list [ ref_frame ] ) { setup_buffer_inter ( cpi , x , tile , ref_frame , bsize , mi_row , mi_col , frame_mv [ NEARESTMV ] , frame_mv [ NEARMV ] , yv12_mb ) ; } frame_mv [ NEWMV ] [ ref_frame ] . as_int = INVALID_MV ; frame_mv [ ZEROMV ] [ ref_frame ] . as_int = 0 ; } for ( ref_frame = LAST_FRAME ; ref_frame <= ALTREF_FRAME ; ++ ref_frame ) { if ( ! ( cpi -> ref_frame_flags & flag_list [ ref_frame ] ) ) { ref_frame_skip_mask [ 0 ] |= ( 1 << ref_frame ) ; ref_frame_skip_mask [ 1 ] |= SECOND_REF_FRAME_MASK ; } else if ( cpi -> sf . reference_masking ) { for ( i = LAST_FRAME ; i <= ALTREF_FRAME ; ++ i ) { if ( ( x -> pred_mv_sad [ ref_frame ] >> 2 ) > x -> pred_mv_sad [ i ] ) { mode_skip_mask [ ref_frame ] |= INTER_NEAREST_NEAR_ZERO ; break ; } } } if ( vp9_segfeature_active ( seg , segment_id , SEG_LVL_REF_FRAME ) && vp9_get_segdata ( seg , segment_id , SEG_LVL_REF_FRAME ) != ( int ) ref_frame ) { ref_frame_skip_mask [ 0 ] |= ( 1 << ref_frame ) ; ref_frame_skip_mask [ 1 ] |= SECOND_REF_FRAME_MASK ; } } if ( ! vp9_segfeature_active ( seg , segment_id , SEG_LVL_REF_FRAME ) ) { if ( cpi -> rc . is_src_frame_alt_ref && ( cpi -> oxcf . arnr_max_frames == 0 ) ) { ref_frame_skip_mask [ 0 ] = ( 1 << LAST_FRAME ) | ( 1 << GOLDEN_FRAME ) ; ref_frame_skip_mask [ 1 ] = SECOND_REF_FRAME_MASK ; mode_skip_mask [ ALTREF_FRAME ] = ~ INTER_NEAREST_NEAR_ZERO ; if ( frame_mv [ NEARMV ] [ ALTREF_FRAME ] . as_int != 0 ) mode_skip_mask [ ALTREF_FRAME ] |= ( 1 << NEARMV ) ; if ( frame_mv [ NEARESTMV ] [ ALTREF_FRAME ] . as_int != 0 ) mode_skip_mask [ ALTREF_FRAME ] |= ( 1 << NEARESTMV ) ; } } if ( cpi -> rc . is_src_frame_alt_ref ) { if ( cpi -> sf . alt_ref_search_fp ) { mode_skip_mask [ ALTREF_FRAME ] = 0 ; ref_frame_skip_mask [ 0 ] = ~ ( 1 << ALTREF_FRAME ) ; ref_frame_skip_mask [ 1 ] = SECOND_REF_FRAME_MASK ; } } if ( bsize > cpi -> sf . max_intra_bsize ) { ref_frame_skip_mask [ 0 ] |= ( 1 << INTRA_FRAME ) ; ref_frame_skip_mask [ 1 ] |= ( 1 << INTRA_FRAME ) ; } mode_skip_mask [ INTRA_FRAME ] |= ~ ( cpi -> sf . intra_y_mode_mask [ max_txsize_lookup [ bsize ] ] ) ; for ( i = 0 ; i < MAX_MODES ; ++ i ) mode_threshold [ i ] = ( ( int64_t ) rd_threshes [ i ] * rd_thresh_freq_fact [ i ] ) >> 5 ; midx = cpi -> sf . schedule_mode_search ? mode_skip_start : 0 ; while ( midx > 4 ) { uint8_t end_pos = 0 ; for ( i = 5 ; i < midx ; ++ i ) { if ( mode_threshold [ mode_map [ i - 1 ] ] > mode_threshold [ mode_map [ i ] ] ) { uint8_t tmp = mode_map [ i ] ; mode_map [ i ] = mode_map [ i - 1 ] ; mode_map [ i - 1 ] = tmp ; end_pos = i ; } } midx = end_pos ; } for ( midx = 0 ; midx < MAX_MODES ; ++ midx ) { int mode_index = mode_map [ midx ] ; int mode_excluded = 0 ; int64_t this_rd = INT64_MAX ; int disable_skip = 0 ; int compmode_cost = 0 ; int rate2 = 0 , rate_y = 0 , rate_uv = 0 ; int64_t distortion2 = 0 , distortion_y = 0 , distortion_uv = 0 ; int skippable = 0 ; int64_t tx_cache [ TX_MODES ] ; int this_skip2 = 0 ; int64_t total_sse = INT64_MAX ; int early_term = 0 ; this_mode = vp9_mode_order [ mode_index ] . mode ; ref_frame = vp9_mode_order [ mode_index ] . ref_frame [ 0 ] ; second_ref_frame = vp9_mode_order [ mode_index ] . ref_frame [ 1 ] ; if ( midx == mode_skip_start && best_mode_index >= 0 ) { switch ( best_mbmode . ref_frame [ 0 ] ) { case INTRA_FRAME : break ; case LAST_FRAME : ref_frame_skip_mask [ 0 ] |= LAST_FRAME_MODE_MASK ; ref_frame_skip_mask [ 1 ] |= SECOND_REF_FRAME_MASK ; break ; case GOLDEN_FRAME : ref_frame_skip_mask [ 0 ] |= GOLDEN_FRAME_MODE_MASK ; ref_frame_skip_mask [ 1 ] |= SECOND_REF_FRAME_MASK ; break ; case ALTREF_FRAME : ref_frame_skip_mask [ 0 ] |= ALT_REF_MODE_MASK ; break ; case NONE : case MAX_REF_FRAMES : assert ( 0 && "Invalid Reference frame" ) ; break ; } } if ( ref_frame_skip_mask [ 0 ] & ( 1 << ref_frame ) && ref_frame_skip_mask [ 1 ] & ( 1 << MAX ( 0 , second_ref_frame ) ) ) continue ; if ( mode_skip_mask [ ref_frame ] & ( 1 << this_mode ) ) continue ; if ( best_mode_skippable && cpi -> sf . schedule_mode_search ) mode_threshold [ mode_index ] <<= 1 ; if ( best_rd < mode_threshold [ mode_index ] ) continue ; if ( cpi -> sf . motion_field_mode_search ) { const int mi_width = MIN ( num_8x8_blocks_wide_lookup [ bsize ] , tile -> mi_col_end - mi_col ) ; const int mi_height = MIN ( num_8x8_blocks_high_lookup [ bsize ] , tile -> mi_row_end - mi_row ) ; const int bsl = mi_width_log2 ( bsize ) ; int cb_partition_search_ctrl = ( ( ( mi_row + mi_col ) >> bsl ) + get_chessboard_index ( cm -> current_video_frame ) ) & 0x1 ; MB_MODE_INFO * ref_mbmi ; int const_motion = 1 ; int skip_ref_frame = ! cb_partition_search_ctrl ; MV_REFERENCE_FRAME rf = NONE ; int_mv ref_mv ; ref_mv . as_int = INVALID_MV ; if ( ( mi_row - 1 ) >= tile -> mi_row_start ) { ref_mv = xd -> mi [ - xd -> mi_stride ] . src_mi -> mbmi . mv [ 0 ] ; rf = xd -> mi [ - xd -> mi_stride ] . src_mi -> mbmi . ref_frame [ 0 ] ; for ( i = 0 ; i < mi_width ; ++ i ) { ref_mbmi = & xd -> mi [ - xd -> mi_stride + i ] . src_mi -> mbmi ; const_motion &= ( ref_mv . as_int == ref_mbmi -> mv [ 0 ] . as_int ) && ( ref_frame == ref_mbmi -> ref_frame [ 0 ] ) ; skip_ref_frame &= ( rf == ref_mbmi -> ref_frame [ 0 ] ) ; } } if ( ( mi_col - 1 ) >= tile -> mi_col_start ) { if ( ref_mv . as_int == INVALID_MV ) ref_mv = xd -> mi [ - 1 ] . src_mi -> mbmi . mv [ 0 ] ; if ( rf == NONE ) rf = xd -> mi [ - 1 ] . src_mi -> mbmi . ref_frame [ 0 ] ; for ( i = 0 ; i < mi_height ; ++ i ) { ref_mbmi = & xd -> mi [ i * xd -> mi_stride - 1 ] . src_mi -> mbmi ; const_motion &= ( ref_mv . as_int == ref_mbmi -> mv [ 0 ] . as_int ) && ( ref_frame == ref_mbmi -> ref_frame [ 0 ] ) ; skip_ref_frame &= ( rf == ref_mbmi -> ref_frame [ 0 ] ) ; } } if ( skip_ref_frame && this_mode != NEARESTMV && this_mode != NEWMV ) if ( rf > INTRA_FRAME ) if ( ref_frame != rf ) continue ; if ( const_motion ) if ( this_mode == NEARMV || this_mode == ZEROMV ) continue ; } comp_pred = second_ref_frame > INTRA_FRAME ; if ( comp_pred ) { if ( ! cm -> allow_comp_inter_inter ) continue ; if ( ! ( cpi -> ref_frame_flags & flag_list [ second_ref_frame ] ) ) continue ; if ( vp9_segfeature_active ( seg , segment_id , SEG_LVL_REF_FRAME ) ) continue ; if ( ( mode_search_skip_flags & FLAG_SKIP_COMP_BESTINTRA ) && best_mode_index >= 0 && best_mbmode . ref_frame [ 0 ] == INTRA_FRAME ) continue ; mode_excluded = cm -> reference_mode == SINGLE_REFERENCE ; } else { if ( ref_frame != INTRA_FRAME ) mode_excluded = cm -> reference_mode == COMPOUND_REFERENCE ; } if ( ref_frame == INTRA_FRAME ) { if ( cpi -> sf . adaptive_mode_search ) if ( ( x -> source_variance << num_pels_log2_lookup [ bsize ] ) > best_pred_sse ) continue ; if ( this_mode != DC_PRED ) { const unsigned int skip_intra_var_thresh = 64 ; if ( ( mode_search_skip_flags & FLAG_SKIP_INTRA_LOWVAR ) && x -> source_variance < skip_intra_var_thresh ) continue ; if ( ( mode_search_skip_flags & FLAG_SKIP_INTRA_BESTINTER ) && ( this_mode >= D45_PRED && this_mode <= TM_PRED ) ) { if ( best_mode_index >= 0 && best_mbmode . ref_frame [ 0 ] > INTRA_FRAME ) continue ; } if ( mode_search_skip_flags & FLAG_SKIP_INTRA_DIRMISMATCH ) { if ( conditional_skipintra ( this_mode , best_intra_mode ) ) continue ; } } } else { const MV_REFERENCE_FRAME ref_frames [ 2 ] = { ref_frame , second_ref_frame } ; if ( ! check_best_zero_mv ( cpi , mbmi -> mode_context , frame_mv , this_mode , ref_frames ) ) continue ; } mbmi -> mode = this_mode ; mbmi -> uv_mode = DC_PRED ; mbmi -> ref_frame [ 0 ] = ref_frame ; mbmi -> ref_frame [ 1 ] = second_ref_frame ; mbmi -> interp_filter = cm -> interp_filter == SWITCHABLE ? EIGHTTAP : cm -> interp_filter ; mbmi -> mv [ 0 ] . as_int = mbmi -> mv [ 1 ] . as_int = 0 ; x -> skip = 0 ; set_ref_ptrs ( cm , xd , ref_frame , second_ref_frame ) ; for ( i = 0 ; i < MAX_MB_PLANE ; i ++ ) { xd -> plane [ i ] . pre [ 0 ] = yv12_mb [ ref_frame ] [ i ] ; if ( comp_pred ) xd -> plane [ i ] . pre [ 1 ] = yv12_mb [ second_ref_frame ] [ i ] ; } for ( i = 0 ; i < TX_MODES ; ++ i ) tx_cache [ i ] = INT64_MAX ; if ( ref_frame == INTRA_FRAME ) { TX_SIZE uv_tx ; super_block_yrd ( cpi , x , & rate_y , & distortion_y , & skippable , NULL , bsize , tx_cache , best_rd ) ; if ( rate_y == INT_MAX ) continue ; uv_tx = get_uv_tx_size_impl ( mbmi -> tx_size , bsize , pd [ 1 ] . subsampling_x , pd [ 1 ] . subsampling_y ) ; if ( rate_uv_intra [ uv_tx ] == INT_MAX ) { choose_intra_uv_mode ( cpi , ctx , bsize , uv_tx , & rate_uv_intra [ uv_tx ] , & rate_uv_tokenonly [ uv_tx ] , & dist_uv [ uv_tx ] , & skip_uv [ uv_tx ] , & mode_uv [ uv_tx ] ) ; } rate_uv = rate_uv_tokenonly [ uv_tx ] ; distortion_uv = dist_uv [ uv_tx ] ; skippable = skippable && skip_uv [ uv_tx ] ; mbmi -> uv_mode = mode_uv [ uv_tx ] ; rate2 = rate_y + cpi -> mbmode_cost [ mbmi -> mode ] + rate_uv_intra [ uv_tx ] ; if ( this_mode != DC_PRED && this_mode != TM_PRED ) rate2 += intra_cost_penalty ; distortion2 = distortion_y + distortion_uv ; } else { this_rd = handle_inter_mode ( cpi , x , bsize , tx_cache , & rate2 , & distortion2 , & skippable , & rate_y , & distortion_y , & rate_uv , & distortion_uv , & disable_skip , frame_mv , mi_row , mi_col , single_newmv , single_inter_filter , single_skippable , & total_sse , best_rd ) ; if ( this_rd == INT64_MAX ) continue ; compmode_cost = vp9_cost_bit ( comp_mode_p , comp_pred ) ; if ( cm -> reference_mode == REFERENCE_MODE_SELECT ) rate2 += compmode_cost ; } if ( comp_pred ) { rate2 += ref_costs_comp [ ref_frame ] ; } else { rate2 += ref_costs_single [ ref_frame ] ; } if ( ! disable_skip ) { if ( skippable ) { rate2 -= ( rate_y + rate_uv ) ; rate2 += vp9_cost_bit ( vp9_get_skip_prob ( cm , xd ) , 1 ) ; } else if ( ref_frame != INTRA_FRAME && ! xd -> lossless ) { if ( RDCOST ( x -> rdmult , x -> rddiv , rate_y + rate_uv , distortion2 ) < RDCOST ( x -> rdmult , x -> rddiv , 0 , total_sse ) ) { rate2 += vp9_cost_bit ( vp9_get_skip_prob ( cm , xd ) , 0 ) ; } else { rate2 += vp9_cost_bit ( vp9_get_skip_prob ( cm , xd ) , 1 ) ; distortion2 = total_sse ; assert ( total_sse >= 0 ) ; rate2 -= ( rate_y + rate_uv ) ; this_skip2 = 1 ; } } else { rate2 += vp9_cost_bit ( vp9_get_skip_prob ( cm , xd ) , 0 ) ; } this_rd = RDCOST ( x -> rdmult , x -> rddiv , rate2 , distortion2 ) ; } if ( ref_frame == INTRA_FRAME ) { if ( this_rd < best_intra_rd ) { best_intra_rd = this_rd ; best_intra_mode = mbmi -> mode ; } } if ( ! disable_skip && ref_frame == INTRA_FRAME ) { for ( i = 0 ; i < REFERENCE_MODES ; ++ i ) best_pred_rd [ i ] = MIN ( best_pred_rd [ i ] , this_rd ) ; for ( i = 0 ; i < SWITCHABLE_FILTER_CONTEXTS ; i ++ ) best_filter_rd [ i ] = MIN ( best_filter_rd [ i ] , this_rd ) ; } if ( this_rd < best_rd || x -> skip ) { int max_plane = MAX_MB_PLANE ; if ( ! mode_excluded ) { best_mode_index = mode_index ; if ( ref_frame == INTRA_FRAME ) { mbmi -> mv [ 0 ] . as_int = 0 ; max_plane = 1 ; } else { best_pred_sse = x -> pred_sse [ ref_frame ] ; } * returnrate = rate2 ; * returndistortion = distortion2 ; best_rd = this_rd ; best_mbmode = * mbmi ; best_skip2 = this_skip2 ; best_mode_skippable = skippable ; if ( ! x -> select_tx_size ) swap_block_ptr ( x , ctx , 1 , 0 , 0 , max_plane ) ; vpx_memcpy ( ctx -> zcoeff_blk , x -> zcoeff_blk [ mbmi -> tx_size ] , sizeof ( uint8_t ) * ctx -> num_4x4_blk ) ; if ( ( mode_search_skip_flags & FLAG_EARLY_TERMINATE ) && ( mode_index > MIN_EARLY_TERM_INDEX ) ) { const int qstep = xd -> plane [ 0 ] . dequant [ 1 ] ; int scale = 4 ; if ( x -> source_variance < UINT_MAX ) { const int var_adjust = ( x -> source_variance < 16 ) ; scale -= var_adjust ; } if ( ref_frame > INTRA_FRAME && distortion2 * scale < qstep * qstep ) { early_term = 1 ; } } } } if ( ! disable_skip && ref_frame != INTRA_FRAME ) { int64_t single_rd , hybrid_rd , single_rate , hybrid_rate ; if ( cm -> reference_mode == REFERENCE_MODE_SELECT ) { single_rate = rate2 - compmode_cost ; hybrid_rate = rate2 ; } else { single_rate = rate2 ; hybrid_rate = rate2 + compmode_cost ; } single_rd = RDCOST ( x -> rdmult , x -> rddiv , single_rate , distortion2 ) ; hybrid_rd = RDCOST ( x -> rdmult , x -> rddiv , hybrid_rate , distortion2 ) ; if ( ! comp_pred ) { if ( single_rd < best_pred_rd [ SINGLE_REFERENCE ] ) best_pred_rd [ SINGLE_REFERENCE ] = single_rd ; } else { if ( single_rd < best_pred_rd [ COMPOUND_REFERENCE ] ) best_pred_rd [ COMPOUND_REFERENCE ] = single_rd ; } if ( hybrid_rd < best_pred_rd [ REFERENCE_MODE_SELECT ] ) best_pred_rd [ REFERENCE_MODE_SELECT ] = hybrid_rd ; if ( ! mode_excluded && cm -> interp_filter != BILINEAR ) { int64_t ref = rd_opt -> filter_cache [ cm -> interp_filter == SWITCHABLE ? SWITCHABLE_FILTERS : cm -> interp_filter ] ; for ( i = 0 ; i < SWITCHABLE_FILTER_CONTEXTS ; i ++ ) { int64_t adj_rd ; if ( ref == INT64_MAX ) adj_rd = 0 ; else if ( rd_opt -> filter_cache [ i ] == INT64_MAX ) adj_rd = rd_opt -> mask_filter - ref + 10 ; else adj_rd = rd_opt -> filter_cache [ i ] - ref ; adj_rd += this_rd ; best_filter_rd [ i ] = MIN ( best_filter_rd [ i ] , adj_rd ) ; } } } if ( bsize < BLOCK_32X32 ) { if ( bsize < BLOCK_16X16 ) tx_cache [ ALLOW_16X16 ] = tx_cache [ ALLOW_8X8 ] ; tx_cache [ ALLOW_32X32 ] = tx_cache [ ALLOW_16X16 ] ; } if ( ! mode_excluded && this_rd != INT64_MAX ) { for ( i = 0 ; i < TX_MODES && tx_cache [ i ] < INT64_MAX ; i ++ ) { int64_t adj_rd = INT64_MAX ; adj_rd = this_rd + tx_cache [ i ] - tx_cache [ cm -> tx_mode ] ; if ( adj_rd < best_tx_rd [ i ] ) best_tx_rd [ i ] = adj_rd ; } } if ( early_term ) break ; if ( x -> skip && ! comp_pred ) break ; } if ( best_mbmode . mode == NEWMV ) { const MV_REFERENCE_FRAME refs [ 2 ] = { best_mbmode . ref_frame [ 0 ] , best_mbmode . ref_frame [ 1 ] } ; int comp_pred_mode = refs [ 1 ] > INTRA_FRAME ; if ( frame_mv [ NEARESTMV ] [ refs [ 0 ] ] . as_int == best_mbmode . mv [ 0 ] . as_int && ( ( comp_pred_mode && frame_mv [ NEARESTMV ] [ refs [ 1 ] ] . as_int == best_mbmode . mv [ 1 ] . as_int ) || ! comp_pred_mode ) ) best_mbmode . mode = NEARESTMV ; else if ( frame_mv [ NEARMV ] [ refs [ 0 ] ] . as_int == best_mbmode . mv [ 0 ] . as_int && ( ( comp_pred_mode && frame_mv [ NEARMV ] [ refs [ 1 ] ] . as_int == best_mbmode . mv [ 1 ] . as_int ) || ! comp_pred_mode ) ) best_mbmode . mode = NEARMV ; else if ( best_mbmode . mv [ 0 ] . as_int == 0 && ( ( comp_pred_mode && best_mbmode . mv [ 1 ] . as_int == 0 ) || ! comp_pred_mode ) ) best_mbmode . mode = ZEROMV ; } if ( best_mode_index < 0 || best_rd >= best_rd_so_far ) return INT64_MAX ; if ( cpi -> sf . use_uv_intra_rd_estimate ) { if ( best_mbmode . ref_frame [ 0 ] == INTRA_FRAME ) { TX_SIZE uv_tx_size ; * mbmi = best_mbmode ; uv_tx_size = get_uv_tx_size ( mbmi , & xd -> plane [ 1 ] ) ; rd_pick_intra_sbuv_mode ( cpi , x , ctx , & rate_uv_intra [ uv_tx_size ] , & rate_uv_tokenonly [ uv_tx_size ] , & dist_uv [ uv_tx_size ] , & skip_uv [ uv_tx_size ] , bsize < BLOCK_8X8 ? BLOCK_8X8 : bsize , uv_tx_size ) ; } } assert ( ( cm -> interp_filter == SWITCHABLE ) || ( cm -> interp_filter == best_mbmode . interp_filter ) || ! is_inter_block ( & best_mbmode ) ) ; if ( ! cpi -> rc . is_src_frame_alt_ref ) update_rd_thresh_fact ( cpi , bsize , best_mode_index ) ; * mbmi = best_mbmode ; x -> skip |= best_skip2 ; for ( i = 0 ; i < REFERENCE_MODES ; ++ i ) { if ( best_pred_rd [ i ] == INT64_MAX ) best_pred_diff [ i ] = INT_MIN ; else best_pred_diff [ i ] = best_rd - best_pred_rd [ i ] ; } if ( ! x -> skip ) { for ( i = 0 ; i < SWITCHABLE_FILTER_CONTEXTS ; i ++ ) { if ( best_filter_rd [ i ] == INT64_MAX ) best_filter_diff [ i ] = 0 ; else best_filter_diff [ i ] = best_rd - best_filter_rd [ i ] ; } if ( cm -> interp_filter == SWITCHABLE ) assert ( best_filter_diff [ SWITCHABLE_FILTERS ] == 0 ) ; for ( i = 0 ; i < TX_MODES ; i ++ ) { if ( best_tx_rd [ i ] == INT64_MAX ) best_tx_diff [ i ] = 0 ; else best_tx_diff [ i ] = best_rd - best_tx_rd [ i ] ; } } else { vp9_zero ( best_filter_diff ) ; vp9_zero ( best_tx_diff ) ; } x -> skip |= best_mode_skippable ; store_coding_context ( x , ctx , best_mode_index , best_pred_diff , best_tx_diff , best_filter_diff , best_mode_skippable ) ; return best_rd ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int luaD_pcall ( lua_State * L , Pfunc func , void * u , ptrdiff_t old_top , ptrdiff_t ef ) { int status ; unsigned short oldnCcalls = L -> nCcalls ; ptrdiff_t old_ci = saveci ( L , L -> ci ) ; lu_byte old_allowhooks = L -> allowhook ; ptrdiff_t old_errfunc = L -> errfunc ; L -> errfunc = ef ; status = luaD_rawrunprotected ( L , func , u ) ; if ( status != 0 ) { StkId oldtop = restorestack ( L , old_top ) ; luaF_close ( L , oldtop ) ; luaD_seterrorobj ( L , status , oldtop ) ; L -> nCcalls = oldnCcalls ; L -> ci = restoreci ( L , old_ci ) ; L -> base = L -> ci -> base ; L -> savedpc = L -> ci -> savedpc ; L -> allowhook = old_allowhooks ; restore_stack_limit ( L ) ; } L -> errfunc = old_errfunc ; return status ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_T_routing ( 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_T_routing , T_routing_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void nlm_match_fhandle_reply ( packet_info * pinfo , proto_tree * tree ) { nlm_msg_res_matched_data * md ; md = ( nlm_msg_res_matched_data * ) g_hash_table_lookup ( nlm_msg_res_matched , GINT_TO_POINTER ( pinfo -> fd -> num ) ) ; if ( md && md -> rep_frame ) { dissect_fhandle_hidden ( pinfo , tree , md -> req_frame ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static unsigned int _warc_rdtyp ( const char * buf , size_t bsz ) { static const char _key [ ] = "\r\nWARC-Type:" ; const char * val , * eol ; if ( ( val = xmemmem ( buf , bsz , _key , sizeof ( _key ) - 1U ) ) == NULL ) { return WT_NONE ; } val += sizeof ( _key ) - 1U ; if ( ( eol = _warc_find_eol ( val , buf + bsz - val ) ) == NULL ) { return WT_NONE ; } while ( val < eol && ( * val == ' ' || * val == '\t' ) ) ++ val ; if ( val + 8U == eol ) { if ( memcmp ( val , "resource" , 8U ) == 0 ) return WT_RSRC ; else if ( memcmp ( val , "response" , 8U ) == 0 ) return WT_RSP ; } return WT_NONE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void vga_draw_line15_be ( VGACommonState * vga , uint8_t * d , uint32_t addr , int width ) { int w ; uint32_t v , r , g , b ; w = width ; do { v = vga_read_word_be ( vga , addr ) ; r = ( v >> 7 ) & 0xf8 ; g = ( v >> 2 ) & 0xf8 ; b = ( v << 3 ) & 0xf8 ; ( ( uint32_t * ) d ) [ 0 ] = rgb_to_pixel32 ( r , g , b ) ; addr += 2 ; d += 4 ; } while ( -- w != 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static char * quote_for_like ( const char * name , char * buff ) { char * to = buff ; * to ++ = '\'' ; while ( * name ) { if ( * name == '\\' ) { * to ++ = '\\' ; * to ++ = '\\' ; * to ++ = '\\' ; } else if ( * name == '\'' || * name == '_' || * name == '%' ) * to ++ = '\\' ; * to ++ = * name ++ ; } to [ 0 ] = '\'' ; to [ 1 ] = 0 ; return buff ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_zbee_zcl_pwr_prof ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) { proto_tree * payload_tree ; zbee_zcl_packet * zcl ; guint offset = 0 ; guint8 cmd_id ; gint rem_len ; if ( data == NULL ) return 0 ; zcl = ( zbee_zcl_packet * ) data ; cmd_id = zcl -> cmd_id ; if ( zcl -> direction == ZBEE_ZCL_FCF_TO_SERVER ) { col_append_fstr ( pinfo -> cinfo , COL_INFO , "%s, Seq: %u" , val_to_str_const ( cmd_id , zbee_zcl_pwr_prof_srv_rx_cmd_names , "Unknown Command" ) , zcl -> tran_seqno ) ; proto_tree_add_item ( tree , hf_zbee_zcl_pwr_prof_srv_rx_cmd_id , tvb , offset , 1 , cmd_id ) ; rem_len = tvb_reported_length_remaining ( tvb , ++ offset ) ; if ( rem_len > 0 ) { payload_tree = proto_tree_add_subtree ( tree , tvb , offset , rem_len , ett_zbee_zcl_pwr_prof , NULL , "Payload" ) ; switch ( cmd_id ) { case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_REQ : case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_REQ : case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_REQ : dissect_zcl_pwr_prof_pwrprofreq ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_REQ : break ; case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_RSP : case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT_RSP : dissect_zcl_pwr_prof_getpwrprofpricersp ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE_RSP : dissect_zcl_pwr_prof_getoverallschedpricersp ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_NOTIF : case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_RSP : dissect_zcl_pwr_prof_enphsschednotif ( tvb , payload_tree , & offset ) ; break ; default : break ; } } } else { col_append_fstr ( pinfo -> cinfo , COL_INFO , "%s, Seq: %u" , val_to_str_const ( cmd_id , zbee_zcl_pwr_prof_srv_tx_cmd_names , "Unknown Command" ) , zcl -> tran_seqno ) ; proto_tree_add_item ( tree , hf_zbee_zcl_pwr_prof_srv_tx_cmd_id , tvb , offset , 1 , cmd_id ) ; rem_len = tvb_reported_length_remaining ( tvb , ++ offset ) ; if ( rem_len > 0 ) { payload_tree = proto_tree_add_subtree ( tree , tvb , offset , rem_len , ett_zbee_zcl_pwr_prof , NULL , "Payload" ) ; switch ( cmd_id ) { case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_NOTIF : case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_RSP : dissect_zcl_pwr_prof_pwrprofnotif ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_RSP : case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_STATE_NOTIF : dissect_zcl_pwr_prof_pwrprofstatersp ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_OVERALL_SCHED_PRICE : break ; case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_RSP : case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_STATE_NOITIF : dissect_zcl_pwr_prof_enphsschednotif ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE : case ZBEE_ZCL_CMD_ID_PWR_PROF_ENERGY_PHASES_SCHED_REQ : dissect_zcl_pwr_prof_pwrprofreq ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_NOTIF : case ZBEE_ZCL_CMD_ID_PWR_PROF_PWR_PROF_SCHED_CONSTRS_RSP : dissect_zcl_pwr_prof_pwrprofschedcontrsnotif ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_PWR_PROF_GET_PWR_PROF_PRICE_EXT : dissect_zcl_pwr_prof_pwrprofpriceext ( tvb , payload_tree , & offset ) ; break ; default : break ; } } } return tvb_captured_length ( tvb ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int tls1_PRF ( long digest_mask , const void * seed1 , int seed1_len , const void * seed2 , int seed2_len , const void * seed3 , int seed3_len , const void * seed4 , int seed4_len , const void * seed5 , int seed5_len , const unsigned char * sec , int slen , unsigned char * out1 , unsigned char * out2 , int olen ) { int len , i , idx , count ; const unsigned char * S1 ; long m ; const EVP_MD * md ; int ret = 0 ; count = 0 ; for ( idx = 0 ; ssl_get_handshake_digest ( idx , & m , & md ) ; idx ++ ) { if ( ( m << TLS1_PRF_DGST_SHIFT ) & digest_mask ) count ++ ; } len = slen / count ; if ( count == 1 ) slen = 0 ; S1 = sec ; memset ( out1 , 0 , olen ) ; for ( idx = 0 ; ssl_get_handshake_digest ( idx , & m , & md ) ; idx ++ ) { if ( ( m << TLS1_PRF_DGST_SHIFT ) & digest_mask ) { if ( ! md ) { SSLerr ( SSL_F_TLS1_PRF , SSL_R_UNSUPPORTED_DIGEST_TYPE ) ; goto err ; } if ( ! tls1_P_hash ( md , S1 , len + ( slen & 1 ) , seed1 , seed1_len , seed2 , seed2_len , seed3 , seed3_len , seed4 , seed4_len , seed5 , seed5_len , out2 , olen ) ) goto err ; S1 += len ; for ( i = 0 ; i < olen ; i ++ ) { out1 [ i ] ^= out2 [ i ] ; } } } ret = 1 ; err : return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gint64 ascend_seek ( wtap * wth , int * err , gchar * * err_info ) { int byte ; gint64 date_off = - 1 , cur_off , packet_off ; size_t string_level [ ASCEND_MAGIC_STRINGS ] ; guint string_i = 0 , type = 0 ; guint excessive_read_count = 262144 ; memset ( & string_level , 0 , sizeof ( string_level ) ) ; while ( ( ( byte = file_getc ( wth -> fh ) ) != EOF ) ) { excessive_read_count -- ; if ( ! excessive_read_count ) { * err = 0 ; return - 1 ; } for ( string_i = 0 ; string_i < ASCEND_MAGIC_STRINGS ; string_i ++ ) { const gchar * strptr = ascend_magic [ string_i ] . strptr ; size_t len = strlen ( strptr ) ; if ( byte == * ( strptr + string_level [ string_i ] ) ) { string_level [ string_i ] ++ ; if ( string_level [ string_i ] >= len ) { cur_off = file_tell ( wth -> fh ) ; if ( cur_off == - 1 ) { * err = file_error ( wth -> fh , err_info ) ; return - 1 ; } if ( strcmp ( strptr , ASCEND_DATE ) == 0 ) { date_off = cur_off - len ; } else { if ( date_off == - 1 ) { packet_off = cur_off - len ; } else { packet_off = date_off ; } type = ascend_magic [ string_i ] . type ; goto found ; } } } else { string_level [ string_i ] = 0 ; } } } * err = file_error ( wth -> fh , err_info ) ; return - 1 ; found : if ( file_seek ( wth -> fh , packet_off , SEEK_SET , err ) == - 1 ) return - 1 ; wth -> phdr . pseudo_header . ascend . type = type ; return packet_off ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static guint32 dissect_minivideopacket ( tvbuff_t * tvb , guint32 offset , guint16 scallno , packet_info * pinfo , proto_tree * iax2_tree , proto_tree * main_tree ) { guint32 ts ; iax_packet_data * iax_packet ; gboolean rtp_marker ; proto_item * item ; ts = tvb_get_ntohs ( tvb , offset ) ; rtp_marker = ts & 0x8000 ? TRUE : FALSE ; ts &= ~ 0x8000 ; iax_packet = iax2_get_packet_data_for_minipacket ( pinfo , scallno , TRUE ) ; if ( iax2_tree ) { if ( iax_packet -> call_data ) { item = proto_tree_add_uint ( iax2_tree , hf_iax2_callno , tvb , 0 , 4 , iax_packet -> call_data -> forward_circuit_ids [ 0 ] ) ; PROTO_ITEM_SET_GENERATED ( item ) ; } proto_tree_add_item ( iax2_tree , hf_iax2_minividts , tvb , offset , 2 , ENC_BIG_ENDIAN ) ; iax2_add_ts_fields ( pinfo , iax2_tree , iax_packet , ( guint16 ) ts ) ; proto_tree_add_item ( iax2_tree , hf_iax2_minividmarker , tvb , offset , 2 , ENC_BIG_ENDIAN ) ; } else { iax2_add_ts_fields ( pinfo , iax2_tree , iax_packet , ( guint16 ) ts ) ; } offset += 2 ; col_add_fstr ( pinfo -> cinfo , COL_INFO , "Mini video packet, source call# %d, timestamp %ums%s" , scallno , ts , rtp_marker ? ", Mark" : "" ) ; dissect_payload ( tvb , offset , pinfo , iax2_tree , main_tree , ts , TRUE , iax_packet ) ; iax_packet -> first_time = FALSE ; return offset ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int create_or_remove_cgroup ( bool do_remove , struct cgroup_mount_point * mp , const char * path , int recurse ) { int r , saved_errno = 0 ; char * buf = cgroup_to_absolute_path ( mp , path , NULL ) ; if ( ! buf ) return - 1 ; if ( do_remove ) { if ( recurse ) r = cgroup_rmdir ( buf ) ; else r = rmdir ( buf ) ; } else r = mkdir ( buf , 0777 ) ; saved_errno = errno ; free ( buf ) ; errno = saved_errno ; return r ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
UChar * ufmt_defaultCPToUnicode ( const char * s , int32_t sSize , UChar * target , int32_t tSize ) { UChar * alias ; UErrorCode status = U_ZERO_ERROR ; UConverter * defConverter = u_getDefaultConverter ( & status ) ; if ( U_FAILURE ( status ) || defConverter == 0 ) return 0 ; if ( sSize <= 0 ) { sSize = uprv_strlen ( s ) + 1 ; } if ( target != 0 ) { alias = target ; ucnv_toUnicode ( defConverter , & alias , alias + tSize , & s , s + sSize - 1 , NULL , TRUE , & status ) ; * alias = 0x0000 ; } u_releaseDefaultConverter ( defConverter ) ; return target ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int handle_compressed ( void * procctx , PKT_compressed * cd , int ( * callback ) ( IOBUF , void * ) , void * passthru ) { compress_filter_context_t * cfx ; int rc ; if ( check_compress_algo ( cd -> algorithm ) ) return G10ERR_COMPR_ALGO ; cfx = xmalloc_clear ( sizeof * cfx ) ; cfx -> release = release_context ; cfx -> algo = cd -> algorithm ; push_compress_filter ( cd -> buf , cfx , cd -> algorithm ) ; if ( callback ) rc = callback ( cd -> buf , passthru ) ; else rc = proc_packets ( procctx , cd -> buf ) ; cd -> buf = NULL ; return rc ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void find_mv_refs_idx ( const VP9_COMMON * cm , const MACROBLOCKD * xd , const TileInfo * const tile , MODE_INFO * mi , MV_REFERENCE_FRAME ref_frame , int_mv * mv_ref_list , int block , int mi_row , int mi_col ) { const int * ref_sign_bias = cm -> ref_frame_sign_bias ; int i , refmv_count = 0 ; const MODE_INFO * prev_mi = ! cm -> error_resilient_mode && cm -> prev_mi ? cm -> prev_mi_grid_visible [ mi_row * xd -> mi_stride + mi_col ] : NULL ; const MB_MODE_INFO * const prev_mbmi = prev_mi ? & prev_mi -> mbmi : NULL ; const POSITION * const mv_ref_search = mv_ref_blocks [ mi -> mbmi . sb_type ] ; int different_ref_found = 0 ; int context_counter = 0 ; vpx_memset ( mv_ref_list , 0 , sizeof ( * mv_ref_list ) * MAX_MV_REF_CANDIDATES ) ; for ( i = 0 ; i < 2 ; ++ i ) { const POSITION * const mv_ref = & mv_ref_search [ i ] ; if ( is_inside ( tile , mi_col , mi_row , cm -> mi_rows , mv_ref ) ) { const MODE_INFO * const candidate_mi = xd -> mi [ mv_ref -> col + mv_ref -> row * xd -> mi_stride ] ; const MB_MODE_INFO * const candidate = & candidate_mi -> mbmi ; context_counter += mode_2_counter [ candidate -> mode ] ; different_ref_found = 1 ; if ( candidate -> ref_frame [ 0 ] == ref_frame ) ADD_MV_REF_LIST ( get_sub_block_mv ( candidate_mi , 0 , mv_ref -> col , block ) ) ; else if ( candidate -> ref_frame [ 1 ] == ref_frame ) ADD_MV_REF_LIST ( get_sub_block_mv ( candidate_mi , 1 , mv_ref -> col , block ) ) ; } } for ( ; i < MVREF_NEIGHBOURS ; ++ i ) { const POSITION * const mv_ref = & mv_ref_search [ i ] ; if ( is_inside ( tile , mi_col , mi_row , cm -> mi_rows , mv_ref ) ) { const MB_MODE_INFO * const candidate = & xd -> mi [ mv_ref -> col + mv_ref -> row * xd -> mi_stride ] -> mbmi ; different_ref_found = 1 ; if ( candidate -> ref_frame [ 0 ] == ref_frame ) ADD_MV_REF_LIST ( candidate -> mv [ 0 ] ) ; else if ( candidate -> ref_frame [ 1 ] == ref_frame ) ADD_MV_REF_LIST ( candidate -> mv [ 1 ] ) ; } } if ( prev_mbmi ) { if ( prev_mbmi -> ref_frame [ 0 ] == ref_frame ) ADD_MV_REF_LIST ( prev_mbmi -> mv [ 0 ] ) ; else if ( prev_mbmi -> ref_frame [ 1 ] == ref_frame ) ADD_MV_REF_LIST ( prev_mbmi -> mv [ 1 ] ) ; } if ( different_ref_found ) { for ( i = 0 ; i < MVREF_NEIGHBOURS ; ++ i ) { const POSITION * mv_ref = & mv_ref_search [ i ] ; if ( is_inside ( tile , mi_col , mi_row , cm -> mi_rows , mv_ref ) ) { const MB_MODE_INFO * const candidate = & xd -> mi [ mv_ref -> col + mv_ref -> row * xd -> mi_stride ] -> mbmi ; IF_DIFF_REF_FRAME_ADD_MV ( candidate ) ; } } } if ( prev_mbmi ) IF_DIFF_REF_FRAME_ADD_MV ( prev_mbmi ) ; Done : mi -> mbmi . mode_context [ ref_frame ] = counter_to_context [ context_counter ] ; for ( i = 0 ; i < MAX_MV_REF_CANDIDATES ; ++ i ) clamp_mv_ref ( & mv_ref_list [ i ] . as_mv , xd ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int collector_substr ( int c , void * data ) { struct collector_substr_data * pc = ( struct collector_substr_data * ) data ; if ( pc -> output >= pc -> stop ) { return - 1 ; } if ( pc -> output >= pc -> start ) { ( * pc -> next_filter -> filter_function ) ( c , pc -> next_filter ) ; } pc -> output ++ ; return c ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gint pad_according_to_type ( gint offset , gint field_starting_offset , gint max_offset , guint8 type ) { switch ( type ) { case ARG_BYTE : break ; case ARG_DOUBLE : case ARG_UINT64 : case ARG_INT64 : case ARG_STRUCT : case ARG_DICT_ENTRY : offset = round_to_8byte ( offset , field_starting_offset ) ; break ; case ARG_SIGNATURE : break ; case ARG_HANDLE : break ; case ARG_INT32 : case ARG_UINT32 : case ARG_BOOLEAN : offset = round_to_4byte ( offset , field_starting_offset ) ; break ; case ARG_INT16 : case ARG_UINT16 : offset = round_to_2byte ( offset , field_starting_offset ) ; break ; case ARG_STRING : break ; case ARG_VARIANT : break ; case ARG_OBJ_PATH : break ; default : break ; } if ( offset > max_offset ) { offset = max_offset ; } return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int test_gf2m_mod_inv ( BIO * bp , BN_CTX * ctx ) { BIGNUM * a , * b [ 2 ] , * c , * d ; int i , j , ret = 0 ; int p0 [ ] = { 163 , 7 , 6 , 3 , 0 , - 1 } ; int p1 [ ] = { 193 , 15 , 0 , - 1 } ; a = BN_new ( ) ; b [ 0 ] = BN_new ( ) ; b [ 1 ] = BN_new ( ) ; c = BN_new ( ) ; d = BN_new ( ) ; BN_GF2m_arr2poly ( p0 , b [ 0 ] ) ; BN_GF2m_arr2poly ( p1 , b [ 1 ] ) ; for ( i = 0 ; i < num0 ; i ++ ) { BN_bntest_rand ( a , 512 , 0 , 0 ) ; for ( j = 0 ; j < 2 ; j ++ ) { BN_GF2m_mod_inv ( c , a , b [ j ] , ctx ) ; BN_GF2m_mod_mul ( d , a , c , b [ j ] , ctx ) ; # if 0 if ( bp != NULL ) { if ( ! results ) { BN_print ( bp , a ) ; BIO_puts ( bp , " * " ) ; BN_print ( bp , c ) ; BIO_puts ( bp , " - 1 % " ) ; BN_print ( bp , b [ j ] ) ; BIO_puts ( bp , "\n" ) ; } } # endif if ( ! BN_is_one ( d ) ) { fprintf ( stderr , "GF(2^m) modular inversion test failed!\n" ) ; goto err ; } } } ret = 1 ; err : BN_free ( a ) ; BN_free ( b [ 0 ] ) ; BN_free ( b [ 1 ] ) ; BN_free ( c ) ; BN_free ( d ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vp9_idct16x16_256_add_c ( const int16_t * input , uint8_t * dest , int stride ) { int16_t out [ 16 * 16 ] ; int16_t * outptr = out ; int i , j ; int16_t temp_in [ 16 ] , temp_out [ 16 ] ; for ( i = 0 ; i < 16 ; ++ i ) { idct16 ( input , outptr ) ; input += 16 ; outptr += 16 ; } for ( i = 0 ; i < 16 ; ++ i ) { for ( j = 0 ; j < 16 ; ++ j ) temp_in [ j ] = out [ j * 16 + i ] ; idct16 ( temp_in , temp_out ) ; for ( j = 0 ; j < 16 ; ++ j ) dest [ j * stride + i ] = clip_pixel ( ROUND_POWER_OF_TWO ( temp_out [ j ] , 6 ) + dest [ j * stride + i ] ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void jbig2_decode_mmr_consume ( Jbig2MmrCtx * mmr , int n_bits ) { mmr -> word <<= n_bits ; mmr -> bit_index += n_bits ; while ( mmr -> bit_index >= 8 ) { mmr -> bit_index -= 8 ; if ( mmr -> data_index + 4 < mmr -> size ) mmr -> word |= ( mmr -> data [ mmr -> data_index + 4 ] << mmr -> bit_index ) ; mmr -> data_index ++ ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
gboolean tree_expanded ( int tree_type ) { g_assert ( tree_type >= 0 && tree_type < num_tree_types ) ; return tree_is_expanded [ tree_type >> 5 ] & ( 1U << ( tree_type & 31 ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static hb_unicode_combining_class_t hb_icu_unicode_combining_class ( hb_unicode_funcs_t * ufuncs HB_UNUSED , hb_codepoint_t unicode , void * user_data HB_UNUSED ) { return ( hb_unicode_combining_class_t ) u_getCombiningClass ( unicode ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void jpc_qmfb_split_col ( jpc_fix_t * a , int numrows , int stride , int parity ) { int bufsize = JPC_CEILDIVPOW2 ( numrows , 1 ) ; jpc_fix_t splitbuf [ QMFB_SPLITBUFSIZE ] ; jpc_fix_t * buf = splitbuf ; register jpc_fix_t * srcptr ; register jpc_fix_t * dstptr ; register int n ; register int m ; int hstartcol ; if ( bufsize > QMFB_SPLITBUFSIZE ) { if ( ! ( buf = jas_alloc2 ( bufsize , sizeof ( jpc_fix_t ) ) ) ) { abort ( ) ; } } if ( numrows >= 2 ) { hstartcol = ( numrows + 1 - parity ) >> 1 ; m = numrows - hstartcol ; n = m ; dstptr = buf ; srcptr = & a [ ( 1 - parity ) * stride ] ; while ( n -- > 0 ) { * dstptr = * srcptr ; ++ dstptr ; srcptr += stride << 1 ; } dstptr = & a [ ( 1 - parity ) * stride ] ; srcptr = & a [ ( 2 - parity ) * stride ] ; n = numrows - m - ( ! parity ) ; while ( n -- > 0 ) { * dstptr = * srcptr ; dstptr += stride ; srcptr += stride << 1 ; } dstptr = & a [ hstartcol * stride ] ; srcptr = buf ; n = m ; while ( n -- > 0 ) { * dstptr = * srcptr ; dstptr += stride ; ++ srcptr ; } } if ( buf != splitbuf ) { jas_free ( buf ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static const char * hfinfo_number_vals_format ( const header_field_info * hfinfo , char buf [ 32 ] , guint32 value ) { int display = hfinfo -> display & FIELD_DISPLAY_E_MASK ; if ( display == BASE_NONE ) return NULL ; if ( display == BASE_DEC_HEX ) display = BASE_DEC ; if ( display == BASE_HEX_DEC ) display = BASE_HEX ; return hfinfo_number_value_format_display ( hfinfo , display , buf , value ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
Datum neqjoinsel ( PG_FUNCTION_ARGS ) { PlannerInfo * root = ( PlannerInfo * ) PG_GETARG_POINTER ( 0 ) ; Oid operator = PG_GETARG_OID ( 1 ) ; List * args = ( List * ) PG_GETARG_POINTER ( 2 ) ; JoinType jointype = ( JoinType ) PG_GETARG_INT16 ( 3 ) ; SpecialJoinInfo * sjinfo = ( SpecialJoinInfo * ) PG_GETARG_POINTER ( 4 ) ; Oid eqop ; float8 result ; eqop = get_negator ( operator ) ; if ( eqop ) { result = DatumGetFloat8 ( DirectFunctionCall5 ( eqjoinsel , PointerGetDatum ( root ) , ObjectIdGetDatum ( eqop ) , PointerGetDatum ( args ) , Int16GetDatum ( jointype ) , PointerGetDatum ( sjinfo ) ) ) ; } else { result = DEFAULT_EQ_SEL ; } result = 1.0 - result ; PG_RETURN_FLOAT8 ( result ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
VAR * var_get ( const char * var_name , const char * * var_name_end , my_bool raw , my_bool ignore_not_existing ) { int digit ; VAR * v ; DBUG_ENTER ( "var_get" ) ; DBUG_PRINT ( "enter" , ( "var_name: %s" , var_name ) ) ; if ( * var_name != '$' ) goto err ; digit = * ++ var_name - '0' ; if ( digit < 0 || digit >= 10 ) { const char * save_var_name = var_name , * end ; uint length ; end = ( var_name_end ) ? * var_name_end : 0 ; while ( my_isvar ( charset_info , * var_name ) && var_name != end ) var_name ++ ; if ( var_name == save_var_name ) { if ( ignore_not_existing ) DBUG_RETURN ( 0 ) ; die ( "Empty variable" ) ; } length = ( uint ) ( var_name - save_var_name ) ; if ( length >= MAX_VAR_NAME_LENGTH ) die ( "Too long variable name: %s" , save_var_name ) ; if ( ! ( v = ( VAR * ) my_hash_search ( & var_hash , ( const uchar * ) save_var_name , length ) ) ) { char buff [ MAX_VAR_NAME_LENGTH + 1 ] ; strmake ( buff , save_var_name , length ) ; v = var_from_env ( buff , "" ) ; } var_name -- ; } else v = var_reg + digit ; if ( ! raw && v -> int_dirty ) { sprintf ( v -> str_val , "%d" , v -> int_val ) ; v -> int_dirty = false ; v -> str_val_len = strlen ( v -> str_val ) ; } if ( var_name_end ) * var_name_end = var_name ; DBUG_RETURN ( v ) ; err : if ( var_name_end ) * var_name_end = 0 ; die ( "Unsupported variable name: %s" , var_name ) ; DBUG_RETURN ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vp9_quantize_b_c ( const int16_t * coeff_ptr , intptr_t count , int skip_block , const int16_t * zbin_ptr , const int16_t * round_ptr , const int16_t * quant_ptr , const int16_t * quant_shift_ptr , int16_t * qcoeff_ptr , int16_t * dqcoeff_ptr , const int16_t * dequant_ptr , int zbin_oq_value , uint16_t * eob_ptr , const int16_t * scan , const int16_t * iscan ) { int i , non_zero_count = ( int ) count , eob = - 1 ; const int zbins [ 2 ] = { zbin_ptr [ 0 ] + zbin_oq_value , zbin_ptr [ 1 ] + zbin_oq_value } ; const int nzbins [ 2 ] = { zbins [ 0 ] * - 1 , zbins [ 1 ] * - 1 } ; ( void ) iscan ; vpx_memset ( qcoeff_ptr , 0 , count * sizeof ( int16_t ) ) ; vpx_memset ( dqcoeff_ptr , 0 , count * sizeof ( int16_t ) ) ; if ( ! skip_block ) { for ( i = ( int ) count - 1 ; i >= 0 ; i -- ) { const int rc = scan [ i ] ; const int coeff = coeff_ptr [ rc ] ; if ( coeff < zbins [ rc != 0 ] && coeff > nzbins [ rc != 0 ] ) non_zero_count -- ; else break ; } for ( i = 0 ; i < non_zero_count ; i ++ ) { const int rc = scan [ i ] ; const int coeff = coeff_ptr [ rc ] ; const int coeff_sign = ( coeff >> 31 ) ; const int abs_coeff = ( coeff ^ coeff_sign ) - coeff_sign ; if ( abs_coeff >= zbins [ rc != 0 ] ) { int tmp = clamp ( abs_coeff + round_ptr [ rc != 0 ] , INT16_MIN , INT16_MAX ) ; tmp = ( ( ( ( tmp * quant_ptr [ rc != 0 ] ) >> 16 ) + tmp ) * quant_shift_ptr [ rc != 0 ] ) >> 16 ; qcoeff_ptr [ rc ] = ( tmp ^ coeff_sign ) - coeff_sign ; dqcoeff_ptr [ rc ] = qcoeff_ptr [ rc ] * dequant_ptr [ rc != 0 ] ; if ( tmp ) eob = i ; } } } * eob_ptr = eob + 1 ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
TSReturnCode sdk_sanity_check_fetch_sm ( TSFetchSM fetch_sm ) { if ( fetch_sm == nullptr ) { return TS_ERROR ; } return TS_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( FramebustBlockBrowserTest , ModelAllowsRedirection ) { const GURL blocked_urls [ ] = { GURL ( chrome : : kChromeUIHistoryURL ) , GURL ( chrome : : kChromeUISettingsURL ) , GURL ( chrome : : kChromeUIVersionURL ) , } ; auto * helper = GetFramebustTabHelper ( ) ; for ( const GURL & url : blocked_urls ) { helper -> AddBlockedUrl ( url , base : : BindOnce ( & FramebustBlockBrowserTest : : OnClick , base : : Unretained ( this ) ) ) ; } EXPECT_TRUE ( helper -> HasBlockedUrls ( ) ) ; ContentSettingFramebustBlockBubbleModel framebust_block_bubble_model ( browser ( ) -> content_setting_bubble_model_delegate ( ) , GetWebContents ( ) , browser ( ) -> profile ( ) ) ; EXPECT_FALSE ( clicked_index_ . has_value ( ) ) ; EXPECT_FALSE ( clicked_url_ . has_value ( ) ) ; content : : TestNavigationObserver observer ( GetWebContents ( ) ) ; framebust_block_bubble_model . OnListItemClicked ( 1 , ui : : EF_LEFT_MOUSE_BUTTON ) ; observer . Wait ( ) ; EXPECT_TRUE ( clicked_index_ . has_value ( ) ) ; EXPECT_TRUE ( clicked_url_ . has_value ( ) ) ; EXPECT_EQ ( 1u , clicked_index_ . value ( ) ) ; EXPECT_EQ ( GURL ( chrome : : kChromeUISettingsURL ) , clicked_url_ . value ( ) ) ; EXPECT_FALSE ( helper -> HasBlockedUrls ( ) ) ; EXPECT_EQ ( blocked_urls [ 1 ] , GetWebContents ( ) -> GetLastCommittedURL ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorTextDelDevice ( qemuMonitorPtr mon , const char * devalias ) { char * cmd = NULL ; char * reply = NULL ; char * safedev ; int ret = - 1 ; if ( ! ( safedev = qemuMonitorEscapeArg ( devalias ) ) ) { virReportOOMError ( ) ; goto cleanup ; } if ( virAsprintf ( & cmd , "device_del %s" , safedev ) < 0 ) { virReportOOMError ( ) ; goto cleanup ; } VIR_DEBUG ( "TextDelDevice devalias=%s" , devalias ) ; if ( qemuMonitorHMPCommand ( mon , cmd , & reply ) < 0 ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , _ ( "cannot detach %s device" ) , devalias ) ; goto cleanup ; } if ( STRNEQ ( reply , "" ) ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , _ ( "detaching %s device failed: %s" ) , devalias , reply ) ; goto cleanup ; } ret = 0 ; cleanup : VIR_FREE ( cmd ) ; VIR_FREE ( reply ) ; VIR_FREE ( safedev ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static cmsBool WriteSeqID ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , void * Cargo , cmsUInt32Number n , cmsUInt32Number SizeOfTag ) { cmsSEQ * Seq = ( cmsSEQ * ) Cargo ; if ( ! io -> Write ( io , 16 , Seq -> seq [ n ] . ProfileID . ID8 ) ) return FALSE ; if ( ! SaveDescription ( self , io , Seq -> seq [ n ] . Description ) ) return FALSE ; return TRUE ; cmsUNUSED_PARAMETER ( SizeOfTag ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int _warc_read ( struct archive_read * a , const void * * buf , size_t * bsz , int64_t * off ) { struct warc_s * w = a -> format -> data ; const char * rab ; ssize_t nrd ; if ( w -> cntoff >= w -> cntlen ) { eof : * buf = NULL ; * bsz = 0U ; * off = w -> cntoff + 4U ; w -> unconsumed = 0U ; return ( ARCHIVE_EOF ) ; } rab = __archive_read_ahead ( a , 1U , & nrd ) ; if ( nrd < 0 ) { * bsz = 0U ; return ( int ) nrd ; } else if ( nrd == 0 ) { goto eof ; } else if ( ( size_t ) nrd > w -> cntlen - w -> cntoff ) { nrd = w -> cntlen - w -> cntoff ; } * off = w -> cntoff ; * bsz = nrd ; * buf = rab ; w -> cntoff += nrd ; w -> unconsumed = ( size_t ) nrd ; return ( ARCHIVE_OK ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
int tm_taskinfo ( tm_node_id node , tm_task_id * tid_list , int list_size , int * ntasks , tm_event_t * event ) { struct taskhold * thold ; struct tcp_chan * chan = NULL ; if ( ! init_done ) return TM_BADINIT ; if ( tid_list == NULL || list_size == 0 || ntasks == NULL ) return TM_EBADENVIRONMENT ; * event = new_event ( ) ; if ( startcom ( TM_TASKS , * event , & chan ) != DIS_SUCCESS ) return TM_ESYSTEM ; if ( diswsi ( chan , node ) != DIS_SUCCESS ) { DIS_tcp_cleanup ( chan ) ; return TM_ESYSTEM ; } DIS_tcp_wflush ( chan ) ; DIS_tcp_cleanup ( chan ) ; thold = ( struct taskhold * ) calloc ( 1 , sizeof ( struct taskhold ) ) ; assert ( thold != NULL ) ; thold -> list = tid_list ; thold -> size = list_size ; thold -> ntasks = ntasks ; add_event ( * event , node , TM_TASKS , ( void * ) thold ) ; return TM_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int read_channel_params ( MLPDecodeContext * m , unsigned int substr , GetBitContext * gbp , unsigned int ch ) { SubStream * s = & m -> substream [ substr ] ; ChannelParams * cp = & s -> channel_params [ ch ] ; FilterParams * fir = & cp -> filter_params [ FIR ] ; FilterParams * iir = & cp -> filter_params [ IIR ] ; int ret ; if ( s -> param_presence_flags & PARAM_FIR ) if ( get_bits1 ( gbp ) ) if ( ( ret = read_filter_params ( m , gbp , substr , ch , FIR ) ) < 0 ) return ret ; if ( s -> param_presence_flags & PARAM_IIR ) if ( get_bits1 ( gbp ) ) if ( ( ret = read_filter_params ( m , gbp , substr , ch , IIR ) ) < 0 ) return ret ; if ( fir -> order + iir -> order > 8 ) { av_log ( m -> avctx , AV_LOG_ERROR , "Total filter orders too high.\n" ) ; return AVERROR_INVALIDDATA ; } if ( fir -> order && iir -> order && fir -> shift != iir -> shift ) { av_log ( m -> avctx , AV_LOG_ERROR , "FIR and IIR filters must use the same precision.\n" ) ; return AVERROR_INVALIDDATA ; } if ( ! fir -> order && iir -> order ) fir -> shift = iir -> shift ; if ( s -> param_presence_flags & PARAM_HUFFOFFSET ) if ( get_bits1 ( gbp ) ) cp -> huff_offset = get_sbits ( gbp , 15 ) ; cp -> codebook = get_bits ( gbp , 2 ) ; cp -> huff_lsbs = get_bits ( gbp , 5 ) ; if ( cp -> huff_lsbs > 24 ) { av_log ( m -> avctx , AV_LOG_ERROR , "Invalid huff_lsbs.\n" ) ; return AVERROR_INVALIDDATA ; } cp -> sign_huff_offset = calculate_sign_huff ( m , substr , ch ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
proto_item * proto_tree_add_text_internal ( proto_tree * tree , tvbuff_t * tvb , gint start , gint length , const char * format , ... ) { proto_item * pi ; va_list ap ; header_field_info * hfinfo ; CHECK_FOR_NULL_TREE ( tree ) ; TRY_TO_FAKE_THIS_ITEM ( tree , hf_text_only , hfinfo ) ; pi = proto_tree_add_text_node ( tree , tvb , start , length ) ; TRY_TO_FAKE_THIS_REPR ( pi ) ; va_start ( ap , format ) ; proto_tree_set_representation ( pi , format , ap ) ; va_end ( ap ) ; return pi ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void ctl_putts ( const char * tag , l_fp * ts ) { register char * cp ; register const char * cq ; char buffer [ 200 ] ; cp = buffer ; cq = tag ; while ( * cq != '\0' ) * cp ++ = * cq ++ ; * cp ++ = '=' ; INSIST ( ( size_t ) ( cp - buffer ) < sizeof ( buffer ) ) ; snprintf ( cp , sizeof ( buffer ) - ( cp - buffer ) , "0x%08x.%08x" , ( u_int ) ts -> l_ui , ( u_int ) ts -> l_uf ) ; cp += strlen ( cp ) ; ctl_putdata ( buffer , ( unsigned ) ( cp - buffer ) , 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void desegment_iax ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * iax2_tree , proto_tree * tree , gboolean video , iax_packet_data * iax_packet ) { iax_call_data * iax_call = iax_packet -> call_data ; iax_call_dirdata * dirdata ; gpointer value = NULL ; guint32 frag_offset = 0 ; fragment_head * fd_head ; gboolean must_desegment = FALSE ; DISSECTOR_ASSERT ( iax_call ) ; pinfo -> can_desegment = 2 ; pinfo -> desegment_offset = 0 ; pinfo -> desegment_len = 0 ; # ifdef DEBUG_DESEGMENT g_debug ( "dissecting packet %u" , pinfo -> fd -> num ) ; # endif dirdata = & ( iax_call -> dirdata [ ! ! ( iax_packet -> reversed ) ] ) ; if ( ( ! pinfo -> fd -> flags . visited && ( dirdata -> current_frag_bytes > 0 ) ) || ( ( value = g_hash_table_lookup ( iax_fid_table , GUINT_TO_POINTER ( pinfo -> fd -> num ) ) ) != NULL ) ) { guint32 fid ; guint32 frag_len = tvb_reported_length ( tvb ) ; gboolean complete ; # ifdef DEBUG_DESEGMENT g_debug ( "visited: %i; c_f_b: %u; hash: %u->%u" , pinfo -> fd -> flags . visited ? 1 : 0 , dirdata -> current_frag_bytes , pinfo -> fd -> num , dirdata -> current_frag_id ) ; # endif if ( ! pinfo -> fd -> flags . visited ) { guint32 tot_len ; fid = dirdata -> current_frag_id ; tot_len = dirdata -> current_frag_minlen ; DISSECTOR_ASSERT ( g_hash_table_lookup ( iax_fid_table , GUINT_TO_POINTER ( pinfo -> fd -> num ) ) == NULL ) ; g_hash_table_insert ( iax_fid_table , GUINT_TO_POINTER ( pinfo -> fd -> num ) , GUINT_TO_POINTER ( fid ) ) ; frag_offset = dirdata -> current_frag_bytes ; dirdata -> current_frag_bytes += frag_len ; complete = dirdata -> current_frag_bytes > tot_len ; # ifdef DEBUG_DESEGMENT g_debug ( "hash: %u->%u; frag_offset: %u; c_f_b: %u; totlen: %u" , pinfo -> fd -> num , fid , frag_offset , dirdata -> current_frag_bytes , tot_len ) ; # endif } else { fid = GPOINTER_TO_UINT ( value ) ; dirdata -> current_frag_bytes = 0 ; complete = FALSE ; } fd_head = fragment_add ( & iax_reassembly_table , tvb , 0 , pinfo , fid , NULL , frag_offset , frag_len , ! complete ) ; if ( fd_head && ( pinfo -> fd -> num == fd_head -> reassembled_in ) ) { gint32 old_len ; tvbuff_t * next_tvb = tvb_new_chain ( tvb , fd_head -> tvb_data ) ; add_new_data_source ( pinfo , next_tvb , "Reassembled IAX2" ) ; process_iax_pdu ( next_tvb , pinfo , tree , video , iax_packet ) ; old_len = ( gint32 ) ( tvb_reported_length ( next_tvb ) - frag_len ) ; if ( pinfo -> desegment_len && ( pinfo -> desegment_offset < old_len ) ) { fragment_set_partial_reassembly ( & iax_reassembly_table , pinfo , fid , NULL ) ; if ( pinfo -> desegment_len == DESEGMENT_ONE_MORE_SEGMENT ) { dirdata -> current_frag_minlen = fd_head -> datalen + 1 ; } else { dirdata -> current_frag_minlen = fd_head -> datalen + pinfo -> desegment_len ; } } else { proto_item * iax_tree_item , * frag_tree_item ; show_fragment_tree ( fd_head , & iax2_fragment_items , tree , pinfo , next_tvb , & frag_tree_item ) ; iax_tree_item = proto_item_get_parent ( proto_tree_get_parent ( iax2_tree ) ) ; if ( frag_tree_item && iax_tree_item ) proto_tree_move_item ( tree , iax_tree_item , frag_tree_item ) ; dirdata -> current_frag_minlen = dirdata -> current_frag_id = dirdata -> current_frag_bytes = 0 ; if ( pinfo -> desegment_len ) { must_desegment = TRUE ; pinfo -> desegment_offset -= old_len ; } fd_head = NULL ; } } } else { process_iax_pdu ( tvb , pinfo , tree , video , iax_packet ) ; if ( pinfo -> desegment_len ) { must_desegment = TRUE ; } fd_head = NULL ; } if ( must_desegment ) { guint32 fid = pinfo -> fd -> num ; guint32 deseg_offset = pinfo -> desegment_offset ; guint32 frag_len = tvb_reported_length_remaining ( tvb , deseg_offset ) ; dirdata -> current_frag_id = fid ; dirdata -> current_frag_bytes = frag_len ; if ( pinfo -> desegment_len == DESEGMENT_ONE_MORE_SEGMENT ) { dirdata -> current_frag_minlen = frag_len + 1 ; } else { dirdata -> current_frag_minlen = frag_len + pinfo -> desegment_len ; } fd_head = fragment_add ( & iax_reassembly_table , tvb , deseg_offset , pinfo , fid , NULL , 0 , frag_len , TRUE ) ; # ifdef DEBUG_DESEGMENT g_debug ( "Start offset of undissected bytes: %u; " "Bytes remaining in this segment: %u; min required bytes: %u\n" , deseg_offset , frag_len , frag_len + pinfo -> desegment_len ) ; # endif } if ( fd_head != NULL ) { guint32 deseg_offset = pinfo -> desegment_offset ; if ( fd_head -> reassembled_in != 0 && ! ( fd_head -> flags & FD_PARTIAL_REASSEMBLY ) ) { proto_item * iax_tree_item ; iax_tree_item = proto_tree_add_uint ( tree , hf_iax2_reassembled_in , tvb , deseg_offset , tvb_reported_length_remaining ( tvb , deseg_offset ) , fd_head -> reassembled_in ) ; PROTO_ITEM_SET_GENERATED ( iax_tree_item ) ; } else { proto_tree_add_item ( tree , hf_iax2_fragment_unfinished , tvb , deseg_offset , - 1 , ENC_NA ) ; } if ( pinfo -> desegment_offset == 0 ) { col_set_str ( pinfo -> cinfo , COL_PROTOCOL , "IAX2" ) ; col_set_str ( pinfo -> cinfo , COL_INFO , "[IAX2 segment of a reassembled PDU]" ) ; } } pinfo -> can_desegment = 0 ; pinfo -> desegment_offset = 0 ; pinfo -> desegment_len = 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void apply_frame_size ( VP9_COMMON * cm , int width , int height ) { # if CONFIG_SIZE_LIMIT if ( width > DECODE_WIDTH_LIMIT || height > DECODE_HEIGHT_LIMIT ) vpx_internal_error ( & cm -> error , VPX_CODEC_CORRUPT_FRAME , "Width and height beyond allowed size." ) ; # endif if ( cm -> width != width || cm -> height != height ) { if ( width > cm -> width || height > cm -> height ) { if ( vp9_resize_frame_buffers ( cm , width , height ) ) vpx_internal_error ( & cm -> error , VPX_CODEC_MEM_ERROR , "Failed to allocate frame buffers" ) ; } cm -> width = width ; cm -> height = height ; vp9_update_frame_size ( cm ) ; } if ( vp9_realloc_frame_buffer ( get_frame_new_buffer ( cm ) , cm -> width , cm -> height , cm -> subsampling_x , cm -> subsampling_y , VP9_DEC_BORDER_IN_PIXELS , & cm -> frame_bufs [ cm -> new_fb_idx ] . raw_frame_buffer , cm -> get_fb_cb , cm -> cb_priv ) ) { vpx_internal_error ( & cm -> error , VPX_CODEC_MEM_ERROR , "Failed to allocate frame buffer" ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int X509_REQ_sign ( X509_REQ * x , EVP_PKEY * pkey , const EVP_MD * md ) { return ( ASN1_item_sign ( ASN1_ITEM_rptr ( X509_REQ_INFO ) , x -> sig_alg , NULL , x -> signature , x -> req_info , pkey , md ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void nautilus_file_operations_delete ( GList * files , GtkWindow * parent_window , NautilusDeleteCallback done_callback , gpointer done_callback_data ) { trash_or_delete_internal ( files , parent_window , FALSE , done_callback , done_callback_data ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void mbfl_buffer_converter_delete ( mbfl_buffer_converter * convd ) { if ( convd != NULL ) { if ( convd -> filter1 ) { mbfl_convert_filter_delete ( convd -> filter1 ) ; } if ( convd -> filter2 ) { mbfl_convert_filter_delete ( convd -> filter2 ) ; } mbfl_memory_device_clear ( & convd -> device ) ; mbfl_free ( ( void * ) convd ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void sig_connect_failed ( SERVER_REC * server , gchar * msg ) { g_return_if_fail ( server != NULL ) ; if ( msg == NULL ) { printformat ( server , NULL , MSGLEVEL_CLIENTNOTICE , TXT_CONNECTION_LOST , server -> connrec -> address ) ; } else { printformat ( server , NULL , MSGLEVEL_CLIENTERROR , TXT_CANT_CONNECT , server -> connrec -> address , server -> connrec -> port , msg ) ; } }
0False