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 | TEST_P ( PasswordStoreXTest , Notifications ) {
std : : unique_ptr < password_manager : : LoginDatabase > login_db ( new password_manager : : LoginDatabase ( test_login_db_file_path ( ) ) ) ;
scoped_refptr < PasswordStoreX > store ( new PasswordStoreX ( base : : ThreadTaskRunnerHandle : : Get ( ) , base : : ThreadTaskRunnerHandle : : Get ( ) , std : : move ( login_db ) , GetBackend ( GetParam ( ) ) ) ) ;
store -> Init ( syncer : : SyncableService : : StartSyncFlare ( ) ) ;
password_manager : : PasswordFormData form_data = {
PasswordForm : : SCHEME_HTML , "http://bar.example.com" , "http://bar.example.com/origin" , "http://bar.example.com/action" , L"submit_element" , L"username_element" , L"password_element" , L"username_value" , L"password_value" , true , 1 }
;
std : : unique_ptr < PasswordForm > form = CreatePasswordFormFromDataForTesting ( form_data ) ;
password_manager : : MockPasswordStoreObserver observer ;
store -> AddObserver ( & observer ) ;
const PasswordStoreChange expected_add_changes [ ] = {
PasswordStoreChange ( PasswordStoreChange : : ADD , * form ) , }
;
EXPECT_CALL ( observer , OnLoginsChanged ( ElementsAreArray ( expected_add_changes ) ) ) ;
store -> AddLogin ( * form ) ;
base : : RunLoop ( ) . RunUntilIdle ( ) ;
form -> password_value = base : : ASCIIToUTF16 ( "a different password" ) ;
const PasswordStoreChange expected_update_changes [ ] = {
PasswordStoreChange ( PasswordStoreChange : : UPDATE , * form ) , }
;
EXPECT_CALL ( observer , OnLoginsChanged ( ElementsAreArray ( expected_update_changes ) ) ) ;
store -> UpdateLogin ( * form ) ;
base : : RunLoop ( ) . RunUntilIdle ( ) ;
const PasswordStoreChange expected_delete_changes [ ] = {
PasswordStoreChange ( PasswordStoreChange : : REMOVE , * form ) , }
;
EXPECT_CALL ( observer , OnLoginsChanged ( ElementsAreArray ( expected_delete_changes ) ) ) ;
store -> RemoveLogin ( * form ) ;
base : : RunLoop ( ) . RunUntilIdle ( ) ;
store -> RemoveObserver ( & observer ) ;
store -> ShutdownOnUIThread ( ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int SpoolssGetPrinterData_r ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep _U_ ) {
dcerpc_call_value * dcv = ( dcerpc_call_value * ) di -> call_data ;
guint32 type ;
proto_item * hidden_item ;
const char * data ;
hidden_item = proto_tree_add_uint ( tree , hf_printerdata , tvb , offset , 0 , 1 ) ;
PROTO_ITEM_SET_HIDDEN ( hidden_item ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_printerdata_type , & type ) ;
data = ( const char * ) ( dcv -> se_data ? dcv -> se_data : "????" ) ;
col_append_fstr ( pinfo -> cinfo , COL_INFO , ", %s" , data ) ;
offset = dissect_printerdata_data ( tvb , offset , pinfo , tree , di , drep , type ) ;
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 void tgq_idct_put_mb_dconly ( TgqContext * s , int mb_x , int mb_y , const int8_t * dc ) {
int linesize = s -> frame . linesize [ 0 ] ;
uint8_t * dest_y = s -> frame . data [ 0 ] + ( mb_y * 16 * linesize ) + mb_x * 16 ;
uint8_t * dest_cb = s -> frame . data [ 1 ] + ( mb_y * 8 * s -> frame . linesize [ 1 ] ) + mb_x * 8 ;
uint8_t * dest_cr = s -> frame . data [ 2 ] + ( mb_y * 8 * s -> frame . linesize [ 2 ] ) + mb_x * 8 ;
tgq_dconly ( s , dest_y , linesize , dc [ 0 ] ) ;
tgq_dconly ( s , dest_y + 8 , linesize , dc [ 1 ] ) ;
tgq_dconly ( s , dest_y + 8 * linesize , linesize , dc [ 2 ] ) ;
tgq_dconly ( s , dest_y + 8 * linesize + 8 , linesize , dc [ 3 ] ) ;
if ( ! ( s -> avctx -> flags & CODEC_FLAG_GRAY ) ) {
tgq_dconly ( s , dest_cb , s -> frame . linesize [ 1 ] , dc [ 4 ] ) ;
tgq_dconly ( s , dest_cr , s -> frame . linesize [ 2 ] , dc [ 5 ] ) ;
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static inline uint32_t vmsvga_fifo_read ( struct vmsvga_state_s * s ) {
return le32_to_cpu ( vmsvga_fifo_read_raw ( s ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_OCTET_STRING_SIZE_4 ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_octet_string ( tvb , offset , actx , tree , hf_index , 4 , 4 , FALSE , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int ff_h264_handle_frag_packet ( AVPacket * pkt , const uint8_t * buf , int len , int start_bit , const uint8_t * nal_header , int nal_header_len ) {
int ret ;
int tot_len = len ;
int pos = 0 ;
if ( start_bit ) tot_len += sizeof ( start_sequence ) + nal_header_len ;
if ( ( ret = av_new_packet ( pkt , tot_len ) ) < 0 ) return ret ;
if ( start_bit ) {
memcpy ( pkt -> data + pos , start_sequence , sizeof ( start_sequence ) ) ;
pos += sizeof ( start_sequence ) ;
memcpy ( pkt -> data + pos , nal_header , nal_header_len ) ;
pos += nal_header_len ;
}
memcpy ( pkt -> data + pos , buf , len ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int encode_hq_slice ( AVCodecContext * avctx , void * arg ) {
SliceArgs * slice_dat = arg ;
VC2EncContext * s = slice_dat -> ctx ;
PutBitContext * pb = & slice_dat -> pb ;
const int slice_x = slice_dat -> x ;
const int slice_y = slice_dat -> y ;
const int quant_idx = slice_dat -> quant_idx ;
const int slice_bytes_max = slice_dat -> bytes ;
uint8_t quants [ MAX_DWT_LEVELS ] [ 4 ] ;
int p , level , orientation ;
memset ( put_bits_ptr ( pb ) , 0 , s -> prefix_bytes ) ;
skip_put_bytes ( pb , s -> prefix_bytes ) ;
put_bits ( pb , 8 , quant_idx ) ;
for ( level = 0 ;
level < s -> wavelet_depth ;
level ++ ) for ( orientation = ! ! level ;
orientation < 4 ;
orientation ++ ) quants [ level ] [ orientation ] = FFMAX ( quant_idx - s -> quant [ level ] [ orientation ] , 0 ) ;
for ( p = 0 ;
p < 3 ;
p ++ ) {
int bytes_start , bytes_len , pad_s , pad_c ;
bytes_start = put_bits_count ( pb ) >> 3 ;
put_bits ( pb , 8 , 0 ) ;
for ( level = 0 ;
level < s -> wavelet_depth ;
level ++ ) {
for ( orientation = ! ! level ;
orientation < 4 ;
orientation ++ ) {
encode_subband ( s , pb , slice_x , slice_y , & s -> plane [ p ] . band [ level ] [ orientation ] , quants [ level ] [ orientation ] ) ;
}
}
avpriv_align_put_bits ( pb ) ;
bytes_len = ( put_bits_count ( pb ) >> 3 ) - bytes_start - 1 ;
if ( p == 2 ) {
int len_diff = slice_bytes_max - ( put_bits_count ( pb ) >> 3 ) ;
pad_s = FFALIGN ( ( bytes_len + len_diff ) , s -> size_scaler ) / s -> size_scaler ;
pad_c = ( pad_s * s -> size_scaler ) - bytes_len ;
}
else {
pad_s = FFALIGN ( bytes_len , s -> size_scaler ) / s -> size_scaler ;
pad_c = ( pad_s * s -> size_scaler ) - bytes_len ;
}
pb -> buf [ bytes_start ] = pad_s ;
flush_put_bits ( pb ) ;
memset ( put_bits_ptr ( pb ) , 0xFF , pad_c ) ;
skip_put_bytes ( pb , pad_c ) ;
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void dumpcffcidset ( struct alltabs * at ) {
int gid , start ;
putc ( 2 , at -> charset ) ;
start = - 1 ;
for ( gid = 1 ;
gid < at -> gi . gcnt ;
++ gid ) {
if ( start == - 1 ) start = gid ;
else if ( at -> gi . bygid [ gid ] - at -> gi . bygid [ start ] != gid - start ) {
putshort ( at -> charset , at -> gi . bygid [ start ] ) ;
putshort ( at -> charset , at -> gi . bygid [ gid - 1 ] - at -> gi . bygid [ start ] ) ;
start = gid ;
}
}
if ( start != - 1 ) {
putshort ( at -> charset , at -> gi . bygid [ start ] ) ;
putshort ( at -> charset , at -> gi . bygid [ gid - 1 ] - at -> gi . bygid [ start ] ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int vp8_receive_raw_frame ( VP8_COMP * cpi , unsigned int frame_flags , YV12_BUFFER_CONFIG * sd , int64_t time_stamp , int64_t end_time ) {
struct vpx_usec_timer timer ;
int res = 0 ;
vpx_usec_timer_start ( & timer ) ;
if ( sd -> y_width != cpi -> oxcf . Width || sd -> y_height != cpi -> oxcf . Height ) {
assert ( cpi -> oxcf . lag_in_frames < 2 ) ;
dealloc_raw_frame_buffers ( cpi ) ;
alloc_raw_frame_buffers ( cpi ) ;
}
if ( vp8_lookahead_push ( cpi -> lookahead , sd , time_stamp , end_time , frame_flags , cpi -> active_map_enabled ? cpi -> active_map : NULL ) ) res = - 1 ;
vpx_usec_timer_mark ( & timer ) ;
cpi -> time_receive_data += vpx_usec_timer_elapsed ( & timer ) ;
return res ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean construct_match_selected_string ( field_info * finfo , epan_dissect_t * edt , char * * filter ) {
header_field_info * hfinfo ;
int abbrev_len ;
char * ptr ;
int buf_len ;
int dfilter_len , i ;
gint start , length , length_remaining ;
guint8 c ;
gchar is_signed_num = FALSE ;
if ( ! finfo ) return FALSE ;
hfinfo = finfo -> hfinfo ;
DISSECTOR_ASSERT ( hfinfo ) ;
abbrev_len = ( int ) strlen ( hfinfo -> abbrev ) ;
if ( hfinfo -> strings && ( hfinfo -> display & FIELD_DISPLAY_E_MASK ) == BASE_NONE ) {
const gchar * str = NULL ;
switch ( hfinfo -> type ) {
case FT_INT8 : case FT_INT16 : case FT_INT24 : case FT_INT32 : str = hf_try_val_to_str ( fvalue_get_sinteger ( & finfo -> value ) , hfinfo ) ;
break ;
case FT_UINT8 : case FT_UINT16 : case FT_UINT24 : case FT_UINT32 : str = hf_try_val_to_str ( fvalue_get_uinteger ( & finfo -> value ) , hfinfo ) ;
break ;
default : break ;
}
if ( str != NULL && filter != NULL ) {
* filter = wmem_strdup_printf ( NULL , "%s == \"%s\"" , hfinfo -> abbrev , str ) ;
return TRUE ;
}
}
switch ( hfinfo -> type ) {
case FT_INT8 : case FT_INT16 : case FT_INT24 : case FT_INT32 : is_signed_num = TRUE ;
case FT_UINT8 : case FT_UINT16 : case FT_UINT24 : case FT_UINT32 : case FT_FRAMENUM : if ( filter != NULL ) {
guint32 number ;
char buf [ 32 ] ;
const char * out ;
if ( is_signed_num ) number = fvalue_get_sinteger ( & finfo -> value ) ;
else number = fvalue_get_uinteger ( & finfo -> value ) ;
out = hfinfo_numeric_value_format ( hfinfo , buf , number ) ;
* filter = wmem_strdup_printf ( NULL , "%s == %s" , hfinfo -> abbrev , out ) ;
}
break ;
case FT_INT40 : case FT_INT48 : case FT_INT56 : case FT_INT64 : is_signed_num = TRUE ;
case FT_UINT40 : case FT_UINT48 : case FT_UINT56 : case FT_UINT64 : if ( filter != NULL ) {
guint64 number ;
char buf [ 48 ] ;
const char * out ;
if ( is_signed_num ) number = fvalue_get_sinteger64 ( & finfo -> value ) ;
else number = fvalue_get_uinteger64 ( & finfo -> value ) ;
out = hfinfo_numeric_value_format64 ( hfinfo , buf , number ) ;
* filter = wmem_strdup_printf ( NULL , "%s == %s" , hfinfo -> abbrev , out ) ;
}
break ;
case FT_PROTOCOL : if ( filter != NULL ) * filter = wmem_strdup ( NULL , finfo -> hfinfo -> abbrev ) ;
break ;
case FT_NONE : length = finfo -> length ;
if ( length == 0 ) {
if ( filter != NULL ) * filter = wmem_strdup ( NULL , finfo -> hfinfo -> abbrev ) ;
break ;
}
if ( length < 0 ) return FALSE ;
if ( edt == NULL ) return FALSE ;
if ( finfo -> ds_tvb != edt -> tvb ) return FALSE ;
length_remaining = tvb_captured_length_remaining ( finfo -> ds_tvb , finfo -> start ) ;
if ( length > length_remaining ) length = length_remaining ;
if ( length <= 0 ) return FALSE ;
if ( filter != NULL ) {
start = finfo -> start ;
buf_len = 32 + length * 3 ;
* filter = ( char * ) wmem_alloc0 ( NULL , buf_len ) ;
ptr = * filter ;
ptr += g_snprintf ( ptr , ( gulong ) ( buf_len - ( ptr - * filter ) ) , "frame[%d:%d] == " , finfo -> start , length ) ;
for ( i = 0 ;
i < length ;
i ++ ) {
c = tvb_get_guint8 ( finfo -> ds_tvb , start ) ;
start ++ ;
if ( i == 0 ) {
ptr += g_snprintf ( ptr , ( gulong ) ( buf_len - ( ptr - * filter ) ) , "%02x" , c ) ;
}
else {
ptr += g_snprintf ( ptr , ( gulong ) ( buf_len - ( ptr - * filter ) ) , ":%02x" , c ) ;
}
}
}
break ;
case FT_PCRE : DISSECTOR_ASSERT_NOT_REACHED ( ) ;
break ;
default : if ( filter != NULL ) {
char * str ;
dfilter_len = fvalue_string_repr_len ( & finfo -> value , FTREPR_DFILTER , finfo -> hfinfo -> display ) ;
dfilter_len += abbrev_len + 4 + 1 ;
* filter = ( char * ) wmem_alloc0 ( NULL , dfilter_len ) ;
str = fvalue_to_string_repr ( NULL , & finfo -> value , FTREPR_DFILTER , finfo -> hfinfo -> display ) ;
g_snprintf ( * filter , dfilter_len , "%s == %s" , hfinfo -> abbrev , str ) ;
wmem_free ( NULL , str ) ;
}
break ;
}
return TRUE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void dissect_coap_payload ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * coap_tree , proto_tree * parent_tree , gint offset , gint offset_end , guint8 code_class , coap_info * coinfo , coap_common_dissect_t * dissect_hf , gboolean oscore ) {
proto_tree * payload_tree ;
proto_item * payload_item , * length_item ;
tvbuff_t * payload_tvb ;
guint payload_length = offset_end - offset ;
const char * coap_ctype_str_dis ;
char str_payload [ 80 ] ;
if ( coinfo -> ctype_value == DEFAULT_COAP_CTYPE_VALUE ) {
if ( ( code_class >= 4 ) && ( code_class <= 5 ) ) {
coinfo -> ctype_str = "text/plain;
charset=utf-8" ;
coap_ctype_str_dis = "text/plain" ;
}
else {
coinfo -> ctype_str = "application/octet-stream" ;
coap_ctype_str_dis = coinfo -> ctype_str ;
}
}
else if ( coinfo -> ctype_value == 0 ) {
coap_ctype_str_dis = "text/plain" ;
}
else {
coap_ctype_str_dis = coinfo -> ctype_str ;
}
g_snprintf ( str_payload , sizeof ( str_payload ) , "Payload Content-Format: %s%s, Length: %u" , coinfo -> ctype_str , coinfo -> ctype_value == DEFAULT_COAP_CTYPE_VALUE ? " (no Content-Format)" : "" , payload_length ) ;
payload_item = proto_tree_add_string ( coap_tree , dissect_hf -> hf . payload , tvb , offset , payload_length , str_payload ) ;
payload_tree = proto_item_add_subtree ( payload_item , dissect_hf -> ett . payload ) ;
proto_tree_add_string ( payload_tree , dissect_hf -> hf . payload_desc , tvb , offset , 0 , coinfo -> ctype_str ) ;
length_item = proto_tree_add_uint ( payload_tree , dissect_hf -> hf . payload_length , tvb , offset , 0 , payload_length ) ;
PROTO_ITEM_SET_GENERATED ( length_item ) ;
payload_tvb = tvb_new_subset_length ( tvb , offset , payload_length ) ;
dissector_try_string ( media_type_dissector_table , coap_ctype_str_dis , payload_tvb , pinfo , parent_tree , NULL ) ;
if ( coinfo -> object_security && ! oscore ) {
proto_item_set_text ( payload_item , "Encrypted OSCORE Data" ) ;
call_dissector_with_data ( oscore_handle , payload_tvb , pinfo , parent_tree , coinfo -> oscore_info ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int openpic_load ( QEMUFile * f , void * opaque , int version_id ) {
OpenPICState * opp = ( OpenPICState * ) opaque ;
unsigned int i ;
if ( version_id != 1 ) {
return - EINVAL ;
}
qemu_get_be32s ( f , & opp -> gcr ) ;
qemu_get_be32s ( f , & opp -> vir ) ;
qemu_get_be32s ( f , & opp -> pir ) ;
qemu_get_be32s ( f , & opp -> spve ) ;
qemu_get_be32s ( f , & opp -> tfrr ) ;
qemu_get_be32s ( f , & opp -> nb_cpus ) ;
for ( i = 0 ;
i < opp -> nb_cpus ;
i ++ ) {
qemu_get_sbe32s ( f , & opp -> dst [ i ] . ctpr ) ;
openpic_load_IRQ_queue ( f , & opp -> dst [ i ] . raised ) ;
openpic_load_IRQ_queue ( f , & opp -> dst [ i ] . servicing ) ;
qemu_get_buffer ( f , ( uint8_t * ) & opp -> dst [ i ] . outputs_active , sizeof ( opp -> dst [ i ] . outputs_active ) ) ;
}
for ( i = 0 ;
i < OPENPIC_MAX_TMR ;
i ++ ) {
qemu_get_be32s ( f , & opp -> timers [ i ] . tccr ) ;
qemu_get_be32s ( f , & opp -> timers [ i ] . tbcr ) ;
}
for ( i = 0 ;
i < opp -> max_irq ;
i ++ ) {
uint32_t val ;
val = qemu_get_be32 ( f ) ;
write_IRQreg_idr ( opp , i , val ) ;
val = qemu_get_be32 ( f ) ;
write_IRQreg_ivpr ( opp , i , val ) ;
qemu_get_be32s ( f , & opp -> src [ i ] . ivpr ) ;
qemu_get_be32s ( f , & opp -> src [ i ] . idr ) ;
qemu_get_be32s ( f , & opp -> src [ i ] . destmask ) ;
qemu_get_sbe32s ( f , & opp -> src [ i ] . last_cpu ) ;
qemu_get_sbe32s ( f , & opp -> src [ i ] . pending ) ;
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int mime_parse_month ( const char * & buf , const char * end , int * month ) {
const char * e ;
while ( ( buf != end ) && * buf && ! ParseRules : : is_alpha ( * buf ) ) {
buf += 1 ;
}
e = buf ;
while ( ( e != end ) && * e && ParseRules : : is_alpha ( * e ) ) {
e += 1 ;
}
* month = month_names_dfa -> match ( buf , e - buf ) ;
if ( * month < 0 ) {
return 0 ;
}
else {
buf = e ;
return 1 ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | float lut_interp_linear ( double input_value , uint16_t * table , size_t length ) {
int upper , lower ;
float value ;
input_value = input_value * ( length - 1 ) ;
upper = ceil ( input_value ) ;
lower = floor ( input_value ) ;
value = table [ upper ] * ( 1. - ( upper - input_value ) ) + table [ lower ] * ( upper - input_value ) ;
return value * ( 1.f / 65535.f ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | extern bool validate_slurm_user ( uid_t uid ) {
# ifndef NDEBUG if ( drop_priv ) return false ;
# endif if ( ( uid == 0 ) || ( uid == slurmctld_conf . slurm_user_id ) ) return true ;
else return false ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static bool steal_time_msr_needed ( void * opaque ) {
X86CPU * cpu = opaque ;
return cpu -> env . steal_time_msr != 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void ber_free ( BerElement * ber , int freebuf ) {
if ( ber == NULL ) {
LDAP_MEMORY_DEBUG_ASSERT ( ber != NULL ) ;
return ;
}
if ( freebuf ) ber_free_buf ( ber ) ;
ber_memfree_x ( ( char * ) ber , ber -> ber_memctx ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | vpx_codec_err_t vpx_svc_init ( SvcContext * svc_ctx , vpx_codec_ctx_t * codec_ctx , vpx_codec_iface_t * iface , vpx_codec_enc_cfg_t * enc_cfg ) {
vpx_codec_err_t res ;
int i ;
SvcInternal * const si = get_svc_internal ( svc_ctx ) ;
if ( svc_ctx == NULL || codec_ctx == NULL || iface == NULL || enc_cfg == NULL ) {
return VPX_CODEC_INVALID_PARAM ;
}
if ( si == NULL ) return VPX_CODEC_MEM_ERROR ;
si -> codec_ctx = codec_ctx ;
si -> width = enc_cfg -> g_w ;
si -> height = enc_cfg -> g_h ;
if ( enc_cfg -> kf_max_dist < 2 ) {
svc_log ( svc_ctx , SVC_LOG_ERROR , "key frame distance too small: %d\n" , enc_cfg -> kf_max_dist ) ;
return VPX_CODEC_INVALID_PARAM ;
}
si -> kf_dist = enc_cfg -> kf_max_dist ;
if ( svc_ctx -> spatial_layers == 0 ) svc_ctx -> spatial_layers = VPX_SS_DEFAULT_LAYERS ;
if ( svc_ctx -> spatial_layers < 1 || svc_ctx -> spatial_layers > VPX_SS_MAX_LAYERS ) {
svc_log ( svc_ctx , SVC_LOG_ERROR , "spatial layers: invalid value: %d\n" , svc_ctx -> spatial_layers ) ;
return VPX_CODEC_INVALID_PARAM ;
}
for ( i = 0 ;
i < VPX_SS_MAX_LAYERS ;
++ i ) {
si -> svc_params . max_quantizers [ i ] = MAX_QUANTIZER ;
si -> svc_params . min_quantizers [ i ] = 0 ;
si -> svc_params . scaling_factor_num [ i ] = DEFAULT_SCALE_FACTORS_NUM [ i ] ;
si -> svc_params . scaling_factor_den [ i ] = DEFAULT_SCALE_FACTORS_DEN [ i ] ;
}
res = parse_options ( svc_ctx , si -> options ) ;
if ( res != VPX_CODEC_OK ) return res ;
if ( svc_ctx -> spatial_layers < 1 ) svc_ctx -> spatial_layers = 1 ;
if ( svc_ctx -> spatial_layers > VPX_SS_MAX_LAYERS ) svc_ctx -> spatial_layers = VPX_SS_MAX_LAYERS ;
if ( svc_ctx -> temporal_layers < 1 ) svc_ctx -> temporal_layers = 1 ;
if ( svc_ctx -> temporal_layers > VPX_TS_MAX_LAYERS ) svc_ctx -> temporal_layers = VPX_TS_MAX_LAYERS ;
assign_layer_bitrates ( svc_ctx , enc_cfg ) ;
# if CONFIG_SPATIAL_SVC for ( i = 0 ;
i < svc_ctx -> spatial_layers ;
++ i ) enc_cfg -> ss_enable_auto_alt_ref [ i ] = si -> enable_auto_alt_ref [ i ] ;
# endif if ( svc_ctx -> temporal_layers > 1 ) {
int i ;
for ( i = 0 ;
i < svc_ctx -> temporal_layers ;
++ i ) {
enc_cfg -> ts_target_bitrate [ i ] = enc_cfg -> rc_target_bitrate / svc_ctx -> temporal_layers ;
enc_cfg -> ts_rate_decimator [ i ] = 1 << ( svc_ctx -> temporal_layers - 1 - i ) ;
}
}
enc_cfg -> ss_number_layers = svc_ctx -> spatial_layers ;
enc_cfg -> ts_number_layers = svc_ctx -> temporal_layers ;
if ( enc_cfg -> g_error_resilient == 0 && si -> use_multiple_frame_contexts == 0 ) enc_cfg -> g_error_resilient = 1 ;
res = vpx_codec_enc_init ( codec_ctx , iface , enc_cfg , VPX_CODEC_USE_PSNR ) ;
if ( res != VPX_CODEC_OK ) {
svc_log ( svc_ctx , SVC_LOG_ERROR , "svc_enc_init error\n" ) ;
return res ;
}
vpx_codec_control ( codec_ctx , VP9E_SET_SVC , 1 ) ;
vpx_codec_control ( codec_ctx , VP9E_SET_SVC_PARAMETERS , & si -> svc_params ) ;
return VPX_CODEC_OK ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int selinux_msg_queue_msgctl ( struct msg_queue * msq , int cmd ) {
int err ;
int perms ;
switch ( cmd ) {
case IPC_INFO : case MSG_INFO : return task_has_system ( current , SYSTEM__IPC_INFO ) ;
case IPC_STAT : case MSG_STAT : perms = MSGQ__GETATTR | MSGQ__ASSOCIATE ;
break ;
case IPC_SET : perms = MSGQ__SETATTR ;
break ;
case IPC_RMID : perms = MSGQ__DESTROY ;
break ;
default : return 0 ;
}
err = ipc_has_perm ( & msq -> q_perm , perms ) ;
return err ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void pdf_drop_gstate ( fz_context * ctx , pdf_gstate * gs ) {
pdf_drop_material ( ctx , & gs -> stroke ) ;
pdf_drop_material ( ctx , & gs -> fill ) ;
pdf_drop_font ( ctx , gs -> text . font ) ;
pdf_drop_xobject ( ctx , gs -> softmask ) ;
pdf_drop_obj ( ctx , gs -> softmask_resources ) ;
fz_drop_stroke_state ( ctx , gs -> stroke_state ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static char * ext_t_0_wml_10 ( tvbuff_t * tvb , guint32 value , guint32 str_tbl ) {
char * str = wmem_strdup_printf ( wmem_packet_scope ( ) , "Variable substitution - escaped: '%s'" , tvb_get_const_stringz ( tvb , str_tbl + value , NULL ) ) ;
return str ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void dtap_cc_hold_rej ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) {
guint32 curr_offset ;
guint32 consumed ;
guint curr_len ;
curr_offset = offset ;
curr_len = len ;
is_uplink = IS_UPLINK_FALSE ;
ELEM_MAND_LV ( GSM_A_PDU_TYPE_DTAP , DE_CAUSE , NULL ) ;
EXTRANEOUS_DATA_CHECK ( curr_len , 0 , pinfo , & ei_gsm_a_dtap_extraneous_data ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | unsigned int dtls1_min_mtu ( void ) {
return ( g_probable_mtu [ ( sizeof ( g_probable_mtu ) / sizeof ( g_probable_mtu [ 0 ] ) ) - 1 ] ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int dissect_h245_T38FaxProfile ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_T38FaxProfile , T38FaxProfile_sequence ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | unsigned int vp8_variance8x16_neon ( const unsigned char * src_ptr , int source_stride , const unsigned char * ref_ptr , int recon_stride , unsigned int * sse ) {
int i ;
uint8x8_t d0u8 , d2u8 , d4u8 , d6u8 ;
int16x4_t d22s16 , d23s16 , d24s16 , d25s16 ;
uint32x2_t d0u32 , d10u32 ;
int64x1_t d0s64 , d1s64 ;
uint16x8_t q11u16 , q12u16 ;
int32x4_t q8s32 , q9s32 , q10s32 ;
int64x2_t q0s64 , q1s64 , q5s64 ;
q8s32 = vdupq_n_s32 ( 0 ) ;
q9s32 = vdupq_n_s32 ( 0 ) ;
q10s32 = vdupq_n_s32 ( 0 ) ;
for ( i = 0 ;
i < 8 ;
i ++ ) {
d0u8 = vld1_u8 ( src_ptr ) ;
src_ptr += source_stride ;
d2u8 = vld1_u8 ( src_ptr ) ;
src_ptr += source_stride ;
__builtin_prefetch ( src_ptr ) ;
d4u8 = vld1_u8 ( ref_ptr ) ;
ref_ptr += recon_stride ;
d6u8 = vld1_u8 ( ref_ptr ) ;
ref_ptr += recon_stride ;
__builtin_prefetch ( ref_ptr ) ;
q11u16 = vsubl_u8 ( d0u8 , d4u8 ) ;
q12u16 = vsubl_u8 ( d2u8 , d6u8 ) ;
d22s16 = vreinterpret_s16_u16 ( vget_low_u16 ( q11u16 ) ) ;
d23s16 = vreinterpret_s16_u16 ( vget_high_u16 ( q11u16 ) ) ;
q8s32 = vpadalq_s16 ( q8s32 , vreinterpretq_s16_u16 ( q11u16 ) ) ;
q9s32 = vmlal_s16 ( q9s32 , d22s16 , d22s16 ) ;
q10s32 = vmlal_s16 ( q10s32 , d23s16 , d23s16 ) ;
d24s16 = vreinterpret_s16_u16 ( vget_low_u16 ( q12u16 ) ) ;
d25s16 = vreinterpret_s16_u16 ( vget_high_u16 ( q12u16 ) ) ;
q8s32 = vpadalq_s16 ( q8s32 , vreinterpretq_s16_u16 ( q12u16 ) ) ;
q9s32 = vmlal_s16 ( q9s32 , d24s16 , d24s16 ) ;
q10s32 = vmlal_s16 ( q10s32 , d25s16 , d25s16 ) ;
}
q10s32 = vaddq_s32 ( q10s32 , q9s32 ) ;
q0s64 = vpaddlq_s32 ( q8s32 ) ;
q1s64 = vpaddlq_s32 ( q10s32 ) ;
d0s64 = vadd_s64 ( vget_low_s64 ( q0s64 ) , vget_high_s64 ( q0s64 ) ) ;
d1s64 = vadd_s64 ( vget_low_s64 ( q1s64 ) , vget_high_s64 ( q1s64 ) ) ;
q5s64 = vmull_s32 ( vreinterpret_s32_s64 ( d0s64 ) , vreinterpret_s32_s64 ( d0s64 ) ) ;
vst1_lane_u32 ( ( uint32_t * ) sse , vreinterpret_u32_s64 ( d1s64 ) , 0 ) ;
d10u32 = vshr_n_u32 ( vreinterpret_u32_s64 ( vget_low_s64 ( q5s64 ) ) , 7 ) ;
d0u32 = vsub_u32 ( vreinterpret_u32_s64 ( d1s64 ) , d10u32 ) ;
return vget_lane_u32 ( d0u32 , 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_DepFECMode ( 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_DepFECMode , DepFECMode_choice , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_diameter_avp ( diam_ctx_t * c , tvbuff_t * tvb , int offset , diam_sub_dis_t * diam_sub_dis_inf ) {
guint32 code = tvb_get_ntohl ( tvb , offset ) ;
guint32 len = tvb_get_ntohl ( tvb , offset + 4 ) ;
guint32 vendor_flag = len & 0x80000000 ;
guint32 flags_bits_idx = ( len & 0xE0000000 ) >> 29 ;
guint32 flags_bits = ( len & 0xFF000000 ) >> 24 ;
guint32 vendorid = vendor_flag ? tvb_get_ntohl ( tvb , offset + 8 ) : 0 ;
wmem_tree_key_t k [ 3 ] ;
diam_avp_t * a ;
proto_item * pi , * avp_item ;
proto_tree * avp_tree , * save_tree ;
tvbuff_t * subtvb ;
diam_vnd_t * vendor ;
const char * code_str ;
const char * avp_str = NULL ;
guint8 pad_len ;
k [ 0 ] . length = 1 ;
k [ 0 ] . key = & code ;
k [ 1 ] . length = 1 ;
k [ 1 ] . key = & vendorid ;
k [ 2 ] . length = 0 ;
k [ 2 ] . key = NULL ;
a = ( diam_avp_t * ) wmem_tree_lookup32_array ( dictionary . avps , k ) ;
len &= 0x00ffffff ;
pad_len = ( len % 4 ) ? 4 - ( len % 4 ) : 0 ;
if ( ! a ) {
a = & unknown_avp ;
if ( vendor_flag ) {
if ( ! ( vendor = ( diam_vnd_t * ) wmem_tree_lookup32 ( dictionary . vnds , vendorid ) ) ) vendor = & unknown_vendor ;
}
else {
vendor = & no_vnd ;
}
}
else {
vendor = ( diam_vnd_t * ) a -> vendor ;
}
if ( vendor -> vs_avps_ext == NULL ) {
g_array_sort ( vendor -> vs_avps , compare_avps ) ;
vendor -> vs_avps_ext = value_string_ext_new ( VND_AVP_VS ( vendor ) , VND_AVP_VS_LEN ( vendor ) + 1 , g_strdup_printf ( "diameter_vendor_%s" , val_to_str_ext_const ( vendorid , & sminmpec_values_ext , "Unknown" ) ) ) ;
# if 0 {
value_string * vendor_avp_vs = VALUE_STRING_EXT_VS_P ( vendor -> vs_avps_ext ) ;
gint i = 0 ;
while ( vendor_avp_vs [ i ] . strptr != NULL ) {
g_warning ( "%u %s" , vendor_avp_vs [ i ] . value , vendor_avp_vs [ i ] . strptr ) ;
i ++ ;
}
}
# endif }
avp_item = proto_tree_add_item ( c -> tree , hf_diameter_avp , tvb , offset , len + pad_len , ENC_NA ) ;
avp_tree = proto_item_add_subtree ( avp_item , a -> ett ) ;
pi = proto_tree_add_item ( avp_tree , hf_diameter_avp_code , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
code_str = val_to_str_ext_const ( code , vendor -> vs_avps_ext , "Unknown" ) ;
proto_item_append_text ( pi , " %s" , code_str ) ;
if ( a == & unknown_avp ) {
proto_tree * tu = proto_item_add_subtree ( pi , ett_unknown ) ;
proto_tree_add_expert_format ( tu , c -> pinfo , & ei_diameter_avp_code , tvb , offset , 4 , "Unknown AVP %u (vendor=%s), if you know what this is you can add it to dictionary.xml" , code , val_to_str_ext_const ( vendorid , & sminmpec_values_ext , "Unknown" ) ) ;
}
offset += 4 ;
proto_item_set_text ( avp_item , "AVP: %s(%u) l=%u f=%s" , code_str , code , len , avpflags_str [ flags_bits_idx ] ) ;
pi = proto_tree_add_item ( avp_tree , hf_diameter_avp_flags , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
{
proto_tree * flags_tree = proto_item_add_subtree ( pi , ett_diameter_avp_flags ) ;
proto_tree_add_item ( flags_tree , hf_diameter_avp_flags_vendor_specific , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flags_tree , hf_diameter_avp_flags_mandatory , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flags_tree , hf_diameter_avp_flags_protected , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
pi = proto_tree_add_item ( flags_tree , hf_diameter_avp_flags_reserved3 , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
if ( flags_bits & 0x10 ) expert_add_info ( c -> pinfo , pi , & ei_diameter_reserved_bit_set ) ;
pi = proto_tree_add_item ( flags_tree , hf_diameter_avp_flags_reserved4 , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
if ( flags_bits & 0x08 ) expert_add_info ( c -> pinfo , pi , & ei_diameter_reserved_bit_set ) ;
pi = proto_tree_add_item ( flags_tree , hf_diameter_avp_flags_reserved5 , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
if ( flags_bits & 0x04 ) expert_add_info ( c -> pinfo , pi , & ei_diameter_reserved_bit_set ) ;
proto_tree_add_item ( flags_tree , hf_diameter_avp_flags_reserved6 , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
if ( flags_bits & 0x02 ) expert_add_info ( c -> pinfo , pi , & ei_diameter_reserved_bit_set ) ;
proto_tree_add_item ( flags_tree , hf_diameter_avp_flags_reserved7 , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
if ( flags_bits & 0x01 ) expert_add_info ( c -> pinfo , pi , & ei_diameter_reserved_bit_set ) ;
}
offset += 1 ;
proto_tree_add_item ( avp_tree , hf_diameter_avp_len , tvb , offset , 3 , ENC_BIG_ENDIAN ) ;
offset += 3 ;
if ( vendor_flag ) {
proto_item_append_text ( avp_item , " vnd=%s" , val_to_str ( vendorid , vnd_short_vs , "%d" ) ) ;
pi = proto_tree_add_item ( avp_tree , hf_diameter_avp_vendor_id , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
if ( vendor == & unknown_vendor ) {
proto_tree * tu = proto_item_add_subtree ( pi , ett_unknown ) ;
proto_tree_add_expert ( tu , c -> pinfo , & ei_diameter_avp_vendor_id , tvb , offset , 4 ) ;
}
offset += 4 ;
}
if ( len == ( guint32 ) ( vendor_flag ? 12 : 8 ) ) {
proto_tree_add_expert ( avp_tree , c -> pinfo , & ei_diameter_avp_no_data , tvb , offset , 0 ) ;
return len + pad_len ;
}
if ( ( diam_sub_dis_inf -> dis_gouped ) && ( ! vendor_flag ) && ( code == 266 ) ) {
diam_sub_dis_inf -> vendor_id = tvb_get_ntohl ( tvb , offset ) ;
}
subtvb = tvb_new_subset_length ( tvb , offset , len - ( 8 + ( vendor_flag ? 4 : 0 ) ) ) ;
offset += len - ( 8 + ( vendor_flag ? 4 : 0 ) ) ;
save_tree = c -> tree ;
c -> tree = avp_tree ;
if ( ( diam_sub_dis_inf -> dis_gouped ) && ( ! vendor_flag ) && ( code == 298 ) && ( diam_sub_dis_inf -> vendor_id != 0 ) && ( diam_sub_dis_inf -> vendor_id != VENDOR_THE3GPP ) ) {
if ( ! dissector_try_uint_new ( diameter_expr_result_vnd_table , diam_sub_dis_inf -> vendor_id , subtvb , c -> pinfo , avp_tree , FALSE , diam_sub_dis_inf ) ) {
dissect_diameter_other_vendor_exp_res ( subtvb , avp_tree , diam_sub_dis_inf ) ;
}
if ( diam_sub_dis_inf -> avp_str ) {
proto_item_append_text ( avp_item , " val=%s" , diam_sub_dis_inf -> avp_str ) ;
}
}
else if ( c -> version_rfc ) {
avp_str = a -> dissector_rfc ( c , a , subtvb , diam_sub_dis_inf ) ;
}
else {
avp_str = a -> dissector_v16 ( c , a , subtvb , diam_sub_dis_inf ) ;
}
c -> tree = save_tree ;
diam_sub_dis_inf -> avp_str = NULL ;
call_avp_subdissector ( vendorid , code , subtvb , c -> pinfo , avp_tree , diam_sub_dis_inf ) ;
if ( diam_sub_dis_inf -> avp_str ) {
proto_item_append_text ( avp_item , " val=%s" , diam_sub_dis_inf -> avp_str ) ;
}
else if ( avp_str ) {
proto_item_append_text ( avp_item , " val=%s" , avp_str ) ;
}
if ( pad_len ) {
guint8 i ;
pi = proto_tree_add_item ( avp_tree , hf_diameter_avp_pad , tvb , offset , pad_len , ENC_NA ) ;
for ( i = 0 ;
i < pad_len ;
i ++ ) {
if ( tvb_get_guint8 ( tvb , offset ++ ) != 0 ) {
expert_add_info ( c -> pinfo , pi , & ei_diameter_avp_pad ) ;
break ;
}
}
}
return len + pad_len ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void check_require ( DYNAMIC_STRING * ds , const char * fname ) {
DBUG_ENTER ( "check_require" ) ;
if ( dyn_string_cmp ( ds , fname ) ) {
char reason [ FN_REFLEN ] ;
fn_format ( reason , fname , "" , "" , MY_REPLACE_EXT | MY_REPLACE_DIR ) ;
abort_not_supported_test ( "Test requires: '%s'" , reason ) ;
}
DBUG_VOID_RETURN ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static uint32_t virtio_pci_config_readw ( void * opaque , uint32_t addr ) {
VirtIOPCIProxy * proxy = opaque ;
uint32_t config = VIRTIO_PCI_CONFIG ( & proxy -> pci_dev ) ;
addr -= proxy -> addr ;
if ( addr < config ) return virtio_ioport_read ( proxy , addr ) ;
addr -= config ;
return virtio_config_readw ( proxy -> vdev , addr ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | proto_tree * proto_tree_add_subtree ( proto_tree * tree , tvbuff_t * tvb , gint start , gint length , gint idx , proto_item * * tree_item , const char * text ) {
return proto_tree_add_subtree_format ( tree , tvb , start , length , idx , tree_item , "%s" , text ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void e1000e_calc_per_desc_buf_size ( E1000ECore * core ) {
int i ;
core -> rx_desc_buf_size = 0 ;
for ( i = 0 ;
i < ARRAY_SIZE ( core -> rxbuf_sizes ) ;
i ++ ) {
core -> rx_desc_buf_size += core -> rxbuf_sizes [ i ] ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void rawv6_close ( struct sock * sk , long timeout ) {
if ( inet_sk ( sk ) -> inet_num == IPPROTO_RAW ) ip6_ra_control ( sk , - 1 ) ;
ip6mr_sk_done ( sk ) ;
sk_common_release ( sk ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | xmlHashTablePtr xmlHashCreate ( int size ) {
xmlHashTablePtr table ;
if ( size <= 0 ) size = 256 ;
table = xmlMalloc ( sizeof ( xmlHashTable ) ) ;
if ( table ) {
table -> dict = NULL ;
table -> size = size ;
table -> nbElems = 0 ;
table -> table = xmlMalloc ( size * sizeof ( xmlHashEntry ) ) ;
if ( table -> table ) {
memset ( table -> table , 0 , size * sizeof ( xmlHashEntry ) ) ;
return ( table ) ;
}
xmlFree ( table ) ;
}
return ( NULL ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static bool cgfs_unfreeze ( void * hdata ) {
struct cgfs_data * d = hdata ;
char * cgabspath , * cgrelpath ;
int ret ;
if ( ! d ) return false ;
cgrelpath = lxc_cgroup_get_hierarchy_path_data ( "freezer" , d ) ;
cgabspath = lxc_cgroup_find_abs_path ( "freezer" , cgrelpath , true , NULL ) ;
if ( ! cgabspath ) return false ;
ret = do_cgroup_set ( cgabspath , "freezer.state" , "THAWED" ) ;
free ( cgabspath ) ;
return ret == 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_MultiplexedStreamCapability ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_MultiplexedStreamCapability , MultiplexedStreamCapability_sequence ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void pdf_set_usecmap ( fz_context * ctx , pdf_cmap * cmap , pdf_cmap * usecmap ) {
int i ;
pdf_drop_cmap ( ctx , cmap -> usecmap ) ;
cmap -> usecmap = pdf_keep_cmap ( ctx , usecmap ) ;
if ( cmap -> codespace_len == 0 ) {
cmap -> codespace_len = usecmap -> codespace_len ;
for ( i = 0 ;
i < usecmap -> codespace_len ;
i ++ ) cmap -> codespace [ i ] = usecmap -> codespace [ i ] ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void CloseArchive ( Archive * AHX ) {
int res = 0 ;
ArchiveHandle * AH = ( ArchiveHandle * ) AHX ;
( * AH -> ClosePtr ) ( AH ) ;
if ( AH -> gzOut ) res = GZCLOSE ( AH -> OF ) ;
else if ( AH -> OF != stdout ) res = fclose ( AH -> OF ) ;
if ( res != 0 ) exit_horribly ( modulename , "could not close output file: %s\n" , strerror ( errno ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | ASN1_TYPE * ossl_asn1_get_asn1type ( VALUE obj ) {
ASN1_TYPE * ret ;
VALUE value , rflag ;
void * ptr ;
void ( * free_func ) ( ) ;
int tag , flag ;
tag = ossl_asn1_default_tag ( obj ) ;
value = ossl_asn1_get_value ( obj ) ;
switch ( tag ) {
case V_ASN1_BOOLEAN : ptr = ( void * ) ( VALUE ) obj_to_asn1bool ( value ) ;
free_func = NULL ;
break ;
case V_ASN1_INTEGER : case V_ASN1_ENUMERATED : ptr = obj_to_asn1int ( value ) ;
free_func = ASN1_INTEGER_free ;
break ;
case V_ASN1_BIT_STRING : rflag = rb_attr_get ( obj , sivUNUSED_BITS ) ;
flag = NIL_P ( rflag ) ? - 1 : NUM2INT ( rflag ) ;
ptr = obj_to_asn1bstr ( value , flag ) ;
free_func = ASN1_BIT_STRING_free ;
break ;
case V_ASN1_NULL : ptr = obj_to_asn1null ( value ) ;
free_func = ASN1_NULL_free ;
break ;
case V_ASN1_OCTET_STRING : case V_ASN1_UTF8STRING : case V_ASN1_NUMERICSTRING : case V_ASN1_PRINTABLESTRING : case V_ASN1_T61STRING : case V_ASN1_VIDEOTEXSTRING : case V_ASN1_IA5STRING : case V_ASN1_GRAPHICSTRING : case V_ASN1_ISO64STRING : case V_ASN1_GENERALSTRING : case V_ASN1_UNIVERSALSTRING : case V_ASN1_BMPSTRING : ptr = obj_to_asn1str ( value ) ;
free_func = ASN1_STRING_free ;
break ;
case V_ASN1_OBJECT : ptr = obj_to_asn1obj ( value ) ;
free_func = ASN1_OBJECT_free ;
break ;
case V_ASN1_UTCTIME : ptr = obj_to_asn1utime ( value ) ;
free_func = ASN1_TIME_free ;
break ;
case V_ASN1_GENERALIZEDTIME : ptr = obj_to_asn1gtime ( value ) ;
free_func = ASN1_TIME_free ;
break ;
case V_ASN1_SET : case V_ASN1_SEQUENCE : ptr = obj_to_asn1derstr ( obj ) ;
free_func = ASN1_STRING_free ;
break ;
default : ossl_raise ( eASN1Error , "unsupported ASN.1 type" ) ;
}
if ( ! ( ret = OPENSSL_malloc ( sizeof ( ASN1_TYPE ) ) ) ) {
if ( free_func ) free_func ( ptr ) ;
ossl_raise ( eASN1Error , "ASN1_TYPE alloc failure" ) ;
}
memset ( ret , 0 , sizeof ( ASN1_TYPE ) ) ;
ASN1_TYPE_set ( ret , tag , ptr ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static size_t try_block ( const char * d , size_t dlen , const char * fromcode , const char * tocode , encoder_t * encoder , size_t * wlen ) {
char buf [ ENCWORD_LEN_MAX - ENCWORD_LEN_MIN + 1 ] ;
const char * ib = NULL ;
char * ob = NULL ;
size_t ibl , obl ;
int count , len , len_b , len_q ;
if ( fromcode ) {
iconv_t cd = mutt_ch_iconv_open ( tocode , fromcode , 0 ) ;
assert ( cd != ( iconv_t ) ( - 1 ) ) ;
ib = d ;
ibl = dlen ;
ob = buf ;
obl = sizeof ( buf ) - strlen ( tocode ) ;
if ( iconv ( cd , ( ICONV_CONST char * * ) & ib , & ibl , & ob , & obl ) == ( size_t ) ( - 1 ) || iconv ( cd , NULL , NULL , & ob , & obl ) == ( size_t ) ( - 1 ) ) {
assert ( errno == E2BIG ) ;
iconv_close ( cd ) ;
assert ( ib > d ) ;
return ( ib - d == dlen ) ? dlen : ib - d + 1 ;
}
iconv_close ( cd ) ;
}
else {
if ( dlen > ( sizeof ( buf ) - strlen ( tocode ) ) ) return ( sizeof ( buf ) - strlen ( tocode ) + 1 ) ;
memcpy ( buf , d , dlen ) ;
ob = buf + dlen ;
}
count = 0 ;
for ( char * p = buf ;
p < ob ;
p ++ ) {
unsigned char c = * p ;
assert ( strchr ( MimeSpecials , '?' ) ) ;
if ( ( c >= 0x7f ) || ( c < 0x20 ) || ( * p == '_' ) || ( ( c != ' ' ) && strchr ( MimeSpecials , * p ) ) ) {
count ++ ;
}
}
len = ENCWORD_LEN_MIN - 2 + strlen ( tocode ) ;
len_b = len + ( ( ( ob - buf ) + 2 ) / 3 ) * 4 ;
len_q = len + ( ob - buf ) + 2 * count ;
if ( mutt_str_strcasecmp ( tocode , "ISO-2022-JP" ) == 0 ) len_q = ENCWORD_LEN_MAX + 1 ;
if ( ( len_b < len_q ) && ( len_b <= ENCWORD_LEN_MAX ) ) {
* encoder = b_encoder ;
* wlen = len_b ;
return 0 ;
}
else if ( len_q <= ENCWORD_LEN_MAX ) {
* encoder = q_encoder ;
* wlen = len_q ;
return 0 ;
}
else return dlen ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void reverse_dc_prediction ( Vp3DecodeContext * s , int first_fragment , int fragment_width , int fragment_height ) {
# define PUL 8 # define PU 4 # define PUR 2 # define PL 1 int x , y ;
int i = first_fragment ;
int predicted_dc ;
int vl , vul , vu , vur ;
int l , ul , u , ur ;
static const int predictor_transform [ 16 ] [ 4 ] = {
{
0 , 0 , 0 , 0 }
, {
0 , 0 , 0 , 128 }
, {
0 , 0 , 128 , 0 }
, {
0 , 0 , 53 , 75 }
, {
0 , 128 , 0 , 0 }
, {
0 , 64 , 0 , 64 }
, {
0 , 128 , 0 , 0 }
, {
0 , 0 , 53 , 75 }
, {
128 , 0 , 0 , 0 }
, {
0 , 0 , 0 , 128 }
, {
64 , 0 , 64 , 0 }
, {
0 , 0 , 53 , 75 }
, {
0 , 128 , 0 , 0 }
, {
- 104 , 116 , 0 , 116 }
, {
24 , 80 , 24 , 0 }
, {
- 104 , 116 , 0 , 116 }
}
;
static const unsigned char compatible_frame [ 9 ] = {
1 , 0 , 1 , 1 , 1 , 2 , 2 , 1 , 3 }
;
int current_frame_type ;
short last_dc [ 3 ] ;
int transform = 0 ;
vul = vu = vur = vl = 0 ;
last_dc [ 0 ] = last_dc [ 1 ] = last_dc [ 2 ] = 0 ;
for ( y = 0 ;
y < fragment_height ;
y ++ ) {
for ( x = 0 ;
x < fragment_width ;
x ++ , i ++ ) {
if ( s -> all_fragments [ i ] . coding_method != MODE_COPY ) {
current_frame_type = compatible_frame [ s -> all_fragments [ i ] . coding_method ] ;
transform = 0 ;
if ( x ) {
l = i - 1 ;
vl = DC_COEFF ( l ) ;
if ( COMPATIBLE_FRAME ( l ) ) transform |= PL ;
}
if ( y ) {
u = i - fragment_width ;
vu = DC_COEFF ( u ) ;
if ( COMPATIBLE_FRAME ( u ) ) transform |= PU ;
if ( x ) {
ul = i - fragment_width - 1 ;
vul = DC_COEFF ( ul ) ;
if ( COMPATIBLE_FRAME ( ul ) ) transform |= PUL ;
}
if ( x + 1 < fragment_width ) {
ur = i - fragment_width + 1 ;
vur = DC_COEFF ( ur ) ;
if ( COMPATIBLE_FRAME ( ur ) ) transform |= PUR ;
}
}
if ( transform == 0 ) {
predicted_dc = last_dc [ current_frame_type ] ;
}
else {
predicted_dc = ( predictor_transform [ transform ] [ 0 ] * vul ) + ( predictor_transform [ transform ] [ 1 ] * vu ) + ( predictor_transform [ transform ] [ 2 ] * vur ) + ( predictor_transform [ transform ] [ 3 ] * vl ) ;
predicted_dc /= 128 ;
if ( ( transform == 15 ) || ( transform == 13 ) ) {
if ( FFABS ( predicted_dc - vu ) > 128 ) predicted_dc = vu ;
else if ( FFABS ( predicted_dc - vl ) > 128 ) predicted_dc = vl ;
else if ( FFABS ( predicted_dc - vul ) > 128 ) predicted_dc = vul ;
}
}
DC_COEFF ( i ) += predicted_dc ;
last_dc [ current_frame_type ] = DC_COEFF ( i ) ;
}
}
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void purple_logout ( struct im_connection * ic ) {
struct purple_data * pd = ic -> proto_data ;
if ( ! pd ) {
return ;
}
while ( ic -> groupchats ) {
imcb_chat_free ( ic -> groupchats -> data ) ;
}
if ( pd -> filetransfers ) {
purple_transfer_cancel_all ( ic ) ;
}
purple_account_set_enabled ( pd -> account , "BitlBee" , FALSE ) ;
purple_connections = g_slist_remove ( purple_connections , ic ) ;
purple_accounts_remove ( pd -> account ) ;
imcb_chat_list_free ( ic ) ;
g_free ( pd -> chat_list_server ) ;
g_hash_table_destroy ( pd -> input_requests ) ;
g_free ( pd ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int8_t getWindow ( const uint32_t offsets [ 8 ] , uint32_t c ) {
int i ;
for ( i = 0 ;
i < 8 ;
++ i ) {
if ( ( uint32_t ) ( c - offsets [ i ] ) <= 0x7f ) {
return ( int8_t ) ( i ) ;
}
}
return - 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int PEM_write_ ## name ( FILE * fp , const type * x ) ;
# define DECLARE_PEM_write_cb_fp ( name , type ) int PEM_write_ ## name ( FILE * fp , type * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
# endif # define DECLARE_PEM_read_bio ( name , type ) type * PEM_read_bio_ ## name ( BIO * bp , type * * x , pem_password_cb * cb , void * u ) ;
# define DECLARE_PEM_write_bio ( name , type ) int PEM_write_bio_ ## name ( BIO * bp , type * x ) ;
# define DECLARE_PEM_write_bio_const ( name , type ) int PEM_write_bio_ ## name ( BIO * bp , const type * x ) ;
# define DECLARE_PEM_write_cb_bio ( name , type ) int PEM_write_bio_ ## name ( BIO * bp , type * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
# define DECLARE_PEM_write ( name , type ) DECLARE_PEM_write_bio ( name , type ) DECLARE_PEM_write_fp ( name , type ) # define DECLARE_PEM_write_const ( name , type ) DECLARE_PEM_write_bio_const ( name , type ) DECLARE_PEM_write_fp_const ( name , type ) # define DECLARE_PEM_write_cb ( name , type ) DECLARE_PEM_write_cb_bio ( name , type ) DECLARE_PEM_write_cb_fp ( name , type ) # define DECLARE_PEM_read ( name , type ) DECLARE_PEM_read_bio ( name , type ) DECLARE_PEM_read_fp ( name , type ) # define DECLARE_PEM_rw ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write ( name , type ) # define DECLARE_PEM_rw_const ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write_const ( name , type ) # define DECLARE_PEM_rw_cb ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write_cb ( name , type ) typedef int pem_password_cb ( char * buf , int size , int rwflag , void * userdata ) ;
int PEM_get_EVP_CIPHER_INFO ( char * header , EVP_CIPHER_INFO * cipher ) ;
int PEM_do_header ( EVP_CIPHER_INFO * cipher , unsigned char * data , long * len , pem_password_cb * callback , void * u ) ;
int PEM_read_bio ( BIO * bp , char * * name , char * * header , unsigned char * * data , long * len ) ;
# define PEM_FLAG_SECURE 0x1 # define PEM_FLAG_EAY_COMPATIBLE 0x2 # define PEM_FLAG_ONLY_B64 0x4 int PEM_read_bio_ex ( BIO * bp , char * * name , char * * header , unsigned char * * data , long * len , unsigned int flags ) ;
int PEM_bytes_read_bio_secmem ( unsigned char * * pdata , long * plen , char * * pnm , const char * name , BIO * bp , pem_password_cb * cb , void * u ) ;
int PEM_write_bio ( BIO * bp , const char * name , const char * hdr , const unsigned char * data , long len ) ;
int PEM_bytes_read_bio ( unsigned char * * pdata , long * plen , char * * pnm , const char * name , BIO * bp , pem_password_cb * cb , void * u ) ;
void * PEM_ASN1_read_bio ( d2i_of_void * d2i , const char * name , BIO * bp , void * * x , pem_password_cb * cb , void * u ) ;
int PEM_ASN1_write_bio ( i2d_of_void * i2d , const char * name , BIO * bp , void * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
STACK_OF ( X509_INFO ) * PEM_X509_INFO_read_bio ( BIO * bp , STACK_OF ( X509_INFO ) * sk , pem_password_cb * cb , void * u ) ;
int PEM_X509_INFO_write_bio ( BIO * bp , X509_INFO * xi , EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cd , void * u ) ;
# ifndef OPENSSL_NO_STDIO int PEM_read ( FILE * fp , char * * name , char * * header , unsigned char * * data , long * len ) ;
int PEM_write ( FILE * fp , const char * name , const char * hdr , const unsigned char * data , long len ) ;
void * PEM_ASN1_read ( d2i_of_void * d2i , const char * name , FILE * fp , void * * x , pem_password_cb * cb , void * u ) ;
int PEM_ASN1_write ( i2d_of_void * i2d , const char * name , FILE * fp , void * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * callback , void * u ) ;
STACK_OF ( X509_INFO ) * PEM_X509_INFO_read ( FILE * fp , STACK_OF ( X509_INFO ) * sk , pem_password_cb * cb , void * u ) ;
# endif int PEM_SignInit ( EVP_MD_CTX * ctx , EVP_MD * type ) ;
int PEM_SignUpdate ( EVP_MD_CTX * ctx , unsigned char * d , unsigned int cnt ) ;
int PEM_SignFinal ( EVP_MD_CTX * ctx , unsigned char * sigret , unsigned int * siglen , EVP_PKEY * pkey ) ;
int PEM_def_callback ( char * buf , int num , int rwflag , void * userdata ) ;
void PEM_proc_type ( char * buf , int type ) ;
void PEM_dek_info ( char * buf , const char * type , int len , char * str ) ;
# include < openssl / symhacks . h > DECLARE_PEM_rw ( X509 , X509 ) DECLARE_PEM_rw ( X509_AUX , X509 ) DECLARE_PEM_rw ( X509_REQ , X509_REQ ) DECLARE_PEM_write ( X509_REQ_NEW , X509_REQ ) DECLARE_PEM_rw ( X509_CRL , X509_CRL ) DECLARE_PEM_rw ( PKCS7 , PKCS7 ) DECLARE_PEM_rw ( NETSCAPE_CERT_SEQUENCE , NETSCAPE_CERT_SEQUENCE ) DECLARE_PEM_rw ( PKCS8 , X509_SIG ) DECLARE_PEM_rw ( PKCS8_PRIV_KEY_INFO , PKCS8_PRIV_KEY_INFO ) # ifndef OPENSSL_NO_RSA DECLARE_PEM_rw_cb ( RSAPrivateKey , RSA ) DECLARE_PEM_rw_const ( RSAPublicKey , RSA ) DECLARE_PEM_rw ( RSA_PUBKEY , RSA ) # endif # ifndef OPENSSL_NO_DSA DECLARE_PEM_rw_cb ( DSAPrivateKey , DSA ) DECLARE_PEM_rw ( DSA_PUBKEY , DSA ) DECLARE_PEM_rw_const ( DSAparams , DSA ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( WebUsbDetectorTest , NotificationClickedWhileInactiveTabUrlIsLandingPage ) {
GURL landing_page_1 ( kLandingPage_1 ) ;
GURL landing_page_2 ( kLandingPage_2 ) ;
scoped_refptr < device : : MockUsbDevice > device_1 ( new device : : MockUsbDevice ( 0 , 1 , "Google" , kProductName_1 , "002" , landing_page_1 ) ) ;
std : : string guid_1 = device_1 -> guid ( ) ;
TabStripModel * tab_strip_model = browser ( ) -> tab_strip_model ( ) ;
base : : HistogramTester histogram_tester ;
Initialize ( ) ;
AddTab ( browser ( ) , landing_page_1 ) ;
AddTab ( browser ( ) , landing_page_2 ) ;
device_client_ . usb_service ( ) -> AddDevice ( device_1 ) ;
message_center : : Notification * notification_1 = message_center_ -> FindVisibleNotificationById ( guid_1 ) ;
ASSERT_TRUE ( notification_1 != nullptr ) ;
EXPECT_EQ ( 2 , tab_strip_model -> count ( ) ) ;
notification_1 -> Click ( ) ;
EXPECT_EQ ( 2 , tab_strip_model -> count ( ) ) ;
content : : WebContents * web_contents = tab_strip_model -> GetWebContentsAt ( tab_strip_model -> active_index ( ) ) ;
EXPECT_EQ ( landing_page_1 , web_contents -> GetURL ( ) ) ;
ASSERT_TRUE ( message_center_ -> FindVisibleNotificationById ( guid_1 ) == nullptr ) ;
histogram_tester . ExpectUniqueSample ( "WebUsb.NotificationClosed" , 2 , 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | AsfStream * gst_asf_demux_get_stream ( GstASFDemux * demux , guint16 id ) {
guint i ;
for ( i = 0 ;
i < demux -> num_streams ;
i ++ ) {
if ( demux -> stream [ i ] . id == id ) return & demux -> stream [ i ] ;
}
if ( gst_asf_demux_is_unknown_stream ( demux , id ) ) GST_WARNING ( "Segment found for undefined stream: (%d)" , id ) ;
return NULL ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | gboolean nautilus_mime_file_launches ( NautilusFile * file ) {
ActivationAction activation_action ;
activation_action = get_activation_action ( file ) ;
return ( activation_action == ACTIVATION_ACTION_LAUNCH ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void release_tree_content ( struct tree_content * t ) {
struct avail_tree_content * f = ( struct avail_tree_content * ) t ;
unsigned int hc = hc_entries ( f -> entry_capacity ) ;
f -> next_avail = avail_tree_table [ hc ] ;
avail_tree_table [ hc ] = f ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static VALUE ossl_s_ciphers ( VALUE self ) {
VALUE ary ;
ary = rb_ary_new ( ) ;
OBJ_NAME_do_all_sorted ( OBJ_NAME_TYPE_CIPHER_METH , ( void ( * ) ( const OBJ_NAME * , void * ) ) add_cipher_name_to_ary , ( void * ) ary ) ;
return ary ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void s390_virtio_bus_register_withprop ( VirtIOS390DeviceInfo * info ) {
info -> qdev . init = s390_virtio_busdev_init ;
info -> qdev . bus_info = & s390_virtio_bus_info ;
assert ( info -> qdev . size >= sizeof ( VirtIOS390Device ) ) ;
qdev_register ( & info -> qdev ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void kadmin_modpol ( int argc , char * argv [ ] ) {
krb5_error_code retval ;
long mask ;
kadm5_policy_ent_rec policy ;
memset ( & policy , 0 , sizeof ( policy ) ) ;
if ( kadmin_parse_policy_args ( argc , argv , & policy , & mask , "modify_policy" ) ) {
kadmin_addmodpol_usage ( "modify_policy" ) ;
return ;
}
policy . policy = argv [ argc - 1 ] ;
retval = kadm5_modify_policy ( handle , & policy , mask ) ;
if ( retval ) {
com_err ( "modify_policy" , retval , _ ( "while modifying policy \"%s\"." ) , policy . policy ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int qcow2_open ( BlockDriverState * bs , QDict * options , int flags , Error * * errp ) {
BDRVQcowState * s = bs -> opaque ;
unsigned int len , i ;
int ret = 0 ;
QCowHeader header ;
QemuOpts * opts ;
Error * local_err = NULL ;
uint64_t ext_end ;
uint64_t l1_vm_state_index ;
const char * opt_overlap_check ;
int overlap_check_template = 0 ;
ret = bdrv_pread ( bs -> file , 0 , & header , sizeof ( header ) ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret , "Could not read qcow2 header" ) ;
goto fail ;
}
be32_to_cpus ( & header . magic ) ;
be32_to_cpus ( & header . version ) ;
be64_to_cpus ( & header . backing_file_offset ) ;
be32_to_cpus ( & header . backing_file_size ) ;
be64_to_cpus ( & header . size ) ;
be32_to_cpus ( & header . cluster_bits ) ;
be32_to_cpus ( & header . crypt_method ) ;
be64_to_cpus ( & header . l1_table_offset ) ;
be32_to_cpus ( & header . l1_size ) ;
be64_to_cpus ( & header . refcount_table_offset ) ;
be32_to_cpus ( & header . refcount_table_clusters ) ;
be64_to_cpus ( & header . snapshots_offset ) ;
be32_to_cpus ( & header . nb_snapshots ) ;
if ( header . magic != QCOW_MAGIC ) {
error_setg ( errp , "Image is not in qcow2 format" ) ;
ret = - EINVAL ;
goto fail ;
}
if ( header . version < 2 || header . version > 3 ) {
report_unsupported ( bs , errp , "QCOW version %d" , header . version ) ;
ret = - ENOTSUP ;
goto fail ;
}
s -> qcow_version = header . version ;
if ( header . cluster_bits < MIN_CLUSTER_BITS || header . cluster_bits > MAX_CLUSTER_BITS ) {
error_setg ( errp , "Unsupported cluster size: 2^%i" , header . cluster_bits ) ;
ret = - EINVAL ;
goto fail ;
}
s -> cluster_bits = header . cluster_bits ;
s -> cluster_size = 1 << s -> cluster_bits ;
s -> cluster_sectors = 1 << ( s -> cluster_bits - 9 ) ;
if ( header . version == 2 ) {
header . incompatible_features = 0 ;
header . compatible_features = 0 ;
header . autoclear_features = 0 ;
header . refcount_order = 4 ;
header . header_length = 72 ;
}
else {
be64_to_cpus ( & header . incompatible_features ) ;
be64_to_cpus ( & header . compatible_features ) ;
be64_to_cpus ( & header . autoclear_features ) ;
be32_to_cpus ( & header . refcount_order ) ;
be32_to_cpus ( & header . header_length ) ;
if ( header . header_length < 104 ) {
error_setg ( errp , "qcow2 header too short" ) ;
ret = - EINVAL ;
goto fail ;
}
}
if ( header . header_length > s -> cluster_size ) {
error_setg ( errp , "qcow2 header exceeds cluster size" ) ;
ret = - EINVAL ;
goto fail ;
}
if ( header . header_length > sizeof ( header ) ) {
s -> unknown_header_fields_size = header . header_length - sizeof ( header ) ;
s -> unknown_header_fields = g_malloc ( s -> unknown_header_fields_size ) ;
ret = bdrv_pread ( bs -> file , sizeof ( header ) , s -> unknown_header_fields , s -> unknown_header_fields_size ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret , "Could not read unknown qcow2 header " "fields" ) ;
goto fail ;
}
}
if ( header . backing_file_offset > s -> cluster_size ) {
error_setg ( errp , "Invalid backing file offset" ) ;
ret = - EINVAL ;
goto fail ;
}
if ( header . backing_file_offset ) {
ext_end = header . backing_file_offset ;
}
else {
ext_end = 1 << header . cluster_bits ;
}
s -> incompatible_features = header . incompatible_features ;
s -> compatible_features = header . compatible_features ;
s -> autoclear_features = header . autoclear_features ;
if ( s -> incompatible_features & ~ QCOW2_INCOMPAT_MASK ) {
void * feature_table = NULL ;
qcow2_read_extensions ( bs , header . header_length , ext_end , & feature_table , NULL ) ;
report_unsupported_feature ( bs , errp , feature_table , s -> incompatible_features & ~ QCOW2_INCOMPAT_MASK ) ;
ret = - ENOTSUP ;
g_free ( feature_table ) ;
goto fail ;
}
if ( s -> incompatible_features & QCOW2_INCOMPAT_CORRUPT ) {
if ( ( flags & BDRV_O_RDWR ) && ! ( flags & BDRV_O_CHECK ) ) {
error_setg ( errp , "qcow2: Image is corrupt;
cannot be opened " "read/write" ) ;
ret = - EACCES ;
goto fail ;
}
}
if ( header . refcount_order != 4 ) {
report_unsupported ( bs , errp , "%d bit reference counts" , 1 << header . refcount_order ) ;
ret = - ENOTSUP ;
goto fail ;
}
s -> refcount_order = header . refcount_order ;
if ( header . crypt_method > QCOW_CRYPT_AES ) {
error_setg ( errp , "Unsupported encryption method: %i" , header . crypt_method ) ;
ret = - EINVAL ;
goto fail ;
}
s -> crypt_method_header = header . crypt_method ;
if ( s -> crypt_method_header ) {
bs -> encrypted = 1 ;
}
s -> l2_bits = s -> cluster_bits - 3 ;
s -> l2_size = 1 << s -> l2_bits ;
bs -> total_sectors = header . size / 512 ;
s -> csize_shift = ( 62 - ( s -> cluster_bits - 8 ) ) ;
s -> csize_mask = ( 1 << ( s -> cluster_bits - 8 ) ) - 1 ;
s -> cluster_offset_mask = ( 1LL << s -> csize_shift ) - 1 ;
s -> refcount_table_offset = header . refcount_table_offset ;
s -> refcount_table_size = header . refcount_table_clusters << ( s -> cluster_bits - 3 ) ;
if ( header . refcount_table_clusters > qcow2_max_refcount_clusters ( s ) ) {
error_setg ( errp , "Reference count table too large" ) ;
ret = - EINVAL ;
goto fail ;
}
ret = validate_table_offset ( bs , s -> refcount_table_offset , s -> refcount_table_size , sizeof ( uint64_t ) ) ;
if ( ret < 0 ) {
error_setg ( errp , "Invalid reference count table offset" ) ;
goto fail ;
}
if ( header . nb_snapshots > QCOW_MAX_SNAPSHOTS ) {
error_setg ( errp , "Too many snapshots" ) ;
ret = - EINVAL ;
goto fail ;
}
ret = validate_table_offset ( bs , header . snapshots_offset , header . nb_snapshots , sizeof ( QCowSnapshotHeader ) ) ;
if ( ret < 0 ) {
error_setg ( errp , "Invalid snapshot table offset" ) ;
goto fail ;
}
if ( header . l1_size > 0x2000000 ) {
error_setg ( errp , "Active L1 table too large" ) ;
ret = - EFBIG ;
goto fail ;
}
s -> l1_size = header . l1_size ;
l1_vm_state_index = size_to_l1 ( s , header . size ) ;
if ( l1_vm_state_index > INT_MAX ) {
error_setg ( errp , "Image is too big" ) ;
ret = - EFBIG ;
goto fail ;
}
s -> l1_vm_state_index = l1_vm_state_index ;
if ( s -> l1_size < s -> l1_vm_state_index ) {
error_setg ( errp , "L1 table is too small" ) ;
ret = - EINVAL ;
goto fail ;
}
ret = validate_table_offset ( bs , header . l1_table_offset , header . l1_size , sizeof ( uint64_t ) ) ;
if ( ret < 0 ) {
error_setg ( errp , "Invalid L1 table offset" ) ;
goto fail ;
}
s -> l1_table_offset = header . l1_table_offset ;
if ( s -> l1_size > 0 ) {
s -> l1_table = g_malloc0 ( align_offset ( s -> l1_size * sizeof ( uint64_t ) , 512 ) ) ;
ret = bdrv_pread ( bs -> file , s -> l1_table_offset , s -> l1_table , s -> l1_size * sizeof ( uint64_t ) ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret , "Could not read L1 table" ) ;
goto fail ;
}
for ( i = 0 ;
i < s -> l1_size ;
i ++ ) {
be64_to_cpus ( & s -> l1_table [ i ] ) ;
}
}
s -> l2_table_cache = qcow2_cache_create ( bs , L2_CACHE_SIZE ) ;
s -> refcount_block_cache = qcow2_cache_create ( bs , REFCOUNT_CACHE_SIZE ) ;
s -> cluster_cache = g_malloc ( s -> cluster_size ) ;
s -> cluster_data = qemu_blockalign ( bs , QCOW_MAX_CRYPT_CLUSTERS * s -> cluster_size + 512 ) ;
s -> cluster_cache_offset = - 1 ;
s -> flags = flags ;
ret = qcow2_refcount_init ( bs ) ;
if ( ret != 0 ) {
error_setg_errno ( errp , - ret , "Could not initialize refcount handling" ) ;
goto fail ;
}
QLIST_INIT ( & s -> cluster_allocs ) ;
QTAILQ_INIT ( & s -> discards ) ;
if ( qcow2_read_extensions ( bs , header . header_length , ext_end , NULL , & local_err ) ) {
error_propagate ( errp , local_err ) ;
ret = - EINVAL ;
goto fail ;
}
if ( header . backing_file_offset != 0 ) {
len = header . backing_file_size ;
if ( len > MIN ( 1023 , s -> cluster_size - header . backing_file_offset ) ) {
error_setg ( errp , "Backing file name too long" ) ;
ret = - EINVAL ;
goto fail ;
}
ret = bdrv_pread ( bs -> file , header . backing_file_offset , bs -> backing_file , len ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret , "Could not read backing file name" ) ;
goto fail ;
}
bs -> backing_file [ len ] = '\0' ;
}
s -> snapshots_offset = header . snapshots_offset ;
s -> nb_snapshots = header . nb_snapshots ;
ret = qcow2_read_snapshots ( bs ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret , "Could not read snapshots" ) ;
goto fail ;
}
if ( ! bs -> read_only && ! ( flags & BDRV_O_INCOMING ) && s -> autoclear_features ) {
s -> autoclear_features = 0 ;
ret = qcow2_update_header ( bs ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret , "Could not update qcow2 header" ) ;
goto fail ;
}
}
qemu_co_mutex_init ( & s -> lock ) ;
if ( ! ( flags & ( BDRV_O_CHECK | BDRV_O_INCOMING ) ) && ! bs -> read_only && ( s -> incompatible_features & QCOW2_INCOMPAT_DIRTY ) ) {
BdrvCheckResult result = {
0 }
;
ret = qcow2_check ( bs , & result , BDRV_FIX_ERRORS ) ;
if ( ret < 0 ) {
error_setg_errno ( errp , - ret , "Could not repair dirty image" ) ;
goto fail ;
}
}
opts = qemu_opts_create ( & qcow2_runtime_opts , NULL , 0 , & error_abort ) ;
qemu_opts_absorb_qdict ( opts , options , & local_err ) ;
if ( local_err ) {
error_propagate ( errp , local_err ) ;
ret = - EINVAL ;
goto fail ;
}
s -> use_lazy_refcounts = qemu_opt_get_bool ( opts , QCOW2_OPT_LAZY_REFCOUNTS , ( s -> compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS ) ) ;
s -> discard_passthrough [ QCOW2_DISCARD_NEVER ] = false ;
s -> discard_passthrough [ QCOW2_DISCARD_ALWAYS ] = true ;
s -> discard_passthrough [ QCOW2_DISCARD_REQUEST ] = qemu_opt_get_bool ( opts , QCOW2_OPT_DISCARD_REQUEST , flags & BDRV_O_UNMAP ) ;
s -> discard_passthrough [ QCOW2_DISCARD_SNAPSHOT ] = qemu_opt_get_bool ( opts , QCOW2_OPT_DISCARD_SNAPSHOT , true ) ;
s -> discard_passthrough [ QCOW2_DISCARD_OTHER ] = qemu_opt_get_bool ( opts , QCOW2_OPT_DISCARD_OTHER , false ) ;
opt_overlap_check = qemu_opt_get ( opts , "overlap-check" ) ? : "cached" ;
if ( ! strcmp ( opt_overlap_check , "none" ) ) {
overlap_check_template = 0 ;
}
else if ( ! strcmp ( opt_overlap_check , "constant" ) ) {
overlap_check_template = QCOW2_OL_CONSTANT ;
}
else if ( ! strcmp ( opt_overlap_check , "cached" ) ) {
overlap_check_template = QCOW2_OL_CACHED ;
}
else if ( ! strcmp ( opt_overlap_check , "all" ) ) {
overlap_check_template = QCOW2_OL_ALL ;
}
else {
error_setg ( errp , "Unsupported value '%s' for qcow2 option " "'overlap-check'. Allowed are either of the following: " "none, constant, cached, all" , opt_overlap_check ) ;
qemu_opts_del ( opts ) ;
ret = - EINVAL ;
goto fail ;
}
s -> overlap_check = 0 ;
for ( i = 0 ;
i < QCOW2_OL_MAX_BITNR ;
i ++ ) {
s -> overlap_check |= qemu_opt_get_bool ( opts , overlap_bool_option_names [ i ] , overlap_check_template & ( 1 << i ) ) << i ;
}
qemu_opts_del ( opts ) ;
if ( s -> use_lazy_refcounts && s -> qcow_version < 3 ) {
error_setg ( errp , "Lazy refcounts require a qcow2 image with at least " "qemu 1.1 compatibility level" ) ;
ret = - EINVAL ;
goto fail ;
}
# ifdef DEBUG_ALLOC {
BdrvCheckResult result = {
0 }
;
qcow2_check_refcounts ( bs , & result , 0 ) ;
}
# endif return ret ;
fail : g_free ( s -> unknown_header_fields ) ;
cleanup_unknown_header_ext ( bs ) ;
qcow2_free_snapshots ( bs ) ;
qcow2_refcount_close ( bs ) ;
g_free ( s -> l1_table ) ;
s -> l1_table = NULL ;
if ( s -> l2_table_cache ) {
qcow2_cache_destroy ( bs , s -> l2_table_cache ) ;
}
if ( s -> refcount_block_cache ) {
qcow2_cache_destroy ( bs , s -> refcount_block_cache ) ;
}
g_free ( s -> cluster_cache ) ;
qemu_vfree ( s -> cluster_data ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void spl_filesystem_dir_it_current_data ( zend_object_iterator * iter , zval * * * data TSRMLS_DC ) {
spl_filesystem_iterator * iterator = ( spl_filesystem_iterator * ) iter ;
* data = & iterator -> current ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TSReturnCode TSHttpTxnClientPacketDscpSet ( TSHttpTxn txnp , int dscp ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
HttpSM * sm = ( HttpSM * ) txnp ;
if ( nullptr == sm -> ua_session ) {
return TS_ERROR ;
}
NetVConnection * vc = sm -> ua_session -> get_netvc ( ) ;
if ( nullptr == vc ) {
return TS_ERROR ;
}
vc -> options . packet_tos = ( uint32_t ) dscp << 2 ;
vc -> apply_options ( ) ;
return TS_SUCCESS ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void mgcpDialedDigits ( gchar * signalStr , gchar * * dialedDigits ) {
gchar * tmpStr ;
gchar * resultStr ;
gint i , j ;
guint resultStrLen = 1 ;
if ( signalStr == NULL ) return ;
tmpStr = g_strdup ( signalStr ) ;
for ( i = 0 ;
tmpStr [ i ] ;
i ++ ) {
switch ( tmpStr [ i ] ) {
case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' : case '#' : case '*' : resultStrLen ++ ;
break ;
default : tmpStr [ i ] = '?' ;
break ;
}
}
if ( resultStrLen == 1 ) {
g_free ( tmpStr ) ;
return ;
}
resultStr = ( gchar * ) g_malloc ( resultStrLen ) ;
for ( i = 0 , j = 0 ;
tmpStr [ i ] ;
i ++ ) {
if ( tmpStr [ i ] != '?' ) resultStr [ j ++ ] = tmpStr [ i ] ;
}
resultStr [ j ] = '\0' ;
g_free ( * dialedDigits ) ;
g_free ( tmpStr ) ;
* dialedDigits = resultStr ;
return ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int kvm_device_intx_deassign ( KVMState * s , uint32_t dev_id , bool use_host_msi ) {
return kvm_deassign_irq_internal ( s , dev_id , KVM_DEV_IRQ_GUEST_INTX | ( use_host_msi ? KVM_DEV_IRQ_HOST_MSI : KVM_DEV_IRQ_HOST_INTX ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int tm_rescinfo ( tm_node_id node , char * resource , int len , tm_event_t * event ) {
struct reschold * rhold ;
struct tcp_chan * chan = NULL ;
if ( ! init_done ) return TM_BADINIT ;
if ( resource == NULL || len == 0 ) return TM_EBADENVIRONMENT ;
* event = new_event ( ) ;
if ( startcom ( TM_RESOURCES , * event , & chan ) != DIS_SUCCESS ) return TM_ESYSTEM ;
if ( diswsi ( chan , node ) != DIS_SUCCESS ) {
DIS_tcp_cleanup ( chan ) ;
return TM_ESYSTEM ;
}
DIS_tcp_wflush ( chan ) ;
DIS_tcp_cleanup ( chan ) ;
rhold = ( struct reschold * ) calloc ( 1 , sizeof ( struct reschold ) ) ;
assert ( rhold != NULL ) ;
rhold -> resc = resource ;
rhold -> len = len ;
add_event ( * event , node , TM_RESOURCES , ( void * ) rhold ) ;
return TM_SUCCESS ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline void ttafilter_process ( TTAFilter * c , int32_t * in ) {
register int32_t * dl = c -> dl , * qm = c -> qm , * dx = c -> dx , sum = c -> round ;
if ( ! c -> error ) {
sum += * dl ++ * * qm , qm ++ ;
sum += * dl ++ * * qm , qm ++ ;
sum += * dl ++ * * qm , qm ++ ;
sum += * dl ++ * * qm , qm ++ ;
sum += * dl ++ * * qm , qm ++ ;
sum += * dl ++ * * qm , qm ++ ;
sum += * dl ++ * * qm , qm ++ ;
sum += * dl ++ * * qm , qm ++ ;
dx += 8 ;
}
else if ( c -> error < 0 ) {
sum += * dl ++ * ( * qm -= * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm -= * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm -= * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm -= * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm -= * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm -= * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm -= * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm -= * dx ++ ) , qm ++ ;
}
else {
sum += * dl ++ * ( * qm += * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm += * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm += * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm += * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm += * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm += * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm += * dx ++ ) , qm ++ ;
sum += * dl ++ * ( * qm += * dx ++ ) , qm ++ ;
}
* ( dx - 0 ) = ( ( * ( dl - 1 ) >> 30 ) | 1 ) << 2 ;
* ( dx - 1 ) = ( ( * ( dl - 2 ) >> 30 ) | 1 ) << 1 ;
* ( dx - 2 ) = ( ( * ( dl - 3 ) >> 30 ) | 1 ) << 1 ;
* ( dx - 3 ) = ( ( * ( dl - 4 ) >> 30 ) | 1 ) ;
c -> error = * in ;
* in += ( sum >> c -> shift ) ;
* dl = * in ;
* ( dl - 1 ) = * dl - * ( dl - 1 ) ;
* ( dl - 2 ) = * ( dl - 1 ) - * ( dl - 2 ) ;
* ( dl - 3 ) = * ( dl - 2 ) - * ( dl - 3 ) ;
memshl ( c -> dl , c -> dl + 1 ) ;
memshl ( c -> dx , c -> dx + 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void test_cursors_with_procedure ( ) {
const char * queries [ ] = {
"SELECT * FROM t1 procedure analyse()" }
;
myheader ( "test_cursors_with_procedure" ) ;
fetch_n ( queries , sizeof ( queries ) / sizeof ( * queries ) , USE_ROW_BY_ROW_FETCH ) ;
fetch_n ( queries , sizeof ( queries ) / sizeof ( * queries ) , USE_STORE_RESULT ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_sad ## m ## x ## n ## x ## k ## _c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < k ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , & ref [ i ] , ref_stride ) ;
\ }
# define sadMxNx4D ( m , n ) void vp9_sad ## m ## x ## n ## x4d_c ( const uint8_t * src , int src_stride , const uint8_t * const refs [ ] , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < 4 ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , refs [ i ] , ref_stride ) ;
\ }
sadMxN ( 64 , 64 ) sadMxNxK ( 64 , 64 , 3 ) sadMxNxK ( 64 , 64 , 8 ) sadMxNx4D ( 64 , 64 ) sadMxN ( 64 , 32 ) sadMxNx4D ( 64 , 32 ) sadMxN ( 32 , 64 ) sadMxNx4D ( 32 , 64 ) sadMxN ( 32 , 32 ) sadMxNxK ( 32 , 32 , 3 ) sadMxNxK ( 32 , 32 , 8 ) sadMxNx4D ( 32 , 32 ) sadMxN ( 32 , 16 ) sadMxNx4D ( 32 , 16 ) sadMxN ( 16 , 32 ) sadMxNx4D ( 16 , 32 ) sadMxN ( 16 , 16 ) sadMxNxK ( 16 , 16 , 3 ) sadMxNxK ( 16 , 16 , 8 ) sadMxNx4D ( 16 , 16 ) sadMxN ( 16 , 8 ) sadMxNxK ( 16 , 8 , 3 ) sadMxNxK ( 16 , 8 , 8 ) sadMxNx4D ( 16 , 8 ) sadMxN ( 8 , 16 ) sadMxNxK ( 8 , 16 , 3 ) sadMxNxK ( 8 , 16 , 8 ) sadMxNx4D ( 8 , 16 ) sadMxN ( 8 , 8 ) sadMxNxK ( 8 , 8 , 3 ) sadMxNxK ( 8 , 8 , 8 ) sadMxNx4D ( 8 , 8 ) sadMxN ( 8 , 4 ) sadMxNxK ( 8 , 4 , 8 ) sadMxNx4D ( 8 , 4 ) sadMxN ( 4 , 8 ) sadMxNxK ( 4 , 8 , 8 ) sadMxNx4D ( 4 , 8 ) sadMxN ( 4 , 4 ) sadMxNxK ( 4 , 4 , 3 ) sadMxNxK ( 4 , 4 , 8 ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void sig_server_reconnect_not_found ( const char * tag ) {
g_return_if_fail ( tag != NULL ) ;
printformat ( NULL , NULL , MSGLEVEL_CLIENTNOTICE , TXT_RECONNECT_NOT_FOUND , tag ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | unsigned long keydb_get_skipped_counter ( KEYDB_HANDLE hd ) {
return hd ? hd -> skipped_long_blobs : 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void CloseDecoder ( vlc_object_t * p_this ) {
decoder_t * p_dec = ( decoder_t * ) p_this ;
decoder_sys_t * p_sys = p_dec -> p_sys ;
if ( p_sys -> iconv_handle != ( vlc_iconv_t ) - 1 ) vlc_iconv_close ( p_sys -> iconv_handle ) ;
free ( p_sys ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static cmsBool ReadMPECurve ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , void * Cargo , cmsUInt32Number n , cmsUInt32Number SizeOfTag ) {
cmsToneCurve * * GammaTables = ( cmsToneCurve * * ) Cargo ;
GammaTables [ n ] = ReadSegmentedCurve ( self , io ) ;
return ( GammaTables [ n ] != NULL ) ;
cmsUNUSED_PARAMETER ( SizeOfTag ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char ) typedef void * OPENSSL_BLOCK ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_BLOCK , void ) | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static inline size_t GetPixelChannels ( const Image * restrict image ) {
return ( image -> number_channels ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void parse_new_commit ( const char * arg ) {
static struct strbuf msg = STRBUF_INIT ;
struct branch * b ;
char * author = NULL ;
char * committer = NULL ;
struct hash_list * merge_list = NULL ;
unsigned int merge_count ;
unsigned char prev_fanout , new_fanout ;
const char * v ;
b = lookup_branch ( arg ) ;
if ( ! b ) b = new_branch ( arg ) ;
read_next_command ( ) ;
parse_mark ( ) ;
if ( skip_prefix ( command_buf . buf , "author " , & v ) ) {
author = parse_ident ( v ) ;
read_next_command ( ) ;
}
if ( skip_prefix ( command_buf . buf , "committer " , & v ) ) {
committer = parse_ident ( v ) ;
read_next_command ( ) ;
}
if ( ! committer ) die ( "Expected committer but didn't get one" ) ;
parse_data ( & msg , 0 , NULL ) ;
read_next_command ( ) ;
parse_from ( b ) ;
merge_list = parse_merge ( & merge_count ) ;
if ( ! b -> branch_tree . tree || ! max_active_branches ) {
unload_one_branch ( ) ;
load_branch ( b ) ;
}
prev_fanout = convert_num_notes_to_fanout ( b -> num_notes ) ;
while ( command_buf . len > 0 ) {
if ( skip_prefix ( command_buf . buf , "M " , & v ) ) file_change_m ( v , b ) ;
else if ( skip_prefix ( command_buf . buf , "D " , & v ) ) file_change_d ( v , b ) ;
else if ( skip_prefix ( command_buf . buf , "R " , & v ) ) file_change_cr ( v , b , 1 ) ;
else if ( skip_prefix ( command_buf . buf , "C " , & v ) ) file_change_cr ( v , b , 0 ) ;
else if ( skip_prefix ( command_buf . buf , "N " , & v ) ) note_change_n ( v , b , & prev_fanout ) ;
else if ( ! strcmp ( "deleteall" , command_buf . buf ) ) file_change_deleteall ( b ) ;
else if ( skip_prefix ( command_buf . buf , "ls " , & v ) ) parse_ls ( v , b ) ;
else {
unread_command_buf = 1 ;
break ;
}
if ( read_next_command ( ) == EOF ) break ;
}
new_fanout = convert_num_notes_to_fanout ( b -> num_notes ) ;
if ( new_fanout != prev_fanout ) b -> num_notes = change_note_fanout ( & b -> branch_tree , new_fanout ) ;
store_tree ( & b -> branch_tree ) ;
hashcpy ( b -> branch_tree . versions [ 0 ] . sha1 , b -> branch_tree . versions [ 1 ] . sha1 ) ;
strbuf_reset ( & new_data ) ;
strbuf_addf ( & new_data , "tree %s\n" , sha1_to_hex ( b -> branch_tree . versions [ 1 ] . sha1 ) ) ;
if ( ! is_null_sha1 ( b -> sha1 ) ) strbuf_addf ( & new_data , "parent %s\n" , sha1_to_hex ( b -> sha1 ) ) ;
while ( merge_list ) {
struct hash_list * next = merge_list -> next ;
strbuf_addf ( & new_data , "parent %s\n" , sha1_to_hex ( merge_list -> sha1 ) ) ;
free ( merge_list ) ;
merge_list = next ;
}
strbuf_addf ( & new_data , "author %s\n" "committer %s\n" "\n" , author ? author : committer , committer ) ;
strbuf_addbuf ( & new_data , & msg ) ;
free ( author ) ;
free ( committer ) ;
if ( ! store_object ( OBJ_COMMIT , & new_data , NULL , b -> sha1 , next_mark ) ) b -> pack_id = pack_id ;
b -> last_commit = object_count_by_type [ OBJ_COMMIT ] ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int check_best_zero_mv ( const VP9_COMP * cpi , const uint8_t mode_context [ MAX_REF_FRAMES ] , int_mv frame_mv [ MB_MODE_COUNT ] [ MAX_REF_FRAMES ] , int inter_mode_mask , int this_mode , const MV_REFERENCE_FRAME ref_frames [ 2 ] ) {
if ( ( inter_mode_mask & ( 1 << ZEROMV ) ) && ( this_mode == NEARMV || this_mode == NEARESTMV || this_mode == ZEROMV ) && frame_mv [ this_mode ] [ ref_frames [ 0 ] ] . as_int == 0 && ( ref_frames [ 1 ] == NONE || frame_mv [ this_mode ] [ ref_frames [ 1 ] ] . as_int == 0 ) ) {
int rfc = mode_context [ ref_frames [ 0 ] ] ;
int c1 = cost_mv_ref ( cpi , NEARMV , rfc ) ;
int c2 = cost_mv_ref ( cpi , NEARESTMV , rfc ) ;
int c3 = cost_mv_ref ( cpi , ZEROMV , rfc ) ;
if ( this_mode == NEARMV ) {
if ( c1 > c3 ) return 0 ;
}
else if ( this_mode == NEARESTMV ) {
if ( c2 > c3 ) return 0 ;
}
else {
assert ( this_mode == ZEROMV ) ;
if ( ref_frames [ 1 ] == NONE ) {
if ( ( c3 >= c2 && frame_mv [ NEARESTMV ] [ ref_frames [ 0 ] ] . as_int == 0 ) || ( c3 >= c1 && frame_mv [ NEARMV ] [ ref_frames [ 0 ] ] . as_int == 0 ) ) return 0 ;
}
else {
if ( ( c3 >= c2 && frame_mv [ NEARESTMV ] [ ref_frames [ 0 ] ] . as_int == 0 && frame_mv [ NEARESTMV ] [ ref_frames [ 1 ] ] . as_int == 0 ) || ( c3 >= c1 && frame_mv [ NEARMV ] [ ref_frames [ 0 ] ] . as_int == 0 && frame_mv [ NEARMV ] [ ref_frames [ 1 ] ] . as_int == 0 ) ) return 0 ;
}
}
}
return 1 ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void setupRestoreWorker ( Archive * AHX ) {
ArchiveHandle * AH = ( ArchiveHandle * ) AHX ;
( AH -> ReopenPtr ) ( AH ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int fz_colorspace_device_n_has_cmyk ( fz_context * ctx , const fz_colorspace * cs ) {
return cs && ( cs -> flags & FZ_CS_HAS_CMYK ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static char * get_application_no_mime_type_handler_message ( NautilusFile * file , char * uri ) {
char * uri_for_display ;
char * name ;
char * error_message ;
name = nautilus_file_get_display_name ( file ) ;
uri_for_display = eel_str_middle_truncate ( name , MAX_URI_IN_DIALOG_LENGTH ) ;
error_message = g_strdup_printf ( _ ( "Could not display “%s”." ) , uri_for_display ) ;
g_free ( uri_for_display ) ;
g_free ( name ) ;
return error_message ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | unsigned min_heap_size ( min_heap_t * s ) {
return s -> n ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | pdf_xobject * pdf_load_xobject ( fz_context * ctx , pdf_document * doc , pdf_obj * dict ) {
pdf_xobject * form ;
if ( ( form = pdf_find_item ( ctx , pdf_drop_xobject_imp , dict ) ) != NULL ) return form ;
form = fz_malloc_struct ( ctx , pdf_xobject ) ;
FZ_INIT_STORABLE ( form , 1 , pdf_drop_xobject_imp ) ;
form -> obj = NULL ;
form -> iteration = 0 ;
pdf_store_item ( ctx , dict , form , pdf_xobject_size ( form ) ) ;
form -> obj = pdf_keep_obj ( ctx , dict ) ;
return form ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void arm_mptimer_reset ( DeviceState * dev ) {
ARMMPTimerState * s = FROM_SYSBUS ( ARMMPTimerState , SYS_BUS_DEVICE ( dev ) ) ;
int i ;
for ( i = 0 ;
i < ARRAY_SIZE ( s -> timerblock ) ;
i ++ ) {
timerblock_reset ( & s -> timerblock [ i ] ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void PNGAPI png_set_gAMA ( png_structp png_ptr , png_infop info_ptr , double file_gamma ) {
double png_gamma ;
png_debug1 ( 1 , "in %s storage function" , "gAMA" ) ;
if ( png_ptr == NULL || info_ptr == NULL ) return ;
if ( file_gamma > 21474.83 ) {
png_warning ( png_ptr , "Limiting gamma to 21474.83" ) ;
png_gamma = 21474.83 ;
}
else png_gamma = file_gamma ;
info_ptr -> gamma = ( float ) png_gamma ;
# ifdef PNG_FIXED_POINT_SUPPORTED info_ptr -> int_gamma = ( int ) ( png_gamma * 100000. + .5 ) ;
# endif info_ptr -> valid |= PNG_INFO_gAMA ;
if ( png_gamma == 0.0 ) png_warning ( png_ptr , "Setting gamma=0" ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int vp9_loop_filter_worker ( LFWorkerData * const lf_data , void * unused ) {
( void ) unused ;
vp9_loop_filter_rows ( lf_data -> frame_buffer , lf_data -> cm , lf_data -> planes , lf_data -> start , lf_data -> stop , lf_data -> y_only ) ;
return 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void mac_init ( void ) {
mac_is_sdus = g_hash_table_new_full ( mac_is_channel_hash , mac_is_channel_equal , NULL , mac_is_sdus_hash_destroy ) ;
mac_is_fragments = g_hash_table_new_full ( mac_is_channel_hash , mac_is_channel_equal , NULL , NULL ) ;
if ( global_mac_tsn_size == MAC_TSN_6BITS ) {
MAX_TSN = 64 ;
mac_tsn_size = 6 ;
}
else {
MAX_TSN = 16384 ;
mac_tsn_size = 14 ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void gx_device_set_media_from_hwsize ( gx_device * dev ) {
int rot = ( dev -> LeadingEdge & 1 ) ;
double x = dev -> width * 72.0 / dev -> HWResolution [ 0 ] ;
double y = dev -> height * 72.0 / dev -> HWResolution [ 1 ] ;
if ( rot ) {
dev -> MediaSize [ 1 ] = x ;
dev -> MediaSize [ 0 ] = y ;
}
else {
dev -> MediaSize [ 0 ] = x ;
dev -> MediaSize [ 1 ] = y ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int qemuMonitorJSONIOProcessEvent ( qemuMonitorPtr mon , virJSONValuePtr obj ) {
const char * type ;
int i ;
VIR_DEBUG ( "mon=%p obj=%p" , mon , obj ) ;
type = virJSONValueObjectGetString ( obj , "event" ) ;
if ( ! type ) {
VIR_WARN ( "missing event type in message" ) ;
errno = EINVAL ;
return - 1 ;
}
for ( i = 0 ;
i < ARRAY_CARDINALITY ( eventHandlers ) ;
i ++ ) {
if ( STREQ ( eventHandlers [ i ] . type , type ) ) {
virJSONValuePtr data = virJSONValueObjectGet ( obj , "data" ) ;
VIR_DEBUG ( "handle %s handler=%p data=%p" , type , eventHandlers [ i ] . handler , data ) ;
( eventHandlers [ i ] . handler ) ( mon , data ) ;
break ;
}
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void server_port_ready_callback ( int fd , short events , void * arg ) {
struct evdns_server_port * port = ( struct evdns_server_port * ) arg ;
( void ) fd ;
if ( events & EV_WRITE ) {
port -> choked = 0 ;
server_port_flush ( port ) ;
}
if ( events & EV_READ ) {
server_port_read ( port ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | Node * eval_const_expressions ( PlannerInfo * root , Node * node ) {
eval_const_expressions_context context ;
if ( root ) context . boundParams = root -> glob -> boundParams ;
else context . boundParams = NULL ;
context . root = root ;
context . active_fns = NIL ;
context . case_val = NULL ;
context . estimate = false ;
return eval_const_expressions_mutator ( node , & context ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void test_multiple ( void ) {
struct event ev , ev2 ;
int i ;
setup_test ( "Multiple read/write: " ) ;
memset ( rbuf , 0 , sizeof ( rbuf ) ) ;
for ( i = 0 ;
i < sizeof ( wbuf ) ;
i ++ ) wbuf [ i ] = i ;
roff = woff = 0 ;
usepersist = 0 ;
event_set ( & ev , pair [ 0 ] , EV_WRITE , multiple_write_cb , & ev ) ;
if ( event_add ( & ev , NULL ) == - 1 ) exit ( 1 ) ;
event_set ( & ev2 , pair [ 1 ] , EV_READ , multiple_read_cb , & ev2 ) ;
if ( event_add ( & ev2 , NULL ) == - 1 ) exit ( 1 ) ;
event_dispatch ( ) ;
if ( roff == woff ) test_ok = memcmp ( rbuf , wbuf , sizeof ( wbuf ) ) == 0 ;
cleanup_test ( ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void ctcp_msg_dcc_resume ( IRC_SERVER_REC * server , const char * data , const char * nick , const char * addr , const char * target , DCC_REC * chat ) {
FILE_DCC_REC * dcc ;
char * str ;
uoff_t size ;
int pasv_id = - 1 ;
if ( ! dcc_ctcp_resume_parse ( DCC_SEND_TYPE , data , nick , & dcc , & size , & pasv_id ) ) {
signal_emit ( "dcc error ctcp" , 5 , "RESUME" , data , nick , addr , target ) ;
}
else if ( dcc != NULL && dcc_resume_file_check ( dcc , server , size ) ) {
if ( ! dcc_is_passive ( dcc ) ) {
str = g_strdup_printf ( DCC_SEND ( dcc ) -> file_quoted ? "DCC ACCEPT \"%s\" %d %" PRIuUOFF_T : "DCC ACCEPT %s %d %" PRIuUOFF_T , dcc -> arg , dcc -> port , dcc -> transfd ) ;
}
else {
str = g_strdup_printf ( DCC_SEND ( dcc ) -> file_quoted ? "DCC ACCEPT \"%s\" 0 %" PRIuUOFF_T " %d" : "DCC ACCEPT %s 0 %" PRIuUOFF_T " %d" , dcc -> arg , dcc -> transfd , dcc -> pasv_id ) ;
}
dcc_ctcp_message ( dcc -> server , dcc -> nick , dcc -> chat , FALSE , str ) ;
g_free ( str ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_MaximumHeaderIntervalResp ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_MaximumHeaderIntervalResp , MaximumHeaderIntervalResp_sequence ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int calc_add_mv ( RV34DecContext * r , int dir , int val ) {
int mul = dir ? - r -> mv_weight2 : r -> mv_weight1 ;
return ( val * mul + 0x2000 ) >> 14 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | bool contain_volatile_functions ( Node * clause ) {
return contain_volatile_functions_walker ( clause , NULL ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int pic_num_extract ( H264Context * h , int pic_num , int * structure ) {
* structure = h -> picture_structure ;
if ( FIELD_PICTURE ) {
if ( ! ( pic_num & 1 ) ) * structure ^= PICT_FRAME ;
pic_num >>= 1 ;
}
return pic_num ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int event_base_dispatch ( struct event_base * event_base ) {
return ( event_base_loop ( event_base , 0 ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_nlm4_share ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ ) {
return dissect_nlm_share ( tvb , 0 , pinfo , tree , 4 , ( rpc_call_info_value * ) data ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static pdf_obj * resolve_properties ( fz_context * ctx , pdf_csi * csi , pdf_obj * obj ) {
if ( pdf_is_name ( ctx , obj ) ) return pdf_dict_get ( ctx , pdf_dict_get ( ctx , csi -> rdb , PDF_NAME_Properties ) , obj ) ;
else return obj ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | gcry_error_t _gcry_pk_register ( gcry_pk_spec_t * pubkey , pk_extra_spec_t * extraspec , unsigned int * algorithm_id , gcry_module_t * module ) {
gcry_err_code_t err = GPG_ERR_NO_ERROR ;
gcry_module_t mod ;
if ( fips_mode ( ) ) return gpg_error ( GPG_ERR_NOT_SUPPORTED ) ;
ath_mutex_lock ( & pubkeys_registered_lock ) ;
err = _gcry_module_add ( & pubkeys_registered , 0 , ( void * ) pubkey , ( void * ) ( extraspec ? extraspec : & dummy_extra_spec ) , & mod ) ;
ath_mutex_unlock ( & pubkeys_registered_lock ) ;
if ( ! err ) {
* module = mod ;
* algorithm_id = mod -> mod_id ;
}
return err ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void http_badreq_readcb ( struct bufferevent * bev , void * arg ) {
const char * what = "Hello, 127.0.0.1" ;
const char * bad_request = "400 Bad Request" ;
event_debug ( ( "%s: %s\n" , __func__ , EVBUFFER_DATA ( bev -> input ) ) ) ;
if ( evbuffer_find ( bev -> input , ( const unsigned char * ) bad_request , strlen ( bad_request ) ) != NULL ) {
event_debug ( ( "%s: bad request detected" , __func__ ) ) ;
test_ok = - 10 ;
bufferevent_disable ( bev , EV_READ ) ;
event_loopexit ( NULL ) ;
return ;
}
if ( evbuffer_find ( bev -> input , ( const unsigned char * ) what , strlen ( what ) ) != NULL ) {
struct evhttp_request * req = evhttp_request_new ( NULL , NULL ) ;
enum message_read_status done ;
req -> kind = EVHTTP_RESPONSE ;
done = evhttp_parse_firstline ( req , bev -> input ) ;
if ( done != ALL_DATA_READ ) goto out ;
done = evhttp_parse_headers ( req , bev -> input ) ;
if ( done != ALL_DATA_READ ) goto out ;
if ( done == 1 && evhttp_find_header ( req -> input_headers , "Content-Type" ) != NULL ) test_ok ++ ;
out : evhttp_request_free ( req ) ;
evbuffer_drain ( bev -> input , EVBUFFER_LENGTH ( bev -> input ) ) ;
}
shutdown ( bev -> ev_read . ev_fd , SHUT_WR ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void cirrus_bitblt_fill_nop ( CirrusVGAState * s , uint32_t dstaddr , int dstpitch , int bltwidth , int bltheight ) {
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int setup_test ( const char * name ) {
fprintf ( stdout , "%s" , name ) ;
if ( evutil_socketpair ( AF_UNIX , SOCK_STREAM , 0 , pair ) == - 1 ) {
fprintf ( stderr , "%s: socketpair\n" , __func__ ) ;
exit ( 1 ) ;
}
# ifdef HAVE_FCNTL if ( fcntl ( pair [ 0 ] , F_SETFL , O_NONBLOCK ) == - 1 ) fprintf ( stderr , "fcntl(O_NONBLOCK)" ) ;
if ( fcntl ( pair [ 1 ] , F_SETFL , O_NONBLOCK ) == - 1 ) fprintf ( stderr , "fcntl(O_NONBLOCK)" ) ;
# endif test_ok = 0 ;
called = 0 ;
return ( 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int yop_paint_block ( YopDecContext * s , int tag ) {
if ( s -> src_end - s -> srcptr < paint_lut [ tag ] [ 3 ] ) {
av_log ( s -> avctx , AV_LOG_ERROR , "Packet too small.\n" ) ;
return AVERROR_INVALIDDATA ;
}
s -> dstptr [ 0 ] = s -> srcptr [ 0 ] ;
s -> dstptr [ 1 ] = s -> srcptr [ paint_lut [ tag ] [ 0 ] ] ;
s -> dstptr [ s -> frame . linesize [ 0 ] ] = s -> srcptr [ paint_lut [ tag ] [ 1 ] ] ;
s -> dstptr [ s -> frame . linesize [ 0 ] + 1 ] = s -> srcptr [ paint_lut [ tag ] [ 2 ] ] ;
s -> srcptr += paint_lut [ tag ] [ 3 ] ;
return 0 ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void activation_get_activation_uris ( ActivateParameters * parameters ) {
GList * l , * files ;
NautilusFile * file ;
LaunchLocation * location ;
for ( l = parameters -> locations ;
l != NULL ;
l = l -> next ) {
location = l -> data ;
file = location -> file ;
if ( file_was_cancelled ( file ) ) {
launch_location_free ( location ) ;
parameters -> locations = g_list_delete_link ( parameters -> locations , l ) ;
continue ;
}
}
if ( parameters -> locations == NULL ) {
activation_parameters_free ( parameters ) ;
return ;
}
files = get_file_list_for_launch_locations ( parameters -> locations ) ;
nautilus_file_list_call_when_ready ( files , nautilus_mime_actions_get_required_file_attributes ( ) , & parameters -> files_handle , activate_activation_uris_ready_callback , parameters ) ;
nautilus_file_list_free ( files ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int init_dimensions ( H264Context * h ) {
int width = h -> width - ( h -> sps . crop_right + h -> sps . crop_left ) ;
int height = h -> height - ( h -> sps . crop_top + h -> sps . crop_bottom ) ;
av_assert0 ( h -> sps . crop_right + h -> sps . crop_left < ( unsigned ) h -> width ) ;
av_assert0 ( h -> sps . crop_top + h -> sps . crop_bottom < ( unsigned ) h -> height ) ;
if ( ! h -> sps . crop && FFALIGN ( h -> avctx -> width , 16 ) == h -> width && FFALIGN ( h -> avctx -> height , 16 ) == h -> height ) {
width = h -> avctx -> width ;
height = h -> avctx -> height ;
}
if ( width <= 0 || height <= 0 ) {
av_log ( h -> avctx , AV_LOG_ERROR , "Invalid cropped dimensions: %dx%d.\n" , width , height ) ;
if ( h -> avctx -> err_recognition & AV_EF_EXPLODE ) return AVERROR_INVALIDDATA ;
av_log ( h -> avctx , AV_LOG_WARNING , "Ignoring cropping information.\n" ) ;
h -> sps . crop_bottom = h -> sps . crop_top = h -> sps . crop_right = h -> sps . crop_left = 0 ;
h -> sps . crop = 0 ;
width = h -> width ;
height = h -> height ;
}
h -> avctx -> coded_width = h -> width ;
h -> avctx -> coded_height = h -> height ;
h -> avctx -> width = width ;
h -> avctx -> height = height ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void appendConnStrVal ( PQExpBuffer buf , const char * str ) {
const char * s ;
bool needquotes ;
needquotes = true ;
for ( s = str ;
* s ;
s ++ ) {
if ( ! ( ( * s >= 'a' && * s <= 'z' ) || ( * s >= 'A' && * s <= 'Z' ) || ( * s >= '0' && * s <= '9' ) || * s == '_' || * s == '.' ) ) {
needquotes = true ;
break ;
}
needquotes = false ;
}
if ( needquotes ) {
appendPQExpBufferChar ( buf , '\'' ) ;
while ( * str ) {
if ( * str == '\'' || * str == '\\' ) appendPQExpBufferChar ( buf , '\\' ) ;
appendPQExpBufferChar ( buf , * str ) ;
str ++ ;
}
appendPQExpBufferChar ( buf , '\'' ) ;
}
else appendPQExpBufferStr ( buf , str ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( ExternalProtocolHandlerTest , TestGetBlockStateUnknown ) {
ExternalProtocolHandler : : BlockState block_state = ExternalProtocolHandler : : GetBlockState ( "tel" , profile_ . get ( ) ) ;
EXPECT_EQ ( ExternalProtocolHandler : : UNKNOWN , block_state ) ;
EXPECT_TRUE ( local_state_ -> GetDictionary ( prefs : : kExcludedSchemes ) -> empty ( ) ) ;
EXPECT_FALSE ( profile_ -> GetPrefs ( ) -> GetDictionary ( prefs : : kExcludedSchemes ) -> empty ( ) ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | PXA2xxI2CState * pxa2xx_i2c_init ( hwaddr base , qemu_irq irq , uint32_t region_size ) {
DeviceState * dev ;
SysBusDevice * i2c_dev ;
PXA2xxI2CState * s ;
i2c_dev = SYS_BUS_DEVICE ( qdev_create ( NULL , "pxa2xx_i2c" ) ) ;
qdev_prop_set_uint32 ( & i2c_dev -> qdev , "size" , region_size + 1 ) ;
qdev_prop_set_uint32 ( & i2c_dev -> qdev , "offset" , base & region_size ) ;
qdev_init_nofail ( & i2c_dev -> qdev ) ;
sysbus_mmio_map ( i2c_dev , 0 , base & ~ region_size ) ;
sysbus_connect_irq ( i2c_dev , 0 , irq ) ;
s = FROM_SYSBUS ( PXA2xxI2CState , i2c_dev ) ;
dev = i2c_create_slave ( i2c_init_bus ( NULL , "dummy" ) , "pxa2xx-i2c-slave" , 0 ) ;
s -> slave = FROM_I2C_SLAVE ( PXA2xxI2CSlaveState , I2C_SLAVE ( dev ) ) ;
s -> slave -> host = s ;
return s ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void proto_tree_set_eui64_tvb ( field_info * fi , tvbuff_t * tvb , gint start , const guint encoding ) {
if ( encoding ) {
proto_tree_set_eui64 ( fi , tvb_get_letoh64 ( tvb , start ) ) ;
}
else {
proto_tree_set_eui64 ( fi , tvb_get_ntoh64 ( tvb , start ) ) ;
}
} | 0False
|