instruction
stringclasses 1
value | input
stringlengths 31
235k
| output
class label 2
classes |
---|---|---|
Categorize the following code snippet as vulnerable or not. True or False
|
static ngx_int_t parse_status_line ( ngx_http_request_t * r , passenger_context_t * context ) {
u_char ch ;
u_char * pos ;
ngx_http_upstream_t * u ;
enum {
sw_start = 0 , sw_H , sw_HT , sw_HTT , sw_HTTP , sw_first_major_digit , sw_major_digit , sw_first_minor_digit , sw_minor_digit , sw_status , sw_space_after_status , sw_status_text , sw_almost_done }
state ;
u = r -> upstream ;
state = r -> state ;
for ( pos = u -> buffer . pos ;
pos < u -> buffer . last ;
pos ++ ) {
ch = * pos ;
switch ( state ) {
case sw_start : switch ( ch ) {
case 'H' : state = sw_H ;
break ;
default : return NGX_HTTP_SCGI_PARSE_NO_HEADER ;
}
break ;
case sw_H : switch ( ch ) {
case 'T' : state = sw_HT ;
break ;
default : return NGX_HTTP_SCGI_PARSE_NO_HEADER ;
}
break ;
case sw_HT : switch ( ch ) {
case 'T' : state = sw_HTT ;
break ;
default : return NGX_HTTP_SCGI_PARSE_NO_HEADER ;
}
break ;
case sw_HTT : switch ( ch ) {
case 'P' : state = sw_HTTP ;
break ;
default : return NGX_HTTP_SCGI_PARSE_NO_HEADER ;
}
break ;
case sw_HTTP : switch ( ch ) {
case '/' : state = sw_first_major_digit ;
break ;
default : return NGX_HTTP_SCGI_PARSE_NO_HEADER ;
}
break ;
case sw_first_major_digit : if ( ch < '1' || ch > '9' ) {
return NGX_HTTP_SCGI_PARSE_NO_HEADER ;
}
state = sw_major_digit ;
break ;
case sw_major_digit : if ( ch == '.' ) {
state = sw_first_minor_digit ;
break ;
}
if ( ch < '0' || ch > '9' ) {
return NGX_HTTP_SCGI_PARSE_NO_HEADER ;
}
break ;
case sw_first_minor_digit : if ( ch < '0' || ch > '9' ) {
return NGX_HTTP_SCGI_PARSE_NO_HEADER ;
}
state = sw_minor_digit ;
break ;
case sw_minor_digit : if ( ch == ' ' ) {
state = sw_status ;
break ;
}
if ( ch < '0' || ch > '9' ) {
return NGX_HTTP_SCGI_PARSE_NO_HEADER ;
}
break ;
case sw_status : if ( ch == ' ' ) {
break ;
}
if ( ch < '0' || ch > '9' ) {
return NGX_HTTP_SCGI_PARSE_NO_HEADER ;
}
context -> status = context -> status * 10 + ch - '0' ;
if ( ++ context -> status_count == 3 ) {
state = sw_space_after_status ;
context -> status_start = pos - 2 ;
}
break ;
case sw_space_after_status : switch ( ch ) {
case ' ' : state = sw_status_text ;
break ;
case '.' : state = sw_status_text ;
break ;
case CR : state = sw_almost_done ;
break ;
case LF : goto done ;
default : return NGX_HTTP_SCGI_PARSE_NO_HEADER ;
}
break ;
case sw_status_text : switch ( ch ) {
case CR : state = sw_almost_done ;
break ;
case LF : goto done ;
}
break ;
case sw_almost_done : context -> status_end = pos - 1 ;
switch ( ch ) {
case LF : goto done ;
default : return NGX_HTTP_SCGI_PARSE_NO_HEADER ;
}
}
}
u -> buffer . pos = pos ;
r -> state = state ;
return NGX_AGAIN ;
done : u -> buffer . pos = pos + 1 ;
if ( context -> status_end == NULL ) {
context -> status_end = pos ;
}
r -> state = sw_start ;
return NGX_OK ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
guint16 de_time_zone ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len _U_ , gchar * add_string _U_ , int string_len _U_ ) {
guint8 oct ;
guint32 curr_offset ;
char sign ;
curr_offset = offset ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
sign = ( oct & 0x08 ) ? '-' : '+' ;
oct = ( oct >> 4 ) + ( oct & 0x07 ) * 10 ;
proto_tree_add_uint_format_value ( tree , hf_gsm_a_dtap_timezone , tvb , curr_offset , 1 , oct , "GMT %c %d hours %d minutes" , sign , oct / 4 , oct % 4 * 15 ) ;
curr_offset ++ ;
return ( curr_offset - offset ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * Type_ParametricCurve_Dup ( struct _cms_typehandler_struct * self , const void * Ptr , cmsUInt32Number n ) {
return ( void * ) cmsDupToneCurve ( ( cmsToneCurve * ) Ptr ) ;
cmsUNUSED_PARAMETER ( n ) ;
cmsUNUSED_PARAMETER ( self ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_zbee_zcl_appl_stats ( 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_appl_stats_srv_rx_cmd_names , "Unknown Command" ) , zcl -> tran_seqno ) ;
proto_tree_add_item ( tree , hf_zbee_zcl_appl_stats_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_appl_stats , NULL , "Payload" ) ;
switch ( cmd_id ) {
case ZBEE_ZCL_CMD_ID_APPL_STATS_LOG_REQ : dissect_zcl_appl_stats_log_req ( tvb , payload_tree , & offset ) ;
break ;
case ZBEE_ZCL_CMD_ID_APPL_STATS_LOG_QUEUE_REQ : break ;
default : break ;
}
}
}
else {
col_append_fstr ( pinfo -> cinfo , COL_INFO , "%s, Seq: %u" , val_to_str_const ( cmd_id , zbee_zcl_appl_stats_srv_tx_cmd_names , "Unknown Command" ) , zcl -> tran_seqno ) ;
proto_tree_add_item ( tree , hf_zbee_zcl_appl_stats_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_appl_stats , NULL , "Payload" ) ;
switch ( cmd_id ) {
case ZBEE_ZCL_CMD_ID_APPL_STATS_LOG_NOTIF : case ZBEE_ZCL_CMD_ID_APPL_STATS_LOG_RSP : dissect_zcl_appl_stats_log_rsp ( tvb , payload_tree , & offset ) ;
break ;
case ZBEE_ZCL_CMD_ID_APPL_STATS_LOG_QUEUE_RSP : case ZBEE_ZCL_CMD_ID_APPL_STATS_STATS_AVAILABLE : dissect_zcl_appl_stats_log_queue_rsp ( 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
|
IN_PROC_BROWSER_TEST_F ( DownloadExtensionTest , DownloadExtensionTest_OnDeterminingFilename_AbsPathInvalid ) {
GoOnTheRecord ( ) ;
LoadExtension ( "downloads_split" ) ;
AddFilenameDeterminer ( ) ;
ASSERT_TRUE ( StartEmbeddedTestServer ( ) ) ;
std : : string download_url = embedded_test_server ( ) -> GetURL ( "/slow?0" ) . spec ( ) ;
std : : unique_ptr < base : : Value > result ( RunFunctionAndReturnResult ( new DownloadsDownloadFunction ( ) , base : : StringPrintf ( "[{
\"url\": \"%s\"}
]" , download_url . c_str ( ) ) ) ) ;
ASSERT_TRUE ( result . get ( ) ) ;
int result_id = - 1 ;
ASSERT_TRUE ( result -> GetAsInteger ( & result_id ) ) ;
DownloadItem * item = GetCurrentManager ( ) -> GetDownload ( result_id ) ;
ASSERT_TRUE ( item ) ;
ScopedCancellingItem canceller ( item ) ;
ASSERT_EQ ( download_url , item -> GetOriginalUrl ( ) . spec ( ) ) ;
ASSERT_TRUE ( WaitFor ( downloads : : OnCreated : : kEventName , base : : StringPrintf ( "[{
\"danger\": \"safe\"," " \"incognito\": false," " \"id\": %d," " \"mime\": \"text/plain\"," " \"paused\": false," " \"url\": \"%s\"}
]" , result_id , download_url . c_str ( ) ) ) ) ;
ASSERT_TRUE ( WaitFor ( downloads : : OnDeterminingFilename : : kEventName , base : : StringPrintf ( "[{
\"id\": %d," " \"filename\":\"slow.txt\"}
]" , result_id ) ) ) ;
ASSERT_TRUE ( item -> GetTargetFilePath ( ) . empty ( ) ) ;
ASSERT_EQ ( DownloadItem : : IN_PROGRESS , item -> GetState ( ) ) ;
std : : string error ;
ASSERT_FALSE ( ExtensionDownloadsEventRouter : : DetermineFilename ( browser ( ) -> profile ( ) , false , GetExtensionId ( ) , result_id , downloads_directory ( ) . Append ( FILE_PATH_LITERAL ( "sneaky.txt" ) ) , downloads : : FILENAME_CONFLICT_ACTION_UNIQUIFY , & error ) ) ;
EXPECT_STREQ ( errors : : kInvalidFilename , error . c_str ( ) ) ;
ASSERT_TRUE ( WaitFor ( downloads : : OnChanged : : kEventName , base : : StringPrintf ( "[{
\"id\": %d," " \"filename\": {
" " \"previous\": \"\"," " \"current\": \"%s\"}
}
]" , result_id , GetFilename ( "slow.txt" ) . c_str ( ) ) ) ) ;
ASSERT_TRUE ( WaitFor ( downloads : : OnChanged : : kEventName , base : : StringPrintf ( "[{
\"id\": %d," " \"state\": {
" " \"previous\": \"in_progress\"," " \"current\": \"complete\"}
}
]" , result_id ) ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void model_rd_for_sb ( VP9_COMP * cpi , BLOCK_SIZE bsize , MACROBLOCK * x , MACROBLOCKD * xd , int * out_rate_sum , int64_t * out_dist_sum ) {
int i ;
int64_t rate_sum = 0 ;
int64_t dist_sum = 0 ;
const int ref = xd -> mi [ 0 ] -> mbmi . ref_frame [ 0 ] ;
unsigned int sse ;
unsigned int var = 0 ;
unsigned int sum_sse = 0 ;
const int shift = 8 ;
int rate ;
int64_t dist ;
x -> pred_sse [ ref ] = 0 ;
for ( i = 0 ;
i < MAX_MB_PLANE ;
++ i ) {
struct macroblock_plane * const p = & x -> plane [ i ] ;
struct macroblockd_plane * const pd = & xd -> plane [ i ] ;
const BLOCK_SIZE bs = get_plane_block_size ( bsize , pd ) ;
const TX_SIZE max_tx_size = max_txsize_lookup [ bs ] ;
const BLOCK_SIZE unit_size = txsize_to_bsize [ max_tx_size ] ;
int bw = 1 << ( b_width_log2_lookup [ bs ] - b_width_log2_lookup [ unit_size ] ) ;
int bh = 1 << ( b_height_log2_lookup [ bs ] - b_width_log2_lookup [ unit_size ] ) ;
int idx , idy ;
int lw = b_width_log2_lookup [ unit_size ] + 2 ;
int lh = b_height_log2_lookup [ unit_size ] + 2 ;
sum_sse = 0 ;
for ( idy = 0 ;
idy < bh ;
++ idy ) {
for ( idx = 0 ;
idx < bw ;
++ idx ) {
uint8_t * src = p -> src . buf + ( idy * p -> src . stride << lh ) + ( idx << lw ) ;
uint8_t * dst = pd -> dst . buf + ( idy * pd -> dst . stride << lh ) + ( idx << lh ) ;
int block_idx = ( idy << 1 ) + idx ;
var = cpi -> fn_ptr [ unit_size ] . vf ( src , p -> src . stride , dst , pd -> dst . stride , & sse ) ;
x -> bsse [ ( i << 2 ) + block_idx ] = sse ;
sum_sse += sse ;
if ( ! x -> select_tx_size ) {
if ( x -> bsse [ ( i << 2 ) + block_idx ] < p -> quant_thred [ 0 ] >> shift ) x -> skip_txfm [ ( i << 2 ) + block_idx ] = 1 ;
else if ( var < p -> quant_thred [ 1 ] >> shift ) x -> skip_txfm [ ( i << 2 ) + block_idx ] = 2 ;
else x -> skip_txfm [ ( i << 2 ) + block_idx ] = 0 ;
}
if ( i == 0 ) x -> pred_sse [ ref ] += sse ;
}
}
if ( cpi -> oxcf . speed > 4 ) {
int64_t rate ;
int64_t dist ;
int64_t square_error = sse ;
int quantizer = ( pd -> dequant [ 1 ] >> 3 ) ;
if ( quantizer < 120 ) rate = ( square_error * ( 280 - quantizer ) ) >> 8 ;
else rate = 0 ;
dist = ( square_error * quantizer ) >> 8 ;
rate_sum += rate ;
dist_sum += dist ;
}
else {
vp9_model_rd_from_var_lapndz ( sum_sse , 1 << num_pels_log2_lookup [ bs ] , pd -> dequant [ 1 ] >> 3 , & rate , & dist ) ;
rate_sum += rate ;
dist_sum += dist ;
}
}
* out_rate_sum = ( int ) rate_sum ;
* out_dist_sum = dist_sum << 4 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
vpx_codec_err_t vpx_codec_enc_init_ver ( vpx_codec_ctx_t * ctx , vpx_codec_iface_t * iface , const vpx_codec_enc_cfg_t * cfg , vpx_codec_flags_t flags , int ver ) {
vpx_codec_err_t res ;
if ( ver != VPX_ENCODER_ABI_VERSION ) res = VPX_CODEC_ABI_MISMATCH ;
else if ( ! ctx || ! iface || ! cfg ) res = VPX_CODEC_INVALID_PARAM ;
else if ( iface -> abi_version != VPX_CODEC_INTERNAL_ABI_VERSION ) res = VPX_CODEC_ABI_MISMATCH ;
else if ( ! ( iface -> caps & VPX_CODEC_CAP_ENCODER ) ) res = VPX_CODEC_INCAPABLE ;
else if ( ( flags & VPX_CODEC_USE_PSNR ) && ! ( iface -> caps & VPX_CODEC_CAP_PSNR ) ) res = VPX_CODEC_INCAPABLE ;
else if ( ( flags & VPX_CODEC_USE_OUTPUT_PARTITION ) && ! ( iface -> caps & VPX_CODEC_CAP_OUTPUT_PARTITION ) ) res = VPX_CODEC_INCAPABLE ;
else {
ctx -> iface = iface ;
ctx -> name = iface -> name ;
ctx -> priv = NULL ;
ctx -> init_flags = flags ;
ctx -> config . enc = cfg ;
res = ctx -> iface -> init ( ctx , NULL ) ;
if ( res ) {
ctx -> err_detail = ctx -> priv ? ctx -> priv -> err_detail : NULL ;
vpx_codec_destroy ( ctx ) ;
}
}
return SAVE_STATUS ( ctx , res ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( BrowsingDataRemoverImplTest , RemoveCookieForever ) {
BlockUntilBrowsingDataRemoved ( base : : Time ( ) , base : : Time : : Max ( ) , BrowsingDataRemover : : REMOVE_COOKIES , false ) ;
EXPECT_EQ ( BrowsingDataRemover : : REMOVE_COOKIES , GetRemovalMask ( ) ) ;
EXPECT_EQ ( BrowsingDataHelper : : UNPROTECTED_WEB , GetOriginTypeMask ( ) ) ;
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData ( ) ;
EXPECT_EQ ( removal_data . remove_mask , StoragePartition : : REMOVE_DATA_MASK_COOKIES ) ;
EXPECT_EQ ( removal_data . quota_storage_remove_mask , StoragePartition : : QUOTA_MANAGED_STORAGE_MASK_ALL ) ;
EXPECT_EQ ( removal_data . remove_begin , GetBeginTime ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void create_pid_file ( ) {
File file ;
if ( ( file = mysql_file_create ( key_file_pid , pidfile_name , 0664 , O_WRONLY | O_TRUNC , MYF ( MY_WME ) ) ) >= 0 ) {
char buff [ MAX_BIGINT_WIDTH + 1 ] , * end ;
end = int10_to_str ( ( long ) getpid ( ) , buff , 10 ) ;
* end ++ = '\n' ;
if ( ! mysql_file_write ( file , ( uchar * ) buff , ( uint ) ( end - buff ) , MYF ( MY_WME | MY_NABP ) ) ) {
mysql_file_close ( file , MYF ( 0 ) ) ;
pid_file_created = true ;
return ;
}
mysql_file_close ( file , MYF ( 0 ) ) ;
}
sql_perror ( "Can't start server: can't create PID file" ) ;
exit ( 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint16 de_tp_epc_horizontal_velocity ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len _U_ , gchar * add_string _U_ , int string_len _U_ ) {
guint32 curr_offset ;
curr_offset = offset ;
proto_tree_add_bits_item ( tree , hf_gsm_a_dtap_epc_bearing , tvb , curr_offset << 3 , 9 , ENC_BIG_ENDIAN ) ;
proto_tree_add_bits_item ( tree , hf_gsm_a_dtap_epc_horizontal_speed , tvb , ( curr_offset << 3 ) + 9 , 11 , ENC_BIG_ENDIAN ) ;
curr_offset += 3 ;
return ( curr_offset - offset ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int ohci_read_td ( OHCIState * ohci , dma_addr_t addr , struct ohci_td * td ) {
return get_dwords ( ohci , addr , ( uint32_t * ) td , sizeof ( * td ) >> 2 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int handle__publish ( struct mosquitto_db * db , struct mosquitto * context ) {
char * topic ;
mosquitto__payload_uhpa payload ;
uint32_t payloadlen ;
uint8_t dup , qos , retain ;
uint16_t mid = 0 ;
int rc = 0 ;
uint8_t header = context -> in_packet . command ;
int res = 0 ;
struct mosquitto_msg_store * stored = NULL ;
int len ;
int slen ;
char * topic_mount ;
# ifdef WITH_BRIDGE char * topic_temp ;
int i ;
struct mosquitto__bridge_topic * cur_topic ;
bool match ;
# endif payload . ptr = NULL ;
dup = ( header & 0x08 ) >> 3 ;
qos = ( header & 0x06 ) >> 1 ;
if ( qos == 3 ) {
log__printf ( NULL , MOSQ_LOG_INFO , "Invalid QoS in PUBLISH from %s, disconnecting." , context -> id ) ;
return 1 ;
}
retain = ( header & 0x01 ) ;
if ( packet__read_string ( & context -> in_packet , & topic , & slen ) ) return 1 ;
if ( ! slen ) {
mosquitto__free ( topic ) ;
return 1 ;
}
if ( mosquitto_validate_utf8 ( topic , slen ) != MOSQ_ERR_SUCCESS ) {
mosquitto__free ( topic ) ;
return 1 ;
}
# ifdef WITH_BRIDGE if ( context -> bridge && context -> bridge -> topics && context -> bridge -> topic_remapping ) {
for ( i = 0 ;
i < context -> bridge -> topic_count ;
i ++ ) {
cur_topic = & context -> bridge -> topics [ i ] ;
if ( ( cur_topic -> direction == bd_both || cur_topic -> direction == bd_in ) && ( cur_topic -> remote_prefix || cur_topic -> local_prefix ) ) {
rc = mosquitto_topic_matches_sub ( cur_topic -> remote_topic , topic , & match ) ;
if ( rc ) {
mosquitto__free ( topic ) ;
return rc ;
}
if ( match ) {
if ( cur_topic -> remote_prefix ) {
if ( ! strncmp ( cur_topic -> remote_prefix , topic , strlen ( cur_topic -> remote_prefix ) ) ) {
topic_temp = mosquitto__strdup ( topic + strlen ( cur_topic -> remote_prefix ) ) ;
if ( ! topic_temp ) {
mosquitto__free ( topic ) ;
return MOSQ_ERR_NOMEM ;
}
mosquitto__free ( topic ) ;
topic = topic_temp ;
}
}
if ( cur_topic -> local_prefix ) {
len = strlen ( topic ) + strlen ( cur_topic -> local_prefix ) + 1 ;
topic_temp = mosquitto__malloc ( len + 1 ) ;
if ( ! topic_temp ) {
mosquitto__free ( topic ) ;
return MOSQ_ERR_NOMEM ;
}
snprintf ( topic_temp , len , "%s%s" , cur_topic -> local_prefix , topic ) ;
topic_temp [ len ] = '\0' ;
mosquitto__free ( topic ) ;
topic = topic_temp ;
}
break ;
}
}
}
}
# endif if ( mosquitto_pub_topic_check ( topic ) != MOSQ_ERR_SUCCESS ) {
mosquitto__free ( topic ) ;
return 1 ;
}
if ( qos > 0 ) {
if ( packet__read_uint16 ( & context -> in_packet , & mid ) ) {
mosquitto__free ( topic ) ;
return 1 ;
}
}
payloadlen = context -> in_packet . remaining_length - context -> in_packet . pos ;
G_PUB_BYTES_RECEIVED_INC ( payloadlen ) ;
if ( context -> listener && context -> listener -> mount_point ) {
len = strlen ( context -> listener -> mount_point ) + strlen ( topic ) + 1 ;
topic_mount = mosquitto__malloc ( len + 1 ) ;
if ( ! topic_mount ) {
mosquitto__free ( topic ) ;
return MOSQ_ERR_NOMEM ;
}
snprintf ( topic_mount , len , "%s%s" , context -> listener -> mount_point , topic ) ;
topic_mount [ len ] = '\0' ;
mosquitto__free ( topic ) ;
topic = topic_mount ;
}
if ( payloadlen ) {
if ( db -> config -> message_size_limit && payloadlen > db -> config -> message_size_limit ) {
log__printf ( NULL , MOSQ_LOG_DEBUG , "Dropped too large PUBLISH from %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))" , context -> id , dup , qos , retain , mid , topic , ( long ) payloadlen ) ;
goto process_bad_message ;
}
if ( UHPA_ALLOC ( payload , payloadlen + 1 ) == 0 ) {
mosquitto__free ( topic ) ;
return MOSQ_ERR_NOMEM ;
}
if ( packet__read_bytes ( & context -> in_packet , UHPA_ACCESS ( payload , payloadlen ) , payloadlen ) ) {
mosquitto__free ( topic ) ;
UHPA_FREE ( payload , payloadlen ) ;
return 1 ;
}
}
rc = mosquitto_acl_check ( db , context , topic , MOSQ_ACL_WRITE ) ;
if ( rc == MOSQ_ERR_ACL_DENIED ) {
log__printf ( NULL , MOSQ_LOG_DEBUG , "Denied PUBLISH from %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))" , context -> id , dup , qos , retain , mid , topic , ( long ) payloadlen ) ;
goto process_bad_message ;
}
else if ( rc != MOSQ_ERR_SUCCESS ) {
mosquitto__free ( topic ) ;
UHPA_FREE ( payload , payloadlen ) ;
return rc ;
}
log__printf ( NULL , MOSQ_LOG_DEBUG , "Received PUBLISH from %s (d%d, q%d, r%d, m%d, '%s', ... (%ld bytes))" , context -> id , dup , qos , retain , mid , topic , ( long ) payloadlen ) ;
if ( qos > 0 ) {
db__message_store_find ( context , mid , & stored ) ;
}
if ( ! stored ) {
dup = 0 ;
if ( db__message_store ( db , context -> id , mid , topic , qos , payloadlen , & payload , retain , & stored , 0 ) ) {
return 1 ;
}
}
else {
mosquitto__free ( topic ) ;
topic = stored -> topic ;
dup = 1 ;
}
switch ( qos ) {
case 0 : if ( sub__messages_queue ( db , context -> id , topic , qos , retain , & stored ) ) rc = 1 ;
break ;
case 1 : if ( sub__messages_queue ( db , context -> id , topic , qos , retain , & stored ) ) rc = 1 ;
if ( send__puback ( context , mid ) ) rc = 1 ;
break ;
case 2 : if ( ! dup ) {
res = db__message_insert ( db , context , mid , mosq_md_in , qos , retain , stored ) ;
}
else {
res = 0 ;
}
if ( ! res ) {
if ( send__pubrec ( context , mid ) ) rc = 1 ;
}
else if ( res == 1 ) {
rc = 1 ;
}
break ;
}
return rc ;
process_bad_message : mosquitto__free ( topic ) ;
UHPA_FREE ( payload , payloadlen ) ;
switch ( qos ) {
case 0 : return MOSQ_ERR_SUCCESS ;
case 1 : return send__puback ( context , mid ) ;
case 2 : db__message_store_find ( context , mid , & stored ) ;
if ( ! stored ) {
if ( db__message_store ( db , context -> id , mid , NULL , qos , 0 , NULL , false , & stored , 0 ) ) {
return 1 ;
}
res = db__message_insert ( db , context , mid , mosq_md_in , qos , false , stored ) ;
}
else {
res = 0 ;
}
if ( ! res ) {
res = send__pubrec ( context , mid ) ;
}
return res ;
}
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int jbig2_parse_extension_segment ( Jbig2Ctx * ctx , Jbig2Segment * segment , const uint8_t * segment_data ) {
uint32_t type = jbig2_get_uint32 ( segment_data ) ;
bool reserved = type & 0x20000000 ;
bool necessary = type & 0x80000000 ;
if ( necessary && ! reserved ) {
jbig2_error ( ctx , JBIG2_SEVERITY_WARNING , segment -> number , "extension segment is marked 'necessary' but " "not 'reservered' contrary to spec" ) ;
}
switch ( type ) {
case 0x20000000 : return jbig2_comment_ascii ( ctx , segment , segment_data ) ;
case 0x20000002 : return jbig2_comment_unicode ( ctx , segment , segment_data ) ;
default : if ( necessary ) {
return jbig2_error ( ctx , JBIG2_SEVERITY_FATAL , segment -> number , "unhandled necessary extension segment type 0x%08x" , type ) ;
}
else {
return jbig2_error ( ctx , JBIG2_SEVERITY_WARNING , segment -> number , "unhandled extension segment" ) ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int parsedate ( const char * date , time_t * output ) {
time_t t = 0 ;
int wdaynum = - 1 ;
int monnum = - 1 ;
int mdaynum = - 1 ;
int hournum = - 1 ;
int minnum = - 1 ;
int secnum = - 1 ;
int yearnum = - 1 ;
int tzoff = - 1 ;
struct my_tm tm ;
enum assume dignext = DATE_MDAY ;
const char * indate = date ;
int part = 0 ;
while ( * date && ( part < 6 ) ) {
bool found = FALSE ;
skip ( & date ) ;
if ( ISALPHA ( * date ) ) {
char buf [ 32 ] = "" ;
size_t len ;
if ( sscanf ( date , "%31[ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz]" , buf ) ) len = strlen ( buf ) ;
else len = 0 ;
if ( wdaynum == - 1 ) {
wdaynum = checkday ( buf , len ) ;
if ( wdaynum != - 1 ) found = TRUE ;
}
if ( ! found && ( monnum == - 1 ) ) {
monnum = checkmonth ( buf ) ;
if ( monnum != - 1 ) found = TRUE ;
}
if ( ! found && ( tzoff == - 1 ) ) {
tzoff = checktz ( buf ) ;
if ( tzoff != - 1 ) found = TRUE ;
}
if ( ! found ) return PARSEDATE_FAIL ;
date += len ;
}
else if ( ISDIGIT ( * date ) ) {
int val ;
char * end ;
if ( ( secnum == - 1 ) && ( 3 == sscanf ( date , "%02d:%02d:%02d" , & hournum , & minnum , & secnum ) ) ) {
date += 8 ;
}
else if ( ( secnum == - 1 ) && ( 2 == sscanf ( date , "%02d:%02d" , & hournum , & minnum ) ) ) {
date += 5 ;
secnum = 0 ;
}
else {
long lval ;
int error ;
int old_errno ;
old_errno = ERRNO ;
SET_ERRNO ( 0 ) ;
lval = strtol ( date , & end , 10 ) ;
error = ERRNO ;
if ( error != old_errno ) SET_ERRNO ( old_errno ) ;
if ( error ) return PARSEDATE_FAIL ;
# if LONG_MAX != INT_MAX if ( ( lval > ( long ) INT_MAX ) || ( lval < ( long ) INT_MIN ) ) return PARSEDATE_FAIL ;
# endif val = curlx_sltosi ( lval ) ;
if ( ( tzoff == - 1 ) && ( ( end - date ) == 4 ) && ( val <= 1400 ) && ( indate < date ) && ( ( date [ - 1 ] == '+' || date [ - 1 ] == '-' ) ) ) {
found = TRUE ;
tzoff = ( val / 100 * 60 + val % 100 ) * 60 ;
tzoff = date [ - 1 ] == '+' ? - tzoff : tzoff ;
}
if ( ( ( end - date ) == 8 ) && ( yearnum == - 1 ) && ( monnum == - 1 ) && ( mdaynum == - 1 ) ) {
found = TRUE ;
yearnum = val / 10000 ;
monnum = ( val % 10000 ) / 100 - 1 ;
mdaynum = val % 100 ;
}
if ( ! found && ( dignext == DATE_MDAY ) && ( mdaynum == - 1 ) ) {
if ( ( val > 0 ) && ( val < 32 ) ) {
mdaynum = val ;
found = TRUE ;
}
dignext = DATE_YEAR ;
}
if ( ! found && ( dignext == DATE_YEAR ) && ( yearnum == - 1 ) ) {
yearnum = val ;
found = TRUE ;
if ( yearnum < 1900 ) {
if ( yearnum > 70 ) yearnum += 1900 ;
else yearnum += 2000 ;
}
if ( mdaynum == - 1 ) dignext = DATE_MDAY ;
}
if ( ! found ) return PARSEDATE_FAIL ;
date = end ;
}
}
part ++ ;
}
if ( - 1 == secnum ) secnum = minnum = hournum = 0 ;
if ( ( - 1 == mdaynum ) || ( - 1 == monnum ) || ( - 1 == yearnum ) ) return PARSEDATE_FAIL ;
# if SIZEOF_TIME_T < 5 if ( yearnum > 2037 ) {
* output = 0x7fffffff ;
return PARSEDATE_LATER ;
}
# endif if ( yearnum < 1970 ) {
* output = 0 ;
return PARSEDATE_SOONER ;
}
if ( ( mdaynum > 31 ) || ( monnum > 11 ) || ( hournum > 23 ) || ( minnum > 59 ) || ( secnum > 60 ) ) return PARSEDATE_FAIL ;
tm . tm_sec = secnum ;
tm . tm_min = minnum ;
tm . tm_hour = hournum ;
tm . tm_mday = mdaynum ;
tm . tm_mon = monnum ;
tm . tm_year = yearnum - 1900 ;
t = my_timegm ( & tm ) ;
if ( - 1 != ( int ) t ) {
long delta = ( long ) ( tzoff != - 1 ? tzoff : 0 ) ;
if ( ( delta > 0 ) && ( t > LONG_MAX - delta ) ) {
* output = 0x7fffffff ;
return PARSEDATE_LATER ;
}
t += delta ;
}
* output = t ;
return PARSEDATE_OK ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int unicast_flush_resp ( struct sock * sk , const struct sadb_msg * ihdr ) {
struct sk_buff * skb ;
struct sadb_msg * hdr ;
skb = alloc_skb ( sizeof ( struct sadb_msg ) + 16 , GFP_ATOMIC ) ;
if ( ! skb ) return - ENOBUFS ;
hdr = ( struct sadb_msg * ) skb_put ( skb , sizeof ( struct sadb_msg ) ) ;
memcpy ( hdr , ihdr , sizeof ( struct sadb_msg ) ) ;
hdr -> sadb_msg_errno = ( uint8_t ) 0 ;
hdr -> sadb_msg_len = ( sizeof ( struct sadb_msg ) / sizeof ( uint64_t ) ) ;
return pfkey_broadcast ( skb , GFP_ATOMIC , BROADCAST_ONE , sk , sock_net ( sk ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int writer_register ( const Writer * writer ) {
static int next_registered_writer_idx = 0 ;
if ( next_registered_writer_idx == MAX_REGISTERED_WRITERS_NB ) return AVERROR ( ENOMEM ) ;
registered_writers [ next_registered_writer_idx ++ ] = writer ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static pdf_gstate * begin_softmask ( fz_context * ctx , pdf_run_processor * pr , softmask_save * save ) {
pdf_gstate * gstate = pr -> gstate + pr -> gtop ;
pdf_xobject * softmask = gstate -> softmask ;
fz_rect mask_bbox ;
fz_matrix tos_save [ 2 ] , save_ctm ;
fz_matrix mask_matrix ;
fz_colorspace * mask_colorspace ;
save -> softmask = softmask ;
if ( softmask == NULL ) return gstate ;
save -> page_resources = gstate -> softmask_resources ;
save -> ctm = gstate -> softmask_ctm ;
save_ctm = gstate -> ctm ;
pdf_xobject_bbox ( ctx , softmask , & mask_bbox ) ;
pdf_xobject_matrix ( ctx , softmask , & mask_matrix ) ;
pdf_tos_save ( ctx , & pr -> tos , tos_save ) ;
if ( gstate -> luminosity ) mask_bbox = fz_infinite_rect ;
else {
fz_transform_rect ( & mask_bbox , & mask_matrix ) ;
fz_transform_rect ( & mask_bbox , & gstate -> softmask_ctm ) ;
}
gstate -> softmask = NULL ;
gstate -> softmask_resources = NULL ;
gstate -> ctm = gstate -> softmask_ctm ;
mask_colorspace = pdf_xobject_colorspace ( ctx , softmask ) ;
if ( gstate -> luminosity && ! mask_colorspace ) mask_colorspace = fz_keep_colorspace ( ctx , fz_device_gray ( ctx ) ) ;
fz_try ( ctx ) {
fz_begin_mask ( ctx , pr -> dev , & mask_bbox , gstate -> luminosity , mask_colorspace , gstate -> softmask_bc , & gstate -> fill . color_params ) ;
pdf_run_xobject ( ctx , pr , softmask , save -> page_resources , & fz_identity , 1 ) ;
}
fz_always ( ctx ) fz_drop_colorspace ( ctx , mask_colorspace ) ;
fz_catch ( ctx ) {
fz_rethrow_if ( ctx , FZ_ERROR_TRYLATER ) ;
}
fz_end_mask ( ctx , pr -> dev ) ;
pdf_tos_restore ( ctx , & pr -> tos , tos_save ) ;
gstate = pr -> gstate + pr -> gtop ;
gstate -> ctm = save_ctm ;
return gstate ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ps2_kbd_post_load ( void * opaque , int version_id ) {
PS2KbdState * s = ( PS2KbdState * ) opaque ;
PS2State * ps2 = & s -> common ;
if ( version_id == 2 ) s -> scancode_set = 2 ;
ps2_common_post_load ( ps2 ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
fz_xml * xps_lookup_alternate_content ( fz_xml * node ) {
for ( node = fz_xml_down ( node ) ;
node ;
node = fz_xml_next ( node ) ) {
if ( ! strcmp ( fz_xml_tag ( node ) , "mc:Choice" ) && fz_xml_att ( node , "Requires" ) ) {
char list [ 64 ] ;
char * next = list , * item ;
fz_strlcpy ( list , fz_xml_att ( node , "Requires" ) , sizeof ( list ) ) ;
while ( ( item = fz_strsep ( & next , " \t\r\n" ) ) != NULL && ( ! * item || ! strcmp ( item , "xps" ) ) ) ;
if ( ! item ) return fz_xml_down ( node ) ;
}
else if ( ! strcmp ( fz_xml_tag ( node ) , "mc:Fallback" ) ) return fz_xml_down ( node ) ;
}
return NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int EVP_CipherInit ( EVP_CIPHER_CTX * ctx , const EVP_CIPHER * cipher , const unsigned char * key , const unsigned char * iv , int enc ) {
EVP_CIPHER_CTX_reset ( ctx ) ;
return EVP_CipherInit_ex ( ctx , cipher , NULL , key , iv , enc ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SPL_METHOD ( SplFileInfo , func_name ) \ {
\ spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
\ zend_error_handling error_handling ;
\ if ( zend_parse_parameters_none ( ) == FAILURE ) {
\ return ;
\ }
\ \ zend_replace_error_handling ( EH_THROW , spl_ce_RuntimeException , & error_handling TSRMLS_CC ) ;
\ spl_filesystem_object_get_file_name ( intern TSRMLS_CC ) ;
\ php_stat ( intern -> file_name , intern -> file_name_len , func_num , return_value TSRMLS_CC ) ;
\ zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
\ }
FileInfoFunction ( getPerms , FS_PERMS ) FileInfoFunction ( getInode , FS_INODE ) FileInfoFunction ( getSize , FS_SIZE ) FileInfoFunction ( getOwner , FS_OWNER ) FileInfoFunction ( getGroup , FS_GROUP ) FileInfoFunction ( getATime , FS_ATIME ) FileInfoFunction ( getMTime , FS_MTIME ) FileInfoFunction ( getCTime , FS_CTIME )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int squared_diff_macroblock ( uint8_t a [ ] , uint8_t b [ ] , int size ) {
int cp , sdiff = 0 ;
for ( cp = 0 ;
cp < 3 ;
cp ++ ) {
int bias = ( cp ? CHROMA_BIAS : 4 ) ;
sdiff += bias * eval_sse ( a , b , size * size ) ;
a += size * size ;
b += size * size ;
}
return sdiff ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( BaseSearchProviderTest , PreserveAnswersWhenDeduplicating ) {
TemplateURLData data ;
data . SetURL ( "http://foo.com/url?bar={
searchTerms}
" ) ;
std : : unique_ptr < TemplateURL > template_url ( new TemplateURL ( data ) ) ;
TestBaseSearchProvider : : MatchMap map ;
base : : string16 query = base : : ASCIIToUTF16 ( "weather los angeles" ) ;
base : : string16 answer_contents = base : : ASCIIToUTF16 ( "some answer content" ) ;
base : : string16 answer_type = base : : ASCIIToUTF16 ( "2334" ) ;
std : : unique_ptr < SuggestionAnswer > answer ( new SuggestionAnswer ( ) ) ;
answer -> set_type ( 2334 ) ;
EXPECT_CALL ( * provider_ , GetInput ( _ ) ) . WillRepeatedly ( Return ( AutocompleteInput ( ) ) ) ;
EXPECT_CALL ( * provider_ , GetTemplateURL ( _ ) ) . WillRepeatedly ( Return ( template_url . get ( ) ) ) ;
SearchSuggestionParser : : SuggestResult more_relevant ( query , AutocompleteMatchType : : SEARCH_HISTORY , 0 , query , base : : string16 ( ) , base : : string16 ( ) , base : : string16 ( ) , base : : string16 ( ) , nullptr , std : : string ( ) , std : : string ( ) , false , 1300 , true , false , query ) ;
provider_ -> AddMatchToMap ( more_relevant , std : : string ( ) , TemplateURLRef : : NO_SUGGESTION_CHOSEN , false , false , & map ) ;
SearchSuggestionParser : : SuggestResult less_relevant ( query , AutocompleteMatchType : : SEARCH_SUGGEST , 0 , query , base : : string16 ( ) , base : : string16 ( ) , answer_contents , answer_type , SuggestionAnswer : : copy ( answer . get ( ) ) , std : : string ( ) , std : : string ( ) , false , 850 , true , false , query ) ;
provider_ -> AddMatchToMap ( less_relevant , std : : string ( ) , TemplateURLRef : : NO_SUGGESTION_CHOSEN , false , false , & map ) ;
ASSERT_EQ ( 1U , map . size ( ) ) ;
AutocompleteMatch match = map . begin ( ) -> second ;
ASSERT_EQ ( 1U , match . duplicate_matches . size ( ) ) ;
AutocompleteMatch duplicate = match . duplicate_matches [ 0 ] ;
EXPECT_EQ ( answer_contents , match . answer_contents ) ;
EXPECT_EQ ( answer_type , match . answer_type ) ;
EXPECT_TRUE ( answer -> Equals ( * match . answer ) ) ;
EXPECT_EQ ( AutocompleteMatchType : : SEARCH_HISTORY , match . type ) ;
EXPECT_EQ ( 1300 , match . relevance ) ;
EXPECT_EQ ( answer_contents , duplicate . answer_contents ) ;
EXPECT_EQ ( answer_type , duplicate . answer_type ) ;
EXPECT_TRUE ( answer -> Equals ( * duplicate . answer ) ) ;
EXPECT_EQ ( AutocompleteMatchType : : SEARCH_SUGGEST , duplicate . type ) ;
EXPECT_EQ ( 850 , duplicate . relevance ) ;
map . clear ( ) ;
base : : string16 answer_contents2 = base : : ASCIIToUTF16 ( "different answer" ) ;
base : : string16 answer_type2 = base : : ASCIIToUTF16 ( "8242" ) ;
std : : unique_ptr < SuggestionAnswer > answer2 ( new SuggestionAnswer ( ) ) ;
answer2 -> set_type ( 8242 ) ;
more_relevant = SearchSuggestionParser : : SuggestResult ( query , AutocompleteMatchType : : SEARCH_HISTORY , 0 , query , base : : string16 ( ) , base : : string16 ( ) , answer_contents2 , answer_type2 , SuggestionAnswer : : copy ( answer2 . get ( ) ) , std : : string ( ) , std : : string ( ) , false , 1300 , true , false , query ) ;
provider_ -> AddMatchToMap ( more_relevant , std : : string ( ) , TemplateURLRef : : NO_SUGGESTION_CHOSEN , false , false , & map ) ;
provider_ -> AddMatchToMap ( less_relevant , std : : string ( ) , TemplateURLRef : : NO_SUGGESTION_CHOSEN , false , false , & map ) ;
ASSERT_EQ ( 1U , map . size ( ) ) ;
match = map . begin ( ) -> second ;
ASSERT_EQ ( 1U , match . duplicate_matches . size ( ) ) ;
duplicate = match . duplicate_matches [ 0 ] ;
EXPECT_EQ ( answer_contents2 , match . answer_contents ) ;
EXPECT_EQ ( answer_type2 , match . answer_type ) ;
EXPECT_TRUE ( answer2 -> Equals ( * match . answer ) ) ;
EXPECT_EQ ( AutocompleteMatchType : : SEARCH_HISTORY , match . type ) ;
EXPECT_EQ ( 1300 , match . relevance ) ;
EXPECT_EQ ( answer_contents , duplicate . answer_contents ) ;
EXPECT_EQ ( answer_type , duplicate . answer_type ) ;
EXPECT_TRUE ( answer -> Equals ( * duplicate . answer ) ) ;
EXPECT_EQ ( AutocompleteMatchType : : SEARCH_SUGGEST , duplicate . type ) ;
EXPECT_EQ ( 850 , duplicate . relevance ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
kadm5_ret_t kadm5_set_string ( void * server_handle , krb5_principal principal , const char * key , const char * value ) {
kadm5_server_handle_t handle = server_handle ;
kadm5_ret_t ret ;
krb5_db_entry * kdb ;
osa_princ_ent_rec adb ;
CHECK_HANDLE ( server_handle ) ;
if ( principal == NULL || key == NULL ) return EINVAL ;
ret = kdb_get_entry ( handle , principal , & kdb , & adb ) ;
if ( ret ) return ret ;
ret = krb5_dbe_set_string ( handle -> context , kdb , key , value ) ;
if ( ret ) goto done ;
kdb -> mask = KADM5_TL_DATA ;
ret = kdb_put_entry ( handle , kdb , & adb ) ;
done : kdb_free_entry ( handle , kdb , & adb ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_bug4026 ( ) {
MYSQL_STMT * stmt ;
MYSQL_BIND my_bind [ 2 ] ;
MYSQL_TIME time_in , time_out ;
MYSQL_TIME datetime_in , datetime_out ;
const char * stmt_text ;
int rc ;
myheader ( "test_bug4026" ) ;
stmt = mysql_stmt_init ( mysql ) ;
stmt_text = "SELECT ?, ?" ;
rc = mysql_stmt_prepare ( stmt , stmt_text , strlen ( stmt_text ) ) ;
check_execute ( stmt , rc ) ;
memset ( my_bind , 0 , sizeof ( my_bind ) ) ;
memset ( & time_in , 0 , sizeof ( time_in ) ) ;
memset ( & time_out , 0 , sizeof ( time_out ) ) ;
memset ( & datetime_in , 0 , sizeof ( datetime_in ) ) ;
memset ( & datetime_out , 0 , sizeof ( datetime_out ) ) ;
my_bind [ 0 ] . buffer_type = MYSQL_TYPE_TIME ;
my_bind [ 0 ] . buffer = ( void * ) & time_in ;
my_bind [ 1 ] . buffer_type = MYSQL_TYPE_DATETIME ;
my_bind [ 1 ] . buffer = ( void * ) & datetime_in ;
time_in . hour = 23 ;
time_in . minute = 59 ;
time_in . second = 59 ;
time_in . second_part = 123456 ;
time_in . time_type = MYSQL_TIMESTAMP_TIME ;
datetime_in = time_in ;
datetime_in . year = 2003 ;
datetime_in . month = 12 ;
datetime_in . day = 31 ;
datetime_in . time_type = MYSQL_TIMESTAMP_DATETIME ;
mysql_stmt_bind_param ( stmt , my_bind ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
my_bind [ 0 ] . buffer = ( void * ) & time_out ;
my_bind [ 1 ] . buffer = ( void * ) & datetime_out ;
mysql_stmt_bind_result ( stmt , my_bind ) ;
rc = mysql_stmt_fetch ( stmt ) ;
DIE_UNLESS ( rc == 0 ) ;
if ( ! opt_silent ) {
printf ( "%d:%d:%d.%lu\n" , time_out . hour , time_out . minute , time_out . second , time_out . second_part ) ;
printf ( "%d-%d-%d %d:%d:%d.%lu\n" , datetime_out . year , datetime_out . month , datetime_out . day , datetime_out . hour , datetime_out . minute , datetime_out . second , datetime_out . second_part ) ;
}
DIE_UNLESS ( memcmp ( & time_in , & time_out , sizeof ( time_in ) ) == 0 ) ;
DIE_UNLESS ( memcmp ( & datetime_in , & datetime_out , sizeof ( datetime_in ) ) == 0 ) ;
mysql_stmt_close ( stmt ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_Clc_reason ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_Clc_reason , Clc_reason_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void encode_block_pass1 ( int plane , int block , BLOCK_SIZE plane_bsize , TX_SIZE tx_size , void * arg ) {
MACROBLOCK * const x = ( MACROBLOCK * ) arg ;
MACROBLOCKD * const xd = & x -> e_mbd ;
struct macroblock_plane * const p = & x -> plane [ plane ] ;
struct macroblockd_plane * const pd = & xd -> plane [ plane ] ;
tran_low_t * const dqcoeff = BLOCK_OFFSET ( pd -> dqcoeff , block ) ;
int i , j ;
uint8_t * dst ;
txfrm_block_to_raster_xy ( plane_bsize , tx_size , block , & i , & j ) ;
dst = & pd -> dst . buf [ 4 * j * pd -> dst . stride + 4 * i ] ;
vp9_xform_quant ( x , plane , block , plane_bsize , tx_size ) ;
if ( p -> eobs [ block ] > 0 ) x -> itxm_add ( dqcoeff , dst , pd -> dst . stride , p -> eobs [ block ] ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean gst_asf_demux_handle_seek_push ( GstASFDemux * demux , GstEvent * event ) {
gdouble rate ;
GstFormat format ;
GstSeekFlags flags ;
GstSeekType cur_type , stop_type ;
gint64 cur , stop ;
guint packet ;
gboolean res ;
GstEvent * byte_event ;
gst_event_parse_seek ( event , & rate , & format , & flags , & cur_type , & cur , & stop_type , & stop ) ;
stop_type = GST_SEEK_TYPE_NONE ;
stop = - 1 ;
GST_DEBUG_OBJECT ( demux , "seeking to %" GST_TIME_FORMAT , GST_TIME_ARGS ( cur ) ) ;
if ( ! gst_asf_demux_seek_index_lookup ( demux , & packet , cur , NULL , NULL , FALSE , NULL ) ) {
packet = ( guint ) gst_util_uint64_scale ( demux -> num_packets , cur , demux -> play_time ) ;
}
if ( packet > demux -> num_packets ) {
GST_DEBUG_OBJECT ( demux , "could not determine packet to seek to, " "seek aborted." ) ;
return FALSE ;
}
GST_DEBUG_OBJECT ( demux , "seeking to packet %d" , packet ) ;
cur = demux -> data_offset + ( ( guint64 ) packet * demux -> packet_size ) ;
GST_DEBUG_OBJECT ( demux , "Pushing BYTE seek rate %g, " "start %" G_GINT64_FORMAT ", stop %" G_GINT64_FORMAT , rate , cur , stop ) ;
byte_event = gst_event_new_seek ( rate , GST_FORMAT_BYTES , flags , cur_type , cur , stop_type , stop ) ;
gst_event_set_seqnum ( byte_event , gst_event_get_seqnum ( event ) ) ;
res = gst_pad_push_event ( demux -> sinkpad , byte_event ) ;
return res ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool isAssignmentIndirectionExpr ( ExprState * exprstate ) {
if ( exprstate == NULL ) return false ;
if ( IsA ( exprstate , FieldStoreState ) ) {
FieldStore * fstore = ( FieldStore * ) exprstate -> expr ;
if ( fstore -> arg && IsA ( fstore -> arg , CaseTestExpr ) ) return true ;
}
else if ( IsA ( exprstate , ArrayRefExprState ) ) {
ArrayRef * arrayRef = ( ArrayRef * ) exprstate -> expr ;
if ( arrayRef -> refexpr && IsA ( arrayRef -> refexpr , CaseTestExpr ) ) return true ;
}
return false ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int best_effort_strncat_to_utf16le ( struct archive_string * as16 , const void * _p , size_t length , struct archive_string_conv * sc ) {
return ( best_effort_strncat_to_utf16 ( as16 , _p , length , sc , 0 ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( HttpsEngagementPageLoadMetricsBrowserTest , BackgroundThenForeground_Http ) {
StartHttpServer ( ) ;
base : : TimeDelta upper_bound = NavigateInBackgroundAndCloseInForegroundWithTiming ( 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 ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int is_afio_large ( const char * h , size_t len ) {
if ( len < afiol_header_size ) return ( 0 ) ;
if ( h [ afiol_ino_m_offset ] != 'm' || h [ afiol_mtime_n_offset ] != 'n' || h [ afiol_xsize_s_offset ] != 's' || h [ afiol_filesize_c_offset ] != ':' ) return ( 0 ) ;
if ( ! is_hex ( h + afiol_dev_offset , afiol_ino_m_offset - afiol_dev_offset ) ) return ( 0 ) ;
if ( ! is_hex ( h + afiol_mode_offset , afiol_mtime_n_offset - afiol_mode_offset ) ) return ( 0 ) ;
if ( ! is_hex ( h + afiol_namesize_offset , afiol_xsize_s_offset - afiol_namesize_offset ) ) return ( 0 ) ;
if ( ! is_hex ( h + afiol_filesize_offset , afiol_filesize_size ) ) return ( 0 ) ;
return ( 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_save_layer_context ( VP9_COMP * const cpi ) {
const VP9EncoderConfig * const oxcf = & cpi -> oxcf ;
LAYER_CONTEXT * const lc = get_layer_context ( cpi ) ;
lc -> rc = cpi -> rc ;
lc -> twopass = cpi -> twopass ;
lc -> target_bandwidth = ( int ) oxcf -> target_bandwidth ;
lc -> alt_ref_source = cpi -> alt_ref_source ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int lexescape ( struct vars * v ) {
chr c ;
static const chr alert [ ] = {
CHR ( 'a' ) , CHR ( 'l' ) , CHR ( 'e' ) , CHR ( 'r' ) , CHR ( 't' ) }
;
static const chr esc [ ] = {
CHR ( 'E' ) , CHR ( 'S' ) , CHR ( 'C' ) }
;
const chr * save ;
assert ( v -> cflags & REG_ADVF ) ;
assert ( ! ATEOS ( ) ) ;
c = * v -> now ++ ;
if ( ! iscalnum ( c ) ) RETV ( PLAIN , c ) ;
NOTE ( REG_UNONPOSIX ) ;
switch ( c ) {
case CHR ( 'a' ) : RETV ( PLAIN , chrnamed ( v , alert , ENDOF ( alert ) , CHR ( '\007' ) ) ) ;
break ;
case CHR ( 'A' ) : RETV ( SBEGIN , 0 ) ;
break ;
case CHR ( 'b' ) : RETV ( PLAIN , CHR ( '\b' ) ) ;
break ;
case CHR ( 'B' ) : RETV ( PLAIN , CHR ( '\\' ) ) ;
break ;
case CHR ( 'c' ) : NOTE ( REG_UUNPORT ) ;
if ( ATEOS ( ) ) FAILW ( REG_EESCAPE ) ;
RETV ( PLAIN , ( chr ) ( * v -> now ++ & 037 ) ) ;
break ;
case CHR ( 'd' ) : NOTE ( REG_ULOCALE ) ;
RETV ( CCLASS , 'd' ) ;
break ;
case CHR ( 'D' ) : NOTE ( REG_ULOCALE ) ;
RETV ( CCLASS , 'D' ) ;
break ;
case CHR ( 'e' ) : NOTE ( REG_UUNPORT ) ;
RETV ( PLAIN , chrnamed ( v , esc , ENDOF ( esc ) , CHR ( '\033' ) ) ) ;
break ;
case CHR ( 'f' ) : RETV ( PLAIN , CHR ( '\f' ) ) ;
break ;
case CHR ( 'm' ) : RET ( '<' ) ;
break ;
case CHR ( 'M' ) : RET ( '>' ) ;
break ;
case CHR ( 'n' ) : RETV ( PLAIN , CHR ( '\n' ) ) ;
break ;
case CHR ( 'r' ) : RETV ( PLAIN , CHR ( '\r' ) ) ;
break ;
case CHR ( 's' ) : NOTE ( REG_ULOCALE ) ;
RETV ( CCLASS , 's' ) ;
break ;
case CHR ( 'S' ) : NOTE ( REG_ULOCALE ) ;
RETV ( CCLASS , 'S' ) ;
break ;
case CHR ( 't' ) : RETV ( PLAIN , CHR ( '\t' ) ) ;
break ;
case CHR ( 'u' ) : c = lexdigits ( v , 16 , 4 , 4 ) ;
if ( ISERR ( ) ) FAILW ( REG_EESCAPE ) ;
RETV ( PLAIN , c ) ;
break ;
case CHR ( 'U' ) : c = lexdigits ( v , 16 , 8 , 8 ) ;
if ( ISERR ( ) ) FAILW ( REG_EESCAPE ) ;
RETV ( PLAIN , c ) ;
break ;
case CHR ( 'v' ) : RETV ( PLAIN , CHR ( '\v' ) ) ;
break ;
case CHR ( 'w' ) : NOTE ( REG_ULOCALE ) ;
RETV ( CCLASS , 'w' ) ;
break ;
case CHR ( 'W' ) : NOTE ( REG_ULOCALE ) ;
RETV ( CCLASS , 'W' ) ;
break ;
case CHR ( 'x' ) : NOTE ( REG_UUNPORT ) ;
c = lexdigits ( v , 16 , 1 , 255 ) ;
if ( ISERR ( ) ) FAILW ( REG_EESCAPE ) ;
RETV ( PLAIN , c ) ;
break ;
case CHR ( 'y' ) : NOTE ( REG_ULOCALE ) ;
RETV ( WBDRY , 0 ) ;
break ;
case CHR ( 'Y' ) : NOTE ( REG_ULOCALE ) ;
RETV ( NWBDRY , 0 ) ;
break ;
case CHR ( 'Z' ) : RETV ( SEND , 0 ) ;
break ;
case CHR ( '1' ) : case CHR ( '2' ) : case CHR ( '3' ) : case CHR ( '4' ) : case CHR ( '5' ) : case CHR ( '6' ) : case CHR ( '7' ) : case CHR ( '8' ) : case CHR ( '9' ) : save = v -> now ;
v -> now -- ;
c = lexdigits ( v , 10 , 1 , 255 ) ;
if ( ISERR ( ) ) FAILW ( REG_EESCAPE ) ;
if ( v -> now == save || ( ( int ) c > 0 && ( int ) c <= v -> nsubexp ) ) {
NOTE ( REG_UBACKREF ) ;
RETV ( BACKREF , ( chr ) c ) ;
}
v -> now = save ;
case CHR ( '0' ) : NOTE ( REG_UUNPORT ) ;
v -> now -- ;
c = lexdigits ( v , 8 , 1 , 3 ) ;
if ( ISERR ( ) ) FAILW ( REG_EESCAPE ) ;
if ( c > 0xff ) {
v -> now -- ;
c >>= 3 ;
}
RETV ( PLAIN , c ) ;
break ;
default : assert ( iscalpha ( c ) ) ;
FAILW ( REG_EESCAPE ) ;
break ;
}
assert ( NOTREACHED ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int finish_frame ( AVCodecContext * avctx , AVFrame * pict ) {
RV34DecContext * r = avctx -> priv_data ;
MpegEncContext * s = & r -> s ;
int got_picture = 0 , ret ;
ff_er_frame_end ( & s -> er ) ;
ff_MPV_frame_end ( s ) ;
s -> mb_num_left = 0 ;
if ( HAVE_THREADS && ( s -> avctx -> active_thread_type & FF_THREAD_FRAME ) ) ff_thread_report_progress ( & s -> current_picture_ptr -> tf , INT_MAX , 0 ) ;
if ( s -> pict_type == AV_PICTURE_TYPE_B || s -> low_delay ) {
if ( ( ret = av_frame_ref ( pict , & s -> current_picture_ptr -> f ) ) < 0 ) return ret ;
ff_print_debug_info ( s , s -> current_picture_ptr ) ;
got_picture = 1 ;
}
else if ( s -> last_picture_ptr != NULL ) {
if ( ( ret = av_frame_ref ( pict , & s -> last_picture_ptr -> f ) ) < 0 ) return ret ;
ff_print_debug_info ( s , s -> last_picture_ptr ) ;
got_picture = 1 ;
}
return got_picture ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void init_tee ( const char * file_name ) {
FILE * new_outfile ;
if ( opt_outfile ) end_tee ( ) ;
if ( ! ( new_outfile = my_fopen ( file_name , O_APPEND | O_WRONLY , MYF ( MY_WME ) ) ) ) {
tee_fprintf ( stdout , "Error logging to file '%s'\n" , file_name ) ;
return ;
}
OUTFILE = new_outfile ;
strmake_buf ( outfile , file_name ) ;
tee_fprintf ( stdout , "Logging to file '%s'\n" , file_name ) ;
opt_outfile = 1 ;
return ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( MdDownloadsDOMHandlerTest , ChecksForRemovedFiles ) {
EXPECT_CALL ( * manager ( ) , CheckForHistoryFilesRemoval ( ) ) ;
TestMdDownloadsDOMHandler handler ( manager ( ) , web_ui ( ) ) ;
testing : : Mock : : VerifyAndClear ( manager ( ) ) ;
EXPECT_CALL ( * manager ( ) , CheckForHistoryFilesRemoval ( ) ) ;
handler . OnJavascriptDisallowed ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void write_delta_q ( struct vp9_write_bit_buffer * wb , int delta_q ) {
if ( delta_q != 0 ) {
vp9_wb_write_bit ( wb , 1 ) ;
vp9_wb_write_literal ( wb , abs ( delta_q ) , 4 ) ;
vp9_wb_write_bit ( wb , delta_q < 0 ) ;
}
else {
vp9_wb_write_bit ( wb , 0 ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int virLogPriorityFromSyslog ( int priority ATTRIBUTE_UNUSED ) {
return VIR_LOG_ERROR ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void decode_power_in_watt ( gchar * s , guint16 value ) {
g_snprintf ( s , ITEM_LABEL_LENGTH , "%d Watt" , value ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static SlirpState * slirp_lookup ( Monitor * mon , const char * vlan , const char * stack ) {
if ( vlan ) {
NetClientState * nc ;
nc = net_hub_find_client_by_name ( strtol ( vlan , NULL , 0 ) , stack ) ;
if ( ! nc ) {
monitor_printf ( mon , "unrecognized (vlan-id, stackname) pair\n" ) ;
return NULL ;
}
if ( strcmp ( nc -> model , "user" ) ) {
monitor_printf ( mon , "invalid device specified\n" ) ;
return NULL ;
}
return DO_UPCAST ( SlirpState , nc , nc ) ;
}
else {
if ( QTAILQ_EMPTY ( & slirp_stacks ) ) {
monitor_printf ( mon , "user mode network stack not in use\n" ) ;
return NULL ;
}
return QTAILQ_FIRST ( & slirp_stacks ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static __always_inline __le32 __cpu_to_le32p ( const __u32 * p ) {
return ( __le32 ) * p ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( SyncBookmarkDataTypeControllerTest , StartAssociationFailed ) {
CreateBookmarkModel ( LOAD_MODEL ) ;
SetStartExpectations ( ) ;
EXPECT_CALL ( * profile_sync_factory_ , CreateBookmarkSyncComponents ( _ , _ ) ) ;
EXPECT_CALL ( * model_associator_ , CryptoReadyIfNecessary ( ) ) . WillRepeatedly ( Return ( true ) ) ;
EXPECT_CALL ( * model_associator_ , SyncModelHasUserCreatedNodes ( _ ) ) . WillRepeatedly ( DoAll ( SetArgumentPointee < 0 > ( true ) , Return ( true ) ) ) ;
EXPECT_CALL ( * model_associator_ , AssociateModels ( _ , _ ) ) . WillRepeatedly ( Return ( syncer : : SyncError ( FROM_HERE , syncer : : SyncError : : DATATYPE_ERROR , "error" , syncer : : BOOKMARKS ) ) ) ;
EXPECT_CALL ( start_callback_ , Run ( DataTypeController : : ASSOCIATION_FAILED , _ , _ ) ) ;
Start ( ) ;
EXPECT_EQ ( DataTypeController : : DISABLED , bookmark_dtc_ -> state ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( ProtocolHandlerRegistryTest , TestClearDefault ) {
ProtocolHandler ph1 = CreateProtocolHandler ( "test" , "test1" ) ;
ProtocolHandler ph2 = CreateProtocolHandler ( "test" , "test2" ) ;
registry ( ) -> OnAcceptRegisterProtocolHandler ( ph1 ) ;
registry ( ) -> OnAcceptRegisterProtocolHandler ( ph2 ) ;
registry ( ) -> OnAcceptRegisterProtocolHandler ( ph1 ) ;
registry ( ) -> ClearDefault ( "test" ) ;
ASSERT_FALSE ( registry ( ) -> IsDefault ( ph1 ) ) ;
ASSERT_FALSE ( registry ( ) -> IsDefault ( ph2 ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int auth_server_input_ok ( struct auth_server_connection * conn , const char * const * args ) {
struct auth_client_request * request ;
if ( auth_server_lookup_request ( conn , args [ 0 ] , TRUE , & request ) < 0 ) return - 1 ;
auth_client_request_server_input ( request , AUTH_REQUEST_STATUS_OK , args + 1 ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ieee80211_radiotap_iterator_init ( struct ieee80211_radiotap_iterator * iterator , struct ieee80211_radiotap_header * radiotap_header , int max_length , const struct ieee80211_radiotap_vendor_namespaces * vns ) {
if ( max_length < ( int ) sizeof ( struct ieee80211_radiotap_header ) ) return - EINVAL ;
if ( radiotap_header -> it_version ) return - EINVAL ;
if ( max_length < get_unaligned_le16 ( & radiotap_header -> it_len ) ) return - EINVAL ;
iterator -> _rtheader = radiotap_header ;
iterator -> _max_length = get_unaligned_le16 ( & radiotap_header -> it_len ) ;
iterator -> _arg_index = 0 ;
iterator -> _bitmap_shifter = get_unaligned_le32 ( & radiotap_header -> it_present ) ;
iterator -> _arg = ( guint8 * ) radiotap_header + sizeof ( * radiotap_header ) ;
iterator -> _reset_on_ext = 0 ;
iterator -> _next_ns_data = NULL ;
iterator -> _next_bitmap = & radiotap_header -> it_present ;
iterator -> _next_bitmap ++ ;
iterator -> _vns = vns ;
iterator -> current_namespace = & radiotap_ns ;
iterator -> is_radiotap_ns = 1 ;
# ifdef RADIOTAP_SUPPORT_OVERRIDES iterator -> n_overrides = 0 ;
iterator -> overrides = NULL ;
# endif if ( iterator -> _bitmap_shifter & ( 1U << IEEE80211_RADIOTAP_EXT ) ) {
if ( ! ITERATOR_VALID ( iterator , sizeof ( guint32 ) ) ) return - EINVAL ;
while ( get_unaligned_le32 ( iterator -> _arg ) & ( 1U << IEEE80211_RADIOTAP_EXT ) ) {
iterator -> _arg += sizeof ( guint32 ) ;
if ( ! ITERATOR_VALID ( iterator , sizeof ( guint32 ) ) ) return - EINVAL ;
}
iterator -> _arg += sizeof ( guint32 ) ;
}
iterator -> this_arg = iterator -> _arg ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( DownloadExtensionTest , DISABLED_DownloadExtensionTest_OnDeterminingFilename_InterruptedResume ) {
LoadExtension ( "downloads_split" ) ;
ASSERT_TRUE ( StartEmbeddedTestServer ( ) ) ;
GoOnTheRecord ( ) ;
content : : RenderProcessHost * host = AddFilenameDeterminer ( ) ;
DownloadItem * item = NULL ;
{
DownloadManager * manager = GetCurrentManager ( ) ;
std : : unique_ptr < content : : DownloadTestObserver > observer ( new JustInProgressDownloadObserver ( manager , 1 ) ) ;
ASSERT_EQ ( 0 , manager -> InProgressCount ( ) ) ;
ASSERT_EQ ( 0 , manager -> NonMaliciousInProgressCount ( ) ) ;
ui_test_utils : : NavigateToURLWithDisposition ( current_browser ( ) , GURL ( net : : URLRequestSlowDownloadJob : : kUnknownSizeUrl ) , WindowOpenDisposition : : CURRENT_TAB , ui_test_utils : : BROWSER_TEST_NONE ) ;
observer -> WaitForFinished ( ) ;
EXPECT_EQ ( 1u , observer -> NumDownloadsSeenInState ( DownloadItem : : IN_PROGRESS ) ) ;
DownloadManager : : DownloadVector items ;
manager -> GetAllDownloads ( & items ) ;
for ( DownloadManager : : DownloadVector : : iterator iter = items . begin ( ) ;
iter != items . end ( ) ;
++ iter ) {
if ( ( * iter ) -> GetState ( ) == DownloadItem : : IN_PROGRESS ) {
EXPECT_EQ ( NULL , item ) ;
item = * iter ;
}
}
ASSERT_TRUE ( item ) ;
}
ScopedCancellingItem canceller ( item ) ;
ASSERT_TRUE ( WaitFor ( downloads : : OnCreated : : kEventName , base : : StringPrintf ( "[{
\"danger\": \"safe\"," " \"incognito\": false," " \"id\": %d," " \"mime\": \"application/octet-stream\"," " \"paused\": false}
]" , item -> GetId ( ) ) ) ) ;
ASSERT_TRUE ( WaitFor ( downloads : : OnDeterminingFilename : : kEventName , base : : StringPrintf ( "[{
\"id\": %d," " \"incognito\": false," " \"filename\":\"download-unknown-size\"}
]" , item -> GetId ( ) ) ) ) ;
ASSERT_TRUE ( item -> GetTargetFilePath ( ) . empty ( ) ) ;
ASSERT_EQ ( DownloadItem : : IN_PROGRESS , item -> GetState ( ) ) ;
ClearEvents ( ) ;
ui_test_utils : : NavigateToURLWithDisposition ( current_browser ( ) , GURL ( net : : URLRequestSlowDownloadJob : : kErrorDownloadUrl ) , WindowOpenDisposition : : NEW_BACKGROUND_TAB , ui_test_utils : : BROWSER_TEST_WAIT_FOR_NAVIGATION ) ;
std : : string error ;
ASSERT_TRUE ( ExtensionDownloadsEventRouter : : DetermineFilename ( current_browser ( ) -> profile ( ) , false , GetExtensionId ( ) , item -> GetId ( ) , base : : FilePath ( FILE_PATH_LITERAL ( "42.txt" ) ) , downloads : : FILENAME_CONFLICT_ACTION_UNIQUIFY , & error ) ) << error ;
EXPECT_EQ ( "" , error ) ;
ASSERT_TRUE ( WaitFor ( downloads : : OnChanged : : kEventName , base : : StringPrintf ( "[{
\"id\": %d," " \"filename\": {
" " \"previous\": \"\"," " \"current\": \"%s\"}
}
]" , item -> GetId ( ) , GetFilename ( "42.txt" ) . c_str ( ) ) ) ) ;
content : : DownloadUpdatedObserver interrupted ( item , base : : Bind ( ItemIsInterrupted ) ) ;
ASSERT_TRUE ( interrupted . WaitForEvent ( ) ) ;
ASSERT_TRUE ( WaitFor ( downloads : : OnChanged : : kEventName , base : : StringPrintf ( "[{
\"id\": %d," " \"error\":{
\"current\":\"NETWORK_FAILED\"}
," " \"state\":{
" " \"previous\":\"in_progress\"," " \"current\":\"interrupted\"}
}
]" , item -> GetId ( ) ) ) ) ;
ClearEvents ( ) ;
RemoveFilenameDeterminer ( host ) ;
item -> Resume ( ) ;
ASSERT_TRUE ( WaitFor ( downloads : : OnChanged : : kEventName , base : : StringPrintf ( "[{
\"id\": %d," " \"error\":{
\"previous\":\"NETWORK_FAILED\"}
," " \"state\":{
" " \"previous\":\"interrupted\"," " \"current\":\"in_progress\"}
}
]" , item -> GetId ( ) ) ) ) ;
ClearEvents ( ) ;
FinishFirstSlowDownloads ( ) ;
ASSERT_TRUE ( WaitFor ( downloads : : OnChanged : : kEventName , base : : StringPrintf ( "[{
\"id\": %d," " \"state\": {
" " \"previous\": \"in_progress\"," " \"current\": \"complete\"}
}
]" , item -> GetId ( ) ) ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( AppApiTest , MAYBE_AppProcessBackgroundInstances ) {
TestAppInstancesHelper ( "app_process_background_instances" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint32_t getToUnicodeValue ( CnvExtData * extData , UCMTable * table , UCMapping * m ) {
UChar32 * u32 ;
UChar * u ;
uint32_t value ;
int32_t u16Length , ratio ;
UErrorCode errorCode ;
if ( m -> uLen == 1 ) {
u16Length = U16_LENGTH ( m -> u ) ;
value = ( uint32_t ) ( UCNV_EXT_TO_U_MIN_CODE_POINT + m -> u ) ;
}
else {
u32 = UCM_GET_CODE_POINTS ( table , m ) ;
errorCode = U_ZERO_ERROR ;
u_strFromUTF32 ( NULL , 0 , & u16Length , u32 , m -> uLen , & errorCode ) ;
if ( U_FAILURE ( errorCode ) && errorCode != U_BUFFER_OVERFLOW_ERROR ) {
exit ( errorCode ) ;
}
value = ( ( ( uint32_t ) u16Length + UCNV_EXT_TO_U_LENGTH_OFFSET ) << UCNV_EXT_TO_U_LENGTH_SHIFT ) | ( ( uint32_t ) utm_countItems ( extData -> toUUChars ) ) ;
u = utm_allocN ( extData -> toUUChars , u16Length ) ;
errorCode = U_ZERO_ERROR ;
u_strFromUTF32 ( u , u16Length , NULL , u32 , m -> uLen , & errorCode ) ;
if ( U_FAILURE ( errorCode ) && errorCode != U_BUFFER_OVERFLOW_ERROR ) {
exit ( errorCode ) ;
}
}
if ( m -> f == 0 ) {
value |= UCNV_EXT_TO_U_ROUNDTRIP_FLAG ;
}
if ( m -> bLen > extData -> maxInBytes ) {
extData -> maxInBytes = m -> bLen ;
}
if ( u16Length > extData -> maxOutUChars ) {
extData -> maxOutUChars = u16Length ;
}
ratio = ( u16Length + ( m -> bLen - 1 ) ) / m -> bLen ;
if ( ratio > extData -> maxUCharsPerByte ) {
extData -> maxUCharsPerByte = ratio ;
}
return value ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
const char * SSL_state_string ( const SSL * s ) {
const char * str ;
switch ( s -> state ) {
case SSL_ST_BEFORE : str = "PINIT " ;
break ;
case SSL_ST_ACCEPT : str = "AINIT " ;
break ;
case SSL_ST_CONNECT : str = "CINIT " ;
break ;
case SSL_ST_OK : str = "SSLOK " ;
break ;
case SSL_ST_ERR : str = "SSLERR" ;
break ;
# ifndef OPENSSL_NO_SSL2 case SSL2_ST_CLIENT_START_ENCRYPTION : str = "2CSENC" ;
break ;
case SSL2_ST_SERVER_START_ENCRYPTION : str = "2SSENC" ;
break ;
case SSL2_ST_SEND_CLIENT_HELLO_A : str = "2SCH_A" ;
break ;
case SSL2_ST_SEND_CLIENT_HELLO_B : str = "2SCH_B" ;
break ;
case SSL2_ST_GET_SERVER_HELLO_A : str = "2GSH_A" ;
break ;
case SSL2_ST_GET_SERVER_HELLO_B : str = "2GSH_B" ;
break ;
case SSL2_ST_SEND_CLIENT_MASTER_KEY_A : str = "2SCMKA" ;
break ;
case SSL2_ST_SEND_CLIENT_MASTER_KEY_B : str = "2SCMKB" ;
break ;
case SSL2_ST_SEND_CLIENT_FINISHED_A : str = "2SCF_A" ;
break ;
case SSL2_ST_SEND_CLIENT_FINISHED_B : str = "2SCF_B" ;
break ;
case SSL2_ST_SEND_CLIENT_CERTIFICATE_A : str = "2SCC_A" ;
break ;
case SSL2_ST_SEND_CLIENT_CERTIFICATE_B : str = "2SCC_B" ;
break ;
case SSL2_ST_SEND_CLIENT_CERTIFICATE_C : str = "2SCC_C" ;
break ;
case SSL2_ST_SEND_CLIENT_CERTIFICATE_D : str = "2SCC_D" ;
break ;
case SSL2_ST_GET_SERVER_VERIFY_A : str = "2GSV_A" ;
break ;
case SSL2_ST_GET_SERVER_VERIFY_B : str = "2GSV_B" ;
break ;
case SSL2_ST_GET_SERVER_FINISHED_A : str = "2GSF_A" ;
break ;
case SSL2_ST_GET_SERVER_FINISHED_B : str = "2GSF_B" ;
break ;
case SSL2_ST_GET_CLIENT_HELLO_A : str = "2GCH_A" ;
break ;
case SSL2_ST_GET_CLIENT_HELLO_B : str = "2GCH_B" ;
break ;
case SSL2_ST_GET_CLIENT_HELLO_C : str = "2GCH_C" ;
break ;
case SSL2_ST_SEND_SERVER_HELLO_A : str = "2SSH_A" ;
break ;
case SSL2_ST_SEND_SERVER_HELLO_B : str = "2SSH_B" ;
break ;
case SSL2_ST_GET_CLIENT_MASTER_KEY_A : str = "2GCMKA" ;
break ;
case SSL2_ST_GET_CLIENT_MASTER_KEY_B : str = "2GCMKA" ;
break ;
case SSL2_ST_SEND_SERVER_VERIFY_A : str = "2SSV_A" ;
break ;
case SSL2_ST_SEND_SERVER_VERIFY_B : str = "2SSV_B" ;
break ;
case SSL2_ST_SEND_SERVER_VERIFY_C : str = "2SSV_C" ;
break ;
case SSL2_ST_GET_CLIENT_FINISHED_A : str = "2GCF_A" ;
break ;
case SSL2_ST_GET_CLIENT_FINISHED_B : str = "2GCF_B" ;
break ;
case SSL2_ST_SEND_SERVER_FINISHED_A : str = "2SSF_A" ;
break ;
case SSL2_ST_SEND_SERVER_FINISHED_B : str = "2SSF_B" ;
break ;
case SSL2_ST_SEND_REQUEST_CERTIFICATE_A : str = "2SRC_A" ;
break ;
case SSL2_ST_SEND_REQUEST_CERTIFICATE_B : str = "2SRC_B" ;
break ;
case SSL2_ST_SEND_REQUEST_CERTIFICATE_C : str = "2SRC_C" ;
break ;
case SSL2_ST_SEND_REQUEST_CERTIFICATE_D : str = "2SRC_D" ;
break ;
case SSL2_ST_X509_GET_SERVER_CERTIFICATE : str = "2X9GSC" ;
break ;
case SSL2_ST_X509_GET_CLIENT_CERTIFICATE : str = "2X9GCC" ;
break ;
# endif # ifndef OPENSSL_NO_SSL3 case SSL3_ST_SW_FLUSH : case SSL3_ST_CW_FLUSH : str = "3FLUSH" ;
break ;
case SSL3_ST_CW_CLNT_HELLO_A : str = "3WCH_A" ;
break ;
case SSL3_ST_CW_CLNT_HELLO_B : str = "3WCH_B" ;
break ;
case SSL3_ST_CR_SRVR_HELLO_A : str = "3RSH_A" ;
break ;
case SSL3_ST_CR_SRVR_HELLO_B : str = "3RSH_B" ;
break ;
case SSL3_ST_CR_CERT_A : str = "3RSC_A" ;
break ;
case SSL3_ST_CR_CERT_B : str = "3RSC_B" ;
break ;
case SSL3_ST_CR_KEY_EXCH_A : str = "3RSKEA" ;
break ;
case SSL3_ST_CR_KEY_EXCH_B : str = "3RSKEB" ;
break ;
case SSL3_ST_CR_CERT_REQ_A : str = "3RCR_A" ;
break ;
case SSL3_ST_CR_CERT_REQ_B : str = "3RCR_B" ;
break ;
case SSL3_ST_CR_SRVR_DONE_A : str = "3RSD_A" ;
break ;
case SSL3_ST_CR_SRVR_DONE_B : str = "3RSD_B" ;
break ;
case SSL3_ST_CW_CERT_A : str = "3WCC_A" ;
break ;
case SSL3_ST_CW_CERT_B : str = "3WCC_B" ;
break ;
case SSL3_ST_CW_CERT_C : str = "3WCC_C" ;
break ;
case SSL3_ST_CW_CERT_D : str = "3WCC_D" ;
break ;
case SSL3_ST_CW_KEY_EXCH_A : str = "3WCKEA" ;
break ;
case SSL3_ST_CW_KEY_EXCH_B : str = "3WCKEB" ;
break ;
case SSL3_ST_CW_CERT_VRFY_A : str = "3WCV_A" ;
break ;
case SSL3_ST_CW_CERT_VRFY_B : str = "3WCV_B" ;
break ;
case SSL3_ST_SW_CHANGE_A : case SSL3_ST_CW_CHANGE_A : str = "3WCCSA" ;
break ;
case SSL3_ST_SW_CHANGE_B : case SSL3_ST_CW_CHANGE_B : str = "3WCCSB" ;
break ;
case SSL3_ST_SW_FINISHED_A : case SSL3_ST_CW_FINISHED_A : str = "3WFINA" ;
break ;
case SSL3_ST_SW_FINISHED_B : case SSL3_ST_CW_FINISHED_B : str = "3WFINB" ;
break ;
case SSL3_ST_SR_CHANGE_A : case SSL3_ST_CR_CHANGE_A : str = "3RCCSA" ;
break ;
case SSL3_ST_SR_CHANGE_B : case SSL3_ST_CR_CHANGE_B : str = "3RCCSB" ;
break ;
case SSL3_ST_SR_FINISHED_A : case SSL3_ST_CR_FINISHED_A : str = "3RFINA" ;
break ;
case SSL3_ST_SR_FINISHED_B : case SSL3_ST_CR_FINISHED_B : str = "3RFINB" ;
break ;
case SSL3_ST_SW_HELLO_REQ_A : str = "3WHR_A" ;
break ;
case SSL3_ST_SW_HELLO_REQ_B : str = "3WHR_B" ;
break ;
case SSL3_ST_SW_HELLO_REQ_C : str = "3WHR_C" ;
break ;
case SSL3_ST_SR_CLNT_HELLO_A : str = "3RCH_A" ;
break ;
case SSL3_ST_SR_CLNT_HELLO_B : str = "3RCH_B" ;
break ;
case SSL3_ST_SR_CLNT_HELLO_C : str = "3RCH_C" ;
break ;
case SSL3_ST_SW_SRVR_HELLO_A : str = "3WSH_A" ;
break ;
case SSL3_ST_SW_SRVR_HELLO_B : str = "3WSH_B" ;
break ;
case SSL3_ST_SW_CERT_A : str = "3WSC_A" ;
break ;
case SSL3_ST_SW_CERT_B : str = "3WSC_B" ;
break ;
case SSL3_ST_SW_KEY_EXCH_A : str = "3WSKEA" ;
break ;
case SSL3_ST_SW_KEY_EXCH_B : str = "3WSKEB" ;
break ;
case SSL3_ST_SW_CERT_REQ_A : str = "3WCR_A" ;
break ;
case SSL3_ST_SW_CERT_REQ_B : str = "3WCR_B" ;
break ;
case SSL3_ST_SW_SRVR_DONE_A : str = "3WSD_A" ;
break ;
case SSL3_ST_SW_SRVR_DONE_B : str = "3WSD_B" ;
break ;
case SSL3_ST_SR_CERT_A : str = "3RCC_A" ;
break ;
case SSL3_ST_SR_CERT_B : str = "3RCC_B" ;
break ;
case SSL3_ST_SR_KEY_EXCH_A : str = "3RCKEA" ;
break ;
case SSL3_ST_SR_KEY_EXCH_B : str = "3RCKEB" ;
break ;
case SSL3_ST_SR_CERT_VRFY_A : str = "3RCV_A" ;
break ;
case SSL3_ST_SR_CERT_VRFY_B : str = "3RCV_B" ;
break ;
# endif case SSL23_ST_CW_CLNT_HELLO_A : str = "23WCHA" ;
break ;
case SSL23_ST_CW_CLNT_HELLO_B : str = "23WCHB" ;
break ;
case SSL23_ST_CR_SRVR_HELLO_A : str = "23RSHA" ;
break ;
case SSL23_ST_CR_SRVR_HELLO_B : str = "23RSHA" ;
break ;
case SSL23_ST_SR_CLNT_HELLO_A : str = "23RCHA" ;
break ;
case SSL23_ST_SR_CLNT_HELLO_B : str = "23RCHB" ;
break ;
case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A : str = "DRCHVA" ;
break ;
case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B : str = "DRCHVB" ;
break ;
case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A : str = "DWCHVA" ;
break ;
case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B : str = "DWCHVB" ;
break ;
default : str = "UNKWN " ;
break ;
}
return ( str ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static jpc_enc_cblk_t * cblk_create ( jpc_enc_cblk_t * cblk , jpc_enc_cp_t * cp , jpc_enc_prc_t * prc ) {
jpc_enc_band_t * band ;
uint_fast32_t cblktlx ;
uint_fast32_t cblktly ;
uint_fast32_t cblkbrx ;
uint_fast32_t cblkbry ;
jpc_enc_rlvl_t * rlvl ;
uint_fast32_t cblkxind ;
uint_fast32_t cblkyind ;
uint_fast32_t cblkno ;
uint_fast32_t tlcblktlx ;
uint_fast32_t tlcblktly ;
cblkno = cblk - prc -> cblks ;
cblkxind = cblkno % prc -> numhcblks ;
cblkyind = cblkno / prc -> numhcblks ;
rlvl = prc -> band -> rlvl ;
cblk -> prc = prc ;
cblk -> numpasses = 0 ;
cblk -> passes = 0 ;
cblk -> numencpasses = 0 ;
cblk -> numimsbs = 0 ;
cblk -> numlenbits = 0 ;
cblk -> stream = 0 ;
cblk -> mqenc = 0 ;
cblk -> flags = 0 ;
cblk -> numbps = 0 ;
cblk -> curpass = 0 ;
cblk -> data = 0 ;
cblk -> savedcurpass = 0 ;
cblk -> savednumlenbits = 0 ;
cblk -> savednumencpasses = 0 ;
band = prc -> band ;
tlcblktlx = JPC_FLOORTOMULTPOW2 ( prc -> tlx , rlvl -> cblkwidthexpn ) ;
tlcblktly = JPC_FLOORTOMULTPOW2 ( prc -> tly , rlvl -> cblkheightexpn ) ;
cblktlx = JAS_MAX ( tlcblktlx + ( cblkxind << rlvl -> cblkwidthexpn ) , prc -> tlx ) ;
cblktly = JAS_MAX ( tlcblktly + ( cblkyind << rlvl -> cblkheightexpn ) , prc -> tly ) ;
cblkbrx = JAS_MIN ( tlcblktlx + ( ( cblkxind + 1 ) << rlvl -> cblkwidthexpn ) , prc -> brx ) ;
cblkbry = JAS_MIN ( tlcblktly + ( ( cblkyind + 1 ) << rlvl -> cblkheightexpn ) , prc -> bry ) ;
assert ( cblktlx < cblkbrx && cblktly < cblkbry ) ;
if ( ! ( cblk -> data = jas_seq2d_create ( 0 , 0 , 0 , 0 ) ) ) {
goto error ;
}
jas_seq2d_bindsub ( cblk -> data , band -> data , cblktlx , cblktly , cblkbrx , cblkbry ) ;
return cblk ;
error : cblk_destroy ( cblk ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static cmsBool Read16bitTables ( cmsContext ContextID , cmsIOHANDLER * io , cmsPipeline * lut , int nChannels , int nEntries ) {
int i ;
cmsToneCurve * Tables [ cmsMAXCHANNELS ] ;
if ( nEntries <= 0 ) return TRUE ;
if ( nEntries < 2 ) return FALSE ;
if ( nChannels > cmsMAXCHANNELS ) return FALSE ;
memset ( Tables , 0 , sizeof ( Tables ) ) ;
for ( i = 0 ;
i < nChannels ;
i ++ ) {
Tables [ i ] = cmsBuildTabulatedToneCurve16 ( ContextID , nEntries , NULL ) ;
if ( Tables [ i ] == NULL ) goto Error ;
if ( ! _cmsReadUInt16Array ( io , nEntries , Tables [ i ] -> Table16 ) ) goto Error ;
}
if ( ! cmsPipelineInsertStage ( lut , cmsAT_END , cmsStageAllocToneCurves ( ContextID , nChannels , Tables ) ) ) goto Error ;
for ( i = 0 ;
i < nChannels ;
i ++ ) cmsFreeToneCurve ( Tables [ i ] ) ;
return TRUE ;
Error : for ( i = 0 ;
i < nChannels ;
i ++ ) {
if ( Tables [ i ] ) cmsFreeToneCurve ( Tables [ i ] ) ;
}
return FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( PageLoadMetricsBrowserTest , ChromeErrorPage ) {
ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ;
GURL url = embedded_test_server ( ) -> GetURL ( "/title1.html" ) ;
ASSERT_TRUE ( embedded_test_server ( ) -> ShutdownAndWaitUntilComplete ( ) ) ;
content : : NavigationHandleObserver observer ( browser ( ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) , url ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , url ) ;
ASSERT_TRUE ( observer . is_error ( ) ) ;
NavigateToUntrackedUrl ( ) ;
EXPECT_TRUE ( NoPageLoadMetricsRecorded ( ) ) << "Recorded metrics: " << GetRecordedPageLoadMetricNames ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ngsniffer_process_record ( wtap * wth , gboolean is_random , guint * padding , struct wtap_pkthdr * phdr , Buffer * buf , int * err , gchar * * err_info ) {
ngsniffer_t * ngsniffer ;
char record_type [ 2 ] ;
char record_length [ 4 ] ;
guint type , length ;
struct frame2_rec frame2 ;
struct frame4_rec frame4 ;
struct frame6_rec frame6 ;
guint16 time_low , time_med , true_size , size ;
guint8 time_high , time_day ;
guint64 t , tsecs , tpsecs ;
if ( ! ng_read_bytes_or_eof ( wth , record_type , 2 , is_random , err , err_info ) ) {
if ( * err != 0 ) return - 1 ;
return REC_EOF ;
}
if ( ! ng_read_bytes ( wth , record_length , 4 , is_random , err , err_info ) ) return - 1 ;
type = pletoh16 ( record_type ) ;
length = pletoh16 ( record_length ) ;
ngsniffer = ( ngsniffer_t * ) wth -> priv ;
switch ( type ) {
case REC_FRAME2 : if ( ngsniffer -> network == NETWORK_ATM ) {
* err = WTAP_ERR_BAD_FILE ;
* err_info = g_strdup ( "ngsniffer: REC_FRAME2 record in an ATM Sniffer file" ) ;
return - 1 ;
}
if ( length < sizeof frame2 ) {
* err = WTAP_ERR_BAD_FILE ;
* err_info = g_strdup ( "ngsniffer: REC_FRAME2 record length is less than record header length" ) ;
return - 1 ;
}
if ( ! ng_read_bytes ( wth , & frame2 , ( unsigned int ) sizeof frame2 , is_random , err , err_info ) ) return - 1 ;
time_low = pletoh16 ( & frame2 . time_low ) ;
time_med = pletoh16 ( & frame2 . time_med ) ;
time_high = frame2 . time_high ;
time_day = frame2 . time_day ;
size = pletoh16 ( & frame2 . size ) ;
true_size = pletoh16 ( & frame2 . true_size ) ;
length -= sizeof frame2 ;
set_pseudo_header_frame2 ( wth , & phdr -> pseudo_header , & frame2 ) ;
break ;
case REC_FRAME4 : if ( ngsniffer -> network != NETWORK_ATM ) {
* err = WTAP_ERR_BAD_FILE ;
* err_info = g_strdup ( "ngsniffer: REC_FRAME4 record in a non-ATM Sniffer file" ) ;
return - 1 ;
}
if ( ngsniffer -> maj_vers < 5 && ngsniffer -> min_vers >= 95 ) length += sizeof frame4 - sizeof frame2 ;
if ( length < sizeof frame4 ) {
* err = WTAP_ERR_BAD_FILE ;
* err_info = g_strdup ( "ngsniffer: REC_FRAME4 record length is less than record header length" ) ;
return - 1 ;
}
if ( ! ng_read_bytes ( wth , & frame4 , ( unsigned int ) sizeof frame4 , is_random , err , err_info ) ) return - 1 ;
time_low = pletoh16 ( & frame4 . time_low ) ;
time_med = pletoh16 ( & frame4 . time_med ) ;
time_high = frame4 . time_high ;
time_day = frame4 . time_day ;
size = pletoh16 ( & frame4 . size ) ;
true_size = pletoh16 ( & frame4 . true_size ) ;
length -= sizeof frame4 ;
set_pseudo_header_frame4 ( & phdr -> pseudo_header , & frame4 ) ;
break ;
case REC_FRAME6 : if ( length < sizeof frame6 ) {
* err = WTAP_ERR_BAD_FILE ;
* err_info = g_strdup ( "ngsniffer: REC_FRAME6 record length is less than record header length" ) ;
return - 1 ;
}
if ( ! ng_read_bytes ( wth , & frame6 , ( unsigned int ) sizeof frame6 , is_random , err , err_info ) ) return - 1 ;
time_low = pletoh16 ( & frame6 . time_low ) ;
time_med = pletoh16 ( & frame6 . time_med ) ;
time_high = frame6 . time_high ;
time_day = frame6 . time_day ;
size = pletoh16 ( & frame6 . size ) ;
true_size = pletoh16 ( & frame6 . true_size ) ;
length -= sizeof frame6 ;
set_pseudo_header_frame6 ( wth , & phdr -> pseudo_header , & frame6 ) ;
break ;
case REC_EOF : * err = 0 ;
return REC_EOF ;
default : if ( padding != NULL ) {
* padding = length ;
}
return type ;
}
if ( size > length ) {
* err = WTAP_ERR_BAD_FILE ;
* err_info = g_strdup ( "ngsniffer: Record length is less than packet size" ) ;
return - 1 ;
}
if ( padding != NULL ) {
* padding = length - size ;
}
phdr -> rec_type = REC_TYPE_PACKET ;
phdr -> presence_flags = true_size ? WTAP_HAS_TS | WTAP_HAS_CAP_LEN : WTAP_HAS_TS ;
phdr -> len = true_size ? true_size : size ;
phdr -> caplen = size ;
ws_buffer_assure_space ( buf , size ) ;
if ( ! ng_read_bytes ( wth , ws_buffer_start_ptr ( buf ) , size , is_random , err , err_info ) ) return - 1 ;
phdr -> pkt_encap = fix_pseudo_header ( wth -> file_encap , buf , size , & phdr -> pseudo_header ) ;
t = ( ( ( guint64 ) time_high ) << 32 ) | ( ( ( guint64 ) time_med ) << 16 ) | time_low ;
t *= ngsniffer -> timeunit ;
tsecs = t / G_GUINT64_CONSTANT ( 1000000000000 ) ;
tpsecs = t - tsecs * G_GUINT64_CONSTANT ( 1000000000000 ) ;
tsecs += time_day * 86400 ;
tsecs += ngsniffer -> start ;
phdr -> ts . secs = ( time_t ) tsecs ;
phdr -> ts . nsecs = ( int ) ( tpsecs / 1000 ) ;
return type ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int test_candidate_kf ( TWO_PASS * twopass , const FIRSTPASS_STATS * last_frame , const FIRSTPASS_STATS * this_frame , const FIRSTPASS_STATS * next_frame ) {
int is_viable_kf = 0 ;
if ( ( this_frame -> pcnt_second_ref < 0.10 ) && ( next_frame -> pcnt_second_ref < 0.10 ) && ( ( this_frame -> pcnt_inter < 0.05 ) || ( ( ( this_frame -> pcnt_inter - this_frame -> pcnt_neutral ) < 0.35 ) && ( ( this_frame -> intra_error / DOUBLE_DIVIDE_CHECK ( this_frame -> coded_error ) ) < 2.5 ) && ( ( fabs ( last_frame -> coded_error - this_frame -> coded_error ) / DOUBLE_DIVIDE_CHECK ( this_frame -> coded_error ) > 0.40 ) || ( fabs ( last_frame -> intra_error - this_frame -> intra_error ) / DOUBLE_DIVIDE_CHECK ( this_frame -> intra_error ) > 0.40 ) || ( ( next_frame -> intra_error / DOUBLE_DIVIDE_CHECK ( next_frame -> coded_error ) ) > 3.5 ) ) ) ) ) {
int i ;
const FIRSTPASS_STATS * start_pos = twopass -> stats_in ;
FIRSTPASS_STATS local_next_frame = * next_frame ;
double boost_score = 0.0 ;
double old_boost_score = 0.0 ;
double decay_accumulator = 1.0 ;
for ( i = 0 ;
i < 16 ;
++ i ) {
double next_iiratio = ( IIKFACTOR1 * local_next_frame . intra_error / DOUBLE_DIVIDE_CHECK ( local_next_frame . coded_error ) ) ;
if ( next_iiratio > RMAX ) next_iiratio = RMAX ;
if ( local_next_frame . pcnt_inter > 0.85 ) decay_accumulator *= local_next_frame . pcnt_inter ;
else decay_accumulator *= ( 0.85 + local_next_frame . pcnt_inter ) / 2.0 ;
boost_score += ( decay_accumulator * next_iiratio ) ;
if ( ( local_next_frame . pcnt_inter < 0.05 ) || ( next_iiratio < 1.5 ) || ( ( ( local_next_frame . pcnt_inter - local_next_frame . pcnt_neutral ) < 0.20 ) && ( next_iiratio < 3.0 ) ) || ( ( boost_score - old_boost_score ) < 3.0 ) || ( local_next_frame . intra_error < 200 ) ) {
break ;
}
old_boost_score = boost_score ;
if ( EOF == input_stats ( twopass , & local_next_frame ) ) break ;
}
if ( boost_score > 30.0 && ( i > 3 ) ) {
is_viable_kf = 1 ;
}
else {
reset_fpf_position ( twopass , start_pos ) ;
is_viable_kf = 0 ;
}
}
return is_viable_kf ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_multi ( ) {
MYSQL_STMT * stmt_delete , * stmt_update , * stmt_select1 , * stmt_select2 ;
char * query ;
MYSQL_BIND my_bind [ 1 ] ;
int rc , i ;
int32 param = 1 ;
ulong length = 1 ;
myheader ( "test_multi" ) ;
memset ( my_bind , 0 , sizeof ( my_bind ) ) ;
my_bind [ 0 ] . buffer_type = MYSQL_TYPE_LONG ;
my_bind [ 0 ] . buffer = ( void * ) & param ;
my_bind [ 0 ] . length = & length ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS t1, t2" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "create table t1 (a int, b int)" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "create table t2 (a int, b int)" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "insert into t1 values (3, 3), (2, 2), (1, 1)" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "insert into t2 values (3, 3), (2, 2), (1, 1)" ) ;
myquery ( rc ) ;
query = ( char * ) "delete t1, t2 from t1, t2 where t1.a=t2.a and t1.b=10" ;
stmt_delete = mysql_simple_prepare ( mysql , query ) ;
check_stmt ( stmt_delete ) ;
query = ( char * ) "update t1, t2 set t1.b=10, t2.b=10 where t1.a=t2.a and t1.b=?" ;
stmt_update = mysql_simple_prepare ( mysql , query ) ;
check_stmt ( stmt_update ) ;
query = ( char * ) "select * from t1" ;
stmt_select1 = mysql_simple_prepare ( mysql , query ) ;
check_stmt ( stmt_select1 ) ;
query = ( char * ) "select * from t2" ;
stmt_select2 = mysql_simple_prepare ( mysql , query ) ;
check_stmt ( stmt_select2 ) ;
for ( i = 0 ;
i < 3 ;
i ++ ) {
rc = mysql_stmt_bind_param ( stmt_update , my_bind ) ;
check_execute ( stmt_update , rc ) ;
rc = mysql_stmt_execute ( stmt_update ) ;
check_execute ( stmt_update , rc ) ;
if ( ! opt_silent ) fprintf ( stdout , "update %ld\n" , ( long ) param ) ;
rc = mysql_stmt_execute ( stmt_delete ) ;
check_execute ( stmt_delete , rc ) ;
if ( ! opt_silent ) fprintf ( stdout , "delete %ld\n" , ( long ) param ) ;
rc = mysql_stmt_execute ( stmt_select1 ) ;
check_execute ( stmt_select1 , rc ) ;
rc = my_process_stmt_result ( stmt_select1 ) ;
DIE_UNLESS ( rc == 3 - param ) ;
rc = mysql_stmt_execute ( stmt_select2 ) ;
check_execute ( stmt_select2 , rc ) ;
rc = my_process_stmt_result ( stmt_select2 ) ;
DIE_UNLESS ( rc == 3 - param ) ;
param ++ ;
}
mysql_stmt_close ( stmt_delete ) ;
mysql_stmt_close ( stmt_update ) ;
mysql_stmt_close ( stmt_select1 ) ;
mysql_stmt_close ( stmt_select2 ) ;
rc = mysql_query ( mysql , "drop table t1, t2" ) ;
myquery ( rc ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void ulti_pattern ( AVFrame * frame , int x , int y , int f0 , int f1 , int Y0 , int Y1 , int chroma ) {
uint8_t Luma [ 16 ] ;
int mask , i ;
for ( mask = 0x80 , i = 0 ;
mask ;
mask >>= 1 , i ++ ) {
if ( f0 & mask ) Luma [ i ] = Y1 ;
else Luma [ i ] = Y0 ;
}
for ( mask = 0x80 , i = 8 ;
mask ;
mask >>= 1 , i ++ ) {
if ( f1 & mask ) Luma [ i ] = Y1 ;
else Luma [ i ] = Y0 ;
}
ulti_convert_yuv ( frame , x , y , Luma , chroma ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void TSActionCancel ( TSAction actionp ) {
Action * a ;
INKContInternal * i ;
if ( ( uintptr_t ) actionp & 0x1 ) {
a = ( Action * ) ( ( uintptr_t ) actionp - 1 ) ;
i = ( INKContInternal * ) a -> continuation ;
i -> handle_event_count ( EVENT_IMMEDIATE ) ;
}
else {
a = ( Action * ) actionp ;
}
a -> cancel ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int fz_colorspace_is_gray ( fz_context * ctx , const fz_colorspace * cs ) {
return cs && cs -> type == FZ_COLORSPACE_GRAY ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
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 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_P ( BrowserCloseManagerWithDownloadsBrowserTest , TestWithDownloadsFromDifferentProfiles ) {
ProfileManager * profile_manager = g_browser_process -> profile_manager ( ) ;
Profile * other_profile = nullptr ;
{
base : : FilePath path = profile_manager -> user_data_dir ( ) . AppendASCII ( "test_profile" ) ;
base : : ScopedAllowBlockingForTesting allow_blocking ;
if ( ! base : : PathExists ( path ) ) ASSERT_TRUE ( base : : CreateDirectory ( path ) ) ;
other_profile = Profile : : CreateProfile ( path , NULL , Profile : : CREATE_MODE_SYNCHRONOUS ) ;
}
profile_manager -> RegisterTestingProfile ( other_profile , true , false ) ;
Browser * other_profile_browser = CreateBrowser ( other_profile ) ;
SetDownloadPathForProfile ( browser ( ) -> profile ( ) ) ;
SetDownloadPathForProfile ( other_profile ) ;
ASSERT_NO_FATAL_FAILURE ( CreateStalledDownload ( browser ( ) ) ) ;
{
RepeatedNotificationObserver close_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , 1 ) ;
browser ( ) -> window ( ) -> Close ( ) ;
close_observer . Wait ( ) ;
}
ui_test_utils : : BrowserAddedObserver new_browser_observer ;
TestBrowserCloseManager : : AttemptClose ( TestBrowserCloseManager : : USER_CHOICE_USER_CANCELS_CLOSE ) ;
EXPECT_FALSE ( browser_shutdown : : IsTryingToQuit ( ) ) ;
Browser * opened_browser = new_browser_observer . WaitForSingleNewBrowser ( ) ;
EXPECT_EQ ( GURL ( chrome : : kChromeUIDownloadsURL ) , opened_browser -> tab_strip_model ( ) -> GetActiveWebContents ( ) -> GetURL ( ) ) ;
EXPECT_EQ ( GURL ( "about:blank" ) , other_profile_browser -> tab_strip_model ( ) -> GetActiveWebContents ( ) -> GetURL ( ) ) ;
RepeatedNotificationObserver close_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , 2 ) ;
TestBrowserCloseManager : : AttemptClose ( TestBrowserCloseManager : : USER_CHOICE_USER_ALLOWS_CLOSE ) ;
close_observer . Wait ( ) ;
EXPECT_TRUE ( browser_shutdown : : IsTryingToQuit ( ) ) ;
EXPECT_TRUE ( BrowserList : : GetInstance ( ) -> empty ( ) ) ;
if ( browser_defaults : : kBrowserAliveWithNoWindows ) EXPECT_EQ ( 1 , DownloadCoreService : : NonMaliciousDownloadCountAllProfiles ( ) ) ;
else EXPECT_EQ ( 0 , DownloadCoreService : : NonMaliciousDownloadCountAllProfiles ( ) ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void nntp_parse_xref ( struct Context * ctx , struct Header * hdr ) {
struct NntpData * nntp_data = ctx -> data ;
char * buf = mutt_str_strdup ( hdr -> env -> xref ) ;
char * p = buf ;
while ( p ) {
anum_t anum ;
p += strspn ( p , " \t" ) ;
char * grp = p ;
p = strpbrk ( p , " \t" ) ;
if ( p ) * p ++ = '\0' ;
char * colon = strchr ( grp , ':' ) ;
if ( ! colon ) continue ;
* colon ++ = '\0' ;
if ( sscanf ( colon , ANUM , & anum ) != 1 ) continue ;
nntp_article_status ( ctx , hdr , grp , anum ) ;
if ( ! NHDR ( hdr ) -> article_num && ( mutt_str_strcmp ( nntp_data -> group , grp ) == 0 ) ) NHDR ( hdr ) -> article_num = anum ;
}
FREE ( & buf ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_read_format_mtree3 ( void ) {
static char archive [ ] = "#mtree\n" "a type=file contents=file\n" "b type=link link=a\n" "c type=file contents=file\n" ;
struct archive_entry * ae ;
struct archive * a ;
assertMakeDir ( "mtree3" , 0777 ) ;
assertChdir ( "mtree3" ) ;
assertMakeFile ( "file" , 0644 , "file contents" ) ;
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_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "a" ) ;
assertEqualInt ( archive_entry_filetype ( ae ) , AE_IFREG ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "b" ) ;
assertEqualInt ( archive_entry_filetype ( ae ) , AE_IFLNK ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "c" ) ;
assertEqualInt ( archive_entry_filetype ( ae ) , AE_IFREG ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_EOF , archive_read_next_header ( a , & ae ) ) ;
assertEqualInt ( 3 , archive_file_count ( a ) ) ;
assertEqualInt ( ARCHIVE_OK , archive_read_close ( a ) ) ;
assertEqualInt ( ARCHIVE_OK , archive_read_free ( a ) ) ;
assertChdir ( ".." ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pdf_run_SC_pattern ( fz_context * ctx , pdf_processor * proc , const char * name , pdf_pattern * pat , int n , float * color ) {
pdf_run_processor * pr = ( pdf_run_processor * ) proc ;
pr -> dev -> flags &= ~ FZ_DEVFLAG_STROKECOLOR_UNDEFINED ;
pdf_set_pattern ( ctx , pr , PDF_STROKE , pat , color ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_loop_filter_frame_mt ( YV12_BUFFER_CONFIG * frame , VP9Decoder * pbi , VP9_COMMON * cm , int frame_filter_level , int y_only ) {
VP9LfSync * const lf_sync = & pbi -> lf_row_sync ;
const VP9WorkerInterface * const winterface = vp9_get_worker_interface ( ) ;
const int sb_rows = mi_cols_aligned_to_sb ( cm -> mi_rows ) >> MI_BLOCK_SIZE_LOG2 ;
const int tile_cols = 1 << cm -> log2_tile_cols ;
const int num_workers = MIN ( pbi -> max_threads & ~ 1 , tile_cols ) ;
int i ;
if ( ! frame_filter_level ) return ;
if ( ! lf_sync -> sync_range || cm -> last_height != cm -> height ) {
vp9_loop_filter_dealloc ( lf_sync ) ;
vp9_loop_filter_alloc ( lf_sync , cm , sb_rows , cm -> width ) ;
}
vp9_loop_filter_frame_init ( cm , frame_filter_level ) ;
vpx_memset ( lf_sync -> cur_sb_col , - 1 , sizeof ( * lf_sync -> cur_sb_col ) * sb_rows ) ;
for ( i = 0 ;
i < num_workers ;
++ i ) {
VP9Worker * const worker = & pbi -> tile_workers [ i ] ;
TileWorkerData * const tile_data = ( TileWorkerData * ) worker -> data1 ;
LFWorkerData * const lf_data = & tile_data -> lfdata ;
worker -> hook = ( VP9WorkerHook ) loop_filter_row_worker ;
lf_data -> frame_buffer = frame ;
lf_data -> cm = cm ;
vp9_copy ( lf_data -> planes , pbi -> mb . plane ) ;
lf_data -> start = i ;
lf_data -> stop = sb_rows ;
lf_data -> y_only = y_only ;
lf_data -> lf_sync = lf_sync ;
lf_data -> num_lf_workers = num_workers ;
if ( i == num_workers - 1 ) {
winterface -> execute ( worker ) ;
}
else {
winterface -> launch ( worker ) ;
}
}
for ( i = 0 ;
i < num_workers ;
++ i ) {
winterface -> sync ( & pbi -> tile_workers [ i ] ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void proto_register_ber ( void ) {
static hf_register_info hf [ ] = {
{
& hf_ber_id_class , {
"Class" , "ber.id.class" , FT_UINT8 , BASE_DEC , VALS ( ber_class_codes ) , 0xc0 , "Class of BER TLV Identifier" , HFILL }
}
, {
& hf_ber_bitstring_padding , {
"Padding" , "ber.bitstring.padding" , FT_UINT8 , BASE_DEC , NULL , 0x0 , "Number of unused bits in the last octet of the bitstring" , HFILL }
}
, {
& hf_ber_bitstring_empty , {
"Empty" , "ber.bitstring.empty" , FT_UINT8 , BASE_DEC , NULL , 0x0 , "This is an empty bitstring" , HFILL }
}
, {
& hf_ber_id_pc , {
"P/C" , "ber.id.pc" , FT_BOOLEAN , 8 , TFS ( & ber_pc_codes ) , 0x20 , "Primitive or Constructed BER encoding" , HFILL }
}
, {
& hf_ber_id_uni_tag , {
"Tag" , "ber.id.uni_tag" , FT_UINT8 , BASE_DEC | BASE_EXT_STRING , & ber_uni_tag_codes_ext , 0x1f , "Universal tag type" , HFILL }
}
, {
& hf_ber_id_uni_tag_ext , {
"Tag" , "ber.id.uni_tag" , FT_UINT32 , BASE_DEC , NULL , 0 , "Universal tag type" , HFILL }
}
, {
& hf_ber_id_tag , {
"Tag" , "ber.id.tag" , FT_UINT8 , BASE_DEC , NULL , 0x1f , "Tag value for non-Universal classes" , HFILL }
}
, {
& hf_ber_id_tag_ext , {
"Tag" , "ber.id.tag" , FT_UINT32 , BASE_DEC , NULL , 0 , "Tag value for non-Universal classes" , HFILL }
}
, {
& hf_ber_length , {
"Length" , "ber.length" , FT_UINT32 , BASE_DEC , NULL , 0 , "Length of contents" , HFILL }
}
, {
& hf_ber_unknown_OCTETSTRING , {
"OCTETSTRING" , "ber.unknown.OCTETSTRING" , FT_BYTES , BASE_NONE , NULL , 0 , "This is an unknown OCTETSTRING" , HFILL }
}
, {
& hf_ber_unknown_BER_OCTETSTRING , {
"OCTETSTRING [BER encoded]" , "ber.unknown.OCTETSTRING" , FT_NONE , BASE_NONE , NULL , 0 , "This is an BER encoded OCTETSTRING" , HFILL }
}
, {
& hf_ber_unknown_BER_primitive , {
"Primitive [BER encoded]" , "ber.unknown.primitive" , FT_NONE , BASE_NONE , NULL , 0 , "This is a BER encoded Primitive" , HFILL }
}
, {
& hf_ber_unknown_OID , {
"OID" , "ber.unknown.OID" , FT_OID , BASE_NONE , NULL , 0 , "This is an unknown Object Identifier" , HFILL }
}
, {
& hf_ber_unknown_relative_OID , {
"OID" , "ber.unknown.relative_OID" , FT_REL_OID , BASE_NONE , NULL , 0 , "This is an unknown relative Object Identifier" , HFILL }
}
, {
& hf_ber_unknown_GraphicString , {
"GRAPHICSTRING" , "ber.unknown.GRAPHICSTRING" , FT_STRING , BASE_NONE , NULL , 0 , "This is an unknown GRAPHICSTRING" , HFILL }
}
, {
& hf_ber_unknown_NumericString , {
"NumericString" , "ber.unknown.NumericString" , FT_STRING , BASE_NONE , NULL , 0 , "This is an unknown NumericString" , HFILL }
}
, {
& hf_ber_unknown_PrintableString , {
"PrintableString" , "ber.unknown.PrintableString" , FT_STRING , BASE_NONE , NULL , 0 , "This is an unknown PrintableString" , HFILL }
}
, {
& hf_ber_unknown_TeletexString , {
"TeletexString" , "ber.unknown.TeletexString" , FT_STRING , BASE_NONE , NULL , 0 , "This is an unknown TeletexString" , HFILL }
}
, {
& hf_ber_unknown_VisibleString , {
"VisibleString" , "ber.unknown.VisibleString" , FT_STRING , BASE_NONE , NULL , 0 , "This is an unknown VisibleString" , HFILL }
}
, {
& hf_ber_unknown_GeneralString , {
"GeneralString" , "ber.unknown.GeneralString" , FT_STRING , BASE_NONE , NULL , 0 , "This is an unknown GeneralString" , HFILL }
}
, {
& hf_ber_unknown_UniversalString , {
"UniversalString" , "ber.unknown.UniversalString" , FT_STRING , BASE_NONE , NULL , 0 , "This is an unknown UniversalString" , HFILL }
}
, {
& hf_ber_unknown_BMPString , {
"BMPString" , "ber.unknown.BMPString" , FT_STRING , BASE_NONE , NULL , 0 , "This is an unknown BMPString" , HFILL }
}
, {
& hf_ber_unknown_IA5String , {
"IA5String" , "ber.unknown.IA5String" , FT_STRING , BASE_NONE , NULL , 0 , "This is an unknown IA5String" , HFILL }
}
, {
& hf_ber_unknown_UTCTime , {
"UTCTime" , "ber.unknown.UTCTime" , FT_STRING , BASE_NONE , NULL , 0 , "This is an unknown UTCTime" , HFILL }
}
, {
& hf_ber_unknown_UTF8String , {
"UTF8String" , "ber.unknown.UTF8String" , FT_STRING , BASE_NONE , NULL , 0 , "This is an unknown UTF8String" , HFILL }
}
, {
& hf_ber_unknown_GeneralizedTime , {
"GeneralizedTime" , "ber.unknown.GeneralizedTime" , FT_STRING , BASE_NONE , NULL , 0 , "This is an unknown GeneralizedTime" , HFILL }
}
, {
& hf_ber_unknown_INTEGER , {
"INTEGER" , "ber.unknown.INTEGER" , FT_INT64 , BASE_DEC , NULL , 0 , "This is an unknown INTEGER" , HFILL }
}
, {
& hf_ber_unknown_REAL , {
"REAL" , "ber.unknown.REAL" , FT_DOUBLE , BASE_NONE , NULL , 0 , "This is an unknown REAL" , HFILL }
}
, {
& hf_ber_unknown_BITSTRING , {
"BITSTRING" , "ber.unknown.BITSTRING" , FT_BYTES , BASE_NONE , NULL , 0 , "This is an unknown BITSTRING" , HFILL }
}
, {
& hf_ber_unknown_BOOLEAN , {
"BOOLEAN" , "ber.unknown.BOOLEAN" , FT_UINT8 , BASE_HEX , NULL , 0 , "This is an unknown BOOLEAN" , HFILL }
}
, {
& hf_ber_unknown_ENUMERATED , {
"ENUMERATED" , "ber.unknown.ENUMERATED" , FT_UINT32 , BASE_DEC , NULL , 0 , "This is an unknown ENUMERATED" , HFILL }
}
, {
& hf_ber_error , {
"BER Error" , "ber.error" , FT_STRING , BASE_NONE , NULL , 0 , NULL , HFILL }
}
, {
& hf_ber_direct_reference , {
"direct-reference" , "ber.direct_reference" , FT_OID , BASE_NONE , NULL , 0 , "ber.OBJECT_IDENTIFIER" , HFILL }
}
, {
& hf_ber_indirect_reference , {
"indirect-reference" , "ber.indirect_reference" , FT_INT32 , BASE_DEC , NULL , 0 , "ber.INTEGER" , HFILL }
}
, {
& hf_ber_data_value_descriptor , {
"data-value-descriptor" , "ber.data_value_descriptor" , FT_STRING , BASE_NONE , NULL , 0 , "ber.ObjectDescriptor" , HFILL }
}
, {
& hf_ber_encoding , {
"encoding" , "ber.encoding" , FT_UINT32 , BASE_DEC , VALS ( ber_T_encoding_vals ) , 0 , "ber.T_encoding" , HFILL }
}
, {
& hf_ber_octet_aligned , {
"octet-aligned" , "ber.octet_aligned" , FT_BYTES , BASE_NONE , NULL , 0 , "ber.T_octet_aligned" , HFILL }
}
, {
& hf_ber_arbitrary , {
"arbitrary" , "ber.arbitrary" , FT_BYTES , BASE_NONE , NULL , 0 , "ber.T_arbitrary" , HFILL }
}
, {
& hf_ber_single_ASN1_type , {
"single-ASN1-type" , "ber.single_ASN1_type" , FT_NONE , BASE_NONE , NULL , 0 , "ber.T_single_ASN1_type" , HFILL }
}
, {
& hf_ber_fragments , {
"OCTET STRING fragments" , "ber.octet_string.fragments" , FT_NONE , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_ber_fragment , {
"OCTET STRING fragment" , "ber.octet_string.fragment" , FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_ber_fragment_overlap , {
"OCTET STRING fragment overlap" , "ber.octet_string.fragment.overlap" , FT_BOOLEAN , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_ber_fragment_overlap_conflicts , {
"OCTET STRING fragment overlapping with conflicting data" , "ber.octet_string.fragment.overlap.conflicts" , FT_BOOLEAN , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_ber_fragment_multiple_tails , {
"OCTET STRING has multiple tail fragments" , "ber.octet_string.fragment.multiple_tails" , FT_BOOLEAN , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_ber_fragment_too_long_fragment , {
"OCTET STRING fragment too long" , "ber.octet_string.fragment.too_long_fragment" , FT_BOOLEAN , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_ber_fragment_error , {
"OCTET STRING defragmentation error" , "ber.octet_string.fragment.error" , FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_ber_fragment_count , {
"OCTET STRING fragment count" , "ber.octet_string.fragment.count" , FT_UINT32 , BASE_DEC , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_ber_reassembled_in , {
"Reassembled in" , "ber.octet_string.reassembled.in" , FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_ber_reassembled_length , {
"Reassembled OCTET STRING length" , "ber.octet_string.reassembled.length" , FT_UINT32 , BASE_DEC , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_ber_null_tag , {
"NULL tag" , "ber.null_tag" , FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_ber_unknown_data , {
"Unknown Data" , "ber.unknown_data" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_ber_unknown_octetstring , {
"Unknown OctetString" , "ber.unknown_octetstring" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_ber_seq_field_eoc , {
"SEQ FIELD EOC" , "ber.seq_field_eoc" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_ber_seq_eoc , {
"SEQ EOC" , "ber.seq_eoc" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_ber_set_field_eoc , {
"SET FIELD EOC" , "ber.set_field_eoc" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_ber_set_eoc , {
"SET EOC" , "ber.set_eoc" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_ber_choice_eoc , {
"CHOICE EOC" , "ber.choice_eoc" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_ber_seq_of_eoc , {
"SEQ OF EOC" , "ber.seq_of_eoc" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_ber_64bit_uint_as_bytes , {
"64bits unsigned integer" , "ber.64bit_uint_as_bytes" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, }
;
static gint * ett [ ] = {
& ett_ber_octet_string , & ett_ber_reassembled_octet_string , & ett_ber_primitive , & ett_ber_unknown , & ett_ber_SEQUENCE , & ett_ber_EXTERNAL , & ett_ber_T_encoding , & ett_ber_fragment , & ett_ber_fragments }
;
static ei_register_info ei [ ] = {
{
& ei_ber_size_constraint_string , {
"ber.size_constraint.string" , PI_PROTOCOL , PI_WARN , "Size constraint: string" , EXPFILL }
}
, {
& ei_ber_size_constraint_value , {
"ber.size_constraint.value" , PI_PROTOCOL , PI_WARN , "Size constraint: values" , EXPFILL }
}
, {
& ei_ber_size_constraint_items , {
"ber.size_constraint.items" , PI_PROTOCOL , PI_WARN , "Size constraint: items" , EXPFILL }
}
, {
& ei_ber_sequence_field_wrong , {
"ber.error.sequence.field_wrong" , PI_MALFORMED , PI_WARN , "BER Error: Wrong field in SEQUENCE" , EXPFILL }
}
, {
& ei_ber_expected_octet_string , {
"ber.error.expected.octet_string" , PI_MALFORMED , PI_WARN , "BER Error: OctetString expected" , EXPFILL }
}
, {
& ei_ber_expected_null , {
"ber.error.expected.null" , PI_MALFORMED , PI_WARN , "BER Error: NULL expected" , EXPFILL }
}
, {
& ei_ber_expected_null_zero_length , {
"ber.error.expected.null_zero_length" , PI_MALFORMED , PI_WARN , "BER Error: NULL expect zero length" , EXPFILL }
}
, {
& ei_ber_expected_sequence , {
"ber.error.expected.sequence" , PI_MALFORMED , PI_WARN , "BER Error: Sequence expected" , EXPFILL }
}
, {
& ei_ber_expected_set , {
"ber.error.expected.set" , PI_MALFORMED , PI_WARN , "BER Error: SET expected" , EXPFILL }
}
, {
& ei_ber_expected_string , {
"ber.error.expected.string" , PI_MALFORMED , PI_WARN , "BER Error: String expected" , EXPFILL }
}
, {
& ei_ber_expected_object_identifier , {
"ber.error.expected.object_identifier" , PI_MALFORMED , PI_WARN , "BER Error: Object Identifier expected" , EXPFILL }
}
, {
& ei_ber_expected_generalized_time , {
"ber.error.expected.generalized_time" , PI_MALFORMED , PI_WARN , "BER Error: GeneralizedTime expected" , EXPFILL }
}
, {
& ei_ber_expected_utc_time , {
"ber.error.expected.utc_time" , PI_MALFORMED , PI_WARN , "BER Error: UTCTime expected" , EXPFILL }
}
, {
& ei_ber_expected_bitstring , {
"ber.error.expected.bitstring" , PI_MALFORMED , PI_WARN , "BER Error: BitString expected" , EXPFILL }
}
, {
& ei_ber_error_length , {
"ber.error.length" , PI_MALFORMED , PI_WARN , "BER Error length" , EXPFILL }
}
, {
& ei_ber_wrong_tag_in_tagged_type , {
"ber.error.wrong_tag_in_tagged_type" , PI_MALFORMED , PI_WARN , "BER Error: Wrong tag in tagged type" , EXPFILL }
}
, {
& ei_ber_universal_tag_unknown , {
"ber.error.universal_tag_unknown" , PI_MALFORMED , PI_WARN , "BER Error: can not handle universal" , EXPFILL }
}
, {
& ei_ber_no_oid , {
"ber.error.no_oid" , PI_MALFORMED , PI_WARN , "BER Error: No OID supplied to call_ber_oid_callback" , EXPFILL }
}
, {
& ei_ber_oid_not_implemented , {
"ber.error.oid_not_implemented" , PI_UNDECODED , PI_WARN , "BER: Dissector for OID not implemented. Contact Wireshark developers if you want this supported" , EXPFILL }
}
, {
& ei_ber_syntax_not_implemented , {
"ber.error.syntax_not_implemented" , PI_UNDECODED , PI_WARN , "BER: Syntax not implemented" , EXPFILL }
}
, {
& ei_ber_value_too_many_bytes , {
"ber.error.value_too_many_bytes" , PI_MALFORMED , PI_WARN , "Value is encoded with too many bytes" , EXPFILL }
}
, {
& ei_ber_unknown_field_sequence , {
"ber.error.unknown_field.sequence" , PI_MALFORMED , PI_WARN , "BER Error: Unknown field in Sequence" , EXPFILL }
}
, {
& ei_ber_unknown_field_set , {
"ber.error.unknown_field.set" , PI_MALFORMED , PI_WARN , "BER Error: Unknown field in SET" , EXPFILL }
}
, {
& ei_ber_missing_field_set , {
"ber.error.missing_field.set" , PI_MALFORMED , PI_WARN , "BER Error: Missing field in SET" , EXPFILL }
}
, {
& ei_ber_empty_choice , {
"ber.error.empty_choice" , PI_MALFORMED , PI_WARN , "BER Error: Empty choice was found" , EXPFILL }
}
, {
& ei_ber_choice_not_found , {
"ber.error.choice_not_found" , PI_MALFORMED , PI_WARN , "BER Error: This choice field was not found" , EXPFILL }
}
, {
& ei_ber_bits_unknown , {
"ber.error.bits_unknown" , PI_UNDECODED , PI_WARN , "BER Error: Bits unknown" , EXPFILL }
}
, {
& ei_ber_bits_set_padded , {
"ber.error.bits_set_padded" , PI_UNDECODED , PI_WARN , "BER Error: Bits set in padded area" , EXPFILL }
}
, {
& ei_ber_illegal_padding , {
"ber.error.illegal_padding" , PI_UNDECODED , PI_WARN , "Illegal padding" , EXPFILL }
}
, {
& ei_ber_invalid_format_generalized_time , {
"ber.error.invalid_format.generalized_time" , PI_MALFORMED , PI_WARN , "BER Error: GeneralizedTime invalid format" , EXPFILL }
}
, {
& ei_ber_invalid_format_utctime , {
"ber.error.invalid_format.utctime" , PI_MALFORMED , PI_WARN , "BER Error: malformed UTCTime encoding" , EXPFILL }
}
, {
& ei_hf_field_not_integer_type , {
"ber.error.hf_field_not_integer_type" , PI_PROTOCOL , PI_ERROR , "Was passed a HF field that was not integer type" , EXPFILL }
}
, }
;
static build_valid_func ber_da_build_value [ 1 ] = {
ber_value }
;
static decode_as_value_t ber_da_values = {
ber_prompt , 1 , ber_da_build_value }
;
static decode_as_t ber_da = {
"ber" , "ASN.1" , "ber.syntax" , 1 , 0 , & ber_da_values , NULL , NULL , ber_populate_list , ber_decode_as_reset , ber_decode_as_change , NULL }
;
module_t * ber_module ;
expert_module_t * expert_ber ;
uat_t * users_uat = uat_new ( "OID Tables" , sizeof ( oid_user_t ) , "oid" , FALSE , & oid_users , & num_oid_users , UAT_AFFECTS_DISSECTION , "ChObjectIdentifiers" , oid_copy_cb , NULL , oid_free_cb , ber_update_oids , users_flds ) ;
proto_ber = proto_register_protocol ( "Basic Encoding Rules (ASN.1 X.690)" , "BER" , "ber" ) ;
ber_handle = new_register_dissector ( "ber" , dissect_ber , proto_ber ) ;
proto_register_field_array ( proto_ber , hf , array_length ( hf ) ) ;
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
expert_ber = expert_register_protocol ( proto_ber ) ;
expert_register_field_array ( expert_ber , ei , array_length ( ei ) ) ;
proto_set_cant_toggle ( proto_ber ) ;
ber_module = prefs_register_protocol ( proto_ber , NULL ) ;
prefs_register_bool_preference ( ber_module , "show_internals" , "Show internal BER encapsulation tokens" , "Whether the dissector should also display internal" " ASN.1 BER details such as Identifier and Length fields" , & show_internal_ber_fields ) ;
prefs_register_bool_preference ( ber_module , "decode_unexpected" , "Decode unexpected tags as BER encoded data" , "Whether the dissector should decode unexpected tags as" " ASN.1 BER encoded data" , & decode_unexpected ) ;
prefs_register_bool_preference ( ber_module , "decode_octetstring" , "Decode OCTET STRING as BER encoded data" , "Whether the dissector should try decoding OCTET STRINGs as" " constructed ASN.1 BER encoded data" , & decode_octetstring_as_ber ) ;
prefs_register_bool_preference ( ber_module , "decode_primitive" , "Decode Primitive as BER encoded data" , "Whether the dissector should try decoding unknown primitive as" " constructed ASN.1 BER encoded data" , & decode_primitive_as_ber ) ;
prefs_register_bool_preference ( ber_module , "warn_too_many_bytes" , "Warn if too many leading zero bits in encoded data" , "Whether the dissector should warn if excessive leading zero (0) bits" , & decode_warning_leading_zero_bits ) ;
prefs_register_uat_preference ( ber_module , "oid_table" , "Object Identifiers" , "A table that provides names for object identifiers" " and the syntax of any associated values" , users_uat ) ;
ber_oid_dissector_table = register_dissector_table ( "ber.oid" , "BER OID Dissectors" , FT_STRING , BASE_NONE , DISSECTOR_TABLE_ALLOW_DUPLICATE ) ;
ber_syntax_dissector_table = register_dissector_table ( "ber.syntax" , "BER syntax" , FT_STRING , BASE_NONE , DISSECTOR_TABLE_ALLOW_DUPLICATE ) ;
syntax_table = g_hash_table_new ( g_str_hash , g_str_equal ) ;
register_ber_syntax_dissector ( "ASN.1" , proto_ber , dissect_ber_syntax ) ;
register_init_routine ( ber_defragment_init ) ;
register_cleanup_routine ( ber_defragment_cleanup ) ;
register_decode_as ( & ber_da ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void gx_ttfReader__destroy ( gx_ttfReader * self ) {
gs_free_object ( self -> memory , self , "gx_ttfReader__destroy" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SplinePointList * SplinePointListInterpretPS ( FILE * ps , int flags , int is_stroked , int * width ) {
EntityChar ec ;
SplineChar sc ;
memset ( & ec , '\0' , sizeof ( ec ) ) ;
ec . width = ec . vwidth = UNDEFINED_WIDTH ;
memset ( & sc , 0 , sizeof ( sc ) ) ;
sc . name = "<No particular character>" ;
ec . sc = & sc ;
InterpretPS ( ps , NULL , & ec , NULL ) ;
if ( width != NULL ) * width = ec . width ;
return ( SplinesFromEntityChar ( & ec , & flags , is_stroked ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_rsvp_call_id ( proto_tree * ti , packet_info * pinfo , proto_tree * rsvp_object_tree , tvbuff_t * tvb , int offset , int obj_length , int rsvp_class _U_ , int c_type ) {
int type = 0 ;
const char * str ;
int offset2 = offset + 4 ;
int offset3 , offset4 , len ;
proto_tree * ti2 = NULL ;
proto_item_set_text ( ti , "CALL-ID: " ) ;
switch ( c_type ) {
case 0 : proto_item_append_text ( ti , "Empty" ) ;
proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , c_type , "Empty (%u)" , c_type ) ;
if ( obj_length > 4 ) proto_tree_add_item ( rsvp_object_tree , hf_rsvp_call_id_data , tvb , offset2 , obj_length - 4 , ENC_NA ) ;
break ;
case 1 : case 2 : type = tvb_get_guint8 ( tvb , offset2 ) ;
if ( c_type == 1 ) {
offset3 = offset2 + 4 ;
len = obj_length - 16 ;
proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , c_type , "1 (operator specific)" ) ;
ti2 = proto_tree_add_item ( rsvp_object_tree , hf_rsvp_call_id_address_type , tvb , offset2 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_call_id_reserved , tvb , offset2 + 1 , 3 , ENC_BIG_ENDIAN ) ;
proto_item_append_text ( ti , "Operator-Specific. Addr Type: %s. " , val_to_str ( type , address_type_vals , "Unknown (%u)" ) ) ;
}
else {
offset3 = offset2 + 16 ;
len = obj_length - 28 ;
proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , c_type , "2 (globally unique)" ) ;
ti2 = proto_tree_add_item ( rsvp_object_tree , hf_rsvp_call_id_address_type , tvb , offset2 , 1 , ENC_BIG_ENDIAN ) ;
str = tvb_get_string_enc ( wmem_packet_scope ( ) , tvb , offset2 + 1 , 3 , ENC_ASCII ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_call_id_international_segment , tvb , offset2 + 1 , 3 , ENC_NA | ENC_ASCII ) ;
proto_item_append_text ( ti , "Globally-Unique. Addr Type: %s. Intl Segment: %s. " , val_to_str ( type , address_type_vals , "Unknown (%u)" ) , str ) ;
str = tvb_get_string_enc ( wmem_packet_scope ( ) , tvb , offset2 + 4 , 12 , ENC_ASCII ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_call_id_national_segment , tvb , offset2 + 4 , 12 , ENC_NA | ENC_ASCII ) ;
proto_item_append_text ( ti , "Natl Segment: %s. " , str ) ;
}
switch ( type ) {
case 1 : offset4 = offset3 + 4 ;
str = tvb_ip_to_str ( tvb , offset3 ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_filter [ RSVPF_CALL_ID_SRC_ADDR_IPV4 ] , tvb , offset3 , 4 , ENC_BIG_ENDIAN ) ;
break ;
case 2 : offset4 = offset3 + 16 ;
str = tvb_ip6_to_str ( tvb , offset3 ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_filter [ RSVPF_CALL_ID_SRC_ADDR_IPV6 ] , tvb , offset3 , 16 , ENC_NA ) ;
break ;
case 3 : offset4 = offset3 + 20 ;
str = print_nsap_net ( tvb , offset3 , 20 ) ;
proto_tree_add_string ( rsvp_object_tree , hf_rsvp_source_transport_network_addr , tvb , offset3 , 20 , str ) ;
break ;
case 4 : offset4 = offset3 + 6 ;
str = tvb_ether_to_str ( tvb , offset3 ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_callid_srcaddr_ether , tvb , offset3 , 6 , ENC_NA ) ;
break ;
case 0x7F : offset4 = offset3 + len ;
str = tvb_bytes_to_str ( wmem_packet_scope ( ) , tvb , offset3 , len ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_callid_srcaddr_bytes , tvb , offset3 , len , ENC_NA ) ;
break ;
default : offset4 = offset3 + len ;
str = "???" ;
expert_add_info ( pinfo , ti2 , & ei_rsvp_call_id_address_type ) ;
break ;
}
proto_item_append_text ( ti , "Src: %s. " , str ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_call_id_local_identifier , tvb , offset4 , 8 , ENC_NA ) ;
proto_item_append_text ( ti , "Local ID: %s. " , tvb_bytes_to_str ( wmem_packet_scope ( ) , tvb , offset4 , 8 ) ) ;
break ;
default : proto_item_append_text ( ti , " Unknown" ) ;
proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , c_type , "Unknown (%u)" , c_type ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_call_id_data , tvb , offset2 , obj_length - 4 , ENC_NA ) ;
break ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
char * Curl_checkheaders ( const struct connectdata * conn , const char * thisheader ) {
struct curl_slist * head ;
size_t thislen = strlen ( thisheader ) ;
struct Curl_easy * data = conn -> data ;
for ( head = data -> set . headers ;
head ;
head = head -> next ) {
if ( Curl_raw_nequal ( head -> data , thisheader , thislen ) ) return head -> data ;
}
return NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int inverse_quant_coeff ( IMCContext * q , IMCChannel * chctx , int stream_format_code ) {
int i , j ;
int middle_value , cw_len , max_size ;
const float * quantizer ;
for ( i = 0 ;
i < BANDS ;
i ++ ) {
for ( j = band_tab [ i ] ;
j < band_tab [ i + 1 ] ;
j ++ ) {
chctx -> CWdecoded [ j ] = 0 ;
cw_len = chctx -> CWlengthT [ j ] ;
if ( cw_len <= 0 || chctx -> skipFlags [ j ] ) continue ;
max_size = 1 << cw_len ;
middle_value = max_size >> 1 ;
if ( chctx -> codewords [ j ] >= max_size || chctx -> codewords [ j ] < 0 ) return AVERROR_INVALIDDATA ;
if ( cw_len >= 4 ) {
quantizer = imc_quantizer2 [ ( stream_format_code & 2 ) >> 1 ] ;
if ( chctx -> codewords [ j ] >= middle_value ) chctx -> CWdecoded [ j ] = quantizer [ chctx -> codewords [ j ] - 8 ] * chctx -> flcoeffs6 [ i ] ;
else chctx -> CWdecoded [ j ] = - quantizer [ max_size - chctx -> codewords [ j ] - 8 - 1 ] * chctx -> flcoeffs6 [ i ] ;
}
else {
quantizer = imc_quantizer1 [ ( ( stream_format_code & 2 ) >> 1 ) | ( chctx -> bandFlagsBuf [ i ] << 1 ) ] ;
if ( chctx -> codewords [ j ] >= middle_value ) chctx -> CWdecoded [ j ] = quantizer [ chctx -> codewords [ j ] - 1 ] * chctx -> flcoeffs6 [ i ] ;
else chctx -> CWdecoded [ j ] = - quantizer [ max_size - 2 - chctx -> codewords [ j ] ] * chctx -> flcoeffs6 [ i ] ;
}
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int vp9_rc_clamp_pframe_target_size ( const VP9_COMP * const cpi , int target ) {
const RATE_CONTROL * rc = & cpi -> rc ;
const int min_frame_target = MAX ( rc -> min_frame_bandwidth , rc -> avg_frame_bandwidth >> 5 ) ;
if ( target < min_frame_target ) target = min_frame_target ;
if ( cpi -> refresh_golden_frame && rc -> is_src_frame_alt_ref ) {
target = min_frame_target ;
}
if ( target > rc -> max_frame_bandwidth ) target = rc -> max_frame_bandwidth ;
return target ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void * xcalloc ( size_t num , size_t size ) {
size_t res ;
if ( check_mul_overflow ( num , size , & res ) ) abort ( ) ;
void * ptr ;
ptr = malloc ( res ) ;
if ( ptr ) {
memset ( ptr , '\0' , ( res ) ) ;
}
return ptr ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void gic_update ( GICState * s ) {
int best_irq ;
int best_prio ;
int irq ;
int level ;
int cpu ;
int cm ;
for ( cpu = 0 ;
cpu < NUM_CPU ( s ) ;
cpu ++ ) {
cm = 1 << cpu ;
s -> current_pending [ cpu ] = 1023 ;
if ( ! s -> enabled || ! s -> cpu_enabled [ cpu ] ) {
qemu_irq_lower ( s -> parent_irq [ cpu ] ) ;
return ;
}
best_prio = 0x100 ;
best_irq = 1023 ;
for ( irq = 0 ;
irq < s -> num_irq ;
irq ++ ) {
if ( GIC_TEST_ENABLED ( irq , cm ) && GIC_TEST_PENDING ( irq , cm ) ) {
if ( GIC_GET_PRIORITY ( irq , cpu ) < best_prio ) {
best_prio = GIC_GET_PRIORITY ( irq , cpu ) ;
best_irq = irq ;
}
}
}
level = 0 ;
if ( best_prio < s -> priority_mask [ cpu ] ) {
s -> current_pending [ cpu ] = best_irq ;
if ( best_prio < s -> running_priority [ cpu ] ) {
DPRINTF ( "Raised pending IRQ %d (cpu %d)\n" , best_irq , cpu ) ;
level = 1 ;
}
}
qemu_set_irq ( s -> parent_irq [ cpu ] , level ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void revert_cdlms ( WmallDecodeCtx * s , int ch , int coef_begin , int coef_end ) {
int icoef , pred , ilms , num_lms , residue , input ;
num_lms = s -> cdlms_ttl [ ch ] ;
for ( ilms = num_lms - 1 ;
ilms >= 0 ;
ilms -- ) {
for ( icoef = coef_begin ;
icoef < coef_end ;
icoef ++ ) {
pred = 1 << ( s -> cdlms [ ch ] [ ilms ] . scaling - 1 ) ;
residue = s -> channel_residues [ ch ] [ icoef ] ;
pred += lms_predict ( s , ch , ilms ) ;
input = residue + ( pred >> s -> cdlms [ ch ] [ ilms ] . scaling ) ;
lms_update ( s , ch , ilms , input , residue ) ;
s -> channel_residues [ ch ] [ icoef ] = input ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_SPOOL_PRINTER_INFO ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) {
proto_tree * subtree ;
guint32 level ;
proto_tree * item ;
subtree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_SPOOL_PRINTER_INFO_LEVEL , & item , "Spool printer info level" ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , subtree , di , drep , hf_level , & level ) ;
switch ( level ) {
case 3 : {
guint32 devmode_ptr , secdesc_ptr ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , subtree , di , drep , hf_spool_printer_info_devmode_ptr , & devmode_ptr ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , subtree , di , drep , hf_spool_printer_info_secdesc_ptr , & secdesc_ptr ) ;
if ( devmode_ptr ) offset = dissect_DEVMODE_CTR ( tvb , offset , pinfo , subtree , di , drep ) ;
if ( secdesc_ptr ) offset = dissect_SEC_DESC_BUF ( tvb , offset , pinfo , subtree , di , drep ) ;
break ;
}
case 2 : default : expert_add_info_format ( pinfo , item , & ei_spool_printer_info_level , "Unknown spool printer info level %d" , level ) ;
break ;
}
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pdf_run_cm ( fz_context * ctx , pdf_processor * proc , float a , float b , float c , float d , float e , float f ) {
pdf_run_processor * pr = ( pdf_run_processor * ) proc ;
pdf_gstate * gstate = pdf_flush_text ( ctx , pr ) ;
fz_matrix m ;
m . a = a ;
m . b = b ;
m . c = c ;
m . d = d ;
m . e = e ;
m . f = f ;
fz_concat ( & gstate -> ctm , & m , & gstate -> ctm ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_RequestModeReject ( 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_RequestModeReject , RequestModeReject_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void TSFetchUserDataSet ( TSFetchSM fetch_sm , void * data ) {
sdk_assert ( sdk_sanity_check_fetch_sm ( fetch_sm ) == TS_SUCCESS ) ;
( ( FetchSM * ) fetch_sm ) -> ext_set_user_data ( data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_Progress_UUIE ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 412 "./asn1/h225/h225.cnf" h225_packet_info * h225_pi ;
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_Progress_UUIE , Progress_UUIE_sequence ) ;
# line 416 "./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_PROGRESS ;
if ( contains_faststart == TRUE ) g_snprintf ( h225_pi -> frame_label , 50 , "%s OLC (%s)" , val_to_str ( h225_pi -> cs_type , T_h323_message_body_vals , "<unknown>" ) , h225_pi -> frame_label ) ;
else g_snprintf ( h225_pi -> frame_label , 50 , "%s" , val_to_str ( h225_pi -> cs_type , T_h323_message_body_vals , "<unknown>" ) ) ;
}
return offset ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_exp_vlc ( WMACodecContext * s , int ch ) {
int last_exp , n , code ;
const uint16_t * ptr ;
float v , max_scale ;
uint32_t * q , * q_end , iv ;
const float * ptab = pow_tab + 60 ;
const uint32_t * iptab = ( const uint32_t * ) ptab ;
ptr = s -> exponent_bands [ s -> frame_len_bits - s -> block_len_bits ] ;
q = ( uint32_t * ) s -> exponents [ ch ] ;
q_end = q + s -> block_len ;
max_scale = 0 ;
if ( s -> version == 1 ) {
last_exp = get_bits ( & s -> gb , 5 ) + 10 ;
v = ptab [ last_exp ] ;
iv = iptab [ last_exp ] ;
max_scale = v ;
n = * ptr ++ ;
switch ( n & 3 ) do {
case 0 : * q ++ = iv ;
case 3 : * q ++ = iv ;
case 2 : * q ++ = iv ;
case 1 : * q ++ = iv ;
}
while ( ( n -= 4 ) > 0 ) ;
}
else last_exp = 36 ;
while ( q < q_end ) {
code = get_vlc2 ( & s -> gb , s -> exp_vlc . table , EXPVLCBITS , EXPMAX ) ;
if ( code < 0 ) {
av_log ( s -> avctx , AV_LOG_ERROR , "Exponent vlc invalid\n" ) ;
return - 1 ;
}
last_exp += code - 60 ;
if ( ( unsigned ) last_exp + 60 >= FF_ARRAY_ELEMS ( pow_tab ) ) {
av_log ( s -> avctx , AV_LOG_ERROR , "Exponent out of range: %d\n" , last_exp ) ;
return - 1 ;
}
v = ptab [ last_exp ] ;
iv = iptab [ last_exp ] ;
if ( v > max_scale ) max_scale = v ;
n = * ptr ++ ;
switch ( n & 3 ) do {
case 0 : * q ++ = iv ;
case 3 : * q ++ = iv ;
case 2 : * q ++ = iv ;
case 1 : * q ++ = iv ;
}
while ( ( n -= 4 ) > 0 ) ;
}
s -> max_exponent [ ch ] = max_scale ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int kvm_device_intx_set_mask ( KVMState * s , uint32_t dev_id , bool masked ) {
struct kvm_assigned_pci_dev dev_data = {
. assigned_dev_id = dev_id , . flags = masked ? KVM_DEV_ASSIGN_MASK_INTX : 0 , }
;
return kvm_vm_ioctl ( s , KVM_ASSIGN_SET_INTX_MASK , & dev_data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int wpa_check_MIC ( struct eapol_header * eapol , struct eapol_key_header * eapol_key , size_t eapol_len , u_char * kck , int algo ) {
u_char mic [ WPA_MICKEY_LEN ] ;
u_int len ;
u_char hmac_mic [ 20 ] ;
memcpy ( mic , eapol_key -> key_MIC , WPA_MICKEY_LEN ) ;
memset ( eapol_key -> key_MIC , 0 , WPA_MICKEY_LEN ) ;
if ( algo == WPA_KEY_TKIP ) {
HMAC ( EVP_md5 ( ) , kck , WPA_KCK_LEN , ( u_char * ) eapol , eapol_len , hmac_mic , & len ) ;
}
else if ( algo == WPA_KEY_CCMP ) {
HMAC ( EVP_sha1 ( ) , kck , WPA_KCK_LEN , ( u_char * ) eapol , eapol_len , hmac_mic , & len ) ;
}
else return - E_INVALID ;
memcpy ( eapol_key -> key_MIC , mic , WPA_MICKEY_LEN ) ;
return memcmp ( mic , hmac_mic , WPA_MICKEY_LEN ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int netstat_seq_open ( struct inode * inode , struct file * file ) {
return single_open_net ( inode , file , netstat_seq_show ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void next_char ( hb_buffer_t * buffer , hb_codepoint_t glyph ) {
buffer -> cur ( ) . glyph_index ( ) = glyph ;
buffer -> next_glyph ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void cpu_resume ( CPUState * cpu ) {
cpu -> stop = false ;
cpu -> stopped = false ;
qemu_cpu_kick ( cpu ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int parse_vType ( tvbuff_t * tvb , int offset , guint16 * vtype ) {
guint16 tmp_vtype = tvb_get_letohs ( tvb , offset ) ;
guint16 modifier = tmp_vtype & 0xFF00 ;
switch ( tmp_vtype & 0xFF ) {
case VT_EMPTY : * vtype = VT_EMPTY ;
break ;
case VT_NULL : * vtype = VT_NULL ;
break ;
case VT_I2 : * vtype = VT_I2 ;
break ;
case VT_I4 : * vtype = VT_I4 ;
break ;
case VT_R4 : * vtype = VT_R4 ;
break ;
case VT_R8 : * vtype = VT_R8 ;
break ;
case VT_CY : * vtype = VT_CY ;
break ;
case VT_DATE : * vtype = VT_DATE ;
break ;
case VT_BSTR : * vtype = VT_BSTR ;
break ;
case VT_ERROR : * vtype = VT_ERROR ;
break ;
case VT_BOOL : * vtype = VT_BOOL ;
break ;
case VT_VARIANT : * vtype = VT_VARIANT ;
break ;
case VT_DECIMAL : * vtype = VT_DECIMAL ;
break ;
case VT_I1 : * vtype = VT_I1 ;
break ;
case VT_UI1 : * vtype = VT_UI1 ;
break ;
case VT_UI2 : * vtype = VT_UI2 ;
break ;
case VT_UI4 : * vtype = VT_UI4 ;
break ;
case VT_I8 : * vtype = VT_I8 ;
break ;
case VT_UI8 : * vtype = VT_UI8 ;
break ;
case VT_INT : * vtype = VT_INT ;
break ;
case VT_UINT : * vtype = VT_UINT ;
break ;
case VT_LPSTR : * vtype = VT_LPSTR ;
break ;
case VT_LPWSTR : * vtype = VT_LPWSTR ;
break ;
case VT_COMPRESSED_LPWSTR : * vtype = VT_COMPRESSED_LPWSTR ;
break ;
case VT_FILETIME : * vtype = VT_FILETIME ;
break ;
case VT_BLOB : * vtype = VT_BLOB ;
break ;
case VT_BLOB_OBJECT : * vtype = VT_BLOB_OBJECT ;
break ;
case VT_CLSID : * vtype = VT_CLSID ;
break ;
default : DISSECTOR_ASSERT ( FALSE ) ;
break ;
}
if ( modifier ) {
switch ( modifier ) {
case VT_VECTOR : * vtype |= VT_VECTOR ;
break ;
case VT_ARRAY : * vtype |= VT_ARRAY ;
break ;
default : DISSECTOR_ASSERT ( FALSE ) ;
break ;
}
}
return offset + 2 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void Type_MLU_Free ( struct _cms_typehandler_struct * self , void * Ptr ) {
cmsMLUfree ( ( cmsMLU * ) Ptr ) ;
return ;
cmsUNUSED_PARAMETER ( self ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline uint16_t le16_to_cpu ( uint16_t v ) {
return v ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_bug8722 ( ) {
MYSQL_STMT * stmt ;
int rc ;
const char * stmt_text ;
myheader ( "test_bug8722" ) ;
stmt_text = "drop table if exists t1, v1" ;
rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ;
myquery ( rc ) ;
stmt_text = "CREATE TABLE t1 (c1 varchar(10), c2 varchar(10), c3 varchar(10)," " c4 varchar(10), c5 varchar(10), c6 varchar(10)," " c7 varchar(10), c8 varchar(10), c9 varchar(10)," "c10 varchar(10))" ;
rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ;
myquery ( rc ) ;
stmt_text = "INSERT INTO t1 VALUES (1,2,3,4,5,6,7,8,9,10)" ;
rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ;
myquery ( rc ) ;
stmt_text = "CREATE VIEW v1 AS SELECT * FROM t1" ;
rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ;
myquery ( rc ) ;
stmt = mysql_stmt_init ( mysql ) ;
stmt_text = "select * from v1" ;
rc = mysql_stmt_prepare ( stmt , stmt_text , strlen ( stmt_text ) ) ;
check_execute ( stmt , rc ) ;
mysql_stmt_close ( stmt ) ;
stmt_text = "drop table if exists t1, v1" ;
rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ;
myquery ( rc ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int x ( struct vcache * avc , int afun , struct vrequest * areq , \ struct afs_pdata * ain , struct afs_pdata * aout , \ afs_ucred_t * * acred ) DECL_PIOCTL ( PGetFID ) ;
DECL_PIOCTL ( PSetAcl ) ;
DECL_PIOCTL ( PStoreBehind ) ;
DECL_PIOCTL ( PGCPAGs ) ;
DECL_PIOCTL ( PGetAcl ) ;
DECL_PIOCTL ( PNoop ) ;
DECL_PIOCTL ( PBogus ) ;
DECL_PIOCTL ( PGetFileCell ) ;
DECL_PIOCTL ( PGetWSCell ) ;
DECL_PIOCTL ( PGetUserCell ) ;
DECL_PIOCTL ( PSetTokens ) ;
DECL_PIOCTL ( PGetVolumeStatus ) ;
DECL_PIOCTL ( PSetVolumeStatus ) ;
DECL_PIOCTL ( PFlush ) ;
DECL_PIOCTL ( PNewStatMount ) ;
DECL_PIOCTL ( PGetTokens ) ;
DECL_PIOCTL ( PUnlog ) ;
DECL_PIOCTL ( PMariner ) ;
DECL_PIOCTL ( PCheckServers ) ;
DECL_PIOCTL ( PCheckVolNames ) ;
DECL_PIOCTL ( PCheckAuth ) ;
DECL_PIOCTL ( PFindVolume ) ;
DECL_PIOCTL ( PViceAccess ) ;
DECL_PIOCTL ( PSetCacheSize ) ;
DECL_PIOCTL ( PGetCacheSize ) ;
DECL_PIOCTL ( PRemoveCallBack ) ;
DECL_PIOCTL ( PNewCell ) ;
DECL_PIOCTL ( PNewAlias ) ;
DECL_PIOCTL ( PListCells ) ;
DECL_PIOCTL ( PListAliases ) ;
DECL_PIOCTL ( PRemoveMount ) ;
DECL_PIOCTL ( PGetCellStatus ) ;
DECL_PIOCTL ( PSetCellStatus ) ;
DECL_PIOCTL ( PFlushVolumeData ) ;
DECL_PIOCTL ( PFlushAllVolumeData ) ;
DECL_PIOCTL ( PGetVnodeXStatus ) ;
DECL_PIOCTL ( PGetVnodeXStatus2 ) ;
DECL_PIOCTL ( PSetSysName ) ;
DECL_PIOCTL ( PSetSPrefs ) ;
DECL_PIOCTL ( PSetSPrefs33 ) ;
DECL_PIOCTL ( PGetSPrefs ) ;
DECL_PIOCTL ( PExportAfs ) ;
DECL_PIOCTL ( PGag ) ;
DECL_PIOCTL ( PTwiddleRx ) ;
DECL_PIOCTL ( PGetInitParams ) ;
DECL_PIOCTL ( PGetRxkcrypt ) ;
DECL_PIOCTL ( PSetRxkcrypt ) ;
DECL_PIOCTL ( PGetCPrefs ) ;
DECL_PIOCTL ( PSetCPrefs ) ;
DECL_PIOCTL ( PFlushMount ) ;
DECL_PIOCTL ( PRxStatProc ) ;
DECL_PIOCTL ( PRxStatPeer ) ;
DECL_PIOCTL ( PPrefetchFromTape ) ;
DECL_PIOCTL ( PFsCmd ) ;
DECL_PIOCTL ( PCallBackAddr ) ;
DECL_PIOCTL ( PDiscon ) ;
DECL_PIOCTL ( PNFSNukeCreds ) ;
DECL_PIOCTL ( PNewUuid ) ;
DECL_PIOCTL ( PPrecache )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void lsp_interpolate ( int16_t * lpc , int16_t * cur_lsp , int16_t * prev_lsp ) {
int i ;
int16_t * lpc_ptr = lpc ;
ff_acelp_weighted_vector_sum ( lpc , cur_lsp , prev_lsp , 4096 , 12288 , 1 << 13 , 14 , LPC_ORDER ) ;
ff_acelp_weighted_vector_sum ( lpc + LPC_ORDER , cur_lsp , prev_lsp , 8192 , 8192 , 1 << 13 , 14 , LPC_ORDER ) ;
ff_acelp_weighted_vector_sum ( lpc + 2 * LPC_ORDER , cur_lsp , prev_lsp , 12288 , 4096 , 1 << 13 , 14 , LPC_ORDER ) ;
memcpy ( lpc + 3 * LPC_ORDER , cur_lsp , LPC_ORDER * sizeof ( * lpc ) ) ;
for ( i = 0 ;
i < SUBFRAMES ;
i ++ ) {
lsp2lpc ( lpc_ptr ) ;
lpc_ptr += LPC_ORDER ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
CURLcode Curl_add_buffer ( Curl_send_buffer * in , const void * inptr , size_t size ) {
char * new_rb ;
size_t new_size ;
if ( ~ size < in -> size_used ) {
Curl_safefree ( in -> buffer ) ;
free ( in ) ;
return CURLE_OUT_OF_MEMORY ;
}
if ( ! in -> buffer || ( ( in -> size_used + size ) > ( in -> size_max - 1 ) ) ) {
if ( ( size > ( size_t ) - 1 / 2 ) || ( in -> size_used > ( size_t ) - 1 / 2 ) || ( ~ ( size * 2 ) < ( in -> size_used * 2 ) ) ) new_size = ( size_t ) - 1 ;
else new_size = ( in -> size_used + size ) * 2 ;
if ( in -> buffer ) new_rb = realloc ( in -> buffer , new_size ) ;
else new_rb = malloc ( new_size ) ;
if ( ! new_rb ) {
Curl_safefree ( in -> buffer ) ;
free ( in ) ;
return CURLE_OUT_OF_MEMORY ;
}
in -> buffer = new_rb ;
in -> size_max = new_size ;
}
memcpy ( & in -> buffer [ in -> size_used ] , inptr , size ) ;
in -> size_used += size ;
return CURLE_OK ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static PyObject * authGSSClientResponseConf ( PyObject * self , PyObject * args ) {
gss_client_state * state ;
PyObject * pystate ;
if ( ! PyArg_ParseTuple ( args , "O" , & pystate ) ) return NULL ;
# if PY_MAJOR_VERSION >= 3 if ( ! PyCapsule_CheckExact ( pystate ) ) {
# else if ( ! PyCObject_Check ( pystate ) ) {
# endif PyErr_SetString ( PyExc_TypeError , "Expected a context object" ) ;
return NULL ;
}
# if PY_MAJOR_VERSION >= 3 state = PyCapsule_GetPointer ( pystate , NULL ) ;
# else state = ( gss_client_state * ) PyCObject_AsVoidPtr ( pystate ) ;
# endif if ( state == NULL ) return NULL ;
return Py_BuildValue ( "i" , state -> responseConf ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint16 expected_ulpdu_length ( mpa_state_t * state , struct tcpinfo * tcpinfo , guint8 endpoint ) {
guint32 length , pad_length , markers_length ;
length = fpdu_total_length ( tcpinfo ) ;
if ( length <= MPA_CRC_LEN ) return 0 ;
length -= MPA_CRC_LEN ;
pad_length = ( MPA_ALIGNMENT - ( length % MPA_ALIGNMENT ) ) % MPA_ALIGNMENT ;
if ( length <= pad_length ) return 0 ;
length -= pad_length ;
if ( state -> minfo [ endpoint ] . valid ) {
markers_length = number_of_markers ( state , tcpinfo , endpoint ) * MPA_MARKER_LEN ;
if ( length <= markers_length ) return 0 ;
length -= markers_length ;
}
if ( length <= MPA_ULPDU_LENGTH_LEN ) return 0 ;
length -= MPA_ULPDU_LENGTH_LEN ;
return ( guint16 ) length ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_Connect_UUIE ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 538 "./asn1/h225/h225.cnf" h225_packet_info * h225_pi ;
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_Connect_UUIE , Connect_UUIE_sequence ) ;
# line 542 "./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_CONNECT ;
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 socket_connect ( int fd , const char * address , unsigned short port ) {
struct addrinfo * ai = make_addrinfo ( address , port ) ;
int res = - 1 ;
if ( ai == NULL ) {
event_debug ( ( "%s: make_addrinfo: \"%s:%d\"" , __func__ , address , port ) ) ;
return ( - 1 ) ;
}
if ( connect ( fd , ai -> ai_addr , ai -> ai_addrlen ) == - 1 ) {
# ifdef WIN32 int tmp_error = WSAGetLastError ( ) ;
if ( tmp_error != WSAEWOULDBLOCK && tmp_error != WSAEINVAL && tmp_error != WSAEINPROGRESS ) {
goto out ;
}
# else if ( errno != EINPROGRESS ) {
goto out ;
}
# endif }
res = 0 ;
out : # ifdef HAVE_GETADDRINFO freeaddrinfo ( ai ) ;
# else fake_freeaddrinfo ( ai ) ;
# endif return ( res ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dissect_h225_RasMessage ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 294 "./asn1/h225/h225.cnf" gint32 rasmessage_value ;
h225_packet_info * h225_pi ;
call_id_guid = NULL ;
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h225_RasMessage , RasMessage_choice , & rasmessage_value ) ;
col_add_fstr ( actx -> pinfo -> cinfo , COL_INFO , "RAS: %s " , val_to_str ( rasmessage_value , h225_RasMessage_vals , "<unknown>" ) ) ;
h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
if ( h225_pi != NULL ) {
h225_pi -> msg_tag = rasmessage_value ;
if ( call_id_guid ) {
h225_pi -> guid = * call_id_guid ;
}
}
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline picture_t * ffmpeg_NewPictBuf ( decoder_t * p_dec , AVCodecContext * p_context ) {
decoder_sys_t * p_sys = p_dec -> p_sys ;
int width = p_context -> coded_width ;
int height = p_context -> coded_height ;
if ( p_sys -> p_va == NULL ) {
int aligns [ AV_NUM_DATA_POINTERS ] ;
avcodec_align_dimensions2 ( p_context , & width , & height , aligns ) ;
}
if ( width == 0 || height == 0 || width > 8192 || height > 8192 || width < p_context -> width || height < p_context -> height ) {
msg_Err ( p_dec , "Invalid frame size %dx%d. vsz %dx%d" , width , height , p_context -> width , p_context -> height ) ;
return NULL ;
}
p_dec -> fmt_out . video . i_width = width ;
p_dec -> fmt_out . video . i_height = height ;
if ( width != p_context -> width || height != p_context -> height ) {
p_dec -> fmt_out . video . i_visible_width = p_context -> width ;
p_dec -> fmt_out . video . i_visible_height = p_context -> height ;
}
else {
p_dec -> fmt_out . video . i_visible_width = width ;
p_dec -> fmt_out . video . i_visible_height = height ;
}
if ( ! p_sys -> p_va && GetVlcChroma ( & p_dec -> fmt_out . video , p_context -> pix_fmt ) ) {
p_dec -> fmt_out . video . i_chroma = VLC_CODEC_I420 ;
}
p_dec -> fmt_out . i_codec = p_dec -> fmt_out . video . i_chroma ;
if ( p_dec -> fmt_in . video . i_sar_num > 0 && p_dec -> fmt_in . video . i_sar_den > 0 ) {
p_dec -> fmt_out . video . i_sar_num = p_dec -> fmt_in . video . i_sar_num ;
p_dec -> fmt_out . video . i_sar_den = p_dec -> fmt_in . video . i_sar_den ;
}
else {
p_dec -> fmt_out . video . i_sar_num = p_context -> sample_aspect_ratio . num ;
p_dec -> fmt_out . video . i_sar_den = p_context -> sample_aspect_ratio . den ;
if ( ! p_dec -> fmt_out . video . i_sar_num || ! p_dec -> fmt_out . video . i_sar_den ) {
p_dec -> fmt_out . video . i_sar_num = 1 ;
p_dec -> fmt_out . video . i_sar_den = 1 ;
}
}
if ( p_dec -> fmt_in . video . i_frame_rate > 0 && p_dec -> fmt_in . video . i_frame_rate_base > 0 ) {
p_dec -> fmt_out . video . i_frame_rate = p_dec -> fmt_in . video . i_frame_rate ;
p_dec -> fmt_out . video . i_frame_rate_base = p_dec -> fmt_in . video . i_frame_rate_base ;
}
# if LIBAVCODEC_VERSION_CHECK ( 56 , 5 , 0 , 7 , 100 ) else if ( p_context -> framerate . num > 0 && p_context -> framerate . den > 0 ) {
p_dec -> fmt_out . video . i_frame_rate = p_context -> framerate . num ;
p_dec -> fmt_out . video . i_frame_rate_base = p_context -> framerate . den ;
# if LIBAVCODEC_VERSION_MICRO < 100 p_dec -> fmt_out . video . i_frame_rate_base *= __MAX ( p_context -> ticks_per_frame , 1 ) ;
# endif }
# endif else if ( p_context -> time_base . num > 0 && p_context -> time_base . den > 0 ) {
p_dec -> fmt_out . video . i_frame_rate = p_context -> time_base . den ;
p_dec -> fmt_out . video . i_frame_rate_base = p_context -> time_base . num * __MAX ( p_context -> ticks_per_frame , 1 ) ;
}
return decoder_NewPicture ( p_dec ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gint dissect_ac_if_output_terminal ( tvbuff_t * tvb , gint offset , packet_info * pinfo _U_ , proto_tree * tree , usb_conv_info_t * usb_conv_info _U_ ) {
gint offset_start ;
offset_start = offset ;
proto_tree_add_item ( tree , hf_ac_if_output_terminalid , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
offset += 1 ;
proto_tree_add_item ( tree , hf_ac_if_output_terminaltype , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
offset += 2 ;
proto_tree_add_item ( tree , hf_ac_if_output_assocterminal , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
offset += 1 ;
proto_tree_add_item ( tree , hf_ac_if_output_sourceid , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
offset += 1 ;
proto_tree_add_item ( tree , hf_ac_if_output_terminal , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
offset += 1 ;
return offset - offset_start ;
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.