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
IN_PROC_BROWSER_TEST_F ( ClientHintsBrowserTest , ClientHintsLifetimeNotAttachedJavaScriptBlocked ) { base : : HistogramTester histogram_tester ; ContentSettingsForOneType host_settings ; HostContentSettingsMapFactory : : GetForProfile ( browser ( ) -> profile ( ) ) -> GetSettingsForOneType ( CONTENT_SETTINGS_TYPE_CLIENT_HINTS , std : : string ( ) , & host_settings ) ; EXPECT_EQ ( 0u , host_settings . size ( ) ) ; ui_test_utils : : NavigateToURL ( browser ( ) , accept_ch_with_lifetime_url ( ) ) ; histogram_tester . ExpectUniqueSample ( "ClientHints.UpdateEventCount" , 1 , 1 ) ; content : : FetchHistogramsFromChildProcesses ( ) ; SubprocessMetricsProvider : : MergeHistogramDeltasForTesting ( ) ; histogram_tester . ExpectUniqueSample ( "ClientHints.UpdateSize" , 3 , 1 ) ; histogram_tester . ExpectUniqueSample ( "ClientHints.PersistDuration" , * 1000 , 1 ) ; base : : RunLoop ( ) . RunUntilIdle ( ) ; HostContentSettingsMapFactory : : GetForProfile ( browser ( ) -> profile ( ) ) -> GetSettingsForOneType ( CONTENT_SETTINGS_TYPE_CLIENT_HINTS , std : : string ( ) , & host_settings ) ; EXPECT_EQ ( 1u , host_settings . size ( ) ) ; HostContentSettingsMapFactory : : GetForProfile ( browser ( ) -> profile ( ) ) -> SetContentSettingDefaultScope ( without_accept_ch_without_lifetime_url ( ) , GURL ( ) , CONTENT_SETTINGS_TYPE_JAVASCRIPT , std : : string ( ) , CONTENT_SETTING_BLOCK ) ; ui_test_utils : : NavigateToURL ( browser ( ) , without_accept_ch_without_lifetime_url ( ) ) ; EXPECT_EQ ( 0u , count_client_hints_headers_seen ( ) ) ; VerifyContentSettingsNotNotified ( ) ; HostContentSettingsMapFactory : : GetForProfile ( browser ( ) -> profile ( ) ) -> SetContentSettingDefaultScope ( without_accept_ch_without_lifetime_url ( ) , GURL ( ) , CONTENT_SETTINGS_TYPE_JAVASCRIPT , std : : string ( ) , CONTENT_SETTING_ALLOW ) ; SetClientHintExpectationsOnMainFrame ( true ) ; SetClientHintExpectationsOnSubresources ( true ) ; ui_test_utils : : NavigateToURL ( browser ( ) , without_accept_ch_without_lifetime_url ( ) ) ; # if defined ( OS_ANDROID ) EXPECT_EQ ( 4u , count_client_hints_headers_seen ( ) ) ; # else EXPECT_EQ ( 6u , count_client_hints_headers_seen ( ) ) ; # endif HostContentSettingsMapFactory : : GetForProfile ( browser ( ) -> profile ( ) ) -> ClearSettingsForOneType ( CONTENT_SETTINGS_TYPE_JAVASCRIPT ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_NoPTAudioToneCapability ( 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_NoPTAudioToneCapability , NoPTAudioToneCapability_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static vpx_codec_err_t ctrl_set_frame_periodic_boost ( vpx_codec_alg_priv_t * ctx , va_list args ) { struct vp9_extracfg extra_cfg = ctx -> extra_cfg ; extra_cfg . frame_periodic_boost = CAST ( VP9E_SET_FRAME_PERIODIC_BOOST , args ) ; return update_extra_cfg ( ctx , & extra_cfg ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void kadmin_addpol ( int argc , char * argv [ ] ) { krb5_error_code retval ; long mask ; kadm5_policy_ent_rec policy ; memset ( & policy , 0 , sizeof ( policy ) ) ; if ( kadmin_parse_policy_args ( argc , argv , & policy , & mask , "add_policy" ) ) { kadmin_addmodpol_usage ( "add_policy" ) ; return ; } policy . policy = argv [ argc - 1 ] ; mask |= KADM5_POLICY ; retval = kadm5_create_policy ( handle , & policy , mask ) ; if ( retval ) { com_err ( "add_policy" , retval , _ ( "while creating policy \"%s\"." ) , policy . policy ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int event_priority_set ( struct event * ev , int pri ) { if ( ev -> ev_flags & EVLIST_ACTIVE ) return ( - 1 ) ; if ( pri < 0 || pri >= ev -> ev_base -> nactivequeues ) return ( - 1 ) ; ev -> ev_pri = pri ; return ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
bool handle_new_meta_connection ( int sock ) { connection_t * c ; sockaddr_t sa ; int fd ; socklen_t len = sizeof ( sa ) ; fd = accept ( sock , & sa . sa , & len ) ; if ( fd < 0 ) { logger ( LOG_ERR , "Accepting a new connection failed: %s" , sockstrerror ( sockerrno ) ) ; return false ; } sockaddrunmap ( & sa ) ; c = new_connection ( ) ; c -> name = xstrdup ( "<unknown>" ) ; c -> outcipher = myself -> connection -> outcipher ; c -> outdigest = myself -> connection -> outdigest ; c -> outmaclength = myself -> connection -> outmaclength ; c -> outcompression = myself -> connection -> outcompression ; c -> address = sa ; c -> hostname = sockaddr2hostname ( & sa ) ; c -> socket = fd ; c -> last_ping_time = now ; ifdebug ( CONNECTIONS ) logger ( LOG_NOTICE , "Connection from %s" , c -> hostname ) ; configure_tcp ( c ) ; connection_add ( c ) ; c -> allow_request = ID ; send_id ( c ) ; return true ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static gboolean dissect_iwarp_mpa ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) { tvbuff_t * next_tvb = NULL ; conversation_t * conversation = NULL ; mpa_state_t * state = NULL ; struct tcpinfo * tcpinfo ; guint8 endpoint = 3 ; guint16 ulpdu_length = 0 ; if ( data == NULL ) return FALSE ; tcpinfo = ( struct tcpinfo * ) data ; if ( tvb_captured_length ( tvb ) >= MPA_SMALLEST_FPDU_LEN && is_mpa_fpdu ( pinfo ) ) { conversation = find_conversation ( pinfo -> num , & pinfo -> src , & pinfo -> dst , pinfo -> ptype , pinfo -> srcport , pinfo -> destport , 0 ) ; state = get_mpa_state ( conversation ) ; if ( pinfo -> srcport == state -> minfo [ MPA_INITIATOR ] . port ) { endpoint = MPA_INITIATOR ; } else if ( pinfo -> srcport == state -> minfo [ MPA_RESPONDER ] . port ) { endpoint = MPA_RESPONDER ; } else { REPORT_DISSECTOR_BUG ( "endpoint cannot be determined" ) ; } if ( ( state -> ini_exp_m_res || state -> res_exp_m_ini ) && endpoint <= MPA_RESPONDER ) { if ( ! state -> minfo [ endpoint ] . valid ) { state -> minfo [ endpoint ] . seq = tcpinfo -> seq ; state -> minfo [ endpoint ] . valid = TRUE ; } } ulpdu_length = dissect_mpa_fpdu ( tvb , pinfo , tree , state , tcpinfo , endpoint ) ; if ( ! ulpdu_length ) return FALSE ; if ( endpoint <= MPA_RESPONDER && state -> minfo [ endpoint ] . valid && number_of_markers ( state , tcpinfo , endpoint ) > 0 ) { next_tvb = tvb_new_subset_length ( remove_markers ( tvb , pinfo , get_first_marker_offset ( state , tcpinfo , endpoint ) , number_of_markers ( state , tcpinfo , endpoint ) , fpdu_total_length ( tcpinfo ) ) , MPA_ULPDU_LENGTH_LEN , ulpdu_length ) ; } else { next_tvb = tvb_new_subset_length ( tvb , MPA_ULPDU_LENGTH_LEN , ulpdu_length ) ; } if ( ddp_rdmap_handle ) { call_dissector ( ddp_rdmap_handle , next_tvb , pinfo , tree ) ; } else { REPORT_DISSECTOR_BUG ( "ddp_handle was null" ) ; } return TRUE ; } if ( tvb_captured_length ( tvb ) >= MPA_REQ_REP_FRAME_HEADER_LEN ) { if ( is_mpa_req ( tvb , pinfo ) ) return dissect_mpa_req_rep ( tvb , pinfo , tree , MPA_REQUEST_FRAME ) ; else if ( is_mpa_rep ( tvb , pinfo ) ) return dissect_mpa_req_rep ( tvb , pinfo , tree , MPA_REPLY_FRAME ) ; } return FALSE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static List * expand_function_arguments ( List * args , Oid result_type , HeapTuple func_tuple ) { Form_pg_proc funcform = ( Form_pg_proc ) GETSTRUCT ( func_tuple ) ; bool has_named_args = false ; ListCell * lc ; foreach ( lc , args ) { Node * arg = ( Node * ) lfirst ( lc ) ; if ( IsA ( arg , NamedArgExpr ) ) { has_named_args = true ; break ; } } if ( has_named_args ) { args = reorder_function_arguments ( args , func_tuple ) ; recheck_cast_function_args ( args , result_type , func_tuple ) ; } else if ( list_length ( args ) < funcform -> pronargs ) { args = add_function_defaults ( args , func_tuple ) ; recheck_cast_function_args ( args , result_type , func_tuple ) ; } return args ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
unsigned long # define BN_LONG long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK ( 0xffffffffffffffffffffffffffffffffLL ) # define BN_MASK2 ( 0xffffffffffffffffL ) # define BN_MASK2l ( 0xffffffffL ) # define BN_MASK2h ( 0xffffffff00000000L ) # define BN_MASK2h1 ( 0xffffffff80000000L ) # define BN_TBIT ( 0x8000000000000000L ) # define BN_DEC_CONV ( 10000000000000000000UL ) # define BN_DEC_FMT1 "%lu" # define BN_DEC_FMT2 "%019lu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%lX" # define BN_HEX_FMT2 "%016lX" # endif # ifdef SIXTY_FOUR_BIT # undef BN_LLONG # undef BN_ULLONG # define BN_ULONG unsigned long long # define BN_LONG long long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK2 ( 0xffffffffffffffffLL ) # define BN_MASK2l ( 0xffffffffL ) # define BN_MASK2h ( 0xffffffff00000000LL ) # define BN_MASK2h1 ( 0xffffffff80000000LL ) # define BN_TBIT ( 0x8000000000000000LL ) # define BN_DEC_CONV ( 10000000000000000000ULL ) # define BN_DEC_FMT1 "%llu" # define BN_DEC_FMT2 "%019llu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%llX" # define BN_HEX_FMT2 "%016llX" # endif # ifdef THIRTY_TWO_BIT # ifdef BN_LLONG # if defined ( _WIN32 ) && ! defined ( __GNUC__ ) # define BN_ULLONG unsigned __int64 # define BN_MASK ( 0xffffffffffffffffI64 ) # else # define BN_ULLONG unsigned long long # define BN_MASK ( 0xffffffffffffffffLL ) # endif # endif # define BN_ULONG unsigned int # define BN_LONG int # define BN_BITS 64 # define BN_BYTES 4 # define BN_BITS2 32 # define BN_BITS4 16 # define BN_MASK2 ( 0xffffffffL ) # define BN_MASK2l ( 0xffff ) # define BN_MASK2h1 ( 0xffff8000L ) # define BN_MASK2h ( 0xffff0000L ) # define BN_TBIT ( 0x80000000L ) # define BN_DEC_CONV ( 1000000000L ) # define BN_DEC_FMT1 "%u" # define BN_DEC_FMT2 "%09u" # define BN_DEC_NUM 9 # define BN_HEX_FMT1 "%X" # define BN_HEX_FMT2 "%08X" # endif # define BN_DEFAULT_BITS 1280 # define BN_FLG_MALLOCED 0x01 # define BN_FLG_STATIC_DATA 0x02 # define BN_FLG_CONSTTIME 0x04 # ifndef OPENSSL_NO_DEPRECATED # define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME # endif # ifndef OPENSSL_NO_DEPRECATED # define BN_FLG_FREE 0x8000 # endif # define BN_set_flags ( b , n ) ( ( b ) -> flags |= ( n ) ) # define BN_get_flags ( b , n ) ( ( b ) -> flags & ( n ) ) # define BN_with_flags ( dest , b , n ) ( ( dest ) -> d = ( b ) -> d , \ ( dest ) -> top = ( b ) -> top , \ ( dest ) -> dmax = ( b ) -> dmax , \ ( dest ) -> neg = ( b ) -> neg , \ ( dest ) -> flags = ( ( ( dest ) -> flags & BN_FLG_MALLOCED ) \ | ( ( b ) -> flags & ~ BN_FLG_MALLOCED ) \ | BN_FLG_STATIC_DATA \ | ( n ) ) ) # if 0 typedef struct bignum_st BIGNUM ; typedef struct bignum_ctx BN_CTX ; typedef struct bn_blinding_st BN_BLINDING ; typedef struct bn_mont_ctx_st BN_MONT_CTX ; typedef struct bn_recp_ctx_st BN_RECP_CTX ; typedef struct bn_gencb_st BN_GENCB ; # endif struct bignum_st { BN_ULONG * d ; int top ; int dmax ; int neg ; int flags ; } ; struct bn_mont_ctx_st { int ri ; BIGNUM RR ; BIGNUM N ; BIGNUM Ni ; BN_ULONG n0 [ 2 ] ; int flags ; } ; struct bn_recp_ctx_st { BIGNUM N ; BIGNUM Nr ; int num_bits ; int shift ; int flags ; } ; struct bn_gencb_st { unsigned int ver ; void * arg ; union { void ( * cb_1 ) ( int , int , void * ) ; int ( * cb_2 ) ( int , int , BN_GENCB * ) ; } cb ; } ; int BN_GENCB_call ( BN_GENCB * cb , int a , int b ) ; # define BN_GENCB_set_old ( gencb , callback , cb_arg ) { \ BN_GENCB * tmp_gencb = ( gencb ) ; \ tmp_gencb -> ver = 1 ; \ tmp_gencb -> arg = ( cb_arg ) ; \ tmp_gencb -> cb . cb_1 = ( callback ) ; } # define BN_GENCB_set ( gencb , callback , cb_arg ) { \ BN_GENCB * tmp_gencb = ( gencb ) ; \ tmp_gencb -> ver = 2 ; \ tmp_gencb -> arg = ( cb_arg ) ; \ tmp_gencb -> cb . cb_2 = ( callback ) ; } # define BN_prime_checks 0 # define BN_prime_checks_for_size ( b ) ( ( b ) >= 1300 ? 2 : \ ( b ) >= 850 ? 3 : \ ( b ) >= 650 ? 4 : \ ( b ) >= 550 ? 5 : \ ( b ) >= 450 ? 6 : \ ( b ) >= 400 ? 7 : \ ( b ) >= 350 ? 8 : \ ( b ) >= 300 ? 9 : \ ( b ) >= 250 ? 12 : \ ( b ) >= 200 ? 15 : \ ( b ) >= 150 ? 18 : \ 27 ) # define BN_num_bytes ( a ) ( ( BN_num_bits ( a ) + 7 ) / 8 ) # define BN_abs_is_word ( a , w ) ( ( ( ( a ) -> top == 1 ) && ( ( a ) -> d [ 0 ] == ( BN_ULONG ) ( w ) ) ) || \ ( ( ( w ) == 0 ) && ( ( a ) -> top == 0 ) ) ) # define BN_is_zero ( a ) ( ( a ) -> top == 0 ) # define BN_is_one ( a ) ( BN_abs_is_word ( ( a ) , 1 ) && ! ( a ) -> neg ) # define BN_is_word ( a , w ) ( BN_abs_is_word ( ( a ) , ( w ) ) && ( ! ( w ) || ! ( a ) -> neg ) ) # define BN_is_odd ( a ) ( ( ( a ) -> top > 0 ) && ( ( a ) -> d [ 0 ] & 1 ) ) # define BN_one ( a ) ( BN_set_word ( ( a ) , 1 ) ) # define BN_zero_ex ( a ) \ do { \ BIGNUM * _tmp_bn = ( a ) ; \ _tmp_bn -> top = 0 ; \ _tmp_bn -> neg = 0 ; \ } while ( 0 ) # ifdef OPENSSL_NO_DEPRECATED # define BN_zero ( a ) BN_zero_ex ( a ) # else # define BN_zero ( a ) ( BN_set_word ( ( a ) , 0 ) ) # endif const BIGNUM * BN_value_one ( void ) ; char * BN_options ( void ) ; BN_CTX * BN_CTX_new ( void ) ; # ifndef OPENSSL_NO_DEPRECATED void BN_CTX_init ( BN_CTX * c ) ; # endif void BN_CTX_free ( BN_CTX * c ) ; void BN_CTX_start ( BN_CTX * ctx ) ; BIGNUM * BN_CTX_get ( BN_CTX * ctx ) ; void BN_CTX_end ( BN_CTX * ctx ) ; int BN_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ; int BN_pseudo_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ; int BN_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ; int BN_pseudo_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ; int BN_num_bits ( const BIGNUM * a ) ; int BN_num_bits_word ( BN_ULONG l ) ; BIGNUM * BN_new ( void ) ; void BN_init ( BIGNUM * ) ; void BN_clear_free ( BIGNUM * a ) ; BIGNUM * BN_copy ( BIGNUM * a , const BIGNUM * b ) ; void BN_swap ( BIGNUM * a , BIGNUM * b ) ; BIGNUM * BN_bin2bn ( const unsigned char * s , int len , BIGNUM * ret ) ; int BN_bn2bin ( const BIGNUM * a , unsigned char * to ) ; BIGNUM * BN_mpi2bn ( const unsigned char * s , int len , BIGNUM * ret ) ; int BN_bn2mpi ( const BIGNUM * a , unsigned char * to ) ; int BN_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ; int BN_usub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ; int BN_uadd ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ; int BN_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ; int BN_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ; int BN_sqr ( BIGNUM * r , const BIGNUM * a , BN_CTX * ctx ) ; void BN_set_negative ( BIGNUM * b , int n ) ; # define BN_is_negative ( a ) ( ( a ) -> neg != 0 ) int BN_div ( BIGNUM * dv , BIGNUM * rem , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ; # define BN_mod ( rem , m , d , ctx ) BN_div ( NULL , ( rem ) , ( m ) , ( d ) , ( ctx ) ) int BN_nnmod ( BIGNUM * r , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ; int BN_mod_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_add_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ; int BN_mod_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_sub_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ; int BN_mod_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_sqr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_lshift1 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_lshift1_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m ) ; int BN_mod_lshift ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_lshift_quick ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m ) ; BN_ULONG BN_mod_word ( const BIGNUM * a , BN_ULONG w ) ; BN_ULONG BN_div_word ( BIGNUM * a , BN_ULONG w ) ; int BN_mul_word ( BIGNUM * a , BN_ULONG w ) ; int BN_add_word ( BIGNUM * a , BN_ULONG w ) ; int BN_sub_word ( BIGNUM * a , BN_ULONG w ) ; int BN_set_word ( BIGNUM * a , BN_ULONG w ) ; BN_ULONG BN_get_word ( const BIGNUM * a )
0False
Categorize the following code snippet as vulnerable or not. True or False
void vpx_svc_release ( SvcContext * svc_ctx ) { SvcInternal * si ; if ( svc_ctx == NULL ) return ; si = ( SvcInternal * ) svc_ctx -> internal ; if ( si != NULL ) { fd_free ( si -> frame_temp ) ; fd_free_list ( si -> frame_list ) ; if ( si -> rc_stats_buf ) { free ( si -> rc_stats_buf ) ; } free ( si ) ; svc_ctx -> internal = NULL ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int next ( struct vars * v ) { chr c ; if ( ISERR ( ) ) return 0 ; v -> lasttype = v -> nexttype ; if ( v -> nexttype == EMPTY && ( v -> cflags & REG_BOSONLY ) ) { RETV ( SBEGIN , 0 ) ; } if ( v -> savenow != NULL && ATEOS ( ) ) { v -> now = v -> savenow ; v -> stop = v -> savestop ; v -> savenow = v -> savestop = NULL ; } if ( v -> cflags & REG_EXPANDED ) switch ( v -> lexcon ) { case L_ERE : case L_BRE : case L_EBND : case L_BBND : skip ( v ) ; break ; } if ( ATEOS ( ) ) { switch ( v -> lexcon ) { case L_ERE : case L_BRE : case L_Q : RET ( EOS ) ; break ; case L_EBND : case L_BBND : FAILW ( REG_EBRACE ) ; break ; case L_BRACK : case L_CEL : case L_ECL : case L_CCL : FAILW ( REG_EBRACK ) ; break ; } assert ( NOTREACHED ) ; } c = * v -> now ++ ; switch ( v -> lexcon ) { case L_BRE : return brenext ( v , c ) ; break ; case L_ERE : break ; case L_Q : RETV ( PLAIN , c ) ; break ; case L_BBND : case L_EBND : switch ( c ) { case CHR ( '0' ) : case CHR ( '1' ) : case CHR ( '2' ) : case CHR ( '3' ) : case CHR ( '4' ) : case CHR ( '5' ) : case CHR ( '6' ) : case CHR ( '7' ) : case CHR ( '8' ) : case CHR ( '9' ) : RETV ( DIGIT , ( chr ) DIGITVAL ( c ) ) ; break ; case CHR ( ',' ) : RET ( ',' ) ; break ; case CHR ( '} ' ) : if ( INCON ( L_EBND ) ) { INTOCON ( L_ERE ) ; if ( ( v -> cflags & REG_ADVF ) && NEXT1 ( '?' ) ) { v -> now ++ ; NOTE ( REG_UNONPOSIX ) ; RETV ( '} ' , 0 ) ; } RETV ( '} ' , 1 ) ; } else FAILW ( REG_BADBR ) ; break ; case CHR ( '\\' ) : if ( INCON ( L_BBND ) && NEXT1 ( '} ' ) ) { v -> now ++ ; INTOCON ( L_BRE ) ; RET ( '} ' ) ; } else FAILW ( REG_BADBR ) ; break ; default : FAILW ( REG_BADBR ) ; break ; } assert ( NOTREACHED ) ; break ; case L_BRACK : switch ( c ) { case CHR ( ']' ) : if ( LASTTYPE ( '[' ) ) RETV ( PLAIN , c ) ; else { INTOCON ( ( v -> cflags & REG_EXTENDED ) ? L_ERE : L_BRE ) ; RET ( ']' ) ; } break ; case CHR ( '\\' ) : NOTE ( REG_UBBS ) ; if ( ! ( v -> cflags & REG_ADVF ) ) RETV ( PLAIN , c ) ; NOTE ( REG_UNONPOSIX ) ; if ( ATEOS ( ) ) FAILW ( REG_EESCAPE ) ; ( DISCARD ) lexescape ( v ) ; switch ( v -> nexttype ) { case PLAIN : return 1 ; break ; case CCLASS : switch ( v -> nextvalue ) { case 'd' : lexnest ( v , brbackd , ENDOF ( brbackd ) ) ; break ; case 's' : lexnest ( v , brbacks , ENDOF ( brbacks ) ) ; break ; case 'w' : lexnest ( v , brbackw , ENDOF ( brbackw ) ) ; break ; default : FAILW ( REG_EESCAPE ) ; break ; } v -> nexttype = v -> lasttype ; return next ( v ) ; break ; } FAILW ( REG_EESCAPE ) ; break ; case CHR ( '-' ) : if ( LASTTYPE ( '[' ) || NEXT1 ( ']' ) ) RETV ( PLAIN , c ) ; else RETV ( RANGE , c ) ; break ; case CHR ( '[' ) : if ( ATEOS ( ) ) FAILW ( REG_EBRACK ) ; switch ( * v -> now ++ ) { case CHR ( '.' ) : INTOCON ( L_CEL ) ; RET ( COLLEL ) ; break ; case CHR ( '=' ) : INTOCON ( L_ECL ) ; NOTE ( REG_ULOCALE ) ; RET ( ECLASS ) ; break ; case CHR ( ':' ) : INTOCON ( L_CCL ) ; NOTE ( REG_ULOCALE ) ; RET ( CCLASS ) ; break ; default : v -> now -- ; RETV ( PLAIN , c ) ; break ; } assert ( NOTREACHED ) ; break ; default : RETV ( PLAIN , c ) ; break ; } assert ( NOTREACHED ) ; break ; case L_CEL : if ( c == CHR ( '.' ) && NEXT1 ( ']' ) ) { v -> now ++ ; INTOCON ( L_BRACK ) ; RETV ( END , '.' ) ; } else RETV ( PLAIN , c ) ; break ; case L_ECL : if ( c == CHR ( '=' ) && NEXT1 ( ']' ) ) { v -> now ++ ; INTOCON ( L_BRACK ) ; RETV ( END , '=' ) ; } else RETV ( PLAIN , c ) ; break ; case L_CCL : if ( c == CHR ( ':' ) && NEXT1 ( ']' ) ) { v -> now ++ ; INTOCON ( L_BRACK ) ; RETV ( END , ':' ) ; } else RETV ( PLAIN , c ) ; break ; default : assert ( NOTREACHED ) ; break ; } assert ( INCON ( L_ERE ) ) ; switch ( c ) { case CHR ( '|' ) : RET ( '|' ) ; break ; case CHR ( '*' ) : if ( ( v -> cflags & REG_ADVF ) && NEXT1 ( '?' ) ) { v -> now ++ ; NOTE ( REG_UNONPOSIX ) ; RETV ( '*' , 0 ) ; } RETV ( '*' , 1 ) ; break ; case CHR ( '+' ) : if ( ( v -> cflags & REG_ADVF ) && NEXT1 ( '?' ) ) { v -> now ++ ; NOTE ( REG_UNONPOSIX ) ; RETV ( '+' , 0 ) ; } RETV ( '+' , 1 ) ; break ; case CHR ( '?' ) : if ( ( v -> cflags & REG_ADVF ) && NEXT1 ( '?' ) ) { v -> now ++ ; NOTE ( REG_UNONPOSIX ) ; RETV ( '?' , 0 ) ; } RETV ( '?' , 1 ) ; break ; case CHR ( '{ ' ) : if ( v -> cflags & REG_EXPANDED ) skip ( v ) ; if ( ATEOS ( ) || ! iscdigit ( * v -> now ) ) { NOTE ( REG_UBRACES ) ; NOTE ( REG_UUNSPEC ) ; RETV ( PLAIN , c ) ; } else { NOTE ( REG_UBOUNDS ) ; INTOCON ( L_EBND ) ; RET ( '{ ' ) ; } assert ( NOTREACHED ) ; break ; case CHR ( '(' ) : if ( ( v -> cflags & REG_ADVF ) && NEXT1 ( '?' ) ) { NOTE ( REG_UNONPOSIX ) ; v -> now ++ ; if ( ATEOS ( ) ) FAILW ( REG_BADRPT ) ; switch ( * v -> now ++ ) { case CHR ( ':' ) : RETV ( '(' , 0 ) ; break ; case CHR ( '#' ) : while ( ! ATEOS ( ) && * v -> now != CHR ( ')' ) ) v -> now ++ ; if ( ! ATEOS ( ) ) v -> now ++ ; assert ( v -> nexttype == v -> lasttype ) ; return next ( v ) ; break ; case CHR ( '=' ) : NOTE ( REG_ULOOKAROUND ) ; RETV ( LACON , LATYPE_AHEAD_POS ) ; break ; case CHR ( '!' ) : NOTE ( REG_ULOOKAROUND ) ; RETV ( LACON , LATYPE_AHEAD_NEG ) ; break ; case CHR ( '<' ) : if ( ATEOS ( ) ) FAILW ( REG_BADRPT ) ; switch ( * v -> now ++ ) { case CHR ( '=' ) : NOTE ( REG_ULOOKAROUND ) ; RETV ( LACON , LATYPE_BEHIND_POS ) ; break ; case CHR ( '!' ) : NOTE ( REG_ULOOKAROUND ) ; RETV ( LACON , LATYPE_BEHIND_NEG ) ; break ; default : FAILW ( REG_BADRPT ) ; break ; } assert ( NOTREACHED ) ; break ; default : FAILW ( REG_BADRPT ) ; break ; } assert ( NOTREACHED ) ; } if ( v -> cflags & REG_NOSUB ) RETV ( '(' , 0 ) ; else RETV ( '(' , 1 ) ; break ; case CHR ( ')' ) : if ( LASTTYPE ( '(' ) ) NOTE ( REG_UUNSPEC ) ; RETV ( ')' , c ) ; break ; case CHR ( '[' ) : if ( HAVE ( 6 ) && * ( v -> now + 0 ) == CHR ( '[' ) && * ( v -> now + 1 ) == CHR ( ':' ) && ( * ( v -> now + 2 ) == CHR ( '<' ) || * ( v -> now + 2 ) == CHR ( '>' ) ) && * ( v -> now + 3 ) == CHR ( ':' ) && * ( v -> now + 4 ) == CHR ( ']' ) && * ( v -> now + 5 ) == CHR ( ']' ) ) { c = * ( v -> now + 2 ) ; v -> now += 6 ; NOTE ( REG_UNONPOSIX ) ; RET ( ( c == CHR ( '<' ) ) ? '<' : '>' ) ; } INTOCON ( L_BRACK ) ; if ( NEXT1 ( '^' ) ) { v -> now ++ ; RETV ( '[' , 0 ) ; } RETV ( '[' , 1 ) ; break ; case CHR ( '.' ) : RET ( '.' ) ; break ; case CHR ( '^' ) : RET ( '^' ) ; break ; case CHR ( '$' ) : RET ( '$' ) ; break ; case CHR ( '\\' ) : if ( ATEOS ( ) ) FAILW ( REG_EESCAPE ) ; break ; default : RETV ( PLAIN , c ) ; break ; } assert ( ! ATEOS ( ) ) ; if ( ! ( v -> cflags & REG_ADVF ) ) { if ( iscalnum ( * v -> now ) ) { NOTE ( REG_UBSALNUM ) ; NOTE ( REG_UUNSPEC ) ; } RETV ( PLAIN , * v -> now ++ ) ; } ( DISCARD ) lexescape ( v ) ; if ( ISERR ( ) ) FAILW ( REG_EESCAPE ) ; if ( v -> nexttype == CCLASS ) { switch ( v -> nextvalue ) { case 'd' : lexnest ( v , backd , ENDOF ( backd ) ) ; break ; case 'D' : lexnest ( v , backD , ENDOF ( backD ) ) ; break ; case 's' : lexnest ( v , backs , ENDOF ( backs ) ) ; break ; case 'S' : lexnest ( v , backS , ENDOF ( backS ) ) ; break ; case 'w' : lexnest ( v , backw , ENDOF ( backw ) ) ; break ; case 'W' : lexnest ( v , backW , ENDOF ( backW ) ) ; break ; default : assert ( NOTREACHED ) ; FAILW ( REG_ASSERT ) ; break ; } v -> nexttype = v -> lasttype ; return next ( v ) ; } return ! ISERR ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int parse_RowsBuffer ( tvbuff_t * tvb , int offset , guint32 num_rows , struct CPMSetBindingsIn * bindingsin , struct rows_data * rowsin , gboolean is64bit , proto_tree * parent_tree , const char * fmt , ... ) { proto_tree * tree ; proto_item * item ; guint32 num ; const char * txt ; va_list ap ; va_start ( ap , fmt ) ; txt = wmem_strdup_vprintf ( wmem_packet_scope ( ) , fmt , ap ) ; va_end ( ap ) ; tree = proto_tree_add_subtree ( parent_tree , tvb , offset , 0 , ett_GetRowsRow , & item , txt ) ; for ( num = 0 ; num < num_rows ; ++ num ) { guint32 col ; proto_tree * row_tree ; row_tree = proto_tree_add_subtree_format ( tree , tvb , offset , 0 , ett_GetRowsRow , NULL , "Row[%d]" , num ) ; for ( col = 0 ; col < bindingsin -> ccolumns ; col ++ ) { parse_RowsBufferCol ( tvb , offset , num , col , bindingsin , rowsin , is64bit , row_tree , "Col[%d]" , col ) ; } } return offset ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int nb_add_values ( char * * ret_buffer , size_t * ret_buffer_len , const lcc_value_list_t * vl ) { char * packet_ptr ; size_t packet_len ; uint16_t pkg_type ; uint16_t pkg_length ; uint16_t pkg_num_values ; uint8_t pkg_values_types [ vl -> values_len ] ; value_t pkg_values [ vl -> values_len ] ; size_t offset ; size_t i ; packet_len = sizeof ( pkg_type ) + sizeof ( pkg_length ) + sizeof ( pkg_num_values ) + sizeof ( pkg_values_types ) + sizeof ( pkg_values ) ; if ( * ret_buffer_len < packet_len ) return ( ENOMEM ) ; pkg_type = htons ( TYPE_VALUES ) ; pkg_length = htons ( ( uint16_t ) packet_len ) ; pkg_num_values = htons ( ( uint16_t ) vl -> values_len ) ; for ( i = 0 ; i < vl -> values_len ; i ++ ) { pkg_values_types [ i ] = ( uint8_t ) vl -> values_types [ i ] ; switch ( vl -> values_types [ i ] ) { case LCC_TYPE_COUNTER : pkg_values [ i ] . counter = ( counter_t ) htonll ( vl -> values [ i ] . counter ) ; break ; case LCC_TYPE_GAUGE : pkg_values [ i ] . gauge = ( gauge_t ) htond ( vl -> values [ i ] . gauge ) ; break ; case LCC_TYPE_DERIVE : pkg_values [ i ] . derive = ( derive_t ) htonll ( vl -> values [ i ] . derive ) ; break ; case LCC_TYPE_ABSOLUTE : pkg_values [ i ] . absolute = ( absolute_t ) htonll ( vl -> values [ i ] . absolute ) ; break ; default : return ( EINVAL ) ; } } packet_ptr = * ret_buffer ; offset = 0 ; memcpy ( packet_ptr + offset , & pkg_type , sizeof ( pkg_type ) ) ; offset += sizeof ( pkg_type ) ; memcpy ( packet_ptr + offset , & pkg_length , sizeof ( pkg_length ) ) ; offset += sizeof ( pkg_length ) ; memcpy ( packet_ptr + offset , & pkg_num_values , sizeof ( pkg_num_values ) ) ; offset += sizeof ( pkg_num_values ) ; memcpy ( packet_ptr + offset , pkg_values_types , sizeof ( pkg_values_types ) ) ; offset += sizeof ( pkg_values_types ) ; memcpy ( packet_ptr + offset , pkg_values , sizeof ( pkg_values ) ) ; offset += sizeof ( pkg_values ) ; assert ( offset == packet_len ) ; * ret_buffer = packet_ptr + packet_len ; * ret_buffer_len -= packet_len ; return ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void i_enable_free ( gs_memory_t * mem , bool enable ) { if ( enable ) mem -> procs . free_object = i_free_object , mem -> procs . free_string = i_free_string ; else mem -> procs . free_object = gs_ignore_free_object , mem -> procs . free_string = gs_ignore_free_string ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void virtio_pci_config_writeb ( void * opaque , uint32_t addr , uint32_t val ) { VirtIOPCIProxy * proxy = opaque ; uint32_t config = VIRTIO_PCI_CONFIG ( & proxy -> pci_dev ) ; addr -= proxy -> addr ; if ( addr < config ) { virtio_ioport_write ( proxy , addr , val ) ; return ; } addr -= config ; virtio_config_writeb ( proxy -> vdev , addr , val ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int parse_picture_segment ( AVCodecContext * avctx , const uint8_t * buf , int buf_size ) { PGSSubContext * ctx = avctx -> priv_data ; uint8_t sequence_desc ; unsigned int rle_bitmap_len , width , height ; uint16_t picture_id ; if ( buf_size <= 4 ) return - 1 ; buf_size -= 4 ; picture_id = bytestream_get_be16 ( & buf ) ; buf ++ ; sequence_desc = bytestream_get_byte ( & buf ) ; if ( ! ( sequence_desc & 0x80 ) ) { if ( buf_size > ctx -> pictures [ picture_id ] . rle_remaining_len ) return - 1 ; memcpy ( ctx -> pictures [ picture_id ] . rle + ctx -> pictures [ picture_id ] . rle_data_len , buf , buf_size ) ; ctx -> pictures [ picture_id ] . rle_data_len += buf_size ; ctx -> pictures [ picture_id ] . rle_remaining_len -= buf_size ; return 0 ; } if ( buf_size <= 7 ) return - 1 ; buf_size -= 7 ; rle_bitmap_len = bytestream_get_be24 ( & buf ) - 2 * 2 ; width = bytestream_get_be16 ( & buf ) ; height = bytestream_get_be16 ( & buf ) ; if ( avctx -> width < width || avctx -> height < height ) { av_log ( avctx , AV_LOG_ERROR , "Bitmap dimensions larger than video.\n" ) ; return - 1 ; } ctx -> pictures [ picture_id ] . w = width ; ctx -> pictures [ picture_id ] . h = height ; av_fast_malloc ( & ctx -> pictures [ picture_id ] . rle , & ctx -> pictures [ picture_id ] . rle_buffer_size , rle_bitmap_len ) ; if ( ! ctx -> pictures [ picture_id ] . rle ) return - 1 ; memcpy ( ctx -> pictures [ picture_id ] . rle , buf , buf_size ) ; ctx -> pictures [ picture_id ] . rle_data_len = buf_size ; ctx -> pictures [ picture_id ] . rle_remaining_len = rle_bitmap_len - buf_size ; return 0 ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int mss4_decode_dct_block ( MSS4Context * c , GetBitContext * gb , uint8_t * dst [ 3 ] , int mb_x , int mb_y ) { int i , j , k , ret ; uint8_t * out = dst [ 0 ] ; for ( j = 0 ; j < 2 ; j ++ ) { for ( i = 0 ; i < 2 ; i ++ ) { int xpos = mb_x * 2 + i ; c -> dc_cache [ j ] [ TOP_LEFT ] = c -> dc_cache [ j ] [ TOP ] ; c -> dc_cache [ j ] [ TOP ] = c -> prev_dc [ 0 ] [ mb_x * 2 + i ] ; ret = mss4_decode_dct ( gb , c -> dc_vlc , c -> ac_vlc , c -> block , c -> dc_cache [ j ] , xpos , mb_y * 2 + j , c -> quant_mat [ 0 ] ) ; if ( ret ) return ret ; c -> prev_dc [ 0 ] [ mb_x * 2 + i ] = c -> dc_cache [ j ] [ LEFT ] ; ff_mss34_dct_put ( out + xpos * 8 , c -> pic . linesize [ 0 ] , c -> block ) ; } out += 8 * c -> pic . linesize [ 0 ] ; } for ( i = 1 ; i < 3 ; i ++ ) { c -> dc_cache [ i + 1 ] [ TOP_LEFT ] = c -> dc_cache [ i + 1 ] [ TOP ] ; c -> dc_cache [ i + 1 ] [ TOP ] = c -> prev_dc [ i ] [ mb_x ] ; ret = mss4_decode_dct ( gb , c -> dc_vlc + 1 , c -> ac_vlc + 1 , c -> block , c -> dc_cache [ i + 1 ] , mb_x , mb_y , c -> quant_mat [ 1 ] ) ; if ( ret ) return ret ; c -> prev_dc [ i ] [ mb_x ] = c -> dc_cache [ i + 1 ] [ LEFT ] ; ff_mss34_dct_put ( c -> imgbuf [ i ] , 8 , c -> block ) ; out = dst [ i ] + mb_x * 16 ; for ( j = 0 ; j < 16 ; j ++ ) { for ( k = 0 ; k < 8 ; k ++ ) AV_WN16A ( out + k * 2 , c -> imgbuf [ i ] [ k + ( j & ~ 1 ) * 4 ] * 0x101 ) ; out += c -> pic . linesize [ i ] ; } } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
struct block * compiler_add_ifblk ( struct ifblock * ifb , struct block * blk ) { struct block * bl ; SAFE_CALLOC ( bl , 1 , sizeof ( struct block ) ) ; bl -> type = BLK_IFBLK ; bl -> un . ifb = ifb ; bl -> next = blk ; return bl ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _LMBCSOpen ## n ( UConverter * _this , UConverterLoadArgs * pArgs , UErrorCode * err ) \ { _LMBCSOpenWorker ( _this , pArgs , err , n ) ; } static void _LMBCSOpenWorker ( UConverter * _this , UConverterLoadArgs * pArgs , UErrorCode * err , ulmbcs_byte_t OptGroup ) { UConverterDataLMBCS * extraInfo = _this -> extraInfo = ( UConverterDataLMBCS * ) uprv_malloc ( sizeof ( UConverterDataLMBCS ) ) ; if ( extraInfo != NULL ) { UConverterNamePieces stackPieces ; UConverterLoadArgs stackArgs = { ( int32_t ) sizeof ( UConverterLoadArgs ) } ; ulmbcs_byte_t i ; uprv_memset ( extraInfo , 0 , sizeof ( UConverterDataLMBCS ) ) ; stackArgs . onlyTestIsLoadable = pArgs -> onlyTestIsLoadable ; for ( i = 0 ; i <= ULMBCS_GRP_LAST && U_SUCCESS ( * err ) ; i ++ ) { if ( OptGroupByteToCPName [ i ] != NULL ) { extraInfo -> OptGrpConverter [ i ] = ucnv_loadSharedData ( OptGroupByteToCPName [ i ] , & stackPieces , & stackArgs , err ) ; } } if ( U_FAILURE ( * err ) || pArgs -> onlyTestIsLoadable ) { _LMBCSClose ( _this ) ; return ; } extraInfo -> OptGroup = OptGroup ; extraInfo -> localeConverterIndex = FindLMBCSLocale ( pArgs -> locale ) ; } else { * err = U_MEMORY_ALLOCATION_ERROR ; } } static void _LMBCSClose ( UConverter * _this ) { if ( _this -> extraInfo != NULL ) { ulmbcs_byte_t Ix ; UConverterDataLMBCS * extraInfo = ( UConverterDataLMBCS * ) _this -> extraInfo ; for ( Ix = 0 ; Ix <= ULMBCS_GRP_LAST ; Ix ++ ) { if ( extraInfo -> OptGrpConverter [ Ix ] != NULL ) ucnv_unloadSharedDataIfReady ( extraInfo -> OptGrpConverter [ Ix ] ) ; } if ( ! _this -> isExtraLocal ) { uprv_free ( _this -> extraInfo ) ; _this -> extraInfo = NULL ; } } } typedef struct LMBCSClone { UConverter cnv ; UConverterDataLMBCS lmbcs ; } LMBCSClone ; static UConverter * _LMBCSSafeClone ( const UConverter * cnv , void * stackBuffer , int32_t * pBufferSize , UErrorCode * status ) { LMBCSClone * newLMBCS ; UConverterDataLMBCS * extraInfo ; int32_t i ; if ( * pBufferSize <= 0 ) { * pBufferSize = ( int32_t ) sizeof ( LMBCSClone ) ; return NULL ; } extraInfo = ( UConverterDataLMBCS * ) cnv -> extraInfo ; newLMBCS = ( LMBCSClone * ) stackBuffer ; uprv_memcpy ( & newLMBCS -> lmbcs , extraInfo , sizeof ( UConverterDataLMBCS ) ) ; for ( i = 0 ; i <= ULMBCS_GRP_LAST ; ++ i ) { if ( extraInfo -> OptGrpConverter [ i ] != NULL ) { ucnv_incrementRefCount ( extraInfo -> OptGrpConverter [ i ] ) ; } } newLMBCS -> cnv . extraInfo = & newLMBCS -> lmbcs ; newLMBCS -> cnv . isExtraLocal = TRUE ; return & newLMBCS -> cnv ; } static size_t LMBCSConversionWorker ( UConverterDataLMBCS * extraInfo , ulmbcs_byte_t group , ulmbcs_byte_t * pStartLMBCS , UChar * pUniChar , ulmbcs_byte_t * lastConverterIndex , UBool * groups_tried ) { ulmbcs_byte_t * pLMBCS = pStartLMBCS ; UConverterSharedData * xcnv = extraInfo -> OptGrpConverter [ group ] ; int bytesConverted ; uint32_t value ; ulmbcs_byte_t firstByte ; U_ASSERT ( xcnv ) ; U_ASSERT ( group < ULMBCS_GRP_UNICODE ) ; bytesConverted = ucnv_MBCSFromUChar32 ( xcnv , * pUniChar , & value , FALSE ) ; if ( bytesConverted > 0 ) { firstByte = ( ulmbcs_byte_t ) ( value >> ( ( bytesConverted - 1 ) * 8 ) ) ; } else { groups_tried [ group ] = TRUE ; return 0 ; } * lastConverterIndex = group ; U_ASSERT ( ( firstByte <= ULMBCS_C0END ) || ( firstByte >= ULMBCS_C1START ) || ( group == ULMBCS_GRP_EXCEPT ) ) ; if ( group != ULMBCS_GRP_EXCEPT && extraInfo -> OptGroup != group ) { * pLMBCS ++ = group ; if ( bytesConverted == 1 && group >= ULMBCS_DOUBLEOPTGROUP_START ) { * pLMBCS ++ = group ; } } if ( bytesConverted == 1 && firstByte < 0x20 ) return 0 ; switch ( bytesConverted ) { case 4 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 24 ) ; U_FALLTHROUGH ; case 3 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 16 ) ; U_FALLTHROUGH ; case 2 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 8 ) ; U_FALLTHROUGH ; case 1 : * pLMBCS ++ = ( ulmbcs_byte_t ) value ; U_FALLTHROUGH ; default : break ; } return ( pLMBCS - pStartLMBCS ) ; } static size_t LMBCSConvertUni ( ulmbcs_byte_t * pLMBCS , UChar uniChar ) { uint8_t LowCh = ( uint8_t ) ( uniChar & 0x00FF ) ; uint8_t HighCh = ( uint8_t ) ( uniChar >> 8 ) ; * pLMBCS ++ = ULMBCS_GRP_UNICODE ; if ( LowCh == 0 ) { * pLMBCS ++ = ULMBCS_UNICOMPATZERO ; * pLMBCS ++ = HighCh ; } else { * pLMBCS ++ = HighCh ; * pLMBCS ++ = LowCh ; } return ULMBCS_UNICODE_SIZE ; } static void _LMBCSFromUnicode ( UConverterFromUnicodeArgs * args , UErrorCode * err ) { ulmbcs_byte_t lastConverterIndex = 0 ; UChar uniChar ; ulmbcs_byte_t LMBCS [ ULMBCS_CHARSIZE_MAX ] ; ulmbcs_byte_t * pLMBCS ; int32_t bytes_written ; UBool groups_tried [ ULMBCS_GRP_LAST + 1 ] ; UConverterDataLMBCS * extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ; int sourceIndex = 0 ; ulmbcs_byte_t OldConverterIndex = 0 ; while ( args -> source < args -> sourceLimit && ! U_FAILURE ( * err ) ) { OldConverterIndex = extraInfo -> localeConverterIndex ; if ( args -> target >= args -> targetLimit ) { * err = U_BUFFER_OVERFLOW_ERROR ; break ; } uniChar = * ( args -> source ) ; bytes_written = 0 ; pLMBCS = LMBCS ; if ( ( uniChar >= 0x80 ) && ( uniChar <= 0xff ) && ( uniChar != 0xB1 ) && ( uniChar != 0xD7 ) && ( uniChar != 0xF7 ) && ( uniChar != 0xB0 ) && ( uniChar != 0xB4 ) && ( uniChar != 0xB6 ) && ( uniChar != 0xA7 ) && ( uniChar != 0xA8 ) ) { extraInfo -> localeConverterIndex = ULMBCS_GRP_L1 ; } if ( ( ( uniChar > ULMBCS_C0END ) && ( uniChar < ULMBCS_C1START ) ) || uniChar == 0 || uniChar == ULMBCS_HT || uniChar == ULMBCS_CR || uniChar == ULMBCS_LF || uniChar == ULMBCS_123SYSTEMRANGE ) { * pLMBCS ++ = ( ulmbcs_byte_t ) uniChar ; bytes_written = 1 ; } if ( ! bytes_written ) { ulmbcs_byte_t group = FindLMBCSUniRange ( uniChar ) ; if ( group == ULMBCS_GRP_UNICODE ) { pLMBCS += LMBCSConvertUni ( pLMBCS , uniChar ) ; bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ; } else if ( group == ULMBCS_GRP_CTRL ) { if ( uniChar <= ULMBCS_C0END ) { * pLMBCS ++ = ULMBCS_GRP_CTRL ; * pLMBCS ++ = ( ulmbcs_byte_t ) ( ULMBCS_CTRLOFFSET + uniChar ) ; } else if ( uniChar >= ULMBCS_C1START && uniChar <= ULMBCS_C1START + ULMBCS_CTRLOFFSET ) { * pLMBCS ++ = ULMBCS_GRP_CTRL ; * pLMBCS ++ = ( ulmbcs_byte_t ) ( uniChar & 0x00FF ) ; } bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ; } else if ( group < ULMBCS_GRP_UNICODE ) { bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , group , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } if ( ! bytes_written ) { uprv_memset ( groups_tried , 0 , sizeof ( groups_tried ) ) ; if ( ( extraInfo -> OptGroup != 1 ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , extraInfo -> OptGroup ) ) ) { if ( extraInfo -> localeConverterIndex < ULMBCS_DOUBLEOPTGROUP_START ) { bytes_written = LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_L1 , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; if ( ! bytes_written ) { bytes_written = LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_EXCEPT , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } if ( ! bytes_written ) { bytes_written = LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } } else { bytes_written = LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } } if ( ! bytes_written && ( extraInfo -> localeConverterIndex ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , extraInfo -> localeConverterIndex ) ) ) { bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } if ( ! bytes_written && ( lastConverterIndex ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , lastConverterIndex ) ) ) { bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , lastConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } if ( ! bytes_written ) { ulmbcs_byte_t grp_start ; ulmbcs_byte_t grp_end ; ulmbcs_byte_t grp_ix ; grp_start = ( ulmbcs_byte_t ) ( ( group == ULMBCS_AMBIGUOUS_MBCS ) ? ULMBCS_DOUBLEOPTGROUP_START : ULMBCS_GRP_L1 ) ; grp_end = ( ulmbcs_byte_t ) ( ( group == ULMBCS_AMBIGUOUS_MBCS ) ? ULMBCS_GRP_LAST : ULMBCS_GRP_TH ) ; if ( group == ULMBCS_AMBIGUOUS_ALL ) { grp_start = ULMBCS_GRP_L1 ; grp_end = ULMBCS_GRP_LAST ; } for ( grp_ix = grp_start ; grp_ix <= grp_end && ! bytes_written ; grp_ix ++ ) { if ( extraInfo -> OptGrpConverter [ grp_ix ] && ! groups_tried [ grp_ix ] ) { bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , grp_ix , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } } if ( ! bytes_written && grp_start == ULMBCS_GRP_L1 ) { bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_EXCEPT , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ; } } if ( ! bytes_written ) { pLMBCS += LMBCSConvertUni ( pLMBCS , uniChar ) ; bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ; } } } args -> source ++ ; pLMBCS = LMBCS ; while ( args -> target < args -> targetLimit && bytes_written -- ) { * ( args -> target ) ++ = * pLMBCS ++ ; if ( args -> offsets ) { * ( args -> offsets ) ++ = sourceIndex ; } } sourceIndex ++ ; if ( bytes_written > 0 ) { uint8_t * pErrorBuffer = args -> converter -> charErrorBuffer ; * err = U_BUFFER_OVERFLOW_ERROR ; args -> converter -> charErrorBufferLength = ( int8_t ) bytes_written ; while ( bytes_written -- ) { * pErrorBuffer ++ = * pLMBCS ++ ; } } extraInfo -> localeConverterIndex = OldConverterIndex ; } } static UChar GetUniFromLMBCSUni ( char const * * ppLMBCSin ) { uint8_t HighCh = * ( * ppLMBCSin ) ++ ; uint8_t LowCh = * ( * ppLMBCSin ) ++ ; if ( HighCh == ULMBCS_UNICOMPATZERO ) { HighCh = LowCh ; LowCh = 0 ; } return ( UChar ) ( ( HighCh << 8 ) | LowCh ) ; } # define CHECK_SOURCE_LIMIT ( index ) if ( args -> source + index > args -> sourceLimit ) { * err = U_TRUNCATED_CHAR_FOUND ; args -> source = args -> sourceLimit ; return 0xffff ; } static UChar32 _LMBCSGetNextUCharWorker ( UConverterToUnicodeArgs * args , UErrorCode * err ) { UChar32 uniChar = 0 ; ulmbcs_byte_t CurByte ; if ( args -> source >= args -> sourceLimit ) { * err = U_ILLEGAL_ARGUMENT_ERROR ; return 0xffff ; } CurByte = * ( ( ulmbcs_byte_t * ) ( args -> source ++ ) ) ; if ( ( ( CurByte > ULMBCS_C0END ) && ( CurByte < ULMBCS_C1START ) ) || ( CurByte == 0 ) || CurByte == ULMBCS_HT || CurByte == ULMBCS_CR || CurByte == ULMBCS_LF || CurByte == ULMBCS_123SYSTEMRANGE ) { uniChar = CurByte ; } else { UConverterDataLMBCS * extraInfo ; ulmbcs_byte_t group ; UConverterSharedData * cnv ; if ( CurByte == ULMBCS_GRP_CTRL ) { ulmbcs_byte_t C0C1byte ; CHECK_SOURCE_LIMIT ( 1 ) ; C0C1byte = * ( args -> source ) ++ ; uniChar = ( C0C1byte < ULMBCS_C1START ) ? C0C1byte - ULMBCS_CTRLOFFSET : C0C1byte ; } else if ( CurByte == ULMBCS_GRP_UNICODE ) { CHECK_SOURCE_LIMIT ( 2 ) ; return GetUniFromLMBCSUni ( & ( args -> source ) ) ; } else if ( CurByte <= ULMBCS_CTRLOFFSET ) { group = CurByte ; extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ; if ( group > ULMBCS_GRP_LAST || ( cnv = extraInfo -> OptGrpConverter [ group ] ) == NULL ) { * err = U_INVALID_CHAR_FOUND ; } else if ( group >= ULMBCS_DOUBLEOPTGROUP_START ) { CHECK_SOURCE_LIMIT ( 2 ) ; if ( * args -> source == group ) { ++ args -> source ; uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source , 1 , FALSE ) ; ++ args -> source ; } else { uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source , 2 , FALSE ) ; args -> source += 2 ; } } else { CHECK_SOURCE_LIMIT ( 1 ) ; CurByte = * ( args -> source ) ++ ; if ( CurByte >= ULMBCS_C1START ) { uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP ( cnv , CurByte ) ; } else { char bytes [ 2 ] ; extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ; cnv = extraInfo -> OptGrpConverter [ ULMBCS_GRP_EXCEPT ] ; bytes [ 0 ] = group ; bytes [ 1 ] = CurByte ; uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , bytes , 2 , FALSE ) ; } } } else if ( CurByte >= ULMBCS_C1START ) { extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ; group = extraInfo -> OptGroup ; cnv = extraInfo -> OptGrpConverter [ group ] ; if ( group >= ULMBCS_DOUBLEOPTGROUP_START ) { if ( ! ucnv_MBCSIsLeadByte ( cnv , CurByte ) ) { CHECK_SOURCE_LIMIT ( 0 ) ; uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source - 1 , 1 , FALSE ) ; } else { CHECK_SOURCE_LIMIT ( 1 ) ; uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source - 1 , 2 , FALSE ) ; ++ args -> source ; } } else { uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP ( cnv , CurByte ) ; } } } return uniChar ; } static void _LMBCSToUnicodeWithOffsets ( UConverterToUnicodeArgs * args , UErrorCode * err ) { char LMBCS [ ULMBCS_CHARSIZE_MAX ] ; UChar uniChar ; const char * saveSource ; const char * pStartLMBCS = args -> source ; const char * errSource = NULL ; int8_t savebytes = 0 ; while ( U_SUCCESS ( * err ) && args -> sourceLimit > args -> source && args -> targetLimit > args -> target ) { saveSource = args -> source ; if ( args -> converter -> toULength ) { const char * saveSourceLimit ; size_t size_old = args -> converter -> toULength ; size_t size_new_maybe_1 = sizeof ( LMBCS ) - size_old ; size_t size_new_maybe_2 = args -> sourceLimit - args -> source ; size_t size_new = ( size_new_maybe_1 < size_new_maybe_2 ) ? size_new_maybe_1 : size_new_maybe_2 ; uprv_memcpy ( LMBCS , args -> converter -> toUBytes , size_old ) ; uprv_memcpy ( LMBCS + size_old , args -> source , size_new ) ; saveSourceLimit = args -> sourceLimit ; args -> source = errSource = LMBCS ; args -> sourceLimit = LMBCS + size_old + size_new ; savebytes = ( int8_t ) ( size_old + size_new ) ; uniChar = ( UChar ) _LMBCSGetNextUCharWorker ( args , err ) ; args -> source = saveSource + ( ( args -> source - LMBCS ) - size_old ) ; args -> sourceLimit = saveSourceLimit ; if ( * err == U_TRUNCATED_CHAR_FOUND ) { args -> converter -> toULength = savebytes ; uprv_memcpy ( args -> converter -> toUBytes , LMBCS , savebytes ) ; args -> source = args -> sourceLimit ; * err = U_ZERO_ERROR ; return ; } else { args -> converter -> toULength = 0 ; } } else { errSource = saveSource ; uniChar = ( UChar ) _LMBCSGetNextUCharWorker ( args , err ) ; savebytes = ( int8_t ) ( args -> source - saveSource ) ; } if ( U_SUCCESS ( * err ) ) { if ( uniChar < 0xfffe ) { * ( args -> target ) ++ = uniChar ; if ( args -> offsets ) { * ( args -> offsets ) ++ = ( int32_t ) ( saveSource - pStartLMBCS ) ; } } else if ( uniChar == 0xfffe ) { * err = U_INVALID_CHAR_FOUND ; } else { * err = U_ILLEGAL_CHAR_FOUND ; } } } if ( U_SUCCESS ( * err ) && args -> sourceLimit > args -> source && args -> targetLimit <= args -> target ) { * err = U_BUFFER_OVERFLOW_ERROR ; } else if ( U_FAILURE ( * err ) ) { args -> converter -> toULength = savebytes ; if ( savebytes > 0 ) { uprv_memcpy ( args -> converter -> toUBytes , errSource , savebytes ) ; } if ( * err == U_TRUNCATED_CHAR_FOUND ) { * err = U_ZERO_ERROR ; } } } DEFINE_LMBCS_OPEN ( 1 ) DEFINE_LMBCS_OPEN ( 2 ) DEFINE_LMBCS_OPEN ( 3 ) DEFINE_LMBCS_OPEN ( 4 ) DEFINE_LMBCS_OPEN ( 5 ) DEFINE_LMBCS_OPEN ( 6 ) DEFINE_LMBCS_OPEN ( 8 ) DEFINE_LMBCS_OPEN ( 11 )
1True
Categorize the following code snippet as vulnerable or not. True or False
int rds_notify_queue_get ( struct rds_sock * rs , struct msghdr * msghdr ) { struct rds_notifier * notifier ; struct rds_rdma_notify cmsg = { 0 } ; unsigned int count = 0 , max_messages = ~ 0U ; unsigned long flags ; LIST_HEAD ( copy ) ; int err = 0 ; if ( msghdr ) { max_messages = msghdr -> msg_controllen / CMSG_SPACE ( sizeof ( cmsg ) ) ; if ( ! max_messages ) max_messages = 1 ; } spin_lock_irqsave ( & rs -> rs_lock , flags ) ; while ( ! list_empty ( & rs -> rs_notify_queue ) && count < max_messages ) { notifier = list_entry ( rs -> rs_notify_queue . next , struct rds_notifier , n_list ) ; list_move ( & notifier -> n_list , & copy ) ; count ++ ; } spin_unlock_irqrestore ( & rs -> rs_lock , flags ) ; if ( ! count ) return 0 ; while ( ! list_empty ( & copy ) ) { notifier = list_entry ( copy . next , struct rds_notifier , n_list ) ; if ( msghdr ) { cmsg . user_token = notifier -> n_user_token ; cmsg . status = notifier -> n_status ; err = put_cmsg ( msghdr , SOL_RDS , RDS_CMSG_RDMA_STATUS , sizeof ( cmsg ) , & cmsg ) ; if ( err ) break ; } list_del_init ( & notifier -> n_list ) ; kfree ( notifier ) ; } if ( ! list_empty ( & copy ) ) { spin_lock_irqsave ( & rs -> rs_lock , flags ) ; list_splice ( & copy , & rs -> rs_notify_queue ) ; spin_unlock_irqrestore ( & rs -> rs_lock , flags ) ; } return err ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void Init_ossl_cipher ( void ) { # if 0 mOSSL = rb_define_module ( "OpenSSL" ) ; eOSSLError = rb_define_class_under ( mOSSL , "OpenSSLError" , rb_eStandardError ) ; # endif cCipher = rb_define_class_under ( mOSSL , "Cipher" , rb_cObject ) ; eCipherError = rb_define_class_under ( cCipher , "CipherError" , eOSSLError ) ; rb_define_alloc_func ( cCipher , ossl_cipher_alloc ) ; rb_define_copy_func ( cCipher , ossl_cipher_copy ) ; rb_define_module_function ( cCipher , "ciphers" , ossl_s_ciphers , 0 ) ; rb_define_method ( cCipher , "initialize" , ossl_cipher_initialize , 1 ) ; rb_define_method ( cCipher , "reset" , ossl_cipher_reset , 0 ) ; rb_define_method ( cCipher , "encrypt" , ossl_cipher_encrypt , - 1 ) ; rb_define_method ( cCipher , "decrypt" , ossl_cipher_decrypt , - 1 ) ; rb_define_method ( cCipher , "pkcs5_keyivgen" , ossl_cipher_pkcs5_keyivgen , - 1 ) ; rb_define_method ( cCipher , "update" , ossl_cipher_update , - 1 ) ; rb_define_method ( cCipher , "final" , ossl_cipher_final , 0 ) ; rb_define_method ( cCipher , "name" , ossl_cipher_name , 0 ) ; rb_define_method ( cCipher , "key=" , ossl_cipher_set_key , 1 ) ; rb_define_method ( cCipher , "auth_data=" , ossl_cipher_set_auth_data , 1 ) ; rb_define_method ( cCipher , "auth_tag=" , ossl_cipher_set_auth_tag , 1 ) ; rb_define_method ( cCipher , "auth_tag" , ossl_cipher_get_auth_tag , - 1 ) ; rb_define_method ( cCipher , "auth_tag_len=" , ossl_cipher_set_auth_tag_len , 1 ) ; rb_define_method ( cCipher , "authenticated?" , ossl_cipher_is_authenticated , 0 ) ; rb_define_method ( cCipher , "key_len=" , ossl_cipher_set_key_length , 1 ) ; rb_define_method ( cCipher , "key_len" , ossl_cipher_key_length , 0 ) ; rb_define_method ( cCipher , "iv=" , ossl_cipher_set_iv , 1 ) ; rb_define_method ( cCipher , "iv_len=" , ossl_cipher_set_iv_length , 1 ) ; rb_define_method ( cCipher , "iv_len" , ossl_cipher_iv_length , 0 ) ; rb_define_method ( cCipher , "block_size" , ossl_cipher_block_size , 0 ) ; rb_define_method ( cCipher , "padding=" , ossl_cipher_set_padding , 1 ) ; id_auth_tag_len = rb_intern_const ( "auth_tag_len" ) ; id_key_set = rb_intern_const ( "key_set" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
MPI mpi_set_opaque ( MPI a , void * p , unsigned int len ) { if ( ! a ) { # ifdef M_DEBUG a = mpi_debug_alloc ( 0 , "alloc_opaque" ) ; # else a = mpi_alloc ( 0 ) ; # endif } if ( a -> flags & 4 ) xfree ( a -> d ) ; else { # ifdef M_DEBUG mpi_debug_free_limb_space ( a -> d , "alloc_opaque" ) ; # else mpi_free_limb_space ( a -> d ) ; # endif } a -> d = p ; a -> alloced = 0 ; a -> nlimbs = 0 ; a -> nbits = len ; a -> flags = 4 ; return a ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void TSCacheHttpInfoSizeSet ( TSCacheHttpInfo infop , int64_t size ) { CacheHTTPInfo * info = ( CacheHTTPInfo * ) infop ; info -> object_size_set ( size ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static VALUE ossl_cipher_name ( VALUE self ) { EVP_CIPHER_CTX * ctx ; GetCipher ( self , ctx ) ; return rb_str_new2 ( EVP_CIPHER_name ( EVP_CIPHER_CTX_cipher ( ctx ) ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean k12_read ( wtap * wth , int * err , gchar * * err_info , gint64 * data_offset ) { k12_t * k12 = ( k12_t * ) wth -> priv ; k12_src_desc_t * src_desc ; guint8 * buffer ; gint64 offset ; gint len ; guint32 type ; guint32 src_id ; offset = file_tell ( wth -> fh ) ; do { if ( k12 -> num_of_records == 0 ) { * err = 0 ; return FALSE ; } K12_DBG ( 5 , ( "k12_read: offset=%i" , offset ) ) ; * data_offset = offset ; len = get_record ( k12 , wth -> fh , offset , FALSE , err , err_info ) ; if ( len < 0 ) { return FALSE ; } else if ( len == 0 ) { * err = WTAP_ERR_SHORT_READ ; return FALSE ; } else if ( len < K12_RECORD_SRC_ID + 4 ) { * err = WTAP_ERR_BAD_FILE ; * err_info = g_strdup_printf ( "data record length %d too short" , len ) ; return FALSE ; } k12 -> num_of_records -- ; buffer = k12 -> seq_read_buff ; type = pntoh32 ( buffer + K12_RECORD_TYPE ) ; src_id = pntoh32 ( buffer + K12_RECORD_SRC_ID ) ; if ( ! ( src_desc = ( k12_src_desc_t * ) g_hash_table_lookup ( k12 -> src_by_id , GUINT_TO_POINTER ( src_id ) ) ) ) { src_desc = ( k12_src_desc_t * ) g_hash_table_lookup ( k12 -> src_by_id , GUINT_TO_POINTER ( src_id & K12_RECORD_SRC_ID_MASK ) ) ; } K12_DBG ( 5 , ( "k12_read: record type=%x src_id=%x" , type , src_id ) ) ; offset += len ; } while ( ( ( type & K12_MASK_PACKET ) != K12_REC_PACKET && ( type & K12_MASK_PACKET ) != K12_REC_D0020 ) || ! src_id || ! src_desc ) ; process_packet_data ( & wth -> phdr , wth -> frame_buffer , buffer , len , k12 ) ; return TRUE ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void empty_trash_for_unmount_done ( gboolean success , gpointer user_data ) { UnmountData * data = user_data ; do_unmount ( data ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int mbfl_oddlen ( mbfl_string * string ) { int len , n , m , k ; unsigned char * p ; const unsigned char * mbtab ; const mbfl_encoding * encoding ; if ( string == NULL ) { return - 1 ; } encoding = mbfl_no2encoding ( string -> no_encoding ) ; if ( encoding == NULL ) { return - 1 ; } len = 0 ; if ( encoding -> flag & MBFL_ENCTYPE_SBCS ) { return 0 ; } else if ( encoding -> flag & ( MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE ) ) { return len % 2 ; } else if ( encoding -> flag & ( MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE ) ) { return len % 4 ; } else if ( encoding -> mblen_table != NULL ) { mbtab = encoding -> mblen_table ; n = 0 ; p = string -> val ; k = string -> len ; if ( p != NULL ) { while ( n < k ) { m = mbtab [ * p ] ; n += m ; p += m ; } ; } return n - k ; } else { return 0 ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorJSONBlockJob ( qemuMonitorPtr mon , const char * device , unsigned long bandwidth , virDomainBlockJobInfoPtr info , int mode ) { int ret = - 1 ; virJSONValuePtr cmd = NULL ; virJSONValuePtr reply = NULL ; const char * cmd_name = NULL ; if ( mode == BLOCK_JOB_ABORT ) { cmd_name = "block_job_cancel" ; cmd = qemuMonitorJSONMakeCommand ( cmd_name , "s:device" , device , NULL ) ; } else if ( mode == BLOCK_JOB_INFO ) { cmd_name = "query-block-jobs" ; cmd = qemuMonitorJSONMakeCommand ( cmd_name , NULL ) ; } else if ( mode == BLOCK_JOB_SPEED ) { cmd_name = "block_job_set_speed" ; cmd = qemuMonitorJSONMakeCommand ( cmd_name , "s:device" , device , "U:value" , bandwidth * 1024ULL * 1024ULL , NULL ) ; } else if ( mode == BLOCK_JOB_PULL ) { cmd_name = "block_stream" ; cmd = qemuMonitorJSONMakeCommand ( cmd_name , "s:device" , device , NULL ) ; } if ( ! cmd ) return - 1 ; ret = qemuMonitorJSONCommand ( mon , cmd , & reply ) ; if ( ret == 0 && virJSONValueObjectHasKey ( reply , "error" ) ) { if ( qemuMonitorJSONHasError ( reply , "DeviceNotActive" ) ) qemuReportError ( VIR_ERR_OPERATION_INVALID , _ ( "No active operation on device: %s" ) , device ) ; else if ( qemuMonitorJSONHasError ( reply , "DeviceInUse" ) ) qemuReportError ( VIR_ERR_OPERATION_FAILED , _ ( "Device %s in use" ) , device ) ; else if ( qemuMonitorJSONHasError ( reply , "NotSupported" ) ) qemuReportError ( VIR_ERR_OPERATION_INVALID , _ ( "Operation is not supported for device: %s" ) , device ) ; else if ( qemuMonitorJSONHasError ( reply , "CommandNotFound" ) ) qemuReportError ( VIR_ERR_OPERATION_INVALID , _ ( "Command '%s' is not found" ) , cmd_name ) ; else qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "Unexpected error" ) ) ; ret = - 1 ; } if ( ret == 0 && mode == BLOCK_JOB_INFO ) ret = qemuMonitorJSONGetBlockJobInfo ( reply , device , info ) ; virJSONValueFree ( cmd ) ; virJSONValueFree ( reply ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static bool is_valid_host_port ( const char * host , const char * port ) { for ( const char * p = host ; * p ; p ++ ) if ( ! isalnum ( * p ) && * p != '-' && * p != '.' ) { return false ; } for ( const char * p = port ; * p ; p ++ ) if ( ! isalnum ( * p ) ) { return false ; } return true ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void openpic_tmr_write ( void * opaque , hwaddr addr , uint64_t val , unsigned len ) { OpenPICState * opp = opaque ; int idx ; addr += 0x10f0 ; DPRINTF ( "%s: addr %#" HWADDR_PRIx " <= %08" PRIx64 "\n" , __func__ , addr , val ) ; if ( addr & 0xF ) { return ; } if ( addr == 0x10f0 ) { opp -> tfrr = val ; return ; } idx = ( addr >> 6 ) & 0x3 ; addr = addr & 0x30 ; switch ( addr & 0x30 ) { case 0x00 : break ; case 0x10 : if ( ( opp -> timers [ idx ] . tccr & TCCR_TOG ) != 0 && ( val & TBCR_CI ) == 0 && ( opp -> timers [ idx ] . tbcr & TBCR_CI ) != 0 ) { opp -> timers [ idx ] . tccr &= ~ TCCR_TOG ; } opp -> timers [ idx ] . tbcr = val ; break ; case 0x20 : write_IRQreg_ivpr ( opp , opp -> irq_tim0 + idx , val ) ; break ; case 0x30 : write_IRQreg_idr ( opp , opp -> irq_tim0 + idx , val ) ; break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline void lh_ ## type ## _node_usage_stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) { OPENSSL_LH_node_usage_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ; } static ossl_inline void lh_ ## type ## _stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) { OPENSSL_LH_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ; } static ossl_inline unsigned long lh_ ## type ## _get_down_load ( LHASH_OF ( type ) * lh ) { return OPENSSL_LH_get_down_load ( ( OPENSSL_LHASH * ) lh ) ; } static ossl_inline void lh_ ## type ## _set_down_load ( LHASH_OF ( type ) * lh , unsigned long dl ) { OPENSSL_LH_set_down_load ( ( OPENSSL_LHASH * ) lh , dl ) ; } static ossl_inline void lh_ ## type ## _doall ( LHASH_OF ( type ) * lh , void ( * doall ) ( type * ) ) { OPENSSL_LH_doall ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNC ) doall ) ; } LHASH_OF ( type ) # define IMPLEMENT_LHASH_DOALL_ARG_CONST ( type , argtype ) int_implement_lhash_doall ( type , argtype , const type ) # define IMPLEMENT_LHASH_DOALL_ARG ( type , argtype ) int_implement_lhash_doall ( type , argtype , type ) # define int_implement_lhash_doall ( type , argtype , cbargtype ) static ossl_inline void lh_ ## type ## _doall_ ## argtype ( LHASH_OF ( type ) * lh , void ( * fn ) ( cbargtype * , argtype * ) , argtype * arg ) { OPENSSL_LH_doall_arg ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNCARG ) fn , ( void * ) arg ) ; } LHASH_OF ( type ) DEFINE_LHASH_OF ( OPENSSL_STRING ) ; # ifdef _MSC_VER # pragma warning ( push ) # pragma warning ( disable : 4090 ) # endif DEFINE_LHASH_OF ( OPENSSL_CSTRING )
1True
Categorize the following code snippet as vulnerable or not. True or False
static void ctl_puthex ( const char * tag , u_long uval ) { register char * cp ; register const char * cq ; char buffer [ 200 ] ; cp = buffer ; cq = tag ; while ( * cq != '\0' ) * cp ++ = * cq ++ ; * cp ++ = '=' ; INSIST ( ( cp - buffer ) < ( int ) sizeof ( buffer ) ) ; snprintf ( cp , sizeof ( buffer ) - ( cp - buffer ) , "0x%lx" , uval ) ; cp += strlen ( cp ) ; ctl_putdata ( buffer , ( unsigned ) ( cp - buffer ) , 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
extern int as_mysql_job_start ( mysql_conn_t * mysql_conn , struct job_record * job_ptr ) { int rc = SLURM_SUCCESS ; char * nodes = NULL , * jname = NULL , * node_inx = NULL ; int track_steps = 0 ; char * block_id = NULL , * partition = NULL ; char * gres_req = NULL , * gres_alloc = NULL ; char temp_bit [ BUF_SIZE ] ; char * query = NULL ; int reinit = 0 ; time_t begin_time , check_time , start_time , submit_time ; uint32_t wckeyid = 0 ; uint32_t job_state ; int node_cnt = 0 ; uint32_t array_task_id = ( job_ptr -> array_job_id ) ? job_ptr -> array_task_id : NO_VAL ; uint64_t job_db_inx = job_ptr -> db_index ; job_array_struct_t * array_recs = job_ptr -> array_recs ; if ( ( ! job_ptr -> details || ! job_ptr -> details -> submit_time ) && ! job_ptr -> resize_time ) { error ( "as_mysql_job_start: " "Not inputing this job, it has no submit time." ) ; return SLURM_ERROR ; } if ( check_connection ( mysql_conn ) != SLURM_SUCCESS ) return ESLURM_DB_CONNECTION ; debug2 ( "as_mysql_slurmdb_job_start() called" ) ; job_state = job_ptr -> job_state ; if ( job_ptr -> resize_time ) { begin_time = job_ptr -> resize_time ; submit_time = job_ptr -> resize_time ; start_time = job_ptr -> resize_time ; } else { begin_time = job_ptr -> details -> begin_time ; submit_time = job_ptr -> details -> submit_time ; start_time = job_ptr -> start_time ; } if ( job_ptr -> state_reason == WAIT_ARRAY_TASK_LIMIT ) begin_time = INFINITE ; if ( IS_JOB_RESIZING ( job_ptr ) ) { if ( ! job_ptr -> db_index ) { error ( "We don't have a db_index for job %u, " "this should only happen when resizing " "jobs and the database interface was down." , job_ptr -> job_id ) ; job_ptr -> db_index = _get_db_index ( mysql_conn , job_ptr -> details -> submit_time , job_ptr -> job_id , job_ptr -> assoc_id ) ; } if ( job_ptr -> db_index ) as_mysql_job_complete ( mysql_conn , job_ptr ) ; job_state &= ( ~ JOB_RESIZING ) ; job_ptr -> db_index = 0 ; } job_state &= JOB_STATE_BASE ; if ( start_time ) check_time = start_time ; else if ( begin_time ) check_time = begin_time ; else check_time = submit_time ; slurm_mutex_lock ( & rollup_lock ) ; if ( check_time < global_last_rollup ) { MYSQL_RES * result = NULL ; MYSQL_ROW row ; query = xstrdup_printf ( "select job_db_inx " "from \"%s_%s\" where id_job=%u and " "time_submit=%ld and time_eligible=%ld " "and time_start=%ld; " , mysql_conn -> cluster_name , job_table , job_ptr -> job_id , submit_time , begin_time , start_time ) ; if ( debug_flags & DEBUG_FLAG_DB_JOB ) DB_DEBUG ( mysql_conn -> conn , "query\n%s" , query ) ; if ( ! ( result = mysql_db_query_ret ( mysql_conn , query , 0 ) ) ) { xfree ( query ) ; slurm_mutex_unlock ( & rollup_lock ) ; return SLURM_ERROR ; } xfree ( query ) ; if ( ( row = mysql_fetch_row ( result ) ) ) { mysql_free_result ( result ) ; debug4 ( "revieved an update for a " "job (%u) already known about" , job_ptr -> job_id ) ; slurm_mutex_unlock ( & rollup_lock ) ; goto no_rollup_change ; } mysql_free_result ( result ) ; if ( job_ptr -> start_time ) debug ( "Need to reroll usage from %s Job %u " "from %s started then and we are just " "now hearing about it." , slurm_ctime2 ( & check_time ) , job_ptr -> job_id , mysql_conn -> cluster_name ) ; else if ( begin_time ) debug ( "Need to reroll usage from %s Job %u " "from %s became eligible then and we are just " "now hearing about it." , slurm_ctime2 ( & check_time ) , job_ptr -> job_id , mysql_conn -> cluster_name ) ; else debug ( "Need to reroll usage from %s Job %u " "from %s was submitted then and we are just " "now hearing about it." , slurm_ctime2 ( & check_time ) , job_ptr -> job_id , mysql_conn -> cluster_name ) ; global_last_rollup = check_time ; slurm_mutex_unlock ( & rollup_lock ) ; query = xstrdup_printf ( "update \"%s_%s\" set " "hourly_rollup=%ld, " "daily_rollup=%ld, monthly_rollup=%ld" , mysql_conn -> cluster_name , last_ran_table , check_time , check_time , check_time ) ; if ( debug_flags & DEBUG_FLAG_DB_JOB ) DB_DEBUG ( mysql_conn -> conn , "query\n%s" , query ) ; rc = mysql_db_query ( mysql_conn , query ) ; xfree ( query ) ; } else slurm_mutex_unlock ( & rollup_lock ) ; no_rollup_change : if ( job_ptr -> name && job_ptr -> name [ 0 ] ) jname = slurm_add_slash_to_quotes ( job_ptr -> name ) ; else { jname = xstrdup ( "allocation" ) ; track_steps = 1 ; } if ( job_ptr -> nodes && job_ptr -> nodes [ 0 ] ) nodes = job_ptr -> nodes ; else nodes = "None assigned" ; if ( job_ptr -> batch_flag ) track_steps = 1 ; if ( slurmdbd_conf ) { block_id = xstrdup ( job_ptr -> comment ) ; node_cnt = job_ptr -> total_nodes ; node_inx = job_ptr -> network ; } else { if ( job_ptr -> node_bitmap ) { node_inx = bit_fmt ( temp_bit , sizeof ( temp_bit ) , job_ptr -> node_bitmap ) ; } # ifdef HAVE_BG select_g_select_jobinfo_get ( job_ptr -> select_jobinfo , SELECT_JOBDATA_BLOCK_ID , & block_id ) ; select_g_select_jobinfo_get ( job_ptr -> select_jobinfo , SELECT_JOBDATA_NODE_CNT , & node_cnt ) ; # else node_cnt = job_ptr -> total_nodes ; # endif } if ( job_ptr -> assoc_id && ( ! job_ptr -> db_index || job_ptr -> wckey ) ) wckeyid = _get_wckeyid ( mysql_conn , & job_ptr -> wckey , job_ptr -> user_id , mysql_conn -> cluster_name , job_ptr -> assoc_id ) ; if ( ! IS_JOB_PENDING ( job_ptr ) && job_ptr -> part_ptr ) partition = slurm_add_slash_to_quotes ( job_ptr -> part_ptr -> name ) ; else if ( job_ptr -> partition ) partition = slurm_add_slash_to_quotes ( job_ptr -> partition ) ; if ( job_ptr -> gres_req ) gres_req = slurm_add_slash_to_quotes ( job_ptr -> gres_req ) ; if ( job_ptr -> gres_alloc ) gres_alloc = slurm_add_slash_to_quotes ( job_ptr -> gres_alloc ) ; if ( ! job_ptr -> db_index ) { query = xstrdup_printf ( "insert into \"%s_%s\" " "(id_job, mod_time, id_array_job, id_array_task, " "id_assoc, id_qos, id_user, " "id_group, nodelist, id_resv, timelimit, " "time_eligible, time_submit, time_start, " "job_name, track_steps, state, priority, cpus_req, " "nodes_alloc, mem_req" , mysql_conn -> cluster_name , job_table ) ; if ( wckeyid ) xstrcat ( query , ", id_wckey" ) ; if ( job_ptr -> account ) xstrcat ( query , ", account" ) ; if ( partition ) xstrcat ( query , ", `partition`" ) ; if ( block_id ) xstrcat ( query , ", id_block" ) ; if ( job_ptr -> wckey ) xstrcat ( query , ", wckey" ) ; if ( node_inx ) xstrcat ( query , ", node_inx" ) ; if ( gres_req ) xstrcat ( query , ", gres_req" ) ; if ( gres_alloc ) xstrcat ( query , ", gres_alloc" ) ; if ( array_recs && array_recs -> task_id_str ) xstrcat ( query , ", array_task_str, array_max_tasks, " "array_task_pending" ) ; else xstrcat ( query , ", array_task_str, array_task_pending" ) ; if ( job_ptr -> tres_alloc_str ) xstrcat ( query , ", tres_alloc" ) ; if ( job_ptr -> tres_req_str ) xstrcat ( query , ", tres_req" ) ; xstrfmtcat ( query , ") values (%u, UNIX_TIMESTAMP(), " "%u, %u, %u, %u, %u, %u, " "'%s', %u, %u, %ld, %ld, %ld, " "'%s', %u, %u, %u, %u, %u, %" PRIu64 "" , job_ptr -> job_id , job_ptr -> array_job_id , array_task_id , job_ptr -> assoc_id , job_ptr -> qos_id , job_ptr -> user_id , job_ptr -> group_id , nodes , job_ptr -> resv_id , job_ptr -> time_limit , begin_time , submit_time , start_time , jname , track_steps , job_state , job_ptr -> priority , job_ptr -> details -> min_cpus , node_cnt , job_ptr -> details -> pn_min_memory ) ; if ( wckeyid ) xstrfmtcat ( query , ", %u" , wckeyid ) ; if ( job_ptr -> account ) xstrfmtcat ( query , ", '%s'" , job_ptr -> account ) ; if ( partition ) xstrfmtcat ( query , ", '%s'" , partition ) ; if ( block_id ) xstrfmtcat ( query , ", '%s'" , block_id ) ; if ( job_ptr -> wckey ) xstrfmtcat ( query , ", '%s'" , job_ptr -> wckey ) ; if ( node_inx ) xstrfmtcat ( query , ", '%s'" , node_inx ) ; if ( gres_req ) xstrfmtcat ( query , ", '%s'" , gres_req ) ; if ( gres_alloc ) xstrfmtcat ( query , ", '%s'" , gres_alloc ) ; if ( array_recs && array_recs -> task_id_str ) xstrfmtcat ( query , ", '%s', %u, %u" , array_recs -> task_id_str , array_recs -> max_run_tasks , array_recs -> task_cnt ) ; else xstrcat ( query , ", NULL, 0" ) ; if ( job_ptr -> tres_alloc_str ) xstrfmtcat ( query , ", '%s'" , job_ptr -> tres_alloc_str ) ; if ( job_ptr -> tres_req_str ) xstrfmtcat ( query , ", '%s'" , job_ptr -> tres_req_str ) ; xstrfmtcat ( query , ") on duplicate key update " "job_db_inx=LAST_INSERT_ID(job_db_inx), " "id_user=%u, id_group=%u, " "nodelist='%s', id_resv=%u, timelimit=%u, " "time_submit=%ld, time_eligible=%ld, " "time_start=%ld, mod_time=UNIX_TIMESTAMP(), " "job_name='%s', track_steps=%u, id_qos=%u, " "state=greatest(state, %u), priority=%u, " "cpus_req=%u, nodes_alloc=%u, " "mem_req=%" PRIu64 ", id_array_job=%u, id_array_task=%u" , job_ptr -> user_id , job_ptr -> group_id , nodes , job_ptr -> resv_id , job_ptr -> time_limit , submit_time , begin_time , start_time , jname , track_steps , job_ptr -> qos_id , job_state , job_ptr -> priority , job_ptr -> details -> min_cpus , node_cnt , job_ptr -> details -> pn_min_memory , job_ptr -> array_job_id , array_task_id ) ; if ( wckeyid ) xstrfmtcat ( query , ", id_wckey=%u" , wckeyid ) ; if ( job_ptr -> account ) xstrfmtcat ( query , ", account='%s'" , job_ptr -> account ) ; if ( partition ) xstrfmtcat ( query , ", `partition`='%s'" , partition ) ; if ( block_id ) xstrfmtcat ( query , ", id_block='%s'" , block_id ) ; if ( job_ptr -> wckey ) xstrfmtcat ( query , ", wckey='%s'" , job_ptr -> wckey ) ; if ( node_inx ) xstrfmtcat ( query , ", node_inx='%s'" , node_inx ) ; if ( gres_req ) xstrfmtcat ( query , ", gres_req='%s'" , gres_req ) ; if ( gres_alloc ) xstrfmtcat ( query , ", gres_alloc='%s'" , gres_alloc ) ; if ( array_recs && array_recs -> task_id_str ) xstrfmtcat ( query , ", array_task_str='%s', " "array_max_tasks=%u, array_task_pending=%u" , array_recs -> task_id_str , array_recs -> max_run_tasks , array_recs -> task_cnt ) ; else xstrfmtcat ( query , ", array_task_str=NULL, " "array_task_pending=0" ) ; if ( job_ptr -> tres_alloc_str ) xstrfmtcat ( query , ", tres_alloc='%s'" , job_ptr -> tres_alloc_str ) ; if ( job_ptr -> tres_req_str ) xstrfmtcat ( query , ", tres_req='%s'" , job_ptr -> tres_req_str ) ; if ( debug_flags & DEBUG_FLAG_DB_JOB ) DB_DEBUG ( mysql_conn -> conn , "query\n%s" , query ) ; try_again : if ( ! ( job_ptr -> db_index = mysql_db_insert_ret_id ( mysql_conn , query ) ) ) { if ( ! reinit ) { error ( "It looks like the storage has gone " "away trying to reconnect" ) ; check_connection ( mysql_conn ) ; reinit = 1 ; goto try_again ; } else rc = SLURM_ERROR ; } } else { query = xstrdup_printf ( "update \"%s_%s\" set nodelist='%s', " , mysql_conn -> cluster_name , job_table , nodes ) ; if ( wckeyid ) xstrfmtcat ( query , "id_wckey=%u, " , wckeyid ) ; if ( job_ptr -> account ) xstrfmtcat ( query , "account='%s', " , job_ptr -> account ) ; if ( partition ) xstrfmtcat ( query , "`partition`='%s', " , partition ) ; if ( block_id ) xstrfmtcat ( query , "id_block='%s', " , block_id ) ; if ( job_ptr -> wckey ) xstrfmtcat ( query , "wckey='%s', " , job_ptr -> wckey ) ; if ( node_inx ) xstrfmtcat ( query , "node_inx='%s', " , node_inx ) ; if ( gres_req ) xstrfmtcat ( query , "gres_req='%s', " , gres_req ) ; if ( gres_alloc ) xstrfmtcat ( query , "gres_alloc='%s', " , gres_alloc ) ; if ( array_recs && array_recs -> task_id_str ) xstrfmtcat ( query , "array_task_str='%s', " "array_max_tasks=%u, " "array_task_pending=%u, " , array_recs -> task_id_str , array_recs -> max_run_tasks , array_recs -> task_cnt ) ; else xstrfmtcat ( query , "array_task_str=NULL, " "array_task_pending=0, " ) ; if ( job_ptr -> tres_alloc_str ) xstrfmtcat ( query , "tres_alloc='%s', " , job_ptr -> tres_alloc_str ) ; if ( job_ptr -> tres_req_str ) xstrfmtcat ( query , "tres_req='%s', " , job_ptr -> tres_req_str ) ; xstrfmtcat ( query , "time_start=%ld, job_name='%s', state=%u, " "nodes_alloc=%u, id_qos=%u, " "id_assoc=%u, id_resv=%u, " "timelimit=%u, mem_req=%" PRIu64 ", " "id_array_job=%u, id_array_task=%u, " "time_eligible=%ld, mod_time=UNIX_TIMESTAMP() " "where job_db_inx=%" PRIu64 , start_time , jname , job_state , node_cnt , job_ptr -> qos_id , job_ptr -> assoc_id , job_ptr -> resv_id , job_ptr -> time_limit , job_ptr -> details -> pn_min_memory , job_ptr -> array_job_id , array_task_id , begin_time , job_ptr -> db_index ) ; if ( debug_flags & DEBUG_FLAG_DB_JOB ) DB_DEBUG ( mysql_conn -> conn , "query\n%s" , query ) ; rc = mysql_db_query ( mysql_conn , query ) ; } xfree ( block_id ) ; xfree ( partition ) ; xfree ( gres_req ) ; xfree ( gres_alloc ) ; xfree ( jname ) ; xfree ( query ) ; if ( IS_JOB_RESIZING ( job_ptr ) ) { if ( IS_JOB_SUSPENDED ( job_ptr ) ) as_mysql_suspend ( mysql_conn , job_db_inx , job_ptr ) ; } return rc ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( TemplateURLTest , IsSearchResults ) { TemplateURLData data ; data . SetURL ( "http://bar/search?q={ searchTerms} " ) ; data . instant_url = "http://bar/instant#q={ searchTerms} " ; data . new_tab_url = "http://barewtab" ; data . alternate_urls . push_back ( "http://bar/?q={ searchTerms} " ) ; data . alternate_urls . push_back ( "http://bar/#q={ searchTerms} " ) ; data . alternate_urls . push_back ( "http://bar/search#q{ searchTerms} " ) ; data . alternate_urls . push_back ( "http://bar/webhp#q={ searchTerms} " ) ; TemplateURL search_provider ( data ) ; const struct { const char * const url ; bool result ; } url_data [ ] = { { "http://bar/search?q=foo&oq=foo" , true , } , { "http://bar/?q=foo&oq=foo" , true , } , { "http://bar/#output=search&q=foo&oq=foo" , true , } , { "http://bar/webhp#q=foo&oq=foo" , true , } , { "http://bar/#q=foo&oq=foo" , true , } , { "http://bar/?ext=foo&q=foo#ref=bar" , true , } , { "http://bar/url?url=http://www.foo.com/&q=foo#ref=bar" , false , } , { "http://bar/" , false , } , { "http://foo/" , false , } , { "http://barewtab" , false , } , } ; for ( size_t i = 0 ; i < arraysize ( url_data ) ; ++ i ) { EXPECT_EQ ( url_data [ i ] . result , search_provider . IsSearchURL ( GURL ( url_data [ i ] . url ) , search_terms_data_ ) ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int string_print ( PyStringObject * op , FILE * fp , int flags ) { Py_ssize_t i , str_len ; char c ; int quote ; if ( ! PyString_CheckExact ( op ) ) { int ret ; op = ( PyStringObject * ) PyObject_Str ( ( PyObject * ) op ) ; if ( op == NULL ) return - 1 ; ret = string_print ( op , fp , flags ) ; Py_DECREF ( op ) ; return ret ; } if ( flags & Py_PRINT_RAW ) { char * data = op -> ob_sval ; Py_ssize_t size = Py_SIZE ( op ) ; Py_BEGIN_ALLOW_THREADS while ( size > INT_MAX ) { const int chunk_size = INT_MAX & ~ 0x3FFF ; fwrite ( data , 1 , chunk_size , fp ) ; data += chunk_size ; size -= chunk_size ; } # ifdef __VMS if ( size ) fwrite ( data , ( size_t ) size , 1 , fp ) ; # else fwrite ( data , 1 , ( size_t ) size , fp ) ; # endif Py_END_ALLOW_THREADS return 0 ; } quote = '\'' ; if ( memchr ( op -> ob_sval , '\'' , Py_SIZE ( op ) ) && ! memchr ( op -> ob_sval , '"' , Py_SIZE ( op ) ) ) quote = '"' ; str_len = Py_SIZE ( op ) ; Py_BEGIN_ALLOW_THREADS fputc ( quote , fp ) ; for ( i = 0 ; i < str_len ; i ++ ) { c = op -> ob_sval [ i ] ; if ( c == quote || c == '\\' ) fprintf ( fp , "\\%c" , c ) ; else if ( c == '\t' ) fprintf ( fp , "\\t" ) ; else if ( c == '\n' ) fprintf ( fp , "\\n" ) ; else if ( c == '\r' ) fprintf ( fp , "\\r" ) ; else if ( c < ' ' || c >= 0x7f ) fprintf ( fp , "\\x%02x" , c & 0xff ) ; else fputc ( c , fp ) ; } fputc ( quote , fp ) ; Py_END_ALLOW_THREADS return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void dissect_zcl_identify_attr_data ( proto_tree * tree , tvbuff_t * tvb , guint * offset , guint16 attr_id , guint data_type ) { switch ( attr_id ) { case ZBEE_ZCL_ATTR_ID_IDENTIFY_IDENTIFY_TIME : proto_tree_add_item ( tree , hf_zbee_zcl_identify_identify_time , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ; * offset += 2 ; break ; default : dissect_zcl_attr_data ( tvb , tree , offset , data_type ) ; break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_ParallelH245Control_item ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 363 "./asn1/h225/h225.cnf" tvbuff_t * h245_tvb = NULL ; offset = dissect_per_octet_string ( tvb , offset , actx , tree , hf_index , NO_BOUND , NO_BOUND , FALSE , & h245_tvb ) ; next_tvb_add_handle ( & h245_list , h245_tvb , ( h225_h245_in_tree ) ? tree : NULL , h245dg_handle ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int rawv6_getsockopt ( struct sock * sk , int level , int optname , char __user * optval , int __user * optlen ) { switch ( level ) { case SOL_RAW : break ; case SOL_ICMPV6 : if ( inet_sk ( sk ) -> inet_num != IPPROTO_ICMPV6 ) return - EOPNOTSUPP ; return rawv6_geticmpfilter ( sk , level , optname , optval , optlen ) ; case SOL_IPV6 : if ( optname == IPV6_CHECKSUM ) break ; default : return ipv6_getsockopt ( sk , level , optname , optval , optlen ) ; } return do_rawv6_getsockopt ( sk , level , optname , optval , optlen ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static GFile * map_possibly_volatile_file_to_real_on_write ( GFile * volatile_file , GFileOutputStream * stream , GCancellable * cancellable , GError * * error ) { GFile * real_file = NULL ; GFileInfo * info = NULL ; info = g_file_output_stream_query_info ( stream , G_FILE_ATTRIBUTE_STANDARD_IS_SYMLINK "," G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE "," G_FILE_ATTRIBUTE_STANDARD_SYMLINK_TARGET , cancellable , error ) ; if ( info == NULL ) { return NULL ; } else { gboolean is_volatile ; is_volatile = g_file_info_get_attribute_boolean ( info , G_FILE_ATTRIBUTE_STANDARD_IS_VOLATILE ) ; if ( is_volatile ) { const gchar * target ; target = g_file_info_get_symlink_target ( info ) ; real_file = g_file_resolve_relative_path ( volatile_file , target ) ; } } g_object_unref ( info ) ; if ( real_file == NULL ) { real_file = g_object_ref ( volatile_file ) ; } return real_file ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void decode_2p_track ( int * out , int code , int m , int off ) { int pos0 = BIT_STR ( code , m , m ) + off ; int pos1 = BIT_STR ( code , 0 , m ) + off ; out [ 0 ] = BIT_POS ( code , 2 * m ) ? - pos0 : pos0 ; out [ 1 ] = BIT_POS ( code , 2 * m ) ? - pos1 : pos1 ; out [ 1 ] = pos0 > pos1 ? - out [ 1 ] : out [ 1 ] ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dtap_cc_call_conf ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) { guint32 curr_offset ; guint32 consumed ; guint curr_len ; curr_offset = offset ; curr_len = len ; is_uplink = IS_UPLINK_TRUE ; ELEM_OPT_TV_SHORT ( 0xd0 , GSM_A_PDU_TYPE_DTAP , DE_REPEAT_IND , " BC repeat indicator" ) ; ELEM_OPT_TLV ( 0x04 , GSM_A_PDU_TYPE_DTAP , DE_BEARER_CAP , " 1" ) ; ELEM_OPT_TLV ( 0x04 , GSM_A_PDU_TYPE_DTAP , DE_BEARER_CAP , " 2" ) ; ELEM_OPT_TLV ( 0x08 , GSM_A_PDU_TYPE_DTAP , DE_CAUSE , NULL ) ; ELEM_OPT_TLV ( 0x15 , GSM_A_PDU_TYPE_DTAP , DE_CC_CAP , NULL ) ; ELEM_OPT_TLV ( 0x2d , GSM_A_PDU_TYPE_DTAP , DE_SI , NULL ) ; ELEM_OPT_TLV ( 0x40 , GSM_A_PDU_TYPE_DTAP , DE_SUP_CODEC_LIST , NULL ) ; EXTRANEOUS_DATA_CHECK ( curr_len , 0 , pinfo , & ei_gsm_a_dtap_extraneous_data ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void setos2 ( struct os2 * os2 , struct alltabs * at , SplineFont * sf , enum fontformat format ) { int i , cnt1 , cnt2 , first , last , avg1 , avg2 , gid ; char * pt ; static int const weightFactors [ 26 ] = { 64 , 14 , 27 , 35 , 100 , 20 , 14 , 42 , 63 , 3 , 6 , 35 , 20 , 56 , 56 , 17 , 4 , 49 , 56 , 71 , 31 , 10 , 18 , 3 , 18 , 2 } ; EncMap * map ; SplineChar * sc ; int modformat = format ; os2 -> version = 1 ; if ( format == ff_otf || format == ff_otfcid ) os2 -> version = 3 ; if ( sf -> use_typo_metrics || sf -> weight_width_slope_only ) os2 -> version = 4 ; if ( sf -> os2_version > os2 -> version ) os2 -> version = sf -> os2_version ; if ( ( format >= ff_ttf && format <= ff_otfdfont ) && ( at -> gi . flags & ttf_flag_symbol ) ) modformat = ff_ttfsym ; os2 -> weightClass = sf -> pfminfo . weight ; os2 -> widthClass = sf -> pfminfo . width ; os2 -> fstype = 0x8 ; if ( sf -> pfminfo . fstype != - 1 ) os2 -> fstype = sf -> pfminfo . fstype ; if ( ! sf -> pfminfo . subsuper_set ) SFDefaultOS2SubSuper ( & sf -> pfminfo , sf -> ascent + sf -> descent , sf -> italicangle ) ; os2 -> ysupYSize = sf -> pfminfo . os2_supysize ; os2 -> ysubXSize = sf -> pfminfo . os2_subxsize ; os2 -> ysubYSize = sf -> pfminfo . os2_subysize ; os2 -> ysupXSize = sf -> pfminfo . os2_supxsize ; os2 -> ysubYOff = sf -> pfminfo . os2_subyoff ; os2 -> ysubXOff = sf -> pfminfo . os2_subxoff ; os2 -> ysupXOff = sf -> pfminfo . os2_supxoff ; os2 -> ysupYOff = sf -> pfminfo . os2_supyoff ; os2 -> yStrikeoutSize = sf -> pfminfo . os2_strikeysize ; os2 -> yStrikeoutPos = sf -> pfminfo . os2_strikeypos ; if ( sf -> pfminfo . stylemap != - 1 ) { int changed = 0 ; os2 -> fsSel = sf -> pfminfo . stylemap ; if ( at -> head . macstyle & 1 && ! ( os2 -> fsSel & 32 ) ) { at -> head . macstyle &= 0x7E ; changed = 1 ; } if ( at -> head . macstyle & 2 && ! ( os2 -> fsSel & 1 ) ) { at -> head . macstyle &= 0x7D ; changed = 1 ; } if ( changed ) redohead ( at ) ; } else { os2 -> fsSel = ( at -> head . macstyle & 1 ? 32 : 0 ) | ( at -> head . macstyle & 2 ? 1 : 0 ) ; if ( os2 -> fsSel == 0 && sf -> pfminfo . weight == 400 ) os2 -> fsSel = 64 ; } if ( sf -> fullname != NULL && strstrmatch ( sf -> fullname , "outline" ) != NULL ) os2 -> fsSel |= 8 ; if ( os2 -> version >= 4 ) { if ( strstrmatch ( sf -> fontname , "Obli" ) != NULL ) { os2 -> fsSel |= 512 ; } if ( sf -> use_typo_metrics ) os2 -> fsSel |= 128 ; if ( sf -> weight_width_slope_only ) os2 -> fsSel |= 256 ; } if ( sf -> pfminfo . typoascent_add ) os2 -> ascender = sf -> ascent + sf -> pfminfo . os2_typoascent ; else os2 -> ascender = sf -> pfminfo . os2_typoascent ; if ( sf -> pfminfo . typodescent_add ) os2 -> descender = - sf -> descent + sf -> pfminfo . os2_typodescent ; else os2 -> descender = sf -> pfminfo . os2_typodescent ; WinBB ( sf , & os2 -> winascent , & os2 -> windescent , at ) ; os2 -> linegap = sf -> pfminfo . os2_typolinegap ; os2 -> sFamilyClass = sf -> pfminfo . os2_family_class ; avg1 = avg2 = last = 0 ; first = 0xffff ; cnt1 = cnt2 = 0 ; for ( i = 0 ; i < sf -> glyphcnt ; ++ i ) if ( ( sc = sf -> glyphs [ i ] ) != NULL ) { if ( SCWorthOutputting ( sc ) && sc -> unicodeenc != - 1 ) { if ( ( format >= ff_ttf && format <= ff_otfdfont && sc -> ttf_glyph > 2 ) || ( format >= ff_ttf && format <= ff_otfdfont && sc -> ttf_glyph > 0 ) ) { if ( sc -> unicodeenc <= 0xffff ) { if ( sc -> unicodeenc < first ) first = sc -> unicodeenc ; if ( sc -> unicodeenc > last ) last = sc -> unicodeenc ; } else { last = 0xffff ; } } if ( sc -> width != 0 ) { avg2 += sc -> width ; ++ cnt2 ; } if ( sc -> unicodeenc == ' ' ) { avg1 += sc -> width * 166 ; ++ cnt1 ; } else if ( sc -> unicodeenc >= 'a' && sc -> unicodeenc <= 'z' ) { avg1 += sc -> width * weightFactors [ sc -> unicodeenc - 'a' ] ; ++ cnt1 ; } } } if ( sf -> pfminfo . hasunicoderanges ) memcpy ( os2 -> unicoderange , sf -> pfminfo . unicoderanges , sizeof ( os2 -> unicoderange ) ) ; else OS2FigureUnicodeRanges ( sf , os2 -> unicoderange ) ; if ( modformat == ff_ttfsym ) memset ( os2 -> unicoderange , 0 , sizeof ( os2 -> unicoderange ) ) ; if ( sf -> pfminfo . pfmset ) strncpy ( os2 -> achVendID , sf -> pfminfo . os2_vendor , 4 ) ; else if ( TTFFoundry != NULL ) strncpy ( os2 -> achVendID , TTFFoundry , 4 ) ; else memcpy ( os2 -> achVendID , "PfEd" , 4 ) ; for ( pt = os2 -> achVendID ; pt < os2 -> achVendID && * pt != '\0' ; ++ pt ) ; while ( pt < os2 -> achVendID ) * pt ++ = ' ' ; os2 -> avgCharWid = 500 ; os2 -> v1_avgCharWid = os2 -> v3_avgCharWid = 0 ; if ( cnt1 == 27 ) os2 -> v1_avgCharWid = avg1 / 1000 ; if ( cnt2 != 0 ) os2 -> v3_avgCharWid = avg2 / cnt2 ; memcpy ( os2 -> panose , sf -> pfminfo . panose , sizeof ( os2 -> panose ) ) ; map = at -> map ; if ( modformat == ff_ttfsym ) { if ( sf -> pfminfo . hascodepages ) memcpy ( os2 -> ulCodePage , sf -> pfminfo . codepages , sizeof ( os2 -> ulCodePage ) ) ; else { os2 -> ulCodePage [ 0 ] = 0x80000000 ; os2 -> ulCodePage [ 1 ] = 0 ; } if ( AlreadyMSSymbolArea ( sf , map ) ) { first = 0xf0ff ; last = 0 ; for ( i = 0xf020 ; i < map -> enccount && i <= 0xf0ff ; ++ i ) if ( ( gid = map -> map [ i ] ) != - 1 && sf -> glyphs [ gid ] != NULL && sf -> glyphs [ gid ] -> ttf_glyph != - 1 ) { if ( i < first ) first = i ; if ( i > last ) last = i ; } for ( i = 0 ; i < map -> enccount && i <= 255 ; ++ i ) if ( ( gid = map -> map [ i ] ) != - 1 && sf -> glyphs [ gid ] != NULL && sf -> glyphs [ gid ] -> ttf_glyph != - 1 ) { if ( i + 0xf000 < first ) first = i + 0xf000 ; if ( i + 0xf000 > last ) last = i + 0xf000 ; } os2 -> firstcharindex = first ; os2 -> lastcharindex = last ; } else { first = 255 ; last = 0 ; for ( i = 0 ; i < map -> enccount && i <= 255 ; ++ i ) if ( ( gid = map -> map [ i ] ) != - 1 && sf -> glyphs [ gid ] != NULL && sf -> glyphs [ gid ] -> ttf_glyph != - 1 ) { if ( i < first ) first = i ; if ( i > last ) last = i ; } for ( i = 0xf020 ; i < map -> enccount && i <= 0xf0ff ; ++ i ) if ( ( gid = map -> map [ i ] ) != - 1 && sf -> glyphs [ gid ] != NULL && sf -> glyphs [ gid ] -> ttf_glyph != - 1 ) { if ( i - 0xf000 < first ) first = i - 0xf000 ; if ( i - 0xf000 > last ) last = i - 0xf000 ; } if ( first < ' ' ) first = ' ' ; os2 -> firstcharindex = 0xf000 + first ; os2 -> lastcharindex = 0xf000 + last ; } } else { os2 -> firstcharindex = first ; os2 -> lastcharindex = last ; if ( sf -> pfminfo . hascodepages ) memcpy ( os2 -> ulCodePage , sf -> pfminfo . codepages , sizeof ( os2 -> ulCodePage ) ) ; else OS2FigureCodePages ( sf , os2 -> ulCodePage ) ; if ( ! sf -> pfminfo . hascodepages ) if ( ( os2 -> ulCodePage [ 0 ] & ~ ( 1U << 31 ) ) == 0 && os2 -> ulCodePage [ 1 ] == 0 ) os2 -> ulCodePage [ 0 ] |= 1 ; } if ( os2 -> version >= 2 ) { if ( sf -> pfminfo . os2_xheight != 0 ) os2 -> xHeight = sf -> pfminfo . os2_xheight ; else { double xh = SFXHeight ( sf , at -> gi . layer , true ) ; os2 -> xHeight = ( xh >= 0.0 ? xh : 0 ) ; } if ( sf -> pfminfo . os2_capheight != 0 ) os2 -> capHeight = sf -> pfminfo . os2_capheight ; else { double caph = SFCapHeight ( sf , at -> gi . layer , true ) ; os2 -> capHeight = ( caph >= 0.0 ? caph : 0 ) ; } os2 -> defChar = 0 ; if ( format == ff_otf || format == ff_otfcid ) os2 -> defChar = ' ' ; os2 -> breakChar = ' ' ; os2 -> maxContext = 1 ; } if ( os2 -> version >= 3 && os2 -> v3_avgCharWid != 0 ) os2 -> avgCharWid = os2 -> v3_avgCharWid ; else if ( os2 -> v1_avgCharWid != 0 ) os2 -> avgCharWid = os2 -> v1_avgCharWid ; else if ( os2 -> v3_avgCharWid != 0 ) os2 -> avgCharWid = os2 -> v3_avgCharWid ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void pmac_ide_writeb ( void * opaque , hwaddr addr , uint32_t val ) { MACIOIDEState * d = opaque ; addr = ( addr & 0xFFF ) >> 4 ; switch ( addr ) { case 1 ... 7 : ide_ioport_write ( & d -> bus , addr , val ) ; break ; case 8 : case 22 : ide_cmd_write ( & d -> bus , 0 , val ) ; break ; default : break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int checkHttpTxnIncomingAddrGet ( SocketTest * test , void * data ) { uint16_t port ; HttpProxyPort * proxy_port = HttpProxyPort : : findHttp ( AF_INET ) ; TSHttpTxn txnp = ( TSHttpTxn ) data ; sockaddr const * ptr = TSHttpTxnIncomingAddrGet ( txnp ) ; if ( nullptr == proxy_port ) { SDK_RPRINT ( test -> regtest , "TSHttpTxnIncomingPortGet" , "TestCase1" , TC_FAIL , "TSHttpTxnIncomingAddrGet failed to find configured HTTP port." ) ; test -> test_client_incoming_port_get = false ; return TS_EVENT_CONTINUE ; } if ( nullptr == ptr ) { SDK_RPRINT ( test -> regtest , "TSHttpTxnIncomingPortGet" , "TestCase1" , TC_FAIL , "TSHttpTxnIncomingAddrGet returns 0 pointer" ) ; test -> test_client_incoming_port_get = false ; return TS_EVENT_CONTINUE ; } port = ats_ip_port_host_order ( ptr ) ; TSDebug ( UTDBG_TAG , "TS HTTP port = %x, Txn incoming client port %x" , proxy_port -> m_port , port ) ; if ( port == proxy_port -> m_port ) { SDK_RPRINT ( test -> regtest , "TSHttpTxnIncomingAddrGet" , "TestCase1" , TC_PASS , "ok" ) ; test -> test_client_incoming_port_get = true ; } else { SDK_RPRINT ( test -> regtest , "TSHttpTxnIncomingAddrGet" , "TestCase1" , TC_FAIL , "Value's Mismatch. From Function: %d Expected value: %d" , port , proxy_port -> m_port ) ; test -> test_client_incoming_port_get = false ; } return TS_EVENT_CONTINUE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void bitmap_writer_set_checksum ( unsigned char * sha1 ) { hashcpy ( writer . pack_checksum , sha1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void * Type_MPE_Dup ( struct _cms_typehandler_struct * self , const void * Ptr , cmsUInt32Number n ) { return ( void * ) cmsPipelineDup ( ( cmsPipeline * ) Ptr ) ; cmsUNUSED_PARAMETER ( n ) ; cmsUNUSED_PARAMETER ( self ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int qemudParseDriveAddReply ( const char * reply , virDomainDeviceDriveAddressPtr addr ) { char * s , * e ; if ( ! ( s = strstr ( reply , "OK " ) ) ) return - 1 ; s += 3 ; if ( STRPREFIX ( s , "bus " ) ) { s += strlen ( "bus " ) ; if ( virStrToLong_ui ( s , & e , 10 , & addr -> bus ) == - 1 ) { VIR_WARN ( "Unable to parse bus '%s'" , s ) ; return - 1 ; } if ( ! STRPREFIX ( e , ", " ) ) { VIR_WARN ( "Expected ', ' parsing drive_add reply '%s'" , s ) ; return - 1 ; } s = e + 2 ; } if ( ! STRPREFIX ( s , "unit " ) ) { VIR_WARN ( "Expected 'unit ' parsing drive_add reply '%s'" , s ) ; return - 1 ; } s += strlen ( "bus " ) ; if ( virStrToLong_ui ( s , & e , 10 , & addr -> unit ) == - 1 ) { VIR_WARN ( "Unable to parse unit number '%s'" , s ) ; return - 1 ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void fz_set_default_output_intent ( fz_context * ctx , fz_default_colorspaces * default_cs , fz_colorspace * cs ) { fz_drop_colorspace ( ctx , default_cs -> oi ) ; default_cs -> oi = fz_keep_colorspace ( ctx , cs ) ; switch ( cs -> n ) { case 1 : if ( default_cs -> gray == fz_device_gray ( ctx ) ) { fz_drop_colorspace ( ctx , default_cs -> gray ) ; default_cs -> gray = fz_keep_colorspace ( ctx , cs ) ; } break ; case 3 : if ( default_cs -> rgb == fz_device_rgb ( ctx ) ) { fz_drop_colorspace ( ctx , default_cs -> rgb ) ; default_cs -> rgb = fz_keep_colorspace ( ctx , cs ) ; } break ; case 4 : if ( default_cs -> cmyk == fz_device_cmyk ( ctx ) ) { fz_drop_colorspace ( ctx , default_cs -> cmyk ) ; default_cs -> cmyk = fz_keep_colorspace ( ctx , cs ) ; } break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void fz_cmm_init_link ( fz_context * ctx , fz_icclink * link , const fz_iccprofile * dst , int dst_extras , const fz_iccprofile * src , int src_extras , const fz_iccprofile * prf , const fz_color_params * rend , int cmm_flags , int num_bytes , int copy_spots ) { if ( ctx && ctx -> colorspace && ctx -> colorspace -> cmm && ctx -> cmm_instance ) ctx -> colorspace -> cmm -> init_link ( ctx -> cmm_instance , link , dst , dst_extras , src , src_extras , prf , rend , cmm_flags , num_bytes , copy_spots ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void s390_virtio_device_sync ( VirtIOS390Device * dev ) { VirtIOS390Bus * bus = DO_UPCAST ( VirtIOS390Bus , bus , dev -> qdev . parent_bus ) ; ram_addr_t cur_offs ; uint8_t num_vq ; int i ; virtio_reset ( dev -> vdev ) ; stb_phys ( dev -> dev_offs + VIRTIO_DEV_OFFS_TYPE , dev -> vdev -> device_id ) ; stb_phys ( dev -> dev_offs + VIRTIO_DEV_OFFS_NUM_VQ , s390_virtio_device_num_vq ( dev ) ) ; stb_phys ( dev -> dev_offs + VIRTIO_DEV_OFFS_FEATURE_LEN , dev -> feat_len ) ; stb_phys ( dev -> dev_offs + VIRTIO_DEV_OFFS_CONFIG_LEN , dev -> vdev -> config_len ) ; num_vq = s390_virtio_device_num_vq ( dev ) ; stb_phys ( dev -> dev_offs + VIRTIO_DEV_OFFS_NUM_VQ , num_vq ) ; for ( i = 0 ; i < num_vq ; i ++ ) { ram_addr_t vq = ( dev -> dev_offs + VIRTIO_DEV_OFFS_CONFIG ) + ( i * VIRTIO_VQCONFIG_LEN ) ; ram_addr_t vring ; vring = s390_virtio_next_ring ( bus ) ; virtio_queue_set_addr ( dev -> vdev , i , vring ) ; virtio_queue_set_vector ( dev -> vdev , i , i ) ; stq_phys ( vq + VIRTIO_VQCONFIG_OFFS_ADDRESS , vring ) ; stw_phys ( vq + VIRTIO_VQCONFIG_OFFS_NUM , virtio_queue_get_num ( dev -> vdev , i ) ) ; } cur_offs = dev -> dev_offs ; cur_offs += VIRTIO_DEV_OFFS_CONFIG ; cur_offs += num_vq * VIRTIO_VQCONFIG_LEN ; stl_phys ( cur_offs , dev -> host_features ) ; dev -> feat_offs = cur_offs + dev -> feat_len ; cur_offs += dev -> feat_len * 2 ; if ( dev -> vdev -> get_config ) { dev -> vdev -> get_config ( dev -> vdev , dev -> vdev -> config ) ; } cpu_physical_memory_rw ( cur_offs , dev -> vdev -> config , dev -> vdev -> config_len , 1 ) ; cur_offs += dev -> vdev -> config_len ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
PKCS7 * d2i_PKCS7_bio ( BIO * bp , PKCS7 * * p7 ) { return ASN1_item_d2i_bio ( ASN1_ITEM_rptr ( PKCS7 ) , bp , p7 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
unsigned int vp9_sub_pixel_avg_variance ## W ## x ## H ## _c ( const uint8_t * src , int src_stride , int xoffset , int yoffset , const uint8_t * dst , int dst_stride , unsigned int * sse , const uint8_t * second_pred ) { uint16_t fdata3 [ ( H + 1 ) * W ] ; uint8_t temp2 [ H * W ] ; DECLARE_ALIGNED_ARRAY ( 16 , uint8_t , temp3 , H * W ) ; var_filter_block2d_bil_first_pass ( src , fdata3 , src_stride , 1 , H + 1 , W , BILINEAR_FILTERS_2TAP ( xoffset ) ) ; var_filter_block2d_bil_second_pass ( fdata3 , temp2 , W , W , H , W , BILINEAR_FILTERS_2TAP ( yoffset ) ) ; vp9_comp_avg_pred ( temp3 , second_pred , W , H , temp2 , W ) ; return vp9_variance ## W ## x ## H ## _c ( temp3 , W , dst , dst_stride , sse ) ; \ } void vp9_get16x16var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) { variance ( src_ptr , source_stride , ref_ptr , ref_stride , 16 , 16 , sse , sum ) ; } void vp9_get8x8var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) { variance ( src_ptr , source_stride , ref_ptr , ref_stride , 8 , 8 , sse , sum ) ; } unsigned int vp9_mse16x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) { int sum ; variance ( src , src_stride , ref , ref_stride , 16 , 16 , sse , & sum ) ; return * sse ; } unsigned int vp9_mse16x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) { int sum ; variance ( src , src_stride , ref , ref_stride , 16 , 8 , sse , & sum ) ; return * sse ; } unsigned int vp9_mse8x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) { int sum ; variance ( src , src_stride , ref , ref_stride , 8 , 16 , sse , & sum ) ; return * sse ; } unsigned int vp9_mse8x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) { int sum ; variance ( src , src_stride , ref , ref_stride , 8 , 8 , sse , & sum ) ; return * sse ; } VAR ( 4 , 4 ) SUBPIX_VAR ( 4 , 4 ) SUBPIX_AVG_VAR ( 4 , 4 ) VAR ( 4 , 8 ) SUBPIX_VAR ( 4 , 8 ) SUBPIX_AVG_VAR ( 4 , 8 ) VAR ( 8 , 4 ) SUBPIX_VAR ( 8 , 4 ) SUBPIX_AVG_VAR ( 8 , 4 ) VAR ( 8 , 8 ) SUBPIX_VAR ( 8 , 8 ) SUBPIX_AVG_VAR ( 8 , 8 ) VAR ( 8 , 16 ) SUBPIX_VAR ( 8 , 16 ) SUBPIX_AVG_VAR ( 8 , 16 ) VAR ( 16 , 8 ) SUBPIX_VAR ( 16 , 8 ) SUBPIX_AVG_VAR ( 16 , 8 ) VAR ( 16 , 16 ) SUBPIX_VAR ( 16 , 16 ) SUBPIX_AVG_VAR ( 16 , 16 ) VAR ( 16 , 32 ) SUBPIX_VAR ( 16 , 32 ) SUBPIX_AVG_VAR ( 16 , 32 ) VAR ( 32 , 16 ) SUBPIX_VAR ( 32 , 16 ) SUBPIX_AVG_VAR ( 32 , 16 ) VAR ( 32 , 32 ) SUBPIX_VAR ( 32 , 32 ) SUBPIX_AVG_VAR ( 32 , 32 ) VAR ( 32 , 64 ) SUBPIX_VAR ( 32 , 64 ) SUBPIX_AVG_VAR ( 32 , 64 ) VAR ( 64 , 32 ) SUBPIX_VAR ( 64 , 32 ) SUBPIX_AVG_VAR ( 64 , 32 )
0False
Categorize the following code snippet as vulnerable or not. True or False
OFCondition parseAssociate ( unsigned char * buf , unsigned long pduLength , PRV_ASSOCIATEPDU * assoc ) { OFCondition cond = EC_Normal ; unsigned char type ; unsigned long itemLength ; PRV_PRESENTATIONCONTEXTITEM * context ; ( void ) memset ( assoc , 0 , sizeof ( * assoc ) ) ; if ( ( assoc -> presentationContextList = LST_Create ( ) ) == NULL ) return EC_MemoryExhausted ; if ( ( assoc -> userInfo . SCUSCPRoleList = LST_Create ( ) ) == NULL ) return EC_MemoryExhausted ; if ( pduLength < 2 + 2 + 16 + 16 + 32 ) return makeLengthError ( "associate PDU" , pduLength , 2 + 2 + 16 + 16 + 32 ) ; assoc -> type = * buf ++ ; assoc -> rsv1 = * buf ++ ; EXTRACT_LONG_BIG ( buf , assoc -> length ) ; buf += 4 ; EXTRACT_SHORT_BIG ( buf , assoc -> protocol ) ; buf += 2 ; pduLength -= 2 ; if ( ( assoc -> protocol & DUL_PROTOCOL ) == 0 ) { char buffer [ 256 ] ; sprintf ( buffer , "DUL Unsupported peer protocol %04x; expected %04x in %s" , assoc -> protocol , DUL_PROTOCOL , "parseAssociate" ) ; return makeDcmnetCondition ( DULC_UNSUPPORTEDPEERPROTOCOL , OF_error , buffer ) ; } assoc -> rsv2 [ 0 ] = * buf ++ ; pduLength -- ; assoc -> rsv2 [ 1 ] = * buf ++ ; pduLength -- ; ( void ) strncpy ( assoc -> calledAPTitle , ( char * ) buf , 16 ) ; assoc -> calledAPTitle [ 16 ] = '\0' ; trim_trailing_spaces ( assoc -> calledAPTitle ) ; buf += 16 ; pduLength -= 16 ; ( void ) strncpy ( assoc -> callingAPTitle , ( char * ) buf , 16 ) ; assoc -> callingAPTitle [ 16 ] = '\0' ; trim_trailing_spaces ( assoc -> callingAPTitle ) ; buf += 16 ; pduLength -= 16 ; ( void ) memcpy ( assoc -> rsv3 , buf , 32 ) ; buf += 32 ; pduLength -= 32 ; if ( DCM_dcmnetLogger . isEnabledFor ( OFLogger : : DEBUG_LOG_LEVEL ) ) { const char * s ; DCMNET_DEBUG ( "Parsing an A-ASSOCIATE PDU" ) ; if ( assoc -> type == DUL_TYPEASSOCIATERQ ) s = "A-ASSOCIATE RQ" ; else if ( assoc -> type == DUL_TYPEASSOCIATEAC ) s = "A-ASSOCIATE AC" ; else s = "Unknown: Programming bug in parseAssociate" ; DCMNET_TRACE ( "PDU type: " << STD_NAMESPACE hex << ( ( unsigned int ) assoc -> type ) << STD_NAMESPACE dec << " (" << s << "), PDU Length: " << assoc -> length << OFendl << "DICOM Protocol: " << STD_NAMESPACE hex << assoc -> protocol << STD_NAMESPACE dec << OFendl << "Called AP Title: " << assoc -> calledAPTitle << OFendl << "Calling AP Title: " << assoc -> callingAPTitle ) ; } while ( ( cond . good ( ) ) && ( pduLength > 0 ) ) { type = * buf ; DCMNET_TRACE ( "Parsing remaining " << pduLength << " bytes of A-ASSOCIATE PDU" << OFendl << "Next item type: " << STD_NAMESPACE hex << STD_NAMESPACE setfill ( '0' ) << STD_NAMESPACE setw ( 2 ) << ( ( unsigned int ) type ) ) ; switch ( type ) { case DUL_TYPEAPPLICATIONCONTEXT : cond = parseSubItem ( & assoc -> applicationContext , buf , & itemLength , pduLength ) ; if ( cond . good ( ) ) { buf += itemLength ; pduLength -= itemLength ; DCMNET_TRACE ( "Successfully parsed Application Context" ) ; } break ; case DUL_TYPEPRESENTATIONCONTEXTRQ : case DUL_TYPEPRESENTATIONCONTEXTAC : context = ( PRV_PRESENTATIONCONTEXTITEM * ) malloc ( sizeof ( PRV_PRESENTATIONCONTEXTITEM ) ) ; if ( context == NULL ) return EC_MemoryExhausted ; ( void ) memset ( context , 0 , sizeof ( * context ) ) ; cond = parsePresentationContext ( type , context , buf , & itemLength , pduLength ) ; if ( cond . bad ( ) ) return cond ; buf += itemLength ; pduLength -= itemLength ; LST_Enqueue ( & assoc -> presentationContextList , ( LST_NODE * ) context ) ; DCMNET_TRACE ( "Successfully parsed Presentation Context" ) ; break ; case DUL_TYPEUSERINFO : cond = parseUserInfo ( & assoc -> userInfo , buf , & itemLength , assoc -> type , pduLength ) ; if ( cond . bad ( ) ) return cond ; buf += itemLength ; pduLength -= itemLength ; DCMNET_TRACE ( "Successfully parsed User Information" ) ; break ; default : cond = parseDummy ( buf , & itemLength , pduLength ) ; buf += itemLength ; if ( ! OFStandard : : safeSubtract ( pduLength , itemLength , pduLength ) ) return makeUnderflowError ( "unknown item type" , pduLength , itemLength ) ; break ; } } return cond ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dissect_fhandle_data_unknown ( tvbuff_t * tvb , int offset , proto_tree * tree ) { guint bytes_left = PVFS2_FH_LENGTH ; proto_tree_add_item ( tree , hf_fhandle_data , tvb , offset , bytes_left , ENC_NA ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void TSHttpTxnUntransformedRespCache ( TSHttpTxn txnp , int on ) { sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ; HttpSM * sm = ( HttpSM * ) txnp ; sm -> t_state . api_info . cache_untransformed = ( on ? true : false ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void mark_work_done ( ArchiveHandle * AH , TocEntry * ready_list , int worker , int status , ParallelState * pstate ) { TocEntry * te = NULL ; te = pstate -> parallelSlot [ worker ] . args -> te ; if ( te == NULL ) exit_horribly ( modulename , "could not find slot of finished worker\n" ) ; ahlog ( AH , 1 , "finished item %d %s %s\n" , te -> dumpId , te -> desc , te -> tag ) ; if ( status == WORKER_CREATE_DONE ) mark_create_done ( AH , te ) ; else if ( status == WORKER_INHIBIT_DATA ) { inhibit_data_for_failed_table ( AH , te ) ; AH -> public . n_errors ++ ; } else if ( status == WORKER_IGNORED_ERRORS ) AH -> public . n_errors ++ ; else if ( status != 0 ) exit_horribly ( modulename , "worker process failed: exit code %d\n" , status ) ; reduce_dependencies ( AH , te , ready_list ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int dissect_h225_CryptoH323Token ( 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_CryptoH323Token , CryptoH323Token_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void spl_ptr_llist_push ( spl_ptr_llist * llist , void * data TSRMLS_DC ) { spl_ptr_llist_element * elem = emalloc ( sizeof ( spl_ptr_llist_element ) ) ; elem -> data = data ; elem -> rc = 1 ; elem -> prev = llist -> tail ; elem -> next = NULL ; if ( llist -> tail ) { llist -> tail -> next = elem ; } else { llist -> head = elem ; } llist -> tail = elem ; llist -> count ++ ; if ( llist -> ctor ) { llist -> ctor ( elem TSRMLS_CC ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline LHASH_OF ( type ) * lh_ ## type ## _new ( unsigned long ( * hfn ) ( const type * ) , int ( * cfn ) ( const type * , const type * ) ) { return ( LHASH_OF ( type ) * ) OPENSSL_LH_new ( ( OPENSSL_LH_HASHFUNC ) hfn , ( OPENSSL_LH_COMPFUNC ) cfn ) ; } static ossl_inline void lh_ ## type ## _free ( LHASH_OF ( type ) * lh ) { OPENSSL_LH_free ( ( OPENSSL_LHASH * ) lh ) ; } static ossl_inline type * lh_ ## type ## _insert ( LHASH_OF ( type ) * lh , type * d ) { return ( type * ) OPENSSL_LH_insert ( ( OPENSSL_LHASH * ) lh , d ) ; } static ossl_inline type * lh_ ## type ## _delete ( LHASH_OF ( type ) * lh , const type * d ) { return ( type * ) OPENSSL_LH_delete ( ( OPENSSL_LHASH * ) lh , d ) ; } static ossl_inline type * lh_ ## type ## _retrieve ( LHASH_OF ( type ) * lh , const type * d ) { return ( type * ) OPENSSL_LH_retrieve ( ( OPENSSL_LHASH * ) lh , d ) ; } static ossl_inline int lh_ ## type ## _error ( LHASH_OF ( type ) * lh ) { return OPENSSL_LH_error ( ( OPENSSL_LHASH * ) lh ) ; } static ossl_inline unsigned long lh_ ## type ## _num_items ( LHASH_OF ( type ) * lh ) { return OPENSSL_LH_num_items ( ( OPENSSL_LHASH * ) lh ) ; } static ossl_inline void lh_ ## type ## _node_stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) { OPENSSL_LH_node_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ; } static ossl_inline void lh_ ## type ## _node_usage_stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) { OPENSSL_LH_node_usage_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ; } static ossl_inline void lh_ ## type ## _stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) { OPENSSL_LH_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ; } static ossl_inline unsigned long lh_ ## type ## _get_down_load ( LHASH_OF ( type ) * lh ) { return OPENSSL_LH_get_down_load ( ( OPENSSL_LHASH * ) lh ) ; } static ossl_inline void lh_ ## type ## _set_down_load ( LHASH_OF ( type ) * lh , unsigned long dl ) { OPENSSL_LH_set_down_load ( ( OPENSSL_LHASH * ) lh , dl ) ; } static ossl_inline void lh_ ## type ## _doall ( LHASH_OF ( type ) * lh , void ( * doall ) ( type * ) ) { OPENSSL_LH_doall ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNC ) doall ) ; } LHASH_OF ( type ) # define IMPLEMENT_LHASH_DOALL_ARG_CONST ( type , argtype ) int_implement_lhash_doall ( type , argtype , const type ) # define IMPLEMENT_LHASH_DOALL_ARG ( type , argtype ) int_implement_lhash_doall ( type , argtype , type ) # define int_implement_lhash_doall ( type , argtype , cbargtype ) static ossl_inline void lh_ ## type ## _doall_ ## argtype ( LHASH_OF ( type ) * lh , void ( * fn ) ( cbargtype * , argtype * ) , argtype * arg ) { OPENSSL_LH_doall_arg ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNCARG ) fn , ( void * ) arg ) ; } LHASH_OF ( type ) DEFINE_LHASH_OF ( OPENSSL_STRING ) ; # ifdef _MSC_VER # pragma warning ( push ) # pragma warning ( disable : 4090 ) # endif DEFINE_LHASH_OF ( OPENSSL_CSTRING )
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_zbee_zcl_poll_ctrl ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) { zbee_zcl_packet * zcl ; guint offset = 0 ; guint8 cmd_id ; 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_poll_ctrl_srv_rx_cmd_names , "Unknown Command" ) , zcl -> tran_seqno ) ; proto_tree_add_item ( tree , hf_zbee_zcl_poll_ctrl_srv_rx_cmd_id , tvb , offset , 1 , cmd_id ) ; offset ++ ; switch ( cmd_id ) { case ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN_RESPONSE : proto_tree_add_item ( tree , hf_zbee_zcl_poll_ctrl_start_fast_polling , tvb , offset , 1 , ENC_NA ) ; offset ++ ; proto_tree_add_item ( tree , hf_zbee_zcl_poll_ctrl_fast_poll_timeout , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ; break ; case ZBEE_ZCL_CMD_ID_POLL_CTRL_FAST_POLL_STOP : break ; case ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_LONG_POLL : proto_tree_add_item ( tree , hf_zbee_zcl_poll_ctrl_new_long_poll_interval , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ; break ; case ZBEE_ZCL_CMD_ID_POLL_CTRL_SET_SHORT_POLL : proto_tree_add_item ( tree , hf_zbee_zcl_poll_ctrl_new_short_poll_interval , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ; break ; default : break ; } } else { col_append_fstr ( pinfo -> cinfo , COL_INFO , "%s, Seq: %u" , val_to_str_const ( cmd_id , zbee_zcl_poll_ctrl_srv_tx_cmd_names , "Unknown Command" ) , zcl -> tran_seqno ) ; proto_tree_add_item ( tree , hf_zbee_zcl_poll_ctrl_srv_tx_cmd_id , tvb , offset , 1 , ENC_NA ) ; offset ++ ; switch ( cmd_id ) { case ZBEE_ZCL_CMD_ID_POLL_CTRL_CHECK_IN : default : break ; } } return tvb_captured_length ( tvb ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void choose_partitioning ( VP9_COMP * cpi , const TileInfo * const tile , int mi_row , int mi_col ) { VP9_COMMON * const cm = & cpi -> common ; MACROBLOCK * x = & cpi -> mb ; MACROBLOCKD * xd = & cpi -> mb . e_mbd ; int i , j , k ; v64x64 vt ; uint8_t * s ; const uint8_t * d ; int sp ; int dp ; int pixels_wide = 64 , pixels_high = 64 ; int_mv nearest_mv , near_mv ; const YV12_BUFFER_CONFIG * yv12 = get_ref_frame_buffer ( cpi , LAST_FRAME ) ; const struct scale_factors * const sf = & cm -> frame_refs [ LAST_FRAME - 1 ] . sf ; vp9_zero ( vt ) ; set_offsets ( cpi , tile , mi_row , mi_col , BLOCK_64X64 ) ; if ( xd -> mb_to_right_edge < 0 ) pixels_wide += ( xd -> mb_to_right_edge >> 3 ) ; if ( xd -> mb_to_bottom_edge < 0 ) pixels_high += ( xd -> mb_to_bottom_edge >> 3 ) ; s = x -> plane [ 0 ] . src . buf ; sp = x -> plane [ 0 ] . src . stride ; if ( cm -> frame_type != KEY_FRAME ) { vp9_setup_pre_planes ( xd , 0 , yv12 , mi_row , mi_col , sf ) ; xd -> mi [ 0 ] . src_mi -> mbmi . ref_frame [ 0 ] = LAST_FRAME ; xd -> mi [ 0 ] . src_mi -> mbmi . sb_type = BLOCK_64X64 ; vp9_find_best_ref_mvs ( xd , cm -> allow_high_precision_mv , xd -> mi [ 0 ] . src_mi -> mbmi . ref_mvs [ LAST_FRAME ] , & nearest_mv , & near_mv ) ; xd -> mi [ 0 ] . src_mi -> mbmi . mv [ 0 ] = nearest_mv ; vp9_build_inter_predictors_sby ( xd , mi_row , mi_col , BLOCK_64X64 ) ; d = xd -> plane [ 0 ] . dst . buf ; dp = xd -> plane [ 0 ] . dst . stride ; } else { d = VP9_VAR_OFFS ; dp = 0 ; } for ( i = 0 ; i < 4 ; i ++ ) { const int x32_idx = ( ( i & 1 ) << 5 ) ; const int y32_idx = ( ( i >> 1 ) << 5 ) ; for ( j = 0 ; j < 4 ; j ++ ) { const int x16_idx = x32_idx + ( ( j & 1 ) << 4 ) ; const int y16_idx = y32_idx + ( ( j >> 1 ) << 4 ) ; v16x16 * vst = & vt . split [ i ] . split [ j ] ; for ( k = 0 ; k < 4 ; k ++ ) { int x_idx = x16_idx + ( ( k & 1 ) << 3 ) ; int y_idx = y16_idx + ( ( k >> 1 ) << 3 ) ; unsigned int sse = 0 ; int sum = 0 ; if ( x_idx < pixels_wide && y_idx < pixels_high ) vp9_get8x8var ( s + y_idx * sp + x_idx , sp , d + y_idx * dp + x_idx , dp , & sse , & sum ) ; fill_variance ( sse , sum , 64 , & vst -> split [ k ] . part_variances . none ) ; } } } for ( i = 0 ; i < 4 ; i ++ ) { for ( j = 0 ; j < 4 ; j ++ ) { fill_variance_tree ( & vt . split [ i ] . split [ j ] , BLOCK_16X16 ) ; } fill_variance_tree ( & vt . split [ i ] , BLOCK_32X32 ) ; } fill_variance_tree ( & vt , BLOCK_64X64 ) ; if ( ! set_vt_partitioning ( cpi , & vt , BLOCK_64X64 , mi_row , mi_col ) ) { for ( i = 0 ; i < 4 ; ++ i ) { const int x32_idx = ( ( i & 1 ) << 2 ) ; const int y32_idx = ( ( i >> 1 ) << 2 ) ; if ( ! set_vt_partitioning ( cpi , & vt . split [ i ] , BLOCK_32X32 , ( mi_row + y32_idx ) , ( mi_col + x32_idx ) ) ) { for ( j = 0 ; j < 4 ; ++ j ) { const int x16_idx = ( ( j & 1 ) << 1 ) ; const int y16_idx = ( ( j >> 1 ) << 1 ) ; # define DISABLE_8X8_VAR_BASED_PARTITION # ifdef DISABLE_8X8_VAR_BASED_PARTITION if ( mi_row + y32_idx + y16_idx + 1 < cm -> mi_rows && mi_row + x32_idx + x16_idx + 1 < cm -> mi_cols ) { set_block_size ( cpi , ( mi_row + y32_idx + y16_idx ) , ( mi_col + x32_idx + x16_idx ) , BLOCK_16X16 ) ; } else { for ( k = 0 ; k < 4 ; ++ k ) { const int x8_idx = ( k & 1 ) ; const int y8_idx = ( k >> 1 ) ; set_block_size ( cpi , ( mi_row + y32_idx + y16_idx + y8_idx ) , ( mi_col + x32_idx + x16_idx + x8_idx ) , BLOCK_8X8 ) ; } } # else if ( ! set_vt_partitioning ( cpi , & vt . split [ i ] . split [ j ] , tile , BLOCK_16X16 , ( mi_row + y32_idx + y16_idx ) , ( mi_col + x32_idx + x16_idx ) , 2 ) ) { for ( k = 0 ; k < 4 ; ++ k ) { const int x8_idx = ( k & 1 ) ; const int y8_idx = ( k >> 1 ) ; set_block_size ( cpi , ( mi_row + y32_idx + y16_idx + y8_idx ) , ( mi_col + x32_idx + x16_idx + x8_idx ) , BLOCK_8X8 ) ; } } # endif } } } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline type * lh_ ## type ## _delete ( LHASH_OF ( type ) * lh , const type * d ) { return ( type * ) OPENSSL_LH_delete ( ( OPENSSL_LHASH * ) lh , d ) ; } static ossl_inline type * lh_ ## type ## _retrieve ( LHASH_OF ( type ) * lh , const type * d ) { return ( type * ) OPENSSL_LH_retrieve ( ( OPENSSL_LHASH * ) lh , d ) ; } static ossl_inline int lh_ ## type ## _error ( LHASH_OF ( type ) * lh ) { return OPENSSL_LH_error ( ( OPENSSL_LHASH * ) lh ) ; } static ossl_inline unsigned long lh_ ## type ## _num_items ( LHASH_OF ( type ) * lh ) { return OPENSSL_LH_num_items ( ( OPENSSL_LHASH * ) lh ) ; } static ossl_inline void lh_ ## type ## _node_stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) { OPENSSL_LH_node_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ; } static ossl_inline void lh_ ## type ## _node_usage_stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) { OPENSSL_LH_node_usage_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ; } static ossl_inline void lh_ ## type ## _stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) { OPENSSL_LH_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ; } static ossl_inline unsigned long lh_ ## type ## _get_down_load ( LHASH_OF ( type ) * lh ) { return OPENSSL_LH_get_down_load ( ( OPENSSL_LHASH * ) lh ) ; } static ossl_inline void lh_ ## type ## _set_down_load ( LHASH_OF ( type ) * lh , unsigned long dl ) { OPENSSL_LH_set_down_load ( ( OPENSSL_LHASH * ) lh , dl ) ; } static ossl_inline void lh_ ## type ## _doall ( LHASH_OF ( type ) * lh , void ( * doall ) ( type * ) ) { OPENSSL_LH_doall ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNC ) doall ) ; } LHASH_OF ( type ) # define IMPLEMENT_LHASH_DOALL_ARG_CONST ( type , argtype ) int_implement_lhash_doall ( type , argtype , const type ) # define IMPLEMENT_LHASH_DOALL_ARG ( type , argtype ) int_implement_lhash_doall ( type , argtype , type ) # define int_implement_lhash_doall ( type , argtype , cbargtype ) static ossl_inline void lh_ ## type ## _doall_ ## argtype ( LHASH_OF ( type ) * lh , void ( * fn ) ( cbargtype * , argtype * ) , argtype * arg ) { OPENSSL_LH_doall_arg ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNCARG ) fn , ( void * ) arg ) ; } LHASH_OF ( type ) DEFINE_LHASH_OF ( OPENSSL_STRING )
0False
Categorize the following code snippet as vulnerable or not. True or False
static int decode_cabac_mb_cbp_luma ( H264Context * h ) { int cbp_b , cbp_a , ctx , cbp = 0 ; cbp_a = h -> left_cbp ; cbp_b = h -> top_cbp ; ctx = ! ( cbp_a & 0x02 ) + 2 * ! ( cbp_b & 0x04 ) ; cbp += get_cabac_noinline ( & h -> cabac , & h -> cabac_state [ 73 + ctx ] ) ; ctx = ! ( cbp & 0x01 ) + 2 * ! ( cbp_b & 0x08 ) ; cbp += get_cabac_noinline ( & h -> cabac , & h -> cabac_state [ 73 + ctx ] ) << 1 ; ctx = ! ( cbp_a & 0x08 ) + 2 * ! ( cbp & 0x01 ) ; cbp += get_cabac_noinline ( & h -> cabac , & h -> cabac_state [ 73 + ctx ] ) << 2 ; ctx = ! ( cbp & 0x04 ) + 2 * ! ( cbp & 0x02 ) ; cbp += get_cabac_noinline ( & h -> cabac , & h -> cabac_state [ 73 + ctx ] ) << 3 ; return cbp ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_Cmd_clockRecovery ( 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_Cmd_clockRecovery , Cmd_clockRecovery_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void handle_raw_ping ( struct query * q , int dns_fd , int userid ) { if ( check_user_and_ip ( userid , q ) != 0 ) { return ; } users [ userid ] . last_pkt = time ( NULL ) ; memcpy ( & ( users [ userid ] . q ) , q , sizeof ( struct query ) ) ; if ( debug >= 1 ) { fprintf ( stderr , "IN ping raw, from user %d\n" , userid ) ; } send_raw ( dns_fd , NULL , 0 , userid , RAW_HDR_CMD_PING , q ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void U_CALLCONV _UTF16BEToUnicodeWithOffsets ( UConverterToUnicodeArgs * pArgs , UErrorCode * pErrorCode ) { UConverter * cnv ; const uint8_t * source ; UChar * target ; int32_t * offsets ; uint32_t targetCapacity , length , count , sourceIndex ; UChar c , trail ; if ( pArgs -> converter -> mode < 8 ) { _UTF16ToUnicodeWithOffsets ( pArgs , pErrorCode ) ; return ; } cnv = pArgs -> converter ; source = ( const uint8_t * ) pArgs -> source ; length = ( int32_t ) ( ( const uint8_t * ) pArgs -> sourceLimit - source ) ; if ( length <= 0 && cnv -> toUnicodeStatus == 0 ) { return ; } target = pArgs -> target ; if ( target >= pArgs -> targetLimit ) { * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; return ; } targetCapacity = ( uint32_t ) ( pArgs -> targetLimit - target ) ; offsets = pArgs -> offsets ; sourceIndex = 0 ; c = 0 ; if ( cnv -> toUnicodeStatus != 0 ) { cnv -> toUBytes [ 0 ] = ( uint8_t ) cnv -> toUnicodeStatus ; cnv -> toULength = 1 ; cnv -> toUnicodeStatus = 0 ; } if ( ( count = cnv -> toULength ) != 0 ) { uint8_t * p = cnv -> toUBytes ; do { p [ count ++ ] = * source ++ ; ++ sourceIndex ; -- length ; if ( count == 2 ) { c = ( ( UChar ) p [ 0 ] << 8 ) | p [ 1 ] ; if ( U16_IS_SINGLE ( c ) ) { * target ++ = c ; if ( offsets != NULL ) { * offsets ++ = - 1 ; } -- targetCapacity ; count = 0 ; c = 0 ; break ; } else if ( U16_IS_SURROGATE_LEAD ( c ) ) { c = 0 ; } else { break ; } } else if ( count == 4 ) { c = ( ( UChar ) p [ 0 ] << 8 ) | p [ 1 ] ; trail = ( ( UChar ) p [ 2 ] << 8 ) | p [ 3 ] ; if ( U16_IS_TRAIL ( trail ) ) { * target ++ = c ; if ( targetCapacity >= 2 ) { * target ++ = trail ; if ( offsets != NULL ) { * offsets ++ = - 1 ; * offsets ++ = - 1 ; } targetCapacity -= 2 ; } else { targetCapacity = 0 ; cnv -> UCharErrorBuffer [ 0 ] = trail ; cnv -> UCharErrorBufferLength = 1 ; * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; } count = 0 ; c = 0 ; break ; } else { * pErrorCode = U_ILLEGAL_CHAR_FOUND ; if ( ( ( const uint8_t * ) pArgs -> source - source ) >= 2 ) { source -= 2 ; } else { cnv -> toUnicodeStatus = 0x100 | p [ 2 ] ; -- source ; } cnv -> toULength = 2 ; pArgs -> source = ( const char * ) source ; pArgs -> target = target ; pArgs -> offsets = offsets ; return ; } } } while ( length > 0 ) ; cnv -> toULength = ( int8_t ) count ; } count = 2 * targetCapacity ; if ( count > length ) { count = length & ~ 1 ; } if ( c == 0 && count > 0 ) { length -= count ; count >>= 1 ; targetCapacity -= count ; if ( offsets == NULL ) { do { c = ( ( UChar ) source [ 0 ] << 8 ) | source [ 1 ] ; source += 2 ; if ( U16_IS_SINGLE ( c ) ) { * target ++ = c ; } else if ( U16_IS_SURROGATE_LEAD ( c ) && count >= 2 && U16_IS_TRAIL ( trail = ( ( UChar ) source [ 0 ] << 8 ) | source [ 1 ] ) ) { source += 2 ; -- count ; * target ++ = c ; * target ++ = trail ; } else { break ; } } while ( -- count > 0 ) ; } else { do { c = ( ( UChar ) source [ 0 ] << 8 ) | source [ 1 ] ; source += 2 ; if ( U16_IS_SINGLE ( c ) ) { * target ++ = c ; * offsets ++ = sourceIndex ; sourceIndex += 2 ; } else if ( U16_IS_SURROGATE_LEAD ( c ) && count >= 2 && U16_IS_TRAIL ( trail = ( ( UChar ) source [ 0 ] << 8 ) | source [ 1 ] ) ) { source += 2 ; -- count ; * target ++ = c ; * target ++ = trail ; * offsets ++ = sourceIndex ; * offsets ++ = sourceIndex ; sourceIndex += 4 ; } else { break ; } } while ( -- count > 0 ) ; } if ( count == 0 ) { c = 0 ; } else { length += 2 * ( count - 1 ) ; targetCapacity += count ; } } if ( c != 0 ) { cnv -> toUBytes [ 0 ] = ( uint8_t ) ( c >> 8 ) ; cnv -> toUBytes [ 1 ] = ( uint8_t ) c ; cnv -> toULength = 2 ; if ( U16_IS_SURROGATE_LEAD ( c ) ) { if ( length >= 2 ) { if ( U16_IS_TRAIL ( trail = ( ( UChar ) source [ 0 ] << 8 ) | source [ 1 ] ) ) { source += 2 ; length -= 2 ; * target ++ = c ; if ( offsets != NULL ) { * offsets ++ = sourceIndex ; } cnv -> UCharErrorBuffer [ 0 ] = trail ; cnv -> UCharErrorBufferLength = 1 ; cnv -> toULength = 0 ; * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; } else { * pErrorCode = U_ILLEGAL_CHAR_FOUND ; } } else { } } else { * pErrorCode = U_ILLEGAL_CHAR_FOUND ; } } if ( U_SUCCESS ( * pErrorCode ) ) { if ( length > 0 ) { if ( targetCapacity == 0 ) { * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; } else { cnv -> toUBytes [ cnv -> toULength ++ ] = * source ++ ; } } } pArgs -> source = ( const char * ) source ; pArgs -> target = target ; pArgs -> offsets = offsets ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( ExtensionPreferenceApiTest , MAYBE_Standard ) { PrefService * prefs = profile_ -> GetPrefs ( ) ; prefs -> SetBoolean ( prefs : : kAlternateErrorPagesEnabled , false ) ; prefs -> SetBoolean ( autofill : : prefs : : kAutofillEnabled , false ) ; prefs -> SetBoolean ( autofill : : prefs : : kAutofillCreditCardEnabled , false ) ; prefs -> SetBoolean ( autofill : : prefs : : kAutofillProfileEnabled , false ) ; prefs -> SetBoolean ( prefs : : kBlockThirdPartyCookies , true ) ; prefs -> SetBoolean ( prefs : : kEnableHyperlinkAuditing , false ) ; prefs -> SetBoolean ( prefs : : kEnableReferrers , false ) ; prefs -> SetBoolean ( prefs : : kOfferTranslateEnabled , false ) ; prefs -> SetInteger ( prefs : : kNetworkPredictionOptions , chrome_browser_net : : NETWORK_PREDICTION_NEVER ) ; prefs -> SetBoolean ( password_manager : : prefs : : kCredentialsEnableService , false ) ; prefs -> SetBoolean ( prefs : : kSafeBrowsingEnabled , false ) ; prefs -> SetBoolean ( prefs : : kSearchSuggestEnabled , false ) ; prefs -> SetBoolean ( prefs : : kWebRTCMultipleRoutesEnabled , false ) ; prefs -> SetBoolean ( prefs : : kWebRTCNonProxiedUdpEnabled , false ) ; prefs -> SetString ( prefs : : kWebRTCIPHandlingPolicy , content : : kWebRTCIPHandlingDefaultPublicInterfaceOnly ) ; const char kExtensionPath [ ] = "preference/standard" ; EXPECT_TRUE ( RunExtensionSubtest ( kExtensionPath , "test.html" ) ) << message_ ; CheckPreferencesSet ( ) ; ReloadExtension ( last_loaded_extension_id ( ) ) ; CheckPreferencesSet ( ) ; extensions : : TestExtensionRegistryObserver observer ( extensions : : ExtensionRegistry : : Get ( profile_ ) , last_loaded_extension_id ( ) ) ; UninstallExtension ( last_loaded_extension_id ( ) ) ; observer . WaitForExtensionUninstalled ( ) ; CheckPreferencesCleared ( ) ; LoadExtension ( test_data_dir_ . AppendASCII ( kExtensionPath ) ) ; CheckPreferencesCleared ( ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static inline void ZERO8x2 ( void * dst , int stride ) { fill_rectangle ( dst , 1 , 2 , stride , 0 , 4 ) ; fill_rectangle ( ( ( uint8_t * ) ( dst ) ) + 4 , 1 , 2 , stride , 0 , 4 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void gic_thiscpu_write ( void * opaque , hwaddr addr , uint64_t value , unsigned size ) { GICState * s = ( GICState * ) opaque ; gic_cpu_write ( s , gic_get_current_cpu ( s ) , addr , value ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_CapabilityDescriptor ( 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_CapabilityDescriptor , CapabilityDescriptor_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( MdDownloadsDOMHandlerTest , HandleSaveDownload ) { testing : : StrictMock < content : : MockDownloadItem > dangerous_file_type ; EXPECT_CALL ( dangerous_file_type , GetDangerType ( ) ) . WillRepeatedly ( testing : : Return ( content : : DOWNLOAD_DANGER_TYPE_DANGEROUS_FILE ) ) ; EXPECT_CALL ( dangerous_file_type , GetId ( ) ) . WillOnce ( testing : : Return ( uint32_t ( ) ) ) ; TestMdDownloadsDOMHandler handler ( manager ( ) , web_ui ( ) ) ; EXPECT_EQ ( 0 , handler . danger_prompt_count ( ) ) ; handler . SaveDownload ( & dangerous_file_type ) ; EXPECT_EQ ( 0 , handler . danger_prompt_count ( ) ) ; testing : : StrictMock < content : : MockDownloadItem > malicious_download ; EXPECT_CALL ( malicious_download , GetDangerType ( ) ) . WillRepeatedly ( testing : : Return ( content : : DOWNLOAD_DANGER_TYPE_DANGEROUS_URL ) ) ; handler . SaveDownload ( & malicious_download ) ; EXPECT_EQ ( 1 , handler . danger_prompt_count ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int i2c_ASN1_BIT_STRING ( ASN1_BIT_STRING * a , unsigned char * * pp ) { int ret , j , bits , len ; unsigned char * p , * d ; if ( a == NULL ) return ( 0 ) ; len = a -> length ; if ( len > 0 ) { if ( a -> flags & ASN1_STRING_FLAG_BITS_LEFT ) { bits = ( int ) a -> flags & 0x07 ; } else { for ( ; len > 0 ; len -- ) { if ( a -> data [ len - 1 ] ) break ; } j = a -> data [ len - 1 ] ; if ( j & 0x01 ) bits = 0 ; else if ( j & 0x02 ) bits = 1 ; else if ( j & 0x04 ) bits = 2 ; else if ( j & 0x08 ) bits = 3 ; else if ( j & 0x10 ) bits = 4 ; else if ( j & 0x20 ) bits = 5 ; else if ( j & 0x40 ) bits = 6 ; else if ( j & 0x80 ) bits = 7 ; else bits = 0 ; } } else bits = 0 ; ret = 1 + len ; if ( pp == NULL ) return ( ret ) ; p = * pp ; * ( p ++ ) = ( unsigned char ) bits ; d = a -> data ; memcpy ( p , d , len ) ; p += len ; if ( len > 0 ) p [ - 1 ] &= ( 0xff << bits ) ; * pp = p ; return ( ret ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _evdns_log ( int warn , const char * fmt , ... ) { va_list args ; static char buf [ 512 ] ; if ( ! evdns_log_fn ) return ; va_start ( args , fmt ) ; evutil_vsnprintf ( buf , sizeof ( buf ) , fmt , args ) ; buf [ sizeof ( buf ) - 1 ] = '\0' ; evdns_log_fn ( warn , buf ) ; va_end ( args ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void check_object ( struct object_entry * entry ) { if ( entry -> in_pack ) { struct packed_git * p = entry -> in_pack ; struct pack_window * w_curs = NULL ; const unsigned char * base_ref = NULL ; struct object_entry * base_entry ; unsigned long used , used_0 ; unsigned long avail ; off_t ofs ; unsigned char * buf , c ; buf = use_pack ( p , & w_curs , entry -> in_pack_offset , & avail ) ; used = unpack_object_header_buffer ( buf , avail , & entry -> in_pack_type , & entry -> size ) ; if ( used == 0 ) goto give_up ; switch ( entry -> in_pack_type ) { default : entry -> type = entry -> in_pack_type ; entry -> in_pack_header_size = used ; if ( entry -> type < OBJ_COMMIT || entry -> type > OBJ_BLOB ) goto give_up ; unuse_pack ( & w_curs ) ; return ; case OBJ_REF_DELTA : if ( reuse_delta && ! entry -> preferred_base ) base_ref = use_pack ( p , & w_curs , entry -> in_pack_offset + used , NULL ) ; entry -> in_pack_header_size = used + 20 ; break ; case OBJ_OFS_DELTA : buf = use_pack ( p , & w_curs , entry -> in_pack_offset + used , NULL ) ; used_0 = 0 ; c = buf [ used_0 ++ ] ; ofs = c & 127 ; while ( c & 128 ) { ofs += 1 ; if ( ! ofs || MSB ( ofs , 7 ) ) { error ( "delta base offset overflow in pack for %s" , sha1_to_hex ( entry -> idx . sha1 ) ) ; goto give_up ; } c = buf [ used_0 ++ ] ; ofs = ( ofs << 7 ) + ( c & 127 ) ; } ofs = entry -> in_pack_offset - ofs ; if ( ofs <= 0 || ofs >= entry -> in_pack_offset ) { error ( "delta base offset out of bound for %s" , sha1_to_hex ( entry -> idx . sha1 ) ) ; goto give_up ; } if ( reuse_delta && ! entry -> preferred_base ) { struct revindex_entry * revidx ; revidx = find_pack_revindex ( p , ofs ) ; if ( ! revidx ) goto give_up ; base_ref = nth_packed_object_sha1 ( p , revidx -> nr ) ; } entry -> in_pack_header_size = used + used_0 ; break ; } if ( base_ref && ( base_entry = packlist_find ( & to_pack , base_ref , NULL ) ) ) { entry -> type = entry -> in_pack_type ; entry -> delta = base_entry ; entry -> delta_size = entry -> size ; entry -> delta_sibling = base_entry -> delta_child ; base_entry -> delta_child = entry ; unuse_pack ( & w_curs ) ; return ; } if ( entry -> type ) { entry -> size = get_size_from_delta ( p , & w_curs , entry -> in_pack_offset + entry -> in_pack_header_size ) ; if ( entry -> size == 0 ) goto give_up ; unuse_pack ( & w_curs ) ; return ; } give_up : unuse_pack ( & w_curs ) ; } entry -> type = sha1_object_info ( entry -> idx . sha1 , & entry -> size ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int get_ref_frame_flags ( const VP9_COMP * cpi ) { const int * const map = cpi -> common . ref_frame_map ; const int gold_is_last = map [ cpi -> gld_fb_idx ] == map [ cpi -> lst_fb_idx ] ; const int alt_is_last = map [ cpi -> alt_fb_idx ] == map [ cpi -> lst_fb_idx ] ; const int gold_is_alt = map [ cpi -> gld_fb_idx ] == map [ cpi -> alt_fb_idx ] ; int flags = VP9_ALT_FLAG | VP9_GOLD_FLAG | VP9_LAST_FLAG ; if ( gold_is_last ) flags &= ~ VP9_GOLD_FLAG ; if ( cpi -> rc . frames_till_gf_update_due == INT_MAX && ! is_two_pass_svc ( cpi ) ) flags &= ~ VP9_GOLD_FLAG ; if ( alt_is_last ) flags &= ~ VP9_ALT_FLAG ; if ( gold_is_alt ) flags &= ~ VP9_ALT_FLAG ; return flags ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void convolute_with_sparse ( float * out , const AMRFixed * pulses , const float * shape , int length ) { int i , j ; memset ( out , 0 , length * sizeof ( float ) ) ; for ( i = 0 ; i < pulses -> n ; i ++ ) for ( j = pulses -> x [ i ] ; j < length ; j ++ ) out [ j ] += pulses -> y [ i ] * shape [ j - pulses -> x [ i ] ] ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
struct mskwaj_decompressor * mspack_create_kwaj_decompressor ( struct mspack_system * sys ) { struct mskwaj_decompressor_p * self = NULL ; if ( ! sys ) sys = mspack_default_system ; if ( ! mspack_valid_system ( sys ) ) return NULL ; if ( ( self = ( struct mskwaj_decompressor_p * ) sys -> alloc ( sys , sizeof ( struct mskwaj_decompressor_p ) ) ) ) { self -> base . open = & kwajd_open ; self -> base . close = & kwajd_close ; self -> base . extract = & kwajd_extract ; self -> base . decompress = & kwajd_decompress ; self -> base . last_error = & kwajd_error ; self -> system = sys ; self -> error = MSPACK_ERR_OK ; } return ( struct mskwaj_decompressor * ) self ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int selinux_msg_queue_alloc_security ( struct msg_queue * msq ) { struct ipc_security_struct * isec ; struct common_audit_data ad ; u32 sid = current_sid ( ) ; int rc ; rc = ipc_alloc_security ( current , & msq -> q_perm , SECCLASS_MSGQ ) ; if ( rc ) return rc ; isec = msq -> q_perm . security ; ad . type = LSM_AUDIT_DATA_IPC ; ad . u . ipc_id = msq -> q_perm . key ; rc = avc_has_perm ( sid , isec -> sid , SECCLASS_MSGQ , MSGQ__CREATE , & ad ) ; if ( rc ) { ipc_free_security ( & msq -> q_perm ) ; return rc ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_xjoin ( ) { MYSQL_STMT * stmt ; int rc , i ; const char * query = "select t.id, p1.value, n1.value, p2.value, n2.value from t3 t LEFT JOIN t1 p1 ON (p1.id=t.param1_id) LEFT JOIN t2 p2 ON (p2.id=t.param2_id) LEFT JOIN t4 n1 ON (n1.id=p1.name_id) LEFT JOIN t4 n2 ON (n2.id=p2.name_id) where t.id=1" ; myheader ( "test_xjoin" ) ; rc = mysql_query ( mysql , "DROP TABLE IF EXISTS t1, t2, t3, t4" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "create table t3 (id int(8), param1_id int(8), param2_id int(8)) ENGINE=InnoDB DEFAULT CHARSET=utf8" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "create table t1 ( id int(8), name_id int(8), value varchar(10)) ENGINE=InnoDB DEFAULT CHARSET=utf8" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "create table t2 (id int(8), name_id int(8), value varchar(10)) ENGINE=InnoDB DEFAULT CHARSET=utf8; " ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "create table t4(id int(8), value varchar(10)) ENGINE=InnoDB DEFAULT CHARSET=utf8" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "insert into t3 values (1, 1, 1), (2, 2, null)" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "insert into t1 values (1, 1, 'aaa'), (2, null, 'bbb')" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "insert into t2 values (1, 2, 'ccc')" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "insert into t4 values (1, 'Name1'), (2, null)" ) ; myquery ( rc ) ; stmt = mysql_simple_prepare ( mysql , query ) ; check_stmt ( stmt ) ; for ( i = 0 ; i < 3 ; i ++ ) { rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; rc = my_process_stmt_result ( stmt ) ; DIE_UNLESS ( rc == 1 ) ; } mysql_stmt_close ( stmt ) ; rc = mysql_query ( mysql , "DROP TABLE t1, t2, t3, t4" ) ; myquery ( rc ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const char * qemuAgentCommandName ( virJSONValuePtr cmd ) { const char * name = virJSONValueObjectGetString ( cmd , "execute" ) ; if ( name ) return name ; else return "<unknown>" ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_pvfs2_crdirent_request ( tvbuff_t * tvb , proto_tree * tree , int offset , packet_info * pinfo ) { offset = dissect_pvfs_string ( tvb , tree , hf_pvfs_path , offset , NULL ) ; offset = dissect_pvfs_fh ( tvb , offset , pinfo , tree , "file handle" , NULL ) ; offset = dissect_pvfs_fh ( tvb , offset , pinfo , tree , "parent handle" , NULL ) ; offset = dissect_pvfs_fs_id ( tvb , tree , offset ) ; offset += 4 ; offset = dissect_pvfs_time ( tvb , tree , offset , hf_pvfs_atime , hf_pvfs_atime_sec , hf_pvfs_atime_nsec ) ; offset = dissect_pvfs_time ( tvb , tree , offset , hf_pvfs_mtime , hf_pvfs_mtime_sec , hf_pvfs_mtime_nsec ) ; offset = dissect_pvfs_time ( tvb , tree , offset , hf_pvfs_ctime , hf_pvfs_ctime_sec , hf_pvfs_ctime_nsec ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int aes_wrap_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t inlen ) { EVP_AES_WRAP_CTX * wctx = EVP_C_DATA ( EVP_AES_WRAP_CTX , ctx ) ; size_t rv ; int pad = EVP_CIPHER_CTX_iv_length ( ctx ) == 4 ; if ( ! in ) return 0 ; if ( ! inlen ) return - 1 ; if ( ! EVP_CIPHER_CTX_encrypting ( ctx ) && ( inlen < 16 || inlen & 0x7 ) ) return - 1 ; if ( ! pad && inlen & 0x7 ) return - 1 ; if ( is_partially_overlapping ( out , in , inlen ) ) { EVPerr ( EVP_F_AES_WRAP_CIPHER , EVP_R_PARTIALLY_OVERLAPPING ) ; return 0 ; } if ( ! out ) { if ( EVP_CIPHER_CTX_encrypting ( ctx ) ) { if ( pad ) inlen = ( inlen + 7 ) / 8 * 8 ; return inlen + 8 ; } else { return inlen - 8 ; } } if ( pad ) { if ( EVP_CIPHER_CTX_encrypting ( ctx ) ) rv = CRYPTO_128_wrap_pad ( & wctx -> ks . ks , wctx -> iv , out , in , inlen , ( block128_f ) AES_encrypt ) ; else rv = CRYPTO_128_unwrap_pad ( & wctx -> ks . ks , wctx -> iv , out , in , inlen , ( block128_f ) AES_decrypt ) ; } else { if ( EVP_CIPHER_CTX_encrypting ( ctx ) ) rv = CRYPTO_128_wrap ( & wctx -> ks . ks , wctx -> iv , out , in , inlen , ( block128_f ) AES_encrypt ) ; else rv = CRYPTO_128_unwrap ( & wctx -> ks . ks , wctx -> iv , out , in , inlen , ( block128_f ) AES_decrypt ) ; } return rv ? ( int ) rv : - 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( SingleClientSessionsSyncTest , ResponseCodeIsPreserved ) { ASSERT_TRUE ( SetupSync ( ) ) << "SetupSync() failed." ; ASSERT_TRUE ( CheckInitialState ( 0 ) ) ; const GURL url ( "data:text/html,<html><title>Test</title></html>" ) ; ScopedWindowMap windows ; ASSERT_TRUE ( OpenTabAndGetLocalWindows ( 0 , url , windows . GetMutable ( ) ) ) ; int found_navigations = 0 ; for ( SessionWindowMap : : const_iterator it = windows . Get ( ) -> begin ( ) ; it != windows . Get ( ) -> end ( ) ; ++ it ) { for ( std : : vector < sessions : : SessionTab * > : : const_iterator it2 = it -> second -> tabs . begin ( ) ; it2 != it -> second -> tabs . end ( ) ; ++ it2 ) { for ( std : : vector < sessions : : SerializedNavigationEntry > : : const_iterator it3 = ( * it2 ) -> navigations . begin ( ) ; it3 != ( * it2 ) -> navigations . end ( ) ; ++ it3 ) { EXPECT_EQ ( 200 , it3 -> http_status_code ( ) ) ; ++ found_navigations ; } } } ASSERT_EQ ( 1 , found_navigations ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vmxnet_tx_pkt_setup_vlan_header ( struct VmxnetTxPkt * pkt , uint16_t vlan ) { bool is_new ; assert ( pkt ) ; eth_setup_vlan_headers ( pkt -> vec [ VMXNET_TX_PKT_L2HDR_FRAG ] . iov_base , vlan , & is_new ) ; if ( is_new ) { pkt -> hdr_len += sizeof ( struct vlan_header ) ; pkt -> vec [ VMXNET_TX_PKT_L2HDR_FRAG ] . iov_len += sizeof ( struct vlan_header ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) { return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ; } # define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ; typedef const char * OPENSSL_CSTRING ; DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char ) typedef void * OPENSSL_BLOCK ; DEFINE_SPECIAL_STACK_OF ( OPENSSL_BLOCK , void )
1True
Categorize the following code snippet as vulnerable or not. True or False
static int pre_estimate_motion_thread ( AVCodecContext * c , void * arg ) { MpegEncContext * s = * ( void * * ) arg ; s -> me . pre_pass = 1 ; s -> me . dia_size = s -> avctx -> pre_dia_size ; s -> first_slice_line = 1 ; for ( s -> mb_y = s -> end_mb_y - 1 ; s -> mb_y >= s -> start_mb_y ; s -> mb_y -- ) { for ( s -> mb_x = s -> mb_width - 1 ; s -> mb_x >= 0 ; s -> mb_x -- ) { ff_pre_estimate_p_frame_motion ( s , s -> mb_x , s -> mb_y ) ; } s -> first_slice_line = 0 ; } s -> me . pre_pass = 0 ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean pk_transaction_obtain_authorization ( PkTransaction * transaction , PkRoleEnum role , GError * * error ) { g_autoptr ( GPtrArray ) actions = NULL ; PkTransactionPrivate * priv = transaction -> priv ; g_autofree gchar * package_ids = NULL ; g_autoptr ( PolkitDetails ) details = NULL ; g_autoptr ( GString ) string = NULL ; g_return_val_if_fail ( priv -> sender != NULL , FALSE ) ; if ( pk_bitfield_contain ( transaction -> priv -> cached_transaction_flags , PK_TRANSACTION_FLAG_ENUM_ONLY_DOWNLOAD ) || pk_bitfield_contain ( transaction -> priv -> cached_transaction_flags , PK_TRANSACTION_FLAG_ENUM_SIMULATE ) || priv -> skip_auth_check == TRUE ) { g_debug ( "No authentication required" ) ; pk_transaction_set_state ( transaction , PK_TRANSACTION_STATE_READY ) ; return TRUE ; } if ( priv -> subject == NULL ) { g_set_error ( error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_REFUSED_BY_POLICY , "subject %s not found" , priv -> sender ) ; return FALSE ; } actions = pk_transaction_role_to_actions ( role , priv -> cached_transaction_flags ) ; if ( actions == NULL ) return FALSE ; return pk_transaction_authorize_actions ( transaction , role , actions ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void remove_callback_link ( NautilusDirectory * directory , GList * link ) { ReadyCallback * callback ; callback = link -> data ; remove_callback_link_keep_data ( directory , link ) ; g_free ( callback ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int evbuffer_add_buffer ( struct evbuffer * outbuf , struct evbuffer * inbuf ) { int res ; if ( outbuf -> off == 0 ) { struct evbuffer tmp ; size_t oldoff = inbuf -> off ; SWAP ( & tmp , outbuf ) ; SWAP ( outbuf , inbuf ) ; SWAP ( inbuf , & tmp ) ; if ( inbuf -> off != oldoff && inbuf -> cb != NULL ) ( * inbuf -> cb ) ( inbuf , oldoff , inbuf -> off , inbuf -> cbarg ) ; if ( oldoff && outbuf -> cb != NULL ) ( * outbuf -> cb ) ( outbuf , 0 , oldoff , outbuf -> cbarg ) ; return ( 0 ) ; } res = evbuffer_add ( outbuf , inbuf -> buffer , inbuf -> off ) ; if ( res == 0 ) { evbuffer_drain ( inbuf , inbuf -> off ) ; } return ( res ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
Jbig2Ctx * jbig2_ctx_new ( Jbig2Allocator * allocator , Jbig2Options options , Jbig2GlobalCtx * global_ctx , Jbig2ErrorCallback error_callback , void * error_callback_data ) { Jbig2Ctx * result ; if ( allocator == NULL ) allocator = & jbig2_default_allocator ; if ( error_callback == NULL ) error_callback = & jbig2_default_error ; result = ( Jbig2Ctx * ) jbig2_alloc ( allocator , sizeof ( Jbig2Ctx ) , 1 ) ; if ( result == NULL ) { error_callback ( error_callback_data , "initial context allocation failed!" , JBIG2_SEVERITY_FATAL , - 1 ) ; return result ; } result -> allocator = allocator ; result -> options = options ; result -> global_ctx = ( const Jbig2Ctx * ) global_ctx ; result -> error_callback = error_callback ; result -> error_callback_data = error_callback_data ; result -> state = ( options & JBIG2_OPTIONS_EMBEDDED ) ? JBIG2_FILE_SEQUENTIAL_HEADER : JBIG2_FILE_HEADER ; result -> buf = NULL ; result -> n_segments = 0 ; result -> n_segments_max = 16 ; result -> segments = jbig2_new ( result , Jbig2Segment * , result -> n_segments_max ) ; if ( result -> segments == NULL ) { error_callback ( error_callback_data , "initial segments allocation failed!" , JBIG2_SEVERITY_FATAL , - 1 ) ; jbig2_free ( allocator , result ) ; return result ; } result -> segment_index = 0 ; result -> current_page = 0 ; result -> max_page_index = 4 ; result -> pages = jbig2_new ( result , Jbig2Page , result -> max_page_index ) ; if ( result -> pages == NULL ) { error_callback ( error_callback_data , "initial pages allocation failed!" , JBIG2_SEVERITY_FATAL , - 1 ) ; jbig2_free ( allocator , result -> segments ) ; jbig2_free ( allocator , result ) ; return result ; } { int index ; for ( index = 0 ; index < result -> max_page_index ; index ++ ) { result -> pages [ index ] . state = JBIG2_PAGE_FREE ; result -> pages [ index ] . number = 0 ; result -> pages [ index ] . image = NULL ; } } return result ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void hb_face_set_glyph_count ( hb_face_t * face , unsigned int glyph_count ) { if ( face -> immutable ) return ; face -> num_glyphs = glyph_count ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int cirrus_bitblt_videotovideo_patterncopy ( CirrusVGAState * s ) { return cirrus_bitblt_common_patterncopy ( s ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
SPL_METHOD ( FilesystemIterator , __construct ) { spl_filesystem_object_construct ( INTERNAL_FUNCTION_PARAM_PASSTHRU , DIT_CTOR_FLAGS | SPL_FILE_DIR_SKIPDOTS ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dissect_rtmpt_body_video ( tvbuff_t * tvb , gint offset , proto_tree * rtmpt_tree ) { guint8 iCtl ; proto_item * vi ; proto_tree * vt ; iCtl = tvb_get_guint8 ( tvb , offset ) ; vi = proto_tree_add_uint_format ( rtmpt_tree , hf_rtmpt_video_control , tvb , offset , 1 , iCtl , "Control: 0x%02x (%s %s)" , iCtl , val_to_str_const ( ( iCtl & 0xf0 ) >> 4 , rtmpt_video_types , "Unknown frame type" ) , val_to_str_const ( iCtl & 0x0f , rtmpt_video_codecs , "Unknown codec" ) ) ; vt = proto_item_add_subtree ( vi , ett_rtmpt_video_control ) ; proto_tree_add_uint ( vt , hf_rtmpt_video_type , tvb , offset , 1 , iCtl ) ; proto_tree_add_uint ( vt , hf_rtmpt_video_format , tvb , offset , 1 , iCtl ) ; proto_tree_add_item ( rtmpt_tree , hf_rtmpt_video_data , tvb , offset + 1 , - 1 , ENC_NA ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dsa_copy_parameters ( EVP_PKEY * to , const EVP_PKEY * from ) { BIGNUM * a ; if ( to -> pkey . dsa == NULL ) { to -> pkey . dsa = DSA_new ( ) ; if ( to -> pkey . dsa == NULL ) return 0 ; } if ( ( a = BN_dup ( from -> pkey . dsa -> p ) ) == NULL ) return 0 ; BN_free ( to -> pkey . dsa -> p ) ; to -> pkey . dsa -> p = a ; if ( ( a = BN_dup ( from -> pkey . dsa -> q ) ) == NULL ) return 0 ; BN_free ( to -> pkey . dsa -> q ) ; to -> pkey . dsa -> q = a ; if ( ( a = BN_dup ( from -> pkey . dsa -> g ) ) == NULL ) return 0 ; BN_free ( to -> pkey . dsa -> g ) ; to -> pkey . dsa -> g = a ; return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void count_segs_sb ( const VP9_COMMON * cm , MACROBLOCKD * xd , const TileInfo * tile , MODE_INFO * * mi , int * no_pred_segcounts , int ( * temporal_predictor_count ) [ 2 ] , int * t_unpred_seg_counts , int mi_row , int mi_col , BLOCK_SIZE bsize ) { const int mis = cm -> mi_stride ; int bw , bh ; const int bs = num_8x8_blocks_wide_lookup [ bsize ] , hbs = bs / 2 ; if ( mi_row >= cm -> mi_rows || mi_col >= cm -> mi_cols ) return ; bw = num_8x8_blocks_wide_lookup [ mi [ 0 ] -> mbmi . sb_type ] ; bh = num_8x8_blocks_high_lookup [ mi [ 0 ] -> mbmi . sb_type ] ; if ( bw == bs && bh == bs ) { count_segs ( cm , xd , tile , mi , no_pred_segcounts , temporal_predictor_count , t_unpred_seg_counts , bs , bs , mi_row , mi_col ) ; } else if ( bw == bs && bh < bs ) { count_segs ( cm , xd , tile , mi , no_pred_segcounts , temporal_predictor_count , t_unpred_seg_counts , bs , hbs , mi_row , mi_col ) ; count_segs ( cm , xd , tile , mi + hbs * mis , no_pred_segcounts , temporal_predictor_count , t_unpred_seg_counts , bs , hbs , mi_row + hbs , mi_col ) ; } else if ( bw < bs && bh == bs ) { count_segs ( cm , xd , tile , mi , no_pred_segcounts , temporal_predictor_count , t_unpred_seg_counts , hbs , bs , mi_row , mi_col ) ; count_segs ( cm , xd , tile , mi + hbs , no_pred_segcounts , temporal_predictor_count , t_unpred_seg_counts , hbs , bs , mi_row , mi_col + hbs ) ; } else { const BLOCK_SIZE subsize = subsize_lookup [ PARTITION_SPLIT ] [ bsize ] ; int n ; assert ( bw < bs && bh < bs ) ; for ( n = 0 ; n < 4 ; n ++ ) { const int mi_dc = hbs * ( n & 1 ) ; const int mi_dr = hbs * ( n >> 1 ) ; count_segs_sb ( cm , xd , tile , & mi [ mi_dr * mis + mi_dc ] , no_pred_segcounts , temporal_predictor_count , t_unpred_seg_counts , mi_row + mi_dr , mi_col + mi_dc , subsize ) ; } } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void pk_register_default ( void ) { gcry_err_code_t err = 0 ; int i ; for ( i = 0 ; ( ! err ) && pubkey_table [ i ] . pubkey ; i ++ ) { # define pubkey_use_dummy ( func ) \ if ( ! pubkey_table [ i ] . pubkey -> func ) \ pubkey_table [ i ] . pubkey -> func = dummy_ ## func ; pubkey_use_dummy ( generate ) ; pubkey_use_dummy ( check_secret_key ) ; pubkey_use_dummy ( encrypt ) ; pubkey_use_dummy ( decrypt ) ; pubkey_use_dummy ( sign ) ; pubkey_use_dummy ( verify ) ; pubkey_use_dummy ( get_nbits ) ; # undef pubkey_use_dummy err = _gcry_module_add ( & pubkeys_registered , pubkey_table [ i ] . algorithm , ( void * ) pubkey_table [ i ] . pubkey , ( void * ) pubkey_table [ i ] . extraspec , NULL ) ; } if ( err ) BUG ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void vmxnet_tx_pkt_calculate_hdr_len ( struct VmxnetTxPkt * pkt ) { pkt -> hdr_len = pkt -> vec [ VMXNET_TX_PKT_L2HDR_FRAG ] . iov_len + pkt -> vec [ VMXNET_TX_PKT_L3HDR_FRAG ] . iov_len ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int32_t u_printf_string_handler ( const u_printf_stream_handler * handler , void * context , ULocaleBundle * formatBundle , const u_printf_spec_info * info , const ufmt_args * args ) { UChar * s ; UChar buffer [ UFMT_DEFAULT_BUFFER_SIZE ] ; int32_t len , written ; int32_t argSize ; const char * arg = ( const char * ) ( args [ 0 ] . ptrValue ) ; if ( arg ) { argSize = ( int32_t ) strlen ( arg ) + 1 ; if ( argSize >= MAX_UCHAR_BUFFER_SIZE ( buffer ) ) { s = ufmt_defaultCPToUnicode ( arg , argSize , ( UChar * ) uprv_malloc ( MAX_UCHAR_BUFFER_NEEDED ( argSize ) ) , MAX_UCHAR_BUFFER_NEEDED ( argSize ) ) ; if ( s == NULL ) { return 0 ; } } else { s = ufmt_defaultCPToUnicode ( arg , argSize , buffer , UPRV_LENGTHOF ( buffer ) ) ; } } else { s = ( UChar * ) gNullStr ; } len = u_strlen ( s ) ; if ( info -> fPrecision != - 1 && info -> fPrecision < len ) { len = info -> fPrecision ; } written = handler -> pad_and_justify ( context , info , s , len ) ; if ( gNullStr != s && buffer != s ) { uprv_free ( s ) ; } return written ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
char * SRP_create_verifier ( const char * user , const char * pass , char * * salt , char * * verifier , const char * N , const char * g ) { int len ; char * result = NULL , * vf = NULL ; BIGNUM * N_bn = NULL , * g_bn = NULL , * s = NULL , * v = NULL ; unsigned char tmp [ MAX_LEN ] ; unsigned char tmp2 [ MAX_LEN ] ; char * defgNid = NULL ; int vfsize = 0 ; if ( ( user == NULL ) || ( pass == NULL ) || ( salt == NULL ) || ( verifier == NULL ) ) goto err ; if ( N ) { if ( ! ( len = t_fromb64 ( tmp , N ) ) ) goto err ; N_bn = BN_bin2bn ( tmp , len , NULL ) ; if ( ! ( len = t_fromb64 ( tmp , g ) ) ) goto err ; g_bn = BN_bin2bn ( tmp , len , NULL ) ; defgNid = "*" ; } else { SRP_gN * gN = SRP_get_gN_by_id ( g , NULL ) ; if ( gN == NULL ) goto err ; N_bn = gN -> N ; g_bn = gN -> g ; defgNid = gN -> id ; } if ( * salt == NULL ) { if ( RAND_pseudo_bytes ( tmp2 , SRP_RANDOM_SALT_LEN ) < 0 ) goto err ; s = BN_bin2bn ( tmp2 , SRP_RANDOM_SALT_LEN , NULL ) ; } else { if ( ! ( len = t_fromb64 ( tmp2 , * salt ) ) ) goto err ; s = BN_bin2bn ( tmp2 , len , NULL ) ; } if ( ! SRP_create_verifier_BN ( user , pass , & s , & v , N_bn , g_bn ) ) goto err ; BN_bn2bin ( v , tmp ) ; vfsize = BN_num_bytes ( v ) * 2 ; if ( ( ( vf = OPENSSL_malloc ( vfsize ) ) == NULL ) ) goto err ; t_tob64 ( vf , tmp , BN_num_bytes ( v ) ) ; if ( * salt == NULL ) { char * tmp_salt ; if ( ( tmp_salt = OPENSSL_malloc ( SRP_RANDOM_SALT_LEN * 2 ) ) == NULL ) { goto err ; } t_tob64 ( tmp_salt , tmp2 , SRP_RANDOM_SALT_LEN ) ; * salt = tmp_salt ; } * verifier = vf ; vf = NULL ; result = defgNid ; err : if ( N ) { BN_free ( N_bn ) ; BN_free ( g_bn ) ; } OPENSSL_cleanse ( vf , vfsize ) ; OPENSSL_free ( vf ) ; BN_clear_free ( s ) ; BN_clear_free ( v ) ; return result ; }
0False