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
int luaD_poscall ( lua_State * L , StkId firstResult ) { StkId res ; int wanted , i ; CallInfo * ci ; if ( L -> hookmask & LUA_MASKRET ) firstResult = callrethooks ( L , firstResult ) ; ci = L -> ci -- ; res = ci -> func ; wanted = ci -> nresults ; L -> base = ( ci - 1 ) -> base ; L -> savedpc = ( ci - 1 ) -> savedpc ; for ( i = wanted ; i != 0 && firstResult < L -> top ; i -- ) setobjs2s ( L , res ++ , firstResult ++ ) ; while ( i -- > 0 ) setnilvalue ( res ++ ) ; L -> top = res ; return ( wanted - LUA_MULTRET ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int * __xmlKeepBlanksDefaultValue ( void ) { if ( IS_MAIN_THREAD ) return ( & xmlKeepBlanksDefaultValue ) ; else return ( & xmlGetGlobalState ( ) -> xmlKeepBlanksDefaultValue ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void steamdiscover_dissect_body_discovery ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , gint offset , gint bytes_left ) { gint len ; gint64 value ; protobuf_desc_t pb = { tvb , offset , bytes_left } ; protobuf_tag_t tag = { 0 , 0 , 0 } ; while ( protobuf_iter_next ( & pb , & tag ) ) { switch ( tag . field_number ) { case STEAMDISCOVER_FN_DISCOVERY_SEQNUM : STEAMDISCOVER_ENSURE_WIRETYPE ( PROTOBUF_WIRETYPE_VARINT ) ; value = get_varint64 ( pb . tvb , pb . offset , pb . bytes_left , & len ) ; proto_tree_add_uint ( tree , hf_steam_ihs_discovery_body_discovery_seqnum , pb . tvb , pb . offset , len , ( guint32 ) value ) ; col_append_fstr ( pinfo -> cinfo , COL_INFO , " Seq=%" G_GUINT32_FORMAT , ( guint32 ) value ) ; break ; case STEAMDISCOVER_FN_DISCOVERY_CLIENTIDS : STEAMDISCOVER_ENSURE_WIRETYPE ( PROTOBUF_WIRETYPE_VARINT ) ; value = get_varint64 ( pb . tvb , pb . offset , pb . bytes_left , & len ) ; proto_tree_add_uint64 ( tree , hf_steam_ihs_discovery_body_discovery_clientids , pb . tvb , pb . offset , len , value ) ; break ; default : len = protobuf_dissect_unknown_field ( & pb , & tag , pinfo , tree , NULL ) ; break ; } protobuf_seek_forward ( & pb , len ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int SpoolssRFFPCNEX_q ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep _U_ ) { guint32 flags ; static const int * hf_flags [ ] = { & hf_rffpcnex_flags_timeout , & hf_rffpcnex_flags_delete_driver , & hf_rffpcnex_flags_set_driver , & hf_rffpcnex_flags_add_driver , & hf_rffpcnex_flags_delete_print_processor , & hf_rffpcnex_flags_add_print_processor , & hf_rffpcnex_flags_delete_port , & hf_rffpcnex_flags_configure_port , & hf_rffpcnex_flags_add_port , & hf_rffpcnex_flags_delete_form , & hf_rffpcnex_flags_set_form , & hf_rffpcnex_flags_add_form , & hf_rffpcnex_flags_write_job , & hf_rffpcnex_flags_delete_job , & hf_rffpcnex_flags_set_job , & hf_rffpcnex_flags_add_job , & hf_rffpcnex_flags_failed_printer_connection , & hf_rffpcnex_flags_delete_printer , & hf_rffpcnex_flags_set_printer , & hf_rffpcnex_flags_add_printer , NULL } ; offset = dissect_nt_policy_hnd ( tvb , offset , pinfo , tree , di , drep , hf_hnd , NULL , NULL , FALSE , FALSE ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , NULL , di , drep , - 1 , & flags ) ; proto_tree_add_bitmask_value ( tree , tvb , offset - 4 , hf_rffpcnex_flags , ett_rffpcnex_flags , hf_flags , flags ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_rffpcnex_options , NULL ) ; offset = dissect_ndr_str_pointer_item ( tvb , offset , pinfo , tree , di , drep , NDR_POINTER_UNIQUE , "Server" , hf_servername , 0 ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_printerlocal , NULL ) ; offset = dissect_ndr_pointer ( tvb , offset , pinfo , tree , di , drep , dissect_NOTIFY_OPTIONS_ARRAY_CTR , NDR_POINTER_UNIQUE , "Notify Options Container" , - 1 ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void delta_decode ( uint8_t * dst , const uint8_t * src , int src_size , uint8_t * state , const int8_t * table ) { uint8_t val = * state ; while ( src_size -- ) { uint8_t d = * src ++ ; val = av_clip_uint8 ( val + table [ d & 0xF ] ) ; * dst ++ = val ; val = av_clip_uint8 ( val + table [ d >> 4 ] ) ; * dst ++ = val ; } * state = val ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TSReturnCode TSHttpTxnCacheLookupStatusGet ( TSHttpTxn txnp , int * lookup_status ) { sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ; sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) lookup_status ) == TS_SUCCESS ) ; HttpSM * sm = ( HttpSM * ) txnp ; switch ( sm -> t_state . cache_lookup_result ) { case HttpTransact : : CACHE_LOOKUP_MISS : case HttpTransact : : CACHE_LOOKUP_DOC_BUSY : * lookup_status = TS_CACHE_LOOKUP_MISS ; break ; case HttpTransact : : CACHE_LOOKUP_HIT_STALE : * lookup_status = TS_CACHE_LOOKUP_HIT_STALE ; break ; case HttpTransact : : CACHE_LOOKUP_HIT_WARNING : case HttpTransact : : CACHE_LOOKUP_HIT_FRESH : * lookup_status = TS_CACHE_LOOKUP_HIT_FRESH ; break ; case HttpTransact : : CACHE_LOOKUP_SKIPPED : * lookup_status = TS_CACHE_LOOKUP_SKIPPED ; break ; case HttpTransact : : CACHE_LOOKUP_NONE : default : return TS_ERROR ; } ; return TS_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void http_skip_ws ( const char * & buf , int & len ) { while ( len > 0 && * buf && ParseRules : : is_ws ( * buf ) ) { buf += 1 ; len -= 1 ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static float fixed_gain_smooth ( AMRContext * p , const float * lsf , const float * lsf_avg , const enum Mode mode ) { float diff = 0.0 ; int i ; for ( i = 0 ; i < LP_FILTER_ORDER ; i ++ ) diff += fabs ( lsf_avg [ i ] - lsf [ i ] ) / lsf_avg [ i ] ; p -> diff_count ++ ; if ( diff <= 0.65 ) p -> diff_count = 0 ; if ( p -> diff_count > 10 ) { p -> hang_count = 0 ; p -> diff_count -- ; } if ( p -> hang_count < 40 ) { p -> hang_count ++ ; } else if ( mode < MODE_7k4 || mode == MODE_10k2 ) { const float smoothing_factor = av_clipf ( 4.0 * diff - 1.6 , 0.0 , 1.0 ) ; const float fixed_gain_mean = ( p -> fixed_gain [ 0 ] + p -> fixed_gain [ 1 ] + p -> fixed_gain [ 2 ] + p -> fixed_gain [ 3 ] + p -> fixed_gain [ 4 ] ) * 0.2 ; return smoothing_factor * p -> fixed_gain [ 4 ] + ( 1.0 - smoothing_factor ) * fixed_gain_mean ; } return p -> fixed_gain [ 4 ] ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorJSONSetCapabilities ( qemuMonitorPtr mon ) { int ret ; virJSONValuePtr cmd = qemuMonitorJSONMakeCommand ( "qmp_capabilities" , NULL ) ; virJSONValuePtr reply = NULL ; if ( ! cmd ) return - 1 ; ret = qemuMonitorJSONCommand ( mon , cmd , & reply ) ; if ( ret == 0 ) ret = qemuMonitorJSONCheckError ( cmd , reply ) ; virJSONValueFree ( cmd ) ; virJSONValueFree ( reply ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static bool config_filter_match_service ( const struct config_filter * mask , const struct config_filter * filter ) { if ( mask -> service != NULL ) { if ( filter -> service == NULL ) return FALSE ; if ( mask -> service [ 0 ] == '!' ) { if ( strcmp ( filter -> service , mask -> service + 1 ) == 0 ) return FALSE ; } else { if ( strcmp ( filter -> service , mask -> service ) != 0 ) return FALSE ; } } return TRUE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline int check_bidir_mv ( MpegEncContext * s , int motion_fx , int motion_fy , int motion_bx , int motion_by , int pred_fx , int pred_fy , int pred_bx , int pred_by , int size , int h ) { MotionEstContext * const c = & s -> me ; uint8_t * const mv_penalty_f = c -> mv_penalty [ s -> f_code ] + MAX_MV ; uint8_t * const mv_penalty_b = c -> mv_penalty [ s -> b_code ] + MAX_MV ; int stride = c -> stride ; uint8_t * dest_y = c -> scratchpad ; uint8_t * ptr ; int dxy ; int src_x , src_y ; int fbmin ; uint8_t * * src_data = c -> src [ 0 ] ; uint8_t * * ref_data = c -> ref [ 0 ] ; uint8_t * * ref2_data = c -> ref [ 2 ] ; if ( s -> quarter_sample ) { dxy = ( ( motion_fy & 3 ) << 2 ) | ( motion_fx & 3 ) ; src_x = motion_fx >> 2 ; src_y = motion_fy >> 2 ; ptr = ref_data [ 0 ] + ( src_y * stride ) + src_x ; s -> dsp . put_qpel_pixels_tab [ 0 ] [ dxy ] ( dest_y , ptr , stride ) ; dxy = ( ( motion_by & 3 ) << 2 ) | ( motion_bx & 3 ) ; src_x = motion_bx >> 2 ; src_y = motion_by >> 2 ; ptr = ref2_data [ 0 ] + ( src_y * stride ) + src_x ; s -> dsp . avg_qpel_pixels_tab [ size ] [ dxy ] ( dest_y , ptr , stride ) ; } else { dxy = ( ( motion_fy & 1 ) << 1 ) | ( motion_fx & 1 ) ; src_x = motion_fx >> 1 ; src_y = motion_fy >> 1 ; ptr = ref_data [ 0 ] + ( src_y * stride ) + src_x ; s -> dsp . put_pixels_tab [ size ] [ dxy ] ( dest_y , ptr , stride , h ) ; dxy = ( ( motion_by & 1 ) << 1 ) | ( motion_bx & 1 ) ; src_x = motion_bx >> 1 ; src_y = motion_by >> 1 ; ptr = ref2_data [ 0 ] + ( src_y * stride ) + src_x ; s -> dsp . avg_pixels_tab [ size ] [ dxy ] ( dest_y , ptr , stride , h ) ; } fbmin = ( mv_penalty_f [ motion_fx - pred_fx ] + mv_penalty_f [ motion_fy - pred_fy ] ) * c -> mb_penalty_factor + ( mv_penalty_b [ motion_bx - pred_bx ] + mv_penalty_b [ motion_by - pred_by ] ) * c -> mb_penalty_factor + s -> dsp . mb_cmp [ size ] ( s , src_data [ 0 ] , dest_y , stride , h ) ; if ( c -> avctx -> mb_cmp & FF_CMP_CHROMA ) { } return fbmin ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static uint64_t cchip_read ( void * opaque , hwaddr addr , unsigned size ) { CPUState * cpu = current_cpu ; TyphoonState * s = opaque ; uint64_t ret = 0 ; if ( addr & 4 ) { return s -> latch_tmp ; } switch ( addr ) { case 0x0000 : break ; case 0x0040 : break ; case 0x0080 : ret = s -> cchip . misc | ( cpu -> cpu_index & 3 ) ; break ; case 0x00c0 : break ; case 0x0100 : case 0x0140 : case 0x0180 : case 0x01c0 : break ; case 0x0200 : ret = s -> cchip . dim [ 0 ] ; break ; case 0x0240 : ret = s -> cchip . dim [ 1 ] ; break ; case 0x0280 : ret = s -> cchip . dim [ 0 ] & s -> cchip . drir ; break ; case 0x02c0 : ret = s -> cchip . dim [ 1 ] & s -> cchip . drir ; break ; case 0x0300 : ret = s -> cchip . drir ; break ; case 0x0340 : break ; case 0x0380 : ret = s -> cchip . iic [ 0 ] ; break ; case 0x03c0 : ret = s -> cchip . iic [ 1 ] ; break ; case 0x0400 : case 0x0440 : case 0x0480 : case 0x04c0 : break ; case 0x0580 : break ; case 0x05c0 : break ; case 0x0600 : ret = s -> cchip . dim [ 2 ] ; break ; case 0x0640 : ret = s -> cchip . dim [ 3 ] ; break ; case 0x0680 : ret = s -> cchip . dim [ 2 ] & s -> cchip . drir ; break ; case 0x06c0 : ret = s -> cchip . dim [ 3 ] & s -> cchip . drir ; break ; case 0x0700 : ret = s -> cchip . iic [ 2 ] ; break ; case 0x0740 : ret = s -> cchip . iic [ 3 ] ; break ; case 0x0780 : break ; case 0x0c00 : case 0x0c40 : case 0x0c80 : case 0x0cc0 : break ; default : cpu_unassigned_access ( cpu , addr , false , false , 0 , size ) ; return - 1 ; } s -> latch_tmp = ret >> 32 ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int SpoolssGetPrinterDriverDirectory_r ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) { offset = dissect_spoolss_string_parm ( tvb , offset , pinfo , tree , di , drep , "Directory" ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_needed , NULL ) ; offset = dissect_doserror ( tvb , offset , pinfo , tree , di , drep , hf_rc , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int row_get_classname ( const zval * object , const char * * class_name , zend_uint * class_name_len , int parent TSRMLS_DC ) { if ( parent ) { return FAILURE ; } else { * class_name = estrndup ( "PDORow" , sizeof ( "PDORow" ) - 1 ) ; * class_name_len = sizeof ( "PDORow" ) - 1 ; return SUCCESS ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void U_CALLCONV _CompoundTextReset ( UConverter * converter , UConverterResetChoice choice ) { ( void ) converter ; ( void ) choice ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int dissect_h245_UnicastAddress ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_UnicastAddress , UnicastAddress_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
gcry_mpi_t _gcry_sexp_nth_opaque_mpi ( gcry_sexp_t list , int number ) { char * p ; size_t n ; gcry_mpi_t a ; p = gcry_sexp_nth_buffer ( list , number , & n ) ; if ( ! p ) return NULL ; a = gcry_is_secure ( list ) ? _gcry_mpi_snew ( 0 ) : _gcry_mpi_new ( 0 ) ; if ( a ) gcry_mpi_set_opaque ( a , p , n * 8 ) ; else gcry_free ( p ) ; return a ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int main ( int argc , char * * argv ) { using std : : string ; if ( argc != 2 ) { fprintf ( stderr , "One argument, the input filename, must be provided.\n" ) ; return 1 ; } string filename ( argv [ 1 ] ) ; string outfilename = filename . substr ( 0 , filename . find_last_of ( "." ) ) + ".ttf" ; fprintf ( stdout , "Processing %s => %s\n" , filename . c_str ( ) , outfilename . c_str ( ) ) ; string input = woff2 : : GetFileContent ( filename ) ; size_t decompressed_size = woff2 : : ComputeWOFF2FinalSize ( reinterpret_cast < const uint8_t * > ( input . data ( ) ) , input . size ( ) ) ; string output ( decompressed_size , 0 ) ; const bool ok = woff2 : : ConvertWOFF2ToTTF ( reinterpret_cast < uint8_t * > ( & output [ 0 ] ) , decompressed_size , reinterpret_cast < const uint8_t * > ( input . data ( ) ) , input . size ( ) ) ; if ( ! ok ) { fprintf ( stderr , "Decompression failed\n" ) ; return 1 ; } woff2 : : SetFileContents ( outfilename , output ) ; return 0 ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static GFile * get_target_file_for_display_name ( GFile * dir , const gchar * name ) { GFile * dest ; dest = NULL ; dest = g_file_get_child_for_display_name ( dir , name , NULL ) ; if ( dest == NULL ) { dest = g_file_get_child ( dir , name ) ; } return dest ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static struct evhttp * evhttp_new_object ( void ) { struct evhttp * http = NULL ; if ( ( http = calloc ( 1 , sizeof ( struct evhttp ) ) ) == NULL ) { event_warn ( "%s: calloc" , __func__ ) ; return ( NULL ) ; } http -> timeout = - 1 ; TAILQ_INIT ( & http -> sockets ) ; TAILQ_INIT ( & http -> callbacks ) ; TAILQ_INIT ( & http -> connections ) ; return ( http ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _slurm_rpc_dump_jobs_user ( slurm_msg_t * msg ) { DEF_TIMERS ; char * dump ; int dump_size ; slurm_msg_t response_msg ; job_user_id_msg_t * job_info_request_msg = ( job_user_id_msg_t * ) msg -> data ; slurmctld_lock_t job_read_lock = { READ_LOCK , READ_LOCK , NO_LOCK , READ_LOCK , READ_LOCK } ; uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ; START_TIMER ; debug3 ( "Processing RPC: REQUEST_JOB_USER_INFO from uid=%d" , uid ) ; lock_slurmctld ( job_read_lock ) ; pack_all_jobs ( & dump , & dump_size , job_info_request_msg -> show_flags , uid , job_info_request_msg -> user_id , msg -> protocol_version ) ; unlock_slurmctld ( job_read_lock ) ; END_TIMER2 ( "_slurm_rpc_dump_job_user" ) ; # if 0 info ( "_slurm_rpc_dump_user_jobs, size=%d %s" , dump_size , TIME_STR ) ; # endif slurm_msg_t_init ( & response_msg ) ; response_msg . flags = msg -> flags ; response_msg . protocol_version = msg -> protocol_version ; response_msg . address = msg -> address ; response_msg . conn = msg -> conn ; response_msg . msg_type = RESPONSE_JOB_INFO ; response_msg . data = dump ; response_msg . data_size = dump_size ; slurm_send_node_msg ( msg -> conn_fd , & response_msg ) ; xfree ( dump ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int main_input ( xd3_cmd cmd , main_file * ifile , main_file * ofile , main_file * sfile ) { int ret ; xd3_stream stream ; size_t nread = 0 ; usize_t winsize ; int stream_flags = 0 ; xd3_config config ; xd3_source source ; xoff_t last_total_in = 0 ; xoff_t last_total_out = 0 ; long start_time ; int stdout_only = 0 ; int ( * input_func ) ( xd3_stream * ) ; int ( * output_func ) ( xd3_stream * , main_file * ) ; memset ( & stream , 0 , sizeof ( stream ) ) ; memset ( & source , 0 , sizeof ( source ) ) ; memset ( & config , 0 , sizeof ( config ) ) ; config . alloc = main_alloc ; config . freef = main_free1 ; config . iopt_size = option_iopt_size ; config . sprevsz = option_sprevsz ; do_src_fifo = 0 ; start_time = get_millisecs_now ( ) ; if ( option_use_checksum ) { stream_flags |= XD3_ADLER32 ; } switch ( ( int ) cmd ) { # if VCDIFF_TOOLS if ( 1 ) { case CMD_PRINTHDR : stream_flags |= XD3_JUST_HDR ; } else if ( 1 ) { case CMD_PRINTHDRS : stream_flags |= XD3_SKIP_WINDOW ; } else { case CMD_PRINTDELTA : stream_flags |= XD3_SKIP_EMIT ; } ifile -> flags |= RD_NONEXTERNAL ; input_func = xd3_decode_input ; output_func = main_print_func ; stream_flags |= XD3_ADLER32_NOVER ; stdout_only = 1 ; break ; case CMD_RECODE : case CMD_MERGE : case CMD_MERGE_ARG : stream_flags |= XD3_ADLER32_NOVER | XD3_SKIP_EMIT ; ifile -> flags |= RD_NONEXTERNAL ; input_func = xd3_decode_input ; if ( ( ret = main_init_recode_stream ( ) ) ) { return EXIT_FAILURE ; } if ( cmd == CMD_RECODE ) { output_func = main_recode_func ; } else { output_func = main_merge_func ; } break ; # endif # if XD3_ENCODER case CMD_ENCODE : do_src_fifo = 1 ; input_func = xd3_encode_input ; output_func = main_write_output ; if ( option_no_compress ) { stream_flags |= XD3_NOCOMPRESS ; } if ( option_use_altcodetable ) { stream_flags |= XD3_ALT_CODE_TABLE ; } if ( option_smatch_config ) { const char * s = option_smatch_config ; char * e ; int values [ XD3_SOFTCFG_VARCNT ] ; int got ; config . smatch_cfg = XD3_SMATCH_SOFT ; for ( got = 0 ; got < XD3_SOFTCFG_VARCNT ; got += 1 , s = e + 1 ) { values [ got ] = strtol ( s , & e , 10 ) ; if ( ( values [ got ] < 0 ) || ( e == s ) || ( got < XD3_SOFTCFG_VARCNT - 1 && * e == 0 ) || ( got == XD3_SOFTCFG_VARCNT - 1 && * e != 0 ) ) { XPR ( NT "invalid string match specifier (-C) %d: %s\n" , got , s ) ; return EXIT_FAILURE ; } } config . smatcher_soft . large_look = values [ 0 ] ; config . smatcher_soft . large_step = values [ 1 ] ; config . smatcher_soft . small_look = values [ 2 ] ; config . smatcher_soft . small_chain = values [ 3 ] ; config . smatcher_soft . small_lchain = values [ 4 ] ; config . smatcher_soft . max_lazy = values [ 5 ] ; config . smatcher_soft . long_enough = values [ 6 ] ; } else { if ( option_verbose > 2 ) { XPR ( NT "compression level: %d\n" , option_level ) ; } if ( option_level == 0 ) { stream_flags |= XD3_NOCOMPRESS ; config . smatch_cfg = XD3_SMATCH_FASTEST ; } else if ( option_level == 1 ) { config . smatch_cfg = XD3_SMATCH_FASTEST ; } else if ( option_level == 2 ) { config . smatch_cfg = XD3_SMATCH_FASTER ; } else if ( option_level <= 5 ) { config . smatch_cfg = XD3_SMATCH_FAST ; } else if ( option_level == 6 ) { config . smatch_cfg = XD3_SMATCH_DEFAULT ; } else { config . smatch_cfg = XD3_SMATCH_SLOW ; } } break ; # endif case CMD_DECODE : if ( option_use_checksum == 0 ) { stream_flags |= XD3_ADLER32_NOVER ; } ifile -> flags |= RD_NONEXTERNAL ; input_func = xd3_decode_input ; output_func = main_write_output ; break ; default : XPR ( NT "internal error\n" ) ; return EXIT_FAILURE ; } main_bsize = winsize = main_get_winsize ( ifile ) ; if ( ( main_bdata = ( uint8_t * ) main_bufalloc ( winsize ) ) == NULL ) { return EXIT_FAILURE ; } config . winsize = winsize ; config . getblk = main_getblk_func ; config . flags = stream_flags ; if ( ( ret = main_set_secondary_flags ( & config ) ) || ( ret = xd3_config_stream ( & stream , & config ) ) ) { XPR ( NT XD3_LIB_ERRMSG ( & stream , ret ) ) ; return EXIT_FAILURE ; } # if VCDIFF_TOOLS if ( ( cmd == CMD_MERGE || cmd == CMD_MERGE_ARG ) && ( ret = xd3_whole_state_init ( & stream ) ) ) { XPR ( NT XD3_LIB_ERRMSG ( & stream , ret ) ) ; return EXIT_FAILURE ; } # endif if ( cmd != CMD_DECODE ) { if ( sfile && sfile -> filename != NULL ) { if ( ( ret = main_set_source ( & stream , cmd , sfile , & source ) ) ) { return EXIT_FAILURE ; } XD3_ASSERT ( stream . src != NULL ) ; } } if ( cmd == CMD_PRINTHDR || cmd == CMD_PRINTHDRS || cmd == CMD_PRINTDELTA || cmd == CMD_RECODE ) { if ( sfile -> filename == NULL ) { allow_fake_source = 1 ; sfile -> filename = "<placeholder>" ; main_set_source ( & stream , cmd , sfile , & source ) ; } } get_millisecs_since ( ) ; do { xoff_t input_offset ; xoff_t input_remain ; usize_t try_read ; input_offset = ifile -> nread ; input_remain = XOFF_T_MAX - input_offset ; try_read = ( usize_t ) min ( ( xoff_t ) config . winsize , input_remain ) ; if ( ( ret = main_read_primary_input ( ifile , main_bdata , try_read , & nread ) ) ) { return EXIT_FAILURE ; } if ( nread < try_read ) { stream . flags |= XD3_FLUSH ; } # if XD3_ENCODER if ( cmd == CMD_ENCODE && ( ret = main_set_appheader ( & stream , ifile , sfile ) ) ) { return EXIT_FAILURE ; } # endif xd3_avail_input ( & stream , main_bdata , nread ) ; if ( nread == 0 && stream . current_window > 0 ) { break ; } again : ret = input_func ( & stream ) ; switch ( ret ) { case XD3_INPUT : continue ; case XD3_GOTHEADER : { XD3_ASSERT ( stream . current_window == 0 ) ; if ( cmd == CMD_DECODE ) { main_get_appheader ( & stream , ifile , ofile , sfile ) ; if ( ( sfile -> filename != NULL ) && ( ret = main_set_source ( & stream , cmd , sfile , & source ) ) ) { return EXIT_FAILURE ; } } } case XD3_WINSTART : { goto again ; } case XD3_OUTPUT : { if ( ofile != NULL && ! main_file_isopen ( ofile ) && ( ret = main_open_output ( & stream , ofile ) ) != 0 ) { return EXIT_FAILURE ; } if ( ( ret = output_func ( & stream , ofile ) ) && ( ret != PRINTHDR_SPECIAL ) ) { return EXIT_FAILURE ; } if ( ret == PRINTHDR_SPECIAL ) { xd3_abort_stream ( & stream ) ; ret = EXIT_SUCCESS ; goto done ; } ret = 0 ; xd3_consume_output ( & stream ) ; goto again ; } case XD3_WINFINISH : { if ( IS_ENCODE ( cmd ) || cmd == CMD_DECODE || cmd == CMD_RECODE ) { if ( ! option_quiet && IS_ENCODE ( cmd ) && main_file_isopen ( sfile ) ) { if ( option_verbose && ! xd3_encoder_used_source ( & stream ) ) { XPR ( NT "warning: input window %" Q "u..%" Q "u has " "no source copies\n" , stream . current_window * winsize , ( stream . current_window + 1 ) * winsize ) ; XD3_ASSERT ( stream . src != NULL ) ; } if ( option_verbose > 1 && stream . srcwin_decided_early && stream . i_slots_used > stream . iopt_size ) { XPR ( NT "warning: input position %" Q "u overflowed " "instruction buffer, needed %u (vs. %u), " "consider changing -I\n" , stream . current_window * winsize , stream . i_slots_used , stream . iopt_size ) ; } } if ( option_verbose ) { shortbuf rrateavg , wrateavg , tm ; shortbuf rdb , wdb ; shortbuf trdb , twdb ; shortbuf srcpos ; long millis = get_millisecs_since ( ) ; usize_t this_read = ( usize_t ) ( stream . total_in - last_total_in ) ; usize_t this_write = ( usize_t ) ( stream . total_out - last_total_out ) ; last_total_in = stream . total_in ; last_total_out = stream . total_out ; if ( option_verbose > 1 ) { XPR ( NT "%" Q "u: in %s (%s): out %s (%s): " "total in %s: out %s: %s: srcpos %s\n" , stream . current_window , main_format_bcnt ( this_read , & rdb ) , main_format_rate ( this_read , millis , & rrateavg ) , main_format_bcnt ( this_write , & wdb ) , main_format_rate ( this_write , millis , & wrateavg ) , main_format_bcnt ( stream . total_in , & trdb ) , main_format_bcnt ( stream . total_out , & twdb ) , main_format_millis ( millis , & tm ) , main_format_bcnt ( sfile -> source_position , & srcpos ) ) ; } else { XPR ( NT "%" Q "u: in %s: out %s: total in %s: " "out %s: %s\n" , stream . current_window , main_format_bcnt ( this_read , & rdb ) , main_format_bcnt ( this_write , & wdb ) , main_format_bcnt ( stream . total_in , & trdb ) , main_format_bcnt ( stream . total_out , & twdb ) , main_format_millis ( millis , & tm ) ) ; } } } goto again ; } default : XPR ( NT XD3_LIB_ERRMSG ( & stream , ret ) ) ; if ( ! option_quiet && ret == XD3_INVALID_INPUT ) { XPR ( NT "normally this indicates that the source file is incorrect\n" ) ; XPR ( NT "please verify the source file with sha1sum or equivalent\n" ) ; } return EXIT_FAILURE ; } } while ( nread == config . winsize ) ; done : main_file_close ( ifile ) ; if ( sfile != NULL ) { main_file_close ( sfile ) ; } # if VCDIFF_TOOLS if ( cmd == CMD_MERGE && ( ret = main_merge_output ( & stream , ofile ) ) ) { return EXIT_FAILURE ; } if ( cmd == CMD_MERGE_ARG ) { xd3_swap_whole_state ( & stream . whole_target , & recode_stream -> whole_target ) ; } # endif if ( ! option_no_output && ofile != NULL ) { if ( ! stdout_only && ! main_file_isopen ( ofile ) ) { XPR ( NT "nothing to output: %s\n" , ifile -> filename ) ; return EXIT_FAILURE ; } if ( main_file_close ( ofile ) != 0 ) { return EXIT_FAILURE ; } } # if EXTERNAL_COMPRESSION if ( ( ret = main_external_compression_finish ( ) ) ) { XPR ( NT "external compression commands failed\n" ) ; return EXIT_FAILURE ; } # endif if ( ( ret = xd3_close_stream ( & stream ) ) ) { XPR ( NT XD3_LIB_ERRMSG ( & stream , ret ) ) ; return EXIT_FAILURE ; } # if XD3_ENCODER if ( option_verbose > 1 && cmd == CMD_ENCODE ) { XPR ( NT "scanner configuration: %s\n" , stream . smatcher . name ) ; XPR ( NT "target hash table size: %u\n" , stream . small_hash . size ) ; if ( sfile != NULL && sfile -> filename != NULL ) { XPR ( NT "source hash table size: %u\n" , stream . large_hash . size ) ; } } if ( option_verbose > 2 && cmd == CMD_ENCODE ) { XPR ( NT "source copies: %" Q "u (%" Q "u bytes)\n" , stream . n_scpy , stream . l_scpy ) ; XPR ( NT "target copies: %" Q "u (%" Q "u bytes)\n" , stream . n_tcpy , stream . l_tcpy ) ; XPR ( NT "adds: %" Q "u (%" Q "u bytes)\n" , stream . n_add , stream . l_add ) ; XPR ( NT "runs: %" Q "u (%" Q "u bytes)\n" , stream . n_run , stream . l_run ) ; } # endif xd3_free_stream ( & stream ) ; if ( option_verbose ) { shortbuf tm ; long end_time = get_millisecs_now ( ) ; xoff_t nwrite = ofile != NULL ? ofile -> nwrite : 0 ; XPR ( NT "finished in %s; input %" Q "u output %" Q "u bytes (%0.2f%%)\n" , main_format_millis ( end_time - start_time , & tm ) , ifile -> nread , nwrite , 100.0 * nwrite / ifile -> nread ) ; } return EXIT_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int chk_size ( MI_CHECK * param , register MI_INFO * info ) { int error = 0 ; register my_off_t skr , size ; char buff [ 22 ] , buff2 [ 22 ] ; DBUG_ENTER ( "chk_size" ) ; if ( ! ( param -> testflag & T_SILENT ) ) puts ( "- check file-size" ) ; flush_key_blocks ( info -> s -> key_cache , info -> s -> kfile , FLUSH_FORCE_WRITE ) ; size = mysql_file_seek ( info -> s -> kfile , 0L , MY_SEEK_END , MYF ( MY_THREADSAFE ) ) ; if ( ( skr = ( my_off_t ) info -> state -> key_file_length ) != size ) { if ( skr > size && mi_is_any_key_active ( info -> s -> state . key_map ) ) { error = 1 ; mi_check_print_error ( param , "Size of indexfile is: %-8s Should be: %s" , llstr ( size , buff ) , llstr ( skr , buff2 ) ) ; } else mi_check_print_warning ( param , "Size of indexfile is: %-8s Should be: %s" , llstr ( size , buff ) , llstr ( skr , buff2 ) ) ; } if ( ! ( param -> testflag & T_VERY_SILENT ) && ! ( info -> s -> options & HA_OPTION_COMPRESS_RECORD ) && ulonglong2double ( info -> state -> key_file_length ) > ulonglong2double ( info -> s -> base . margin_key_file_length ) * 0.9 ) mi_check_print_warning ( param , "Keyfile is almost full, %10s of %10s used" , llstr ( info -> state -> key_file_length , buff ) , llstr ( info -> s -> base . max_key_file_length - 1 , buff ) ) ; size = mysql_file_seek ( info -> dfile , 0L , MY_SEEK_END , MYF ( 0 ) ) ; skr = ( my_off_t ) info -> state -> data_file_length ; if ( info -> s -> options & HA_OPTION_COMPRESS_RECORD ) skr += MEMMAP_EXTRA_MARGIN ; # ifdef USE_RELOC if ( info -> data_file_type == STATIC_RECORD && skr < ( my_off_t ) info -> s -> base . reloc * info -> s -> base . min_pack_length ) skr = ( my_off_t ) info -> s -> base . reloc * info -> s -> base . min_pack_length ; # endif if ( skr != size ) { info -> state -> data_file_length = size ; if ( skr > size && skr != size + MEMMAP_EXTRA_MARGIN ) { error = 1 ; mi_check_print_error ( param , "Size of datafile is: %-9s Should be: %s" , llstr ( size , buff ) , llstr ( skr , buff2 ) ) ; param -> testflag |= T_RETRY_WITHOUT_QUICK ; } else { mi_check_print_warning ( param , "Size of datafile is: %-9s Should be: %s" , llstr ( size , buff ) , llstr ( skr , buff2 ) ) ; } } if ( ! ( param -> testflag & T_VERY_SILENT ) && ! ( info -> s -> options & HA_OPTION_COMPRESS_RECORD ) && ulonglong2double ( info -> state -> data_file_length ) > ( ulonglong2double ( info -> s -> base . max_data_file_length ) * 0.9 ) ) mi_check_print_warning ( param , "Datafile is almost full, %10s of %10s used" , llstr ( info -> state -> data_file_length , buff ) , llstr ( info -> s -> base . max_data_file_length - 1 , buff2 ) ) ; DBUG_RETURN ( error ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int proto_register_field_init ( header_field_info * hfinfo , const int parent ) { tmp_fld_check_assert ( hfinfo ) ; hfinfo -> parent = parent ; hfinfo -> same_name_next = NULL ; hfinfo -> same_name_prev_id = - 1 ; if ( gpa_hfinfo . len >= gpa_hfinfo . allocated_len ) { if ( ! gpa_hfinfo . hfi ) { gpa_hfinfo . allocated_len = PROTO_PRE_ALLOC_HF_FIELDS_MEM ; gpa_hfinfo . hfi = ( header_field_info * * ) g_malloc ( sizeof ( header_field_info * ) * PROTO_PRE_ALLOC_HF_FIELDS_MEM ) ; } else { gpa_hfinfo . allocated_len += 1000 ; gpa_hfinfo . hfi = ( header_field_info * * ) g_realloc ( gpa_hfinfo . hfi , sizeof ( header_field_info * ) * gpa_hfinfo . allocated_len ) ; } } gpa_hfinfo . hfi [ gpa_hfinfo . len ] = hfinfo ; gpa_hfinfo . len ++ ; hfinfo -> id = gpa_hfinfo . len - 1 ; if ( ( hfinfo -> name [ 0 ] != 0 ) && ( hfinfo -> abbrev [ 0 ] != 0 ) ) { header_field_info * same_name_next_hfinfo ; guchar c ; c = wrs_check_charset ( fld_abbrev_chars , hfinfo -> abbrev ) ; if ( c ) { if ( g_ascii_isprint ( c ) ) fprintf ( stderr , "Invalid character '%c' in filter name '%s'\n" , c , hfinfo -> abbrev ) ; else fprintf ( stderr , "Invalid byte \\%03o in filter name '%s'\n" , c , hfinfo -> abbrev ) ; DISSECTOR_ASSERT_NOT_REACHED ( ) ; } same_name_hfinfo = NULL ; g_hash_table_insert ( gpa_name_map , ( gpointer ) ( hfinfo -> abbrev ) , hfinfo ) ; if ( same_name_hfinfo ) { same_name_next_hfinfo = same_name_hfinfo -> same_name_next ; hfinfo -> same_name_next = same_name_next_hfinfo ; if ( same_name_next_hfinfo ) same_name_next_hfinfo -> same_name_prev_id = hfinfo -> id ; same_name_hfinfo -> same_name_next = hfinfo ; hfinfo -> same_name_prev_id = same_name_hfinfo -> id ; # ifdef ENABLE_CHECK_FILTER while ( same_name_hfinfo ) { if ( _ftype_common ( hfinfo -> type ) != _ftype_common ( same_name_hfinfo -> type ) ) fprintf ( stderr , "'%s' exists multiple times with NOT compatible types: %s and %s\n" , hfinfo -> abbrev , ftype_name ( hfinfo -> type ) , ftype_name ( same_name_hfinfo -> type ) ) ; same_name_hfinfo = same_name_hfinfo -> same_name_next ; } # endif } } return hfinfo -> id ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( ExtensionPreferenceApiTest , DISABLED_IncognitoDisabled ) { EXPECT_FALSE ( RunExtensionTest ( "preference/persistent_incognito" ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_func_fields ( ) { int rc ; MYSQL_RES * result ; MYSQL_FIELD * field ; myheader ( "test_func_fields" ) ; rc = mysql_autocommit ( mysql , TRUE ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "DROP TABLE IF EXISTS test_dateformat" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "CREATE TABLE test_dateformat(id int, \ ts timestamp)" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "INSERT INTO test_dateformat(id) values(10)" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "SELECT ts FROM test_dateformat" ) ; myquery ( rc ) ; result = mysql_store_result ( mysql ) ; mytest ( result ) ; field = mysql_fetch_field ( result ) ; mytest ( field ) ; if ( ! opt_silent ) fprintf ( stdout , "\n table name: `%s` (expected: `%s`)" , field -> table , "test_dateformat" ) ; DIE_UNLESS ( strcmp ( field -> table , "test_dateformat" ) == 0 ) ; field = mysql_fetch_field ( result ) ; mytest_r ( field ) ; mysql_free_result ( result ) ; rc = mysql_query ( mysql , "SELECT DATE_FORMAT(ts, '%Y') AS 'venu' FROM test_dateformat" ) ; myquery ( rc ) ; result = mysql_store_result ( mysql ) ; mytest ( result ) ; field = mysql_fetch_field ( result ) ; mytest ( field ) ; if ( ! opt_silent ) fprintf ( stdout , "\n table name: `%s` (expected: `%s`)" , field -> table , "" ) ; DIE_UNLESS ( field -> table [ 0 ] == '\0' ) ; field = mysql_fetch_field ( result ) ; mytest_r ( field ) ; mysql_free_result ( result ) ; rc = mysql_query ( mysql , "SELECT DATE_FORMAT(ts, '%Y') AS 'YEAR' FROM test_dateformat" ) ; myquery ( rc ) ; result = mysql_store_result ( mysql ) ; mytest ( result ) ; field = mysql_fetch_field ( result ) ; mytest ( field ) ; if ( ! opt_silent ) { printf ( "\n field name: `%s` (expected: `%s`)" , field -> name , "YEAR" ) ; printf ( "\n field org name: `%s` (expected: `%s`)" , field -> org_name , "" ) ; } DIE_UNLESS ( strcmp ( field -> name , "YEAR" ) == 0 ) ; DIE_UNLESS ( field -> org_name [ 0 ] == '\0' ) ; field = mysql_fetch_field ( result ) ; mytest_r ( field ) ; mysql_free_result ( result ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static UHashTok _uhash_remove ( UHashtable * hash , UHashTok key ) { UHashTok result ; UHashElement * e = _uhash_find ( hash , key , hash -> keyHasher ( key ) ) ; U_ASSERT ( e != NULL ) ; result . pointer = NULL ; result . integer = 0 ; if ( ! IS_EMPTY_OR_DELETED ( e -> hashcode ) ) { result = _uhash_internalRemoveElement ( hash , e ) ; if ( hash -> count < hash -> lowWaterMark ) { UErrorCode status = U_ZERO_ERROR ; _uhash_rehash ( hash , & status ) ; } } return result ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void proto_register_netbios ( void ) { static gint * ett [ ] = { & ett_netb , & ett_netb_name , & ett_netb_flags , & ett_netb_status , & ett_netb_fragments , & ett_netb_fragment , } ; static hf_register_info hf_netb [ ] = { { & hf_netb_cmd , { "Command" , "netbios.command" , FT_UINT8 , BASE_HEX | BASE_EXT_STRING , & cmd_vals_ext , 0x0 , NULL , HFILL } } , { & hf_netb_hdr_len , { "Length" , "netbios.hdr_len" , FT_UINT16 , BASE_DEC , NULL , 0x0 , "Header Length" , HFILL } } , { & hf_netb_delimiter , { "Delimiter" , "netbios.delimiter" , FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_xmit_corrl , { "Transmit Correlator" , "netbios.xmit_corrl" , FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_resp_corrl , { "Response Correlator" , "netbios.resp_corrl" , FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_call_name_type , { "Caller's Name Type" , "netbios.call_name_type" , FT_UINT8 , BASE_HEX , VALS ( name_types ) , 0x0 , NULL , HFILL } } , { & hf_netb_nb_name_type , { "NetBIOS Name Type" , "netbios.nb_name_type" , FT_UINT8 , BASE_HEX | BASE_EXT_STRING , & nb_name_type_vals_ext , 0x0 , NULL , HFILL } } , { & hf_netb_nb_name , { "NetBIOS Name" , "netbios.nb_name" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_version , { "NetBIOS Version" , "netbios.version" , FT_BOOLEAN , 8 , TFS ( & netb_version_str ) , 0x01 , NULL , HFILL } } , { & hf_netbios_no_receive_flags , { "Flags" , "netbios.no_receive_flags" , FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } , { & hf_netbios_no_receive_flags_send_no_ack , { "SEND.NO.ACK data received" , "netbios.no_receive_flags.send_no_ack" , FT_BOOLEAN , 8 , TFS ( & tfs_no_yes ) , 0x02 , NULL , HFILL } } , { & hf_netb_largest_frame , { "Largest Frame" , "netbios.largest_frame" , FT_UINT8 , BASE_DEC , VALS ( max_frame_size_vals ) , 0x0E , NULL , HFILL } } , { & hf_netb_status_buffer_len , { "Length of status buffer" , "netbios.status_buffer_len" , FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_status , { "Status" , "netbios.status" , FT_UINT8 , BASE_DEC , VALS ( status_vals ) , 0x0 , NULL , HFILL } } , { & hf_netb_name_type , { "Name type" , "netbios.name_type" , FT_UINT16 , BASE_DEC , VALS ( name_types ) , 0x0 , NULL , HFILL } } , { & hf_netb_max_data_recv_size , { "Maximum data receive size" , "netbios.max_data_recv_size" , FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_termination_indicator , { "Termination indicator" , "netbios.termination_indicator" , FT_UINT16 , BASE_HEX , VALS ( termination_indicator_vals ) , 0x0 , NULL , HFILL } } , { & hf_netb_num_data_bytes_accepted , { "Number of data bytes accepted" , "netbios.num_data_bytes_accepted" , FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_local_ses_no , { "Local Session No." , "netbios.local_session" , FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_remote_ses_no , { "Remote Session No." , "netbios.remote_session" , FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_flags , { "Flags" , "netbios.flags" , FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_flags_send_no_ack , { "Handle SEND.NO.ACK" , "netbios.flags.send_no_ack" , FT_BOOLEAN , 8 , TFS ( & tfs_yes_no ) , 0x80 , NULL , HFILL } } , { & hf_netb_flags_ack , { "Acknowledge" , "netbios.flags.ack" , FT_BOOLEAN , 8 , TFS ( & tfs_set_notset ) , 0x08 , NULL , HFILL } } , { & hf_netb_flags_ack_with_data , { "Acknowledge with data" , "netbios.flags.ack_with_data" , FT_BOOLEAN , 8 , TFS ( & flags_allowed ) , 0x04 , NULL , HFILL } } , { & hf_netb_flags_ack_expected , { "Acknowledge expected" , "netbios.flags.ack_expected" , FT_BOOLEAN , 8 , TFS ( & tfs_yes_no ) , 0x02 , NULL , HFILL } } , { & hf_netb_flags_recv_cont_req , { "RECEIVE_CONTINUE requested" , "netbios.flags.recv_cont_req" , FT_BOOLEAN , 8 , TFS ( & tfs_yes_no ) , 0x01 , NULL , HFILL } } , { & hf_netb_data2 , { "DATA2 value" , "netbios.data2" , FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_data2_frame , { "Data length exceeds maximum frame size" , "netbios.data2.frame" , FT_BOOLEAN , 16 , TFS ( & tfs_yes_no ) , 0x8000 , NULL , HFILL } } , { & hf_netb_data2_user , { "Data length exceeds user's buffer" , "netbios.data2.user" , FT_BOOLEAN , 16 , TFS ( & tfs_yes_no ) , 0x4000 , NULL , HFILL } } , { & hf_netb_data2_status , { "Status data length" , "netbios.data2.status" , FT_UINT16 , BASE_DEC , NULL , 0x3FFF , NULL , HFILL } } , { & hf_netb_datagram_mac , { "Sender's MAC Address" , "netbios.datagram_mac" , FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_datagram_bcast_mac , { "Sender's Node Address" , "netbios.datagram_bcast_mac" , FT_ETHER , BASE_NONE , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_resync_indicator , { "Re-sync indicator" , "netbios.resync_indicator" , FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_status_request , { "Status request" , "netbios.status_request" , FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_local_session_no , { "Local Session No." , "netbios.local_session_no" , FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_state_of_name , { "State of name" , "netbios.state_of_name" , FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_status_response , { "Status response" , "netbios.status_response" , FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_fragment_overlap , { "Fragment overlap" , "netbios.fragment.overlap" , FT_BOOLEAN , BASE_NONE , NULL , 0x0 , "Fragment overlaps with other fragments" , HFILL } } , { & hf_netb_fragment_overlap_conflict , { "Conflicting data in fragment overlap" , "netbios.fragment.overlap.conflict" , FT_BOOLEAN , BASE_NONE , NULL , 0x0 , "Overlapping fragments contained conflicting data" , HFILL } } , { & hf_netb_fragment_multiple_tails , { "Multiple tail fragments found" , "netbios.fragment.multipletails" , FT_BOOLEAN , BASE_NONE , NULL , 0x0 , "Several tails were found when defragmenting the packet" , HFILL } } , { & hf_netb_fragment_too_long_fragment , { "Fragment too long" , "netbios.fragment.toolongfragment" , FT_BOOLEAN , BASE_NONE , NULL , 0x0 , "Fragment contained data past end of packet" , HFILL } } , { & hf_netb_fragment_error , { "Defragmentation error" , "netbios.fragment.error" , FT_FRAMENUM , BASE_NONE , NULL , 0x0 , "Defragmentation error due to illegal fragments" , HFILL } } , { & hf_netb_fragment_count , { "Fragment count" , "netbios.fragment.count" , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_fragment , { "NetBIOS Fragment" , "netbios.fragment" , FT_FRAMENUM , BASE_NONE , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_fragments , { "NetBIOS Fragments" , "netbios.fragments" , FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL } } , { & hf_netb_reassembled_length , { "Reassembled NetBIOS length" , "netbios.reassembled.length" , FT_UINT32 , BASE_DEC , NULL , 0x0 , "The total length of the reassembled payload" , HFILL } } , } ; static ei_register_info ei [ ] = { { & ei_netb_unknown_command_data , { "netbios.unknown_command_data" , PI_UNDECODED , PI_WARN , "Unknown NetBIOS command data" , EXPFILL } } , } ; module_t * netbios_module ; expert_module_t * expert_netbios ; proto_netbios = proto_register_protocol ( "NetBIOS" , "NetBIOS" , "netbios" ) ; proto_register_subtree_array ( ett , array_length ( ett ) ) ; proto_register_field_array ( proto_netbios , hf_netb , array_length ( hf_netb ) ) ; expert_netbios = expert_register_protocol ( proto_netbios ) ; expert_register_field_array ( expert_netbios , ei , array_length ( ei ) ) ; netbios_heur_subdissector_list = register_heur_dissector_list ( "netbios" , proto_netbios ) ; netbios_module = prefs_register_protocol ( proto_netbios , NULL ) ; prefs_register_bool_preference ( netbios_module , "defragment" , "Reassemble fragmented NetBIOS messages spanning multiple frames" , "Whether the NetBIOS dissector should defragment messages spanning multiple frames" , & netbios_defragment ) ; register_init_routine ( netbios_init ) ; register_cleanup_routine ( netbios_cleanup ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_tran_innodb ( ) { MYSQL_RES * result ; MYSQL_ROW row ; int rc ; myheader ( "test_tran_innodb" ) ; rc = mysql_autocommit ( mysql , FALSE ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "DROP TABLE IF EXISTS my_demo_transaction" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "CREATE TABLE my_demo_transaction(col1 int, " "col2 varchar(30)) ENGINE= InnoDB" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "INSERT INTO my_demo_transaction VALUES(10, 'venu')" ) ; myquery ( rc ) ; rc = mysql_commit ( mysql ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "INSERT INTO my_demo_transaction VALUES(20, 'mysql')" ) ; myquery ( rc ) ; rc = mysql_rollback ( mysql ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "DELETE FROM my_demo_transaction WHERE col1= 10" ) ; myquery ( rc ) ; rc = mysql_rollback ( mysql ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "SELECT * FROM my_demo_transaction" ) ; myquery ( rc ) ; result = mysql_store_result ( mysql ) ; mytest ( result ) ; ( void ) my_process_result_set ( result ) ; mysql_free_result ( result ) ; rc = mysql_query ( mysql , "SELECT * FROM my_demo_transaction" ) ; myquery ( rc ) ; result = mysql_use_result ( mysql ) ; mytest ( result ) ; row = mysql_fetch_row ( result ) ; mytest ( row ) ; row = mysql_fetch_row ( result ) ; mytest_r ( row ) ; mysql_free_result ( result ) ; mysql_autocommit ( mysql , TRUE ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static pdf_material * pdf_keep_material ( fz_context * ctx , pdf_material * mat ) { if ( mat -> colorspace ) fz_keep_colorspace ( ctx , mat -> colorspace ) ; if ( mat -> pattern ) pdf_keep_pattern ( ctx , mat -> pattern ) ; if ( mat -> shade ) fz_keep_shade ( ctx , mat -> shade ) ; return mat ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_T_nonCollapsingRaw ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 689 "../../asn1/h245/h245.cnf" tvbuff_t * value_tvb ; gef_ctx_t * parent_gefx ; gef_ctx_t * gefx ; parent_gefx = gef_ctx_get ( actx -> private_data ) ; actx -> private_data = gef_ctx_alloc ( parent_gefx , "nonCollapsingRaw" ) ; offset = dissect_per_octet_string ( tvb , offset , actx , tree , hf_index , NO_BOUND , NO_BOUND , FALSE , & value_tvb ) ; gefx = gef_ctx_get ( actx -> private_data ) ; if ( gefx ) { dissector_try_string ( gef_content_dissector_table , gefx -> key , value_tvb , actx -> pinfo , tree , actx ) ; } actx -> private_data = parent_gefx ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_fetch_double ( ) { int rc ; myheader ( "test_fetch_double" ) ; rc = mysql_query ( mysql , "DROP TABLE IF EXISTS test_bind_fetch" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "CREATE TABLE test_bind_fetch(c1 double(5, 2), " "c2 double unsigned, c3 double unsigned, " "c4 double unsigned, c5 double unsigned, " "c6 double unsigned, c7 double unsigned)" ) ; myquery ( rc ) ; bind_fetch ( 3 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
u_int sl_bsdos_if_print ( netdissect_options * ndo , const struct pcap_pkthdr * h , const u_char * p ) { register u_int caplen = h -> caplen ; register u_int length = h -> len ; register const struct ip * ip ; if ( caplen < SLIP_HDRLEN ) { ND_PRINT ( ( ndo , "%s" , tstr ) ) ; return ( caplen ) ; } length -= SLIP_HDRLEN ; ip = ( const struct ip * ) ( p + SLIP_HDRLEN ) ; # ifdef notdef if ( ndo -> ndo_eflag ) sliplink_print ( ndo , p , ip , length ) ; # endif ip_print ( ndo , ( const u_char * ) ip , length ) ; return ( SLIP_HDRLEN ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
hb_bool_t _hb_graphite2_shape ( hb_shape_plan_t * shape_plan , hb_font_t * font , hb_buffer_t * buffer , const hb_feature_t * features , unsigned int num_features ) { hb_face_t * face = font -> face ; gr_face * grface = HB_SHAPER_DATA_GET ( face ) -> grface ; gr_font * grfont = HB_SHAPER_DATA_GET ( font ) ; const char * lang = hb_language_to_string ( hb_buffer_get_language ( buffer ) ) ; const char * lang_end = lang ? strchr ( lang , '-' ) : NULL ; int lang_len = lang_end ? lang_end - lang : - 1 ; gr_feature_val * feats = gr_face_featureval_for_lang ( grface , lang ? hb_tag_from_string ( lang , lang_len ) : 0 ) ; for ( unsigned int i = 0 ; i < num_features ; i ++ ) { const gr_feature_ref * fref = gr_face_find_fref ( grface , features [ i ] . tag ) ; if ( fref ) gr_fref_set_feature_value ( fref , features [ i ] . value , feats ) ; } gr_segment * seg = NULL ; const gr_slot * is ; unsigned int ci = 0 , ic = 0 ; float curradvx = 0. , curradvy = 0. ; unsigned int scratch_size ; hb_buffer_t : : scratch_buffer_t * scratch = buffer -> get_scratch_buffer ( & scratch_size ) ; uint32_t * chars = ( uint32_t * ) scratch ; for ( unsigned int i = 0 ; i < buffer -> len ; ++ i ) chars [ i ] = buffer -> info [ i ] . codepoint ; hb_tag_t script_tag [ 2 ] ; hb_ot_tags_from_script ( hb_buffer_get_script ( buffer ) , & script_tag [ 0 ] , & script_tag [ 1 ] ) ; seg = gr_make_seg ( grfont , grface , script_tag [ 1 ] == HB_TAG_NONE ? script_tag [ 0 ] : script_tag [ 1 ] , feats , gr_utf32 , chars , buffer -> len , | ( hb_buffer_get_direction ( buffer ) == HB_DIRECTION_RTL ? 1 : 0 ) ) ; if ( unlikely ( ! seg ) ) { if ( feats ) gr_featureval_destroy ( feats ) ; return false ; } unsigned int glyph_count = gr_seg_n_slots ( seg ) ; if ( unlikely ( ! glyph_count ) ) { if ( feats ) gr_featureval_destroy ( feats ) ; gr_seg_destroy ( seg ) ; buffer -> len = 0 ; return true ; } buffer -> ensure ( glyph_count ) ; scratch = buffer -> get_scratch_buffer ( & scratch_size ) ; while ( ( DIV_CEIL ( sizeof ( hb_graphite2_cluster_t ) * buffer -> len , sizeof ( * scratch ) ) + DIV_CEIL ( sizeof ( hb_codepoint_t ) * glyph_count , sizeof ( * scratch ) ) ) > scratch_size ) { if ( unlikely ( ! buffer -> ensure ( buffer -> allocated * 2 ) ) ) { if ( feats ) gr_featureval_destroy ( feats ) ; gr_seg_destroy ( seg ) ; return false ; } scratch = buffer -> get_scratch_buffer ( & scratch_size ) ; } # define ALLOCATE_ARRAY ( Type , name , len ) Type * name = ( Type * ) scratch ; { unsigned int _consumed = DIV_CEIL ( ( len ) * sizeof ( Type ) , sizeof ( * scratch ) ) ; assert ( _consumed <= scratch_size ) ; scratch += _consumed ; scratch_size -= _consumed ; } ALLOCATE_ARRAY ( hb_graphite2_cluster_t , clusters , buffer -> len ) ; ALLOCATE_ARRAY ( hb_codepoint_t , gids , glyph_count ) ; # undef ALLOCATE_ARRAY memset ( clusters , 0 , sizeof ( clusters [ 0 ] ) * buffer -> len ) ; hb_codepoint_t * pg = gids ; clusters [ 0 ] . cluster = buffer -> info [ 0 ] . cluster ; for ( is = gr_seg_first_slot ( seg ) , ic = 0 ; is ; is = gr_slot_next_in_segment ( is ) , ic ++ ) { unsigned int before = gr_slot_before ( is ) ; unsigned int after = gr_slot_after ( is ) ; * pg = gr_slot_gid ( is ) ; pg ++ ; while ( clusters [ ci ] . base_char > before && ci ) { clusters [ ci - 1 ] . num_chars += clusters [ ci ] . num_chars ; clusters [ ci - 1 ] . num_glyphs += clusters [ ci ] . num_glyphs ; ci -- ; } if ( gr_slot_can_insert_before ( is ) && clusters [ ci ] . num_chars && before >= clusters [ ci ] . base_char + clusters [ ci ] . num_chars ) { hb_graphite2_cluster_t * c = clusters + ci + 1 ; c -> base_char = clusters [ ci ] . base_char + clusters [ ci ] . num_chars ; c -> cluster = buffer -> info [ c -> base_char ] . cluster ; c -> num_chars = before - c -> base_char ; c -> base_glyph = ic ; c -> num_glyphs = 0 ; ci ++ ; } clusters [ ci ] . num_glyphs ++ ; if ( clusters [ ci ] . base_char + clusters [ ci ] . num_chars < after + 1 ) clusters [ ci ] . num_chars = after + 1 - clusters [ ci ] . base_char ; } ci ++ ; for ( unsigned int i = 0 ; i < ci ; ++ i ) { for ( unsigned int j = 0 ; j < clusters [ i ] . num_glyphs ; ++ j ) { hb_glyph_info_t * info = & buffer -> info [ clusters [ i ] . base_glyph + j ] ; info -> codepoint = gids [ clusters [ i ] . base_glyph + j ] ; info -> cluster = clusters [ i ] . cluster ; } } buffer -> len = glyph_count ; if ( ! HB_DIRECTION_IS_BACKWARD ( buffer -> props . direction ) ) { hb_glyph_position_t * pPos ; for ( pPos = hb_buffer_get_glyph_positions ( buffer , NULL ) , is = gr_seg_first_slot ( seg ) ; is ; pPos ++ , is = gr_slot_next_in_segment ( is ) ) { pPos -> x_offset = gr_slot_origin_X ( is ) - curradvx ; pPos -> y_offset = gr_slot_origin_Y ( is ) - curradvy ; pPos -> x_advance = gr_slot_advance_X ( is , grface , grfont ) ; pPos -> y_advance = gr_slot_advance_Y ( is , grface , grfont ) ; curradvx += pPos -> x_advance ; curradvy += pPos -> y_advance ; } pPos [ - 1 ] . x_advance += gr_seg_advance_X ( seg ) - curradvx ; } else { hb_glyph_position_t * pPos = hb_buffer_get_glyph_positions ( buffer , NULL ) + buffer -> len - 1 ; const hb_glyph_info_t * info = buffer -> info + buffer -> len - 1 ; const hb_glyph_info_t * tinfo ; const gr_slot * tis ; int currclus = - 1 ; float clusx = 0. , clusy = 0. ; for ( is = gr_seg_last_slot ( seg ) ; is ; pPos -- , info -- , is = gr_slot_prev_in_segment ( is ) ) { if ( info -> cluster != currclus ) { curradvx += clusx ; curradvy += clusy ; currclus = info -> cluster ; clusx = 0. ; clusy = 0. ; for ( tis = is , tinfo = info ; tis && tinfo -> cluster == currclus ; tis = gr_slot_prev_in_segment ( tis ) , tinfo -- ) { clusx += gr_slot_advance_X ( tis , grface , grfont ) ; clusy += gr_slot_advance_Y ( tis , grface , grfont ) ; } curradvx += clusx ; curradvy += clusy ; } pPos -> x_advance = gr_slot_advance_X ( is , grface , grfont ) ; pPos -> y_advance = gr_slot_advance_Y ( is , grface , grfont ) ; curradvx -= pPos -> x_advance ; curradvy -= pPos -> y_advance ; pPos -> x_offset = gr_slot_origin_X ( is ) - curradvx ; pPos -> y_offset = gr_slot_origin_Y ( is ) - curradvy ; } hb_buffer_reverse_clusters ( buffer ) ; } if ( feats ) gr_featureval_destroy ( feats ) ; gr_seg_destroy ( seg ) ; return true ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void ff_compute_band_indexes ( MPADecodeContext * s , GranuleDef * g ) { if ( g -> block_type == 2 ) { if ( g -> switch_point ) { if ( s -> sample_rate_index <= 2 ) g -> long_end = 8 ; else g -> long_end = 6 ; g -> short_start = 3 ; } else { g -> long_end = 0 ; g -> short_start = 0 ; } } else { g -> short_start = 13 ; g -> long_end = 22 ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void tee_puts ( const char * s , FILE * file ) { fputs ( s , file ) ; fputc ( '\n' , file ) ; if ( opt_outfile ) { fputs ( s , OUTFILE ) ; fputc ( '\n' , OUTFILE ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void copy_cell ( Indeo3DecodeContext * ctx , Plane * plane , Cell * cell ) { int h , w , mv_x , mv_y , offset , offset_dst ; uint8_t * src , * dst ; offset_dst = ( cell -> ypos << 2 ) * plane -> pitch + ( cell -> xpos << 2 ) ; dst = plane -> pixels [ ctx -> buf_sel ] + offset_dst ; mv_y = cell -> mv_ptr [ 0 ] ; mv_x = cell -> mv_ptr [ 1 ] ; offset = offset_dst + mv_y * plane -> pitch + mv_x ; src = plane -> pixels [ ctx -> buf_sel ^ 1 ] + offset ; h = cell -> height << 2 ; for ( w = cell -> width ; w > 0 ; ) { if ( ! ( ( cell -> xpos << 2 ) & 15 ) && w >= 4 ) { for ( ; w >= 4 ; src += 16 , dst += 16 , w -= 4 ) ctx -> dsp . put_no_rnd_pixels_tab [ 0 ] [ 0 ] ( dst , src , plane -> pitch , h ) ; } if ( ! ( ( cell -> xpos << 2 ) & 7 ) && w >= 2 ) { ctx -> dsp . put_no_rnd_pixels_tab [ 1 ] [ 0 ] ( dst , src , plane -> pitch , h ) ; w -= 2 ; src += 8 ; dst += 8 ; } if ( w >= 1 ) { ctx -> dsp . put_no_rnd_pixels_tab [ 2 ] [ 0 ] ( dst , src , plane -> pitch , h ) ; w -- ; src += 4 ; dst += 4 ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int mime_hdr_fields_count ( MIMEHdrImpl * mh ) { unsigned int index ; MIMEFieldBlockImpl * fblock ; MIMEField * field ; int count ; count = 0 ; for ( fblock = & ( mh -> m_first_fblock ) ; fblock != nullptr ; fblock = fblock -> m_next ) { for ( index = 0 ; index < fblock -> m_freetop ; index ++ ) { field = & ( fblock -> m_field_slots [ index ] ) ; if ( field -> is_live ( ) ) { ++ count ; } } } return count ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
Oid get_func_signature ( Oid funcid , Oid * * argtypes , int * nargs ) { HeapTuple tp ; Form_pg_proc procstruct ; Oid result ; tp = SearchSysCache1 ( PROCOID , ObjectIdGetDatum ( funcid ) ) ; if ( ! HeapTupleIsValid ( tp ) ) elog ( ERROR , "cache lookup failed for function %u" , funcid ) ; procstruct = ( Form_pg_proc ) GETSTRUCT ( tp ) ; result = procstruct -> prorettype ; * nargs = ( int ) procstruct -> pronargs ; Assert ( * nargs == procstruct -> proargtypes . dim1 ) ; * argtypes = ( Oid * ) palloc ( * nargs * sizeof ( Oid ) ) ; memcpy ( * argtypes , procstruct -> proargtypes . values , * nargs * sizeof ( Oid ) ) ; ReleaseSysCache ( tp ) ; return result ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static double get_rate_correction_factor ( const VP9_COMP * cpi ) { const RATE_CONTROL * const rc = & cpi -> rc ; if ( cpi -> common . frame_type == KEY_FRAME ) { return rc -> rate_correction_factors [ KF_STD ] ; } else if ( cpi -> oxcf . pass == 2 ) { RATE_FACTOR_LEVEL rf_lvl = cpi -> twopass . gf_group . rf_level [ cpi -> twopass . gf_group . index ] ; return rc -> rate_correction_factors [ rf_lvl ] ; } else { if ( ( cpi -> refresh_alt_ref_frame || cpi -> refresh_golden_frame ) && ! rc -> is_src_frame_alt_ref && ! ( cpi -> use_svc && cpi -> oxcf . rc_mode == VPX_CBR ) ) return rc -> rate_correction_factors [ GF_ARF_STD ] ; else return rc -> rate_correction_factors [ INTER_NORMAL ] ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void idreg_class_init ( ObjectClass * klass , void * data ) { SysBusDeviceClass * k = SYS_BUS_DEVICE_CLASS ( klass ) ; k -> init = idreg_init1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void pim_print ( netdissect_options * ndo , register const u_char * bp , register u_int len , const u_char * bp2 ) { register const u_char * ep ; register const struct pim * pim = ( const struct pim * ) bp ; ep = ( const u_char * ) ndo -> ndo_snapend ; if ( bp >= ep ) return ; # ifdef notyet ND_TCHECK ( pim -> pim_rsv ) ; # endif switch ( PIM_VER ( pim -> pim_typever ) ) { case 2 : if ( ! ndo -> ndo_vflag ) { ND_PRINT ( ( ndo , "PIMv%u, %s, length %u" , PIM_VER ( pim -> pim_typever ) , tok2str ( pimv2_type_values , "Unknown Type" , PIM_TYPE ( pim -> pim_typever ) ) , len ) ) ; return ; } else { ND_PRINT ( ( ndo , "PIMv%u, length %u\n\t%s" , PIM_VER ( pim -> pim_typever ) , len , tok2str ( pimv2_type_values , "Unknown Type" , PIM_TYPE ( pim -> pim_typever ) ) ) ) ; pimv2_print ( ndo , bp , len , bp2 ) ; } break ; default : ND_PRINT ( ( ndo , "PIMv%u, length %u" , PIM_VER ( pim -> pim_typever ) , len ) ) ; break ; } return ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void handle_transform ( TSCont contp ) { TSVConn output_conn ; TSVIO write_vio ; int64_t towrite ; int64_t avail ; output_conn = TSTransformOutputVConnGet ( contp ) ; write_vio = TSVConnWriteVIOGet ( contp ) ; auto * data = static_cast < AppendTransformTestData * > ( TSContDataGet ( contp ) ) ; if ( ! data -> output_buffer ) { towrite = TSVIONBytesGet ( write_vio ) ; if ( towrite != INT64_MAX ) { towrite += append_buffer_length ; } data -> output_buffer = TSIOBufferCreate ( ) ; data -> output_reader = TSIOBufferReaderAlloc ( data -> output_buffer ) ; data -> output_vio = TSVConnWrite ( output_conn , contp , data -> output_reader , towrite ) ; } ink_assert ( data -> output_vio ) ; if ( ! TSVIOBufferGet ( write_vio ) ) { if ( data -> append_needed ) { data -> append_needed = 0 ; TSIOBufferCopy ( TSVIOBufferGet ( data -> output_vio ) , append_buffer_reader , append_buffer_length , 0 ) ; } TSVIONBytesSet ( data -> output_vio , TSVIONDoneGet ( write_vio ) + append_buffer_length ) ; TSVIOReenable ( data -> output_vio ) ; return ; } towrite = TSVIONTodoGet ( write_vio ) ; if ( towrite > 0 ) { avail = TSIOBufferReaderAvail ( TSVIOReaderGet ( write_vio ) ) ; if ( towrite > avail ) { towrite = avail ; } if ( towrite > 0 ) { TSIOBufferCopy ( TSVIOBufferGet ( data -> output_vio ) , TSVIOReaderGet ( write_vio ) , towrite , 0 ) ; TSIOBufferReaderConsume ( TSVIOReaderGet ( write_vio ) , towrite ) ; TSVIONDoneSet ( write_vio , TSVIONDoneGet ( write_vio ) + towrite ) ; } } if ( TSVIONTodoGet ( write_vio ) > 0 ) { if ( towrite > 0 ) { TSVIOReenable ( data -> output_vio ) ; TSContCall ( TSVIOContGet ( write_vio ) , TS_EVENT_VCONN_WRITE_READY , write_vio ) ; } } else { if ( data -> append_needed ) { data -> append_needed = 0 ; TSIOBufferCopy ( TSVIOBufferGet ( data -> output_vio ) , append_buffer_reader , append_buffer_length , 0 ) ; } TSVIONBytesSet ( data -> output_vio , TSVIONDoneGet ( write_vio ) + append_buffer_length ) ; TSVIOReenable ( data -> output_vio ) ; TSContCall ( TSVIOContGet ( write_vio ) , TS_EVENT_VCONN_WRITE_COMPLETE , write_vio ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void copy_pack_data ( struct sha1file * f , struct packed_git * p , struct pack_window * * w_curs , off_t offset , off_t len ) { unsigned char * in ; unsigned long avail ; while ( len ) { in = use_pack ( p , w_curs , offset , & avail ) ; if ( avail > len ) avail = ( unsigned long ) len ; sha1write ( f , in , avail ) ; offset += avail ; len -= avail ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void * vpx_svc_get_buffer ( SvcContext * svc_ctx ) { SvcInternal * const si = get_svc_internal ( svc_ctx ) ; if ( svc_ctx == NULL || si == NULL || si -> frame_list == NULL ) return NULL ; if ( si -> frame_temp ) fd_free ( si -> frame_temp ) ; si -> frame_temp = si -> frame_list ; si -> frame_list = si -> frame_list -> next ; return si -> frame_temp -> buf ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
struct archive_string * archive_strncat ( struct archive_string * as , const void * _p , size_t n ) { size_t s ; const char * p , * pp ; p = ( const char * ) _p ; s = 0 ; pp = p ; while ( s < n && * pp ) { pp ++ ; s ++ ; } if ( ( as = archive_string_append ( as , p , s ) ) == NULL ) __archive_errx ( 1 , "Out of memory" ) ; return ( as ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int usbdev_notify ( struct notifier_block * self , unsigned long action , void * dev ) { switch ( action ) { case USB_DEVICE_ADD : break ; case USB_DEVICE_REMOVE : usbdev_remove ( dev ) ; break ; } return NOTIFY_OK ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int vpx_codec_pkt_list_add ( struct vpx_codec_pkt_list * list , const struct vpx_codec_cx_pkt * pkt ) { if ( list -> cnt < list -> max ) { list -> pkts [ list -> cnt ++ ] = * pkt ; return 0 ; } return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void y4m_convert_411_420jpeg ( y4m_input * _y4m , unsigned char * _dst , unsigned char * _aux ) { unsigned char * tmp ; int c_w ; int c_h ; int c_sz ; int dst_c_w ; int dst_c_h ; int dst_c_sz ; int tmp_sz ; int pli ; int y ; int x ; _dst += _y4m -> pic_w * _y4m -> pic_h ; c_w = ( _y4m -> pic_w + _y4m -> src_c_dec_h - 1 ) / _y4m -> src_c_dec_h ; c_h = _y4m -> pic_h ; dst_c_w = ( _y4m -> pic_w + _y4m -> dst_c_dec_h - 1 ) / _y4m -> dst_c_dec_h ; dst_c_h = ( _y4m -> pic_h + _y4m -> dst_c_dec_v - 1 ) / _y4m -> dst_c_dec_v ; c_sz = c_w * c_h ; dst_c_sz = dst_c_w * dst_c_h ; tmp_sz = dst_c_w * c_h ; tmp = _aux + 2 * c_sz ; for ( pli = 1 ; pli < 3 ; pli ++ ) { for ( y = 0 ; y < c_h ; y ++ ) { for ( x = 0 ; x < OC_MINI ( c_w , 1 ) ; x ++ ) { tmp [ x << 1 ] = ( unsigned char ) OC_CLAMPI ( 0 , ( 111 * _aux [ 0 ] + 18 * _aux [ OC_MINI ( 1 , c_w - 1 ) ] - _aux [ OC_MINI ( 2 , c_w - 1 ) ] + 64 ) >> 7 , 255 ) ; tmp [ x << 1 | 1 ] = ( unsigned char ) OC_CLAMPI ( 0 , ( 47 * _aux [ 0 ] + 86 * _aux [ OC_MINI ( 1 , c_w - 1 ) ] - 5 * _aux [ OC_MINI ( 2 , c_w - 1 ) ] + 64 ) >> 7 , 255 ) ; } for ( ; x < c_w - 2 ; x ++ ) { tmp [ x << 1 ] = ( unsigned char ) OC_CLAMPI ( 0 , ( _aux [ x - 1 ] + 110 * _aux [ x ] + 18 * _aux [ x + 1 ] - _aux [ x + 2 ] + 64 ) >> 7 , 255 ) ; tmp [ x << 1 | 1 ] = ( unsigned char ) OC_CLAMPI ( 0 , ( - 3 * _aux [ x - 1 ] + 50 * _aux [ x ] + 86 * _aux [ x + 1 ] - 5 * _aux [ x + 2 ] + 64 ) >> 7 , 255 ) ; } for ( ; x < c_w ; x ++ ) { tmp [ x << 1 ] = ( unsigned char ) OC_CLAMPI ( 0 , ( _aux [ x - 1 ] + 110 * _aux [ x ] + 18 * _aux [ OC_MINI ( x + 1 , c_w - 1 ) ] - _aux [ c_w - 1 ] + 64 ) >> 7 , 255 ) ; if ( ( x << 1 | 1 ) < dst_c_w ) { tmp [ x << 1 | 1 ] = ( unsigned char ) OC_CLAMPI ( 0 , ( - 3 * _aux [ x - 1 ] + 50 * _aux [ x ] + 86 * _aux [ OC_MINI ( x + 1 , c_w - 1 ) ] - 5 * _aux [ c_w - 1 ] + 64 ) >> 7 , 255 ) ; } } tmp += dst_c_w ; _aux += c_w ; } tmp -= tmp_sz ; y4m_422jpeg_420jpeg_helper ( _dst , tmp , dst_c_w , c_h ) ; _dst += dst_c_sz ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int selinux_kernel_module_request ( char * kmod_name ) { u32 sid ; struct common_audit_data ad ; sid = task_sid ( current ) ; ad . type = LSM_AUDIT_DATA_KMOD ; ad . u . kmod_name = kmod_name ; return avc_has_perm ( sid , SECINITSID_KERNEL , SECCLASS_SYSTEM , SYSTEM__MODULE_REQUEST , & ad ) ; }
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 )
0False
Categorize the following code snippet as vulnerable or not. True or False
static void http_request_bad ( struct evhttp_request * req , void * arg ) { if ( req != NULL ) { fprintf ( stderr , "FAILED\n" ) ; exit ( 1 ) ; } test_ok = 1 ; event_loopexit ( NULL ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void decoder_LinkPicture ( decoder_t * p_decoder , picture_t * p_picture ) { p_decoder -> pf_picture_link ( p_decoder , p_picture ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
guint16 de_plmn_list ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo , guint32 offset , guint len , gchar * add_string , int string_len ) { guint8 octs [ 3 ] ; guint32 curr_offset ; gchar mcc [ 4 ] ; gchar mnc [ 4 ] ; guint8 num_plmn ; proto_tree * subtree ; curr_offset = offset ; num_plmn = 0 ; while ( ( len - ( curr_offset - offset ) ) >= 3 ) { octs [ 0 ] = tvb_get_guint8 ( tvb , curr_offset ) ; octs [ 1 ] = tvb_get_guint8 ( tvb , curr_offset + 1 ) ; octs [ 2 ] = tvb_get_guint8 ( tvb , curr_offset + 2 ) ; mcc_mnc_aux ( octs , mcc , mnc ) ; subtree = proto_tree_add_subtree_format ( tree , tvb , curr_offset , 3 , ett_gsm_a_plmn , NULL , "PLMN[%u]" , num_plmn + 1 ) ; proto_tree_add_string ( subtree , hf_gsm_a_mobile_country_code , tvb , curr_offset , 3 , mcc ) ; proto_tree_add_string ( subtree , hf_gsm_a_mobile_network_code , tvb , curr_offset , 3 , mnc ) ; curr_offset += 3 ; num_plmn ++ ; } if ( add_string ) g_snprintf ( add_string , string_len , " - %u PLMN%s" , num_plmn , plurality ( num_plmn , "" , "s" ) ) ; EXTRANEOUS_DATA_CHECK ( len , curr_offset - offset , pinfo , & ei_gsm_a_extraneous_data ) ; return ( curr_offset - offset ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void testIteratorState ( UCharIterator * iter1 , UCharIterator * iter2 , const char * n , int32_t middle ) { UChar32 u [ 4 ] ; UErrorCode errorCode ; UChar32 c ; uint32_t state ; int32_t i , j ; iter1 -> move ( iter1 , middle - 2 , UITER_ZERO ) ; for ( i = 0 ; i < 4 ; ++ i ) { c = iter1 -> next ( iter1 ) ; if ( c < 0 ) { log_err ( "test error: %s[%d]=%d\n" , n , middle - 2 + i , c ) ; return ; } u [ i ] = c ; } iter1 -> move ( iter1 , - 2 , UITER_CURRENT ) ; state = uiter_getState ( iter1 ) ; errorCode = U_ZERO_ERROR ; uiter_setState ( iter2 , state , & errorCode ) ; if ( U_FAILURE ( errorCode ) ) { log_err ( "%s->setState(0x%x) failed: %s\n" , n , state , u_errorName ( errorCode ) ) ; return ; } c = iter2 -> current ( iter2 ) ; if ( c != u [ 2 ] ) { log_err ( "%s->current(at %d)=U+%04x!=U+%04x\n" , n , middle , c , u [ 2 ] ) ; } c = iter2 -> previous ( iter2 ) ; if ( c != u [ 1 ] ) { log_err ( "%s->previous(at %d)=U+%04x!=U+%04x\n" , n , middle - 1 , c , u [ 1 ] ) ; } iter2 -> move ( iter2 , 2 , UITER_CURRENT ) ; c = iter2 -> next ( iter2 ) ; if ( c != u [ 3 ] ) { log_err ( "%s->next(at %d)=U+%04x!=U+%04x\n" , n , middle + 1 , c , u [ 3 ] ) ; } iter2 -> move ( iter2 , - 3 , UITER_CURRENT ) ; c = iter2 -> previous ( iter2 ) ; if ( c != u [ 0 ] ) { log_err ( "%s->previous(at %d)=U+%04x!=U+%04x\n" , n , middle - 2 , c , u [ 0 ] ) ; } iter2 -> move ( iter2 , 1 , UITER_CURRENT ) ; iter2 -> next ( iter2 ) ; i = iter1 -> getIndex ( iter1 , UITER_CURRENT ) ; j = iter2 -> getIndex ( iter2 , UITER_CURRENT ) ; if ( i != middle ) { log_err ( "%s->getIndex(current)=%d!=%d as expected\n" , n , i , middle ) ; } if ( i != j ) { log_err ( "%s->getIndex(current)=%d!=%d after setState()\n" , n , j , i ) ; } i = iter1 -> getIndex ( iter1 , UITER_LENGTH ) ; j = iter2 -> getIndex ( iter2 , UITER_LENGTH ) ; if ( i != j ) { log_err ( "%s->getIndex(length)=%d!=%d before/after setState()\n" , n , i , j ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static CURLFORMcode FormAdd ( struct curl_httppost * * httppost , struct curl_httppost * * last_post , va_list params ) { FormInfo * first_form , * current_form , * form = NULL ; CURLFORMcode return_value = CURL_FORMADD_OK ; const char * prevtype = NULL ; struct curl_httppost * post = NULL ; CURLformoption option ; struct curl_forms * forms = NULL ; char * array_value = NULL ; bool array_state = FALSE ; first_form = calloc ( 1 , sizeof ( struct FormInfo ) ) ; if ( ! first_form ) return CURL_FORMADD_MEMORY ; current_form = first_form ; while ( return_value == CURL_FORMADD_OK ) { if ( array_state && forms ) { option = forms -> option ; array_value = ( char * ) forms -> value ; forms ++ ; if ( CURLFORM_END == option ) { array_state = FALSE ; continue ; } } else { option = va_arg ( params , CURLformoption ) ; if ( CURLFORM_END == option ) break ; } switch ( option ) { case CURLFORM_ARRAY : if ( array_state ) return_value = CURL_FORMADD_ILLEGAL_ARRAY ; else { forms = va_arg ( params , struct curl_forms * ) ; if ( forms ) array_state = TRUE ; else return_value = CURL_FORMADD_NULL ; } break ; case CURLFORM_PTRNAME : # ifdef CURL_DOES_CONVERSIONS # else current_form -> flags |= HTTPPOST_PTRNAME ; # endif case CURLFORM_COPYNAME : if ( current_form -> name ) return_value = CURL_FORMADD_OPTION_TWICE ; else { char * name = array_state ? array_value : va_arg ( params , char * ) ; if ( name ) current_form -> name = name ; else return_value = CURL_FORMADD_NULL ; } break ; case CURLFORM_NAMELENGTH : if ( current_form -> namelength ) return_value = CURL_FORMADD_OPTION_TWICE ; else current_form -> namelength = array_state ? ( size_t ) array_value : ( size_t ) va_arg ( params , long ) ; break ; case CURLFORM_PTRCONTENTS : current_form -> flags |= HTTPPOST_PTRCONTENTS ; case CURLFORM_COPYCONTENTS : if ( current_form -> value ) return_value = CURL_FORMADD_OPTION_TWICE ; else { char * value = array_state ? array_value : va_arg ( params , char * ) ; if ( value ) current_form -> value = value ; else return_value = CURL_FORMADD_NULL ; } break ; case CURLFORM_CONTENTSLENGTH : if ( current_form -> contentslength ) return_value = CURL_FORMADD_OPTION_TWICE ; else current_form -> contentslength = array_state ? ( size_t ) array_value : ( size_t ) va_arg ( params , long ) ; break ; case CURLFORM_FILECONTENT : if ( current_form -> flags & ( HTTPPOST_PTRCONTENTS | HTTPPOST_READFILE ) ) return_value = CURL_FORMADD_OPTION_TWICE ; else { const char * filename = array_state ? array_value : va_arg ( params , char * ) ; if ( filename ) { current_form -> value = strdup ( filename ) ; if ( ! current_form -> value ) return_value = CURL_FORMADD_MEMORY ; else { current_form -> flags |= HTTPPOST_READFILE ; current_form -> value_alloc = TRUE ; } } else return_value = CURL_FORMADD_NULL ; } break ; case CURLFORM_FILE : { const char * filename = array_state ? array_value : va_arg ( params , char * ) ; if ( current_form -> value ) { if ( current_form -> flags & HTTPPOST_FILENAME ) { if ( filename ) { char * fname = strdup ( filename ) ; if ( ! fname ) return_value = CURL_FORMADD_MEMORY ; else { form = AddFormInfo ( fname , NULL , current_form ) ; if ( ! form ) { Curl_safefree ( fname ) ; return_value = CURL_FORMADD_MEMORY ; } else { form -> value_alloc = TRUE ; current_form = form ; form = NULL ; } } } else return_value = CURL_FORMADD_NULL ; } else return_value = CURL_FORMADD_OPTION_TWICE ; } else { if ( filename ) { current_form -> value = strdup ( filename ) ; if ( ! current_form -> value ) return_value = CURL_FORMADD_MEMORY ; else { current_form -> flags |= HTTPPOST_FILENAME ; current_form -> value_alloc = TRUE ; } } else return_value = CURL_FORMADD_NULL ; } break ; } case CURLFORM_BUFFERPTR : current_form -> flags |= HTTPPOST_PTRBUFFER | HTTPPOST_BUFFER ; if ( current_form -> buffer ) return_value = CURL_FORMADD_OPTION_TWICE ; else { char * buffer = array_state ? array_value : va_arg ( params , char * ) ; if ( buffer ) { current_form -> buffer = buffer ; current_form -> value = buffer ; } else return_value = CURL_FORMADD_NULL ; } break ; case CURLFORM_BUFFERLENGTH : if ( current_form -> bufferlength ) return_value = CURL_FORMADD_OPTION_TWICE ; else current_form -> bufferlength = array_state ? ( size_t ) array_value : ( size_t ) va_arg ( params , long ) ; break ; case CURLFORM_STREAM : current_form -> flags |= HTTPPOST_CALLBACK ; if ( current_form -> userp ) return_value = CURL_FORMADD_OPTION_TWICE ; else { char * userp = array_state ? array_value : va_arg ( params , char * ) ; if ( userp ) { current_form -> userp = userp ; current_form -> value = userp ; } else return_value = CURL_FORMADD_NULL ; } break ; case CURLFORM_CONTENTTYPE : { const char * contenttype = array_state ? array_value : va_arg ( params , char * ) ; if ( current_form -> contenttype ) { if ( current_form -> flags & HTTPPOST_FILENAME ) { if ( contenttype ) { char * type = strdup ( contenttype ) ; if ( ! type ) return_value = CURL_FORMADD_MEMORY ; else { form = AddFormInfo ( NULL , type , current_form ) ; if ( ! form ) { Curl_safefree ( type ) ; return_value = CURL_FORMADD_MEMORY ; } else { form -> contenttype_alloc = TRUE ; current_form = form ; form = NULL ; } } } else return_value = CURL_FORMADD_NULL ; } else return_value = CURL_FORMADD_OPTION_TWICE ; } else { if ( contenttype ) { current_form -> contenttype = strdup ( contenttype ) ; if ( ! current_form -> contenttype ) return_value = CURL_FORMADD_MEMORY ; else current_form -> contenttype_alloc = TRUE ; } else return_value = CURL_FORMADD_NULL ; } break ; } case CURLFORM_CONTENTHEADER : { struct curl_slist * list = array_state ? ( struct curl_slist * ) array_value : va_arg ( params , struct curl_slist * ) ; if ( current_form -> contentheader ) return_value = CURL_FORMADD_OPTION_TWICE ; else current_form -> contentheader = list ; break ; } case CURLFORM_FILENAME : case CURLFORM_BUFFER : { const char * filename = array_state ? array_value : va_arg ( params , char * ) ; if ( current_form -> showfilename ) return_value = CURL_FORMADD_OPTION_TWICE ; else { current_form -> showfilename = strdup ( filename ) ; if ( ! current_form -> showfilename ) return_value = CURL_FORMADD_MEMORY ; else current_form -> showfilename_alloc = TRUE ; } break ; } default : return_value = CURL_FORMADD_UNKNOWN_OPTION ; break ; } } if ( CURL_FORMADD_OK != return_value ) { FormInfo * ptr ; for ( ptr = first_form ; ptr != NULL ; ptr = ptr -> more ) { if ( ptr -> name_alloc ) { Curl_safefree ( ptr -> name ) ; ptr -> name_alloc = FALSE ; } if ( ptr -> value_alloc ) { Curl_safefree ( ptr -> value ) ; ptr -> value_alloc = FALSE ; } if ( ptr -> contenttype_alloc ) { Curl_safefree ( ptr -> contenttype ) ; ptr -> contenttype_alloc = FALSE ; } if ( ptr -> showfilename_alloc ) { Curl_safefree ( ptr -> showfilename ) ; ptr -> showfilename_alloc = FALSE ; } } } if ( CURL_FORMADD_OK == return_value ) { post = NULL ; for ( form = first_form ; form != NULL ; form = form -> more ) { if ( ( ( ! form -> name || ! form -> value ) && ! post ) || ( ( form -> contentslength ) && ( form -> flags & HTTPPOST_FILENAME ) ) || ( ( form -> flags & HTTPPOST_FILENAME ) && ( form -> flags & HTTPPOST_PTRCONTENTS ) ) || ( ( ! form -> buffer ) && ( form -> flags & HTTPPOST_BUFFER ) && ( form -> flags & HTTPPOST_PTRBUFFER ) ) || ( ( form -> flags & HTTPPOST_READFILE ) && ( form -> flags & HTTPPOST_PTRCONTENTS ) ) ) { return_value = CURL_FORMADD_INCOMPLETE ; break ; } else { if ( ( ( form -> flags & HTTPPOST_FILENAME ) || ( form -> flags & HTTPPOST_BUFFER ) ) && ! form -> contenttype ) { char * f = form -> flags & HTTPPOST_BUFFER ? form -> showfilename : form -> value ; form -> contenttype = strdup ( ContentTypeForFilename ( f , prevtype ) ) ; if ( ! form -> contenttype ) { return_value = CURL_FORMADD_MEMORY ; break ; } form -> contenttype_alloc = TRUE ; } if ( ! ( form -> flags & HTTPPOST_PTRNAME ) && ( form == first_form ) ) { if ( form -> name ) { form -> name = Curl_memdup ( form -> name , form -> namelength ? form -> namelength : strlen ( form -> name ) + 1 ) ; } if ( ! form -> name ) { return_value = CURL_FORMADD_MEMORY ; break ; } form -> name_alloc = TRUE ; } if ( ! ( form -> flags & ( HTTPPOST_FILENAME | HTTPPOST_READFILE | HTTPPOST_PTRCONTENTS | HTTPPOST_PTRBUFFER | HTTPPOST_CALLBACK ) ) && form -> value ) { form -> value = Curl_memdup ( form -> value , form -> contentslength ? form -> contentslength : strlen ( form -> value ) + 1 ) ; if ( ! form -> value ) { return_value = CURL_FORMADD_MEMORY ; break ; } form -> value_alloc = TRUE ; } post = AddHttpPost ( form -> name , form -> namelength , form -> value , form -> contentslength , form -> buffer , form -> bufferlength , form -> contenttype , form -> flags , form -> contentheader , form -> showfilename , form -> userp , post , httppost , last_post ) ; if ( ! post ) { return_value = CURL_FORMADD_MEMORY ; break ; } if ( form -> contenttype ) prevtype = form -> contenttype ; } } if ( CURL_FORMADD_OK != return_value ) { FormInfo * ptr ; for ( ptr = form ; ptr != NULL ; ptr = ptr -> more ) { if ( ptr -> name_alloc ) { Curl_safefree ( ptr -> name ) ; ptr -> name_alloc = FALSE ; } if ( ptr -> value_alloc ) { Curl_safefree ( ptr -> value ) ; ptr -> value_alloc = FALSE ; } if ( ptr -> contenttype_alloc ) { Curl_safefree ( ptr -> contenttype ) ; ptr -> contenttype_alloc = FALSE ; } if ( ptr -> showfilename_alloc ) { Curl_safefree ( ptr -> showfilename ) ; ptr -> showfilename_alloc = FALSE ; } } } } while ( first_form ) { FormInfo * ptr = first_form -> more ; Curl_safefree ( first_form ) ; first_form = ptr ; } return return_value ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( BrowsingDataRemoverImplTest , RemoveQuotaManagedDataForeverOnlyTemporary ) { # if BUILDFLAG ( ENABLE_EXTENSIONS ) CreateMockPolicy ( ) ; # endif BlockUntilBrowsingDataRemoved ( base : : Time ( ) , base : : Time : : Max ( ) , BrowsingDataRemover : : REMOVE_FILE_SYSTEMS | BrowsingDataRemover : : REMOVE_WEBSQL | BrowsingDataRemover : : REMOVE_APPCACHE | BrowsingDataRemover : : REMOVE_SERVICE_WORKERS | BrowsingDataRemover : : REMOVE_CACHE_STORAGE | BrowsingDataRemover : : REMOVE_INDEXEDDB , false ) ; EXPECT_EQ ( BrowsingDataRemover : : REMOVE_FILE_SYSTEMS | BrowsingDataRemover : : REMOVE_WEBSQL | BrowsingDataRemover : : REMOVE_APPCACHE | BrowsingDataRemover : : REMOVE_SERVICE_WORKERS | BrowsingDataRemover : : REMOVE_CACHE_STORAGE | BrowsingDataRemover : : REMOVE_INDEXEDDB , GetRemovalMask ( ) ) ; EXPECT_EQ ( BrowsingDataHelper : : UNPROTECTED_WEB , GetOriginTypeMask ( ) ) ; StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData ( ) ; EXPECT_EQ ( removal_data . remove_mask , StoragePartition : : REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition : : REMOVE_DATA_MASK_WEBSQL | StoragePartition : : REMOVE_DATA_MASK_APPCACHE | StoragePartition : : REMOVE_DATA_MASK_SERVICE_WORKERS | StoragePartition : : REMOVE_DATA_MASK_CACHE_STORAGE | StoragePartition : : REMOVE_DATA_MASK_INDEXEDDB ) ; EXPECT_EQ ( removal_data . quota_storage_remove_mask , StoragePartition : : QUOTA_MANAGED_STORAGE_MASK_ALL ) ; EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin1 , mock_policy ( ) ) ) ; EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin2 , mock_policy ( ) ) ) ; EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin3 , mock_policy ( ) ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dtls1_reassemble_fragment ( SSL * s , const struct hm_header_st * msg_hdr , int * ok ) { hm_fragment * frag = NULL ; pitem * item = NULL ; int i = - 1 , is_complete ; unsigned char seq64be [ 8 ] ; unsigned long frag_len = msg_hdr -> frag_len ; if ( ( msg_hdr -> frag_off + frag_len ) > msg_hdr -> msg_len || msg_hdr -> msg_len > dtls1_max_handshake_message_len ( s ) ) goto err ; if ( frag_len == 0 ) return DTLS1_HM_FRAGMENT_RETRY ; memset ( seq64be , 0 , sizeof ( seq64be ) ) ; seq64be [ 6 ] = ( unsigned char ) ( msg_hdr -> seq >> 8 ) ; seq64be [ 7 ] = ( unsigned char ) msg_hdr -> seq ; item = pqueue_find ( s -> d1 -> buffered_messages , seq64be ) ; if ( item == NULL ) { frag = dtls1_hm_fragment_new ( msg_hdr -> msg_len , 1 ) ; if ( frag == NULL ) goto err ; memcpy ( & ( frag -> msg_header ) , msg_hdr , sizeof ( * msg_hdr ) ) ; frag -> msg_header . frag_len = frag -> msg_header . msg_len ; frag -> msg_header . frag_off = 0 ; } else { frag = ( hm_fragment * ) item -> data ; if ( frag -> msg_header . msg_len != msg_hdr -> msg_len ) { item = NULL ; frag = NULL ; goto err ; } } if ( frag -> reassembly == NULL ) { unsigned char devnull [ 256 ] ; while ( frag_len ) { i = s -> method -> ssl_read_bytes ( s , SSL3_RT_HANDSHAKE , NULL , devnull , frag_len > sizeof ( devnull ) ? sizeof ( devnull ) : frag_len , 0 ) ; if ( i <= 0 ) goto err ; frag_len -= i ; } return DTLS1_HM_FRAGMENT_RETRY ; } i = s -> method -> ssl_read_bytes ( s , SSL3_RT_HANDSHAKE , NULL , frag -> fragment + msg_hdr -> frag_off , frag_len , 0 ) ; if ( ( unsigned long ) i != frag_len ) i = - 1 ; if ( i <= 0 ) goto err ; RSMBLY_BITMASK_MARK ( frag -> reassembly , ( long ) msg_hdr -> frag_off , ( long ) ( msg_hdr -> frag_off + frag_len ) ) ; RSMBLY_BITMASK_IS_COMPLETE ( frag -> reassembly , ( long ) msg_hdr -> msg_len , is_complete ) ; if ( is_complete ) { OPENSSL_free ( frag -> reassembly ) ; frag -> reassembly = NULL ; } if ( item == NULL ) { item = pitem_new ( seq64be , frag ) ; if ( item == NULL ) { i = - 1 ; goto err ; } item = pqueue_insert ( s -> d1 -> buffered_messages , item ) ; OPENSSL_assert ( item != NULL ) ; } return DTLS1_HM_FRAGMENT_RETRY ; err : if ( item == NULL ) dtls1_hm_fragment_free ( frag ) ; * ok = 0 ; return i ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
fz_colorspace * fz_colorspace_base ( fz_context * ctx , const fz_colorspace * cs ) { return cs && cs -> get_base ? cs -> get_base ( cs ) : NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static uint32_t vmsvga_value_read ( void * opaque , uint32_t address ) { uint32_t caps ; struct vmsvga_state_s * s = opaque ; DisplaySurface * surface = qemu_console_surface ( s -> vga . con ) ; PixelFormat pf ; uint32_t ret ; switch ( s -> index ) { case SVGA_REG_ID : ret = s -> svgaid ; break ; case SVGA_REG_ENABLE : ret = s -> enable ; break ; case SVGA_REG_WIDTH : ret = s -> new_width ? s -> new_width : surface_width ( surface ) ; break ; case SVGA_REG_HEIGHT : ret = s -> new_height ? s -> new_height : surface_height ( surface ) ; break ; case SVGA_REG_MAX_WIDTH : ret = SVGA_MAX_WIDTH ; break ; case SVGA_REG_MAX_HEIGHT : ret = SVGA_MAX_HEIGHT ; break ; case SVGA_REG_DEPTH : ret = ( s -> new_depth == 32 ) ? 24 : s -> new_depth ; break ; case SVGA_REG_BITS_PER_PIXEL : case SVGA_REG_HOST_BITS_PER_PIXEL : ret = s -> new_depth ; break ; case SVGA_REG_PSEUDOCOLOR : ret = 0x0 ; break ; case SVGA_REG_RED_MASK : pf = qemu_default_pixelformat ( s -> new_depth ) ; ret = pf . rmask ; break ; case SVGA_REG_GREEN_MASK : pf = qemu_default_pixelformat ( s -> new_depth ) ; ret = pf . gmask ; break ; case SVGA_REG_BLUE_MASK : pf = qemu_default_pixelformat ( s -> new_depth ) ; ret = pf . bmask ; break ; case SVGA_REG_BYTES_PER_LINE : if ( s -> new_width ) { ret = ( s -> new_depth * s -> new_width ) / 8 ; } else { ret = surface_stride ( surface ) ; } break ; case SVGA_REG_FB_START : { struct pci_vmsvga_state_s * pci_vmsvga = container_of ( s , struct pci_vmsvga_state_s , chip ) ; ret = pci_get_bar_addr ( PCI_DEVICE ( pci_vmsvga ) , 1 ) ; break ; } case SVGA_REG_FB_OFFSET : ret = 0x0 ; break ; case SVGA_REG_VRAM_SIZE : ret = s -> vga . vram_size ; break ; case SVGA_REG_FB_SIZE : ret = s -> vga . vram_size ; break ; case SVGA_REG_CAPABILITIES : caps = SVGA_CAP_NONE ; # ifdef HW_RECT_ACCEL caps |= SVGA_CAP_RECT_COPY ; # endif # ifdef HW_FILL_ACCEL caps |= SVGA_CAP_RECT_FILL ; # endif # ifdef HW_MOUSE_ACCEL if ( dpy_cursor_define_supported ( s -> vga . con ) ) { caps |= SVGA_CAP_CURSOR | SVGA_CAP_CURSOR_BYPASS_2 | SVGA_CAP_CURSOR_BYPASS ; } # endif ret = caps ; break ; case SVGA_REG_MEM_START : { struct pci_vmsvga_state_s * pci_vmsvga = container_of ( s , struct pci_vmsvga_state_s , chip ) ; ret = pci_get_bar_addr ( PCI_DEVICE ( pci_vmsvga ) , 2 ) ; break ; } case SVGA_REG_MEM_SIZE : ret = s -> fifo_size ; break ; case SVGA_REG_CONFIG_DONE : ret = s -> config ; break ; case SVGA_REG_SYNC : case SVGA_REG_BUSY : ret = s -> syncing ; break ; case SVGA_REG_GUEST_ID : ret = s -> guest ; break ; case SVGA_REG_CURSOR_ID : ret = s -> cursor . id ; break ; case SVGA_REG_CURSOR_X : ret = s -> cursor . x ; break ; case SVGA_REG_CURSOR_Y : ret = s -> cursor . y ; break ; case SVGA_REG_CURSOR_ON : ret = s -> cursor . on ; break ; case SVGA_REG_SCRATCH_SIZE : ret = s -> scratch_size ; break ; case SVGA_REG_MEM_REGS : case SVGA_REG_NUM_DISPLAYS : case SVGA_REG_PITCHLOCK : case SVGA_PALETTE_BASE ... SVGA_PALETTE_END : ret = 0 ; break ; default : if ( s -> index >= SVGA_SCRATCH_BASE && s -> index < SVGA_SCRATCH_BASE + s -> scratch_size ) { ret = s -> scratch [ s -> index - SVGA_SCRATCH_BASE ] ; break ; } printf ( "%s: Bad register %02x\n" , __func__ , s -> index ) ; ret = 0 ; break ; } if ( s -> index >= SVGA_SCRATCH_BASE ) { trace_vmware_scratch_read ( s -> index , ret ) ; } else if ( s -> index >= SVGA_PALETTE_BASE ) { trace_vmware_palette_read ( s -> index , ret ) ; } else { trace_vmware_value_read ( s -> index , ret ) ; } return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( PageLoadMetricsBrowserTest , UseCounterUkmMixedContentFeaturesLogged ) { net : : EmbeddedTestServer https_server ( net : : EmbeddedTestServer : : TYPE_HTTPS ) ; https_server . AddDefaultHandlers ( base : : FilePath ( FILE_PATH_LITERAL ( "chrome/test/data" ) ) ) ; ASSERT_TRUE ( https_server . Start ( ) ) ; auto waiter = CreatePageLoadMetricsWaiter ( ) ; waiter -> AddPageExpectation ( TimingField : : LOAD_EVENT ) ; GURL url = https_server . GetURL ( "/page_load_metrics/use_counter_features.html" ) ; ui_test_utils : : NavigateToURL ( browser ( ) , url ) ; waiter -> Wait ( ) ; NavigateToUntrackedUrl ( ) ; const auto & entries = test_ukm_recorder_ -> GetEntriesByName ( internal : : kUkmUseCounterEventName ) ; EXPECT_EQ ( 6u , entries . size ( ) ) ; std : : vector < int64_t > ukm_features ; for ( const auto * entry : entries ) { test_ukm_recorder_ -> ExpectEntrySourceHasUrl ( entry , url ) ; const auto * metric = test_ukm_recorder_ -> GetEntryMetric ( entry , internal : : kUkmUseCounterFeature ) ; EXPECT_TRUE ( metric ) ; ukm_features . push_back ( * metric ) ; } EXPECT_THAT ( ukm_features , UnorderedElementsAre ( static_cast < int64_t > ( WebFeature : : kNavigatorVibrate ) , static_cast < int64_t > ( WebFeature : : kDataUriHasOctothorpe ) , static_cast < int64_t > ( WebFeature : : kApplicationCacheManifestSelectSecureOrigin ) , static_cast < int64_t > ( WebFeature : : kMixedContentImage ) , static_cast < int64_t > ( WebFeature : : kMixedContentAudio ) , static_cast < int64_t > ( WebFeature : : kMixedContentVideo ) ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void proto_tree_set_bytes_tvb ( field_info * fi , tvbuff_t * tvb , gint offset , gint length ) { proto_tree_set_bytes ( fi , tvb_get_ptr ( tvb , offset , length ) , length ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int rtp_packetize_jpeg ( sout_stream_id_sys_t * id , block_t * in ) { uint8_t * p_data = in -> p_buffer ; int i_data = in -> i_buffer ; uint8_t * bufend = p_data + i_data ; const uint8_t * qtables = NULL ; int nb_qtables = 0 ; int off = 0 ; int y_sampling_factor ; int type ; int w = 0 ; int h = 0 ; int restart_interval ; int dri_found = 0 ; if ( GetWBE ( p_data ) != 0xffd8 ) goto error ; p_data += 2 ; i_data -= 2 ; int header_finished = 0 ; while ( ! header_finished && p_data + 4 <= bufend ) { uint16_t marker = GetWBE ( p_data ) ; uint8_t * section = p_data + 2 ; int section_size = GetWBE ( section ) ; uint8_t * section_body = p_data + 4 ; if ( section + section_size > bufend ) goto error ; assert ( ( marker & 0xff00 ) == 0xff00 ) ; switch ( marker ) { case 0xffdb : if ( section_body [ 0 ] ) goto error ; nb_qtables = section_size / 65 ; qtables = section_body ; break ; case 0xffc0 : { int height = GetWBE ( & section_body [ 1 ] ) ; int width = GetWBE ( & section_body [ 3 ] ) ; if ( width > 2040 || height > 2040 ) { goto error ; } w = ( ( width + 7 ) & ~ 7 ) >> 3 ; h = ( ( height + 7 ) & ~ 7 ) >> 3 ; if ( section_body [ 5 ] != 3 ) goto error ; for ( int j = 0 ; j < 3 ; j ++ ) { if ( section_body [ 6 + j * 3 ] == 1 ) { y_sampling_factor = section_body [ 6 + j * 3 + 1 ] ; } else if ( section_body [ 6 + j * 3 + 1 ] != 0x11 ) { goto error ; } } break ; } case 0xffdd : restart_interval = GetWBE ( section_body ) ; dri_found = 1 ; break ; case 0xffda : header_finished = 1 ; break ; } p_data += 2 + section_size ; i_data -= 2 + section_size ; } if ( ! header_finished ) goto error ; if ( ! w || ! h ) goto error ; switch ( y_sampling_factor ) { case 0x22 : type = 1 ; break ; case 0x21 : type = 0 ; break ; default : goto error ; } if ( dri_found ) type += 64 ; while ( i_data ) { int hdr_size = 8 + dri_found * 4 ; if ( off == 0 && nb_qtables ) hdr_size += 4 + 64 * nb_qtables ; int i_payload = __MIN ( i_data , ( int ) ( rtp_mtu ( id ) - hdr_size ) ) ; if ( i_payload <= 0 ) return VLC_EGENERIC ; block_t * out = block_Alloc ( 12 + hdr_size + i_payload ) ; if ( out == NULL ) return VLC_ENOMEM ; uint8_t * p = out -> p_buffer + 12 ; SetDWBE ( p , off & 0x00ffffff ) ; p += 4 ; * p ++ = type ; * p ++ = 255 ; * p ++ = w ; * p ++ = h ; if ( dri_found ) { SetWBE ( p , restart_interval ) ; p += 2 ; SetWBE ( p , 0xffff ) ; p += 2 ; } if ( off == 0 && nb_qtables ) { * p ++ = 0 ; * p ++ = 0 ; SetWBE ( p , 64 * nb_qtables ) ; p += 2 ; for ( int i = 0 ; i < nb_qtables ; i ++ ) { memcpy ( p , & qtables [ 65 * i + 1 ] , 64 ) ; p += 64 ; } } rtp_packetize_common ( id , out , ( i_payload == i_data ) , ( in -> i_pts > VLC_TS_INVALID ? in -> i_pts : in -> i_dts ) ) ; memcpy ( p , p_data , i_payload ) ; out -> i_dts = in -> i_dts ; out -> i_length = in -> i_length ; rtp_packetize_send ( id , out ) ; p_data += i_payload ; i_data -= i_payload ; off += i_payload ; } block_Release ( in ) ; return VLC_SUCCESS ; error : block_Release ( in ) ; return VLC_EGENERIC ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void decSetSubnormal ( decNumber * dn , decContext * set , Int * residue , uInt * status ) { decContext workset ; Int etiny , adjust ; # if DECSUBSET if ( ! set -> extended ) { uprv_decNumberZero ( dn ) ; * status |= DEC_Underflow | DEC_Subnormal | DEC_Inexact | DEC_Rounded ; return ; } # endif etiny = set -> emin - ( set -> digits - 1 ) ; if ISZERO ( dn ) { # if DECCHECK if ( * residue != 0 ) { printf ( "++ Subnormal 0 residue %ld\n" , ( LI ) * residue ) ; * status |= DEC_Invalid_operation ; } # endif if ( dn -> exponent < etiny ) { dn -> exponent = etiny ; * status |= DEC_Clamped ; } return ; } * status |= DEC_Subnormal ; adjust = etiny - dn -> exponent ; if ( adjust <= 0 ) { if ( * status & DEC_Inexact ) * status |= DEC_Underflow ; return ; } workset = * set ; workset . digits = dn -> digits - adjust ; workset . emin -= adjust ; decSetCoeff ( dn , & workset , dn -> lsu , dn -> digits , residue , status ) ; decApplyRound ( dn , & workset , * residue , status ) ; if ( * status & DEC_Inexact ) * status |= DEC_Underflow ; if ( dn -> exponent > etiny ) { dn -> digits = decShiftToMost ( dn -> lsu , dn -> digits , 1 ) ; dn -> exponent -- ; } if ( ISZERO ( dn ) ) * status |= DEC_Clamped ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void constrain_copy_partitioning ( VP9_COMP * const cpi , const TileInfo * const tile , MODE_INFO * * mi_8x8 , MODE_INFO * * prev_mi_8x8 , int mi_row , int mi_col , BLOCK_SIZE bsize ) { VP9_COMMON * const cm = & cpi -> common ; const int mis = cm -> mi_stride ; const int row8x8_remaining = tile -> mi_row_end - mi_row ; const int col8x8_remaining = tile -> mi_col_end - mi_col ; MODE_INFO * const mi_upper_left = cm -> mi + mi_row * mis + mi_col ; const int bh = num_8x8_blocks_high_lookup [ bsize ] ; const int bw = num_8x8_blocks_wide_lookup [ bsize ] ; int block_row , block_col ; assert ( ( row8x8_remaining > 0 ) && ( col8x8_remaining > 0 ) ) ; if ( ( col8x8_remaining >= MI_BLOCK_SIZE ) && ( row8x8_remaining >= MI_BLOCK_SIZE ) ) { for ( block_row = 0 ; block_row < MI_BLOCK_SIZE ; block_row += bh ) { for ( block_col = 0 ; block_col < MI_BLOCK_SIZE ; block_col += bw ) { const int index = block_row * mis + block_col ; MODE_INFO * prev_mi = prev_mi_8x8 [ index ] ; const BLOCK_SIZE sb_type = prev_mi ? prev_mi -> mbmi . sb_type : 0 ; if ( prev_mi && sb_type <= bsize ) { int block_row2 , block_col2 ; for ( block_row2 = 0 ; block_row2 < bh ; ++ block_row2 ) { for ( block_col2 = 0 ; block_col2 < bw ; ++ block_col2 ) { const int index2 = ( block_row + block_row2 ) * mis + block_col + block_col2 ; prev_mi = prev_mi_8x8 [ index2 ] ; if ( prev_mi ) { const ptrdiff_t offset = prev_mi - cm -> prev_mi ; mi_8x8 [ index2 ] = cm -> mi + offset ; mi_8x8 [ index2 ] -> mbmi . sb_type = prev_mi -> mbmi . sb_type ; } } } } else { mi_8x8 [ index ] = mi_upper_left + index ; mi_8x8 [ index ] -> mbmi . sb_type = bsize ; } } } } else { copy_partitioning ( cm , mi_8x8 , prev_mi_8x8 ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void _CompoundTextOpen ( UConverter * cnv , UConverterLoadArgs * pArgs , UErrorCode * errorCode ) { cnv -> extraInfo = uprv_malloc ( sizeof ( UConverterDataCompoundText ) ) ; if ( cnv -> extraInfo != NULL ) { UConverterDataCompoundText * myConverterData = ( UConverterDataCompoundText * ) cnv -> extraInfo ; UConverterNamePieces stackPieces ; UConverterLoadArgs stackArgs = { ( int32_t ) sizeof ( UConverterLoadArgs ) } ; myConverterData -> myConverterArray [ COMPOUND_TEXT_SINGLE_0 ] = NULL ; myConverterData -> myConverterArray [ COMPOUND_TEXT_SINGLE_1 ] = ucnv_loadSharedData ( "icu-internal-compound-s1" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ COMPOUND_TEXT_SINGLE_2 ] = ucnv_loadSharedData ( "icu-internal-compound-s2" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ COMPOUND_TEXT_SINGLE_3 ] = ucnv_loadSharedData ( "icu-internal-compound-s3" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ COMPOUND_TEXT_DOUBLE_1 ] = ucnv_loadSharedData ( "icu-internal-compound-d1" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ COMPOUND_TEXT_DOUBLE_2 ] = ucnv_loadSharedData ( "icu-internal-compound-d2" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ COMPOUND_TEXT_DOUBLE_3 ] = ucnv_loadSharedData ( "icu-internal-compound-d3" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ COMPOUND_TEXT_DOUBLE_4 ] = ucnv_loadSharedData ( "icu-internal-compound-d4" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ COMPOUND_TEXT_DOUBLE_5 ] = ucnv_loadSharedData ( "icu-internal-compound-d5" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ COMPOUND_TEXT_DOUBLE_6 ] = ucnv_loadSharedData ( "icu-internal-compound-d6" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ COMPOUND_TEXT_DOUBLE_7 ] = ucnv_loadSharedData ( "icu-internal-compound-d7" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ COMPOUND_TEXT_TRIPLE_DOUBLE ] = ucnv_loadSharedData ( "icu-internal-compound-t" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ IBM_915 ] = ucnv_loadSharedData ( "ibm-915_P100-1995" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ IBM_916 ] = ucnv_loadSharedData ( "ibm-916_P100-1995" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ IBM_914 ] = ucnv_loadSharedData ( "ibm-914_P100-1995" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ IBM_874 ] = ucnv_loadSharedData ( "ibm-874_P100-1995" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ IBM_912 ] = ucnv_loadSharedData ( "ibm-912_P100-1995" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ IBM_913 ] = ucnv_loadSharedData ( "ibm-913_P100-2000" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ ISO_8859_14 ] = ucnv_loadSharedData ( "iso-8859_14-1998" , & stackPieces , & stackArgs , errorCode ) ; myConverterData -> myConverterArray [ IBM_923 ] = ucnv_loadSharedData ( "ibm-923_P100-1998" , & stackPieces , & stackArgs , errorCode ) ; if ( U_FAILURE ( * errorCode ) || pArgs -> onlyTestIsLoadable ) { _CompoundTextClose ( cnv ) ; return ; } myConverterData -> state = ( COMPOUND_TEXT_CONVERTERS ) 0 ; } else { * errorCode = U_MEMORY_ALLOCATION_ERROR ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void encode_superblock ( VP9_COMP * cpi , TOKENEXTRA * * t , int output_enabled , int mi_row , int mi_col , BLOCK_SIZE bsize , PICK_MODE_CONTEXT * ctx ) { VP9_COMMON * const cm = & cpi -> common ; MACROBLOCK * const x = & cpi -> mb ; MACROBLOCKD * const xd = & x -> e_mbd ; MODE_INFO * * mi_8x8 = xd -> mi ; MODE_INFO * mi = mi_8x8 [ 0 ] ; MB_MODE_INFO * mbmi = & mi -> mbmi ; const int seg_skip = vp9_segfeature_active ( & cm -> seg , mbmi -> segment_id , SEG_LVL_SKIP ) ; const int mis = cm -> mi_stride ; const int mi_width = num_8x8_blocks_wide_lookup [ bsize ] ; const int mi_height = num_8x8_blocks_high_lookup [ bsize ] ; x -> skip_recode = ! x -> select_tx_size && mbmi -> sb_type >= BLOCK_8X8 && cpi -> oxcf . aq_mode != COMPLEXITY_AQ && cpi -> oxcf . aq_mode != CYCLIC_REFRESH_AQ && cpi -> sf . allow_skip_recode ; if ( ! x -> skip_recode && ! cpi -> sf . use_nonrd_pick_mode ) vpx_memset ( x -> skip_txfm , 0 , sizeof ( x -> skip_txfm ) ) ; x -> skip_optimize = ctx -> is_coded ; ctx -> is_coded = 1 ; x -> use_lp32x32fdct = cpi -> sf . use_lp32x32fdct ; x -> skip_encode = ( ! output_enabled && cpi -> sf . skip_encode_frame && x -> q_index < QIDX_SKIP_THRESH ) ; if ( x -> skip_encode ) return ; set_ref_ptrs ( cm , xd , mbmi -> ref_frame [ 0 ] , mbmi -> ref_frame [ 1 ] ) ; cpi -> zbin_mode_boost = get_zbin_mode_boost ( mbmi , cpi -> zbin_mode_boost_enabled ) ; vp9_update_zbin_extra ( cpi , x ) ; if ( ! is_inter_block ( mbmi ) ) { int plane ; mbmi -> skip = 1 ; for ( plane = 0 ; plane < MAX_MB_PLANE ; ++ plane ) vp9_encode_intra_block_plane ( x , MAX ( bsize , BLOCK_8X8 ) , plane ) ; if ( output_enabled ) sum_intra_stats ( & cm -> counts , mi ) ; vp9_tokenize_sb ( cpi , t , ! output_enabled , MAX ( bsize , BLOCK_8X8 ) ) ; } else { int ref ; const int is_compound = has_second_ref ( mbmi ) ; for ( ref = 0 ; ref < 1 + is_compound ; ++ ref ) { YV12_BUFFER_CONFIG * cfg = get_ref_frame_buffer ( cpi , mbmi -> ref_frame [ ref ] ) ; vp9_setup_pre_planes ( xd , ref , cfg , mi_row , mi_col , & xd -> block_refs [ ref ] -> sf ) ; } if ( ! cpi -> sf . reuse_inter_pred_sby || seg_skip ) vp9_build_inter_predictors_sby ( xd , mi_row , mi_col , MAX ( bsize , BLOCK_8X8 ) ) ; vp9_build_inter_predictors_sbuv ( xd , mi_row , mi_col , MAX ( bsize , BLOCK_8X8 ) ) ; if ( ! x -> skip ) { mbmi -> skip = 1 ; vp9_encode_sb ( x , MAX ( bsize , BLOCK_8X8 ) ) ; vp9_tokenize_sb ( cpi , t , ! output_enabled , MAX ( bsize , BLOCK_8X8 ) ) ; } else { mbmi -> skip = 1 ; if ( output_enabled && ! seg_skip ) cm -> counts . skip [ vp9_get_skip_context ( xd ) ] [ 1 ] ++ ; reset_skip_context ( xd , MAX ( bsize , BLOCK_8X8 ) ) ; } } if ( output_enabled ) { if ( cm -> tx_mode == TX_MODE_SELECT && mbmi -> sb_type >= BLOCK_8X8 && ! ( is_inter_block ( mbmi ) && ( mbmi -> skip || seg_skip ) ) ) { ++ get_tx_counts ( max_txsize_lookup [ bsize ] , vp9_get_tx_size_context ( xd ) , & cm -> counts . tx ) [ mbmi -> tx_size ] ; } else { int x , y ; TX_SIZE tx_size ; if ( is_inter_block ( & mi -> mbmi ) ) { tx_size = MIN ( tx_mode_to_biggest_tx_size [ cm -> tx_mode ] , max_txsize_lookup [ bsize ] ) ; } else { tx_size = ( bsize >= BLOCK_8X8 ) ? mbmi -> tx_size : TX_4X4 ; } for ( y = 0 ; y < mi_height ; y ++ ) for ( x = 0 ; x < mi_width ; x ++ ) if ( mi_col + x < cm -> mi_cols && mi_row + y < cm -> mi_rows ) mi_8x8 [ mis * y + x ] -> mbmi . tx_size = tx_size ; } } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void get_info_state_free ( GetInfoState * state ) { g_object_unref ( state -> cancellable ) ; g_free ( state ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_btgatt_nordic_uart_tx ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data ) { btatt_data_t * att_data = ( btatt_data_t * ) data ; if ( bluetooth_gatt_has_no_parameter ( att_data -> opcode ) ) return - 1 ; proto_tree_add_item ( tree , hf_gatt_nordic_uart_tx , tvb , 0 , tvb_captured_length ( tvb ) , ENC_ASCII | ENC_NA ) ; return tvb_captured_length ( tvb ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int x_catch_free_colors ( Display * dpy , XErrorEvent * err ) { if ( err -> request_code == X_FreeColors ) return 0 ; return x_error_handler . orighandler ( dpy , err ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
void PNGAPI png_set_pCAL ( png_structp png_ptr , png_infop info_ptr , png_charp purpose , png_int_32 X0 , png_int_32 X1 , int type , int nparams , png_charp units , png_charpp params ) { png_uint_32 length ; int i ; png_debug1 ( 1 , "in %s storage function" , "pCAL" ) ; if ( png_ptr == NULL || info_ptr == NULL ) return ; length = png_strlen ( purpose ) + 1 ; png_debug1 ( 3 , "allocating purpose for info (%lu bytes)" , ( unsigned long ) length ) ; info_ptr -> pcal_purpose = ( png_charp ) png_malloc_warn ( png_ptr , length ) ; if ( info_ptr -> pcal_purpose == NULL ) { png_warning ( png_ptr , "Insufficient memory for pCAL purpose." ) ; return ; } png_memcpy ( info_ptr -> pcal_purpose , purpose , ( png_size_t ) length ) ; png_debug ( 3 , "storing X0, X1, type, and nparams in info" ) ; info_ptr -> pcal_X0 = X0 ; info_ptr -> pcal_X1 = X1 ; info_ptr -> pcal_type = ( png_byte ) type ; info_ptr -> pcal_nparams = ( png_byte ) nparams ; length = png_strlen ( units ) + 1 ; png_debug1 ( 3 , "allocating units for info (%lu bytes)" , ( unsigned long ) length ) ; info_ptr -> pcal_units = ( png_charp ) png_malloc_warn ( png_ptr , length ) ; if ( info_ptr -> pcal_units == NULL ) { png_warning ( png_ptr , "Insufficient memory for pCAL units." ) ; return ; } png_memcpy ( info_ptr -> pcal_units , units , ( png_size_t ) length ) ; info_ptr -> pcal_params = ( png_charpp ) png_malloc_warn ( png_ptr , ( png_uint_32 ) ( ( nparams + 1 ) * png_sizeof ( png_charp ) ) ) ; if ( info_ptr -> pcal_params == NULL ) { png_warning ( png_ptr , "Insufficient memory for pCAL params." ) ; return ; } png_memset ( info_ptr -> pcal_params , 0 , ( nparams + 1 ) * png_sizeof ( png_charp ) ) ; for ( i = 0 ; i < nparams ; i ++ ) { length = png_strlen ( params [ i ] ) + 1 ; png_debug2 ( 3 , "allocating parameter %d for info (%lu bytes)" , i , ( unsigned long ) length ) ; info_ptr -> pcal_params [ i ] = ( png_charp ) png_malloc_warn ( png_ptr , length ) ; if ( info_ptr -> pcal_params [ i ] == NULL ) { png_warning ( png_ptr , "Insufficient memory for pCAL parameter." ) ; return ; } png_memcpy ( info_ptr -> pcal_params [ i ] , params [ i ] , ( png_size_t ) length ) ; } info_ptr -> valid |= PNG_INFO_pCAL ; # ifdef PNG_FREE_ME_SUPPORTED info_ptr -> free_me |= PNG_FREE_PCAL ; # endif }
0False
Categorize the following code snippet as vulnerable or not. True or False
static PyObject * string_capitalize ( PyStringObject * self ) { char * s = PyString_AS_STRING ( self ) , * s_new ; Py_ssize_t i , n = PyString_GET_SIZE ( self ) ; PyObject * newobj ; newobj = PyString_FromStringAndSize ( NULL , n ) ; if ( newobj == NULL ) return NULL ; s_new = PyString_AsString ( newobj ) ; if ( 0 < n ) { int c = Py_CHARMASK ( * s ++ ) ; if ( islower ( c ) ) * s_new = toupper ( c ) ; else * s_new = c ; s_new ++ ; } for ( i = 1 ; i < n ; i ++ ) { int c = Py_CHARMASK ( * s ++ ) ; if ( isupper ( c ) ) * s_new = tolower ( c ) ; else * s_new = c ; s_new ++ ; } return newobj ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int alloc_picture ( H264Context * h , Picture * pic ) { int i , ret = 0 ; av_assert0 ( ! pic -> f . data [ 0 ] ) ; pic -> tf . f = & pic -> f ; ret = ff_thread_get_buffer ( h -> avctx , & pic -> tf , pic -> reference ? AV_GET_BUFFER_FLAG_REF : 0 ) ; if ( ret < 0 ) goto fail ; h -> linesize = pic -> f . linesize [ 0 ] ; h -> uvlinesize = pic -> f . linesize [ 1 ] ; pic -> crop = h -> sps . crop ; pic -> crop_top = h -> sps . crop_top ; pic -> crop_left = h -> sps . crop_left ; if ( h -> avctx -> hwaccel ) { const AVHWAccel * hwaccel = h -> avctx -> hwaccel ; av_assert0 ( ! pic -> hwaccel_picture_private ) ; if ( hwaccel -> priv_data_size ) { pic -> hwaccel_priv_buf = av_buffer_allocz ( hwaccel -> priv_data_size ) ; if ( ! pic -> hwaccel_priv_buf ) return AVERROR ( ENOMEM ) ; pic -> hwaccel_picture_private = pic -> hwaccel_priv_buf -> data ; } } if ( ! h -> qscale_table_pool ) { ret = init_table_pools ( h ) ; if ( ret < 0 ) goto fail ; } pic -> qscale_table_buf = av_buffer_pool_get ( h -> qscale_table_pool ) ; pic -> mb_type_buf = av_buffer_pool_get ( h -> mb_type_pool ) ; if ( ! pic -> qscale_table_buf || ! pic -> mb_type_buf ) goto fail ; pic -> mb_type = ( uint32_t * ) pic -> mb_type_buf -> data + 2 * h -> mb_stride + 1 ; pic -> qscale_table = pic -> qscale_table_buf -> data + 2 * h -> mb_stride + 1 ; for ( i = 0 ; i < 2 ; i ++ ) { pic -> motion_val_buf [ i ] = av_buffer_pool_get ( h -> motion_val_pool ) ; pic -> ref_index_buf [ i ] = av_buffer_pool_get ( h -> ref_index_pool ) ; if ( ! pic -> motion_val_buf [ i ] || ! pic -> ref_index_buf [ i ] ) goto fail ; pic -> motion_val [ i ] = ( int16_t ( * ) [ 2 ] ) pic -> motion_val_buf [ i ] -> data + 4 ; pic -> ref_index [ i ] = pic -> ref_index_buf [ i ] -> data ; } return 0 ; fail : unref_picture ( h , pic ) ; return ( ret < 0 ) ? ret : AVERROR ( ENOMEM ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int dissect_ber_integer64 ( gboolean implicit_tag , asn1_ctx_t * actx , proto_tree * tree , tvbuff_t * tvb , int offset , gint hf_id , gint64 * value ) { gint8 ber_class ; gboolean pc ; gint32 tag ; guint32 len ; gint64 val ; guint32 i ; gboolean used_too_many_bytes = FALSE ; guint8 first ; # ifdef DEBUG_BER { const char * name ; header_field_info * hfinfo ; if ( hf_id >= 0 ) { hfinfo = proto_registrar_get_nth ( hf_id ) ; name = hfinfo -> name ; } else { name = "unnamed" ; } if ( tvb_reported_length_remaining ( tvb , offset ) > 3 ) { printf ( "INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n" , name , implicit_tag , offset , tvb_reported_length_remaining ( tvb , offset ) , tvb_get_guint8 ( tvb , offset ) , tvb_get_guint8 ( tvb , offset + 1 ) , tvb_get_guint8 ( tvb , offset + 2 ) ) ; } else { printf ( "INTEGERnew dissect_ber_integer(%s) entered implicit_tag:%d \n" , name , implicit_tag ) ; } } # endif if ( value ) { * value = 0 ; } if ( ! implicit_tag ) { offset = dissect_ber_identifier ( actx -> pinfo , tree , tvb , offset , & ber_class , & pc , & tag ) ; offset = dissect_ber_length ( actx -> pinfo , tree , tvb , offset , & len , NULL ) ; } else { gint32 remaining = tvb_reported_length_remaining ( tvb , offset ) ; len = remaining > 0 ? remaining : 0 ; } first = tvb_get_guint8 ( tvb , offset ) ; if ( ( len > 9 ) || ( ( len == 9 ) && ( first != 0 ) ) ) { if ( hf_id >= 0 ) { header_field_info * hfinfo = proto_registrar_get_nth ( hf_id ) ; if ( hfinfo -> type != FT_BYTES ) hf_id = hf_ber_64bit_uint_as_bytes ; proto_tree_add_bytes_format ( tree , hf_id , tvb , offset , len , NULL , "%s: 0x%s" , hfinfo -> name , tvb_bytes_to_str ( wmem_packet_scope ( ) , tvb , offset , len ) ) ; } offset += len ; return offset ; } val = 0 ; if ( len > 0 ) { enum ftenum type = FT_INT32 ; if ( hf_id >= 0 ) { type = proto_registrar_get_ftype ( hf_id ) ; } if ( first & 0x80 && IS_FT_INT ( type ) ) { val = - 1 ; } if ( ( len > 1 ) && decode_warning_leading_zero_bits ) { guint8 second = tvb_get_guint8 ( tvb , offset + 1 ) ; if ( ( ( first == 0x00 ) && ( ( second & 0x80 ) == 0 ) ) || ( ( first == 0xff ) && ( ( second & 0x80 ) != 0 ) ) ) { used_too_many_bytes = TRUE ; } } for ( i = 0 ; i < len ; i ++ ) { val = ( ( guint64 ) val << 8 ) | tvb_get_guint8 ( tvb , offset ) ; offset ++ ; } } actx -> created_item = NULL ; if ( hf_id >= 0 ) { if ( ( len < 1 ) || ( len > 9 ) || ( ( len == 9 ) && ( first != 0 ) ) ) { proto_item * pi = proto_tree_add_string_format_value ( tree , hf_ber_error , tvb , offset - len , len , "invalid length" , "Can't handle integer length: %u" , len ) ; expert_add_info_format ( actx -> pinfo , pi , & ei_ber_error_length , "BER Error: Illegal integer length: %u" , len ) ; } else { header_field_info * hfi ; hfi = proto_registrar_get_nth ( hf_id ) ; switch ( hfi -> type ) { case FT_UINT8 : case FT_UINT16 : case FT_UINT24 : case FT_UINT32 : actx -> created_item = proto_tree_add_uint ( tree , hf_id , tvb , offset - len , len , ( guint32 ) val ) ; break ; case FT_INT8 : case FT_INT16 : case FT_INT24 : case FT_INT32 : actx -> created_item = proto_tree_add_int ( tree , hf_id , tvb , offset - len , len , ( gint32 ) val ) ; break ; case FT_INT64 : actx -> created_item = proto_tree_add_int64 ( tree , hf_id , tvb , offset - len , len , val ) ; break ; case FT_UINT64 : actx -> created_item = proto_tree_add_uint64 ( tree , hf_id , tvb , offset - len , len , ( guint64 ) val ) ; break ; default : DISSECTOR_ASSERT_NOT_REACHED ( ) ; } if ( used_too_many_bytes ) { expert_add_info_format ( actx -> pinfo , actx -> created_item , & ei_ber_value_too_many_bytes , "Value is encoded with too many bytes(9 leading zero or one bits), hf_abbr: %s" , hfi -> abbrev ) ; } } } if ( value ) { * value = val ; } return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static char * get_relative_path ( const char * path ) { if ( test_if_hard_path ( path ) && is_prefix ( path , DEFAULT_MYSQL_HOME ) && strcmp ( DEFAULT_MYSQL_HOME , FN_ROOTDIR ) ) { path += ( uint ) strlen ( DEFAULT_MYSQL_HOME ) ; while ( * path == FN_LIBCHAR || * path == FN_LIBCHAR2 ) path ++ ; } return ( char * ) path ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_INTEGER_1_15 ( 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 , 1U , 15U , NULL , FALSE ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void do_list_files ( struct st_command * command ) { int error ; static DYNAMIC_STRING ds_dirname ; static DYNAMIC_STRING ds_wild ; const struct command_arg list_files_args [ ] = { { "dirname" , ARG_STRING , TRUE , & ds_dirname , "Directory to list" } , { "file" , ARG_STRING , FALSE , & ds_wild , "Filename (incl. wildcard)" } } ; DBUG_ENTER ( "do_list_files" ) ; command -> used_replace = 1 ; check_command_args ( command , command -> first_argument , list_files_args , sizeof ( list_files_args ) / sizeof ( struct command_arg ) , ' ' ) ; error = get_list_files ( & ds_res , & ds_dirname , & ds_wild ) ; handle_command_error ( command , error , my_errno ) ; dynstr_free ( & ds_dirname ) ; dynstr_free ( & ds_wild ) ; DBUG_VOID_RETURN ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _slurm_rpc_sib_job_unlock ( uint32_t uid , slurm_msg_t * msg ) { int rc ; sib_msg_t * sib_msg = msg -> data ; if ( ! msg -> conn ) { error ( "Security violation, SIB_JOB_UNLOCK RPC from uid=%d" , uid ) ; slurm_send_rc_msg ( msg , ESLURM_ACCESS_DENIED ) ; return ; } rc = fed_mgr_job_lock_unset ( sib_msg -> job_id , sib_msg -> cluster_id ) ; slurm_send_rc_msg ( msg , rc ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int zcountexecstack ( i_ctx_t * i_ctx_p ) { os_ptr op = osp ; push ( 1 ) ; make_int ( op , count_exec_stack ( i_ctx_p , false ) ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void evdns_search_ndots_set ( const int ndots ) { if ( ! global_search_state ) global_search_state = search_state_new ( ) ; if ( ! global_search_state ) return ; global_search_state -> ndots = ndots ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
hb_blob_t * hb_blob_reference ( hb_blob_t * blob ) { return hb_object_reference ( blob ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_pvfs2_rmdirent_response ( tvbuff_t * tvb , proto_tree * tree , int offset , packet_info * pinfo ) { offset = dissect_pvfs_fh ( tvb , offset , pinfo , tree , "handle" , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _slurm_rpc_shutdown_controller_immediate ( slurm_msg_t * msg ) { int error_code = SLURM_SUCCESS ; uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ; if ( ! validate_super_user ( uid ) ) { error ( "Security violation, SHUTDOWN_IMMEDIATE RPC from uid=%d" , uid ) ; error_code = ESLURM_USER_ID_MISSING ; } if ( error_code == SLURM_SUCCESS ) debug ( "Performing RPC: REQUEST_SHUTDOWN_IMMEDIATE" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void lance_init ( NICInfo * nd , hwaddr leaddr , void * dma_opaque , qemu_irq irq ) { DeviceState * dev ; SysBusDevice * s ; qemu_irq reset ; qemu_check_nic_model ( & nd_table [ 0 ] , "lance" ) ; dev = qdev_create ( NULL , "lance" ) ; qdev_set_nic_properties ( dev , nd ) ; qdev_prop_set_ptr ( dev , "dma" , dma_opaque ) ; qdev_init_nofail ( dev ) ; s = SYS_BUS_DEVICE ( dev ) ; sysbus_mmio_map ( s , 0 , leaddr ) ; sysbus_connect_irq ( s , 0 , irq ) ; reset = qdev_get_gpio_in ( dev , 0 ) ; qdev_connect_gpio_out ( dma_opaque , 0 , reset ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int opt_sections ( void * optctx , const char * opt , const char * arg ) { printf ( "Sections:\n" "W.. = Section is a wrapper (contains other sections, no local entries)\n" ".A. = Section contains an array of elements of the same type\n" "..V = Section may contain a variable number of fields with variable keys\n" "FLAGS NAME/UNIQUE_NAME\n" "---\n" ) ; print_section ( SECTION_ID_ROOT , 0 ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int encode_frame ( VC2EncContext * s , AVPacket * avpkt , const AVFrame * frame , const char * aux_data , const int header_size , int field ) { int i , ret ; int64_t max_frame_bytes ; for ( i = 0 ; i < 3 ; i ++ ) { s -> transform_args [ i ] . ctx = s ; s -> transform_args [ i ] . field = field ; s -> transform_args [ i ] . plane = & s -> plane [ i ] ; s -> transform_args [ i ] . idata = frame -> data [ i ] ; s -> transform_args [ i ] . istride = frame -> linesize [ i ] ; } s -> avctx -> execute ( s -> avctx , dwt_plane , s -> transform_args , NULL , 3 , sizeof ( TransformArgs ) ) ; max_frame_bytes = header_size + calc_slice_sizes ( s ) ; if ( field < 2 ) { ret = ff_alloc_packet2 ( s -> avctx , avpkt , max_frame_bytes << s -> interlaced , max_frame_bytes << s -> interlaced ) ; if ( ret ) { av_log ( s -> avctx , AV_LOG_ERROR , "Error getting output packet.\n" ) ; return ret ; } init_put_bits ( & s -> pb , avpkt -> data , avpkt -> size ) ; } encode_parse_info ( s , DIRAC_PCODE_SEQ_HEADER ) ; encode_seq_header ( s ) ; if ( aux_data ) { encode_parse_info ( s , DIRAC_PCODE_AUX ) ; avpriv_put_string ( & s -> pb , aux_data , 1 ) ; } encode_parse_info ( s , DIRAC_PCODE_PICTURE_HQ ) ; encode_picture_start ( s ) ; encode_slices ( s ) ; encode_parse_info ( s , DIRAC_PCODE_END_SEQ ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void advertise_sasl_exit ( hook_data_client_exit * data ) { if ( ! ConfigFileEntry . sasl_service ) return ; if ( irccmp ( data -> target -> name , ConfigFileEntry . sasl_service ) ) return ; sendto_local_clients_with_capability ( CLICAP_CAP_NOTIFY , ":%s CAP * DEL :sasl" , me . name ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int gsm_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) { AVFrame * frame = data ; int res ; GetBitContext gb ; const uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; int16_t * samples ; if ( buf_size < avctx -> block_align ) { av_log ( avctx , AV_LOG_ERROR , "Packet is too small\n" ) ; return AVERROR_INVALIDDATA ; } frame -> nb_samples = avctx -> frame_size ; if ( ( res = ff_get_buffer ( avctx , frame , 0 ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ; return res ; } samples = ( int16_t * ) frame -> data [ 0 ] ; switch ( avctx -> codec_id ) { case AV_CODEC_ID_GSM : init_get_bits ( & gb , buf , buf_size * 8 ) ; if ( get_bits ( & gb , 4 ) != 0xd ) av_log ( avctx , AV_LOG_WARNING , "Missing GSM magic!\n" ) ; res = gsm_decode_block ( avctx , samples , & gb ) ; if ( res < 0 ) return res ; break ; case AV_CODEC_ID_GSM_MS : res = ff_msgsm_decode_block ( avctx , samples , buf ) ; if ( res < 0 ) return res ; } * got_frame_ptr = 1 ; return avctx -> block_align ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_SEQUENCE_OF_ClearToken ( 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_ClearToken , SEQUENCE_OF_ClearToken_sequence_of ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( WebFrameTest , AltTextOnAboutBlankPage ) { FrameTestHelpers : : WebViewHelper web_view_helper ; web_view_helper . InitializeAndLoad ( "about:blank" ) ; web_view_helper . Resize ( WebSize ( 640 , 480 ) ) ; WebLocalFrameImpl * frame = web_view_helper . LocalMainFrame ( ) ; const char kSource [ ] = "<img id='foo' src='foo' alt='foo alt' width='200' height='200'>" ; FrameTestHelpers : : LoadHTMLString ( frame , kSource , ToKURL ( "about:blank" ) ) ; web_view_helper . GetWebView ( ) -> UpdateAllLifecyclePhases ( ) ; RunPendingTasks ( ) ; LayoutObject * layout_object = frame -> GetFrame ( ) -> GetDocument ( ) -> getElementById ( "foo" ) -> GetLayoutObject ( ) -> SlowFirstChild ( ) ; String text = "" ; for ( LayoutObject * obj = layout_object ; obj ; obj = obj -> NextInPreOrder ( ) ) { if ( obj -> IsText ( ) ) { LayoutText * layout_text = ToLayoutText ( obj ) ; text = layout_text -> GetText ( ) ; break ; } } EXPECT_EQ ( "foo alt" , text . Utf8 ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( DownloadNotificationTest , DownloadRemoved ) { CreateDownload ( ) ; EXPECT_TRUE ( notification ( ) ) ; download_item ( ) -> Remove ( ) ; EXPECT_FALSE ( notification ( ) ) ; std : : vector < download : : DownloadItem * > downloads ; GetDownloadManager ( browser ( ) ) -> GetAllDownloads ( & downloads ) ; EXPECT_EQ ( 0u , downloads . size ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void clean_index ( AVFormatContext * s ) { int i ; int64_t j ; for ( i = 0 ; i < s -> nb_streams ; i ++ ) { AVStream * st = s -> streams [ i ] ; AVIStream * ast = st -> priv_data ; int n = st -> nb_index_entries ; int max = ast -> sample_size ; int64_t pos , size , ts ; if ( n != 1 || ast -> sample_size == 0 ) continue ; while ( max < 1024 ) max += max ; pos = st -> index_entries [ 0 ] . pos ; size = st -> index_entries [ 0 ] . size ; ts = st -> index_entries [ 0 ] . timestamp ; for ( j = 0 ; j < size ; j += max ) av_add_index_entry ( st , pos + j , ts + j , FFMIN ( max , size - j ) , 0 , AVINDEX_KEYFRAME ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static struct usb_memory * find_memory_area ( struct usb_dev_state * ps , const struct usbdevfs_urb * uurb ) { struct usb_memory * usbm = NULL , * iter ; unsigned long flags ; unsigned long uurb_start = ( unsigned long ) uurb -> buffer ; spin_lock_irqsave ( & ps -> lock , flags ) ; list_for_each_entry ( iter , & ps -> memory_list , memlist ) { if ( uurb_start >= iter -> vm_start && uurb_start < iter -> vm_start + iter -> size ) { if ( uurb -> buffer_length > iter -> vm_start + iter -> size - uurb_start ) { usbm = ERR_PTR ( - EINVAL ) ; } else { usbm = iter ; usbm -> urb_use_count ++ ; } break ; } } spin_unlock_irqrestore ( & ps -> lock , flags ) ; return usbm ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_oid_to_str ( void ) { struct { unsigned int binlen ; unsigned char * bin ; char * str ; } tests [ ] = { { 7 , "\x02\x82\x06\x01\x0A\x0C\x00" , "0.2.262.1.10.12.0" } , { 7 , "\x02\x82\x06\x01\x0A\x0C\x01" , "0.2.262.1.10.12.1" } , { 7 , "\x2A\x86\x48\xCE\x38\x04\x01" , "1.2.840.10040.4.1" } , { 7 , "\x2A\x86\x48\xCE\x38\x04\x03" , "1.2.840.10040.4.3" } , { 10 , "\x2B\x06\x01\x04\x01\xDA\x47\x02\x01\x01" , "1.3.6.1.4.1.11591.2.1.1" } , { 3 , "\x55\x1D\x0E" , "2.5.29.14" } , { 9 , "\x80\x02\x70\x50\x25\x46\xfd\x0c\xc0" , BADOID } , { 1 , "\x80" , BADOID } , { 2 , "\x81\x00" , "2.48" } , { 2 , "\x81\x01" , "2.49" } , { 2 , "\x81\x7f" , "2.175" } , { 2 , "\x81\x80" , "2.48" } , { 2 , "\x81\x81\x01" , "2.49" } , { 0 , "" , "" } , { 0 , NULL , NULL } } ; int tidx ; char * str ; for ( tidx = 0 ; tests [ tidx ] . bin ; tidx ++ ) { str = ksba_oid_to_str ( tests [ tidx ] . bin , tests [ tidx ] . binlen ) ; if ( ! str ) { perror ( "ksba_oid_to_str failed" ) ; exit ( 1 ) ; } if ( strcmp ( tests [ tidx ] . str , str ) ) { fprintf ( stderr , "ksba_oid_to_str test %d failed\n" , tidx ) ; fprintf ( stderr , " got=%s\n" , str ) ; fprintf ( stderr , " want=%s\n" , tests [ tidx ] . str ) ; exit ( 1 ) ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int zmbv_decode_xor_32 ( ZmbvContext * c ) { uint8_t * src = c -> decomp_buf ; uint32_t * output , * prev ; int8_t * mvec ; int x , y ; int d , dx , dy , bw2 , bh2 ; int block ; int i , j ; int mx , my ; output = ( uint32_t * ) c -> cur ; prev = ( uint32_t * ) c -> prev ; mvec = ( int8_t * ) src ; src += ( ( c -> bx * c -> by * 2 + 3 ) & ~ 3 ) ; block = 0 ; for ( y = 0 ; y < c -> height ; y += c -> bh ) { bh2 = ( ( c -> height - y ) > c -> bh ) ? c -> bh : ( c -> height - y ) ; for ( x = 0 ; x < c -> width ; x += c -> bw ) { uint32_t * out , * tprev ; d = mvec [ block ] & 1 ; dx = mvec [ block ] >> 1 ; dy = mvec [ block + 1 ] >> 1 ; block += 2 ; bw2 = ( ( c -> width - x ) > c -> bw ) ? c -> bw : ( c -> width - x ) ; out = output + x ; tprev = prev + x + dx + dy * c -> width ; mx = x + dx ; my = y + dy ; for ( j = 0 ; j < bh2 ; j ++ ) { if ( my + j < 0 || my + j >= c -> height ) { memset ( out , 0 , bw2 * 4 ) ; } else { for ( i = 0 ; i < bw2 ; i ++ ) { if ( mx + i < 0 || mx + i >= c -> width ) out [ i ] = 0 ; else out [ i ] = tprev [ i ] ; } } out += c -> width ; tprev += c -> width ; } if ( d ) { out = output + x ; for ( j = 0 ; j < bh2 ; j ++ ) { for ( i = 0 ; i < bw2 ; i ++ ) { out [ i ] ^= * ( ( uint32_t * ) src ) ; src += 4 ; } out += c -> width ; } } } output += c -> width * c -> bh ; prev += c -> width * c -> bh ; } if ( src - c -> decomp_buf != c -> decomp_len ) av_log ( c -> avctx , AV_LOG_ERROR , "Used %ti of %i bytes\n" , src - c -> decomp_buf , c -> decomp_len ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vp9_idct8x8_add ( const tran_low_t * input , uint8_t * dest , int stride , int eob ) { if ( eob == 1 ) vp9_idct8x8_1_add ( input , dest , stride ) ; else if ( eob <= 12 ) vp9_idct8x8_12_add ( input , dest , stride ) ; else vp9_idct8x8_64_add ( input , dest , stride ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void TSVConnActiveTimeoutCancel ( TSVConn connp ) { sdk_assert ( sdk_sanity_check_iocore_structure ( connp ) == TS_SUCCESS ) ; NetVConnection * vc = ( NetVConnection * ) connp ; vc -> cancel_active_timeout ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void DisconnectDatabase ( Archive * AHX ) { ArchiveHandle * AH = ( ArchiveHandle * ) AHX ; char errbuf [ 1 ] ; if ( ! AH -> connection ) return ; if ( AH -> connCancel ) { if ( PQtransactionStatus ( AH -> connection ) == PQTRANS_ACTIVE ) PQcancel ( AH -> connCancel , errbuf , sizeof ( errbuf ) ) ; set_archive_cancel_info ( AH , NULL ) ; } PQfinish ( AH -> connection ) ; AH -> connection = NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void writer_print_section_footer ( WriterContext * wctx ) { int section_id = wctx -> section [ wctx -> level ] -> id ; int parent_section_id = wctx -> level ? wctx -> section [ wctx -> level - 1 ] -> id : SECTION_ID_NONE ; if ( parent_section_id != SECTION_ID_NONE ) wctx -> nb_item [ wctx -> level - 1 ] ++ ; if ( parent_section_id == SECTION_ID_PACKETS_AND_FRAMES ) { if ( section_id == SECTION_ID_PACKET ) wctx -> nb_section_packet ++ ; else wctx -> nb_section_frame ++ ; } if ( wctx -> writer -> print_section_footer ) wctx -> writer -> print_section_footer ( wctx ) ; wctx -> level -- ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int nb_add_number ( char * * ret_buffer , size_t * ret_buffer_len , uint16_t type , uint64_t value ) { char * packet_ptr ; size_t packet_len ; uint16_t pkg_type ; uint16_t pkg_length ; uint64_t pkg_value ; size_t offset ; packet_len = sizeof ( pkg_type ) + sizeof ( pkg_length ) + sizeof ( pkg_value ) ; if ( * ret_buffer_len < packet_len ) return ( ENOMEM ) ; pkg_type = htons ( type ) ; pkg_length = htons ( ( uint16_t ) packet_len ) ; pkg_value = htonll ( value ) ; packet_ptr = * ret_buffer ; offset = 0 ; memcpy ( packet_ptr + offset , & pkg_type , sizeof ( pkg_type ) ) ; offset += sizeof ( pkg_type ) ; memcpy ( packet_ptr + offset , & pkg_length , sizeof ( pkg_length ) ) ; offset += sizeof ( pkg_length ) ; memcpy ( packet_ptr + offset , & pkg_value , sizeof ( pkg_value ) ) ; offset += sizeof ( pkg_value ) ; assert ( offset == packet_len ) ; * ret_buffer = packet_ptr + packet_len ; * ret_buffer_len -= packet_len ; return ( 0 ) ; }
0False