instruction
stringclasses 1
value | input
stringlengths 31
235k
| output
class label 2
classes |
---|---|---|
Categorize the following code snippet as vulnerable or not. True or False | int flush_blocks ( MI_CHECK * param , KEY_CACHE * key_cache , File file ) {
if ( flush_key_blocks ( key_cache , file , FLUSH_RELEASE ) ) {
mi_check_print_error ( param , "%d when trying to write bufferts" , my_errno ) ;
return ( 1 ) ;
}
if ( ! param -> using_global_keycache ) end_key_cache ( key_cache , 1 ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static indic_position_t consonant_position_from_face ( const indic_shape_plan_t * indic_plan , const hb_codepoint_t consonant , const hb_codepoint_t virama , hb_face_t * face ) {
hb_codepoint_t glyphs [ 3 ] = {
virama , consonant , virama }
;
if ( indic_plan -> blwf . would_substitute ( glyphs , 2 , face ) || indic_plan -> blwf . would_substitute ( glyphs + 1 , 2 , face ) ) return POS_BELOW_C ;
if ( indic_plan -> pstf . would_substitute ( glyphs , 2 , face ) || indic_plan -> pstf . would_substitute ( glyphs + 1 , 2 , face ) ) return POS_POST_C ;
unsigned int pref_len = indic_plan -> config -> pref_len ;
if ( ( pref_len == PREF_LEN_2 && ( indic_plan -> pref . would_substitute ( glyphs , 2 , face ) || indic_plan -> pref . would_substitute ( glyphs + 1 , 2 , face ) ) ) || ( pref_len == PREF_LEN_1 && indic_plan -> pref . would_substitute ( glyphs + 1 , 1 , face ) ) ) return POS_POST_C ;
return POS_BASE_C ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void cmd_network_add_modify ( const char * data , gboolean add ) {
GHashTable * optlist ;
char * name , * value ;
void * free_arg ;
IRC_CHATNET_REC * rec ;
if ( ! cmd_get_params ( data , & free_arg , 1 | PARAM_FLAG_OPTIONS , "network add" , & optlist , & name ) ) return ;
if ( * name == '\0' ) cmd_param_error ( CMDERR_NOT_ENOUGH_PARAMS ) ;
rec = ircnet_find ( name ) ;
if ( rec == NULL ) {
if ( add == FALSE ) {
cmd_params_free ( free_arg ) ;
printformat ( NULL , NULL , MSGLEVEL_CLIENTNOTICE , IRCTXT_NETWORK_NOT_FOUND , name ) ;
return ;
}
rec = g_new0 ( IRC_CHATNET_REC , 1 ) ;
rec -> name = g_strdup ( name ) ;
}
else {
if ( g_hash_table_lookup ( optlist , "nick" ) ) g_free_and_null ( rec -> nick ) ;
if ( g_hash_table_lookup ( optlist , "alternate_nick" ) ) g_free_and_null ( rec -> alternate_nick ) ;
if ( g_hash_table_lookup ( optlist , "user" ) ) g_free_and_null ( rec -> username ) ;
if ( g_hash_table_lookup ( optlist , "realname" ) ) g_free_and_null ( rec -> realname ) ;
if ( g_hash_table_lookup ( optlist , "host" ) ) {
g_free_and_null ( rec -> own_host ) ;
rec -> own_ip4 = rec -> own_ip6 = NULL ;
}
if ( g_hash_table_lookup ( optlist , "usermode" ) ) g_free_and_null ( rec -> usermode ) ;
if ( g_hash_table_lookup ( optlist , "autosendcmd" ) ) g_free_and_null ( rec -> autosendcmd ) ;
if ( g_hash_table_lookup ( optlist , "sasl_mechanism" ) ) g_free_and_null ( rec -> sasl_mechanism ) ;
if ( g_hash_table_lookup ( optlist , "sasl_username" ) ) g_free_and_null ( rec -> sasl_username ) ;
if ( g_hash_table_lookup ( optlist , "sasl_password" ) ) g_free_and_null ( rec -> sasl_password ) ;
}
value = g_hash_table_lookup ( optlist , "kicks" ) ;
if ( value != NULL ) rec -> max_kicks = atoi ( value ) ;
value = g_hash_table_lookup ( optlist , "msgs" ) ;
if ( value != NULL ) rec -> max_msgs = atoi ( value ) ;
value = g_hash_table_lookup ( optlist , "modes" ) ;
if ( value != NULL ) rec -> max_modes = atoi ( value ) ;
value = g_hash_table_lookup ( optlist , "whois" ) ;
if ( value != NULL ) rec -> max_whois = atoi ( value ) ;
value = g_hash_table_lookup ( optlist , "cmdspeed" ) ;
if ( value != NULL ) rec -> cmd_queue_speed = atoi ( value ) ;
value = g_hash_table_lookup ( optlist , "cmdmax" ) ;
if ( value != NULL ) rec -> max_cmds_at_once = atoi ( value ) ;
value = g_hash_table_lookup ( optlist , "querychans" ) ;
if ( value != NULL ) rec -> max_query_chans = atoi ( value ) ;
value = g_hash_table_lookup ( optlist , "nick" ) ;
if ( value != NULL && * value != '\0' ) rec -> nick = g_strdup ( value ) ;
value = g_hash_table_lookup ( optlist , "alternate_nick" ) ;
if ( value != NULL && * value != '\0' ) rec -> alternate_nick = g_strdup ( value ) ;
value = g_hash_table_lookup ( optlist , "user" ) ;
if ( value != NULL && * value != '\0' ) rec -> username = g_strdup ( value ) ;
value = g_hash_table_lookup ( optlist , "realname" ) ;
if ( value != NULL && * value != '\0' ) rec -> realname = g_strdup ( value ) ;
value = g_hash_table_lookup ( optlist , "host" ) ;
if ( value != NULL && * value != '\0' ) {
rec -> own_host = g_strdup ( value ) ;
rec -> own_ip4 = rec -> own_ip6 = NULL ;
}
value = g_hash_table_lookup ( optlist , "usermode" ) ;
if ( value != NULL && * value != '\0' ) rec -> usermode = g_strdup ( value ) ;
value = g_hash_table_lookup ( optlist , "autosendcmd" ) ;
if ( value != NULL && * value != '\0' ) rec -> autosendcmd = g_strdup ( value ) ;
value = g_hash_table_lookup ( optlist , "sasl_mechanism" ) ;
if ( value != NULL ) rec -> sasl_mechanism = * value != '\0' ? g_strdup ( value ) : NULL ;
value = g_hash_table_lookup ( optlist , "sasl_username" ) ;
if ( value != NULL ) rec -> sasl_username = * value != '\0' ? g_strdup ( value ) : NULL ;
value = g_hash_table_lookup ( optlist , "sasl_password" ) ;
if ( value != NULL ) rec -> sasl_password = * value != '\0' ? g_strdup ( value ) : NULL ;
ircnet_create ( rec ) ;
printformat ( NULL , NULL , MSGLEVEL_CLIENTNOTICE , IRCTXT_NETWORK_ADDED , name ) ;
cmd_params_free ( free_arg ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int ts_lua_http_server_packet_dscp_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 dscp set" ) ;
TSHttpTxnServerPacketDscpSet ( http_ctx -> txnp , value ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void wpa_sess_add ( u_char * sta , struct wpa_sa * sa ) {
struct wpa_session * e , * s ;
char tmp [ MAX_ASCII_ADDR_LEN ] ;
SAFE_CALLOC ( e , 1 , sizeof ( struct wpa_session ) ) ;
if ( sta ) memcpy ( & e -> sta , sta , ETH_ADDR_LEN ) ;
if ( sa ) {
gettimeofday ( & sa -> tv , NULL ) ;
memcpy ( & e -> sa , sa , sizeof ( struct wpa_sa ) ) ;
}
pthread_mutex_lock ( & root_mutex ) ;
LIST_FOREACH ( s , & wpa_sess_root , next ) {
if ( ! memcmp ( & e -> sta , & s -> sta , ETH_ADDR_LEN ) ) {
if ( sa ) {
memcpy ( & s -> sa , sa , sizeof ( struct wpa_sa ) ) ;
gettimeofday ( & s -> sa . tv , NULL ) ;
}
USER_MSG ( "WPA session updated for [%s]\n" , mac_addr_ntoa ( e -> sta , tmp ) ) ;
pthread_mutex_unlock ( & root_mutex ) ;
return ;
}
}
LIST_INSERT_HEAD ( & wpa_sess_root , e , next ) ;
pthread_mutex_unlock ( & root_mutex ) ;
USER_MSG ( "New WPA session for [%s]\n" , mac_addr_ntoa ( e -> sta , tmp ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int ossl_cipher_update_long ( EVP_CIPHER_CTX * ctx , unsigned char * out , long * out_len_ptr , const unsigned char * in , long in_len ) {
int out_part_len ;
int limit = INT_MAX / 2 + 1 ;
long out_len = 0 ;
do {
int in_part_len = in_len > limit ? limit : ( int ) in_len ;
if ( ! EVP_CipherUpdate ( ctx , out ? ( out + out_len ) : 0 , & out_part_len , in , in_part_len ) ) return 0 ;
out_len += out_part_len ;
in += in_part_len ;
}
while ( ( in_len -= limit ) > 0 ) ;
if ( out_len_ptr ) * out_len_ptr = out_len ;
return 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static uint32_t nvic_readl ( nvic_state * s , uint32_t offset ) {
uint32_t val ;
int irq ;
switch ( offset ) {
case 4 : return ( s -> num_irq / 32 ) - 1 ;
case 0x10 : val = s -> systick . control ;
s -> systick . control &= ~ SYSTICK_COUNTFLAG ;
return val ;
case 0x14 : return s -> systick . reload ;
case 0x18 : {
int64_t t ;
if ( ( s -> systick . control & SYSTICK_ENABLE ) == 0 ) return 0 ;
t = qemu_get_clock_ns ( vm_clock ) ;
if ( t >= s -> systick . tick ) return 0 ;
val = ( ( s -> systick . tick - ( t + 1 ) ) / systick_scale ( s ) ) + 1 ;
if ( val > s -> systick . reload ) val = 0 ;
return val ;
}
case 0x1c : return 10000 ;
case 0xd00 : return cpu_single_env -> cp15 . c0_cpuid ;
case 0xd04 : val = s -> gic . running_irq [ 0 ] ;
if ( val == 1023 ) {
val = 0 ;
}
else if ( val >= 32 ) {
val -= 16 ;
}
if ( s -> gic . running_irq [ 0 ] == 1023 || s -> gic . last_active [ s -> gic . running_irq [ 0 ] ] [ 0 ] == 1023 ) {
val |= ( 1 << 11 ) ;
}
if ( s -> gic . current_pending [ 0 ] != 1023 ) val |= ( s -> gic . current_pending [ 0 ] << 12 ) ;
for ( irq = 32 ;
irq < s -> num_irq ;
irq ++ ) {
if ( s -> gic . irq_state [ irq ] . pending ) {
val |= ( 1 << 22 ) ;
break ;
}
}
if ( s -> gic . irq_state [ ARMV7M_EXCP_SYSTICK ] . pending ) val |= ( 1 << 26 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_PENDSV ] . pending ) val |= ( 1 << 28 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_NMI ] . pending ) val |= ( 1 << 31 ) ;
return val ;
case 0xd08 : return cpu_single_env -> v7m . vecbase ;
case 0xd0c : return 0xfa05000 ;
case 0xd10 : return 0 ;
case 0xd14 : return 0 ;
case 0xd24 : val = 0 ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_MEM ] . active ) val |= ( 1 << 0 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_BUS ] . active ) val |= ( 1 << 1 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_USAGE ] . active ) val |= ( 1 << 3 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_SVC ] . active ) val |= ( 1 << 7 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_DEBUG ] . active ) val |= ( 1 << 8 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_PENDSV ] . active ) val |= ( 1 << 10 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_SYSTICK ] . active ) val |= ( 1 << 11 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_USAGE ] . pending ) val |= ( 1 << 12 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_MEM ] . pending ) val |= ( 1 << 13 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_BUS ] . pending ) val |= ( 1 << 14 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_SVC ] . pending ) val |= ( 1 << 15 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_MEM ] . enabled ) val |= ( 1 << 16 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_BUS ] . enabled ) val |= ( 1 << 17 ) ;
if ( s -> gic . irq_state [ ARMV7M_EXCP_USAGE ] . enabled ) val |= ( 1 << 18 ) ;
return val ;
case 0xd28 : qemu_log_mask ( LOG_UNIMP , "Configurable Fault Status unimplemented\n" ) ;
return 0 ;
case 0xd2c : case 0xd30 : case 0xd34 : case 0xd38 : case 0xd3c : qemu_log_mask ( LOG_UNIMP , "Fault status registers unimplemented\n" ) ;
return 0 ;
case 0xd40 : return 0x00000030 ;
case 0xd44 : return 0x00000200 ;
case 0xd48 : return 0x00100000 ;
case 0xd4c : return 0x00000000 ;
case 0xd50 : return 0x00000030 ;
case 0xd54 : return 0x00000000 ;
case 0xd58 : return 0x00000000 ;
case 0xd5c : return 0x00000000 ;
case 0xd60 : return 0x01141110 ;
case 0xd64 : return 0x02111000 ;
case 0xd68 : return 0x21112231 ;
case 0xd6c : return 0x01111110 ;
case 0xd70 : return 0x01310102 ;
default : qemu_log_mask ( LOG_GUEST_ERROR , "NVIC: Bad read offset 0x%x\n" , offset ) ;
return 0 ;
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_zbee_zcl_groups ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) {
proto_tree * payload_tree ;
zbee_zcl_packet * zcl ;
guint offset = 0 ;
guint8 cmd_id ;
gint rem_len ;
if ( data == NULL ) return 0 ;
zcl = ( zbee_zcl_packet * ) data ;
cmd_id = zcl -> cmd_id ;
if ( zcl -> direction == ZBEE_ZCL_FCF_TO_SERVER ) {
col_append_fstr ( pinfo -> cinfo , COL_INFO , "%s, Seq: %u" , val_to_str_const ( cmd_id , zbee_zcl_groups_srv_rx_cmd_names , "Unknown Command" ) , zcl -> tran_seqno ) ;
proto_tree_add_item ( tree , hf_zbee_zcl_groups_srv_rx_cmd_id , tvb , offset , 1 , cmd_id ) ;
rem_len = tvb_reported_length_remaining ( tvb , ++ offset ) ;
if ( rem_len > 0 ) {
payload_tree = proto_tree_add_subtree ( tree , tvb , offset , rem_len , ett_zbee_zcl_groups , NULL , "Payload" ) ;
switch ( cmd_id ) {
case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP : dissect_zcl_groups_add_group_or_if_identifying ( tvb , payload_tree , & offset ) ;
break ;
case ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP : dissect_zcl_groups_view_group ( tvb , payload_tree , & offset ) ;
break ;
case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GET_GROUP_MEMBERSHIP : dissect_zcl_groups_get_group_membership ( tvb , payload_tree , & offset ) ;
break ;
case ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP : dissect_zcl_groups_remove_group ( tvb , payload_tree , & offset ) ;
break ;
case ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_ALL_GROUPS : break ;
case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_IF_IDENTIFYING : dissect_zcl_groups_add_group_or_if_identifying ( tvb , payload_tree , & offset ) ;
break ;
default : break ;
}
}
}
else {
col_append_fstr ( pinfo -> cinfo , COL_INFO , "%s, Seq: %u" , val_to_str_const ( cmd_id , zbee_zcl_groups_srv_tx_cmd_names , "Unknown Command" ) , zcl -> tran_seqno ) ;
proto_tree_add_item ( tree , hf_zbee_zcl_groups_srv_tx_cmd_id , tvb , offset , 1 , cmd_id ) ;
rem_len = tvb_reported_length_remaining ( tvb , ++ offset ) ;
if ( rem_len > 0 ) {
payload_tree = proto_tree_add_subtree ( tree , tvb , offset , rem_len , ett_zbee_zcl_groups , NULL , "Payload" ) ;
switch ( cmd_id ) {
case ZBEE_ZCL_CMD_ID_GROUPS_ADD_GROUP_RESPONSE : dissect_zcl_groups_add_remove_group_response ( tvb , payload_tree , & offset ) ;
break ;
case ZBEE_ZCL_CMD_ID_GROUPS_VIEW_GROUP_RESPONSE : dissect_zcl_groups_view_group_response ( tvb , payload_tree , & offset ) ;
break ;
case ZBEE_ZCL_CMD_ID_GROUPS_GET_GROUP_MEMBERSHIP_RESPONSE : dissect_zcl_groups_get_group_membership_response ( tvb , payload_tree , & offset ) ;
break ;
case ZBEE_ZCL_CMD_ID_GROUPS_REMOVE_GROUP_RESPONSE : dissect_zcl_groups_add_remove_group_response ( tvb , payload_tree , & offset ) ;
break ;
default : break ;
}
}
}
return tvb_captured_length ( tvb ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | GType hb_gobject_ ## name ## _get_type ( void ) \ {
static gsize type_id = 0 ;
if ( g_once_init_enter ( & type_id ) ) {
GType id = g_boxed_type_register_static ( g_intern_static_string ( "hb_" # name "_t" ) , ( GBoxedCopyFunc ) copy_func , ( GBoxedFreeFunc ) free_func ) ;
g_once_init_leave ( & type_id , id ) ;
}
return type_id ;
\ }
# define HB_DEFINE_OBJECT_TYPE ( name ) HB_DEFINE_BOXED_TYPE ( name , hb_ ## name ## _reference , hb_ ## name ## _destroy ) ;
# define HB_DEFINE_VALUE_TYPE ( name ) static hb_ ## name ## _t * _hb_ ## name ## _reference ( const hb_ ## name ## _t * l ) {
hb_ ## name ## _t * c = ( hb_ ## name ## _t * ) calloc ( 1 , sizeof ( hb_ ## name ## _t ) ) ;
if ( unlikely ( ! c ) ) return NULL ;
* c = * l ;
return c ;
}
static void _hb_ ## name ## _destroy ( hb_ ## name ## _t * l ) {
free ( l ) ;
}
HB_DEFINE_BOXED_TYPE ( name , _hb_ ## name ## _reference , _hb_ ## name ## _destroy ) ;
HB_DEFINE_OBJECT_TYPE ( buffer ) HB_DEFINE_OBJECT_TYPE ( blob ) HB_DEFINE_OBJECT_TYPE ( face ) HB_DEFINE_OBJECT_TYPE ( font ) HB_DEFINE_OBJECT_TYPE ( font_funcs ) HB_DEFINE_OBJECT_TYPE ( set ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static struct FrameData * fd_create ( void * buf , size_t size , vpx_codec_frame_flags_t flags ) {
struct FrameData * const frame_data = ( struct FrameData * ) vpx_malloc ( sizeof ( * frame_data ) ) ;
if ( frame_data == NULL ) {
return NULL ;
}
frame_data -> buf = vpx_malloc ( size ) ;
if ( frame_data -> buf == NULL ) {
vpx_free ( frame_data ) ;
return NULL ;
}
vpx_memcpy ( frame_data -> buf , buf , size ) ;
frame_data -> size = size ;
frame_data -> flags = flags ;
return frame_data ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( UnloadTest , BrowserListDoubleCloseBeforeUnloadOK ) {
NavigateToDataURL ( BEFORE_UNLOAD_HTML , "beforeunload" ) ;
content : : WindowedNotificationObserver window_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , content : : NotificationService : : AllSources ( ) ) ;
UnloadResults unload_results ;
BrowserList : : CloseAllBrowsersWithProfile ( browser ( ) -> profile ( ) , base : : Bind ( & UnloadResults : : AddSuccess , base : : Unretained ( & unload_results ) ) , base : : Bind ( & UnloadResults : : AddAbort , base : : Unretained ( & unload_results ) ) , false ) ;
BrowserList : : CloseAllBrowsersWithProfile ( browser ( ) -> profile ( ) , base : : Bind ( & UnloadResults : : AddSuccess , base : : Unretained ( & unload_results ) ) , base : : Bind ( & UnloadResults : : AddAbort , base : : Unretained ( & unload_results ) ) , false ) ;
ClickModalDialogButton ( true ) ;
window_observer . Wait ( ) ;
EXPECT_EQ ( 1 , unload_results . get_successes ( ) ) ;
EXPECT_EQ ( 0 , unload_results . get_aborts ( ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void get_residual ( int16_t * residual , int16_t * prev_excitation , int lag ) {
int offset = PITCH_MAX - PITCH_ORDER / 2 - lag ;
int i ;
residual [ 0 ] = prev_excitation [ offset ] ;
residual [ 1 ] = prev_excitation [ offset + 1 ] ;
offset += 2 ;
for ( i = 2 ;
i < SUBFRAME_LEN + PITCH_ORDER - 1 ;
i ++ ) residual [ i ] = prev_excitation [ offset + ( i - 2 ) % lag ] ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int jbig2_end_of_stripe ( Jbig2Ctx * ctx , Jbig2Segment * segment , const uint8_t * segment_data ) {
Jbig2Page page = ctx -> pages [ ctx -> current_page ] ;
uint32_t end_row ;
end_row = jbig2_get_uint32 ( segment_data ) ;
if ( end_row < page . end_row ) {
jbig2_error ( ctx , JBIG2_SEVERITY_WARNING , segment -> number , "end of stripe segment with non-positive end row advance" " (new end row %d vs current end row %d)" , end_row , page . end_row ) ;
}
else {
jbig2_error ( ctx , JBIG2_SEVERITY_INFO , segment -> number , "end of stripe: advancing end row to %d" , end_row ) ;
}
page . end_row = end_row ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int virtio_net_load ( QEMUFile * f , void * opaque , int version_id ) {
VirtIONet * n = opaque ;
int i ;
int ret ;
if ( version_id < 2 || version_id > VIRTIO_NET_VM_VERSION ) return - EINVAL ;
ret = virtio_load ( & n -> vdev , f ) ;
if ( ret ) {
return ret ;
}
qemu_get_buffer ( f , n -> mac , ETH_ALEN ) ;
n -> tx_waiting = qemu_get_be32 ( f ) ;
n -> mergeable_rx_bufs = qemu_get_be32 ( f ) ;
if ( version_id >= 3 ) n -> status = qemu_get_be16 ( f ) ;
if ( version_id >= 4 ) {
if ( version_id < 8 ) {
n -> promisc = qemu_get_be32 ( f ) ;
n -> allmulti = qemu_get_be32 ( f ) ;
}
else {
n -> promisc = qemu_get_byte ( f ) ;
n -> allmulti = qemu_get_byte ( f ) ;
}
}
if ( version_id >= 5 ) {
n -> mac_table . in_use = qemu_get_be32 ( f ) ;
if ( n -> mac_table . in_use <= MAC_TABLE_ENTRIES ) {
qemu_get_buffer ( f , n -> mac_table . macs , n -> mac_table . in_use * ETH_ALEN ) ;
}
else if ( n -> mac_table . in_use ) {
qemu_fseek ( f , n -> mac_table . in_use * ETH_ALEN , SEEK_CUR ) ;
n -> mac_table . multi_overflow = n -> mac_table . uni_overflow = 1 ;
n -> mac_table . in_use = 0 ;
}
}
if ( version_id >= 6 ) qemu_get_buffer ( f , ( uint8_t * ) n -> vlans , MAX_VLAN >> 3 ) ;
if ( version_id >= 7 ) {
if ( qemu_get_be32 ( f ) && ! peer_has_vnet_hdr ( n ) ) {
error_report ( "virtio-net: saved image requires vnet_hdr=on" ) ;
return - 1 ;
}
if ( n -> has_vnet_hdr ) {
tap_using_vnet_hdr ( n -> nic -> nc . peer , 1 ) ;
tap_set_offload ( n -> nic -> nc . peer , ( n -> vdev . guest_features >> VIRTIO_NET_F_GUEST_CSUM ) & 1 , ( n -> vdev . guest_features >> VIRTIO_NET_F_GUEST_TSO4 ) & 1 , ( n -> vdev . guest_features >> VIRTIO_NET_F_GUEST_TSO6 ) & 1 , ( n -> vdev . guest_features >> VIRTIO_NET_F_GUEST_ECN ) & 1 , ( n -> vdev . guest_features >> VIRTIO_NET_F_GUEST_UFO ) & 1 ) ;
}
}
if ( version_id >= 9 ) {
n -> mac_table . multi_overflow = qemu_get_byte ( f ) ;
n -> mac_table . uni_overflow = qemu_get_byte ( f ) ;
}
if ( version_id >= 10 ) {
n -> alluni = qemu_get_byte ( f ) ;
n -> nomulti = qemu_get_byte ( f ) ;
n -> nouni = qemu_get_byte ( f ) ;
n -> nobcast = qemu_get_byte ( f ) ;
}
if ( version_id >= 11 ) {
if ( qemu_get_byte ( f ) && ! peer_has_ufo ( n ) ) {
error_report ( "virtio-net: saved image requires TUN_F_UFO support" ) ;
return - 1 ;
}
}
for ( i = 0 ;
i < n -> mac_table . in_use ;
i ++ ) {
if ( n -> mac_table . macs [ i * ETH_ALEN ] & 1 ) {
break ;
}
}
n -> mac_table . first_multi = i ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_BMPString ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_BMPString ( tvb , offset , actx , tree , hf_index , NO_BOUND , NO_BOUND , FALSE ) ;
return offset ;
} | 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 ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | unsigned long # define BN_LONG long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK ( 0xffffffffffffffffffffffffffffffffLL ) # define BN_MASK2 ( 0xffffffffffffffffL ) # define BN_MASK2l ( 0xffffffffL ) # define BN_MASK2h ( 0xffffffff00000000L ) # define BN_MASK2h1 ( 0xffffffff80000000L ) # define BN_TBIT ( 0x8000000000000000L ) # define BN_DEC_CONV ( 10000000000000000000UL ) # define BN_DEC_FMT1 "%lu" # define BN_DEC_FMT2 "%019lu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%lX" # define BN_HEX_FMT2 "%016lX" # endif # ifdef SIXTY_FOUR_BIT # undef BN_LLONG # undef BN_ULLONG # define BN_ULONG unsigned long long # define BN_LONG long long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK2 ( 0xffffffffffffffffLL ) # define BN_MASK2l ( 0xffffffffL ) # define BN_MASK2h ( 0xffffffff00000000LL ) # define BN_MASK2h1 ( 0xffffffff80000000LL ) # define BN_TBIT ( 0x8000000000000000LL ) # define BN_DEC_CONV ( 10000000000000000000ULL ) # define BN_DEC_FMT1 "%llu" # define BN_DEC_FMT2 "%019llu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%llX" # define BN_HEX_FMT2 "%016llX" # endif # ifdef THIRTY_TWO_BIT # ifdef BN_LLONG # if defined ( _WIN32 ) && ! defined ( __GNUC__ ) # define BN_ULLONG unsigned __int64 # define BN_MASK ( 0xffffffffffffffffI64 ) # else # define BN_ULLONG unsigned long long # define BN_MASK ( 0xffffffffffffffffLL ) # endif # endif # define BN_ULONG unsigned int # define BN_LONG int # define BN_BITS 64 # define BN_BYTES 4 # define BN_BITS2 32 # define BN_BITS4 16 # define BN_MASK2 ( 0xffffffffL ) # define BN_MASK2l ( 0xffff ) # define BN_MASK2h1 ( 0xffff8000L ) # define BN_MASK2h ( 0xffff0000L ) # define BN_TBIT ( 0x80000000L ) # define BN_DEC_CONV ( 1000000000L ) # define BN_DEC_FMT1 "%u" # define BN_DEC_FMT2 "%09u" # define BN_DEC_NUM 9 # define BN_HEX_FMT1 "%X" # define BN_HEX_FMT2 "%08X" # endif # define BN_DEFAULT_BITS 1280 # define BN_FLG_MALLOCED 0x01 # define BN_FLG_STATIC_DATA 0x02 # define BN_FLG_CONSTTIME 0x04 # ifndef OPENSSL_NO_DEPRECATED # define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME # endif # ifndef OPENSSL_NO_DEPRECATED # define BN_FLG_FREE 0x8000 # endif # define BN_set_flags ( b , n ) ( ( b ) -> flags |= ( n ) ) # define BN_get_flags ( b , n ) ( ( b ) -> flags & ( n ) ) # define BN_with_flags ( dest , b , n ) ( ( dest ) -> d = ( b ) -> d , \ ( dest ) -> top = ( b ) -> top , \ ( dest ) -> dmax = ( b ) -> dmax , \ ( dest ) -> neg = ( b ) -> neg , \ ( dest ) -> flags = ( ( ( dest ) -> flags & BN_FLG_MALLOCED ) \ | ( ( b ) -> flags & ~ BN_FLG_MALLOCED ) \ | BN_FLG_STATIC_DATA \ | ( n ) ) ) # if 0 typedef struct bignum_st BIGNUM ;
typedef struct bignum_ctx BN_CTX ;
typedef struct bn_blinding_st BN_BLINDING ;
typedef struct bn_mont_ctx_st BN_MONT_CTX ;
typedef struct bn_recp_ctx_st BN_RECP_CTX ;
typedef struct bn_gencb_st BN_GENCB ;
# endif struct bignum_st {
BN_ULONG * d ;
int top ;
int dmax ;
int neg ;
int flags ;
}
;
struct bn_mont_ctx_st {
int ri ;
BIGNUM RR ;
BIGNUM N ;
BIGNUM Ni ;
BN_ULONG n0 [ 2 ] ;
int flags ;
}
;
struct bn_recp_ctx_st {
BIGNUM N ;
BIGNUM Nr ;
int num_bits ;
int shift ;
int flags ;
}
;
struct bn_gencb_st {
unsigned int ver ;
void * arg ;
union {
void ( * cb_1 ) ( int , int , void * ) ;
int ( * cb_2 ) ( int , int , BN_GENCB * ) ;
}
cb ;
}
;
int BN_GENCB_call ( BN_GENCB * cb , int a , int b ) ;
# define BN_GENCB_set_old ( gencb , callback , cb_arg ) {
\ BN_GENCB * tmp_gencb = ( gencb ) ;
\ tmp_gencb -> ver = 1 ;
\ tmp_gencb -> arg = ( cb_arg ) ;
\ tmp_gencb -> cb . cb_1 = ( callback ) ;
}
# define BN_GENCB_set ( gencb , callback , cb_arg ) {
\ BN_GENCB * tmp_gencb = ( gencb ) ;
\ tmp_gencb -> ver = 2 ;
\ tmp_gencb -> arg = ( cb_arg ) ;
\ tmp_gencb -> cb . cb_2 = ( callback ) ;
}
# define BN_prime_checks 0 # define BN_prime_checks_for_size ( b ) ( ( b ) >= 1300 ? 2 : \ ( b ) >= 850 ? 3 : \ ( b ) >= 650 ? 4 : \ ( b ) >= 550 ? 5 : \ ( b ) >= 450 ? 6 : \ ( b ) >= 400 ? 7 : \ ( b ) >= 350 ? 8 : \ ( b ) >= 300 ? 9 : \ ( b ) >= 250 ? 12 : \ ( b ) >= 200 ? 15 : \ ( b ) >= 150 ? 18 : \ 27 ) # define BN_num_bytes ( a ) ( ( BN_num_bits ( a ) + 7 ) / 8 ) # define BN_abs_is_word ( a , w ) ( ( ( ( a ) -> top == 1 ) && ( ( a ) -> d [ 0 ] == ( BN_ULONG ) ( w ) ) ) || \ ( ( ( w ) == 0 ) && ( ( a ) -> top == 0 ) ) ) # define BN_is_zero ( a ) ( ( a ) -> top == 0 ) # define BN_is_one ( a ) ( BN_abs_is_word ( ( a ) , 1 ) && ! ( a ) -> neg ) # define BN_is_word ( a , w ) ( BN_abs_is_word ( ( a ) , ( w ) ) && ( ! ( w ) || ! ( a ) -> neg ) ) # define BN_is_odd ( a ) ( ( ( a ) -> top > 0 ) && ( ( a ) -> d [ 0 ] & 1 ) ) # define BN_one ( a ) ( BN_set_word ( ( a ) , 1 ) ) # define BN_zero_ex ( a ) \ do {
\ BIGNUM * _tmp_bn = ( a ) ;
\ _tmp_bn -> top = 0 ;
\ _tmp_bn -> neg = 0 ;
\ }
while ( 0 ) # ifdef OPENSSL_NO_DEPRECATED # define BN_zero ( a ) BN_zero_ex ( a ) # else # define BN_zero ( a ) ( BN_set_word ( ( a ) , 0 ) ) # endif const BIGNUM * BN_value_one ( void ) ;
char * BN_options ( void ) ;
BN_CTX * BN_CTX_new ( void ) ;
# ifndef OPENSSL_NO_DEPRECATED void BN_CTX_init ( BN_CTX * c ) ;
# endif void BN_CTX_free ( BN_CTX * c ) ;
void BN_CTX_start ( BN_CTX * ctx ) ;
BIGNUM * BN_CTX_get ( BN_CTX * ctx ) ;
void BN_CTX_end ( BN_CTX * ctx ) ;
int BN_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ;
int BN_pseudo_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ;
int BN_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ;
int BN_pseudo_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ;
int BN_num_bits ( const BIGNUM * a ) ;
int BN_num_bits_word ( BN_ULONG l ) ;
BIGNUM * BN_new ( void ) ;
void BN_init ( BIGNUM * ) ;
void BN_clear_free ( BIGNUM * a ) ;
BIGNUM * BN_copy ( BIGNUM * a , const BIGNUM * b ) ;
void BN_swap ( BIGNUM * a , BIGNUM * b ) ;
BIGNUM * BN_bin2bn ( const unsigned char * s , int len , BIGNUM * ret ) ;
int BN_bn2bin ( const BIGNUM * a , unsigned char * to ) ;
BIGNUM * BN_mpi2bn ( const unsigned char * s , int len , BIGNUM * ret ) ;
int BN_bn2mpi ( const BIGNUM * a , unsigned char * to ) ;
int BN_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_usub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_uadd ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ;
int BN_sqr ( BIGNUM * r , const BIGNUM * a , BN_CTX * ctx ) ;
void BN_set_negative ( BIGNUM * b , int n ) ;
# define BN_is_negative ( a ) ( ( a ) -> neg != 0 ) int BN_div ( BIGNUM * dv , BIGNUM * rem , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ;
# define BN_mod ( rem , m , d , ctx ) BN_div ( NULL , ( rem ) , ( m ) , ( d ) , ( ctx ) ) int BN_nnmod ( BIGNUM * r , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ;
int BN_mod_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_add_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ;
int BN_mod_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_sub_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ;
int BN_mod_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_sqr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_lshift1 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_lshift1_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m ) ;
int BN_mod_lshift ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_lshift_quick ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m ) ;
BN_ULONG BN_mod_word ( const BIGNUM * a , BN_ULONG w ) ;
BN_ULONG BN_div_word ( BIGNUM * a , BN_ULONG w ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void decStatus ( decNumber * dn , uInt status , decContext * set ) {
if ( status & DEC_NaNs ) {
if ( status & DEC_sNaN ) status &= ~ DEC_sNaN ;
else {
uprv_decNumberZero ( dn ) ;
dn -> bits = DECNAN ;
}
}
uprv_decContextSetStatus ( set , status ) ;
return ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | bool isWriteable ( TSMBuffer bufp ) {
if ( bufp != nullptr ) {
return ( ( HdrHeapSDKHandle * ) bufp ) -> m_heap -> m_writeable ;
}
return false ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int remoteStreamHandleFinish ( struct qemud_client * client , struct qemud_client_stream * stream , struct qemud_client_message * msg ) {
remote_error rerr ;
int ret ;
VIR_DEBUG ( "stream=%p proc=%d serial=%d" , stream , msg -> hdr . proc , msg -> hdr . serial ) ;
memset ( & rerr , 0 , sizeof rerr ) ;
stream -> closed = 1 ;
virStreamEventRemoveCallback ( stream -> st ) ;
ret = virStreamFinish ( stream -> st ) ;
if ( ret < 0 ) {
remoteDispatchError ( & rerr ) ;
return remoteSerializeReplyError ( client , & rerr , & msg -> hdr ) ;
}
else {
if ( remoteSendStreamData ( client , stream , NULL , 0 ) < 0 ) return - 1 ;
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int nntp_mbox_check ( struct Context * ctx , int * index_hint ) {
int ret = check_mailbox ( ctx ) ;
if ( ret == 0 ) {
struct NntpData * nntp_data = ctx -> data ;
struct NntpServer * nserv = nntp_data -> nserv ;
nntp_newsrc_close ( nserv ) ;
}
return ret ;
} | 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 ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void register_type_length_mismatch ( void ) {
static ei_register_info ei [ ] = {
{
& ei_type_length_mismatch_error , {
"_ws.type_length.mismatch" , PI_MALFORMED , PI_ERROR , "Trying to fetch X with length Y" , EXPFILL }
}
, {
& ei_type_length_mismatch_warn , {
"_ws.type_length.mismatch" , PI_MALFORMED , PI_WARN , "Trying to fetch X with length Y" , EXPFILL }
}
, }
;
expert_module_t * expert_type_length_mismatch ;
proto_type_length_mismatch = proto_register_protocol ( "Type Length Mismatch" , "Type length mismatch" , "_ws.type_length" ) ;
expert_type_length_mismatch = expert_register_protocol ( proto_type_length_mismatch ) ;
expert_register_field_array ( expert_type_length_mismatch , ei , array_length ( ei ) ) ;
proto_set_cant_toggle ( proto_type_length_mismatch ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void get_hfi_length ( header_field_info * hfinfo , tvbuff_t * tvb , const gint start , gint * length , gint * item_length ) {
gint length_remaining ;
DISSECTOR_ASSERT ( tvb != NULL || * length == 0 ) ;
if ( * length == - 1 ) {
switch ( hfinfo -> type ) {
case FT_PROTOCOL : case FT_NONE : case FT_BYTES : case FT_STRING : case FT_STRINGZPAD : * length = tvb_captured_length ( tvb ) ? tvb_ensure_captured_length_remaining ( tvb , start ) : 0 ;
DISSECTOR_ASSERT ( * length >= 0 ) ;
break ;
case FT_STRINGZ : break ;
default : THROW ( ReportedBoundsError ) ;
DISSECTOR_ASSERT_NOT_REACHED ( ) ;
}
* item_length = * length ;
}
else {
* item_length = * length ;
if ( hfinfo -> type == FT_PROTOCOL || hfinfo -> type == FT_NONE ) {
if ( tvb ) {
length_remaining = tvb_captured_length_remaining ( tvb , start ) ;
if ( * item_length < 0 || ( * item_length > 0 && ( length_remaining < * item_length ) ) ) * item_length = length_remaining ;
}
}
if ( * item_length < 0 ) {
THROW ( ReportedBoundsError ) ;
}
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int32_t U_CALLCONV lenient8IteratorMove ( UCharIterator * iter , int32_t delta , UCharIteratorOrigin origin ) {
const uint8_t * s ;
UChar32 c ;
int32_t pos ;
int32_t i ;
UBool havePos ;
switch ( origin ) {
case UITER_ZERO : case UITER_START : pos = delta ;
havePos = TRUE ;
break ;
case UITER_CURRENT : if ( iter -> index >= 0 ) {
pos = iter -> index + delta ;
havePos = TRUE ;
}
else {
pos = 0 ;
havePos = FALSE ;
}
break ;
case UITER_LIMIT : case UITER_LENGTH : if ( iter -> length >= 0 ) {
pos = iter -> length + delta ;
havePos = TRUE ;
}
else {
iter -> index = - 1 ;
iter -> start = iter -> limit ;
iter -> reservedField = 0 ;
if ( delta >= 0 ) {
return UITER_UNKNOWN_INDEX ;
}
else {
pos = 0 ;
havePos = FALSE ;
}
}
break ;
default : return - 1 ;
}
if ( havePos ) {
if ( pos <= 0 ) {
iter -> index = iter -> start = iter -> reservedField = 0 ;
return 0 ;
}
else if ( iter -> length >= 0 && pos >= iter -> length ) {
iter -> index = iter -> length ;
iter -> start = iter -> limit ;
iter -> reservedField = 0 ;
return iter -> index ;
}
if ( iter -> index < 0 || pos < iter -> index / 2 ) {
iter -> index = iter -> start = iter -> reservedField = 0 ;
}
else if ( iter -> length >= 0 && ( iter -> length - pos ) < ( pos - iter -> index ) ) {
iter -> index = iter -> length ;
iter -> start = iter -> limit ;
iter -> reservedField = 0 ;
}
delta = pos - iter -> index ;
if ( delta == 0 ) {
return iter -> index ;
}
}
else {
if ( delta == 0 ) {
return UITER_UNKNOWN_INDEX ;
}
else if ( - delta >= iter -> start ) {
iter -> index = iter -> start = iter -> reservedField = 0 ;
return 0 ;
}
else if ( delta >= ( iter -> limit - iter -> start ) ) {
iter -> index = iter -> length ;
iter -> start = iter -> limit ;
iter -> reservedField = 0 ;
return iter -> index >= 0 ? iter -> index : UITER_UNKNOWN_INDEX ;
}
}
s = ( const uint8_t * ) iter -> context ;
pos = iter -> index ;
i = iter -> start ;
if ( delta > 0 ) {
int32_t limit = iter -> limit ;
if ( iter -> reservedField != 0 ) {
iter -> reservedField = 0 ;
++ pos ;
-- delta ;
}
while ( delta > 0 && i < limit ) {
L8_NEXT ( s , i , limit , c ) ;
if ( c < 0xffff ) {
++ pos ;
-- delta ;
}
else if ( delta >= 2 ) {
pos += 2 ;
delta -= 2 ;
}
else {
iter -> reservedField = c ;
++ pos ;
break ;
}
}
if ( i == limit ) {
if ( iter -> length < 0 && iter -> index >= 0 ) {
iter -> length = iter -> reservedField == 0 ? pos : pos + 1 ;
}
else if ( iter -> index < 0 && iter -> length >= 0 ) {
iter -> index = iter -> reservedField == 0 ? iter -> length : iter -> length - 1 ;
}
}
}
else {
if ( iter -> reservedField != 0 ) {
iter -> reservedField = 0 ;
i -= 4 ;
-- pos ;
++ delta ;
}
while ( delta < 0 && i > 0 ) {
L8_PREV ( s , 0 , i , c ) ;
if ( c < 0xffff ) {
-- pos ;
++ delta ;
}
else if ( delta <= - 2 ) {
pos -= 2 ;
delta += 2 ;
}
else {
i += 4 ;
iter -> reservedField = c ;
-- pos ;
break ;
}
}
}
iter -> start = i ;
if ( iter -> index >= 0 ) {
return iter -> index = pos ;
}
else {
if ( i <= 1 ) {
return iter -> index = i ;
}
else {
return UITER_UNKNOWN_INDEX ;
}
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static GURL ToAndFromOriginIdentifier ( const GURL origin_url ) {
std : : string id = webkit_database : : GetIdentifierFromOrigin ( origin_url ) ;
return webkit_database : : GetOriginFromIdentifier ( id ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline void mv_pred_direct ( AVSContext * h , cavs_vector * pmv_fw , cavs_vector * col_mv ) {
cavs_vector * pmv_bw = pmv_fw + MV_BWD_OFFS ;
int den = h -> direct_den [ col_mv -> ref ] ;
int m = col_mv -> x >> 31 ;
pmv_fw -> dist = h -> dist [ 1 ] ;
pmv_bw -> dist = h -> dist [ 0 ] ;
pmv_fw -> ref = 1 ;
pmv_bw -> ref = 0 ;
pmv_fw -> x = ( ( ( den + ( den * col_mv -> x * pmv_fw -> dist ^ m ) - m - 1 ) >> 14 ) ^ m ) - m ;
pmv_bw -> x = m - ( ( ( den + ( den * col_mv -> x * pmv_bw -> dist ^ m ) - m - 1 ) >> 14 ) ^ m ) ;
m = col_mv -> y >> 31 ;
pmv_fw -> y = ( ( ( den + ( den * col_mv -> y * pmv_fw -> dist ^ m ) - m - 1 ) >> 14 ) ^ m ) - m ;
pmv_bw -> y = m - ( ( ( den + ( den * col_mv -> y * pmv_bw -> dist ^ m ) - m - 1 ) >> 14 ) ^ m ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static PyObject * string_isspace ( PyStringObject * self ) {
register const unsigned char * p = ( unsigned char * ) PyString_AS_STRING ( self ) ;
register const unsigned char * e ;
if ( PyString_GET_SIZE ( self ) == 1 && isspace ( * p ) ) return PyBool_FromLong ( 1 ) ;
if ( PyString_GET_SIZE ( self ) == 0 ) return PyBool_FromLong ( 0 ) ;
e = p + PyString_GET_SIZE ( self ) ;
for ( ;
p < e ;
p ++ ) {
if ( ! isspace ( * p ) ) return PyBool_FromLong ( 0 ) ;
}
return PyBool_FromLong ( 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_t38_T_field_data ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 151 "../../asn1/t38/t38.cnf" tvbuff_t * value_tvb = NULL ;
guint32 value_len ;
offset = dissect_per_octet_string ( tvb , offset , actx , tree , hf_index , 1 , 65535 , FALSE , & value_tvb ) ;
value_len = tvb_reported_length ( value_tvb ) ;
# line 158 "../../asn1/t38/t38.cnf" if ( primary_part ) {
if ( value_len < 8 ) {
col_append_fstr ( actx -> pinfo -> cinfo , COL_INFO , "[%s]" , tvb_bytes_to_str ( wmem_packet_scope ( ) , value_tvb , 0 , value_len ) ) ;
}
else {
col_append_fstr ( actx -> pinfo -> cinfo , COL_INFO , "[%s...]" , tvb_bytes_to_str ( wmem_packet_scope ( ) , value_tvb , 0 , 7 ) ) ;
}
}
if ( primary_part && ( Data_Field_item_num < 2 ) ) {
fragment_head * frag_msg = NULL ;
if ( Data_Field_field_type_value == 0 || Data_Field_field_type_value == 6 ) {
gboolean save_fragmented = actx -> pinfo -> fragmented ;
actx -> pinfo -> fragmented = TRUE ;
if ( p_t38_packet_conv && p_t38_conv && ( p_t38_packet_conv_info -> reass_ID == 0 ) ) {
p_t38_conv_info -> reass_ID = actx -> pinfo -> fd -> num ;
p_t38_conv_info -> reass_start_seqnum = seq_number ;
p_t38_conv_info -> time_first_t4_data = nstime_to_sec ( & actx -> pinfo -> rel_ts ) ;
p_t38_conv_info -> additional_hdlc_data_field_counter = 0 ;
p_t38_packet_conv_info -> reass_ID = p_t38_conv_info -> reass_ID ;
p_t38_packet_conv_info -> reass_start_seqnum = p_t38_conv_info -> reass_start_seqnum ;
p_t38_packet_conv_info -> seqnum_prev_data_field = p_t38_conv_info -> seqnum_prev_data_field ;
p_t38_packet_conv_info -> additional_hdlc_data_field_counter = p_t38_conv_info -> additional_hdlc_data_field_counter ;
p_t38_packet_conv_info -> time_first_t4_data = p_t38_conv_info -> time_first_t4_data ;
}
if ( seq_number == ( guint32 ) p_t38_packet_conv_info -> seqnum_prev_data_field ) {
p_t38_packet_conv_info -> additional_hdlc_data_field_counter ++ ;
if ( p_t38_conv ) {
p_t38_conv_info -> additional_hdlc_data_field_counter = p_t38_packet_conv_info -> additional_hdlc_data_field_counter ;
}
}
frag_msg = fragment_add_seq ( & data_reassembly_table , value_tvb , 0 , actx -> pinfo , p_t38_packet_conv_info -> reass_ID , NULL , seq_number - ( guint32 ) p_t38_packet_conv_info -> reass_start_seqnum + ( guint32 ) p_t38_packet_conv_info -> additional_hdlc_data_field_counter , value_len , TRUE , 0 ) ;
p_t38_packet_conv_info -> seqnum_prev_data_field = ( gint32 ) seq_number ;
process_reassembled_data ( tvb , offset , actx -> pinfo , "Reassembled T38" , frag_msg , & data_frag_items , NULL , tree ) ;
if ( ! frag_msg ) {
if ( Data_Field_field_type_value == 0 ) {
col_append_fstr ( actx -> pinfo -> cinfo , COL_INFO , " (HDLC fragment %u)" , seq_number + ( guint32 ) p_t38_packet_conv_info -> additional_hdlc_data_field_counter - ( guint32 ) p_t38_packet_conv_info -> reass_start_seqnum ) ;
}
else {
col_append_fstr ( actx -> pinfo -> cinfo , COL_INFO , " (t4-data fragment %u)" , seq_number - ( guint32 ) p_t38_packet_conv_info -> reass_start_seqnum ) ;
}
}
actx -> pinfo -> fragmented = save_fragmented ;
}
}
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int qemuAgentIOWrite ( qemuAgentPtr mon ) {
int done ;
if ( ! mon -> msg || mon -> msg -> txOffset == mon -> msg -> txLength ) return 0 ;
done = safewrite ( mon -> fd , mon -> msg -> txBuffer + mon -> msg -> txOffset , mon -> msg -> txLength - mon -> msg -> txOffset ) ;
if ( done < 0 ) {
if ( errno == EAGAIN ) return 0 ;
virReportSystemError ( errno , "%s" , _ ( "Unable to write to monitor" ) ) ;
return - 1 ;
}
mon -> msg -> txOffset += done ;
return done ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void xps_parse_gradient_brush ( xps_document * doc , const fz_matrix * ctm , const fz_rect * area , char * base_uri , xps_resource * dict , fz_xml * root , void ( * draw ) ( xps_document * , const fz_matrix * , const fz_rect * , struct stop * , int , fz_xml * , int ) ) {
fz_xml * node ;
char * opacity_att ;
char * spread_att ;
char * transform_att ;
fz_xml * transform_tag = NULL ;
fz_xml * stop_tag = NULL ;
struct stop stop_list [ MAX_STOPS ] ;
int stop_count ;
fz_matrix transform ;
int spread_method ;
opacity_att = fz_xml_att ( root , "Opacity" ) ;
spread_att = fz_xml_att ( root , "SpreadMethod" ) ;
transform_att = fz_xml_att ( root , "Transform" ) ;
for ( node = fz_xml_down ( root ) ;
node ;
node = fz_xml_next ( node ) ) {
if ( ! strcmp ( fz_xml_tag ( node ) , "LinearGradientBrush.Transform" ) ) transform_tag = fz_xml_down ( node ) ;
if ( ! strcmp ( fz_xml_tag ( node ) , "RadialGradientBrush.Transform" ) ) transform_tag = fz_xml_down ( node ) ;
if ( ! strcmp ( fz_xml_tag ( node ) , "LinearGradientBrush.GradientStops" ) ) stop_tag = fz_xml_down ( node ) ;
if ( ! strcmp ( fz_xml_tag ( node ) , "RadialGradientBrush.GradientStops" ) ) stop_tag = fz_xml_down ( node ) ;
}
xps_resolve_resource_reference ( doc , dict , & transform_att , & transform_tag , NULL ) ;
spread_method = SPREAD_PAD ;
if ( spread_att ) {
if ( ! strcmp ( spread_att , "Pad" ) ) spread_method = SPREAD_PAD ;
if ( ! strcmp ( spread_att , "Reflect" ) ) spread_method = SPREAD_REFLECT ;
if ( ! strcmp ( spread_att , "Repeat" ) ) spread_method = SPREAD_REPEAT ;
}
transform = fz_identity ;
if ( transform_att ) xps_parse_render_transform ( doc , transform_att , & transform ) ;
if ( transform_tag ) xps_parse_matrix_transform ( doc , transform_tag , & transform ) ;
fz_concat ( & transform , & transform , ctm ) ;
if ( ! stop_tag ) {
fz_warn ( doc -> ctx , "missing gradient stops tag" ) ;
return ;
}
stop_count = xps_parse_gradient_stops ( doc , base_uri , stop_tag , stop_list , MAX_STOPS ) ;
if ( stop_count == 0 ) {
fz_warn ( doc -> ctx , "no gradient stops found" ) ;
return ;
}
xps_begin_opacity ( doc , & transform , area , base_uri , dict , opacity_att , NULL ) ;
draw ( doc , & transform , area , stop_list , stop_count , root , spread_method ) ;
xps_end_opacity ( doc , base_uri , dict , opacity_att , NULL ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | op_array_table * get_global_op_array ( const gs_memory_t * mem ) {
gs_main_instance * minst = get_minst_from_memory ( mem ) ;
return & minst -> i_ctx_p -> op_array_table_global ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int evbuffer_add ( struct evbuffer * buf , const void * data , size_t datlen ) {
size_t used = buf -> misalign + buf -> off ;
size_t oldoff = buf -> off ;
if ( buf -> totallen - used < datlen ) {
if ( evbuffer_expand ( buf , datlen ) == - 1 ) return ( - 1 ) ;
}
memcpy ( buf -> buffer + buf -> off , data , datlen ) ;
buf -> off += datlen ;
if ( datlen && buf -> cb != NULL ) ( * buf -> cb ) ( buf , oldoff , buf -> off , buf -> cbarg ) ;
return ( 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int selinux_genfs_get_sid ( struct dentry * dentry , u16 tclass , u16 flags , u32 * sid ) {
int rc ;
struct super_block * sb = dentry -> d_sb ;
char * buffer , * path ;
buffer = ( char * ) __get_free_page ( GFP_KERNEL ) ;
if ( ! buffer ) return - ENOMEM ;
path = dentry_path_raw ( dentry , buffer , PAGE_SIZE ) ;
if ( IS_ERR ( path ) ) rc = PTR_ERR ( path ) ;
else {
if ( flags & SE_SBPROC ) {
while ( path [ 1 ] >= '0' && path [ 1 ] <= '9' ) {
path [ 1 ] = '/' ;
path ++ ;
}
}
rc = security_genfs_sid ( sb -> s_type -> name , path , tclass , sid ) ;
}
free_page ( ( unsigned long ) buffer ) ;
return rc ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int write_file_contents ( struct archive_write * a , int64_t offset , int64_t size ) {
struct iso9660 * iso9660 = a -> format_data ;
int r ;
lseek ( iso9660 -> temp_fd , offset , SEEK_SET ) ;
while ( size ) {
size_t rsize ;
ssize_t rs ;
unsigned char * wb ;
wb = wb_buffptr ( a ) ;
rsize = wb_remaining ( a ) ;
if ( rsize > ( size_t ) size ) rsize = ( size_t ) size ;
rs = read ( iso9660 -> temp_fd , wb , rsize ) ;
if ( rs <= 0 ) {
archive_set_error ( & a -> archive , errno , "Can't read temporary file(%jd)" , ( intmax_t ) rs ) ;
return ( ARCHIVE_FATAL ) ;
}
size -= rs ;
r = wb_consume ( a , rs ) ;
if ( r < 0 ) return ( r ) ;
}
return ( ARCHIVE_OK ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static char * custom_size_to_string ( char * format , va_list va ) {
goffset size ;
size = va_arg ( va , goffset ) ;
return g_format_size ( size ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | DEFINE_TEST ( test_read_format_mtree_nonexistent_contents_file ) {
static char archive [ ] = "#mtree\n" "a type=file contents=nonexistent_file\n" ;
struct archive_entry * ae ;
struct archive * a ;
assert ( ( a = archive_read_new ( ) ) != NULL ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_support_filter_all ( a ) ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_support_format_all ( a ) ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_set_options ( a , "mtree:checkfs" ) ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_open_memory ( a , archive , sizeof ( archive ) ) ) ;
assertEqualIntA ( a , ARCHIVE_WARN , archive_read_next_header ( a , & ae ) ) ;
assert ( strlen ( archive_error_string ( a ) ) > 0 ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "a" ) ;
assertEqualInt ( archive_entry_filetype ( ae ) , AE_IFREG ) ;
assertEqualIntA ( a , ARCHIVE_EOF , archive_read_next_header ( a , & ae ) ) ;
assertEqualInt ( 1 , archive_file_count ( a ) ) ;
assertEqualInt ( ARCHIVE_OK , archive_read_close ( a ) ) ;
assertEqualInt ( ARCHIVE_OK , archive_read_free ( a ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | extern int name ( int ) __THROW __exctype ( isalnum ) ;
__exctype ( isalpha ) ;
__exctype ( iscntrl ) ;
__exctype ( isdigit ) ;
__exctype ( islower ) ;
__exctype ( isgraph ) ;
__exctype ( isprint ) ;
__exctype ( ispunct ) ;
__exctype ( isspace ) ;
__exctype ( isupper ) ;
__exctype ( isxdigit ) ;
extern int tolower ( int __c ) __THROW ;
extern int toupper ( int __c ) __THROW ;
# ifdef __USE_ISOC99 __exctype ( isblank ) ;
# endif # ifdef __USE_GNU extern int isctype ( int __c , int __mask ) __THROW ;
# endif # if defined __USE_MISC || defined __USE_XOPEN extern int isascii ( int __c ) __THROW ;
extern int toascii ( int __c ) __THROW ;
__exctype ( _toupper ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void got_filesystem_info ( FilesystemInfoState * state , GFileInfo * info ) {
NautilusDirectory * directory ;
NautilusFile * file ;
const char * filesystem_type ;
directory = nautilus_directory_ref ( state -> directory ) ;
state -> directory -> details -> filesystem_info_state = NULL ;
async_job_end ( state -> directory , "filesystem info" ) ;
file = nautilus_file_ref ( state -> file ) ;
file -> details -> filesystem_info_is_up_to_date = TRUE ;
if ( info != NULL ) {
file -> details -> filesystem_use_preview = g_file_info_get_attribute_uint32 ( info , G_FILE_ATTRIBUTE_FILESYSTEM_USE_PREVIEW ) ;
file -> details -> filesystem_readonly = g_file_info_get_attribute_boolean ( info , G_FILE_ATTRIBUTE_FILESYSTEM_READONLY ) ;
filesystem_type = g_file_info_get_attribute_string ( info , G_FILE_ATTRIBUTE_FILESYSTEM_TYPE ) ;
if ( g_strcmp0 ( eel_ref_str_peek ( file -> details -> filesystem_type ) , filesystem_type ) != 0 ) {
eel_ref_str_unref ( file -> details -> filesystem_type ) ;
file -> details -> filesystem_type = eel_ref_str_get_unique ( filesystem_type ) ;
}
}
nautilus_directory_async_state_changed ( directory ) ;
nautilus_file_changed ( file ) ;
nautilus_file_unref ( file ) ;
nautilus_directory_unref ( directory ) ;
filesystem_info_state_free ( state ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_reserve ( sk_ ## t1 ## _compfunc compare , int n ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_reserve ( ( OPENSSL_sk_compfunc ) compare , n ) ;
}
static ossl_inline int sk_ ## t1 ## _reserve ( STACK_OF ( t1 ) * sk , int n ) {
return OPENSSL_sk_reserve ( ( OPENSSL_STACK * ) sk , n ) ;
}
static ossl_inline void sk_ ## t1 ## _free ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_free ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _zero ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_zero ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete ( STACK_OF ( t1 ) * sk , int i ) {
return ( t2 * ) OPENSSL_sk_delete ( ( OPENSSL_STACK * ) sk , i ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char ) | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void make_data_reader ( Gif_Reader * grr , const uint8_t * data , uint32_t length ) {
grr -> v = data ;
grr -> pos = 0 ;
grr -> length = length ;
grr -> is_record = 1 ;
grr -> byte_getter = record_byte_getter ;
grr -> block_getter = record_block_getter ;
grr -> eofer = record_eofer ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int TSHttpCurrentCacheConnectionsGet ( void ) {
int64_t S ;
HTTP_READ_DYN_SUM ( http_current_cache_connections_stat , S ) ;
return ( int ) S ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int cinepak_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int ret = 0 , buf_size = avpkt -> size ;
CinepakContext * s = avctx -> priv_data ;
s -> data = buf ;
s -> size = buf_size ;
if ( ( ret = ff_reget_buffer ( avctx , & s -> frame ) ) ) {
av_log ( avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ;
return ret ;
}
if ( s -> palette_video ) {
const uint8_t * pal = av_packet_get_side_data ( avpkt , AV_PKT_DATA_PALETTE , NULL ) ;
if ( pal ) {
s -> frame . palette_has_changed = 1 ;
memcpy ( s -> pal , pal , AVPALETTE_SIZE ) ;
}
}
cinepak_decode ( s ) ;
if ( s -> palette_video ) memcpy ( s -> frame . data [ 1 ] , s -> pal , AVPALETTE_SIZE ) ;
if ( ( ret = av_frame_ref ( data , & s -> frame ) ) < 0 ) return ret ;
* got_frame = 1 ;
return buf_size ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void proto_register_zbee_zcl_scenes ( void ) {
static hf_register_info hf [ ] = {
{
& hf_zbee_zcl_scenes_attr_id , {
"Attribute" , "zbee_zcl_general.scenes.attr_id" , FT_UINT16 , BASE_HEX , VALS ( zbee_zcl_scenes_attr_names ) , 0x00 , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_scene_list , {
"Scene List" , "zbee_zcl_general.groups.scene_list" , FT_NONE , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_group_id , {
"Group ID" , "zbee_zcl_general.scenes.group_id" , FT_UINT16 , BASE_HEX , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_scene_id , {
"Scene ID" , "zbee_zcl_general.scenes.scene_id" , FT_UINT8 , BASE_HEX , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_transit_time , {
"Transition Time" , "zbee_zcl_general.scenes.transit_time" , FT_UINT16 , BASE_HEX , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_status , {
"Scenes Status" , "zbee_zcl_general.scenes.scenes_status" , FT_UINT8 , BASE_HEX , VALS ( zbee_zcl_status_names ) , 0x00 , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_capacity , {
"Scene Capacity" , "zbee_zcl_general.scenes.scene_capacity" , FT_UINT8 , BASE_DEC , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_scene_count , {
"Scene Count" , "zbee_zcl_general.scenes.scene_count" , FT_UINT8 , BASE_DEC , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_attr_id_name_support , {
"Scene Name Support" , "zbee_zcl_general.scenes.attr.name_support" , FT_UINT8 , BASE_HEX , VALS ( zbee_zcl_scenes_group_names_support_values ) , ZBEE_ZCL_CMD_ID_SCENES_NAME_SUPPORT_MASK , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_attr_id_scene_valid , {
"Scene Validity" , "zbee_zcl_general.scenes.scene_valid" , FT_BOOLEAN , 8 , TFS ( & tfs_true_false ) , ZBEE_ZCL_CMD_ID_SCENES_SUPPORTED_MASK , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_attr_str_len , {
"Length" , "zbee_zcl_general.scenes.attr_str_len" , FT_UINT8 , BASE_DEC , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_attr_str , {
"String" , "zbee_zcl_general.scenes.attr_str" , FT_STRING , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_extension_set_field , {
"Extension Set" , "zbee_zcl_general.scenes.extension_set" , FT_BYTES , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_srv_rx_cmd_id , {
"Command" , "zbee_zcl_general.scenes.cmd.srv_rx.id" , FT_UINT8 , BASE_HEX , VALS ( zbee_zcl_scenes_srv_rx_cmd_names ) , 0x00 , NULL , HFILL }
}
, {
& hf_zbee_zcl_scenes_srv_tx_cmd_id , {
"Command" , "zbee_zcl_general.scenes.cmd.srv_tx.id" , FT_UINT8 , BASE_HEX , VALS ( zbee_zcl_scenes_srv_tx_cmd_names ) , 0x00 , NULL , HFILL }
}
}
;
static gint * ett [ ZBEE_ZCL_SCENES_NUM_ETT ] ;
ett [ 0 ] = & ett_zbee_zcl_scenes ;
ett [ 1 ] = & ett_zbee_zcl_scenes_scene_ctrl ;
proto_zbee_zcl_scenes = proto_register_protocol ( "ZigBee ZCL Scenes" , "ZCL Scenes" , ZBEE_PROTOABBREV_ZCL_SCENES ) ;
proto_register_field_array ( proto_zbee_zcl_scenes , hf , array_length ( hf ) ) ;
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
register_dissector ( ZBEE_PROTOABBREV_ZCL_SCENES , dissect_zbee_zcl_scenes , proto_zbee_zcl_scenes ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | METHOD ( asn1_parser_t , destroy , void , private_asn1_parser_t * this ) {
free ( this ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int try_rgrow_left ( MAIN_WINDOW_REC * window , int count ) {
MAIN_WINDOW_REC * grow_win ;
grow_win = mainwindows_find_left ( window , FALSE ) ;
if ( grow_win != NULL ) {
grow_win -> last_column += count ;
window -> first_column += count ;
mainwindows_rresize_two ( grow_win , window , count ) ;
return TRUE ;
}
return FALSE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int decode_slice ( AVCodecContext * avctx , void * tdata ) {
ProresThreadData * td = tdata ;
ProresContext * ctx = avctx -> priv_data ;
int mb_x_pos = td -> x_pos ;
int mb_y_pos = td -> y_pos ;
int pic_num = ctx -> pic_num ;
int slice_num = td -> slice_num ;
int mbs_per_slice = td -> slice_width ;
const uint8_t * buf ;
uint8_t * y_data , * u_data , * v_data ;
AVFrame * pic = avctx -> coded_frame ;
int i , sf , slice_width_factor ;
int slice_data_size , hdr_size , y_data_size , u_data_size , v_data_size ;
int y_linesize , u_linesize , v_linesize ;
buf = ctx -> slice_data [ slice_num ] . index ;
slice_data_size = ctx -> slice_data [ slice_num + 1 ] . index - buf ;
slice_width_factor = av_log2 ( mbs_per_slice ) ;
y_data = pic -> data [ 0 ] ;
u_data = pic -> data [ 1 ] ;
v_data = pic -> data [ 2 ] ;
y_linesize = pic -> linesize [ 0 ] ;
u_linesize = pic -> linesize [ 1 ] ;
v_linesize = pic -> linesize [ 2 ] ;
if ( pic -> interlaced_frame ) {
if ( ! ( pic_num ^ pic -> top_field_first ) ) {
y_data += y_linesize ;
u_data += u_linesize ;
v_data += v_linesize ;
}
y_linesize <<= 1 ;
u_linesize <<= 1 ;
v_linesize <<= 1 ;
}
if ( slice_data_size < 6 ) {
av_log ( avctx , AV_LOG_ERROR , "slice data too small\n" ) ;
return AVERROR_INVALIDDATA ;
}
hdr_size = buf [ 0 ] >> 3 ;
y_data_size = AV_RB16 ( buf + 2 ) ;
u_data_size = AV_RB16 ( buf + 4 ) ;
v_data_size = hdr_size > 7 ? AV_RB16 ( buf + 6 ) : slice_data_size - y_data_size - u_data_size - hdr_size ;
if ( hdr_size + y_data_size + u_data_size + v_data_size > slice_data_size || v_data_size < 0 || hdr_size < 6 ) {
av_log ( avctx , AV_LOG_ERROR , "invalid data size\n" ) ;
return AVERROR_INVALIDDATA ;
}
sf = av_clip ( buf [ 1 ] , 1 , 224 ) ;
sf = sf > 128 ? ( sf - 96 ) << 2 : sf ;
if ( ctx -> qmat_changed || sf != td -> prev_slice_sf ) {
td -> prev_slice_sf = sf ;
for ( i = 0 ;
i < 64 ;
i ++ ) {
td -> qmat_luma_scaled [ ctx -> dsp . idct_permutation [ i ] ] = ctx -> qmat_luma [ i ] * sf ;
td -> qmat_chroma_scaled [ ctx -> dsp . idct_permutation [ i ] ] = ctx -> qmat_chroma [ i ] * sf ;
}
}
decode_slice_plane ( ctx , td , buf + hdr_size , y_data_size , ( uint16_t * ) ( y_data + ( mb_y_pos << 4 ) * y_linesize + ( mb_x_pos << 5 ) ) , y_linesize , mbs_per_slice , 4 , slice_width_factor + 2 , td -> qmat_luma_scaled , 0 ) ;
decode_slice_plane ( ctx , td , buf + hdr_size + y_data_size , u_data_size , ( uint16_t * ) ( u_data + ( mb_y_pos << 4 ) * u_linesize + ( mb_x_pos << ctx -> mb_chroma_factor ) ) , u_linesize , mbs_per_slice , ctx -> num_chroma_blocks , slice_width_factor + ctx -> chroma_factor - 1 , td -> qmat_chroma_scaled , 1 ) ;
decode_slice_plane ( ctx , td , buf + hdr_size + y_data_size + u_data_size , v_data_size , ( uint16_t * ) ( v_data + ( mb_y_pos << 4 ) * v_linesize + ( mb_x_pos << ctx -> mb_chroma_factor ) ) , v_linesize , mbs_per_slice , ctx -> num_chroma_blocks , slice_width_factor + ctx -> chroma_factor - 1 , td -> qmat_chroma_scaled , 1 ) ;
return 0 ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( TabDragCaptureLostTest , ReleaseCaptureOnDrag ) {
AddTabAndResetBrowser ( browser ( ) ) ;
TabStrip * tab_strip = GetTabStripForBrowser ( browser ( ) ) ;
gfx : : Point tab_1_center ( GetCenterInScreenCoordinates ( tab_strip -> tab_at ( 1 ) ) ) ;
ASSERT_TRUE ( ui_test_utils : : SendMouseMoveSync ( tab_1_center ) && ui_test_utils : : SendMouseEventsSync ( ui_controls : : LEFT , ui_controls : : DOWN ) ) ;
gfx : : Point tab_0_center ( GetCenterInScreenCoordinates ( tab_strip -> tab_at ( 0 ) ) ) ;
TestDesktopBrowserFrameAura * frame = static_cast < TestDesktopBrowserFrameAura * > ( BrowserView : : GetBrowserViewForBrowser ( browser ( ) ) -> GetWidget ( ) -> native_widget_private ( ) ) ;
frame -> ReleaseCaptureOnNextClear ( ) ;
ASSERT_TRUE ( ui_test_utils : : SendMouseMoveSync ( tab_0_center ) ) ;
EXPECT_FALSE ( tab_strip -> IsDragSessionActive ( ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void view_error_processor ( THD * thd , void * data ) {
( ( TABLE_LIST * ) data ) -> hide_view_error ( thd ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_CallProceeding_UUIE ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 489 "./asn1/h225/h225.cnf" h225_packet_info * h225_pi ;
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_CallProceeding_UUIE , CallProceeding_UUIE_sequence ) ;
# line 493 "./asn1/h225/h225.cnf" h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
if ( h225_pi != NULL ) {
h225_pi -> cs_type = H225_CALL_PROCEDING ;
if ( contains_faststart ) {
char temp [ 50 ] ;
g_snprintf ( temp , 50 , "%s OLC (%s)" , val_to_str ( h225_pi -> cs_type , T_h323_message_body_vals , "<unknown>" ) , h225_pi -> frame_label ) ;
g_strlcpy ( h225_pi -> frame_label , temp , 50 ) ;
}
else g_snprintf ( h225_pi -> frame_label , 50 , "%s" , val_to_str ( h225_pi -> cs_type , T_h323_message_body_vals , "<unknown>" ) ) ;
}
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int IRQ_get_next ( OpenPICState * opp , IRQQueue * q ) {
IRQ_check ( opp , q ) ;
return q -> next ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int phar_parse_tarfile ( php_stream * fp , char * fname , int fname_len , char * alias , int alias_len , phar_archive_data * * pphar , int is_data , php_uint32 compression , char * * error TSRMLS_DC ) {
char buf [ 512 ] , * actual_alias = NULL , * p ;
phar_entry_info entry = {
0 }
;
size_t pos = 0 , read , totalsize ;
tar_header * hdr ;
php_uint32 sum1 , sum2 , size , old ;
phar_archive_data * myphar , * * actual ;
int last_was_longlink = 0 ;
if ( error ) {
* error = NULL ;
}
php_stream_seek ( fp , 0 , SEEK_END ) ;
totalsize = php_stream_tell ( fp ) ;
php_stream_seek ( fp , 0 , SEEK_SET ) ;
read = php_stream_read ( fp , buf , sizeof ( buf ) ) ;
if ( read != sizeof ( buf ) ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: \"%s\" is not a tar file or is truncated" , fname ) ;
}
php_stream_close ( fp ) ;
return FAILURE ;
}
hdr = ( tar_header * ) buf ;
old = ( memcmp ( hdr -> magic , "ustar" , sizeof ( "ustar" ) - 1 ) != 0 ) ;
myphar = ( phar_archive_data * ) pecalloc ( 1 , sizeof ( phar_archive_data ) , PHAR_G ( persist ) ) ;
myphar -> is_persistent = PHAR_G ( persist ) ;
zend_hash_init ( & myphar -> manifest , 2 + ( totalsize >> 12 ) , zend_get_hash_value , destroy_phar_manifest_entry , ( zend_bool ) myphar -> is_persistent ) ;
zend_hash_init ( & myphar -> mounted_dirs , 5 , zend_get_hash_value , NULL , ( zend_bool ) myphar -> is_persistent ) ;
zend_hash_init ( & myphar -> virtual_dirs , 4 + ( totalsize >> 11 ) , zend_get_hash_value , NULL , ( zend_bool ) myphar -> is_persistent ) ;
myphar -> is_tar = 1 ;
myphar -> flags = compression ;
entry . is_tar = 1 ;
entry . is_crc_checked = 1 ;
entry . phar = myphar ;
pos += sizeof ( buf ) ;
do {
phar_entry_info * newentry ;
pos = php_stream_tell ( fp ) ;
hdr = ( tar_header * ) buf ;
sum1 = phar_tar_number ( hdr -> checksum , sizeof ( hdr -> checksum ) ) ;
if ( sum1 == 0 && phar_tar_checksum ( buf , sizeof ( buf ) ) == 0 ) {
break ;
}
memset ( hdr -> checksum , ' ' , sizeof ( hdr -> checksum ) ) ;
sum2 = phar_tar_checksum ( buf , old ? sizeof ( old_tar_header ) : sizeof ( tar_header ) ) ;
size = entry . uncompressed_filesize = entry . compressed_filesize = phar_tar_number ( hdr -> size , sizeof ( hdr -> size ) ) ;
if ( ( ( ! old && hdr -> prefix [ 0 ] == 0 ) || old ) && strlen ( hdr -> name ) == sizeof ( ".phar/signature.bin" ) - 1 && ! strncmp ( hdr -> name , ".phar/signature.bin" , sizeof ( ".phar/signature.bin" ) - 1 ) ) {
off_t curloc ;
if ( size > 511 ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: tar-based phar \"%s\" has signature that is larger than 511 bytes, cannot process" , fname ) ;
}
bail : php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
curloc = php_stream_tell ( fp ) ;
read = php_stream_read ( fp , buf , size ) ;
if ( read != size ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: tar-based phar \"%s\" signature cannot be read" , fname ) ;
}
goto bail ;
}
# ifdef WORDS_BIGENDIAN # define PHAR_GET_32 ( buffer ) \ ( ( ( ( ( unsigned char * ) ( buffer ) ) [ 3 ] ) << 24 ) \ | ( ( ( ( unsigned char * ) ( buffer ) ) [ 2 ] ) << 16 ) \ | ( ( ( ( unsigned char * ) ( buffer ) ) [ 1 ] ) << 8 ) \ | ( ( ( unsigned char * ) ( buffer ) ) [ 0 ] ) ) # else # define PHAR_GET_32 ( buffer ) ( php_uint32 ) * ( buffer ) # endif myphar -> sig_flags = PHAR_GET_32 ( buf ) ;
if ( FAILURE == phar_verify_signature ( fp , php_stream_tell ( fp ) - size - 512 , myphar -> sig_flags , buf + 8 , size - 8 , fname , & myphar -> signature , & myphar -> sig_len , error TSRMLS_CC ) ) {
if ( error ) {
char * save = * error ;
spprintf ( error , 4096 , "phar error: tar-based phar \"%s\" signature cannot be verified: %s" , fname , save ) ;
efree ( save ) ;
}
goto bail ;
}
php_stream_seek ( fp , curloc + 512 , SEEK_SET ) ;
if ( ( ( hdr -> typeflag == '\0' ) || ( hdr -> typeflag == TAR_FILE ) ) && size > 0 ) {
php_stream_seek ( fp , 512 , SEEK_CUR ) ;
if ( ( uint ) php_stream_tell ( fp ) > totalsize ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: \"%s\" is a corrupted tar file (truncated)" , fname ) ;
}
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
}
read = php_stream_read ( fp , buf , sizeof ( buf ) ) ;
if ( read != sizeof ( buf ) ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: \"%s\" is a corrupted tar file (truncated)" , fname ) ;
}
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
hdr = ( tar_header * ) buf ;
sum1 = phar_tar_number ( hdr -> checksum , sizeof ( hdr -> checksum ) ) ;
if ( sum1 == 0 && phar_tar_checksum ( buf , sizeof ( buf ) ) == 0 ) {
break ;
}
if ( error ) {
spprintf ( error , 4096 , "phar error: \"%s\" has entries after signature, invalid phar" , fname ) ;
}
goto bail ;
}
if ( ! last_was_longlink && hdr -> typeflag == 'L' ) {
last_was_longlink = 1 ;
entry . filename_len = entry . uncompressed_filesize ;
if ( entry . filename_len == UINT_MAX ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: \"%s\" is a corrupted tar file (invalid entry size)" , fname ) ;
}
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
entry . filename = pemalloc ( entry . filename_len + 1 , myphar -> is_persistent ) ;
read = php_stream_read ( fp , entry . filename , entry . filename_len ) ;
if ( read != entry . filename_len ) {
efree ( entry . filename ) ;
if ( error ) {
spprintf ( error , 4096 , "phar error: \"%s\" is a corrupted tar file (truncated)" , fname ) ;
}
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
entry . filename [ entry . filename_len ] = '\0' ;
size = ( ( size + 511 ) & ~ 511 ) - size ;
php_stream_seek ( fp , size , SEEK_CUR ) ;
if ( ( uint ) php_stream_tell ( fp ) > totalsize ) {
efree ( entry . filename ) ;
if ( error ) {
spprintf ( error , 4096 , "phar error: \"%s\" is a corrupted tar file (truncated)" , fname ) ;
}
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
read = php_stream_read ( fp , buf , sizeof ( buf ) ) ;
if ( read != sizeof ( buf ) ) {
efree ( entry . filename ) ;
if ( error ) {
spprintf ( error , 4096 , "phar error: \"%s\" is a corrupted tar file (truncated)" , fname ) ;
}
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
continue ;
}
else if ( ! last_was_longlink && ! old && hdr -> prefix [ 0 ] != 0 ) {
char name [ 256 ] ;
int i , j ;
for ( i = 0 ;
i < 155 ;
i ++ ) {
name [ i ] = hdr -> prefix [ i ] ;
if ( name [ i ] == '\0' ) {
break ;
}
}
name [ i ++ ] = '/' ;
for ( j = 0 ;
j < 100 ;
j ++ ) {
name [ i + j ] = hdr -> name [ j ] ;
if ( name [ i + j ] == '\0' ) {
break ;
}
}
entry . filename_len = i + j ;
if ( name [ entry . filename_len - 1 ] == '/' ) {
entry . filename_len -- ;
}
entry . filename = pestrndup ( name , entry . filename_len , myphar -> is_persistent ) ;
}
else if ( ! last_was_longlink ) {
int i ;
for ( i = 0 ;
i < 100 ;
i ++ ) {
if ( hdr -> name [ i ] == '\0' ) {
break ;
}
}
entry . filename_len = i ;
entry . filename = pestrndup ( hdr -> name , i , myphar -> is_persistent ) ;
if ( entry . filename [ entry . filename_len - 1 ] == '/' ) {
entry . filename [ entry . filename_len - 1 ] = '\0' ;
entry . filename_len -- ;
}
}
last_was_longlink = 0 ;
phar_add_virtual_dirs ( myphar , entry . filename , entry . filename_len TSRMLS_CC ) ;
if ( sum1 != sum2 ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: \"%s\" is a corrupted tar file (checksum mismatch of file \"%s\")" , fname , entry . filename ) ;
}
pefree ( entry . filename , myphar -> is_persistent ) ;
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
entry . tar_type = ( ( old & ( hdr -> typeflag == '\0' ) ) ? TAR_FILE : hdr -> typeflag ) ;
entry . offset = entry . offset_abs = pos ;
entry . fp_type = PHAR_FP ;
entry . flags = phar_tar_number ( hdr -> mode , sizeof ( hdr -> mode ) ) & PHAR_ENT_PERM_MASK ;
entry . timestamp = phar_tar_number ( hdr -> mtime , sizeof ( hdr -> mtime ) ) ;
entry . is_persistent = myphar -> is_persistent ;
# ifndef S_ISDIR # define S_ISDIR ( mode ) ( ( ( mode ) & S_IFMT ) == S_IFDIR ) # endif if ( old && entry . tar_type == TAR_FILE && S_ISDIR ( entry . flags ) ) {
entry . tar_type = TAR_DIR ;
}
if ( entry . tar_type == TAR_DIR ) {
entry . is_dir = 1 ;
}
else {
entry . is_dir = 0 ;
}
entry . link = NULL ;
if ( entry . tar_type == TAR_LINK ) {
if ( ! zend_hash_exists ( & myphar -> manifest , hdr -> linkname , strlen ( hdr -> linkname ) ) ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: \"%s\" is a corrupted tar file - hard link to non-existent file \"%s\"" , fname , hdr -> linkname ) ;
}
pefree ( entry . filename , entry . is_persistent ) ;
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
entry . link = estrdup ( hdr -> linkname ) ;
}
else if ( entry . tar_type == TAR_SYMLINK ) {
entry . link = estrdup ( hdr -> linkname ) ;
}
phar_set_inode ( & entry TSRMLS_CC ) ;
zend_hash_add ( & myphar -> manifest , entry . filename , entry . filename_len , ( void * ) & entry , sizeof ( phar_entry_info ) , ( void * * ) & newentry ) ;
if ( entry . is_persistent ) {
++ entry . manifest_pos ;
}
if ( entry . filename_len >= sizeof ( ".phar/.metadata" ) - 1 && ! memcmp ( entry . filename , ".phar/.metadata" , sizeof ( ".phar/.metadata" ) - 1 ) ) {
if ( FAILURE == phar_tar_process_metadata ( newentry , fp TSRMLS_CC ) ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: tar-based phar \"%s\" has invalid metadata in magic file \"%s\"" , fname , entry . filename ) ;
}
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
}
if ( ! actual_alias && entry . filename_len == sizeof ( ".phar/alias.txt" ) - 1 && ! strncmp ( entry . filename , ".phar/alias.txt" , sizeof ( ".phar/alias.txt" ) - 1 ) ) {
if ( size > 511 ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: tar-based phar \"%s\" has alias that is larger than 511 bytes, cannot process" , fname ) ;
}
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
read = php_stream_read ( fp , buf , size ) ;
if ( read == size ) {
buf [ size ] = '\0' ;
if ( ! phar_validate_alias ( buf , size ) ) {
if ( size > 50 ) {
buf [ 50 ] = '.' ;
buf [ 51 ] = '.' ;
buf [ 52 ] = '.' ;
buf [ 53 ] = '\0' ;
}
if ( error ) {
spprintf ( error , 4096 , "phar error: invalid alias \"%s\" in tar-based phar \"%s\"" , buf , fname ) ;
}
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
actual_alias = pestrndup ( buf , size , myphar -> is_persistent ) ;
myphar -> alias = actual_alias ;
myphar -> alias_len = size ;
php_stream_seek ( fp , pos , SEEK_SET ) ;
}
else {
if ( error ) {
spprintf ( error , 4096 , "phar error: Unable to read alias from tar-based phar \"%s\"" , fname ) ;
}
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
}
size = ( size + 511 ) & ~ 511 ;
if ( ( ( hdr -> typeflag == '\0' ) || ( hdr -> typeflag == TAR_FILE ) ) && size > 0 ) {
php_stream_seek ( fp , size , SEEK_CUR ) ;
if ( ( uint ) php_stream_tell ( fp ) > totalsize ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: \"%s\" is a corrupted tar file (truncated)" , fname ) ;
}
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
}
read = php_stream_read ( fp , buf , sizeof ( buf ) ) ;
if ( read != sizeof ( buf ) ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: \"%s\" is a corrupted tar file (truncated)" , fname ) ;
}
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
}
while ( read != 0 ) ;
if ( zend_hash_exists ( & ( myphar -> manifest ) , ".phar/stub.php" , sizeof ( ".phar/stub.php" ) - 1 ) ) {
myphar -> is_data = 0 ;
}
else {
myphar -> is_data = 1 ;
}
if ( ! myphar -> is_data && PHAR_G ( require_hash ) && ! myphar -> signature ) {
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
if ( error ) {
spprintf ( error , 0 , "tar-based phar \"%s\" does not have a signature" , fname ) ;
}
return FAILURE ;
}
myphar -> fname = pestrndup ( fname , fname_len , myphar -> is_persistent ) ;
# ifdef PHP_WIN32 phar_unixify_path_separators ( myphar -> fname , fname_len ) ;
# endif myphar -> fname_len = fname_len ;
myphar -> fp = fp ;
p = strrchr ( myphar -> fname , '/' ) ;
if ( p ) {
myphar -> ext = memchr ( p , '.' , ( myphar -> fname + fname_len ) - p ) ;
if ( myphar -> ext == p ) {
myphar -> ext = memchr ( p + 1 , '.' , ( myphar -> fname + fname_len ) - p - 1 ) ;
}
if ( myphar -> ext ) {
myphar -> ext_len = ( myphar -> fname + fname_len ) - myphar -> ext ;
}
}
phar_request_initialize ( TSRMLS_C ) ;
if ( SUCCESS != zend_hash_add ( & ( PHAR_GLOBALS -> phar_fname_map ) , myphar -> fname , fname_len , ( void * ) & myphar , sizeof ( phar_archive_data * ) , ( void * * ) & actual ) ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: Unable to add tar-based phar \"%s\" to phar registry" , fname ) ;
}
php_stream_close ( fp ) ;
phar_destroy_phar_data ( myphar TSRMLS_CC ) ;
return FAILURE ;
}
myphar = * actual ;
if ( actual_alias ) {
phar_archive_data * * fd_ptr ;
myphar -> is_temporary_alias = 0 ;
if ( SUCCESS == zend_hash_find ( & ( PHAR_GLOBALS -> phar_alias_map ) , actual_alias , myphar -> alias_len , ( void * * ) & fd_ptr ) ) {
if ( SUCCESS != phar_free_alias ( * fd_ptr , actual_alias , myphar -> alias_len TSRMLS_CC ) ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: Unable to add tar-based phar \"%s\", alias is already in use" , fname ) ;
}
zend_hash_del ( & ( PHAR_GLOBALS -> phar_fname_map ) , myphar -> fname , fname_len ) ;
return FAILURE ;
}
}
zend_hash_add ( & ( PHAR_GLOBALS -> phar_alias_map ) , actual_alias , myphar -> alias_len , ( void * ) & myphar , sizeof ( phar_archive_data * ) , NULL ) ;
}
else {
phar_archive_data * * fd_ptr ;
if ( alias_len ) {
if ( SUCCESS == zend_hash_find ( & ( PHAR_GLOBALS -> phar_alias_map ) , alias , alias_len , ( void * * ) & fd_ptr ) ) {
if ( SUCCESS != phar_free_alias ( * fd_ptr , alias , alias_len TSRMLS_CC ) ) {
if ( error ) {
spprintf ( error , 4096 , "phar error: Unable to add tar-based phar \"%s\", alias is already in use" , fname ) ;
}
zend_hash_del ( & ( PHAR_GLOBALS -> phar_fname_map ) , myphar -> fname , fname_len ) ;
return FAILURE ;
}
}
zend_hash_add ( & ( PHAR_GLOBALS -> phar_alias_map ) , alias , alias_len , ( void * ) & myphar , sizeof ( phar_archive_data * ) , NULL ) ;
myphar -> alias = pestrndup ( alias , alias_len , myphar -> is_persistent ) ;
myphar -> alias_len = alias_len ;
}
else {
myphar -> alias = pestrndup ( myphar -> fname , fname_len , myphar -> is_persistent ) ;
myphar -> alias_len = fname_len ;
}
myphar -> is_temporary_alias = 1 ;
}
if ( pphar ) {
* pphar = myphar ;
}
return SUCCESS ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static uint16_t NVRAM_crc_update ( uint16_t prev , uint16_t value ) {
uint16_t tmp ;
uint16_t pd , pd1 , pd2 ;
tmp = prev >> 8 ;
pd = prev ^ value ;
pd1 = pd & 0x000F ;
pd2 = ( ( pd >> 4 ) & 0x000F ) ^ pd1 ;
tmp ^= ( pd1 << 3 ) | ( pd1 << 8 ) ;
tmp ^= pd2 | ( pd2 << 7 ) | ( pd2 << 12 ) ;
return tmp ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void free_h225_info ( gpointer p ) {
h323_calls_info_t * tmp_h323info = ( h323_calls_info_t * ) p ;
DUMP_PTR2 ( tmp_h323info -> guid ) ;
g_free ( tmp_h323info -> guid ) ;
if ( tmp_h323info -> h245_list ) {
GList * list2 = g_list_first ( tmp_h323info -> h245_list ) ;
while ( list2 ) {
h245_address_t * h245_add = ( h245_address_t * ) list2 -> data ;
g_free ( ( void * ) h245_add -> h245_address . data ) ;
g_free ( list2 -> data ) ;
list2 = g_list_next ( list2 ) ;
}
g_list_free ( tmp_h323info -> h245_list ) ;
}
g_free ( p ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_reserve ( sk_ ## t1 ## _compfunc compare , int n ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_reserve ( ( OPENSSL_sk_compfunc ) compare , n ) ;
}
static ossl_inline int sk_ ## t1 ## _reserve ( STACK_OF ( t1 ) * sk , int n ) {
return OPENSSL_sk_reserve ( ( OPENSSL_STACK * ) sk , n ) ;
}
static ossl_inline void sk_ ## t1 ## _free ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_free ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _zero ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_zero ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete ( STACK_OF ( t1 ) * sk , int i ) {
return ( t2 * ) OPENSSL_sk_delete ( ( OPENSSL_STACK * ) sk , i ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static inline void vmsvga_check_size ( struct vmsvga_state_s * s ) {
DisplaySurface * surface = qemu_console_surface ( s -> vga . con ) ;
if ( s -> new_width != surface_width ( surface ) || s -> new_height != surface_height ( surface ) || s -> new_depth != surface_bits_per_pixel ( surface ) ) {
int stride = ( s -> new_depth * s -> new_width ) / 8 ;
pixman_format_code_t format = qemu_default_pixman_format ( s -> new_depth , true ) ;
trace_vmware_setmode ( s -> new_width , s -> new_height , s -> new_depth ) ;
surface = qemu_create_displaysurface_from ( s -> new_width , s -> new_height , format , stride , s -> vga . vram_ptr ) ;
dpy_gfx_replace_surface ( s -> vga . con , surface ) ;
s -> invalidated = 1 ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean is_readable_request ( guint8 opcode ) {
return ( opcode == ATT_OPCODE_READ_REQUEST || opcode == ATT_OPCODE_READ_BLOB_REQUEST || opcode == ATT_OPCODE_READ_BY_TYPE_REQUEST || opcode == ATT_OPCODE_READ_MULTIPLE_REQUEST ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static char * * new_mysql_completion ( const char * text , int start __attribute__ ( ( unused ) ) , int end __attribute__ ( ( unused ) ) ) {
if ( ! status . batch && ! quick ) # if defined ( USE_NEW_READLINE_INTERFACE ) return rl_completion_matches ( text , new_command_generator ) ;
# else return completion_matches ( ( char * ) text , ( CPFunction * ) new_command_generator ) ;
# endif else return ( char * * ) 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TSReturnCode TSHttpTxnShutDown ( TSHttpTxn txnp , TSEvent event ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
if ( event == TS_EVENT_HTTP_TXN_CLOSE ) {
return TS_ERROR ;
}
HttpTransact : : State * s = & ( ( ( HttpSM * ) txnp ) -> t_state ) ;
s -> api_http_sm_shutdown = true ;
return TS_SUCCESS ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_JitterIndication ( 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_JitterIndication , JitterIndication_sequence ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void mpeg_decode_picture_coding_extension ( Mpeg1Context * s1 ) {
MpegEncContext * s = & s1 -> mpeg_enc_ctx ;
s -> full_pel [ 0 ] = s -> full_pel [ 1 ] = 0 ;
s -> mpeg_f_code [ 0 ] [ 0 ] = get_bits ( & s -> gb , 4 ) ;
s -> mpeg_f_code [ 0 ] [ 1 ] = get_bits ( & s -> gb , 4 ) ;
s -> mpeg_f_code [ 1 ] [ 0 ] = get_bits ( & s -> gb , 4 ) ;
s -> mpeg_f_code [ 1 ] [ 1 ] = get_bits ( & s -> gb , 4 ) ;
if ( ! s -> pict_type && s1 -> mpeg_enc_ctx_allocated ) {
av_log ( s -> avctx , AV_LOG_ERROR , "Missing picture start code, guessing missing values\n" ) ;
if ( s -> mpeg_f_code [ 1 ] [ 0 ] == 15 && s -> mpeg_f_code [ 1 ] [ 1 ] == 15 ) {
if ( s -> mpeg_f_code [ 0 ] [ 0 ] == 15 && s -> mpeg_f_code [ 0 ] [ 1 ] == 15 ) s -> pict_type = AV_PICTURE_TYPE_I ;
else s -> pict_type = AV_PICTURE_TYPE_P ;
}
else s -> pict_type = AV_PICTURE_TYPE_B ;
s -> current_picture . f . pict_type = s -> pict_type ;
s -> current_picture . f . key_frame = s -> pict_type == AV_PICTURE_TYPE_I ;
}
s -> intra_dc_precision = get_bits ( & s -> gb , 2 ) ;
s -> picture_structure = get_bits ( & s -> gb , 2 ) ;
s -> top_field_first = get_bits1 ( & s -> gb ) ;
s -> frame_pred_frame_dct = get_bits1 ( & s -> gb ) ;
s -> concealment_motion_vectors = get_bits1 ( & s -> gb ) ;
s -> q_scale_type = get_bits1 ( & s -> gb ) ;
s -> intra_vlc_format = get_bits1 ( & s -> gb ) ;
s -> alternate_scan = get_bits1 ( & s -> gb ) ;
s -> repeat_first_field = get_bits1 ( & s -> gb ) ;
s -> chroma_420_type = get_bits1 ( & s -> gb ) ;
s -> progressive_frame = get_bits1 ( & s -> gb ) ;
if ( s -> progressive_sequence && ! s -> progressive_frame ) {
s -> progressive_frame = 1 ;
av_log ( s -> avctx , AV_LOG_ERROR , "interlaced frame in progressive sequence, ignoring\n" ) ;
}
if ( s -> picture_structure == 0 || ( s -> progressive_frame && s -> picture_structure != PICT_FRAME ) ) {
av_log ( s -> avctx , AV_LOG_ERROR , "picture_structure %d invalid, ignoring\n" , s -> picture_structure ) ;
s -> picture_structure = PICT_FRAME ;
}
if ( s -> progressive_sequence && ! s -> frame_pred_frame_dct ) {
av_log ( s -> avctx , AV_LOG_WARNING , "invalid frame_pred_frame_dct\n" ) ;
}
if ( s -> picture_structure == PICT_FRAME ) {
s -> first_field = 0 ;
s -> v_edge_pos = 16 * s -> mb_height ;
}
else {
s -> first_field ^= 1 ;
s -> v_edge_pos = 8 * s -> mb_height ;
memset ( s -> mbskip_table , 0 , s -> mb_stride * s -> mb_height ) ;
}
if ( s -> alternate_scan ) {
ff_init_scantable ( s -> dsp . idct_permutation , & s -> inter_scantable , ff_alternate_vertical_scan ) ;
ff_init_scantable ( s -> dsp . idct_permutation , & s -> intra_scantable , ff_alternate_vertical_scan ) ;
}
else {
ff_init_scantable ( s -> dsp . idct_permutation , & s -> inter_scantable , ff_zigzag_direct ) ;
ff_init_scantable ( s -> dsp . idct_permutation , & s -> intra_scantable , ff_zigzag_direct ) ;
}
av_dlog ( s -> avctx , "intra_dc_precision=%d\n" , s -> intra_dc_precision ) ;
av_dlog ( s -> avctx , "picture_structure=%d\n" , s -> picture_structure ) ;
av_dlog ( s -> avctx , "top field first=%d\n" , s -> top_field_first ) ;
av_dlog ( s -> avctx , "repeat first field=%d\n" , s -> repeat_first_field ) ;
av_dlog ( s -> avctx , "conceal=%d\n" , s -> concealment_motion_vectors ) ;
av_dlog ( s -> avctx , "intra_vlc_format=%d\n" , s -> intra_vlc_format ) ;
av_dlog ( s -> avctx , "alternate_scan=%d\n" , s -> alternate_scan ) ;
av_dlog ( s -> avctx , "frame_pred_frame_dct=%d\n" , s -> frame_pred_frame_dct ) ;
av_dlog ( s -> avctx , "progressive_frame=%d\n" , s -> progressive_frame ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | GType hb_gobject_ ## name ## _get_type ( void ) \ {
static gsize type_id = 0 ;
if ( g_once_init_enter ( & type_id ) ) {
GType id = g_boxed_type_register_static ( g_intern_static_string ( "hb_" # name "_t" ) , ( GBoxedCopyFunc ) copy_func , ( GBoxedFreeFunc ) free_func ) ;
g_once_init_leave ( & type_id , id ) ;
}
return type_id ;
\ }
# define HB_DEFINE_OBJECT_TYPE ( name ) HB_DEFINE_BOXED_TYPE ( name , hb_ ## name ## _reference , hb_ ## name ## _destroy ) ;
# define HB_DEFINE_VALUE_TYPE ( name ) static hb_ ## name ## _t * _hb_ ## name ## _reference ( const hb_ ## name ## _t * l ) {
hb_ ## name ## _t * c = ( hb_ ## name ## _t * ) calloc ( 1 , sizeof ( hb_ ## name ## _t ) ) ;
if ( unlikely ( ! c ) ) return NULL ;
* c = * l ;
return c ;
}
static void _hb_ ## name ## _destroy ( hb_ ## name ## _t * l ) {
free ( l ) ;
}
HB_DEFINE_BOXED_TYPE ( name , _hb_ ## name ## _reference , _hb_ ## name ## _destroy ) ;
HB_DEFINE_OBJECT_TYPE ( buffer ) HB_DEFINE_OBJECT_TYPE ( blob ) HB_DEFINE_OBJECT_TYPE ( face ) HB_DEFINE_OBJECT_TYPE ( font ) HB_DEFINE_OBJECT_TYPE ( font_funcs ) HB_DEFINE_OBJECT_TYPE ( set ) HB_DEFINE_OBJECT_TYPE ( shape_plan ) HB_DEFINE_OBJECT_TYPE ( unicode_funcs ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void remove_tap_listener_mgcp_calls ( void ) {
remove_tap_listener ( & ( the_tapinfo_struct . mgcp_dummy ) ) ;
have_MGCP_tap_listener = FALSE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void test_logs ( ) {
MYSQL_STMT * stmt ;
MYSQL_BIND my_bind [ 2 ] ;
char data [ 255 ] ;
ulong length ;
int rc ;
short id ;
myheader ( "test_logs" ) ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS test_logs" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE test_logs(id smallint, name varchar(20))" ) ;
myquery ( rc ) ;
strmov ( ( char * ) data , "INSERT INTO test_logs VALUES(?, ?)" ) ;
stmt = mysql_simple_prepare ( mysql , data ) ;
check_stmt ( stmt ) ;
memset ( my_bind , 0 , sizeof ( my_bind ) ) ;
my_bind [ 0 ] . buffer_type = MYSQL_TYPE_SHORT ;
my_bind [ 0 ] . buffer = ( void * ) & id ;
my_bind [ 1 ] . buffer_type = MYSQL_TYPE_STRING ;
my_bind [ 1 ] . buffer = ( void * ) & data ;
my_bind [ 1 ] . buffer_length = 255 ;
my_bind [ 1 ] . length = & length ;
id = 9876 ;
length = ( ulong ) ( strmov ( ( char * ) data , "MySQL - Open Source Database" ) - data ) ;
rc = mysql_stmt_bind_param ( stmt , my_bind ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
strmov ( ( char * ) data , "'" ) ;
length = 1 ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
strmov ( ( char * ) data , "\"" ) ;
length = 1 ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
length = ( ulong ) ( strmov ( ( char * ) data , "my\'sql\'" ) - data ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
length = ( ulong ) ( strmov ( ( char * ) data , "my\"sql\"" ) - data ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
mysql_stmt_close ( stmt ) ;
strmov ( ( char * ) data , "INSERT INTO test_logs VALUES(20, 'mysql')" ) ;
stmt = mysql_simple_prepare ( mysql , data ) ;
check_stmt ( stmt ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
mysql_stmt_close ( stmt ) ;
strmov ( ( char * ) data , "SELECT * FROM test_logs WHERE id=?" ) ;
stmt = mysql_simple_prepare ( mysql , data ) ;
check_stmt ( stmt ) ;
rc = mysql_stmt_bind_param ( stmt , my_bind ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
my_bind [ 1 ] . buffer_length = 255 ;
rc = mysql_stmt_bind_result ( stmt , my_bind ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_fetch ( stmt ) ;
check_execute ( stmt , rc ) ;
if ( ! opt_silent ) {
fprintf ( stdout , "id : %d\n" , id ) ;
fprintf ( stdout , "name : %s(%ld)\n" , data , length ) ;
}
DIE_UNLESS ( id == 9876 ) ;
DIE_UNLESS ( length == 19 || length == 20 ) ;
DIE_UNLESS ( is_prefix ( data , "MySQL - Open Source" ) == 1 ) ;
rc = mysql_stmt_fetch ( stmt ) ;
check_execute ( stmt , rc ) ;
if ( ! opt_silent ) fprintf ( stdout , "\n name : %s(%ld)" , data , length ) ;
DIE_UNLESS ( length == 1 ) ;
DIE_UNLESS ( strcmp ( data , "'" ) == 0 ) ;
rc = mysql_stmt_fetch ( stmt ) ;
check_execute ( stmt , rc ) ;
if ( ! opt_silent ) fprintf ( stdout , "\n name : %s(%ld)" , data , length ) ;
DIE_UNLESS ( length == 1 ) ;
DIE_UNLESS ( strcmp ( data , "\"" ) == 0 ) ;
rc = mysql_stmt_fetch ( stmt ) ;
check_execute ( stmt , rc ) ;
if ( ! opt_silent ) fprintf ( stdout , "\n name : %s(%ld)" , data , length ) ;
DIE_UNLESS ( length == 7 ) ;
DIE_UNLESS ( strcmp ( data , "my\'sql\'" ) == 0 ) ;
rc = mysql_stmt_fetch ( stmt ) ;
check_execute ( stmt , rc ) ;
if ( ! opt_silent ) fprintf ( stdout , "\n name : %s(%ld)" , data , length ) ;
DIE_UNLESS ( length == 7 ) ;
rc = mysql_stmt_fetch ( stmt ) ;
DIE_UNLESS ( rc == MYSQL_NO_DATA ) ;
mysql_stmt_close ( stmt ) ;
rc = mysql_query ( mysql , "DROP TABLE test_logs" ) ;
myquery ( rc ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_sigcomp ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ ) {
proto_item * ti ;
proto_tree * sigcomp_tree ;
gint offset = 0 ;
gint8 octet ;
if ( pinfo -> ptype == PT_TCP ) return dissect_sigcomp_tcp ( tvb , pinfo , tree , NULL ) ;
octet = tvb_get_guint8 ( tvb , offset ) ;
if ( ( octet & 0xf8 ) != 0xf8 ) return 0 ;
col_set_str ( pinfo -> cinfo , COL_PROTOCOL , "SIGCOMP" ) ;
col_clear ( pinfo -> cinfo , COL_INFO ) ;
top_tree = tree ;
ti = proto_tree_add_item ( tree , proto_sigcomp , tvb , 0 , - 1 , ENC_NA ) ;
sigcomp_tree = proto_item_add_subtree ( ti , ett_sigcomp ) ;
return dissect_sigcomp_common ( tvb , pinfo , sigcomp_tree ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void dissect_zcl_groups_attr_data ( proto_tree * tree , tvbuff_t * tvb , guint * offset , guint16 attr_id , guint data_type ) {
switch ( attr_id ) {
case ZBEE_ZCL_ATTR_ID_GROUPS_NAME_SUPPORT : proto_tree_add_item ( tree , hf_zbee_zcl_groups_group_name_support , tvb , * offset , 1 , ENC_LITTLE_ENDIAN ) ;
* offset += 1 ;
break ;
default : dissect_zcl_attr_data ( tvb , tree , offset , data_type ) ;
break ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int qemuAgentFSTrim ( qemuAgentPtr mon , unsigned long long minimum ) {
int ret = - 1 ;
virJSONValuePtr cmd ;
virJSONValuePtr reply = NULL ;
cmd = qemuAgentMakeCommand ( "guest-fstrim" , "U:minimum" , minimum , NULL ) ;
if ( ! cmd ) return ret ;
ret = qemuAgentCommand ( mon , cmd , & reply , false , VIR_DOMAIN_QEMU_AGENT_COMMAND_BLOCK ) ;
virJSONValueFree ( cmd ) ;
virJSONValueFree ( reply ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void tb_check_watchpoint ( CPUArchState * env ) {
TranslationBlock * tb ;
tb = tb_find_pc ( env -> mem_io_pc ) ;
if ( ! tb ) {
cpu_abort ( env , "check_watchpoint: could not find TB for pc=%p" , ( void * ) env -> mem_io_pc ) ;
}
cpu_restore_state_from_tb ( tb , env , env -> mem_io_pc ) ;
tb_phys_invalidate ( tb , - 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void verbose_msg ( const char * fmt , ... ) {
va_list args ;
DBUG_ENTER ( "verbose_msg" ) ;
if ( ! verbose ) DBUG_VOID_RETURN ;
va_start ( args , fmt ) ;
vfprintf ( stderr , fmt , args ) ;
va_end ( args ) ;
fflush ( stderr ) ;
DBUG_VOID_RETURN ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | struct ifblock * compiler_create_ifblock ( struct condition * conds , struct block * blk ) {
struct ifblock * ifblk ;
SAFE_CALLOC ( ifblk , 1 , sizeof ( struct ifblock ) ) ;
ifblk -> conds = conds ;
ifblk -> blk = blk ;
return ifblk ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( HttpsEngagementPageLoadMetricsBrowserTest , ClosedWhileHidden_Http ) {
StartHttpServer ( ) ;
base : : TimeDelta upper_bound = NavigateInForegroundAndCloseInBackgroundWithTiming ( http_test_server_ -> GetURL ( "/simple.html" ) ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHttpEngagementHistogram , 1 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHttpsEngagementHistogram , 0 ) ;
int32_t bucket_min = histogram_tester_ . GetAllSamples ( internal : : kHttpEngagementHistogram ) [ 0 ] . min ;
EXPECT_GE ( upper_bound . InMilliseconds ( ) , bucket_min ) ;
EXPECT_LT ( 0 , bucket_min ) ;
FakeUserMetricsUpload ( ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHttpsEngagementSessionPercentage , 1 ) ;
int32_t ratio_bucket = histogram_tester_ . GetAllSamples ( internal : : kHttpsEngagementSessionPercentage ) [ 0 ] . min ;
EXPECT_EQ ( 0 , ratio_bucket ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int sort_one_index ( MI_CHECK * param , MI_INFO * info , MI_KEYDEF * keyinfo , my_off_t pagepos , File new_file ) {
uint length , nod_flag , used_length , key_length ;
uchar * buff , * keypos , * endpos ;
uchar key [ HA_MAX_POSSIBLE_KEY_BUFF ] ;
my_off_t new_page_pos , next_page ;
char llbuff [ 22 ] ;
DBUG_ENTER ( "sort_one_index" ) ;
DBUG_ASSERT ( keyinfo -> key_alg != HA_KEY_ALG_RTREE ) ;
new_page_pos = param -> new_file_pos ;
param -> new_file_pos += keyinfo -> block_length ;
if ( ! ( buff = ( uchar * ) my_alloca ( ( uint ) keyinfo -> block_length ) ) ) {
mi_check_print_error ( param , "Not enough memory for key block" ) ;
DBUG_RETURN ( - 1 ) ;
}
if ( ! _mi_fetch_keypage ( info , keyinfo , pagepos , DFLT_INIT_HITS , buff , 0 ) ) {
mi_check_print_error ( param , "Can't read key block from filepos: %s" , llstr ( pagepos , llbuff ) ) ;
goto err ;
}
if ( ( nod_flag = mi_test_if_nod ( buff ) ) || keyinfo -> flag & HA_FULLTEXT ) {
used_length = mi_getint ( buff ) ;
keypos = buff + 2 + nod_flag ;
endpos = buff + used_length ;
for ( ;
;
) {
if ( nod_flag ) {
next_page = _mi_kpos ( nod_flag , keypos ) ;
_mi_kpointer ( info , keypos - nod_flag , param -> new_file_pos ) ;
if ( sort_one_index ( param , info , keyinfo , next_page , new_file ) ) {
DBUG_PRINT ( "error" , ( "From page: %ld, keyoffset: %lu used_length: %d" , ( ulong ) pagepos , ( ulong ) ( keypos - buff ) , ( int ) used_length ) ) ;
DBUG_DUMP ( "buff" , ( uchar * ) buff , used_length ) ;
goto err ;
}
}
if ( keypos >= endpos || ( key_length = ( * keyinfo -> get_key ) ( keyinfo , nod_flag , & keypos , key ) ) == 0 ) break ;
DBUG_ASSERT ( keypos <= endpos ) ;
if ( keyinfo -> flag & HA_FULLTEXT ) {
uint off ;
int subkeys ;
get_key_full_length_rdonly ( off , key ) ;
subkeys = ft_sintXkorr ( key + off ) ;
if ( subkeys < 0 ) {
next_page = _mi_dpos ( info , 0 , key + key_length ) ;
_mi_dpointer ( info , keypos - nod_flag - info -> s -> rec_reflength , param -> new_file_pos ) ;
if ( sort_one_index ( param , info , & info -> s -> ft2_keyinfo , next_page , new_file ) ) goto err ;
}
}
}
}
length = mi_getint ( buff ) ;
bzero ( ( uchar * ) buff + length , keyinfo -> block_length - length ) ;
if ( mysql_file_pwrite ( new_file , ( uchar * ) buff , ( uint ) keyinfo -> block_length , new_page_pos , MYF ( MY_NABP | MY_WAIT_IF_FULL ) ) ) {
mi_check_print_error ( param , "Can't write indexblock, error: %d" , my_errno ) ;
goto err ;
}
my_afree ( ( uchar * ) buff ) ;
DBUG_RETURN ( 0 ) ;
err : my_afree ( ( uchar * ) buff ) ;
DBUG_RETURN ( 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void gtkui_connection_inject ( void ) {
GtkWidget * dialog , * text , * label , * vbox , * frame , * content_area ;
GtkWidget * button1 , * button2 , * hbox ;
GtkTextBuffer * buf ;
GtkTextIter start , end ;
char tmp [ MAX_ASCII_ADDR_LEN ] ;
gint response = 0 ;
DEBUG_MSG ( "gtk_connection_inject" ) ;
if ( curr_conn == NULL ) return ;
dialog = gtk_dialog_new_with_buttons ( "Character Injection" , GTK_WINDOW ( window ) , GTK_DIALOG_MODAL , GTK_STOCK_CANCEL , GTK_RESPONSE_CANCEL , GTK_STOCK_OK , GTK_RESPONSE_OK , NULL ) ;
# if ! GTK_CHECK_VERSION ( 2 , 22 , 0 ) gtk_dialog_set_has_separator ( GTK_DIALOG ( dialog ) , FALSE ) ;
# endif gtk_container_set_border_width ( GTK_CONTAINER ( dialog ) , 5 ) ;
content_area = gtk_dialog_get_content_area ( GTK_DIALOG ( dialog ) ) ;
vbox = gtkui_box_new ( GTK_ORIENTATION_VERTICAL , 0 , FALSE ) ;
gtk_box_pack_start ( GTK_BOX ( content_area ) , vbox , FALSE , FALSE , 0 ) ;
label = gtk_label_new ( "Packet destination:" ) ;
gtk_misc_set_alignment ( GTK_MISC ( label ) , 0 , 0.5 ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , label , FALSE , FALSE , 0 ) ;
hbox = gtkui_box_new ( GTK_ORIENTATION_HORIZONTAL , 5 , FALSE ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , hbox , FALSE , FALSE , 0 ) ;
button1 = gtk_radio_button_new_with_label ( NULL , ip_addr_ntoa ( & curr_conn -> L3_addr2 , tmp ) ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , button1 , FALSE , FALSE , 0 ) ;
button2 = gtk_radio_button_new_with_label_from_widget ( GTK_RADIO_BUTTON ( button1 ) , ip_addr_ntoa ( & curr_conn -> L3_addr1 , tmp ) ) ;
gtk_box_pack_start ( GTK_BOX ( hbox ) , button2 , FALSE , FALSE , 0 ) ;
label = gtk_label_new ( "Characters to be injected:" ) ;
gtk_misc_set_alignment ( GTK_MISC ( label ) , 0 , 0.5 ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , label , FALSE , FALSE , 0 ) ;
frame = gtk_frame_new ( NULL ) ;
gtk_frame_set_shadow_type ( GTK_FRAME ( frame ) , GTK_SHADOW_IN ) ;
gtk_box_pack_start ( GTK_BOX ( vbox ) , frame , TRUE , TRUE , 5 ) ;
text = gtk_text_view_new ( ) ;
gtk_text_view_set_wrap_mode ( GTK_TEXT_VIEW ( text ) , GTK_WRAP_CHAR ) ;
gtk_container_add ( GTK_CONTAINER ( frame ) , text ) ;
gtk_widget_show_all ( dialog ) ;
response = gtk_dialog_run ( GTK_DIALOG ( dialog ) ) ;
if ( response == GTK_RESPONSE_OK ) {
gtk_widget_hide ( dialog ) ;
SAFE_REALLOC ( injectbuf , 501 * sizeof ( char ) ) ;
memset ( injectbuf , 0 , 501 ) ;
buf = gtk_text_view_get_buffer ( GTK_TEXT_VIEW ( text ) ) ;
gtk_text_buffer_get_start_iter ( buf , & start ) ;
gtk_text_buffer_get_start_iter ( buf , & end ) ;
gtk_text_iter_forward_chars ( & end , 500 ) ;
strncpy ( injectbuf , gtk_text_buffer_get_text ( buf , & start , & end , FALSE ) , 501 ) ;
if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( button1 ) ) ) gtkui_inject_user ( 1 ) ;
else if ( gtk_toggle_button_get_active ( GTK_TOGGLE_BUTTON ( button2 ) ) ) gtkui_inject_user ( 2 ) ;
}
gtk_widget_destroy ( dialog ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int ExecCleanTargetListLength ( List * targetlist ) {
int len = 0 ;
ListCell * tl ;
foreach ( tl , targetlist ) {
TargetEntry * curTle = ( TargetEntry * ) lfirst ( tl ) ;
Assert ( IsA ( curTle , TargetEntry ) ) ;
if ( ! curTle -> resjunk ) len ++ ;
}
return len ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int xps_parse_gradient_stops ( xps_document * doc , char * base_uri , fz_xml * node , struct stop * stops , int maxcount ) {
fz_colorspace * colorspace ;
float sample [ 8 ] ;
float rgb [ 3 ] ;
int before , after ;
int count ;
int i ;
maxcount -= 2 ;
count = 0 ;
while ( node && count < maxcount ) {
if ( ! strcmp ( fz_xml_tag ( node ) , "GradientStop" ) ) {
char * offset = fz_xml_att ( node , "Offset" ) ;
char * color = fz_xml_att ( node , "Color" ) ;
if ( offset && color ) {
stops [ count ] . offset = fz_atof ( offset ) ;
stops [ count ] . index = count ;
xps_parse_color ( doc , base_uri , color , & colorspace , sample ) ;
fz_convert_color ( doc -> ctx , fz_device_rgb ( doc -> ctx ) , rgb , colorspace , sample + 1 ) ;
stops [ count ] . r = rgb [ 0 ] ;
stops [ count ] . g = rgb [ 1 ] ;
stops [ count ] . b = rgb [ 2 ] ;
stops [ count ] . a = sample [ 0 ] ;
count ++ ;
}
}
node = fz_xml_next ( node ) ;
}
if ( count == 0 ) {
fz_warn ( doc -> ctx , "gradient brush has no gradient stops" ) ;
stops [ 0 ] . offset = 0 ;
stops [ 0 ] . r = 0 ;
stops [ 0 ] . g = 0 ;
stops [ 0 ] . b = 0 ;
stops [ 0 ] . a = 1 ;
stops [ 1 ] . offset = 1 ;
stops [ 1 ] . r = 1 ;
stops [ 1 ] . g = 1 ;
stops [ 1 ] . b = 1 ;
stops [ 1 ] . a = 1 ;
return 2 ;
}
if ( count == maxcount ) fz_warn ( doc -> ctx , "gradient brush exceeded maximum number of gradient stops" ) ;
qsort ( stops , count , sizeof ( struct stop ) , cmp_stop ) ;
before = - 1 ;
after = - 1 ;
for ( i = 0 ;
i < count ;
i ++ ) {
if ( stops [ i ] . offset < 0 ) before = i ;
if ( stops [ i ] . offset > 1 ) {
after = i ;
break ;
}
}
if ( before > 0 ) {
memmove ( stops , stops + before , ( count - before ) * sizeof ( struct stop ) ) ;
count -= before ;
}
if ( after >= 0 ) count = after + 1 ;
if ( count == 1 ) {
stops [ 1 ] = stops [ 0 ] ;
stops [ 0 ] . offset = 0 ;
stops [ 1 ] . offset = 1 ;
return 2 ;
}
if ( stops [ 0 ] . offset < 0 ) {
float d = - stops [ 0 ] . offset / ( stops [ 1 ] . offset - stops [ 0 ] . offset ) ;
stops [ 0 ] . offset = 0 ;
stops [ 0 ] . r = lerp ( stops [ 0 ] . r , stops [ 1 ] . r , d ) ;
stops [ 0 ] . g = lerp ( stops [ 0 ] . g , stops [ 1 ] . g , d ) ;
stops [ 0 ] . b = lerp ( stops [ 0 ] . b , stops [ 1 ] . b , d ) ;
stops [ 0 ] . a = lerp ( stops [ 0 ] . a , stops [ 1 ] . a , d ) ;
}
if ( stops [ count - 1 ] . offset > 1 ) {
float d = ( 1 - stops [ count - 2 ] . offset ) / ( stops [ count - 1 ] . offset - stops [ count - 2 ] . offset ) ;
stops [ count - 1 ] . offset = 1 ;
stops [ count - 1 ] . r = lerp ( stops [ count - 2 ] . r , stops [ count - 1 ] . r , d ) ;
stops [ count - 1 ] . g = lerp ( stops [ count - 2 ] . g , stops [ count - 1 ] . g , d ) ;
stops [ count - 1 ] . b = lerp ( stops [ count - 2 ] . b , stops [ count - 1 ] . b , d ) ;
stops [ count - 1 ] . a = lerp ( stops [ count - 2 ] . a , stops [ count - 1 ] . a , d ) ;
}
if ( stops [ 0 ] . offset > 0 ) {
memmove ( stops + 1 , stops , count * sizeof ( struct stop ) ) ;
stops [ 0 ] = stops [ 1 ] ;
stops [ 0 ] . offset = 0 ;
count ++ ;
}
if ( stops [ count - 1 ] . offset < 1 ) {
stops [ count ] = stops [ count - 1 ] ;
stops [ count ] . offset = 1 ;
count ++ ;
}
return count ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | SPL_METHOD ( SplFileObject , ftell ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
long ret = php_stream_tell ( intern -> u . file . stream ) ;
if ( ret == - 1 ) {
RETURN_FALSE ;
}
else {
RETURN_LONG ( ret ) ;
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int SpoolssEndPagePrinter_r ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) {
offset = dissect_doserror ( tvb , offset , pinfo , tree , di , drep , hf_rc , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void virLogFilterFree ( virLogFilterPtr filter ) {
if ( ! filter ) return ;
VIR_FREE ( filter -> match ) ;
VIR_FREE ( filter ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static const char * name ## _get_name ( void * ctx ) \ {
return # name ;
\ }
static const AVClass name ## _class = {
. class_name = # name , . item_name = name ## _get_name , . option = name ## _options \ }
typedef struct DefaultContext {
const AVClass * class ;
int nokey ;
int noprint_wrappers ;
int nested_section [ SECTION_MAX_NB_LEVELS ] ;
}
DefaultContext ;
# undef OFFSET # define OFFSET ( x ) offsetof ( DefaultContext , x ) static const AVOption default_options [ ] = {
{
"noprint_wrappers" , "do not print headers and footers" , OFFSET ( noprint_wrappers ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"nw" , "do not print headers and footers" , OFFSET ( noprint_wrappers ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"nokey" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"nk" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
NULL }
, }
;
DEFINE_WRITER_CLASS ( default ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static VALUE cState_from_state_s ( VALUE self , VALUE opts ) {
if ( rb_obj_is_kind_of ( opts , self ) ) {
return opts ;
}
else if ( rb_obj_is_kind_of ( opts , rb_cHash ) ) {
return rb_funcall ( self , i_new , 1 , opts ) ;
}
else {
if ( NIL_P ( CJSON_SAFE_STATE_PROTOTYPE ) ) {
CJSON_SAFE_STATE_PROTOTYPE = rb_const_get ( mJSON , i_SAFE_STATE_PROTOTYPE ) ;
}
return rb_funcall ( CJSON_SAFE_STATE_PROTOTYPE , i_dup , 0 ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_iwht4x4_16_add_c ( const tran_low_t * input , uint8_t * dest , int stride ) {
int i ;
tran_low_t output [ 16 ] ;
tran_high_t a1 , b1 , c1 , d1 , e1 ;
const tran_low_t * ip = input ;
tran_low_t * op = output ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
a1 = ip [ 0 ] >> UNIT_QUANT_SHIFT ;
c1 = ip [ 1 ] >> UNIT_QUANT_SHIFT ;
d1 = ip [ 2 ] >> UNIT_QUANT_SHIFT ;
b1 = ip [ 3 ] >> UNIT_QUANT_SHIFT ;
a1 += c1 ;
d1 -= b1 ;
e1 = ( a1 - d1 ) >> 1 ;
b1 = e1 - b1 ;
c1 = e1 - c1 ;
a1 -= b1 ;
d1 += c1 ;
op [ 0 ] = a1 ;
op [ 1 ] = b1 ;
op [ 2 ] = c1 ;
op [ 3 ] = d1 ;
ip += 4 ;
op += 4 ;
}
ip = output ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
a1 = ip [ 4 * 0 ] ;
c1 = ip [ 4 * 1 ] ;
d1 = ip [ 4 * 2 ] ;
b1 = ip [ 4 * 3 ] ;
a1 += c1 ;
d1 -= b1 ;
e1 = ( a1 - d1 ) >> 1 ;
b1 = e1 - b1 ;
c1 = e1 - c1 ;
a1 -= b1 ;
d1 += c1 ;
dest [ stride * 0 ] = clip_pixel ( dest [ stride * 0 ] + a1 ) ;
dest [ stride * 1 ] = clip_pixel ( dest [ stride * 1 ] + b1 ) ;
dest [ stride * 2 ] = clip_pixel ( dest [ stride * 2 ] + c1 ) ;
dest [ stride * 3 ] = clip_pixel ( dest [ stride * 3 ] + d1 ) ;
ip ++ ;
dest ++ ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_entropy_mode_init ( ) {
vp9_tokens_from_tree ( intra_mode_encodings , vp9_intra_mode_tree ) ;
vp9_tokens_from_tree ( switchable_interp_encodings , vp9_switchable_interp_tree ) ;
vp9_tokens_from_tree ( partition_encodings , vp9_partition_tree ) ;
vp9_tokens_from_tree ( inter_mode_encodings , vp9_inter_mode_tree ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TSMLoc TSMimeHdrFieldGet ( TSMBuffer bufp , TSMLoc hdr_obj , int idx ) {
sdk_assert ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) ;
sdk_assert ( ( sdk_sanity_check_mime_hdr_handle ( hdr_obj ) == TS_SUCCESS ) || ( sdk_sanity_check_http_hdr_handle ( hdr_obj ) == TS_SUCCESS ) ) ;
sdk_assert ( idx >= 0 ) ;
MIMEHdrImpl * mh = _hdr_mloc_to_mime_hdr_impl ( hdr_obj ) ;
MIMEField * f = mime_hdr_field_get ( mh , idx ) ;
if ( f == nullptr ) {
return TS_NULL_MLOC ;
}
MIMEFieldSDKHandle * h = sdk_alloc_field_handle ( bufp , mh ) ;
h -> field_ptr = f ;
return reinterpret_cast < TSMLoc > ( h ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | unsigned long # define BN_LONG long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK ( 0xffffffffffffffffffffffffffffffffLL ) # define BN_MASK2 ( 0xffffffffffffffffL ) # define BN_MASK2l ( 0xffffffffL ) # define BN_MASK2h ( 0xffffffff00000000L ) # define BN_MASK2h1 ( 0xffffffff80000000L ) # define BN_TBIT ( 0x8000000000000000L ) # define BN_DEC_CONV ( 10000000000000000000UL ) # define BN_DEC_FMT1 "%lu" # define BN_DEC_FMT2 "%019lu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%lX" # define BN_HEX_FMT2 "%016lX" # endif # ifdef SIXTY_FOUR_BIT # undef BN_LLONG # undef BN_ULLONG # define BN_ULONG unsigned long long # define BN_LONG long long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK2 ( 0xffffffffffffffffLL ) # define BN_MASK2l ( 0xffffffffL ) # define BN_MASK2h ( 0xffffffff00000000LL ) # define BN_MASK2h1 ( 0xffffffff80000000LL ) # define BN_TBIT ( 0x8000000000000000LL ) # define BN_DEC_CONV ( 10000000000000000000ULL ) # define BN_DEC_FMT1 "%llu" # define BN_DEC_FMT2 "%019llu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%llX" # define BN_HEX_FMT2 "%016llX" # endif # ifdef THIRTY_TWO_BIT # ifdef BN_LLONG # if defined ( _WIN32 ) && ! defined ( __GNUC__ ) # define BN_ULLONG unsigned __int64 # define BN_MASK ( 0xffffffffffffffffI64 ) # else # define BN_ULLONG unsigned long long # define BN_MASK ( 0xffffffffffffffffLL ) # endif # endif # define BN_ULONG unsigned int # define BN_LONG int # define BN_BITS 64 # define BN_BYTES 4 # define BN_BITS2 32 # define BN_BITS4 16 # define BN_MASK2 ( 0xffffffffL ) # define BN_MASK2l ( 0xffff ) # define BN_MASK2h1 ( 0xffff8000L ) # define BN_MASK2h ( 0xffff0000L ) # define BN_TBIT ( 0x80000000L ) # define BN_DEC_CONV ( 1000000000L ) # define BN_DEC_FMT1 "%u" # define BN_DEC_FMT2 "%09u" # define BN_DEC_NUM 9 # define BN_HEX_FMT1 "%X" # define BN_HEX_FMT2 "%08X" # endif # define BN_DEFAULT_BITS 1280 # define BN_FLG_MALLOCED 0x01 # define BN_FLG_STATIC_DATA 0x02 # define BN_FLG_CONSTTIME 0x04 # ifndef OPENSSL_NO_DEPRECATED # define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME # endif # ifndef OPENSSL_NO_DEPRECATED # define BN_FLG_FREE 0x8000 # endif # define BN_set_flags ( b , n ) ( ( b ) -> flags |= ( n ) ) # define BN_get_flags ( b , n ) ( ( b ) -> flags & ( n ) ) # define BN_with_flags ( dest , b , n ) ( ( dest ) -> d = ( b ) -> d , \ ( dest ) -> top = ( b ) -> top , \ ( dest ) -> dmax = ( b ) -> dmax , \ ( dest ) -> neg = ( b ) -> neg , \ ( dest ) -> flags = ( ( ( dest ) -> flags & BN_FLG_MALLOCED ) \ | ( ( b ) -> flags & ~ BN_FLG_MALLOCED ) \ | BN_FLG_STATIC_DATA \ | ( n ) ) ) # if 0 typedef struct bignum_st BIGNUM ;
typedef struct bignum_ctx BN_CTX ;
typedef struct bn_blinding_st BN_BLINDING ;
typedef struct bn_mont_ctx_st BN_MONT_CTX ;
typedef struct bn_recp_ctx_st BN_RECP_CTX ;
typedef struct bn_gencb_st BN_GENCB ;
# endif struct bignum_st {
BN_ULONG * d ;
int top ;
int dmax ;
int neg ;
int flags ;
}
;
struct bn_mont_ctx_st {
int ri ;
BIGNUM RR ;
BIGNUM N ;
BIGNUM Ni ;
BN_ULONG n0 [ 2 ] ;
int flags ;
}
;
struct bn_recp_ctx_st {
BIGNUM N ;
BIGNUM Nr ;
int num_bits ;
int shift ;
int flags ;
}
;
struct bn_gencb_st {
unsigned int ver ;
void * arg ;
union {
void ( * cb_1 ) ( int , int , void * ) ;
int ( * cb_2 ) ( int , int , BN_GENCB * ) ;
}
cb ;
}
;
int BN_GENCB_call ( BN_GENCB * cb , int a , int b ) ;
# define BN_GENCB_set_old ( gencb , callback , cb_arg ) {
\ BN_GENCB * tmp_gencb = ( gencb ) ;
\ tmp_gencb -> ver = 1 ;
\ tmp_gencb -> arg = ( cb_arg ) ;
\ tmp_gencb -> cb . cb_1 = ( callback ) ;
}
# define BN_GENCB_set ( gencb , callback , cb_arg ) {
\ BN_GENCB * tmp_gencb = ( gencb ) ;
\ tmp_gencb -> ver = 2 ;
\ tmp_gencb -> arg = ( cb_arg ) ;
\ tmp_gencb -> cb . cb_2 = ( callback ) ;
}
# define BN_prime_checks 0 # define BN_prime_checks_for_size ( b ) ( ( b ) >= 1300 ? 2 : \ ( b ) >= 850 ? 3 : \ ( b ) >= 650 ? 4 : \ ( b ) >= 550 ? 5 : \ ( b ) >= 450 ? 6 : \ ( b ) >= 400 ? 7 : \ ( b ) >= 350 ? 8 : \ ( b ) >= 300 ? 9 : \ ( b ) >= 250 ? 12 : \ ( b ) >= 200 ? 15 : \ ( b ) >= 150 ? 18 : \ 27 ) # define BN_num_bytes ( a ) ( ( BN_num_bits ( a ) + 7 ) / 8 ) # define BN_abs_is_word ( a , w ) ( ( ( ( a ) -> top == 1 ) && ( ( a ) -> d [ 0 ] == ( BN_ULONG ) ( w ) ) ) || \ ( ( ( w ) == 0 ) && ( ( a ) -> top == 0 ) ) ) # define BN_is_zero ( a ) ( ( a ) -> top == 0 ) # define BN_is_one ( a ) ( BN_abs_is_word ( ( a ) , 1 ) && ! ( a ) -> neg ) # define BN_is_word ( a , w ) ( BN_abs_is_word ( ( a ) , ( w ) ) && ( ! ( w ) || ! ( a ) -> neg ) ) # define BN_is_odd ( a ) ( ( ( a ) -> top > 0 ) && ( ( a ) -> d [ 0 ] & 1 ) ) # define BN_one ( a ) ( BN_set_word ( ( a ) , 1 ) ) # define BN_zero_ex ( a ) \ do {
\ BIGNUM * _tmp_bn = ( a ) ;
\ _tmp_bn -> top = 0 ;
\ _tmp_bn -> neg = 0 ;
\ }
while ( 0 ) # ifdef OPENSSL_NO_DEPRECATED # define BN_zero ( a ) BN_zero_ex ( a ) # else # define BN_zero ( a ) ( BN_set_word ( ( a ) , 0 ) ) # endif const BIGNUM * BN_value_one ( void ) ;
char * BN_options ( void ) ;
BN_CTX * BN_CTX_new ( void ) ;
# ifndef OPENSSL_NO_DEPRECATED void BN_CTX_init ( BN_CTX * c ) ;
# endif void BN_CTX_free ( BN_CTX * c ) ;
void BN_CTX_start ( BN_CTX * ctx ) ;
BIGNUM * BN_CTX_get ( BN_CTX * ctx ) ;
void BN_CTX_end ( BN_CTX * ctx ) ;
int BN_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ;
int BN_pseudo_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ;
int BN_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ;
int BN_pseudo_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ;
int BN_num_bits ( const BIGNUM * a ) ;
int BN_num_bits_word ( BN_ULONG l ) ;
BIGNUM * BN_new ( void ) ;
void BN_init ( BIGNUM * ) ;
void BN_clear_free ( BIGNUM * a ) ;
BIGNUM * BN_copy ( BIGNUM * a , const BIGNUM * b ) ;
void BN_swap ( BIGNUM * a , BIGNUM * b ) ;
BIGNUM * BN_bin2bn ( const unsigned char * s , int len , BIGNUM * ret ) ;
int BN_bn2bin ( const BIGNUM * a , unsigned char * to ) ;
BIGNUM * BN_mpi2bn ( const unsigned char * s , int len , BIGNUM * ret ) ;
int BN_bn2mpi ( const BIGNUM * a , unsigned char * to ) ;
int BN_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_usub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_uadd ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ;
int BN_sqr ( BIGNUM * r , const BIGNUM * a , BN_CTX * ctx ) ;
void BN_set_negative ( BIGNUM * b , int n ) ;
# define BN_is_negative ( a ) ( ( a ) -> neg != 0 ) int BN_div ( BIGNUM * dv , BIGNUM * rem , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ;
# define BN_mod ( rem , m , d , ctx ) BN_div ( NULL , ( rem ) , ( m ) , ( d ) , ( ctx ) ) int BN_nnmod ( BIGNUM * r , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ;
int BN_mod_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_add_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ;
int BN_mod_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_sub_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ;
int BN_mod_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_sqr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_lshift1 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_lshift1_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m ) ;
int BN_mod_lshift ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_lshift_quick ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m ) ;
BN_ULONG BN_mod_word ( const BIGNUM * a , BN_ULONG w ) ;
BN_ULONG BN_div_word ( BIGNUM * a , BN_ULONG w ) ;
int BN_mul_word ( BIGNUM * a , BN_ULONG w ) ;
int BN_add_word ( BIGNUM * a , BN_ULONG w ) ;
int BN_sub_word ( BIGNUM * a , BN_ULONG w ) ;
int BN_set_word ( BIGNUM * a , BN_ULONG w ) ;
BN_ULONG BN_get_word ( const BIGNUM * a ) ;
int BN_cmp ( const BIGNUM * a , const BIGNUM * b ) ;
void BN_free ( BIGNUM * a ) ;
int BN_is_bit_set ( const BIGNUM * a , int n ) ;
int BN_lshift ( BIGNUM * r , const BIGNUM * a , int n ) ;
int BN_lshift1 ( BIGNUM * r , const BIGNUM * a ) ;
int BN_exp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_mod_exp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_exp_mont ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) ;
int BN_mod_exp_mont_consttime ( BIGNUM * rr , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * in_mont ) ;
int BN_mod_exp_mont_word ( BIGNUM * r , BN_ULONG a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) ;
int BN_mod_exp2_mont ( BIGNUM * r , const BIGNUM * a1 , const BIGNUM * p1 , const BIGNUM * a2 , const BIGNUM * p2 , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) ;
int BN_mod_exp_simple ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mask_bits ( BIGNUM * a , int n ) ;
# ifndef OPENSSL_NO_FP_API int BN_print_fp ( FILE * fp , const BIGNUM * a ) ;
# endif # ifdef HEADER_BIO_H int BN_print ( BIO * fp , const BIGNUM * a ) ;
# else int BN_print ( void * fp , const BIGNUM * a ) ;
# endif int BN_reciprocal ( BIGNUM * r , const BIGNUM * m , int len , BN_CTX * ctx ) ;
int BN_rshift ( BIGNUM * r , const BIGNUM * a , int n ) ;
int BN_rshift1 ( BIGNUM * r , const BIGNUM * a ) ;
void BN_clear ( BIGNUM * a ) ;
BIGNUM * BN_dup ( const BIGNUM * a ) ;
int BN_ucmp ( const BIGNUM * a , const BIGNUM * b ) ;
int BN_set_bit ( BIGNUM * a , int n ) ;
int BN_clear_bit ( BIGNUM * a , int n ) ;
char * BN_bn2hex ( const BIGNUM * a ) ;
char * BN_bn2dec ( const BIGNUM * a ) ;
int BN_hex2bn ( BIGNUM * * a , const char * str ) ;
int BN_dec2bn ( BIGNUM * * a , const char * str ) ;
int BN_asc2bn ( BIGNUM * * a , const char * str ) ;
int BN_gcd ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ;
int BN_kronecker ( const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ;
BIGNUM * BN_mod_inverse ( BIGNUM * ret , const BIGNUM * a , const BIGNUM * n , BN_CTX * ctx ) ;
BIGNUM * BN_mod_sqrt ( BIGNUM * ret , const BIGNUM * a , const BIGNUM * n , BN_CTX * ctx ) ;
void BN_consttime_swap ( BN_ULONG swap , BIGNUM * a , BIGNUM * b , int nwords ) ;
# ifndef OPENSSL_NO_DEPRECATED BIGNUM * BN_generate_prime ( BIGNUM * ret , int bits , int safe , const BIGNUM * add , const BIGNUM * rem , void ( * callback ) ( int , int , void * ) , void * cb_arg ) ;
int BN_is_prime ( const BIGNUM * p , int nchecks , void ( * callback ) ( int , int , void * ) , BN_CTX * ctx , void * cb_arg ) ;
int BN_is_prime_fasttest ( const BIGNUM * p , int nchecks , void ( * callback ) ( int , int , void * ) , BN_CTX * ctx , void * cb_arg , int do_trial_division ) ;
# endif int BN_generate_prime_ex ( BIGNUM * ret , int bits , int safe , const BIGNUM * add , const BIGNUM * rem , BN_GENCB * cb ) ;
int BN_is_prime_ex ( const BIGNUM * p , int nchecks , BN_CTX * ctx , BN_GENCB * cb ) ;
int BN_is_prime_fasttest_ex ( const BIGNUM * p , int nchecks , BN_CTX * ctx , int do_trial_division , BN_GENCB * cb ) ;
int BN_X931_generate_Xpq ( BIGNUM * Xp , BIGNUM * Xq , int nbits , BN_CTX * ctx ) ;
int BN_X931_derive_prime_ex ( BIGNUM * p , BIGNUM * p1 , BIGNUM * p2 , const BIGNUM * Xp , const BIGNUM * Xp1 , const BIGNUM * Xp2 , const BIGNUM * e , BN_CTX * ctx , BN_GENCB * cb ) ;
int BN_X931_generate_prime_ex ( BIGNUM * p , BIGNUM * p1 , BIGNUM * p2 , BIGNUM * Xp1 , BIGNUM * Xp2 , const BIGNUM * Xp , const BIGNUM * e , BN_CTX * ctx , BN_GENCB * cb ) ;
BN_MONT_CTX * BN_MONT_CTX_new ( void ) ;
void BN_MONT_CTX_init ( BN_MONT_CTX * ctx ) ;
int BN_mod_mul_montgomery ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_MONT_CTX * mont , BN_CTX * ctx ) ;
# define BN_to_montgomery ( r , a , mont , ctx ) BN_mod_mul_montgomery ( \ ( r ) , ( a ) , & ( ( mont ) -> RR ) , ( mont ) , ( ctx ) ) int BN_from_montgomery ( BIGNUM * r , const BIGNUM * a , BN_MONT_CTX * mont , BN_CTX * ctx ) ;
void BN_MONT_CTX_free ( BN_MONT_CTX * mont ) ;
int BN_MONT_CTX_set ( BN_MONT_CTX * mont , const BIGNUM * mod , BN_CTX * ctx ) ;
BN_MONT_CTX * BN_MONT_CTX_copy ( BN_MONT_CTX * to , BN_MONT_CTX * from ) ;
BN_MONT_CTX * BN_MONT_CTX_set_locked ( BN_MONT_CTX * * pmont , int lock , const BIGNUM * mod , BN_CTX * ctx ) ;
# define BN_BLINDING_NO_UPDATE 0x00000001 # define BN_BLINDING_NO_RECREATE 0x00000002 BN_BLINDING * BN_BLINDING_new ( const BIGNUM * A , const BIGNUM * Ai , BIGNUM * mod ) ;
void BN_BLINDING_free ( BN_BLINDING * b ) ;
int BN_BLINDING_update ( BN_BLINDING * b , BN_CTX * ctx ) ;
int BN_BLINDING_convert ( BIGNUM * n , BN_BLINDING * b , BN_CTX * ctx ) ;
int BN_BLINDING_invert ( BIGNUM * n , BN_BLINDING * b , BN_CTX * ctx ) ;
int BN_BLINDING_convert_ex ( BIGNUM * n , BIGNUM * r , BN_BLINDING * b , BN_CTX * ) ;
int BN_BLINDING_invert_ex ( BIGNUM * n , const BIGNUM * r , BN_BLINDING * b , BN_CTX * ) ;
# ifndef OPENSSL_NO_DEPRECATED unsigned long BN_BLINDING_get_thread_id ( const BN_BLINDING * ) ;
void BN_BLINDING_set_thread_id ( BN_BLINDING * , unsigned long ) ;
# endif CRYPTO_THREADID * BN_BLINDING_thread_id ( BN_BLINDING * ) ;
unsigned long BN_BLINDING_get_flags ( const BN_BLINDING * ) ;
void BN_BLINDING_set_flags ( BN_BLINDING * , unsigned long ) ;
BN_BLINDING * BN_BLINDING_create_param ( BN_BLINDING * b , const BIGNUM * e , BIGNUM * m , BN_CTX * ctx , int ( * bn_mod_exp ) ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) , BN_MONT_CTX * m_ctx ) ;
# ifndef OPENSSL_NO_DEPRECATED void BN_set_params ( int mul , int high , int low , int mont ) ;
int BN_get_params ( int which ) ;
# endif void BN_RECP_CTX_init ( BN_RECP_CTX * recp ) ;
BN_RECP_CTX * BN_RECP_CTX_new ( void ) ;
void BN_RECP_CTX_free ( BN_RECP_CTX * recp ) ;
int BN_RECP_CTX_set ( BN_RECP_CTX * recp , const BIGNUM * rdiv , BN_CTX * ctx ) ;
int BN_mod_mul_reciprocal ( BIGNUM * r , const BIGNUM * x , const BIGNUM * y , BN_RECP_CTX * recp , BN_CTX * ctx ) ;
int BN_mod_exp_recp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_div_recp ( BIGNUM * dv , BIGNUM * rem , const BIGNUM * m , BN_RECP_CTX * recp , BN_CTX * ctx ) ;
# ifndef OPENSSL_NO_EC2M int BN_GF2m_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
# define BN_GF2m_sub ( r , a , b ) BN_GF2m_add ( r , a , b ) int BN_GF2m_mod ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p ) ;
int BN_GF2m_mod_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_sqr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_inv ( BIGNUM * r , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_div ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_exp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_sqrt ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_solve_quad ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
# define BN_GF2m_cmp ( a , b ) BN_ucmp ( ( a ) , ( b ) ) int BN_GF2m_mod_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] ) ;
int BN_GF2m_mod_mul_arr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_sqr_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_inv_arr ( BIGNUM * r , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_div_arr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_exp_arr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_sqrt_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_solve_quad_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_poly2arr ( const BIGNUM * a , int p [ ] , int max ) ;
int BN_GF2m_arr2poly ( const int p [ ] , BIGNUM * a ) ;
# endif int BN_nist_mod_192 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_nist_mod_224 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_nist_mod_256 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_nist_mod_384 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_nist_mod_521 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
const BIGNUM * BN_get0_nist_prime_192 ( void ) ;
const BIGNUM * BN_get0_nist_prime_224 ( void ) ;
const BIGNUM * BN_get0_nist_prime_256 ( void ) ;
const BIGNUM * BN_get0_nist_prime_384 ( void ) ;
const BIGNUM * BN_get0_nist_prime_521 ( void ) ;
int ( * BN_nist_mod_func ( const BIGNUM * p ) ) ( BIGNUM * r , const BIGNUM * a , const BIGNUM * field , BN_CTX * ctx ) ;
int BN_generate_dsa_nonce ( BIGNUM * out , const BIGNUM * range , const BIGNUM * priv , const unsigned char * message , size_t message_len , BN_CTX * ctx ) ;
# define bn_expand ( a , bits ) ( ( ( ( ( ( bits + BN_BITS2 - 1 ) ) / BN_BITS2 ) ) <= ( a ) -> dmax ) ? \ ( a ) : bn_expand2 ( ( a ) , ( bits + BN_BITS2 - 1 ) / BN_BITS2 ) ) # define bn_wexpand ( a , words ) ( ( ( words ) <= ( a ) -> dmax ) ? ( a ) : bn_expand2 ( ( a ) , ( words ) ) ) BIGNUM * bn_expand2 ( BIGNUM * a , int words ) ;
# ifndef OPENSSL_NO_DEPRECATED BIGNUM * bn_dup_expand ( const BIGNUM * a , int words ) ;
# endif # ifdef BN_DEBUG # include < assert . h > # ifdef BN_DEBUG_RAND # ifndef RAND_pseudo_bytes int RAND_pseudo_bytes ( unsigned char * buf , int num ) ;
# define BN_DEBUG_TRIX # endif # define bn_pollute ( a ) \ do {
\ const BIGNUM * _bnum1 = ( a ) ;
\ if ( _bnum1 -> top < _bnum1 -> dmax ) {
\ unsigned char _tmp_char ;
\ \ BN_ULONG * _not_const ;
\ memcpy ( & _not_const , & _bnum1 -> d , sizeof ( BN_ULONG * ) ) ;
\ RAND_pseudo_bytes ( & _tmp_char , 1 ) ;
\ memset ( ( unsigned char * ) ( _not_const + _bnum1 -> top ) , _tmp_char , \ ( _bnum1 -> dmax - _bnum1 -> top ) * sizeof ( BN_ULONG ) ) ;
\ }
\ }
while ( 0 ) # ifdef BN_DEBUG_TRIX # undef RAND_pseudo_bytes # endif # else # define bn_pollute ( a ) # endif # define bn_check_top ( a ) \ do {
\ const BIGNUM * _bnum2 = ( a ) ;
\ if ( _bnum2 != NULL ) {
\ assert ( ( _bnum2 -> top == 0 ) || \ ( _bnum2 -> d [ _bnum2 -> top - 1 ] != 0 ) ) ;
\ bn_pollute ( _bnum2 ) ;
\ }
\ }
while ( 0 ) # define bn_fix_top ( a ) bn_check_top ( a ) # define bn_check_size ( bn , bits ) bn_wcheck_size ( bn , ( ( bits + BN_BITS2 - 1 ) ) / BN_BITS2 ) # define bn_wcheck_size ( bn , words ) \ do {
\ const BIGNUM * _bnum2 = ( bn ) ;
\ assert ( words <= ( _bnum2 ) -> dmax && words >= ( _bnum2 ) -> top ) ;
\ }
while ( 0 ) # else # define bn_pollute ( a ) # define bn_check_top ( a ) # define bn_fix_top ( a ) bn_correct_top ( a ) # define bn_check_size ( bn , bits ) # define bn_wcheck_size ( bn , words ) # endif # define bn_correct_top ( a ) \ {
\ BN_ULONG * ftl ;
\ int tmp_top = ( a ) -> top ;
\ if ( tmp_top > 0 ) \ {
\ for ( ftl = & ( ( a ) -> d [ tmp_top - 1 ] ) ;
tmp_top > 0 ;
tmp_top -- ) \ if ( * ( ftl -- ) ) break ;
\ ( a ) -> top = tmp_top ;
\ }
\ bn_pollute ( a ) ;
\ }
BN_ULONG bn_mul_add_words ( BN_ULONG * rp , const BN_ULONG * ap , int num , BN_ULONG w ) ;
BN_ULONG bn_mul_words ( BN_ULONG * rp , const BN_ULONG * ap , int num , BN_ULONG w ) | 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 ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void _update_cred_key ( void ) {
slurm_cred_ctx_key_update ( slurmctld_config . cred_ctx , slurmctld_conf . job_credential_private_key ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void transpose_perm ( int16_t * out , int16_t * in , int num_vect , const uint8_t line_len [ 2 ] , int length_div ) {
int i , j ;
int cont = 0 ;
for ( i = 0 ;
i < num_vect ;
i ++ ) for ( j = 0 ;
j < line_len [ i >= length_div ] ;
j ++ ) out [ cont ++ ] = in [ j * num_vect + i ] ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void pchip_write ( void * opaque , hwaddr addr , uint64_t v32 , unsigned size ) {
TyphoonState * s = opaque ;
CPUState * cs ;
uint64_t val , oldval ;
if ( addr & 4 ) {
val = v32 << 32 | s -> latch_tmp ;
addr ^= 4 ;
}
else {
s -> latch_tmp = v32 ;
return ;
}
switch ( addr ) {
case 0x0000 : s -> pchip . win [ 0 ] . base_addr = val ;
break ;
case 0x0040 : s -> pchip . win [ 1 ] . base_addr = val ;
break ;
case 0x0080 : s -> pchip . win [ 2 ] . base_addr = val ;
break ;
case 0x00c0 : s -> pchip . win [ 3 ] . base_addr = val ;
break ;
case 0x0100 : s -> pchip . win [ 0 ] . mask = val ;
break ;
case 0x0140 : s -> pchip . win [ 1 ] . mask = val ;
break ;
case 0x0180 : s -> pchip . win [ 2 ] . mask = val ;
break ;
case 0x01c0 : s -> pchip . win [ 3 ] . mask = val ;
break ;
case 0x0200 : s -> pchip . win [ 0 ] . translated_base_pfn = val >> 10 ;
break ;
case 0x0240 : s -> pchip . win [ 1 ] . translated_base_pfn = val >> 10 ;
break ;
case 0x0280 : s -> pchip . win [ 2 ] . translated_base_pfn = val >> 10 ;
break ;
case 0x02c0 : s -> pchip . win [ 3 ] . translated_base_pfn = val >> 10 ;
break ;
case 0x0300 : oldval = s -> pchip . ctl ;
oldval &= ~ 0x00001cff0fc7ffull ;
oldval |= val & 0x00001cff0fc7ffull ;
s -> pchip . ctl = oldval ;
break ;
case 0x0340 : break ;
case 0x03c0 : break ;
case 0x0400 : break ;
case 0x0440 : break ;
case 0x0480 : break ;
case 0x04c0 : break ;
case 0x0500 : case 0x0540 : case 0x0800 : break ;
default : cs = CPU ( alpha_env_get_cpu ( cpu_single_env ) ) ;
cpu_unassigned_access ( cs , addr , true , false , 0 , size ) ;
return ;
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static float voice_factor ( float * p_vector , float p_gain , float * f_vector , float f_gain ) {
double p_ener = ( double ) avpriv_scalarproduct_float_c ( p_vector , p_vector , AMRWB_SFR_SIZE ) * p_gain * p_gain ;
double f_ener = ( double ) avpriv_scalarproduct_float_c ( f_vector , f_vector , AMRWB_SFR_SIZE ) * f_gain * f_gain ;
return ( p_ener - f_ener ) / ( p_ener + f_ener ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | bool kvm_has_x2apic_api ( void ) {
return has_x2apic_api ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_ber_external_U ( gboolean implicit_tag , tvbuff_t * tvb , int offset , asn1_ctx_t * actx _U_ , proto_tree * tree , int hf_index _U_ ) {
offset = dissect_ber_sequence ( implicit_tag , actx , tree , tvb , offset , external_U_sequence , hf_index , ett_ber_EXTERNAL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void read_switchable_interp_probs ( FRAME_CONTEXT * fc , vp9_reader * r ) {
int i , j ;
for ( j = 0 ;
j < SWITCHABLE_FILTER_CONTEXTS ;
++ j ) for ( i = 0 ;
i < SWITCHABLE_FILTERS - 1 ;
++ i ) vp9_diff_update_prob ( r , & fc -> switchable_interp_prob [ j ] [ i ] ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | Datum scalarltsel ( PG_FUNCTION_ARGS ) {
PlannerInfo * root = ( PlannerInfo * ) PG_GETARG_POINTER ( 0 ) ;
Oid operator = PG_GETARG_OID ( 1 ) ;
List * args = ( List * ) PG_GETARG_POINTER ( 2 ) ;
int varRelid = PG_GETARG_INT32 ( 3 ) ;
VariableStatData vardata ;
Node * other ;
bool varonleft ;
Datum constval ;
Oid consttype ;
bool isgt ;
double selec ;
if ( ! get_restriction_variable ( root , args , varRelid , & vardata , & other , & varonleft ) ) PG_RETURN_FLOAT8 ( DEFAULT_INEQ_SEL ) ;
if ( ! IsA ( other , Const ) ) {
ReleaseVariableStats ( vardata ) ;
PG_RETURN_FLOAT8 ( DEFAULT_INEQ_SEL ) ;
}
if ( ( ( Const * ) other ) -> constisnull ) {
ReleaseVariableStats ( vardata ) ;
PG_RETURN_FLOAT8 ( 0.0 ) ;
}
constval = ( ( Const * ) other ) -> constvalue ;
consttype = ( ( Const * ) other ) -> consttype ;
if ( varonleft ) {
isgt = false ;
}
else {
operator = get_commutator ( operator ) ;
if ( ! operator ) {
ReleaseVariableStats ( vardata ) ;
PG_RETURN_FLOAT8 ( DEFAULT_INEQ_SEL ) ;
}
isgt = true ;
}
selec = scalarineqsel ( root , operator , isgt , & vardata , constval , consttype ) ;
ReleaseVariableStats ( vardata ) ;
PG_RETURN_FLOAT8 ( ( float8 ) selec ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int putint ( jas_stream_t * out , int sgnd , int prec , long val ) {
int n ;
int c ;
if ( sgnd ) {
abort ( ) ;
}
val &= ( 1 << prec ) - 1 ;
n = ( prec + 7 ) / 8 ;
while ( -- n >= 0 ) {
c = ( val >> ( n * 8 ) ) & 0xff ;
if ( jas_stream_putc ( out , c ) != c ) return - 1 ;
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean gsm_a_dtap_gmm_stat_packet ( void * tapdata , packet_info * pinfo _U_ , epan_dissect_t * edt _U_ , const void * gatr_ptr ) {
return gsm_a_stat_packet ( tapdata , gatr_ptr , BSSAP_PDU_TYPE_DTAP , PD_GMM ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_VendorIdentifier ( 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_VendorIdentifier , VendorIdentifier_sequence ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int read_runs ( AVCodecContext * avctx , GetBitContext * gb , Bundle * b ) {
int t , v ;
const uint8_t * dec_end ;
CHECK_READ_VAL ( gb , b , t ) ;
dec_end = b -> cur_dec + t ;
if ( dec_end > b -> data_end ) {
av_log ( avctx , AV_LOG_ERROR , "Run value went out of bounds\n" ) ;
return AVERROR_INVALIDDATA ;
}
if ( get_bits1 ( gb ) ) {
v = get_bits ( gb , 4 ) ;
memset ( b -> cur_dec , v , t ) ;
b -> cur_dec += t ;
}
else {
while ( b -> cur_dec < dec_end ) * b -> cur_dec ++ = GET_HUFF ( gb , b -> tree ) ;
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void init_logging ( const char * name , u_int32 def_syslogmask , int is_daemon ) {
static int was_daemon ;
char * cp ;
const char * pname ;
if ( INIT_NTP_SYSLOGMASK == ntp_syslogmask && != def_syslogmask ) ntp_syslogmask = def_syslogmask ;
cp = strrchr ( name , DIR_SEP ) ;
if ( NULL == cp ) pname = name ;
else pname = 1 + cp ;
progname = estrdup ( pname ) ;
# ifdef SYS_WINNT cp = strrchr ( progname , '.' ) ;
if ( NULL != cp && ! strcasecmp ( cp , ".exe" ) ) * cp = '\0' ;
# endif # if ! defined ( VMS ) if ( is_daemon ) was_daemon = TRUE ;
# ifndef LOG_DAEMON openlog ( progname , LOG_PID ) ;
# else # ifndef LOG_NTP # define LOG_NTP LOG_DAEMON # endif openlog ( progname , LOG_PID | LOG_NDELAY , ( was_daemon ) ? LOG_NTP : 0 ) ;
# ifdef DEBUG if ( debug ) setlogmask ( LOG_UPTO ( LOG_DEBUG ) ) ;
else # endif setlogmask ( LOG_UPTO ( LOG_DEBUG ) ) ;
# endif # endif } | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int main_external_compression_finish ( void ) {
int i ;
int ret ;
for ( i = 0 ;
i < num_subprocs ;
i += 1 ) {
if ( ! ext_subprocs [ i ] ) {
continue ;
}
if ( ( ret = main_waitpid_check ( ext_subprocs [ i ] ) ) ) {
return ret ;
}
ext_subprocs [ i ] = 0 ;
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TSReturnCode TSHttpTxnServerAddrSet ( TSHttpTxn txnp , struct sockaddr const * addr ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
HttpSM * sm = reinterpret_cast < HttpSM * > ( txnp ) ;
if ( ats_ip_copy ( & sm -> t_state . server_info . dst_addr . sa , addr ) ) {
sm -> t_state . api_server_addr_set = true ;
return TS_SUCCESS ;
}
else {
return TS_ERROR ;
}
} | 0False
|