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 dbstmt_prop_write ( zval * object , zval * member , zval * value , const zend_literal * key TSRMLS_DC ) {
pdo_stmt_t * stmt = ( pdo_stmt_t * ) zend_object_store_get_object ( object TSRMLS_CC ) ;
convert_to_string ( member ) ;
if ( strcmp ( Z_STRVAL_P ( member ) , "queryString" ) == 0 ) {
pdo_raise_impl_error ( stmt -> dbh , stmt , "HY000" , "property queryString is read only" TSRMLS_CC ) ;
}
else {
std_object_handlers . write_property ( object , member , value , key TSRMLS_CC ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
h225ras_call_t * new_h225ras_call ( h225ras_call_info_key * h225ras_call_key , packet_info * pinfo , e_guid_t * guid , int category ) {
h225ras_call_info_key * new_h225ras_call_key ;
h225ras_call_t * h225ras_call = NULL ;
new_h225ras_call_key = wmem_new ( wmem_file_scope ( ) , h225ras_call_info_key ) ;
new_h225ras_call_key -> reqSeqNum = h225ras_call_key -> reqSeqNum ;
new_h225ras_call_key -> conversation = h225ras_call_key -> conversation ;
h225ras_call = wmem_new ( wmem_file_scope ( ) , h225ras_call_t ) ;
h225ras_call -> req_num = pinfo -> num ;
h225ras_call -> rsp_num = 0 ;
h225ras_call -> requestSeqNum = h225ras_call_key -> reqSeqNum ;
h225ras_call -> responded = FALSE ;
h225ras_call -> next_call = NULL ;
h225ras_call -> req_time = pinfo -> abs_ts ;
h225ras_call -> guid = * guid ;
g_hash_table_insert ( ras_calls [ category ] , new_h225ras_call_key , h225ras_call ) ;
return h225ras_call ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void proto_reg_handoff_zbee_zcl_appl_stats ( void ) {
dissector_handle_t appl_stats_handle ;
appl_stats_handle = find_dissector ( ZBEE_PROTOABBREV_ZCL_APPLSTATS ) ;
dissector_add_uint ( "zbee.zcl.cluster" , ZBEE_ZCL_CID_APPLIANCE_STATISTICS , appl_stats_handle ) ;
zbee_zcl_init_cluster ( proto_zbee_zcl_appl_stats , ett_zbee_zcl_appl_stats , ZBEE_ZCL_CID_APPLIANCE_STATISTICS , hf_zbee_zcl_appl_stats_attr_id , hf_zbee_zcl_appl_stats_srv_rx_cmd_id , hf_zbee_zcl_appl_stats_srv_tx_cmd_id , NULL ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_pvfs2_flush_request ( tvbuff_t * tvb , proto_tree * tree , int offset , packet_info * pinfo ) {
offset = dissect_pvfs_fh ( tvb , offset , pinfo , tree , "handle" , NULL ) ;
offset = dissect_pvfs_fs_id ( tvb , tree , offset ) ;
proto_tree_add_item ( tree , hf_pvfs_flush_request_flags , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void balloon_page ( void * addr , int deflate ) {
# if defined ( __linux__ ) if ( ! kvm_enabled ( ) || kvm_has_sync_mmu ( ) ) qemu_madvise ( addr , TARGET_PAGE_SIZE , deflate ? QEMU_MADV_WILLNEED : QEMU_MADV_DONTNEED ) ;
# endif }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int vc1_decode_p_mb ( VC1Context * v ) {
MpegEncContext * s = & v -> s ;
GetBitContext * gb = & s -> gb ;
int i , j ;
int mb_pos = s -> mb_x + s -> mb_y * s -> mb_stride ;
int cbp ;
int mqdiff , mquant ;
int ttmb = v -> ttfrm ;
int mb_has_coeffs = 1 ;
int dmv_x , dmv_y ;
int index , index1 ;
int val , sign ;
int first_block = 1 ;
int dst_idx , off ;
int skipped , fourmv ;
int block_cbp = 0 , pat , block_tt = 0 , block_intra = 0 ;
mquant = v -> pq ;
if ( v -> mv_type_is_raw ) fourmv = get_bits1 ( gb ) ;
else fourmv = v -> mv_type_mb_plane [ mb_pos ] ;
if ( v -> skip_is_raw ) skipped = get_bits1 ( gb ) ;
else skipped = v -> s . mbskip_table [ mb_pos ] ;
if ( ! fourmv ) {
if ( ! skipped ) {
GET_MVDATA ( dmv_x , dmv_y ) ;
if ( s -> mb_intra ) {
s -> current_picture . f . motion_val [ 1 ] [ s -> block_index [ 0 ] ] [ 0 ] = 0 ;
s -> current_picture . f . motion_val [ 1 ] [ s -> block_index [ 0 ] ] [ 1 ] = 0 ;
}
s -> current_picture . f . mb_type [ mb_pos ] = s -> mb_intra ? MB_TYPE_INTRA : MB_TYPE_16x16 ;
vc1_pred_mv ( v , 0 , dmv_x , dmv_y , 1 , v -> range_x , v -> range_y , v -> mb_type [ 0 ] , 0 , 0 ) ;
if ( s -> mb_intra && ! mb_has_coeffs ) {
GET_MQUANT ( ) ;
s -> ac_pred = get_bits1 ( gb ) ;
cbp = 0 ;
}
else if ( mb_has_coeffs ) {
if ( s -> mb_intra ) s -> ac_pred = get_bits1 ( gb ) ;
cbp = get_vlc2 ( & v -> s . gb , v -> cbpcy_vlc -> table , VC1_CBPCY_P_VLC_BITS , 2 ) ;
GET_MQUANT ( ) ;
}
else {
mquant = v -> pq ;
cbp = 0 ;
}
s -> current_picture . f . qscale_table [ mb_pos ] = mquant ;
if ( ! v -> ttmbf && ! s -> mb_intra && mb_has_coeffs ) ttmb = get_vlc2 ( gb , ff_vc1_ttmb_vlc [ v -> tt_index ] . table , VC1_TTMB_VLC_BITS , 2 ) ;
if ( ! s -> mb_intra ) vc1_mc_1mv ( v , 0 ) ;
dst_idx = 0 ;
for ( i = 0 ;
i < 6 ;
i ++ ) {
s -> dc_val [ 0 ] [ s -> block_index [ i ] ] = 0 ;
dst_idx += i >> 2 ;
val = ( ( cbp >> ( 5 - i ) ) & 1 ) ;
off = ( i & 4 ) ? 0 : ( ( i & 1 ) * 8 + ( i & 2 ) * 4 * s -> linesize ) ;
v -> mb_type [ 0 ] [ s -> block_index [ i ] ] = s -> mb_intra ;
if ( s -> mb_intra ) {
v -> a_avail = v -> c_avail = 0 ;
if ( i == 2 || i == 3 || ! s -> first_slice_line ) v -> a_avail = v -> mb_type [ 0 ] [ s -> block_index [ i ] - s -> block_wrap [ i ] ] ;
if ( i == 1 || i == 3 || s -> mb_x ) v -> c_avail = v -> mb_type [ 0 ] [ s -> block_index [ i ] - 1 ] ;
vc1_decode_intra_block ( v , s -> block [ i ] , i , val , mquant , ( i & 4 ) ? v -> codingset2 : v -> codingset ) ;
if ( ( i > 3 ) && ( s -> flags & CODEC_FLAG_GRAY ) ) continue ;
v -> vc1dsp . vc1_inv_trans_8x8 ( s -> block [ i ] ) ;
if ( v -> rangeredfrm ) for ( j = 0 ;
j < 64 ;
j ++ ) s -> block [ i ] [ j ] <<= 1 ;
s -> dsp . put_signed_pixels_clamped ( s -> block [ i ] , s -> dest [ dst_idx ] + off , i & 4 ? s -> uvlinesize : s -> linesize ) ;
if ( v -> pq >= 9 && v -> overlap ) {
if ( v -> c_avail ) v -> vc1dsp . vc1_h_overlap ( s -> dest [ dst_idx ] + off , i & 4 ? s -> uvlinesize : s -> linesize ) ;
if ( v -> a_avail ) v -> vc1dsp . vc1_v_overlap ( s -> dest [ dst_idx ] + off , i & 4 ? s -> uvlinesize : s -> linesize ) ;
}
block_cbp |= 0xF << ( i << 2 ) ;
block_intra |= 1 << i ;
}
else if ( val ) {
pat = vc1_decode_p_block ( v , s -> block [ i ] , i , mquant , ttmb , first_block , s -> dest [ dst_idx ] + off , ( i & 4 ) ? s -> uvlinesize : s -> linesize , ( i & 4 ) && ( s -> flags & CODEC_FLAG_GRAY ) , & block_tt ) ;
block_cbp |= pat << ( i << 2 ) ;
if ( ! v -> ttmbf && ttmb < 8 ) ttmb = - 1 ;
first_block = 0 ;
}
}
}
else {
s -> mb_intra = 0 ;
for ( i = 0 ;
i < 6 ;
i ++ ) {
v -> mb_type [ 0 ] [ s -> block_index [ i ] ] = 0 ;
s -> dc_val [ 0 ] [ s -> block_index [ i ] ] = 0 ;
}
s -> current_picture . f . mb_type [ mb_pos ] = MB_TYPE_SKIP ;
s -> current_picture . f . qscale_table [ mb_pos ] = 0 ;
vc1_pred_mv ( v , 0 , 0 , 0 , 1 , v -> range_x , v -> range_y , v -> mb_type [ 0 ] , 0 , 0 ) ;
vc1_mc_1mv ( v , 0 ) ;
}
}
else {
if ( ! skipped ) {
int intra_count = 0 , coded_inter = 0 ;
int is_intra [ 6 ] , is_coded [ 6 ] ;
cbp = get_vlc2 ( & v -> s . gb , v -> cbpcy_vlc -> table , VC1_CBPCY_P_VLC_BITS , 2 ) ;
for ( i = 0 ;
i < 6 ;
i ++ ) {
val = ( ( cbp >> ( 5 - i ) ) & 1 ) ;
s -> dc_val [ 0 ] [ s -> block_index [ i ] ] = 0 ;
s -> mb_intra = 0 ;
if ( i < 4 ) {
dmv_x = dmv_y = 0 ;
s -> mb_intra = 0 ;
mb_has_coeffs = 0 ;
if ( val ) {
GET_MVDATA ( dmv_x , dmv_y ) ;
}
vc1_pred_mv ( v , i , dmv_x , dmv_y , 0 , v -> range_x , v -> range_y , v -> mb_type [ 0 ] , 0 , 0 ) ;
if ( ! s -> mb_intra ) vc1_mc_4mv_luma ( v , i , 0 ) ;
intra_count += s -> mb_intra ;
is_intra [ i ] = s -> mb_intra ;
is_coded [ i ] = mb_has_coeffs ;
}
if ( i & 4 ) {
is_intra [ i ] = ( intra_count >= 3 ) ;
is_coded [ i ] = val ;
}
if ( i == 4 ) vc1_mc_4mv_chroma ( v , 0 ) ;
v -> mb_type [ 0 ] [ s -> block_index [ i ] ] = is_intra [ i ] ;
if ( ! coded_inter ) coded_inter = ! is_intra [ i ] & is_coded [ i ] ;
}
dst_idx = 0 ;
if ( ! intra_count && ! coded_inter ) goto end ;
GET_MQUANT ( ) ;
s -> current_picture . f . qscale_table [ mb_pos ] = mquant ;
{
int intrapred = 0 ;
for ( i = 0 ;
i < 6 ;
i ++ ) if ( is_intra [ i ] ) {
if ( ( ( ! s -> first_slice_line || ( i == 2 || i == 3 ) ) && v -> mb_type [ 0 ] [ s -> block_index [ i ] - s -> block_wrap [ i ] ] ) || ( ( s -> mb_x || ( i == 1 || i == 3 ) ) && v -> mb_type [ 0 ] [ s -> block_index [ i ] - 1 ] ) ) {
intrapred = 1 ;
break ;
}
}
if ( intrapred ) s -> ac_pred = get_bits1 ( gb ) ;
else s -> ac_pred = 0 ;
}
if ( ! v -> ttmbf && coded_inter ) ttmb = get_vlc2 ( gb , ff_vc1_ttmb_vlc [ v -> tt_index ] . table , VC1_TTMB_VLC_BITS , 2 ) ;
for ( i = 0 ;
i < 6 ;
i ++ ) {
dst_idx += i >> 2 ;
off = ( i & 4 ) ? 0 : ( ( i & 1 ) * 8 + ( i & 2 ) * 4 * s -> linesize ) ;
s -> mb_intra = is_intra [ i ] ;
if ( is_intra [ i ] ) {
v -> a_avail = v -> c_avail = 0 ;
if ( i == 2 || i == 3 || ! s -> first_slice_line ) v -> a_avail = v -> mb_type [ 0 ] [ s -> block_index [ i ] - s -> block_wrap [ i ] ] ;
if ( i == 1 || i == 3 || s -> mb_x ) v -> c_avail = v -> mb_type [ 0 ] [ s -> block_index [ i ] - 1 ] ;
vc1_decode_intra_block ( v , s -> block [ i ] , i , is_coded [ i ] , mquant , ( i & 4 ) ? v -> codingset2 : v -> codingset ) ;
if ( ( i > 3 ) && ( s -> flags & CODEC_FLAG_GRAY ) ) continue ;
v -> vc1dsp . vc1_inv_trans_8x8 ( s -> block [ i ] ) ;
if ( v -> rangeredfrm ) for ( j = 0 ;
j < 64 ;
j ++ ) s -> block [ i ] [ j ] <<= 1 ;
s -> dsp . put_signed_pixels_clamped ( s -> block [ i ] , s -> dest [ dst_idx ] + off , ( i & 4 ) ? s -> uvlinesize : s -> linesize ) ;
if ( v -> pq >= 9 && v -> overlap ) {
if ( v -> c_avail ) v -> vc1dsp . vc1_h_overlap ( s -> dest [ dst_idx ] + off , i & 4 ? s -> uvlinesize : s -> linesize ) ;
if ( v -> a_avail ) v -> vc1dsp . vc1_v_overlap ( s -> dest [ dst_idx ] + off , i & 4 ? s -> uvlinesize : s -> linesize ) ;
}
block_cbp |= 0xF << ( i << 2 ) ;
block_intra |= 1 << i ;
}
else if ( is_coded [ i ] ) {
pat = vc1_decode_p_block ( v , s -> block [ i ] , i , mquant , ttmb , first_block , s -> dest [ dst_idx ] + off , ( i & 4 ) ? s -> uvlinesize : s -> linesize , ( i & 4 ) && ( s -> flags & CODEC_FLAG_GRAY ) , & block_tt ) ;
block_cbp |= pat << ( i << 2 ) ;
if ( ! v -> ttmbf && ttmb < 8 ) ttmb = - 1 ;
first_block = 0 ;
}
}
}
else {
s -> mb_intra = 0 ;
s -> current_picture . f . qscale_table [ mb_pos ] = 0 ;
for ( i = 0 ;
i < 6 ;
i ++ ) {
v -> mb_type [ 0 ] [ s -> block_index [ i ] ] = 0 ;
s -> dc_val [ 0 ] [ s -> block_index [ i ] ] = 0 ;
}
for ( i = 0 ;
i < 4 ;
i ++ ) {
vc1_pred_mv ( v , i , 0 , 0 , 0 , v -> range_x , v -> range_y , v -> mb_type [ 0 ] , 0 , 0 ) ;
vc1_mc_4mv_luma ( v , i , 0 ) ;
}
vc1_mc_4mv_chroma ( v , 0 ) ;
s -> current_picture . f . qscale_table [ mb_pos ] = 0 ;
}
}
end : v -> cbp [ s -> mb_x ] = block_cbp ;
v -> ttblk [ s -> mb_x ] = block_tt ;
v -> is_intra [ s -> mb_x ] = block_intra ;
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
proto_item * proto_tree_add_ipv4_format ( proto_tree * tree , int hfindex , tvbuff_t * tvb , gint start , gint length , guint32 value , const char * format , ... ) {
proto_item * pi ;
va_list ap ;
pi = proto_tree_add_ipv4 ( tree , hfindex , tvb , start , length , value ) ;
if ( pi != tree ) {
TRY_TO_FAKE_THIS_REPR ( pi ) ;
va_start ( ap , format ) ;
proto_tree_set_representation ( pi , format , ap ) ;
va_end ( ap ) ;
}
return pi ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_pvfs2_create_request ( tvbuff_t * tvb , proto_tree * tree , int offset , packet_info * pinfo ) {
offset = dissect_pvfs_fs_id ( tvb , tree , offset ) ;
offset = dissect_pvfs2_ds_type ( tvb , tree , offset , NULL ) ;
offset += 4 ;
offset = dissect_pvfs_handle_extent_array ( tvb , tree , offset , pinfo ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void mszipd_free ( struct mszipd_stream * zip ) {
struct mspack_system * sys ;
if ( zip ) {
sys = zip -> sys ;
sys -> free ( zip -> inbuf ) ;
sys -> free ( zip ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void tb_invalidate_phys_range ( tb_page_addr_t start , tb_page_addr_t end , int is_cpu_write_access ) {
while ( start < end ) {
tb_invalidate_phys_page_range ( start , end , is_cpu_write_access ) ;
start &= TARGET_PAGE_MASK ;
start += TARGET_PAGE_SIZE ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dtap_tp_epc_activate_test_mode ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) {
guint32 curr_offset ;
guint32 consumed ;
guint curr_len ;
curr_len = len ;
curr_offset = offset ;
ELEM_MAND_V ( GSM_A_PDU_TYPE_DTAP , DE_TP_EPC_UE_TEST_LOOP_MODE , NULL ) ;
EXTRANEOUS_DATA_CHECK ( curr_len , 0 , pinfo , & ei_gsm_a_dtap_extraneous_data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void Type_Screening_Free ( struct _cms_typehandler_struct * self , void * Ptr ) {
_cmsFree ( self -> ContextID , Ptr ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gint coap_get_opt_uint ( tvbuff_t * tvb , gint offset , gint length ) {
switch ( length ) {
case 0 : return 0 ;
case 1 : return ( guint ) tvb_get_guint8 ( tvb , offset ) ;
case 2 : return ( guint ) tvb_get_ntohs ( tvb , offset ) ;
case 3 : return ( guint ) tvb_get_ntoh24 ( tvb , offset ) ;
case 4 : return ( guint ) tvb_get_ntohl ( tvb , offset ) ;
default : return - 1 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void e1000e_set_rdtr ( E1000ECore * core , int index , uint32_t val ) {
e1000e_set_16bit ( core , index , val ) ;
if ( ( val & E1000_RDTR_FPD ) && ( core -> rdtr . running ) ) {
trace_e1000e_irq_rdtr_fpd_running ( ) ;
e1000e_intrmgr_fire_delayed_interrupts ( core ) ;
}
else {
trace_e1000e_irq_rdtr_fpd_not_running ( ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int jpc_pi_nextcprl ( register jpc_pi_t * pi ) {
int rlvlno ;
jpc_pirlvl_t * pirlvl ;
jpc_pchg_t * pchg ;
int prchind ;
int prcvind ;
int * prclyrno ;
uint_fast32_t trx0 ;
uint_fast32_t try0 ;
uint_fast32_t r ;
uint_fast32_t rpx ;
uint_fast32_t rpy ;
pchg = pi -> pchg ;
if ( ! pi -> prgvolfirst ) {
goto skip ;
}
else {
pi -> prgvolfirst = 0 ;
}
for ( pi -> compno = pchg -> compnostart , pi -> picomp = & pi -> picomps [ pi -> compno ] ;
pi -> compno < JAS_CAST ( int , pchg -> compnoend ) && pi -> compno < pi -> numcomps ;
++ pi -> compno , ++ pi -> picomp ) {
pirlvl = pi -> picomp -> pirlvls ;
pi -> xstep = pi -> picomp -> hsamp * ( 1 << ( pirlvl -> prcwidthexpn + pi -> picomp -> numrlvls - 1 ) ) ;
pi -> ystep = pi -> picomp -> vsamp * ( 1 << ( pirlvl -> prcheightexpn + pi -> picomp -> numrlvls - 1 ) ) ;
for ( rlvlno = 1 , pirlvl = & pi -> picomp -> pirlvls [ 1 ] ;
rlvlno < pi -> picomp -> numrlvls ;
++ rlvlno , ++ pirlvl ) {
pi -> xstep = JAS_MIN ( pi -> xstep , pi -> picomp -> hsamp * ( 1 << ( pirlvl -> prcwidthexpn + pi -> picomp -> numrlvls - rlvlno - 1 ) ) ) ;
pi -> ystep = JAS_MIN ( pi -> ystep , pi -> picomp -> vsamp * ( 1 << ( pirlvl -> prcheightexpn + pi -> picomp -> numrlvls - rlvlno - 1 ) ) ) ;
}
for ( pi -> y = pi -> ystart ;
pi -> y < pi -> yend ;
pi -> y += pi -> ystep - ( pi -> y % pi -> ystep ) ) {
for ( pi -> x = pi -> xstart ;
pi -> x < pi -> xend ;
pi -> x += pi -> xstep - ( pi -> x % pi -> xstep ) ) {
for ( pi -> rlvlno = pchg -> rlvlnostart , pi -> pirlvl = & pi -> picomp -> pirlvls [ pi -> rlvlno ] ;
pi -> rlvlno < pi -> picomp -> numrlvls && pi -> rlvlno < pchg -> rlvlnoend ;
++ pi -> rlvlno , ++ pi -> pirlvl ) {
if ( pi -> pirlvl -> numprcs == 0 ) {
continue ;
}
r = pi -> picomp -> numrlvls - 1 - pi -> rlvlno ;
trx0 = JPC_CEILDIV ( pi -> xstart , pi -> picomp -> hsamp << r ) ;
try0 = JPC_CEILDIV ( pi -> ystart , pi -> picomp -> vsamp << r ) ;
rpx = r + pi -> pirlvl -> prcwidthexpn ;
rpy = r + pi -> pirlvl -> prcheightexpn ;
if ( ( ( pi -> x == pi -> xstart && ( ( trx0 << r ) % ( 1 << rpx ) ) ) || ! ( pi -> x % ( pi -> picomp -> hsamp << rpx ) ) ) && ( ( pi -> y == pi -> ystart && ( ( try0 << r ) % ( 1 << rpy ) ) ) || ! ( pi -> y % ( pi -> picomp -> vsamp << rpy ) ) ) ) {
prchind = JPC_FLOORDIVPOW2 ( JPC_CEILDIV ( pi -> x , pi -> picomp -> hsamp << r ) , pi -> pirlvl -> prcwidthexpn ) - JPC_FLOORDIVPOW2 ( trx0 , pi -> pirlvl -> prcwidthexpn ) ;
prcvind = JPC_FLOORDIVPOW2 ( JPC_CEILDIV ( pi -> y , pi -> picomp -> vsamp << r ) , pi -> pirlvl -> prcheightexpn ) - JPC_FLOORDIVPOW2 ( try0 , pi -> pirlvl -> prcheightexpn ) ;
pi -> prcno = prcvind * pi -> pirlvl -> numhprcs + prchind ;
assert ( pi -> prcno < pi -> pirlvl -> numprcs ) ;
for ( pi -> lyrno = 0 ;
pi -> lyrno < pi -> numlyrs && pi -> lyrno < JAS_CAST ( int , pchg -> lyrnoend ) ;
++ pi -> lyrno ) {
prclyrno = & pi -> pirlvl -> prclyrnos [ pi -> prcno ] ;
if ( pi -> lyrno >= * prclyrno ) {
++ ( * prclyrno ) ;
return 0 ;
}
skip : ;
}
}
}
}
}
}
return 1 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void vga_draw_line8d2 ( VGACommonState * vga , uint8_t * d , uint32_t addr , int width ) {
uint32_t * palette ;
int x ;
palette = vga -> last_palette ;
width >>= 3 ;
for ( x = 0 ;
x < width ;
x ++ ) {
PUT_PIXEL2 ( d , 0 , palette [ vga_read_byte ( vga , addr + 0 ) ] ) ;
PUT_PIXEL2 ( d , 1 , palette [ vga_read_byte ( vga , addr + 1 ) ] ) ;
PUT_PIXEL2 ( d , 2 , palette [ vga_read_byte ( vga , addr + 2 ) ] ) ;
PUT_PIXEL2 ( d , 3 , palette [ vga_read_byte ( vga , addr + 3 ) ] ) ;
d += 32 ;
addr += 4 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_rsl_ie_timing_adv ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset , gboolean is_mandatory ) {
proto_tree * ie_tree ;
guint8 ie_id ;
if ( is_mandatory == FALSE ) {
ie_id = tvb_get_guint8 ( tvb , offset ) ;
if ( ie_id != RSL_IE_TIMING_ADV ) return offset ;
}
ie_tree = proto_tree_add_subtree ( tree , tvb , offset , 2 , ett_ie_timing_adv , NULL , "Timing Advance IE" ) ;
proto_tree_add_item ( ie_tree , hf_rsl_ie_id , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
proto_tree_add_item ( ie_tree , hf_rsl_timing_adv , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int kvm_device_msix_assign ( KVMState * s , uint32_t dev_id ) {
return kvm_assign_irq_internal ( s , dev_id , KVM_DEV_IRQ_HOST_MSIX | KVM_DEV_IRQ_GUEST_MSIX , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int pcm_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) {
const uint8_t * src = avpkt -> data ;
int buf_size = avpkt -> size ;
PCMDecode * s = avctx -> priv_data ;
AVFrame * frame = data ;
int sample_size , c , n , ret , samples_per_block ;
uint8_t * samples ;
int32_t * dst_int32_t ;
sample_size = av_get_bits_per_sample ( avctx -> codec_id ) / 8 ;
samples_per_block = 1 ;
if ( AV_CODEC_ID_PCM_DVD == avctx -> codec_id ) {
if ( avctx -> bits_per_coded_sample != 20 && avctx -> bits_per_coded_sample != 24 ) {
av_log ( avctx , AV_LOG_ERROR , "PCM DVD unsupported sample depth\n" ) ;
return AVERROR ( EINVAL ) ;
}
samples_per_block = 2 ;
sample_size = avctx -> bits_per_coded_sample * 2 / 8 ;
}
else if ( avctx -> codec_id == AV_CODEC_ID_PCM_LXF ) {
samples_per_block = 2 ;
sample_size = 5 ;
}
if ( sample_size == 0 ) {
av_log ( avctx , AV_LOG_ERROR , "Invalid sample_size\n" ) ;
return AVERROR ( EINVAL ) ;
}
n = avctx -> channels * sample_size ;
if ( n && buf_size % n ) {
if ( buf_size < n ) {
av_log ( avctx , AV_LOG_ERROR , "invalid PCM packet\n" ) ;
return - 1 ;
}
else buf_size -= buf_size % n ;
}
n = buf_size / sample_size ;
frame -> nb_samples = n * samples_per_block / avctx -> channels ;
if ( ( ret = ff_get_buffer ( avctx , frame , 0 ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
samples = frame -> data [ 0 ] ;
switch ( avctx -> codec -> id ) {
case AV_CODEC_ID_PCM_U32LE : DECODE ( 32 , le32 , src , samples , n , 0 , 0x80000000 ) break ;
case AV_CODEC_ID_PCM_U32BE : DECODE ( 32 , be32 , src , samples , n , 0 , 0x80000000 ) break ;
case AV_CODEC_ID_PCM_S24LE : DECODE ( 32 , le24 , src , samples , n , 8 , 0 ) break ;
case AV_CODEC_ID_PCM_S24BE : DECODE ( 32 , be24 , src , samples , n , 8 , 0 ) break ;
case AV_CODEC_ID_PCM_U24LE : DECODE ( 32 , le24 , src , samples , n , 8 , 0x800000 ) break ;
case AV_CODEC_ID_PCM_U24BE : DECODE ( 32 , be24 , src , samples , n , 8 , 0x800000 ) break ;
case AV_CODEC_ID_PCM_S24DAUD : for ( ;
n > 0 ;
n -- ) {
uint32_t v = bytestream_get_be24 ( & src ) ;
v >>= 4 ;
AV_WN16A ( samples , ff_reverse [ ( v >> 8 ) & 0xff ] + ( ff_reverse [ v & 0xff ] << 8 ) ) ;
samples += 2 ;
}
break ;
case AV_CODEC_ID_PCM_S16LE_PLANAR : {
int av_unused n2 ;
n /= avctx -> channels ;
for ( c = 0 ;
c < avctx -> channels ;
c ++ ) {
samples = frame -> extended_data [ c ] ;
# if HAVE_BIGENDIAN n2 = n ;
DECODE ( 16 , le16 , src , samples , n2 , 0 , 0 ) # else memcpy ( samples , src , n * 2 ) ;
src += n * 2 ;
# endif }
break ;
}
case AV_CODEC_ID_PCM_U16LE : DECODE ( 16 , le16 , src , samples , n , 0 , 0x8000 ) break ;
case AV_CODEC_ID_PCM_U16BE : DECODE ( 16 , be16 , src , samples , n , 0 , 0x8000 ) break ;
case AV_CODEC_ID_PCM_S8 : for ( ;
n > 0 ;
n -- ) * samples ++ = * src ++ + 128 ;
break ;
# if HAVE_BIGENDIAN case AV_CODEC_ID_PCM_F64LE : DECODE ( 64 , le64 , src , samples , n , 0 , 0 ) break ;
case AV_CODEC_ID_PCM_S32LE : case AV_CODEC_ID_PCM_F32LE : DECODE ( 32 , le32 , src , samples , n , 0 , 0 ) break ;
case AV_CODEC_ID_PCM_S16LE : DECODE ( 16 , le16 , src , samples , n , 0 , 0 ) break ;
case AV_CODEC_ID_PCM_F64BE : case AV_CODEC_ID_PCM_F32BE : case AV_CODEC_ID_PCM_S32BE : case AV_CODEC_ID_PCM_S16BE : # else case AV_CODEC_ID_PCM_F64BE : DECODE ( 64 , be64 , src , samples , n , 0 , 0 ) break ;
case AV_CODEC_ID_PCM_F32BE : case AV_CODEC_ID_PCM_S32BE : DECODE ( 32 , be32 , src , samples , n , 0 , 0 ) break ;
case AV_CODEC_ID_PCM_S16BE : DECODE ( 16 , be16 , src , samples , n , 0 , 0 ) break ;
case AV_CODEC_ID_PCM_F64LE : case AV_CODEC_ID_PCM_F32LE : case AV_CODEC_ID_PCM_S32LE : case AV_CODEC_ID_PCM_S16LE : # endif case AV_CODEC_ID_PCM_U8 : memcpy ( samples , src , n * sample_size ) ;
break ;
case AV_CODEC_ID_PCM_ZORK : for ( ;
n > 0 ;
n -- ) {
int v = * src ++ ;
if ( v < 128 ) v = 128 - v ;
* samples ++ = v ;
}
break ;
case AV_CODEC_ID_PCM_ALAW : case AV_CODEC_ID_PCM_MULAW : for ( ;
n > 0 ;
n -- ) {
AV_WN16A ( samples , s -> table [ * src ++ ] ) ;
samples += 2 ;
}
break ;
case AV_CODEC_ID_PCM_DVD : {
const uint8_t * src8 ;
dst_int32_t = ( int32_t * ) frame -> data [ 0 ] ;
n /= avctx -> channels ;
switch ( avctx -> bits_per_coded_sample ) {
case 20 : while ( n -- ) {
c = avctx -> channels ;
src8 = src + 4 * c ;
while ( c -- ) {
* dst_int32_t ++ = ( bytestream_get_be16 ( & src ) << 16 ) + ( ( * src8 & 0xf0 ) << 8 ) ;
* dst_int32_t ++ = ( bytestream_get_be16 ( & src ) << 16 ) + ( ( * src8 ++ & 0x0f ) << 12 ) ;
}
src = src8 ;
}
break ;
case 24 : while ( n -- ) {
c = avctx -> channels ;
src8 = src + 4 * c ;
while ( c -- ) {
* dst_int32_t ++ = ( bytestream_get_be16 ( & src ) << 16 ) + ( ( * src8 ++ ) << 8 ) ;
* dst_int32_t ++ = ( bytestream_get_be16 ( & src ) << 16 ) + ( ( * src8 ++ ) << 8 ) ;
}
src = src8 ;
}
break ;
}
break ;
}
case AV_CODEC_ID_PCM_LXF : {
int i ;
n /= avctx -> channels ;
for ( c = 0 ;
c < avctx -> channels ;
c ++ ) {
dst_int32_t = ( int32_t * ) frame -> extended_data [ c ] ;
for ( i = 0 ;
i < n ;
i ++ ) {
* dst_int32_t ++ = ( src [ 2 ] << 28 ) | ( src [ 1 ] << 20 ) | ( src [ 0 ] << 12 ) | ( ( src [ 2 ] & 0x0F ) << 8 ) | src [ 1 ] ;
* dst_int32_t ++ = ( src [ 4 ] << 24 ) | ( src [ 3 ] << 16 ) | ( ( src [ 2 ] & 0xF0 ) << 8 ) | ( src [ 4 ] << 4 ) | ( src [ 3 ] >> 4 ) ;
src += 5 ;
}
}
break ;
}
default : return - 1 ;
}
* got_frame_ptr = 1 ;
return buf_size ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_set_rd_speed_thresholds_sub8x8 ( VP9_COMP * cpi ) {
const SPEED_FEATURES * const sf = & cpi -> sf ;
RD_OPT * const rd = & cpi -> rd ;
int i ;
for ( i = 0 ;
i < MAX_REFS ;
++ i ) rd -> thresh_mult_sub8x8 [ i ] = cpi -> oxcf . mode == BEST ? - 500 : 0 ;
rd -> thresh_mult_sub8x8 [ THR_LAST ] += 2500 ;
rd -> thresh_mult_sub8x8 [ THR_GOLD ] += 2500 ;
rd -> thresh_mult_sub8x8 [ THR_ALTR ] += 2500 ;
rd -> thresh_mult_sub8x8 [ THR_INTRA ] += 2500 ;
rd -> thresh_mult_sub8x8 [ THR_COMP_LA ] += 4500 ;
rd -> thresh_mult_sub8x8 [ THR_COMP_GA ] += 4500 ;
for ( i = 0 ;
i < MAX_REFS ;
++ i ) if ( sf -> disable_split_mask & ( 1 << i ) ) rd -> thresh_mult_sub8x8 [ i ] = INT_MAX ;
if ( ! ( cpi -> ref_frame_flags & VP9_LAST_FLAG ) ) rd -> thresh_mult_sub8x8 [ THR_LAST ] = INT_MAX ;
if ( ! ( cpi -> ref_frame_flags & VP9_GOLD_FLAG ) ) rd -> thresh_mult_sub8x8 [ THR_GOLD ] = INT_MAX ;
if ( ! ( cpi -> ref_frame_flags & VP9_ALT_FLAG ) ) rd -> thresh_mult_sub8x8 [ THR_ALTR ] = INT_MAX ;
if ( ( cpi -> ref_frame_flags & ( VP9_LAST_FLAG | VP9_ALT_FLAG ) ) != ( VP9_LAST_FLAG | VP9_ALT_FLAG ) ) rd -> thresh_mult_sub8x8 [ THR_COMP_LA ] = INT_MAX ;
if ( ( cpi -> ref_frame_flags & ( VP9_GOLD_FLAG | VP9_ALT_FLAG ) ) != ( VP9_GOLD_FLAG | VP9_ALT_FLAG ) ) rd -> thresh_mult_sub8x8 [ THR_COMP_GA ] = INT_MAX ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int bethsoftvid_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
BethsoftvidContext * vid = avctx -> priv_data ;
char block_type ;
uint8_t * dst ;
uint8_t * frame_end ;
int remaining = avctx -> width ;
int wrap_to_next_line ;
int code , ret ;
int yoffset ;
if ( ( ret = avctx -> reget_buffer ( avctx , & vid -> frame ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ;
return ret ;
}
wrap_to_next_line = vid -> frame . linesize [ 0 ] - avctx -> width ;
if ( avpkt -> side_data_elems > 0 && avpkt -> side_data [ 0 ] . type == AV_PKT_DATA_PALETTE ) {
bytestream2_init ( & vid -> g , avpkt -> side_data [ 0 ] . data , avpkt -> side_data [ 0 ] . size ) ;
if ( ( ret = set_palette ( vid ) ) < 0 ) return ret ;
}
bytestream2_init ( & vid -> g , avpkt -> data , avpkt -> size ) ;
dst = vid -> frame . data [ 0 ] ;
frame_end = vid -> frame . data [ 0 ] + vid -> frame . linesize [ 0 ] * avctx -> height ;
switch ( block_type = bytestream2_get_byte ( & vid -> g ) ) {
case PALETTE_BLOCK : {
* got_frame = 0 ;
if ( ( ret = set_palette ( vid ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "error reading palette\n" ) ;
return ret ;
}
return bytestream2_tell ( & vid -> g ) ;
}
case VIDEO_YOFF_P_FRAME : yoffset = bytestream2_get_le16 ( & vid -> g ) ;
if ( yoffset >= avctx -> height ) return AVERROR_INVALIDDATA ;
dst += vid -> frame . linesize [ 0 ] * yoffset ;
}
while ( ( code = bytestream2_get_byte ( & vid -> g ) ) ) {
int length = code & 0x7f ;
while ( length > remaining ) {
if ( code < 0x80 ) bytestream2_get_buffer ( & vid -> g , dst , remaining ) ;
else if ( block_type == VIDEO_I_FRAME ) memset ( dst , bytestream2_peek_byte ( & vid -> g ) , remaining ) ;
length -= remaining ;
dst += remaining + wrap_to_next_line ;
remaining = avctx -> width ;
if ( dst == frame_end ) goto end ;
}
if ( code < 0x80 ) bytestream2_get_buffer ( & vid -> g , dst , length ) ;
else if ( block_type == VIDEO_I_FRAME ) memset ( dst , bytestream2_get_byte ( & vid -> g ) , length ) ;
remaining -= length ;
dst += length ;
}
end : * got_frame = 1 ;
* ( AVFrame * ) data = vid -> frame ;
return avpkt -> size ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int pxa2xx_ssp_load ( QEMUFile * f , void * opaque , int version_id ) {
PXA2xxSSPState * s = ( PXA2xxSSPState * ) opaque ;
int i ;
s -> enable = qemu_get_be32 ( f ) ;
qemu_get_be32s ( f , & s -> sscr [ 0 ] ) ;
qemu_get_be32s ( f , & s -> sscr [ 1 ] ) ;
qemu_get_be32s ( f , & s -> sspsp ) ;
qemu_get_be32s ( f , & s -> ssto ) ;
qemu_get_be32s ( f , & s -> ssitr ) ;
qemu_get_be32s ( f , & s -> sssr ) ;
qemu_get_8s ( f , & s -> sstsa ) ;
qemu_get_8s ( f , & s -> ssrsa ) ;
qemu_get_8s ( f , & s -> ssacd ) ;
s -> rx_level = qemu_get_byte ( f ) ;
s -> rx_start = 0 ;
for ( i = 0 ;
i < s -> rx_level ;
i ++ ) s -> rx_fifo [ i ] = qemu_get_byte ( f ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void cal_nmvjointsadcost ( int * mvjointsadcost ) {
mvjointsadcost [ 0 ] = 600 ;
mvjointsadcost [ 1 ] = 300 ;
mvjointsadcost [ 2 ] = 300 ;
mvjointsadcost [ 3 ] = 300 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static PyObject * string_split ( PyStringObject * self , PyObject * args ) {
Py_ssize_t len = PyString_GET_SIZE ( self ) , n ;
Py_ssize_t maxsplit = - 1 ;
const char * s = PyString_AS_STRING ( self ) , * sub ;
PyObject * subobj = Py_None ;
if ( ! PyArg_ParseTuple ( args , "|On:split" , & subobj , & maxsplit ) ) return NULL ;
if ( maxsplit < 0 ) maxsplit = PY_SSIZE_T_MAX ;
if ( subobj == Py_None ) return stringlib_split_whitespace ( ( PyObject * ) self , s , len , maxsplit ) ;
if ( PyString_Check ( subobj ) ) {
sub = PyString_AS_STRING ( subobj ) ;
n = PyString_GET_SIZE ( subobj ) ;
}
# ifdef Py_USING_UNICODE else if ( PyUnicode_Check ( subobj ) ) return PyUnicode_Split ( ( PyObject * ) self , subobj , maxsplit ) ;
# endif else if ( PyObject_AsCharBuffer ( subobj , & sub , & n ) ) return NULL ;
return stringlib_split ( ( PyObject * ) self , s , len , sub , n , maxsplit ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_wave_header ( AVCodecContext * avctx , const uint8_t * header , int header_size ) {
int len ;
short wave_format ;
if ( bytestream_get_le32 ( & header ) != MKTAG ( 'R' , 'I' , 'F' , 'F' ) ) {
av_log ( avctx , AV_LOG_ERROR , "missing RIFF tag\n" ) ;
return AVERROR_INVALIDDATA ;
}
header += 4 ;
if ( bytestream_get_le32 ( & header ) != MKTAG ( 'W' , 'A' , 'V' , 'E' ) ) {
av_log ( avctx , AV_LOG_ERROR , "missing WAVE tag\n" ) ;
return AVERROR_INVALIDDATA ;
}
while ( bytestream_get_le32 ( & header ) != MKTAG ( 'f' , 'm' , 't' , ' ' ) ) {
len = bytestream_get_le32 ( & header ) ;
header += len ;
}
len = bytestream_get_le32 ( & header ) ;
if ( len < 16 ) {
av_log ( avctx , AV_LOG_ERROR , "fmt chunk was too short\n" ) ;
return AVERROR_INVALIDDATA ;
}
wave_format = bytestream_get_le16 ( & header ) ;
switch ( wave_format ) {
case WAVE_FORMAT_PCM : break ;
default : av_log ( avctx , AV_LOG_ERROR , "unsupported wave format\n" ) ;
return AVERROR ( ENOSYS ) ;
}
header += 2 ;
avctx -> sample_rate = bytestream_get_le32 ( & header ) ;
header += 4 ;
header += 2 ;
avctx -> bits_per_coded_sample = bytestream_get_le16 ( & header ) ;
if ( avctx -> bits_per_coded_sample != 16 ) {
av_log ( avctx , AV_LOG_ERROR , "unsupported number of bits per sample\n" ) ;
return AVERROR ( ENOSYS ) ;
}
len -= 16 ;
if ( len > 0 ) av_log ( avctx , AV_LOG_INFO , "%d header bytes unparsed\n" , len ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
CharDriverState * qdev_init_chardev ( DeviceState * dev ) {
static int next_serial ;
static int next_virtconsole ;
if ( strncmp ( dev -> info -> name , "virtio" , 6 ) == 0 ) {
return virtcon_hds [ next_virtconsole ++ ] ;
}
else {
return serial_hds [ next_serial ++ ] ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void libopus_flush ( AVCodecContext * avc ) {
struct libopus_context * opus = avc -> priv_data ;
opus_multistream_decoder_ctl ( opus -> dec , OPUS_RESET_STATE ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void draw_n_color ( uint8_t * out , int stride , int width , int height , int bpp , uint8_t cols [ 4 ] , uint8_t grps [ 4 ] , uint32_t col ) {
int x , y ;
for ( y = 0 ;
y < height ;
y ++ ) {
if ( grps ) cols [ 0 ] = grps [ 3 * ( y >> 1 ) ] ;
for ( x = 0 ;
x < width ;
x ++ ) {
if ( grps ) cols [ 1 ] = grps [ ( x >> 1 ) + 1 ] ;
out [ x + y * stride ] = cols [ col & ( ( 1 << bpp ) - 1 ) ] ;
col >>= bpp ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline size_t SALEN ( struct sockaddr * sa ) {
switch ( sa -> sa_family ) {
case AF_INET : return ( sizeof ( struct sockaddr_in ) ) ;
case AF_INET6 : return ( sizeof ( struct sockaddr_in6 ) ) ;
default : return 0 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int file_read ( void * buf , size_t size , FILE * file ) {
const int kMaxRetries = 5 ;
int retry_count = 0 ;
int file_error ;
size_t len = 0 ;
do {
const size_t n = fread ( ( uint8_t * ) buf + len , 1 , size - len , file ) ;
len += n ;
file_error = ferror ( file ) ;
if ( file_error ) {
if ( errno == EINTR || errno == EAGAIN ) {
clearerr ( file ) ;
continue ;
}
else {
fprintf ( stderr , "Error reading file: %u of %u bytes read, %d: %s\n" , ( uint32_t ) len , ( uint32_t ) size , errno , strerror ( errno ) ) ;
return 0 ;
}
}
}
while ( ! feof ( file ) && len < size && ++ retry_count < kMaxRetries ) ;
if ( ! feof ( file ) && len != size ) {
fprintf ( stderr , "Error reading file: %u of %u bytes read," " error: %d, retries: %d, %d: %s\n" , ( uint32_t ) len , ( uint32_t ) size , file_error , retry_count , errno , strerror ( errno ) ) ;
}
return len == size ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * main_malloc ( size_t size ) {
void * r = main_malloc1 ( size ) ;
if ( r ) {
IF_DEBUG ( main_mallocs += 1 ) ;
}
return r ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void spl_dllist_it_get_current_key ( zend_object_iterator * iter , zval * key TSRMLS_DC ) {
spl_dllist_it * iterator = ( spl_dllist_it * ) iter ;
ZVAL_LONG ( key , iterator -> traverse_position ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int main ( int argc ATTRIBUTE_UNUSED , char * * argv ATTRIBUTE_UNUSED ) {
printf ( "%s : XPath/Canonicalization and output support not compiled in\n" , argv [ 0 ] ) ;
return ( 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int read_uncompressed_sgi ( unsigned char * out_buf , uint8_t * out_end , SgiState * s ) {
int x , y , z ;
unsigned int offset = s -> height * s -> width * s -> bytes_per_channel ;
GetByteContext gp [ 4 ] ;
if ( offset * s -> depth > bytestream2_get_bytes_left ( & s -> g ) ) return AVERROR_INVALIDDATA ;
for ( z = 0 ;
z < s -> depth ;
z ++ ) {
gp [ z ] = s -> g ;
bytestream2_skip ( & gp [ z ] , z * offset ) ;
}
for ( y = s -> height - 1 ;
y >= 0 ;
y -- ) {
out_end = out_buf + ( y * s -> linesize ) ;
if ( s -> bytes_per_channel == 1 ) {
for ( x = s -> width ;
x > 0 ;
x -- ) for ( z = 0 ;
z < s -> depth ;
z ++ ) * out_end ++ = bytestream2_get_byteu ( & gp [ z ] ) ;
}
else {
uint16_t * out16 = ( uint16_t * ) out_end ;
for ( x = s -> width ;
x > 0 ;
x -- ) for ( z = 0 ;
z < s -> depth ;
z ++ ) * out16 ++ = bytestream2_get_ne16u ( & gp [ z ] ) ;
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int evhttp_parse_request_line ( struct evhttp_request * req , char * line ) {
char * method ;
char * uri ;
char * version ;
method = strsep ( & line , " " ) ;
if ( line == NULL ) return ( - 1 ) ;
uri = strsep ( & line , " " ) ;
if ( line == NULL ) return ( - 1 ) ;
version = strsep ( & line , " " ) ;
if ( line != NULL ) return ( - 1 ) ;
if ( strcmp ( method , "GET" ) == 0 ) {
req -> type = EVHTTP_REQ_GET ;
}
else if ( strcmp ( method , "POST" ) == 0 ) {
req -> type = EVHTTP_REQ_POST ;
}
else if ( strcmp ( method , "HEAD" ) == 0 ) {
req -> type = EVHTTP_REQ_HEAD ;
}
else {
event_debug ( ( "%s: bad method %s on request %p from %s" , __func__ , method , req , req -> remote_host ) ) ;
return ( - 1 ) ;
}
if ( strcmp ( version , "HTTP/1.0" ) == 0 ) {
req -> major = 1 ;
req -> minor = 0 ;
}
else if ( strcmp ( version , "HTTP/1.1" ) == 0 ) {
req -> major = 1 ;
req -> minor = 1 ;
}
else {
event_debug ( ( "%s: bad version %s on request %p from %s" , __func__ , version , req , req -> remote_host ) ) ;
return ( - 1 ) ;
}
if ( ( req -> uri = strdup ( uri ) ) == NULL ) {
event_debug ( ( "%s: evhttp_decode_uri" , __func__ ) ) ;
return ( - 1 ) ;
}
if ( strlen ( req -> uri ) > 0 && req -> uri [ 0 ] != '/' ) req -> flags |= EVHTTP_PROXY_REQUEST ;
return ( 0 ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void parseVariant ( proto_tree * tree , tvbuff_t * tvb , packet_info * pinfo , gint * pOffset , const char * szFieldName ) {
proto_item * ti ;
proto_tree * subtree = proto_tree_add_subtree_format ( tree , tvb , * pOffset , - 1 , ett_opcua_variant , & ti , "%s: Variant" , szFieldName ) ;
gint iOffset = * pOffset ;
guint8 EncodingMask ;
gint32 ArrayDimensions = 0 ;
guint opcua_nested_count ;
opcua_nested_count = GPOINTER_TO_UINT ( p_get_proto_data ( pinfo -> pool , pinfo , proto_opcua , 0 ) ) ;
if ( ++ opcua_nested_count > MAX_NESTING_DEPTH ) {
expert_add_info ( pinfo , ti , & ei_nesting_depth ) ;
return ;
}
p_add_proto_data ( pinfo -> pool , pinfo , proto_opcua , 0 , GUINT_TO_POINTER ( opcua_nested_count ) ) ;
EncodingMask = tvb_get_guint8 ( tvb , iOffset ) ;
proto_tree_add_item ( subtree , hf_opcua_variant_encodingmask , tvb , iOffset , 1 , ENC_LITTLE_ENDIAN ) ;
iOffset ++ ;
if ( EncodingMask & VARIANT_ARRAYMASK ) {
switch ( EncodingMask & 0x3f ) {
case OpcUaType_Null : break ;
case OpcUaType_Boolean : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Boolean" , "Boolean" , hf_opcua_Boolean , parseBoolean , ett_opcua_array_Boolean ) ;
break ;
case OpcUaType_SByte : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "SByte" , "SByte" , hf_opcua_SByte , parseSByte , ett_opcua_array_SByte ) ;
break ;
case OpcUaType_Byte : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Byte" , "Byte" , hf_opcua_Byte , parseByte , ett_opcua_array_Byte ) ;
break ;
case OpcUaType_Int16 : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Int16" , "Int16" , hf_opcua_Int16 , parseInt16 , ett_opcua_array_Int16 ) ;
break ;
case OpcUaType_UInt16 : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "UInt16" , "UInt16" , hf_opcua_UInt16 , parseUInt16 , ett_opcua_array_UInt16 ) ;
break ;
case OpcUaType_Int32 : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Int32" , "Int32" , hf_opcua_Int32 , parseInt32 , ett_opcua_array_Int32 ) ;
break ;
case OpcUaType_UInt32 : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "UInt32" , "UInt32" , hf_opcua_UInt32 , parseUInt32 , ett_opcua_array_UInt32 ) ;
break ;
case OpcUaType_Int64 : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Int64" , "Int64" , hf_opcua_Int64 , parseInt64 , ett_opcua_array_Int64 ) ;
break ;
case OpcUaType_UInt64 : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "UInt64" , "UInt64" , hf_opcua_UInt64 , parseUInt64 , ett_opcua_array_UInt64 ) ;
break ;
case OpcUaType_Float : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Float" , "Float" , hf_opcua_Float , parseFloat , ett_opcua_array_Float ) ;
break ;
case OpcUaType_Double : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Double" , "Double" , hf_opcua_Double , parseDouble , ett_opcua_array_Double ) ;
break ;
case OpcUaType_String : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "String" , "String" , hf_opcua_String , parseString , ett_opcua_array_String ) ;
break ;
case OpcUaType_DateTime : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "DateTime" , "DateTime" , hf_opcua_DateTime , parseDateTime , ett_opcua_array_DateTime ) ;
break ;
case OpcUaType_Guid : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Guid" , "Guid" , hf_opcua_Guid , parseGuid , ett_opcua_array_Guid ) ;
break ;
case OpcUaType_ByteString : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "ByteString" , "ByteString" , hf_opcua_ByteString , parseByteString , ett_opcua_array_ByteString ) ;
break ;
case OpcUaType_XmlElement : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "XmlElement" , "XmlElement" , hf_opcua_XmlElement , parseXmlElement , ett_opcua_array_XmlElement ) ;
break ;
case OpcUaType_NodeId : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "NodeId" , "NodeId" , parseNodeId , ett_opcua_array_NodeId ) ;
break ;
case OpcUaType_ExpandedNodeId : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "ExpandedNodeId" , "ExpandedNodeId" , parseExpandedNodeId , ett_opcua_array_ExpandedNodeId ) ;
break ;
case OpcUaType_StatusCode : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "StatusCode" , "StatusCode" , hf_opcua_StatusCode , parseStatusCode , ett_opcua_array_StatusCode ) ;
break ;
case OpcUaType_DiagnosticInfo : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "DiagnosticInfo" , "DiagnosticInfo" , parseDiagnosticInfo , ett_opcua_array_DiagnosticInfo ) ;
break ;
case OpcUaType_QualifiedName : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "QualifiedName" , "QualifiedName" , parseQualifiedName , ett_opcua_array_QualifiedName ) ;
break ;
case OpcUaType_LocalizedText : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "LocalizedText" , "LocalizedText" , parseLocalizedText , ett_opcua_array_LocalizedText ) ;
break ;
case OpcUaType_ExtensionObject : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "ExtensionObject" , "ExtensionObject" , parseExtensionObject , ett_opcua_array_ExtensionObject ) ;
break ;
case OpcUaType_DataValue : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "DataValue" , "DataValue" , parseDataValue , ett_opcua_array_DataValue ) ;
break ;
case OpcUaType_Variant : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "Variant" , "Variant" , parseVariant , ett_opcua_array_Variant ) ;
break ;
}
if ( EncodingMask & VARIANT_ARRAYDIMENSIONS ) {
proto_item * ti_2 ;
proto_tree * subtree_2 = proto_tree_add_subtree ( subtree , tvb , iOffset , - 1 , ett_opcua_variant_arraydims , & ti_2 , "ArrayDimensions" ) ;
int i ;
ArrayDimensions = tvb_get_letohl ( tvb , iOffset ) ;
proto_tree_add_item ( subtree_2 , hf_opcua_ArraySize , tvb , iOffset , 4 , ENC_LITTLE_ENDIAN ) ;
if ( ArrayDimensions > MAX_ARRAY_LEN ) {
proto_tree_add_expert_format ( subtree_2 , pinfo , & ei_array_length , tvb , iOffset , 4 , "ArrayDimensions length %d too large to process" , ArrayDimensions ) ;
return ;
}
iOffset += 4 ;
for ( i = 0 ;
i < ArrayDimensions ;
i ++ ) {
parseInt32 ( subtree_2 , tvb , pinfo , & iOffset , hf_opcua_Int32 ) ;
}
proto_item_set_end ( ti_2 , tvb , iOffset ) ;
}
}
else {
switch ( EncodingMask & 0x3f ) {
case OpcUaType_Null : break ;
case OpcUaType_Boolean : parseBoolean ( subtree , tvb , pinfo , & iOffset , hf_opcua_Boolean ) ;
break ;
case OpcUaType_SByte : parseSByte ( subtree , tvb , pinfo , & iOffset , hf_opcua_SByte ) ;
break ;
case OpcUaType_Byte : parseByte ( subtree , tvb , pinfo , & iOffset , hf_opcua_Byte ) ;
break ;
case OpcUaType_Int16 : parseInt16 ( subtree , tvb , pinfo , & iOffset , hf_opcua_Int16 ) ;
break ;
case OpcUaType_UInt16 : parseUInt16 ( subtree , tvb , pinfo , & iOffset , hf_opcua_UInt16 ) ;
break ;
case OpcUaType_Int32 : parseInt32 ( subtree , tvb , pinfo , & iOffset , hf_opcua_Int32 ) ;
break ;
case OpcUaType_UInt32 : parseUInt32 ( subtree , tvb , pinfo , & iOffset , hf_opcua_UInt32 ) ;
break ;
case OpcUaType_Int64 : parseInt64 ( subtree , tvb , pinfo , & iOffset , hf_opcua_Int64 ) ;
break ;
case OpcUaType_UInt64 : parseUInt64 ( subtree , tvb , pinfo , & iOffset , hf_opcua_UInt64 ) ;
break ;
case OpcUaType_Float : parseFloat ( subtree , tvb , pinfo , & iOffset , hf_opcua_Float ) ;
break ;
case OpcUaType_Double : parseDouble ( subtree , tvb , pinfo , & iOffset , hf_opcua_Double ) ;
break ;
case OpcUaType_String : parseString ( subtree , tvb , pinfo , & iOffset , hf_opcua_String ) ;
break ;
case OpcUaType_DateTime : parseDateTime ( subtree , tvb , pinfo , & iOffset , hf_opcua_DateTime ) ;
break ;
case OpcUaType_Guid : parseGuid ( subtree , tvb , pinfo , & iOffset , hf_opcua_Guid ) ;
break ;
case OpcUaType_ByteString : parseByteString ( subtree , tvb , pinfo , & iOffset , hf_opcua_ByteString ) ;
break ;
case OpcUaType_XmlElement : parseXmlElement ( subtree , tvb , pinfo , & iOffset , hf_opcua_XmlElement ) ;
break ;
case OpcUaType_NodeId : parseNodeId ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_ExpandedNodeId : parseExpandedNodeId ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_StatusCode : parseStatusCode ( subtree , tvb , pinfo , & iOffset , hf_opcua_StatusCode ) ;
break ;
case OpcUaType_DiagnosticInfo : parseDiagnosticInfo ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_QualifiedName : parseQualifiedName ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_LocalizedText : parseLocalizedText ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_ExtensionObject : parseExtensionObject ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_DataValue : parseDataValue ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_Variant : parseVariant ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
}
}
proto_item_set_end ( ti , tvb , iOffset ) ;
* pOffset = iOffset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_T_decision ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_T_decision , T_decision_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * gx_ttfMemory__alloc_bytes ( ttfMemory * self , int size , const char * cname ) {
gs_memory_t * mem = ( ( gx_ttfMemory * ) self ) -> memory ;
return gs_alloc_bytes ( mem , size , cname ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int jbig2_find_changing_element ( const byte * line , uint32_t x , uint32_t w ) {
int a , b ;
if ( line == 0 ) return ( int ) w ;
if ( x == MINUS1 ) {
a = 0 ;
x = 0 ;
}
else {
a = getbit ( line , x ) ;
x ++ ;
}
while ( x < w ) {
b = getbit ( line , x ) ;
if ( a != b ) break ;
x ++ ;
}
return x ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void selinux_d_instantiate ( struct dentry * dentry , struct inode * inode ) {
if ( inode ) inode_doinit_with_dentry ( inode , dentry ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int truespeech_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) {
AVFrame * frame = data ;
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
TSContext * c = avctx -> priv_data ;
int i , j ;
int16_t * samples ;
int iterations , ret ;
iterations = buf_size / 32 ;
if ( ! iterations ) {
av_log ( avctx , AV_LOG_ERROR , "Too small input buffer (%d bytes), need at least 32 bytes\n" , buf_size ) ;
return - 1 ;
}
frame -> nb_samples = iterations * 240 ;
if ( ( ret = ff_get_buffer ( avctx , frame , 0 ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
samples = ( int16_t * ) frame -> data [ 0 ] ;
memset ( samples , 0 , iterations * 240 * sizeof ( * samples ) ) ;
for ( j = 0 ;
j < iterations ;
j ++ ) {
truespeech_read_frame ( c , buf ) ;
buf += 32 ;
truespeech_correlate_filter ( c ) ;
truespeech_filters_merge ( c ) ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
truespeech_apply_twopoint_filter ( c , i ) ;
truespeech_place_pulses ( c , samples , i ) ;
truespeech_update_filters ( c , samples , i ) ;
truespeech_synth ( c , samples , i ) ;
samples += 60 ;
}
truespeech_save_prevvec ( c ) ;
}
* got_frame_ptr = 1 ;
return buf_size ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void do_get_replace ( struct st_command * command ) {
uint i ;
char * from = command -> first_argument ;
char * buff , * start ;
char word_end_chars [ 256 ] , * pos ;
POINTER_ARRAY to_array , from_array ;
DBUG_ENTER ( "get_replace" ) ;
free_replace ( ) ;
bzero ( ( char * ) & to_array , sizeof ( to_array ) ) ;
bzero ( ( char * ) & from_array , sizeof ( from_array ) ) ;
if ( ! * from ) die ( "Missing argument in %s" , command -> query ) ;
start = buff = ( char * ) my_malloc ( strlen ( from ) + 1 , MYF ( MY_WME | MY_FAE ) ) ;
while ( * from ) {
char * to = buff ;
to = get_string ( & buff , & from , command ) ;
if ( ! * from ) die ( "Wrong number of arguments to replace_result in '%s'" , command -> query ) ;
# ifdef __WIN__ fix_win_paths ( to , from - to ) ;
# endif insert_pointer_name ( & from_array , to ) ;
to = get_string ( & buff , & from , command ) ;
insert_pointer_name ( & to_array , to ) ;
}
for ( i = 1 , pos = word_end_chars ;
i < 256 ;
i ++ ) if ( my_isspace ( charset_info , i ) ) * pos ++ = i ;
* pos = 0 ;
if ( ! ( glob_replace = init_replace ( ( char * * ) from_array . typelib . type_names , ( char * * ) to_array . typelib . type_names , ( uint ) from_array . typelib . count , word_end_chars ) ) ) die ( "Can't initialize replace from '%s'" , command -> query ) ;
free_pointer_array ( & from_array ) ;
free_pointer_array ( & to_array ) ;
my_free ( start ) ;
command -> last_argument = command -> end ;
DBUG_VOID_RETURN ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pdf_run_G ( fz_context * ctx , pdf_processor * proc , float g ) {
pdf_run_processor * pr = ( pdf_run_processor * ) proc ;
pr -> dev -> flags &= ~ FZ_DEVFLAG_STROKECOLOR_UNDEFINED ;
pdf_set_colorspace ( ctx , pr , PDF_STROKE , fz_device_gray ( ctx ) ) ;
pdf_set_color ( ctx , pr , PDF_STROKE , & g ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int pfkey_sec_ctx_len ( const struct sadb_x_sec_ctx * sec_ctx ) {
return DIV_ROUND_UP ( sizeof ( struct sadb_x_sec_ctx ) + sec_ctx -> sadb_x_ctx_len , sizeof ( uint64_t ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void gx_device_set_width_height ( gx_device * dev , int width , int height ) {
dev -> width = width ;
dev -> height = height ;
gx_device_set_media_from_hwsize ( dev ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_iht8x8_64_add_c ( const int16_t * input , uint8_t * dest , int stride , int tx_type ) {
int i , j ;
int16_t out [ 8 * 8 ] ;
int16_t * outptr = out ;
int16_t temp_in [ 8 ] , temp_out [ 8 ] ;
const transform_2d ht = IHT_8 [ tx_type ] ;
for ( i = 0 ;
i < 8 ;
++ i ) {
ht . rows ( input , outptr ) ;
input += 8 ;
outptr += 8 ;
}
for ( i = 0 ;
i < 8 ;
++ i ) {
for ( j = 0 ;
j < 8 ;
++ j ) temp_in [ j ] = out [ j * 8 + i ] ;
ht . cols ( temp_in , temp_out ) ;
for ( j = 0 ;
j < 8 ;
++ j ) dest [ j * stride + i ] = clip_pixel ( ROUND_POWER_OF_TWO ( temp_out [ j ] , 5 ) + dest [ j * stride + i ] ) ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_T_routing ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_T_routing , T_routing_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean k12_dump_record ( wtap_dumper * wdh , guint32 len , guint8 * buffer , int * err_p ) {
k12_dump_t * k12 = ( k12_dump_t * ) wdh -> priv ;
guint32 junky_offset = ( 8192 - ( ( k12 -> file_offset - K12_FILE_HDR_LEN ) % 8192 ) ) % 8192 ;
if ( len > junky_offset ) {
if ( junky_offset ) {
if ( ! wtap_dump_file_write ( wdh , buffer , junky_offset , err_p ) ) return FALSE ;
}
if ( ! wtap_dump_file_write ( wdh , dumpy_junk , K12_FILE_BLOB_LEN , err_p ) ) return FALSE ;
if ( ! wtap_dump_file_write ( wdh , buffer + junky_offset , len - junky_offset , err_p ) ) return FALSE ;
k12 -> file_offset += len + K12_FILE_BLOB_LEN ;
k12 -> file_len += len + K12_FILE_BLOB_LEN ;
}
else {
if ( ! wtap_dump_file_write ( wdh , buffer , len , err_p ) ) return FALSE ;
k12 -> file_offset += len ;
k12 -> file_len += len ;
}
k12 -> num_of_records ++ ;
return TRUE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void FigureFullMetricsEnd ( SplineFont * sf , struct glyphinfo * gi , int istt ) {
int i , lasti , lastv , lastdefault = istt ? 3 : 1 ;
int width , vwidth ;
lasti = lastv = gi -> gcnt - 1 ;
for ( i = gi -> gcnt - 1 ;
i > lastdefault && gi -> bygid [ i ] == - 1 ;
-- i ) ;
if ( i >= lastdefault ) {
width = sf -> glyphs [ gi -> bygid [ i ] ] -> width ;
vwidth = sf -> glyphs [ gi -> bygid [ i ] ] -> vwidth ;
lasti = lastv = i ;
for ( i = lasti - 1 ;
i >= lastdefault ;
-- i ) {
if ( SCWorthOutputting ( sf -> glyphs [ gi -> bygid [ i ] ] ) ) {
if ( sf -> glyphs [ gi -> bygid [ i ] ] -> width != width ) break ;
else lasti = i ;
}
}
gi -> lasthwidth = lasti ;
if ( sf -> hasvmetrics ) {
for ( i = lastv - 1 ;
i >= lastdefault ;
-- i ) {
if ( SCWorthOutputting ( sf -> glyphs [ gi -> bygid [ i ] ] ) ) {
if ( sf -> glyphs [ gi -> bygid [ i ] ] -> vwidth != vwidth ) break ;
else lastv = i ;
}
}
gi -> lastvwidth = lastv ;
}
}
else {
gi -> lasthwidth = 0 ;
gi -> lastvwidth = 0 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int tm_register ( tm_whattodo_t * what , tm_event_t * event ) {
if ( ! init_done ) return TM_BADINIT ;
return TM_ENOTIMPLEMENTED ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_T_passwordResponse ( 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_T_passwordResponse , T_passwordResponse_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dtap_mm_cm_reestab_req ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) {
guint32 curr_offset ;
guint32 consumed ;
guint curr_len ;
guint8 oct ;
proto_tree * subtree ;
curr_offset = offset ;
curr_len = len ;
is_uplink = IS_UPLINK_TRUE ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
proto_tree_add_bits_item ( tree , hf_gsm_a_spare_bits , tvb , curr_offset << 3 , 4 , ENC_BIG_ENDIAN ) ;
subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_gsm_common_elem [ DE_CIPH_KEY_SEQ_NUM ] , NULL , val_to_str_ext_const ( DE_CIPH_KEY_SEQ_NUM , & gsm_common_elem_strings_ext , "" ) ) ;
proto_tree_add_bits_item ( subtree , hf_gsm_a_spare_bits , tvb , ( curr_offset << 3 ) + 4 , 1 , ENC_BIG_ENDIAN ) ;
switch ( oct & 0x07 ) {
case 0x07 : proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_ciphering_key_sequence_number , tvb , curr_offset , 1 , oct , "No key is available" ) ;
break ;
default : proto_tree_add_item ( subtree , hf_gsm_a_dtap_ciphering_key_sequence_number , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
break ;
}
curr_offset ++ ;
curr_len -- ;
if ( ( signed ) curr_len <= 0 ) return ;
ELEM_MAND_LV ( GSM_A_PDU_TYPE_COMMON , DE_MS_CM_2 , NULL ) ;
ELEM_MAND_LV ( GSM_A_PDU_TYPE_COMMON , DE_MID , NULL ) ;
ELEM_OPT_TV ( 0x13 , GSM_A_PDU_TYPE_COMMON , DE_LAI , NULL ) ;
ELEM_OPT_TV_SHORT ( 0xD0 , GSM_A_PDU_TYPE_GM , DE_DEVICE_PROPERTIES , NULL ) ;
EXTRANEOUS_DATA_CHECK ( curr_len , 0 , pinfo , & ei_gsm_a_dtap_extraneous_data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
bool kvm_has_smm ( void ) {
return kvm_check_extension ( kvm_state , KVM_CAP_X86_SMM ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ssize_t write_iso9660_data ( struct archive_write * a , const void * buff , size_t s ) {
struct iso9660 * iso9660 = a -> format_data ;
size_t ws ;
if ( iso9660 -> temp_fd < 0 ) {
archive_set_error ( & a -> archive , ARCHIVE_ERRNO_MISC , "Couldn't create temporary file" ) ;
return ( ARCHIVE_FATAL ) ;
}
ws = s ;
if ( iso9660 -> need_multi_extent && ( iso9660 -> cur_file -> cur_content -> size + ws ) >= ( MULTI_EXTENT_SIZE - LOGICAL_BLOCK_SIZE ) ) {
struct content * con ;
size_t ts ;
ts = ( size_t ) ( MULTI_EXTENT_SIZE - LOGICAL_BLOCK_SIZE - iso9660 -> cur_file -> cur_content -> size ) ;
if ( iso9660 -> zisofs . detect_magic ) zisofs_detect_magic ( a , buff , ts ) ;
if ( iso9660 -> zisofs . making ) {
if ( zisofs_write_to_temp ( a , buff , ts ) != ARCHIVE_OK ) return ( ARCHIVE_FATAL ) ;
}
else {
if ( wb_write_to_temp ( a , buff , ts ) != ARCHIVE_OK ) return ( ARCHIVE_FATAL ) ;
iso9660 -> cur_file -> cur_content -> size += ts ;
}
if ( wb_write_padding_to_temp ( a , iso9660 -> cur_file -> cur_content -> size ) != ARCHIVE_OK ) return ( ARCHIVE_FATAL ) ;
iso9660 -> cur_file -> cur_content -> blocks = ( int ) ( ( iso9660 -> cur_file -> cur_content -> size + LOGICAL_BLOCK_SIZE - 1 ) >> LOGICAL_BLOCK_BITS ) ;
ws -= ts ;
buff = ( const void * ) ( ( ( const unsigned char * ) buff ) + ts ) ;
con = calloc ( 1 , sizeof ( * con ) ) ;
if ( con == NULL ) {
archive_set_error ( & a -> archive , ENOMEM , "Can't allocate content data" ) ;
return ( ARCHIVE_FATAL ) ;
}
con -> offset_of_temp = wb_offset ( a ) ;
iso9660 -> cur_file -> cur_content -> next = con ;
iso9660 -> cur_file -> cur_content = con ;
# ifdef HAVE_ZLIB_H iso9660 -> zisofs . block_offset = 0 ;
# endif }
if ( iso9660 -> zisofs . detect_magic ) zisofs_detect_magic ( a , buff , ws ) ;
if ( iso9660 -> zisofs . making ) {
if ( zisofs_write_to_temp ( a , buff , ws ) != ARCHIVE_OK ) return ( ARCHIVE_FATAL ) ;
}
else {
if ( wb_write_to_temp ( a , buff , ws ) != ARCHIVE_OK ) return ( ARCHIVE_FATAL ) ;
iso9660 -> cur_file -> cur_content -> size += ws ;
}
return ( s ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
extern int main ( int argc , const char * argv [ ] ) {
UDataMemory * result = NULL ;
UErrorCode status = U_ZERO_ERROR ;
uint16_t intValue = 0 ;
char * string = NULL ;
uint16_t * intPointer = NULL ;
const void * dataMemory = NULL ;
char curPathBuffer [ 1024 ] ;
# ifdef WIN32 char * currdir = _getcwd ( NULL , 0 ) ;
# else char * currdir = getcwd ( NULL , 0 ) ;
# endif strcpy ( curPathBuffer , currdir ) ;
result = udata_openChoice ( curPathBuffer , DATA_TYPE , DATA_NAME , isAcceptable , NULL , & status ) ;
if ( currdir != NULL ) {
free ( currdir ) ;
}
if ( U_FAILURE ( status ) ) {
printf ( "Failed to open data file example.dat in %s with error number %d\n" , curPathBuffer , status ) ;
return - 1 ;
}
dataMemory = udata_getMemory ( result ) ;
intPointer = ( uint16_t * ) dataMemory ;
printf ( "Read value %d from data file\n" , * intPointer ) ;
string = ( char * ) ( intPointer + 1 ) ;
printf ( "Read string %s from data file\n" , string ) ;
if ( U_SUCCESS ( status ) ) {
udata_close ( result ) ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int EVP_CIPHER_CTX_copy ( EVP_CIPHER_CTX * out , const EVP_CIPHER_CTX * in ) {
if ( ( in == NULL ) || ( in -> cipher == NULL ) ) {
EVPerr ( EVP_F_EVP_CIPHER_CTX_COPY , EVP_R_INPUT_NOT_INITIALIZED ) ;
return 0 ;
}
# ifndef OPENSSL_NO_ENGINE if ( in -> engine && ! ENGINE_init ( in -> engine ) ) {
EVPerr ( EVP_F_EVP_CIPHER_CTX_COPY , ERR_R_ENGINE_LIB ) ;
return 0 ;
}
# endif EVP_CIPHER_CTX_reset ( out ) ;
memcpy ( out , in , sizeof ( * out ) ) ;
if ( in -> cipher_data && in -> cipher -> ctx_size ) {
out -> cipher_data = OPENSSL_malloc ( in -> cipher -> ctx_size ) ;
if ( out -> cipher_data == NULL ) {
EVPerr ( EVP_F_EVP_CIPHER_CTX_COPY , ERR_R_MALLOC_FAILURE ) ;
return 0 ;
}
memcpy ( out -> cipher_data , in -> cipher_data , in -> cipher -> ctx_size ) ;
}
if ( in -> cipher -> flags & EVP_CIPH_CUSTOM_COPY ) return in -> cipher -> ctrl ( ( EVP_CIPHER_CTX * ) in , EVP_CTRL_COPY , 0 , out ) ;
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ptvcursor_advance ( ptvcursor_t * ptvc , gint length ) {
ptvc -> offset += length ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static qcelp_packet_rate buf_size2bitrate ( const int buf_size ) {
switch ( buf_size ) {
case 35 : return RATE_FULL ;
case 17 : return RATE_HALF ;
case 8 : return RATE_QUARTER ;
case 4 : return RATE_OCTAVE ;
case 1 : return SILENCE ;
}
return I_F_Q ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void scope_chunk_ret ( Operation * op , ID2 * scopes ) {
struct mdb_info * mdb = ( struct mdb_info * ) op -> o_bd -> be_private ;
void * ret = NULL ;
ldap_pvt_thread_pool_getkey ( op -> o_threadctx , ( void * ) scope_chunk_get , & ret , NULL ) ;
scopes [ 0 ] . mval . mv_data = ret ;
ldap_pvt_thread_pool_setkey ( op -> o_threadctx , ( void * ) scope_chunk_get , ( void * ) scopes , scope_chunk_free , NULL , NULL ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void dissect_q931_cause_ie ( tvbuff_t * tvb , int offset , int len , proto_tree * tree , int hf_cause_value , guint8 * cause_value , const value_string * ie_vals ) {
gboolean have_valid_q931_pi_save = have_valid_q931_pi ;
have_valid_q931_pi = FALSE ;
dissect_q931_cause_ie_unsafe ( tvb , offset , len , tree , hf_cause_value , cause_value , ie_vals ) ;
have_valid_q931_pi = have_valid_q931_pi_save ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
struct archive_string_conv * archive_string_default_conversion_for_write ( struct archive * a ) {
( void ) a ;
return ( NULL ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
char * TSMatcherLineValue ( TSMatcherLine ml , int element ) {
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) ml ) == TS_SUCCESS ) ;
return ( ( ( matcher_line * ) ml ) -> line ) [ 1 ] [ element ] ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void sig_complete_alias ( GList * * list , WINDOW_REC * window , const char * word , const char * line , int * want_space ) {
const char * definition ;
g_return_if_fail ( list != NULL ) ;
g_return_if_fail ( word != NULL ) ;
g_return_if_fail ( line != NULL ) ;
if ( * line != '\0' ) {
if ( ( definition = alias_find ( line ) ) != NULL ) {
* list = g_list_append ( NULL , g_strdup ( definition ) ) ;
signal_stop ( ) ;
}
}
else {
* list = completion_get_aliases ( word ) ;
if ( * list != NULL ) signal_stop ( ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int udp6_csum_init ( struct sk_buff * skb , struct udphdr * uh , int proto ) {
int err ;
UDP_SKB_CB ( skb ) -> partial_cov = 0 ;
UDP_SKB_CB ( skb ) -> cscov = skb -> len ;
if ( proto == IPPROTO_UDPLITE ) {
err = udplite_checksum_init ( skb , uh ) ;
if ( err ) return err ;
}
if ( uh -> check == 0 ) {
LIMIT_NETDEBUG ( KERN_INFO "IPv6: udp checksum is 0\n" ) ;
return 1 ;
}
if ( skb -> ip_summed == CHECKSUM_COMPLETE && ! csum_ipv6_magic ( & ipv6_hdr ( skb ) -> saddr , & ipv6_hdr ( skb ) -> daddr , skb -> len , proto , skb -> csum ) ) skb -> ip_summed = CHECKSUM_UNNECESSARY ;
if ( ! skb_csum_unnecessary ( skb ) ) skb -> csum = ~ csum_unfold ( csum_ipv6_magic ( & ipv6_hdr ( skb ) -> saddr , & ipv6_hdr ( skb ) -> daddr , skb -> len , proto , 0 ) ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void bn_sqr_comba4 ( BN_ULONG * r , const BN_ULONG * a ) {
BN_ULONG t1 , t2 ;
BN_ULONG c1 , c2 , c3 ;
c1 = 0 ;
c2 = 0 ;
c3 = 0 ;
sqr_add_c ( a , 0 , c1 , c2 , c3 ) ;
r [ 0 ] = c1 ;
c1 = 0 ;
sqr_add_c2 ( a , 1 , 0 , c2 , c3 , c1 ) ;
r [ 1 ] = c2 ;
c2 = 0 ;
sqr_add_c ( a , 1 , c3 , c1 , c2 ) ;
sqr_add_c2 ( a , 2 , 0 , c3 , c1 , c2 ) ;
r [ 2 ] = c3 ;
c3 = 0 ;
sqr_add_c2 ( a , 3 , 0 , c1 , c2 , c3 ) ;
sqr_add_c2 ( a , 2 , 1 , c1 , c2 , c3 ) ;
r [ 3 ] = c1 ;
c1 = 0 ;
sqr_add_c ( a , 2 , c2 , c3 , c1 ) ;
sqr_add_c2 ( a , 3 , 1 , c2 , c3 , c1 ) ;
r [ 4 ] = c2 ;
c2 = 0 ;
sqr_add_c2 ( a , 3 , 2 , c3 , c1 , c2 ) ;
r [ 5 ] = c3 ;
c3 = 0 ;
sqr_add_c ( a , 3 , c1 , c2 , c3 ) ;
r [ 6 ] = c1 ;
r [ 7 ] = c2 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void PNGAPI png_set_cHRM ( png_structp png_ptr , png_infop info_ptr , double white_x , double white_y , double red_x , double red_y , double green_x , double green_y , double blue_x , double blue_y ) {
png_debug1 ( 1 , "in %s storage function" , "cHRM" ) ;
if ( png_ptr == NULL || info_ptr == NULL ) return ;
info_ptr -> x_white = ( float ) white_x ;
info_ptr -> y_white = ( float ) white_y ;
info_ptr -> x_red = ( float ) red_x ;
info_ptr -> y_red = ( float ) red_y ;
info_ptr -> x_green = ( float ) green_x ;
info_ptr -> y_green = ( float ) green_y ;
info_ptr -> x_blue = ( float ) blue_x ;
info_ptr -> y_blue = ( float ) blue_y ;
# ifdef PNG_FIXED_POINT_SUPPORTED info_ptr -> int_x_white = ( png_fixed_point ) ( white_x * 100000. + 0.5 ) ;
info_ptr -> int_y_white = ( png_fixed_point ) ( white_y * 100000. + 0.5 ) ;
info_ptr -> int_x_red = ( png_fixed_point ) ( red_x * 100000. + 0.5 ) ;
info_ptr -> int_y_red = ( png_fixed_point ) ( red_y * 100000. + 0.5 ) ;
info_ptr -> int_x_green = ( png_fixed_point ) ( green_x * 100000. + 0.5 ) ;
info_ptr -> int_y_green = ( png_fixed_point ) ( green_y * 100000. + 0.5 ) ;
info_ptr -> int_x_blue = ( png_fixed_point ) ( blue_x * 100000. + 0.5 ) ;
info_ptr -> int_y_blue = ( png_fixed_point ) ( blue_y * 100000. + 0.5 ) ;
# endif info_ptr -> valid |= PNG_INFO_cHRM ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_long_data ( ) {
MYSQL_STMT * stmt ;
int rc , int_data ;
char * data = NullS ;
MYSQL_RES * result ;
MYSQL_BIND my_bind [ 3 ] ;
char query [ MAX_TEST_QUERY_LENGTH ] ;
myheader ( "test_long_data" ) ;
rc = mysql_autocommit ( mysql , TRUE ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS test_long_data" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE test_long_data(col1 int, " " col2 long varchar, col3 long varbinary)" ) ;
myquery ( rc ) ;
strmov ( query , "INSERT INTO test_long_data(col1, col2) VALUES(?)" ) ;
stmt = mysql_simple_prepare ( mysql , query ) ;
check_stmt_r ( stmt ) ;
strmov ( query , "INSERT INTO test_long_data(col1, col2, col3) VALUES(?, ?, ?)" ) ;
stmt = mysql_simple_prepare ( mysql , query ) ;
check_stmt ( stmt ) ;
verify_param_count ( stmt , 3 ) ;
memset ( my_bind , 0 , sizeof ( my_bind ) ) ;
my_bind [ 0 ] . buffer = ( void * ) & int_data ;
my_bind [ 0 ] . buffer_type = MYSQL_TYPE_LONG ;
my_bind [ 1 ] . buffer_type = MYSQL_TYPE_STRING ;
my_bind [ 2 ] = my_bind [ 1 ] ;
rc = mysql_stmt_bind_param ( stmt , my_bind ) ;
check_execute ( stmt , rc ) ;
int_data = 999 ;
data = ( char * ) "Michael" ;
rc = mysql_stmt_send_long_data ( stmt , 1 , data , strlen ( data ) ) ;
data = ( char * ) " 'Monty' Widenius" ;
rc = mysql_stmt_send_long_data ( stmt , 1 , data , strlen ( data ) ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_send_long_data ( stmt , 2 , "Venu ([email protected])" , 4 ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_execute ( stmt ) ;
if ( ! opt_silent ) fprintf ( stdout , " mysql_stmt_execute() returned %d\n" , rc ) ;
check_execute ( stmt , rc ) ;
rc = mysql_commit ( mysql ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "SELECT * FROM test_long_data" ) ;
myquery ( rc ) ;
result = mysql_store_result ( mysql ) ;
mytest ( result ) ;
rc = my_process_result_set ( result ) ;
DIE_UNLESS ( rc == 1 ) ;
mysql_free_result ( result ) ;
verify_col_data ( "test_long_data" , "col1" , "999" ) ;
verify_col_data ( "test_long_data" , "col2" , "Michael 'Monty' Widenius" ) ;
verify_col_data ( "test_long_data" , "col3" , "Venu" ) ;
mysql_stmt_close ( stmt ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int cache_hook_handler ( TSCont contp , TSEvent event , void * edata ) {
TSHttpTxn txnp = nullptr ;
CacheTestData * data = nullptr ;
CHECK_SPURIOUS_EVENT ( contp , event , edata ) ;
data = ( CacheTestData * ) TSContDataGet ( contp ) ;
switch ( event ) {
case TS_EVENT_HTTP_READ_REQUEST_HDR : txnp = ( TSHttpTxn ) edata ;
TSSkipRemappingSet ( txnp , 1 ) ;
TSHttpTxnReenable ( txnp , TS_EVENT_HTTP_CONTINUE ) ;
break ;
case TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE : {
int lookup_status ;
if ( data -> first_time == true ) {
txnp = ( TSHttpTxn ) edata ;
if ( TSHttpTxnCacheLookupStatusGet ( txnp , & lookup_status ) != TS_SUCCESS ) {
SDK_RPRINT ( data -> test , "TSHttpTxnCacheLookupStatusGet" , "TestCase1" , TC_FAIL , "TSHttpTxnCacheLookupStatus doesn't return TS_SUCCESS" ) ;
}
else {
if ( lookup_status == TS_CACHE_LOOKUP_MISS ) {
SDK_RPRINT ( data -> test , "TSHttpTxnCacheLookupStatusGet" , "TestCase1" , TC_PASS , "ok" ) ;
data -> test_passed_txn_cache_lookup_status = true ;
}
else {
SDK_RPRINT ( data -> test , "TSHttpTxnCacheLookupStatusGet" , "TestCase1" , TC_FAIL , "Incorrect Value returned by TSHttpTxnCacheLookupStatusGet" ) ;
}
}
}
else {
txnp = ( TSHttpTxn ) edata ;
if ( TSHttpTxnCacheLookupStatusGet ( txnp , & lookup_status ) != TS_SUCCESS ) {
SDK_RPRINT ( data -> test , "TSHttpTxnCacheLookupStatusGet" , "TestCase2" , TC_FAIL , "TSHttpTxnCacheLookupStatus doesn't return TS_SUCCESS" ) ;
data -> test_passed_txn_cache_lookup_status = false ;
}
else {
if ( lookup_status == TS_CACHE_LOOKUP_HIT_FRESH ) {
SDK_RPRINT ( data -> test , "TSHttpTxnCacheLookupStatusGet" , "TestCase2" , TC_PASS , "ok" ) ;
}
else {
SDK_RPRINT ( data -> test , "TSHttpTxnCacheLookupStatusGet" , "TestCase2" , TC_FAIL , "Incorrect Value returned by TSHttpTxnCacheLookupStatusGet" ) ;
data -> test_passed_txn_cache_lookup_status = false ;
}
}
}
TSHttpTxnReenable ( txnp , TS_EVENT_HTTP_CONTINUE ) ;
}
break ;
case TS_EVENT_HTTP_READ_CACHE_HDR : {
TSMBuffer reqbuf ;
TSMBuffer respbuf ;
TSMLoc reqhdr ;
TSMLoc resphdr ;
txnp = ( TSHttpTxn ) edata ;
if ( TSHttpTxnCachedReqGet ( txnp , & reqbuf , & reqhdr ) != TS_SUCCESS ) {
SDK_RPRINT ( data -> test , "TSHttpTxnCachedReqGet" , "TestCase1" , TC_FAIL , "TSHttpTxnCachedReqGet returns 0" ) ;
}
else {
if ( ( reqbuf == reinterpret_cast < TSMBuffer > ( ( ( HttpSM * ) txnp ) -> t_state . cache_req_hdr_heap_handle ) ) && ( reqhdr == reinterpret_cast < TSMLoc > ( ( ( ( HttpSM * ) txnp ) -> t_state . cache_info . object_read -> request_get ( ) ) -> m_http ) ) ) {
SDK_RPRINT ( data -> test , "TSHttpTxnCachedReqGet" , "TestCase1" , TC_PASS , "ok" ) ;
data -> test_passed_txn_cached_req_get = true ;
}
else {
SDK_RPRINT ( data -> test , "TSHttpTxnCachedReqGet" , "TestCase1" , TC_FAIL , "Value's Mismatch" ) ;
}
}
if ( TSHttpTxnCachedRespGet ( txnp , & respbuf , & resphdr ) != TS_SUCCESS ) {
SDK_RPRINT ( data -> test , "TSHttpTxnCachedRespGet" , "TestCase1" , TC_FAIL , "TSHttpTxnCachedRespGet returns 0" ) ;
}
else {
if ( ( respbuf == reinterpret_cast < TSMBuffer > ( ( ( HttpSM * ) txnp ) -> t_state . cache_resp_hdr_heap_handle ) ) && ( resphdr == reinterpret_cast < TSMLoc > ( ( ( ( HttpSM * ) txnp ) -> t_state . cache_info . object_read -> response_get ( ) ) -> m_http ) ) ) {
SDK_RPRINT ( data -> test , "TSHttpTxnCachedRespGet" , "TestCase1" , TC_PASS , "ok" ) ;
data -> test_passed_txn_cached_resp_get = true ;
}
else {
SDK_RPRINT ( data -> test , "TSHttpTxnCachedRespGet" , "TestCase1" , TC_FAIL , "Value's Mismatch" ) ;
}
}
if ( ( TSHandleMLocRelease ( reqbuf , TS_NULL_MLOC , reqhdr ) != TS_SUCCESS ) || ( TSHandleMLocRelease ( respbuf , TS_NULL_MLOC , resphdr ) != TS_SUCCESS ) ) {
SDK_RPRINT ( data -> test , "TSHttpTxnCache" , "" , TC_FAIL , "Unable to release handle to headers." ) ;
}
TSHttpTxnReenable ( txnp , TS_EVENT_HTTP_CONTINUE ) ;
}
break ;
case TS_EVENT_IMMEDIATE : case TS_EVENT_TIMEOUT : if ( data -> first_time == true ) {
if ( data -> browser1 -> status == REQUEST_INPROGRESS ) {
TSContSchedule ( contp , 25 , TS_THREAD_POOL_DEFAULT ) ;
return 0 ;
}
}
else {
if ( data -> browser2 -> status == REQUEST_INPROGRESS ) {
TSContSchedule ( contp , 25 , TS_THREAD_POOL_DEFAULT ) ;
return 0 ;
}
}
{
if ( data -> first_time == true ) {
data -> first_time = false ;
synserver_delete ( data -> os ) ;
data -> os = nullptr ;
synclient_txn_send_request ( data -> browser2 , data -> request ) ;
ink_assert ( REQUEST_INPROGRESS == data -> browser2 -> status ) ;
TSContSchedule ( contp , 25 , TS_THREAD_POOL_DEFAULT ) ;
return 0 ;
}
if ( ( data -> browser1 -> status == REQUEST_SUCCESS ) && ( data -> browser2 -> status == REQUEST_SUCCESS ) && ( data -> test_passed_txn_cached_req_get == true ) && ( data -> test_passed_txn_cached_resp_get == true ) && ( data -> test_passed_txn_cache_lookup_status == true ) ) {
* ( data -> pstatus ) = REGRESSION_TEST_PASSED ;
}
else {
* ( data -> pstatus ) = REGRESSION_TEST_FAILED ;
}
synclient_txn_delete ( data -> browser1 ) ;
synclient_txn_delete ( data -> browser2 ) ;
data -> magic = MAGIC_DEAD ;
TSfree ( data -> request ) ;
TSfree ( data ) ;
TSContDataSet ( contp , nullptr ) ;
}
break ;
default : * ( data -> pstatus ) = REGRESSION_TEST_FAILED ;
SDK_RPRINT ( data -> test , "TSHttpTxnCache" , "TestCase1" , TC_FAIL , "Unexpected event %d" , event ) ;
break ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void luaD_reallocCI ( lua_State * L , int newsize ) {
CallInfo * oldci = L -> base_ci ;
luaM_reallocvector ( L , L -> base_ci , L -> size_ci , newsize , CallInfo ) ;
L -> size_ci = newsize ;
L -> ci = ( L -> ci - oldci ) + L -> base_ci ;
L -> end_ci = L -> base_ci + L -> size_ci - 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_pvfs2_error ( tvbuff_t * tvb , proto_tree * tree , int offset , packet_info * pinfo ) {
gint32 err ;
const char * errmsg = NULL ;
err = tvb_get_letohl ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_pvfs_error , tvb , offset , 4 , - err ) ;
offset += 4 ;
if ( err != 0 ) {
errmsg = val_to_str ( - err , names_pvfs_error , "Unknown error: %u" ) ;
col_append_fstr ( pinfo -> cinfo , COL_INFO , " Error: %s" , errmsg ) ;
}
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_SEQUENCE_OF_NonStandardParameter ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h245_SEQUENCE_OF_NonStandardParameter , SEQUENCE_OF_NonStandardParameter_sequence_of ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int name_cmp_len ( const char * name ) {
int i ;
for ( i = 0 ;
name [ i ] && name [ i ] != '\n' && name [ i ] != '/' ;
i ++ ) ;
return i ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean contains_uppercase ( const char * s1 ) {
const char * ch ;
for ( ch = s1 ;
* ch != '\0' ;
ch ++ ) {
if ( g_ascii_isupper ( * ch ) ) return TRUE ;
}
return FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void WarnBadInstruction ( gs_font_type42 * pfont , int glyph_index ) {
char buf [ gs_font_name_max + 1 ] ;
int l ;
gs_font_type42 * base_font = pfont ;
while ( ( gs_font_type42 * ) base_font -> base != base_font ) base_font = ( gs_font_type42 * ) base_font -> base ;
if ( ! base_font -> data . warning_bad_instruction ) {
l = min ( sizeof ( buf ) - 1 , base_font -> font_name . size ) ;
memcpy ( buf , base_font -> font_name . chars , l ) ;
buf [ l ] = 0 ;
if ( glyph_index >= 0 ) emprintf2 ( pfont -> memory , "Failed to interpret TT instructions for glyph index %d of font %s. " "Continue ignoring instructions of the font.\n" , glyph_index , buf ) ;
else emprintf1 ( pfont -> memory , "Failed to interpret TT instructions in font %s. " "Continue ignoring instructions of the font.\n" , buf ) ;
base_font -> data . warning_bad_instruction = true ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
char * proto_construct_match_selected_string ( field_info * finfo , epan_dissect_t * edt ) {
char * filter = NULL ;
if ( ! construct_match_selected_string ( finfo , edt , & filter ) ) {
wmem_free ( NULL , filter ) ;
return NULL ;
}
return filter ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int main_version ( void ) {
XPR ( NTR "Xdelta version 3.0.8, Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Joshua MacDonald\n" ) ;
XPR ( NTR "Xdelta comes with ABSOLUTELY NO WARRANTY.\n" ) ;
XPR ( NTR "This is free software, and you are welcome to redistribute it\n" ) ;
XPR ( NTR "under certain conditions;
see \"COPYING\" for details.\n" ) ;
return EXIT_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( FullscreenControllerInteractiveTest , EscapingMouseLock ) {
ASSERT_TRUE ( test_server ( ) -> Start ( ) ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , test_server ( ) -> GetURL ( kFullscreenMouseLockHTML ) ) ;
ASSERT_FALSE ( IsFullscreenBubbleDisplayed ( ) ) ;
{
ASSERT_TRUE ( ui_test_utils : : SendKeyPressAndWait ( browser ( ) , ui : : VKEY_1 , false , false , false , false , chrome : : NOTIFICATION_MOUSE_LOCK_CHANGED , content : : NotificationService : : AllSources ( ) ) ) ;
}
ASSERT_FALSE ( IsFullscreenPermissionRequested ( ) ) ;
ASSERT_TRUE ( IsMouseLockPermissionRequested ( ) ) ;
SendEscapeToFullscreenController ( ) ;
ASSERT_FALSE ( IsFullscreenPermissionRequested ( ) ) ;
ASSERT_FALSE ( IsMouseLockPermissionRequested ( ) ) ;
{
ASSERT_TRUE ( ui_test_utils : : SendKeyPressAndWait ( browser ( ) , ui : : VKEY_1 , false , false , false , false , chrome : : NOTIFICATION_MOUSE_LOCK_CHANGED , content : : NotificationService : : AllSources ( ) ) ) ;
}
ASSERT_FALSE ( IsFullscreenPermissionRequested ( ) ) ;
ASSERT_TRUE ( IsMouseLockPermissionRequested ( ) ) ;
AcceptCurrentFullscreenOrMouseLockRequest ( ) ;
ASSERT_TRUE ( IsMouseLocked ( ) ) ;
ASSERT_FALSE ( IsWindowFullscreenForTabOrPending ( ) ) ;
ASSERT_FALSE ( IsFullscreenPermissionRequested ( ) ) ;
ASSERT_FALSE ( IsMouseLockPermissionRequested ( ) ) ;
SendEscapeToFullscreenController ( ) ;
ASSERT_FALSE ( IsMouseLocked ( ) ) ;
ASSERT_FALSE ( IsWindowFullscreenForTabOrPending ( ) ) ;
ASSERT_FALSE ( IsFullscreenPermissionRequested ( ) ) ;
ASSERT_FALSE ( IsMouseLockPermissionRequested ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void setup_BAT ( CPUPPCState * env , int BAT , uint32_t virtual , uint32_t physical , uint32_t size , int Vs , int Vp , int PP ) {
uint32_t sz_bits , tmp_sz , align , tmp ;
sz_bits = 0 ;
align = 131072 ;
for ( tmp_sz = size / 131072 ;
tmp_sz != 1 ;
tmp_sz = tmp_sz >> 1 ) {
sz_bits = ( sz_bits << 1 ) + 1 ;
align = align << 1 ;
}
tmp = virtual & ~ ( align - 1 ) ;
tmp |= sz_bits << 2 ;
tmp |= Vs << 1 ;
tmp |= Vp ;
env -> DBAT [ 0 ] [ BAT ] = tmp ;
env -> IBAT [ 0 ] [ BAT ] = tmp ;
tmp = physical & ~ ( align - 1 ) ;
tmp |= 0 ;
tmp |= PP ;
env -> DBAT [ 1 ] [ BAT ] = tmp ;
env -> IBAT [ 1 ] [ BAT ] = tmp ;
printf ( "Set BATU0 to 0x%08x BATL0 to 0x%08x\n" , env -> DBAT [ 0 ] [ BAT ] , env -> DBAT [ 1 ] [ BAT ] ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int synth_superframe ( AVCodecContext * ctx , AVFrame * frame , int * got_frame_ptr ) {
WMAVoiceContext * s = ctx -> priv_data ;
GetBitContext * gb = & s -> gb , s_gb ;
int n , res , n_samples = 480 ;
double lsps [ MAX_FRAMES ] [ MAX_LSPS ] ;
const double * mean_lsf = s -> lsps == 16 ? wmavoice_mean_lsf16 [ s -> lsp_def_mode ] : wmavoice_mean_lsf10 [ s -> lsp_def_mode ] ;
float excitation [ MAX_SIGNAL_HISTORY + MAX_SFRAMESIZE + 12 ] ;
float synth [ MAX_LSPS + MAX_SFRAMESIZE ] ;
float * samples ;
memcpy ( synth , s -> synth_history , s -> lsps * sizeof ( * synth ) ) ;
memcpy ( excitation , s -> excitation_history , s -> history_nsamples * sizeof ( * excitation ) ) ;
if ( s -> sframe_cache_size > 0 ) {
gb = & s_gb ;
init_get_bits ( gb , s -> sframe_cache , s -> sframe_cache_size ) ;
s -> sframe_cache_size = 0 ;
}
if ( ( res = check_bits_for_superframe ( gb , s ) ) == 1 ) {
* got_frame_ptr = 0 ;
return 1 ;
}
if ( ! get_bits1 ( gb ) ) {
av_log_missing_feature ( ctx , "WMAPro-in-WMAVoice" , 1 ) ;
return AVERROR_PATCHWELCOME ;
}
if ( get_bits1 ( gb ) ) {
if ( ( n_samples = get_bits ( gb , 12 ) ) > 480 ) {
av_log ( ctx , AV_LOG_ERROR , "Superframe encodes >480 samples (%d), not allowed\n" , n_samples ) ;
return - 1 ;
}
}
if ( s -> has_residual_lsps ) {
double prev_lsps [ MAX_LSPS ] , a1 [ MAX_LSPS * 2 ] , a2 [ MAX_LSPS * 2 ] ;
for ( n = 0 ;
n < s -> lsps ;
n ++ ) prev_lsps [ n ] = s -> prev_lsps [ n ] - mean_lsf [ n ] ;
if ( s -> lsps == 10 ) {
dequant_lsp10r ( gb , lsps [ 2 ] , prev_lsps , a1 , a2 , s -> lsp_q_mode ) ;
}
else dequant_lsp16r ( gb , lsps [ 2 ] , prev_lsps , a1 , a2 , s -> lsp_q_mode ) ;
for ( n = 0 ;
n < s -> lsps ;
n ++ ) {
lsps [ 0 ] [ n ] = mean_lsf [ n ] + ( a1 [ n ] - a2 [ n * 2 ] ) ;
lsps [ 1 ] [ n ] = mean_lsf [ n ] + ( a1 [ s -> lsps + n ] - a2 [ n * 2 + 1 ] ) ;
lsps [ 2 ] [ n ] += mean_lsf [ n ] ;
}
for ( n = 0 ;
n < 3 ;
n ++ ) stabilize_lsps ( lsps [ n ] , s -> lsps ) ;
}
frame -> nb_samples = 480 ;
if ( ( res = ff_get_buffer ( ctx , frame , 0 ) ) < 0 ) {
av_log ( ctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return res ;
}
frame -> nb_samples = n_samples ;
samples = ( float * ) frame -> data [ 0 ] ;
for ( n = 0 ;
n < 3 ;
n ++ ) {
if ( ! s -> has_residual_lsps ) {
int m ;
if ( s -> lsps == 10 ) {
dequant_lsp10i ( gb , lsps [ n ] ) ;
}
else dequant_lsp16i ( gb , lsps [ n ] ) ;
for ( m = 0 ;
m < s -> lsps ;
m ++ ) lsps [ n ] [ m ] += mean_lsf [ m ] ;
stabilize_lsps ( lsps [ n ] , s -> lsps ) ;
}
if ( ( res = synth_frame ( ctx , gb , n , & samples [ n * MAX_FRAMESIZE ] , lsps [ n ] , n == 0 ? s -> prev_lsps : lsps [ n - 1 ] , & excitation [ s -> history_nsamples + n * MAX_FRAMESIZE ] , & synth [ s -> lsps + n * MAX_FRAMESIZE ] ) ) ) {
* got_frame_ptr = 0 ;
return res ;
}
}
if ( get_bits1 ( gb ) ) {
res = get_bits ( gb , 4 ) ;
skip_bits ( gb , 10 * ( res + 1 ) ) ;
}
* got_frame_ptr = 1 ;
memcpy ( s -> prev_lsps , lsps [ 2 ] , s -> lsps * sizeof ( * s -> prev_lsps ) ) ;
memcpy ( s -> synth_history , & synth [ MAX_SFRAMESIZE ] , s -> lsps * sizeof ( * synth ) ) ;
memcpy ( s -> excitation_history , & excitation [ MAX_SFRAMESIZE ] , s -> history_nsamples * sizeof ( * excitation ) ) ;
if ( s -> do_apf ) memmove ( s -> zero_exc_pf , & s -> zero_exc_pf [ MAX_SFRAMESIZE ] , s -> history_nsamples * sizeof ( * s -> zero_exc_pf ) ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_OpenLogicalChannelReject ( 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_OpenLogicalChannelReject , OpenLogicalChannelReject_sequence ) ;
# line 542 "../../asn1/h245/h245.cnf" if ( h245_pi != NULL ) h245_pi -> msg_type = H245_OpenLogChnRjc ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
struct auth_client_request * auth_client_request_new ( struct auth_client * client , const struct auth_request_info * request_info , auth_request_callback_t * callback , void * context ) {
struct auth_client_request * request ;
pool_t pool ;
pool = pool_alloconly_create ( "auth client request" , 512 ) ;
request = p_new ( pool , struct auth_client_request , 1 ) ;
request -> pool = pool ;
request -> conn = client -> conn ;
request -> callback = callback ;
request -> context = context ;
request -> id = auth_server_connection_add_request ( request -> conn , request ) ;
request -> created = ioloop_time ;
T_BEGIN {
auth_server_send_new_request ( request -> conn , request , request_info ) ;
}
T_END ;
return request ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int parse_global_var ( AVFormatContext * avctx , AVStream * st , const char * name , int size ) {
MvContext * mv = avctx -> priv_data ;
AVIOContext * pb = avctx -> pb ;
if ( ! strcmp ( name , "__NUM_I_TRACKS" ) ) {
mv -> nb_video_tracks = var_read_int ( pb , size ) ;
}
else if ( ! strcmp ( name , "__NUM_A_TRACKS" ) ) {
mv -> nb_audio_tracks = var_read_int ( pb , size ) ;
}
else if ( ! strcmp ( name , "COMMENT" ) || ! strcmp ( name , "TITLE" ) ) {
var_read_metadata ( avctx , name , size ) ;
}
else if ( ! strcmp ( name , "LOOP_MODE" ) || ! strcmp ( name , "NUM_LOOPS" ) || ! strcmp ( name , "OPTIMIZED" ) ) {
avio_skip ( pb , size ) ;
}
else return AVERROR_INVALIDDATA ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_zcl_color_control_move_to_color_temp ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) {
proto_tree_add_item ( tree , hf_zbee_zcl_color_control_color_temp , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
proto_tree_add_item ( tree , hf_zbee_zcl_color_control_transit_time , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int tls_construct_server_key_exchange ( SSL * s ) {
# ifndef OPENSSL_NO_DH EVP_PKEY * pkdh = NULL ;
int j ;
# endif # ifndef OPENSSL_NO_EC unsigned char * encodedPoint = NULL ;
int encodedlen = 0 ;
int curve_id = 0 ;
# endif EVP_PKEY * pkey ;
const EVP_MD * md = NULL ;
unsigned char * p , * d ;
int al , i ;
unsigned long type ;
int n ;
const BIGNUM * r [ 4 ] ;
int nr [ 4 ] , kn ;
BUF_MEM * buf ;
EVP_MD_CTX * md_ctx = EVP_MD_CTX_new ( ) ;
if ( md_ctx == NULL ) {
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , ERR_R_MALLOC_FAILURE ) ;
al = SSL_AD_INTERNAL_ERROR ;
goto f_err ;
}
type = s -> s3 -> tmp . new_cipher -> algorithm_mkey ;
buf = s -> init_buf ;
r [ 0 ] = r [ 1 ] = r [ 2 ] = r [ 3 ] = NULL ;
n = 0 ;
# ifndef OPENSSL_NO_PSK if ( type & SSL_PSK ) {
n += 2 ;
if ( s -> cert -> psk_identity_hint ) n += strlen ( s -> cert -> psk_identity_hint ) ;
}
if ( type & ( SSL_kPSK | SSL_kRSAPSK ) ) {
}
else # endif # ifndef OPENSSL_NO_DH if ( type & ( SSL_kDHE | SSL_kDHEPSK ) ) {
CERT * cert = s -> cert ;
EVP_PKEY * pkdhp = NULL ;
DH * dh ;
if ( s -> cert -> dh_tmp_auto ) {
DH * dhp = ssl_get_auto_dh ( s ) ;
pkdh = EVP_PKEY_new ( ) ;
if ( pkdh == NULL || dhp == NULL ) {
DH_free ( dhp ) ;
al = SSL_AD_INTERNAL_ERROR ;
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , ERR_R_INTERNAL_ERROR ) ;
goto f_err ;
}
EVP_PKEY_assign_DH ( pkdh , dhp ) ;
pkdhp = pkdh ;
}
else {
pkdhp = cert -> dh_tmp ;
}
if ( ( pkdhp == NULL ) && ( s -> cert -> dh_tmp_cb != NULL ) ) {
DH * dhp = s -> cert -> dh_tmp_cb ( s , 0 , 1024 ) ;
pkdh = ssl_dh_to_pkey ( dhp ) ;
if ( pkdh == NULL ) {
al = SSL_AD_INTERNAL_ERROR ;
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , ERR_R_INTERNAL_ERROR ) ;
goto f_err ;
}
pkdhp = pkdh ;
}
if ( pkdhp == NULL ) {
al = SSL_AD_HANDSHAKE_FAILURE ;
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , SSL_R_MISSING_TMP_DH_KEY ) ;
goto f_err ;
}
if ( ! ssl_security ( s , SSL_SECOP_TMP_DH , EVP_PKEY_security_bits ( pkdhp ) , 0 , pkdhp ) ) {
al = SSL_AD_HANDSHAKE_FAILURE ;
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , SSL_R_DH_KEY_TOO_SMALL ) ;
goto f_err ;
}
if ( s -> s3 -> tmp . pkey != NULL ) {
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , ERR_R_INTERNAL_ERROR ) ;
goto err ;
}
s -> s3 -> tmp . pkey = ssl_generate_pkey ( pkdhp ) ;
if ( s -> s3 -> tmp . pkey == NULL ) {
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , ERR_R_EVP_LIB ) ;
goto err ;
}
dh = EVP_PKEY_get0_DH ( s -> s3 -> tmp . pkey ) ;
EVP_PKEY_free ( pkdh ) ;
pkdh = NULL ;
DH_get0_pqg ( dh , & r [ 0 ] , NULL , & r [ 1 ] ) ;
DH_get0_key ( dh , & r [ 2 ] , NULL ) ;
}
else # endif # ifndef OPENSSL_NO_EC if ( type & ( SSL_kECDHE | SSL_kECDHEPSK ) ) {
int nid ;
if ( s -> s3 -> tmp . pkey != NULL ) {
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , ERR_R_INTERNAL_ERROR ) ;
goto err ;
}
nid = tls1_shared_curve ( s , - 2 ) ;
curve_id = tls1_ec_nid2curve_id ( nid ) ;
if ( curve_id == 0 ) {
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , SSL_R_UNSUPPORTED_ELLIPTIC_CURVE ) ;
goto err ;
}
s -> s3 -> tmp . pkey = ssl_generate_pkey_curve ( curve_id ) ;
if ( s -> s3 -> tmp . pkey == NULL ) {
al = SSL_AD_INTERNAL_ERROR ;
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , ERR_R_EVP_LIB ) ;
goto f_err ;
}
encodedlen = EVP_PKEY_get1_tls_encodedpoint ( s -> s3 -> tmp . pkey , & encodedPoint ) ;
if ( encodedlen == 0 ) {
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , ERR_R_EC_LIB ) ;
goto err ;
}
n += 4 + encodedlen ;
r [ 0 ] = NULL ;
r [ 1 ] = NULL ;
r [ 2 ] = NULL ;
r [ 3 ] = NULL ;
}
else # endif # ifndef OPENSSL_NO_SRP if ( type & SSL_kSRP ) {
if ( ( s -> srp_ctx . N == NULL ) || ( s -> srp_ctx . g == NULL ) || ( s -> srp_ctx . s == NULL ) || ( s -> srp_ctx . B == NULL ) ) {
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , SSL_R_MISSING_SRP_PARAM ) ;
goto err ;
}
r [ 0 ] = s -> srp_ctx . N ;
r [ 1 ] = s -> srp_ctx . g ;
r [ 2 ] = s -> srp_ctx . s ;
r [ 3 ] = s -> srp_ctx . B ;
}
else # endif {
al = SSL_AD_HANDSHAKE_FAILURE ;
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , SSL_R_UNKNOWN_KEY_EXCHANGE_TYPE ) ;
goto f_err ;
}
for ( i = 0 ;
i < 4 && r [ i ] != NULL ;
i ++ ) {
nr [ i ] = BN_num_bytes ( r [ i ] ) ;
# ifndef OPENSSL_NO_SRP if ( ( i == 2 ) && ( type & SSL_kSRP ) ) n += 1 + nr [ i ] ;
else # endif # ifndef OPENSSL_NO_DH if ( ( i == 2 ) && ( type & ( SSL_kDHE | SSL_kDHEPSK ) ) ) n += 2 + nr [ 0 ] ;
else # endif n += 2 + nr [ i ] ;
}
if ( ! ( s -> s3 -> tmp . new_cipher -> algorithm_auth & ( SSL_aNULL | SSL_aSRP ) ) && ! ( s -> s3 -> tmp . new_cipher -> algorithm_mkey & SSL_PSK ) ) {
if ( ( pkey = ssl_get_sign_pkey ( s , s -> s3 -> tmp . new_cipher , & md ) ) == NULL ) {
al = SSL_AD_DECODE_ERROR ;
goto f_err ;
}
kn = EVP_PKEY_size ( pkey ) ;
if ( SSL_USE_SIGALGS ( s ) ) kn += 2 ;
kn += 2 ;
}
else {
pkey = NULL ;
kn = 0 ;
}
if ( ! BUF_MEM_grow_clean ( buf , n + SSL_HM_HEADER_LENGTH ( s ) + kn ) ) {
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , ERR_LIB_BUF ) ;
goto err ;
}
d = p = ssl_handshake_start ( s ) ;
# ifndef OPENSSL_NO_PSK if ( type & SSL_PSK ) {
if ( s -> cert -> psk_identity_hint ) {
size_t len = strlen ( s -> cert -> psk_identity_hint ) ;
if ( len > PSK_MAX_IDENTITY_LEN ) {
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , ERR_R_INTERNAL_ERROR ) ;
goto err ;
}
s2n ( len , p ) ;
memcpy ( p , s -> cert -> psk_identity_hint , len ) ;
p += len ;
}
else {
s2n ( 0 , p ) ;
}
}
# endif for ( i = 0 ;
i < 4 && r [ i ] != NULL ;
i ++ ) {
# ifndef OPENSSL_NO_SRP if ( ( i == 2 ) && ( type & SSL_kSRP ) ) {
* p = nr [ i ] ;
p ++ ;
}
else # endif # ifndef OPENSSL_NO_DH if ( ( i == 2 ) && ( type & ( SSL_kDHE | SSL_kDHEPSK ) ) ) {
s2n ( nr [ 0 ] , p ) ;
for ( j = 0 ;
j < ( nr [ 0 ] - nr [ 2 ] ) ;
++ j ) {
* p = 0 ;
++ p ;
}
}
else # endif s2n ( nr [ i ] , p ) ;
BN_bn2bin ( r [ i ] , p ) ;
p += nr [ i ] ;
}
# ifndef OPENSSL_NO_EC if ( type & ( SSL_kECDHE | SSL_kECDHEPSK ) ) {
* p = NAMED_CURVE_TYPE ;
p += 1 ;
* p = 0 ;
p += 1 ;
* p = curve_id ;
p += 1 ;
* p = encodedlen ;
p += 1 ;
memcpy ( p , encodedPoint , encodedlen ) ;
OPENSSL_free ( encodedPoint ) ;
encodedPoint = NULL ;
p += encodedlen ;
}
# endif if ( pkey != NULL ) {
if ( md ) {
if ( SSL_USE_SIGALGS ( s ) ) {
if ( ! tls12_get_sigandhash ( p , pkey , md ) ) {
al = SSL_AD_INTERNAL_ERROR ;
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , ERR_R_INTERNAL_ERROR ) ;
goto f_err ;
}
p += 2 ;
}
# ifdef SSL_DEBUG fprintf ( stderr , "Using hash %s\n" , EVP_MD_name ( md ) ) ;
# endif if ( EVP_SignInit_ex ( md_ctx , md , NULL ) <= 0 || EVP_SignUpdate ( md_ctx , & ( s -> s3 -> client_random [ 0 ] ) , SSL3_RANDOM_SIZE ) <= 0 || EVP_SignUpdate ( md_ctx , & ( s -> s3 -> server_random [ 0 ] ) , SSL3_RANDOM_SIZE ) <= 0 || EVP_SignUpdate ( md_ctx , d , n ) <= 0 || EVP_SignFinal ( md_ctx , & ( p [ 2 ] ) , ( unsigned int * ) & i , pkey ) <= 0 ) {
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , ERR_LIB_EVP ) ;
al = SSL_AD_INTERNAL_ERROR ;
goto f_err ;
}
s2n ( i , p ) ;
n += i + 2 ;
if ( SSL_USE_SIGALGS ( s ) ) n += 2 ;
}
else {
al = SSL_AD_HANDSHAKE_FAILURE ;
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , SSL_R_UNKNOWN_PKEY_TYPE ) ;
goto f_err ;
}
}
if ( ! ssl_set_handshake_header ( s , SSL3_MT_SERVER_KEY_EXCHANGE , n ) ) {
al = SSL_AD_HANDSHAKE_FAILURE ;
SSLerr ( SSL_F_TLS_CONSTRUCT_SERVER_KEY_EXCHANGE , ERR_R_INTERNAL_ERROR ) ;
goto f_err ;
}
EVP_MD_CTX_free ( md_ctx ) ;
return 1 ;
f_err : ssl3_send_alert ( s , SSL3_AL_FATAL , al ) ;
err : # ifndef OPENSSL_NO_DH EVP_PKEY_free ( pkdh ) ;
# endif # ifndef OPENSSL_NO_EC OPENSSL_free ( encodedPoint ) ;
# endif EVP_MD_CTX_free ( md_ctx ) ;
ossl_statem_set_error ( s ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static u_int parse_constraint ( chunk_t object ) {
switch ( object . len ) {
case 0 : return 0 ;
case 1 : return ( object . ptr [ 0 ] & 0x80 ) ? X509_NO_CONSTRAINT : object . ptr [ 0 ] ;
default : return X509_NO_CONSTRAINT ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_IA5String_SIZE_1_64 ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_IA5String ( tvb , offset , actx , tree , hf_index , 1 , 64 , FALSE ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void e1000e_rx_ring_init ( E1000ECore * core , E1000E_RxRing * rxr , int idx ) {
static const E1000E_RingInfo i [ E1000E_NUM_QUEUES ] = {
{
RDBAH0 , RDBAL0 , RDLEN0 , RDH0 , RDT0 , 0 }
, {
RDBAH1 , RDBAL1 , RDLEN1 , RDH1 , RDT1 , 1 }
}
;
assert ( idx < ARRAY_SIZE ( i ) ) ;
rxr -> i = & i [ idx ] ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_null ( void ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_null ( ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_reserve ( sk_ ## t1 ## _compfunc compare , int n ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_reserve ( ( OPENSSL_sk_compfunc ) compare , n ) ;
}
static ossl_inline int sk_ ## t1 ## _reserve ( STACK_OF ( t1 ) * sk , int n ) {
return OPENSSL_sk_reserve ( ( OPENSSL_STACK * ) sk , n ) ;
}
static ossl_inline void sk_ ## t1 ## _free ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_free ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _zero ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_zero ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete ( STACK_OF ( t1 ) * sk , int i ) {
return ( t2 * ) OPENSSL_sk_delete ( ( OPENSSL_STACK * ) sk , i ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( ShortcutsProviderTest , CalculateScore ) {
ShortcutsDatabase : : Shortcut shortcut ( std : : string ( ) , ASCIIToUTF16 ( "test" ) , ShortcutsDatabase : : Shortcut : : MatchCore ( ASCIIToUTF16 ( "www.test.com" ) , GURL ( "http://www.test.com" ) , ASCIIToUTF16 ( "www.test.com" ) , "0,1,4,3,8,1" , ASCIIToUTF16 ( "A test" ) , "0,0,2,2" , ui : : PAGE_TRANSITION_TYPED , AutocompleteMatchType : : HISTORY_URL , base : : string16 ( ) ) , base : : Time : : Now ( ) , 1 ) ;
const int max_relevance = ShortcutsProvider : : kShortcutsProviderDefaultMaxRelevance ;
const int kMaxScore = CalculateScore ( "test" , shortcut , max_relevance ) ;
int score_three_quarters = CalculateScore ( "tes" , shortcut , max_relevance ) ;
EXPECT_LT ( score_three_quarters , kMaxScore ) ;
int score_one_half = CalculateScore ( "te" , shortcut , max_relevance ) ;
EXPECT_LT ( score_one_half , score_three_quarters ) ;
int score_one_quarter = CalculateScore ( "t" , shortcut , max_relevance ) ;
EXPECT_LT ( score_one_quarter , score_one_half ) ;
shortcut . last_access_time = base : : Time : : Now ( ) - base : : TimeDelta : : FromDays ( 7 ) ;
int score_week_old = CalculateScore ( "test" , shortcut , max_relevance ) ;
EXPECT_LT ( score_week_old , kMaxScore ) ;
shortcut . last_access_time = base : : Time : : Now ( ) - base : : TimeDelta : : FromDays ( 14 ) ;
int score_two_weeks_old = CalculateScore ( "test" , shortcut , max_relevance ) ;
EXPECT_LT ( score_two_weeks_old , score_week_old ) ;
shortcut . number_of_hits = 2 ;
shortcut . last_access_time = base : : Time : : Now ( ) - base : : TimeDelta : : FromDays ( 14 ) ;
int score_popular_two_weeks_old = CalculateScore ( "test" , shortcut , max_relevance ) ;
EXPECT_LT ( score_two_weeks_old , score_popular_two_weeks_old ) ;
EXPECT_LT ( score_popular_two_weeks_old , kMaxScore ) ;
shortcut . number_of_hits = 3 ;
shortcut . last_access_time = base : : Time : : Now ( ) - base : : TimeDelta : : FromDays ( 14 ) ;
int score_more_popular_two_weeks_old = CalculateScore ( "test" , shortcut , max_relevance ) ;
EXPECT_LT ( score_two_weeks_old , score_more_popular_two_weeks_old ) ;
EXPECT_LT ( score_popular_two_weeks_old , score_more_popular_two_weeks_old ) ;
EXPECT_LT ( score_more_popular_two_weeks_old , kMaxScore ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int tm_kill ( tm_task_id tid , int sig , tm_event_t * event ) {
int rc = TM_SUCCESS ;
task_info * tp ;
struct tcp_chan * chan = NULL ;
if ( ! init_done ) {
rc = TM_BADINIT ;
goto tm_kill_cleanup ;
}
if ( ( tp = find_task ( tid ) ) == NULL ) {
rc = TM_ENOTFOUND ;
goto tm_kill_cleanup ;
}
* event = new_event ( ) ;
if ( startcom ( TM_SIGNAL , * event , & chan ) != DIS_SUCCESS ) {
rc = TM_ENOTCONNECTED ;
goto tm_kill_cleanup ;
}
if ( diswsi ( chan , tp -> t_node ) != DIS_SUCCESS ) {
rc = TM_ENOTCONNECTED ;
goto tm_kill_cleanup ;
}
if ( diswsi ( chan , tid ) != DIS_SUCCESS ) {
rc = TM_ENOTCONNECTED ;
goto tm_kill_cleanup ;
}
if ( diswsi ( chan , sig ) != DIS_SUCCESS ) {
rc = TM_ENOTCONNECTED ;
goto tm_kill_cleanup ;
}
DIS_tcp_wflush ( chan ) ;
add_event ( * event , tp -> t_node , TM_SIGNAL , NULL ) ;
tm_kill_cleanup : if ( chan != NULL ) DIS_tcp_cleanup ( chan ) ;
return rc ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_ ## type ## _predictor_ ## size ## x ## size ## _c ( uint8_t * dst , ptrdiff_t stride , const uint8_t * above , const uint8_t * left ) {
type ## _predictor ( dst , stride , size , above , left ) ;
}
# define intra_pred_allsizes ( type ) intra_pred_sized ( type , 4 ) intra_pred_sized ( type , 8 ) intra_pred_sized ( type , 16 ) intra_pred_sized ( type , 32 ) static INLINE void d207_predictor ( uint8_t * dst , ptrdiff_t stride , int bs , const uint8_t * above , const uint8_t * left ) {
int r , c ;
( void ) above ;
for ( r = 0 ;
r < bs - 1 ;
++ r ) dst [ r * stride ] = ROUND_POWER_OF_TWO ( left [ r ] + left [ r + 1 ] , 1 ) ;
dst [ ( bs - 1 ) * stride ] = left [ bs - 1 ] ;
dst ++ ;
for ( r = 0 ;
r < bs - 2 ;
++ r ) dst [ r * stride ] = ROUND_POWER_OF_TWO ( left [ r ] + left [ r + 1 ] * 2 + left [ r + 2 ] , 2 ) ;
dst [ ( bs - 2 ) * stride ] = ROUND_POWER_OF_TWO ( left [ bs - 2 ] + left [ bs - 1 ] * 3 , 2 ) ;
dst [ ( bs - 1 ) * stride ] = left [ bs - 1 ] ;
dst ++ ;
for ( c = 0 ;
c < bs - 2 ;
++ c ) dst [ ( bs - 1 ) * stride + c ] = left [ bs - 1 ] ;
for ( r = bs - 2 ;
r >= 0 ;
-- r ) for ( c = 0 ;
c < bs - 2 ;
++ c ) dst [ r * stride + c ] = dst [ ( r + 1 ) * stride + c - 2 ] ;
}
intra_pred_allsizes ( d207 ) static INLINE void d63_predictor ( uint8_t * dst , ptrdiff_t stride , int bs , const uint8_t * above , const uint8_t * left ) {
int r , c ;
( void ) left ;
for ( r = 0 ;
r < bs ;
++ r ) {
for ( c = 0 ;
c < bs ;
++ c ) dst [ c ] = r & 1 ? ROUND_POWER_OF_TWO ( above [ r / 2 + c ] + above [ r / 2 + c + 1 ] * 2 + above [ r / 2 + c + 2 ] , 2 ) : ROUND_POWER_OF_TWO ( above [ r / 2 + c ] + above [ r / 2 + c + 1 ] , 1 ) ;
dst += stride ;
}
}
intra_pred_allsizes ( d63 ) static INLINE void d45_predictor ( uint8_t * dst , ptrdiff_t stride , int bs , const uint8_t * above , const uint8_t * left ) {
int r , c ;
( void ) left ;
for ( r = 0 ;
r < bs ;
++ r ) {
for ( c = 0 ;
c < bs ;
++ c ) dst [ c ] = r + c + 2 < bs * 2 ? ROUND_POWER_OF_TWO ( above [ r + c ] + above [ r + c + 1 ] * 2 + above [ r + c + 2 ] , 2 ) : above [ bs * 2 - 1 ] ;
dst += stride ;
}
}
intra_pred_allsizes ( d45 ) static INLINE void d117_predictor ( uint8_t * dst , ptrdiff_t stride , int bs , const uint8_t * above , const uint8_t * left ) {
int r , c ;
for ( c = 0 ;
c < bs ;
c ++ ) dst [ c ] = ROUND_POWER_OF_TWO ( above [ c - 1 ] + above [ c ] , 1 ) ;
dst += stride ;
dst [ 0 ] = ROUND_POWER_OF_TWO ( left [ 0 ] + above [ - 1 ] * 2 + above [ 0 ] , 2 ) ;
for ( c = 1 ;
c < bs ;
c ++ ) dst [ c ] = ROUND_POWER_OF_TWO ( above [ c - 2 ] + above [ c - 1 ] * 2 + above [ c ] , 2 ) ;
dst += stride ;
dst [ 0 ] = ROUND_POWER_OF_TWO ( above [ - 1 ] + left [ 0 ] * 2 + left [ 1 ] , 2 ) ;
for ( r = 3 ;
r < bs ;
++ r ) dst [ ( r - 2 ) * stride ] = ROUND_POWER_OF_TWO ( left [ r - 3 ] + left [ r - 2 ] * 2 + left [ r - 1 ] , 2 ) ;
for ( r = 2 ;
r < bs ;
++ r ) {
for ( c = 1 ;
c < bs ;
c ++ ) dst [ c ] = dst [ - 2 * stride + c - 1 ] ;
dst += stride ;
}
}
intra_pred_allsizes ( d117 )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int * __xmlDefaultBufferSize ( void ) {
if ( IS_MAIN_THREAD ) return ( & xmlDefaultBufferSize ) ;
else return ( & xmlGetGlobalState ( ) -> xmlDefaultBufferSize ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void proto_register_zbee_zcl_appl_ctrl ( void ) {
guint i , j ;
static hf_register_info hf [ ] = {
{
& hf_zbee_zcl_appl_ctrl_attr_id , {
"Attribute" , "zbee_zcl_general.applctrl.attr_id" , FT_UINT16 , BASE_HEX , VALS ( zbee_zcl_appl_ctrl_attr_names ) , 0x0 , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_time , {
"Data" , "zbee_zcl_general.applctrl.time" , FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_time_mm , {
"Minutes" , "zbee_zcl_general.applctrl.time.mm" , FT_UINT16 , BASE_DEC , NULL , ZBEE_ZCL_APPL_CTRL_TIME_MM , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_time_encoding_type , {
"Encoding Type" , "zbee_zcl_general.applctrl.time.encoding_type" , FT_UINT16 , BASE_HEX , VALS ( zbee_zcl_appl_ctrl_time_encoding_type_names ) , ZBEE_ZCL_APPL_CTRL_TIME_ENCOD_TYPE , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_time_hh , {
"Hours" , "zbee_zcl_general.applctrl.time.hh" , FT_UINT16 , BASE_DEC , NULL , ZBEE_ZCL_APPL_CTRL_TIME_HH , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_srv_tx_cmd_id , {
"Command" , "zbee_zcl_general.applctrl.cmd.srv_tx.id" , FT_UINT8 , BASE_HEX , VALS ( zbee_zcl_appl_ctrl_srv_tx_cmd_names ) , 0x0 , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_srv_rx_cmd_id , {
"Command" , "zbee_zcl_general.applctrl.cmd.srv_rx.id" , FT_UINT8 , BASE_HEX , VALS ( zbee_zcl_appl_ctrl_srv_rx_cmd_names ) , 0x0 , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_appl_status , {
"Appliance Status" , "zbee_zcl_general.applctrl.status" , FT_UINT8 , BASE_HEX , VALS ( zbee_zcl_appl_ctrl_appl_status_names ) , 0x0 , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_rem_en_flags_raw , {
"Remote Enable Flags" , "zbee_zcl_general.applctrl.remote_enable_flags" , FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_rem_en_flags , {
"Remote Enable Flags" , "zbee_zcl_general.applctrl.remenflags" , FT_UINT8 , BASE_HEX , VALS ( zbee_zcl_appl_ctrl_rem_flags_names ) , ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_FLAGS , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_status2 , {
"Appliance Status 2" , "zbee_zcl_general.applctrl.status2" , FT_UINT8 , BASE_HEX , VALS ( zbee_zcl_appl_ctrl_status2_names ) , ZBEE_ZCL_APPL_CTRL_REM_EN_FLAGS_STATUS2 , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_status2_array , {
"Appliance Status 2" , "zbee_zcl_general.applctrl.status2.array" , FT_UINT24 , BASE_HEX , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_exec_cmd_id , {
"Command" , "zbee_zcl_general.applctrl.execcmd.id" , FT_UINT8 , BASE_HEX , VALS ( zbee_zcl_appl_ctrl_exec_cmd_names ) , 0x0 , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_attr_func_id , {
"ID" , "zbee_zcl_general.applctrl.attr_func.id" , FT_UINT16 , BASE_HEX , VALS ( zbee_zcl_appl_ctrl_attr_names ) , 0x0 , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_attr_func_data_type , {
"Data Type" , "zbee_zcl_general.applctrl.attr_func.datatype" , FT_UINT8 , BASE_HEX , VALS ( zbee_zcl_short_data_type_names ) , 0x0 , NULL , HFILL }
}
, {
& hf_zbee_zcl_appl_ctrl_warning_id , {
"Warning" , "zbee_zcl_general.applctrl.ovrlwarning.id" , FT_UINT8 , BASE_HEX , VALS ( zbee_zcl_appl_ctrl_ovrl_warning_names ) , 0x0 , NULL , HFILL }
}
}
;
gint * ett [ ZBEE_ZCL_APPL_CTRL_NUM_ETT ] ;
ett [ 0 ] = & ett_zbee_zcl_appl_ctrl ;
ett [ 1 ] = & ett_zbee_zcl_appl_ctrl_flags ;
ett [ 2 ] = & ett_zbee_zcl_appl_ctrl_time ;
for ( i = 0 , j = ZBEE_ZCL_APPL_CTRL_NUM_GENERIC_ETT ;
i < ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT ;
i ++ , j ++ ) {
ett_zbee_zcl_appl_ctrl_func [ i ] = - 1 ;
ett [ j ] = & ett_zbee_zcl_appl_ctrl_func [ i ] ;
}
proto_zbee_zcl_appl_ctrl = proto_register_protocol ( "ZigBee ZCL Appliance Control" , "ZCL Appliance Control" , ZBEE_PROTOABBREV_ZCL_APPLCTRL ) ;
proto_register_field_array ( proto_zbee_zcl_appl_ctrl , hf , array_length ( hf ) ) ;
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
register_dissector ( ZBEE_PROTOABBREV_ZCL_APPLCTRL , dissect_zbee_zcl_appl_ctrl , proto_zbee_zcl_appl_ctrl ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_read_format_mtree1 ( void ) {
const char reffile [ ] = "test_read_format_mtree.mtree" ;
char buff [ 16 ] ;
struct archive_entry * ae ;
struct archive * a ;
FILE * f ;
static const long long max_int64 = ( ( ( ( long long ) 1 ) << 62 ) - 1 ) + ( ( ( long long ) 1 ) << 62 ) ;
time_t min_time ;
volatile time_t t ;
extract_reference_file ( reffile ) ;
assertMakeDir ( "dir" , 0775 ) ;
assertMakeDir ( "dir2" , 0775 ) ;
assert ( ( a = archive_read_new ( ) ) != NULL ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_support_filter_all ( a ) ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_support_format_all ( a ) ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_set_options ( a , "mtree:checkfs" ) ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_open_filename ( a , reffile , 11 ) ) ;
f = fopen ( "file" , "wb" ) ;
assert ( f != NULL ) ;
assertEqualInt ( 3 , fwrite ( "hi\n" , 1 , 3 , f ) ) ;
fclose ( f ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualInt ( archive_format ( a ) , ARCHIVE_FORMAT_MTREE ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "file" ) ;
assertEqualInt ( archive_entry_uid ( ae ) , 18 ) ;
assertEqualInt ( AE_IFREG , archive_entry_filetype ( ae ) ) ;
assertEqualInt ( archive_entry_mode ( ae ) , AE_IFREG | 0123 ) ;
assertEqualInt ( archive_entry_size ( ae ) , 3 ) ;
assertEqualInt ( 3 , archive_read_data ( a , buff , 3 ) ) ;
assertEqualMem ( buff , "hi\n" , 3 ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir" ) ;
assertEqualInt ( AE_IFDIR , archive_entry_filetype ( ae ) ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir/file with space" ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "file with space" ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2" ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2/dir3a" ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2/dir3a/indir3a" ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2/fullindir2" ) ;
assertEqualInt ( archive_entry_mode ( ae ) , AE_IFREG | 0644 ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2/indir2" ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2/dir3b" ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2/dir3b/indir3b" ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "notindir" ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2/emptyfile" ) ;
assertEqualInt ( archive_entry_size ( ae ) , 0 ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2/smallfile" ) ;
assertEqualInt ( archive_entry_size ( ae ) , 1 ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2/toosmallfile" ) ;
assertEqualInt ( archive_entry_size ( ae ) , - 1 ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2/bigfile" ) ;
assertEqualInt ( archive_entry_size ( ae ) , max_int64 ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2/toobigfile" ) ;
assertEqualInt ( archive_entry_size ( ae ) , max_int64 ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2/veryoldfile" ) ;
min_time = archive_entry_mtime ( ae ) ;
assert ( min_time <= 0 ) ;
t = min_time - 1 ;
assert ( t > 0 ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "dir2/toooldfile" ) ;
assertEqualInt ( archive_entry_mtime ( ae ) , min_time ) ;
assertEqualInt ( archive_entry_is_encrypted ( ae ) , 0 ) ;
assertEqualIntA ( a , archive_read_has_encrypted_entries ( a ) , ARCHIVE_READ_FORMAT_ENCRYPTION_UNSUPPORTED ) ;
assertEqualIntA ( a , ARCHIVE_EOF , archive_read_next_header ( a , & ae ) ) ;
assertEqualInt ( 19 , archive_file_count ( a ) ) ;
assertEqualInt ( ARCHIVE_OK , archive_read_close ( a ) ) ;
assertEqualInt ( ARCHIVE_OK , archive_read_free ( a ) ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void load_branch ( struct branch * b ) {
load_tree ( & b -> branch_tree ) ;
if ( ! b -> active ) {
b -> active = 1 ;
b -> active_next_branch = active_branches ;
active_branches = b ;
cur_active_branches ++ ;
branch_load_count ++ ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_T_booleanArray ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 766 "../../asn1/h245/h245.cnf" guint32 value ;
guint8 * buf ;
tvbuff_t * value_tvb ;
gef_ctx_t * gefx ;
offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 0U , 255U , & value , FALSE ) ;
gefx = gef_ctx_get ( actx -> private_data ) ;
if ( gefx ) {
buf = wmem_new ( actx -> pinfo -> pool , guint8 ) ;
buf [ 0 ] = value ;
value_tvb = tvb_new_child_real_data ( tvb , buf , sizeof ( guint8 ) , sizeof ( guint8 ) ) ;
add_new_data_source ( actx -> pinfo , value_tvb , "booleanArray" ) ;
dissector_try_string ( gef_content_dissector_table , gefx -> key , value_tvb , actx -> pinfo , tree , actx ) ;
}
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
const char * tok2str ( register const struct tok * lp , register const char * fmt , register u_int v ) {
static char buf [ 4 ] [ TOKBUFSIZE ] ;
static int idx = 0 ;
char * ret ;
ret = buf [ idx ] ;
idx = ( idx + 1 ) & 3 ;
return tok2strbuf ( lp , fmt , v , ret , sizeof ( buf [ 0 ] ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
proto_item * parseInt16 ( proto_tree * tree , tvbuff_t * tvb , packet_info * pinfo _U_ , gint * pOffset , int hfIndex ) {
proto_item * item = proto_tree_add_item ( tree , hfIndex , tvb , * pOffset , 2 , ENC_LITTLE_ENDIAN ) ;
* pOffset += 2 ;
return item ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * prplcb_notify_userinfo ( PurpleConnection * gc , const char * who , PurpleNotifyUserInfo * user_info ) {
struct im_connection * ic = purple_ic_by_gc ( gc ) ;
GString * info = g_string_new ( "" ) ;
GList * l = purple_notify_user_info_get_entries ( user_info ) ;
char * key ;
const char * value ;
int n ;
while ( l ) {
PurpleNotifyUserInfoEntry * e = l -> data ;
switch ( purple_notify_user_info_entry_get_type ( e ) ) {
case PURPLE_NOTIFY_USER_INFO_ENTRY_PAIR : case PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_HEADER : key = g_strdup ( purple_notify_user_info_entry_get_label ( e ) ) ;
value = purple_notify_user_info_entry_get_value ( e ) ;
if ( key ) {
strip_html ( key ) ;
g_string_append_printf ( info , "%s: " , key ) ;
if ( value ) {
n = strlen ( value ) - 1 ;
while ( g_ascii_isspace ( value [ n ] ) ) {
n -- ;
}
g_string_append_len ( info , value , n + 1 ) ;
}
g_string_append_c ( info , '\n' ) ;
g_free ( key ) ;
}
break ;
case PURPLE_NOTIFY_USER_INFO_ENTRY_SECTION_BREAK : g_string_append ( info , "------------------------\n" ) ;
break ;
}
l = l -> next ;
}
imcb_log ( ic , "User %s info:\n%s" , who , info -> str ) ;
g_string_free ( info , TRUE ) ;
return NULL ;
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.