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
|
ACL_USER * check_acl_user ( LEX_USER * user_name , uint * acl_acl_userdx ) {
ACL_USER * acl_user = 0 ;
uint counter ;
safe_mutex_assert_owner ( & acl_cache -> lock ) ;
for ( counter = 0 ;
counter < acl_users . elements ;
counter ++ ) {
const char * user , * host ;
acl_user = dynamic_element ( & acl_users , counter , ACL_USER * ) ;
if ( ! ( user = acl_user -> user ) ) user = "" ;
if ( ! ( host = acl_user -> host . hostname ) ) host = "" ;
if ( ! strcmp ( user_name -> user . str , user ) && ! my_strcasecmp ( system_charset_info , user_name -> host . str , host ) ) break ;
}
if ( counter == acl_users . elements ) return 0 ;
* acl_acl_userdx = counter ;
return acl_user ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_T_olc_ack_multiplexParameters ( 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_T_olc_ack_multiplexParameters , T_olc_ack_multiplexParameters_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void openpic_src_write ( void * opaque , hwaddr addr , uint64_t val , unsigned len ) {
OpenPICState * opp = opaque ;
int idx ;
DPRINTF ( "%s: addr %#" HWADDR_PRIx " <= %08" PRIx64 "\n" , __func__ , addr , val ) ;
addr = addr & 0xffff ;
idx = addr >> 5 ;
switch ( addr & 0x1f ) {
case 0x00 : write_IRQreg_ivpr ( opp , idx , val ) ;
break ;
case 0x10 : write_IRQreg_idr ( opp , idx , val ) ;
break ;
case 0x18 : write_IRQreg_ilr ( opp , idx , val ) ;
break ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline u32 file_to_av ( struct file * file ) {
u32 av = 0 ;
if ( file -> f_mode & FMODE_READ ) av |= FILE__READ ;
if ( file -> f_mode & FMODE_WRITE ) {
if ( file -> f_flags & O_APPEND ) av |= FILE__APPEND ;
else av |= FILE__WRITE ;
}
if ( ! av ) {
av = FILE__IOCTL ;
}
return av ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static __always_inline __le64 __cpu_to_le64p ( const __u64 * p ) {
return ( __le64 ) * p ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void memset_float ( float * buf , float val , int size ) {
while ( size -- ) * buf ++ = val ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void cmd_window_rsize ( const char * data ) {
char rsizestr [ MAX_INT_STRLEN ] ;
int rsize ;
if ( ! is_numeric ( data , 0 ) ) return ;
rsize = atoi ( data ) ;
rsize -= MAIN_WINDOW_TEXT_WIDTH ( WINDOW_MAIN ( active_win ) ) ;
if ( rsize == 0 ) return ;
ltoa ( rsizestr , rsize < 0 ? - rsize : rsize ) ;
if ( rsize < 0 ) cmd_window_rshrink ( rsizestr ) ;
else cmd_window_rgrow ( rsizestr ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
NewConverter * CnvExtOpen ( UCMFile * ucm ) {
CnvExtData * extData ;
extData = ( CnvExtData * ) uprv_malloc ( sizeof ( CnvExtData ) ) ;
if ( extData == NULL ) {
printf ( "out of memory\n" ) ;
exit ( U_MEMORY_ALLOCATION_ERROR ) ;
}
uprv_memset ( extData , 0 , sizeof ( CnvExtData ) ) ;
extData -> ucm = ucm ;
extData -> newConverter . close = CnvExtClose ;
extData -> newConverter . isValid = CnvExtIsValid ;
extData -> newConverter . addTable = CnvExtAddTable ;
extData -> newConverter . write = CnvExtWrite ;
return & extData -> newConverter ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_coap ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * parent_tree , void * data _U_ ) {
gint offset = 0 ;
proto_item * coap_root ;
proto_item * pi ;
proto_tree * coap_tree ;
guint8 ttype ;
guint8 token_len ;
guint8 code ;
guint8 code_class ;
guint16 mid ;
gint coap_length ;
gchar * coap_token_str ;
coap_info * coinfo ;
conversation_t * conversation ;
coap_conv_info * ccinfo ;
coap_transaction * coap_trans = NULL ;
coinfo = ( coap_info * ) p_get_proto_data ( wmem_file_scope ( ) , pinfo , proto_coap , 0 ) ;
if ( coinfo == NULL ) {
coinfo = wmem_new0 ( wmem_file_scope ( ) , coap_info ) ;
p_add_proto_data ( wmem_file_scope ( ) , pinfo , proto_coap , 0 , coinfo ) ;
}
coap_length = tvb_reported_length ( tvb ) ;
coinfo -> ctype_str = "" ;
coinfo -> ctype_value = DEFAULT_COAP_CTYPE_VALUE ;
col_set_str ( pinfo -> cinfo , COL_PROTOCOL , "CoAP" ) ;
col_clear ( pinfo -> cinfo , COL_INFO ) ;
coap_root = proto_tree_add_item ( parent_tree , proto_coap , tvb , offset , - 1 , ENC_NA ) ;
coap_tree = proto_item_add_subtree ( coap_root , ett_coap ) ;
proto_tree_add_item ( coap_tree , hf_coap_version , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( coap_tree , hf_coap_ttype , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
ttype = ( tvb_get_guint8 ( tvb , offset ) & COAP_TYPE_MASK ) >> 4 ;
proto_tree_add_item ( coap_tree , hf_coap_token_len , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
token_len = tvb_get_guint8 ( tvb , offset ) & COAP_TOKEN_LEN_MASK ;
offset += 1 ;
code = dissect_coap_code ( tvb , coap_tree , & offset , & dissect_coap_hf , & code_class ) ;
proto_tree_add_item ( coap_tree , hf_coap_mid , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
mid = tvb_get_ntohs ( tvb , offset ) ;
col_add_fstr ( pinfo -> cinfo , COL_INFO , "%s, MID:%u, %s" , val_to_str ( ttype , vals_ttype_short , "Unknown %u" ) , mid , val_to_str_ext ( code , & coap_vals_code_ext , "Unknown %u" ) ) ;
proto_item_append_text ( coap_root , ", %s, %s, MID:%u" , val_to_str ( ttype , vals_ttype , "Unknown %u" ) , val_to_str_ext ( code , & coap_vals_code_ext , "Unknown %u" ) , mid ) ;
offset += 2 ;
coinfo -> block_number = DEFAULT_COAP_BLOCK_NUMBER ;
coinfo -> block_mflag = 0 ;
coinfo -> uri_str_strbuf = wmem_strbuf_sized_new ( wmem_packet_scope ( ) , 0 , 1024 ) ;
coinfo -> uri_query_strbuf = wmem_strbuf_sized_new ( wmem_packet_scope ( ) , 0 , 1024 ) ;
coinfo -> oscore_info = wmem_new0 ( wmem_packet_scope ( ) , oscore_info_t ) ;
coinfo -> object_security = FALSE ;
coap_token_str = NULL ;
if ( token_len > 0 ) {
coap_token_str = tvb_bytes_to_str_punct ( wmem_file_scope ( ) , tvb , offset , token_len , ' ' ) ;
proto_tree_add_item ( coap_tree , hf_coap_token , tvb , offset , token_len , ENC_NA ) ;
offset += token_len ;
}
offset = dissect_coap_options ( tvb , pinfo , coap_tree , offset , coap_length , coinfo , & dissect_coap_hf ) ;
if ( offset == - 1 ) return tvb_captured_length ( tvb ) ;
conversation = find_or_create_conversation_noaddrb ( pinfo , ( code_class == 0 ) ) ;
ccinfo = ( coap_conv_info * ) conversation_get_proto_data ( conversation , proto_coap ) ;
if ( ! ccinfo ) {
ccinfo = wmem_new ( wmem_file_scope ( ) , coap_conv_info ) ;
ccinfo -> messages = wmem_map_new ( wmem_file_scope ( ) , g_str_hash , g_str_equal ) ;
conversation_add_proto_data ( conversation , proto_coap , ccinfo ) ;
}
if ( coap_token_str != NULL ) {
if ( code != 0 ) {
coap_trans = ( coap_transaction * ) wmem_map_lookup ( ccinfo -> messages , coap_token_str ) ;
if ( ! coap_trans ) {
if ( ( ! PINFO_FD_VISITED ( pinfo ) ) && ( code_class == 0 ) ) {
coap_trans = wmem_new0 ( wmem_file_scope ( ) , coap_transaction ) ;
coap_trans -> req_frame = pinfo -> num ;
coap_trans -> rsp_frame = 0 ;
coap_trans -> req_time = pinfo -> fd -> abs_ts ;
if ( coinfo -> uri_str_strbuf ) {
coap_trans -> uri_str_strbuf = wmem_strbuf_new ( wmem_file_scope ( ) , wmem_strbuf_get_str ( coinfo -> uri_str_strbuf ) ) ;
}
if ( coinfo -> oscore_info ) {
coap_trans -> oscore_info = ( oscore_info_t * ) wmem_memdup ( wmem_file_scope ( ) , coinfo -> oscore_info , sizeof ( oscore_info_t ) ) ;
if ( coinfo -> oscore_info -> kid ) {
coap_trans -> oscore_info -> kid = ( guint8 * ) wmem_memdup ( wmem_file_scope ( ) , coinfo -> oscore_info -> kid , coinfo -> oscore_info -> kid_len ) ;
}
if ( coinfo -> oscore_info -> kid_context ) {
coap_trans -> oscore_info -> kid_context = ( guint8 * ) wmem_memdup ( wmem_file_scope ( ) , coinfo -> oscore_info -> kid_context , coinfo -> oscore_info -> kid_context_len ) ;
}
if ( coinfo -> oscore_info -> piv ) {
coap_trans -> oscore_info -> piv = ( guint8 * ) wmem_memdup ( wmem_file_scope ( ) , coinfo -> oscore_info -> piv , coinfo -> oscore_info -> piv_len ) ;
}
}
wmem_map_insert ( ccinfo -> messages , coap_token_str , ( void * ) coap_trans ) ;
}
}
else {
if ( ( code_class >= 2 ) && ( code_class <= 5 ) ) {
if ( ! PINFO_FD_VISITED ( pinfo ) ) {
coap_trans -> rsp_frame = pinfo -> num ;
}
if ( coap_trans -> uri_str_strbuf ) {
coinfo -> uri_str_strbuf = wmem_strbuf_new ( wmem_packet_scope ( ) , wmem_strbuf_get_str ( coap_trans -> uri_str_strbuf ) ) ;
}
if ( coap_trans -> oscore_info ) {
if ( coap_trans -> oscore_info -> kid ) {
coinfo -> oscore_info -> kid = ( guint8 * ) wmem_memdup ( wmem_packet_scope ( ) , coap_trans -> oscore_info -> kid , coap_trans -> oscore_info -> kid_len ) ;
}
coinfo -> oscore_info -> kid_len = coap_trans -> oscore_info -> kid_len ;
if ( coap_trans -> oscore_info -> kid_context ) {
coinfo -> oscore_info -> kid_context = ( guint8 * ) wmem_memdup ( wmem_packet_scope ( ) , coap_trans -> oscore_info -> kid_context , coap_trans -> oscore_info -> kid_context_len ) ;
}
coinfo -> oscore_info -> kid_context_len = coap_trans -> oscore_info -> kid_context_len ;
if ( coinfo -> oscore_info -> piv_len > 0 ) {
coinfo -> oscore_info -> piv_in_response = TRUE ;
coap_trans -> oscore_info -> piv_in_response = TRUE ;
}
else if ( coap_trans -> oscore_info -> piv_len > 0 ) {
coinfo -> oscore_info -> piv = ( guint8 * ) wmem_memdup ( wmem_packet_scope ( ) , coap_trans -> oscore_info -> piv , coap_trans -> oscore_info -> piv_len ) ;
coinfo -> oscore_info -> piv_len = coap_trans -> oscore_info -> piv_len ;
}
coinfo -> oscore_info -> response = TRUE ;
}
}
}
}
}
if ( coap_trans != NULL ) {
if ( code_class == 0 ) {
if ( coap_trans -> rsp_frame ) {
proto_item * it ;
it = proto_tree_add_uint ( coap_tree , hf_coap_response_in , tvb , 0 , 0 , coap_trans -> rsp_frame ) ;
PROTO_ITEM_SET_GENERATED ( it ) ;
}
}
else if ( ( code_class >= 2 ) && ( code_class <= 5 ) ) {
if ( coap_trans -> req_frame ) {
proto_item * it ;
nstime_t ns ;
it = proto_tree_add_uint ( coap_tree , hf_coap_response_to , tvb , 0 , 0 , coap_trans -> req_frame ) ;
PROTO_ITEM_SET_GENERATED ( it ) ;
nstime_delta ( & ns , & pinfo -> fd -> abs_ts , & coap_trans -> req_time ) ;
it = proto_tree_add_time ( coap_tree , hf_coap_response_time , tvb , 0 , 0 , & ns ) ;
PROTO_ITEM_SET_GENERATED ( it ) ;
}
if ( coinfo -> object_security && coap_trans -> oscore_info ) {
proto_item * it ;
it = proto_tree_add_bytes ( coap_tree , hf_coap_oscore_kid , tvb , 0 , coap_trans -> oscore_info -> kid_len , coap_trans -> oscore_info -> kid ) ;
PROTO_ITEM_SET_GENERATED ( it ) ;
it = proto_tree_add_bytes ( coap_tree , hf_coap_oscore_kid_context , tvb , 0 , coap_trans -> oscore_info -> kid_context_len , coap_trans -> oscore_info -> kid_context ) ;
PROTO_ITEM_SET_GENERATED ( it ) ;
if ( coap_trans -> oscore_info -> piv_in_response ) {
it = proto_tree_add_bytes ( coap_tree , hf_coap_oscore_piv , tvb , 0 , coinfo -> oscore_info -> piv_len , coinfo -> oscore_info -> piv ) ;
}
else {
it = proto_tree_add_bytes ( coap_tree , hf_coap_oscore_piv , tvb , 0 , coap_trans -> oscore_info -> piv_len , coap_trans -> oscore_info -> piv ) ;
}
PROTO_ITEM_SET_GENERATED ( it ) ;
}
}
}
if ( coap_token_str != NULL ) col_append_fstr ( pinfo -> cinfo , COL_INFO , ", TKN:%s" , coap_token_str ) ;
if ( coinfo -> block_number != DEFAULT_COAP_BLOCK_NUMBER ) col_append_fstr ( pinfo -> cinfo , COL_INFO , ", %sBlock #%u" , coinfo -> block_mflag ? "" : "End of " , coinfo -> block_number ) ;
if ( wmem_strbuf_get_len ( coinfo -> uri_str_strbuf ) > 0 ) {
col_append_fstr ( pinfo -> cinfo , COL_INFO , ", %s" , wmem_strbuf_get_str ( coinfo -> uri_str_strbuf ) ) ;
pi = proto_tree_add_string ( coap_tree , dissect_coap_hf . hf . opt_uri_path_recon , tvb , 0 , 0 , wmem_strbuf_get_str ( coinfo -> uri_str_strbuf ) ) ;
PROTO_ITEM_SET_GENERATED ( pi ) ;
}
if ( wmem_strbuf_get_len ( coinfo -> uri_query_strbuf ) > 0 ) col_append_str ( pinfo -> cinfo , COL_INFO , wmem_strbuf_get_str ( coinfo -> uri_query_strbuf ) ) ;
if ( coap_length > offset ) {
dissect_coap_payload ( tvb , pinfo , coap_tree , parent_tree , offset , coap_length , code_class , coinfo , & dissect_coap_hf , FALSE ) ;
}
return tvb_captured_length ( tvb ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void decode_image_block ( RangeCoder * c , ImageBlockCoder * ic , uint8_t * dst , int stride , int block_size ) {
int i , j ;
int vec_size ;
int vec [ 4 ] ;
int prev_line [ 16 ] ;
int A , B , C ;
vec_size = rac_get_model_sym ( c , & ic -> vec_size_model ) + 2 ;
for ( i = 0 ;
i < vec_size ;
i ++ ) vec [ i ] = rac_get_model256_sym ( c , & ic -> vec_entry_model ) ;
for ( ;
i < 4 ;
i ++ ) vec [ i ] = 0 ;
memset ( prev_line , 0 , sizeof ( prev_line ) ) ;
for ( j = 0 ;
j < block_size ;
j ++ ) {
A = 0 ;
B = 0 ;
for ( i = 0 ;
i < block_size ;
i ++ ) {
C = B ;
B = prev_line [ i ] ;
A = rac_get_model_sym ( c , & ic -> vq_model [ A + B * 5 + C * 25 ] ) ;
prev_line [ i ] = A ;
if ( A < 4 ) dst [ i ] = vec [ A ] ;
else dst [ i ] = rac_get_model256_sym ( c , & ic -> esc_model ) ;
}
dst += stride ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int s_aos_process ( stream_state * st , stream_cursor_read * ignore_pr , stream_cursor_write * pw , bool last ) {
int blk_i , blk_off , blk_cnt , status = 1 ;
uint count ;
aos_state_t * ss = ( aos_state_t * ) st ;
uint max_count = pw -> limit - pw -> ptr ;
uint pos = stell ( ss -> s ) ;
unsigned const char * data ;
ref * blk_ref ;
pos += sbufavailable ( ss -> s ) ;
if ( pos >= ss -> file_sz ) return EOFC ;
blk_i = pos / ss -> blk_sz ;
blk_off = pos % ss -> blk_sz ;
blk_cnt = r_size ( & ss -> blocks ) ;
count = blk_i < blk_cnt - 1 ? ss -> blk_sz : ss -> blk_sz_last ;
blk_ref = ss -> blocks . value . refs ;
data = blk_ref [ blk_i ] . value . bytes ;
if ( max_count > count - blk_off ) {
max_count = count - blk_off ;
if ( blk_i == blk_cnt - 1 ) status = EOFC ;
}
memcpy ( pw -> ptr + 1 , data + blk_off , max_count ) ;
pw -> ptr += max_count ;
return status ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int tm2_read_header ( TM2Context * ctx , const uint8_t * buf ) {
uint32_t magic = AV_RL32 ( buf ) ;
switch ( magic ) {
case TM2_OLD_HEADER_MAGIC : av_log_missing_feature ( ctx -> avctx , "TM2 old header" , 1 ) ;
return 0 ;
case TM2_NEW_HEADER_MAGIC : return 0 ;
default : av_log ( ctx -> avctx , AV_LOG_ERROR , "Not a TM2 header: 0x%08X\n" , magic ) ;
return AVERROR_INVALIDDATA ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int IsTTFRefable ( SplineChar * sc , int layer ) {
RefChar * ref ;
if ( sc -> layers [ layer ] . refs == NULL || sc -> layers [ layer ] . splines != NULL ) return ( false ) ;
for ( ref = sc -> layers [ layer ] . refs ;
ref != NULL ;
ref = ref -> next ) {
if ( ref -> transform [ 0 ] < - 2 || ref -> transform [ 0 ] > 1.999939 || ref -> transform [ 1 ] < - 2 || ref -> transform [ 1 ] > 1.999939 || ref -> transform [ 2 ] < - 2 || ref -> transform [ 2 ] > 1.999939 || ref -> transform [ 3 ] < - 2 || ref -> transform [ 3 ] > 1.999939 ) return ( false ) ;
}
return ( true ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int speed_map ( int speed , const int * map ) {
int res ;
do {
res = * map ++ ;
}
while ( speed >= * map ++ ) ;
return res ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void midi_data_reassemble_init ( void ) {
reassembly_table_init ( & midi_data_reassembly_table , & addresses_reassembly_table_functions ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( FullscreenControllerInteractiveTest , DISABLED_TestNewTabExitsFullscreen ) {
ASSERT_TRUE ( test_server ( ) -> Start ( ) ) ;
AddTabAtIndex ( 0 , GURL ( url : : kAboutBlankURL ) , PAGE_TRANSITION_TYPED ) ;
ASSERT_NO_FATAL_FAILURE ( ToggleTabFullscreen ( true ) ) ;
{
FullscreenNotificationObserver fullscreen_observer ;
AddTabAtIndex ( 1 , GURL ( url : : kAboutBlankURL ) , PAGE_TRANSITION_TYPED ) ;
fullscreen_observer . Wait ( ) ;
ASSERT_FALSE ( browser ( ) -> window ( ) -> IsFullscreen ( ) ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int get_kf_active_quality ( const RATE_CONTROL * const rc , int q ) {
return get_active_quality ( q , rc -> kf_boost , kf_low , kf_high , kf_low_motion_minq , kf_high_motion_minq ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int xmlHashUpdateEntry ( xmlHashTablePtr table , const xmlChar * name , void * userdata , xmlHashDeallocator f ) {
return ( xmlHashUpdateEntry3 ( table , name , NULL , NULL , userdata , f ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void istr_set_destroy ( GHashTable * table ) {
g_hash_table_destroy ( table ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void xps_parse_matrix_transform ( xps_document * doc , fz_xml * root , fz_matrix * matrix ) {
char * transform ;
* matrix = fz_identity ;
if ( ! strcmp ( fz_xml_tag ( root ) , "MatrixTransform" ) ) {
transform = fz_xml_att ( root , "Matrix" ) ;
if ( transform ) xps_parse_render_transform ( doc , transform , matrix ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_nlm_lock ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , int version , rpc_call_info_value * rpc_call ) {
if ( nlm_match_msgres ) {
if ( rpc_call -> proc == 7 ) {
if ( ( ! pinfo -> fd -> flags . visited ) ) {
nlm_register_unmatched_msg ( pinfo , tvb , offset ) ;
}
else {
nlm_print_msgres_request ( pinfo , tree , tvb ) ;
}
if ( nfs_fhandle_reqrep_matching ) {
nlm_match_fhandle_request ( pinfo , tree ) ;
}
}
}
offset = dissect_rpc_data ( tvb , tree , hf_nlm_cookie , offset ) ;
offset = dissect_rpc_bool ( tvb , tree , hf_nlm_block , offset ) ;
offset = dissect_rpc_bool ( tvb , tree , hf_nlm_exclusive , offset ) ;
offset = dissect_lock ( tvb , pinfo , tree , version , offset , rpc_call ) ;
offset = dissect_rpc_bool ( tvb , tree , hf_nlm_reclaim , offset ) ;
offset = dissect_rpc_uint32 ( tvb , tree , hf_nlm_state , offset ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ivi_dec_tile_data_size ( GetBitContext * gb ) {
int len ;
len = 0 ;
if ( get_bits1 ( gb ) ) {
len = get_bits ( gb , 8 ) ;
if ( len == 255 ) len = get_bits_long ( gb , 24 ) ;
}
align_get_bits ( gb ) ;
return len ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
struct block * compiler_add_instr ( struct instruction * ins , struct block * blk ) {
struct block * bl ;
SAFE_CALLOC ( bl , 1 , sizeof ( struct block ) ) ;
bl -> type = BLK_INSTR ;
bl -> un . ins = ins ;
bl -> next = blk ;
return bl ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void pdf_tos_save ( fz_context * ctx , pdf_text_object_state * tos , fz_matrix save [ 2 ] ) {
save [ 0 ] = tos -> tm ;
save [ 1 ] = tos -> tlm ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void decode_postinit ( H264Context * h , int setup_finished ) {
Picture * out = h -> cur_pic_ptr ;
Picture * cur = h -> cur_pic_ptr ;
int i , pics , out_of_order , out_idx ;
h -> cur_pic_ptr -> f . pict_type = h -> pict_type ;
if ( h -> next_output_pic ) return ;
if ( cur -> field_poc [ 0 ] == INT_MAX || cur -> field_poc [ 1 ] == INT_MAX ) {
return ;
}
cur -> f . interlaced_frame = 0 ;
cur -> f . repeat_pict = 0 ;
if ( h -> sps . pic_struct_present_flag ) {
switch ( h -> sei_pic_struct ) {
case SEI_PIC_STRUCT_FRAME : break ;
case SEI_PIC_STRUCT_TOP_FIELD : case SEI_PIC_STRUCT_BOTTOM_FIELD : cur -> f . interlaced_frame = 1 ;
break ;
case SEI_PIC_STRUCT_TOP_BOTTOM : case SEI_PIC_STRUCT_BOTTOM_TOP : if ( FIELD_OR_MBAFF_PICTURE ( h ) ) cur -> f . interlaced_frame = 1 ;
else cur -> f . interlaced_frame = h -> prev_interlaced_frame ;
break ;
case SEI_PIC_STRUCT_TOP_BOTTOM_TOP : case SEI_PIC_STRUCT_BOTTOM_TOP_BOTTOM : cur -> f . repeat_pict = 1 ;
break ;
case SEI_PIC_STRUCT_FRAME_DOUBLING : cur -> f . repeat_pict = 2 ;
break ;
case SEI_PIC_STRUCT_FRAME_TRIPLING : cur -> f . repeat_pict = 4 ;
break ;
}
if ( ( h -> sei_ct_type & 3 ) && h -> sei_pic_struct <= SEI_PIC_STRUCT_BOTTOM_TOP ) cur -> f . interlaced_frame = ( h -> sei_ct_type & ( 1 << 1 ) ) != 0 ;
}
else {
cur -> f . interlaced_frame = FIELD_OR_MBAFF_PICTURE ( h ) ;
}
h -> prev_interlaced_frame = cur -> f . interlaced_frame ;
if ( cur -> field_poc [ 0 ] != cur -> field_poc [ 1 ] ) {
cur -> f . top_field_first = cur -> field_poc [ 0 ] < cur -> field_poc [ 1 ] ;
}
else {
if ( cur -> f . interlaced_frame || h -> sps . pic_struct_present_flag ) {
if ( h -> sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM || h -> sei_pic_struct == SEI_PIC_STRUCT_TOP_BOTTOM_TOP ) cur -> f . top_field_first = 1 ;
else cur -> f . top_field_first = 0 ;
}
else {
cur -> f . top_field_first = 0 ;
}
}
cur -> mmco_reset = h -> mmco_reset ;
h -> mmco_reset = 0 ;
if ( h -> sps . bitstream_restriction_flag && h -> avctx -> has_b_frames < h -> sps . num_reorder_frames ) {
h -> avctx -> has_b_frames = h -> sps . num_reorder_frames ;
h -> low_delay = 0 ;
}
if ( h -> avctx -> strict_std_compliance >= FF_COMPLIANCE_STRICT && ! h -> sps . bitstream_restriction_flag ) {
h -> avctx -> has_b_frames = MAX_DELAYED_PIC_COUNT - 1 ;
h -> low_delay = 0 ;
}
for ( i = 0 ;
1 ;
i ++ ) {
if ( i == MAX_DELAYED_PIC_COUNT || cur -> poc < h -> last_pocs [ i ] ) {
if ( i ) h -> last_pocs [ i - 1 ] = cur -> poc ;
break ;
}
else if ( i ) {
h -> last_pocs [ i - 1 ] = h -> last_pocs [ i ] ;
}
}
out_of_order = MAX_DELAYED_PIC_COUNT - i ;
if ( cur -> f . pict_type == AV_PICTURE_TYPE_B || ( h -> last_pocs [ MAX_DELAYED_PIC_COUNT - 2 ] > INT_MIN && h -> last_pocs [ MAX_DELAYED_PIC_COUNT - 1 ] - h -> last_pocs [ MAX_DELAYED_PIC_COUNT - 2 ] > 2 ) ) out_of_order = FFMAX ( out_of_order , 1 ) ;
if ( out_of_order == MAX_DELAYED_PIC_COUNT ) {
av_log ( h -> avctx , AV_LOG_VERBOSE , "Invalid POC %d<%d\n" , cur -> poc , h -> last_pocs [ 0 ] ) ;
for ( i = 1 ;
i < MAX_DELAYED_PIC_COUNT ;
i ++ ) h -> last_pocs [ i ] = INT_MIN ;
h -> last_pocs [ 0 ] = cur -> poc ;
cur -> mmco_reset = 1 ;
}
else if ( h -> avctx -> has_b_frames < out_of_order && ! h -> sps . bitstream_restriction_flag ) {
av_log ( h -> avctx , AV_LOG_VERBOSE , "Increasing reorder buffer to %d\n" , out_of_order ) ;
h -> avctx -> has_b_frames = out_of_order ;
h -> low_delay = 0 ;
}
pics = 0 ;
while ( h -> delayed_pic [ pics ] ) pics ++ ;
av_assert0 ( pics <= MAX_DELAYED_PIC_COUNT ) ;
h -> delayed_pic [ pics ++ ] = cur ;
if ( cur -> reference == 0 ) cur -> reference = DELAYED_PIC_REF ;
out = h -> delayed_pic [ 0 ] ;
out_idx = 0 ;
for ( i = 1 ;
h -> delayed_pic [ i ] && ! h -> delayed_pic [ i ] -> f . key_frame && ! h -> delayed_pic [ i ] -> mmco_reset ;
i ++ ) if ( h -> delayed_pic [ i ] -> poc < out -> poc ) {
out = h -> delayed_pic [ i ] ;
out_idx = i ;
}
if ( h -> avctx -> has_b_frames == 0 && ( h -> delayed_pic [ 0 ] -> f . key_frame || h -> delayed_pic [ 0 ] -> mmco_reset ) ) h -> next_outputed_poc = INT_MIN ;
out_of_order = out -> poc < h -> next_outputed_poc ;
if ( out_of_order || pics > h -> avctx -> has_b_frames ) {
out -> reference &= ~ DELAYED_PIC_REF ;
for ( i = out_idx ;
h -> delayed_pic [ i ] ;
i ++ ) h -> delayed_pic [ i ] = h -> delayed_pic [ i + 1 ] ;
}
if ( ! out_of_order && pics > h -> avctx -> has_b_frames ) {
h -> next_output_pic = out ;
if ( out_idx == 0 && h -> delayed_pic [ 0 ] && ( h -> delayed_pic [ 0 ] -> f . key_frame || h -> delayed_pic [ 0 ] -> mmco_reset ) ) {
h -> next_outputed_poc = INT_MIN ;
}
else h -> next_outputed_poc = out -> poc ;
}
else {
av_log ( h -> avctx , AV_LOG_DEBUG , "no picture %s\n" , out_of_order ? "ooo" : "" ) ;
}
if ( h -> next_output_pic ) {
if ( h -> next_output_pic -> recovered ) {
h -> frame_recovered |= FRAME_RECOVERED_SEI ;
}
h -> next_output_pic -> recovered |= ! ! ( h -> frame_recovered & FRAME_RECOVERED_SEI ) ;
}
if ( setup_finished && ! h -> avctx -> hwaccel ) ff_thread_finish_setup ( h -> avctx ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int flush_pending_blocks ( MI_SORT_PARAM * sort_param ) {
uint nod_flag , length ;
my_off_t filepos , key_file_length ;
SORT_KEY_BLOCKS * key_block ;
SORT_INFO * sort_info = sort_param -> sort_info ;
myf myf_rw = sort_info -> param -> myf_rw ;
MI_INFO * info = sort_info -> info ;
MI_KEYDEF * keyinfo = sort_param -> keyinfo ;
DBUG_ENTER ( "flush_pending_blocks" ) ;
filepos = HA_OFFSET_ERROR ;
nod_flag = 0 ;
for ( key_block = sort_info -> key_block ;
key_block -> inited ;
key_block ++ ) {
key_block -> inited = 0 ;
length = mi_getint ( key_block -> buff ) ;
if ( nod_flag ) _mi_kpointer ( info , key_block -> end_pos , filepos ) ;
key_file_length = info -> state -> key_file_length ;
bzero ( ( uchar * ) key_block -> buff + length , keyinfo -> block_length - length ) ;
if ( ( filepos = _mi_new ( info , keyinfo , DFLT_INIT_HITS ) ) == HA_OFFSET_ERROR ) DBUG_RETURN ( 1 ) ;
if ( key_file_length == info -> state -> key_file_length ) {
if ( _mi_write_keypage ( info , keyinfo , filepos , DFLT_INIT_HITS , key_block -> buff ) ) DBUG_RETURN ( 1 ) ;
}
else if ( mysql_file_pwrite ( info -> s -> kfile , ( uchar * ) key_block -> buff , ( uint ) keyinfo -> block_length , filepos , myf_rw ) ) DBUG_RETURN ( 1 ) ;
DBUG_DUMP ( "buff" , ( uchar * ) key_block -> buff , length ) ;
nod_flag = 1 ;
}
info -> s -> state . key_root [ sort_param -> key ] = filepos ;
DBUG_RETURN ( 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
Oid get_opclass_input_type ( Oid opclass ) {
HeapTuple tp ;
Form_pg_opclass cla_tup ;
Oid result ;
tp = SearchSysCache1 ( CLAOID , ObjectIdGetDatum ( opclass ) ) ;
if ( ! HeapTupleIsValid ( tp ) ) elog ( ERROR , "cache lookup failed for opclass %u" , opclass ) ;
cla_tup = ( Form_pg_opclass ) GETSTRUCT ( tp ) ;
result = cla_tup -> opcintype ;
ReleaseSysCache ( tp ) ;
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int string_buffer_getbuffer ( PyStringObject * self , Py_buffer * view , int flags ) {
return PyBuffer_FillInfo ( view , ( PyObject * ) self , ( void * ) self -> ob_sval , Py_SIZE ( self ) , 1 , flags ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pop_string ( stroke_msg_t * msg , char * * string ) {
if ( * string == NULL ) {
return ;
}
if ( string < ( char * * ) msg || string > ( char * * ) ( ( char * ) msg + sizeof ( stroke_msg_t ) ) || ( unsigned long ) * string < ( unsigned long ) ( ( char * ) msg -> buffer - ( char * ) msg ) || ( unsigned long ) * string > msg -> length ) {
* string = "(invalid pointer in stroke msg)" ;
}
else {
* string = ( char * ) msg + ( unsigned long ) * string ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void proto_reg_handoff_zbee_zcl_met_idt ( void ) {
zbee_zcl_init_cluster ( proto_zbee_zcl_met_idt , ett_zbee_zcl_met_idt , ZBEE_ZCL_CID_METER_IDENTIFICATION , hf_zbee_zcl_met_idt_attr_id , - 1 , - 1 , ( zbee_zcl_fn_attr_data ) dissect_zcl_met_idt_attr_data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int X509_REQ_digest ( const X509_REQ * data , const EVP_MD * type , unsigned char * md , unsigned int * len ) {
return ( ASN1_item_digest ( ASN1_ITEM_rptr ( X509_REQ ) , type , ( char * ) data , md , len ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
unsigned long # define BN_LONG long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK ( 0xffffffffffffffffffffffffffffffffLL ) # define BN_MASK2 ( 0xffffffffffffffffL ) # define BN_MASK2l ( 0xffffffffL ) # define BN_MASK2h ( 0xffffffff00000000L ) # define BN_MASK2h1 ( 0xffffffff80000000L ) # define BN_TBIT ( 0x8000000000000000L ) # define BN_DEC_CONV ( 10000000000000000000UL ) # define BN_DEC_FMT1 "%lu" # define BN_DEC_FMT2 "%019lu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%lX" # define BN_HEX_FMT2 "%016lX" # endif # ifdef SIXTY_FOUR_BIT # undef BN_LLONG # undef BN_ULLONG # define BN_ULONG unsigned long long # define BN_LONG long long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK2 ( 0xffffffffffffffffLL ) # define BN_MASK2l ( 0xffffffffL ) # define BN_MASK2h ( 0xffffffff00000000LL ) # define BN_MASK2h1 ( 0xffffffff80000000LL ) # define BN_TBIT ( 0x8000000000000000LL ) # define BN_DEC_CONV ( 10000000000000000000ULL ) # define BN_DEC_FMT1 "%llu" # define BN_DEC_FMT2 "%019llu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%llX" # define BN_HEX_FMT2 "%016llX" # endif # ifdef THIRTY_TWO_BIT # ifdef BN_LLONG # if defined ( _WIN32 ) && ! defined ( __GNUC__ ) # define BN_ULLONG unsigned __int64 # define BN_MASK ( 0xffffffffffffffffI64 ) # else # define BN_ULLONG unsigned long long # define BN_MASK ( 0xffffffffffffffffLL ) # endif # endif # define BN_ULONG unsigned int # define BN_LONG int # define BN_BITS 64 # define BN_BYTES 4 # define BN_BITS2 32 # define BN_BITS4 16 # define BN_MASK2 ( 0xffffffffL ) # define BN_MASK2l ( 0xffff ) # define BN_MASK2h1 ( 0xffff8000L ) # define BN_MASK2h ( 0xffff0000L ) # define BN_TBIT ( 0x80000000L ) # define BN_DEC_CONV ( 1000000000L ) # define BN_DEC_FMT1 "%u" # define BN_DEC_FMT2 "%09u" # define BN_DEC_NUM 9 # define BN_HEX_FMT1 "%X" # define BN_HEX_FMT2 "%08X" # endif # define BN_DEFAULT_BITS 1280 # define BN_FLG_MALLOCED 0x01 # define BN_FLG_STATIC_DATA 0x02 # define BN_FLG_CONSTTIME 0x04 # ifndef OPENSSL_NO_DEPRECATED # define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME # endif # ifndef OPENSSL_NO_DEPRECATED # define BN_FLG_FREE 0x8000 # endif # define BN_set_flags ( b , n ) ( ( b ) -> flags |= ( n ) ) # define BN_get_flags ( b , n ) ( ( b ) -> flags & ( n ) ) # define BN_with_flags ( dest , b , n ) ( ( dest ) -> d = ( b ) -> d , \ ( dest ) -> top = ( b ) -> top , \ ( dest ) -> dmax = ( b ) -> dmax , \ ( dest ) -> neg = ( b ) -> neg , \ ( dest ) -> flags = ( ( ( dest ) -> flags & BN_FLG_MALLOCED ) \ | ( ( b ) -> flags & ~ BN_FLG_MALLOCED ) \ | BN_FLG_STATIC_DATA \ | ( n ) ) ) # if 0 typedef struct bignum_st BIGNUM ;
typedef struct bignum_ctx BN_CTX ;
typedef struct bn_blinding_st BN_BLINDING ;
typedef struct bn_mont_ctx_st BN_MONT_CTX ;
typedef struct bn_recp_ctx_st BN_RECP_CTX ;
typedef struct bn_gencb_st BN_GENCB ;
# endif struct bignum_st {
BN_ULONG * d ;
int top ;
int dmax ;
int neg ;
int flags ;
}
;
struct bn_mont_ctx_st {
int ri ;
BIGNUM RR ;
BIGNUM N ;
BIGNUM Ni ;
BN_ULONG n0 [ 2 ] ;
int flags ;
}
;
struct bn_recp_ctx_st {
BIGNUM N ;
BIGNUM Nr ;
int num_bits ;
int shift ;
int flags ;
}
;
struct bn_gencb_st {
unsigned int ver ;
void * arg ;
union {
void ( * cb_1 ) ( int , int , void * ) ;
int ( * cb_2 ) ( int , int , BN_GENCB * ) ;
}
cb ;
}
;
int BN_GENCB_call ( BN_GENCB * cb , int a , int b ) ;
# define BN_GENCB_set_old ( gencb , callback , cb_arg ) {
\ BN_GENCB * tmp_gencb = ( gencb ) ;
\ tmp_gencb -> ver = 1 ;
\ tmp_gencb -> arg = ( cb_arg ) ;
\ tmp_gencb -> cb . cb_1 = ( callback ) ;
}
# define BN_GENCB_set ( gencb , callback , cb_arg ) {
\ BN_GENCB * tmp_gencb = ( gencb ) ;
\ tmp_gencb -> ver = 2 ;
\ tmp_gencb -> arg = ( cb_arg ) ;
\ tmp_gencb -> cb . cb_2 = ( callback ) ;
}
# define BN_prime_checks 0 # define BN_prime_checks_for_size ( b ) ( ( b ) >= 1300 ? 2 : \ ( b ) >= 850 ? 3 : \ ( b ) >= 650 ? 4 : \ ( b ) >= 550 ? 5 : \ ( b ) >= 450 ? 6 : \ ( b ) >= 400 ? 7 : \ ( b ) >= 350 ? 8 : \ ( b ) >= 300 ? 9 : \ ( b ) >= 250 ? 12 : \ ( b ) >= 200 ? 15 : \ ( b ) >= 150 ? 18 : \ 27 ) # define BN_num_bytes ( a ) ( ( BN_num_bits ( a ) + 7 ) / 8 ) # define BN_abs_is_word ( a , w ) ( ( ( ( a ) -> top == 1 ) && ( ( a ) -> d [ 0 ] == ( BN_ULONG ) ( w ) ) ) || \ ( ( ( w ) == 0 ) && ( ( a ) -> top == 0 ) ) ) # define BN_is_zero ( a ) ( ( a ) -> top == 0 ) # define BN_is_one ( a ) ( BN_abs_is_word ( ( a ) , 1 ) && ! ( a ) -> neg ) # define BN_is_word ( a , w ) ( BN_abs_is_word ( ( a ) , ( w ) ) && ( ! ( w ) || ! ( a ) -> neg ) ) # define BN_is_odd ( a ) ( ( ( a ) -> top > 0 ) && ( ( a ) -> d [ 0 ] & 1 ) ) # define BN_one ( a ) ( BN_set_word ( ( a ) , 1 ) ) # define BN_zero_ex ( a ) \ do {
\ BIGNUM * _tmp_bn = ( a ) ;
\ _tmp_bn -> top = 0 ;
\ _tmp_bn -> neg = 0 ;
\ }
while ( 0 ) # ifdef OPENSSL_NO_DEPRECATED # define BN_zero ( a ) BN_zero_ex ( a ) # else # define BN_zero ( a ) ( BN_set_word ( ( a ) , 0 ) ) # endif const BIGNUM * BN_value_one ( void ) ;
char * BN_options ( void ) ;
BN_CTX * BN_CTX_new ( void ) ;
# ifndef OPENSSL_NO_DEPRECATED void BN_CTX_init ( BN_CTX * c ) ;
# endif void BN_CTX_free ( BN_CTX * c ) ;
void BN_CTX_start ( BN_CTX * ctx ) ;
BIGNUM * BN_CTX_get ( BN_CTX * ctx ) ;
void BN_CTX_end ( BN_CTX * ctx ) ;
int BN_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ;
int BN_pseudo_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ;
int BN_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ;
int BN_pseudo_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ;
int BN_num_bits ( const BIGNUM * a ) ;
int BN_num_bits_word ( BN_ULONG l ) ;
BIGNUM * BN_new ( void ) ;
void BN_init ( BIGNUM * ) ;
void BN_clear_free ( BIGNUM * a ) ;
BIGNUM * BN_copy ( BIGNUM * a , const BIGNUM * b ) ;
void BN_swap ( BIGNUM * a , BIGNUM * b ) ;
BIGNUM * BN_bin2bn ( const unsigned char * s , int len , BIGNUM * ret ) ;
int BN_bn2bin ( const BIGNUM * a , unsigned char * to ) ;
BIGNUM * BN_mpi2bn ( const unsigned char * s , int len , BIGNUM * ret ) ;
int BN_bn2mpi ( const BIGNUM * a , unsigned char * to ) ;
int BN_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_usub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_uadd ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ;
int BN_sqr ( BIGNUM * r , const BIGNUM * a , BN_CTX * ctx ) ;
void BN_set_negative ( BIGNUM * b , int n ) ;
# define BN_is_negative ( a ) ( ( a ) -> neg != 0 ) int BN_div ( BIGNUM * dv , BIGNUM * rem , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ;
# define BN_mod ( rem , m , d , ctx ) BN_div ( NULL , ( rem ) , ( m ) , ( d ) , ( ctx ) ) int BN_nnmod ( BIGNUM * r , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ;
int BN_mod_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_add_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ;
int BN_mod_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_sub_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ;
int BN_mod_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_sqr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_lshift1 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_lshift1_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m ) ;
int BN_mod_lshift ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_lshift_quick ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m ) ;
BN_ULONG BN_mod_word ( const BIGNUM * a , BN_ULONG w ) ;
BN_ULONG BN_div_word ( BIGNUM * a , BN_ULONG w ) ;
int BN_mul_word ( BIGNUM * a , BN_ULONG w ) ;
int BN_add_word ( BIGNUM * a , BN_ULONG w ) ;
int BN_sub_word ( BIGNUM * a , BN_ULONG w ) ;
int BN_set_word ( BIGNUM * a , BN_ULONG w ) ;
BN_ULONG BN_get_word ( const BIGNUM * a ) ;
int BN_cmp ( const BIGNUM * a , const BIGNUM * b ) ;
void BN_free ( BIGNUM * a ) ;
int BN_is_bit_set ( const BIGNUM * a , int n ) ;
int BN_lshift ( BIGNUM * r , const BIGNUM * a , int n ) ;
int BN_lshift1 ( BIGNUM * r , const BIGNUM * a ) ;
int BN_exp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_mod_exp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_exp_mont ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) ;
int BN_mod_exp_mont_consttime ( BIGNUM * rr , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * in_mont ) ;
int BN_mod_exp_mont_word ( BIGNUM * r , BN_ULONG a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) ;
int BN_mod_exp2_mont ( BIGNUM * r , const BIGNUM * a1 , const BIGNUM * p1 , const BIGNUM * a2 , const BIGNUM * p2 , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) ;
int BN_mod_exp_simple ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mask_bits ( BIGNUM * a , int n ) ;
# ifndef OPENSSL_NO_FP_API int BN_print_fp ( FILE * fp , const BIGNUM * a ) ;
# endif # ifdef HEADER_BIO_H int BN_print ( BIO * fp , const BIGNUM * a ) ;
# else int BN_print ( void * fp , const BIGNUM * a ) ;
# endif int BN_reciprocal ( BIGNUM * r , const BIGNUM * m , int len , BN_CTX * ctx ) ;
int BN_rshift ( BIGNUM * r , const BIGNUM * a , int n ) ;
int BN_rshift1 ( BIGNUM * r , const BIGNUM * a ) ;
void BN_clear ( BIGNUM * a ) ;
BIGNUM * BN_dup ( const BIGNUM * a ) ;
int BN_ucmp ( const BIGNUM * a , const BIGNUM * b ) ;
int BN_set_bit ( BIGNUM * a , int n ) ;
int BN_clear_bit ( BIGNUM * a , int n ) ;
char * BN_bn2hex ( const BIGNUM * a ) ;
char * BN_bn2dec ( const BIGNUM * a ) ;
int BN_hex2bn ( BIGNUM * * a , const char * str ) ;
int BN_dec2bn ( BIGNUM * * a , const char * str ) ;
int BN_asc2bn ( BIGNUM * * a , const char * str ) ;
int BN_gcd ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ;
int BN_kronecker ( const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ;
BIGNUM * BN_mod_inverse ( BIGNUM * ret , const BIGNUM * a , const BIGNUM * n , BN_CTX * ctx ) ;
BIGNUM * BN_mod_sqrt ( BIGNUM * ret , const BIGNUM * a , const BIGNUM * n , BN_CTX * ctx ) ;
void BN_consttime_swap ( BN_ULONG swap , BIGNUM * a , BIGNUM * b , int nwords ) ;
# ifndef OPENSSL_NO_DEPRECATED BIGNUM * BN_generate_prime ( BIGNUM * ret , int bits , int safe , const BIGNUM * add , const BIGNUM * rem , void ( * callback ) ( int , int , void * ) , void * cb_arg ) ;
int BN_is_prime ( const BIGNUM * p , int nchecks , void ( * callback ) ( int , int , void * ) , BN_CTX * ctx , void * cb_arg ) ;
int BN_is_prime_fasttest ( const BIGNUM * p , int nchecks , void ( * callback ) ( int , int , void * ) , BN_CTX * ctx , void * cb_arg , int do_trial_division ) ;
# endif int BN_generate_prime_ex ( BIGNUM * ret , int bits , int safe , const BIGNUM * add , const BIGNUM * rem , BN_GENCB * cb ) ;
int BN_is_prime_ex ( const BIGNUM * p , int nchecks , BN_CTX * ctx , BN_GENCB * cb ) ;
int BN_is_prime_fasttest_ex ( const BIGNUM * p , int nchecks , BN_CTX * ctx , int do_trial_division , BN_GENCB * cb ) ;
int BN_X931_generate_Xpq ( BIGNUM * Xp , BIGNUM * Xq , int nbits , BN_CTX * ctx ) ;
int BN_X931_derive_prime_ex ( BIGNUM * p , BIGNUM * p1 , BIGNUM * p2 , const BIGNUM * Xp , const BIGNUM * Xp1 , const BIGNUM * Xp2 , const BIGNUM * e , BN_CTX * ctx , BN_GENCB * cb ) ;
int BN_X931_generate_prime_ex ( BIGNUM * p , BIGNUM * p1 , BIGNUM * p2 , BIGNUM * Xp1 , BIGNUM * Xp2 , const BIGNUM * Xp , const BIGNUM * e , BN_CTX * ctx , BN_GENCB * cb ) ;
BN_MONT_CTX * BN_MONT_CTX_new ( void ) ;
void BN_MONT_CTX_init ( BN_MONT_CTX * ctx ) ;
int BN_mod_mul_montgomery ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_MONT_CTX * mont , BN_CTX * ctx ) ;
# define BN_to_montgomery ( r , a , mont , ctx ) BN_mod_mul_montgomery ( \ ( r ) , ( a ) , & ( ( mont ) -> RR ) , ( mont ) , ( ctx ) ) int BN_from_montgomery ( BIGNUM * r , const BIGNUM * a , BN_MONT_CTX * mont , BN_CTX * ctx ) ;
void BN_MONT_CTX_free ( BN_MONT_CTX * mont ) ;
int BN_MONT_CTX_set ( BN_MONT_CTX * mont , const BIGNUM * mod , BN_CTX * ctx ) ;
BN_MONT_CTX * BN_MONT_CTX_copy ( BN_MONT_CTX * to , BN_MONT_CTX * from ) ;
BN_MONT_CTX * BN_MONT_CTX_set_locked ( BN_MONT_CTX * * pmont , int lock , const BIGNUM * mod , BN_CTX * ctx ) ;
# define BN_BLINDING_NO_UPDATE 0x00000001 # define BN_BLINDING_NO_RECREATE 0x00000002 BN_BLINDING * BN_BLINDING_new ( const BIGNUM * A , const BIGNUM * Ai , BIGNUM * mod ) ;
void BN_BLINDING_free ( BN_BLINDING * b ) ;
int BN_BLINDING_update ( BN_BLINDING * b , BN_CTX * ctx ) ;
int BN_BLINDING_convert ( BIGNUM * n , BN_BLINDING * b , BN_CTX * ctx ) ;
int BN_BLINDING_invert ( BIGNUM * n , BN_BLINDING * b , BN_CTX * ctx ) ;
int BN_BLINDING_convert_ex ( BIGNUM * n , BIGNUM * r , BN_BLINDING * b , BN_CTX * ) ;
int BN_BLINDING_invert_ex ( BIGNUM * n , const BIGNUM * r , BN_BLINDING * b , BN_CTX * ) ;
# ifndef OPENSSL_NO_DEPRECATED unsigned long BN_BLINDING_get_thread_id ( const BN_BLINDING * ) ;
void BN_BLINDING_set_thread_id ( BN_BLINDING * , unsigned long ) ;
# endif CRYPTO_THREADID * BN_BLINDING_thread_id ( BN_BLINDING * ) ;
unsigned long BN_BLINDING_get_flags ( const BN_BLINDING * ) ;
void BN_BLINDING_set_flags ( BN_BLINDING * , unsigned long ) ;
BN_BLINDING * BN_BLINDING_create_param ( BN_BLINDING * b , const BIGNUM * e , BIGNUM * m , BN_CTX * ctx , int ( * bn_mod_exp ) ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) , BN_MONT_CTX * m_ctx ) ;
# ifndef OPENSSL_NO_DEPRECATED void BN_set_params ( int mul , int high , int low , int mont ) ;
int BN_get_params ( int which ) ;
# endif void BN_RECP_CTX_init ( BN_RECP_CTX * recp ) ;
BN_RECP_CTX * BN_RECP_CTX_new ( void ) ;
void BN_RECP_CTX_free ( BN_RECP_CTX * recp ) ;
int BN_RECP_CTX_set ( BN_RECP_CTX * recp , const BIGNUM * rdiv , BN_CTX * ctx ) ;
int BN_mod_mul_reciprocal ( BIGNUM * r , const BIGNUM * x , const BIGNUM * y , BN_RECP_CTX * recp , BN_CTX * ctx ) ;
int BN_mod_exp_recp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_div_recp ( BIGNUM * dv , BIGNUM * rem , const BIGNUM * m , BN_RECP_CTX * recp , BN_CTX * ctx ) ;
# ifndef OPENSSL_NO_EC2M int BN_GF2m_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
# define BN_GF2m_sub ( r , a , b ) BN_GF2m_add ( r , a , b ) int BN_GF2m_mod ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p ) ;
int BN_GF2m_mod_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_sqr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_inv ( BIGNUM * r , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_div ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_exp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_sqrt ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_solve_quad ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
# define BN_GF2m_cmp ( a , b ) BN_ucmp ( ( a ) , ( b ) ) int BN_GF2m_mod_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] ) ;
int BN_GF2m_mod_mul_arr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_sqr_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_inv_arr ( BIGNUM * r , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_div_arr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_exp_arr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_sqrt_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_solve_quad_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_poly2arr ( const BIGNUM * a , int p [ ] , int max ) ;
int BN_GF2m_arr2poly ( const int p [ ] , BIGNUM * a ) ;
# endif int BN_nist_mod_192 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_nist_mod_224 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_nist_mod_256 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_nist_mod_384 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_nist_mod_521 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
const BIGNUM * BN_get0_nist_prime_192 ( void ) ;
const BIGNUM * BN_get0_nist_prime_224 ( void ) ;
const BIGNUM * BN_get0_nist_prime_256 ( void ) ;
const BIGNUM * BN_get0_nist_prime_384 ( void ) ;
const BIGNUM * BN_get0_nist_prime_521 ( void ) ;
int ( * BN_nist_mod_func ( const BIGNUM * p ) ) ( BIGNUM * r , const BIGNUM * a , const BIGNUM * field , BN_CTX * ctx ) ;
int BN_generate_dsa_nonce ( BIGNUM * out , const BIGNUM * range , const BIGNUM * priv , const unsigned char * message , size_t message_len , BN_CTX * ctx ) ;
# define bn_expand ( a , bits ) ( ( ( ( ( ( bits + BN_BITS2 - 1 ) ) / BN_BITS2 ) ) <= ( a ) -> dmax ) ? \ ( a ) : bn_expand2 ( ( a ) , ( bits + BN_BITS2 - 1 ) / BN_BITS2 ) ) # define bn_wexpand ( a , words ) ( ( ( words ) <= ( a ) -> dmax ) ? ( a ) : bn_expand2 ( ( a ) , ( words ) ) ) BIGNUM * bn_expand2 ( BIGNUM * a , int words ) ;
# ifndef OPENSSL_NO_DEPRECATED BIGNUM * bn_dup_expand ( const BIGNUM * a , int words ) ;
# endif # ifdef BN_DEBUG # include < assert . h > # ifdef BN_DEBUG_RAND # ifndef RAND_pseudo_bytes int RAND_pseudo_bytes ( unsigned char * buf , int num ) ;
# define BN_DEBUG_TRIX # endif # define bn_pollute ( a ) \ do {
\ const BIGNUM * _bnum1 = ( a ) ;
\ if ( _bnum1 -> top < _bnum1 -> dmax ) {
\ unsigned char _tmp_char ;
\ \ BN_ULONG * _not_const ;
\ memcpy ( & _not_const , & _bnum1 -> d , sizeof ( BN_ULONG * ) ) ;
\ RAND_pseudo_bytes ( & _tmp_char , 1 ) ;
\ memset ( ( unsigned char * ) ( _not_const + _bnum1 -> top ) , _tmp_char , \ ( _bnum1 -> dmax - _bnum1 -> top ) * sizeof ( BN_ULONG ) ) ;
\ }
\ }
while ( 0 ) # ifdef BN_DEBUG_TRIX # undef RAND_pseudo_bytes # endif # else # define bn_pollute ( a ) # endif # define bn_check_top ( a ) \ do {
\ const BIGNUM * _bnum2 = ( a ) ;
\ if ( _bnum2 != NULL ) {
\ assert ( ( _bnum2 -> top == 0 ) || \ ( _bnum2 -> d [ _bnum2 -> top - 1 ] != 0 ) ) ;
\ bn_pollute ( _bnum2 ) ;
\ }
\ }
while ( 0 ) # define bn_fix_top ( a ) bn_check_top ( a ) # define bn_check_size ( bn , bits ) bn_wcheck_size ( bn , ( ( bits + BN_BITS2 - 1 ) ) / BN_BITS2 ) # define bn_wcheck_size ( bn , words ) \ do {
\ const BIGNUM * _bnum2 = ( bn ) ;
\ assert ( words <= ( _bnum2 ) -> dmax && words >= ( _bnum2 ) -> top ) ;
\ }
while ( 0 ) # else # define bn_pollute ( a ) # define bn_check_top ( a ) # define bn_fix_top ( a ) bn_correct_top ( a ) # define bn_check_size ( bn , bits ) # define bn_wcheck_size ( bn , words ) # endif # define bn_correct_top ( a ) \ {
\ BN_ULONG * ftl ;
\ int tmp_top = ( a ) -> top ;
\ if ( tmp_top > 0 ) \ {
\ for ( ftl = & ( ( a ) -> d [ tmp_top - 1 ] ) ;
tmp_top > 0 ;
tmp_top -- ) \ if ( * ( ftl -- ) ) break ;
\ ( a ) -> top = tmp_top ;
\ }
\ bn_pollute ( a ) ;
\ }
BN_ULONG bn_mul_add_words ( BN_ULONG * rp , const BN_ULONG * ap , int num , BN_ULONG w ) ;
BN_ULONG bn_mul_words ( BN_ULONG * rp , const BN_ULONG * ap , int num , BN_ULONG w ) ;
void bn_sqr_words ( BN_ULONG * rp , const BN_ULONG * ap , int num ) ;
BN_ULONG bn_div_words ( BN_ULONG h , BN_ULONG l , BN_ULONG d ) ;
BN_ULONG bn_add_words ( BN_ULONG * rp , const BN_ULONG * ap , const BN_ULONG * bp , int num ) ;
BN_ULONG bn_sub_words ( BN_ULONG * rp , const BN_ULONG * ap , const BN_ULONG * bp , int num )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gchar * pk_transaction_get_content_type_for_file ( const gchar * filename , GError * * error ) {
g_autoptr ( GError ) error_local = NULL ;
g_autoptr ( GFile ) file = NULL ;
g_autoptr ( GFileInfo ) info = NULL ;
file = g_file_new_for_path ( filename ) ;
info = g_file_query_info ( file , "standard::content-type" , G_FILE_QUERY_INFO_NONE , NULL , & error_local ) ;
if ( info == NULL ) {
g_set_error ( error , 1 , 0 , "failed to get file attributes for %s: %s" , filename , error_local -> message ) ;
return NULL ;
}
return g_file_info_get_attribute_as_string ( info , "standard::content-type" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void free_picture ( MpegEncContext * s , Picture * pic ) {
int i ;
if ( pic -> f . data [ 0 ] && pic -> f . type != FF_BUFFER_TYPE_SHARED ) {
free_frame_buffer ( s , pic ) ;
}
av_freep ( & pic -> mb_var ) ;
av_freep ( & pic -> mc_mb_var ) ;
av_freep ( & pic -> mb_mean ) ;
av_freep ( & pic -> f . mbskip_table ) ;
av_freep ( & pic -> qscale_table_base ) ;
pic -> f . qscale_table = NULL ;
av_freep ( & pic -> mb_type_base ) ;
pic -> f . mb_type = NULL ;
av_freep ( & pic -> f . dct_coeff ) ;
av_freep ( & pic -> f . pan_scan ) ;
pic -> f . mb_type = NULL ;
for ( i = 0 ;
i < 2 ;
i ++ ) {
av_freep ( & pic -> motion_val_base [ i ] ) ;
av_freep ( & pic -> f . ref_index [ i ] ) ;
pic -> f . motion_val [ i ] = NULL ;
}
if ( pic -> f . type == FF_BUFFER_TYPE_SHARED ) {
for ( i = 0 ;
i < 4 ;
i ++ ) {
pic -> f . base [ i ] = pic -> f . data [ i ] = NULL ;
}
pic -> f . type = 0 ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static VALUE ossl_asn1_ ## klass ( int argc , VALUE * argv , VALUE self ) \ {
return rb_funcall3 ( cASN1 ## klass , rb_intern ( "new" ) , argc , argv ) ;
}
OSSL_ASN1_IMPL_FACTORY_METHOD ( Boolean ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Integer ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Enumerated ) OSSL_ASN1_IMPL_FACTORY_METHOD ( BitString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( OctetString )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
err_status_t srtp_install_event_handler ( srtp_event_handler_func_t func ) {
srtp_event_handler = func ;
return err_status_ok ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
tdata_t _TIFFmalloc ( tsize_t s ) {
if ( s == 0 ) return ( ( void * ) NULL ) ;
return ( malloc ( ( size_t ) s ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * name ## _get_name ( void * ctx ) \ {
return # name ;
\ }
static const AVClass name ## _class = {
. class_name = # name , . item_name = name ## _get_name , . option = name ## _options \ }
typedef struct DefaultContext {
const AVClass * class ;
int nokey ;
int noprint_wrappers ;
int nested_section [ SECTION_MAX_NB_LEVELS ] ;
}
DefaultContext ;
# undef OFFSET # define OFFSET ( x ) offsetof ( DefaultContext , x ) static const AVOption default_options [ ] = {
{
"noprint_wrappers" , "do not print headers and footers" , OFFSET ( noprint_wrappers ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"nw" , "do not print headers and footers" , OFFSET ( noprint_wrappers ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"nokey" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"nk" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
NULL }
, }
;
DEFINE_WRITER_CLASS ( default ) ;
static inline char * upcase_string ( char * dst , size_t dst_size , const char * src ) {
int i ;
for ( i = 0 ;
src [ i ] && i < dst_size - 1 ;
i ++ ) dst [ i ] = av_toupper ( src [ i ] ) ;
dst [ i ] = 0 ;
return dst ;
}
static void default_print_section_header ( WriterContext * wctx ) {
DefaultContext * def = wctx -> priv ;
char buf [ 32 ] ;
const struct section * section = wctx -> section [ wctx -> level ] ;
const struct section * parent_section = wctx -> level ? wctx -> section [ wctx -> level - 1 ] : NULL ;
av_bprint_clear ( & wctx -> section_pbuf [ wctx -> level ] ) ;
if ( parent_section && ! ( parent_section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) {
def -> nested_section [ wctx -> level ] = 1 ;
av_bprintf ( & wctx -> section_pbuf [ wctx -> level ] , "%s%s:" , wctx -> section_pbuf [ wctx -> level - 1 ] . str , upcase_string ( buf , sizeof ( buf ) , av_x_if_null ( section -> element_name , section -> name ) ) ) ;
}
if ( def -> noprint_wrappers || def -> nested_section [ wctx -> level ] ) return ;
if ( ! ( section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) printf ( "[%s]\n" , upcase_string ( buf , sizeof ( buf ) , section -> name ) ) ;
}
static void default_print_section_footer ( WriterContext * wctx ) {
DefaultContext * def = wctx -> priv ;
const struct section * section = wctx -> section [ wctx -> level ] ;
char buf [ 32 ] ;
if ( def -> noprint_wrappers || def -> nested_section [ wctx -> level ] ) return ;
if ( ! ( section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) printf ( "[/%s]\n" , upcase_string ( buf , sizeof ( buf ) , section -> name ) ) ;
}
static void default_print_str ( WriterContext * wctx , const char * key , const char * value ) {
DefaultContext * def = wctx -> priv ;
if ( ! def -> nokey ) printf ( "%s%s=" , wctx -> section_pbuf [ wctx -> level ] . str , key ) ;
printf ( "%s\n" , value ) ;
}
static void default_print_int ( WriterContext * wctx , const char * key , long long int value ) {
DefaultContext * def = wctx -> priv ;
if ( ! def -> nokey ) printf ( "%s%s=" , wctx -> section_pbuf [ wctx -> level ] . str , key ) ;
printf ( "%lld\n" , value ) ;
}
static const Writer default_writer = {
. name = "default" , . priv_size = sizeof ( DefaultContext ) , . print_section_header = default_print_section_header , . print_section_footer = default_print_section_footer , . print_integer = default_print_int , . print_string = default_print_str , . flags = WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS , . priv_class = & default_class , }
;
static const char * c_escape_str ( AVBPrint * dst , const char * src , const char sep , void * log_ctx ) {
const char * p ;
for ( p = src ;
* p ;
p ++ ) {
switch ( * p ) {
case '\b' : av_bprintf ( dst , "%s" , "\\b" ) ;
break ;
case '\f' : av_bprintf ( dst , "%s" , "\\f" ) ;
break ;
case '\n' : av_bprintf ( dst , "%s" , "\\n" ) ;
break ;
case '\r' : av_bprintf ( dst , "%s" , "\\r" ) ;
break ;
case '\\' : av_bprintf ( dst , "%s" , "\\\\" ) ;
break ;
default : if ( * p == sep ) av_bprint_chars ( dst , '\\' , 1 ) ;
av_bprint_chars ( dst , * p , 1 ) ;
}
}
return dst -> str ;
}
static const char * csv_escape_str ( AVBPrint * dst , const char * src , const char sep , void * log_ctx ) {
char meta_chars [ ] = {
sep , '"' , '\n' , '\r' , '\0' }
;
int needs_quoting = ! ! src [ strcspn ( src , meta_chars ) ] ;
if ( needs_quoting ) av_bprint_chars ( dst , '"' , 1 ) ;
for ( ;
* src ;
src ++ ) {
if ( * src == '"' ) av_bprint_chars ( dst , '"' , 1 ) ;
av_bprint_chars ( dst , * src , 1 ) ;
}
if ( needs_quoting ) av_bprint_chars ( dst , '"' , 1 ) ;
return dst -> str ;
}
static const char * none_escape_str ( AVBPrint * dst , const char * src , const char sep , void * log_ctx ) {
return src ;
}
typedef struct CompactContext {
const AVClass * class ;
char * item_sep_str ;
char item_sep ;
int nokey ;
int print_section ;
char * escape_mode_str ;
const char * ( * escape_str ) ( AVBPrint * dst , const char * src , const char sep , void * log_ctx ) ;
int nested_section [ SECTION_MAX_NB_LEVELS ] ;
int has_nested_elems [ SECTION_MAX_NB_LEVELS ] ;
int terminate_line [ SECTION_MAX_NB_LEVELS ] ;
}
CompactContext ;
# undef OFFSET # define OFFSET ( x ) offsetof ( CompactContext , x ) static const AVOption compact_options [ ] = {
{
"item_sep" , "set item separator" , OFFSET ( item_sep_str ) , AV_OPT_TYPE_STRING , {
. str = "|" }
, CHAR_MIN , CHAR_MAX }
, {
"s" , "set item separator" , OFFSET ( item_sep_str ) , AV_OPT_TYPE_STRING , {
. str = "|" }
, CHAR_MIN , CHAR_MAX }
, {
"nokey" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"nk" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"escape" , "set escape mode" , OFFSET ( escape_mode_str ) , AV_OPT_TYPE_STRING , {
. str = "c" }
, CHAR_MIN , CHAR_MAX }
, {
"e" , "set escape mode" , OFFSET ( escape_mode_str ) , AV_OPT_TYPE_STRING , {
. str = "c" }
, CHAR_MIN , CHAR_MAX }
, {
"print_section" , "print section name" , OFFSET ( print_section ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
"p" , "print section name" , OFFSET ( print_section ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
NULL }
, }
;
DEFINE_WRITER_CLASS ( compact ) ;
static av_cold int compact_init ( WriterContext * wctx ) {
CompactContext * compact = wctx -> priv ;
if ( strlen ( compact -> item_sep_str ) != 1 ) {
av_log ( wctx , AV_LOG_ERROR , "Item separator '%s' specified, but must contain a single character\n" , compact -> item_sep_str ) ;
return AVERROR ( EINVAL ) ;
}
compact -> item_sep = compact -> item_sep_str [ 0 ] ;
if ( ! strcmp ( compact -> escape_mode_str , "none" ) ) compact -> escape_str = none_escape_str ;
else if ( ! strcmp ( compact -> escape_mode_str , "c" ) ) compact -> escape_str = c_escape_str ;
else if ( ! strcmp ( compact -> escape_mode_str , "csv" ) ) compact -> escape_str = csv_escape_str ;
else {
av_log ( wctx , AV_LOG_ERROR , "Unknown escape mode '%s'\n" , compact -> escape_mode_str ) ;
return AVERROR ( EINVAL ) ;
}
return 0 ;
}
static void compact_print_section_header ( WriterContext * wctx ) {
CompactContext * compact = wctx -> priv ;
const struct section * section = wctx -> section [ wctx -> level ] ;
const struct section * parent_section = wctx -> level ? wctx -> section [ wctx -> level - 1 ] : NULL ;
compact -> terminate_line [ wctx -> level ] = 1 ;
compact -> has_nested_elems [ wctx -> level ] = 0 ;
av_bprint_clear ( & wctx -> section_pbuf [ wctx -> level ] ) ;
if ( ! ( section -> flags & SECTION_FLAG_IS_ARRAY ) && parent_section && ! ( parent_section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) {
compact -> nested_section [ wctx -> level ] = 1 ;
compact -> has_nested_elems [ wctx -> level - 1 ] = 1 ;
av_bprintf ( & wctx -> section_pbuf [ wctx -> level ] , "%s%s:" , wctx -> section_pbuf [ wctx -> level - 1 ] . str , ( char * ) av_x_if_null ( section -> element_name , section -> name ) ) ;
wctx -> nb_item [ wctx -> level ] = wctx -> nb_item [ wctx -> level - 1 ] ;
}
else {
if ( parent_section && compact -> has_nested_elems [ wctx -> level - 1 ] && ( section -> flags & SECTION_FLAG_IS_ARRAY ) ) {
compact -> terminate_line [ wctx -> level - 1 ] = 0 ;
printf ( "\n" ) ;
}
if ( compact -> print_section && ! ( section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) printf ( "%s%c" , section -> name , compact -> item_sep ) ;
}
}
static void compact_print_section_footer ( WriterContext * wctx ) {
CompactContext * compact = wctx -> priv ;
if ( ! compact -> nested_section [ wctx -> level ] && compact -> terminate_line [ wctx -> level ] && ! ( wctx -> section [ wctx -> level ] -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) printf ( "\n" ) ;
}
static void compact_print_str ( WriterContext * wctx , const char * key , const char * value ) {
CompactContext * compact = wctx -> priv ;
AVBPrint buf ;
if ( wctx -> nb_item [ wctx -> level ] ) printf ( "%c" , compact -> item_sep ) ;
if ( ! compact -> nokey ) printf ( "%s%s=" , wctx -> section_pbuf [ wctx -> level ] . str , key ) ;
av_bprint_init ( & buf , 1 , AV_BPRINT_SIZE_UNLIMITED ) ;
printf ( "%s" , compact -> escape_str ( & buf , value , compact -> item_sep , wctx ) ) ;
av_bprint_finalize ( & buf , NULL ) ;
}
static void compact_print_int ( WriterContext * wctx , const char * key , long long int value ) {
CompactContext * compact = wctx -> priv ;
if ( wctx -> nb_item [ wctx -> level ] ) printf ( "%c" , compact -> item_sep ) ;
if ( ! compact -> nokey ) printf ( "%s%s=" , wctx -> section_pbuf [ wctx -> level ] . str , key ) ;
printf ( "%lld" , value ) ;
}
static const Writer compact_writer = {
. name = "compact" , . priv_size = sizeof ( CompactContext ) , . init = compact_init , . print_section_header = compact_print_section_header , . print_section_footer = compact_print_section_footer , . print_integer = compact_print_int , . print_string = compact_print_str , . flags = WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS , . priv_class = & compact_class , }
;
# undef OFFSET # define OFFSET ( x ) offsetof ( CompactContext , x ) static const AVOption csv_options [ ] = {
{
"item_sep" , "set item separator" , OFFSET ( item_sep_str ) , AV_OPT_TYPE_STRING , {
. str = "," }
, CHAR_MIN , CHAR_MAX }
, {
"s" , "set item separator" , OFFSET ( item_sep_str ) , AV_OPT_TYPE_STRING , {
. str = "," }
, CHAR_MIN , CHAR_MAX }
, {
"nokey" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
"nk" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
"escape" , "set escape mode" , OFFSET ( escape_mode_str ) , AV_OPT_TYPE_STRING , {
. str = "csv" }
, CHAR_MIN , CHAR_MAX }
, {
"e" , "set escape mode" , OFFSET ( escape_mode_str ) , AV_OPT_TYPE_STRING , {
. str = "csv" }
, CHAR_MIN , CHAR_MAX }
, {
"print_section" , "print section name" , OFFSET ( print_section ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
"p" , "print section name" , OFFSET ( print_section ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
NULL }
, }
;
DEFINE_WRITER_CLASS ( csv ) ;
static const Writer csv_writer = {
. name = "csv" , . priv_size = sizeof ( CompactContext ) , . init = compact_init , . print_section_header = compact_print_section_header , . print_section_footer = compact_print_section_footer , . print_integer = compact_print_int , . print_string = compact_print_str , . flags = WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS , . priv_class = & csv_class , }
;
typedef struct FlatContext {
const AVClass * class ;
const char * sep_str ;
char sep ;
int hierarchical ;
}
FlatContext ;
# undef OFFSET # define OFFSET ( x ) offsetof ( FlatContext , x ) static const AVOption flat_options [ ] = {
{
"sep_char" , "set separator" , OFFSET ( sep_str ) , AV_OPT_TYPE_STRING , {
. str = "." }
, CHAR_MIN , CHAR_MAX }
, {
"s" , "set separator" , OFFSET ( sep_str ) , AV_OPT_TYPE_STRING , {
. str = "." }
, CHAR_MIN , CHAR_MAX }
, {
"hierarchical" , "specify if the section specification should be hierarchical" , OFFSET ( hierarchical ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
"h" , "specify if the section specification should be hierarchical" , OFFSET ( hierarchical ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
NULL }
, }
;
DEFINE_WRITER_CLASS ( flat ) ;
static av_cold int flat_init ( WriterContext * wctx ) {
FlatContext * flat = wctx -> priv ;
if ( strlen ( flat -> sep_str ) != 1 ) {
av_log ( wctx , AV_LOG_ERROR , "Item separator '%s' specified, but must contain a single character\n" , flat -> sep_str ) ;
return AVERROR ( EINVAL ) ;
}
flat -> sep = flat -> sep_str [ 0 ] ;
return 0 ;
}
static const char * flat_escape_key_str ( AVBPrint * dst , const char * src , const char sep ) {
const char * p ;
for ( p = src ;
* p ;
p ++ ) {
if ( ! ( ( * p >= '0' && * p <= '9' ) || ( * p >= 'a' && * p <= 'z' ) || ( * p >= 'A' && * p <= 'Z' ) ) ) av_bprint_chars ( dst , '_' , 1 ) ;
else av_bprint_chars ( dst , * p , 1 ) ;
}
return dst -> str ;
}
static const char * flat_escape_value_str ( AVBPrint * dst , const char * src ) {
const char * p ;
for ( p = src ;
* p ;
p ++ ) {
switch ( * p ) {
case '\n' : av_bprintf ( dst , "%s" , "\\n" ) ;
break ;
case '\r' : av_bprintf ( dst , "%s" , "\\r" ) ;
break ;
case '\\' : av_bprintf ( dst , "%s" , "\\\\" ) ;
break ;
case '"' : av_bprintf ( dst , "%s" , "\\\"" ) ;
break ;
case '`' : av_bprintf ( dst , "%s" , "\\`" ) ;
break ;
case '$' : av_bprintf ( dst , "%s" , "\\$" ) ;
break ;
default : av_bprint_chars ( dst , * p , 1 ) ;
break ;
}
}
return dst -> str ;
}
static void flat_print_section_header ( WriterContext * wctx ) {
FlatContext * flat = wctx -> priv ;
AVBPrint * buf = & wctx -> section_pbuf [ wctx -> level ] ;
const struct section * section = wctx -> section [ wctx -> level ] ;
const struct section * parent_section = wctx -> level ? wctx -> section [ wctx -> level - 1 ] : NULL ;
av_bprint_clear ( buf ) ;
if ( ! parent_section ) return ;
av_bprintf ( buf , "%s" , wctx -> section_pbuf [ wctx -> level - 1 ] . str ) ;
if ( flat -> hierarchical || ! ( section -> flags & ( SECTION_FLAG_IS_ARRAY | SECTION_FLAG_IS_WRAPPER ) ) ) {
av_bprintf ( buf , "%s%s" , wctx -> section [ wctx -> level ] -> name , flat -> sep_str ) ;
if ( parent_section -> flags & SECTION_FLAG_IS_ARRAY ) {
int n = parent_section -> id == SECTION_ID_PACKETS_AND_FRAMES ? wctx -> nb_section_packet_frame : wctx -> nb_item [ wctx -> level - 1 ] ;
av_bprintf ( buf , "%d%s" , n , flat -> sep_str ) ;
}
}
}
static void flat_print_int ( WriterContext * wctx , const char * key , long long int value ) {
printf ( "%s%s=%lld\n" , wctx -> section_pbuf [ wctx -> level ] . str , key , value ) ;
}
static void flat_print_str ( WriterContext * wctx , const char * key , const char * value ) {
FlatContext * flat = wctx -> priv ;
AVBPrint buf ;
printf ( "%s" , wctx -> section_pbuf [ wctx -> level ] . str ) ;
av_bprint_init ( & buf , 1 , AV_BPRINT_SIZE_UNLIMITED ) ;
printf ( "%s=" , flat_escape_key_str ( & buf , key , flat -> sep ) ) ;
av_bprint_clear ( & buf ) ;
printf ( "\"%s\"\n" , flat_escape_value_str ( & buf , value ) ) ;
av_bprint_finalize ( & buf , NULL ) ;
}
static const Writer flat_writer = {
. name = "flat" , . priv_size = sizeof ( FlatContext ) , . init = flat_init , . print_section_header = flat_print_section_header , . print_integer = flat_print_int , . print_string = flat_print_str , . flags = WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS | WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER , . priv_class = & flat_class , }
;
typedef struct INIContext {
const AVClass * class ;
int hierarchical ;
}
INIContext ;
# undef OFFSET # define OFFSET ( x ) offsetof ( INIContext , x ) static const AVOption ini_options [ ] = {
{
"hierarchical" , "specify if the section specification should be hierarchical" , OFFSET ( hierarchical ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
"h" , "specify if the section specification should be hierarchical" , OFFSET ( hierarchical ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
NULL }
, }
;
DEFINE_WRITER_CLASS ( ini ) ;
static char * ini_escape_str ( AVBPrint * dst , const char * src ) {
int i = 0 ;
char c = 0 ;
while ( c = src [ i ++ ] ) {
switch ( c ) {
case '\b' : av_bprintf ( dst , "%s" , "\\b" ) ;
break ;
case '\f' : av_bprintf ( dst , "%s" , "\\f" ) ;
break ;
case '\n' : av_bprintf ( dst , "%s" , "\\n" ) ;
break ;
case '\r' : av_bprintf ( dst , "%s" , "\\r" ) ;
break ;
case '\t' : av_bprintf ( dst , "%s" , "\\t" ) ;
break ;
case '\\' : case '#' : case '=' : case ':' : av_bprint_chars ( dst , '\\' , 1 ) ;
default : if ( ( unsigned char ) c < 32 ) av_bprintf ( dst , "\\x00%02x" , c & 0xff ) ;
else av_bprint_chars ( dst , c , 1 ) ;
break ;
}
}
return dst -> str ;
}
static void ini_print_section_header ( WriterContext * wctx ) {
INIContext * ini = wctx -> priv ;
AVBPrint * buf = & wctx -> section_pbuf [ wctx -> level ] ;
const struct section * section = wctx -> section [ wctx -> level ] ;
const struct section * parent_section = wctx -> level ? wctx -> section [ wctx -> level - 1 ] : NULL ;
av_bprint_clear ( buf ) ;
if ( ! parent_section ) {
printf ( "# ffprobe output\n\n" ) ;
return ;
}
if ( wctx -> nb_item [ wctx -> level - 1 ] ) printf ( "\n" ) ;
av_bprintf ( buf , "%s" , wctx -> section_pbuf [ wctx -> level - 1 ] . str ) ;
if ( ini -> hierarchical || ! ( section -> flags & ( SECTION_FLAG_IS_ARRAY | SECTION_FLAG_IS_WRAPPER ) ) ) {
av_bprintf ( buf , "%s%s" , buf -> str [ 0 ] ? "." : "" , wctx -> section [ wctx -> level ] -> name ) ;
if ( parent_section -> flags & SECTION_FLAG_IS_ARRAY ) {
int n = parent_section -> id == SECTION_ID_PACKETS_AND_FRAMES ? wctx -> nb_section_packet_frame : wctx -> nb_item [ wctx -> level - 1 ] ;
av_bprintf ( buf , ".%d" , n ) ;
}
}
if ( ! ( section -> flags & ( SECTION_FLAG_IS_ARRAY | SECTION_FLAG_IS_WRAPPER ) ) ) printf ( "[%s]\n" , buf -> str ) ;
}
static void ini_print_str ( WriterContext * wctx , const char * key , const char * value ) {
AVBPrint buf ;
av_bprint_init ( & buf , 1 , AV_BPRINT_SIZE_UNLIMITED ) ;
printf ( "%s=" , ini_escape_str ( & buf , key ) ) ;
av_bprint_clear ( & buf ) ;
printf ( "%s\n" , ini_escape_str ( & buf , value ) ) ;
av_bprint_finalize ( & buf , NULL ) ;
}
static void ini_print_int ( WriterContext * wctx , const char * key , long long int value ) {
printf ( "%s=%lld\n" , key , value ) ;
}
static const Writer ini_writer = {
. name = "ini" , . priv_size = sizeof ( INIContext ) , . print_section_header = ini_print_section_header , . print_integer = ini_print_int , . print_string = ini_print_str , . flags = WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS | WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER , . priv_class = & ini_class , }
;
typedef struct JSONContext {
const AVClass * class ;
int indent_level ;
int compact ;
const char * item_sep , * item_start_end ;
}
JSONContext ;
# undef OFFSET # define OFFSET ( x ) offsetof ( JSONContext , x ) static const AVOption json_options [ ] = {
{
"compact" , "enable compact output" , OFFSET ( compact ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"c" , "enable compact output" , OFFSET ( compact ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
NULL }
}
;
DEFINE_WRITER_CLASS ( json ) ;
static av_cold int json_init ( WriterContext * wctx ) {
JSONContext * json = wctx -> priv ;
json -> item_sep = json -> compact ? ", " : ",\n" ;
json -> item_start_end = json -> compact ? " " : "\n" ;
return 0 ;
}
static const char * json_escape_str ( AVBPrint * dst , const char * src , void * log_ctx ) {
static const char json_escape [ ] = {
'"' , '\\' , '\b' , '\f' , '\n' , '\r' , '\t' , 0 }
;
static const char json_subst [ ] = {
'"' , '\\' , 'b' , 'f' , 'n' , 'r' , 't' , 0 }
;
const char * p ;
for ( p = src ;
* p ;
p ++ ) {
char * s = strchr ( json_escape , * p ) ;
if ( s ) {
av_bprint_chars ( dst , '\\' , 1 ) ;
av_bprint_chars ( dst , json_subst [ s - json_escape ] , 1 ) ;
}
else if ( ( unsigned char ) * p < 32 ) {
av_bprintf ( dst , "\\u00%02x" , * p & 0xff ) ;
}
else {
av_bprint_chars ( dst , * p , 1 ) ;
}
}
return dst -> str ;
}
# define JSON_INDENT ( ) printf ( "%*c" , json -> indent_level * 4 , ' ' ) static void json_print_section_header ( WriterContext * wctx ) {
JSONContext * json = wctx -> priv ;
AVBPrint buf ;
const struct section * section = wctx -> section [ wctx -> level ] ;
const struct section * parent_section = wctx -> level ? wctx -> section [ wctx -> level - 1 ] : NULL ;
if ( wctx -> level && wctx -> nb_item [ wctx -> level - 1 ] ) printf ( ",\n" ) ;
if ( section -> flags & SECTION_FLAG_IS_WRAPPER ) {
printf ( "{
\n" ) ;
json -> indent_level ++ ;
}
else {
av_bprint_init ( & buf , 1 , AV_BPRINT_SIZE_UNLIMITED ) ;
json_escape_str ( & buf , section -> name , wctx ) ;
JSON_INDENT ( ) ;
json -> indent_level ++ ;
if ( section -> flags & SECTION_FLAG_IS_ARRAY ) {
printf ( "\"%s\": [\n" , buf . str ) ;
}
else if ( parent_section && ! ( parent_section -> flags & SECTION_FLAG_IS_ARRAY ) ) {
printf ( "\"%s\": {
%s" , buf . str , json -> item_start_end ) ;
}
else {
printf ( "{
%s" , json -> item_start_end ) ;
if ( parent_section && parent_section -> id == SECTION_ID_PACKETS_AND_FRAMES ) {
if ( ! json -> compact ) JSON_INDENT ( ) ;
printf ( "\"type\": \"%s\"%s" , section -> name , json -> item_sep ) ;
}
}
av_bprint_finalize ( & buf , NULL ) ;
}
}
static void json_print_section_footer ( WriterContext * wctx ) {
JSONContext * json = wctx -> priv ;
const struct section * section = wctx -> section [ wctx -> level ] ;
if ( wctx -> level == 0 ) {
json -> indent_level -- ;
printf ( "\n}
\n" ) ;
}
else if ( section -> flags & SECTION_FLAG_IS_ARRAY ) {
printf ( "\n" ) ;
json -> indent_level -- ;
JSON_INDENT ( ) ;
printf ( "]" ) ;
}
else {
printf ( "%s" , json -> item_start_end ) ;
json -> indent_level -- ;
if ( ! json -> compact ) JSON_INDENT ( ) ;
printf ( "}
" ) ;
}
}
static inline void json_print_item_str ( WriterContext * wctx , const char * key , const char * value ) {
AVBPrint buf ;
av_bprint_init ( & buf , 1 , AV_BPRINT_SIZE_UNLIMITED ) ;
printf ( "\"%s\":" , json_escape_str ( & buf , key , wctx ) ) ;
av_bprint_clear ( & buf ) ;
printf ( " \"%s\"" , json_escape_str ( & buf , value , wctx ) ) ;
av_bprint_finalize ( & buf , NULL ) ;
}
static void json_print_str ( WriterContext * wctx , const char * key , const char * value ) {
JSONContext * json = wctx -> priv ;
if ( wctx -> nb_item [ wctx -> level ] ) printf ( "%s" , json -> item_sep ) ;
if ( ! json -> compact ) JSON_INDENT ( ) ;
json_print_item_str ( wctx , key , value ) ;
}
static void json_print_int ( WriterContext * wctx , const char * key , long long int value ) {
JSONContext * json = wctx -> priv ;
AVBPrint buf ;
if ( wctx -> nb_item [ wctx -> level ] ) printf ( "%s" , json -> item_sep ) ;
if ( ! json -> compact ) JSON_INDENT ( ) ;
av_bprint_init ( & buf , 1 , AV_BPRINT_SIZE_UNLIMITED ) ;
printf ( "\"%s\": %lld" , json_escape_str ( & buf , key , wctx ) , value ) ;
av_bprint_finalize ( & buf , NULL ) ;
}
static const Writer json_writer = {
. name = "json" , . priv_size = sizeof ( JSONContext ) , . init = json_init , . print_section_header = json_print_section_header , . print_section_footer = json_print_section_footer , . print_integer = json_print_int , . print_string = json_print_str , . flags = WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER , . priv_class = & json_class , }
;
typedef struct XMLContext {
const AVClass * class ;
int within_tag ;
int indent_level ;
int fully_qualified ;
int xsd_strict ;
}
XMLContext ;
# undef OFFSET # define OFFSET ( x ) offsetof ( XMLContext , x ) static const AVOption xml_options [ ] = {
{
"fully_qualified" , "specify if the output should be fully qualified" , OFFSET ( fully_qualified ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"q" , "specify if the output should be fully qualified" , OFFSET ( fully_qualified ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"xsd_strict" , "ensure that the output is XSD compliant" , OFFSET ( xsd_strict ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"x" , "ensure that the output is XSD compliant" , OFFSET ( xsd_strict ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
NULL }
, }
;
DEFINE_WRITER_CLASS ( xml )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
gcry_error_t gcry_mpi_scan ( struct gcry_mpi * * ret_mpi , enum gcry_mpi_format format , const void * buffer_arg , size_t buflen , size_t * nscanned ) {
const unsigned char * buffer = ( const unsigned char * ) buffer_arg ;
struct gcry_mpi * a = NULL ;
unsigned int len ;
int secure = ( buffer && gcry_is_secure ( buffer ) ) ;
if ( format == GCRYMPI_FMT_SSH ) len = 0 ;
else len = buflen ;
if ( format == GCRYMPI_FMT_STD ) {
const unsigned char * s = buffer ;
a = secure ? mpi_alloc_secure ( ( len + BYTES_PER_MPI_LIMB - 1 ) / BYTES_PER_MPI_LIMB ) : mpi_alloc ( ( len + BYTES_PER_MPI_LIMB - 1 ) / BYTES_PER_MPI_LIMB ) ;
if ( len ) {
a -> sign = ! ! ( * s & 0x80 ) ;
if ( a -> sign ) {
mpi_free ( a ) ;
return gcry_error ( GPG_ERR_INTERNAL ) ;
}
else _gcry_mpi_set_buffer ( a , s , len , 0 ) ;
}
if ( ret_mpi ) {
mpi_normalize ( a ) ;
* ret_mpi = a ;
}
else mpi_free ( a ) ;
return 0 ;
}
else if ( format == GCRYMPI_FMT_USG ) {
a = secure ? mpi_alloc_secure ( ( len + BYTES_PER_MPI_LIMB - 1 ) / BYTES_PER_MPI_LIMB ) : mpi_alloc ( ( len + BYTES_PER_MPI_LIMB - 1 ) / BYTES_PER_MPI_LIMB ) ;
if ( len ) _gcry_mpi_set_buffer ( a , buffer , len , 0 ) ;
if ( ret_mpi ) {
mpi_normalize ( a ) ;
* ret_mpi = a ;
}
else mpi_free ( a ) ;
return 0 ;
}
else if ( format == GCRYMPI_FMT_PGP ) {
a = mpi_read_from_buffer ( buffer , & len , secure ) ;
if ( nscanned ) * nscanned = len ;
if ( ret_mpi && a ) {
mpi_normalize ( a ) ;
* ret_mpi = a ;
}
else if ( a ) {
mpi_free ( a ) ;
a = NULL ;
}
return a ? 0 : gcry_error ( GPG_ERR_INV_OBJ ) ;
}
else if ( format == GCRYMPI_FMT_SSH ) {
const unsigned char * s = buffer ;
size_t n ;
if ( len && len < 4 ) return gcry_error ( GPG_ERR_TOO_SHORT ) ;
n = ( s [ 0 ] << 24 | s [ 1 ] << 16 | s [ 2 ] << 8 | s [ 3 ] ) ;
s += 4 ;
if ( len ) len -= 4 ;
if ( len && n > len ) return gcry_error ( GPG_ERR_TOO_LARGE ) ;
a = secure ? mpi_alloc_secure ( ( n + BYTES_PER_MPI_LIMB - 1 ) / BYTES_PER_MPI_LIMB ) : mpi_alloc ( ( n + BYTES_PER_MPI_LIMB - 1 ) / BYTES_PER_MPI_LIMB ) ;
if ( n ) {
a -> sign = ! ! ( * s & 0x80 ) ;
if ( a -> sign ) {
mpi_free ( a ) ;
return gcry_error ( GPG_ERR_INTERNAL ) ;
}
else _gcry_mpi_set_buffer ( a , s , n , 0 ) ;
}
if ( nscanned ) * nscanned = n + 4 ;
if ( ret_mpi ) {
mpi_normalize ( a ) ;
* ret_mpi = a ;
}
else mpi_free ( a ) ;
return 0 ;
}
else if ( format == GCRYMPI_FMT_HEX ) {
if ( buflen ) return gcry_error ( GPG_ERR_INV_ARG ) ;
a = secure ? mpi_alloc_secure ( 0 ) : mpi_alloc ( 0 ) ;
if ( mpi_fromstr ( a , ( const char * ) buffer ) ) {
mpi_free ( a ) ;
return gcry_error ( GPG_ERR_INV_OBJ ) ;
}
if ( ret_mpi ) {
mpi_normalize ( a ) ;
* ret_mpi = a ;
}
else mpi_free ( a ) ;
return 0 ;
}
else return gcry_error ( GPG_ERR_INV_ARG ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static TocEntry * get_next_work_item ( ArchiveHandle * AH , TocEntry * ready_list , ParallelState * pstate ) {
bool pref_non_data = false ;
TocEntry * data_te = NULL ;
TocEntry * te ;
int i , k ;
if ( pref_non_data ) {
int count = 0 ;
for ( k = 0 ;
k < pstate -> numWorkers ;
k ++ ) if ( pstate -> parallelSlot [ k ] . args -> te != NULL && pstate -> parallelSlot [ k ] . args -> te -> section == SECTION_DATA ) count ++ ;
if ( pstate -> numWorkers == 0 || count * 4 < pstate -> numWorkers ) pref_non_data = false ;
}
for ( te = ready_list -> par_next ;
te != ready_list ;
te = te -> par_next ) {
bool conflicts = false ;
for ( i = 0 ;
i < pstate -> numWorkers && ! conflicts ;
i ++ ) {
TocEntry * running_te ;
if ( pstate -> parallelSlot [ i ] . workerStatus != WRKR_WORKING ) continue ;
running_te = pstate -> parallelSlot [ i ] . args -> te ;
if ( has_lock_conflicts ( te , running_te ) || has_lock_conflicts ( running_te , te ) ) {
conflicts = true ;
break ;
}
}
if ( conflicts ) continue ;
if ( pref_non_data && te -> section == SECTION_DATA ) {
if ( data_te == NULL ) data_te = te ;
continue ;
}
return te ;
}
if ( data_te != NULL ) return data_te ;
ahlog ( AH , 2 , "no item ready\n" ) ;
return NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void load_config ( void ) {
switch ( su_mode ) {
case SU_MODE : logindefs_load_file ( _PATH_LOGINDEFS_SU ) ;
break ;
case RUNUSER_MODE : logindefs_load_file ( _PATH_LOGINDEFS_RUNUSER ) ;
break ;
}
logindefs_load_file ( _PATH_LOGINDEFS ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int scan ( Scanner * s ) {
uchar * cursor = s -> cur ;
char * str , * ptr = NULL ;
std : s -> tok = cursor ;
s -> len = 0 ;
# line 311 "ext/date/lib/parse_iso_intervals.re" # line 291 "ext/date/lib/parse_iso_intervals.c" {
YYCTYPE yych ;
unsigned int yyaccept = 0 ;
static const unsigned char yybm [ ] = {
0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 128 , 128 , 128 , 128 , 128 , 128 , 128 , 128 , 128 , 128 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , }
;
YYDEBUG ( 0 , * YYCURSOR ) ;
if ( ( YYLIMIT - YYCURSOR ) < 20 ) YYFILL ( 20 ) ;
yych = * YYCURSOR ;
if ( yych <= ',' ) {
if ( yych <= '\n' ) {
if ( yych <= 0x00 ) goto yy9 ;
if ( yych <= 0x08 ) goto yy11 ;
if ( yych <= '\t' ) goto yy7 ;
goto yy9 ;
}
else {
if ( yych == ' ' ) goto yy7 ;
if ( yych <= '+' ) goto yy11 ;
goto yy7 ;
}
}
else {
if ( yych <= 'O' ) {
if ( yych <= '-' ) goto yy11 ;
if ( yych <= '/' ) goto yy7 ;
if ( yych <= '9' ) goto yy4 ;
goto yy11 ;
}
else {
if ( yych <= 'P' ) goto yy5 ;
if ( yych != 'R' ) goto yy11 ;
}
}
YYDEBUG ( 2 , * YYCURSOR ) ;
++ YYCURSOR ;
if ( ( yych = * YYCURSOR ) <= '/' ) goto yy3 ;
if ( yych <= '9' ) goto yy98 ;
yy3 : YYDEBUG ( 3 , * YYCURSOR ) ;
# line 424 "ext/date/lib/parse_iso_intervals.re" {
add_error ( s , "Unexpected character" ) ;
goto std ;
}
# line 366 "ext/date/lib/parse_iso_intervals.c" yy4 : YYDEBUG ( 4 , * YYCURSOR ) ;
yyaccept = 0 ;
yych = * ( YYMARKER = ++ YYCURSOR ) ;
if ( yych <= '/' ) goto yy3 ;
if ( yych <= '9' ) goto yy59 ;
goto yy3 ;
yy5 : YYDEBUG ( 5 , * YYCURSOR ) ;
yyaccept = 1 ;
yych = * ( YYMARKER = ++ YYCURSOR ) ;
if ( yych <= '/' ) goto yy6 ;
if ( yych <= '9' ) goto yy12 ;
if ( yych == 'T' ) goto yy14 ;
yy6 : YYDEBUG ( 6 , * YYCURSOR ) ;
# line 351 "ext/date/lib/parse_iso_intervals.re" {
timelib_sll nr ;
int in_time = 0 ;
DEBUG_OUTPUT ( "period" ) ;
TIMELIB_INIT ;
ptr ++ ;
do {
if ( * ptr == 'T' ) {
in_time = 1 ;
ptr ++ ;
}
if ( * ptr == '\0' ) {
add_error ( s , "Missing expected time part" ) ;
break ;
}
nr = timelib_get_unsigned_nr ( ( char * * ) & ptr , 12 ) ;
switch ( * ptr ) {
case 'Y' : s -> period -> y = nr ;
break ;
case 'W' : s -> period -> d = nr * 7 ;
break ;
case 'D' : s -> period -> d = nr ;
break ;
case 'H' : s -> period -> h = nr ;
break ;
case 'S' : s -> period -> s = nr ;
break ;
case 'M' : if ( in_time ) {
s -> period -> i = nr ;
}
else {
s -> period -> m = nr ;
}
break ;
default : add_error ( s , "Undefined period specifier" ) ;
break ;
}
ptr ++ ;
}
while ( ! s -> errors -> error_count && * ptr ) ;
s -> have_period = 1 ;
TIMELIB_DEINIT ;
return TIMELIB_PERIOD ;
}
# line 424 "ext/date/lib/parse_iso_intervals.c" yy7 : YYDEBUG ( 7 , * YYCURSOR ) ;
++ YYCURSOR ;
YYDEBUG ( 8 , * YYCURSOR ) ;
# line 413 "ext/date/lib/parse_iso_intervals.re" {
goto std ;
}
# line 433 "ext/date/lib/parse_iso_intervals.c" yy9 : YYDEBUG ( 9 , * YYCURSOR ) ;
++ YYCURSOR ;
YYDEBUG ( 10 , * YYCURSOR ) ;
# line 418 "ext/date/lib/parse_iso_intervals.re" {
s -> pos = cursor ;
s -> line ++ ;
goto std ;
}
# line 443 "ext/date/lib/parse_iso_intervals.c" yy11 : YYDEBUG ( 11 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
goto yy3 ;
yy12 : YYDEBUG ( 12 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= 'L' ) {
if ( yych <= '9' ) {
if ( yych >= '0' ) goto yy25 ;
}
else {
if ( yych == 'D' ) goto yy24 ;
}
}
else {
if ( yych <= 'W' ) {
if ( yych <= 'M' ) goto yy27 ;
if ( yych >= 'W' ) goto yy26 ;
}
else {
if ( yych == 'Y' ) goto yy28 ;
}
}
yy13 : YYDEBUG ( 13 , * YYCURSOR ) ;
YYCURSOR = YYMARKER ;
if ( yyaccept <= 0 ) {
goto yy3 ;
}
else {
goto yy6 ;
}
yy14 : YYDEBUG ( 14 , * YYCURSOR ) ;
yyaccept = 1 ;
yych = * ( YYMARKER = ++ YYCURSOR ) ;
if ( yybm [ 0 + yych ] & 128 ) {
goto yy15 ;
}
goto yy6 ;
yy15 : YYDEBUG ( 15 , * YYCURSOR ) ;
++ YYCURSOR ;
if ( ( YYLIMIT - YYCURSOR ) < 2 ) YYFILL ( 2 ) ;
yych = * YYCURSOR ;
YYDEBUG ( 16 , * YYCURSOR ) ;
if ( yybm [ 0 + yych ] & 128 ) {
goto yy15 ;
}
if ( yych <= 'L' ) {
if ( yych == 'H' ) goto yy19 ;
goto yy13 ;
}
else {
if ( yych <= 'M' ) goto yy18 ;
if ( yych != 'S' ) goto yy13 ;
}
yy17 : YYDEBUG ( 17 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
goto yy6 ;
yy18 : YYDEBUG ( 18 , * YYCURSOR ) ;
yyaccept = 1 ;
yych = * ( YYMARKER = ++ YYCURSOR ) ;
if ( yych <= '/' ) goto yy6 ;
if ( yych <= '9' ) goto yy22 ;
goto yy6 ;
yy19 : YYDEBUG ( 19 , * YYCURSOR ) ;
yyaccept = 1 ;
yych = * ( YYMARKER = ++ YYCURSOR ) ;
if ( yych <= '/' ) goto yy6 ;
if ( yych >= ':' ) goto yy6 ;
yy20 : YYDEBUG ( 20 , * YYCURSOR ) ;
++ YYCURSOR ;
if ( ( YYLIMIT - YYCURSOR ) < 2 ) YYFILL ( 2 ) ;
yych = * YYCURSOR ;
YYDEBUG ( 21 , * YYCURSOR ) ;
if ( yych <= 'L' ) {
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '9' ) goto yy20 ;
goto yy13 ;
}
else {
if ( yych <= 'M' ) goto yy18 ;
if ( yych == 'S' ) goto yy17 ;
goto yy13 ;
}
yy22 : YYDEBUG ( 22 , * YYCURSOR ) ;
++ YYCURSOR ;
if ( YYLIMIT <= YYCURSOR ) YYFILL ( 1 ) ;
yych = * YYCURSOR ;
YYDEBUG ( 23 , * YYCURSOR ) ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '9' ) goto yy22 ;
if ( yych == 'S' ) goto yy17 ;
goto yy13 ;
yy24 : YYDEBUG ( 24 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych == 'T' ) goto yy14 ;
goto yy6 ;
yy25 : YYDEBUG ( 25 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= 'L' ) {
if ( yych <= '9' ) {
if ( yych <= '/' ) goto yy13 ;
goto yy35 ;
}
else {
if ( yych == 'D' ) goto yy24 ;
goto yy13 ;
}
}
else {
if ( yych <= 'W' ) {
if ( yych <= 'M' ) goto yy27 ;
if ( yych <= 'V' ) goto yy13 ;
}
else {
if ( yych == 'Y' ) goto yy28 ;
goto yy13 ;
}
}
yy26 : YYDEBUG ( 26 , * YYCURSOR ) ;
yyaccept = 1 ;
yych = * ( YYMARKER = ++ YYCURSOR ) ;
if ( yych <= '/' ) goto yy6 ;
if ( yych <= '9' ) goto yy33 ;
if ( yych == 'T' ) goto yy14 ;
goto yy6 ;
yy27 : YYDEBUG ( 27 , * YYCURSOR ) ;
yyaccept = 1 ;
yych = * ( YYMARKER = ++ YYCURSOR ) ;
if ( yych <= '/' ) goto yy6 ;
if ( yych <= '9' ) goto yy31 ;
if ( yych == 'T' ) goto yy14 ;
goto yy6 ;
yy28 : YYDEBUG ( 28 , * YYCURSOR ) ;
yyaccept = 1 ;
yych = * ( YYMARKER = ++ YYCURSOR ) ;
if ( yych <= '/' ) goto yy6 ;
if ( yych <= '9' ) goto yy29 ;
if ( yych == 'T' ) goto yy14 ;
goto yy6 ;
yy29 : YYDEBUG ( 29 , * YYCURSOR ) ;
++ YYCURSOR ;
if ( ( YYLIMIT - YYCURSOR ) < 3 ) YYFILL ( 3 ) ;
yych = * YYCURSOR ;
YYDEBUG ( 30 , * YYCURSOR ) ;
if ( yych <= 'D' ) {
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '9' ) goto yy29 ;
if ( yych <= 'C' ) goto yy13 ;
goto yy24 ;
}
else {
if ( yych <= 'M' ) {
if ( yych <= 'L' ) goto yy13 ;
goto yy27 ;
}
else {
if ( yych == 'W' ) goto yy26 ;
goto yy13 ;
}
}
yy31 : YYDEBUG ( 31 , * YYCURSOR ) ;
++ YYCURSOR ;
if ( ( YYLIMIT - YYCURSOR ) < 3 ) YYFILL ( 3 ) ;
yych = * YYCURSOR ;
YYDEBUG ( 32 , * YYCURSOR ) ;
if ( yych <= 'C' ) {
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '9' ) goto yy31 ;
goto yy13 ;
}
else {
if ( yych <= 'D' ) goto yy24 ;
if ( yych == 'W' ) goto yy26 ;
goto yy13 ;
}
yy33 : YYDEBUG ( 33 , * YYCURSOR ) ;
++ YYCURSOR ;
if ( ( YYLIMIT - YYCURSOR ) < 3 ) YYFILL ( 3 ) ;
yych = * YYCURSOR ;
YYDEBUG ( 34 , * YYCURSOR ) ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '9' ) goto yy33 ;
if ( yych == 'D' ) goto yy24 ;
goto yy13 ;
yy35 : YYDEBUG ( 35 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= 'L' ) {
if ( yych <= '9' ) {
if ( yych <= '/' ) goto yy13 ;
}
else {
if ( yych == 'D' ) goto yy24 ;
goto yy13 ;
}
}
else {
if ( yych <= 'W' ) {
if ( yych <= 'M' ) goto yy27 ;
if ( yych <= 'V' ) goto yy13 ;
goto yy26 ;
}
else {
if ( yych == 'Y' ) goto yy28 ;
goto yy13 ;
}
}
YYDEBUG ( 36 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych != '-' ) goto yy39 ;
YYDEBUG ( 37 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '0' ) goto yy40 ;
if ( yych <= '1' ) goto yy41 ;
goto yy13 ;
yy38 : YYDEBUG ( 38 , * YYCURSOR ) ;
++ YYCURSOR ;
if ( ( YYLIMIT - YYCURSOR ) < 3 ) YYFILL ( 3 ) ;
yych = * YYCURSOR ;
yy39 : YYDEBUG ( 39 , * YYCURSOR ) ;
if ( yych <= 'L' ) {
if ( yych <= '9' ) {
if ( yych <= '/' ) goto yy13 ;
goto yy38 ;
}
else {
if ( yych == 'D' ) goto yy24 ;
goto yy13 ;
}
}
else {
if ( yych <= 'W' ) {
if ( yych <= 'M' ) goto yy27 ;
if ( yych <= 'V' ) goto yy13 ;
goto yy26 ;
}
else {
if ( yych == 'Y' ) goto yy28 ;
goto yy13 ;
}
}
yy40 : YYDEBUG ( 40 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '9' ) goto yy42 ;
goto yy13 ;
yy41 : YYDEBUG ( 41 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '3' ) goto yy13 ;
yy42 : YYDEBUG ( 42 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych != '-' ) goto yy13 ;
YYDEBUG ( 43 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '0' ) goto yy44 ;
if ( yych <= '2' ) goto yy45 ;
if ( yych <= '3' ) goto yy46 ;
goto yy13 ;
yy44 : YYDEBUG ( 44 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '9' ) goto yy47 ;
goto yy13 ;
yy45 : YYDEBUG ( 45 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '9' ) goto yy47 ;
goto yy13 ;
yy46 : YYDEBUG ( 46 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '2' ) goto yy13 ;
yy47 : YYDEBUG ( 47 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych != 'T' ) goto yy13 ;
YYDEBUG ( 48 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '1' ) goto yy49 ;
if ( yych <= '2' ) goto yy50 ;
goto yy13 ;
yy49 : YYDEBUG ( 49 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '9' ) goto yy51 ;
goto yy13 ;
yy50 : YYDEBUG ( 50 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '5' ) goto yy13 ;
yy51 : YYDEBUG ( 51 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych != ':' ) goto yy13 ;
YYDEBUG ( 52 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '6' ) goto yy13 ;
YYDEBUG ( 53 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= ':' ) goto yy13 ;
YYDEBUG ( 54 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych != ':' ) goto yy13 ;
YYDEBUG ( 55 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '6' ) goto yy13 ;
YYDEBUG ( 56 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= ':' ) goto yy13 ;
YYDEBUG ( 57 , * YYCURSOR ) ;
++ YYCURSOR ;
YYDEBUG ( 58 , * YYCURSOR ) ;
# line 393 "ext/date/lib/parse_iso_intervals.re" {
DEBUG_OUTPUT ( "combinedrep" ) ;
TIMELIB_INIT ;
s -> period -> y = timelib_get_unsigned_nr ( ( char * * ) & ptr , 4 ) ;
ptr ++ ;
s -> period -> m = timelib_get_unsigned_nr ( ( char * * ) & ptr , 2 ) ;
ptr ++ ;
s -> period -> d = timelib_get_unsigned_nr ( ( char * * ) & ptr , 2 ) ;
ptr ++ ;
s -> period -> h = timelib_get_unsigned_nr ( ( char * * ) & ptr , 2 ) ;
ptr ++ ;
s -> period -> i = timelib_get_unsigned_nr ( ( char * * ) & ptr , 2 ) ;
ptr ++ ;
s -> period -> s = timelib_get_unsigned_nr ( ( char * * ) & ptr , 2 ) ;
s -> have_period = 1 ;
TIMELIB_DEINIT ;
return TIMELIB_PERIOD ;
}
# line 792 "ext/date/lib/parse_iso_intervals.c" yy59 : YYDEBUG ( 59 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= ':' ) goto yy13 ;
YYDEBUG ( 60 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= ':' ) goto yy13 ;
YYDEBUG ( 61 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) {
if ( yych == '-' ) goto yy64 ;
goto yy13 ;
}
else {
if ( yych <= '0' ) goto yy62 ;
if ( yych <= '1' ) goto yy63 ;
goto yy13 ;
}
yy62 : YYDEBUG ( 62 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '0' ) goto yy13 ;
if ( yych <= '9' ) goto yy85 ;
goto yy13 ;
yy63 : YYDEBUG ( 63 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '2' ) goto yy85 ;
goto yy13 ;
yy64 : YYDEBUG ( 64 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '0' ) goto yy65 ;
if ( yych <= '1' ) goto yy66 ;
goto yy13 ;
yy65 : YYDEBUG ( 65 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '0' ) goto yy13 ;
if ( yych <= '9' ) goto yy67 ;
goto yy13 ;
yy66 : YYDEBUG ( 66 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '3' ) goto yy13 ;
yy67 : YYDEBUG ( 67 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych != '-' ) goto yy13 ;
YYDEBUG ( 68 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '0' ) goto yy69 ;
if ( yych <= '2' ) goto yy70 ;
if ( yych <= '3' ) goto yy71 ;
goto yy13 ;
yy69 : YYDEBUG ( 69 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '0' ) goto yy13 ;
if ( yych <= '9' ) goto yy72 ;
goto yy13 ;
yy70 : YYDEBUG ( 70 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '9' ) goto yy72 ;
goto yy13 ;
yy71 : YYDEBUG ( 71 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '2' ) goto yy13 ;
yy72 : YYDEBUG ( 72 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych != 'T' ) goto yy13 ;
YYDEBUG ( 73 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '1' ) goto yy74 ;
if ( yych <= '2' ) goto yy75 ;
goto yy13 ;
yy74 : YYDEBUG ( 74 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '9' ) goto yy76 ;
goto yy13 ;
yy75 : YYDEBUG ( 75 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '5' ) goto yy13 ;
yy76 : YYDEBUG ( 76 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych != ':' ) goto yy13 ;
YYDEBUG ( 77 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '6' ) goto yy13 ;
YYDEBUG ( 78 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= ':' ) goto yy13 ;
YYDEBUG ( 79 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych != ':' ) goto yy13 ;
YYDEBUG ( 80 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '6' ) goto yy13 ;
YYDEBUG ( 81 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= ':' ) goto yy13 ;
YYDEBUG ( 82 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych != 'Z' ) goto yy13 ;
yy83 : YYDEBUG ( 83 , * YYCURSOR ) ;
++ YYCURSOR ;
YYDEBUG ( 84 , * YYCURSOR ) ;
# line 327 "ext/date/lib/parse_iso_intervals.re" {
timelib_time * current ;
if ( s -> have_date || s -> have_period ) {
current = s -> end ;
s -> have_end_date = 1 ;
}
else {
current = s -> begin ;
s -> have_begin_date = 1 ;
}
DEBUG_OUTPUT ( "datetimebasic | datetimeextended" ) ;
TIMELIB_INIT ;
current -> y = timelib_get_nr ( ( char * * ) & ptr , 4 ) ;
current -> m = timelib_get_nr ( ( char * * ) & ptr , 2 ) ;
current -> d = timelib_get_nr ( ( char * * ) & ptr , 2 ) ;
current -> h = timelib_get_nr ( ( char * * ) & ptr , 2 ) ;
current -> i = timelib_get_nr ( ( char * * ) & ptr , 2 ) ;
current -> s = timelib_get_nr ( ( char * * ) & ptr , 2 ) ;
s -> have_date = 1 ;
TIMELIB_DEINIT ;
return TIMELIB_ISO_DATE ;
}
# line 944 "ext/date/lib/parse_iso_intervals.c" yy85 : YYDEBUG ( 85 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '0' ) goto yy86 ;
if ( yych <= '2' ) goto yy87 ;
if ( yych <= '3' ) goto yy88 ;
goto yy13 ;
yy86 : YYDEBUG ( 86 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '0' ) goto yy13 ;
if ( yych <= '9' ) goto yy89 ;
goto yy13 ;
yy87 : YYDEBUG ( 87 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '9' ) goto yy89 ;
goto yy13 ;
yy88 : YYDEBUG ( 88 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '2' ) goto yy13 ;
yy89 : YYDEBUG ( 89 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych != 'T' ) goto yy13 ;
YYDEBUG ( 90 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '1' ) goto yy91 ;
if ( yych <= '2' ) goto yy92 ;
goto yy13 ;
yy91 : YYDEBUG ( 91 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych <= '9' ) goto yy93 ;
goto yy13 ;
yy92 : YYDEBUG ( 92 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '5' ) goto yy13 ;
yy93 : YYDEBUG ( 93 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '6' ) goto yy13 ;
YYDEBUG ( 94 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= ':' ) goto yy13 ;
YYDEBUG ( 95 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= '6' ) goto yy13 ;
YYDEBUG ( 96 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych <= '/' ) goto yy13 ;
if ( yych >= ':' ) goto yy13 ;
YYDEBUG ( 97 , * YYCURSOR ) ;
yych = * ++ YYCURSOR ;
if ( yych == 'Z' ) goto yy83 ;
goto yy13 ;
yy98 : YYDEBUG ( 98 , * YYCURSOR ) ;
++ YYCURSOR ;
if ( YYLIMIT <= YYCURSOR ) YYFILL ( 1 ) ;
yych = * YYCURSOR ;
YYDEBUG ( 99 , * YYCURSOR ) ;
if ( yych <= '/' ) goto yy100 ;
if ( yych <= '9' ) goto yy98 ;
yy100 : YYDEBUG ( 100 , * YYCURSOR ) ;
# line 316 "ext/date/lib/parse_iso_intervals.re" {
DEBUG_OUTPUT ( "recurrences" ) ;
TIMELIB_INIT ;
ptr ++ ;
s -> recurrences = timelib_get_unsigned_nr ( ( char * * ) & ptr , 9 ) ;
TIMELIB_DEINIT ;
s -> have_recurrences = 1 ;
return TIMELIB_PERIOD ;
}
# line 1032 "ext/date/lib/parse_iso_intervals.c" }
# line 428 "ext/date/lib/parse_iso_intervals.re" }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ef_globals_alloc ( void ) {
SAFE_CALLOC ( ef_gbls , 1 , sizeof ( struct ef_globals ) ) ;
return ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
extern int name ( int , locale_t ) __THROW __exctype_l ( isalnum_l ) ;
__exctype_l ( isalpha_l ) ;
__exctype_l ( iscntrl_l ) ;
__exctype_l ( isdigit_l ) ;
__exctype_l ( islower_l ) ;
__exctype_l ( isgraph_l ) ;
__exctype_l ( isprint_l ) ;
__exctype_l ( ispunct_l ) ;
__exctype_l ( isspace_l ) ;
__exctype_l ( isupper_l ) ;
__exctype_l ( isxdigit_l )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline uint16_t be16_to_cpu ( uint16_t v ) {
return bswap16 ( v ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int crypto_authenticate_and_decrypt ( struct crypto_instance * instance , unsigned char * buf , int * buf_len ) {
struct crypto_config_header * cch = ( struct crypto_config_header * ) buf ;
const char * guessed_str ;
if ( * buf_len <= sizeof ( struct crypto_config_header ) ) {
log_printf ( instance -> log_level_security , "Received message is too short... ignoring" ) ;
return ( - 1 ) ;
}
if ( cch -> crypto_cipher_type != CRYPTO_CIPHER_TYPE_2_3 ) {
guessed_str = NULL ;
if ( ( cch -> crypto_cipher_type == 0xC0 && cch -> crypto_hash_type == 0x70 ) || ( cch -> crypto_cipher_type == 0x70 && cch -> crypto_hash_type == 0xC0 ) ) {
guessed_str = "Corosync 3.x" ;
}
else if ( cch -> crypto_cipher_type == CRYPTO_CIPHER_TYPE_2_2 ) {
guessed_str = "Corosync 2.2" ;
}
else if ( cch -> crypto_cipher_type == 0x01 ) {
guessed_str = "unencrypted Kronosnet" ;
}
else if ( cch -> crypto_cipher_type >= 0 && cch -> crypto_cipher_type <= 5 ) {
guessed_str = "unencrypted Corosync 2.0/2.1/1.x/OpenAIS" ;
}
else {
guessed_str = "encrypted Kronosnet/Corosync 2.0/2.1/1.x/OpenAIS or unknown" ;
}
log_printf ( instance -> log_level_security , "Unsupported incoming packet (probably sent by %s). Rejecting" , guessed_str ) ;
return - 1 ;
}
if ( cch -> crypto_hash_type != CRYPTO_HASH_TYPE_2_3 ) {
log_printf ( instance -> log_level_security , "Incoming packet has different hash type. Rejecting" ) ;
return - 1 ;
}
if ( authenticate_nss_2_3 ( instance , buf , buf_len ) != 0 ) {
return - 1 ;
}
if ( ( cch -> __pad0 != 0 ) || ( cch -> __pad1 != 0 ) ) {
log_printf ( instance -> log_level_security , "Incoming packet appears to have features not supported by this version of corosync. Rejecting" ) ;
return - 1 ;
}
if ( decrypt_nss_2_3 ( instance , buf , buf_len ) != 0 ) {
return - 1 ;
}
cch = NULL ;
memmove ( buf , buf + sizeof ( struct crypto_config_header ) , * buf_len ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_bug15613 ( ) {
MYSQL_STMT * stmt ;
const char * stmt_text ;
MYSQL_RES * metadata ;
MYSQL_FIELD * field ;
int rc ;
myheader ( "test_bug15613" ) ;
rc = mysql_query ( mysql , "set names latin1" ) ;
myquery ( rc ) ;
mysql_query ( mysql , "drop table if exists t1" ) ;
rc = mysql_query ( mysql , "create table t1 (t text character set utf8, " "tt tinytext character set utf8, " "mt mediumtext character set utf8, " "lt longtext character set utf8, " "vl varchar(255) character set latin1," "vb varchar(255) character set binary," "vu varchar(255) character set utf8)" ) ;
myquery ( rc ) ;
stmt = mysql_stmt_init ( mysql ) ;
stmt_text = ( "select t, tt, mt, lt, vl, vb, vu from t1" ) ;
rc = mysql_stmt_prepare ( stmt , stmt_text , strlen ( stmt_text ) ) ;
metadata = mysql_stmt_result_metadata ( stmt ) ;
field = mysql_fetch_fields ( metadata ) ;
if ( ! opt_silent ) {
printf ( "Field lengths (client character set is latin1):\n" "text character set utf8:\t\t%lu\n" "tinytext character set utf8:\t\t%lu\n" "mediumtext character set utf8:\t\t%lu\n" "longtext character set utf8:\t\t%lu\n" "varchar(255) character set latin1:\t%lu\n" "varchar(255) character set binary:\t%lu\n" "varchar(255) character set utf8:\t%lu\n" , field [ 0 ] . length , field [ 1 ] . length , field [ 2 ] . length , field [ 3 ] . length , field [ 4 ] . length , field [ 5 ] . length , field [ 6 ] . length ) ;
}
DIE_UNLESS ( field [ 0 ] . length == 65535 ) ;
DIE_UNLESS ( field [ 1 ] . length == 255 ) ;
DIE_UNLESS ( field [ 2 ] . length == 16777215 ) ;
DIE_UNLESS ( field [ 3 ] . length == 4294967295UL ) ;
DIE_UNLESS ( field [ 4 ] . length == 255 ) ;
DIE_UNLESS ( field [ 5 ] . length == 255 ) ;
DIE_UNLESS ( field [ 6 ] . length == 255 ) ;
mysql_free_result ( metadata ) ;
mysql_stmt_free_result ( stmt ) ;
rc = mysql_query ( mysql , "drop table t1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "set names default" ) ;
myquery ( rc ) ;
mysql_stmt_close ( stmt ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int rollstack ( struct psstack * stack , int sp ) {
int n , j , i ;
struct psstack * temp ;
if ( sp > 1 ) {
n = stack [ sp - 2 ] . u . val ;
j = stack [ sp - 1 ] . u . val ;
sp -= 2 ;
if ( sp >= n && n > 0 ) {
j %= n ;
if ( j < 0 ) j += n ;
temp = malloc ( n * sizeof ( struct psstack ) ) ;
for ( i = 0 ;
i < n ;
++ i ) temp [ i ] = stack [ sp - n + i ] ;
for ( i = 0 ;
i < n ;
++ i ) stack [ sp - n + ( i + j ) % n ] = temp [ i ] ;
free ( temp ) ;
}
}
return ( sp ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_predict_intra_block ( const MACROBLOCKD * xd , int block_idx , int bwl_in , TX_SIZE tx_size , PREDICTION_MODE mode , const uint8_t * ref , int ref_stride , uint8_t * dst , int dst_stride , int aoff , int loff , int plane ) {
const int bwl = bwl_in - tx_size ;
const int wmask = ( 1 << bwl ) - 1 ;
const int have_top = ( block_idx >> bwl ) || xd -> up_available ;
const int have_left = ( block_idx & wmask ) || xd -> left_available ;
const int have_right = ( ( block_idx & wmask ) != wmask ) ;
const int x = aoff * 4 ;
const int y = loff * 4 ;
assert ( bwl >= 0 ) ;
build_intra_predictors ( xd , ref , ref_stride , dst , dst_stride , mode , tx_size , have_top , have_left , have_right , x , y , plane ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void create_task_thread_func ( GTask * task , gpointer source_object , gpointer task_data , GCancellable * cancellable ) {
CreateJob * job ;
CommonJob * common ;
int count ;
GFile * dest ;
g_autofree gchar * dest_uri = NULL ;
char * basename ;
char * filename , * filename2 , * new_filename ;
char * filename_base , * suffix ;
char * dest_fs_type ;
GError * error ;
gboolean res ;
gboolean filename_is_utf8 ;
char * primary , * secondary , * details ;
int response ;
char * data ;
int length ;
GFileOutputStream * out ;
gboolean handled_invalid_filename ;
int max_length , offset ;
job = task_data ;
common = & job -> common ;
nautilus_progress_info_start ( job -> common . progress ) ;
handled_invalid_filename = FALSE ;
dest_fs_type = NULL ;
filename = NULL ;
dest = NULL ;
max_length = get_max_name_length ( job -> dest_dir ) ;
verify_destination ( common , job -> dest_dir , NULL , - 1 ) ;
if ( job_aborted ( common ) ) {
goto aborted ;
}
filename = g_strdup ( job -> filename ) ;
filename_is_utf8 = FALSE ;
if ( filename ) {
filename_is_utf8 = g_utf8_validate ( filename , - 1 , NULL ) ;
}
if ( filename == NULL ) {
if ( job -> make_dir ) {
filename = g_strdup ( _ ( "Untitled Folder" ) ) ;
filename_is_utf8 = TRUE ;
}
else {
if ( job -> src != NULL ) {
basename = g_file_get_basename ( job -> src ) ;
filename = g_strdup_printf ( "%s" , basename ) ;
g_free ( basename ) ;
}
if ( filename == NULL ) {
filename = g_strdup ( _ ( "Untitled Document" ) ) ;
filename_is_utf8 = TRUE ;
}
}
}
make_file_name_valid_for_dest_fs ( filename , dest_fs_type ) ;
if ( filename_is_utf8 ) {
dest = g_file_get_child_for_display_name ( job -> dest_dir , filename , NULL ) ;
}
if ( dest == NULL ) {
dest = g_file_get_child ( job -> dest_dir , filename ) ;
}
count = 1 ;
retry : error = NULL ;
if ( job -> make_dir ) {
res = g_file_make_directory ( dest , common -> cancellable , & error ) ;
if ( res ) {
GFile * real ;
real = map_possibly_volatile_file_to_real ( dest , common -> cancellable , & error ) ;
if ( real == NULL ) {
res = FALSE ;
}
else {
g_object_unref ( dest ) ;
dest = real ;
}
}
if ( res && common -> undo_info != NULL ) {
nautilus_file_undo_info_create_set_data ( NAUTILUS_FILE_UNDO_INFO_CREATE ( common -> undo_info ) , dest , NULL , 0 ) ;
}
}
else {
if ( job -> src ) {
res = g_file_copy ( job -> src , dest , G_FILE_COPY_NONE , common -> cancellable , NULL , NULL , & error ) ;
if ( res ) {
GFile * real ;
real = map_possibly_volatile_file_to_real ( dest , common -> cancellable , & error ) ;
if ( real == NULL ) {
res = FALSE ;
}
else {
g_object_unref ( dest ) ;
dest = real ;
}
}
if ( res && common -> undo_info != NULL ) {
gchar * uri ;
uri = g_file_get_uri ( job -> src ) ;
nautilus_file_undo_info_create_set_data ( NAUTILUS_FILE_UNDO_INFO_CREATE ( common -> undo_info ) , dest , uri , 0 ) ;
g_free ( uri ) ;
}
}
else {
data = "" ;
length = 0 ;
if ( job -> src_data ) {
data = job -> src_data ;
length = job -> length ;
}
out = g_file_create ( dest , G_FILE_CREATE_NONE , common -> cancellable , & error ) ;
if ( out ) {
GFile * real ;
real = map_possibly_volatile_file_to_real_on_write ( dest , out , common -> cancellable , & error ) ;
if ( real == NULL ) {
res = FALSE ;
g_object_unref ( out ) ;
}
else {
g_object_unref ( dest ) ;
dest = real ;
res = g_output_stream_write_all ( G_OUTPUT_STREAM ( out ) , data , length , NULL , common -> cancellable , & error ) ;
if ( res ) {
res = g_output_stream_close ( G_OUTPUT_STREAM ( out ) , common -> cancellable , & error ) ;
if ( res && common -> undo_info != NULL ) {
nautilus_file_undo_info_create_set_data ( NAUTILUS_FILE_UNDO_INFO_CREATE ( common -> undo_info ) , dest , data , length ) ;
}
}
g_object_unref ( out ) ;
}
}
else {
res = FALSE ;
}
}
}
if ( res ) {
job -> created_file = g_object_ref ( dest ) ;
nautilus_file_changes_queue_file_added ( dest ) ;
dest_uri = g_file_get_uri ( dest ) ;
if ( job -> has_position ) {
nautilus_file_changes_queue_schedule_position_set ( dest , job -> position , common -> screen_num ) ;
}
else if ( eel_uri_is_desktop ( dest_uri ) ) {
nautilus_file_changes_queue_schedule_position_remove ( dest ) ;
}
}
else {
g_assert ( error != NULL ) ;
if ( IS_IO_ERROR ( error , INVALID_FILENAME ) && ! handled_invalid_filename ) {
handled_invalid_filename = TRUE ;
g_assert ( dest_fs_type == NULL ) ;
dest_fs_type = query_fs_type ( job -> dest_dir , common -> cancellable ) ;
if ( count == 1 ) {
new_filename = g_strdup ( filename ) ;
}
else {
filename_base = eel_filename_strip_extension ( filename ) ;
offset = strlen ( filename_base ) ;
suffix = g_strdup ( filename + offset ) ;
filename2 = g_strdup_printf ( "%s %d%s" , filename_base , count , suffix ) ;
new_filename = NULL ;
if ( max_length > 0 && strlen ( filename2 ) > max_length ) {
new_filename = shorten_utf8_string ( filename2 , strlen ( filename2 ) - max_length ) ;
}
if ( new_filename == NULL ) {
new_filename = g_strdup ( filename2 ) ;
}
g_free ( filename2 ) ;
g_free ( suffix ) ;
}
if ( make_file_name_valid_for_dest_fs ( new_filename , dest_fs_type ) ) {
g_object_unref ( dest ) ;
if ( filename_is_utf8 ) {
dest = g_file_get_child_for_display_name ( job -> dest_dir , new_filename , NULL ) ;
}
if ( dest == NULL ) {
dest = g_file_get_child ( job -> dest_dir , new_filename ) ;
}
g_free ( new_filename ) ;
g_error_free ( error ) ;
goto retry ;
}
g_free ( new_filename ) ;
}
if ( IS_IO_ERROR ( error , EXISTS ) ) {
g_object_unref ( dest ) ;
dest = NULL ;
filename_base = eel_filename_strip_extension ( filename ) ;
offset = strlen ( filename_base ) ;
suffix = g_strdup ( filename + offset ) ;
filename2 = g_strdup_printf ( "%s %d%s" , filename_base , ++ count , suffix ) ;
if ( max_length > 0 && strlen ( filename2 ) > max_length ) {
new_filename = shorten_utf8_string ( filename2 , strlen ( filename2 ) - max_length ) ;
if ( new_filename != NULL ) {
g_free ( filename2 ) ;
filename2 = new_filename ;
}
}
make_file_name_valid_for_dest_fs ( filename2 , dest_fs_type ) ;
if ( filename_is_utf8 ) {
dest = g_file_get_child_for_display_name ( job -> dest_dir , filename2 , NULL ) ;
}
if ( dest == NULL ) {
dest = g_file_get_child ( job -> dest_dir , filename2 ) ;
}
g_free ( filename2 ) ;
g_free ( suffix ) ;
g_error_free ( error ) ;
goto retry ;
}
else if ( IS_IO_ERROR ( error , CANCELLED ) ) {
g_error_free ( error ) ;
}
else {
if ( job -> make_dir ) {
primary = f ( _ ( "Error while creating directory %B." ) , dest ) ;
}
else {
primary = f ( _ ( "Error while creating file %B." ) , dest ) ;
}
secondary = f ( _ ( "There was an error creating the directory in %F." ) , job -> dest_dir ) ;
details = error -> message ;
response = run_warning ( common , primary , secondary , details , FALSE , CANCEL , SKIP , NULL ) ;
g_error_free ( error ) ;
if ( response == 0 || response == GTK_RESPONSE_DELETE_EVENT ) {
abort_job ( common ) ;
}
else if ( response == 1 ) {
}
else {
g_assert_not_reached ( ) ;
}
}
}
aborted : if ( dest ) {
g_object_unref ( dest ) ;
}
g_free ( filename ) ;
g_free ( dest_fs_type ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( ContentFaviconDriverTest , MixedContentInsecureFaviconBlocked ) {
net : : EmbeddedTestServer ssl_server ( net : : EmbeddedTestServer : : TYPE_HTTPS ) ;
ssl_server . AddDefaultHandlers ( base : : FilePath ( kDocRoot ) ) ;
ASSERT_TRUE ( ssl_server . Start ( ) ) ;
ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ;
const GURL favicon_url = embedded_test_server ( ) -> GetURL ( "example.test" , "/favicon/icon.png" ) ;
const GURL favicon_page = ssl_server . GetURL ( "example.test" , "/favicon/page_with_favicon_by_url.html?url=" + favicon_url . spec ( ) ) ;
content : : ConsoleObserverDelegate console_observer ( web_contents ( ) , "*icon.png*" ) ;
web_contents ( ) -> SetDelegate ( & console_observer ) ;
std : : unique_ptr < TestResourceDispatcherHostDelegate > delegate ( new TestResourceDispatcherHostDelegate ( favicon_url ) ) ;
content : : ResourceDispatcherHost : : Get ( ) -> SetDelegate ( delegate . get ( ) ) ;
PendingTaskWaiter waiter ( web_contents ( ) ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , favicon_page ) ;
console_observer . Wait ( ) ;
waiter . Wait ( ) ;
EXPECT_TRUE ( base : : MatchPattern ( console_observer . message ( ) , "*insecure favicon*" ) ) ;
EXPECT_TRUE ( base : : MatchPattern ( console_observer . message ( ) , "*request has been blocked*" ) ) ;
EXPECT_FALSE ( delegate -> was_requested ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int kq_del ( void * arg , struct event * ev ) {
struct kqop * kqop = arg ;
struct kevent kev ;
if ( ! ( ev -> ev_flags & EVLIST_X_KQINKERNEL ) ) return ( 0 ) ;
if ( ev -> ev_events & EV_SIGNAL ) {
int nsignal = EVENT_SIGNAL ( ev ) ;
struct timespec timeout = {
0 , 0 }
;
assert ( nsignal >= 0 && nsignal < NSIG ) ;
TAILQ_REMOVE ( & kqop -> evsigevents [ nsignal ] , ev , ev_signal_next ) ;
if ( TAILQ_EMPTY ( & kqop -> evsigevents [ nsignal ] ) ) {
memset ( & kev , 0 , sizeof ( kev ) ) ;
kev . ident = nsignal ;
kev . filter = EVFILT_SIGNAL ;
kev . flags = EV_DELETE ;
if ( kevent ( kqop -> kq , & kev , 1 , NULL , 0 , & timeout ) == - 1 ) return ( - 1 ) ;
if ( _evsignal_restore_handler ( ev -> ev_base , nsignal ) == - 1 ) return ( - 1 ) ;
}
ev -> ev_flags &= ~ EVLIST_X_KQINKERNEL ;
return ( 0 ) ;
}
if ( ev -> ev_events & EV_READ ) {
memset ( & kev , 0 , sizeof ( kev ) ) ;
kev . ident = ev -> ev_fd ;
kev . filter = EVFILT_READ ;
kev . flags = EV_DELETE ;
if ( kq_insert ( kqop , & kev ) == - 1 ) return ( - 1 ) ;
ev -> ev_flags &= ~ EVLIST_X_KQINKERNEL ;
}
if ( ev -> ev_events & EV_WRITE ) {
memset ( & kev , 0 , sizeof ( kev ) ) ;
kev . ident = ev -> ev_fd ;
kev . filter = EVFILT_WRITE ;
kev . flags = EV_DELETE ;
if ( kq_insert ( kqop , & kev ) == - 1 ) return ( - 1 ) ;
ev -> ev_flags &= ~ EVLIST_X_KQINKERNEL ;
}
return ( 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void Type_LUT16_Free ( struct _cms_typehandler_struct * self , void * Ptr ) {
cmsPipelineFree ( ( cmsPipeline * ) Ptr ) ;
return ;
cmsUNUSED_PARAMETER ( self ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
struct config_filter_context * config_filter_init ( pool_t pool ) {
struct config_filter_context * ctx ;
ctx = p_new ( pool , struct config_filter_context , 1 ) ;
ctx -> pool = pool ;
return ctx ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
METHOD ( certificate_t , destroy , void , private_x509_cert_t * this ) {
if ( ref_put ( & this -> ref ) ) {
this -> subjectAltNames -> destroy_offset ( this -> subjectAltNames , offsetof ( identification_t , destroy ) ) ;
this -> crl_uris -> destroy_function ( this -> crl_uris , ( void * ) crl_uri_destroy ) ;
this -> ocsp_uris -> destroy_function ( this -> ocsp_uris , free ) ;
this -> ipAddrBlocks -> destroy_offset ( this -> ipAddrBlocks , offsetof ( traffic_selector_t , destroy ) ) ;
this -> permitted_names -> destroy_offset ( this -> permitted_names , offsetof ( identification_t , destroy ) ) ;
this -> excluded_names -> destroy_offset ( this -> excluded_names , offsetof ( identification_t , destroy ) ) ;
this -> cert_policies -> destroy_function ( this -> cert_policies , ( void * ) cert_policy_destroy ) ;
this -> policy_mappings -> destroy_function ( this -> policy_mappings , ( void * ) policy_mapping_destroy ) ;
DESTROY_IF ( this -> issuer ) ;
DESTROY_IF ( this -> subject ) ;
DESTROY_IF ( this -> public_key ) ;
chunk_free ( & this -> authKeyIdentifier ) ;
chunk_free ( & this -> encoding ) ;
chunk_free ( & this -> encoding_hash ) ;
if ( ! this -> parsed ) {
chunk_free ( & this -> signature ) ;
chunk_free ( & this -> serialNumber ) ;
chunk_free ( & this -> tbsCertificate ) ;
}
free ( this ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void pimv1_print ( netdissect_options * ndo , register const u_char * bp , register u_int len ) {
register const u_char * ep ;
register u_char type ;
ep = ( const u_char * ) ndo -> ndo_snapend ;
if ( bp >= ep ) return ;
ND_TCHECK ( bp [ 1 ] ) ;
type = bp [ 1 ] ;
ND_PRINT ( ( ndo , " %s" , tok2str ( pimv1_type_str , "[type %u]" , type ) ) ) ;
switch ( type ) {
case PIMV1_TYPE_QUERY : if ( ND_TTEST ( bp [ 8 ] ) ) {
switch ( bp [ 8 ] >> 4 ) {
case 0 : ND_PRINT ( ( ndo , " Dense-mode" ) ) ;
break ;
case 1 : ND_PRINT ( ( ndo , " Sparse-mode" ) ) ;
break ;
case 2 : ND_PRINT ( ( ndo , " Sparse-Dense-mode" ) ) ;
break ;
default : ND_PRINT ( ( ndo , " mode-%d" , bp [ 8 ] >> 4 ) ) ;
break ;
}
}
if ( ndo -> ndo_vflag ) {
ND_TCHECK2 ( bp [ 10 ] , 2 ) ;
ND_PRINT ( ( ndo , " (Hold-time " ) ) ;
unsigned_relts_print ( ndo , EXTRACT_16BITS ( & bp [ 10 ] ) ) ;
ND_PRINT ( ( ndo , ")" ) ) ;
}
break ;
case PIMV1_TYPE_REGISTER : ND_TCHECK2 ( bp [ 8 ] , 20 ) ;
ND_PRINT ( ( ndo , " for %s > %s" , ipaddr_string ( ndo , & bp [ 20 ] ) , ipaddr_string ( ndo , & bp [ 24 ] ) ) ) ;
break ;
case PIMV1_TYPE_REGISTER_STOP : ND_TCHECK2 ( bp [ 12 ] , sizeof ( struct in_addr ) ) ;
ND_PRINT ( ( ndo , " for %s > %s" , ipaddr_string ( ndo , & bp [ 8 ] ) , ipaddr_string ( ndo , & bp [ 12 ] ) ) ) ;
break ;
case PIMV1_TYPE_RP_REACHABILITY : if ( ndo -> ndo_vflag ) {
ND_TCHECK2 ( bp [ 22 ] , 2 ) ;
ND_PRINT ( ( ndo , " group %s" , ipaddr_string ( ndo , & bp [ 8 ] ) ) ) ;
if ( EXTRACT_32BITS ( & bp [ 12 ] ) != 0xffffffff ) ND_PRINT ( ( ndo , "/%s" , ipaddr_string ( ndo , & bp [ 12 ] ) ) ) ;
ND_PRINT ( ( ndo , " RP %s hold " , ipaddr_string ( ndo , & bp [ 16 ] ) ) ) ;
unsigned_relts_print ( ndo , EXTRACT_16BITS ( & bp [ 22 ] ) ) ;
}
break ;
case PIMV1_TYPE_ASSERT : ND_TCHECK2 ( bp [ 16 ] , sizeof ( struct in_addr ) ) ;
ND_PRINT ( ( ndo , " for %s > %s" , ipaddr_string ( ndo , & bp [ 16 ] ) , ipaddr_string ( ndo , & bp [ 8 ] ) ) ) ;
if ( EXTRACT_32BITS ( & bp [ 12 ] ) != 0xffffffff ) ND_PRINT ( ( ndo , "/%s" , ipaddr_string ( ndo , & bp [ 12 ] ) ) ) ;
ND_TCHECK2 ( bp [ 24 ] , 4 ) ;
ND_PRINT ( ( ndo , " %s pref %d metric %d" , ( bp [ 20 ] & 0x80 ) ? "RP-tree" : "SPT" , EXTRACT_32BITS ( & bp [ 20 ] ) & 0x7fffffff , EXTRACT_32BITS ( & bp [ 24 ] ) ) ) ;
break ;
case PIMV1_TYPE_JOIN_PRUNE : case PIMV1_TYPE_GRAFT : case PIMV1_TYPE_GRAFT_ACK : if ( ndo -> ndo_vflag ) pimv1_join_prune_print ( ndo , & bp [ 8 ] , len - 8 ) ;
break ;
}
ND_TCHECK ( bp [ 4 ] ) ;
if ( ( bp [ 4 ] >> 4 ) != 1 ) ND_PRINT ( ( ndo , " [v%d]" , bp [ 4 ] >> 4 ) ) ;
return ;
trunc : ND_PRINT ( ( ndo , "[|pim]" ) ) ;
return ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_read_format_mtree2 ( void ) {
static char archive [ ] = "#mtree\n" "d type=dir content=.\n" ;
struct archive_entry * ae ;
struct archive * a ;
assert ( ( a = archive_read_new ( ) ) != NULL ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_support_filter_all ( a ) ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_support_format_all ( a ) ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_set_options ( a , "mtree:checkfs" ) ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_open_memory ( a , archive , sizeof ( archive ) ) ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualInt ( archive_format ( a ) , ARCHIVE_FORMAT_MTREE ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "d" ) ;
assertEqualInt ( archive_entry_filetype ( ae ) , AE_IFDIR ) ;
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 ( 1 , archive_file_count ( a ) ) ;
assertEqualInt ( ARCHIVE_OK , archive_read_close ( a ) ) ;
assertEqualInt ( ARCHIVE_OK , archive_read_free ( a ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void calc_segtree_probs ( int * segcounts , vp9_prob * segment_tree_probs ) {
const int c01 = segcounts [ 0 ] + segcounts [ 1 ] ;
const int c23 = segcounts [ 2 ] + segcounts [ 3 ] ;
const int c45 = segcounts [ 4 ] + segcounts [ 5 ] ;
const int c67 = segcounts [ 6 ] + segcounts [ 7 ] ;
segment_tree_probs [ 0 ] = get_binary_prob ( c01 + c23 , c45 + c67 ) ;
segment_tree_probs [ 1 ] = get_binary_prob ( c01 , c23 ) ;
segment_tree_probs [ 2 ] = get_binary_prob ( c45 , c67 ) ;
segment_tree_probs [ 3 ] = get_binary_prob ( segcounts [ 0 ] , segcounts [ 1 ] ) ;
segment_tree_probs [ 4 ] = get_binary_prob ( segcounts [ 2 ] , segcounts [ 3 ] ) ;
segment_tree_probs [ 5 ] = get_binary_prob ( segcounts [ 4 ] , segcounts [ 5 ] ) ;
segment_tree_probs [ 6 ] = get_binary_prob ( segcounts [ 6 ] , segcounts [ 7 ] ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int virtio_net_handle_mac ( VirtIONet * n , uint8_t cmd , VirtQueueElement * elem ) {
struct virtio_net_ctrl_mac mac_data ;
if ( cmd != VIRTIO_NET_CTRL_MAC_TABLE_SET || elem -> out_num != 3 || elem -> out_sg [ 1 ] . iov_len < sizeof ( mac_data ) || elem -> out_sg [ 2 ] . iov_len < sizeof ( mac_data ) ) return VIRTIO_NET_ERR ;
n -> mac_table . in_use = 0 ;
n -> mac_table . first_multi = 0 ;
n -> mac_table . uni_overflow = 0 ;
n -> mac_table . multi_overflow = 0 ;
memset ( n -> mac_table . macs , 0 , MAC_TABLE_ENTRIES * ETH_ALEN ) ;
mac_data . entries = ldl_p ( elem -> out_sg [ 1 ] . iov_base ) ;
if ( sizeof ( mac_data . entries ) + ( mac_data . entries * ETH_ALEN ) > elem -> out_sg [ 1 ] . iov_len ) return VIRTIO_NET_ERR ;
if ( mac_data . entries <= MAC_TABLE_ENTRIES ) {
memcpy ( n -> mac_table . macs , elem -> out_sg [ 1 ] . iov_base + sizeof ( mac_data ) , mac_data . entries * ETH_ALEN ) ;
n -> mac_table . in_use += mac_data . entries ;
}
else {
n -> mac_table . uni_overflow = 1 ;
}
n -> mac_table . first_multi = n -> mac_table . in_use ;
mac_data . entries = ldl_p ( elem -> out_sg [ 2 ] . iov_base ) ;
if ( sizeof ( mac_data . entries ) + ( mac_data . entries * ETH_ALEN ) > elem -> out_sg [ 2 ] . iov_len ) return VIRTIO_NET_ERR ;
if ( mac_data . entries ) {
if ( n -> mac_table . in_use + mac_data . entries <= MAC_TABLE_ENTRIES ) {
memcpy ( n -> mac_table . macs + ( n -> mac_table . in_use * ETH_ALEN ) , elem -> out_sg [ 2 ] . iov_base + sizeof ( mac_data ) , mac_data . entries * ETH_ALEN ) ;
n -> mac_table . in_use += mac_data . entries ;
}
else {
n -> mac_table . multi_overflow = 1 ;
}
}
return VIRTIO_NET_OK ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void loop_filter ( H264Context * h , int start_x , int end_x ) {
uint8_t * dest_y , * dest_cb , * dest_cr ;
int linesize , uvlinesize , mb_x , mb_y ;
const int end_mb_y = h -> mb_y + FRAME_MBAFF ( h ) ;
const int old_slice_type = h -> slice_type ;
const int pixel_shift = h -> pixel_shift ;
const int block_h = 16 >> h -> chroma_y_shift ;
if ( h -> deblocking_filter ) {
for ( mb_x = start_x ;
mb_x < end_x ;
mb_x ++ ) for ( mb_y = end_mb_y - FRAME_MBAFF ( h ) ;
mb_y <= end_mb_y ;
mb_y ++ ) {
int mb_xy , mb_type ;
mb_xy = h -> mb_xy = mb_x + mb_y * h -> mb_stride ;
h -> slice_num = h -> slice_table [ mb_xy ] ;
mb_type = h -> cur_pic . mb_type [ mb_xy ] ;
h -> list_count = h -> list_counts [ mb_xy ] ;
if ( FRAME_MBAFF ( h ) ) h -> mb_mbaff = h -> mb_field_decoding_flag = ! ! IS_INTERLACED ( mb_type ) ;
h -> mb_x = mb_x ;
h -> mb_y = mb_y ;
dest_y = h -> cur_pic . f . data [ 0 ] + ( ( mb_x << pixel_shift ) + mb_y * h -> linesize ) * 16 ;
dest_cb = h -> cur_pic . f . data [ 1 ] + ( mb_x << pixel_shift ) * ( 8 << CHROMA444 ( h ) ) + mb_y * h -> uvlinesize * block_h ;
dest_cr = h -> cur_pic . f . data [ 2 ] + ( mb_x << pixel_shift ) * ( 8 << CHROMA444 ( h ) ) + mb_y * h -> uvlinesize * block_h ;
if ( MB_FIELD ( h ) ) {
linesize = h -> mb_linesize = h -> linesize * 2 ;
uvlinesize = h -> mb_uvlinesize = h -> uvlinesize * 2 ;
if ( mb_y & 1 ) {
dest_y -= h -> linesize * 15 ;
dest_cb -= h -> uvlinesize * ( block_h - 1 ) ;
dest_cr -= h -> uvlinesize * ( block_h - 1 ) ;
}
}
else {
linesize = h -> mb_linesize = h -> linesize ;
uvlinesize = h -> mb_uvlinesize = h -> uvlinesize ;
}
backup_mb_border ( h , dest_y , dest_cb , dest_cr , linesize , uvlinesize , 0 ) ;
if ( fill_filter_caches ( h , mb_type ) ) continue ;
h -> chroma_qp [ 0 ] = get_chroma_qp ( h , 0 , h -> cur_pic . qscale_table [ mb_xy ] ) ;
h -> chroma_qp [ 1 ] = get_chroma_qp ( h , 1 , h -> cur_pic . qscale_table [ mb_xy ] ) ;
if ( FRAME_MBAFF ( h ) ) {
ff_h264_filter_mb ( h , mb_x , mb_y , dest_y , dest_cb , dest_cr , linesize , uvlinesize ) ;
}
else {
ff_h264_filter_mb_fast ( h , mb_x , mb_y , dest_y , dest_cb , dest_cr , linesize , uvlinesize ) ;
}
}
}
h -> slice_type = old_slice_type ;
h -> mb_x = end_x ;
h -> mb_y = end_mb_y - FRAME_MBAFF ( h ) ;
h -> chroma_qp [ 0 ] = get_chroma_qp ( h , 0 , h -> qscale ) ;
h -> chroma_qp [ 1 ] = get_chroma_qp ( h , 1 , h -> qscale ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint rsvp_hash ( gconstpointer k ) {
const struct rsvp_request_key * key = ( const struct rsvp_request_key * ) k ;
return key -> conversation ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char ) typedef void * OPENSSL_BLOCK ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_BLOCK , void )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void CommuteOpExpr ( OpExpr * clause ) {
Oid opoid ;
Node * temp ;
if ( ! is_opclause ( clause ) || list_length ( clause -> args ) != 2 ) elog ( ERROR , "cannot commute non-binary-operator clause" ) ;
opoid = get_commutator ( clause -> opno ) ;
if ( ! OidIsValid ( opoid ) ) elog ( ERROR , "could not find commutator for operator %u" , clause -> opno ) ;
clause -> opno = opoid ;
clause -> opfuncid = InvalidOid ;
temp = linitial ( clause -> args ) ;
linitial ( clause -> args ) = lsecond ( clause -> args ) ;
lsecond ( clause -> args ) = temp ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void NVRAM_set_byte ( m48t59_t * nvram , uint32_t addr , uint8_t value ) {
m48t59_set_addr ( nvram , addr ) ;
m48t59_write ( nvram , value ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void register_ber_oid_syntax ( const char * oid , const char * name , const char * syntax ) {
if ( syntax && * syntax ) g_hash_table_insert ( syntax_table , ( gpointer ) g_strdup ( oid ) , ( gpointer ) g_strdup ( syntax ) ) ;
if ( name && * name ) register_ber_oid_name ( oid , name ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline void lh_ ## type ## _stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) {
OPENSSL_LH_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ;
}
static ossl_inline unsigned long lh_ ## type ## _get_down_load ( LHASH_OF ( type ) * lh ) {
return OPENSSL_LH_get_down_load ( ( OPENSSL_LHASH * ) lh ) ;
}
static ossl_inline void lh_ ## type ## _set_down_load ( LHASH_OF ( type ) * lh , unsigned long dl ) {
OPENSSL_LH_set_down_load ( ( OPENSSL_LHASH * ) lh , dl ) ;
}
static ossl_inline void lh_ ## type ## _doall ( LHASH_OF ( type ) * lh , void ( * doall ) ( type * ) ) {
OPENSSL_LH_doall ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNC ) doall ) ;
}
LHASH_OF ( type ) # define IMPLEMENT_LHASH_DOALL_ARG_CONST ( type , argtype ) int_implement_lhash_doall ( type , argtype , const type ) # define IMPLEMENT_LHASH_DOALL_ARG ( type , argtype ) int_implement_lhash_doall ( type , argtype , type ) # define int_implement_lhash_doall ( type , argtype , cbargtype ) static ossl_inline void lh_ ## type ## _doall_ ## argtype ( LHASH_OF ( type ) * lh , void ( * fn ) ( cbargtype * , argtype * ) , argtype * arg ) {
OPENSSL_LH_doall_arg ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNCARG ) fn , ( void * ) arg ) ;
}
LHASH_OF ( type ) DEFINE_LHASH_OF ( OPENSSL_STRING ) ;
# ifdef _MSC_VER # pragma warning ( push ) # pragma warning ( disable : 4090 ) # endif DEFINE_LHASH_OF ( OPENSSL_CSTRING )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
VmncContext * const c = avctx -> priv_data ;
uint8_t * outptr ;
const uint8_t * src = buf ;
int dx , dy , w , h , depth , enc , chunks , res , size_left ;
c -> pic . reference = 1 ;
c -> pic . buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE ;
if ( avctx -> reget_buffer ( avctx , & c -> pic ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ;
return - 1 ;
}
c -> pic . key_frame = 0 ;
c -> pic . pict_type = AV_PICTURE_TYPE_P ;
if ( c -> screendta ) {
int i ;
w = c -> cur_w ;
if ( c -> width < c -> cur_x + w ) w = c -> width - c -> cur_x ;
h = c -> cur_h ;
if ( c -> height < c -> cur_y + h ) h = c -> height - c -> cur_y ;
dx = c -> cur_x ;
if ( dx < 0 ) {
w += dx ;
dx = 0 ;
}
dy = c -> cur_y ;
if ( dy < 0 ) {
h += dy ;
dy = 0 ;
}
if ( ( w > 0 ) && ( h > 0 ) ) {
outptr = c -> pic . data [ 0 ] + dx * c -> bpp2 + dy * c -> pic . linesize [ 0 ] ;
for ( i = 0 ;
i < h ;
i ++ ) {
memcpy ( outptr , c -> screendta + i * c -> cur_w * c -> bpp2 , w * c -> bpp2 ) ;
outptr += c -> pic . linesize [ 0 ] ;
}
}
}
src += 2 ;
chunks = AV_RB16 ( src ) ;
src += 2 ;
while ( chunks -- ) {
dx = AV_RB16 ( src ) ;
src += 2 ;
dy = AV_RB16 ( src ) ;
src += 2 ;
w = AV_RB16 ( src ) ;
src += 2 ;
h = AV_RB16 ( src ) ;
src += 2 ;
enc = AV_RB32 ( src ) ;
src += 4 ;
outptr = c -> pic . data [ 0 ] + dx * c -> bpp2 + dy * c -> pic . linesize [ 0 ] ;
size_left = buf_size - ( src - buf ) ;
switch ( enc ) {
case MAGIC_WMVd : if ( size_left < 2 + w * h * c -> bpp2 * 2 ) {
av_log ( avctx , AV_LOG_ERROR , "Premature end of data! (need %i got %i)\n" , 2 + w * h * c -> bpp2 * 2 , size_left ) ;
return - 1 ;
}
src += 2 ;
c -> cur_w = w ;
c -> cur_h = h ;
c -> cur_hx = dx ;
c -> cur_hy = dy ;
if ( ( c -> cur_hx > c -> cur_w ) || ( c -> cur_hy > c -> cur_h ) ) {
av_log ( avctx , AV_LOG_ERROR , "Cursor hot spot is not in image: %ix%i of %ix%i cursor size\n" , c -> cur_hx , c -> cur_hy , c -> cur_w , c -> cur_h ) ;
c -> cur_hx = c -> cur_hy = 0 ;
}
c -> curbits = av_realloc ( c -> curbits , c -> cur_w * c -> cur_h * c -> bpp2 ) ;
c -> curmask = av_realloc ( c -> curmask , c -> cur_w * c -> cur_h * c -> bpp2 ) ;
c -> screendta = av_realloc ( c -> screendta , c -> cur_w * c -> cur_h * c -> bpp2 ) ;
load_cursor ( c , src ) ;
src += w * h * c -> bpp2 * 2 ;
break ;
case MAGIC_WMVe : src += 2 ;
break ;
case MAGIC_WMVf : c -> cur_x = dx - c -> cur_hx ;
c -> cur_y = dy - c -> cur_hy ;
break ;
case MAGIC_WMVg : src += 10 ;
break ;
case MAGIC_WMVh : src += 4 ;
break ;
case MAGIC_WMVi : c -> pic . key_frame = 1 ;
c -> pic . pict_type = AV_PICTURE_TYPE_I ;
depth = * src ++ ;
if ( depth != c -> bpp ) {
av_log ( avctx , AV_LOG_INFO , "Depth mismatch. Container %i bpp, Frame data: %i bpp\n" , c -> bpp , depth ) ;
}
src ++ ;
c -> bigendian = * src ++ ;
if ( c -> bigendian & ( ~ 1 ) ) {
av_log ( avctx , AV_LOG_INFO , "Invalid header: bigendian flag = %i\n" , c -> bigendian ) ;
return - 1 ;
}
src += 13 ;
break ;
case MAGIC_WMVj : src += 2 ;
break ;
case 0x00000000 : if ( ( dx + w > c -> width ) || ( dy + h > c -> height ) ) {
av_log ( avctx , AV_LOG_ERROR , "Incorrect frame size: %ix%i+%ix%i of %ix%i\n" , w , h , dx , dy , c -> width , c -> height ) ;
return - 1 ;
}
if ( size_left < w * h * c -> bpp2 ) {
av_log ( avctx , AV_LOG_ERROR , "Premature end of data! (need %i got %i)\n" , w * h * c -> bpp2 , size_left ) ;
return - 1 ;
}
paint_raw ( outptr , w , h , src , c -> bpp2 , c -> bigendian , c -> pic . linesize [ 0 ] ) ;
src += w * h * c -> bpp2 ;
break ;
case 0x00000005 : if ( ( dx + w > c -> width ) || ( dy + h > c -> height ) ) {
av_log ( avctx , AV_LOG_ERROR , "Incorrect frame size: %ix%i+%ix%i of %ix%i\n" , w , h , dx , dy , c -> width , c -> height ) ;
return - 1 ;
}
res = decode_hextile ( c , outptr , src , size_left , w , h , c -> pic . linesize [ 0 ] ) ;
if ( res < 0 ) return - 1 ;
src += res ;
break ;
default : av_log ( avctx , AV_LOG_ERROR , "Unsupported block type 0x%08X\n" , enc ) ;
chunks = 0 ;
}
}
if ( c -> screendta ) {
int i ;
w = c -> cur_w ;
if ( c -> width < c -> cur_x + w ) w = c -> width - c -> cur_x ;
h = c -> cur_h ;
if ( c -> height < c -> cur_y + h ) h = c -> height - c -> cur_y ;
dx = c -> cur_x ;
if ( dx < 0 ) {
w += dx ;
dx = 0 ;
}
dy = c -> cur_y ;
if ( dy < 0 ) {
h += dy ;
dy = 0 ;
}
if ( ( w > 0 ) && ( h > 0 ) ) {
outptr = c -> pic . data [ 0 ] + dx * c -> bpp2 + dy * c -> pic . linesize [ 0 ] ;
for ( i = 0 ;
i < h ;
i ++ ) {
memcpy ( c -> screendta + i * c -> cur_w * c -> bpp2 , outptr , w * c -> bpp2 ) ;
outptr += c -> pic . linesize [ 0 ] ;
}
outptr = c -> pic . data [ 0 ] ;
put_cursor ( outptr , c -> pic . linesize [ 0 ] , c , c -> cur_x , c -> cur_y ) ;
}
}
* got_frame = 1 ;
* ( AVFrame * ) data = c -> pic ;
return buf_size ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
rfbBool rfbSendFileTransferMessage ( rfbClientPtr cl , uint8_t contentType , uint8_t contentParam , uint32_t size , uint32_t length , const char * buffer ) {
rfbFileTransferMsg ft ;
ft . type = rfbFileTransfer ;
ft . contentType = contentType ;
ft . contentParam = contentParam ;
ft . pad = 0 ;
ft . size = Swap32IfLE ( size ) ;
ft . length = Swap32IfLE ( length ) ;
FILEXFER_ALLOWED_OR_CLOSE_AND_RETURN ( "" , cl , FALSE ) ;
LOCK ( cl -> sendMutex ) ;
if ( rfbWriteExact ( cl , ( char * ) & ft , sz_rfbFileTransferMsg ) < 0 ) {
rfbLogPerror ( "rfbSendFileTransferMessage: write" ) ;
rfbCloseClient ( cl ) ;
UNLOCK ( cl -> sendMutex ) ;
return FALSE ;
}
if ( length > 0 ) {
if ( rfbWriteExact ( cl , buffer , length ) < 0 ) {
rfbLogPerror ( "rfbSendFileTransferMessage: write" ) ;
rfbCloseClient ( cl ) ;
UNLOCK ( cl -> sendMutex ) ;
return FALSE ;
}
}
UNLOCK ( cl -> sendMutex ) ;
rfbStatRecordMessageSent ( cl , rfbFileTransfer , sz_rfbFileTransferMsg + length , sz_rfbFileTransferMsg + length ) ;
return TRUE ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSMimeHdrFieldValueIntInsert ( TSMBuffer bufp , TSMLoc hdr , TSMLoc field , int idx , int value ) {
sdk_assert ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) ;
sdk_assert ( ( sdk_sanity_check_mime_hdr_handle ( hdr ) == TS_SUCCESS ) || ( sdk_sanity_check_http_hdr_handle ( hdr ) == TS_SUCCESS ) ) ;
sdk_assert ( sdk_sanity_check_field_handle ( field , hdr ) == TS_SUCCESS ) ;
if ( ! isWriteable ( bufp ) ) {
return TS_ERROR ;
}
char tmp [ 16 ] ;
int len = mime_format_int ( tmp , value , sizeof ( tmp ) ) ;
TSMimeFieldValueInsert ( bufp , field , tmp , len , idx ) ;
return TS_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int main ( int argc , char * * argv ) {
if ( argc < 2 ) {
fprintf ( stderr , "Usage:\n%s t_header.h\n" , argv [ 0 ] ) ;
exit ( 1 ) ;
}
debug = 1 ;
populate_symb ( argv [ 1 ] ) ;
generate_preamble ( ) ;
generate_token_text ( ) ;
generate_fsm ( ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int test_lshift1 ( BIO * bp ) {
BIGNUM * a , * b , * c ;
int i ;
a = BN_new ( ) ;
b = BN_new ( ) ;
c = BN_new ( ) ;
BN_bntest_rand ( a , 200 , 0 , 0 ) ;
a -> neg = rand_neg ( ) ;
for ( i = 0 ;
i < num0 ;
i ++ ) {
BN_lshift1 ( b , a ) ;
if ( bp != NULL ) {
if ( ! results ) {
BN_print ( bp , a ) ;
BIO_puts ( bp , " * 2" ) ;
BIO_puts ( bp , " - " ) ;
}
BN_print ( bp , b ) ;
BIO_puts ( bp , "\n" ) ;
}
BN_add ( c , a , a ) ;
BN_sub ( a , b , c ) ;
if ( ! BN_is_zero ( a ) ) {
fprintf ( stderr , "Left shift one test failed!\n" ) ;
return 0 ;
}
BN_copy ( a , b ) ;
}
BN_free ( a ) ;
BN_free ( b ) ;
BN_free ( c ) ;
return ( 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void makeascii ( int length , const char * data , FILE * fp ) {
const u_char * data_u_char ;
const u_char * cp ;
int c ;
data_u_char = ( const u_char * ) data ;
for ( cp = data_u_char ;
cp < data_u_char + length ;
cp ++ ) {
c = ( int ) * cp ;
if ( c & 0x80 ) {
putc ( 'M' , fp ) ;
putc ( '-' , fp ) ;
c &= 0x7f ;
}
if ( c < ' ' ) {
putc ( '^' , fp ) ;
putc ( c + '@' , fp ) ;
}
else if ( 0x7f == c ) {
putc ( '^' , fp ) ;
putc ( '?' , fp ) ;
}
else putc ( c , fp ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static xmlLinkPtr xmlListLinkSearch ( xmlListPtr l , void * data ) {
xmlLinkPtr lk ;
if ( l == NULL ) return ( NULL ) ;
lk = xmlListLowerSearch ( l , data ) ;
if ( lk == l -> sentinel ) return NULL ;
else {
if ( l -> linkCompare ( lk -> data , data ) == 0 ) return lk ;
return NULL ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
unsigned long dtls1_output_cert_chain ( SSL * s , X509 * x ) {
unsigned char * p ;
int i ;
unsigned long l = 3 + DTLS1_HM_HEADER_LENGTH ;
BUF_MEM * buf ;
buf = s -> init_buf ;
if ( ! BUF_MEM_grow_clean ( buf , 10 ) ) {
SSLerr ( SSL_F_DTLS1_OUTPUT_CERT_CHAIN , ERR_R_BUF_LIB ) ;
return ( 0 ) ;
}
if ( x != NULL ) {
X509_STORE_CTX xs_ctx ;
if ( ! X509_STORE_CTX_init ( & xs_ctx , s -> ctx -> cert_store , x , NULL ) ) {
SSLerr ( SSL_F_DTLS1_OUTPUT_CERT_CHAIN , ERR_R_X509_LIB ) ;
return ( 0 ) ;
}
X509_verify_cert ( & xs_ctx ) ;
ERR_clear_error ( ) ;
for ( i = 0 ;
i < sk_X509_num ( xs_ctx . chain ) ;
i ++ ) {
x = sk_X509_value ( xs_ctx . chain , i ) ;
if ( ! dtls1_add_cert_to_buf ( buf , & l , x ) ) {
X509_STORE_CTX_cleanup ( & xs_ctx ) ;
return 0 ;
}
}
X509_STORE_CTX_cleanup ( & xs_ctx ) ;
}
for ( i = 0 ;
i < sk_X509_num ( s -> ctx -> extra_certs ) ;
i ++ ) {
x = sk_X509_value ( s -> ctx -> extra_certs , i ) ;
if ( ! dtls1_add_cert_to_buf ( buf , & l , x ) ) return 0 ;
}
l -= ( 3 + DTLS1_HM_HEADER_LENGTH ) ;
p = ( unsigned char * ) & ( buf -> data [ DTLS1_HM_HEADER_LENGTH ] ) ;
l2n3 ( l , p ) ;
l += 3 ;
p = ( unsigned char * ) & ( buf -> data [ 0 ] ) ;
p = dtls1_set_message_header ( s , p , SSL3_MT_CERTIFICATE , l , 0 , l ) ;
l += DTLS1_HM_HEADER_LENGTH ;
return ( l ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
struct condition * compiler_concat_conditions ( struct condition * a , u_int16 op , struct condition * b ) {
struct condition * head = a ;
while ( a -> next != NULL ) a = a -> next ;
a -> op = op ;
a -> next = b ;
return head ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int mv_refs_rt ( const VP9_COMMON * cm , const MACROBLOCKD * xd , const TileInfo * const tile , MODE_INFO * mi , MV_REFERENCE_FRAME ref_frame , int_mv * mv_ref_list , int mi_row , int mi_col ) {
const int * ref_sign_bias = cm -> ref_frame_sign_bias ;
int i , refmv_count = 0 ;
const POSITION * const mv_ref_search = mv_ref_blocks [ mi -> mbmi . sb_type ] ;
int different_ref_found = 0 ;
int context_counter = 0 ;
int const_motion = 0 ;
vpx_memset ( mv_ref_list , 0 , sizeof ( * mv_ref_list ) * MAX_MV_REF_CANDIDATES ) ;
for ( i = 0 ;
i < 2 ;
++ i ) {
const POSITION * const mv_ref = & mv_ref_search [ i ] ;
if ( is_inside ( tile , mi_col , mi_row , cm -> mi_rows , mv_ref ) ) {
const MODE_INFO * const candidate_mi = xd -> mi [ mv_ref -> col + mv_ref -> row * xd -> mi_stride ] . src_mi ;
const MB_MODE_INFO * const candidate = & candidate_mi -> mbmi ;
context_counter += mode_2_counter [ candidate -> mode ] ;
different_ref_found = 1 ;
if ( candidate -> ref_frame [ 0 ] == ref_frame ) ADD_MV_REF_LIST ( get_sub_block_mv ( candidate_mi , 0 , mv_ref -> col , - 1 ) ) ;
}
}
const_motion = 1 ;
for ( ;
i < MVREF_NEIGHBOURS && ! refmv_count ;
++ i ) {
const POSITION * const mv_ref = & mv_ref_search [ i ] ;
if ( is_inside ( tile , mi_col , mi_row , cm -> mi_rows , mv_ref ) ) {
const MB_MODE_INFO * const candidate = & xd -> mi [ mv_ref -> col + mv_ref -> row * xd -> mi_stride ] . src_mi -> mbmi ;
different_ref_found = 1 ;
if ( candidate -> ref_frame [ 0 ] == ref_frame ) ADD_MV_REF_LIST ( candidate -> mv [ 0 ] ) ;
}
}
if ( different_ref_found && ! refmv_count ) {
for ( i = 0 ;
i < MVREF_NEIGHBOURS ;
++ i ) {
const POSITION * mv_ref = & mv_ref_search [ i ] ;
if ( is_inside ( tile , mi_col , mi_row , cm -> mi_rows , mv_ref ) ) {
const MB_MODE_INFO * const candidate = & xd -> mi [ mv_ref -> col + mv_ref -> row * xd -> mi_stride ] . src_mi -> mbmi ;
IF_DIFF_REF_FRAME_ADD_MV ( candidate ) ;
}
}
}
Done : mi -> mbmi . mode_context [ ref_frame ] = counter_to_context [ context_counter ] ;
for ( i = 0 ;
i < MAX_MV_REF_CANDIDATES ;
++ i ) clamp_mv_ref ( & mv_ref_list [ i ] . as_mv , xd ) ;
return const_motion ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int output_to_inttgt ( int output ) {
int i ;
for ( i = 0 ;
i < ARRAY_SIZE ( inttgt_output ) ;
i ++ ) {
if ( inttgt_output [ i ] [ 1 ] == output ) {
return inttgt_output [ i ] [ 0 ] ;
}
}
abort ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( TemplateURLTest , HostAndSearchTermKey ) {
struct TestData {
const std : : string url ;
const std : : string host ;
const std : : string path ;
const std : : string search_term_key ;
}
test_data [ ] = {
{
"http://blah/?foo=bar&q={
searchTerms}
&b=x" , "blah" , "/" , "q" }
, {
"http://blah/{
searchTerms}
" , "blah" , "/" , "" }
, {
"http://blah/" , "" , "" , "" }
, {
"http://blah/?q={
searchTerms}
&x={
searchTerms}
" , "" , "" , "" }
, {
"http://{
searchTerms}
" , "" , "" , "" }
, {
"http://blah/?q={
searchTerms}
" , "blah" , "/" , "q" }
, {
"https://blah/?q={
searchTerms}
" , "blah" , "/" , "q" }
, {
"http://blah/?q=stock:{
searchTerms}
" , "blah" , "/" , "q" }
, }
;
for ( size_t i = 0 ;
i < arraysize ( test_data ) ;
++ i ) {
TemplateURLData data ;
data . SetURL ( test_data [ i ] . url ) ;
TemplateURL url ( data ) ;
EXPECT_EQ ( test_data [ i ] . host , url . url_ref ( ) . GetHost ( search_terms_data_ ) ) ;
EXPECT_EQ ( test_data [ i ] . path , url . url_ref ( ) . GetPath ( search_terms_data_ ) ) ;
EXPECT_EQ ( test_data [ i ] . search_term_key , url . url_ref ( ) . GetSearchTermKey ( search_terms_data_ ) ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int make_aos ( i_ctx_t * i_ctx_p , os_ptr op , int blk_sz , int blk_sz_last , uint file_sz ) {
stream * s ;
aos_state_t * ss ;
byte * buf ;
const int aos_buf_size = 1024 ;
uint save_space = icurrent_space ;
ialloc_set_space ( idmemory , r_space ( op ) ) ;
s = s_alloc ( imemory , "aos_stream" ) ;
ss = ( aos_state_t * ) s_alloc_state ( imemory , & st_aos_state , "st_aos_state" ) ;
buf = gs_alloc_bytes ( imemory , aos_buf_size , "aos_stream_buf" ) ;
if ( s == 0 || ss == 0 || buf == 0 ) {
gs_free_object ( imemory , buf , "aos_stream_buf" ) ;
gs_free_object ( imemory , ss , "st_aos_state" ) ;
gs_free_object ( imemory , s , "aos_stream" ) ;
ialloc_set_space ( idmemory , save_space ) ;
return_error ( gs_error_VMerror ) ;
}
ialloc_set_space ( idmemory , save_space ) ;
ss -> templat = & s_aos_template ;
ss -> blocks = * op ;
ss -> s = s ;
ss -> blk_sz = blk_sz ;
ss -> blk_sz_last = blk_sz_last ;
ss -> file_sz = file_sz ;
s_std_init ( s , buf , aos_buf_size , & s_aos_procs , s_mode_read + s_mode_seek ) ;
s -> state = ( stream_state * ) ss ;
s -> file_offset = 0 ;
s -> file_limit = S_FILE_LIMIT_MAX ;
s -> close_at_eod = false ;
s -> read_id = 1 ;
make_stream_file ( op , s , "r" ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void CheckMake ( SplinePoint * from , SplinePoint * to ) {
CheckMakeB ( & from -> me , NULL ) ;
CheckMakeB ( & from -> nextcp , & from -> me ) ;
CheckMakeB ( & to -> prevcp , & from -> nextcp ) ;
CheckMakeB ( & to -> me , & to -> prevcp ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int32_t u_scanf_pointer_handler ( UFILE * input , u_scanf_spec_info * info , ufmt_args * args , const UChar * fmt , int32_t * fmtConsumed , int32_t * argConverted ) {
( void ) fmt ;
( void ) fmtConsumed ;
int32_t len ;
int32_t skipped ;
void * result ;
void * * p = ( void * * ) ( args [ 0 ] . ptrValue ) ;
skipped = u_scanf_skip_leading_ws ( input , info -> fPadChar ) ;
ufile_fill_uchar_buffer ( input ) ;
len = ( int32_t ) ( input -> str . fLimit - input -> str . fPos ) ;
if ( info -> fWidth != - 1 ) {
len = ufmt_min ( len , info -> fWidth ) ;
}
if ( len > ( int32_t ) ( sizeof ( void * ) * 2 ) ) {
len = ( int32_t ) ( sizeof ( void * ) * 2 ) ;
}
result = ufmt_utop ( input -> str . fPos , & len ) ;
if ( ! info -> fSkipArg ) {
* p = result ;
}
input -> str . fPos += len ;
* argConverted = ! info -> fSkipArg ;
return len + skipped ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void signal_cb ( int fd , short event , void * arg ) {
struct event * signal = arg ;
printf ( "%s: got signal %d\n" , __func__ , EVENT_SIGNAL ( signal ) ) ;
if ( called >= 2 ) event_del ( signal ) ;
called ++ ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static cmsBool Type_XYZ_Write ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , void * Ptr , cmsUInt32Number nItems ) {
return _cmsWriteXYZNumber ( io , ( cmsCIEXYZ * ) Ptr ) ;
cmsUNUSED_PARAMETER ( nItems ) ;
cmsUNUSED_PARAMETER ( self ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int _ar_read_header ( struct archive_read * a , struct archive_entry * entry , struct ar * ar , const char * h , size_t * unconsumed ) {
char filename [ AR_name_size + 1 ] ;
uint64_t number ;
size_t bsd_name_length , entry_size ;
char * p , * st ;
const void * b ;
int r ;
if ( strncmp ( h + AR_fmag_offset , "`\n" , 2 ) != 0 ) {
archive_set_error ( & a -> archive , EINVAL , "Incorrect file header signature" ) ;
return ( ARCHIVE_WARN ) ;
}
strncpy ( filename , h + AR_name_offset , AR_name_size ) ;
filename [ AR_name_size ] = '\0' ;
if ( a -> archive . archive_format == ARCHIVE_FORMAT_AR ) {
if ( strncmp ( filename , "#1/" , 3 ) == 0 ) a -> archive . archive_format = ARCHIVE_FORMAT_AR_BSD ;
else if ( strchr ( filename , '/' ) != NULL ) a -> archive . archive_format = ARCHIVE_FORMAT_AR_GNU ;
else if ( strncmp ( filename , "__.SYMDEF" , 9 ) == 0 ) a -> archive . archive_format = ARCHIVE_FORMAT_AR_BSD ;
}
if ( a -> archive . archive_format == ARCHIVE_FORMAT_AR_GNU ) a -> archive . archive_format_name = "ar (GNU/SVR4)" ;
else if ( a -> archive . archive_format == ARCHIVE_FORMAT_AR_BSD ) a -> archive . archive_format_name = "ar (BSD)" ;
else a -> archive . archive_format_name = "ar" ;
p = filename + AR_name_size - 1 ;
while ( p >= filename && * p == ' ' ) {
* p = '\0' ;
p -- ;
}
if ( filename [ 0 ] != '/' && * p == '/' ) * p = '\0' ;
if ( strcmp ( filename , "//" ) == 0 ) {
ar_parse_common_header ( ar , entry , h ) ;
archive_entry_copy_pathname ( entry , filename ) ;
archive_entry_set_filetype ( entry , AE_IFREG ) ;
number = ar_atol10 ( h + AR_size_offset , AR_size_size ) ;
if ( number > SIZE_MAX ) {
archive_set_error ( & a -> archive , ARCHIVE_ERRNO_MISC , "Filename table too large" ) ;
return ( ARCHIVE_FATAL ) ;
}
entry_size = ( size_t ) number ;
if ( entry_size == 0 ) {
archive_set_error ( & a -> archive , EINVAL , "Invalid string table" ) ;
return ( ARCHIVE_WARN ) ;
}
if ( ar -> strtab != NULL ) {
archive_set_error ( & a -> archive , EINVAL , "More than one string tables exist" ) ;
return ( ARCHIVE_WARN ) ;
}
st = malloc ( entry_size ) ;
if ( st == NULL ) {
archive_set_error ( & a -> archive , ENOMEM , "Can't allocate filename table buffer" ) ;
return ( ARCHIVE_FATAL ) ;
}
ar -> strtab = st ;
ar -> strtab_size = entry_size ;
if ( * unconsumed ) {
__archive_read_consume ( a , * unconsumed ) ;
* unconsumed = 0 ;
}
if ( ( b = __archive_read_ahead ( a , entry_size , NULL ) ) == NULL ) return ( ARCHIVE_FATAL ) ;
memcpy ( st , b , entry_size ) ;
__archive_read_consume ( a , entry_size ) ;
ar -> entry_bytes_remaining = 0 ;
archive_entry_set_size ( entry , ar -> entry_bytes_remaining ) ;
return ( ar_parse_gnu_filename_table ( a ) ) ;
}
if ( filename [ 0 ] == '/' && filename [ 1 ] >= '0' && filename [ 1 ] <= '9' ) {
number = ar_atol10 ( h + AR_name_offset + 1 , AR_name_size - 1 ) ;
if ( ar -> strtab == NULL || number > ar -> strtab_size ) {
archive_set_error ( & a -> archive , EINVAL , "Can't find long filename for entry" ) ;
archive_entry_copy_pathname ( entry , filename ) ;
ar_parse_common_header ( ar , entry , h ) ;
return ( ARCHIVE_WARN ) ;
}
archive_entry_copy_pathname ( entry , & ar -> strtab [ ( size_t ) number ] ) ;
return ( ar_parse_common_header ( ar , entry , h ) ) ;
}
if ( strncmp ( filename , "#1/" , 3 ) == 0 ) {
ar_parse_common_header ( ar , entry , h ) ;
number = ar_atol10 ( h + AR_name_offset + 3 , AR_name_size - 3 ) ;
bsd_name_length = ( size_t ) number ;
if ( number > ( uint64_t ) ( bsd_name_length + 1 ) || ( int64_t ) bsd_name_length > ar -> entry_bytes_remaining ) {
archive_set_error ( & a -> archive , ARCHIVE_ERRNO_MISC , "Bad input file size" ) ;
return ( ARCHIVE_FATAL ) ;
}
ar -> entry_bytes_remaining -= bsd_name_length ;
archive_entry_set_size ( entry , ar -> entry_bytes_remaining ) ;
if ( * unconsumed ) {
__archive_read_consume ( a , * unconsumed ) ;
* unconsumed = 0 ;
}
if ( ( b = __archive_read_ahead ( a , bsd_name_length , NULL ) ) == NULL ) {
archive_set_error ( & a -> archive , ARCHIVE_ERRNO_MISC , "Truncated input file" ) ;
return ( ARCHIVE_FATAL ) ;
}
p = ( char * ) malloc ( bsd_name_length + 1 ) ;
if ( p == NULL ) {
archive_set_error ( & a -> archive , ENOMEM , "Can't allocate fname buffer" ) ;
return ( ARCHIVE_FATAL ) ;
}
strncpy ( p , b , bsd_name_length ) ;
p [ bsd_name_length ] = '\0' ;
__archive_read_consume ( a , bsd_name_length ) ;
archive_entry_copy_pathname ( entry , p ) ;
free ( p ) ;
return ( ARCHIVE_OK ) ;
}
if ( strcmp ( filename , "/" ) == 0 ) {
archive_entry_copy_pathname ( entry , "/" ) ;
r = ar_parse_common_header ( ar , entry , h ) ;
archive_entry_set_filetype ( entry , AE_IFREG ) ;
return ( r ) ;
}
if ( strcmp ( filename , "__.SYMDEF" ) == 0 ) {
archive_entry_copy_pathname ( entry , filename ) ;
return ( ar_parse_common_header ( ar , entry , h ) ) ;
}
archive_entry_copy_pathname ( entry , filename ) ;
return ( ar_parse_common_header ( ar , entry , h ) ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int header_odc ( struct archive_read * a , struct cpio * cpio , struct archive_entry * entry , size_t * namelength , size_t * name_pad ) {
const void * h ;
int r ;
const char * header ;
a -> archive . archive_format = ARCHIVE_FORMAT_CPIO_POSIX ;
a -> archive . archive_format_name = "POSIX octet-oriented cpio" ;
r = find_odc_header ( a ) ;
if ( r < ARCHIVE_WARN ) return ( r ) ;
if ( a -> archive . archive_format == ARCHIVE_FORMAT_CPIO_AFIO_LARGE ) {
int r2 = ( header_afiol ( a , cpio , entry , namelength , name_pad ) ) ;
if ( r2 == ARCHIVE_OK ) return ( r ) ;
else return ( r2 ) ;
}
h = __archive_read_ahead ( a , odc_header_size , NULL ) ;
if ( h == NULL ) return ( ARCHIVE_FATAL ) ;
header = ( const char * ) h ;
archive_entry_set_dev ( entry , ( dev_t ) atol8 ( header + odc_dev_offset , odc_dev_size ) ) ;
archive_entry_set_ino ( entry , atol8 ( header + odc_ino_offset , odc_ino_size ) ) ;
archive_entry_set_mode ( entry , ( mode_t ) atol8 ( header + odc_mode_offset , odc_mode_size ) ) ;
archive_entry_set_uid ( entry , atol8 ( header + odc_uid_offset , odc_uid_size ) ) ;
archive_entry_set_gid ( entry , atol8 ( header + odc_gid_offset , odc_gid_size ) ) ;
archive_entry_set_nlink ( entry , ( unsigned int ) atol8 ( header + odc_nlink_offset , odc_nlink_size ) ) ;
archive_entry_set_rdev ( entry , ( dev_t ) atol8 ( header + odc_rdev_offset , odc_rdev_size ) ) ;
archive_entry_set_mtime ( entry , atol8 ( header + odc_mtime_offset , odc_mtime_size ) , 0 ) ;
* namelength = ( size_t ) atol8 ( header + odc_namesize_offset , odc_namesize_size ) ;
* name_pad = 0 ;
cpio -> entry_bytes_remaining = atol8 ( header + odc_filesize_offset , odc_filesize_size ) ;
archive_entry_set_size ( entry , cpio -> entry_bytes_remaining ) ;
cpio -> entry_padding = 0 ;
__archive_read_consume ( a , odc_header_size ) ;
return ( r ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSUrlFtpTypeSet ( TSMBuffer bufp , TSMLoc obj , int type ) {
sdk_assert ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_url_handle ( obj ) == TS_SUCCESS ) ;
if ( ( type == 0 || type == 'A' || type == 'E' || type == 'I' || type == 'a' || type == 'i' || type == 'e' ) && isWriteable ( bufp ) ) {
URL u ;
u . m_heap = ( ( HdrHeapSDKHandle * ) bufp ) -> m_heap ;
u . m_url_impl = ( URLImpl * ) obj ;
u . type_set ( type ) ;
return TS_SUCCESS ;
}
return TS_ERROR ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_IS11172_multichannelType ( 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_IS11172_multichannelType , IS11172_multichannelType_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint32 dissect_netb_unknown ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * tree ) {
proto_tree_add_expert ( tree , pinfo , & ei_netb_unknown_command_data , tvb , offset + NB_COMMAND + 1 , - 1 ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static cmsBool ReadCountAndSting ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , cmsMLU * mlu , cmsUInt32Number * SizeOfTag , const char * Section ) {
cmsUInt32Number Count ;
char * Text ;
if ( * SizeOfTag < sizeof ( cmsUInt32Number ) ) return FALSE ;
if ( ! _cmsReadUInt32Number ( io , & Count ) ) return FALSE ;
if ( Count > UINT_MAX - sizeof ( cmsUInt32Number ) ) return FALSE ;
if ( * SizeOfTag < Count + sizeof ( cmsUInt32Number ) ) return FALSE ;
Text = ( char * ) _cmsMalloc ( self -> ContextID , Count + 1 ) ;
if ( Text == NULL ) return FALSE ;
if ( io -> Read ( io , Text , sizeof ( cmsUInt8Number ) , Count ) != Count ) {
_cmsFree ( self -> ContextID , Text ) ;
return FALSE ;
}
Text [ Count ] = 0 ;
cmsMLUsetASCII ( mlu , "PS" , Section , Text ) ;
_cmsFree ( self -> ContextID , Text ) ;
* SizeOfTag -= ( Count + sizeof ( cmsUInt32Number ) ) ;
return TRUE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void deloco_rgb24 ( uint8_t * dst , int size ) {
int i ;
for ( i = 0 ;
i < size ;
i += 3 ) {
int g = dst [ i + 1 ] ;
dst [ i + 0 ] += g ;
dst [ i + 2 ] += g ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void nlm_register_unmatched_res ( packet_info * pinfo , tvbuff_t * tvb , int offset ) {
nlm_msg_res_unmatched_data umd ;
nlm_msg_res_unmatched_data * old_umd ;
umd . cookie_len = tvb_get_ntohl ( tvb , offset ) ;
umd . cookie = tvb_get_ptr ( tvb , offset + 4 , - 1 ) ;
old_umd = ( nlm_msg_res_unmatched_data * ) g_hash_table_lookup ( nlm_msg_res_unmatched , ( gconstpointer ) & umd ) ;
if ( old_umd ) {
nlm_msg_res_matched_data * md_req , * md_rep ;
md_req = ( nlm_msg_res_matched_data * ) g_malloc ( sizeof ( nlm_msg_res_matched_data ) ) ;
md_req -> req_frame = old_umd -> req_frame ;
md_req -> rep_frame = pinfo -> fd -> num ;
md_req -> ns = old_umd -> ns ;
md_rep = ( nlm_msg_res_matched_data * ) g_memdup ( md_req , sizeof ( nlm_msg_res_matched_data ) ) ;
g_hash_table_insert ( nlm_msg_res_matched , GINT_TO_POINTER ( md_req -> req_frame ) , ( gpointer ) md_req ) ;
g_hash_table_insert ( nlm_msg_res_matched , GINT_TO_POINTER ( md_rep -> rep_frame ) , ( gpointer ) md_rep ) ;
g_hash_table_remove ( nlm_msg_res_unmatched , ( gconstpointer ) old_umd ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int selinux_is_sblabel_mnt ( struct super_block * sb ) {
struct superblock_security_struct * sbsec = sb -> s_security ;
return sbsec -> behavior == SECURITY_FS_USE_XATTR || sbsec -> behavior == SECURITY_FS_USE_TRANS || sbsec -> behavior == SECURITY_FS_USE_TASK || sbsec -> behavior == SECURITY_FS_USE_NATIVE || ! strcmp ( sb -> s_type -> name , "sysfs" ) || ! strcmp ( sb -> s_type -> name , "pstore" ) || ! strcmp ( sb -> s_type -> name , "debugfs" ) || ! strcmp ( sb -> s_type -> name , "rootfs" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( PrefsFunctionalTest , TestDownloadDirPref ) {
ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ;
base : : FilePath new_download_dir = DownloadPrefs ( browser ( ) -> profile ( ) ) . DownloadPath ( ) . AppendASCII ( "subdir" ) ;
base : : FilePath downloaded_pkg = new_download_dir . AppendASCII ( "a_zip_file.zip" ) ;
browser ( ) -> profile ( ) -> GetPrefs ( ) -> SetFilePath ( prefs : : kDownloadDefaultDirectory , new_download_dir ) ;
std : : unique_ptr < content : : DownloadTestObserver > downloads_observer ( CreateWaiter ( browser ( ) , 1 ) ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , embedded_test_server ( ) -> GetURL ( "/downloads/a_zip_file.zip" ) ) ;
downloads_observer -> WaitForFinished ( ) ;
base : : ScopedAllowBlockingForTesting allow_blocking ;
EXPECT_TRUE ( base : : PathExists ( downloaded_pkg ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ff_MPV_decode_mb ( MpegEncContext * s , int16_t block [ 12 ] [ 64 ] ) {
# if ! CONFIG_SMALL if ( s -> out_format == FMT_MPEG1 ) {
MPV_decode_mb_internal ( s , block , 1 ) ;
}
else # endif MPV_decode_mb_internal ( s , block , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void PNGAPI png_set_sRGB_gAMA_and_cHRM ( png_structp png_ptr , png_infop info_ptr , int intent ) {
# ifdef PNG_gAMA_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED float file_gamma ;
# endif # ifdef PNG_FIXED_POINT_SUPPORTED png_fixed_point int_file_gamma ;
# endif # endif # ifdef PNG_cHRM_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED float white_x , white_y , red_x , red_y , green_x , green_y , blue_x , blue_y ;
# endif # ifdef PNG_FIXED_POINT_SUPPORTED png_fixed_point int_white_x , int_white_y , int_red_x , int_red_y , int_green_x , int_green_y , int_blue_x , int_blue_y ;
# endif # endif png_debug1 ( 1 , "in %s storage function" , "sRGB_gAMA_and_cHRM" ) ;
if ( png_ptr == NULL || info_ptr == NULL ) return ;
png_set_sRGB ( png_ptr , info_ptr , intent ) ;
# ifdef PNG_gAMA_SUPPORTED # ifdef PNG_FLOATING_POINT_SUPPORTED file_gamma = ( float ) .45455 ;
png_set_gAMA ( png_ptr , info_ptr , file_gamma ) ;
# endif # ifdef PNG_FIXED_POINT_SUPPORTED int_file_gamma = 45455L ;
png_set_gAMA_fixed ( png_ptr , info_ptr , int_file_gamma ) ;
# endif # endif # ifdef PNG_cHRM_SUPPORTED # ifdef PNG_FIXED_POINT_SUPPORTED int_white_x = 31270L ;
int_white_y = 32900L ;
int_red_x = 64000L ;
int_red_y = 33000L ;
int_green_x = 30000L ;
int_green_y = 60000L ;
int_blue_x = 15000L ;
int_blue_y = 6000L ;
png_set_cHRM_fixed ( png_ptr , info_ptr , int_white_x , int_white_y , int_red_x , int_red_y , int_green_x , int_green_y , int_blue_x , int_blue_y ) ;
# endif # ifdef PNG_FLOATING_POINT_SUPPORTED white_x = ( float ) .3127 ;
white_y = ( float ) .3290 ;
red_x = ( float ) .64 ;
red_y = ( float ) .33 ;
green_x = ( float ) .30 ;
green_y = ( float ) .60 ;
blue_x = ( float ) .15 ;
blue_y = ( float ) .06 ;
png_set_cHRM ( png_ptr , info_ptr , white_x , white_y , red_x , red_y , green_x , green_y , blue_x , blue_y ) ;
# endif # endif }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline guint8 gst_asf_demux_get_uint8 ( guint8 * * p_data , guint64 * p_size ) {
guint8 ret ;
g_assert ( * p_size >= 1 ) ;
ret = GST_READ_UINT8 ( * p_data ) ;
* p_data += sizeof ( guint8 ) ;
* p_size -= sizeof ( guint8 ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
EXCLUSIVE_REGRESSION_TEST ( SDK_API_HttpAltInfo ) ( RegressionTest * test , int , int * pstatus ) {
* pstatus = REGRESSION_TEST_INPROGRESS ;
TSCont cont = TSContCreate ( altinfo_hook_handler , TSMutexCreate ( ) ) ;
if ( cont == nullptr ) {
SDK_RPRINT ( test , "TSHttpSsn" , "TestCase1" , TC_FAIL , "Unable to create Continuation." ) ;
* pstatus = REGRESSION_TEST_FAILED ;
return ;
}
TSHttpHookAdd ( TS_HTTP_READ_REQUEST_HDR_HOOK , cont ) ;
AltInfoTestData * socktest = ( AltInfoTestData * ) TSmalloc ( sizeof ( AltInfoTestData ) ) ;
socktest -> test = test ;
socktest -> pstatus = pstatus ;
socktest -> test_passed_txn_alt_info_client_req_get = true ;
socktest -> test_passed_txn_alt_info_cached_req_get = true ;
socktest -> test_passed_txn_alt_info_cached_resp_get = true ;
socktest -> test_passed_txn_alt_info_quality_set = true ;
socktest -> run_at_least_once = false ;
socktest -> first_time = true ;
socktest -> magic = MAGIC_ALIVE ;
TSContDataSet ( cont , socktest ) ;
socktest -> os = synserver_create ( SYNSERVER_LISTEN_PORT ) ;
synserver_start ( socktest -> os ) ;
socktest -> browser1 = synclient_txn_create ( ) ;
socktest -> browser2 = synclient_txn_create ( ) ;
socktest -> browser3 = synclient_txn_create ( ) ;
socktest -> request1 = generate_request ( 6 ) ;
socktest -> request2 = generate_request ( 7 ) ;
socktest -> request3 = generate_request ( 8 ) ;
synclient_txn_send_request ( socktest -> browser1 , socktest -> request1 ) ;
synclient_txn_send_request ( socktest -> browser2 , socktest -> request2 ) ;
TSContSchedule ( cont , 25 , TS_THREAD_POOL_DEFAULT ) ;
return ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void srtp_calc_aead_iv ( srtp_stream_ctx_t * stream , v128_t * iv , xtd_seq_num_t * seq , srtp_hdr_t * hdr ) {
v128_t in ;
v128_t salt ;
# ifdef NO_64BIT_MATH uint32_t local_roc = ( ( high32 ( * seq ) << 16 ) | ( low32 ( * seq ) >> 16 ) ) ;
uint16_t local_seq = ( uint16_t ) ( low32 ( * seq ) ) ;
# else uint32_t local_roc = ( uint32_t ) ( * seq >> 16 ) ;
uint16_t local_seq = ( uint16_t ) * seq ;
# endif memset ( & in , 0 , sizeof ( v128_t ) ) ;
memset ( & salt , 0 , sizeof ( v128_t ) ) ;
in . v16 [ 5 ] = htons ( local_seq ) ;
local_roc = htonl ( local_roc ) ;
memcpy ( & in . v16 [ 3 ] , & local_roc , sizeof ( local_roc ) ) ;
memcpy ( & in . v8 [ 2 ] , & hdr -> ssrc , 4 ) ;
debug_print ( mod_srtp , "Pre-salted RTP IV = %s\n" , v128_hex_string ( & in ) ) ;
memcpy ( salt . v8 , stream -> salt , SRTP_AEAD_SALT_LEN ) ;
debug_print ( mod_srtp , "RTP SALT = %s\n" , v128_hex_string ( & salt ) ) ;
v128_xor ( iv , & in , & salt ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void e1000e_intmgr_timer_pause ( E1000IntrDelayTimer * timer ) {
if ( timer -> running ) {
timer_del ( timer -> timer ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_truncation ( ) {
MYSQL_STMT * stmt ;
const char * stmt_text ;
int rc ;
uint bind_count ;
MYSQL_BIND * bind_array , * my_bind ;
myheader ( "test_truncation" ) ;
rc = mysql_query ( mysql , "drop table if exists t1" ) ;
myquery ( rc ) ;
stmt_text = "create table t1 (" "i8 tinyint, ui8 tinyint unsigned, " "i16 smallint, i16_1 smallint, " "ui16 smallint unsigned, i32 int, i32_1 int, " "d double, d_1 double, ch char(30), ch_1 char(30), " "tx text, tx_1 text, ch_2 char(30) " ")" ;
rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ;
myquery ( rc ) ;
{
const char insert_text [ ] = "insert into t1 VALUES (" "-10, " "200, " "32000, " "-32767, " "64000, " "1073741824, " "1073741825, " "123.456, " "-12345678910, " "'111111111111111111111111111111'," "'abcdef', " "'12345 ', " "'12345.67 ', " "'12345.67abc'" ")" ;
rc = mysql_real_query ( mysql , insert_text , strlen ( insert_text ) ) ;
myquery ( rc ) ;
}
stmt_text = "select i8 c1, i8 c2, ui8 c3, i16_1 c4, ui16 c5, " " i16 c6, ui16 c7, i32 c8, i32_1 c9, i32_1 c10, " " d c11, d_1 c12, d_1 c13, ch c14, ch_1 c15, tx c16, " " tx_1 c17, ch_2 c18 " "from t1" ;
stmt = mysql_stmt_init ( mysql ) ;
rc = mysql_stmt_prepare ( stmt , stmt_text , strlen ( stmt_text ) ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
bind_count = ( uint ) mysql_stmt_field_count ( stmt ) ;
bind_array = malloc ( sizeof ( MYSQL_BIND ) * bind_count ) ;
memset ( bind_array , 0 , sizeof ( MYSQL_BIND ) * bind_count ) ;
for ( my_bind = bind_array ;
my_bind < bind_array + bind_count ;
my_bind ++ ) my_bind -> error = & my_bind -> error_value ;
my_bind = bind_array ;
my_bind -> buffer = malloc ( sizeof ( uint8 ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_TINY ;
my_bind -> is_unsigned = TRUE ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( uint32 ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_LONG ;
my_bind -> is_unsigned = TRUE ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( int8 ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_TINY ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( uint16 ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_SHORT ;
my_bind -> is_unsigned = TRUE ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( int16 ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_SHORT ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( uint16 ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_SHORT ;
my_bind -> is_unsigned = TRUE ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( int8 ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_TINY ;
my_bind -> is_unsigned = TRUE ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( float ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_FLOAT ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( float ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_FLOAT ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( double ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_DOUBLE ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( longlong ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_LONGLONG ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( ulonglong ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_LONGLONG ;
my_bind -> is_unsigned = TRUE ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( longlong ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_LONGLONG ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( longlong ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_LONGLONG ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( longlong ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_LONGLONG ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( longlong ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_LONGLONG ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( double ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_DOUBLE ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
my_bind -> buffer = malloc ( sizeof ( double ) ) ;
my_bind -> buffer_type = MYSQL_TYPE_DOUBLE ;
rc = mysql_stmt_bind_result ( stmt , bind_array ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_fetch ( stmt ) ;
DIE_UNLESS ( rc == MYSQL_DATA_TRUNCATED ) ;
my_bind = bind_array ;
DIE_UNLESS ( * my_bind -> error && * ( int8 * ) my_bind -> buffer == - 10 ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( * my_bind -> error && * ( int32 * ) my_bind -> buffer == - 10 ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( * my_bind -> error && * ( uint8 * ) my_bind -> buffer == 200 ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( * my_bind -> error && * ( int16 * ) my_bind -> buffer == - 32767 ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( * my_bind -> error && * ( uint16 * ) my_bind -> buffer == 64000 ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( ! * my_bind -> error && * ( uint16 * ) my_bind -> buffer == 32000 ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( * my_bind -> error && * ( int8 * ) my_bind -> buffer == 0 ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( ! * my_bind -> error && * ( float * ) my_bind -> buffer == 1073741824 ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( * my_bind -> error ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( ! * my_bind -> error && * ( double * ) my_bind -> buffer == 1073741825 ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( * my_bind -> error ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( ! * my_bind -> error && * ( longlong * ) my_bind -> buffer == LL ( - 12345678910 ) ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( * my_bind -> error ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( * my_bind -> error && * ( longlong * ) my_bind -> buffer == 0 ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( ! * my_bind -> error && * ( longlong * ) my_bind -> buffer == 12345 ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( ! * my_bind -> error && * ( double * ) my_bind -> buffer == 12345.67 ) ;
DIE_UNLESS ( my_bind ++ < bind_array + bind_count ) ;
DIE_UNLESS ( * ( double * ) my_bind -> buffer == 12345.67 ) ;
mysql_stmt_close ( stmt ) ;
for ( my_bind = bind_array ;
my_bind < bind_array + bind_count ;
my_bind ++ ) free ( my_bind -> buffer ) ;
free ( bind_array ) ;
rc = mysql_query ( mysql , "drop table t1" ) ;
myquery ( rc ) ;
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.