instruction
stringclasses 1
value | input
stringlengths 31
235k
| output
class label 2
classes |
---|---|---|
Categorize the following code snippet as vulnerable or not. True or False
|
static void rice_decompress ( ALACContext * alac , int32_t * output_buffer , int nb_samples , int bps , int rice_history_mult ) {
int i ;
unsigned int history = alac -> rice_initial_history ;
int sign_modifier = 0 ;
for ( i = 0 ;
i < nb_samples ;
i ++ ) {
int k ;
unsigned int x ;
k = av_log2 ( ( history >> 9 ) + 3 ) ;
k = FFMIN ( k , alac -> rice_limit ) ;
x = decode_scalar ( & alac -> gb , k , bps ) ;
x += sign_modifier ;
sign_modifier = 0 ;
output_buffer [ i ] = ( x >> 1 ) ^ - ( x & 1 ) ;
if ( x > 0xffff ) history = 0xffff ;
else history += x * rice_history_mult - ( ( history * rice_history_mult ) >> 9 ) ;
if ( ( history < 128 ) && ( i + 1 < nb_samples ) ) {
int block_size ;
k = 7 - av_log2 ( history ) + ( ( history + 16 ) >> 6 ) ;
k = FFMIN ( k , alac -> rice_limit ) ;
block_size = decode_scalar ( & alac -> gb , k , 16 ) ;
if ( block_size > 0 ) {
if ( block_size >= nb_samples - i ) {
av_log ( alac -> avctx , AV_LOG_ERROR , "invalid zero block size of %d %d %d\n" , block_size , nb_samples , i ) ;
block_size = nb_samples - i - 1 ;
}
memset ( & output_buffer [ i + 1 ] , 0 , block_size * sizeof ( * output_buffer ) ) ;
i += block_size ;
}
if ( block_size <= 0xffff ) sign_modifier = 1 ;
history = 0 ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void proto_tree_set_boolean ( field_info * fi , guint64 value ) {
proto_tree_set_uint64 ( fi , value ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
const char * TSHttpTxnPluginTagGet ( TSHttpTxn txnp ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
HttpSM * sm = reinterpret_cast < HttpSM * > ( txnp ) ;
return sm -> plugin_tag ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int aes_ecb_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) {
size_t bl = EVP_CIPHER_CTX_block_size ( ctx ) ;
size_t i ;
EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ;
if ( len < bl ) return 1 ;
for ( i = 0 , len -= bl ;
i <= len ;
i += bl ) ( * dat -> block ) ( in + i , out + i , & dat -> ks ) ;
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void rd_pick_partition ( VP9_COMP * cpi , const TileInfo * const tile , TOKENEXTRA * * tp , int mi_row , int mi_col , BLOCK_SIZE bsize , int * rate , int64_t * dist , int64_t best_rd , PC_TREE * pc_tree ) {
VP9_COMMON * const cm = & cpi -> common ;
MACROBLOCK * const x = & cpi -> mb ;
MACROBLOCKD * const xd = & x -> e_mbd ;
const int mi_step = num_8x8_blocks_wide_lookup [ bsize ] / 2 ;
ENTROPY_CONTEXT l [ 16 * MAX_MB_PLANE ] , a [ 16 * MAX_MB_PLANE ] ;
PARTITION_CONTEXT sl [ 8 ] , sa [ 8 ] ;
TOKENEXTRA * tp_orig = * tp ;
PICK_MODE_CONTEXT * ctx = & pc_tree -> none ;
int i , pl ;
BLOCK_SIZE subsize ;
int this_rate , sum_rate = 0 , best_rate = INT_MAX ;
int64_t this_dist , sum_dist = 0 , best_dist = INT64_MAX ;
int64_t sum_rd = 0 ;
int do_split = bsize >= BLOCK_8X8 ;
int do_rect = 1 ;
const int force_horz_split = ( mi_row + mi_step >= cm -> mi_rows ) ;
const int force_vert_split = ( mi_col + mi_step >= cm -> mi_cols ) ;
const int xss = x -> e_mbd . plane [ 1 ] . subsampling_x ;
const int yss = x -> e_mbd . plane [ 1 ] . subsampling_y ;
BLOCK_SIZE min_size = cpi -> sf . min_partition_size ;
BLOCK_SIZE max_size = cpi -> sf . max_partition_size ;
# if CONFIG_FP_MB_STATS unsigned int src_diff_var = UINT_MAX ;
int none_complexity = 0 ;
# endif int partition_none_allowed = ! force_horz_split && ! force_vert_split ;
int partition_horz_allowed = ! force_vert_split && yss <= xss && bsize >= BLOCK_8X8 ;
int partition_vert_allowed = ! force_horz_split && xss <= yss && bsize >= BLOCK_8X8 ;
( void ) * tp_orig ;
assert ( num_8x8_blocks_wide_lookup [ bsize ] == num_8x8_blocks_high_lookup [ bsize ] ) ;
set_offsets ( cpi , tile , mi_row , mi_col , bsize ) ;
if ( bsize == BLOCK_16X16 && cpi -> oxcf . aq_mode ) x -> mb_energy = vp9_block_energy ( cpi , x , bsize ) ;
if ( cpi -> sf . cb_partition_search && bsize == BLOCK_16X16 ) {
int cb_partition_search_ctrl = ( ( pc_tree -> index == 0 || pc_tree -> index == 3 ) + get_chessboard_index ( cm -> current_video_frame ) ) & 0x1 ;
if ( cb_partition_search_ctrl && bsize > min_size && bsize < max_size ) set_partition_range ( cm , xd , mi_row , mi_col , bsize , & min_size , & max_size ) ;
}
if ( cpi -> sf . auto_min_max_partition_size ) {
partition_none_allowed &= ( bsize <= max_size && bsize >= min_size ) ;
partition_horz_allowed &= ( ( bsize <= max_size && bsize > min_size ) || force_horz_split ) ;
partition_vert_allowed &= ( ( bsize <= max_size && bsize > min_size ) || force_vert_split ) ;
do_split &= bsize > min_size ;
}
if ( cpi -> sf . use_square_partition_only ) {
partition_horz_allowed &= force_horz_split ;
partition_vert_allowed &= force_vert_split ;
}
save_context ( cpi , mi_row , mi_col , a , l , sa , sl , bsize ) ;
# if CONFIG_FP_MB_STATS if ( cpi -> use_fp_mb_stats ) {
set_offsets ( cpi , tile , mi_row , mi_col , bsize ) ;
src_diff_var = get_sby_perpixel_diff_variance ( cpi , & cpi -> mb . plane [ 0 ] . src , mi_row , mi_col , bsize ) ;
}
# endif # if CONFIG_FP_MB_STATS if ( cpi -> use_fp_mb_stats && bsize >= BLOCK_32X32 && do_split && partition_none_allowed && src_diff_var > 4 && cm -> base_qindex < qindex_split_threshold_lookup [ bsize ] ) {
int mb_row = mi_row >> 1 ;
int mb_col = mi_col >> 1 ;
int mb_row_end = MIN ( mb_row + num_16x16_blocks_high_lookup [ bsize ] , cm -> mb_rows ) ;
int mb_col_end = MIN ( mb_col + num_16x16_blocks_wide_lookup [ bsize ] , cm -> mb_cols ) ;
int r , c ;
for ( r = mb_row ;
r < mb_row_end ;
r ++ ) {
for ( c = mb_col ;
c < mb_col_end ;
c ++ ) {
const int mb_index = r * cm -> mb_cols + c ;
MOTION_DIRECTION this_mv ;
MOTION_DIRECTION right_mv ;
MOTION_DIRECTION bottom_mv ;
this_mv = get_motion_direction_fp ( cpi -> twopass . this_frame_mb_stats [ mb_index ] ) ;
if ( c != mb_col_end - 1 ) {
right_mv = get_motion_direction_fp ( cpi -> twopass . this_frame_mb_stats [ mb_index + 1 ] ) ;
none_complexity += get_motion_inconsistency ( this_mv , right_mv ) ;
}
if ( r != mb_row_end - 1 ) {
bottom_mv = get_motion_direction_fp ( cpi -> twopass . this_frame_mb_stats [ mb_index + cm -> mb_cols ] ) ;
none_complexity += get_motion_inconsistency ( this_mv , bottom_mv ) ;
}
}
}
if ( none_complexity > complexity_16x16_blocks_threshold [ bsize ] ) {
partition_none_allowed = 0 ;
}
}
# endif if ( partition_none_allowed ) {
rd_pick_sb_modes ( cpi , tile , mi_row , mi_col , & this_rate , & this_dist , bsize , ctx , best_rd , 0 ) ;
if ( this_rate != INT_MAX ) {
if ( bsize >= BLOCK_8X8 ) {
pl = partition_plane_context ( xd , mi_row , mi_col , bsize ) ;
this_rate += cpi -> partition_cost [ pl ] [ PARTITION_NONE ] ;
}
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , this_rate , this_dist ) ;
if ( sum_rd < best_rd ) {
int64_t dist_breakout_thr = cpi -> sf . partition_search_breakout_dist_thr ;
int rate_breakout_thr = cpi -> sf . partition_search_breakout_rate_thr ;
best_rate = this_rate ;
best_dist = this_dist ;
best_rd = sum_rd ;
if ( bsize >= BLOCK_8X8 ) pc_tree -> partitioning = PARTITION_NONE ;
dist_breakout_thr >>= 8 - ( b_width_log2 ( bsize ) + b_height_log2 ( bsize ) ) ;
if ( ! x -> e_mbd . lossless && ( ctx -> skippable && best_dist < dist_breakout_thr && best_rate < rate_breakout_thr ) ) {
do_split = 0 ;
do_rect = 0 ;
}
# if CONFIG_FP_MB_STATS if ( cpi -> use_fp_mb_stats && do_split != 0 && cm -> base_qindex > qindex_skip_threshold_lookup [ bsize ] ) {
int mb_row = mi_row >> 1 ;
int mb_col = mi_col >> 1 ;
int mb_row_end = MIN ( mb_row + num_16x16_blocks_high_lookup [ bsize ] , cm -> mb_rows ) ;
int mb_col_end = MIN ( mb_col + num_16x16_blocks_wide_lookup [ bsize ] , cm -> mb_cols ) ;
int r , c ;
int skip = 1 ;
for ( r = mb_row ;
r < mb_row_end ;
r ++ ) {
for ( c = mb_col ;
c < mb_col_end ;
c ++ ) {
const int mb_index = r * cm -> mb_cols + c ;
if ( ! ( cpi -> twopass . this_frame_mb_stats [ mb_index ] & FPMB_MOTION_ZERO_MASK ) || ! ( cpi -> twopass . this_frame_mb_stats [ mb_index ] & FPMB_ERROR_SMALL_MASK ) ) {
skip = 0 ;
break ;
}
}
if ( skip == 0 ) {
break ;
}
}
if ( skip ) {
if ( src_diff_var == UINT_MAX ) {
set_offsets ( cpi , tile , mi_row , mi_col , bsize ) ;
src_diff_var = get_sby_perpixel_diff_variance ( cpi , & cpi -> mb . plane [ 0 ] . src , mi_row , mi_col , bsize ) ;
}
if ( src_diff_var < 8 ) {
do_split = 0 ;
do_rect = 0 ;
}
}
}
# endif }
}
restore_context ( cpi , mi_row , mi_col , a , l , sa , sl , bsize ) ;
}
if ( cpi -> sf . adaptive_motion_search ) store_pred_mv ( x , ctx ) ;
sum_rd = 0 ;
if ( do_split ) {
subsize = get_subsize ( bsize , PARTITION_SPLIT ) ;
if ( bsize == BLOCK_8X8 ) {
i = 4 ;
if ( cpi -> sf . adaptive_pred_interp_filter && partition_none_allowed ) pc_tree -> leaf_split [ 0 ] -> pred_interp_filter = ctx -> mic . mbmi . interp_filter ;
rd_pick_sb_modes ( cpi , tile , mi_row , mi_col , & sum_rate , & sum_dist , subsize , pc_tree -> leaf_split [ 0 ] , best_rd , 0 ) ;
if ( sum_rate == INT_MAX ) sum_rd = INT64_MAX ;
else sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
}
else {
for ( i = 0 ;
i < 4 && sum_rd < best_rd ;
++ i ) {
const int x_idx = ( i & 1 ) * mi_step ;
const int y_idx = ( i >> 1 ) * mi_step ;
if ( mi_row + y_idx >= cm -> mi_rows || mi_col + x_idx >= cm -> mi_cols ) continue ;
if ( cpi -> sf . adaptive_motion_search ) load_pred_mv ( x , ctx ) ;
pc_tree -> split [ i ] -> index = i ;
rd_pick_partition ( cpi , tile , tp , mi_row + y_idx , mi_col + x_idx , subsize , & this_rate , & this_dist , best_rd - sum_rd , pc_tree -> split [ i ] ) ;
if ( this_rate == INT_MAX ) {
sum_rd = INT64_MAX ;
}
else {
sum_rate += this_rate ;
sum_dist += this_dist ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
}
}
}
if ( sum_rd < best_rd && i == 4 ) {
pl = partition_plane_context ( xd , mi_row , mi_col , bsize ) ;
sum_rate += cpi -> partition_cost [ pl ] [ PARTITION_SPLIT ] ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
if ( sum_rd < best_rd ) {
best_rate = sum_rate ;
best_dist = sum_dist ;
best_rd = sum_rd ;
pc_tree -> partitioning = PARTITION_SPLIT ;
}
}
else {
if ( cpi -> sf . less_rectangular_check ) do_rect &= ! partition_none_allowed ;
}
restore_context ( cpi , mi_row , mi_col , a , l , sa , sl , bsize ) ;
}
if ( partition_horz_allowed && do_rect ) {
subsize = get_subsize ( bsize , PARTITION_HORZ ) ;
if ( cpi -> sf . adaptive_motion_search ) load_pred_mv ( x , ctx ) ;
if ( cpi -> sf . adaptive_pred_interp_filter && bsize == BLOCK_8X8 && partition_none_allowed ) pc_tree -> horizontal [ 0 ] . pred_interp_filter = ctx -> mic . mbmi . interp_filter ;
rd_pick_sb_modes ( cpi , tile , mi_row , mi_col , & sum_rate , & sum_dist , subsize , & pc_tree -> horizontal [ 0 ] , best_rd , 0 ) ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
if ( sum_rd < best_rd && mi_row + mi_step < cm -> mi_rows ) {
PICK_MODE_CONTEXT * ctx = & pc_tree -> horizontal [ 0 ] ;
update_state ( cpi , ctx , mi_row , mi_col , subsize , 0 ) ;
encode_superblock ( cpi , tp , 0 , mi_row , mi_col , subsize , ctx ) ;
if ( cpi -> sf . adaptive_motion_search ) load_pred_mv ( x , ctx ) ;
if ( cpi -> sf . adaptive_pred_interp_filter && bsize == BLOCK_8X8 && partition_none_allowed ) pc_tree -> horizontal [ 1 ] . pred_interp_filter = ctx -> mic . mbmi . interp_filter ;
rd_pick_sb_modes ( cpi , tile , mi_row + mi_step , mi_col , & this_rate , & this_dist , subsize , & pc_tree -> horizontal [ 1 ] , best_rd - sum_rd , 1 ) ;
if ( this_rate == INT_MAX ) {
sum_rd = INT64_MAX ;
}
else {
sum_rate += this_rate ;
sum_dist += this_dist ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
}
}
if ( sum_rd < best_rd ) {
pl = partition_plane_context ( xd , mi_row , mi_col , bsize ) ;
sum_rate += cpi -> partition_cost [ pl ] [ PARTITION_HORZ ] ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
if ( sum_rd < best_rd ) {
best_rd = sum_rd ;
best_rate = sum_rate ;
best_dist = sum_dist ;
pc_tree -> partitioning = PARTITION_HORZ ;
}
}
restore_context ( cpi , mi_row , mi_col , a , l , sa , sl , bsize ) ;
}
if ( partition_vert_allowed && do_rect ) {
subsize = get_subsize ( bsize , PARTITION_VERT ) ;
if ( cpi -> sf . adaptive_motion_search ) load_pred_mv ( x , ctx ) ;
if ( cpi -> sf . adaptive_pred_interp_filter && bsize == BLOCK_8X8 && partition_none_allowed ) pc_tree -> vertical [ 0 ] . pred_interp_filter = ctx -> mic . mbmi . interp_filter ;
rd_pick_sb_modes ( cpi , tile , mi_row , mi_col , & sum_rate , & sum_dist , subsize , & pc_tree -> vertical [ 0 ] , best_rd , 0 ) ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
if ( sum_rd < best_rd && mi_col + mi_step < cm -> mi_cols ) {
update_state ( cpi , & pc_tree -> vertical [ 0 ] , mi_row , mi_col , subsize , 0 ) ;
encode_superblock ( cpi , tp , 0 , mi_row , mi_col , subsize , & pc_tree -> vertical [ 0 ] ) ;
if ( cpi -> sf . adaptive_motion_search ) load_pred_mv ( x , ctx ) ;
if ( cpi -> sf . adaptive_pred_interp_filter && bsize == BLOCK_8X8 && partition_none_allowed ) pc_tree -> vertical [ 1 ] . pred_interp_filter = ctx -> mic . mbmi . interp_filter ;
rd_pick_sb_modes ( cpi , tile , mi_row , mi_col + mi_step , & this_rate , & this_dist , subsize , & pc_tree -> vertical [ 1 ] , best_rd - sum_rd , 1 ) ;
if ( this_rate == INT_MAX ) {
sum_rd = INT64_MAX ;
}
else {
sum_rate += this_rate ;
sum_dist += this_dist ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
}
}
if ( sum_rd < best_rd ) {
pl = partition_plane_context ( xd , mi_row , mi_col , bsize ) ;
sum_rate += cpi -> partition_cost [ pl ] [ PARTITION_VERT ] ;
sum_rd = RDCOST ( x -> rdmult , x -> rddiv , sum_rate , sum_dist ) ;
if ( sum_rd < best_rd ) {
best_rate = sum_rate ;
best_dist = sum_dist ;
best_rd = sum_rd ;
pc_tree -> partitioning = PARTITION_VERT ;
}
}
restore_context ( cpi , mi_row , mi_col , a , l , sa , sl , bsize ) ;
}
( void ) best_rd ;
* rate = best_rate ;
* dist = best_dist ;
if ( best_rate < INT_MAX && best_dist < INT64_MAX && pc_tree -> index != 3 ) {
int output_enabled = ( bsize == BLOCK_64X64 ) ;
if ( ( cpi -> oxcf . aq_mode == COMPLEXITY_AQ ) && cm -> seg . update_map ) vp9_select_in_frame_q_segment ( cpi , mi_row , mi_col , output_enabled , best_rate ) ;
if ( cpi -> oxcf . aq_mode == CYCLIC_REFRESH_AQ ) vp9_cyclic_refresh_set_rate_and_dist_sb ( cpi -> cyclic_refresh , best_rate , best_dist ) ;
encode_sb ( cpi , tile , tp , mi_row , mi_col , output_enabled , bsize , pc_tree ) ;
}
if ( bsize == BLOCK_64X64 ) {
assert ( tp_orig < * tp ) ;
assert ( best_rate < INT_MAX ) ;
assert ( best_dist < INT64_MAX ) ;
}
else {
assert ( tp_orig == * tp ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( PrintPreviewUIUnitTest , PrintPreviewDraftPages ) {
WebContents * initiator = browser ( ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) ;
ASSERT_TRUE ( initiator ) ;
printing : : PrintPreviewDialogController * controller = printing : : PrintPreviewDialogController : : GetInstance ( ) ;
ASSERT_TRUE ( controller ) ;
printing : : PrintViewManager * print_view_manager = printing : : PrintViewManager : : FromWebContents ( initiator ) ;
print_view_manager -> PrintPreviewNow ( false ) ;
WebContents * preview_dialog = controller -> GetOrCreatePreviewDialog ( initiator ) ;
EXPECT_NE ( initiator , preview_dialog ) ;
EXPECT_EQ ( 1 , browser ( ) -> tab_strip_model ( ) -> count ( ) ) ;
EXPECT_TRUE ( IsShowingWebContentsModalDialog ( initiator ) ) ;
PrintPreviewUI * preview_ui = static_cast < PrintPreviewUI * > ( preview_dialog -> GetWebUI ( ) -> GetController ( ) ) ;
ASSERT_TRUE ( preview_ui != NULL ) ;
scoped_refptr < base : : RefCountedBytes > data ;
preview_ui -> GetPrintPreviewDataForIndex ( printing : : FIRST_PAGE_INDEX , & data ) ;
EXPECT_EQ ( NULL , data . get ( ) ) ;
scoped_refptr < base : : RefCountedBytes > dummy_data = CreateTestData ( ) ;
preview_ui -> SetPrintPreviewDataForIndex ( printing : : FIRST_PAGE_INDEX , dummy_data . get ( ) ) ;
preview_ui -> GetPrintPreviewDataForIndex ( printing : : FIRST_PAGE_INDEX , & data ) ;
EXPECT_EQ ( dummy_data -> size ( ) , data -> size ( ) ) ;
EXPECT_EQ ( dummy_data . get ( ) , data . get ( ) ) ;
preview_ui -> SetPrintPreviewDataForIndex ( printing : : FIRST_PAGE_INDEX + 2 , dummy_data . get ( ) ) ;
preview_ui -> GetPrintPreviewDataForIndex ( printing : : FIRST_PAGE_INDEX + 2 , & data ) ;
EXPECT_EQ ( dummy_data -> size ( ) , data -> size ( ) ) ;
EXPECT_EQ ( dummy_data . get ( ) , data . get ( ) ) ;
preview_ui -> GetPrintPreviewDataForIndex ( printing : : FIRST_PAGE_INDEX + 1 , & data ) ;
EXPECT_EQ ( NULL , data . get ( ) ) ;
preview_ui -> SetPrintPreviewDataForIndex ( printing : : FIRST_PAGE_INDEX + 1 , dummy_data . get ( ) ) ;
preview_ui -> GetPrintPreviewDataForIndex ( printing : : FIRST_PAGE_INDEX + 1 , & data ) ;
EXPECT_EQ ( dummy_data -> size ( ) , data -> size ( ) ) ;
EXPECT_EQ ( dummy_data . get ( ) , data . get ( ) ) ;
preview_ui -> ClearAllPreviewData ( ) ;
preview_ui -> GetPrintPreviewDataForIndex ( printing : : FIRST_PAGE_INDEX , & data ) ;
EXPECT_EQ ( NULL , data . get ( ) ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int zreusablestream ( i_ctx_t * i_ctx_p ) {
os_ptr op = osp ;
os_ptr source_op = op - 1 ;
long length = max_long ;
bool close_source ;
int code ;
check_type ( * op , t_boolean ) ;
close_source = op -> value . boolval ;
if ( r_has_type ( source_op , t_string ) ) {
uint size = r_size ( source_op ) ;
check_read ( * source_op ) ;
code = make_rss ( i_ctx_p , source_op , source_op -> value . const_bytes , size , r_space ( source_op ) , 0L , size , false ) ;
}
else if ( r_has_type ( source_op , t_astruct ) ) {
uint size = gs_object_size ( imemory , source_op -> value . pstruct ) ;
if ( gs_object_type ( imemory , source_op -> value . pstruct ) != & st_bytes ) return_error ( gs_error_rangecheck ) ;
check_read ( * source_op ) ;
code = make_rss ( i_ctx_p , source_op , ( const byte * ) source_op -> value . pstruct , size , r_space ( source_op ) , 0L , size , true ) ;
}
else if ( r_has_type ( source_op , t_array ) ) {
int i , blk_cnt , blk_sz ;
ref * blk_ref ;
ulong filelen = 0 ;
check_read ( * source_op ) ;
blk_cnt = r_size ( source_op ) ;
blk_ref = source_op -> value . refs ;
if ( blk_cnt > 0 ) {
blk_sz = r_size ( blk_ref ) ;
for ( i = 0 ;
i < blk_cnt ;
i ++ ) {
int len ;
check_read_type ( blk_ref [ i ] , t_string ) ;
len = r_size ( & blk_ref [ i ] ) ;
if ( len > blk_sz || ( len < blk_sz && i < blk_cnt - 1 ) ) return_error ( gs_error_rangecheck ) ;
filelen += len ;
}
}
if ( filelen == 0 ) {
code = make_rss ( i_ctx_p , source_op , ( unsigned char * ) "" , 0 , r_space ( source_op ) , 0 , 0 , false ) ;
}
else {
code = make_aos ( i_ctx_p , source_op , blk_sz , r_size ( & blk_ref [ blk_cnt - 1 ] ) , filelen ) ;
}
}
else {
long offset = 0 ;
stream * source ;
stream * s ;
check_read_file ( i_ctx_p , source , source_op ) ;
s = source ;
rs : if ( s -> cbuf_string . data != 0 ) {
long pos = stell ( s ) ;
long avail = sbufavailable ( s ) + pos ;
offset += pos ;
code = make_rss ( i_ctx_p , source_op , s -> cbuf_string . data , s -> cbuf_string . size , imemory_space ( ( const gs_ref_memory_t * ) s -> memory ) , offset , min ( avail , length ) , false ) ;
}
else if ( s -> file != 0 ) {
if ( ~ s -> modes & ( s_mode_read | s_mode_seek ) ) return_error ( gs_error_ioerror ) ;
code = make_rfs ( i_ctx_p , source_op , s , offset + stell ( s ) , length ) ;
}
else if ( s -> state -> templat == & s_SFD_template ) {
const stream_SFD_state * const sfd_state = ( const stream_SFD_state * ) s -> state ;
if ( sfd_state -> eod . size != 0 ) return_error ( gs_error_rangecheck ) ;
offset += sfd_state -> skip_count - sbufavailable ( s ) ;
if ( sfd_state -> count != 0 ) {
long left = max ( sfd_state -> count , 0 ) + sbufavailable ( s ) ;
if ( left < length ) length = left ;
}
s = s -> strm ;
goto rs ;
}
else return_error ( gs_error_rangecheck ) ;
if ( close_source ) {
stream * rs = fptr ( source_op ) ;
rs -> strm = source ;
rs -> close_strm = true ;
}
}
if ( code >= 0 ) pop ( 1 ) ;
return code ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_t38_tcp_pdu ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree ) {
proto_item * it ;
proto_tree * tr ;
guint32 offset = 0 ;
tvbuff_t * next_tvb ;
guint16 ifp_packet_number = 1 ;
col_set_str ( pinfo -> cinfo , COL_PROTOCOL , "T.38" ) ;
col_clear ( pinfo -> cinfo , COL_INFO ) ;
primary_part = TRUE ;
Data_Field_item_num = 0 ;
it = proto_tree_add_protocol_format ( tree , proto_t38 , tvb , 0 , - 1 , "ITU-T Recommendation T.38" ) ;
tr = proto_item_add_subtree ( it , ett_t38 ) ;
init_t38_info_conv ( pinfo ) ;
if ( global_t38_show_setup_info ) {
show_setup_info ( tvb , tr , p_t38_packet_conv ) ;
}
col_append_str ( pinfo -> cinfo , COL_INFO , "TCP: IFPPacket" ) ;
while ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) {
next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
offset += dissect_IFPPacket_PDU ( next_tvb , pinfo , tr , NULL ) ;
ifp_packet_number ++ ;
if ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) {
if ( t38_tpkt_usage == T38_TPKT_ALWAYS ) {
proto_tree_add_expert_format ( tr , pinfo , & ei_t38_malformed , tvb , offset , tvb_reported_length_remaining ( tvb , offset ) , "[MALFORMED PACKET or wrong preference settings]" ) ;
col_append_str ( pinfo -> cinfo , COL_INFO , " [Malformed?]" ) ;
break ;
}
else {
col_append_fstr ( pinfo -> cinfo , COL_INFO , " IFPPacket#%u" , ifp_packet_number ) ;
}
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint16 de_network_name ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo , guint32 offset , guint len , gchar * add_string _U_ , int string_len _U_ ) {
guint8 oct ;
guint32 curr_offset ;
guint8 coding_scheme , num_spare_bits ;
guint32 num_text_bits ;
proto_item * item ;
curr_offset = offset ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
proto_tree_add_item ( tree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
coding_scheme = ( oct & 0x70 ) >> 4 ;
proto_tree_add_item ( tree , hf_gsm_a_dtap_coding_scheme , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_gsm_a_dtap_add_ci , tvb , curr_offset , 1 , ENC_NA ) ;
num_spare_bits = oct & 0x07 ;
item = proto_tree_add_item ( tree , hf_gsm_a_dtap_number_of_spare_bits , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
switch ( coding_scheme ) {
case 0 : num_text_bits = ( ( len - 1 ) << 3 ) - num_spare_bits ;
if ( num_spare_bits && ( num_text_bits % 7 ) ) {
expert_add_info ( pinfo , item , & ei_gsm_a_dtap_text_string_not_multiple_of_7 ) ;
}
proto_tree_add_ts_23_038_7bits_item ( tree , hf_gsm_a_dtap_text_string , tvb , curr_offset << 3 , num_text_bits / 7 ) ;
break ;
case 1 : proto_tree_add_item ( tree , hf_gsm_a_dtap_text_string , tvb , curr_offset , len - 1 , ENC_UCS_2 | ENC_BIG_ENDIAN ) ;
break ;
default : proto_tree_add_expert ( tree , pinfo , & ei_gsm_a_dtap_coding_scheme , tvb , curr_offset , len - 1 ) ;
}
return ( len ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ipvideo_decode_block_opcode_0x5 ( IpvideoContext * s , AVFrame * frame ) {
signed char x , y ;
x = bytestream2_get_byte ( & s -> stream_ptr ) ;
y = bytestream2_get_byte ( & s -> stream_ptr ) ;
av_dlog ( NULL , " motion bytes = %d, %d\n" , x , y ) ;
return copy_from ( s , s -> last_frame , frame , x , y ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int input_stats ( TWO_PASS * p , FIRSTPASS_STATS * fps ) {
if ( p -> stats_in >= p -> stats_in_end ) return EOF ;
* fps = * p -> stats_in ;
++ p -> stats_in ;
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int kvm_arch_msi_data_to_gsi ( uint32_t data ) {
abort ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
afs_int32 SPR_GetCPS2 ( struct rx_call * call , afs_int32 aid , afs_int32 ahost , prlist * alist , afs_int32 * over ) {
afs_int32 code ;
afs_int32 cid = ANONYMOUSID ;
code = getCPS2 ( call , aid , ahost , alist , over , & cid ) ;
osi_auditU ( call , PTS_GetCPS2Event , code , AUD_ID , aid , AUD_HOST , htonl ( ahost ) , AUD_END ) ;
ViceLog ( 125 , ( "PTS_GetCPS2: code %d cid %d aid %d ahost %d\n" , code , cid , aid , ahost ) ) ;
return code ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void e1000e_core_pci_realize ( E1000ECore * core , const uint16_t * eeprom_templ , uint32_t eeprom_size , const uint8_t * macaddr ) {
int i ;
core -> autoneg_timer = timer_new_ms ( QEMU_CLOCK_VIRTUAL , e1000e_autoneg_timer , core ) ;
e1000e_intrmgr_pci_realize ( core ) ;
core -> vmstate = qemu_add_vm_change_state_handler ( e1000e_vm_state_change , core ) ;
for ( i = 0 ;
i < E1000E_NUM_QUEUES ;
i ++ ) {
net_tx_pkt_init ( & core -> tx [ i ] . tx_pkt , core -> owner , E1000E_MAX_TX_FRAGS , core -> has_vnet ) ;
}
net_rx_pkt_init ( & core -> rx_pkt , core -> has_vnet ) ;
e1000x_core_prepare_eeprom ( core -> eeprom , eeprom_templ , eeprom_size , PCI_DEVICE_GET_CLASS ( core -> owner ) -> device_id , macaddr ) ;
e1000e_update_rx_offloads ( core ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static struct branch * new_branch ( const char * name ) {
unsigned int hc = hc_str ( name , strlen ( name ) ) % branch_table_sz ;
struct branch * b = lookup_branch ( name ) ;
if ( b ) die ( "Invalid attempt to create duplicate branch: %s" , name ) ;
if ( check_refname_format ( name , REFNAME_ALLOW_ONELEVEL ) ) die ( "Branch name doesn't conform to GIT standards: %s" , name ) ;
b = pool_calloc ( 1 , sizeof ( struct branch ) ) ;
b -> name = pool_strdup ( name ) ;
b -> table_next_branch = branch_table [ hc ] ;
b -> branch_tree . versions [ 0 ] . mode = S_IFDIR ;
b -> branch_tree . versions [ 1 ] . mode = S_IFDIR ;
b -> num_notes = 0 ;
b -> active = 0 ;
b -> pack_id = MAX_PACK_ID ;
branch_table [ hc ] = b ;
branch_count ++ ;
return b ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * ContentTypeForFilename ( const char * filename , const char * prevtype ) {
const char * contenttype = NULL ;
unsigned int i ;
struct ContentType {
const char * extension ;
const char * type ;
}
;
static const struct ContentType ctts [ ] = {
{
".gif" , "image/gif" }
, {
".jpg" , "image/jpeg" }
, {
".jpeg" , "image/jpeg" }
, {
".txt" , "text/plain" }
, {
".html" , "text/html" }
, {
".xml" , "application/xml" }
}
;
if ( prevtype ) contenttype = prevtype ;
else contenttype = HTTPPOST_CONTENTTYPE_DEFAULT ;
if ( filename ) {
for ( i = 0 ;
i < sizeof ( ctts ) / sizeof ( ctts [ 0 ] ) ;
i ++ ) {
if ( strlen ( filename ) >= strlen ( ctts [ i ] . extension ) ) {
if ( strequal ( filename + strlen ( filename ) - strlen ( ctts [ i ] . extension ) , ctts [ i ] . extension ) ) {
contenttype = ctts [ i ] . type ;
break ;
}
}
}
}
return contenttype ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static cmsUInt32Number uipow ( cmsUInt32Number n , cmsUInt32Number a , cmsUInt32Number b ) {
cmsUInt32Number rv = 1 , rc ;
if ( a == 0 ) return 0 ;
if ( n == 0 ) return 0 ;
for ( ;
b > 0 ;
b -- ) {
rv *= a ;
if ( rv > UINT_MAX / a ) return ( cmsUInt32Number ) - 1 ;
}
rc = rv * n ;
if ( rv != rc / n ) return ( cmsUInt32Number ) - 1 ;
return rc ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static struct usb_device * usbdev_lookup_by_devt ( dev_t devt ) {
struct device * dev ;
dev = bus_find_device ( & usb_bus_type , NULL , ( void * ) ( unsigned long ) devt , match_devt ) ;
if ( ! dev ) return NULL ;
return to_usb_device ( dev ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
RSA * d2i_RSA_PUBKEY_bio ( BIO * bp , RSA * * rsa ) {
return ASN1_d2i_bio_of ( RSA , RSA_new , d2i_RSA_PUBKEY , bp , rsa ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int row_call_method ( const char * method , INTERNAL_FUNCTION_PARAMETERS ) {
return FAILURE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
DumpOptions * NewDumpOptions ( void ) {
DumpOptions * opts = ( DumpOptions * ) pg_malloc ( sizeof ( DumpOptions ) ) ;
InitDumpOptions ( opts ) ;
return opts ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int qemuMonitorJSONStartCPUs ( qemuMonitorPtr mon , virConnectPtr conn ATTRIBUTE_UNUSED ) {
int ret ;
virJSONValuePtr cmd = qemuMonitorJSONMakeCommand ( "cont" , NULL ) ;
virJSONValuePtr reply = NULL ;
int i = 0 , timeout = 3 ;
if ( ! cmd ) return - 1 ;
do {
ret = qemuMonitorJSONCommand ( mon , cmd , & reply ) ;
if ( ret != 0 ) break ;
if ( ( ret = qemuMonitorJSONCheckError ( cmd , reply ) ) == 0 ) break ;
if ( ! qemuMonitorJSONHasError ( reply , "MigrationExpected" ) ) break ;
virJSONValueFree ( reply ) ;
reply = NULL ;
usleep ( 250000 ) ;
}
while ( ++ i <= timeout ) ;
virJSONValueFree ( cmd ) ;
virJSONValueFree ( reply ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ogg_read_page ( AVFormatContext * s , int * sid ) {
AVIOContext * bc = s -> pb ;
struct ogg * ogg = s -> priv_data ;
struct ogg_stream * os ;
int ret , i = 0 ;
int flags , nsegs ;
uint64_t gp ;
uint32_t serial ;
int size , idx ;
uint8_t sync [ 4 ] ;
int sp = 0 ;
ret = avio_read ( bc , sync , 4 ) ;
if ( ret < 4 ) return ret < 0 ? ret : AVERROR_EOF ;
do {
int c ;
if ( sync [ sp & 3 ] == 'O' && sync [ ( sp + 1 ) & 3 ] == 'g' && sync [ ( sp + 2 ) & 3 ] == 'g' && sync [ ( sp + 3 ) & 3 ] == 'S' ) break ;
if ( ! i && bc -> seekable && ogg -> page_pos > 0 ) {
memset ( sync , 0 , 4 ) ;
avio_seek ( bc , ogg -> page_pos + 4 , SEEK_SET ) ;
ogg -> page_pos = - 1 ;
}
c = avio_r8 ( bc ) ;
if ( avio_feof ( bc ) ) return AVERROR_EOF ;
sync [ sp ++ & 3 ] = c ;
}
while ( i ++ < MAX_PAGE_SIZE ) ;
if ( i >= MAX_PAGE_SIZE ) {
av_log ( s , AV_LOG_INFO , "cannot find sync word\n" ) ;
return AVERROR_INVALIDDATA ;
}
if ( avio_r8 ( bc ) != 0 ) {
av_log ( s , AV_LOG_ERROR , "ogg page, unsupported version\n" ) ;
return AVERROR_INVALIDDATA ;
}
flags = avio_r8 ( bc ) ;
gp = avio_rl64 ( bc ) ;
serial = avio_rl32 ( bc ) ;
avio_skip ( bc , 8 ) ;
nsegs = avio_r8 ( bc ) ;
idx = ogg_find_stream ( ogg , serial ) ;
if ( idx < 0 ) {
if ( data_packets_seen ( ogg ) ) idx = ogg_replace_stream ( s , serial , nsegs ) ;
else idx = ogg_new_stream ( s , serial ) ;
if ( idx < 0 ) {
av_log ( s , AV_LOG_ERROR , "failed to create or replace stream\n" ) ;
return idx ;
}
}
os = ogg -> streams + idx ;
ogg -> page_pos = os -> page_pos = avio_tell ( bc ) - 27 ;
if ( os -> psize > 0 ) {
ret = ogg_new_buf ( ogg , idx ) ;
if ( ret < 0 ) return ret ;
}
ret = avio_read ( bc , os -> segments , nsegs ) ;
if ( ret < nsegs ) return ret < 0 ? ret : AVERROR_EOF ;
os -> nsegs = nsegs ;
os -> segp = 0 ;
size = 0 ;
for ( i = 0 ;
i < nsegs ;
i ++ ) size += os -> segments [ i ] ;
if ( ! ( flags & OGG_FLAG_BOS ) ) os -> got_data = 1 ;
if ( flags & OGG_FLAG_CONT || os -> incomplete ) {
if ( ! os -> psize ) {
while ( os -> segp < os -> nsegs ) {
int seg = os -> segments [ os -> segp ++ ] ;
os -> pstart += seg ;
if ( seg < 255 ) break ;
}
os -> sync_pos = os -> page_pos ;
}
}
else {
os -> psize = 0 ;
os -> sync_pos = os -> page_pos ;
}
if ( os -> bufsize - os -> bufpos < size ) {
uint8_t * nb = av_malloc ( ( os -> bufsize *= 2 ) + AV_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! nb ) return AVERROR ( ENOMEM ) ;
memcpy ( nb , os -> buf , os -> bufpos ) ;
av_free ( os -> buf ) ;
os -> buf = nb ;
}
ret = avio_read ( bc , os -> buf + os -> bufpos , size ) ;
if ( ret < size ) return ret < 0 ? ret : AVERROR_EOF ;
os -> bufpos += size ;
os -> granule = gp ;
os -> flags = flags ;
memset ( os -> buf + os -> bufpos , 0 , AV_INPUT_BUFFER_PADDING_SIZE ) ;
if ( sid ) * sid = idx ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void zisofs_detect_magic ( struct archive_write * a , const void * buff , size_t s ) {
struct iso9660 * iso9660 = a -> format_data ;
struct isofile * file = iso9660 -> cur_file ;
const unsigned char * p , * endp ;
const unsigned char * magic_buff ;
uint32_t uncompressed_size ;
unsigned char header_size ;
unsigned char log2_bs ;
size_t _ceil , doff ;
uint32_t bst , bed ;
int magic_max ;
int64_t entry_size ;
entry_size = archive_entry_size ( file -> entry ) ;
if ( ( int64_t ) sizeof ( iso9660 -> zisofs . magic_buffer ) > entry_size ) magic_max = ( int ) entry_size ;
else magic_max = sizeof ( iso9660 -> zisofs . magic_buffer ) ;
if ( iso9660 -> zisofs . magic_cnt == 0 && s >= ( size_t ) magic_max ) magic_buff = buff ;
else {
if ( iso9660 -> zisofs . magic_cnt < magic_max ) {
size_t l ;
l = sizeof ( iso9660 -> zisofs . magic_buffer ) - iso9660 -> zisofs . magic_cnt ;
if ( l > s ) l = s ;
memcpy ( iso9660 -> zisofs . magic_buffer + iso9660 -> zisofs . magic_cnt , buff , l ) ;
iso9660 -> zisofs . magic_cnt += ( int ) l ;
if ( iso9660 -> zisofs . magic_cnt < magic_max ) return ;
}
magic_buff = iso9660 -> zisofs . magic_buffer ;
}
iso9660 -> zisofs . detect_magic = 0 ;
p = magic_buff ;
if ( memcmp ( p , zisofs_magic , sizeof ( zisofs_magic ) ) != 0 ) return ;
p += sizeof ( zisofs_magic ) ;
uncompressed_size = archive_le32dec ( p ) ;
header_size = p [ 4 ] ;
log2_bs = p [ 5 ] ;
if ( uncompressed_size < 24 || header_size != 4 || log2_bs > 30 || log2_bs < 7 ) return ;
_ceil = ( uncompressed_size + ( ARCHIVE_LITERAL_LL ( 1 ) << log2_bs ) - 1 ) >> log2_bs ;
doff = ( _ceil + 1 ) * 4 + 16 ;
if ( entry_size < ( int64_t ) doff ) return ;
p = magic_buff + 16 ;
endp = magic_buff + magic_max ;
while ( _ceil && p + 8 <= endp ) {
bst = archive_le32dec ( p ) ;
if ( bst != doff ) return ;
p += 4 ;
bed = archive_le32dec ( p ) ;
if ( bed < bst || bed > entry_size ) return ;
doff += bed - bst ;
_ceil -- ;
}
file -> zisofs . uncompressed_size = uncompressed_size ;
file -> zisofs . header_size = header_size ;
file -> zisofs . log2_bs = log2_bs ;
iso9660 -> zisofs . making = 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int qemuAgentCommand ( qemuAgentPtr mon , virJSONValuePtr cmd , virJSONValuePtr * reply , bool needReply , int seconds ) {
int ret = - 1 ;
qemuAgentMessage msg ;
char * cmdstr = NULL ;
int await_event = mon -> await_event ;
* reply = NULL ;
if ( ! mon -> running ) {
virReportError ( VIR_ERR_AGENT_UNRESPONSIVE , "%s" , _ ( "Guest agent disappeared while executing command" ) ) ;
return - 1 ;
}
if ( qemuAgentGuestSync ( mon ) < 0 ) return - 1 ;
memset ( & msg , 0 , sizeof ( msg ) ) ;
if ( ! ( cmdstr = virJSONValueToString ( cmd , false ) ) ) goto cleanup ;
if ( virAsprintf ( & msg . txBuffer , "%s" LINE_ENDING , cmdstr ) < 0 ) goto cleanup ;
msg . txLength = strlen ( msg . txBuffer ) ;
VIR_DEBUG ( "Send command '%s' for write, seconds = %d" , cmdstr , seconds ) ;
ret = qemuAgentSend ( mon , & msg , seconds ) ;
VIR_DEBUG ( "Receive command reply ret=%d rxObject=%p" , ret , msg . rxObject ) ;
if ( ret == 0 ) {
if ( ! msg . rxObject ) {
if ( await_event && ! needReply ) {
VIR_DEBUG ( "Woken up by event %d" , await_event ) ;
}
else {
if ( mon -> running ) virReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "Missing monitor reply object" ) ) ;
else virReportError ( VIR_ERR_AGENT_UNRESPONSIVE , "%s" , _ ( "Guest agent disappeared while executing command" ) ) ;
ret = - 1 ;
}
}
else {
* reply = msg . rxObject ;
ret = qemuAgentCheckError ( cmd , * reply ) ;
}
}
cleanup : VIR_FREE ( cmdstr ) ;
VIR_FREE ( msg . txBuffer ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
GType hb_gobject_ ## name ## _get_type ( void ) \ {
static gsize type_id = 0 ;
if ( g_once_init_enter ( & type_id ) ) {
GType id = g_boxed_type_register_static ( g_intern_static_string ( "hb_" # name "_t" ) , ( GBoxedCopyFunc ) copy_func , ( GBoxedFreeFunc ) free_func ) ;
g_once_init_leave ( & type_id , id ) ;
}
return type_id ;
\ }
# define HB_DEFINE_OBJECT_TYPE ( name ) HB_DEFINE_BOXED_TYPE ( name , hb_ ## name ## _reference , hb_ ## name ## _destroy ) ;
# define HB_DEFINE_VALUE_TYPE ( name ) static hb_ ## name ## _t * _hb_ ## name ## _reference ( const hb_ ## name ## _t * l ) {
hb_ ## name ## _t * c = ( hb_ ## name ## _t * ) calloc ( 1 , sizeof ( hb_ ## name ## _t ) ) ;
if ( unlikely ( ! c ) ) return NULL ;
* c = * l ;
return c ;
}
static void _hb_ ## name ## _destroy ( hb_ ## name ## _t * l ) {
free ( l ) ;
}
HB_DEFINE_BOXED_TYPE ( name , _hb_ ## name ## _reference , _hb_ ## name ## _destroy ) ;
HB_DEFINE_OBJECT_TYPE ( buffer ) HB_DEFINE_OBJECT_TYPE ( blob ) HB_DEFINE_OBJECT_TYPE ( face ) HB_DEFINE_OBJECT_TYPE ( font ) HB_DEFINE_OBJECT_TYPE ( font_funcs ) HB_DEFINE_OBJECT_TYPE ( set ) HB_DEFINE_OBJECT_TYPE ( shape_plan ) HB_DEFINE_OBJECT_TYPE ( unicode_funcs ) HB_DEFINE_VALUE_TYPE ( feature ) HB_DEFINE_VALUE_TYPE ( glyph_info ) HB_DEFINE_VALUE_TYPE ( glyph_position ) HB_DEFINE_VALUE_TYPE ( segment_properties )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void free_days ( UChar * days [ ] ) {
free_symbols ( days , DAY_COUNT ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void DecoderUpdateFormatLocked ( decoder_t * p_dec ) {
decoder_owner_sys_t * p_owner = p_dec -> p_owner ;
vlc_assert_locked ( & p_owner -> lock ) ;
p_owner -> b_fmt_description = true ;
es_format_Clean ( & p_owner -> fmt_description ) ;
es_format_Copy ( & p_owner -> fmt_description , & p_dec -> fmt_out ) ;
if ( p_owner -> p_description && p_dec -> p_description ) vlc_meta_Delete ( p_owner -> p_description ) ;
p_owner -> p_description = p_dec -> p_description ;
p_dec -> p_description = NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int show_routine_grants ( THD * thd , LEX_USER * lex_user , HASH * hash , const char * type , int typelen , char * buff , int buffsize ) {
uint counter , index ;
int error = 0 ;
Protocol * protocol = thd -> protocol ;
for ( index = 0 ;
index < hash -> records ;
index ++ ) {
const char * user , * host ;
GRANT_NAME * grant_proc = ( GRANT_NAME * ) hash_element ( hash , index ) ;
if ( ! ( user = grant_proc -> user ) ) user = "" ;
if ( ! ( host = grant_proc -> host . hostname ) ) host = "" ;
if ( ! strcmp ( lex_user -> user . str , user ) && ! my_strcasecmp ( system_charset_info , lex_user -> host . str , host ) ) {
ulong proc_access = grant_proc -> privs ;
if ( proc_access != 0 ) {
String global ( buff , buffsize , system_charset_info ) ;
ulong test_access = proc_access & ~ GRANT_ACL ;
global . length ( 0 ) ;
global . append ( STRING_WITH_LEN ( "GRANT " ) ) ;
if ( ! test_access ) global . append ( STRING_WITH_LEN ( "USAGE" ) ) ;
else {
int found = 0 ;
ulong j ;
for ( counter = 0 , j = SELECT_ACL ;
j <= PROC_ACLS ;
counter ++ , j <<= 1 ) {
if ( test_access & j ) {
if ( found ) global . append ( STRING_WITH_LEN ( ", " ) ) ;
found = 1 ;
global . append ( command_array [ counter ] , command_lengths [ counter ] ) ;
}
}
}
global . append ( STRING_WITH_LEN ( " ON " ) ) ;
global . append ( type , typelen ) ;
global . append ( ' ' ) ;
append_identifier ( thd , & global , grant_proc -> db , strlen ( grant_proc -> db ) ) ;
global . append ( '.' ) ;
append_identifier ( thd , & global , grant_proc -> tname , strlen ( grant_proc -> tname ) ) ;
global . append ( STRING_WITH_LEN ( " TO '" ) ) ;
global . append ( lex_user -> user . str , lex_user -> user . length , system_charset_info ) ;
global . append ( STRING_WITH_LEN ( "'@'" ) ) ;
global . append ( host , strlen ( host ) , system_charset_info ) ;
global . append ( '\'' ) ;
if ( proc_access & GRANT_ACL ) global . append ( STRING_WITH_LEN ( " WITH GRANT OPTION" ) ) ;
protocol -> prepare_for_resend ( ) ;
protocol -> store ( global . ptr ( ) , global . length ( ) , global . charset ( ) ) ;
if ( protocol -> write ( ) ) {
error = - 1 ;
break ;
}
}
}
}
return error ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void tb_phys_invalidate ( TranslationBlock * tb , tb_page_addr_t page_addr ) {
CPUArchState * env ;
PageDesc * p ;
unsigned int h , n1 ;
tb_page_addr_t phys_pc ;
TranslationBlock * tb1 , * tb2 ;
phys_pc = tb -> page_addr [ 0 ] + ( tb -> pc & ~ TARGET_PAGE_MASK ) ;
h = tb_phys_hash_func ( phys_pc ) ;
tb_hash_remove ( & tcg_ctx . tb_ctx . tb_phys_hash [ h ] , tb ) ;
if ( tb -> page_addr [ 0 ] != page_addr ) {
p = page_find ( tb -> page_addr [ 0 ] >> TARGET_PAGE_BITS ) ;
tb_page_remove ( & p -> first_tb , tb ) ;
invalidate_page_bitmap ( p ) ;
}
if ( tb -> page_addr [ 1 ] != - 1 && tb -> page_addr [ 1 ] != page_addr ) {
p = page_find ( tb -> page_addr [ 1 ] >> TARGET_PAGE_BITS ) ;
tb_page_remove ( & p -> first_tb , tb ) ;
invalidate_page_bitmap ( p ) ;
}
tcg_ctx . tb_ctx . tb_invalidated_flag = 1 ;
h = tb_jmp_cache_hash_func ( tb -> pc ) ;
for ( env = first_cpu ;
env != NULL ;
env = env -> next_cpu ) {
if ( env -> tb_jmp_cache [ h ] == tb ) {
env -> tb_jmp_cache [ h ] = NULL ;
}
}
tb_jmp_remove ( tb , 0 ) ;
tb_jmp_remove ( tb , 1 ) ;
tb1 = tb -> jmp_first ;
for ( ;
;
) {
n1 = ( uintptr_t ) tb1 & 3 ;
if ( n1 == 2 ) {
break ;
}
tb1 = ( TranslationBlock * ) ( ( uintptr_t ) tb1 & ~ 3 ) ;
tb2 = tb1 -> jmp_next [ n1 ] ;
tb_reset_jump ( tb1 , n1 ) ;
tb1 -> jmp_next [ n1 ] = NULL ;
tb1 = tb2 ;
}
tb -> jmp_first = ( TranslationBlock * ) ( ( uintptr_t ) tb | 2 ) ;
tcg_ctx . tb_ctx . tb_phys_invalidate_count ++ ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_tokenize_sb ( VP9_COMP * cpi , TOKENEXTRA * * t , int dry_run , BLOCK_SIZE bsize ) {
VP9_COMMON * const cm = & cpi -> common ;
MACROBLOCKD * const xd = & cpi -> mb . e_mbd ;
MB_MODE_INFO * const mbmi = & xd -> mi [ 0 ] -> mbmi ;
TOKENEXTRA * t_backup = * t ;
const int ctx = vp9_get_skip_context ( xd ) ;
const int skip_inc = ! vp9_segfeature_active ( & cm -> seg , mbmi -> segment_id , SEG_LVL_SKIP ) ;
struct tokenize_b_args arg = {
cpi , xd , t }
;
if ( mbmi -> skip ) {
if ( ! dry_run ) cm -> counts . skip [ ctx ] [ 1 ] += skip_inc ;
reset_skip_context ( xd , bsize ) ;
if ( dry_run ) * t = t_backup ;
return ;
}
if ( ! dry_run ) {
cm -> counts . skip [ ctx ] [ 0 ] += skip_inc ;
vp9_foreach_transformed_block ( xd , bsize , tokenize_b , & arg ) ;
}
else {
vp9_foreach_transformed_block ( xd , bsize , set_entropy_context_b , & arg ) ;
* t = t_backup ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static UBool _isExtlangSubtag ( const char * s , int32_t len ) {
if ( len < 0 ) {
len = ( int32_t ) uprv_strlen ( s ) ;
}
if ( len == 3 && _isAlphaString ( s , len ) ) {
return TRUE ;
}
return FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
extern int name ( int ) __THROW __exctype ( isalnum ) ;
__exctype ( isalpha ) ;
__exctype ( iscntrl )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void selinux_msg_queue_free_security ( struct msg_queue * msq ) {
ipc_free_security ( & msq -> q_perm ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gpgme_error_t gpgsm_cancel ( void * engine ) {
engine_gpgsm_t gpgsm = engine ;
if ( ! gpgsm ) return gpg_error ( GPG_ERR_INV_VALUE ) ;
if ( gpgsm -> status_cb . fd != - 1 ) _gpgme_io_close ( gpgsm -> status_cb . fd ) ;
if ( gpgsm -> input_cb . fd != - 1 ) _gpgme_io_close ( gpgsm -> input_cb . fd ) ;
if ( gpgsm -> output_cb . fd != - 1 ) _gpgme_io_close ( gpgsm -> output_cb . fd ) ;
if ( gpgsm -> message_cb . fd != - 1 ) _gpgme_io_close ( gpgsm -> message_cb . fd ) ;
if ( gpgsm -> assuan_ctx ) {
assuan_release ( gpgsm -> assuan_ctx ) ;
gpgsm -> assuan_ctx = NULL ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int main ( int argc , const char * * argv_ ) {
unsigned int loops = 1 , i ;
char * * argv , * * argi , * * argj ;
struct arg arg ;
int error = 0 ;
argv = argv_dup ( argc - 1 , argv_ + 1 ) ;
for ( argi = argj = argv ;
( * argj = * argi ) ;
argi += arg . argv_step ) {
memset ( & arg , 0 , sizeof ( arg ) ) ;
arg . argv_step = 1 ;
if ( arg_match ( & arg , & looparg , argi ) ) {
loops = arg_parse_uint ( & arg ) ;
break ;
}
}
free ( argv ) ;
for ( i = 0 ;
! error && i < loops ;
i ++ ) error = main_loop ( argc , argv_ ) ;
return error ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void unpack_roq_cell ( roq_cell * cell , uint8_t u [ 4 * 3 ] ) {
memcpy ( u , cell -> y , 4 ) ;
memset ( u + 4 , cell -> u , 4 ) ;
memset ( u + 8 , cell -> v , 4 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_CallInformationReq ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_CallInformationReq , CallInformationReq_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
bool metakey_h ( connection_t * c ) {
char buffer [ MAX_STRING_SIZE ] ;
int cipher , digest , maclength , compression ;
int len ;
if ( sscanf ( c -> buffer , "%*d %d %d %d %d " MAX_STRING , & cipher , & digest , & maclength , & compression , buffer ) != 5 ) {
logger ( LOG_ERR , "Got bad %s from %s (%s)" , "METAKEY" , c -> name , c -> hostname ) ;
return false ;
}
len = RSA_size ( myself -> connection -> rsa_key ) ;
if ( strlen ( buffer ) != ( size_t ) len * 2 ) {
logger ( LOG_ERR , "Possible intruder %s (%s): %s" , c -> name , c -> hostname , "wrong keylength" ) ;
return false ;
}
c -> inkey = xrealloc ( c -> inkey , len ) ;
if ( ! c -> inctx ) {
c -> inctx = EVP_CIPHER_CTX_new ( ) ;
if ( ! c -> inctx ) {
abort ( ) ;
}
}
if ( ! hex2bin ( buffer , buffer , len ) ) {
logger ( LOG_ERR , "Got bad %s from %s(%s): %s" , "METAKEY" , c -> name , c -> hostname , "invalid key" ) ;
return false ;
}
if ( RSA_private_decrypt ( len , ( unsigned char * ) buffer , ( unsigned char * ) c -> inkey , myself -> connection -> rsa_key , RSA_NO_PADDING ) != len ) {
logger ( LOG_ERR , "Error during decryption of meta key for %s (%s): %s" , c -> name , c -> hostname , ERR_error_string ( ERR_get_error ( ) , NULL ) ) ;
return false ;
}
ifdebug ( SCARY_THINGS ) {
bin2hex ( c -> inkey , buffer , len ) ;
buffer [ len * 2 ] = '\0' ;
logger ( LOG_DEBUG , "Received random meta key (unencrypted): %s" , buffer ) ;
}
if ( cipher ) {
c -> incipher = EVP_get_cipherbynid ( cipher ) ;
if ( ! c -> incipher ) {
logger ( LOG_ERR , "%s (%s) uses unknown cipher!" , c -> name , c -> hostname ) ;
return false ;
}
if ( ! EVP_DecryptInit ( c -> inctx , c -> incipher , ( unsigned char * ) c -> inkey + len - EVP_CIPHER_key_length ( c -> incipher ) , ( unsigned char * ) c -> inkey + len - EVP_CIPHER_key_length ( c -> incipher ) - EVP_CIPHER_iv_length ( c -> incipher ) ) ) {
logger ( LOG_ERR , "Error during initialisation of cipher from %s (%s): %s" , c -> name , c -> hostname , ERR_error_string ( ERR_get_error ( ) , NULL ) ) ;
return false ;
}
c -> inbudget = byte_budget ( c -> incipher ) ;
c -> status . decryptin = true ;
}
else {
c -> incipher = NULL ;
}
c -> inmaclength = maclength ;
if ( digest ) {
c -> indigest = EVP_get_digestbynid ( digest ) ;
if ( ! c -> indigest ) {
logger ( LOG_ERR , "Node %s (%s) uses unknown digest!" , c -> name , c -> hostname ) ;
return false ;
}
if ( c -> inmaclength > EVP_MD_size ( c -> indigest ) || c -> inmaclength < 0 ) {
logger ( LOG_ERR , "%s (%s) uses bogus MAC length!" , c -> name , c -> hostname ) ;
return false ;
}
}
else {
c -> indigest = NULL ;
}
c -> incompression = compression ;
c -> allow_request = CHALLENGE ;
return send_challenge ( c ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void update_stats ( VP9_COMMON * cm , const MACROBLOCK * x ) {
const MACROBLOCKD * const xd = & x -> e_mbd ;
const MODE_INFO * const mi = xd -> mi [ 0 ] ;
const MB_MODE_INFO * const mbmi = & mi -> mbmi ;
if ( ! frame_is_intra_only ( cm ) ) {
const int seg_ref_active = vp9_segfeature_active ( & cm -> seg , mbmi -> segment_id , SEG_LVL_REF_FRAME ) ;
if ( ! seg_ref_active ) {
FRAME_COUNTS * const counts = & cm -> counts ;
const int inter_block = is_inter_block ( mbmi ) ;
counts -> intra_inter [ vp9_get_intra_inter_context ( xd ) ] [ inter_block ] ++ ;
if ( inter_block ) {
const MV_REFERENCE_FRAME ref0 = mbmi -> ref_frame [ 0 ] ;
if ( cm -> reference_mode == REFERENCE_MODE_SELECT ) counts -> comp_inter [ vp9_get_reference_mode_context ( cm , xd ) ] [ has_second_ref ( mbmi ) ] ++ ;
if ( has_second_ref ( mbmi ) ) {
counts -> comp_ref [ vp9_get_pred_context_comp_ref_p ( cm , xd ) ] [ ref0 == GOLDEN_FRAME ] ++ ;
}
else {
counts -> single_ref [ vp9_get_pred_context_single_ref_p1 ( xd ) ] [ 0 ] [ ref0 != LAST_FRAME ] ++ ;
if ( ref0 != LAST_FRAME ) counts -> single_ref [ vp9_get_pred_context_single_ref_p2 ( xd ) ] [ 1 ] [ ref0 != GOLDEN_FRAME ] ++ ;
}
}
}
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static afs_int32 put_prentries ( struct prentry * tentry , prentries * bulkentries ) {
struct prlistentries * entry ;
if ( bulkentries -> prentries_val == 0 ) {
bulkentries -> prentries_len = 0 ;
bulkentries -> prentries_val = ( struct prlistentries * ) malloc ( PR_MAXENTRIES * sizeof ( struct prentry ) ) ;
if ( ! bulkentries -> prentries_val ) {
return ( PRNOMEM ) ;
}
}
if ( bulkentries -> prentries_len >= PR_MAXENTRIES ) {
return ( - 1 ) ;
}
entry = ( struct prlistentries * ) bulkentries -> prentries_val ;
entry += bulkentries -> prentries_len ;
entry -> flags = tentry -> flags >> PRIVATE_SHIFT ;
if ( entry -> flags == 0 ) {
entry -> flags = ( ( tentry -> flags & PRGRP ) ? prp_group_default : prp_user_default ) >> PRIVATE_SHIFT ;
}
entry -> owner = tentry -> owner ;
entry -> id = tentry -> id ;
entry -> creator = tentry -> creator ;
entry -> ngroups = tentry -> ngroups ;
entry -> nusers = tentry -> nusers ;
entry -> count = tentry -> count ;
strncpy ( entry -> name , tentry -> name , PR_MAXNAMELEN ) ;
memset ( entry -> reserved , 0 , sizeof ( entry -> reserved ) ) ;
bulkentries -> prentries_len ++ ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int opt_show_ ## section ( const char * opt , const char * arg ) {
mark_section_show_entries ( SECTION_ID_ ## target_section_id , 1 , NULL ) ;
return 0 ;
}
DEFINE_OPT_SHOW_SECTION ( chapters , CHAPTERS )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_rsl_ie_multirate_conf ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , int offset , gboolean is_mandatory ) {
proto_item * ti ;
proto_tree * ie_tree ;
guint length ;
guint8 ie_id ;
if ( is_mandatory == FALSE ) {
ie_id = tvb_get_guint8 ( tvb , offset ) ;
if ( ie_id != RSL_IE_MULTIRATE_CONF ) return offset ;
}
ie_tree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_ie_multirate_conf , & ti , "MultiRate configuration IE" ) ;
proto_tree_add_item ( ie_tree , hf_rsl_ie_id , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
length = tvb_get_guint8 ( tvb , offset ) ;
proto_item_set_len ( ti , length + 2 ) ;
proto_tree_add_item ( ie_tree , hf_rsl_ie_length , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
de_rr_multirate_conf ( tvb , ie_tree , pinfo , offset , length , NULL , 0 ) ;
offset = offset + length ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void modsecurity_shutdown ( msc_engine * msce ) {
if ( msce == NULL ) return ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int nsv_read_header ( AVFormatContext * s ) {
NSVContext * nsv = s -> priv_data ;
int i , err ;
nsv -> state = NSV_UNSYNC ;
nsv -> ahead [ 0 ] . data = nsv -> ahead [ 1 ] . data = NULL ;
for ( i = 0 ;
i < NSV_MAX_RESYNC_TRIES ;
i ++ ) {
if ( nsv_resync ( s ) < 0 ) return - 1 ;
if ( nsv -> state == NSV_FOUND_NSVF ) {
err = nsv_parse_NSVf_header ( s ) ;
if ( err < 0 ) return err ;
}
if ( nsv -> state == NSV_FOUND_NSVS ) {
err = nsv_parse_NSVs_header ( s ) ;
if ( err < 0 ) return err ;
break ;
}
}
if ( s -> nb_streams < 1 ) return - 1 ;
err = nsv_read_chunk ( s , 1 ) ;
av_log ( s , AV_LOG_TRACE , "parsed header\n" ) ;
return err ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static __inline__ __u64 __fswab64 ( __u64 val ) {
# if defined ( __arch_swab64 ) return __arch_swab64 ( val ) ;
# elif defined ( __SWAB_64_THRU_32__ ) __u32 h = val >> 32 ;
__u32 l = val & ( ( 1ULL << 32 ) - 1 ) ;
return ( ( ( __u64 ) __fswab32 ( l ) ) << 32 ) | ( ( __u64 ) ( __fswab32 ( h ) ) ) ;
# else return ___constant_swab64 ( val ) ;
# endif }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int ipv6_addr_type ( const struct in6_addr * addr ) {
return __ipv6_addr_type ( addr ) & 0xffff ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int nntp_active_fetch ( struct NntpServer * nserv , bool new ) {
struct NntpData nntp_data ;
char msg [ STRING ] ;
char buf [ LONG_STRING ] ;
unsigned int i ;
int rc ;
snprintf ( msg , sizeof ( msg ) , _ ( "Loading list of groups from server %s..." ) , nserv -> conn -> account . host ) ;
mutt_message ( msg ) ;
if ( nntp_date ( nserv , & nserv -> newgroups_time ) < 0 ) return - 1 ;
nntp_data . nserv = nserv ;
nntp_data . group = NULL ;
i = nserv -> groups_num ;
mutt_str_strfcpy ( buf , "LIST\r\n" , sizeof ( buf ) ) ;
rc = nntp_fetch_lines ( & nntp_data , buf , sizeof ( buf ) , msg , nntp_add_group , nserv ) ;
if ( rc ) {
if ( rc > 0 ) {
mutt_error ( "LIST: %s" , buf ) ;
}
return - 1 ;
}
if ( new ) {
for ( ;
i < nserv -> groups_num ;
i ++ ) {
struct NntpData * data = nserv -> groups_list [ i ] ;
data -> new = true ;
}
}
for ( i = 0 ;
i < nserv -> groups_num ;
i ++ ) {
struct NntpData * data = nserv -> groups_list [ i ] ;
if ( data && data -> deleted && ! data -> newsrc_ent ) {
nntp_delete_group_cache ( data ) ;
mutt_hash_delete ( nserv -> groups_hash , data -> group , NULL ) ;
nserv -> groups_list [ i ] = NULL ;
}
}
if ( NntpLoadDescription ) rc = get_description ( & nntp_data , "*" , _ ( "Loading descriptions..." ) ) ;
nntp_active_save_cache ( nserv ) ;
if ( rc < 0 ) return - 1 ;
mutt_clear_error ( ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_encode_sb ( MACROBLOCK * x , BLOCK_SIZE bsize ) {
MACROBLOCKD * const xd = & x -> e_mbd ;
struct optimize_ctx ctx ;
MB_MODE_INFO * mbmi = & xd -> mi [ 0 ] -> mbmi ;
struct encode_b_args arg = {
x , & ctx , & mbmi -> skip }
;
int plane ;
for ( plane = 0 ;
plane < MAX_MB_PLANE ;
++ plane ) {
if ( ! x -> skip_recode ) vp9_subtract_plane ( x , bsize , plane ) ;
if ( x -> optimize && ( ! x -> skip_recode || ! x -> skip_optimize ) ) {
const struct macroblockd_plane * const pd = & xd -> plane [ plane ] ;
const TX_SIZE tx_size = plane ? get_uv_tx_size ( mbmi , pd ) : mbmi -> tx_size ;
vp9_get_entropy_contexts ( bsize , tx_size , pd , ctx . ta [ plane ] , ctx . tl [ plane ] ) ;
}
vp9_foreach_transformed_block_in_plane ( xd , bsize , plane , encode_block , & arg ) ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ts_lua_http_config_int_set ( lua_State * L ) {
int conf ;
int value ;
ts_lua_http_ctx * http_ctx ;
GET_HTTP_CONTEXT ( http_ctx , L ) ;
conf = luaL_checkinteger ( L , 1 ) ;
value = luaL_checkinteger ( L , 2 ) ;
TSHttpTxnConfigIntSet ( http_ctx -> txnp , conf , value ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void appendStringLiteralDQ ( PQExpBuffer buf , const char * str , const char * dqprefix ) {
static const char suffixes [ ] = "_XXXXXXX" ;
int nextchar = 0 ;
PQExpBuffer delimBuf = createPQExpBuffer ( ) ;
appendPQExpBufferChar ( delimBuf , '$' ) ;
if ( dqprefix ) appendPQExpBufferStr ( delimBuf , dqprefix ) ;
while ( strstr ( str , delimBuf -> data ) != NULL ) {
appendPQExpBufferChar ( delimBuf , suffixes [ nextchar ++ ] ) ;
nextchar %= sizeof ( suffixes ) - 1 ;
}
appendPQExpBufferChar ( delimBuf , '$' ) ;
appendPQExpBufferStr ( buf , delimBuf -> data ) ;
appendPQExpBufferStr ( buf , str ) ;
appendPQExpBufferStr ( buf , delimBuf -> data ) ;
destroyPQExpBuffer ( delimBuf ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int TSMimeHdrFieldEqual ( TSMBuffer bufp , TSMLoc hdr_obj , TSMLoc field1_obj , TSMLoc field2_obj ) {
sdk_assert ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_field_handle ( field1_obj , hdr_obj ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_field_handle ( field2_obj , hdr_obj ) == TS_SUCCESS ) ;
MIMEFieldSDKHandle * field1_handle = ( MIMEFieldSDKHandle * ) field1_obj ;
MIMEFieldSDKHandle * field2_handle = ( MIMEFieldSDKHandle * ) field2_obj ;
if ( ( field1_handle == nullptr ) || ( field2_handle == nullptr ) ) {
return ( field1_handle == field2_handle ) ;
}
return ( field1_handle -> field_ptr == field2_handle -> field_ptr ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int mxpeg_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
MXpegDecodeContext * s = avctx -> priv_data ;
MJpegDecodeContext * jpg = & s -> jpg ;
const uint8_t * buf_end , * buf_ptr ;
const uint8_t * unescaped_buf_ptr ;
int unescaped_buf_size ;
int start_code ;
int ret ;
buf_ptr = buf ;
buf_end = buf + buf_size ;
jpg -> got_picture = 0 ;
s -> got_mxm_bitmask = 0 ;
while ( buf_ptr < buf_end ) {
start_code = ff_mjpeg_find_marker ( jpg , & buf_ptr , buf_end , & unescaped_buf_ptr , & unescaped_buf_size ) ;
if ( start_code < 0 ) goto the_end ;
{
init_get_bits ( & jpg -> gb , unescaped_buf_ptr , unescaped_buf_size * 8 ) ;
if ( start_code >= APP0 && start_code <= APP15 ) {
mxpeg_decode_app ( s , unescaped_buf_ptr , unescaped_buf_size ) ;
}
switch ( start_code ) {
case SOI : if ( jpg -> got_picture ) goto the_end ;
break ;
case EOI : goto the_end ;
case DQT : ret = ff_mjpeg_decode_dqt ( jpg ) ;
if ( ret < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "quantization table decode error\n" ) ;
return ret ;
}
break ;
case DHT : ret = ff_mjpeg_decode_dht ( jpg ) ;
if ( ret < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "huffman table decode error\n" ) ;
return ret ;
}
break ;
case COM : ret = mxpeg_decode_com ( s , unescaped_buf_ptr , unescaped_buf_size ) ;
if ( ret < 0 ) return ret ;
break ;
case SOF0 : s -> got_sof_data = 0 ;
ret = ff_mjpeg_decode_sof ( jpg ) ;
if ( ret < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "SOF data decode error\n" ) ;
return ret ;
}
if ( jpg -> interlaced ) {
av_log ( avctx , AV_LOG_ERROR , "Interlaced mode not supported in MxPEG\n" ) ;
return AVERROR ( EINVAL ) ;
}
s -> got_sof_data = 1 ;
break ;
case SOS : if ( ! s -> got_sof_data ) {
av_log ( avctx , AV_LOG_WARNING , "Can not process SOS without SOF data, skipping\n" ) ;
break ;
}
if ( ! jpg -> got_picture ) {
if ( jpg -> first_picture ) {
av_log ( avctx , AV_LOG_WARNING , "First picture has no SOF, skipping\n" ) ;
break ;
}
if ( ! s -> got_mxm_bitmask ) {
av_log ( avctx , AV_LOG_WARNING , "Non-key frame has no MXM, skipping\n" ) ;
break ;
}
av_frame_unref ( jpg -> picture_ptr ) ;
if ( ff_get_buffer ( avctx , jpg -> picture_ptr , AV_GET_BUFFER_FLAG_REF ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return AVERROR ( ENOMEM ) ;
}
jpg -> picture_ptr -> pict_type = AV_PICTURE_TYPE_P ;
jpg -> picture_ptr -> key_frame = 0 ;
jpg -> got_picture = 1 ;
}
else {
jpg -> picture_ptr -> pict_type = AV_PICTURE_TYPE_I ;
jpg -> picture_ptr -> key_frame = 1 ;
}
if ( s -> got_mxm_bitmask ) {
AVFrame * reference_ptr = & s -> picture [ s -> picture_index ^ 1 ] ;
if ( mxpeg_check_dimensions ( s , jpg , reference_ptr ) < 0 ) break ;
if ( ! reference_ptr -> data [ 0 ] && ff_get_buffer ( avctx , reference_ptr , AV_GET_BUFFER_FLAG_REF ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return AVERROR ( ENOMEM ) ;
}
ret = ff_mjpeg_decode_sos ( jpg , s -> mxm_bitmask , reference_ptr ) ;
if ( ret < 0 && ( avctx -> err_recognition & AV_EF_EXPLODE ) ) return ret ;
}
else {
ret = ff_mjpeg_decode_sos ( jpg , NULL , NULL ) ;
if ( ret < 0 && ( avctx -> err_recognition & AV_EF_EXPLODE ) ) return ret ;
}
break ;
}
buf_ptr += ( get_bits_count ( & jpg -> gb ) + 7 ) >> 3 ;
}
}
the_end : if ( jpg -> got_picture ) {
int ret = av_frame_ref ( data , jpg -> picture_ptr ) ;
if ( ret < 0 ) return ret ;
* got_frame = 1 ;
s -> picture_index ^= 1 ;
jpg -> picture_ptr = & s -> picture [ s -> picture_index ] ;
if ( ! s -> has_complete_frame ) {
if ( ! s -> got_mxm_bitmask ) s -> has_complete_frame = 1 ;
else * got_frame = 0 ;
}
}
return buf_ptr - buf ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * hf_try_val64_to_str ( guint64 value , const header_field_info * hfinfo ) {
if ( hfinfo -> display & BASE_VAL64_STRING ) return try_val64_to_str ( value , ( const val64_string * ) hfinfo -> strings ) ;
DISSECTOR_ASSERT_NOT_REACHED ( ) ;
return NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int spl_dllist_object_count_elements ( zval * object , long * count TSRMLS_DC ) {
spl_dllist_object * intern = ( spl_dllist_object * ) zend_object_store_get_object ( object TSRMLS_CC ) ;
if ( intern -> fptr_count ) {
zval * rv ;
zend_call_method_with_0_params ( & object , intern -> std . ce , & intern -> fptr_count , "count" , & rv ) ;
if ( rv ) {
zval_ptr_dtor ( & intern -> retval ) ;
MAKE_STD_ZVAL ( intern -> retval ) ;
ZVAL_ZVAL ( intern -> retval , rv , 1 , 1 ) ;
convert_to_long ( intern -> retval ) ;
* count = ( long ) Z_LVAL_P ( intern -> retval ) ;
return SUCCESS ;
}
* count = 0 ;
return FAILURE ;
}
* count = spl_ptr_llist_count ( intern -> llist ) ;
return SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
PKCS7 * d2i_PKCS7_fp ( FILE * fp , PKCS7 * * p7 ) {
return ASN1_item_d2i_fp ( ASN1_ITEM_rptr ( PKCS7 ) , fp , p7 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void clamp_indexed ( const fz_colorspace * cs , const float * in , float * out ) {
struct indexed * idx = cs -> data ;
* out = fz_clamp ( * in , 0 , idx -> high ) / 255.0f ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dumpRoles ( PGconn * conn ) {
PQExpBuffer buf = createPQExpBuffer ( ) ;
PGresult * res ;
int i_oid , i_rolname , i_rolsuper , i_rolinherit , i_rolcreaterole , i_rolcreatedb , i_rolcanlogin , i_rolconnlimit , i_rolpassword , i_rolvaliduntil , i_rolreplication , i_rolbypassrls , i_rolcomment , i_is_current_user ;
int i ;
if ( server_version >= 90600 ) printfPQExpBuffer ( buf , "SELECT oid, rolname, rolsuper, rolinherit, " "rolcreaterole, rolcreatedb, " "rolcanlogin, rolconnlimit, rolpassword, " "rolvaliduntil, rolreplication, rolbypassrls, " "pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, " "rolname = current_user AS is_current_user " "FROM pg_authid " "WHERE rolname !~ '^pg_' " "ORDER BY 2" ) ;
else if ( server_version >= 90500 ) printfPQExpBuffer ( buf , "SELECT oid, rolname, rolsuper, rolinherit, " "rolcreaterole, rolcreatedb, " "rolcanlogin, rolconnlimit, rolpassword, " "rolvaliduntil, rolreplication, rolbypassrls, " "pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, " "rolname = current_user AS is_current_user " "FROM pg_authid " "ORDER BY 2" ) ;
else if ( server_version >= 90100 ) printfPQExpBuffer ( buf , "SELECT oid, rolname, rolsuper, rolinherit, " "rolcreaterole, rolcreatedb, " "rolcanlogin, rolconnlimit, rolpassword, " "rolvaliduntil, rolreplication, " "false as rolbypassrls, " "pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, " "rolname = current_user AS is_current_user " "FROM pg_authid " "ORDER BY 2" ) ;
else if ( server_version >= 80200 ) printfPQExpBuffer ( buf , "SELECT oid, rolname, rolsuper, rolinherit, " "rolcreaterole, rolcreatedb, " "rolcanlogin, rolconnlimit, rolpassword, " "rolvaliduntil, false as rolreplication, " "false as rolbypassrls, " "pg_catalog.shobj_description(oid, 'pg_authid') as rolcomment, " "rolname = current_user AS is_current_user " "FROM pg_authid " "ORDER BY 2" ) ;
else if ( server_version >= 80100 ) printfPQExpBuffer ( buf , "SELECT oid, rolname, rolsuper, rolinherit, " "rolcreaterole, rolcreatedb, " "rolcanlogin, rolconnlimit, rolpassword, " "rolvaliduntil, false as rolreplication, " "false as rolbypassrls, " "null as rolcomment, " "rolname = current_user AS is_current_user " "FROM pg_authid " "ORDER BY 2" ) ;
else printfPQExpBuffer ( buf , "SELECT 0 as oid, usename as rolname, " "usesuper as rolsuper, " "true as rolinherit, " "usesuper as rolcreaterole, " "usecreatedb as rolcreatedb, " "true as rolcanlogin, " "-1 as rolconnlimit, " "passwd as rolpassword, " "valuntil as rolvaliduntil, " "false as rolreplication, " "false as rolbypassrls, " "null as rolcomment, " "usename = current_user AS is_current_user " "FROM pg_shadow " "UNION ALL " "SELECT 0 as oid, groname as rolname, " "false as rolsuper, " "true as rolinherit, " "false as rolcreaterole, " "false as rolcreatedb, " "false as rolcanlogin, " "-1 as rolconnlimit, " "null::text as rolpassword, " "null::abstime as rolvaliduntil, " "false as rolreplication, " "false as rolbypassrls, " "null as rolcomment, " "false AS is_current_user " "FROM pg_group " "WHERE NOT EXISTS (SELECT 1 FROM pg_shadow " " WHERE usename = groname) " "ORDER BY 2" ) ;
res = executeQuery ( conn , buf -> data ) ;
i_oid = PQfnumber ( res , "oid" ) ;
i_rolname = PQfnumber ( res , "rolname" ) ;
i_rolsuper = PQfnumber ( res , "rolsuper" ) ;
i_rolinherit = PQfnumber ( res , "rolinherit" ) ;
i_rolcreaterole = PQfnumber ( res , "rolcreaterole" ) ;
i_rolcreatedb = PQfnumber ( res , "rolcreatedb" ) ;
i_rolcanlogin = PQfnumber ( res , "rolcanlogin" ) ;
i_rolconnlimit = PQfnumber ( res , "rolconnlimit" ) ;
i_rolpassword = PQfnumber ( res , "rolpassword" ) ;
i_rolvaliduntil = PQfnumber ( res , "rolvaliduntil" ) ;
i_rolreplication = PQfnumber ( res , "rolreplication" ) ;
i_rolbypassrls = PQfnumber ( res , "rolbypassrls" ) ;
i_rolcomment = PQfnumber ( res , "rolcomment" ) ;
i_is_current_user = PQfnumber ( res , "is_current_user" ) ;
if ( PQntuples ( res ) > 0 ) fprintf ( OPF , "--\n-- Roles\n--\n\n" ) ;
for ( i = 0 ;
i < PQntuples ( res ) ;
i ++ ) {
const char * rolename ;
Oid auth_oid ;
auth_oid = atooid ( PQgetvalue ( res , i , i_oid ) ) ;
rolename = PQgetvalue ( res , i , i_rolname ) ;
if ( strncmp ( rolename , "pg_" , 3 ) == 0 ) {
fprintf ( stderr , _ ( "%s: role name starting with \"pg_\" skipped (%s)\n" ) , progname , rolename ) ;
continue ;
}
resetPQExpBuffer ( buf ) ;
if ( binary_upgrade ) {
appendPQExpBufferStr ( buf , "\n-- For binary upgrade, must preserve pg_authid.oid\n" ) ;
appendPQExpBuffer ( buf , "SELECT pg_catalog.binary_upgrade_set_next_pg_authid_oid('%u'::pg_catalog.oid);
\n\n" , auth_oid ) ;
}
if ( ! binary_upgrade || strcmp ( PQgetvalue ( res , i , i_is_current_user ) , "f" ) == 0 ) appendPQExpBuffer ( buf , "CREATE ROLE %s;
\n" , fmtId ( rolename ) ) ;
appendPQExpBuffer ( buf , "ALTER ROLE %s WITH" , fmtId ( rolename ) ) ;
if ( strcmp ( PQgetvalue ( res , i , i_rolsuper ) , "t" ) == 0 ) appendPQExpBufferStr ( buf , " SUPERUSER" ) ;
else appendPQExpBufferStr ( buf , " NOSUPERUSER" ) ;
if ( strcmp ( PQgetvalue ( res , i , i_rolinherit ) , "t" ) == 0 ) appendPQExpBufferStr ( buf , " INHERIT" ) ;
else appendPQExpBufferStr ( buf , " NOINHERIT" ) ;
if ( strcmp ( PQgetvalue ( res , i , i_rolcreaterole ) , "t" ) == 0 ) appendPQExpBufferStr ( buf , " CREATEROLE" ) ;
else appendPQExpBufferStr ( buf , " NOCREATEROLE" ) ;
if ( strcmp ( PQgetvalue ( res , i , i_rolcreatedb ) , "t" ) == 0 ) appendPQExpBufferStr ( buf , " CREATEDB" ) ;
else appendPQExpBufferStr ( buf , " NOCREATEDB" ) ;
if ( strcmp ( PQgetvalue ( res , i , i_rolcanlogin ) , "t" ) == 0 ) appendPQExpBufferStr ( buf , " LOGIN" ) ;
else appendPQExpBufferStr ( buf , " NOLOGIN" ) ;
if ( strcmp ( PQgetvalue ( res , i , i_rolreplication ) , "t" ) == 0 ) appendPQExpBufferStr ( buf , " REPLICATION" ) ;
else appendPQExpBufferStr ( buf , " NOREPLICATION" ) ;
if ( strcmp ( PQgetvalue ( res , i , i_rolbypassrls ) , "t" ) == 0 ) appendPQExpBufferStr ( buf , " BYPASSRLS" ) ;
else appendPQExpBufferStr ( buf , " NOBYPASSRLS" ) ;
if ( strcmp ( PQgetvalue ( res , i , i_rolconnlimit ) , "-1" ) != 0 ) appendPQExpBuffer ( buf , " CONNECTION LIMIT %s" , PQgetvalue ( res , i , i_rolconnlimit ) ) ;
if ( ! PQgetisnull ( res , i , i_rolpassword ) ) {
appendPQExpBufferStr ( buf , " PASSWORD " ) ;
appendStringLiteralConn ( buf , PQgetvalue ( res , i , i_rolpassword ) , conn ) ;
}
if ( ! PQgetisnull ( res , i , i_rolvaliduntil ) ) appendPQExpBuffer ( buf , " VALID UNTIL '%s'" , PQgetvalue ( res , i , i_rolvaliduntil ) ) ;
appendPQExpBufferStr ( buf , ";
\n" ) ;
if ( ! PQgetisnull ( res , i , i_rolcomment ) ) {
appendPQExpBuffer ( buf , "COMMENT ON ROLE %s IS " , fmtId ( rolename ) ) ;
appendStringLiteralConn ( buf , PQgetvalue ( res , i , i_rolcomment ) , conn ) ;
appendPQExpBufferStr ( buf , ";
\n" ) ;
}
if ( ! no_security_labels && server_version >= 90200 ) buildShSecLabels ( conn , "pg_authid" , auth_oid , buf , "ROLE" , rolename ) ;
fprintf ( OPF , "%s" , buf -> data ) ;
}
if ( server_version >= 70300 ) for ( i = 0 ;
i < PQntuples ( res ) ;
i ++ ) dumpUserConfig ( conn , PQgetvalue ( res , i , i_rolname ) ) ;
PQclear ( res ) ;
fprintf ( OPF , "\n\n" ) ;
destroyPQExpBuffer ( buf ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
MPI # ifdef M_DEBUG mpi_debug_alloc_secure ( unsigned nlimbs , const char * info ) # else mpi_alloc_secure ( unsigned nlimbs ) # endif {
MPI a ;
if ( DBG_MEMORY ) log_debug ( "mpi_alloc_secure(%u)\n" , nlimbs * BITS_PER_MPI_LIMB ) ;
# ifdef M_DEBUG a = m_debug_alloc ( sizeof * a , info ) ;
a -> d = nlimbs ? mpi_debug_alloc_limb_space ( nlimbs , 1 , info ) : NULL ;
# else a = xmalloc ( sizeof * a ) ;
a -> d = nlimbs ? mpi_alloc_limb_space ( nlimbs , 1 ) : NULL ;
# endif a -> alloced = nlimbs ;
a -> flags = 1 ;
a -> nlimbs = 0 ;
a -> sign = 0 ;
a -> nbits = 0 ;
return a ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ssl3_do_uncompress ( SSL * ssl , SSL3_RECORD * rr ) {
# ifndef OPENSSL_NO_COMP int i ;
if ( rr -> comp == NULL ) {
rr -> comp = ( unsigned char * ) OPENSSL_malloc ( SSL3_RT_MAX_ENCRYPTED_LENGTH ) ;
}
if ( rr -> comp == NULL ) return 0 ;
i = COMP_expand_block ( ssl -> expand , rr -> comp , SSL3_RT_MAX_PLAIN_LENGTH , rr -> data , ( int ) rr -> length ) ;
if ( i < 0 ) return 0 ;
else rr -> length = i ;
rr -> data = rr -> comp ;
# endif return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
uchar * get_table_key ( const char * entry , size_t * length , my_bool not_used __attribute__ ( ( unused ) ) ) {
* length = strlen ( entry ) ;
return ( uchar * ) entry ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void rv34_pred_mv ( RV34DecContext * r , int block_type , int subblock_no , int dmv_no ) {
MpegEncContext * s = & r -> s ;
int mv_pos = s -> mb_x * 2 + s -> mb_y * 2 * s -> b8_stride ;
int A [ 2 ] = {
0 }
, B [ 2 ] , C [ 2 ] ;
int i , j ;
int mx , my ;
int * avail = r -> avail_cache + avail_indexes [ subblock_no ] ;
int c_off = part_sizes_w [ block_type ] ;
mv_pos += ( subblock_no & 1 ) + ( subblock_no >> 1 ) * s -> b8_stride ;
if ( subblock_no == 3 ) c_off = - 1 ;
if ( avail [ - 1 ] ) {
A [ 0 ] = s -> current_picture_ptr -> motion_val [ 0 ] [ mv_pos - 1 ] [ 0 ] ;
A [ 1 ] = s -> current_picture_ptr -> motion_val [ 0 ] [ mv_pos - 1 ] [ 1 ] ;
}
if ( avail [ - 4 ] ) {
B [ 0 ] = s -> current_picture_ptr -> motion_val [ 0 ] [ mv_pos - s -> b8_stride ] [ 0 ] ;
B [ 1 ] = s -> current_picture_ptr -> motion_val [ 0 ] [ mv_pos - s -> b8_stride ] [ 1 ] ;
}
else {
B [ 0 ] = A [ 0 ] ;
B [ 1 ] = A [ 1 ] ;
}
if ( ! avail [ c_off - 4 ] ) {
if ( avail [ - 4 ] && ( avail [ - 1 ] || r -> rv30 ) ) {
C [ 0 ] = s -> current_picture_ptr -> motion_val [ 0 ] [ mv_pos - s -> b8_stride - 1 ] [ 0 ] ;
C [ 1 ] = s -> current_picture_ptr -> motion_val [ 0 ] [ mv_pos - s -> b8_stride - 1 ] [ 1 ] ;
}
else {
C [ 0 ] = A [ 0 ] ;
C [ 1 ] = A [ 1 ] ;
}
}
else {
C [ 0 ] = s -> current_picture_ptr -> motion_val [ 0 ] [ mv_pos - s -> b8_stride + c_off ] [ 0 ] ;
C [ 1 ] = s -> current_picture_ptr -> motion_val [ 0 ] [ mv_pos - s -> b8_stride + c_off ] [ 1 ] ;
}
mx = mid_pred ( A [ 0 ] , B [ 0 ] , C [ 0 ] ) ;
my = mid_pred ( A [ 1 ] , B [ 1 ] , C [ 1 ] ) ;
mx += r -> dmv [ dmv_no ] [ 0 ] ;
my += r -> dmv [ dmv_no ] [ 1 ] ;
for ( j = 0 ;
j < part_sizes_h [ block_type ] ;
j ++ ) {
for ( i = 0 ;
i < part_sizes_w [ block_type ] ;
i ++ ) {
s -> current_picture_ptr -> motion_val [ 0 ] [ mv_pos + i + j * s -> b8_stride ] [ 0 ] = mx ;
s -> current_picture_ptr -> motion_val [ 0 ] [ mv_pos + i + j * s -> b8_stride ] [ 1 ] = my ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void prplcb_buddy_typing ( PurpleAccount * account , const char * who , gpointer null ) {
PurpleConversation * conv ;
PurpleConvIm * im ;
int state ;
if ( ( conv = purple_find_conversation_with_account ( PURPLE_CONV_TYPE_IM , who , account ) ) == NULL ) {
return ;
}
im = PURPLE_CONV_IM ( conv ) ;
switch ( purple_conv_im_get_typing_state ( im ) ) {
case PURPLE_TYPING : state = OPT_TYPING ;
break ;
case PURPLE_TYPED : state = OPT_THINKING ;
break ;
default : state = 0 ;
}
imcb_buddy_typing ( purple_ic_by_pa ( account ) , who , state ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int encode_frame ( vpx_codec_ctx_t * ctx , const vpx_image_t * img , vpx_codec_pts_t pts , unsigned int duration , vpx_enc_frame_flags_t flags , unsigned int deadline , VpxVideoWriter * writer ) {
int got_pkts = 0 ;
vpx_codec_iter_t iter = NULL ;
const vpx_codec_cx_pkt_t * pkt = NULL ;
const vpx_codec_err_t res = vpx_codec_encode ( ctx , img , pts , duration , flags , deadline ) ;
if ( res != VPX_CODEC_OK ) die_codec ( ctx , "Failed to encode frame." ) ;
while ( ( pkt = vpx_codec_get_cx_data ( ctx , & iter ) ) != NULL ) {
got_pkts = 1 ;
if ( pkt -> kind == VPX_CODEC_CX_FRAME_PKT ) {
const int keyframe = ( pkt -> data . frame . flags & VPX_FRAME_IS_KEY ) != 0 ;
if ( ! vpx_video_writer_write_frame ( writer , pkt -> data . frame . buf , pkt -> data . frame . sz , pkt -> data . frame . pts ) ) die_codec ( ctx , "Failed to write compressed frame." ) ;
printf ( keyframe ? "K" : "." ) ;
fflush ( stdout ) ;
}
}
return got_pkts ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int x ( struct vcache * avc , int afun , struct vrequest * areq , \ struct afs_pdata * ain , struct afs_pdata * aout , \ afs_ucred_t * * acred ) DECL_PIOCTL ( PGetFID ) ;
DECL_PIOCTL ( PSetAcl ) ;
DECL_PIOCTL ( PStoreBehind ) ;
DECL_PIOCTL ( PGCPAGs ) ;
DECL_PIOCTL ( PGetAcl ) ;
DECL_PIOCTL ( PNoop ) ;
DECL_PIOCTL ( PBogus ) ;
DECL_PIOCTL ( PGetFileCell ) ;
DECL_PIOCTL ( PGetWSCell ) ;
DECL_PIOCTL ( PGetUserCell ) ;
DECL_PIOCTL ( PSetTokens ) ;
DECL_PIOCTL ( PGetVolumeStatus ) ;
DECL_PIOCTL ( PSetVolumeStatus ) ;
DECL_PIOCTL ( PFlush ) ;
DECL_PIOCTL ( PNewStatMount ) ;
DECL_PIOCTL ( PGetTokens ) ;
DECL_PIOCTL ( PUnlog ) ;
DECL_PIOCTL ( PMariner ) ;
DECL_PIOCTL ( PCheckServers ) ;
DECL_PIOCTL ( PCheckVolNames ) ;
DECL_PIOCTL ( PCheckAuth ) ;
DECL_PIOCTL ( PFindVolume ) ;
DECL_PIOCTL ( PViceAccess ) ;
DECL_PIOCTL ( PSetCacheSize ) ;
DECL_PIOCTL ( PGetCacheSize ) ;
DECL_PIOCTL ( PRemoveCallBack ) ;
DECL_PIOCTL ( PNewCell ) ;
DECL_PIOCTL ( PNewAlias ) ;
DECL_PIOCTL ( PListCells ) ;
DECL_PIOCTL ( PListAliases ) ;
DECL_PIOCTL ( PRemoveMount ) ;
DECL_PIOCTL ( PGetCellStatus ) ;
DECL_PIOCTL ( PSetCellStatus ) ;
DECL_PIOCTL ( PFlushVolumeData ) ;
DECL_PIOCTL ( PFlushAllVolumeData )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( WebFrameTest , PrintIframeUnderDetached ) {
RegisterMockedHttpURLLoad ( "print-detached-iframe.html" ) ;
FrameTestHelpers : : WebViewHelper web_view_helper ;
web_view_helper . InitializeAndLoad ( base_url_ + "print-detached-iframe.html" ) ;
TestFramePrinting ( ToWebLocalFrameImpl ( web_view_helper . LocalMainFrame ( ) -> FirstChild ( ) -> FirstChild ( ) ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int kex_agree_kex_hostkey ( LIBSSH2_SESSION * session , unsigned char * kex , unsigned long kex_len , unsigned char * hostkey , unsigned long hostkey_len ) {
const LIBSSH2_KEX_METHOD * * kexp = libssh2_kex_methods ;
unsigned char * s ;
if ( session -> kex_prefs ) {
s = ( unsigned char * ) session -> kex_prefs ;
while ( s && * s ) {
unsigned char * q , * p = ( unsigned char * ) strchr ( ( char * ) s , ',' ) ;
size_t method_len = ( p ? ( size_t ) ( p - s ) : strlen ( ( char * ) s ) ) ;
if ( ( q = kex_agree_instr ( kex , kex_len , s , method_len ) ) ) {
const LIBSSH2_KEX_METHOD * method = ( const LIBSSH2_KEX_METHOD * ) kex_get_method_by_name ( ( char * ) s , method_len , ( const LIBSSH2_COMMON_METHOD * * ) kexp ) ;
if ( ! method ) {
return - 1 ;
}
if ( kex_agree_hostkey ( session , method -> flags , hostkey , hostkey_len ) == 0 ) {
session -> kex = method ;
if ( session -> burn_optimistic_kexinit && ( kex == q ) ) {
session -> burn_optimistic_kexinit = 0 ;
}
return 0 ;
}
}
s = p ? p + 1 : NULL ;
}
return - 1 ;
}
while ( * kexp && ( * kexp ) -> name ) {
s = kex_agree_instr ( kex , kex_len , ( unsigned char * ) ( * kexp ) -> name , strlen ( ( * kexp ) -> name ) ) ;
if ( s ) {
if ( kex_agree_hostkey ( session , ( * kexp ) -> flags , hostkey , hostkey_len ) == 0 ) {
session -> kex = * kexp ;
if ( session -> burn_optimistic_kexinit && ( kex == s ) ) {
session -> burn_optimistic_kexinit = 0 ;
}
return 0 ;
}
}
kexp ++ ;
}
return - 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void addToHeaderList ( const char * strings [ ] , HttpHeaderList & headers ) {
for ( int i = 0 ;
strings [ i ] ;
i += 2 ) {
if ( i % 4 == 0 ) {
headers . push_back ( HttpHeader ( strings [ i ] , - 1 , strings [ i + 1 ] , - 1 ) ) ;
headers . push_back ( HttpHeader ( ) ) ;
}
else {
headers . push_back ( HttpHeader ( strings [ i ] , strlen ( strings [ i ] ) , strings [ i + 1 ] , strlen ( strings [ i + 1 ] ) ) ) ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_cabac_mb_cbp_chroma ( H264Context * h ) {
int ctx ;
int cbp_a , cbp_b ;
cbp_a = ( h -> left_cbp >> 4 ) & 0x03 ;
cbp_b = ( h -> top_cbp >> 4 ) & 0x03 ;
ctx = 0 ;
if ( cbp_a > 0 ) ctx ++ ;
if ( cbp_b > 0 ) ctx += 2 ;
if ( get_cabac_noinline ( & h -> cabac , & h -> cabac_state [ 77 + ctx ] ) == 0 ) return 0 ;
ctx = 4 ;
if ( cbp_a == 2 ) ctx ++ ;
if ( cbp_b == 2 ) ctx += 2 ;
return 1 + get_cabac_noinline ( & h -> cabac , & h -> cabac_state [ 77 + ctx ] ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static char * xps_parse_glyph_metrics ( char * s , float * advance , float * uofs , float * vofs ) {
if ( * s == ',' ) s = xps_parse_real_num ( s + 1 , advance ) ;
if ( * s == ',' ) s = xps_parse_real_num ( s + 1 , uofs ) ;
if ( * s == ',' ) s = xps_parse_real_num ( s + 1 , vofs ) ;
return s ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void gpgsm_io_event ( void * engine , gpgme_event_io_t type , void * type_data ) {
engine_gpgsm_t gpgsm = engine ;
TRACE3 ( DEBUG_ENGINE , "gpgme:gpgsm_io_event" , gpgsm , "event %p, type %d, type_data %p" , gpgsm -> io_cbs . event , type , type_data ) ;
if ( gpgsm -> io_cbs . event ) ( * gpgsm -> io_cbs . event ) ( gpgsm -> io_cbs . event_priv , type , type_data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int i2d_ ## name ( type * a , unsigned char * * out ) ;
DECLARE_ASN1_ITEM ( itname ) # define DECLARE_ASN1_ENCODE_FUNCTIONS_const ( type , name ) type * d2i_ ## name ( type * * a , const unsigned char * * in , long len ) ;
int i2d_ ## name ( const type * a , unsigned char * * out ) ;
DECLARE_ASN1_ITEM ( name ) # define DECLARE_ASN1_NDEF_FUNCTION ( name ) int i2d_ ## name ## _NDEF ( name * a , unsigned char * * out ) ;
# define DECLARE_ASN1_FUNCTIONS_const ( name ) DECLARE_ASN1_ALLOC_FUNCTIONS ( name ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( name , name ) # define DECLARE_ASN1_ALLOC_FUNCTIONS_name ( type , name ) type * name ## _new ( void ) ;
void name ## _free ( type * a ) ;
# define DECLARE_ASN1_PRINT_FUNCTION ( stname ) DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , stname ) # define DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , fname ) int fname ## _print_ctx ( BIO * out , stname * x , int indent , const ASN1_PCTX * pctx ) ;
# define D2I_OF ( type ) type * ( * ) ( type * * , const unsigned char * * , long ) # define I2D_OF ( type ) int ( * ) ( type * , unsigned char * * ) # define I2D_OF_const ( type ) int ( * ) ( const type * , unsigned char * * ) # define CHECKED_D2I_OF ( type , d2i ) ( ( d2i_of_void * ) ( 1 ? d2i : ( ( D2I_OF ( type ) ) 0 ) ) ) # define CHECKED_I2D_OF ( type , i2d ) ( ( i2d_of_void * ) ( 1 ? i2d : ( ( I2D_OF ( type ) ) 0 ) ) ) # define CHECKED_NEW_OF ( type , xnew ) ( ( void * ( * ) ( void ) ) ( 1 ? xnew : ( ( type * ( * ) ( void ) ) 0 ) ) ) # define CHECKED_PTR_OF ( type , p ) ( ( void * ) ( 1 ? p : ( type * ) 0 ) ) # define CHECKED_PPTR_OF ( type , p ) ( ( void * * ) ( 1 ? p : ( type * * ) 0 ) ) # define TYPEDEF_D2I_OF ( type ) typedef type * d2i_of_ ## type ( type * * , const unsigned char * * , long ) # define TYPEDEF_I2D_OF ( type ) typedef int i2d_of_ ## type ( type * , unsigned char * * ) # define TYPEDEF_D2I2D_OF ( type ) TYPEDEF_D2I_OF ( type ) ;
TYPEDEF_I2D_OF ( type ) TYPEDEF_D2I2D_OF ( void ) ;
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION typedef const ASN1_ITEM ASN1_ITEM_EXP ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ) # define ASN1_ITEM_ref ( iptr ) ( & ( iptr ## _it ) ) # define ASN1_ITEM_rptr ( ref ) ( & ( ref ## _it ) ) # define DECLARE_ASN1_ITEM ( name ) OPENSSL_EXTERN const ASN1_ITEM name ## _it ;
# else typedef const ASN1_ITEM * ASN1_ITEM_EXP ( void ) ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ( ) ) # define ASN1_ITEM_ref ( iptr ) ( iptr ## _it ) # define ASN1_ITEM_rptr ( ref ) ( ref ## _it ( ) ) # define DECLARE_ASN1_ITEM ( name ) const ASN1_ITEM * name ## _it ( void ) ;
# endif # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 # define ASN1_STRFLGS_ESC_QUOTE 8 # define CHARTYPE_PRINTABLESTRING 0x10 # define CHARTYPE_FIRST_ESC_2253 0x20 # define CHARTYPE_LAST_ESC_2253 0x40 # define ASN1_STRFLGS_UTF8_CONVERT 0x10 # define ASN1_STRFLGS_IGNORE_TYPE 0x20 # define ASN1_STRFLGS_SHOW_TYPE 0x40 # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 # define ASN1_STRFLGS_DUMP_DER 0x200 # define ASN1_STRFLGS_ESC_2254 0x400 # define ASN1_STRFLGS_RFC2253 ( ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER ) DEFINE_STACK_OF ( ASN1_INTEGER ) DEFINE_STACK_OF ( ASN1_GENERALSTRING ) DEFINE_STACK_OF ( ASN1_UTF8STRING ) typedef struct asn1_type_st {
int type ;
union {
char * ptr ;
ASN1_BOOLEAN boolean ;
ASN1_STRING * asn1_string ;
ASN1_OBJECT * object ;
ASN1_INTEGER * integer ;
ASN1_ENUMERATED * enumerated ;
ASN1_BIT_STRING * bit_string ;
ASN1_OCTET_STRING * octet_string ;
ASN1_PRINTABLESTRING * printablestring ;
ASN1_T61STRING * t61string ;
ASN1_IA5STRING * ia5string ;
ASN1_GENERALSTRING * generalstring ;
ASN1_BMPSTRING * bmpstring ;
ASN1_UNIVERSALSTRING * universalstring ;
ASN1_UTCTIME * utctime ;
ASN1_GENERALIZEDTIME * generalizedtime ;
ASN1_VISIBLESTRING * visiblestring ;
ASN1_UTF8STRING * utf8string ;
ASN1_STRING * set ;
ASN1_STRING * sequence ;
ASN1_VALUE * asn1_value ;
}
value ;
}
ASN1_TYPE ;
DEFINE_STACK_OF ( ASN1_TYPE ) typedef STACK_OF ( ASN1_TYPE ) ASN1_SEQUENCE_ANY ;
DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SEQUENCE_ANY ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SET_ANY ) typedef struct BIT_STRING_BITNAME_st {
int bitnum ;
const char * lname ;
const char * sname ;
}
BIT_STRING_BITNAME ;
# define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING DECLARE_ASN1_FUNCTIONS_fname ( ASN1_TYPE , ASN1_ANY , ASN1_TYPE ) int ASN1_TYPE_get ( const ASN1_TYPE * a ) ;
void ASN1_TYPE_set ( ASN1_TYPE * a , int type , void * value ) ;
int ASN1_TYPE_set1 ( ASN1_TYPE * a , int type , const void * value ) ;
int ASN1_TYPE_cmp ( const ASN1_TYPE * a , const ASN1_TYPE * b ) ;
ASN1_TYPE * ASN1_TYPE_pack_sequence ( const ASN1_ITEM * it , void * s , ASN1_TYPE * * t ) ;
void * ASN1_TYPE_unpack_sequence ( const ASN1_ITEM * it , const ASN1_TYPE * t ) ;
ASN1_OBJECT * ASN1_OBJECT_new ( void ) ;
void ASN1_OBJECT_free ( ASN1_OBJECT * a ) ;
int i2d_ASN1_OBJECT ( const ASN1_OBJECT * a , unsigned char * * pp ) ;
ASN1_OBJECT * d2i_ASN1_OBJECT ( ASN1_OBJECT * * a , const unsigned char * * pp , long length ) ;
DECLARE_ASN1_ITEM ( ASN1_OBJECT ) DEFINE_STACK_OF ( ASN1_OBJECT ) ASN1_STRING * ASN1_STRING_new ( void ) ;
void ASN1_STRING_free ( ASN1_STRING * a ) ;
void ASN1_STRING_clear_free ( ASN1_STRING * a ) ;
int ASN1_STRING_copy ( ASN1_STRING * dst , const ASN1_STRING * str ) ;
ASN1_STRING * ASN1_STRING_dup ( const ASN1_STRING * a ) ;
ASN1_STRING * ASN1_STRING_type_new ( int type ) ;
int ASN1_STRING_cmp ( const ASN1_STRING * a , const ASN1_STRING * b ) ;
int ASN1_STRING_set ( ASN1_STRING * str , const void * data , int len ) ;
void ASN1_STRING_set0 ( ASN1_STRING * str , void * data , int len ) ;
int ASN1_STRING_length ( const ASN1_STRING * x ) ;
void ASN1_STRING_length_set ( ASN1_STRING * x , int n ) ;
int ASN1_STRING_type ( const ASN1_STRING * x ) ;
DEPRECATEDIN_1_1_0 ( unsigned char * ASN1_STRING_data ( ASN1_STRING * x ) ) const unsigned char * ASN1_STRING_get0_data ( const ASN1_STRING * x ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_BIT_STRING ) int ASN1_BIT_STRING_set ( ASN1_BIT_STRING * a , unsigned char * d , int length ) ;
int ASN1_BIT_STRING_set_bit ( ASN1_BIT_STRING * a , int n , int value ) ;
int ASN1_BIT_STRING_get_bit ( const ASN1_BIT_STRING * a , int n ) ;
int ASN1_BIT_STRING_check ( const ASN1_BIT_STRING * a , const unsigned char * flags , int flags_len ) ;
int ASN1_BIT_STRING_name_print ( BIO * out , ASN1_BIT_STRING * bs , BIT_STRING_BITNAME * tbl , int indent ) ;
int ASN1_BIT_STRING_num_asc ( const char * name , BIT_STRING_BITNAME * tbl ) ;
int ASN1_BIT_STRING_set_asc ( ASN1_BIT_STRING * bs , const char * name , int value , BIT_STRING_BITNAME * tbl ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_INTEGER ) ASN1_INTEGER * d2i_ASN1_UINTEGER ( ASN1_INTEGER * * a , const unsigned char * * pp , long length ) ;
ASN1_INTEGER * ASN1_INTEGER_dup ( const ASN1_INTEGER * x ) ;
int ASN1_INTEGER_cmp ( const ASN1_INTEGER * x , const ASN1_INTEGER * y ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_ENUMERATED ) int ASN1_UTCTIME_check ( const ASN1_UTCTIME * a ) ;
ASN1_UTCTIME * ASN1_UTCTIME_set ( ASN1_UTCTIME * s , time_t t ) ;
ASN1_UTCTIME * ASN1_UTCTIME_adj ( ASN1_UTCTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_UTCTIME_set_string ( ASN1_UTCTIME * s , const char * str ) ;
int ASN1_UTCTIME_cmp_time_t ( const ASN1_UTCTIME * s , time_t t ) ;
int ASN1_GENERALIZEDTIME_check ( const ASN1_GENERALIZEDTIME * a ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_set ( ASN1_GENERALIZEDTIME * s , time_t t ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_adj ( ASN1_GENERALIZEDTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_GENERALIZEDTIME_set_string ( ASN1_GENERALIZEDTIME * s , const char * str ) ;
int ASN1_TIME_diff ( int * pday , int * psec , const ASN1_TIME * from , const ASN1_TIME * to ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_OCTET_STRING ) ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup ( const ASN1_OCTET_STRING * a ) ;
int ASN1_OCTET_STRING_cmp ( const ASN1_OCTET_STRING * a , const ASN1_OCTET_STRING * b ) ;
int ASN1_OCTET_STRING_set ( ASN1_OCTET_STRING * str , const unsigned char * data , int len ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_VISIBLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UNIVERSALSTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UTF8STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_NULL ) DECLARE_ASN1_FUNCTIONS ( ASN1_BMPSTRING ) int UTF8_getc ( const unsigned char * str , int len , unsigned long * val ) ;
int UTF8_putc ( unsigned char * str , int len , unsigned long value ) ;
DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , ASN1_PRINTABLE ) DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , DIRECTORYSTRING ) DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , DISPLAYTEXT ) DECLARE_ASN1_FUNCTIONS ( ASN1_PRINTABLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_T61STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_IA5STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_GENERALSTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UTCTIME ) DECLARE_ASN1_FUNCTIONS ( ASN1_GENERALIZEDTIME )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void dissect_zcl_met_idt_attr_data ( proto_tree * tree , tvbuff_t * tvb , guint * offset , guint16 attr_id , guint data_type ) {
switch ( attr_id ) {
case ZBEE_ZCL_ATTR_ID_MET_IDT_METER_TYPE_ID : proto_tree_add_item ( tree , hf_zbee_zcl_met_idt_meter_type_id , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
break ;
case ZBEE_ZCL_ATTR_ID_MET_IDT_DATA_QUALITY_ID : proto_tree_add_item ( tree , hf_zbee_zcl_met_idt_data_quality_id , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
break ;
default : dissect_zcl_attr_data ( tvb , tree , offset , data_type ) ;
break ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dtap_bcc_setup ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) {
guint32 curr_offset ;
guint32 consumed ;
guint curr_len ;
curr_offset = offset ;
curr_len = len ;
ELEM_MAND_V ( GSM_A_PDU_TYPE_DTAP , DE_BCC_CALL_REF , "(Broadcast identity)" ) ;
ELEM_OPT_TLV ( 0x7e , GSM_A_PDU_TYPE_DTAP , DE_USER_USER , "(Originator-to-dispatcher information)" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static StkId adjust_varargs ( lua_State * L , Proto * p , int actual ) {
int i ;
int nfixargs = p -> numparams ;
Table * htab = NULL ;
StkId base , fixed ;
for ( ;
actual < nfixargs ;
++ actual ) setnilvalue ( L -> top ++ ) ;
# if defined ( LUA_COMPAT_VARARG ) if ( p -> is_vararg & VARARG_NEEDSARG ) {
int nvar = actual - nfixargs ;
lua_assert ( p -> is_vararg & VARARG_HASARG ) ;
luaC_checkGC ( L ) ;
luaD_checkstack ( L , p -> maxstacksize ) ;
htab = luaH_new ( L , nvar , 1 ) ;
for ( i = 0 ;
i < nvar ;
i ++ ) setobj2n ( L , luaH_setnum ( L , htab , i + 1 ) , L -> top - nvar + i ) ;
setnvalue ( luaH_setstr ( L , htab , luaS_newliteral ( L , "n" ) ) , cast_num ( nvar ) ) ;
}
# endif fixed = L -> top - actual ;
base = L -> top ;
for ( i = 0 ;
i < nfixargs ;
i ++ ) {
setobjs2s ( L , L -> top ++ , fixed + i ) ;
setnilvalue ( fixed + i ) ;
}
if ( htab ) {
sethvalue ( L , L -> top ++ , htab ) ;
lua_assert ( iswhite ( obj2gco ( htab ) ) ) ;
}
return base ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int svq3_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
SVQ3Context * s = avctx -> priv_data ;
H264Context * h = & s -> h ;
int buf_size = avpkt -> size ;
int ret , m , i ;
if ( buf_size == 0 ) {
if ( s -> next_pic -> f . data [ 0 ] && ! h -> low_delay && ! s -> last_frame_output ) {
* ( AVFrame * ) data = s -> next_pic -> f ;
s -> last_frame_output = 1 ;
* got_frame = 1 ;
}
return 0 ;
}
init_get_bits ( & h -> gb , buf , 8 * buf_size ) ;
h -> mb_x = h -> mb_y = h -> mb_xy = 0 ;
if ( svq3_decode_slice_header ( avctx ) ) return - 1 ;
h -> pict_type = h -> slice_type ;
if ( h -> pict_type != AV_PICTURE_TYPE_B ) FFSWAP ( Picture * , s -> next_pic , s -> last_pic ) ;
if ( s -> cur_pic -> f . data [ 0 ] ) avctx -> release_buffer ( avctx , & s -> cur_pic -> f ) ;
s -> cur_pic -> f . pict_type = h -> pict_type ;
s -> cur_pic -> f . key_frame = ( h -> pict_type == AV_PICTURE_TYPE_I ) ;
ret = get_buffer ( avctx , s -> cur_pic ) ;
if ( ret < 0 ) return ret ;
h -> cur_pic_ptr = s -> cur_pic ;
h -> cur_pic = * s -> cur_pic ;
for ( i = 0 ;
i < 16 ;
i ++ ) {
h -> block_offset [ i ] = ( 4 * ( ( scan8 [ i ] - scan8 [ 0 ] ) & 7 ) ) + 4 * h -> linesize * ( ( scan8 [ i ] - scan8 [ 0 ] ) >> 3 ) ;
h -> block_offset [ 48 + i ] = ( 4 * ( ( scan8 [ i ] - scan8 [ 0 ] ) & 7 ) ) + 8 * h -> linesize * ( ( scan8 [ i ] - scan8 [ 0 ] ) >> 3 ) ;
}
for ( i = 0 ;
i < 16 ;
i ++ ) {
h -> block_offset [ 16 + i ] = h -> block_offset [ 32 + i ] = ( 4 * ( ( scan8 [ i ] - scan8 [ 0 ] ) & 7 ) ) + 4 * h -> uvlinesize * ( ( scan8 [ i ] - scan8 [ 0 ] ) >> 3 ) ;
h -> block_offset [ 48 + 16 + i ] = h -> block_offset [ 48 + 32 + i ] = ( 4 * ( ( scan8 [ i ] - scan8 [ 0 ] ) & 7 ) ) + 8 * h -> uvlinesize * ( ( scan8 [ i ] - scan8 [ 0 ] ) >> 3 ) ;
}
if ( h -> pict_type != AV_PICTURE_TYPE_I ) {
if ( ! s -> last_pic -> f . data [ 0 ] ) {
av_log ( avctx , AV_LOG_ERROR , "Missing reference frame.\n" ) ;
ret = get_buffer ( avctx , s -> last_pic ) ;
if ( ret < 0 ) return ret ;
memset ( s -> last_pic -> f . data [ 0 ] , 0 , avctx -> height * s -> last_pic -> f . linesize [ 0 ] ) ;
memset ( s -> last_pic -> f . data [ 1 ] , 0x80 , ( avctx -> height / 2 ) * s -> last_pic -> f . linesize [ 1 ] ) ;
memset ( s -> last_pic -> f . data [ 2 ] , 0x80 , ( avctx -> height / 2 ) * s -> last_pic -> f . linesize [ 2 ] ) ;
}
if ( h -> pict_type == AV_PICTURE_TYPE_B && ! s -> next_pic -> f . data [ 0 ] ) {
av_log ( avctx , AV_LOG_ERROR , "Missing reference frame.\n" ) ;
ret = get_buffer ( avctx , s -> next_pic ) ;
if ( ret < 0 ) return ret ;
memset ( s -> next_pic -> f . data [ 0 ] , 0 , avctx -> height * s -> next_pic -> f . linesize [ 0 ] ) ;
memset ( s -> next_pic -> f . data [ 1 ] , 0x80 , ( avctx -> height / 2 ) * s -> next_pic -> f . linesize [ 1 ] ) ;
memset ( s -> next_pic -> f . data [ 2 ] , 0x80 , ( avctx -> height / 2 ) * s -> next_pic -> f . linesize [ 2 ] ) ;
}
}
if ( avctx -> debug & FF_DEBUG_PICT_INFO ) av_log ( h -> avctx , AV_LOG_DEBUG , "%c hpel:%d, tpel:%d aqp:%d qp:%d, slice_num:%02X\n" , av_get_picture_type_char ( h -> pict_type ) , s -> halfpel_flag , s -> thirdpel_flag , s -> adaptive_quant , h -> qscale , h -> slice_num ) ;
if ( avctx -> skip_frame >= AVDISCARD_NONREF && h -> pict_type == AV_PICTURE_TYPE_B || avctx -> skip_frame >= AVDISCARD_NONKEY && h -> pict_type != AV_PICTURE_TYPE_I || avctx -> skip_frame >= AVDISCARD_ALL ) return 0 ;
if ( s -> next_p_frame_damaged ) {
if ( h -> pict_type == AV_PICTURE_TYPE_B ) return 0 ;
else s -> next_p_frame_damaged = 0 ;
}
if ( h -> pict_type == AV_PICTURE_TYPE_B ) {
h -> frame_num_offset = h -> slice_num - h -> prev_frame_num ;
if ( h -> frame_num_offset < 0 ) h -> frame_num_offset += 256 ;
if ( h -> frame_num_offset == 0 || h -> frame_num_offset >= h -> prev_frame_num_offset ) {
av_log ( h -> avctx , AV_LOG_ERROR , "error in B-frame picture id\n" ) ;
return - 1 ;
}
}
else {
h -> prev_frame_num = h -> frame_num ;
h -> frame_num = h -> slice_num ;
h -> prev_frame_num_offset = h -> frame_num - h -> prev_frame_num ;
if ( h -> prev_frame_num_offset < 0 ) h -> prev_frame_num_offset += 256 ;
}
for ( m = 0 ;
m < 2 ;
m ++ ) {
int i ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
int j ;
for ( j = - 1 ;
j < 4 ;
j ++ ) h -> ref_cache [ m ] [ scan8 [ 0 ] + 8 * i + j ] = 1 ;
if ( i < 3 ) h -> ref_cache [ m ] [ scan8 [ 0 ] + 8 * i + j ] = PART_NOT_AVAILABLE ;
}
}
for ( h -> mb_y = 0 ;
h -> mb_y < h -> mb_height ;
h -> mb_y ++ ) {
for ( h -> mb_x = 0 ;
h -> mb_x < h -> mb_width ;
h -> mb_x ++ ) {
unsigned mb_type ;
h -> mb_xy = h -> mb_x + h -> mb_y * h -> mb_stride ;
if ( ( get_bits_count ( & h -> gb ) + 7 ) >= h -> gb . size_in_bits && ( ( get_bits_count ( & h -> gb ) & 7 ) == 0 || show_bits ( & h -> gb , - get_bits_count ( & h -> gb ) & 7 ) == 0 ) ) {
skip_bits ( & h -> gb , s -> next_slice_index - get_bits_count ( & h -> gb ) ) ;
h -> gb . size_in_bits = 8 * buf_size ;
if ( svq3_decode_slice_header ( avctx ) ) return - 1 ;
}
mb_type = svq3_get_ue_golomb ( & h -> gb ) ;
if ( h -> pict_type == AV_PICTURE_TYPE_I ) mb_type += 8 ;
else if ( h -> pict_type == AV_PICTURE_TYPE_B && mb_type >= 4 ) mb_type += 4 ;
if ( mb_type > 33 || svq3_decode_mb ( s , mb_type ) ) {
av_log ( h -> avctx , AV_LOG_ERROR , "error while decoding MB %d %d\n" , h -> mb_x , h -> mb_y ) ;
return - 1 ;
}
if ( mb_type != 0 ) ff_h264_hl_decode_mb ( h ) ;
if ( h -> pict_type != AV_PICTURE_TYPE_B && ! h -> low_delay ) h -> cur_pic . f . mb_type [ h -> mb_x + h -> mb_y * h -> mb_stride ] = ( h -> pict_type == AV_PICTURE_TYPE_P && mb_type < 8 ) ? ( mb_type - 1 ) : - 1 ;
}
ff_draw_horiz_band ( avctx , NULL , s -> cur_pic , s -> last_pic -> f . data [ 0 ] ? s -> last_pic : NULL , 16 * h -> mb_y , 16 , h -> picture_structure , 0 , 0 , h -> low_delay , h -> mb_height * 16 , h -> mb_width * 16 ) ;
}
if ( h -> pict_type == AV_PICTURE_TYPE_B || h -> low_delay ) * ( AVFrame * ) data = s -> cur_pic -> f ;
else * ( AVFrame * ) data = s -> last_pic -> f ;
if ( s -> last_pic -> f . data [ 0 ] || h -> low_delay ) * got_frame = 1 ;
if ( h -> pict_type != AV_PICTURE_TYPE_B ) {
FFSWAP ( Picture * , s -> cur_pic , s -> next_pic ) ;
}
return buf_size ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
const char * msc_alert_message ( modsec_rec * msr , msre_actionset * actionset , const char * action_message , const char * rule_message ) {
const char * message = NULL ;
if ( rule_message == NULL ) rule_message = "Unknown error." ;
if ( action_message == NULL ) {
message = apr_psprintf ( msr -> mp , "%s%s" , rule_message , msre_format_metadata ( msr , actionset ) ) ;
}
else {
message = apr_psprintf ( msr -> mp , "%s %s%s" , action_message , rule_message , msre_format_metadata ( msr , actionset ) ) ;
}
return message ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
krb5_error_code berval2tl_data ( struct berval * in , krb5_tl_data * * out ) {
* out = ( krb5_tl_data * ) malloc ( sizeof ( krb5_tl_data ) ) ;
if ( * out == NULL ) return ENOMEM ;
( * out ) -> tl_data_length = in -> bv_len - 2 ;
( * out ) -> tl_data_contents = ( krb5_octet * ) malloc ( ( * out ) -> tl_data_length * sizeof ( krb5_octet ) ) ;
if ( ( * out ) -> tl_data_contents == NULL ) {
free ( * out ) ;
return ENOMEM ;
}
UNSTORE16_INT ( in -> bv_val , ( * out ) -> tl_data_type ) ;
memcpy ( ( * out ) -> tl_data_contents , in -> bv_val + 2 , ( * out ) -> tl_data_length ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void setup ( char * argv0 , bool * live_check ) {
char exec_path [ MAXPGPATH ] ;
check_pghost_envvar ( ) ;
verify_directories ( ) ;
if ( pid_lock_file_exists ( old_cluster . pgdata ) ) {
if ( start_postmaster ( & old_cluster , false ) ) stop_postmaster ( false ) ;
else {
if ( ! user_opts . check ) pg_fatal ( "There seems to be a postmaster servicing the old cluster.\n" "Please shutdown that postmaster and try again.\n" ) ;
else * live_check = true ;
}
}
if ( pid_lock_file_exists ( new_cluster . pgdata ) ) {
if ( start_postmaster ( & new_cluster , false ) ) stop_postmaster ( false ) ;
else pg_fatal ( "There seems to be a postmaster servicing the new cluster.\n" "Please shutdown that postmaster and try again.\n" ) ;
}
if ( find_my_exec ( argv0 , exec_path ) < 0 ) pg_fatal ( "Could not get path name to pg_upgrade: %s\n" , getErrorText ( ) ) ;
* last_dir_separator ( exec_path ) = '\0' ;
canonicalize_path ( exec_path ) ;
os_info . exec_path = pg_strdup ( exec_path ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void tm2_still_block ( TM2Context * ctx , AVFrame * pic , int bx , int by ) {
int i , j ;
TM2_INIT_POINTERS_2 ( ) ;
for ( j = 0 ;
j < 2 ;
j ++ ) {
for ( i = 0 ;
i < 2 ;
i ++ ) {
U [ i ] = Uo [ i ] ;
V [ i ] = Vo [ i ] ;
}
U += Ustride ;
V += Vstride ;
Uo += oUstride ;
Vo += oVstride ;
}
U -= Ustride * 2 ;
V -= Vstride * 2 ;
TM2_RECALC_BLOCK ( U , Ustride , clast , ctx -> CD ) ;
TM2_RECALC_BLOCK ( V , Vstride , ( clast + 2 ) , ( ctx -> CD + 2 ) ) ;
ctx -> D [ 0 ] = Yo [ 3 ] - last [ 3 ] ;
ctx -> D [ 1 ] = Yo [ 3 + oYstride ] - Yo [ 3 ] ;
ctx -> D [ 2 ] = Yo [ 3 + oYstride * 2 ] - Yo [ 3 + oYstride ] ;
ctx -> D [ 3 ] = Yo [ 3 + oYstride * 3 ] - Yo [ 3 + oYstride * 2 ] ;
for ( j = 0 ;
j < 4 ;
j ++ ) {
for ( i = 0 ;
i < 4 ;
i ++ ) {
Y [ i ] = Yo [ i ] ;
last [ i ] = Yo [ i ] ;
}
Y += Ystride ;
Yo += oYstride ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static BusState * qbus_find ( const char * path ) {
DeviceState * dev ;
BusState * bus ;
char elem [ 128 ] , msg [ 256 ] ;
int pos , len ;
if ( path [ 0 ] == '/' ) {
bus = main_system_bus ;
pos = 0 ;
}
else {
if ( sscanf ( path , "%127[^/]%n" , elem , & len ) != 1 ) {
qemu_error ( "path parse error (\"%s\")\n" , path ) ;
return NULL ;
}
bus = qbus_find_recursive ( main_system_bus , elem , NULL ) ;
if ( ! bus ) {
qemu_error ( "bus \"%s\" not found\n" , elem ) ;
return NULL ;
}
pos = len ;
}
for ( ;
;
) {
if ( path [ pos ] == '\0' ) {
return bus ;
}
if ( sscanf ( path + pos , "/%127[^/]%n" , elem , & len ) != 1 ) {
qemu_error ( "path parse error (\"%s\" pos %d)\n" , path , pos ) ;
return NULL ;
}
pos += len ;
dev = qbus_find_dev ( bus , elem ) ;
if ( ! dev ) {
qbus_list_dev ( bus , msg , sizeof ( msg ) ) ;
qemu_error ( "device \"%s\" not found\n%s\n" , elem , msg ) ;
return NULL ;
}
if ( path [ pos ] == '\0' ) {
switch ( dev -> num_child_bus ) {
case 0 : qemu_error ( "device has no child bus (%s)\n" , path ) ;
return NULL ;
case 1 : return QLIST_FIRST ( & dev -> child_bus ) ;
default : qbus_list_bus ( dev , msg , sizeof ( msg ) ) ;
qemu_error ( "device has multiple child busses (%s)\n%s\n" , path , msg ) ;
return NULL ;
}
}
if ( sscanf ( path + pos , "/%127[^/]%n" , elem , & len ) != 1 ) {
qemu_error ( "path parse error (\"%s\" pos %d)\n" , path , pos ) ;
return NULL ;
}
pos += len ;
bus = qbus_find_bus ( dev , elem ) ;
if ( ! bus ) {
qbus_list_bus ( dev , msg , sizeof ( msg ) ) ;
qemu_error ( "child bus \"%s\" not found\n%s\n" , elem , msg ) ;
return NULL ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ff_h264_check_intra4x4_pred_mode ( H264Context * h ) {
static const int8_t top [ 12 ] = {
- 1 , 0 , LEFT_DC_PRED , - 1 , - 1 , - 1 , - 1 , - 1 , 0 }
;
static const int8_t left [ 12 ] = {
0 , - 1 , TOP_DC_PRED , 0 , - 1 , - 1 , - 1 , 0 , - 1 , DC_128_PRED }
;
int i ;
if ( ! ( h -> top_samples_available & 0x8000 ) ) {
for ( i = 0 ;
i < 4 ;
i ++ ) {
int status = top [ h -> intra4x4_pred_mode_cache [ scan8 [ 0 ] + i ] ] ;
if ( status < 0 ) {
av_log ( h -> avctx , AV_LOG_ERROR , "top block unavailable for requested intra4x4 mode %d at %d %d\n" , status , h -> mb_x , h -> mb_y ) ;
return AVERROR_INVALIDDATA ;
}
else if ( status ) {
h -> intra4x4_pred_mode_cache [ scan8 [ 0 ] + i ] = status ;
}
}
}
if ( ( h -> left_samples_available & 0x8888 ) != 0x8888 ) {
static const int mask [ 4 ] = {
0x8000 , 0x2000 , 0x80 , 0x20 }
;
for ( i = 0 ;
i < 4 ;
i ++ ) if ( ! ( h -> left_samples_available & mask [ i ] ) ) {
int status = left [ h -> intra4x4_pred_mode_cache [ scan8 [ 0 ] + 8 * i ] ] ;
if ( status < 0 ) {
av_log ( h -> avctx , AV_LOG_ERROR , "left block unavailable for requested intra4x4 mode %d at %d %d\n" , status , h -> mb_x , h -> mb_y ) ;
return AVERROR_INVALIDDATA ;
}
else if ( status ) {
h -> intra4x4_pred_mode_cache [ scan8 [ 0 ] + 8 * i ] = status ;
}
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_2 ( void ) {
static char * invalid_labels [ ] = {
"C=de,FOO=something,O=bar" , "Y=foo, C=baz" , NULL }
;
gpg_error_t err ;
int i ;
unsigned char * buf ;
size_t off , len ;
for ( i = 0 ;
invalid_labels [ i ] ;
i ++ ) {
err = ksba_dn_str2der ( invalid_labels [ i ] , & buf , & len ) ;
if ( gpg_err_code ( err ) != GPG_ERR_UNKNOWN_NAME ) fail ( "invalid label not detected" ) ;
err = ksba_dn_teststr ( invalid_labels [ i ] , 0 , & off , & len ) ;
if ( ! err ) fail ( "ksba_dn_test_str returned no error" ) ;
printf ( "string ->%s<- error at %lu.%lu (%.*s)\n" , invalid_labels [ i ] , ( unsigned long ) off , ( unsigned long ) len , ( int ) len , invalid_labels [ i ] + off ) ;
xfree ( buf ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_init_quantizer ( VP9_COMP * cpi ) {
VP9_COMMON * const cm = & cpi -> common ;
QUANTS * const quants = & cpi -> quants ;
int i , q , quant ;
for ( q = 0 ;
q < QINDEX_RANGE ;
q ++ ) {
const int qzbin_factor = get_qzbin_factor ( q , cm -> bit_depth ) ;
const int qrounding_factor = q == 0 ? 64 : 48 ;
for ( i = 0 ;
i < 2 ;
++ i ) {
int qrounding_factor_fp = i == 0 ? 48 : 42 ;
if ( q == 0 ) qrounding_factor_fp = 64 ;
quant = i == 0 ? vp9_dc_quant ( q , cm -> y_dc_delta_q , cm -> bit_depth ) : vp9_ac_quant ( q , 0 , cm -> bit_depth ) ;
invert_quant ( & quants -> y_quant [ q ] [ i ] , & quants -> y_quant_shift [ q ] [ i ] , quant ) ;
quants -> y_quant_fp [ q ] [ i ] = ( 1 << 16 ) / quant ;
quants -> y_round_fp [ q ] [ i ] = ( qrounding_factor_fp * quant ) >> 7 ;
quants -> y_zbin [ q ] [ i ] = ROUND_POWER_OF_TWO ( qzbin_factor * quant , 7 ) ;
quants -> y_round [ q ] [ i ] = ( qrounding_factor * quant ) >> 7 ;
cm -> y_dequant [ q ] [ i ] = quant ;
quant = i == 0 ? vp9_dc_quant ( q , cm -> uv_dc_delta_q , cm -> bit_depth ) : vp9_ac_quant ( q , cm -> uv_ac_delta_q , cm -> bit_depth ) ;
invert_quant ( & quants -> uv_quant [ q ] [ i ] , & quants -> uv_quant_shift [ q ] [ i ] , quant ) ;
quants -> uv_quant_fp [ q ] [ i ] = ( 1 << 16 ) / quant ;
quants -> uv_round_fp [ q ] [ i ] = ( qrounding_factor_fp * quant ) >> 7 ;
quants -> uv_zbin [ q ] [ i ] = ROUND_POWER_OF_TWO ( qzbin_factor * quant , 7 ) ;
quants -> uv_round [ q ] [ i ] = ( qrounding_factor * quant ) >> 7 ;
cm -> uv_dequant [ q ] [ i ] = quant ;
}
for ( i = 2 ;
i < 8 ;
i ++ ) {
quants -> y_quant [ q ] [ i ] = quants -> y_quant [ q ] [ 1 ] ;
quants -> y_quant_fp [ q ] [ i ] = quants -> y_quant_fp [ q ] [ 1 ] ;
quants -> y_round_fp [ q ] [ i ] = quants -> y_round_fp [ q ] [ 1 ] ;
quants -> y_quant_shift [ q ] [ i ] = quants -> y_quant_shift [ q ] [ 1 ] ;
quants -> y_zbin [ q ] [ i ] = quants -> y_zbin [ q ] [ 1 ] ;
quants -> y_round [ q ] [ i ] = quants -> y_round [ q ] [ 1 ] ;
cm -> y_dequant [ q ] [ i ] = cm -> y_dequant [ q ] [ 1 ] ;
quants -> uv_quant [ q ] [ i ] = quants -> uv_quant [ q ] [ 1 ] ;
quants -> uv_quant_fp [ q ] [ i ] = quants -> uv_quant_fp [ q ] [ 1 ] ;
quants -> uv_round_fp [ q ] [ i ] = quants -> uv_round_fp [ q ] [ 1 ] ;
quants -> uv_quant_shift [ q ] [ i ] = quants -> uv_quant_shift [ q ] [ 1 ] ;
quants -> uv_zbin [ q ] [ i ] = quants -> uv_zbin [ q ] [ 1 ] ;
quants -> uv_round [ q ] [ i ] = quants -> uv_round [ q ] [ 1 ] ;
cm -> uv_dequant [ q ] [ i ] = cm -> uv_dequant [ q ] [ 1 ] ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int compare_img ( const vpx_image_t * const img1 , const vpx_image_t * const img2 ) {
uint32_t l_w = img1 -> d_w ;
uint32_t c_w = ( img1 -> d_w + img1 -> x_chroma_shift ) >> img1 -> x_chroma_shift ;
const uint32_t c_h = ( img1 -> d_h + img1 -> y_chroma_shift ) >> img1 -> y_chroma_shift ;
uint32_t i ;
int match = 1 ;
match &= ( img1 -> fmt == img2 -> fmt ) ;
match &= ( img1 -> d_w == img2 -> d_w ) ;
match &= ( img1 -> d_h == img2 -> d_h ) ;
# if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH if ( img1 -> fmt & VPX_IMG_FMT_HIGHBITDEPTH ) {
l_w *= 2 ;
c_w *= 2 ;
}
# endif for ( i = 0 ;
i < img1 -> d_h ;
++ i ) match &= ( memcmp ( img1 -> planes [ VPX_PLANE_Y ] + i * img1 -> stride [ VPX_PLANE_Y ] , img2 -> planes [ VPX_PLANE_Y ] + i * img2 -> stride [ VPX_PLANE_Y ] , l_w ) == 0 ) ;
for ( i = 0 ;
i < c_h ;
++ i ) match &= ( memcmp ( img1 -> planes [ VPX_PLANE_U ] + i * img1 -> stride [ VPX_PLANE_U ] , img2 -> planes [ VPX_PLANE_U ] + i * img2 -> stride [ VPX_PLANE_U ] , c_w ) == 0 ) ;
for ( i = 0 ;
i < c_h ;
++ i ) match &= ( memcmp ( img1 -> planes [ VPX_PLANE_V ] + i * img1 -> stride [ VPX_PLANE_V ] , img2 -> planes [ VPX_PLANE_V ] + i * img2 -> stride [ VPX_PLANE_V ] , c_w ) == 0 ) ;
return match ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
extern int as_mysql_cluster_tres ( mysql_conn_t * mysql_conn , char * cluster_nodes , char * * tres_str_in , time_t event_time ) {
char * query ;
int rc = SLURM_SUCCESS ;
int first = 0 ;
MYSQL_RES * result = NULL ;
MYSQL_ROW row ;
xassert ( tres_str_in ) ;
if ( check_connection ( mysql_conn ) != SLURM_SUCCESS ) return ESLURM_DB_CONNECTION ;
if ( ! mysql_conn -> cluster_name ) {
error ( "%s:%d no cluster name" , THIS_FILE , __LINE__ ) ;
return SLURM_ERROR ;
}
query = xstrdup_printf ( "select tres, cluster_nodes from \"%s_%s\" where " "time_end=0 and node_name='' and state=0 limit 1" , mysql_conn -> cluster_name , event_table ) ;
if ( ! ( result = mysql_db_query_ret ( mysql_conn , query , 0 ) ) ) {
xfree ( query ) ;
if ( mysql_errno ( mysql_conn -> db_conn ) == ER_NO_SUCH_TABLE ) rc = ESLURM_ACCESS_DENIED ;
else rc = SLURM_ERROR ;
return rc ;
}
xfree ( query ) ;
if ( ! ( row = mysql_fetch_row ( result ) ) ) {
debug ( "We don't have an entry for this machine %s " "most likely a first time running." , mysql_conn -> cluster_name ) ;
if ( ! * tres_str_in ) {
rc = 0 ;
goto end_it ;
}
first = 1 ;
goto add_it ;
}
if ( ! * tres_str_in ) {
* tres_str_in = xstrdup ( row [ 0 ] ) ;
goto end_it ;
}
else if ( xstrcmp ( * tres_str_in , row [ 0 ] ) ) {
debug ( "%s has changed tres from %s to %s" , mysql_conn -> cluster_name , row [ 0 ] , * tres_str_in ) ;
}
else {
if ( debug_flags & DEBUG_FLAG_DB_EVENT ) DB_DEBUG ( mysql_conn -> conn , "We have the same tres as before for %s, " "no need to update the database." , mysql_conn -> cluster_name ) ;
if ( cluster_nodes ) {
if ( ! row [ 1 ] [ 0 ] ) {
debug ( "Adding cluster nodes '%s' to " "last instance of cluster '%s'." , cluster_nodes , mysql_conn -> cluster_name ) ;
query = xstrdup_printf ( "update \"%s_%s\" set " "cluster_nodes='%s' " "where time_end=0 and node_name=''" , mysql_conn -> cluster_name , event_table , cluster_nodes ) ;
( void ) mysql_db_query ( mysql_conn , query ) ;
xfree ( query ) ;
goto update_it ;
}
else if ( ! xstrcmp ( cluster_nodes , row [ 1 ] ) ) {
if ( debug_flags & DEBUG_FLAG_DB_EVENT ) DB_DEBUG ( mysql_conn -> conn , "we have the same nodes " "in the cluster " "as before no need to " "update the database." ) ;
goto update_it ;
}
}
goto end_it ;
}
query = xstrdup_printf ( "update \"%s_%s\" set time_end=%ld where time_end=0" , mysql_conn -> cluster_name , event_table , event_time ) ;
rc = mysql_db_query ( mysql_conn , query ) ;
xfree ( query ) ;
first = 1 ;
if ( rc != SLURM_SUCCESS ) goto end_it ;
add_it : query = xstrdup_printf ( "insert into \"%s_%s\" (cluster_nodes, tres, " "time_start, reason) " "values ('%s', '%s', %ld, 'Cluster Registered TRES');
" , mysql_conn -> cluster_name , event_table , cluster_nodes , * tres_str_in , event_time ) ;
( void ) mysql_db_query ( mysql_conn , query ) ;
xfree ( query ) ;
update_it : query = xstrdup_printf ( "update \"%s_%s\" set time_end=%ld where time_end=0 " "and state=%u and node_name='';
" , mysql_conn -> cluster_name , event_table , event_time , NODE_STATE_DOWN ) ;
rc = mysql_db_query ( mysql_conn , query ) ;
xfree ( query ) ;
end_it : mysql_free_result ( result ) ;
if ( first && rc == SLURM_SUCCESS ) rc = ACCOUNTING_FIRST_REG ;
return rc ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_bug2247 ( ) {
MYSQL_STMT * stmt ;
MYSQL_RES * res ;
int rc ;
int i ;
const char * create = "CREATE TABLE bug2247(id INT UNIQUE AUTO_INCREMENT)" ;
const char * insert = "INSERT INTO bug2247 VALUES (NULL)" ;
const char * SELECT = "SELECT id FROM bug2247" ;
const char * update = "UPDATE bug2247 SET id=id+10" ;
const char * drop = "DROP TABLE IF EXISTS bug2247" ;
ulonglong exp_count ;
enum {
NUM_ROWS = 5 }
;
myheader ( "test_bug2247" ) ;
if ( ! opt_silent ) fprintf ( stdout , "\nChecking if stmt_affected_rows is not affected by\n" "mysql_query ... " ) ;
rc = mysql_query ( mysql , drop ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , create ) ;
myquery ( rc ) ;
stmt = mysql_simple_prepare ( mysql , insert ) ;
check_stmt ( stmt ) ;
for ( i = 0 ;
i < NUM_ROWS ;
++ i ) {
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
}
exp_count = mysql_stmt_affected_rows ( stmt ) ;
DIE_UNLESS ( exp_count == 1 ) ;
rc = mysql_query ( mysql , SELECT ) ;
myquery ( rc ) ;
res = mysql_store_result ( mysql ) ;
mytest ( res ) ;
DIE_UNLESS ( mysql_affected_rows ( mysql ) == NUM_ROWS ) ;
DIE_UNLESS ( exp_count == mysql_stmt_affected_rows ( stmt ) ) ;
rc = mysql_query ( mysql , update ) ;
myquery ( rc ) ;
DIE_UNLESS ( mysql_affected_rows ( mysql ) == NUM_ROWS ) ;
DIE_UNLESS ( exp_count == mysql_stmt_affected_rows ( stmt ) ) ;
mysql_free_result ( res ) ;
mysql_stmt_close ( stmt ) ;
stmt = mysql_simple_prepare ( mysql , SELECT ) ;
check_stmt ( stmt ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_store_result ( stmt ) ;
check_execute ( stmt , rc ) ;
exp_count = mysql_stmt_affected_rows ( stmt ) ;
DIE_UNLESS ( exp_count == NUM_ROWS ) ;
rc = mysql_query ( mysql , insert ) ;
myquery ( rc ) ;
DIE_UNLESS ( mysql_affected_rows ( mysql ) == 1 ) ;
DIE_UNLESS ( mysql_stmt_affected_rows ( stmt ) == exp_count ) ;
mysql_stmt_close ( stmt ) ;
if ( ! opt_silent ) fprintf ( stdout , "OK" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void http_hdr_adjust ( HTTPHdrImpl * , int32_t , int32_t , int32_t ) {
ink_release_assert ( ! "http_hdr_adjust not implemented" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int show_starttime ( THD * thd , SHOW_VAR * var , char * buff ) {
var -> type = SHOW_LONG ;
var -> value = buff ;
* ( ( long * ) buff ) = ( long ) ( thd -> query_start ( ) - server_start_time ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
err_status_t srtp_stream_init_keys ( srtp_stream_ctx_t * srtp , const void * key ) {
err_status_t stat ;
srtp_kdf_t kdf ;
uint8_t tmp_key [ MAX_SRTP_KEY_LEN ] ;
int kdf_keylen = 30 , rtp_keylen , rtcp_keylen ;
int rtp_base_key_len , rtp_salt_len ;
int rtcp_base_key_len , rtcp_salt_len ;
rtp_keylen = cipher_get_key_length ( srtp -> rtp_cipher ) ;
rtcp_keylen = cipher_get_key_length ( srtp -> rtcp_cipher ) ;
rtp_base_key_len = base_key_length ( srtp -> rtp_cipher -> type , rtp_keylen ) ;
rtp_salt_len = rtp_keylen - rtp_base_key_len ;
if ( rtp_keylen > kdf_keylen ) {
kdf_keylen = 46 ;
}
if ( rtcp_keylen > kdf_keylen ) {
kdf_keylen = 46 ;
}
debug_print ( mod_srtp , "srtp key len: %d" , rtp_keylen ) ;
debug_print ( mod_srtp , "srtcp key len: %d" , rtcp_keylen ) ;
debug_print ( mod_srtp , "base key len: %d" , rtp_base_key_len ) ;
debug_print ( mod_srtp , "kdf key len: %d" , kdf_keylen ) ;
debug_print ( mod_srtp , "rtp salt len: %d" , rtp_salt_len ) ;
memset ( tmp_key , 0x0 , MAX_SRTP_KEY_LEN ) ;
memcpy ( tmp_key , key , ( rtp_base_key_len + rtp_salt_len ) ) ;
stat = srtp_kdf_init ( & kdf , AES_ICM , ( const uint8_t * ) tmp_key , kdf_keylen ) ;
if ( stat ) {
return err_status_init_fail ;
}
stat = srtp_kdf_generate ( & kdf , label_rtp_encryption , tmp_key , rtp_base_key_len ) ;
if ( stat ) {
octet_string_set_to_zero ( tmp_key , MAX_SRTP_KEY_LEN ) ;
return err_status_init_fail ;
}
debug_print ( mod_srtp , "cipher key: %s" , octet_string_hex_string ( tmp_key , rtp_base_key_len ) ) ;
if ( rtp_salt_len > 0 ) {
debug_print ( mod_srtp , "found rtp_salt_len > 0, generating salt" , NULL ) ;
stat = srtp_kdf_generate ( & kdf , label_rtp_salt , tmp_key + rtp_base_key_len , rtp_salt_len ) ;
if ( stat ) {
octet_string_set_to_zero ( tmp_key , MAX_SRTP_KEY_LEN ) ;
return err_status_init_fail ;
}
memcpy ( srtp -> salt , tmp_key + rtp_base_key_len , SRTP_AEAD_SALT_LEN ) ;
}
if ( rtp_salt_len > 0 ) {
debug_print ( mod_srtp , "cipher salt: %s" , octet_string_hex_string ( tmp_key + rtp_base_key_len , rtp_salt_len ) ) ;
}
stat = cipher_init ( srtp -> rtp_cipher , tmp_key ) ;
if ( stat ) {
octet_string_set_to_zero ( tmp_key , MAX_SRTP_KEY_LEN ) ;
return err_status_init_fail ;
}
stat = srtp_kdf_generate ( & kdf , label_rtp_msg_auth , tmp_key , auth_get_key_length ( srtp -> rtp_auth ) ) ;
if ( stat ) {
octet_string_set_to_zero ( tmp_key , MAX_SRTP_KEY_LEN ) ;
return err_status_init_fail ;
}
debug_print ( mod_srtp , "auth key: %s" , octet_string_hex_string ( tmp_key , auth_get_key_length ( srtp -> rtp_auth ) ) ) ;
stat = auth_init ( srtp -> rtp_auth , tmp_key ) ;
if ( stat ) {
octet_string_set_to_zero ( tmp_key , MAX_SRTP_KEY_LEN ) ;
return err_status_init_fail ;
}
rtcp_base_key_len = base_key_length ( srtp -> rtcp_cipher -> type , rtcp_keylen ) ;
rtcp_salt_len = rtcp_keylen - rtcp_base_key_len ;
debug_print ( mod_srtp , "rtcp salt len: %d" , rtcp_salt_len ) ;
stat = srtp_kdf_generate ( & kdf , label_rtcp_encryption , tmp_key , rtcp_base_key_len ) ;
if ( stat ) {
octet_string_set_to_zero ( tmp_key , MAX_SRTP_KEY_LEN ) ;
return err_status_init_fail ;
}
if ( rtcp_salt_len > 0 ) {
debug_print ( mod_srtp , "found rtcp_salt_len > 0, generating rtcp salt" , NULL ) ;
stat = srtp_kdf_generate ( & kdf , label_rtcp_salt , tmp_key + rtcp_base_key_len , rtcp_salt_len ) ;
if ( stat ) {
octet_string_set_to_zero ( tmp_key , MAX_SRTP_KEY_LEN ) ;
return err_status_init_fail ;
}
memcpy ( srtp -> c_salt , tmp_key + rtcp_base_key_len , SRTP_AEAD_SALT_LEN ) ;
}
debug_print ( mod_srtp , "rtcp cipher key: %s" , octet_string_hex_string ( tmp_key , rtcp_base_key_len ) ) ;
if ( rtcp_salt_len > 0 ) {
debug_print ( mod_srtp , "rtcp cipher salt: %s" , octet_string_hex_string ( tmp_key + rtcp_base_key_len , rtcp_salt_len ) ) ;
}
stat = cipher_init ( srtp -> rtcp_cipher , tmp_key ) ;
if ( stat ) {
octet_string_set_to_zero ( tmp_key , MAX_SRTP_KEY_LEN ) ;
return err_status_init_fail ;
}
stat = srtp_kdf_generate ( & kdf , label_rtcp_msg_auth , tmp_key , auth_get_key_length ( srtp -> rtcp_auth ) ) ;
if ( stat ) {
octet_string_set_to_zero ( tmp_key , MAX_SRTP_KEY_LEN ) ;
return err_status_init_fail ;
}
debug_print ( mod_srtp , "rtcp auth key: %s" , octet_string_hex_string ( tmp_key , auth_get_key_length ( srtp -> rtcp_auth ) ) ) ;
stat = auth_init ( srtp -> rtcp_auth , tmp_key ) ;
if ( stat ) {
octet_string_set_to_zero ( tmp_key , MAX_SRTP_KEY_LEN ) ;
return err_status_init_fail ;
}
stat = srtp_kdf_clear ( & kdf ) ;
octet_string_set_to_zero ( tmp_key , MAX_SRTP_KEY_LEN ) ;
if ( stat ) return err_status_init_fail ;
return err_status_ok ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static k12_t * new_k12_file_data ( void ) {
k12_t * fd = g_new ( k12_t , 1 ) ;
fd -> file_len = 0 ;
fd -> num_of_records = 0 ;
fd -> src_by_name = g_hash_table_new ( g_str_hash , g_str_equal ) ;
fd -> src_by_id = g_hash_table_new ( g_direct_hash , g_direct_equal ) ;
fd -> seq_read_buff = NULL ;
fd -> seq_read_buff_len = 0 ;
fd -> rand_read_buff = NULL ;
fd -> rand_read_buff_len = 0 ;
ws_buffer_init ( & ( fd -> extra_info ) , 100 ) ;
return fd ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void remove_new_subdir ( char * subdir , bool rmtopdir ) {
char new_path [ MAXPGPATH ] ;
prep_status ( "Deleting files from new %s" , subdir ) ;
snprintf ( new_path , sizeof ( new_path ) , "%s/%s" , new_cluster . pgdata , subdir ) ;
if ( ! rmtree ( new_path , rmtopdir ) ) pg_fatal ( "could not delete directory \"%s\"\n" , new_path ) ;
check_ok ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void roq_encode_video ( RoqContext * enc ) {
RoqTempdata * tempData = enc -> tmpData ;
int i ;
memset ( tempData , 0 , sizeof ( * tempData ) ) ;
create_cel_evals ( enc , tempData ) ;
generate_new_codebooks ( enc , tempData ) ;
if ( enc -> framesSinceKeyframe >= 1 ) {
motion_search ( enc , 8 ) ;
motion_search ( enc , 4 ) ;
}
retry_encode : for ( i = 0 ;
i < enc -> width * enc -> height / 64 ;
i ++ ) gather_data_for_cel ( tempData -> cel_evals + i , enc , tempData ) ;
if ( tempData -> mainChunkSize / 8 > 65535 ) {
av_log ( enc -> avctx , AV_LOG_ERROR , "Warning, generated a frame too big (%d > 65535), " "try using a smaller qscale value.\n" , tempData -> mainChunkSize / 8 ) ;
enc -> lambda *= 1.5 ;
tempData -> mainChunkSize = 0 ;
memset ( tempData -> used_option , 0 , sizeof ( tempData -> used_option ) ) ;
memset ( tempData -> codebooks . usedCB4 , 0 , sizeof ( tempData -> codebooks . usedCB4 ) ) ;
memset ( tempData -> codebooks . usedCB2 , 0 , sizeof ( tempData -> codebooks . usedCB2 ) ) ;
goto retry_encode ;
}
remap_codebooks ( enc , tempData ) ;
write_codebooks ( enc , tempData ) ;
reconstruct_and_encode_image ( enc , tempData , enc -> width , enc -> height , enc -> width * enc -> height / 64 ) ;
enc -> avctx -> coded_frame = enc -> current_frame ;
FFSWAP ( AVFrame * , enc -> current_frame , enc -> last_frame ) ;
FFSWAP ( motion_vect * , enc -> last_motion4 , enc -> this_motion4 ) ;
FFSWAP ( motion_vect * , enc -> last_motion8 , enc -> this_motion8 ) ;
av_free ( tempData -> cel_evals ) ;
av_free ( tempData -> closest_cb2 ) ;
enc -> framesSinceKeyframe ++ ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
gcry_sexp_t gcry_sexp_cons ( const gcry_sexp_t a , const gcry_sexp_t b ) {
( void ) a ;
( void ) b ;
BUG ( ) ;
return NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void purple_init ( account_t * acc ) {
char * prpl_id = purple_get_account_prpl_id ( acc ) ;
PurplePlugin * prpl = purple_plugins_find_with_id ( prpl_id ) ;
PurplePluginProtocolInfo * pi = prpl -> info -> extra_info ;
PurpleAccount * pa ;
GList * i , * st ;
set_t * s ;
char help_title [ 64 ] ;
GString * help ;
static gboolean dir_fixed = FALSE ;
if ( ! dir_fixed ) {
PurpleCertificatePool * pool ;
irc_t * irc = acc -> bee -> ui_data ;
char * dir ;
dir = g_strdup_printf ( "%s/purple/%s" , global . conf -> configdir , irc -> user -> nick ) ;
purple_util_set_user_dir ( dir ) ;
g_free ( dir ) ;
purple_blist_load ( ) ;
purple_prefs_load ( ) ;
if ( proxytype == PROXY_SOCKS4A ) {
purple_prefs_set_bool ( "/purple/proxy/socks4_remotedns" , TRUE ) ;
}
pool = purple_certificate_find_pool ( "x509" , "tls_peers" ) ;
dir = purple_certificate_pool_mkpath ( pool , NULL ) ;
purple_build_dir ( dir , 0700 ) ;
g_free ( dir ) ;
dir_fixed = TRUE ;
}
help = g_string_new ( "" ) ;
g_string_printf ( help , "BitlBee libpurple module %s (%s).\n\nSupported settings:" , ( char * ) acc -> prpl -> name , prpl -> info -> name ) ;
if ( pi -> user_splits ) {
GList * l ;
g_string_append_printf ( help , "\n* username: Username" ) ;
for ( l = pi -> user_splits ;
l ;
l = l -> next ) {
g_string_append_printf ( help , "%c%s" , purple_account_user_split_get_separator ( l -> data ) , purple_account_user_split_get_text ( l -> data ) ) ;
}
}
for ( i = pi -> protocol_options ;
i ;
i = i -> next ) {
PurpleAccountOption * o = i -> data ;
const char * name ;
char * def = NULL ;
set_eval eval = NULL ;
void * eval_data = NULL ;
GList * io = NULL ;
GSList * opts = NULL ;
name = purple_account_option_get_setting ( o ) ;
switch ( purple_account_option_get_type ( o ) ) {
case PURPLE_PREF_STRING : def = g_strdup ( purple_account_option_get_default_string ( o ) ) ;
g_string_append_printf ( help , "\n* %s (%s), %s, default: %s" , name , purple_account_option_get_text ( o ) , "string" , def ) ;
break ;
case PURPLE_PREF_INT : def = g_strdup_printf ( "%d" , purple_account_option_get_default_int ( o ) ) ;
eval = set_eval_int ;
g_string_append_printf ( help , "\n* %s (%s), %s, default: %s" , name , purple_account_option_get_text ( o ) , "integer" , def ) ;
break ;
case PURPLE_PREF_BOOLEAN : if ( purple_account_option_get_default_bool ( o ) ) {
def = g_strdup ( "true" ) ;
}
else {
def = g_strdup ( "false" ) ;
}
eval = set_eval_bool ;
g_string_append_printf ( help , "\n* %s (%s), %s, default: %s" , name , purple_account_option_get_text ( o ) , "boolean" , def ) ;
break ;
case PURPLE_PREF_STRING_LIST : def = g_strdup ( purple_account_option_get_default_list_value ( o ) ) ;
g_string_append_printf ( help , "\n* %s (%s), %s, default: %s" , name , purple_account_option_get_text ( o ) , "list" , def ) ;
g_string_append ( help , "\n Possible values: " ) ;
for ( io = purple_account_option_get_list ( o ) ;
io ;
io = io -> next ) {
PurpleKeyValuePair * kv = io -> data ;
opts = g_slist_append ( opts , kv -> value ) ;
if ( strcmp ( kv -> value , kv -> key ) != 0 ) {
g_string_append_printf ( help , "%s (%s), " , ( char * ) kv -> value , kv -> key ) ;
}
else {
g_string_append_printf ( help , "%s, " , ( char * ) kv -> value ) ;
}
}
g_string_truncate ( help , help -> len - 2 ) ;
eval = set_eval_list ;
eval_data = opts ;
break ;
default : g_string_append_printf ( help , "\n* [%s] UNSUPPORTED (type %d)" , name , purple_account_option_get_type ( o ) ) ;
name = NULL ;
}
if ( name != NULL ) {
s = set_add ( & acc -> set , name , def , eval , acc ) ;
s -> flags |= ACC_SET_OFFLINE_ONLY ;
s -> eval_data = eval_data ;
g_free ( def ) ;
}
}
g_snprintf ( help_title , sizeof ( help_title ) , "purple %s" , ( char * ) acc -> prpl -> name ) ;
help_add_mem ( & global . help , help_title , help -> str ) ;
g_string_free ( help , TRUE ) ;
s = set_add ( & acc -> set , "display_name" , NULL , set_eval_display_name , acc ) ;
s -> flags |= ACC_SET_ONLINE_ONLY ;
if ( pi -> options & OPT_PROTO_MAIL_CHECK ) {
s = set_add ( & acc -> set , "mail_notifications" , "false" , set_eval_bool , acc ) ;
s -> flags |= ACC_SET_OFFLINE_ONLY ;
s = set_add ( & acc -> set , "mail_notifications_handle" , NULL , NULL , acc ) ;
s -> flags |= ACC_SET_OFFLINE_ONLY | SET_NULL_OK ;
}
if ( strcmp ( prpl -> info -> name , "Gadu-Gadu" ) == 0 ) {
s = set_add ( & acc -> set , "gg_sync_contacts" , "true" , set_eval_bool , acc ) ;
}
pa = purple_account_new ( acc -> user , prpl_id ) ;
for ( st = purple_account_get_status_types ( pa ) ;
st ;
st = st -> next ) {
PurpleStatusPrimitive prim = purple_status_type_get_primitive ( st -> data ) ;
if ( prim == PURPLE_STATUS_AVAILABLE ) {
if ( purple_status_type_get_attr ( st -> data , "message" ) ) {
acc -> flags |= ACC_FLAG_STATUS_MESSAGE ;
}
}
else if ( prim != PURPLE_STATUS_OFFLINE ) {
if ( purple_status_type_get_attr ( st -> data , "message" ) ) {
acc -> flags |= ACC_FLAG_AWAY_MESSAGE ;
}
}
}
purple_accounts_remove ( pa ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void warn_or_exit_on_error ( vpx_codec_ctx_t * ctx , int fatal , const char * s , ... ) {
va_list ap ;
va_start ( ap , s ) ;
warn_or_exit_on_errorv ( ctx , fatal , s , ap ) ;
va_end ( ap ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pcnet_csr_writew ( PCNetState * s , uint32_t rap , uint32_t new_value ) {
uint16_t val = new_value ;
# ifdef PCNET_DEBUG_CSR printf ( "pcnet_csr_writew rap=%d val=0x%04x\n" , rap , val ) ;
# endif switch ( rap ) {
case 0 : s -> csr [ 0 ] &= ~ ( val & 0x7f00 ) ;
s -> csr [ 0 ] = ( s -> csr [ 0 ] & ~ 0x0040 ) | ( val & 0x0048 ) ;
val = ( val & 0x007f ) | ( s -> csr [ 0 ] & 0x7f00 ) ;
if ( ( val & 7 ) == 7 ) {
val &= ~ 3 ;
}
if ( ! CSR_STOP ( s ) && ( val & 4 ) ) {
pcnet_stop ( s ) ;
}
if ( ! CSR_INIT ( s ) && ( val & 1 ) ) {
pcnet_init ( s ) ;
}
if ( ! CSR_STRT ( s ) && ( val & 2 ) ) {
pcnet_start ( s ) ;
}
if ( CSR_TDMD ( s ) ) {
pcnet_transmit ( s ) ;
}
return ;
case 1 : case 2 : case 8 : case 9 : case 10 : case 11 : case 12 : case 13 : case 14 : case 15 : case 18 : case 19 : case 20 : case 21 : case 22 : case 23 : case 24 : case 25 : case 26 : case 27 : case 28 : case 29 : case 30 : case 31 : case 32 : case 33 : case 34 : case 35 : case 36 : case 37 : case 38 : case 39 : case 40 : case 41 : case 42 : case 43 : case 44 : case 45 : case 46 : case 47 : case 72 : case 74 : break ;
case 76 : case 78 : val = ( val > 0 ) ? val : 512 ;
break ;
case 112 : if ( CSR_STOP ( s ) || CSR_SPND ( s ) ) {
break ;
}
return ;
case 3 : break ;
case 4 : s -> csr [ 4 ] &= ~ ( val & 0x026a ) ;
val &= ~ 0x026a ;
val |= s -> csr [ 4 ] & 0x026a ;
break ;
case 5 : s -> csr [ 5 ] &= ~ ( val & 0x0a90 ) ;
val &= ~ 0x0a90 ;
val |= s -> csr [ 5 ] & 0x0a90 ;
break ;
case 16 : pcnet_csr_writew ( s , 1 , val ) ;
return ;
case 17 : pcnet_csr_writew ( s , 2 , val ) ;
return ;
case 58 : pcnet_bcr_writew ( s , BCR_SWS , val ) ;
break ;
default : return ;
}
s -> csr [ rap ] = val ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
const char * nntohostp ( sockaddr_u * netnum ) {
const char * hostn ;
char * buf ;
if ( ! showhostnames || SOCK_UNSPEC ( netnum ) ) return sptoa ( netnum ) ;
else if ( ISREFCLOCKADR ( netnum ) ) return refnumtoa ( netnum ) ;
hostn = socktohost ( netnum ) ;
LIB_GETBUF ( buf ) ;
snprintf ( buf , LIB_BUFLENGTH , "%s:%u" , hostn , SRCPORT ( netnum ) ) ;
return buf ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int32_t U_CALLCONV upvec_compareRows ( const void * context , const void * l , const void * r ) {
const uint32_t * left = ( const uint32_t * ) l , * right = ( const uint32_t * ) r ;
const UPropsVectors * pv = ( const UPropsVectors * ) context ;
int32_t i , count , columns ;
count = columns = pv -> columns ;
i = 2 ;
do {
if ( left [ i ] != right [ i ] ) {
return left [ i ] < right [ i ] ? - 1 : 1 ;
}
if ( ++ i == columns ) {
i = 0 ;
}
}
while ( -- count > 0 ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_AlternateGK ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_AlternateGK , AlternateGK_sequence ) ;
return offset ;
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.