instruction
stringclasses
1 value
input
stringlengths
31
235k
output
class label
2 classes
Categorize the following code snippet as vulnerable or not. True or False
static void set_connfilter_host ( GtkWidget * widget , gpointer * data ) { ( void ) data ; DEBUG_MSG ( "set_connfilter_host" ) ; filter . host = gtk_entry_get_text ( GTK_ENTRY ( widget ) ) ; gtk_tree_model_filter_refilter ( GTK_TREE_MODEL_FILTER ( filter . model ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void word ( struct vars * v , int dir , struct state * lp , struct state * rp ) { assert ( dir == AHEAD || dir == BEHIND ) ; cloneouts ( v -> nfa , v -> wordchrs , lp , rp , dir ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_T_member ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h225_T_member , T_member_sequence_of ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void ctl_error ( u_char errcode ) { int maclen ; numctlerrors ++ ; DPRINTF ( 3 , ( "sending control error %u\n" , errcode ) ) ; rpkt . r_m_e_op = ( u_char ) CTL_RESPONSE | CTL_ERROR | ( res_opcode & CTL_OP_MASK ) ; rpkt . status = htons ( ( u_short ) ( errcode << 8 ) & 0xff00 ) ; rpkt . count = 0 ; if ( res_authenticate && sys_authenticate ) { maclen = authencrypt ( res_keyid , ( u_int32 * ) & rpkt , CTL_HEADER_LEN ) ; sendpkt ( rmt_addr , lcl_inter , - 2 , ( void * ) & rpkt , CTL_HEADER_LEN + maclen ) ; } else sendpkt ( rmt_addr , lcl_inter , - 3 , ( void * ) & rpkt , CTL_HEADER_LEN ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void qbus_create_inplace ( BusState * bus , BusInfo * info , DeviceState * parent , const char * name ) { char * buf ; int i , len ; bus -> info = info ; bus -> parent = parent ; if ( name ) { bus -> name = qemu_strdup ( name ) ; } else if ( parent && parent -> id ) { len = strlen ( parent -> id ) + 16 ; buf = qemu_malloc ( len ) ; snprintf ( buf , len , "%s.%d" , parent -> id , parent -> num_child_bus ) ; bus -> name = buf ; } else { len = strlen ( info -> name ) + 16 ; buf = qemu_malloc ( len ) ; len = snprintf ( buf , len , "%s.%d" , info -> name , parent ? parent -> num_child_bus : 0 ) ; for ( i = 0 ; i < len ; i ++ ) buf [ i ] = qemu_tolower ( buf [ i ] ) ; bus -> name = buf ; } QLIST_INIT ( & bus -> children ) ; if ( parent ) { QLIST_INSERT_HEAD ( & parent -> child_bus , bus , sibling ) ; parent -> num_child_bus ++ ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vp9_set_rd_speed_thresholds ( VP9_COMP * cpi ) { int i ; RD_OPT * const rd = & cpi -> rd ; SPEED_FEATURES * const sf = & cpi -> sf ; for ( i = 0 ; i < MAX_MODES ; ++ i ) rd -> thresh_mult [ i ] = cpi -> oxcf . mode == BEST ? - 500 : 0 ; rd -> thresh_mult [ THR_NEARESTMV ] = 0 ; rd -> thresh_mult [ THR_NEARESTG ] = 0 ; rd -> thresh_mult [ THR_NEARESTA ] = 0 ; rd -> thresh_mult [ THR_DC ] += 1000 ; rd -> thresh_mult [ THR_NEWMV ] += 1000 ; rd -> thresh_mult [ THR_NEWA ] += 1000 ; rd -> thresh_mult [ THR_NEWG ] += 1000 ; rd -> thresh_mult [ THR_NEWMV ] += sf -> elevate_newmv_thresh ; rd -> thresh_mult [ THR_NEARMV ] += 1000 ; rd -> thresh_mult [ THR_NEARA ] += 1000 ; rd -> thresh_mult [ THR_COMP_NEARESTLA ] += 1000 ; rd -> thresh_mult [ THR_COMP_NEARESTGA ] += 1000 ; rd -> thresh_mult [ THR_TM ] += 1000 ; rd -> thresh_mult [ THR_COMP_NEARLA ] += 1500 ; rd -> thresh_mult [ THR_COMP_NEWLA ] += 2000 ; rd -> thresh_mult [ THR_NEARG ] += 1000 ; rd -> thresh_mult [ THR_COMP_NEARGA ] += 1500 ; rd -> thresh_mult [ THR_COMP_NEWGA ] += 2000 ; rd -> thresh_mult [ THR_ZEROMV ] += 2000 ; rd -> thresh_mult [ THR_ZEROG ] += 2000 ; rd -> thresh_mult [ THR_ZEROA ] += 2000 ; rd -> thresh_mult [ THR_COMP_ZEROLA ] += 2500 ; rd -> thresh_mult [ THR_COMP_ZEROGA ] += 2500 ; rd -> thresh_mult [ THR_H_PRED ] += 2000 ; rd -> thresh_mult [ THR_V_PRED ] += 2000 ; rd -> thresh_mult [ THR_D45_PRED ] += 2500 ; rd -> thresh_mult [ THR_D135_PRED ] += 2500 ; rd -> thresh_mult [ THR_D117_PRED ] += 2500 ; rd -> thresh_mult [ THR_D153_PRED ] += 2500 ; rd -> thresh_mult [ THR_D207_PRED ] += 2500 ; rd -> thresh_mult [ THR_D63_PRED ] += 2500 ; if ( ! ( cpi -> ref_frame_flags & VP9_LAST_FLAG ) ) { rd -> thresh_mult [ THR_NEWMV ] = INT_MAX ; rd -> thresh_mult [ THR_NEARESTMV ] = INT_MAX ; rd -> thresh_mult [ THR_ZEROMV ] = INT_MAX ; rd -> thresh_mult [ THR_NEARMV ] = INT_MAX ; } if ( ! ( cpi -> ref_frame_flags & VP9_GOLD_FLAG ) ) { rd -> thresh_mult [ THR_NEARESTG ] = INT_MAX ; rd -> thresh_mult [ THR_ZEROG ] = INT_MAX ; rd -> thresh_mult [ THR_NEARG ] = INT_MAX ; rd -> thresh_mult [ THR_NEWG ] = INT_MAX ; } if ( ! ( cpi -> ref_frame_flags & VP9_ALT_FLAG ) ) { rd -> thresh_mult [ THR_NEARESTA ] = INT_MAX ; rd -> thresh_mult [ THR_ZEROA ] = INT_MAX ; rd -> thresh_mult [ THR_NEARA ] = INT_MAX ; rd -> thresh_mult [ THR_NEWA ] = INT_MAX ; } if ( ( cpi -> ref_frame_flags & ( VP9_LAST_FLAG | VP9_ALT_FLAG ) ) != ( VP9_LAST_FLAG | VP9_ALT_FLAG ) ) { rd -> thresh_mult [ THR_COMP_ZEROLA ] = INT_MAX ; rd -> thresh_mult [ THR_COMP_NEARESTLA ] = INT_MAX ; rd -> thresh_mult [ THR_COMP_NEARLA ] = INT_MAX ; rd -> thresh_mult [ THR_COMP_NEWLA ] = INT_MAX ; } if ( ( cpi -> ref_frame_flags & ( VP9_GOLD_FLAG | VP9_ALT_FLAG ) ) != ( VP9_GOLD_FLAG | VP9_ALT_FLAG ) ) { rd -> thresh_mult [ THR_COMP_ZEROGA ] = INT_MAX ; rd -> thresh_mult [ THR_COMP_NEARESTGA ] = INT_MAX ; rd -> thresh_mult [ THR_COMP_NEARGA ] = INT_MAX ; rd -> thresh_mult [ THR_COMP_NEWGA ] = INT_MAX ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void nlm_print_msgres_reply ( packet_info * pinfo , proto_tree * tree , tvbuff_t * tvb ) { nlm_msg_res_matched_data * md ; md = ( nlm_msg_res_matched_data * ) g_hash_table_lookup ( nlm_msg_res_matched , GINT_TO_POINTER ( pinfo -> fd -> num ) ) ; if ( md ) { nstime_t ns ; proto_tree_add_uint ( tree , hf_nlm_request_in , tvb , 0 , 0 , md -> req_frame ) ; nstime_delta ( & ns , & pinfo -> fd -> abs_ts , & md -> ns ) ; proto_tree_add_time ( tree , hf_nlm_time , tvb , 0 , 0 , & ns ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void ff_ivi_init_static_vlc ( void ) { int i ; static VLC_TYPE table_data [ 8192 * 16 ] [ 2 ] ; static int initialized_vlcs = 0 ; if ( initialized_vlcs ) return ; for ( i = 0 ; i < 8 ; i ++ ) { ivi_mb_vlc_tabs [ i ] . table = table_data + i * 2 * 8192 ; ivi_mb_vlc_tabs [ i ] . table_allocated = 8192 ; ivi_create_huff_from_desc ( & ff_ivi_mb_huff_desc [ i ] , & ivi_mb_vlc_tabs [ i ] , 1 ) ; ivi_blk_vlc_tabs [ i ] . table = table_data + ( i * 2 + 1 ) * 8192 ; ivi_blk_vlc_tabs [ i ] . table_allocated = 8192 ; ivi_create_huff_from_desc ( & ff_ivi_blk_huff_desc [ i ] , & ivi_blk_vlc_tabs [ i ] , 1 ) ; } initialized_vlcs = 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void nautilus_file_operations_trash_or_delete ( GList * files , GtkWindow * parent_window , NautilusDeleteCallback done_callback , gpointer done_callback_data ) { trash_or_delete_internal ( files , parent_window , TRUE , done_callback , done_callback_data ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int vp9_rc_drop_frame ( VP9_COMP * cpi ) { const VP9EncoderConfig * oxcf = & cpi -> oxcf ; RATE_CONTROL * const rc = & cpi -> rc ; if ( ! oxcf -> drop_frames_water_mark ) { return 0 ; } else { if ( rc -> buffer_level < 0 ) { return 1 ; } else { int drop_mark = ( int ) ( oxcf -> drop_frames_water_mark * rc -> optimal_buffer_level / 100 ) ; if ( ( rc -> buffer_level > drop_mark ) && ( rc -> decimation_factor > 0 ) ) { -- rc -> decimation_factor ; } else if ( rc -> buffer_level <= drop_mark && rc -> decimation_factor == 0 ) { rc -> decimation_factor = 1 ; } if ( rc -> decimation_factor > 0 ) { if ( rc -> decimation_count > 0 ) { -- rc -> decimation_count ; return 1 ; } else { rc -> decimation_count = rc -> decimation_factor ; return 0 ; } } else { rc -> decimation_count = 0 ; return 0 ; } } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static guint16 de_tp_epc_mbms_packet_counter_value ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len _U_ , gchar * add_string _U_ , int string_len _U_ ) { guint32 curr_offset ; curr_offset = offset ; proto_tree_add_bits_item ( tree , hf_gsm_a_dtap_epc_mbms_packet_counter_value , tvb , curr_offset << 3 , 32 , ENC_BIG_ENDIAN ) ; curr_offset += 4 ; return ( curr_offset - offset ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void signal_cb_swp ( int sig , short event , void * arg ) { called ++ ; if ( called < 5 ) raise ( sig ) ; else event_loopexit ( NULL ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int pfkey_send_new_mapping ( struct xfrm_state * x , xfrm_address_t * ipaddr , __be16 sport ) { struct sk_buff * skb ; struct sadb_msg * hdr ; struct sadb_sa * sa ; struct sadb_address * addr ; struct sadb_x_nat_t_port * n_port ; int sockaddr_size ; int size ; __u8 satype = ( x -> id . proto == IPPROTO_ESP ? SADB_SATYPE_ESP : 0 ) ; struct xfrm_encap_tmpl * natt = NULL ; sockaddr_size = pfkey_sockaddr_size ( x -> props . family ) ; if ( ! sockaddr_size ) return - EINVAL ; if ( ! satype ) return - EINVAL ; if ( ! x -> encap ) return - EINVAL ; natt = x -> encap ; size = sizeof ( struct sadb_msg ) + sizeof ( struct sadb_sa ) + ( sizeof ( struct sadb_address ) * 2 ) + ( sockaddr_size * 2 ) + ( sizeof ( struct sadb_x_nat_t_port ) * 2 ) ; skb = alloc_skb ( size + 16 , GFP_ATOMIC ) ; if ( skb == NULL ) return - ENOMEM ; hdr = ( struct sadb_msg * ) skb_put ( skb , sizeof ( struct sadb_msg ) ) ; hdr -> sadb_msg_version = PF_KEY_V2 ; hdr -> sadb_msg_type = SADB_X_NAT_T_NEW_MAPPING ; hdr -> sadb_msg_satype = satype ; hdr -> sadb_msg_len = size / sizeof ( uint64_t ) ; hdr -> sadb_msg_errno = 0 ; hdr -> sadb_msg_reserved = 0 ; hdr -> sadb_msg_seq = x -> km . seq = get_acqseq ( ) ; hdr -> sadb_msg_pid = 0 ; sa = ( struct sadb_sa * ) skb_put ( skb , sizeof ( struct sadb_sa ) ) ; sa -> sadb_sa_len = sizeof ( struct sadb_sa ) / sizeof ( uint64_t ) ; sa -> sadb_sa_exttype = SADB_EXT_SA ; sa -> sadb_sa_spi = x -> id . spi ; sa -> sadb_sa_replay = 0 ; sa -> sadb_sa_state = 0 ; sa -> sadb_sa_auth = 0 ; sa -> sadb_sa_encrypt = 0 ; sa -> sadb_sa_flags = 0 ; addr = ( struct sadb_address * ) skb_put ( skb , sizeof ( struct sadb_address ) + sockaddr_size ) ; addr -> sadb_address_len = ( sizeof ( struct sadb_address ) + sockaddr_size ) / sizeof ( uint64_t ) ; addr -> sadb_address_exttype = SADB_EXT_ADDRESS_SRC ; addr -> sadb_address_proto = 0 ; addr -> sadb_address_reserved = 0 ; addr -> sadb_address_prefixlen = pfkey_sockaddr_fill ( & x -> props . saddr , 0 , ( struct sockaddr * ) ( addr + 1 ) , x -> props . family ) ; if ( ! addr -> sadb_address_prefixlen ) BUG ( ) ; n_port = ( struct sadb_x_nat_t_port * ) skb_put ( skb , sizeof ( * n_port ) ) ; n_port -> sadb_x_nat_t_port_len = sizeof ( * n_port ) / sizeof ( uint64_t ) ; n_port -> sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_SPORT ; n_port -> sadb_x_nat_t_port_port = natt -> encap_sport ; n_port -> sadb_x_nat_t_port_reserved = 0 ; addr = ( struct sadb_address * ) skb_put ( skb , sizeof ( struct sadb_address ) + sockaddr_size ) ; addr -> sadb_address_len = ( sizeof ( struct sadb_address ) + sockaddr_size ) / sizeof ( uint64_t ) ; addr -> sadb_address_exttype = SADB_EXT_ADDRESS_DST ; addr -> sadb_address_proto = 0 ; addr -> sadb_address_reserved = 0 ; addr -> sadb_address_prefixlen = pfkey_sockaddr_fill ( ipaddr , 0 , ( struct sockaddr * ) ( addr + 1 ) , x -> props . family ) ; if ( ! addr -> sadb_address_prefixlen ) BUG ( ) ; n_port = ( struct sadb_x_nat_t_port * ) skb_put ( skb , sizeof ( * n_port ) ) ; n_port -> sadb_x_nat_t_port_len = sizeof ( * n_port ) / sizeof ( uint64_t ) ; n_port -> sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_DPORT ; n_port -> sadb_x_nat_t_port_port = sport ; n_port -> sadb_x_nat_t_port_reserved = 0 ; return pfkey_broadcast ( skb , GFP_ATOMIC , BROADCAST_REGISTERED , NULL , xs_net ( x ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int gs_push_real ( gs_main_instance * minst , double value ) { ref vref ; make_real ( & vref , value ) ; return push_value ( minst , & vref ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void char_init ( GifCtx * ctx ) { ctx -> a_count = 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( MultiBufferTest , ReadAllAdvanceFirst_NeverDefer ) { multibuffer_ . SetMaxWriters ( 1 ) ; size_t pos = 0 ; size_t end = 10000 ; multibuffer_ . SetFileSize ( 10000 ) ; multibuffer_ . SetMaxBlocksAfterDefer ( - 10000 ) ; multibuffer_ . SetRangeSupported ( true ) ; media : : MultiBufferReader reader ( & multibuffer_ , pos , end , base : : Callback < void ( int64_t , int64_t ) > ( ) ) ; reader . SetMaxBuffer ( 2000 , 5000 ) ; reader . SetPreload ( 1000 , 1000 ) ; while ( pos < end ) { unsigned char buffer [ 27 ] ; buffer [ 17 ] = 17 ; size_t to_read = std : : min < size_t > ( end - pos , 17 ) ; while ( AdvanceAll ( ) ) ; int64_t bytes = reader . TryRead ( buffer , to_read ) ; EXPECT_GT ( bytes , 0 ) ; EXPECT_EQ ( buffer [ 17 ] , 17 ) ; for ( int64_t i = 0 ; i < bytes ; i ++ ) { uint8_t expected = static_cast < uint8_t > ( ( pos * 15485863 ) >> 16 ) ; EXPECT_EQ ( expected , buffer [ i ] ) << " pos = " << pos ; pos ++ ; } } EXPECT_GT ( multibuffer_ . writers_created ( ) , 1 ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void U_CALLCONV _HZ_GetUnicodeSet ( const UConverter * cnv , const USetAdder * sa , UConverterUnicodeSet which , UErrorCode * pErrorCode ) { sa -> addRange ( sa -> set , 0 , 0x7f ) ; ucnv_MBCSGetFilteredUnicodeSetForUnicode ( ( ( UConverterDataHZ * ) cnv -> extraInfo ) -> gbConverter -> sharedData , sa , which , UCNV_SET_FILTER_HZ , pErrorCode ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void mdb_writewait ( Operation * op , slap_callback * sc ) { ww_ctx * ww = sc -> sc_private ; if ( ! ww -> flag ) { mdb_rtxn_snap ( op , ww ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int alloc_picture_tables ( MpegEncContext * s , Picture * pic ) { const int big_mb_num = s -> mb_stride * ( s -> mb_height + 1 ) + 1 ; const int mb_array_size = s -> mb_stride * s -> mb_height ; const int b8_array_size = s -> b8_stride * s -> mb_height * 2 ; int i ; pic -> mbskip_table_buf = av_buffer_allocz ( mb_array_size + 2 ) ; pic -> qscale_table_buf = av_buffer_allocz ( big_mb_num + s -> mb_stride ) ; pic -> mb_type_buf = av_buffer_allocz ( ( big_mb_num + s -> mb_stride ) * sizeof ( uint32_t ) ) ; if ( ! pic -> mbskip_table_buf || ! pic -> qscale_table_buf || ! pic -> mb_type_buf ) return AVERROR ( ENOMEM ) ; if ( s -> encoding ) { pic -> mb_var_buf = av_buffer_allocz ( mb_array_size * sizeof ( int16_t ) ) ; pic -> mc_mb_var_buf = av_buffer_allocz ( mb_array_size * sizeof ( int16_t ) ) ; pic -> mb_mean_buf = av_buffer_allocz ( mb_array_size ) ; if ( ! pic -> mb_var_buf || ! pic -> mc_mb_var_buf || ! pic -> mb_mean_buf ) return AVERROR ( ENOMEM ) ; } if ( s -> out_format == FMT_H263 || s -> encoding || ( s -> avctx -> debug & FF_DEBUG_MV ) || s -> avctx -> debug_mv ) { int mv_size = 2 * ( b8_array_size + 4 ) * sizeof ( int16_t ) ; int ref_index_size = 4 * mb_array_size ; for ( i = 0 ; mv_size && i < 2 ; i ++ ) { pic -> motion_val_buf [ i ] = av_buffer_allocz ( mv_size ) ; pic -> ref_index_buf [ i ] = av_buffer_allocz ( ref_index_size ) ; if ( ! pic -> motion_val_buf [ i ] || ! pic -> ref_index_buf [ i ] ) return AVERROR ( ENOMEM ) ; } } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int hyperv_handle_properties ( CPUState * cs ) { X86CPU * cpu = X86_CPU ( cs ) ; CPUX86State * env = & cpu -> env ; if ( cpu -> hyperv_relaxed_timing ) { env -> features [ FEAT_HYPERV_EAX ] |= HV_HYPERCALL_AVAILABLE ; } if ( cpu -> hyperv_vapic ) { env -> features [ FEAT_HYPERV_EAX ] |= HV_HYPERCALL_AVAILABLE ; env -> features [ FEAT_HYPERV_EAX ] |= HV_APIC_ACCESS_AVAILABLE ; } if ( cpu -> hyperv_time ) { if ( kvm_check_extension ( cs -> kvm_state , KVM_CAP_HYPERV_TIME ) <= 0 ) { fprintf ( stderr , "Hyper-V clocksources " "(requested by 'hv-time' cpu flag) " "are not supported by kernel\n" ) ; return - ENOSYS ; } env -> features [ FEAT_HYPERV_EAX ] |= HV_HYPERCALL_AVAILABLE ; env -> features [ FEAT_HYPERV_EAX ] |= HV_TIME_REF_COUNT_AVAILABLE ; env -> features [ FEAT_HYPERV_EAX ] |= HV_REFERENCE_TSC_AVAILABLE ; } if ( cpu -> hyperv_frequencies ) { if ( ! has_msr_hv_frequencies ) { fprintf ( stderr , "Hyper-V frequency MSRs " "(requested by 'hv-frequencies' cpu flag) " "are not supported by kernel\n" ) ; return - ENOSYS ; } env -> features [ FEAT_HYPERV_EAX ] |= HV_ACCESS_FREQUENCY_MSRS ; env -> features [ FEAT_HYPERV_EDX ] |= HV_FREQUENCY_MSRS_AVAILABLE ; } if ( cpu -> hyperv_crash ) { if ( ! has_msr_hv_crash ) { fprintf ( stderr , "Hyper-V crash MSRs " "(requested by 'hv-crash' cpu flag) " "are not supported by kernel\n" ) ; return - ENOSYS ; } env -> features [ FEAT_HYPERV_EDX ] |= HV_GUEST_CRASH_MSR_AVAILABLE ; } if ( cpu -> hyperv_reenlightenment ) { if ( ! has_msr_hv_reenlightenment ) { fprintf ( stderr , "Hyper-V Reenlightenment MSRs " "(requested by 'hv-reenlightenment' cpu flag) " "are not supported by kernel\n" ) ; return - ENOSYS ; } env -> features [ FEAT_HYPERV_EAX ] |= HV_ACCESS_REENLIGHTENMENTS_CONTROL ; } env -> features [ FEAT_HYPERV_EDX ] |= HV_CPU_DYNAMIC_PARTITIONING_AVAILABLE ; if ( cpu -> hyperv_reset ) { if ( ! has_msr_hv_reset ) { fprintf ( stderr , "Hyper-V reset MSR " "(requested by 'hv-reset' cpu flag) " "is not supported by kernel\n" ) ; return - ENOSYS ; } env -> features [ FEAT_HYPERV_EAX ] |= HV_RESET_AVAILABLE ; } if ( cpu -> hyperv_vpindex ) { if ( ! has_msr_hv_vpindex ) { fprintf ( stderr , "Hyper-V VP_INDEX MSR " "(requested by 'hv-vpindex' cpu flag) " "is not supported by kernel\n" ) ; return - ENOSYS ; } env -> features [ FEAT_HYPERV_EAX ] |= HV_VP_INDEX_AVAILABLE ; } if ( cpu -> hyperv_runtime ) { if ( ! has_msr_hv_runtime ) { fprintf ( stderr , "Hyper-V VP_RUNTIME MSR " "(requested by 'hv-runtime' cpu flag) " "is not supported by kernel\n" ) ; return - ENOSYS ; } env -> features [ FEAT_HYPERV_EAX ] |= HV_VP_RUNTIME_AVAILABLE ; } if ( cpu -> hyperv_synic ) { if ( ! has_msr_hv_synic || kvm_vcpu_enable_cap ( cs , KVM_CAP_HYPERV_SYNIC , 0 ) ) { fprintf ( stderr , "Hyper-V SynIC is not supported by kernel\n" ) ; return - ENOSYS ; } env -> features [ FEAT_HYPERV_EAX ] |= HV_SYNIC_AVAILABLE ; } if ( cpu -> hyperv_stimer ) { if ( ! has_msr_hv_stimer ) { fprintf ( stderr , "Hyper-V timers aren't supported by kernel\n" ) ; return - ENOSYS ; } env -> features [ FEAT_HYPERV_EAX ] |= HV_SYNTIMERS_AVAILABLE ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int ivr_probe ( AVProbeData * p ) { if ( memcmp ( p -> buf , ".R1M\x0\x1\x1" , 7 ) && memcmp ( p -> buf , ".REC" , 4 ) ) return 0 ; return AVPROBE_SCORE_MAX ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline int sk_ ## t1 ## _num ( const STACK_OF ( t1 ) * sk ) { return OPENSSL_sk_num ( ( const OPENSSL_STACK * ) sk ) ; } static ossl_inline t2 * sk_ ## t1 ## _value ( const STACK_OF ( t1 ) * sk , int idx ) { return ( t2 * ) OPENSSL_sk_value ( ( const OPENSSL_STACK * ) sk , idx ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new ( sk_ ## t1 ## _compfunc compare ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new ( ( OPENSSL_sk_compfunc ) compare ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_null ( void ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_null ( ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_reserve ( sk_ ## t1 ## _compfunc compare , int n ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_reserve ( ( OPENSSL_sk_compfunc ) compare , n ) ; } static ossl_inline int sk_ ## t1 ## _reserve ( STACK_OF ( t1 ) * sk , int n ) { return OPENSSL_sk_reserve ( ( OPENSSL_STACK * ) sk , n ) ; } static ossl_inline void sk_ ## t1 ## _free ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_free ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline void sk_ ## t1 ## _zero ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_zero ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline t2 * sk_ ## t1 ## _delete ( STACK_OF ( t1 ) * sk , int i ) { return ( t2 * ) OPENSSL_sk_delete ( ( OPENSSL_STACK * ) sk , i ) ; } static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) { return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) { return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) { OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ; } static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) { return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ; } static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) { return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) { return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ; } 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 gboolean gst_asf_demux_activate_mode ( GstPad * sinkpad , GstObject * parent , GstPadMode mode , gboolean active ) { gboolean res ; GstASFDemux * demux ; demux = GST_ASF_DEMUX ( parent ) ; switch ( mode ) { case GST_PAD_MODE_PUSH : demux -> state = GST_ASF_DEMUX_STATE_HEADER ; demux -> streaming = TRUE ; res = TRUE ; break ; case GST_PAD_MODE_PULL : if ( active ) { demux -> state = GST_ASF_DEMUX_STATE_HEADER ; demux -> streaming = FALSE ; res = gst_pad_start_task ( sinkpad , ( GstTaskFunction ) gst_asf_demux_loop , demux , NULL ) ; } else { res = gst_pad_stop_task ( sinkpad ) ; } break ; default : res = FALSE ; break ; } return res ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void remoteStreamMessageFinished ( struct qemud_client * client , struct qemud_client_message * msg ) { struct qemud_client_stream * stream = client -> streams ; while ( stream ) { if ( msg -> hdr . proc == stream -> procedure && msg -> hdr . serial == stream -> serial ) break ; stream = stream -> next ; } VIR_DEBUG ( "Message client=%p stream=%p proc=%d serial=%d" , client , stream , msg -> hdr . proc , msg -> hdr . serial ) ; if ( stream ) { stream -> tx = 1 ; remoteStreamUpdateEvents ( stream ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int matroska_parse_cluster ( MatroskaDemuxContext * matroska ) { MatroskaCluster cluster = { 0 } ; EbmlList * blocks_list ; MatroskaBlock * blocks ; int i , res ; int64_t pos ; if ( ! matroska -> contains_ssa ) return matroska_parse_cluster_incremental ( matroska ) ; pos = avio_tell ( matroska -> ctx -> pb ) ; matroska -> prev_pkt = NULL ; if ( matroska -> current_id ) pos -= 4 ; res = ebml_parse ( matroska , matroska_clusters , & cluster ) ; blocks_list = & cluster . blocks ; blocks = blocks_list -> elem ; for ( i = 0 ; i < blocks_list -> nb_elem && ! res ; i ++ ) if ( blocks [ i ] . bin . size > 0 && blocks [ i ] . bin . data ) { int is_keyframe = blocks [ i ] . non_simple ? ! blocks [ i ] . reference : - 1 ; if ( ! blocks [ i ] . non_simple ) blocks [ i ] . duration = AV_NOPTS_VALUE ; res = matroska_parse_block ( matroska , blocks [ i ] . bin . data , blocks [ i ] . bin . size , blocks [ i ] . bin . pos , cluster . timecode , blocks [ i ] . duration , is_keyframe , pos ) ; } ebml_free ( matroska_cluster , & cluster ) ; return res ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_SEQUENCE_OF_PartyNumber ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h225_SEQUENCE_OF_PartyNumber , SEQUENCE_OF_PartyNumber_sequence_of ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void U_CALLCONV _UTF16BEFromUnicodeWithOffsets ( UConverterFromUnicodeArgs * pArgs , UErrorCode * pErrorCode ) { UConverter * cnv ; const UChar * source ; char * target ; int32_t * offsets ; uint32_t targetCapacity , length , sourceIndex ; UChar c , trail ; char overflow [ 4 ] ; source = pArgs -> source ; length = ( int32_t ) ( pArgs -> sourceLimit - source ) ; if ( length <= 0 ) { return ; } cnv = pArgs -> converter ; if ( cnv -> fromUnicodeStatus == UCNV_NEED_TO_WRITE_BOM ) { static const char bom [ ] = { ( char ) 0xfe , ( char ) 0xff } ; ucnv_fromUWriteBytes ( cnv , bom , 2 , & pArgs -> target , pArgs -> targetLimit , & pArgs -> offsets , - 1 , pErrorCode ) ; cnv -> fromUnicodeStatus = 0 ; } target = pArgs -> target ; if ( target >= pArgs -> targetLimit ) { * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; return ; } targetCapacity = ( uint32_t ) ( pArgs -> targetLimit - target ) ; offsets = pArgs -> offsets ; sourceIndex = 0 ; if ( ( c = ( UChar ) cnv -> fromUChar32 ) != 0 && U16_IS_TRAIL ( trail = * source ) && targetCapacity >= 4 ) { ++ source ; -- length ; target [ 0 ] = ( uint8_t ) ( c >> 8 ) ; target [ 1 ] = ( uint8_t ) c ; target [ 2 ] = ( uint8_t ) ( trail >> 8 ) ; target [ 3 ] = ( uint8_t ) trail ; target += 4 ; targetCapacity -= 4 ; if ( offsets != NULL ) { * offsets ++ = - 1 ; * offsets ++ = - 1 ; * offsets ++ = - 1 ; * offsets ++ = - 1 ; } sourceIndex = 1 ; cnv -> fromUChar32 = c = 0 ; } if ( c == 0 ) { uint32_t count = 2 * length ; if ( count > targetCapacity ) { count = targetCapacity & ~ 1 ; } targetCapacity -= count ; count >>= 1 ; length -= count ; if ( offsets == NULL ) { while ( count > 0 ) { c = * source ++ ; if ( U16_IS_SINGLE ( c ) ) { target [ 0 ] = ( uint8_t ) ( c >> 8 ) ; target [ 1 ] = ( uint8_t ) c ; target += 2 ; } else if ( U16_IS_SURROGATE_LEAD ( c ) && count >= 2 && U16_IS_TRAIL ( trail = * source ) ) { ++ source ; -- count ; target [ 0 ] = ( uint8_t ) ( c >> 8 ) ; target [ 1 ] = ( uint8_t ) c ; target [ 2 ] = ( uint8_t ) ( trail >> 8 ) ; target [ 3 ] = ( uint8_t ) trail ; target += 4 ; } else { break ; } -- count ; } } else { while ( count > 0 ) { c = * source ++ ; if ( U16_IS_SINGLE ( c ) ) { target [ 0 ] = ( uint8_t ) ( c >> 8 ) ; target [ 1 ] = ( uint8_t ) c ; target += 2 ; * offsets ++ = sourceIndex ; * offsets ++ = sourceIndex ++ ; } else if ( U16_IS_SURROGATE_LEAD ( c ) && count >= 2 && U16_IS_TRAIL ( trail = * source ) ) { ++ source ; -- count ; target [ 0 ] = ( uint8_t ) ( c >> 8 ) ; target [ 1 ] = ( uint8_t ) c ; target [ 2 ] = ( uint8_t ) ( trail >> 8 ) ; target [ 3 ] = ( uint8_t ) trail ; target += 4 ; * offsets ++ = sourceIndex ; * offsets ++ = sourceIndex ; * offsets ++ = sourceIndex ; * offsets ++ = sourceIndex ; sourceIndex += 2 ; } else { break ; } -- count ; } } if ( count == 0 ) { if ( length > 0 && targetCapacity > 0 ) { if ( U16_IS_SINGLE ( c = * source ++ ) ) { overflow [ 0 ] = ( char ) ( c >> 8 ) ; overflow [ 1 ] = ( char ) c ; length = 2 ; c = 0 ; } } else { length = 0 ; c = 0 ; } } else { targetCapacity += 2 * count ; } } else { length = 0 ; } if ( c != 0 ) { length = 0 ; if ( U16_IS_SURROGATE_LEAD ( c ) ) { if ( source < pArgs -> sourceLimit ) { if ( U16_IS_TRAIL ( trail = * source ) ) { ++ source ; overflow [ 0 ] = ( char ) ( c >> 8 ) ; overflow [ 1 ] = ( char ) c ; overflow [ 2 ] = ( char ) ( trail >> 8 ) ; overflow [ 3 ] = ( char ) trail ; length = 4 ; c = 0 ; } else { * pErrorCode = U_ILLEGAL_CHAR_FOUND ; } } else { } } else { * pErrorCode = U_ILLEGAL_CHAR_FOUND ; } cnv -> fromUChar32 = c ; } if ( length > 0 ) { ucnv_fromUWriteBytes ( cnv , overflow , length , ( char * * ) & target , pArgs -> targetLimit , & offsets , sourceIndex , pErrorCode ) ; targetCapacity = ( uint32_t ) ( pArgs -> targetLimit - ( char * ) target ) ; } if ( U_SUCCESS ( * pErrorCode ) && source < pArgs -> sourceLimit && targetCapacity == 0 ) { * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; } pArgs -> source = source ; pArgs -> target = ( char * ) target ; pArgs -> offsets = offsets ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void vga_draw_line2d2 ( VGACommonState * vga , uint8_t * d , uint32_t addr , int width ) { uint32_t plane_mask , * palette , data , v ; int x ; palette = vga -> last_palette ; plane_mask = mask16 [ vga -> ar [ VGA_ATC_PLANE_ENABLE ] & 0xf ] ; width >>= 3 ; for ( x = 0 ; x < width ; x ++ ) { data = vga_read_dword_le ( vga , addr ) ; data &= plane_mask ; v = expand2 [ GET_PLANE ( data , 0 ) ] ; v |= expand2 [ GET_PLANE ( data , 2 ) ] << 2 ; PUT_PIXEL2 ( d , 0 , palette [ v >> 12 ] ) ; PUT_PIXEL2 ( d , 1 , palette [ ( v >> 8 ) & 0xf ] ) ; PUT_PIXEL2 ( d , 2 , palette [ ( v >> 4 ) & 0xf ] ) ; PUT_PIXEL2 ( d , 3 , palette [ ( v >> 0 ) & 0xf ] ) ; v = expand2 [ GET_PLANE ( data , 1 ) ] ; v |= expand2 [ GET_PLANE ( data , 3 ) ] << 2 ; PUT_PIXEL2 ( d , 4 , palette [ v >> 12 ] ) ; PUT_PIXEL2 ( d , 5 , palette [ ( v >> 8 ) & 0xf ] ) ; PUT_PIXEL2 ( d , 6 , palette [ ( v >> 4 ) & 0xf ] ) ; PUT_PIXEL2 ( d , 7 , palette [ ( v >> 0 ) & 0xf ] ) ; d += 64 ; addr += 4 ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int expand_rle_row ( SgiState * s , uint8_t * out_buf , uint8_t * out_end , int pixelstride ) { unsigned char pixel , count ; unsigned char * orig = out_buf ; while ( 1 ) { if ( bytestream2_get_bytes_left ( & s -> g ) < 1 ) return AVERROR_INVALIDDATA ; pixel = bytestream2_get_byteu ( & s -> g ) ; if ( ! ( count = ( pixel & 0x7f ) ) ) { return ( out_buf - orig ) / pixelstride ; } if ( out_buf + pixelstride * count >= out_end ) return - 1 ; if ( pixel & 0x80 ) { while ( count -- ) { * out_buf = bytestream2_get_byte ( & s -> g ) ; out_buf += pixelstride ; } } else { pixel = bytestream2_get_byte ( & s -> g ) ; while ( count -- ) { * out_buf = pixel ; out_buf += pixelstride ; } } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int vp9_fast_hex_search ( const MACROBLOCK * x , MV * ref_mv , int search_param , int sad_per_bit , int do_init_search , int * sad_list , const vp9_variance_fn_ptr_t * vfp , int use_mvcost , const MV * center_mv , MV * best_mv ) { return vp9_hex_search ( x , ref_mv , MAX ( MAX_MVSEARCH_STEPS - 2 , search_param ) , sad_per_bit , do_init_search , sad_list , vfp , use_mvcost , center_mv , best_mv ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean strcase_equal ( gconstpointer ka , gconstpointer kb ) { const char * a = ( const char * ) ka ; const char * b = ( const char * ) kb ; return g_ascii_strcasecmp ( a , b ) == 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
extern List as_mysql_get_cluster_events ( mysql_conn_t * mysql_conn , uint32_t uid , slurmdb_event_cond_t * event_cond ) { char * query = NULL ; char * extra = NULL ; char * tmp = NULL ; List ret_list = NULL ; ListIterator itr = NULL ; char * object = NULL ; int set = 0 ; int i = 0 ; MYSQL_RES * result = NULL ; MYSQL_ROW row ; time_t now = time ( NULL ) ; List use_cluster_list = as_mysql_cluster_list ; char * event_req_inx [ ] = { "cluster_nodes" , "node_name" , "state" , "time_start" , "time_end" , "reason" , "reason_uid" , "tres" , } ; enum { EVENT_REQ_CNODES , EVENT_REQ_NODE , EVENT_REQ_STATE , EVENT_REQ_START , EVENT_REQ_END , EVENT_REQ_REASON , EVENT_REQ_REASON_UID , EVENT_REQ_TRES , EVENT_REQ_COUNT } ; if ( check_connection ( mysql_conn ) != SLURM_SUCCESS ) return NULL ; if ( ! event_cond ) goto empty ; if ( event_cond -> cpus_min ) { if ( extra ) xstrcat ( extra , " && (" ) ; else xstrcat ( extra , " where (" ) ; if ( event_cond -> cpus_max ) { xstrfmtcat ( extra , "count between %u and %u)" , event_cond -> cpus_min , event_cond -> cpus_max ) ; } else { xstrfmtcat ( extra , "count='%u')" , event_cond -> cpus_min ) ; } } switch ( event_cond -> event_type ) { case SLURMDB_EVENT_ALL : break ; case SLURMDB_EVENT_CLUSTER : if ( extra ) xstrcat ( extra , " && (" ) ; else xstrcat ( extra , " where (" ) ; xstrcat ( extra , "node_name = '')" ) ; break ; case SLURMDB_EVENT_NODE : if ( extra ) xstrcat ( extra , " && (" ) ; else xstrcat ( extra , " where (" ) ; xstrcat ( extra , "node_name != '')" ) ; break ; default : error ( "Unknown event %u doing all" , event_cond -> event_type ) ; break ; } if ( event_cond -> node_list && list_count ( event_cond -> node_list ) ) { set = 0 ; if ( extra ) xstrcat ( extra , " && (" ) ; else xstrcat ( extra , " where (" ) ; itr = list_iterator_create ( event_cond -> node_list ) ; while ( ( object = list_next ( itr ) ) ) { if ( set ) xstrcat ( extra , " || " ) ; xstrfmtcat ( extra , "node_name='%s'" , object ) ; set = 1 ; } list_iterator_destroy ( itr ) ; xstrcat ( extra , ")" ) ; } if ( event_cond -> period_start ) { if ( ! event_cond -> period_end ) event_cond -> period_end = now ; if ( extra ) xstrcat ( extra , " && (" ) ; else xstrcat ( extra , " where (" ) ; xstrfmtcat ( extra , "(time_start < %ld) " "&& (time_end >= %ld || time_end = 0))" , event_cond -> period_end , event_cond -> period_start ) ; } if ( event_cond -> reason_list && list_count ( event_cond -> reason_list ) ) { set = 0 ; if ( extra ) xstrcat ( extra , " && (" ) ; else xstrcat ( extra , " where (" ) ; itr = list_iterator_create ( event_cond -> reason_list ) ; while ( ( object = list_next ( itr ) ) ) { if ( set ) xstrcat ( extra , " || " ) ; xstrfmtcat ( extra , "reason like '%%%s%%'" , object ) ; set = 1 ; } list_iterator_destroy ( itr ) ; xstrcat ( extra , ")" ) ; } if ( event_cond -> reason_uid_list && list_count ( event_cond -> reason_uid_list ) ) { set = 0 ; if ( extra ) xstrcat ( extra , " && (" ) ; else xstrcat ( extra , " where (" ) ; itr = list_iterator_create ( event_cond -> reason_uid_list ) ; while ( ( object = list_next ( itr ) ) ) { if ( set ) xstrcat ( extra , " || " ) ; xstrfmtcat ( extra , "reason_uid='%s'" , object ) ; set = 1 ; } list_iterator_destroy ( itr ) ; xstrcat ( extra , ")" ) ; } if ( event_cond -> state_list && list_count ( event_cond -> state_list ) ) { set = 0 ; if ( extra ) xstrcat ( extra , " && (" ) ; else xstrcat ( extra , " where (" ) ; itr = list_iterator_create ( event_cond -> state_list ) ; while ( ( object = list_next ( itr ) ) ) { if ( set ) xstrcat ( extra , " || " ) ; xstrfmtcat ( extra , "state='%s'" , object ) ; set = 1 ; } list_iterator_destroy ( itr ) ; xstrcat ( extra , ")" ) ; } if ( event_cond -> cluster_list && list_count ( event_cond -> cluster_list ) ) use_cluster_list = event_cond -> cluster_list ; empty : xfree ( tmp ) ; xstrfmtcat ( tmp , "%s" , event_req_inx [ 0 ] ) ; for ( i = 1 ; i < EVENT_REQ_COUNT ; i ++ ) { xstrfmtcat ( tmp , ", %s" , event_req_inx [ i ] ) ; } if ( use_cluster_list == as_mysql_cluster_list ) slurm_mutex_lock ( & as_mysql_cluster_list_lock ) ; ret_list = list_create ( slurmdb_destroy_event_rec ) ; itr = list_iterator_create ( use_cluster_list ) ; while ( ( object = list_next ( itr ) ) ) { query = xstrdup_printf ( "select %s from \"%s_%s\"" , tmp , object , event_table ) ; if ( extra ) xstrfmtcat ( query , " %s" , extra ) ; if ( debug_flags & DEBUG_FLAG_DB_ASSOC ) DB_DEBUG ( mysql_conn -> conn , "query\n%s" , query ) ; if ( ! ( result = mysql_db_query_ret ( mysql_conn , query , 0 ) ) ) { xfree ( query ) ; if ( mysql_errno ( mysql_conn -> db_conn ) != ER_NO_SUCH_TABLE ) { FREE_NULL_LIST ( ret_list ) ; ret_list = NULL ; } break ; } xfree ( query ) ; while ( ( row = mysql_fetch_row ( result ) ) ) { slurmdb_event_rec_t * event = xmalloc ( sizeof ( slurmdb_event_rec_t ) ) ; list_append ( ret_list , event ) ; event -> cluster = xstrdup ( object ) ; if ( row [ EVENT_REQ_NODE ] && row [ EVENT_REQ_NODE ] [ 0 ] ) { event -> node_name = xstrdup ( row [ EVENT_REQ_NODE ] ) ; event -> event_type = SLURMDB_EVENT_NODE ; } else event -> event_type = SLURMDB_EVENT_CLUSTER ; event -> state = slurm_atoul ( row [ EVENT_REQ_STATE ] ) ; event -> period_start = slurm_atoul ( row [ EVENT_REQ_START ] ) ; event -> period_end = slurm_atoul ( row [ EVENT_REQ_END ] ) ; if ( row [ EVENT_REQ_REASON ] && row [ EVENT_REQ_REASON ] [ 0 ] ) event -> reason = xstrdup ( row [ EVENT_REQ_REASON ] ) ; event -> reason_uid = slurm_atoul ( row [ EVENT_REQ_REASON_UID ] ) ; if ( row [ EVENT_REQ_CNODES ] && row [ EVENT_REQ_CNODES ] [ 0 ] ) event -> cluster_nodes = xstrdup ( row [ EVENT_REQ_CNODES ] ) ; if ( row [ EVENT_REQ_TRES ] && row [ EVENT_REQ_TRES ] [ 0 ] ) event -> tres_str = xstrdup ( row [ EVENT_REQ_TRES ] ) ; } mysql_free_result ( result ) ; } list_iterator_destroy ( itr ) ; xfree ( tmp ) ; xfree ( extra ) ; if ( use_cluster_list == as_mysql_cluster_list ) slurm_mutex_unlock ( & as_mysql_cluster_list_lock ) ; return ret_list ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
size_t WriteStr ( ArchiveHandle * AH , const char * c ) { size_t res ; if ( c ) { int len = strlen ( c ) ; res = WriteInt ( AH , len ) ; ( * AH -> WriteBufPtr ) ( AH , c , len ) ; res += len ; } else res = WriteInt ( AH , - 1 ) ; return res ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int open_input_file ( InputFile * ifile , const char * filename ) { int err , i ; AVFormatContext * fmt_ctx = NULL ; AVDictionaryEntry * t ; int scan_all_pmts_set = 0 ; fmt_ctx = avformat_alloc_context ( ) ; if ( ! fmt_ctx ) { print_error ( filename , AVERROR ( ENOMEM ) ) ; exit_program ( 1 ) ; } fmt_ctx -> flags |= AVFMT_FLAG_KEEP_SIDE_DATA ; if ( ! av_dict_get ( format_opts , "scan_all_pmts" , NULL , AV_DICT_MATCH_CASE ) ) { av_dict_set ( & format_opts , "scan_all_pmts" , "1" , AV_DICT_DONT_OVERWRITE ) ; scan_all_pmts_set = 1 ; } if ( ( err = avformat_open_input ( & fmt_ctx , filename , iformat , & format_opts ) ) < 0 ) { print_error ( filename , err ) ; return err ; } ifile -> fmt_ctx = fmt_ctx ; if ( scan_all_pmts_set ) av_dict_set ( & format_opts , "scan_all_pmts" , NULL , AV_DICT_MATCH_CASE ) ; if ( ( t = av_dict_get ( format_opts , "" , NULL , AV_DICT_IGNORE_SUFFIX ) ) ) { av_log ( NULL , AV_LOG_ERROR , "Option %s not found.\n" , t -> key ) ; return AVERROR_OPTION_NOT_FOUND ; } if ( find_stream_info ) { AVDictionary * * opts = setup_find_stream_info_opts ( fmt_ctx , codec_opts ) ; int orig_nb_streams = fmt_ctx -> nb_streams ; err = avformat_find_stream_info ( fmt_ctx , opts ) ; for ( i = 0 ; i < orig_nb_streams ; i ++ ) av_dict_free ( & opts [ i ] ) ; av_freep ( & opts ) ; if ( err < 0 ) { print_error ( filename , err ) ; return err ; } } av_dump_format ( fmt_ctx , 0 , filename , 0 ) ; ifile -> streams = av_mallocz_array ( fmt_ctx -> nb_streams , sizeof ( * ifile -> streams ) ) ; if ( ! ifile -> streams ) exit ( 1 ) ; ifile -> nb_streams = fmt_ctx -> nb_streams ; for ( i = 0 ; i < fmt_ctx -> nb_streams ; i ++ ) { InputStream * ist = & ifile -> streams [ i ] ; AVStream * stream = fmt_ctx -> streams [ i ] ; AVCodec * codec ; ist -> st = stream ; if ( stream -> codecpar -> codec_id == AV_CODEC_ID_PROBE ) { av_log ( NULL , AV_LOG_WARNING , "Failed to probe codec for input stream %d\n" , stream -> index ) ; continue ; } codec = avcodec_find_decoder ( stream -> codecpar -> codec_id ) ; if ( ! codec ) { av_log ( NULL , AV_LOG_WARNING , "Unsupported codec with id %d for input stream %d\n" , stream -> codecpar -> codec_id , stream -> index ) ; continue ; } { AVDictionary * opts = filter_codec_opts ( codec_opts , stream -> codecpar -> codec_id , fmt_ctx , stream , codec ) ; ist -> dec_ctx = avcodec_alloc_context3 ( codec ) ; if ( ! ist -> dec_ctx ) exit ( 1 ) ; err = avcodec_parameters_to_context ( ist -> dec_ctx , stream -> codecpar ) ; if ( err < 0 ) exit ( 1 ) ; if ( do_show_log ) { av_dict_set ( & codec_opts , "threads" , "1" , 0 ) ; } av_codec_set_pkt_timebase ( ist -> dec_ctx , stream -> time_base ) ; ist -> dec_ctx -> framerate = stream -> avg_frame_rate ; if ( avcodec_open2 ( ist -> dec_ctx , codec , & opts ) < 0 ) { av_log ( NULL , AV_LOG_WARNING , "Could not open codec for input stream %d\n" , stream -> index ) ; exit ( 1 ) ; } if ( ( t = av_dict_get ( opts , "" , NULL , AV_DICT_IGNORE_SUFFIX ) ) ) { av_log ( NULL , AV_LOG_ERROR , "Option %s for input stream %d not found\n" , t -> key , stream -> index ) ; return AVERROR_OPTION_NOT_FOUND ; } } } ifile -> fmt_ctx = fmt_ctx ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void remove_callback_link_keep_data ( NautilusDirectory * directory , GList * link ) { ReadyCallback * callback ; callback = link -> data ; directory -> details -> call_when_ready_list = g_list_remove_link ( directory -> details -> call_when_ready_list , link ) ; request_counter_remove_request ( directory -> details -> call_when_ready_counters , callback -> request ) ; g_list_free_1 ( link ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int compare_combining_class ( const hb_glyph_info_t * pa , const hb_glyph_info_t * pb ) { unsigned int a = _hb_glyph_info_get_modified_combining_class ( pa ) ; unsigned int b = _hb_glyph_info_get_modified_combining_class ( pb ) ; return a < b ? - 1 : a == b ? 0 : + 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void setup_frame ( VP9_COMP * cpi ) { VP9_COMMON * const cm = & cpi -> common ; if ( frame_is_intra_only ( cm ) || cm -> error_resilient_mode ) { vp9_setup_past_independence ( cm ) ; } else { if ( ! cpi -> use_svc ) cm -> frame_context_idx = cpi -> refresh_alt_ref_frame ; } if ( cm -> frame_type == KEY_FRAME ) { if ( ! is_two_pass_svc ( cpi ) ) cpi -> refresh_golden_frame = 1 ; cpi -> refresh_alt_ref_frame = 1 ; vp9_zero ( cpi -> interp_filter_selected ) ; } else { cm -> fc = cm -> frame_contexts [ cm -> frame_context_idx ] ; vp9_zero ( cpi -> interp_filter_selected [ 0 ] ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void gs_memory_set_vm_threshold ( gs_ref_memory_t * mem , long val ) { gs_memory_gc_status_t stat ; gs_ref_memory_t * stable = ( gs_ref_memory_t * ) mem -> stable_memory ; gs_memory_gc_status ( mem , & stat ) ; stat . vm_threshold = val ; gs_memory_set_gc_status ( mem , & stat ) ; gs_memory_gc_status ( stable , & stat ) ; stat . vm_threshold = val ; gs_memory_set_gc_status ( stable , & stat ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static UHashtable * _uhash_init ( UHashtable * result , UHashFunction * keyHash , UKeyComparator * keyComp , UValueComparator * valueComp , int32_t primeIndex , UErrorCode * status ) { if ( U_FAILURE ( * status ) ) return NULL ; U_ASSERT ( keyHash != NULL ) ; U_ASSERT ( keyComp != NULL ) ; result -> keyHasher = keyHash ; result -> keyComparator = keyComp ; result -> valueComparator = valueComp ; result -> keyDeleter = NULL ; result -> valueDeleter = NULL ; result -> allocated = FALSE ; _uhash_internalSetResizePolicy ( result , U_GROW ) ; _uhash_allocate ( result , primeIndex , status ) ; if ( U_FAILURE ( * status ) ) { return NULL ; } return result ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_IS11172AudioCapability ( 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_IS11172AudioCapability , IS11172AudioCapability_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static float hb_graphite2_get_advance ( const void * hb_font , unsigned short gid ) { return ( ( hb_font_t * ) hb_font ) -> get_glyph_h_advance ( gid ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static VALUE ossl_cipher_final ( VALUE self ) { EVP_CIPHER_CTX * ctx ; int out_len ; VALUE str ; GetCipher ( self , ctx ) ; str = rb_str_new ( 0 , EVP_CIPHER_CTX_block_size ( ctx ) ) ; if ( ! EVP_CipherFinal_ex ( ctx , ( unsigned char * ) RSTRING_PTR ( str ) , & out_len ) ) ossl_raise ( eCipherError , NULL ) ; assert ( out_len <= RSTRING_LEN ( str ) ) ; rb_str_set_len ( str , out_len ) ; return str ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int main_config ( void ) { main_version ( ) ; XPR ( NTR "EXTERNAL_COMPRESSION=%d\n" , EXTERNAL_COMPRESSION ) ; XPR ( NTR "GENERIC_ENCODE_TABLES=%d\n" , GENERIC_ENCODE_TABLES ) ; XPR ( NTR "GENERIC_ENCODE_TABLES_COMPUTE=%d\n" , GENERIC_ENCODE_TABLES_COMPUTE ) ; XPR ( NTR "REGRESSION_TEST=%d\n" , REGRESSION_TEST ) ; XPR ( NTR "SECONDARY_DJW=%d\n" , SECONDARY_DJW ) ; XPR ( NTR "SECONDARY_FGK=%d\n" , SECONDARY_FGK ) ; XPR ( NTR "SECONDARY_LZMA=%d\n" , SECONDARY_LZMA ) ; XPR ( NTR "UNALIGNED_OK=%d\n" , UNALIGNED_OK ) ; XPR ( NTR "VCDIFF_TOOLS=%d\n" , VCDIFF_TOOLS ) ; XPR ( NTR "XD3_ALLOCSIZE=%d\n" , XD3_ALLOCSIZE ) ; XPR ( NTR "XD3_DEBUG=%d\n" , XD3_DEBUG ) ; XPR ( NTR "XD3_ENCODER=%d\n" , XD3_ENCODER ) ; XPR ( NTR "XD3_POSIX=%d\n" , XD3_POSIX ) ; XPR ( NTR "XD3_STDIO=%d\n" , XD3_STDIO ) ; XPR ( NTR "XD3_WIN32=%d\n" , XD3_WIN32 ) ; XPR ( NTR "XD3_USE_LARGEFILE64=%d\n" , XD3_USE_LARGEFILE64 ) ; XPR ( NTR "XD3_DEFAULT_LEVEL=%d\n" , XD3_DEFAULT_LEVEL ) ; XPR ( NTR "XD3_DEFAULT_IOPT_SIZE=%d\n" , XD3_DEFAULT_IOPT_SIZE ) ; XPR ( NTR "XD3_DEFAULT_SPREVSZ=%d\n" , XD3_DEFAULT_SPREVSZ ) ; XPR ( NTR "XD3_DEFAULT_SRCWINSZ=%d\n" , XD3_DEFAULT_SRCWINSZ ) ; XPR ( NTR "XD3_DEFAULT_WINSIZE=%d\n" , XD3_DEFAULT_WINSIZE ) ; XPR ( NTR "XD3_HARDMAXWINSIZE=%d\n" , XD3_HARDMAXWINSIZE ) ; XPR ( NTR "sizeof(void*)=%d\n" , ( int ) sizeof ( void * ) ) ; XPR ( NTR "sizeof(int)=%d\n" , ( int ) sizeof ( int ) ) ; XPR ( NTR "sizeof(size_t)=%d\n" , ( int ) sizeof ( size_t ) ) ; XPR ( NTR "sizeof(uint32_t)=%d\n" , ( int ) sizeof ( uint32_t ) ) ; XPR ( NTR "sizeof(uint64_t)=%d\n" , ( int ) sizeof ( uint64_t ) ) ; XPR ( NTR "sizeof(usize_t)=%d\n" , ( int ) sizeof ( usize_t ) ) ; XPR ( NTR "sizeof(xoff_t)=%d\n" , ( int ) sizeof ( xoff_t ) ) ; return EXIT_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void build_page_bitmap ( PageDesc * p ) { int n , tb_start , tb_end ; TranslationBlock * tb ; p -> code_bitmap = g_malloc0 ( TARGET_PAGE_SIZE / 8 ) ; tb = p -> first_tb ; while ( tb != NULL ) { n = ( uintptr_t ) tb & 3 ; tb = ( TranslationBlock * ) ( ( uintptr_t ) tb & ~ 3 ) ; if ( n == 0 ) { tb_start = tb -> pc & ~ TARGET_PAGE_MASK ; tb_end = tb_start + tb -> size ; if ( tb_end > TARGET_PAGE_SIZE ) { tb_end = TARGET_PAGE_SIZE ; } } else { tb_start = 0 ; tb_end = ( ( tb -> pc + tb -> size ) & ~ TARGET_PAGE_MASK ) ; } set_bits ( p -> code_bitmap , tb_start , tb_end - tb_start ) ; tb = tb -> page_next [ n ] ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
TSReturnCode TSHttpTxnConfigFloatGet ( TSHttpTxn txnp , TSOverridableConfigKey conf , TSMgmtFloat * value ) { sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ; sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) value ) == TS_SUCCESS ) ; OverridableDataType type ; TSMgmtFloat * dest = static_cast < TSMgmtFloat * > ( _conf_to_memberp ( conf , ( ( HttpSM * ) txnp ) -> t_state . txn_conf , & type ) ) ; if ( type != OVERRIDABLE_TYPE_FLOAT ) { return TS_ERROR ; } if ( dest ) { * value = * dest ; return TS_SUCCESS ; } return TS_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void jbig2_set_bits ( byte * line , uint32_t x0 , uint32_t x1 ) { uint32_t a0 , a1 , b0 , b1 , a ; a0 = x0 >> 3 ; a1 = x1 >> 3 ; b0 = x0 & 7 ; b1 = x1 & 7 ; if ( a0 == a1 ) { line [ a0 ] |= lm [ b0 ] & rm [ b1 ] ; } else { line [ a0 ] |= lm [ b0 ] ; for ( a = a0 + 1 ; a < a1 ; a ++ ) line [ a ] = 0xFF ; if ( b1 ) line [ a1 ] |= rm [ b1 ] ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int cinepak_decode_vectors ( CinepakContext * s , cvid_strip * strip , int chunk_id , int size , const uint8_t * data ) { const uint8_t * eod = ( data + size ) ; uint32_t flag , mask ; cvid_codebook * codebook ; unsigned int x , y ; uint32_t iy [ 4 ] ; uint32_t iu [ 2 ] ; uint32_t iv [ 2 ] ; flag = 0 ; mask = 0 ; for ( y = strip -> y1 ; y < strip -> y2 ; y += 4 ) { iy [ 0 ] = strip -> x1 + ( y * s -> frame . linesize [ 0 ] ) ; iy [ 1 ] = iy [ 0 ] + s -> frame . linesize [ 0 ] ; iy [ 2 ] = iy [ 1 ] + s -> frame . linesize [ 0 ] ; iy [ 3 ] = iy [ 2 ] + s -> frame . linesize [ 0 ] ; iu [ 0 ] = ( strip -> x1 / 2 ) + ( ( y / 2 ) * s -> frame . linesize [ 1 ] ) ; iu [ 1 ] = iu [ 0 ] + s -> frame . linesize [ 1 ] ; iv [ 0 ] = ( strip -> x1 / 2 ) + ( ( y / 2 ) * s -> frame . linesize [ 2 ] ) ; iv [ 1 ] = iv [ 0 ] + s -> frame . linesize [ 2 ] ; for ( x = strip -> x1 ; x < strip -> x2 ; x += 4 ) { if ( ( chunk_id & 0x01 ) && ! ( mask >>= 1 ) ) { if ( ( data + 4 ) > eod ) return AVERROR_INVALIDDATA ; flag = AV_RB32 ( data ) ; data += 4 ; mask = 0x80000000 ; } if ( ! ( chunk_id & 0x01 ) || ( flag & mask ) ) { if ( ! ( chunk_id & 0x02 ) && ! ( mask >>= 1 ) ) { if ( ( data + 4 ) > eod ) return AVERROR_INVALIDDATA ; flag = AV_RB32 ( data ) ; data += 4 ; mask = 0x80000000 ; } if ( ( chunk_id & 0x02 ) || ( ~ flag & mask ) ) { if ( data >= eod ) return AVERROR_INVALIDDATA ; codebook = & strip -> v1_codebook [ * data ++ ] ; s -> frame . data [ 0 ] [ iy [ 0 ] + 0 ] = codebook -> y0 ; s -> frame . data [ 0 ] [ iy [ 0 ] + 1 ] = codebook -> y0 ; s -> frame . data [ 0 ] [ iy [ 1 ] + 0 ] = codebook -> y0 ; s -> frame . data [ 0 ] [ iy [ 1 ] + 1 ] = codebook -> y0 ; if ( ! s -> palette_video ) { s -> frame . data [ 1 ] [ iu [ 0 ] ] = codebook -> u ; s -> frame . data [ 2 ] [ iv [ 0 ] ] = codebook -> v ; } s -> frame . data [ 0 ] [ iy [ 0 ] + 2 ] = codebook -> y1 ; s -> frame . data [ 0 ] [ iy [ 0 ] + 3 ] = codebook -> y1 ; s -> frame . data [ 0 ] [ iy [ 1 ] + 2 ] = codebook -> y1 ; s -> frame . data [ 0 ] [ iy [ 1 ] + 3 ] = codebook -> y1 ; if ( ! s -> palette_video ) { s -> frame . data [ 1 ] [ iu [ 0 ] + 1 ] = codebook -> u ; s -> frame . data [ 2 ] [ iv [ 0 ] + 1 ] = codebook -> v ; } s -> frame . data [ 0 ] [ iy [ 2 ] + 0 ] = codebook -> y2 ; s -> frame . data [ 0 ] [ iy [ 2 ] + 1 ] = codebook -> y2 ; s -> frame . data [ 0 ] [ iy [ 3 ] + 0 ] = codebook -> y2 ; s -> frame . data [ 0 ] [ iy [ 3 ] + 1 ] = codebook -> y2 ; if ( ! s -> palette_video ) { s -> frame . data [ 1 ] [ iu [ 1 ] ] = codebook -> u ; s -> frame . data [ 2 ] [ iv [ 1 ] ] = codebook -> v ; } s -> frame . data [ 0 ] [ iy [ 2 ] + 2 ] = codebook -> y3 ; s -> frame . data [ 0 ] [ iy [ 2 ] + 3 ] = codebook -> y3 ; s -> frame . data [ 0 ] [ iy [ 3 ] + 2 ] = codebook -> y3 ; s -> frame . data [ 0 ] [ iy [ 3 ] + 3 ] = codebook -> y3 ; if ( ! s -> palette_video ) { s -> frame . data [ 1 ] [ iu [ 1 ] + 1 ] = codebook -> u ; s -> frame . data [ 2 ] [ iv [ 1 ] + 1 ] = codebook -> v ; } } else if ( flag & mask ) { if ( ( data + 4 ) > eod ) return AVERROR_INVALIDDATA ; codebook = & strip -> v4_codebook [ * data ++ ] ; s -> frame . data [ 0 ] [ iy [ 0 ] + 0 ] = codebook -> y0 ; s -> frame . data [ 0 ] [ iy [ 0 ] + 1 ] = codebook -> y1 ; s -> frame . data [ 0 ] [ iy [ 1 ] + 0 ] = codebook -> y2 ; s -> frame . data [ 0 ] [ iy [ 1 ] + 1 ] = codebook -> y3 ; if ( ! s -> palette_video ) { s -> frame . data [ 1 ] [ iu [ 0 ] ] = codebook -> u ; s -> frame . data [ 2 ] [ iv [ 0 ] ] = codebook -> v ; } codebook = & strip -> v4_codebook [ * data ++ ] ; s -> frame . data [ 0 ] [ iy [ 0 ] + 2 ] = codebook -> y0 ; s -> frame . data [ 0 ] [ iy [ 0 ] + 3 ] = codebook -> y1 ; s -> frame . data [ 0 ] [ iy [ 1 ] + 2 ] = codebook -> y2 ; s -> frame . data [ 0 ] [ iy [ 1 ] + 3 ] = codebook -> y3 ; if ( ! s -> palette_video ) { s -> frame . data [ 1 ] [ iu [ 0 ] + 1 ] = codebook -> u ; s -> frame . data [ 2 ] [ iv [ 0 ] + 1 ] = codebook -> v ; } codebook = & strip -> v4_codebook [ * data ++ ] ; s -> frame . data [ 0 ] [ iy [ 2 ] + 0 ] = codebook -> y0 ; s -> frame . data [ 0 ] [ iy [ 2 ] + 1 ] = codebook -> y1 ; s -> frame . data [ 0 ] [ iy [ 3 ] + 0 ] = codebook -> y2 ; s -> frame . data [ 0 ] [ iy [ 3 ] + 1 ] = codebook -> y3 ; if ( ! s -> palette_video ) { s -> frame . data [ 1 ] [ iu [ 1 ] ] = codebook -> u ; s -> frame . data [ 2 ] [ iv [ 1 ] ] = codebook -> v ; } codebook = & strip -> v4_codebook [ * data ++ ] ; s -> frame . data [ 0 ] [ iy [ 2 ] + 2 ] = codebook -> y0 ; s -> frame . data [ 0 ] [ iy [ 2 ] + 3 ] = codebook -> y1 ; s -> frame . data [ 0 ] [ iy [ 3 ] + 2 ] = codebook -> y2 ; s -> frame . data [ 0 ] [ iy [ 3 ] + 3 ] = codebook -> y3 ; if ( ! s -> palette_video ) { s -> frame . data [ 1 ] [ iu [ 1 ] + 1 ] = codebook -> u ; s -> frame . data [ 2 ] [ iv [ 1 ] + 1 ] = codebook -> v ; } } } iy [ 0 ] += 4 ; iy [ 1 ] += 4 ; iy [ 2 ] += 4 ; iy [ 3 ] += 4 ; iu [ 0 ] += 2 ; iu [ 1 ] += 2 ; iv [ 0 ] += 2 ; iv [ 1 ] += 2 ; } } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void set_user ( const char * user , struct passwd * user_info_arg ) { # if ! defined ( __WIN__ ) DBUG_ASSERT ( user_info_arg != 0 ) ; # ifdef HAVE_INITGROUPS calling_initgroups = 1 ; initgroups ( ( char * ) user , user_info_arg -> pw_gid ) ; calling_initgroups = 0 ; # endif if ( setgid ( user_info_arg -> pw_gid ) == - 1 ) { sql_perror ( "setgid" ) ; unireg_abort ( 1 ) ; } if ( setuid ( user_info_arg -> pw_uid ) == - 1 ) { sql_perror ( "setuid" ) ; unireg_abort ( 1 ) ; } allow_coredumps ( ) ; # endif }
0False
Categorize the following code snippet as vulnerable or not. True or False
void jpc_ft_fwdlift_col ( jpc_fix_t * a , int numrows , int stride , int parity ) { jpc_fix_t * lptr ; jpc_fix_t * hptr ; # if 0 register jpc_fix_t * lptr2 ; register jpc_fix_t * hptr2 ; register int i ; # endif register int n ; int llen ; llen = ( numrows + 1 - parity ) >> 1 ; if ( numrows > 1 ) { lptr = & a [ 0 ] ; hptr = & a [ llen * stride ] ; if ( parity ) { hptr [ 0 ] -= lptr [ 0 ] ; hptr += stride ; } n = numrows - llen - parity - ( parity == ( numrows & 1 ) ) ; while ( n -- > 0 ) { hptr [ 0 ] -= jpc_fix_asr ( lptr [ 0 ] + lptr [ stride ] , 1 ) ; hptr += stride ; lptr += stride ; } if ( parity == ( numrows & 1 ) ) { hptr [ 0 ] -= lptr [ 0 ] ; } lptr = & a [ 0 ] ; hptr = & a [ llen * stride ] ; if ( ! parity ) { lptr [ 0 ] += jpc_fix_asr ( hptr [ 0 ] + 1 , 1 ) ; lptr += stride ; } n = llen - ( ! parity ) - ( parity != ( numrows & 1 ) ) ; while ( n -- > 0 ) { lptr [ 0 ] += jpc_fix_asr ( hptr [ 0 ] + hptr [ stride ] + 2 , 2 ) ; lptr += stride ; hptr += stride ; } if ( parity != ( numrows & 1 ) ) { lptr [ 0 ] += jpc_fix_asr ( hptr [ 0 ] + 1 , 1 ) ; } } else { if ( parity ) { lptr = & a [ 0 ] ; lptr [ 0 ] = jpc_fix_asl ( lptr [ 0 ] , 1 ) ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
tvbuff_t * tvb_child_uncompress ( tvbuff_t * parent , tvbuff_t * tvb , const int offset , int comprlen ) { tvbuff_t * new_tvb = tvb_uncompress ( tvb , offset , comprlen ) ; if ( new_tvb ) tvb_set_child_real_data_tvbuff ( parent , new_tvb ) ; return new_tvb ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_rsl_ie_cb_cmd_type ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset , gboolean is_mandatory ) { proto_tree * ie_tree ; guint8 ie_id ; if ( is_mandatory == FALSE ) { ie_id = tvb_get_guint8 ( tvb , offset ) ; if ( ie_id != RSL_IE_CB_CMD_TYPE ) return offset ; } ie_tree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_ie_cb_cmd_type , NULL , "CB Command type IE" ) ; proto_tree_add_item ( ie_tree , hf_rsl_ie_id , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; proto_tree_add_item ( ie_tree , hf_rsl_ch_needed , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static char * default_opaque_binary_tag ( tvbuff_t * tvb , guint32 offset , guint8 token _U_ , guint8 codepage _U_ , guint32 * length ) { guint32 data_len = tvb_get_guintvar ( tvb , offset , length ) ; char * str = wmem_strdup_printf ( wmem_packet_scope ( ) , "(%d bytes of opaque data)" , data_len ) ; * length += data_len ; return str ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void name ## _free ( type * a ) ; # define DECLARE_ASN1_PRINT_FUNCTION ( stname ) DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , stname ) # define DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , fname ) int fname ## _print_ctx ( BIO * out , stname * x , int indent , const ASN1_PCTX * pctx ) ; # define D2I_OF ( type ) type * ( * ) ( type * * , const unsigned char * * , long ) # define I2D_OF ( type ) int ( * ) ( type * , unsigned char * * ) # define I2D_OF_const ( type ) int ( * ) ( const type * , unsigned char * * ) # define CHECKED_D2I_OF ( type , d2i ) ( ( d2i_of_void * ) ( 1 ? d2i : ( ( D2I_OF ( type ) ) 0 ) ) ) # define CHECKED_I2D_OF ( type , i2d ) ( ( i2d_of_void * ) ( 1 ? i2d : ( ( I2D_OF ( type ) ) 0 ) ) ) # define CHECKED_NEW_OF ( type , xnew ) ( ( void * ( * ) ( void ) ) ( 1 ? xnew : ( ( type * ( * ) ( void ) ) 0 ) ) ) # define CHECKED_PTR_OF ( type , p ) ( ( void * ) ( 1 ? p : ( type * ) 0 ) ) # define CHECKED_PPTR_OF ( type , p ) ( ( void * * ) ( 1 ? p : ( type * * ) 0 ) ) # define TYPEDEF_D2I_OF ( type ) typedef type * d2i_of_ ## type ( type * * , const unsigned char * * , long ) # define TYPEDEF_I2D_OF ( type ) typedef int i2d_of_ ## type ( type * , unsigned char * * ) # define TYPEDEF_D2I2D_OF ( type ) TYPEDEF_D2I_OF ( type ) ; TYPEDEF_I2D_OF ( type ) TYPEDEF_D2I2D_OF ( void ) ; # ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION typedef const ASN1_ITEM ASN1_ITEM_EXP ; # define ASN1_ITEM_ptr ( iptr ) ( iptr ) # define ASN1_ITEM_ref ( iptr ) ( & ( iptr ## _it ) ) # define ASN1_ITEM_rptr ( ref ) ( & ( ref ## _it ) ) # define DECLARE_ASN1_ITEM ( name ) OPENSSL_EXTERN const ASN1_ITEM name ## _it ; # else typedef const ASN1_ITEM * ASN1_ITEM_EXP ( void ) ; # define ASN1_ITEM_ptr ( iptr ) ( iptr ( ) ) # define ASN1_ITEM_ref ( iptr ) ( iptr ## _it ) # define ASN1_ITEM_rptr ( ref ) ( ref ## _it ( ) ) # define DECLARE_ASN1_ITEM ( name ) const ASN1_ITEM * name ## _it ( void ) ; # endif # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 # define ASN1_STRFLGS_ESC_QUOTE 8 # define CHARTYPE_PRINTABLESTRING 0x10 # define CHARTYPE_FIRST_ESC_2253 0x20 # define CHARTYPE_LAST_ESC_2253 0x40 # define ASN1_STRFLGS_UTF8_CONVERT 0x10 # define ASN1_STRFLGS_IGNORE_TYPE 0x20 # define ASN1_STRFLGS_SHOW_TYPE 0x40 # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 # define ASN1_STRFLGS_DUMP_DER 0x200 # define ASN1_STRFLGS_ESC_2254 0x400 # define ASN1_STRFLGS_RFC2253 ( ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER ) DEFINE_STACK_OF ( ASN1_INTEGER ) DEFINE_STACK_OF ( ASN1_GENERALSTRING ) DEFINE_STACK_OF ( ASN1_UTF8STRING ) typedef struct asn1_type_st { int type ; union { char * ptr ; ASN1_BOOLEAN boolean ; ASN1_STRING * asn1_string ; ASN1_OBJECT * object ; ASN1_INTEGER * integer ; ASN1_ENUMERATED * enumerated ; ASN1_BIT_STRING * bit_string ; ASN1_OCTET_STRING * octet_string ; ASN1_PRINTABLESTRING * printablestring ; ASN1_T61STRING * t61string ; ASN1_IA5STRING * ia5string ; ASN1_GENERALSTRING * generalstring ; ASN1_BMPSTRING * bmpstring ; ASN1_UNIVERSALSTRING * universalstring ; ASN1_UTCTIME * utctime ; ASN1_GENERALIZEDTIME * generalizedtime ; ASN1_VISIBLESTRING * visiblestring ; ASN1_UTF8STRING * utf8string ; ASN1_STRING * set ; ASN1_STRING * sequence ; ASN1_VALUE * asn1_value ; } value ; } ASN1_TYPE ; DEFINE_STACK_OF ( ASN1_TYPE ) typedef STACK_OF ( ASN1_TYPE ) ASN1_SEQUENCE_ANY ; DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SEQUENCE_ANY ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SET_ANY ) typedef struct BIT_STRING_BITNAME_st { int bitnum ; const char * lname ; const char * sname ; } BIT_STRING_BITNAME ; # define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING DECLARE_ASN1_FUNCTIONS_fname ( ASN1_TYPE , ASN1_ANY , ASN1_TYPE ) int ASN1_TYPE_get ( const ASN1_TYPE * a ) ; void ASN1_TYPE_set ( ASN1_TYPE * a , int type , void * value ) ; int ASN1_TYPE_set1 ( ASN1_TYPE * a , int type , const void * value ) ; int ASN1_TYPE_cmp ( const ASN1_TYPE * a , const ASN1_TYPE * b ) ; ASN1_TYPE * ASN1_TYPE_pack_sequence ( const ASN1_ITEM * it , void * s , ASN1_TYPE * * t ) ; void * ASN1_TYPE_unpack_sequence ( const ASN1_ITEM * it , const ASN1_TYPE * t ) ; ASN1_OBJECT * ASN1_OBJECT_new ( void ) ; void ASN1_OBJECT_free ( ASN1_OBJECT * a ) ; int i2d_ASN1_OBJECT ( const ASN1_OBJECT * a , unsigned char * * pp ) ; ASN1_OBJECT * d2i_ASN1_OBJECT ( ASN1_OBJECT * * a , const unsigned char * * pp , long length ) ; DECLARE_ASN1_ITEM ( ASN1_OBJECT ) DEFINE_STACK_OF ( ASN1_OBJECT ) ASN1_STRING * ASN1_STRING_new ( void ) ; void ASN1_STRING_free ( ASN1_STRING * a ) ; void ASN1_STRING_clear_free ( ASN1_STRING * a ) ; int ASN1_STRING_copy ( ASN1_STRING * dst , const ASN1_STRING * str ) ; ASN1_STRING * ASN1_STRING_dup ( const ASN1_STRING * a ) ; ASN1_STRING * ASN1_STRING_type_new ( int type ) ; int ASN1_STRING_cmp ( const ASN1_STRING * a , const ASN1_STRING * b ) ; int ASN1_STRING_set ( ASN1_STRING * str , const void * data , int len ) ; void ASN1_STRING_set0 ( ASN1_STRING * str , void * data , int len ) ; int ASN1_STRING_length ( const ASN1_STRING * x ) ; void ASN1_STRING_length_set ( ASN1_STRING * x , int n ) ; int ASN1_STRING_type ( const ASN1_STRING * x ) ; DEPRECATEDIN_1_1_0 ( unsigned char * ASN1_STRING_data ( ASN1_STRING * x ) ) const unsigned char * ASN1_STRING_get0_data ( const ASN1_STRING * x ) ; DECLARE_ASN1_FUNCTIONS ( ASN1_BIT_STRING ) int ASN1_BIT_STRING_set ( ASN1_BIT_STRING * a , unsigned char * d , int length ) ; int ASN1_BIT_STRING_set_bit ( ASN1_BIT_STRING * a , int n , int value ) ; int ASN1_BIT_STRING_get_bit ( const ASN1_BIT_STRING * a , int n ) ; int ASN1_BIT_STRING_check ( const ASN1_BIT_STRING * a , const unsigned char * flags , int flags_len ) ; int ASN1_BIT_STRING_name_print ( BIO * out , ASN1_BIT_STRING * bs , BIT_STRING_BITNAME * tbl , int indent ) ; int ASN1_BIT_STRING_num_asc ( const char * name , BIT_STRING_BITNAME * tbl ) ; int ASN1_BIT_STRING_set_asc ( ASN1_BIT_STRING * bs , const char * name , int value , BIT_STRING_BITNAME * tbl ) ; DECLARE_ASN1_FUNCTIONS ( ASN1_INTEGER ) ASN1_INTEGER * d2i_ASN1_UINTEGER ( ASN1_INTEGER * * a , const unsigned char * * pp , long length ) ; ASN1_INTEGER * ASN1_INTEGER_dup ( const ASN1_INTEGER * x ) ; int ASN1_INTEGER_cmp ( const ASN1_INTEGER * x , const ASN1_INTEGER * y ) ; DECLARE_ASN1_FUNCTIONS ( ASN1_ENUMERATED ) int ASN1_UTCTIME_check ( const ASN1_UTCTIME * a ) ; ASN1_UTCTIME * ASN1_UTCTIME_set ( ASN1_UTCTIME * s , time_t t ) ; ASN1_UTCTIME * ASN1_UTCTIME_adj ( ASN1_UTCTIME * s , time_t t , int offset_day , long offset_sec ) ; int ASN1_UTCTIME_set_string ( ASN1_UTCTIME * s , const char * str ) ; int ASN1_UTCTIME_cmp_time_t ( const ASN1_UTCTIME * s , time_t t ) ; int ASN1_GENERALIZEDTIME_check ( const ASN1_GENERALIZEDTIME * a ) ; ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_set ( ASN1_GENERALIZEDTIME * s , time_t t ) ; ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_adj ( ASN1_GENERALIZEDTIME * s , time_t t , int offset_day , long offset_sec ) ; int ASN1_GENERALIZEDTIME_set_string ( ASN1_GENERALIZEDTIME * s , const char * str ) ; int ASN1_TIME_diff ( int * pday , int * psec , const ASN1_TIME * from , const ASN1_TIME * to ) ; DECLARE_ASN1_FUNCTIONS ( ASN1_OCTET_STRING )
0False
Categorize the following code snippet as vulnerable or not. True or False
static int32_t u_scanf_double_handler ( UFILE * input , u_scanf_spec_info * info , ufmt_args * args , const UChar * fmt , int32_t * fmtConsumed , int32_t * argConverted ) { ( void ) fmt ; ( void ) fmtConsumed ; int32_t len ; double num ; UNumberFormat * format ; int32_t parsePos = 0 ; int32_t skipped ; UErrorCode status = U_ZERO_ERROR ; skipped = u_scanf_skip_leading_ws ( input , info -> fPadChar ) ; ufile_fill_uchar_buffer ( input ) ; len = ( int32_t ) ( input -> str . fLimit - input -> str . fPos ) ; if ( info -> fWidth != - 1 ) len = ufmt_min ( len , info -> fWidth ) ; format = u_locbund_getNumberFormat ( & input -> str . fBundle , UNUM_DECIMAL ) ; if ( format == 0 ) return 0 ; skipped += u_scanf_skip_leading_positive_sign ( input , format , & status ) ; num = unum_parseDouble ( format , input -> str . fPos , len , & parsePos , & status ) ; if ( ! info -> fSkipArg ) { if ( info -> fIsLong ) * ( double * ) ( args [ 0 ] . ptrValue ) = num ; else if ( info -> fIsLongDouble ) * ( long double * ) ( args [ 0 ] . ptrValue ) = num ; else * ( float * ) ( args [ 0 ] . ptrValue ) = ( float ) num ; } input -> str . fPos += parsePos ; * argConverted = ! info -> fSkipArg ; return parsePos + skipped ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_Setup_UUIE ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 470 "./asn1/h225/h225.cnf" h225_packet_info * h225_pi ; contains_faststart = FALSE ; offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_Setup_UUIE , Setup_UUIE_sequence ) ; # line 475 "./asn1/h225/h225.cnf" h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ; if ( h225_pi != NULL ) { h225_pi -> cs_type = H225_SETUP ; if ( contains_faststart ) { char temp [ 50 ] ; g_snprintf ( temp , 50 , "%s OLC (%s)" , val_to_str ( h225_pi -> cs_type , T_h323_message_body_vals , "<unknown>" ) , h225_pi -> frame_label ) ; g_strlcpy ( h225_pi -> frame_label , temp , 50 ) ; } else g_snprintf ( h225_pi -> frame_label , 50 , "%s" , val_to_str ( h225_pi -> cs_type , T_h323_message_body_vals , "<unknown>" ) ) ; } return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void handle_no_error ( struct st_command * command ) { DBUG_ENTER ( "handle_no_error" ) ; if ( command -> expected_errors . err [ 0 ] . type == ERR_ERRNO && command -> expected_errors . err [ 0 ] . code . errnum != 0 ) { report_or_die ( "query '%s' succeeded - should have failed with errno %d..." , command -> query , command -> expected_errors . err [ 0 ] . code . errnum ) ; } else if ( command -> expected_errors . err [ 0 ] . type == ERR_SQLSTATE && strcmp ( command -> expected_errors . err [ 0 ] . code . sqlstate , "00000" ) != 0 ) { report_or_die ( "query '%s' succeeded - should have failed with " "sqlstate %s..." , command -> query , command -> expected_errors . err [ 0 ] . code . sqlstate ) ; } DBUG_VOID_RETURN ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int kvm_arch_init ( MachineState * ms , KVMState * s ) { uint64_t identity_base = 0xfffbc000 ; uint64_t shadow_mem ; int ret ; struct utsname utsname ; # ifdef KVM_CAP_XSAVE has_xsave = kvm_check_extension ( s , KVM_CAP_XSAVE ) ; # endif # ifdef KVM_CAP_XCRS has_xcrs = kvm_check_extension ( s , KVM_CAP_XCRS ) ; # endif # ifdef KVM_CAP_PIT_STATE2 has_pit_state2 = kvm_check_extension ( s , KVM_CAP_PIT_STATE2 ) ; # endif ret = kvm_get_supported_msrs ( s ) ; if ( ret < 0 ) { return ret ; } uname ( & utsname ) ; lm_capable_kernel = strcmp ( utsname . machine , "x86_64" ) == 0 ; if ( kvm_check_extension ( s , KVM_CAP_SET_IDENTITY_MAP_ADDR ) ) { identity_base = 0xfeffc000 ; ret = kvm_vm_ioctl ( s , KVM_SET_IDENTITY_MAP_ADDR , & identity_base ) ; if ( ret < 0 ) { return ret ; } } ret = kvm_vm_ioctl ( s , KVM_SET_TSS_ADDR , identity_base + 0x1000 ) ; if ( ret < 0 ) { return ret ; } ret = e820_add_entry ( identity_base , 0x4000 , E820_RESERVED ) ; if ( ret < 0 ) { fprintf ( stderr , "e820_add_entry() table is full\n" ) ; return ret ; } qemu_register_reset ( kvm_unpoison_all , NULL ) ; shadow_mem = machine_kvm_shadow_mem ( ms ) ; if ( shadow_mem != - 1 ) { shadow_mem /= 4096 ; ret = kvm_vm_ioctl ( s , KVM_SET_NR_MMU_PAGES , shadow_mem ) ; if ( ret < 0 ) { return ret ; } } if ( kvm_check_extension ( s , KVM_CAP_X86_SMM ) && object_dynamic_cast ( OBJECT ( ms ) , TYPE_PC_MACHINE ) && pc_machine_is_smm_enabled ( PC_MACHINE ( ms ) ) ) { smram_machine_done . notify = register_smram_listener ; qemu_add_machine_init_done_notifier ( & smram_machine_done ) ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
afs_int32 SPR_Delete ( struct rx_call * call , afs_int32 aid ) { afs_int32 code ; afs_int32 cid = ANONYMOUSID ; code = Delete ( call , aid , & cid ) ; osi_auditU ( call , PTS_DelEvent , code , AUD_ID , aid , AUD_END ) ; ViceLog ( 5 , ( "PTS_Delete: code %d cid %d aid %d\n" , code , cid , aid ) ) ; return code ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static uint32_t e1000e_mac_low ## num ## _read ( E1000ECore * core , int index ) { return core -> mac [ index ] & ( BIT ( num ) - 1 ) ; } # define E1000E_LOW_BITS_READ ( num ) e1000e_mac_low ## num ## _read E1000E_LOW_BITS_READ_FUNC ( 4 ) ; E1000E_LOW_BITS_READ_FUNC ( 6 )
0False
Categorize the following code snippet as vulnerable or not. True or False
static void modify_environment ( const struct passwd * pw , const char * shell ) { if ( simulate_login ) { char * term = getenv ( "TERM" ) ; if ( term ) term = xstrdup ( term ) ; environ = xmalloc ( ( 6 + ! ! term ) * sizeof ( char * ) ) ; environ [ 0 ] = NULL ; if ( term ) { xsetenv ( "TERM" , term , 1 ) ; free ( term ) ; } xsetenv ( "HOME" , pw -> pw_dir , 1 ) ; if ( shell ) xsetenv ( "SHELL" , shell , 1 ) ; xsetenv ( "USER" , pw -> pw_name , 1 ) ; xsetenv ( "LOGNAME" , pw -> pw_name , 1 ) ; set_path ( pw ) ; } else { if ( change_environment ) { xsetenv ( "HOME" , pw -> pw_dir , 1 ) ; if ( shell ) xsetenv ( "SHELL" , shell , 1 ) ; if ( getlogindefs_bool ( "ALWAYS_SET_PATH" , 0 ) ) set_path ( pw ) ; if ( pw -> pw_uid ) { xsetenv ( "USER" , pw -> pw_name , 1 ) ; xsetenv ( "LOGNAME" , pw -> pw_name , 1 ) ; } } } export_pamenv ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static TRBCCode xhci_get_port_bandwidth ( XHCIState * xhci , uint64_t pctx ) { dma_addr_t ctx ; uint8_t bw_ctx [ xhci -> numports + 1 ] ; DPRINTF ( "xhci_get_port_bandwidth()\n" ) ; ctx = xhci_mask64 ( pctx ) ; DPRINTF ( "xhci: bandwidth context at " DMA_ADDR_FMT "\n" , ctx ) ; bw_ctx [ 0 ] = 0 ; memset ( & bw_ctx [ 1 ] , 80 , xhci -> numports ) ; pci_dma_write ( PCI_DEVICE ( xhci ) , ctx , bw_ctx , sizeof ( bw_ctx ) ) ; return CC_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int x ( struct vcache * avc , int afun , struct vrequest * areq , \ struct afs_pdata * ain , struct afs_pdata * aout , \ afs_ucred_t * * acred ) DECL_PIOCTL ( PGetFID ) ; DECL_PIOCTL ( PSetAcl ) ; DECL_PIOCTL ( PStoreBehind ) ; DECL_PIOCTL ( PGCPAGs ) ; DECL_PIOCTL ( PGetAcl ) ; DECL_PIOCTL ( PNoop ) ; DECL_PIOCTL ( PBogus ) ; DECL_PIOCTL ( PGetFileCell ) ; DECL_PIOCTL ( PGetWSCell ) ; DECL_PIOCTL ( PGetUserCell ) ; DECL_PIOCTL ( PSetTokens ) ; DECL_PIOCTL ( PGetVolumeStatus ) ; DECL_PIOCTL ( PSetVolumeStatus ) ; DECL_PIOCTL ( PFlush ) ; DECL_PIOCTL ( PNewStatMount ) ; DECL_PIOCTL ( PGetTokens ) ; DECL_PIOCTL ( PUnlog ) ; DECL_PIOCTL ( PMariner ) ; DECL_PIOCTL ( PCheckServers ) ; DECL_PIOCTL ( PCheckVolNames ) ; DECL_PIOCTL ( PCheckAuth ) ; DECL_PIOCTL ( PFindVolume ) ; DECL_PIOCTL ( PViceAccess ) ; DECL_PIOCTL ( PSetCacheSize ) ; DECL_PIOCTL ( PGetCacheSize ) ; DECL_PIOCTL ( PRemoveCallBack ) ; DECL_PIOCTL ( PNewCell ) ; DECL_PIOCTL ( PNewAlias ) ; DECL_PIOCTL ( PListCells ) ; DECL_PIOCTL ( PListAliases ) ; DECL_PIOCTL ( PRemoveMount ) ; DECL_PIOCTL ( PGetCellStatus ) ; DECL_PIOCTL ( PSetCellStatus ) ; DECL_PIOCTL ( PFlushVolumeData ) ; DECL_PIOCTL ( PFlushAllVolumeData ) ; DECL_PIOCTL ( PGetVnodeXStatus ) ; DECL_PIOCTL ( PGetVnodeXStatus2 ) ; DECL_PIOCTL ( PSetSysName ) ; DECL_PIOCTL ( PSetSPrefs ) ; DECL_PIOCTL ( PSetSPrefs33 ) ; DECL_PIOCTL ( PGetSPrefs ) ; DECL_PIOCTL ( PExportAfs ) ; DECL_PIOCTL ( PGag ) ; DECL_PIOCTL ( PTwiddleRx ) ; DECL_PIOCTL ( PGetInitParams ) ; DECL_PIOCTL ( PGetRxkcrypt ) ; DECL_PIOCTL ( PSetRxkcrypt ) ; DECL_PIOCTL ( PGetCPrefs ) ; DECL_PIOCTL ( PSetCPrefs ) ; DECL_PIOCTL ( PFlushMount ) ; DECL_PIOCTL ( PRxStatProc ) ; DECL_PIOCTL ( PRxStatPeer ) ; DECL_PIOCTL ( PPrefetchFromTape ) ; DECL_PIOCTL ( PFsCmd ) ; DECL_PIOCTL ( PCallBackAddr ) ; DECL_PIOCTL ( PDiscon )
0False
Categorize the following code snippet as vulnerable or not. True or False
void srtp_event_reporter ( srtp_event_data_t * data ) { err_report ( err_level_warning , "srtp: in stream 0x%x: " , data -> stream -> ssrc ) ; switch ( data -> event ) { case event_ssrc_collision : err_report ( err_level_warning , "\tSSRC collision\n" ) ; break ; case event_key_soft_limit : err_report ( err_level_warning , "\tkey usage soft limit reached\n" ) ; break ; case event_key_hard_limit : err_report ( err_level_warning , "\tkey usage hard limit reached\n" ) ; break ; case event_packet_index_limit : err_report ( err_level_warning , "\tpacket index limit reached\n" ) ; break ; default : err_report ( err_level_warning , "\tunknown event reported to handler\n" ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline PixelTrait GetPixelChannelTraits ( const Image * restrict image , const PixelChannel channel ) { return ( image -> channel_map [ channel ] . traits ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void e1000e_parse_rxbufsize ( E1000ECore * core ) { uint32_t rctl = core -> mac [ RCTL ] ; memset ( core -> rxbuf_sizes , 0 , sizeof ( core -> rxbuf_sizes ) ) ; if ( rctl & E1000_RCTL_DTYP_MASK ) { uint32_t bsize ; bsize = core -> mac [ PSRCTL ] & E1000_PSRCTL_BSIZE0_MASK ; core -> rxbuf_sizes [ 0 ] = ( bsize >> E1000_PSRCTL_BSIZE0_SHIFT ) * 128 ; bsize = core -> mac [ PSRCTL ] & E1000_PSRCTL_BSIZE1_MASK ; core -> rxbuf_sizes [ 1 ] = ( bsize >> E1000_PSRCTL_BSIZE1_SHIFT ) * 1024 ; bsize = core -> mac [ PSRCTL ] & E1000_PSRCTL_BSIZE2_MASK ; core -> rxbuf_sizes [ 2 ] = ( bsize >> E1000_PSRCTL_BSIZE2_SHIFT ) * 1024 ; bsize = core -> mac [ PSRCTL ] & E1000_PSRCTL_BSIZE3_MASK ; core -> rxbuf_sizes [ 3 ] = ( bsize >> E1000_PSRCTL_BSIZE3_SHIFT ) * 1024 ; } else if ( rctl & E1000_RCTL_FLXBUF_MASK ) { int flxbuf = rctl & E1000_RCTL_FLXBUF_MASK ; core -> rxbuf_sizes [ 0 ] = ( flxbuf >> E1000_RCTL_FLXBUF_SHIFT ) * 1024 ; } else { core -> rxbuf_sizes [ 0 ] = e1000x_rxbufsize ( rctl ) ; } trace_e1000e_rx_desc_buff_sizes ( core -> rxbuf_sizes [ 0 ] , core -> rxbuf_sizes [ 1 ] , core -> rxbuf_sizes [ 2 ] , core -> rxbuf_sizes [ 3 ] ) ; e1000e_calc_per_desc_buf_size ( core ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int jbig2_decode_mmr_line ( Jbig2MmrCtx * mmr , const byte * ref , byte * dst ) { int a0 = - 1 ; int a1 , a2 , b1 , b2 ; int c = 0 ; while ( 1 ) { uint32_t word = mmr -> word ; if ( a0 >= mmr -> width ) break ; if ( ( word >> ( 32 - 3 ) ) == 1 ) { int white_run , black_run ; jbig2_decode_mmr_consume ( mmr , 3 ) ; if ( a0 == - 1 ) a0 = 0 ; if ( c == 0 ) { white_run = jbig2_decode_get_run ( mmr , jbig2_mmr_white_decode , 8 ) ; black_run = jbig2_decode_get_run ( mmr , jbig2_mmr_black_decode , 7 ) ; a1 = a0 + white_run ; a2 = a1 + black_run ; if ( a1 > mmr -> width ) a1 = mmr -> width ; if ( a2 > mmr -> width ) a2 = mmr -> width ; if ( a2 < a1 || a1 < 0 ) return - 1 ; jbig2_set_bits ( dst , a1 , a2 ) ; a0 = a2 ; } else { black_run = jbig2_decode_get_run ( mmr , jbig2_mmr_black_decode , 7 ) ; white_run = jbig2_decode_get_run ( mmr , jbig2_mmr_white_decode , 8 ) ; a1 = a0 + black_run ; a2 = a1 + white_run ; if ( a1 > mmr -> width ) a1 = mmr -> width ; if ( a2 > mmr -> width ) a2 = mmr -> width ; if ( a1 < a0 || a0 < 0 ) return - 1 ; jbig2_set_bits ( dst , a0 , a1 ) ; a0 = a2 ; } } else if ( ( word >> ( 32 - 4 ) ) == 1 ) { jbig2_decode_mmr_consume ( mmr , 4 ) ; b1 = jbig2_find_changing_element_of_color ( ref , a0 , mmr -> width , ! c ) ; b2 = jbig2_find_changing_element ( ref , b1 , mmr -> width ) ; if ( c ) { if ( b2 < a0 || a0 < 0 ) return - 1 ; jbig2_set_bits ( dst , a0 , b2 ) ; } a0 = b2 ; } else if ( ( word >> ( 32 - 1 ) ) == 1 ) { jbig2_decode_mmr_consume ( mmr , 1 ) ; b1 = jbig2_find_changing_element_of_color ( ref , a0 , mmr -> width , ! c ) ; if ( c ) { if ( b1 < a0 || a0 < 0 ) return - 1 ; jbig2_set_bits ( dst , a0 , b1 ) ; } a0 = b1 ; c = ! c ; } else if ( ( word >> ( 32 - 3 ) ) == 3 ) { jbig2_decode_mmr_consume ( mmr , 3 ) ; b1 = jbig2_find_changing_element_of_color ( ref , a0 , mmr -> width , ! c ) ; if ( b1 + 1 > mmr -> width ) break ; if ( c ) { if ( b1 + 1 < a0 || a0 < 0 ) return - 1 ; jbig2_set_bits ( dst , a0 , b1 + 1 ) ; } a0 = b1 + 1 ; c = ! c ; } else if ( ( word >> ( 32 - 6 ) ) == 3 ) { jbig2_decode_mmr_consume ( mmr , 6 ) ; b1 = jbig2_find_changing_element_of_color ( ref , a0 , mmr -> width , ! c ) ; if ( b1 + 2 > mmr -> width ) break ; if ( c ) { if ( b1 + 2 < a0 || a0 < 0 ) return - 1 ; jbig2_set_bits ( dst , a0 , b1 + 2 ) ; } a0 = b1 + 2 ; c = ! c ; } else if ( ( word >> ( 32 - 7 ) ) == 3 ) { jbig2_decode_mmr_consume ( mmr , 7 ) ; b1 = jbig2_find_changing_element_of_color ( ref , a0 , mmr -> width , ! c ) ; if ( b1 + 3 > mmr -> width ) break ; if ( c ) { if ( b1 + 3 < a0 || a0 < 0 ) return - 1 ; jbig2_set_bits ( dst , a0 , b1 + 3 ) ; } a0 = b1 + 3 ; c = ! c ; } else if ( ( word >> ( 32 - 3 ) ) == 2 ) { jbig2_decode_mmr_consume ( mmr , 3 ) ; b1 = jbig2_find_changing_element_of_color ( ref , a0 , mmr -> width , ! c ) ; if ( b1 - 1 < 0 ) break ; if ( c ) { if ( b1 - 1 < a0 || a0 < 0 ) return - 1 ; jbig2_set_bits ( dst , a0 , b1 - 1 ) ; } a0 = b1 - 1 ; c = ! c ; } else if ( ( word >> ( 32 - 6 ) ) == 2 ) { jbig2_decode_mmr_consume ( mmr , 6 ) ; b1 = jbig2_find_changing_element_of_color ( ref , a0 , mmr -> width , ! c ) ; if ( b1 - 2 < 0 ) break ; if ( c ) { if ( b1 - 2 < a0 || a0 < 0 ) return - 1 ; jbig2_set_bits ( dst , a0 , b1 - 2 ) ; } a0 = b1 - 2 ; c = ! c ; } else if ( ( word >> ( 32 - 7 ) ) == 2 ) { jbig2_decode_mmr_consume ( mmr , 7 ) ; b1 = jbig2_find_changing_element_of_color ( ref , a0 , mmr -> width , ! c ) ; if ( b1 - 3 < 0 ) break ; if ( c ) { if ( b1 - 3 < a0 || a0 < 0 ) return - 1 ; jbig2_set_bits ( dst , a0 , b1 - 3 ) ; } a0 = b1 - 3 ; c = ! c ; } else break ; } return 0 ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
hb_shape_plan_t * hb_shape_plan_create_cached ( hb_face_t * face , const hb_segment_properties_t * props , const hb_feature_t * user_features , unsigned int num_user_features , const char * const * shaper_list ) { DEBUG_MSG_FUNC ( SHAPE_PLAN , NULL , "face=%p num_features=%d shaper_list=%p" , face , num_user_features , shaper_list ) ; hb_shape_plan_proposal_t proposal = { * props , shaper_list , user_features , num_user_features , NULL } ; if ( shaper_list ) { for ( const char * const * shaper_item = shaper_list ; * shaper_item ; shaper_item ++ ) if ( 0 ) ; # define HB_SHAPER_IMPLEMENT ( shaper ) else if ( 0 == strcmp ( * shaper_item , # shaper ) && hb_ ## shaper ## _shaper_face_data_ensure ( face ) ) { proposal . shaper_func = _hb_ ## shaper ## _shape ; break ; } # include "hb-shaper-list.hh" # undef HB_SHAPER_IMPLEMENT if ( unlikely ( ! proposal . shaper_func ) ) return hb_shape_plan_get_empty ( ) ; } retry : hb_face_t : : plan_node_t * cached_plan_nodes = ( hb_face_t : : plan_node_t * ) hb_atomic_ptr_get ( & face -> shape_plans ) ; for ( hb_face_t : : plan_node_t * node = cached_plan_nodes ; node ; node = node -> next ) if ( hb_shape_plan_matches ( node -> shape_plan , & proposal ) ) { DEBUG_MSG_FUNC ( SHAPE_PLAN , node -> shape_plan , "fulfilled from cache" ) ; return hb_shape_plan_reference ( node -> shape_plan ) ; } hb_shape_plan_t * shape_plan = hb_shape_plan_create ( face , props , user_features , num_user_features , shaper_list ) ; if ( hb_non_global_user_features_present ( user_features , num_user_features ) ) return shape_plan ; hb_face_t : : plan_node_t * node = ( hb_face_t : : plan_node_t * ) calloc ( 1 , sizeof ( hb_face_t : : plan_node_t ) ) ; if ( unlikely ( ! node ) ) return shape_plan ; node -> shape_plan = shape_plan ; node -> next = cached_plan_nodes ; if ( ! hb_atomic_ptr_cmpexch ( & face -> shape_plans , cached_plan_nodes , node ) ) { hb_shape_plan_destroy ( shape_plan ) ; free ( node ) ; goto retry ; } DEBUG_MSG_FUNC ( SHAPE_PLAN , shape_plan , "inserted into cache" ) ; return hb_shape_plan_reference ( shape_plan ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void cpTags ( TIFF * in , TIFF * out ) { struct cpTag * p ; for ( p = tags ; p < & tags [ NTAGS ] ; p ++ ) cpTag ( in , out , p -> tag , p -> count , p -> type ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void mi_disable_non_unique_index ( MI_INFO * info , ha_rows rows ) { MYISAM_SHARE * share = info -> s ; MI_KEYDEF * key = share -> keyinfo ; uint i ; DBUG_ASSERT ( info -> state -> records == 0 && ( ! rows || rows >= MI_MIN_ROWS_TO_DISABLE_INDEXES ) ) ; for ( i = 0 ; i < share -> base . keys ; i ++ , key ++ ) { if ( ! ( key -> flag & ( HA_NOSAME | HA_SPATIAL | HA_AUTO_KEY ) ) && ! mi_too_big_key_for_sort ( key , rows ) && info -> s -> base . auto_key != i + 1 ) { mi_clear_key_active ( share -> state . key_map , i ) ; info -> update |= HA_STATE_CHANGED ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static bool lxc_cgroupfs_attach ( const char * name , const char * lxcpath , pid_t pid ) { struct cgroup_meta_data * meta_data ; struct cgroup_process_info * container_info ; int ret ; meta_data = lxc_cgroup_load_meta ( ) ; if ( ! meta_data ) { ERROR ( "could not move attached process %d to cgroup of container" , pid ) ; return false ; } container_info = lxc_cgroup_get_container_info ( name , lxcpath , meta_data ) ; lxc_cgroup_put_meta ( meta_data ) ; if ( ! container_info ) { ERROR ( "could not move attached process %d to cgroup of container" , pid ) ; return false ; } ret = lxc_cgroupfs_enter ( container_info , pid , false ) ; lxc_cgroup_process_info_free ( container_info ) ; if ( ret < 0 ) { ERROR ( "could not move attached process %d to cgroup of container" , pid ) ; return false ; } return true ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( ExtensionServiceSyncTest , DeferredSyncStartupOnInstall ) { InitializeEmptyExtensionService ( ) ; service ( ) -> Init ( ) ; ASSERT_TRUE ( service ( ) -> is_ready ( ) ) ; bool flare_was_called = false ; syncer : : ModelType triggered_type ( syncer : : UNSPECIFIED ) ; base : : WeakPtrFactory < ExtensionServiceSyncTest > factory ( this ) ; extension_sync_service ( ) -> SetSyncStartFlareForTesting ( base : : Bind ( & ExtensionServiceSyncTest : : MockSyncStartFlare , factory . GetWeakPtr ( ) , & flare_was_called , & triggered_type ) ) ; base : : FilePath path = data_dir ( ) . AppendASCII ( "good.crx" ) ; InstallCRX ( path , INSTALL_NEW ) ; EXPECT_TRUE ( flare_was_called ) ; EXPECT_EQ ( syncer : : EXTENSIONS , triggered_type ) ; flare_was_called = false ; triggered_type = syncer : : UNSPECIFIED ; extension_sync_service ( ) -> MergeDataAndStartSyncing ( syncer : : EXTENSIONS , syncer : : SyncDataList ( ) , base : : MakeUnique < syncer : : FakeSyncChangeProcessor > ( ) , base : : MakeUnique < syncer : : SyncErrorFactoryMock > ( ) ) ; path = data_dir ( ) . AppendASCII ( "page_action.crx" ) ; InstallCRX ( path , INSTALL_NEW ) ; EXPECT_FALSE ( flare_was_called ) ; ASSERT_EQ ( syncer : : UNSPECIFIED , triggered_type ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int config_filter_parser_cmp_rev ( struct config_filter_parser * const * p1 , struct config_filter_parser * const * p2 ) { return - config_filter_parser_cmp ( p1 , p2 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int pdf_xobject_knockout ( fz_context * ctx , pdf_xobject * xobj ) { pdf_obj * group = pdf_dict_get ( ctx , xobj -> obj , PDF_NAME_Group ) ; if ( group ) return pdf_to_bool ( ctx , pdf_dict_get ( ctx , group , PDF_NAME_K ) ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void setup_syllables ( const hb_ot_shape_plan_t * plan HB_UNUSED , hb_font_t * font HB_UNUSED , hb_buffer_t * buffer ) { find_syllables ( buffer ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_Setup_UUIE ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 466 "./asn1/h225/h225.cnf" h225_packet_info * h225_pi ; contains_faststart = FALSE ; offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_Setup_UUIE , Setup_UUIE_sequence ) ; # line 471 "./asn1/h225/h225.cnf" h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ; if ( h225_pi != NULL ) { h225_pi -> cs_type = H225_SETUP ; if ( contains_faststart == TRUE ) g_snprintf ( h225_pi -> frame_label , 50 , "%s OLC (%s)" , val_to_str ( h225_pi -> cs_type , T_h323_message_body_vals , "<unknown>" ) , h225_pi -> frame_label ) ; else g_snprintf ( h225_pi -> frame_label , 50 , "%s" , val_to_str ( h225_pi -> cs_type , T_h323_message_body_vals , "<unknown>" ) ) ; } return offset ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
MIMEField * mime_hdr_field_find ( MIMEHdrImpl * mh , const char * field_name_str , int field_name_len ) { HdrTokenHeapPrefix * token_info ; const bool is_wks = hdrtoken_is_wks ( field_name_str ) ; ink_assert ( field_name_len >= 0 ) ; # if TRACK_FIELD_FIND_CALLS Debug ( "http" , "mime_hdr_field_find(hdr 0x%X, field %.*s): is_wks = %d" , mh , field_name_len , field_name_str , is_wks ) ; # endif if ( is_wks ) { token_info = hdrtoken_wks_to_prefix ( field_name_str ) ; if ( ( token_info -> wks_info . mask ) && ( ( mh -> m_presence_bits & token_info -> wks_info . mask ) == 0 ) ) { # if TRACK_FIELD_FIND_CALLS Debug ( "http" , "mime_hdr_field_find(hdr 0x%X, field %.*s): MISS (due to presence bits)" , mh , field_name_len , field_name_str ) ; # endif return nullptr ; } int32_t slot_id = token_info -> wks_info . slotid ; if ( slot_id != MIME_SLOTID_NONE ) { uint32_t slotnum = mime_hdr_get_accelerator_slotnum ( mh , slot_id ) ; if ( slotnum != MIME_FIELD_SLOTNUM_UNKNOWN ) { MIMEField * f = _mime_hdr_field_list_search_by_slotnum ( mh , slotnum ) ; ink_assert ( ( f == nullptr ) || f -> is_live ( ) ) ; # if TRACK_FIELD_FIND_CALLS Debug ( "http" , "mime_hdr_field_find(hdr 0x%X, field %.*s): %s (due to slot accelerators)" , mh , field_name_len , field_name_str , ( f ? "HIT" : "MISS" ) ) ; # endif return f ; } else { # if TRACK_FIELD_FIND_CALLS Debug ( "http" , "mime_hdr_field_find(hdr 0x%X, field %.*s): UNKNOWN (slot too big)" , mh , field_name_len , field_name_str ) ; # endif } } MIMEField * f = _mime_hdr_field_list_search_by_wks ( mh , token_info -> wks_idx ) ; ink_assert ( ( f == nullptr ) || f -> is_live ( ) ) ; # if TRACK_FIELD_FIND_CALLS Debug ( "http" , "mime_hdr_field_find(hdr 0x%X, field %.*s): %s (due to WKS list walk)" , mh , field_name_len , field_name_str , ( f ? "HIT" : "MISS" ) ) ; # endif return f ; } else { MIMEField * f = _mime_hdr_field_list_search_by_string ( mh , field_name_str , field_name_len ) ; ink_assert ( ( f == nullptr ) || f -> is_live ( ) ) ; # if TRACK_FIELD_FIND_CALLS Debug ( "http" , "mime_hdr_field_find(hdr 0x%X, field %.*s): %s (due to strcmp list walk)" , mh , field_name_len , field_name_str , ( f ? "HIT" : "MISS" ) ) ; # endif return f ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int decode_wmv9 ( AVCodecContext * avctx , const uint8_t * buf , int buf_size , int x , int y , int w , int h , int wmv9_mask ) { MSS2Context * ctx = avctx -> priv_data ; MSS12Context * c = & ctx -> c ; VC1Context * v = avctx -> priv_data ; MpegEncContext * s = & v -> s ; AVFrame * f ; int ret ; ff_mpeg_flush ( avctx ) ; if ( s -> current_picture_ptr == NULL || s -> current_picture_ptr -> f . data [ 0 ] ) { int i = ff_find_unused_picture ( s , 0 ) ; if ( i < 0 ) return i ; s -> current_picture_ptr = & s -> picture [ i ] ; } init_get_bits ( & s -> gb , buf , buf_size * 8 ) ; s -> loop_filter = avctx -> skip_loop_filter < AVDISCARD_ALL ; if ( ff_vc1_parse_frame_header ( v , & s -> gb ) == - 1 ) { av_log ( v -> s . avctx , AV_LOG_ERROR , "header error\n" ) ; return AVERROR_INVALIDDATA ; } if ( s -> pict_type != AV_PICTURE_TYPE_I ) { av_log ( v -> s . avctx , AV_LOG_ERROR , "expected I-frame\n" ) ; return AVERROR_INVALIDDATA ; } avctx -> pix_fmt = AV_PIX_FMT_YUV420P ; if ( ( ret = ff_MPV_frame_start ( s , avctx ) ) < 0 ) { av_log ( v -> s . avctx , AV_LOG_ERROR , "ff_MPV_frame_start error\n" ) ; avctx -> pix_fmt = AV_PIX_FMT_RGB24 ; return ret ; } ff_mpeg_er_frame_start ( s ) ; v -> bits = buf_size * 8 ; v -> end_mb_x = ( w + 15 ) >> 4 ; s -> end_mb_y = ( h + 15 ) >> 4 ; if ( v -> respic & 1 ) v -> end_mb_x = v -> end_mb_x + 1 >> 1 ; if ( v -> respic & 2 ) s -> end_mb_y = s -> end_mb_y + 1 >> 1 ; ff_vc1_decode_blocks ( v ) ; ff_er_frame_end ( & s -> er ) ; ff_MPV_frame_end ( s ) ; f = & s -> current_picture . f ; if ( v -> respic == 3 ) { ctx -> dsp . upsample_plane ( f -> data [ 0 ] , f -> linesize [ 0 ] , w , h ) ; ctx -> dsp . upsample_plane ( f -> data [ 1 ] , f -> linesize [ 1 ] , w >> 1 , h >> 1 ) ; ctx -> dsp . upsample_plane ( f -> data [ 2 ] , f -> linesize [ 2 ] , w >> 1 , h >> 1 ) ; } else if ( v -> respic ) av_log_ask_for_sample ( v -> s . avctx , "Asymmetric WMV9 rectangle subsampling\n" ) ; av_assert0 ( f -> linesize [ 1 ] == f -> linesize [ 2 ] ) ; if ( wmv9_mask != - 1 ) ctx -> dsp . mss2_blit_wmv9_masked ( c -> rgb_pic + y * c -> rgb_stride + x * 3 , c -> rgb_stride , wmv9_mask , c -> pal_pic + y * c -> pal_stride + x , c -> pal_stride , f -> data [ 0 ] , f -> linesize [ 0 ] , f -> data [ 1 ] , f -> data [ 2 ] , f -> linesize [ 1 ] , w , h ) ; else ctx -> dsp . mss2_blit_wmv9 ( c -> rgb_pic + y * c -> rgb_stride + x * 3 , c -> rgb_stride , f -> data [ 0 ] , f -> linesize [ 0 ] , f -> data [ 1 ] , f -> data [ 2 ] , f -> linesize [ 1 ] , w , h ) ; avctx -> pix_fmt = AV_PIX_FMT_RGB24 ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const char * cmd_rule_update_target_by_tag ( cmd_parms * cmd , void * _dcfg , const char * p1 , const char * p2 , const char * p3 ) { directory_config * dcfg = ( directory_config * ) _dcfg ; rule_exception * re = apr_pcalloc ( cmd -> pool , sizeof ( rule_exception ) ) ; if ( dcfg == NULL ) return NULL ; if ( p1 == NULL ) { return apr_psprintf ( cmd -> pool , "Updating target by tag with no tag" ) ; } re -> type = RULE_EXCEPTION_REMOVE_TAG ; re -> param = p1 ; re -> param_data = msc_pregcomp ( cmd -> pool , p1 , 0 , NULL , NULL ) ; if ( re -> param_data == NULL ) { return apr_psprintf ( cmd -> pool , "ModSecurity: Invalid regular expression: %s" , p1 ) ; } return msre_ruleset_rule_update_target_matching_exception ( NULL , dcfg -> ruleset , re , p2 , p3 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void qtest_clock_warp ( int64_t dest ) { int64_t clock = qemu_get_clock_ns ( vm_clock ) ; assert ( qtest_enabled ( ) ) ; while ( clock < dest ) { int64_t deadline = qemu_clock_deadline ( vm_clock ) ; int64_t warp = MIN ( dest - clock , deadline ) ; qemu_icount_bias += warp ; qemu_run_timers ( vm_clock ) ; clock = qemu_get_clock_ns ( vm_clock ) ; } qemu_notify_event ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int init_nss_crypto ( struct crypto_instance * instance ) { if ( ! cipher_to_nss [ instance -> crypto_cipher_type ] ) { return 0 ; } instance -> nss_sym_key = import_symmetric_key ( instance , SYM_KEY_TYPE_CRYPT ) ; if ( instance -> nss_sym_key == NULL ) { return - 1 ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( HttpsEngagementPageLoadMetricsBrowserTest , Simple_Https ) { StartHttpsServer ( false ) ; base : : TimeDelta upper_bound = NavigateInForegroundAndCloseWithTiming ( https_test_server_ -> GetURL ( "/simple.html" ) ) ; histogram_tester_ . ExpectTotalCount ( internal : : kHttpEngagementHistogram , 0 ) ; histogram_tester_ . ExpectTotalCount ( internal : : kHttpsEngagementHistogram , 1 ) ; int32_t bucket_min = histogram_tester_ . GetAllSamples ( internal : : kHttpsEngagementHistogram ) [ 0 ] . min ; EXPECT_GE ( upper_bound . InMilliseconds ( ) , bucket_min ) ; EXPECT_LT ( 0 , bucket_min ) ; FakeUserMetricsUpload ( ) ; histogram_tester_ . ExpectTotalCount ( internal : : kHttpsEngagementSessionPercentage , 1 ) ; int32_t ratio_bucket = histogram_tester_ . GetAllSamples ( internal : : kHttpsEngagementSessionPercentage ) [ 0 ] . min ; EXPECT_EQ ( 100 , ratio_bucket ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void config_logconfig ( config_tree * ptree ) { attr_val * my_lc ; my_lc = HEAD_PFIFO ( ptree -> logconfig ) ; for ( ; my_lc != NULL ; my_lc = my_lc -> link ) { switch ( my_lc -> attr ) { case '+' : ntp_syslogmask |= get_logmask ( my_lc -> value . s ) ; break ; case '-' : ntp_syslogmask &= ~ get_logmask ( my_lc -> value . s ) ; break ; case '=' : ntp_syslogmask = get_logmask ( my_lc -> value . s ) ; break ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int checksum_block ( const char * s , int len ) { int sum = 0 ; while ( len -- ) { sum ^= * s ++ ; } return sum ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void update_remote_info_refs ( struct remote_lock * lock ) { struct buffer buffer = { STRBUF_INIT , 0 } ; struct active_request_slot * slot ; struct slot_results results ; struct curl_slist * dav_headers ; remote_ls ( "refs/" , ( PROCESS_FILES | RECURSIVE ) , add_remote_info_ref , & buffer . buf ) ; if ( ! aborted ) { dav_headers = get_dav_token_headers ( lock , DAV_HEADER_IF ) ; slot = get_active_slot ( ) ; slot -> results = & results ; curl_setup_http ( slot -> curl , lock -> url , DAV_PUT , & buffer , fwrite_null ) ; curl_easy_setopt ( slot -> curl , CURLOPT_HTTPHEADER , dav_headers ) ; if ( start_active_slot ( slot ) ) { run_active_slot ( slot ) ; if ( results . curl_result != CURLE_OK ) { fprintf ( stderr , "PUT error: curl result=%d, HTTP code=%ld\n" , results . curl_result , results . http_code ) ; } } } strbuf_release ( & buffer . buf ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void setup_frame_size_with_refs ( VP9_COMMON * cm , struct vp9_read_bit_buffer * rb ) { int width , height ; int found = 0 , i ; for ( i = 0 ; i < REFS_PER_FRAME ; ++ i ) { if ( vp9_rb_read_bit ( rb ) ) { YV12_BUFFER_CONFIG * const buf = cm -> frame_refs [ i ] . buf ; width = buf -> y_crop_width ; height = buf -> y_crop_height ; found = 1 ; break ; } } if ( ! found ) vp9_read_frame_size ( rb , & width , & height ) ; for ( i = 0 ; i < REFS_PER_FRAME ; ++ i ) { RefBuffer * const ref_frame = & cm -> frame_refs [ i ] ; const int ref_width = ref_frame -> buf -> y_width ; const int ref_height = ref_frame -> buf -> y_height ; if ( ! valid_ref_frame_size ( ref_width , ref_height , width , height ) ) vpx_internal_error ( & cm -> error , VPX_CODEC_CORRUPT_FRAME , "Referenced frame has invalid size" ) ; } apply_frame_size ( cm , width , height ) ; setup_display_size ( cm , rb ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
char * FLTGetExpressionForValuesRanges ( layerObj * lp , const char * item , const char * value , int forcecharcter ) { int bIscharacter , bSqlLayer = MS_FALSE ; char * pszExpression = NULL , * pszEscapedStr = NULL , * pszTmpExpression = NULL ; char * * paszElements = NULL , * * papszRangeElements = NULL ; int numelements , i , nrangeelements ; if ( lp && item && value ) { if ( strstr ( value , "/" ) == NULL ) { paszElements = msStringSplit ( value , ',' , & numelements ) ; if ( paszElements && numelements > 0 ) { if ( forcecharcter ) bIscharacter = MS_TRUE ; bIscharacter = ! FLTIsNumeric ( paszElements [ 0 ] ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , "(" ) ; for ( i = 0 ; i < numelements ; i ++ ) { pszTmpExpression = msStringConcatenate ( pszTmpExpression , "(" ) ; if ( bSqlLayer ) pszTmpExpression = msStringConcatenate ( pszTmpExpression , item ) ; else { if ( bIscharacter ) pszTmpExpression = msStringConcatenate ( pszTmpExpression , "\"" ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , "[" ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , item ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , "]" ) ; if ( bIscharacter ) pszTmpExpression = msStringConcatenate ( pszTmpExpression , "\"" ) ; } if ( bIscharacter ) { if ( bSqlLayer ) pszTmpExpression = msStringConcatenate ( pszTmpExpression , " = '" ) ; else pszTmpExpression = msStringConcatenate ( pszTmpExpression , " = \"" ) ; } else pszTmpExpression = msStringConcatenate ( pszTmpExpression , " = " ) ; pszEscapedStr = msLayerEscapeSQLParam ( lp , paszElements [ i ] ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , pszEscapedStr ) ; if ( bIscharacter ) { if ( bSqlLayer ) pszTmpExpression = msStringConcatenate ( pszTmpExpression , "'" ) ; else pszTmpExpression = msStringConcatenate ( pszTmpExpression , "\"" ) ; } pszTmpExpression = msStringConcatenate ( pszTmpExpression , ")" ) ; msFree ( pszEscapedStr ) ; pszEscapedStr = NULL ; if ( pszExpression != NULL ) pszExpression = msStringConcatenate ( pszExpression , " OR " ) ; pszExpression = msStringConcatenate ( pszExpression , pszTmpExpression ) ; msFree ( pszTmpExpression ) ; pszTmpExpression = NULL ; } pszExpression = msStringConcatenate ( pszExpression , ")" ) ; } msFreeCharArray ( paszElements , numelements ) ; } else { paszElements = msStringSplit ( value , ',' , & numelements ) ; if ( paszElements && numelements > 0 ) { pszTmpExpression = msStringConcatenate ( pszTmpExpression , "(" ) ; for ( i = 0 ; i < numelements ; i ++ ) { papszRangeElements = msStringSplit ( paszElements [ i ] , '/' , & nrangeelements ) ; if ( papszRangeElements && nrangeelements > 0 ) { pszTmpExpression = msStringConcatenate ( pszTmpExpression , "(" ) ; if ( nrangeelements == 2 || nrangeelements == 3 ) { if ( bSqlLayer ) pszTmpExpression = msStringConcatenate ( pszTmpExpression , item ) ; else { pszTmpExpression = msStringConcatenate ( pszTmpExpression , "[" ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , item ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , "]" ) ; } pszTmpExpression = msStringConcatenate ( pszTmpExpression , " >= " ) ; pszEscapedStr = msLayerEscapeSQLParam ( lp , papszRangeElements [ 0 ] ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , pszEscapedStr ) ; msFree ( pszEscapedStr ) ; pszEscapedStr = NULL ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , " AND " ) ; if ( bSqlLayer ) pszTmpExpression = msStringConcatenate ( pszTmpExpression , item ) ; else { pszTmpExpression = msStringConcatenate ( pszTmpExpression , "[" ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , item ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , "]" ) ; } pszTmpExpression = msStringConcatenate ( pszTmpExpression , " <= " ) ; pszEscapedStr = msLayerEscapeSQLParam ( lp , papszRangeElements [ 1 ] ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , pszEscapedStr ) ; msFree ( pszEscapedStr ) ; pszEscapedStr = NULL ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , ")" ) ; } else if ( nrangeelements == 1 ) { pszTmpExpression = msStringConcatenate ( pszTmpExpression , "(" ) ; if ( bSqlLayer ) pszTmpExpression = msStringConcatenate ( pszTmpExpression , item ) ; else { pszTmpExpression = msStringConcatenate ( pszTmpExpression , "[" ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , item ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , "]" ) ; } pszTmpExpression = msStringConcatenate ( pszTmpExpression , " = " ) ; pszEscapedStr = msLayerEscapeSQLParam ( lp , papszRangeElements [ 0 ] ) ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , pszEscapedStr ) ; msFree ( pszEscapedStr ) ; pszEscapedStr = NULL ; pszTmpExpression = msStringConcatenate ( pszTmpExpression , ")" ) ; } if ( pszExpression != NULL ) pszExpression = msStringConcatenate ( pszExpression , " OR " ) ; pszExpression = msStringConcatenate ( pszExpression , pszTmpExpression ) ; msFree ( pszTmpExpression ) ; pszTmpExpression = NULL ; } msFreeCharArray ( papszRangeElements , nrangeelements ) ; } pszExpression = msStringConcatenate ( pszExpression , ")" ) ; } msFreeCharArray ( paszElements , numelements ) ; } } msFree ( pszTmpExpression ) ; return pszExpression ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static cmsTagTypeSignature DecideTextDescType ( cmsFloat64Number ICCVersion , const void * Data ) { if ( ICCVersion >= 4.0 ) return cmsSigMultiLocalizedUnicodeType ; return cmsSigTextDescriptionType ; cmsUNUSED_PARAMETER ( Data ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
extern int name ( int ) __THROW __exctype ( isalnum ) ; __exctype ( isalpha ) ; __exctype ( iscntrl ) ; __exctype ( isdigit ) ; __exctype ( islower )
1True
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_INTEGER_0_127 ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 0U , 127U , NULL , FALSE ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
extern int name ( int , locale_t ) __THROW __exctype_l ( isalnum_l ) ; __exctype_l ( isalpha_l ) ; __exctype_l ( iscntrl_l ) ; __exctype_l ( isdigit_l ) ; __exctype_l ( islower_l ) ; __exctype_l ( isgraph_l ) ; __exctype_l ( isprint_l ) ; __exctype_l ( ispunct_l ) ; __exctype_l ( isspace_l ) ; __exctype_l ( isupper_l ) ; __exctype_l ( isxdigit_l ) ; __exctype_l ( isblank_l )
1True
Categorize the following code snippet as vulnerable or not. True or False
static void test_priorities ( int npriorities ) { char buf [ 32 ] ; struct test_pri_event one , two ; struct timeval tv ; evutil_snprintf ( buf , sizeof ( buf ) , "Testing Priorities %d: " , npriorities ) ; setup_test ( buf ) ; event_base_priority_init ( global_base , npriorities ) ; memset ( & one , 0 , sizeof ( one ) ) ; memset ( & two , 0 , sizeof ( two ) ) ; timeout_set ( & one . ev , test_priorities_cb , & one ) ; if ( event_priority_set ( & one . ev , 0 ) == - 1 ) { fprintf ( stderr , "%s: failed to set priority" , __func__ ) ; exit ( 1 ) ; } timeout_set ( & two . ev , test_priorities_cb , & two ) ; if ( event_priority_set ( & two . ev , npriorities - 1 ) == - 1 ) { fprintf ( stderr , "%s: failed to set priority" , __func__ ) ; exit ( 1 ) ; } evutil_timerclear ( & tv ) ; if ( event_add ( & one . ev , & tv ) == - 1 ) exit ( 1 ) ; if ( event_add ( & two . ev , & tv ) == - 1 ) exit ( 1 ) ; event_dispatch ( ) ; event_del ( & one . ev ) ; event_del ( & two . ev ) ; if ( npriorities == 1 ) { if ( one . count == 3 && two . count == 3 ) test_ok = 1 ; } else if ( npriorities == 2 ) { if ( one . count == 3 && two . count == 1 ) test_ok = 1 ; } else { if ( one . count == 3 && two . count == 0 ) test_ok = 1 ; } cleanup_test ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
PyObject * _PyString_Join ( PyObject * sep , PyObject * x ) { assert ( sep != NULL && PyString_Check ( sep ) ) ; assert ( x != NULL ) ; return string_join ( ( PyStringObject * ) sep , x ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void dcc_resume_deinit ( void ) { signal_remove ( "ctcp msg dcc resume" , ( SIGNAL_FUNC ) ctcp_msg_dcc_resume ) ; signal_remove ( "ctcp msg dcc accept" , ( SIGNAL_FUNC ) ctcp_msg_dcc_accept ) ; command_unbind ( "dcc resume" , ( SIGNAL_FUNC ) cmd_dcc_resume ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static krb5_error_code build_principal_va ( krb5_context context , krb5_principal princ , unsigned int rlen , const char * realm , va_list ap ) { krb5_error_code retval = 0 ; char * r = NULL ; krb5_data * data = NULL ; krb5_int32 count = 0 ; krb5_int32 size = 2 ; char * component = NULL ; data = malloc ( size * sizeof ( krb5_data ) ) ; if ( ! data ) { retval = ENOMEM ; } if ( ! retval ) r = k5memdup0 ( realm , rlen , & retval ) ; while ( ! retval && ( component = va_arg ( ap , char * ) ) ) { if ( count == size ) { krb5_data * new_data = NULL ; size *= 2 ; new_data = realloc ( data , size * sizeof ( krb5_data ) ) ; if ( new_data ) { data = new_data ; } else { retval = ENOMEM ; } } if ( ! retval ) { data [ count ] . length = strlen ( component ) ; data [ count ] . data = strdup ( component ) ; if ( ! data [ count ] . data ) { retval = ENOMEM ; } count ++ ; } } if ( ! retval ) { princ -> type = KRB5_NT_UNKNOWN ; princ -> magic = KV5M_PRINCIPAL ; princ -> realm = make_data ( r , rlen ) ; princ -> data = data ; princ -> length = count ; r = NULL ; data = NULL ; } if ( data ) { while ( -- count >= 0 ) { free ( data [ count ] . data ) ; } free ( data ) ; } free ( r ) ; return retval ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( PrintPreviewDialogControllerBrowserTest , NavigateFromInitiatorTab ) { PrintPreview ( ) ; WebContents * preview_dialog = GetPrintPreviewDialog ( ) ; ASSERT_TRUE ( preview_dialog ) ; ASSERT_NE ( initiator ( ) , preview_dialog ) ; PrintPreviewDialogDestroyedObserver dialog_destroyed_observer ( preview_dialog ) ; ui_test_utils : : NavigateToURL ( browser ( ) , GURL ( chrome : : kChromeUINewTabURL ) ) ; ASSERT_TRUE ( dialog_destroyed_observer . dialog_destroyed ( ) ) ; PrintPreview ( ) ; WebContents * new_preview_dialog = GetPrintPreviewDialog ( ) ; EXPECT_TRUE ( new_preview_dialog ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int get_stream_idx ( const unsigned * d ) { if ( d [ 0 ] >= '0' && d [ 0 ] <= '9' && d [ 1 ] >= '0' && d [ 1 ] <= '9' ) { return ( d [ 0 ] - '0' ) * 10 + ( d [ 1 ] - '0' ) ; } else { return 100 ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( TtsControllerTest , TestGetMatchingVoice ) { std : : unique_ptr < TestableTtsController > tts_controller = std : : make_unique < TestableTtsController > ( ) ; # if defined ( OS_CHROMEOS ) TestingPrefServiceSimple pref_service_ ; std : : unique_ptr < base : : DictionaryValue > lang_to_voices = std : : make_unique < base : : DictionaryValue > ( ) ; lang_to_voices -> SetKey ( "es" , base : : Value ( "{ \"name\":\"Voice7\",\"extension\":\"id7\"} " ) ) ; lang_to_voices -> SetKey ( "noLanguage" , base : : Value ( "{ \"name\":\"Android\",\"extension\":\"\"} " ) ) ; pref_service_ . registry ( ) -> RegisterDictionaryPref ( prefs : : kTextToSpeechLangToVoiceName , std : : move ( lang_to_voices ) ) ; tts_controller -> pref_service_ = & pref_service_ ; # endif { Utterance utterance ( nullptr ) ; std : : vector < VoiceData > voices ; EXPECT_EQ ( - 1 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ; } { Utterance utterance ( nullptr ) ; std : : vector < VoiceData > voices ; voices . push_back ( VoiceData ( ) ) ; voices . push_back ( VoiceData ( ) ) ; EXPECT_EQ ( 0 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ; } { Utterance utterance ( nullptr ) ; std : : vector < VoiceData > voices ; VoiceData fr_voice ; fr_voice . lang = "fr" ; voices . push_back ( fr_voice ) ; VoiceData en_voice ; en_voice . lang = "en" ; voices . push_back ( en_voice ) ; VoiceData de_voice ; de_voice . lang = "de" ; voices . push_back ( de_voice ) ; EXPECT_EQ ( 1 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ; } { std : : vector < VoiceData > voices ; VoiceData voice0 ; voices . push_back ( voice0 ) ; VoiceData voice1 ; voice1 . events . insert ( TTS_EVENT_WORD ) ; voices . push_back ( voice1 ) ; VoiceData voice2 ; voice2 . lang = "de-DE" ; voices . push_back ( voice2 ) ; VoiceData voice3 ; voice3 . lang = "fr-CA" ; voices . push_back ( voice3 ) ; VoiceData voice4 ; voice4 . name = "Voice4" ; voices . push_back ( voice4 ) ; VoiceData voice5 ; voice5 . extension_id = "id5" ; voices . push_back ( voice5 ) ; VoiceData voice6 ; voice6 . extension_id = "id7" ; voice6 . name = "Voice6" ; voice6 . lang = "es-es" ; voices . push_back ( voice6 ) ; VoiceData voice7 ; voice7 . extension_id = "id7" ; voice7 . name = "Voice7" ; voice7 . lang = "es-mx" ; voices . push_back ( voice7 ) ; VoiceData voice8 ; voice8 . extension_id = "" ; voice8 . name = "Android" ; voice8 . lang = "" ; voice8 . native = true ; voices . push_back ( voice8 ) ; Utterance utterance ( nullptr ) ; EXPECT_EQ ( 0 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ; std : : set < TtsEventType > types ; types . insert ( TTS_EVENT_WORD ) ; utterance . set_required_event_types ( types ) ; EXPECT_EQ ( 1 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ; utterance . set_lang ( "de-DE" ) ; EXPECT_EQ ( 2 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ; utterance . set_lang ( "fr-FR" ) ; EXPECT_EQ ( 3 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ; utterance . set_voice_name ( "Voice4" ) ; EXPECT_EQ ( 4 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ; utterance . set_voice_name ( "" ) ; utterance . set_extension_id ( "id5" ) ; EXPECT_EQ ( 5 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ; # if defined ( OS_CHROMEOS ) utterance . set_extension_id ( "" ) ; utterance . set_lang ( "es-es" ) ; EXPECT_EQ ( 6 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ; utterance . set_extension_id ( "" ) ; utterance . set_lang ( "es-ar" ) ; EXPECT_EQ ( 7 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ; utterance . set_voice_name ( "Android" ) ; utterance . set_extension_id ( "" ) ; utterance . set_lang ( "" ) ; EXPECT_EQ ( 8 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ; # endif } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void build_inter_predictors_for_planes ( MACROBLOCKD * xd , BLOCK_SIZE bsize , int mi_row , int mi_col , int plane_from , int plane_to ) { int plane ; const int mi_x = mi_col * MI_SIZE ; const int mi_y = mi_row * MI_SIZE ; for ( plane = plane_from ; plane <= plane_to ; ++ plane ) { const BLOCK_SIZE plane_bsize = get_plane_block_size ( bsize , & xd -> plane [ plane ] ) ; const int num_4x4_w = num_4x4_blocks_wide_lookup [ plane_bsize ] ; const int num_4x4_h = num_4x4_blocks_high_lookup [ plane_bsize ] ; const int bw = 4 * num_4x4_w ; const int bh = 4 * num_4x4_h ; if ( xd -> mi [ 0 ] . src_mi -> mbmi . sb_type < BLOCK_8X8 ) { int i = 0 , x , y ; assert ( bsize == BLOCK_8X8 ) ; for ( y = 0 ; y < num_4x4_h ; ++ y ) for ( x = 0 ; x < num_4x4_w ; ++ x ) build_inter_predictors ( xd , plane , i ++ , bw , bh , * x , 4 * y , 4 , 4 , mi_x , mi_y ) ; } else { build_inter_predictors ( xd , plane , 0 , bw , bh , 0 , 0 , bw , bh , mi_x , mi_y ) ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int read_restart_header ( MLPDecodeContext * m , GetBitContext * gbp , const uint8_t * buf , unsigned int substr ) { SubStream * s = & m -> substream [ substr ] ; unsigned int ch ; int sync_word , tmp ; uint8_t checksum ; uint8_t lossless_check ; int start_count = get_bits_count ( gbp ) ; const int max_matrix_channel = m -> avctx -> codec_id == AV_CODEC_ID_MLP ? MAX_MATRIX_CHANNEL_MLP : MAX_MATRIX_CHANNEL_TRUEHD ; sync_word = get_bits ( gbp , 13 ) ; if ( sync_word != 0x31ea >> 1 ) { av_log ( m -> avctx , AV_LOG_ERROR , "restart header sync incorrect (got 0x%04x)\n" , sync_word ) ; return AVERROR_INVALIDDATA ; } s -> noise_type = get_bits1 ( gbp ) ; if ( m -> avctx -> codec_id == AV_CODEC_ID_MLP && s -> noise_type ) { av_log ( m -> avctx , AV_LOG_ERROR , "MLP must have 0x31ea sync word.\n" ) ; return AVERROR_INVALIDDATA ; } skip_bits ( gbp , 16 ) ; s -> min_channel = get_bits ( gbp , 4 ) ; s -> max_channel = get_bits ( gbp , 4 ) ; s -> max_matrix_channel = get_bits ( gbp , 4 ) ; if ( s -> max_matrix_channel > max_matrix_channel ) { av_log ( m -> avctx , AV_LOG_ERROR , "Max matrix channel cannot be greater than %d.\n" , max_matrix_channel ) ; return AVERROR_INVALIDDATA ; } if ( s -> max_channel != s -> max_matrix_channel ) { av_log ( m -> avctx , AV_LOG_ERROR , "Max channel must be equal max matrix channel.\n" ) ; return AVERROR_INVALIDDATA ; } if ( s -> max_channel > MAX_MATRIX_CHANNEL_MLP && ! s -> noise_type ) { av_log_ask_for_sample ( m -> avctx , "Number of channels %d is larger than the maximum supported " "by the decoder.\n" , s -> max_channel + 2 ) ; return AVERROR_PATCHWELCOME ; } if ( s -> min_channel > s -> max_channel ) { av_log ( m -> avctx , AV_LOG_ERROR , "Substream min channel cannot be greater than max channel.\n" ) ; return AVERROR_INVALIDDATA ; } # if FF_API_REQUEST_CHANNELS if ( m -> avctx -> request_channels > 0 && m -> avctx -> request_channels <= s -> max_channel + 1 && m -> max_decoded_substream > substr ) { av_log ( m -> avctx , AV_LOG_DEBUG , "Extracting %d-channel downmix from substream %d. " "Further substreams will be skipped.\n" , s -> max_channel + 1 , substr ) ; m -> max_decoded_substream = substr ; } else # endif if ( m -> avctx -> request_channel_layout == s -> ch_layout && m -> max_decoded_substream > substr ) { av_log ( m -> avctx , AV_LOG_DEBUG , "Extracting %d-channel downmix (0x%" PRIx64 ") from substream %d. " "Further substreams will be skipped.\n" , s -> max_channel + 1 , s -> ch_layout , substr ) ; m -> max_decoded_substream = substr ; } s -> noise_shift = get_bits ( gbp , 4 ) ; s -> noisegen_seed = get_bits ( gbp , 23 ) ; skip_bits ( gbp , 19 ) ; s -> data_check_present = get_bits1 ( gbp ) ; lossless_check = get_bits ( gbp , 8 ) ; if ( substr == m -> max_decoded_substream && s -> lossless_check_data != 0xffffffff ) { tmp = xor_32_to_8 ( s -> lossless_check_data ) ; if ( tmp != lossless_check ) av_log ( m -> avctx , AV_LOG_WARNING , "Lossless check failed - expected %02x, calculated %02x.\n" , lossless_check , tmp ) ; } skip_bits ( gbp , 16 ) ; memset ( s -> ch_assign , 0 , sizeof ( s -> ch_assign ) ) ; for ( ch = 0 ; ch <= s -> max_matrix_channel ; ch ++ ) { int ch_assign = get_bits ( gbp , 6 ) ; if ( m -> avctx -> codec_id == AV_CODEC_ID_TRUEHD ) { uint64_t channel = thd_channel_layout_extract_channel ( s -> ch_layout , ch_assign ) ; ch_assign = av_get_channel_layout_channel_index ( s -> ch_layout , channel ) ; } if ( ch_assign > s -> max_matrix_channel ) { av_log_ask_for_sample ( m -> avctx , "Assignment of matrix channel %d to invalid output channel %d.\n" , ch , ch_assign ) ; return AVERROR_PATCHWELCOME ; } s -> ch_assign [ ch_assign ] = ch ; } checksum = ff_mlp_restart_checksum ( buf , get_bits_count ( gbp ) - start_count ) ; if ( checksum != get_bits ( gbp , 8 ) ) av_log ( m -> avctx , AV_LOG_ERROR , "restart header checksum error\n" ) ; s -> param_presence_flags = 0xff ; s -> num_primitive_matrices = 0 ; s -> blocksize = 8 ; s -> lossless_check_data = 0 ; memset ( s -> output_shift , 0 , sizeof ( s -> output_shift ) ) ; memset ( s -> quant_step_size , 0 , sizeof ( s -> quant_step_size ) ) ; for ( ch = s -> min_channel ; ch <= s -> max_channel ; ch ++ ) { ChannelParams * cp = & s -> channel_params [ ch ] ; cp -> filter_params [ FIR ] . order = 0 ; cp -> filter_params [ IIR ] . order = 0 ; cp -> filter_params [ FIR ] . shift = 0 ; cp -> filter_params [ IIR ] . shift = 0 ; cp -> huff_offset = 0 ; cp -> sign_huff_offset = ( - 1 ) << 23 ; cp -> codebook = 0 ; cp -> huff_lsbs = 24 ; } if ( substr == m -> max_decoded_substream ) { m -> avctx -> channels = s -> max_matrix_channel + 1 ; m -> avctx -> channel_layout = s -> ch_layout ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void SetPixelIndexTraits ( Image * image , const PixelTrait traits ) { image -> channel_map [ IndexPixelChannel ] . traits = traits ; }
0False