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 | void kadmin_getprinc ( int argc , char * argv [ ] ) {
kadm5_principal_ent_rec dprinc ;
krb5_principal princ = NULL ;
krb5_error_code retval ;
char * canon = NULL , * princstr = NULL , * modprincstr = NULL ;
int i ;
size_t j ;
if ( ! ( argc == 2 || ( argc == 3 && ! strcmp ( "-terse" , argv [ 1 ] ) ) ) ) {
fprintf ( stderr , _ ( "usage: get_principal [-terse] principal\n" ) ) ;
return ;
}
memset ( & dprinc , 0 , sizeof ( dprinc ) ) ;
retval = kadmin_parse_name ( argv [ argc - 1 ] , & princ ) ;
if ( retval ) {
com_err ( "get_principal" , retval , _ ( "while parsing principal" ) ) ;
return ;
}
retval = krb5_unparse_name ( context , princ , & canon ) ;
if ( retval ) {
com_err ( "get_principal" , retval , _ ( "while canonicalizing principal" ) ) ;
goto cleanup ;
}
retval = kadm5_get_principal ( handle , princ , & dprinc , KADM5_PRINCIPAL_NORMAL_MASK | KADM5_KEY_DATA ) ;
if ( retval ) {
com_err ( "get_principal" , retval , _ ( "while retrieving \"%s\"." ) , canon ) ;
goto cleanup ;
}
retval = krb5_unparse_name ( context , dprinc . principal , & princstr ) ;
if ( retval ) {
com_err ( "get_principal" , retval , _ ( "while unparsing principal" ) ) ;
goto cleanup ;
}
retval = krb5_unparse_name ( context , dprinc . mod_name , & modprincstr ) ;
if ( retval ) {
com_err ( "get_principal" , retval , _ ( "while unparsing principal" ) ) ;
goto cleanup ;
}
if ( argc == 2 ) {
printf ( _ ( "Principal: %s\n" ) , princstr ) ;
printf ( _ ( "Expiration date: %s\n" ) , dprinc . princ_expire_time ? strdate ( dprinc . princ_expire_time ) : _ ( "[never]" ) ) ;
printf ( _ ( "Last password change: %s\n" ) , dprinc . last_pwd_change ? strdate ( dprinc . last_pwd_change ) : _ ( "[never]" ) ) ;
printf ( _ ( "Password expiration date: %s\n" ) , dprinc . pw_expiration ? strdate ( dprinc . pw_expiration ) : _ ( "[none]" ) ) ;
printf ( _ ( "Maximum ticket life: %s\n" ) , strdur ( dprinc . max_life ) ) ;
printf ( _ ( "Maximum renewable life: %s\n" ) , strdur ( dprinc . max_renewable_life ) ) ;
printf ( _ ( "Last modified: %s (%s)\n" ) , strdate ( dprinc . mod_date ) , modprincstr ) ;
printf ( _ ( "Last successful authentication: %s\n" ) , dprinc . last_success ? strdate ( dprinc . last_success ) : _ ( "[never]" ) ) ;
printf ( "Last failed authentication: %s\n" , dprinc . last_failed ? strdate ( dprinc . last_failed ) : "[never]" ) ;
printf ( _ ( "Failed password attempts: %d\n" ) , dprinc . fail_auth_count ) ;
printf ( _ ( "Number of keys: %d\n" ) , dprinc . n_key_data ) ;
for ( i = 0 ;
i < dprinc . n_key_data ;
i ++ ) {
krb5_key_data * key_data = & dprinc . key_data [ i ] ;
char enctype [ BUFSIZ ] , salttype [ BUFSIZ ] ;
if ( krb5_enctype_to_name ( key_data -> key_data_type [ 0 ] , FALSE , enctype , sizeof ( enctype ) ) ) snprintf ( enctype , sizeof ( enctype ) , _ ( "<Encryption type 0x%x>" ) , key_data -> key_data_type [ 0 ] ) ;
printf ( "Key: vno %d, %s, " , key_data -> key_data_kvno , enctype ) ;
if ( key_data -> key_data_ver > 1 ) {
if ( krb5_salttype_to_string ( key_data -> key_data_type [ 1 ] , salttype , sizeof ( salttype ) ) ) snprintf ( salttype , sizeof ( salttype ) , _ ( "<Salt type 0x%x>" ) , key_data -> key_data_type [ 1 ] ) ;
printf ( "%s\n" , salttype ) ;
}
else printf ( _ ( "no salt\n" ) ) ;
}
printf ( _ ( "MKey: vno %d\n" ) , dprinc . mkvno ) ;
printf ( _ ( "Attributes:" ) ) ;
for ( j = 0 ;
j < sizeof ( prflags ) / sizeof ( char * ) ;
j ++ ) {
if ( dprinc . attributes & ( krb5_flags ) 1 << j ) printf ( " %s" , prflags [ j ] ) ;
}
printf ( "\n" ) ;
printf ( _ ( "Policy: %s\n" ) , dprinc . policy ? dprinc . policy : _ ( "[none]" ) ) ;
}
else {
printf ( "\"%s\"\t%d\t%d\t%d\t%d\t\"%s\"\t%d\t%d\t%d\t%d\t\"%s\"" "\t%d\t%d\t%d\t%d\t%d" , princstr , dprinc . princ_expire_time , dprinc . last_pwd_change , dprinc . pw_expiration , dprinc . max_life , modprincstr , dprinc . mod_date , dprinc . attributes , dprinc . kvno , dprinc . mkvno , dprinc . policy ? dprinc . policy : "[none]" , dprinc . max_renewable_life , dprinc . last_success , dprinc . last_failed , dprinc . fail_auth_count , dprinc . n_key_data ) ;
for ( i = 0 ;
i < dprinc . n_key_data ;
i ++ ) printf ( "\t%d\t%d\t%d\t%d" , dprinc . key_data [ i ] . key_data_ver , dprinc . key_data [ i ] . key_data_kvno , dprinc . key_data [ i ] . key_data_type [ 0 ] , dprinc . key_data [ i ] . key_data_type [ 1 ] ) ;
printf ( "\n" ) ;
}
cleanup : krb5_free_principal ( context , princ ) ;
kadm5_free_principal_ent ( handle , & dprinc ) ;
free ( canon ) ;
free ( princstr ) ;
free ( modprincstr ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | int mbfl_buffer_converter_illegal_mode ( mbfl_buffer_converter * convd , int mode ) {
if ( convd != NULL ) {
if ( convd -> filter2 != NULL ) {
convd -> filter2 -> illegal_mode = mode ;
}
else if ( convd -> filter1 != NULL ) {
convd -> filter1 -> illegal_mode = mode ;
}
else {
return 0 ;
}
}
return 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void curses_connection_inject_file ( void ) {
wdg_t * fop ;
DEBUG_MSG ( "curses_connection_inject_file" ) ;
wdg_create_object ( & fop , WDG_FILE , WDG_OBJ_WANT_FOCUS | WDG_OBJ_FOCUS_MODAL ) ;
wdg_set_title ( fop , "Select a file to inject..." , WDG_ALIGN_LEFT ) ;
wdg_set_color ( fop , WDG_COLOR_SCREEN , EC_COLOR ) ;
wdg_set_color ( fop , WDG_COLOR_WINDOW , EC_COLOR_MENU ) ;
wdg_set_color ( fop , WDG_COLOR_FOCUS , EC_COLOR_FOCUS ) ;
wdg_set_color ( fop , WDG_COLOR_TITLE , EC_COLOR_TITLE ) ;
wdg_file_set_callback ( fop , inject_file ) ;
wdg_draw_object ( fop ) ;
wdg_set_focus ( fop ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | bool is_acl_user ( const char * host , const char * user ) {
bool res ;
if ( ! initialized ) return TRUE ;
VOID ( pthread_mutex_lock ( & acl_cache -> lock ) ) ;
res = find_acl_user ( host , user , TRUE ) != NULL ;
VOID ( pthread_mutex_unlock ( & acl_cache -> lock ) ) ;
return res ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void list_curves ( void ) {
int idx ;
const char * name ;
unsigned int nbits ;
for ( idx = 0 ;
( name = gcry_pk_get_curve ( NULL , idx , & nbits ) ) ;
idx ++ ) {
if ( verbose ) printf ( "%s - %u bits\n" , name , nbits ) ;
}
if ( idx != N_CURVES ) fail ( "expected %d curves but got %d\n" , N_CURVES , idx ) ;
if ( gcry_pk_get_curve ( NULL , - 1 , NULL ) ) fail ( "curve iteration failed\n" ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int x ( struct vcache * avc , int afun , struct vrequest * areq , \ struct afs_pdata * ain , struct afs_pdata * aout , \ afs_ucred_t * * acred ) DECL_PIOCTL ( PGetFID ) ;
DECL_PIOCTL ( PSetAcl ) ;
DECL_PIOCTL ( PStoreBehind ) ;
DECL_PIOCTL ( PGCPAGs ) ;
DECL_PIOCTL ( PGetAcl ) ;
DECL_PIOCTL ( PNoop ) ;
DECL_PIOCTL ( PBogus ) ;
DECL_PIOCTL ( PGetFileCell ) ;
DECL_PIOCTL ( PGetWSCell ) ;
DECL_PIOCTL ( PGetUserCell ) ;
DECL_PIOCTL ( PSetTokens ) ;
DECL_PIOCTL ( PGetVolumeStatus ) ;
DECL_PIOCTL ( PSetVolumeStatus ) ;
DECL_PIOCTL ( PFlush ) ;
DECL_PIOCTL ( PNewStatMount ) ;
DECL_PIOCTL ( PGetTokens ) ;
DECL_PIOCTL ( PUnlog ) ;
DECL_PIOCTL ( PMariner ) ;
DECL_PIOCTL ( PCheckServers ) ;
DECL_PIOCTL ( PCheckVolNames ) ;
DECL_PIOCTL ( PCheckAuth ) ;
DECL_PIOCTL ( PFindVolume ) ;
DECL_PIOCTL ( PViceAccess ) ;
DECL_PIOCTL ( PSetCacheSize ) ;
DECL_PIOCTL ( PGetCacheSize ) ;
DECL_PIOCTL ( PRemoveCallBack ) ;
DECL_PIOCTL ( PNewCell ) ;
DECL_PIOCTL ( PNewAlias ) ;
DECL_PIOCTL ( PListCells ) ;
DECL_PIOCTL ( PListAliases ) ;
DECL_PIOCTL ( PRemoveMount ) ;
DECL_PIOCTL ( PGetCellStatus ) ;
DECL_PIOCTL ( PSetCellStatus ) ;
DECL_PIOCTL ( PFlushVolumeData ) ;
DECL_PIOCTL ( PFlushAllVolumeData ) ;
DECL_PIOCTL ( PGetVnodeXStatus ) ;
DECL_PIOCTL ( PGetVnodeXStatus2 ) ;
DECL_PIOCTL ( PSetSysName ) ;
DECL_PIOCTL ( PSetSPrefs ) ;
DECL_PIOCTL ( PSetSPrefs33 ) ;
DECL_PIOCTL ( PGetSPrefs ) ;
DECL_PIOCTL ( PExportAfs ) ;
DECL_PIOCTL ( PGag ) ;
DECL_PIOCTL ( PTwiddleRx ) ;
DECL_PIOCTL ( PGetInitParams ) ;
DECL_PIOCTL ( PGetRxkcrypt ) ;
DECL_PIOCTL ( PSetRxkcrypt ) ;
DECL_PIOCTL ( PGetCPrefs ) ;
DECL_PIOCTL ( PSetCPrefs ) ;
DECL_PIOCTL ( PFlushMount ) ;
DECL_PIOCTL ( PRxStatProc ) ;
DECL_PIOCTL ( PRxStatPeer ) ;
DECL_PIOCTL ( PPrefetchFromTape ) ;
DECL_PIOCTL ( PFsCmd ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int append_to_frame_graph ( voip_calls_tapinfo_t * tapinfo _U_ , guint32 frame_num , const gchar * new_frame_label , const gchar * new_comment ) {
seq_analysis_item_t * gai = NULL ;
gchar * frame_label = NULL ;
gchar * comment = NULL ;
if ( NULL != tapinfo -> graph_analysis -> ht ) gai = ( seq_analysis_item_t * ) g_hash_table_lookup ( tapinfo -> graph_analysis -> ht , & frame_num ) ;
if ( gai ) {
frame_label = gai -> frame_label ;
comment = gai -> comment ;
if ( new_frame_label != NULL ) {
gai -> frame_label = g_strdup_printf ( "%s %s" , frame_label , new_frame_label ) ;
g_free ( frame_label ) ;
}
if ( new_comment != NULL ) {
gai -> comment = g_strdup_printf ( "%s %s" , comment , new_comment ) ;
g_free ( comment ) ;
}
}
return gai ? 1 : 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_idct16x16_10_add_c ( const tran_low_t * input , uint8_t * dest , int stride ) {
tran_low_t out [ 16 * 16 ] = {
0 }
;
tran_low_t * outptr = out ;
int i , j ;
tran_low_t temp_in [ 16 ] , temp_out [ 16 ] ;
for ( i = 0 ;
i < 4 ;
++ i ) {
idct16 ( input , outptr ) ;
input += 16 ;
outptr += 16 ;
}
for ( i = 0 ;
i < 16 ;
++ i ) {
for ( j = 0 ;
j < 16 ;
++ j ) temp_in [ j ] = out [ j * 16 + i ] ;
idct16 ( temp_in , temp_out ) ;
for ( j = 0 ;
j < 16 ;
++ j ) dest [ j * stride + i ] = clip_pixel ( ROUND_POWER_OF_TWO ( temp_out [ j ] , 6 ) + dest [ j * stride + i ] ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean istr_equal ( gconstpointer v , gconstpointer v2 ) {
return g_ascii_strcasecmp ( v , v2 ) == 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int parse_CSort ( tvbuff_t * tvb , int offset , proto_tree * parent_tree , proto_tree * pad_tree _U_ , const char * fmt , ... ) {
guint32 col , ord , ind ;
proto_item * item ;
proto_tree * tree ;
const char * txt ;
va_list ap ;
va_start ( ap , fmt ) ;
txt = wmem_strdup_vprintf ( wmem_packet_scope ( ) , fmt , ap ) ;
va_end ( ap ) ;
tree = proto_tree_add_subtree ( parent_tree , tvb , offset , 0 , ett_CSort , & item , txt ) ;
col = tvb_get_letohl ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_mswsp_cscort_column , tvb , offset , 4 , col ) ;
offset += 4 ;
ord = tvb_get_letohl ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_mswsp_cscort_order , tvb , offset , 4 , ord ) ;
offset += 4 ;
ind = tvb_get_letohl ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_mswsp_cscort_individual , tvb , offset , 4 , ind ) ;
offset += 4 ;
offset = parse_lcid ( tvb , offset , tree , "lcid" ) ;
proto_item_set_end ( item , tvb , offset ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_quantize_fp_32x32_c ( const int16_t * coeff_ptr , intptr_t n_coeffs , int skip_block , const int16_t * zbin_ptr , const int16_t * round_ptr , const int16_t * quant_ptr , const int16_t * quant_shift_ptr , int16_t * qcoeff_ptr , int16_t * dqcoeff_ptr , const int16_t * dequant_ptr , int zbin_oq_value , uint16_t * eob_ptr , const int16_t * scan , const int16_t * iscan ) {
int i , eob = - 1 ;
( void ) zbin_ptr ;
( void ) quant_shift_ptr ;
( void ) zbin_oq_value ;
( void ) iscan ;
vpx_memset ( qcoeff_ptr , 0 , n_coeffs * sizeof ( int16_t ) ) ;
vpx_memset ( dqcoeff_ptr , 0 , n_coeffs * sizeof ( int16_t ) ) ;
if ( ! skip_block ) {
for ( i = 0 ;
i < n_coeffs ;
i ++ ) {
const int rc = scan [ i ] ;
const int coeff = coeff_ptr [ rc ] ;
const int coeff_sign = ( coeff >> 31 ) ;
int tmp = 0 ;
int abs_coeff = ( coeff ^ coeff_sign ) - coeff_sign ;
if ( abs_coeff >= ( dequant_ptr [ rc != 0 ] >> 2 ) ) {
abs_coeff += ROUND_POWER_OF_TWO ( round_ptr [ rc != 0 ] , 1 ) ;
abs_coeff = clamp ( abs_coeff , INT16_MIN , INT16_MAX ) ;
tmp = ( abs_coeff * quant_ptr [ rc != 0 ] ) >> 15 ;
qcoeff_ptr [ rc ] = ( tmp ^ coeff_sign ) - coeff_sign ;
dqcoeff_ptr [ rc ] = qcoeff_ptr [ rc ] * dequant_ptr [ rc != 0 ] / 2 ;
}
if ( tmp ) eob = i ;
}
}
* eob_ptr = eob + 1 ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static uint32_t gic_dist_readw ( void * opaque , hwaddr offset ) {
uint32_t val ;
val = gic_dist_readb ( opaque , offset ) ;
val |= gic_dist_readb ( opaque , offset + 1 ) << 8 ;
return val ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( BrowsingDataRemoverImplTest , RemoveLocalStorageForLastWeek ) {
# if BUILDFLAG ( ENABLE_EXTENSIONS ) CreateMockPolicy ( ) ;
# endif BlockUntilBrowsingDataRemoved ( base : : Time : : Now ( ) - base : : TimeDelta : : FromDays ( 7 ) , base : : Time : : Max ( ) , BrowsingDataRemover : : REMOVE_LOCAL_STORAGE , false ) ;
EXPECT_EQ ( BrowsingDataRemover : : REMOVE_LOCAL_STORAGE , GetRemovalMask ( ) ) ;
EXPECT_EQ ( BrowsingDataHelper : : UNPROTECTED_WEB , GetOriginTypeMask ( ) ) ;
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData ( ) ;
EXPECT_EQ ( removal_data . remove_mask , StoragePartition : : REMOVE_DATA_MASK_LOCAL_STORAGE ) ;
EXPECT_EQ ( removal_data . quota_storage_remove_mask , ~ StoragePartition : : QUOTA_MANAGED_STORAGE_MASK_PERSISTENT ) ;
EXPECT_EQ ( removal_data . remove_begin , GetBeginTime ( ) ) ;
EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin1 , mock_policy ( ) ) ) ;
EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin2 , mock_policy ( ) ) ) ;
EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin3 , mock_policy ( ) ) ) ;
EXPECT_FALSE ( removal_data . origin_matcher . Run ( kOriginExt , mock_policy ( ) ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int main ( int argc , char * argv [ ] ) {
int frame_cnt = 0 ;
FILE * infile = NULL ;
VpxVideoWriter * writers [ kNumEncoders ] ;
vpx_codec_ctx_t codec [ kNumEncoders ] ;
vpx_codec_enc_cfg_t cfg [ kNumEncoders ] ;
vpx_image_t raw [ kNumEncoders ] ;
const VpxInterface * const encoder = get_vpx_encoder_by_name ( "vp8" ) ;
const int arg_deadline = VPX_DL_REALTIME ;
int i ;
int width = 0 ;
int height = 0 ;
int frame_avail = 0 ;
int got_data = 0 ;
int show_psnr = 0 ;
uint64_t psnr_sse_total [ kNumEncoders ] = {
0 }
;
uint64_t psnr_samples_total [ kNumEncoders ] = {
0 }
;
double psnr_totals [ kNumEncoders ] [ 4 ] = {
{
0 , 0 }
}
;
int psnr_count [ kNumEncoders ] = {
0 }
;
unsigned int target_bitrate [ kNumEncoders ] = {
1000 , 500 , 100 }
;
const int framerate = 30 ;
vpx_rational_t dsf [ kNumEncoders ] = {
{
2 , 1 }
, {
2 , 1 }
, {
1 , 1 }
}
;
exec_name = argv [ 0 ] ;
if ( ! encoder ) die ( "Unsupported codec." ) ;
if ( argc != ( 5 + kNumEncoders ) ) die ( "Invalid number of input options." ) ;
printf ( "Using %s\n" , vpx_codec_iface_name ( encoder -> codec_interface ( ) ) ) ;
width = strtol ( argv [ 1 ] , NULL , 0 ) ;
height = strtol ( argv [ 2 ] , NULL , 0 ) ;
if ( width < 16 || width % 2 || height < 16 || height % 2 ) die ( "Invalid resolution: %ldx%ld" , width , height ) ;
if ( ! ( infile = fopen ( argv [ 3 ] , "rb" ) ) ) die ( "Failed to open %s for reading" , argv [ 3 ] ) ;
show_psnr = strtol ( argv [ kNumEncoders + 4 ] , NULL , 0 ) ;
for ( i = 0 ;
i < kNumEncoders ;
++ i ) {
vpx_codec_err_t res = vpx_codec_enc_config_default ( encoder -> codec_interface ( ) , & cfg [ i ] , 0 ) ;
if ( res != VPX_CODEC_OK ) {
printf ( "Failed to get config: %s\n" , vpx_codec_err_to_string ( res ) ) ;
return EXIT_FAILURE ;
}
}
cfg [ 0 ] . g_w = width ;
cfg [ 0 ] . g_h = height ;
cfg [ 0 ] . g_threads = 1 ;
cfg [ 0 ] . rc_dropframe_thresh = 30 ;
cfg [ 0 ] . rc_end_usage = VPX_CBR ;
cfg [ 0 ] . rc_resize_allowed = 0 ;
cfg [ 0 ] . rc_min_quantizer = 4 ;
cfg [ 0 ] . rc_max_quantizer = 56 ;
cfg [ 0 ] . rc_undershoot_pct = 98 ;
cfg [ 0 ] . rc_overshoot_pct = 100 ;
cfg [ 0 ] . rc_buf_initial_sz = 500 ;
cfg [ 0 ] . rc_buf_optimal_sz = 600 ;
cfg [ 0 ] . rc_buf_sz = 1000 ;
cfg [ 0 ] . g_error_resilient = 1 ;
cfg [ 0 ] . g_lag_in_frames = 0 ;
cfg [ 0 ] . kf_mode = VPX_KF_AUTO ;
cfg [ 0 ] . kf_min_dist = 3000 ;
cfg [ 0 ] . kf_max_dist = 3000 ;
cfg [ 0 ] . rc_target_bitrate = target_bitrate [ 0 ] ;
cfg [ 0 ] . g_timebase . num = 1 ;
cfg [ 0 ] . g_timebase . den = framerate ;
for ( i = 1 ;
i < kNumEncoders ;
++ i ) {
cfg [ i ] = cfg [ 0 ] ;
cfg [ i ] . g_threads = 1 ;
cfg [ i ] . rc_target_bitrate = target_bitrate [ i ] ;
{
unsigned int iw = cfg [ i - 1 ] . g_w * dsf [ i - 1 ] . den + dsf [ i - 1 ] . num - 1 ;
unsigned int ih = cfg [ i - 1 ] . g_h * dsf [ i - 1 ] . den + dsf [ i - 1 ] . num - 1 ;
cfg [ i ] . g_w = iw / dsf [ i - 1 ] . num ;
cfg [ i ] . g_h = ih / dsf [ i - 1 ] . num ;
}
if ( ( cfg [ i ] . g_w ) % 2 ) cfg [ i ] . g_w ++ ;
if ( ( cfg [ i ] . g_h ) % 2 ) cfg [ i ] . g_h ++ ;
}
for ( i = 0 ;
i < kNumEncoders ;
++ i ) {
VpxVideoInfo info = {
encoder -> fourcc , cfg [ i ] . g_w , cfg [ i ] . g_h , {
cfg [ i ] . g_timebase . num , cfg [ i ] . g_timebase . den }
}
;
if ( ! ( writers [ i ] = vpx_video_writer_open ( argv [ i + 4 ] , kContainerIVF , & info ) ) ) die ( "Failed to open %s for writing" , argv [ i + 4 ] ) ;
}
for ( i = 0 ;
i < kNumEncoders ;
++ i ) if ( ! vpx_img_alloc ( & raw [ i ] , VPX_IMG_FMT_I420 , cfg [ i ] . g_w , cfg [ i ] . g_h , 32 ) ) die ( "Failed to allocate image" , cfg [ i ] . g_w , cfg [ i ] . g_h ) ;
if ( vpx_codec_enc_init_multi ( & codec [ 0 ] , encoder -> codec_interface ( ) , & cfg [ 0 ] , kNumEncoders , show_psnr ? VPX_CODEC_USE_PSNR : 0 , & dsf [ 0 ] ) ) die_codec ( & codec [ 0 ] , "Failed to initialize encoder" ) ;
for ( i = 0 ;
i < kNumEncoders ;
i ++ ) {
if ( vpx_codec_control ( & codec [ i ] , VP8E_SET_CPUUSED , - 6 ) ) die_codec ( & codec [ i ] , "Failed to set cpu_used" ) ;
if ( vpx_codec_control ( & codec [ i ] , VP8E_SET_STATIC_THRESHOLD , 1 ) ) die_codec ( & codec [ i ] , "Failed to set static threshold" ) ;
if ( vpx_codec_control ( & codec [ 0 ] , VP8E_SET_NOISE_SENSITIVITY , i == 0 ) ) die_codec ( & codec [ 0 ] , "Failed to set noise_sensitivity" ) ;
}
frame_avail = 1 ;
got_data = 0 ;
while ( frame_avail || got_data ) {
vpx_codec_iter_t iter [ kNumEncoders ] = {
NULL }
;
const vpx_codec_cx_pkt_t * pkt [ kNumEncoders ] ;
frame_avail = vpx_img_read ( & raw [ 0 ] , infile ) ;
if ( frame_avail ) {
for ( i = 1 ;
i < kNumEncoders ;
++ i ) {
vpx_image_t * const prev = & raw [ i - 1 ] ;
I420Scale ( prev -> planes [ VPX_PLANE_Y ] , prev -> stride [ VPX_PLANE_Y ] , prev -> planes [ VPX_PLANE_U ] , prev -> stride [ VPX_PLANE_U ] , prev -> planes [ VPX_PLANE_V ] , prev -> stride [ VPX_PLANE_V ] , prev -> d_w , prev -> d_h , raw [ i ] . planes [ VPX_PLANE_Y ] , raw [ i ] . stride [ VPX_PLANE_Y ] , raw [ i ] . planes [ VPX_PLANE_U ] , raw [ i ] . stride [ VPX_PLANE_U ] , raw [ i ] . planes [ VPX_PLANE_V ] , raw [ i ] . stride [ VPX_PLANE_V ] , raw [ i ] . d_w , raw [ i ] . d_h , 1 ) ;
}
}
if ( vpx_codec_encode ( & codec [ 0 ] , frame_avail ? & raw [ 0 ] : NULL , frame_cnt , 1 , 0 , arg_deadline ) ) {
die_codec ( & codec [ 0 ] , "Failed to encode frame" ) ;
}
for ( i = kNumEncoders - 1 ;
i >= 0 ;
i -- ) {
got_data = 0 ;
while ( ( pkt [ i ] = vpx_codec_get_cx_data ( & codec [ i ] , & iter [ i ] ) ) ) {
got_data = 1 ;
switch ( pkt [ i ] -> kind ) {
case VPX_CODEC_CX_FRAME_PKT : vpx_video_writer_write_frame ( writers [ i ] , pkt [ i ] -> data . frame . buf , pkt [ i ] -> data . frame . sz , frame_cnt - 1 ) ;
break ;
case VPX_CODEC_PSNR_PKT : if ( show_psnr ) {
int j ;
psnr_sse_total [ i ] += pkt [ i ] -> data . psnr . sse [ 0 ] ;
psnr_samples_total [ i ] += pkt [ i ] -> data . psnr . samples [ 0 ] ;
for ( j = 0 ;
j < 4 ;
j ++ ) psnr_totals [ i ] [ j ] += pkt [ i ] -> data . psnr . psnr [ j ] ;
psnr_count [ i ] ++ ;
}
break ;
default : break ;
}
printf ( pkt [ i ] -> kind == VPX_CODEC_CX_FRAME_PKT && ( pkt [ i ] -> data . frame . flags & VPX_FRAME_IS_KEY ) ? "K" : "." ) ;
fflush ( stdout ) ;
}
}
frame_cnt ++ ;
}
printf ( "\n" ) ;
fclose ( infile ) ;
printf ( "Processed %d frames.\n" , frame_cnt - 1 ) ;
for ( i = 0 ;
i < kNumEncoders ;
++ i ) {
if ( show_psnr && psnr_count [ i ] > 0 ) {
int j ;
double ovpsnr = sse_to_psnr ( psnr_samples_total [ i ] , 255.0 , psnr_sse_total [ i ] ) ;
fprintf ( stderr , "\n ENC%d PSNR (Overall/Avg/Y/U/V)" , i ) ;
fprintf ( stderr , " %.3lf" , ovpsnr ) ;
for ( j = 0 ;
j < 4 ;
j ++ ) fprintf ( stderr , " %.3lf" , psnr_totals [ i ] [ j ] / psnr_count [ i ] ) ;
}
if ( vpx_codec_destroy ( & codec [ i ] ) ) die_codec ( & codec [ i ] , "Failed to destroy codec" ) ;
vpx_img_free ( & raw [ i ] ) ;
vpx_video_writer_close ( writers [ i ] ) ;
}
printf ( "\n" ) ;
return EXIT_SUCCESS ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | ArchiveHandle * CloneArchive ( ArchiveHandle * AH ) {
ArchiveHandle * clone ;
clone = ( ArchiveHandle * ) pg_malloc ( sizeof ( ArchiveHandle ) ) ;
memcpy ( clone , AH , sizeof ( ArchiveHandle ) ) ;
memset ( & ( clone -> sqlparse ) , 0 , sizeof ( clone -> sqlparse ) ) ;
clone -> connection = NULL ;
clone -> connCancel = NULL ;
clone -> currUser = NULL ;
clone -> currSchema = NULL ;
clone -> currTablespace = NULL ;
clone -> currWithOids = - 1 ;
if ( clone -> savedPassword ) clone -> savedPassword = pg_strdup ( clone -> savedPassword ) ;
clone -> public . n_errors = 0 ;
if ( AH -> mode == archModeRead ) {
RestoreOptions * ropt = AH -> public . ropt ;
Assert ( AH -> connection == NULL ) ;
ConnectDatabase ( ( Archive * ) clone , ropt -> dbname , ropt -> pghost , ropt -> pgport , ropt -> username , ropt -> promptPassword ) ;
_doSetFixedOutputState ( clone ) ;
}
else {
PQExpBufferData connstr ;
char * pghost ;
char * pgport ;
char * username ;
Assert ( AH -> connection != NULL ) ;
initPQExpBuffer ( & connstr ) ;
appendPQExpBuffer ( & connstr , "dbname=" ) ;
appendConnStrVal ( & connstr , PQdb ( AH -> connection ) ) ;
pghost = PQhost ( AH -> connection ) ;
pgport = PQport ( AH -> connection ) ;
username = PQuser ( AH -> connection ) ;
ConnectDatabase ( ( Archive * ) clone , connstr . data , pghost , pgport , username , TRI_NO ) ;
termPQExpBuffer ( & connstr ) ;
}
( clone -> ClonePtr ) ( clone ) ;
Assert ( clone -> connection != NULL ) ;
return clone ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static PHP_NAMED_FUNCTION ( zif_zip_entry_compressionmethod ) {
php_zip_entry_get_info ( INTERNAL_FUNCTION_PARAM_PASSTHRU , 3 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int sql_real_connect ( char * host , char * database , char * user , char * password , uint silent ) {
if ( connected ) {
connected = 0 ;
mysql_close ( & mysql ) ;
}
mysql_init ( & mysql ) ;
if ( opt_init_command ) mysql_options ( & mysql , MYSQL_INIT_COMMAND , opt_init_command ) ;
if ( opt_connect_timeout ) {
uint timeout = opt_connect_timeout ;
mysql_options ( & mysql , MYSQL_OPT_CONNECT_TIMEOUT , ( char * ) & timeout ) ;
}
if ( opt_compress ) mysql_options ( & mysql , MYSQL_OPT_COMPRESS , NullS ) ;
if ( opt_secure_auth ) mysql_options ( & mysql , MYSQL_SECURE_AUTH , ( char * ) & opt_secure_auth ) ;
if ( using_opt_local_infile ) mysql_options ( & mysql , MYSQL_OPT_LOCAL_INFILE , ( char * ) & opt_local_infile ) ;
# if defined ( HAVE_OPENSSL ) && ! defined ( EMBEDDED_LIBRARY ) if ( opt_use_ssl ) mysql_ssl_set ( & mysql , opt_ssl_key , opt_ssl_cert , opt_ssl_ca , opt_ssl_capath , opt_ssl_cipher ) ;
mysql_options ( & mysql , MYSQL_OPT_SSL_VERIFY_SERVER_CERT , ( char * ) & opt_ssl_verify_server_cert ) ;
# endif if ( opt_protocol ) mysql_options ( & mysql , MYSQL_OPT_PROTOCOL , ( char * ) & opt_protocol ) ;
# ifdef HAVE_SMEM if ( shared_memory_base_name ) mysql_options ( & mysql , MYSQL_SHARED_MEMORY_BASE_NAME , shared_memory_base_name ) ;
# endif if ( safe_updates ) {
char init_command [ 100 ] ;
sprintf ( init_command , "SET SQL_SAFE_UPDATES=1,SQL_SELECT_LIMIT=%lu,MAX_JOIN_SIZE=%lu" , select_limit , max_join_size ) ;
mysql_options ( & mysql , MYSQL_INIT_COMMAND , init_command ) ;
}
mysql_options ( & mysql , MYSQL_SET_CHARSET_NAME , default_charset ) ;
if ( opt_plugin_dir && * opt_plugin_dir ) mysql_options ( & mysql , MYSQL_PLUGIN_DIR , opt_plugin_dir ) ;
if ( opt_default_auth && * opt_default_auth ) mysql_options ( & mysql , MYSQL_DEFAULT_AUTH , opt_default_auth ) ;
if ( ! mysql_real_connect ( & mysql , host , user , password , database , opt_mysql_port , opt_mysql_unix_port , connect_flag | CLIENT_MULTI_STATEMENTS ) ) {
if ( ! silent || ( mysql_errno ( & mysql ) != CR_CONN_HOST_ERROR && mysql_errno ( & mysql ) != CR_CONNECTION_ERROR ) ) {
( void ) put_error ( & mysql ) ;
( void ) fflush ( stdout ) ;
return ignore_errors ? - 1 : 1 ;
}
return - 1 ;
}
charset_info = mysql . charset ;
connected = 1 ;
# ifndef EMBEDDED_LIBRARY mysql . reconnect = debug_info_flag ;
if ( mysql . client_flag & CLIENT_PROGRESS ) mysql_options ( & mysql , MYSQL_PROGRESS_CALLBACK , ( void * ) report_progress ) ;
# else mysql . reconnect = 1 ;
# endif # ifdef HAVE_READLINE build_completion_hash ( opt_rehash , 1 ) ;
# endif return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static FBuffer * cState_prepare_buffer ( VALUE self ) {
FBuffer * buffer ;
GET_STATE ( self ) ;
buffer = fbuffer_alloc ( state -> buffer_initial_length ) ;
if ( state -> object_delim ) {
fbuffer_clear ( state -> object_delim ) ;
}
else {
state -> object_delim = fbuffer_alloc ( 16 ) ;
}
fbuffer_append_char ( state -> object_delim , ',' ) ;
if ( state -> object_delim2 ) {
fbuffer_clear ( state -> object_delim2 ) ;
}
else {
state -> object_delim2 = fbuffer_alloc ( 16 ) ;
}
if ( state -> space_before ) fbuffer_append ( state -> object_delim2 , state -> space_before , state -> space_before_len ) ;
fbuffer_append_char ( state -> object_delim2 , ':' ) ;
if ( state -> space ) fbuffer_append ( state -> object_delim2 , state -> space , state -> space_len ) ;
if ( state -> array_delim ) {
fbuffer_clear ( state -> array_delim ) ;
}
else {
state -> array_delim = fbuffer_alloc ( 16 ) ;
}
fbuffer_append_char ( state -> array_delim , ',' ) ;
if ( state -> array_nl ) fbuffer_append ( state -> array_delim , state -> array_nl , state -> array_nl_len ) ;
return buffer ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_RegistrationRejectReason ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 679 "./asn1/h225/h225.cnf" gint32 value ;
h225_packet_info * h225_pi ;
h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h225_RegistrationRejectReason , RegistrationRejectReason_choice , & value ) ;
if ( h225_pi != NULL ) {
h225_pi -> reason = value ;
}
return offset ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | MIMEField * _mime_hdr_field_list_search_by_string ( MIMEHdrImpl * mh , const char * field_name_str , int field_name_len ) {
MIMEFieldBlockImpl * fblock ;
MIMEField * field , * too_far_field ;
ink_assert ( mh ) ;
for ( fblock = & ( mh -> m_first_fblock ) ;
fblock != nullptr ;
fblock = fblock -> m_next ) {
field = & ( fblock -> m_field_slots [ 0 ] ) ;
too_far_field = & ( fblock -> m_field_slots [ fblock -> m_freetop ] ) ;
while ( field < too_far_field ) {
if ( field -> is_live ( ) && ( field_name_len == field -> m_len_name ) && ( strncasecmp ( field -> m_ptr_name , field_name_str , field_name_len ) == 0 ) ) {
return field ;
}
++ field ;
}
}
return nullptr ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_V76ModeParameters ( 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_V76ModeParameters , V76ModeParameters_choice , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( WebFrameTest , ContextMenuDataSelectAll ) {
EXPECT_FALSE ( TestSelectAll ( "<textarea></textarea>" ) ) ;
EXPECT_TRUE ( TestSelectAll ( "<textarea>nonempty</textarea>" ) ) ;
EXPECT_FALSE ( TestSelectAll ( "<input>" ) ) ;
EXPECT_TRUE ( TestSelectAll ( "<input value='nonempty'>" ) ) ;
EXPECT_FALSE ( TestSelectAll ( "<div contenteditable></div>" ) ) ;
EXPECT_TRUE ( TestSelectAll ( "<div contenteditable>nonempty</div>" ) ) ;
EXPECT_TRUE ( TestSelectAll ( "<div contenteditable>\n</div>" ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | inline const OldUChar * toOldUCharPtr ( const char16_t * p ) {
# ifdef U_ALIASING_BARRIER U_ALIASING_BARRIER ( p ) ;
# endif return reinterpret_cast < const OldUChar * > ( p ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int32_t u_scanf_count_handler ( UFILE * input , u_scanf_spec_info * info , ufmt_args * args , const UChar * fmt , int32_t * fmtConsumed , int32_t * argConverted ) {
if ( ! info -> fSkipArg ) {
if ( info -> fIsShort ) * ( int16_t * ) ( args [ 0 ] . ptrValue ) = ( int16_t ) ( UINT16_MAX & info -> fWidth ) ;
else if ( info -> fIsLongLong ) * ( int64_t * ) ( args [ 0 ] . ptrValue ) = info -> fWidth ;
else * ( int32_t * ) ( args [ 0 ] . ptrValue ) = ( int32_t ) ( UINT32_MAX & info -> fWidth ) ;
}
* argConverted = 0 ;
return 0 ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | int event_priority_init ( int npriorities ) {
return event_base_priority_init ( current_base , npriorities ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | ssize_t e1000e_receive ( E1000ECore * core , const uint8_t * buf , size_t size ) {
const struct iovec iov = {
. iov_base = ( uint8_t * ) buf , . iov_len = size }
;
return e1000e_receive_iov ( core , & iov , 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void dissect_zcl_power_config_attr_data ( proto_tree * tree , tvbuff_t * tvb , guint * offset , guint16 attr_id , guint data_type ) {
proto_item * it ;
static const int * mains_alarm_mask [ ] = {
& hf_zbee_zcl_power_config_mains_alarm_mask_low , & hf_zbee_zcl_power_config_mains_alarm_mask_high , & hf_zbee_zcl_power_config_mains_alarm_mask_reserved , NULL }
;
static const int * batt_alarm_mask [ ] = {
& hf_zbee_zcl_power_config_batt_alarm_mask_low , & hf_zbee_zcl_power_config_batt_alarm_mask_reserved , NULL }
;
switch ( attr_id ) {
case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE : proto_tree_add_item ( tree , hf_zbee_zcl_power_config_mains_voltage , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
break ;
case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_FREQUENCY : proto_tree_add_item ( tree , hf_zbee_zcl_power_config_mains_frequency , tvb , * offset , 1 , ENC_LITTLE_ENDIAN ) ;
* offset += 1 ;
break ;
case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_ALARM_MASK : proto_tree_add_bitmask ( tree , tvb , * offset , hf_zbee_zcl_power_config_mains_alarm_mask , ett_zbee_zcl_power_config_mains_alarm_mask , mains_alarm_mask , ENC_LITTLE_ENDIAN ) ;
* offset += 1 ;
break ;
case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MIN_THR : proto_tree_add_item ( tree , hf_zbee_zcl_power_config_mains_voltage_min_thr , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
break ;
case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_MAX_THR : proto_tree_add_item ( tree , hf_zbee_zcl_power_config_mains_voltage_max_thr , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
break ;
case ZBEE_ZCL_ATTR_ID_POWER_CONF_MAINS_VOLTAGE_DWELL_TP : it = proto_tree_add_item ( tree , hf_zbee_zcl_power_config_mains_voltage_dwell_tp , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
proto_item_append_text ( it , " [s]" ) ;
* offset += 2 ;
break ;
case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_SIZE : proto_tree_add_item ( tree , hf_zbee_zcl_power_config_batt_type , tvb , * offset , 1 , ENC_LITTLE_ENDIAN ) ;
* offset += 1 ;
break ;
case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE : proto_tree_add_item ( tree , hf_zbee_zcl_power_config_batt_voltage , tvb , * offset , 1 , ENC_LITTLE_ENDIAN ) ;
* offset += 1 ;
break ;
case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_AH_RATING : proto_tree_add_item ( tree , hf_zbee_zcl_power_config_batt_ah_rating , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
break ;
case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_RATED_VOLTAGE : proto_tree_add_item ( tree , hf_zbee_zcl_power_config_batt_rated_voltage , tvb , * offset , 1 , ENC_LITTLE_ENDIAN ) ;
* offset += 1 ;
break ;
case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_ALARM_MASK : proto_tree_add_bitmask ( tree , tvb , * offset , hf_zbee_zcl_power_config_batt_alarm_mask , ett_zbee_zcl_power_config_batt_alarm_mask , batt_alarm_mask , ENC_LITTLE_ENDIAN ) ;
* offset += 1 ;
break ;
case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_VOLTAGE_MIN_THR : proto_tree_add_item ( tree , hf_zbee_zcl_power_config_batt_voltage_min_thr , tvb , * offset , 1 , ENC_LITTLE_ENDIAN ) ;
* offset += 1 ;
break ;
case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_MANUFACTURER : case ZBEE_ZCL_ATTR_ID_POWER_CONF_BATTERY_QUANTITY : default : dissect_zcl_attr_data ( tvb , tree , offset , data_type ) ;
break ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void MaxpFromTable ( struct alltabs * at , SplineFont * sf ) {
struct ttf_table * maxp ;
maxp = SFFindTable ( sf , CHR ( 'm' , 'a' , 'x' , 'p' ) ) ;
if ( maxp == NULL && sf -> mm != NULL && sf -> mm -> apple ) maxp = SFFindTable ( sf -> mm -> normal , CHR ( 'm' , 'a' , 'x' , 'p' ) ) ;
if ( maxp == NULL || maxp -> len < 13 * sizeof ( uint16 ) ) return ;
at -> maxp . maxZones = memushort ( maxp -> data , maxp -> len , 7 * sizeof ( uint16 ) ) ;
at -> maxp . maxTwilightPts = memushort ( maxp -> data , maxp -> len , 8 * sizeof ( uint16 ) ) ;
at -> maxp . maxStorage = memushort ( maxp -> data , maxp -> len , 9 * sizeof ( uint16 ) ) ;
at -> maxp . maxFDEFs = memushort ( maxp -> data , maxp -> len , 10 * sizeof ( uint16 ) ) ;
at -> maxp . maxIDEFs = memushort ( maxp -> data , maxp -> len , 11 * sizeof ( uint16 ) ) ;
at -> maxp . maxStack = memushort ( maxp -> data , maxp -> len , 12 * sizeof ( uint16 ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void evhttp_request_set_chunked_cb ( struct evhttp_request * req , void ( * cb ) ( struct evhttp_request * , void * ) ) {
req -> chunk_cb = cb ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int kvm_get_mp_state ( X86CPU * cpu ) {
CPUState * cs = CPU ( cpu ) ;
CPUX86State * env = & cpu -> env ;
struct kvm_mp_state mp_state ;
int ret ;
ret = kvm_vcpu_ioctl ( cs , KVM_GET_MP_STATE , & mp_state ) ;
if ( ret < 0 ) {
return ret ;
}
env -> mp_state = mp_state . mp_state ;
if ( kvm_irqchip_in_kernel ( ) ) {
cs -> halted = ( mp_state . mp_state == KVM_MP_STATE_HALTED ) ;
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_pvfs2_mgmt_setparam_request ( tvbuff_t * tvb , proto_tree * tree , int offset , packet_info * pinfo ) {
offset = dissect_pvfs_fs_id ( tvb , tree , offset ) ;
offset = dissect_pvfs_server_param ( tvb , tree , offset , pinfo ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | REGRESSION_TEST ( SDK_API_OVERRIDABLE_CONFIGS ) ( RegressionTest * test , int , int * pstatus ) {
const char * conf ;
TSOverridableConfigKey key ;
TSRecordDataType type ;
HttpSM * s = HttpSM : : allocate ( ) ;
bool success = true ;
TSHttpTxn txnp = reinterpret_cast < TSHttpTxn > ( s ) ;
InkRand generator ( 17 ) ;
TSMgmtInt ival_read , ival_rand ;
TSMgmtFloat fval_read , fval_rand ;
const char * sval_read ;
const char * test_string = "The Apache Traffic Server" ;
int len ;
s -> init ( ) ;
* pstatus = REGRESSION_TEST_INPROGRESS ;
for ( int i = TS_CONFIG_NULL + 1 ;
i < TS_CONFIG_LAST_ENTRY ;
++ i ) {
conf = SDK_Overridable_Configs [ i ] ;
if ( TS_SUCCESS == TSHttpTxnConfigFind ( conf , - 1 , & key , & type ) ) {
if ( key != i ) {
SDK_RPRINT ( test , "TSHttpTxnConfigFind" , "TestCase1" , TC_FAIL , "Failed on %s, expected %d, got %d" , conf , i , key ) ;
success = false ;
continue ;
}
}
else {
SDK_RPRINT ( test , "TSHttpTxnConfigFind" , "TestCase1" , TC_FAIL , "Call returned unexpected TS_ERROR for %s" , conf ) ;
success = false ;
continue ;
}
switch ( type ) {
case TS_RECORDDATATYPE_INT : ival_rand = generator . random ( ) % 126 ;
TSHttpTxnConfigIntSet ( txnp , key , ival_rand ) ;
TSHttpTxnConfigIntGet ( txnp , key , & ival_read ) ;
if ( ival_rand != ival_read ) {
SDK_RPRINT ( test , "TSHttpTxnConfigIntSet" , "TestCase1" , TC_FAIL , "Failed on %s, %d != %d" , conf , ival_read , ival_rand ) ;
success = false ;
continue ;
}
break ;
case TS_RECORDDATATYPE_FLOAT : fval_rand = generator . random ( ) ;
TSHttpTxnConfigFloatSet ( txnp , key , fval_rand ) ;
TSHttpTxnConfigFloatGet ( txnp , key , & fval_read ) ;
if ( fval_rand != fval_read ) {
SDK_RPRINT ( test , "TSHttpTxnConfigFloatSet" , "TestCase1" , TC_FAIL , "Failed on %s, %f != %f" , conf , fval_read , fval_rand ) ;
success = false ;
continue ;
}
break ;
case TS_RECORDDATATYPE_STRING : TSHttpTxnConfigStringSet ( txnp , key , test_string , - 1 ) ;
TSHttpTxnConfigStringGet ( txnp , key , & sval_read , & len ) ;
if ( test_string != sval_read ) {
SDK_RPRINT ( test , "TSHttpTxnConfigStringSet" , "TestCase1" , TC_FAIL , "Failed on %s, %s != %s" , conf , sval_read , test_string ) ;
success = false ;
continue ;
}
break ;
default : break ;
}
}
s -> destroy ( ) ;
if ( success ) {
* pstatus = REGRESSION_TEST_PASSED ;
SDK_RPRINT ( test , "TSHttpTxnConfigFind" , "TestCase1" , TC_PASS , "ok" ) ;
SDK_RPRINT ( test , "TSHttpTxnConfigIntSet" , "TestCase1" , TC_PASS , "ok" ) ;
SDK_RPRINT ( test , "TSHttpTxnConfigFloatSet" , "TestCase1" , TC_PASS , "ok" ) ;
SDK_RPRINT ( test , "TSHttpTxnConfigStringSet" , "TestCase1" , TC_PASS , "ok" ) ;
}
else {
* pstatus = REGRESSION_TEST_FAILED ;
}
return ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_BandwidthRequest ( 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_h225_BandwidthRequest , BandwidthRequest_sequence ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_rsl_ie_nch_drx ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset , gboolean is_mandatory ) {
proto_tree * ie_tree ;
guint8 ie_id ;
if ( is_mandatory == FALSE ) {
ie_id = tvb_get_guint8 ( tvb , offset ) ;
if ( ie_id != RSL_IE_NCH_DRX_INF ) return offset ;
}
ie_tree = proto_tree_add_subtree ( tree , tvb , offset , 2 , ett_ie_nch_drx , NULL , "NCH DRX information IE" ) ;
proto_tree_add_item ( ie_tree , hf_rsl_ie_id , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
offset ++ ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void get_rela_elf32 ( Dwarf_Small * data , unsigned int i , int endianness , int machine , struct Dwarf_Elf_Rela * relap ) {
Elf32_Rela * relp = ( Elf32_Rela * ) ( data + ( i * sizeof ( Elf32_Rela ) ) ) ;
relap -> r_offset = relp -> r_offset ;
relap -> r_type = ELF32_R_TYPE ( relp -> r_info ) ;
relap -> r_symidx = ELF32_R_SYM ( relp -> r_info ) ;
relap -> r_addend = relp -> r_addend ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | gpg_error_t keydb_delete_keyblock ( KEYDB_HANDLE hd ) {
gpg_error_t rc ;
if ( ! hd ) return gpg_error ( GPG_ERR_INV_ARG ) ;
keyblock_cache_clear ( ) ;
if ( hd -> found < 0 || hd -> found >= hd -> used ) return gpg_error ( GPG_ERR_VALUE_NOT_FOUND ) ;
if ( opt . dry_run ) return 0 ;
rc = lock_all ( hd ) ;
if ( rc ) return rc ;
switch ( hd -> active [ hd -> found ] . type ) {
case KEYDB_RESOURCE_TYPE_NONE : rc = gpg_error ( GPG_ERR_GENERAL ) ;
break ;
case KEYDB_RESOURCE_TYPE_KEYRING : rc = keyring_delete_keyblock ( hd -> active [ hd -> found ] . u . kr ) ;
break ;
case KEYDB_RESOURCE_TYPE_KEYBOX : rc = keybox_delete ( hd -> active [ hd -> found ] . u . kb ) ;
break ;
}
unlock_all ( hd ) ;
return rc ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int gx_device_open_output_file ( const gx_device * dev , char * fname , bool binary , bool positionable , FILE * * pfile ) {
gs_parsed_file_name_t parsed ;
const char * fmt ;
char * pfname = ( char * ) gs_alloc_bytes ( dev -> memory , gp_file_name_sizeof , "gx_device_open_output_file(pfname)" ) ;
int code ;
if ( pfname == NULL ) {
code = gs_note_error ( gs_error_VMerror ) ;
goto done ;
}
if ( strlen ( fname ) == 0 ) {
code = gs_note_error ( gs_error_undefinedfilename ) ;
emprintf1 ( dev -> memory , "Device '%s' requires an output file but no file was specified.\n" , dev -> dname ) ;
goto done ;
}
code = gx_parse_output_file_name ( & parsed , & fmt , fname , strlen ( fname ) , dev -> memory ) ;
if ( code < 0 ) {
goto done ;
}
if ( parsed . iodev && ! strcmp ( parsed . iodev -> dname , "%stdout%" ) ) {
if ( parsed . fname ) {
code = gs_note_error ( gs_error_undefinedfilename ) ;
goto done ;
}
* pfile = dev -> memory -> gs_lib_ctx -> fstdout ;
code = gp_setmode_binary ( * pfile , true ) ;
goto done ;
}
else if ( parsed . iodev && ! strcmp ( parsed . iodev -> dname , "%pipe%" ) ) {
positionable = false ;
}
if ( fmt ) {
long count1 = dev -> PageCount + 1 ;
while ( * fmt != 'l' && * fmt != '%' ) -- fmt ;
if ( * fmt == 'l' ) gs_sprintf ( pfname , parsed . fname , count1 ) ;
else gs_sprintf ( pfname , parsed . fname , ( int ) count1 ) ;
}
else if ( parsed . len && strchr ( parsed . fname , '%' ) ) gs_sprintf ( pfname , parsed . fname ) ;
else pfname [ 0 ] = 0 ;
if ( pfname [ 0 ] ) {
parsed . fname = pfname ;
parsed . len = strlen ( parsed . fname ) ;
}
if ( positionable || ( parsed . iodev && parsed . iodev != iodev_default ( dev -> memory ) ) ) {
char fmode [ 4 ] ;
if ( ! parsed . fname ) {
code = gs_note_error ( gs_error_undefinedfilename ) ;
goto done ;
}
strcpy ( fmode , gp_fmode_wb ) ;
if ( positionable ) strcat ( fmode , "+" ) ;
code = parsed . iodev -> procs . gp_fopen ( parsed . iodev , parsed . fname , fmode , pfile , NULL , 0 ) ;
if ( code ) emprintf1 ( dev -> memory , "**** Could not open the file %s .\n" , parsed . fname ) ;
}
else {
* pfile = gp_open_printer ( dev -> memory , ( pfname [ 0 ] ? pfname : fname ) , binary ) ;
if ( ! ( * pfile ) ) {
emprintf1 ( dev -> memory , "**** Could not open the file '%s'.\n" , ( pfname [ 0 ] ? pfname : fname ) ) ;
code = gs_note_error ( gs_error_invalidfileaccess ) ;
}
}
done : if ( pfname != NULL ) gs_free_object ( dev -> memory , pfname , "gx_device_open_output_file(pfname)" ) ;
return ( code ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void _UTF16BEToUnicodeWithOffsets ( UConverterToUnicodeArgs * pArgs , UErrorCode * pErrorCode ) {
UConverter * cnv ;
const uint8_t * source ;
UChar * target ;
int32_t * offsets ;
uint32_t targetCapacity , length , count , sourceIndex ;
UChar c , trail ;
if ( pArgs -> converter -> mode < 8 ) {
_UTF16ToUnicodeWithOffsets ( pArgs , pErrorCode ) ;
return ;
}
cnv = pArgs -> converter ;
source = ( const uint8_t * ) pArgs -> source ;
length = ( int32_t ) ( ( const uint8_t * ) pArgs -> sourceLimit - source ) ;
if ( length <= 0 && cnv -> toUnicodeStatus == 0 ) {
return ;
}
target = pArgs -> target ;
if ( target >= pArgs -> targetLimit ) {
* pErrorCode = U_BUFFER_OVERFLOW_ERROR ;
return ;
}
targetCapacity = ( uint32_t ) ( pArgs -> targetLimit - target ) ;
offsets = pArgs -> offsets ;
sourceIndex = 0 ;
c = 0 ;
if ( cnv -> toUnicodeStatus != 0 ) {
cnv -> toUBytes [ 0 ] = ( uint8_t ) cnv -> toUnicodeStatus ;
cnv -> toULength = 1 ;
cnv -> toUnicodeStatus = 0 ;
}
if ( ( count = cnv -> toULength ) != 0 ) {
uint8_t * p = cnv -> toUBytes ;
do {
p [ count ++ ] = * source ++ ;
++ sourceIndex ;
-- length ;
if ( count == 2 ) {
c = ( ( UChar ) p [ 0 ] << 8 ) | p [ 1 ] ;
if ( U16_IS_SINGLE ( c ) ) {
* target ++ = c ;
if ( offsets != NULL ) {
* offsets ++ = - 1 ;
}
-- targetCapacity ;
count = 0 ;
c = 0 ;
break ;
}
else if ( U16_IS_SURROGATE_LEAD ( c ) ) {
c = 0 ;
}
else {
break ;
}
}
else if ( count == 4 ) {
c = ( ( UChar ) p [ 0 ] << 8 ) | p [ 1 ] ;
trail = ( ( UChar ) p [ 2 ] << 8 ) | p [ 3 ] ;
if ( U16_IS_TRAIL ( trail ) ) {
* target ++ = c ;
if ( targetCapacity >= 2 ) {
* target ++ = trail ;
if ( offsets != NULL ) {
* offsets ++ = - 1 ;
* offsets ++ = - 1 ;
}
targetCapacity -= 2 ;
}
else {
targetCapacity = 0 ;
cnv -> UCharErrorBuffer [ 0 ] = trail ;
cnv -> UCharErrorBufferLength = 1 ;
* pErrorCode = U_BUFFER_OVERFLOW_ERROR ;
}
count = 0 ;
c = 0 ;
break ;
}
else {
* pErrorCode = U_ILLEGAL_CHAR_FOUND ;
if ( ( ( const uint8_t * ) pArgs -> source - source ) >= 2 ) {
source -= 2 ;
}
else {
cnv -> toUnicodeStatus = 0x100 | p [ 2 ] ;
-- source ;
}
cnv -> toULength = 2 ;
pArgs -> source = ( const char * ) source ;
pArgs -> target = target ;
pArgs -> offsets = offsets ;
return ;
}
}
}
while ( length > 0 ) ;
cnv -> toULength = ( int8_t ) count ;
}
count = 2 * targetCapacity ;
if ( count > length ) {
count = length & ~ 1 ;
}
if ( c == 0 && count > 0 ) {
length -= count ;
count >>= 1 ;
targetCapacity -= count ;
if ( offsets == NULL ) {
do {
c = ( ( UChar ) source [ 0 ] << 8 ) | source [ 1 ] ;
source += 2 ;
if ( U16_IS_SINGLE ( c ) ) {
* target ++ = c ;
}
else if ( U16_IS_SURROGATE_LEAD ( c ) && count >= 2 && U16_IS_TRAIL ( trail = ( ( UChar ) source [ 0 ] << 8 ) | source [ 1 ] ) ) {
source += 2 ;
-- count ;
* target ++ = c ;
* target ++ = trail ;
}
else {
break ;
}
}
while ( -- count > 0 ) ;
}
else {
do {
c = ( ( UChar ) source [ 0 ] << 8 ) | source [ 1 ] ;
source += 2 ;
if ( U16_IS_SINGLE ( c ) ) {
* target ++ = c ;
* offsets ++ = sourceIndex ;
sourceIndex += 2 ;
}
else if ( U16_IS_SURROGATE_LEAD ( c ) && count >= 2 && U16_IS_TRAIL ( trail = ( ( UChar ) source [ 0 ] << 8 ) | source [ 1 ] ) ) {
source += 2 ;
-- count ;
* target ++ = c ;
* target ++ = trail ;
* offsets ++ = sourceIndex ;
* offsets ++ = sourceIndex ;
sourceIndex += 4 ;
}
else {
break ;
}
}
while ( -- count > 0 ) ;
}
if ( count == 0 ) {
c = 0 ;
}
else {
length += 2 * ( count - 1 ) ;
targetCapacity += count ;
}
}
if ( c != 0 ) {
cnv -> toUBytes [ 0 ] = ( uint8_t ) ( c >> 8 ) ;
cnv -> toUBytes [ 1 ] = ( uint8_t ) c ;
cnv -> toULength = 2 ;
if ( U16_IS_SURROGATE_LEAD ( c ) ) {
if ( length >= 2 ) {
if ( U16_IS_TRAIL ( trail = ( ( UChar ) source [ 0 ] << 8 ) | source [ 1 ] ) ) {
source += 2 ;
length -= 2 ;
* target ++ = c ;
if ( offsets != NULL ) {
* offsets ++ = sourceIndex ;
}
cnv -> UCharErrorBuffer [ 0 ] = trail ;
cnv -> UCharErrorBufferLength = 1 ;
cnv -> toULength = 0 ;
* pErrorCode = U_BUFFER_OVERFLOW_ERROR ;
}
else {
* pErrorCode = U_ILLEGAL_CHAR_FOUND ;
}
}
else {
}
}
else {
* pErrorCode = U_ILLEGAL_CHAR_FOUND ;
}
}
if ( U_SUCCESS ( * pErrorCode ) ) {
if ( length > 0 ) {
if ( targetCapacity == 0 ) {
* pErrorCode = U_BUFFER_OVERFLOW_ERROR ;
}
else {
cnv -> toUBytes [ cnv -> toULength ++ ] = * source ++ ;
}
}
}
pArgs -> source = ( const char * ) source ;
pArgs -> target = target ;
pArgs -> offsets = offsets ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static CURLcode expect100 ( struct Curl_easy * data , struct connectdata * conn , Curl_send_buffer * req_buffer ) {
CURLcode result = CURLE_OK ;
const char * ptr ;
data -> state . expect100header = FALSE ;
if ( use_http_1_1plus ( data , conn ) && ( conn -> httpversion != 20 ) ) {
ptr = Curl_checkheaders ( conn , "Expect:" ) ;
if ( ptr ) {
data -> state . expect100header = Curl_compareheader ( ptr , "Expect:" , "100-continue" ) ;
}
else {
result = Curl_add_bufferf ( req_buffer , "Expect: 100-continue\r\n" ) ;
if ( ! result ) data -> state . expect100header = TRUE ;
}
}
return result ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_FastStart_item ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 272 "./asn1/h225/h225.cnf" tvbuff_t * value_tvb = NULL ;
char codec_str [ 50 ] ;
h225_packet_info * h225_pi ;
codec_str [ 0 ] = '\0' ;
offset = dissect_per_octet_string ( tvb , offset , actx , tree , hf_index , NO_BOUND , NO_BOUND , FALSE , & value_tvb ) ;
if ( value_tvb && tvb_reported_length ( value_tvb ) ) {
dissect_h245_FastStart_OLC ( value_tvb , actx -> pinfo , tree , codec_str ) ;
}
h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
if ( h225_pi != NULL ) {
char temp [ 50 ] ;
g_snprintf ( temp , 50 , "%s %s" , h225_pi -> frame_label , codec_str ) ;
g_strlcpy ( h225_pi -> frame_label , temp , 50 ) ;
h225_pi -> is_faststart = TRUE ;
}
contains_faststart = TRUE ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | proto_item * proto_tree_add_bytes_item ( proto_tree * tree , int hfindex , tvbuff_t * tvb , const gint start , gint length , const guint encoding , GByteArray * retval , gint * endoff , gint * err ) {
field_info * new_fi ;
GByteArray * bytes = retval ;
GByteArray * created_bytes = NULL ;
gint saved_err = 0 ;
guint32 n = 0 ;
header_field_info * hfinfo ;
gboolean generate = ( bytes || tree ) ? TRUE : FALSE ;
PROTO_REGISTRAR_GET_NTH ( hfindex , hfinfo ) ;
DISSECTOR_ASSERT_HINT ( hfinfo != NULL , "Not passed hfi!" ) ;
DISSECTOR_ASSERT_HINT ( validate_proto_tree_add_bytes_ftype ( hfinfo -> type ) , "Called proto_tree_add_bytes_item but not a bytes-based FT_XXX type" ) ;
if ( length < - 1 || length == 0 ) {
REPORT_DISSECTOR_BUG ( wmem_strdup_printf ( wmem_packet_scope ( ) , "Invalid length %d passed to proto_tree_add_bytes_item for %s" , length , ftype_name ( hfinfo -> type ) ) ) ;
}
if ( encoding & ENC_STR_NUM ) {
REPORT_DISSECTOR_BUG ( "Decoding number strings for byte arrays is not supported" ) ;
}
if ( generate && ( encoding & ENC_STR_HEX ) ) {
if ( hfinfo -> type == FT_UINT_BYTES ) {
REPORT_DISSECTOR_BUG ( "proto_tree_add_bytes_item called for " "FT_UINT_BYTES type, but as ENC_STR_HEX" ) ;
}
if ( ! bytes ) {
bytes = created_bytes = g_byte_array_new ( ) ;
}
bytes = tvb_get_string_bytes ( tvb , start , length , encoding , bytes , endoff ) ;
saved_err = errno ;
}
else if ( generate ) {
tvb_ensure_bytes_exist ( tvb , start , length ) ;
if ( ! bytes ) {
bytes = created_bytes = g_byte_array_new ( ) ;
}
if ( hfinfo -> type == FT_UINT_BYTES ) {
n = length ;
length = get_uint_value ( tree , tvb , start , n , encoding ) ;
g_byte_array_append ( bytes , tvb_get_ptr ( tvb , start + n , length ) , length ) ;
}
else if ( length > 0 ) {
g_byte_array_append ( bytes , tvb_get_ptr ( tvb , start , length ) , length ) ;
}
if ( endoff ) * endoff = start + n + length ;
}
if ( err ) * err = saved_err ;
CHECK_FOR_NULL_TREE_AND_FREE ( tree , {
if ( created_bytes ) g_byte_array_free ( created_bytes , TRUE ) ;
created_bytes = NULL ;
bytes = NULL ;
}
) ;
TRY_TO_FAKE_THIS_ITEM_OR_FREE ( tree , hfinfo -> id , hfinfo , {
if ( created_bytes ) g_byte_array_free ( created_bytes , TRUE ) ;
created_bytes = NULL ;
bytes = NULL ;
}
) ;
new_fi = new_field_info ( tree , hfinfo , tvb , start , n + length ) ;
if ( encoding & ENC_STRING ) {
if ( saved_err == ERANGE ) expert_add_info ( NULL , tree , & ei_number_string_decoding_erange_error ) ;
else if ( ! bytes || saved_err != 0 ) expert_add_info ( NULL , tree , & ei_number_string_decoding_failed_error ) ;
if ( bytes ) proto_tree_set_bytes_gbytearray ( new_fi , bytes ) ;
else proto_tree_set_bytes ( new_fi , NULL , 0 ) ;
if ( created_bytes ) g_byte_array_free ( created_bytes , TRUE ) ;
}
else {
proto_tree_set_bytes_tvb ( new_fi , tvb , start + n , length ) ;
FI_SET_FLAG ( new_fi , ( encoding & ENC_LITTLE_ENDIAN ) ? FI_LITTLE_ENDIAN : FI_BIG_ENDIAN ) ;
}
return proto_tree_add_node ( tree , new_fi ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static const char * unsigned64_avp ( diam_ctx_t * c , diam_avp_t * a , tvbuff_t * tvb , diam_sub_dis_t * diam_sub_dis_inf _U_ ) {
char * label = NULL ;
proto_item * pi ;
gint length = tvb_reported_length ( tvb ) ;
if ( length == 8 ) {
if ( c -> tree ) {
pi = proto_tree_add_item ( c -> tree , a -> hf_value , tvb , 0 , length , ENC_BIG_ENDIAN ) ;
label = ( char * ) wmem_alloc ( wmem_packet_scope ( ) , ITEM_LABEL_LENGTH + 1 ) ;
proto_item_fill_label ( PITEM_FINFO ( pi ) , label ) ;
label = strstr ( label , ": " ) + 2 ;
}
}
else {
pi = proto_tree_add_bytes_format ( c -> tree , hf_diameter_avp_data_wrong_length , tvb , 0 , length , NULL , "Error! Bad Unsigned64 Length" ) ;
expert_add_info_format ( c -> pinfo , pi , & ei_diameter_avp_len , "Bad Unsigned64 Length (%u)" , length ) ;
PROTO_ITEM_SET_GENERATED ( pi ) ;
}
return label ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void var_filter_block2d_bil_w8 ( const uint8_t * src_ptr , uint8_t * output_ptr , unsigned int src_pixels_per_line , int pixel_step , unsigned int output_height , unsigned int output_width , const uint16_t * vpx_filter ) {
const uint8x8_t f0 = vmov_n_u8 ( ( uint8_t ) vpx_filter [ 0 ] ) ;
const uint8x8_t f1 = vmov_n_u8 ( ( uint8_t ) vpx_filter [ 1 ] ) ;
unsigned int i ;
for ( i = 0 ;
i < output_height ;
++ i ) {
const uint8x8_t src_0 = vld1_u8 ( & src_ptr [ 0 ] ) ;
const uint8x8_t src_1 = vld1_u8 ( & src_ptr [ pixel_step ] ) ;
const uint16x8_t a = vmull_u8 ( src_0 , f0 ) ;
const uint16x8_t b = vmlal_u8 ( a , src_1 , f1 ) ;
const uint8x8_t out = vrshrn_n_u16 ( b , FILTER_BITS ) ;
vst1_u8 ( & output_ptr [ 0 ] , out ) ;
src_ptr += src_pixels_per_line ;
output_ptr += output_width ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void std_conv_color ( fz_context * ctx , fz_color_converter * cc , float * dstv , const float * srcv ) {
float rgb [ 3 ] ;
int i ;
const fz_colorspace * srcs = cc -> ss ;
const fz_colorspace * dsts = cc -> ds ;
if ( srcs == NULL ) srcs = fz_device_rgb ( ctx ) ;
if ( dsts == NULL ) dsts = fz_device_rgb ( ctx ) ;
if ( srcs != dsts ) {
assert ( srcs -> to_ccs && dsts -> from_ccs ) ;
srcs -> to_ccs ( ctx , srcs , srcv , rgb ) ;
dsts -> from_ccs ( ctx , dsts , rgb , dstv ) ;
for ( i = 0 ;
i < dsts -> n ;
i ++ ) dstv [ i ] = fz_clamp ( dstv [ i ] , 0 , 1 ) ;
}
else {
for ( i = 0 ;
i < srcs -> n ;
i ++ ) dstv [ i ] = srcv [ i ] ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static spl_filesystem_object * spl_filesystem_object_create_info ( spl_filesystem_object * source , char * file_path , int file_path_len , int use_copy , zend_class_entry * ce , zval * return_value TSRMLS_DC ) {
spl_filesystem_object * intern ;
zval * arg1 ;
zend_error_handling error_handling ;
if ( ! file_path || ! file_path_len ) {
# if defined ( PHP_WIN32 ) zend_throw_exception_ex ( spl_ce_RuntimeException , 0 TSRMLS_CC , "Cannot create SplFileInfo for empty path" ) ;
if ( file_path && ! use_copy ) {
efree ( file_path ) ;
}
# else if ( file_path && ! use_copy ) {
efree ( file_path ) ;
}
file_path_len = 1 ;
file_path = "/" ;
# endif return NULL ;
}
zend_replace_error_handling ( EH_THROW , spl_ce_RuntimeException , & error_handling TSRMLS_CC ) ;
ce = ce ? ce : source -> info_class ;
zend_update_class_constants ( ce TSRMLS_CC ) ;
return_value -> value . obj = spl_filesystem_object_new_ex ( ce , & intern TSRMLS_CC ) ;
Z_TYPE_P ( return_value ) = IS_OBJECT ;
if ( ce -> constructor -> common . scope != spl_ce_SplFileInfo ) {
MAKE_STD_ZVAL ( arg1 ) ;
ZVAL_STRINGL ( arg1 , file_path , file_path_len , use_copy ) ;
zend_call_method_with_1_params ( & return_value , ce , & ce -> constructor , "__construct" , NULL , arg1 ) ;
zval_ptr_dtor ( & arg1 ) ;
}
else {
spl_filesystem_info_set_filename ( intern , file_path , file_path_len , use_copy TSRMLS_CC ) ;
}
zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
return intern ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int type_size_sort ( const void * _a , const void * _b ) {
const struct object_entry * a = * ( struct object_entry * * ) _a ;
const struct object_entry * b = * ( struct object_entry * * ) _b ;
if ( a -> type > b -> type ) return - 1 ;
if ( a -> type < b -> type ) return 1 ;
if ( a -> hash > b -> hash ) return - 1 ;
if ( a -> hash < b -> hash ) return 1 ;
if ( a -> preferred_base > b -> preferred_base ) return - 1 ;
if ( a -> preferred_base < b -> preferred_base ) return 1 ;
if ( a -> size > b -> size ) return - 1 ;
if ( a -> size < b -> size ) return 1 ;
return a < b ? - 1 : ( a > b ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static guint16 de_ciph_key_seq_num ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len _U_ , gchar * add_string _U_ , int string_len _U_ ) {
guint32 curr_offset , bit_offset ;
curr_offset = offset ;
if ( RIGHT_NIBBLE == len ) bit_offset = 4 ;
else bit_offset = 0 ;
proto_tree_add_bits_item ( tree , hf_gsm_a_spare_bits , tvb , ( curr_offset << 3 ) + bit_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_bits_item ( tree , hf_gsm_a_key_seq , tvb , ( curr_offset << 3 ) + bit_offset + 1 , 3 , ENC_BIG_ENDIAN ) ;
curr_offset ++ ;
return ( curr_offset - offset ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void msc_alert ( modsec_rec * msr , int level , msre_actionset * actionset , const char * action_message , const char * rule_message ) {
const char * message = msc_alert_message ( msr , actionset , action_message , rule_message ) ;
msr_log ( msr , level , "%s" , message ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void init_t38_info_conv ( packet_info * pinfo ) {
t38_info_current ++ ;
if ( t38_info_current == MAX_T38_MESSAGES_IN_PACKET ) {
t38_info_current = 0 ;
}
t38_info = & t38_info_arr [ t38_info_current ] ;
t38_info -> seq_num = 0 ;
t38_info -> type_msg = 0 ;
t38_info -> data_value = 0 ;
t38_info -> t30ind_value = 0 ;
t38_info -> setup_frame_number = 0 ;
t38_info -> Data_Field_field_type_value = 0 ;
t38_info -> desc [ 0 ] = '\0' ;
t38_info -> desc_comment [ 0 ] = '\0' ;
t38_info -> time_first_t4_data = 0 ;
t38_info -> frame_num_first_t4_data = 0 ;
p_t38_packet_conv = NULL ;
p_t38_conv = NULL ;
p_t38_packet_conv = ( t38_conv * ) p_get_proto_data ( wmem_file_scope ( ) , pinfo , proto_t38 , 0 ) ;
p_conv = find_conversation ( pinfo -> fd -> num , & pinfo -> net_dst , & pinfo -> net_src , pinfo -> ptype , pinfo -> destport , pinfo -> srcport , NO_ADDR_B | NO_PORT_B ) ;
if ( ! p_conv ) {
p_conv = conversation_new ( pinfo -> fd -> num , & pinfo -> net_src , & pinfo -> net_dst , pinfo -> ptype , pinfo -> srcport , pinfo -> destport , NO_ADDR_B | NO_PORT_B ) ;
conversation_set_dissector ( p_conv , t38_udp_handle ) ;
}
if ( ! p_t38_packet_conv ) {
p_t38_conv = ( t38_conv * ) conversation_get_proto_data ( p_conv , proto_t38 ) ;
if ( ! p_t38_conv ) {
p_t38_conv = wmem_new ( wmem_file_scope ( ) , t38_conv ) ;
p_t38_conv -> setup_method [ 0 ] = '\0' ;
p_t38_conv -> setup_frame_number = 0 ;
p_t38_conv -> src_t38_info . reass_ID = 0 ;
p_t38_conv -> src_t38_info . reass_start_seqnum = - 1 ;
p_t38_conv -> src_t38_info . reass_data_type = 0 ;
p_t38_conv -> src_t38_info . last_seqnum = - 1 ;
p_t38_conv -> src_t38_info . packet_lost = 0 ;
p_t38_conv -> src_t38_info . burst_lost = 0 ;
p_t38_conv -> src_t38_info . time_first_t4_data = 0 ;
p_t38_conv -> src_t38_info . additional_hdlc_data_field_counter = 0 ;
p_t38_conv -> src_t38_info . seqnum_prev_data_field = - 1 ;
p_t38_conv -> dst_t38_info . reass_ID = 0 ;
p_t38_conv -> dst_t38_info . reass_start_seqnum = - 1 ;
p_t38_conv -> dst_t38_info . reass_data_type = 0 ;
p_t38_conv -> dst_t38_info . last_seqnum = - 1 ;
p_t38_conv -> dst_t38_info . packet_lost = 0 ;
p_t38_conv -> dst_t38_info . burst_lost = 0 ;
p_t38_conv -> dst_t38_info . time_first_t4_data = 0 ;
p_t38_conv -> dst_t38_info . additional_hdlc_data_field_counter = 0 ;
p_t38_conv -> dst_t38_info . seqnum_prev_data_field = - 1 ;
conversation_add_proto_data ( p_conv , proto_t38 , p_t38_conv ) ;
}
p_t38_packet_conv = wmem_new ( wmem_file_scope ( ) , t38_conv ) ;
g_strlcpy ( p_t38_packet_conv -> setup_method , p_t38_conv -> setup_method , MAX_T38_SETUP_METHOD_SIZE ) ;
p_t38_packet_conv -> setup_frame_number = p_t38_conv -> setup_frame_number ;
memcpy ( & ( p_t38_packet_conv -> src_t38_info ) , & ( p_t38_conv -> src_t38_info ) , sizeof ( t38_conv_info ) ) ;
memcpy ( & ( p_t38_packet_conv -> dst_t38_info ) , & ( p_t38_conv -> dst_t38_info ) , sizeof ( t38_conv_info ) ) ;
p_add_proto_data ( wmem_file_scope ( ) , pinfo , proto_t38 , 0 , p_t38_packet_conv ) ;
}
if ( ADDRESSES_EQUAL ( & p_conv -> key_ptr -> addr1 , & pinfo -> net_src ) ) {
p_t38_conv_info = & ( p_t38_conv -> src_t38_info ) ;
p_t38_packet_conv_info = & ( p_t38_packet_conv -> src_t38_info ) ;
}
else {
p_t38_conv_info = & ( p_t38_conv -> dst_t38_info ) ;
p_t38_packet_conv_info = & ( p_t38_packet_conv -> dst_t38_info ) ;
}
t38_info -> setup_frame_number = p_t38_packet_conv -> setup_frame_number ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | int main ( int argc , char * * argv ) {
struct transfer_request * request ;
struct transfer_request * next_request ;
int nr_refspec = 0 ;
char * * refspec = NULL ;
struct remote_lock * ref_lock = NULL ;
struct remote_lock * info_ref_lock = NULL ;
struct rev_info revs ;
int delete_branch = 0 ;
int force_delete = 0 ;
int objects_to_send ;
int rc = 0 ;
int i ;
int new_refs ;
struct ref * ref , * local_refs ;
git_setup_gettext ( ) ;
git_extract_argv0_path ( argv [ 0 ] ) ;
repo = xcalloc ( 1 , sizeof ( * repo ) ) ;
argv ++ ;
for ( i = 1 ;
i < argc ;
i ++ , argv ++ ) {
char * arg = * argv ;
if ( * arg == '-' ) {
if ( ! strcmp ( arg , "--all" ) ) {
push_all = MATCH_REFS_ALL ;
continue ;
}
if ( ! strcmp ( arg , "--force" ) ) {
force_all = 1 ;
continue ;
}
if ( ! strcmp ( arg , "--dry-run" ) ) {
dry_run = 1 ;
continue ;
}
if ( ! strcmp ( arg , "--helper-status" ) ) {
helper_status = 1 ;
continue ;
}
if ( ! strcmp ( arg , "--verbose" ) ) {
push_verbosely = 1 ;
http_is_verbose = 1 ;
continue ;
}
if ( ! strcmp ( arg , "-d" ) ) {
delete_branch = 1 ;
continue ;
}
if ( ! strcmp ( arg , "-D" ) ) {
delete_branch = 1 ;
force_delete = 1 ;
continue ;
}
if ( ! strcmp ( arg , "-h" ) ) usage ( http_push_usage ) ;
}
if ( ! repo -> url ) {
char * path = strstr ( arg , "//" ) ;
str_end_url_with_slash ( arg , & repo -> url ) ;
repo -> path_len = strlen ( repo -> url ) ;
if ( path ) {
repo -> path = strchr ( path + 2 , '/' ) ;
if ( repo -> path ) repo -> path_len = strlen ( repo -> path ) ;
}
continue ;
}
refspec = argv ;
nr_refspec = argc - i ;
break ;
}
# ifndef USE_CURL_MULTI die ( "git-push is not available for http/https repository when not compiled with USE_CURL_MULTI" ) ;
# endif if ( ! repo -> url ) usage ( http_push_usage ) ;
if ( delete_branch && nr_refspec != 1 ) die ( "You must specify only one branch name when deleting a remote branch" ) ;
setup_git_directory ( ) ;
memset ( remote_dir_exists , - 1 , 256 ) ;
http_init ( NULL , repo -> url , 1 ) ;
# ifdef USE_CURL_MULTI is_running_queue = 0 ;
# endif if ( ! locking_available ( ) ) {
rc = 1 ;
goto cleanup ;
}
sigchain_push_common ( remove_locks_on_signal ) ;
repo -> can_update_info_refs = 0 ;
repo -> has_info_refs = remote_exists ( "info/refs" ) ;
repo -> has_info_packs = remote_exists ( "objects/info/packs" ) ;
if ( repo -> has_info_refs ) {
info_ref_lock = lock_remote ( "info/refs" , LOCK_TIME ) ;
if ( info_ref_lock ) repo -> can_update_info_refs = 1 ;
else {
error ( "cannot lock existing info/refs" ) ;
rc = 1 ;
goto cleanup ;
}
}
if ( repo -> has_info_packs ) fetch_indices ( ) ;
local_refs = get_local_heads ( ) ;
fprintf ( stderr , "Fetching remote heads...\n" ) ;
get_dav_remote_heads ( ) ;
run_request_queue ( ) ;
if ( delete_branch ) {
if ( delete_remote_branch ( refspec [ 0 ] , force_delete ) == - 1 ) {
fprintf ( stderr , "Unable to delete remote branch %s\n" , refspec [ 0 ] ) ;
if ( helper_status ) printf ( "error %s cannot remove\n" , refspec [ 0 ] ) ;
}
goto cleanup ;
}
if ( match_push_refs ( local_refs , & remote_refs , nr_refspec , ( const char * * ) refspec , push_all ) ) {
rc = - 1 ;
goto cleanup ;
}
if ( ! remote_refs ) {
fprintf ( stderr , "No refs in common and none specified;
doing nothing.\n" ) ;
if ( helper_status ) printf ( "error null no match\n" ) ;
rc = 0 ;
goto cleanup ;
}
new_refs = 0 ;
for ( ref = remote_refs ;
ref ;
ref = ref -> next ) {
struct argv_array commit_argv = ARGV_ARRAY_INIT ;
if ( ! ref -> peer_ref ) continue ;
if ( is_null_oid ( & ref -> peer_ref -> new_oid ) ) {
if ( delete_remote_branch ( ref -> name , 1 ) == - 1 ) {
error ( "Could not remove %s" , ref -> name ) ;
if ( helper_status ) printf ( "error %s cannot remove\n" , ref -> name ) ;
rc = - 4 ;
}
else if ( helper_status ) printf ( "ok %s\n" , ref -> name ) ;
new_refs ++ ;
continue ;
}
if ( ! oidcmp ( & ref -> old_oid , & ref -> peer_ref -> new_oid ) ) {
if ( push_verbosely ) fprintf ( stderr , "'%s': up-to-date\n" , ref -> name ) ;
if ( helper_status ) printf ( "ok %s up to date\n" , ref -> name ) ;
continue ;
}
if ( ! force_all && ! is_null_oid ( & ref -> old_oid ) && ! ref -> force ) {
if ( ! has_object_file ( & ref -> old_oid ) || ! ref_newer ( & ref -> peer_ref -> new_oid , & ref -> old_oid ) ) {
error ( "remote '%s' is not an ancestor of\n" "local '%s'.\n" "Maybe you are not up-to-date and " "need to pull first?" , ref -> name , ref -> peer_ref -> name ) ;
if ( helper_status ) printf ( "error %s non-fast forward\n" , ref -> name ) ;
rc = - 2 ;
continue ;
}
}
oidcpy ( & ref -> new_oid , & ref -> peer_ref -> new_oid ) ;
new_refs ++ ;
fprintf ( stderr , "updating '%s'" , ref -> name ) ;
if ( strcmp ( ref -> name , ref -> peer_ref -> name ) ) fprintf ( stderr , " using '%s'" , ref -> peer_ref -> name ) ;
fprintf ( stderr , "\n from %s\n to %s\n" , oid_to_hex ( & ref -> old_oid ) , oid_to_hex ( & ref -> new_oid ) ) ;
if ( dry_run ) {
if ( helper_status ) printf ( "ok %s\n" , ref -> name ) ;
continue ;
}
ref_lock = lock_remote ( ref -> name , LOCK_TIME ) ;
if ( ref_lock == NULL ) {
fprintf ( stderr , "Unable to lock remote branch %s\n" , ref -> name ) ;
if ( helper_status ) printf ( "error %s lock error\n" , ref -> name ) ;
rc = 1 ;
continue ;
}
argv_array_push ( & commit_argv , "" ) ;
argv_array_push ( & commit_argv , "--objects" ) ;
argv_array_push ( & commit_argv , oid_to_hex ( & ref -> new_oid ) ) ;
if ( ! push_all && ! is_null_oid ( & ref -> old_oid ) ) argv_array_pushf ( & commit_argv , "^%s" , oid_to_hex ( & ref -> old_oid ) ) ;
init_revisions ( & revs , setup_git_directory ( ) ) ;
setup_revisions ( commit_argv . argc , commit_argv . argv , & revs , NULL ) ;
revs . edge_hint = 0 ;
pushing = 0 ;
if ( prepare_revision_walk ( & revs ) ) die ( "revision walk setup failed" ) ;
mark_edges_uninteresting ( & revs , NULL ) ;
objects_to_send = get_delta ( & revs , ref_lock ) ;
finish_all_active_slots ( ) ;
pushing = 1 ;
if ( objects_to_send ) fprintf ( stderr , " sending %d objects\n" , objects_to_send ) ;
run_request_queue ( ) ;
if ( aborted || ! update_remote ( ref -> new_oid . hash , ref_lock ) ) rc = 1 ;
if ( ! rc ) fprintf ( stderr , " done\n" ) ;
if ( helper_status ) printf ( "%s %s\n" , ! rc ? "ok" : "error" , ref -> name ) ;
unlock_remote ( ref_lock ) ;
check_locks ( ) ;
argv_array_clear ( & commit_argv ) ;
}
if ( repo -> has_info_refs && new_refs ) {
if ( info_ref_lock && repo -> can_update_info_refs ) {
fprintf ( stderr , "Updating remote server info\n" ) ;
if ( ! dry_run ) update_remote_info_refs ( info_ref_lock ) ;
}
else {
fprintf ( stderr , "Unable to update server info\n" ) ;
}
}
cleanup : if ( info_ref_lock ) unlock_remote ( info_ref_lock ) ;
free ( repo ) ;
http_cleanup ( ) ;
request = request_queue_head ;
while ( request != NULL ) {
next_request = request -> next ;
release_request ( request ) ;
request = next_request ;
}
return rc ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dump_tablespaces ( char * ts_where ) {
MYSQL_ROW row ;
MYSQL_RES * tableres ;
char buf [ FN_REFLEN ] ;
DYNAMIC_STRING sqlbuf ;
int first = 0 ;
char extra_format [ ] = "UNDO_BUFFER_SIZE=" ;
char * ubs ;
char * endsemi ;
DBUG_ENTER ( "dump_tablespaces" ) ;
mysql_query ( mysql , "set optimizer_switch='semijoin=off'" ) ;
init_dynamic_string_checked ( & sqlbuf , "SELECT LOGFILE_GROUP_NAME," " FILE_NAME," " TOTAL_EXTENTS," " INITIAL_SIZE," " ENGINE," " EXTRA" " FROM INFORMATION_SCHEMA.FILES" " WHERE FILE_TYPE = 'UNDO LOG'" " AND FILE_NAME IS NOT NULL" , 256 , 1024 ) ;
if ( ts_where ) {
dynstr_append_checked ( & sqlbuf , " AND LOGFILE_GROUP_NAME IN (" "SELECT DISTINCT LOGFILE_GROUP_NAME" " FROM INFORMATION_SCHEMA.FILES" " WHERE FILE_TYPE = 'DATAFILE'" ) ;
dynstr_append_checked ( & sqlbuf , ts_where ) ;
dynstr_append_checked ( & sqlbuf , ")" ) ;
}
dynstr_append_checked ( & sqlbuf , " GROUP BY LOGFILE_GROUP_NAME, FILE_NAME" ", ENGINE" " ORDER BY LOGFILE_GROUP_NAME" ) ;
if ( mysql_query ( mysql , sqlbuf . str ) || ! ( tableres = mysql_store_result ( mysql ) ) ) {
dynstr_free ( & sqlbuf ) ;
if ( mysql_errno ( mysql ) == ER_BAD_TABLE_ERROR || mysql_errno ( mysql ) == ER_BAD_DB_ERROR || mysql_errno ( mysql ) == ER_UNKNOWN_TABLE ) {
fprintf ( md_result_file , "\n--\n-- Not dumping tablespaces as no INFORMATION_SCHEMA.FILES" " table on this server\n--\n" ) ;
check_io ( md_result_file ) ;
DBUG_RETURN ( 0 ) ;
}
fprintf ( stderr , "%s: Error: '%s' when trying to dump tablespaces\n" , my_progname_short , mysql_error ( mysql ) ) ;
DBUG_RETURN ( 1 ) ;
}
buf [ 0 ] = 0 ;
while ( ( row = mysql_fetch_row ( tableres ) ) ) {
if ( strcmp ( buf , row [ 0 ] ) != 0 ) first = 1 ;
if ( first ) {
print_comment ( md_result_file , 0 , "\n--\n-- Logfile group: %s\n--\n" , row [ 0 ] ) ;
fprintf ( md_result_file , "\nCREATE" ) ;
}
else {
fprintf ( md_result_file , "\nALTER" ) ;
}
fprintf ( md_result_file , " LOGFILE GROUP %s\n" " ADD UNDOFILE '%s'\n" , row [ 0 ] , row [ 1 ] ) ;
if ( first ) {
ubs = strstr ( row [ 5 ] , extra_format ) ;
if ( ! ubs ) break ;
ubs += strlen ( extra_format ) ;
endsemi = strstr ( ubs , ";
" ) ;
if ( endsemi ) endsemi [ 0 ] = '\0' ;
fprintf ( md_result_file , " UNDO_BUFFER_SIZE %s\n" , ubs ) ;
}
fprintf ( md_result_file , " INITIAL_SIZE %s\n" " ENGINE=%s;
\n" , row [ 3 ] , row [ 4 ] ) ;
check_io ( md_result_file ) ;
if ( first ) {
first = 0 ;
strxmov ( buf , row [ 0 ] , NullS ) ;
}
}
dynstr_free ( & sqlbuf ) ;
mysql_free_result ( tableres ) ;
init_dynamic_string_checked ( & sqlbuf , "SELECT DISTINCT TABLESPACE_NAME," " FILE_NAME," " LOGFILE_GROUP_NAME," " EXTENT_SIZE," " INITIAL_SIZE," " ENGINE" " FROM INFORMATION_SCHEMA.FILES" " WHERE FILE_TYPE = 'DATAFILE'" , 256 , 1024 ) ;
if ( ts_where ) dynstr_append_checked ( & sqlbuf , ts_where ) ;
dynstr_append_checked ( & sqlbuf , " ORDER BY TABLESPACE_NAME, LOGFILE_GROUP_NAME" ) ;
if ( mysql_query_with_error_report ( mysql , & tableres , sqlbuf . str ) ) {
dynstr_free ( & sqlbuf ) ;
DBUG_RETURN ( 1 ) ;
}
buf [ 0 ] = 0 ;
while ( ( row = mysql_fetch_row ( tableres ) ) ) {
if ( strcmp ( buf , row [ 0 ] ) != 0 ) first = 1 ;
if ( first ) {
print_comment ( md_result_file , 0 , "\n--\n-- Tablespace: %s\n--\n" , row [ 0 ] ) ;
fprintf ( md_result_file , "\nCREATE" ) ;
}
else {
fprintf ( md_result_file , "\nALTER" ) ;
}
fprintf ( md_result_file , " TABLESPACE %s\n" " ADD DATAFILE '%s'\n" , row [ 0 ] , row [ 1 ] ) ;
if ( first ) {
fprintf ( md_result_file , " USE LOGFILE GROUP %s\n" " EXTENT_SIZE %s\n" , row [ 2 ] , row [ 3 ] ) ;
}
fprintf ( md_result_file , " INITIAL_SIZE %s\n" " ENGINE=%s;
\n" , row [ 4 ] , row [ 5 ] ) ;
check_io ( md_result_file ) ;
if ( first ) {
first = 0 ;
strxmov ( buf , row [ 0 ] , NullS ) ;
}
}
mysql_free_result ( tableres ) ;
dynstr_free ( & sqlbuf ) ;
mysql_query ( mysql , "set optimizer_switch=default" ) ;
DBUG_RETURN ( 0 ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | void kadmin_setstring ( int argc , char * argv [ ] ) {
kadm5_ret_t retval ;
char * pname , * canon = NULL , * key , * value ;
krb5_principal princ = NULL ;
if ( argc != 4 ) {
fprintf ( stderr , _ ( "usage: set_string principal key value\n" ) ) ;
return ;
}
pname = argv [ 1 ] ;
key = argv [ 2 ] ;
value = argv [ 3 ] ;
retval = kadmin_parse_name ( pname , & princ ) ;
if ( retval ) {
com_err ( "set_string" , retval , _ ( "while parsing principal" ) ) ;
return ;
}
retval = krb5_unparse_name ( context , princ , & canon ) ;
if ( retval ) {
com_err ( "set_string" , retval , _ ( "while canonicalizing principal" ) ) ;
goto cleanup ;
}
retval = kadm5_set_string ( handle , princ , key , value ) ;
if ( retval ) {
com_err ( "set_string" , retval , _ ( "while setting attribute on principal \"%s\"" ) , canon ) ;
goto cleanup ;
}
printf ( _ ( "Attribute set for principal \"%s\".\n" ) , canon ) ;
cleanup : krb5_free_principal ( context , princ ) ;
free ( canon ) ;
return ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static size_t encode_block ( char * str , char * buf , size_t buflen , const char * fromcode , const char * tocode , encoder_t encoder ) {
if ( ! fromcode ) {
return ( * encoder ) ( str , buf , buflen , tocode ) ;
}
const iconv_t cd = mutt_ch_iconv_open ( tocode , fromcode , 0 ) ;
assert ( cd != ( iconv_t ) ( - 1 ) ) ;
const char * ib = buf ;
size_t ibl = buflen ;
char tmp [ ENCWORD_LEN_MAX - ENCWORD_LEN_MIN + 1 ] ;
char * ob = tmp ;
size_t obl = sizeof ( tmp ) - strlen ( tocode ) ;
const size_t n1 = iconv ( cd , ( ICONV_CONST char * * ) & ib , & ibl , & ob , & obl ) ;
const size_t n2 = iconv ( cd , NULL , NULL , & ob , & obl ) ;
assert ( n1 != ( size_t ) ( - 1 ) && n2 != ( size_t ) ( - 1 ) ) ;
iconv_close ( cd ) ;
return ( * encoder ) ( str , tmp , ob - tmp , tocode ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int vapic_post_load ( void * opaque , int version_id ) {
VAPICROMState * s = opaque ;
uint8_t * zero ;
if ( s -> state == VAPIC_INACTIVE && s -> rom_state_paddr != 0 ) {
s -> state = VAPIC_STANDBY ;
}
if ( s -> state != VAPIC_INACTIVE ) {
if ( vapic_prepare ( s ) < 0 ) {
return - 1 ;
}
}
if ( s -> state == VAPIC_ACTIVE ) {
if ( smp_cpus == 1 ) {
run_on_cpu ( ENV_GET_CPU ( first_cpu ) , do_vapic_enable , s ) ;
}
else {
zero = g_malloc0 ( s -> rom_state . vapic_size ) ;
cpu_physical_memory_rw ( s -> vapic_paddr , zero , s -> rom_state . vapic_size , 1 ) ;
g_free ( zero ) ;
}
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void vvalue_strbuf_append_i4 ( wmem_strbuf_t * strbuf , void * ptr ) {
gint32 i4 = * ( gint32 * ) ptr ;
wmem_strbuf_append_printf ( strbuf , "%d" , i4 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void fe_channels_deinit ( void ) {
signal_remove ( "channel created" , ( SIGNAL_FUNC ) signal_channel_created ) ;
signal_remove ( "channel destroyed" , ( SIGNAL_FUNC ) signal_channel_destroyed ) ;
signal_remove ( "window item changed" , ( SIGNAL_FUNC ) signal_window_item_changed ) ;
signal_remove ( "server disconnected" , ( SIGNAL_FUNC ) sig_disconnected ) ;
signal_remove ( "channel joined" , ( SIGNAL_FUNC ) sig_channel_joined ) ;
command_unbind ( "join" , ( SIGNAL_FUNC ) cmd_join ) ;
command_unbind ( "channel" , ( SIGNAL_FUNC ) cmd_channel ) ;
command_unbind ( "channel add" , ( SIGNAL_FUNC ) cmd_channel_add ) ;
command_unbind ( "channel modify" , ( SIGNAL_FUNC ) cmd_channel_modify ) ;
command_unbind ( "channel remove" , ( SIGNAL_FUNC ) cmd_channel_remove ) ;
command_unbind ( "channel list" , ( SIGNAL_FUNC ) cmd_channel_list ) ;
command_unbind ( "names" , ( SIGNAL_FUNC ) cmd_names ) ;
command_unbind ( "cycle" , ( SIGNAL_FUNC ) cmd_cycle ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void min_heap_elem_init ( struct event * e ) {
e -> min_heap_idx = - 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_DEVMODE_CTR ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) {
proto_tree * subtree ;
guint32 size ;
subtree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_DEVMODE_CTR , NULL , "Devicemode container" ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , subtree , di , drep , hf_devmodectr_size , & size ) ;
offset = dissect_ndr_pointer ( tvb , offset , pinfo , subtree , di , drep , dissect_DEVMODE , NDR_POINTER_UNIQUE , "Devicemode" , - 1 ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dsa_param_decode ( EVP_PKEY * pkey , const unsigned char * * pder , int derlen ) {
DSA * dsa ;
if ( ( dsa = d2i_DSAparams ( NULL , pder , derlen ) ) == NULL ) {
DSAerr ( DSA_F_DSA_PARAM_DECODE , ERR_R_DSA_LIB ) ;
return 0 ;
}
EVP_PKEY_assign_DSA ( pkey , dsa ) ;
return 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static cmsBool Type_CrdInfo_Write ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , void * Ptr , cmsUInt32Number nItems ) {
cmsMLU * mlu = ( cmsMLU * ) Ptr ;
if ( ! WriteCountAndSting ( self , io , mlu , "nm" ) ) goto Error ;
if ( ! WriteCountAndSting ( self , io , mlu , "#0" ) ) goto Error ;
if ( ! WriteCountAndSting ( self , io , mlu , "#1" ) ) goto Error ;
if ( ! WriteCountAndSting ( self , io , mlu , "#2" ) ) goto Error ;
if ( ! WriteCountAndSting ( self , io , mlu , "#3" ) ) goto Error ;
return TRUE ;
Error : return FALSE ;
cmsUNUSED_PARAMETER ( nItems ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void test_bug49972 ( ) {
int rc ;
MYSQL_STMT * stmt ;
MYSQL_BIND in_param_bind ;
MYSQL_BIND out_param_bind ;
int int_data ;
my_bool is_null ;
DBUG_ENTER ( "test_bug49972" ) ;
myheader ( "test_bug49972" ) ;
rc = mysql_query ( mysql , "DROP FUNCTION IF EXISTS f1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "DROP PROCEDURE IF EXISTS p1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE FUNCTION f1() RETURNS INT RETURN 1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE PROCEDURE p1(IN a INT, OUT b INT) SET b = a" ) ;
myquery ( rc ) ;
stmt = mysql_simple_prepare ( mysql , "CALL p1((SELECT f1()), ?)" ) ;
check_stmt ( stmt ) ;
memset ( & in_param_bind , 0 , sizeof ( in_param_bind ) ) ;
in_param_bind . buffer_type = MYSQL_TYPE_LONG ;
in_param_bind . buffer = ( char * ) & int_data ;
in_param_bind . length = 0 ;
in_param_bind . is_null = 0 ;
rc = mysql_stmt_bind_param ( stmt , & in_param_bind ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
{
memset ( & out_param_bind , 0 , sizeof ( out_param_bind ) ) ;
out_param_bind . buffer_type = MYSQL_TYPE_LONG ;
out_param_bind . is_null = & is_null ;
out_param_bind . buffer = & int_data ;
out_param_bind . buffer_length = sizeof ( int_data ) ;
rc = mysql_stmt_bind_result ( stmt , & out_param_bind ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_fetch ( stmt ) ;
rc = mysql_stmt_fetch ( stmt ) ;
DBUG_ASSERT ( rc == MYSQL_NO_DATA ) ;
mysql_stmt_next_result ( stmt ) ;
mysql_stmt_fetch ( stmt ) ;
}
rc = mysql_query ( mysql , "DROP FUNCTION f1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE FUNCTION f1() RETURNS INT RETURN 1" ) ;
myquery ( rc ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
{
memset ( & out_param_bind , 0 , sizeof ( out_param_bind ) ) ;
out_param_bind . buffer_type = MYSQL_TYPE_LONG ;
out_param_bind . is_null = & is_null ;
out_param_bind . buffer = & int_data ;
out_param_bind . buffer_length = sizeof ( int_data ) ;
rc = mysql_stmt_bind_result ( stmt , & out_param_bind ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_fetch ( stmt ) ;
rc = mysql_stmt_fetch ( stmt ) ;
DBUG_ASSERT ( rc == MYSQL_NO_DATA ) ;
mysql_stmt_next_result ( stmt ) ;
mysql_stmt_fetch ( stmt ) ;
}
mysql_stmt_close ( stmt ) ;
rc = mysql_query ( mysql , "DROP PROCEDURE p1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "DROP FUNCTION f1" ) ;
myquery ( rc ) ;
DBUG_VOID_RETURN ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static BusState * qbus_find_bus ( DeviceState * dev , char * elem ) {
BusState * child ;
QLIST_FOREACH ( child , & dev -> child_bus , sibling ) {
if ( strcmp ( child -> name , elem ) == 0 ) {
return child ;
}
}
return NULL ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void dissect_q931_party_category_ie ( tvbuff_t * tvb , int offset , int len , proto_tree * tree ) {
if ( len == 0 ) return ;
proto_tree_add_item ( tree , hf_q931_party_category , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void abort_job ( CommonJob * job ) {
g_clear_object ( & job -> undo_info ) ;
g_cancellable_cancel ( job -> cancellable ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static LAYER_CONTEXT * get_layer_context ( VP9_COMP * const cpi ) {
return ( cpi -> svc . number_temporal_layers > 1 && cpi -> oxcf . rc_mode == VPX_CBR ) ? & cpi -> svc . layer_context [ cpi -> svc . temporal_layer_id ] : & cpi -> svc . layer_context [ cpi -> svc . spatial_layer_id ] ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int selinux_cred_prepare ( struct cred * new , const struct cred * old , gfp_t gfp ) {
const struct task_security_struct * old_tsec ;
struct task_security_struct * tsec ;
old_tsec = old -> security ;
tsec = kmemdup ( old_tsec , sizeof ( struct task_security_struct ) , gfp ) ;
if ( ! tsec ) return - ENOMEM ;
new -> security = tsec ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void psf_use_rsrc ( SF_PRIVATE * psf , int on_off ) {
if ( on_off ) {
if ( psf -> file . filedes != psf -> rsrc . filedes ) {
psf -> file . savedes = psf -> file . filedes ;
psf -> file . filedes = psf -> rsrc . filedes ;
}
;
}
else if ( psf -> file . filedes == psf -> rsrc . filedes ) psf -> file . filedes = psf -> file . savedes ;
return ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( WebFrameTest , ContextMenuDataSelectedText ) {
ContextMenuWebFrameClient frame ;
FrameTestHelpers : : WebViewHelper web_view_helper ;
WebViewImpl * web_view = web_view_helper . Initialize ( & frame ) ;
const std : : string & html = "<input value=' '>" ;
FrameTestHelpers : : LoadHTMLString ( web_view -> MainFrameImpl ( ) , html , ToKURL ( "about:blank" ) ) ;
web_view -> Resize ( WebSize ( 500 , 300 ) ) ;
web_view -> UpdateAllLifecyclePhases ( ) ;
RunPendingTasks ( ) ;
web_view -> SetInitialFocus ( false ) ;
RunPendingTasks ( ) ;
web_view -> MainFrameImpl ( ) -> ExecuteCommand ( WebString : : FromUTF8 ( "SelectAll" ) ) ;
WebMouseEvent mouse_event ( WebInputEvent : : kMouseDown , WebInputEvent : : kNoModifiers , WebInputEvent : : GetStaticTimeStampForTests ( ) ) ;
mouse_event . button = WebMouseEvent : : Button : : kRight ;
mouse_event . SetPositionInWidget ( 8 , 8 ) ;
mouse_event . click_count = 1 ;
web_view -> HandleInputEvent ( WebCoalescedInputEvent ( mouse_event ) ) ;
RunPendingTasks ( ) ;
web_view_helper . Reset ( ) ;
EXPECT_EQ ( frame . GetMenuData ( ) . selected_text , " " ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void e1000e_set_12bit ( E1000ECore * core , int index , uint32_t val ) {
core -> mac [ index ] = val & 0xfff ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static VALUE cState_array_nl_set ( VALUE self , VALUE array_nl ) {
unsigned long len ;
GET_STATE ( self ) ;
Check_Type ( array_nl , T_STRING ) ;
len = RSTRING_LEN ( array_nl ) ;
if ( len == 0 ) {
if ( state -> array_nl ) {
ruby_xfree ( state -> array_nl ) ;
state -> array_nl = NULL ;
}
}
else {
if ( state -> array_nl ) ruby_xfree ( state -> array_nl ) ;
state -> array_nl = fstrndup ( RSTRING_PTR ( array_nl ) , len ) ;
state -> array_nl_len = len ;
}
return Qnil ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static PyObject * _cbson_dict_to_bson ( PyObject * self , PyObject * args ) {
PyObject * dict ;
PyObject * result ;
unsigned char check_keys ;
unsigned char uuid_subtype ;
unsigned char top_level = 1 ;
buffer_t buffer ;
if ( ! PyArg_ParseTuple ( args , "Obb|b" , & dict , & check_keys , & uuid_subtype , & top_level ) ) {
return NULL ;
}
buffer = buffer_new ( ) ;
if ( ! buffer ) {
PyErr_NoMemory ( ) ;
return NULL ;
}
if ( ! write_dict ( self , buffer , dict , check_keys , uuid_subtype , top_level ) ) {
buffer_free ( buffer ) ;
return NULL ;
}
# if PY_MAJOR_VERSION >= 3 result = Py_BuildValue ( "y#" , buffer_get_buffer ( buffer ) , buffer_get_position ( buffer ) ) ;
# else result = Py_BuildValue ( "s#" , buffer_get_buffer ( buffer ) , buffer_get_position ( buffer ) ) ;
# endif buffer_free ( buffer ) ;
return result ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void prepare_new_databases ( void ) {
set_frozenxids ( false ) ;
prep_status ( "Restoring global objects in the new cluster" ) ;
exec_prog ( UTILITY_LOG_FILE , NULL , true , "\"%s/psql\" " EXEC_PSQL_ARGS " %s -f \"%s\"" , new_cluster . bindir , cluster_conn_opts ( & new_cluster ) , GLOBALS_DUMP_FILE ) ;
check_ok ( ) ;
get_db_and_rel_infos ( & new_cluster ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int ts_lua_http_server_packet_tos_set ( lua_State * L ) {
int value ;
ts_lua_http_ctx * http_ctx ;
GET_HTTP_CONTEXT ( http_ctx , L ) ;
value = luaL_checkinteger ( L , 1 ) ;
TSDebug ( TS_LUA_DEBUG_TAG , "server packet tos set" ) ;
TSHttpTxnServerPacketTosSet ( http_ctx -> txnp , value ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | PHP_FUNCTION ( locale_get_display_region ) {
get_icu_disp_value_src_php ( LOC_REGION_TAG , INTERNAL_FUNCTION_PARAM_PASSTHRU ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static uint64_t gic_do_cpu_read ( void * opaque , hwaddr addr , unsigned size ) {
GICState * * backref = ( GICState * * ) opaque ;
GICState * s = * backref ;
int id = ( backref - s -> backref ) ;
return gic_cpu_read ( s , id , addr ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int i2d_ ## name ( type * a , unsigned char * * out ) ;
DECLARE_ASN1_ITEM ( itname ) # define DECLARE_ASN1_ENCODE_FUNCTIONS_const ( type , name ) type * d2i_ ## name ( type * * a , const unsigned char * * in , long len ) ;
int i2d_ ## name ( const type * a , unsigned char * * out ) ;
DECLARE_ASN1_ITEM ( name ) # define DECLARE_ASN1_NDEF_FUNCTION ( name ) int i2d_ ## name ## _NDEF ( name * a , unsigned char * * out ) ;
# define DECLARE_ASN1_FUNCTIONS_const ( name ) DECLARE_ASN1_ALLOC_FUNCTIONS ( name ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( name , name ) # define DECLARE_ASN1_ALLOC_FUNCTIONS_name ( type , name ) type * name ## _new ( void ) ;
void name ## _free ( type * a ) ;
# define DECLARE_ASN1_PRINT_FUNCTION ( stname ) DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , stname ) # define DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , fname ) int fname ## _print_ctx ( BIO * out , stname * x , int indent , const ASN1_PCTX * pctx ) ;
# define D2I_OF ( type ) type * ( * ) ( type * * , const unsigned char * * , long ) # define I2D_OF ( type ) int ( * ) ( type * , unsigned char * * ) # define I2D_OF_const ( type ) int ( * ) ( const type * , unsigned char * * ) # define CHECKED_D2I_OF ( type , d2i ) ( ( d2i_of_void * ) ( 1 ? d2i : ( ( D2I_OF ( type ) ) 0 ) ) ) # define CHECKED_I2D_OF ( type , i2d ) ( ( i2d_of_void * ) ( 1 ? i2d : ( ( I2D_OF ( type ) ) 0 ) ) ) # define CHECKED_NEW_OF ( type , xnew ) ( ( void * ( * ) ( void ) ) ( 1 ? xnew : ( ( type * ( * ) ( void ) ) 0 ) ) ) # define CHECKED_PTR_OF ( type , p ) ( ( void * ) ( 1 ? p : ( type * ) 0 ) ) # define CHECKED_PPTR_OF ( type , p ) ( ( void * * ) ( 1 ? p : ( type * * ) 0 ) ) # define TYPEDEF_D2I_OF ( type ) typedef type * d2i_of_ ## type ( type * * , const unsigned char * * , long ) # define TYPEDEF_I2D_OF ( type ) typedef int i2d_of_ ## type ( type * , unsigned char * * ) # define TYPEDEF_D2I2D_OF ( type ) TYPEDEF_D2I_OF ( type ) ;
TYPEDEF_I2D_OF ( type ) TYPEDEF_D2I2D_OF ( void ) ;
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION typedef const ASN1_ITEM ASN1_ITEM_EXP ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ) # define ASN1_ITEM_ref ( iptr ) ( & ( iptr ## _it ) ) # define ASN1_ITEM_rptr ( ref ) ( & ( ref ## _it ) ) # define DECLARE_ASN1_ITEM ( name ) OPENSSL_EXTERN const ASN1_ITEM name ## _it ;
# else typedef const ASN1_ITEM * ASN1_ITEM_EXP ( void ) ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ( ) ) # define ASN1_ITEM_ref ( iptr ) ( iptr ## _it ) # define ASN1_ITEM_rptr ( ref ) ( ref ## _it ( ) ) # define DECLARE_ASN1_ITEM ( name ) const ASN1_ITEM * name ## _it ( void ) ;
# endif # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 # define ASN1_STRFLGS_ESC_QUOTE 8 # define CHARTYPE_PRINTABLESTRING 0x10 # define CHARTYPE_FIRST_ESC_2253 0x20 # define CHARTYPE_LAST_ESC_2253 0x40 # define ASN1_STRFLGS_UTF8_CONVERT 0x10 # define ASN1_STRFLGS_IGNORE_TYPE 0x20 # define ASN1_STRFLGS_SHOW_TYPE 0x40 # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 # define ASN1_STRFLGS_DUMP_DER 0x200 # define ASN1_STRFLGS_ESC_2254 0x400 # define ASN1_STRFLGS_RFC2253 ( ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER ) DEFINE_STACK_OF ( ASN1_INTEGER ) DEFINE_STACK_OF ( ASN1_GENERALSTRING ) DEFINE_STACK_OF ( ASN1_UTF8STRING ) typedef struct asn1_type_st {
int type ;
union {
char * ptr ;
ASN1_BOOLEAN boolean ;
ASN1_STRING * asn1_string ;
ASN1_OBJECT * object ;
ASN1_INTEGER * integer ;
ASN1_ENUMERATED * enumerated ;
ASN1_BIT_STRING * bit_string ;
ASN1_OCTET_STRING * octet_string ;
ASN1_PRINTABLESTRING * printablestring ;
ASN1_T61STRING * t61string ;
ASN1_IA5STRING * ia5string ;
ASN1_GENERALSTRING * generalstring ;
ASN1_BMPSTRING * bmpstring ;
ASN1_UNIVERSALSTRING * universalstring ;
ASN1_UTCTIME * utctime ;
ASN1_GENERALIZEDTIME * generalizedtime ;
ASN1_VISIBLESTRING * visiblestring ;
ASN1_UTF8STRING * utf8string ;
ASN1_STRING * set ;
ASN1_STRING * sequence ;
ASN1_VALUE * asn1_value ;
}
value ;
}
ASN1_TYPE ;
DEFINE_STACK_OF ( ASN1_TYPE ) typedef STACK_OF ( ASN1_TYPE ) ASN1_SEQUENCE_ANY ;
DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SEQUENCE_ANY ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SET_ANY ) typedef struct BIT_STRING_BITNAME_st {
int bitnum ;
const char * lname ;
const char * sname ;
}
BIT_STRING_BITNAME ;
# define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING DECLARE_ASN1_FUNCTIONS_fname ( ASN1_TYPE , ASN1_ANY , ASN1_TYPE ) int ASN1_TYPE_get ( const ASN1_TYPE * a ) ;
void ASN1_TYPE_set ( ASN1_TYPE * a , int type , void * value ) ;
int ASN1_TYPE_set1 ( ASN1_TYPE * a , int type , const void * value ) ;
int ASN1_TYPE_cmp ( const ASN1_TYPE * a , const ASN1_TYPE * b ) ;
ASN1_TYPE * ASN1_TYPE_pack_sequence ( const ASN1_ITEM * it , void * s , ASN1_TYPE * * t ) ;
void * ASN1_TYPE_unpack_sequence ( const ASN1_ITEM * it , const ASN1_TYPE * t ) ;
ASN1_OBJECT * ASN1_OBJECT_new ( void ) ;
void ASN1_OBJECT_free ( ASN1_OBJECT * a ) ;
int i2d_ASN1_OBJECT ( const ASN1_OBJECT * a , unsigned char * * pp ) ;
ASN1_OBJECT * d2i_ASN1_OBJECT ( ASN1_OBJECT * * a , const unsigned char * * pp , long length ) ;
DECLARE_ASN1_ITEM ( ASN1_OBJECT ) DEFINE_STACK_OF ( ASN1_OBJECT ) ASN1_STRING * ASN1_STRING_new ( void ) ;
void ASN1_STRING_free ( ASN1_STRING * a ) ;
void ASN1_STRING_clear_free ( ASN1_STRING * a ) ;
int ASN1_STRING_copy ( ASN1_STRING * dst , const ASN1_STRING * str ) ;
ASN1_STRING * ASN1_STRING_dup ( const ASN1_STRING * a ) ;
ASN1_STRING * ASN1_STRING_type_new ( int type ) ;
int ASN1_STRING_cmp ( const ASN1_STRING * a , const ASN1_STRING * b ) ;
int ASN1_STRING_set ( ASN1_STRING * str , const void * data , int len ) ;
void ASN1_STRING_set0 ( ASN1_STRING * str , void * data , int len ) ;
int ASN1_STRING_length ( const ASN1_STRING * x ) ;
void ASN1_STRING_length_set ( ASN1_STRING * x , int n ) ;
int ASN1_STRING_type ( const ASN1_STRING * x ) ;
DEPRECATEDIN_1_1_0 ( unsigned char * ASN1_STRING_data ( ASN1_STRING * x ) ) const unsigned char * ASN1_STRING_get0_data ( const ASN1_STRING * x ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_BIT_STRING ) int ASN1_BIT_STRING_set ( ASN1_BIT_STRING * a , unsigned char * d , int length ) ;
int ASN1_BIT_STRING_set_bit ( ASN1_BIT_STRING * a , int n , int value ) ;
int ASN1_BIT_STRING_get_bit ( const ASN1_BIT_STRING * a , int n ) ;
int ASN1_BIT_STRING_check ( const ASN1_BIT_STRING * a , const unsigned char * flags , int flags_len ) ;
int ASN1_BIT_STRING_name_print ( BIO * out , ASN1_BIT_STRING * bs , BIT_STRING_BITNAME * tbl , int indent ) ;
int ASN1_BIT_STRING_num_asc ( const char * name , BIT_STRING_BITNAME * tbl ) ;
int ASN1_BIT_STRING_set_asc ( ASN1_BIT_STRING * bs , const char * name , int value , BIT_STRING_BITNAME * tbl ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_INTEGER ) ASN1_INTEGER * d2i_ASN1_UINTEGER ( ASN1_INTEGER * * a , const unsigned char * * pp , long length ) ;
ASN1_INTEGER * ASN1_INTEGER_dup ( const ASN1_INTEGER * x ) ;
int ASN1_INTEGER_cmp ( const ASN1_INTEGER * x , const ASN1_INTEGER * y ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_ENUMERATED ) int ASN1_UTCTIME_check ( const ASN1_UTCTIME * a ) ;
ASN1_UTCTIME * ASN1_UTCTIME_set ( ASN1_UTCTIME * s , time_t t ) ;
ASN1_UTCTIME * ASN1_UTCTIME_adj ( ASN1_UTCTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_UTCTIME_set_string ( ASN1_UTCTIME * s , const char * str ) ;
int ASN1_UTCTIME_cmp_time_t ( const ASN1_UTCTIME * s , time_t t ) ;
int ASN1_GENERALIZEDTIME_check ( const ASN1_GENERALIZEDTIME * a ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_set ( ASN1_GENERALIZEDTIME * s , time_t t ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_adj ( ASN1_GENERALIZEDTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_GENERALIZEDTIME_set_string ( ASN1_GENERALIZEDTIME * s , const char * str ) ;
int ASN1_TIME_diff ( int * pday , int * psec , const ASN1_TIME * from , const ASN1_TIME * to ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_OCTET_STRING ) ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup ( const ASN1_OCTET_STRING * a ) ;
int ASN1_OCTET_STRING_cmp ( const ASN1_OCTET_STRING * a , const ASN1_OCTET_STRING * b ) ;
int ASN1_OCTET_STRING_set ( ASN1_OCTET_STRING * str , const unsigned char * data , int len ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_VISIBLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UNIVERSALSTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UTF8STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_NULL ) DECLARE_ASN1_FUNCTIONS ( ASN1_BMPSTRING ) int UTF8_getc ( const unsigned char * str , int len , unsigned long * val ) ;
int UTF8_putc ( unsigned char * str , int len , unsigned long value ) ;
DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , ASN1_PRINTABLE ) DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , DIRECTORYSTRING ) DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , DISPLAYTEXT ) DECLARE_ASN1_FUNCTIONS ( ASN1_PRINTABLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_T61STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_IA5STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_GENERALSTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UTCTIME ) DECLARE_ASN1_FUNCTIONS ( ASN1_GENERALIZEDTIME ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | extern rtype gnu_dev_ ## name proto __THROW __attribute_const__ ;
# define __SYSMACROS_IMPL_TEMPL ( rtype , name , proto ) __extension__ __extern_inline __attribute_const__ rtype __NTH ( gnu_dev_ ## name proto ) __BEGIN_DECLS __SYSMACROS_DECLARE_MAJOR ( __SYSMACROS_DECL_TEMPL ) __SYSMACROS_DECLARE_MINOR ( __SYSMACROS_DECL_TEMPL ) __SYSMACROS_DECLARE_MAKEDEV ( __SYSMACROS_DECL_TEMPL ) | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | int dissect_h225_ReleaseCompleteReason ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 713 "./asn1/h225/h225.cnf" gint32 value ;
h225_packet_info * h225_pi ;
h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h225_ReleaseCompleteReason , ReleaseCompleteReason_choice , & value ) ;
if ( h225_pi != NULL ) {
h225_pi -> reason = value ;
}
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline guint64 get_int64_value ( proto_tree * tree , tvbuff_t * tvb , gint start , guint length , const guint encoding ) {
guint64 value = get_uint64_value ( tree , tvb , start , length , encoding ) ;
switch ( length ) {
case 7 : value = ws_sign_ext64 ( value , 56 ) ;
break ;
case 6 : value = ws_sign_ext64 ( value , 48 ) ;
break ;
case 5 : value = ws_sign_ext64 ( value , 40 ) ;
break ;
case 4 : value = ws_sign_ext64 ( value , 32 ) ;
break ;
case 3 : value = ws_sign_ext64 ( value , 24 ) ;
break ;
case 2 : value = ws_sign_ext64 ( value , 16 ) ;
break ;
case 1 : value = ws_sign_ext64 ( value , 8 ) ;
break ;
}
return value ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static Py_ssize_t string_length ( PyStringObject * a ) {
return Py_SIZE ( a ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void test_multiple_cb ( int fd , short event , void * arg ) {
if ( event & EV_READ ) test_ok |= 1 ;
else if ( event & EV_WRITE ) test_ok |= 2 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static const char * ultag_getScript ( const ULanguageTag * langtag ) {
return langtag -> script ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void ide_nop_restart ( void * opaque , int x , RunState y ) {
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int isoent_add_child_tail ( struct isoent * parent , struct isoent * child ) {
if ( ! __archive_rb_tree_insert_node ( & ( parent -> rbtree ) , ( struct archive_rb_node * ) child ) ) return ( 0 ) ;
child -> chnext = NULL ;
* parent -> children . last = child ;
parent -> children . last = & ( child -> chnext ) ;
parent -> children . cnt ++ ;
child -> parent = parent ;
child -> drnext = NULL ;
if ( child -> dir ) {
* parent -> subdirs . last = child ;
parent -> subdirs . last = & ( child -> drnext ) ;
parent -> subdirs . cnt ++ ;
child -> parent = parent ;
}
return ( 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | char * utf8_verify_copy ( const char * str ) {
if ( str == NULL ) return ( NULL ) ;
if ( utf8_valid ( str ) ) return ( copy ( str ) ) ;
return ( latin1_2_utf8_copy ( str ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline bool e1000e_rx_descr_threshold_hit ( E1000ECore * core , const E1000E_RingInfo * rxi ) {
return e1000e_ring_free_descr_num ( core , rxi ) == e1000e_ring_len ( core , rxi ) >> core -> rxbuf_min_shift ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int vp9_compute_qdelta_by_rate ( const RATE_CONTROL * rc , FRAME_TYPE frame_type , int qindex , double rate_target_ratio , vpx_bit_depth_t bit_depth ) {
int target_index = rc -> worst_quality ;
int i ;
const int base_bits_per_mb = vp9_rc_bits_per_mb ( frame_type , qindex , 1.0 , bit_depth ) ;
const int target_bits_per_mb = ( int ) ( rate_target_ratio * base_bits_per_mb ) ;
for ( i = rc -> best_quality ;
i < rc -> worst_quality ;
++ i ) {
target_index = i ;
if ( vp9_rc_bits_per_mb ( frame_type , i , 1.0 , bit_depth ) <= target_bits_per_mb ) break ;
}
return target_index - qindex ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( UnloadTest , DISABLED_BrowserCloseInfiniteBeforeUnload ) {
if ( base : : CommandLine : : ForCurrentProcess ( ) -> HasSwitch ( switches : : kSingleProcess ) ) return ;
LoadUrlAndQuitBrowser ( INFINITE_BEFORE_UNLOAD_HTML , "infinitebeforeunload" ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void vmsvga_index_write ( void * opaque , uint32_t address , uint32_t index ) {
struct vmsvga_state_s * s = opaque ;
s -> index = index ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static guint prplcb_ev_timeout_add ( guint interval , GSourceFunc func , gpointer udata ) {
return b_timeout_add ( interval , ( b_event_handler ) func , udata ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_rsl_ie_starting_time ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset , gboolean is_mandatory ) {
proto_tree * ie_tree ;
guint8 ie_id ;
if ( is_mandatory == FALSE ) {
ie_id = tvb_get_guint8 ( tvb , offset ) ;
if ( ie_id != RSL_IE_STARTING_TIME ) return offset ;
}
ie_tree = proto_tree_add_subtree ( tree , tvb , offset , 3 , ett_ie_staring_time , NULL , "Starting Time IE" ) ;
proto_tree_add_item ( ie_tree , hf_rsl_ie_id , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
proto_tree_add_item ( ie_tree , hf_rsl_req_ref_T1prim , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ie_tree , hf_rsl_req_ref_T3 , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset ++ ;
proto_tree_add_item ( ie_tree , hf_rsl_req_ref_T2 , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | err_status_t srtp_stream_dealloc ( srtp_t session , srtp_stream_ctx_t * stream ) {
err_status_t status ;
if ( session -> stream_template && stream -> rtp_cipher == session -> stream_template -> rtp_cipher ) {
}
else {
status = cipher_dealloc ( stream -> rtp_cipher ) ;
if ( status ) return status ;
}
if ( session -> stream_template && stream -> rtp_auth == session -> stream_template -> rtp_auth ) {
}
else {
status = auth_dealloc ( stream -> rtp_auth ) ;
if ( status ) return status ;
}
if ( session -> stream_template && stream -> limit == session -> stream_template -> limit ) {
}
else {
crypto_free ( stream -> limit ) ;
}
if ( session -> stream_template && stream -> rtcp_cipher == session -> stream_template -> rtcp_cipher ) {
}
else {
status = cipher_dealloc ( stream -> rtcp_cipher ) ;
if ( status ) return status ;
}
if ( session -> stream_template && stream -> rtcp_auth == session -> stream_template -> rtcp_auth ) {
}
else {
status = auth_dealloc ( stream -> rtcp_auth ) ;
if ( status ) return status ;
}
status = rdbx_dealloc ( & stream -> rtp_rdbx ) ;
if ( status ) return status ;
memset ( stream -> salt , 0 , SRTP_AEAD_SALT_LEN ) ;
memset ( stream -> c_salt , 0 , SRTP_AEAD_SALT_LEN ) ;
crypto_free ( stream ) ;
return err_status_ok ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | VIR_ONCE_GLOBAL_INIT ( qemuAgent ) # if DEBUG_RAW_IO # include < c - ctype . h > static char * qemuAgentEscapeNonPrintable ( const char * text ) {
size_t i ;
virBuffer buf = VIR_BUFFER_INITIALIZER ;
for ( i = 0 ;
text [ i ] != '\0' ;
i ++ ) {
if ( text [ i ] == '\\' ) virBufferAddLit ( & buf , "\\\\" ) ;
else if ( c_isprint ( text [ i ] ) || text [ i ] == '\n' || ( text [ i ] == '\r' && text [ i + 1 ] == '\n' ) ) virBufferAddChar ( & buf , text [ i ] ) ;
else virBufferAsprintf ( & buf , "\\x%02x" , text [ i ] ) ;
}
return virBufferContentAndReset ( & buf ) ;
}
# endif static void qemuAgentDispose ( void * obj ) {
qemuAgentPtr mon = obj ;
VIR_DEBUG ( "mon=%p" , mon ) ;
if ( mon -> cb && mon -> cb -> destroy ) ( mon -> cb -> destroy ) ( mon , mon -> vm ) ;
virCondDestroy ( & mon -> notify ) ;
VIR_FREE ( mon -> buffer ) ;
virResetError ( & mon -> lastError ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean is_mpa_req ( tvbuff_t * tvb , packet_info * pinfo ) {
conversation_t * conversation = NULL ;
mpa_state_t * state = NULL ;
guint8 mcrres ;
if ( tvb_get_ntoh64 ( tvb , 0 ) != MPA_REQ_REP_FRAME || tvb_get_ntoh64 ( tvb , 8 ) != MPA_ID_REQ_FRAME ) return FALSE ;
conversation = find_or_create_conversation ( pinfo ) ;
if ( ! get_mpa_state ( conversation ) ) {
state = init_mpa_state ( ) ;
mcrres = tvb_get_guint8 ( tvb , 16 ) ;
state -> ini_exp_m_res = mcrres & MPA_MARKER_FLAG ;
state -> crc = mcrres & MPA_CRC_FLAG ;
state -> revision = tvb_get_guint8 ( tvb , 17 ) ;
state -> req_frame_num = pinfo -> num ;
state -> minfo [ MPA_INITIATOR ] . port = pinfo -> srcport ;
state -> minfo [ MPA_RESPONDER ] . port = pinfo -> destport ;
conversation_add_proto_data ( conversation , proto_iwarp_mpa , state ) ;
if ( mcrres & MPA_RESERVED_FLAG ) expert_add_info ( pinfo , NULL , & ei_mpa_res_field_not_set0 ) ;
if ( state -> revision != 1 ) expert_add_info ( pinfo , NULL , & ei_mpa_rev_field_not_set1 ) ;
}
return TRUE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_MultiplePayloadStreamMode ( 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_MultiplePayloadStreamMode , MultiplePayloadStreamMode_sequence ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int spl_dllist_it_valid ( zend_object_iterator * iter TSRMLS_DC ) {
spl_dllist_it * iterator = ( spl_dllist_it * ) iter ;
spl_ptr_llist_element * element = iterator -> traverse_pointer ;
return ( element != NULL ? SUCCESS : FAILURE ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static vpx_image_t * img_alloc_helper ( vpx_image_t * img , vpx_img_fmt_t fmt , unsigned int d_w , unsigned int d_h , unsigned int buf_align , unsigned int stride_align , unsigned char * img_data ) {
unsigned int h , w , s , xcs , ycs , bps ;
int align ;
if ( ! buf_align ) buf_align = 1 ;
if ( buf_align & ( buf_align - 1 ) ) goto fail ;
if ( ! stride_align ) stride_align = 1 ;
if ( stride_align & ( stride_align - 1 ) ) goto fail ;
switch ( fmt ) {
case VPX_IMG_FMT_RGB32 : case VPX_IMG_FMT_RGB32_LE : case VPX_IMG_FMT_ARGB : case VPX_IMG_FMT_ARGB_LE : bps = 32 ;
break ;
case VPX_IMG_FMT_RGB24 : case VPX_IMG_FMT_BGR24 : bps = 24 ;
break ;
case VPX_IMG_FMT_RGB565 : case VPX_IMG_FMT_RGB565_LE : case VPX_IMG_FMT_RGB555 : case VPX_IMG_FMT_RGB555_LE : case VPX_IMG_FMT_UYVY : case VPX_IMG_FMT_YUY2 : case VPX_IMG_FMT_YVYU : bps = 16 ;
break ;
case VPX_IMG_FMT_I420 : case VPX_IMG_FMT_YV12 : case VPX_IMG_FMT_VPXI420 : case VPX_IMG_FMT_VPXYV12 : bps = 12 ;
break ;
case VPX_IMG_FMT_I422 : bps = 16 ;
break ;
case VPX_IMG_FMT_I444 : bps = 24 ;
break ;
case VPX_IMG_FMT_I42016 : bps = 24 ;
break ;
case VPX_IMG_FMT_I42216 : bps = 32 ;
break ;
case VPX_IMG_FMT_I44416 : bps = 48 ;
break ;
default : bps = 16 ;
break ;
}
switch ( fmt ) {
case VPX_IMG_FMT_I420 : case VPX_IMG_FMT_YV12 : case VPX_IMG_FMT_VPXI420 : case VPX_IMG_FMT_VPXYV12 : case VPX_IMG_FMT_I422 : case VPX_IMG_FMT_I42016 : case VPX_IMG_FMT_I42216 : xcs = 1 ;
break ;
default : xcs = 0 ;
break ;
}
switch ( fmt ) {
case VPX_IMG_FMT_I420 : case VPX_IMG_FMT_YV12 : case VPX_IMG_FMT_VPXI420 : case VPX_IMG_FMT_VPXYV12 : ycs = 1 ;
break ;
default : ycs = 0 ;
break ;
}
align = ( 1 << xcs ) - 1 ;
w = ( d_w + align ) & ~ align ;
align = ( 1 << ycs ) - 1 ;
h = ( d_h + align ) & ~ align ;
s = ( fmt & VPX_IMG_FMT_PLANAR ) ? w : bps * w / 8 ;
s = ( s + stride_align - 1 ) & ~ ( stride_align - 1 ) ;
if ( ! img ) {
img = ( vpx_image_t * ) calloc ( 1 , sizeof ( vpx_image_t ) ) ;
if ( ! img ) goto fail ;
img -> self_allocd = 1 ;
}
else {
memset ( img , 0 , sizeof ( vpx_image_t ) ) ;
}
img -> img_data = img_data ;
if ( ! img_data ) {
img -> img_data = img_buf_memalign ( buf_align , ( ( fmt & VPX_IMG_FMT_PLANAR ) ? h * s * bps / 8 : h * s ) ) ;
img -> img_data_owner = 1 ;
}
if ( ! img -> img_data ) goto fail ;
img -> fmt = fmt ;
img -> bit_depth = ( fmt & VPX_IMG_FMT_HIGH ) ? 16 : 8 ;
img -> w = w ;
img -> h = h ;
img -> x_chroma_shift = xcs ;
img -> y_chroma_shift = ycs ;
img -> bps = bps ;
img -> stride [ VPX_PLANE_Y ] = img -> stride [ VPX_PLANE_ALPHA ] = s ;
img -> stride [ VPX_PLANE_U ] = img -> stride [ VPX_PLANE_V ] = s >> xcs ;
if ( ! vpx_img_set_rect ( img , 0 , 0 , d_w , d_h ) ) return img ;
fail : vpx_img_free ( img ) ;
return NULL ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int cavs_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
AVSContext * h = avctx -> priv_data ;
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
AVFrame * picture = data ;
uint32_t stc = - 1 ;
int input_size ;
const uint8_t * buf_end ;
const uint8_t * buf_ptr ;
if ( buf_size == 0 ) {
if ( ! h -> low_delay && h -> DPB [ 0 ] . f -> data [ 0 ] ) {
* got_frame = 1 ;
* picture = * h -> DPB [ 0 ] . f ;
if ( h -> cur . f -> data [ 0 ] ) avctx -> release_buffer ( avctx , h -> cur . f ) ;
FFSWAP ( AVSFrame , h -> cur , h -> DPB [ 0 ] ) ;
}
return 0 ;
}
buf_ptr = buf ;
buf_end = buf + buf_size ;
for ( ;
;
) {
buf_ptr = avpriv_mpv_find_start_code ( buf_ptr , buf_end , & stc ) ;
if ( ( stc & 0xFFFFFE00 ) || buf_ptr == buf_end ) return FFMAX ( 0 , buf_ptr - buf ) ;
input_size = ( buf_end - buf_ptr ) * 8 ;
switch ( stc ) {
case CAVS_START_CODE : init_get_bits ( & h -> gb , buf_ptr , input_size ) ;
decode_seq_header ( h ) ;
break ;
case PIC_I_START_CODE : if ( ! h -> got_keyframe ) {
if ( h -> DPB [ 0 ] . f -> data [ 0 ] ) avctx -> release_buffer ( avctx , h -> DPB [ 0 ] . f ) ;
if ( h -> DPB [ 1 ] . f -> data [ 0 ] ) avctx -> release_buffer ( avctx , h -> DPB [ 1 ] . f ) ;
h -> got_keyframe = 1 ;
}
case PIC_PB_START_CODE : * got_frame = 0 ;
if ( ! h -> got_keyframe ) break ;
init_get_bits ( & h -> gb , buf_ptr , input_size ) ;
h -> stc = stc ;
if ( decode_pic ( h ) ) break ;
* got_frame = 1 ;
if ( h -> cur . f -> pict_type != AV_PICTURE_TYPE_B ) {
if ( h -> DPB [ 1 ] . f -> data [ 0 ] ) {
* picture = * h -> DPB [ 1 ] . f ;
}
else {
* got_frame = 0 ;
}
}
else * picture = * h -> cur . f ;
break ;
case EXT_START_CODE : break ;
case USER_START_CODE : break ;
default : if ( stc <= SLICE_MAX_START_CODE ) {
init_get_bits ( & h -> gb , buf_ptr , input_size ) ;
decode_slice_header ( h , & h -> gb ) ;
}
break ;
}
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | err_status_t srtp_remove_stream ( srtp_t session , uint32_t ssrc ) {
srtp_stream_ctx_t * stream , * last_stream ;
err_status_t status ;
if ( session == NULL ) return err_status_bad_param ;
last_stream = stream = session -> stream_list ;
while ( ( stream != NULL ) && ( ssrc != stream -> ssrc ) ) {
last_stream = stream ;
stream = stream -> next ;
}
if ( stream == NULL ) return err_status_no_ctx ;
if ( last_stream == stream ) session -> stream_list = stream -> next ;
else last_stream -> next = stream -> next ;
status = srtp_stream_dealloc ( session , stream ) ;
if ( status ) return status ;
return err_status_ok ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void Type_XYZ_Free ( struct _cms_typehandler_struct * self , void * Ptr ) {
_cmsFree ( self -> ContextID , Ptr ) ;
} | 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.