instruction
stringclasses 1
value | input
stringlengths 31
235k
| output
class label 2
classes |
---|---|---|
Categorize the following code snippet as vulnerable or not. True or False
|
int vp9_cyclic_refresh_get_rdmult ( const CYCLIC_REFRESH * cr ) {
return cr -> rdmult ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ff_vdpau_h264_set_reference_frames ( H264Context * h ) {
struct vdpau_render_state * render , * render_ref ;
VdpReferenceFrameH264 * rf , * rf2 ;
Picture * pic ;
int i , list , pic_frame_idx ;
render = ( struct vdpau_render_state * ) h -> cur_pic_ptr -> f . data [ 0 ] ;
assert ( render ) ;
rf = & render -> info . h264 . referenceFrames [ 0 ] ;
# define H264_RF_COUNT FF_ARRAY_ELEMS ( render -> info . h264 . referenceFrames ) for ( list = 0 ;
list < 2 ;
++ list ) {
Picture * * lp = list ? h -> long_ref : h -> short_ref ;
int ls = list ? 16 : h -> short_ref_count ;
for ( i = 0 ;
i < ls ;
++ i ) {
pic = lp [ i ] ;
if ( ! pic || ! pic -> reference ) continue ;
pic_frame_idx = pic -> long_ref ? pic -> pic_id : pic -> frame_num ;
render_ref = ( struct vdpau_render_state * ) pic -> f . data [ 0 ] ;
assert ( render_ref ) ;
rf2 = & render -> info . h264 . referenceFrames [ 0 ] ;
while ( rf2 != rf ) {
if ( ( rf2 -> surface == render_ref -> surface ) && ( rf2 -> is_long_term == pic -> long_ref ) && ( rf2 -> frame_idx == pic_frame_idx ) ) break ;
++ rf2 ;
}
if ( rf2 != rf ) {
rf2 -> top_is_reference |= ( pic -> reference & PICT_TOP_FIELD ) ? VDP_TRUE : VDP_FALSE ;
rf2 -> bottom_is_reference |= ( pic -> reference & PICT_BOTTOM_FIELD ) ? VDP_TRUE : VDP_FALSE ;
continue ;
}
if ( rf >= & render -> info . h264 . referenceFrames [ H264_RF_COUNT ] ) continue ;
rf -> surface = render_ref -> surface ;
rf -> is_long_term = pic -> long_ref ;
rf -> top_is_reference = ( pic -> reference & PICT_TOP_FIELD ) ? VDP_TRUE : VDP_FALSE ;
rf -> bottom_is_reference = ( pic -> reference & PICT_BOTTOM_FIELD ) ? VDP_TRUE : VDP_FALSE ;
rf -> field_order_cnt [ 0 ] = pic -> field_poc [ 0 ] ;
rf -> field_order_cnt [ 1 ] = pic -> field_poc [ 1 ] ;
rf -> frame_idx = pic_frame_idx ;
++ rf ;
}
}
for ( ;
rf < & render -> info . h264 . referenceFrames [ H264_RF_COUNT ] ;
++ rf ) {
rf -> surface = VDP_INVALID_HANDLE ;
rf -> is_long_term = 0 ;
rf -> top_is_reference = 0 ;
rf -> bottom_is_reference = 0 ;
rf -> field_order_cnt [ 0 ] = 0 ;
rf -> field_order_cnt [ 1 ] = 0 ;
rf -> frame_idx = 0 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_sad ## m ## x ## n ## x4d_c ( const uint8_t * src , int src_stride , const uint8_t * const refs [ ] , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < 4 ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , refs [ i ] , ref_stride ) ;
\ }
sadMxN ( 64 , 64 ) sadMxNxK ( 64 , 64 , 3 ) sadMxNxK ( 64 , 64 , 8 ) sadMxNx4D ( 64 , 64 ) sadMxN ( 64 , 32 ) sadMxNx4D ( 64 , 32 ) sadMxN ( 32 , 64 ) sadMxNx4D ( 32 , 64 ) sadMxN ( 32 , 32 ) sadMxNxK ( 32 , 32 , 3 ) sadMxNxK ( 32 , 32 , 8 ) sadMxNx4D ( 32 , 32 ) sadMxN ( 32 , 16 ) sadMxNx4D ( 32 , 16 ) sadMxN ( 16 , 32 ) sadMxNx4D ( 16 , 32 ) sadMxN ( 16 , 16 ) sadMxNxK ( 16 , 16 , 3 ) sadMxNxK ( 16 , 16 , 8 ) sadMxNx4D ( 16 , 16 ) sadMxN ( 16 , 8 ) sadMxNxK ( 16 , 8 , 3 ) sadMxNxK ( 16 , 8 , 8 ) sadMxNx4D ( 16 , 8 ) sadMxN ( 8 , 16 ) sadMxNxK ( 8 , 16 , 3 ) sadMxNxK ( 8 , 16 , 8 ) sadMxNx4D ( 8 , 16 ) sadMxN ( 8 , 8 ) sadMxNxK ( 8 , 8 , 3 ) sadMxNxK ( 8 , 8 , 8 ) sadMxNx4D ( 8 , 8 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_scale_factors ( WMAProDecodeCtx * s ) {
int i ;
for ( i = 0 ;
i < s -> channels_for_cur_subframe ;
i ++ ) {
int c = s -> channel_indexes_for_cur_subframe [ i ] ;
int * sf ;
int * sf_end ;
s -> channel [ c ] . scale_factors = s -> channel [ c ] . saved_scale_factors [ ! s -> channel [ c ] . scale_factor_idx ] ;
sf_end = s -> channel [ c ] . scale_factors + s -> num_bands ;
if ( s -> channel [ c ] . reuse_sf ) {
const int8_t * sf_offsets = s -> sf_offsets [ s -> table_idx ] [ s -> channel [ c ] . table_idx ] ;
int b ;
for ( b = 0 ;
b < s -> num_bands ;
b ++ ) s -> channel [ c ] . scale_factors [ b ] = s -> channel [ c ] . saved_scale_factors [ s -> channel [ c ] . scale_factor_idx ] [ * sf_offsets ++ ] ;
}
if ( ! s -> channel [ c ] . cur_subframe || get_bits1 ( & s -> gb ) ) {
if ( ! s -> channel [ c ] . reuse_sf ) {
int val ;
s -> channel [ c ] . scale_factor_step = get_bits ( & s -> gb , 2 ) + 1 ;
val = 45 / s -> channel [ c ] . scale_factor_step ;
for ( sf = s -> channel [ c ] . scale_factors ;
sf < sf_end ;
sf ++ ) {
val += get_vlc2 ( & s -> gb , sf_vlc . table , SCALEVLCBITS , SCALEMAXDEPTH ) - 60 ;
* sf = val ;
}
}
else {
int i ;
for ( i = 0 ;
i < s -> num_bands ;
i ++ ) {
int idx ;
int skip ;
int val ;
int sign ;
idx = get_vlc2 ( & s -> gb , sf_rl_vlc . table , VLCBITS , SCALERLMAXDEPTH ) ;
if ( ! idx ) {
uint32_t code = get_bits ( & s -> gb , 14 ) ;
val = code >> 6 ;
sign = ( code & 1 ) - 1 ;
skip = ( code & 0x3f ) >> 1 ;
}
else if ( idx == 1 ) {
break ;
}
else {
skip = scale_rl_run [ idx ] ;
val = scale_rl_level [ idx ] ;
sign = get_bits1 ( & s -> gb ) - 1 ;
}
i += skip ;
if ( i >= s -> num_bands ) {
av_log ( s -> avctx , AV_LOG_ERROR , "invalid scale factor coding\n" ) ;
return AVERROR_INVALIDDATA ;
}
s -> channel [ c ] . scale_factors [ i ] += ( val ^ sign ) - sign ;
}
}
s -> channel [ c ] . scale_factor_idx = ! s -> channel [ c ] . scale_factor_idx ;
s -> channel [ c ] . table_idx = s -> table_idx ;
s -> channel [ c ] . reuse_sf = 1 ;
}
s -> channel [ c ] . max_scale_factor = s -> channel [ c ] . scale_factors [ 0 ] ;
for ( sf = s -> channel [ c ] . scale_factors + 1 ;
sf < sf_end ;
sf ++ ) {
s -> channel [ c ] . max_scale_factor = FFMAX ( s -> channel [ c ] . max_scale_factor , * sf ) ;
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void idct8 ( const tran_low_t * input , tran_low_t * output ) {
tran_low_t step1 [ 8 ] , step2 [ 8 ] ;
tran_high_t temp1 , temp2 ;
step1 [ 0 ] = input [ 0 ] ;
step1 [ 2 ] = input [ 4 ] ;
step1 [ 1 ] = input [ 2 ] ;
step1 [ 3 ] = input [ 6 ] ;
temp1 = input [ 1 ] * cospi_28_64 - input [ 7 ] * cospi_4_64 ;
temp2 = input [ 1 ] * cospi_4_64 + input [ 7 ] * cospi_28_64 ;
step1 [ 4 ] = dct_const_round_shift ( temp1 ) ;
step1 [ 7 ] = dct_const_round_shift ( temp2 ) ;
temp1 = input [ 5 ] * cospi_12_64 - input [ 3 ] * cospi_20_64 ;
temp2 = input [ 5 ] * cospi_20_64 + input [ 3 ] * cospi_12_64 ;
step1 [ 5 ] = dct_const_round_shift ( temp1 ) ;
step1 [ 6 ] = dct_const_round_shift ( temp2 ) ;
idct4 ( step1 , step1 ) ;
step2 [ 4 ] = step1 [ 4 ] + step1 [ 5 ] ;
step2 [ 5 ] = step1 [ 4 ] - step1 [ 5 ] ;
step2 [ 6 ] = - step1 [ 6 ] + step1 [ 7 ] ;
step2 [ 7 ] = step1 [ 6 ] + step1 [ 7 ] ;
step1 [ 4 ] = step2 [ 4 ] ;
temp1 = ( step2 [ 6 ] - step2 [ 5 ] ) * cospi_16_64 ;
temp2 = ( step2 [ 5 ] + step2 [ 6 ] ) * cospi_16_64 ;
step1 [ 5 ] = dct_const_round_shift ( temp1 ) ;
step1 [ 6 ] = dct_const_round_shift ( temp2 ) ;
step1 [ 7 ] = step2 [ 7 ] ;
output [ 0 ] = step1 [ 0 ] + step1 [ 7 ] ;
output [ 1 ] = step1 [ 1 ] + step1 [ 6 ] ;
output [ 2 ] = step1 [ 2 ] + step1 [ 5 ] ;
output [ 3 ] = step1 [ 3 ] + step1 [ 4 ] ;
output [ 4 ] = step1 [ 3 ] - step1 [ 4 ] ;
output [ 5 ] = step1 [ 2 ] - step1 [ 5 ] ;
output [ 6 ] = step1 [ 1 ] - step1 [ 6 ] ;
output [ 7 ] = step1 [ 0 ] - step1 [ 7 ] ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ff_mpeg_update_thread_context ( AVCodecContext * dst , const AVCodecContext * src ) {
int i , ret ;
MpegEncContext * s = dst -> priv_data , * s1 = src -> priv_data ;
if ( dst == src || ! s1 -> context_initialized ) return 0 ;
if ( ! s -> context_initialized ) {
memcpy ( s , s1 , sizeof ( MpegEncContext ) ) ;
s -> avctx = dst ;
s -> bitstream_buffer = NULL ;
s -> bitstream_buffer_size = s -> allocated_bitstream_buffer_size = 0 ;
ff_MPV_common_init ( s ) ;
}
if ( s -> height != s1 -> height || s -> width != s1 -> width || s -> context_reinit ) {
int err ;
s -> context_reinit = 0 ;
s -> height = s1 -> height ;
s -> width = s1 -> width ;
if ( ( err = ff_MPV_common_frame_size_change ( s ) ) < 0 ) return err ;
}
s -> avctx -> coded_height = s1 -> avctx -> coded_height ;
s -> avctx -> coded_width = s1 -> avctx -> coded_width ;
s -> avctx -> width = s1 -> avctx -> width ;
s -> avctx -> height = s1 -> avctx -> height ;
s -> coded_picture_number = s1 -> coded_picture_number ;
s -> picture_number = s1 -> picture_number ;
s -> input_picture_number = s1 -> input_picture_number ;
for ( i = 0 ;
i < MAX_PICTURE_COUNT ;
i ++ ) {
ff_mpeg_unref_picture ( s , & s -> picture [ i ] ) ;
if ( s1 -> picture [ i ] . f . data [ 0 ] && ( ret = ff_mpeg_ref_picture ( s , & s -> picture [ i ] , & s1 -> picture [ i ] ) ) < 0 ) return ret ;
}
# define UPDATE_PICTURE ( pic ) do {
ff_mpeg_unref_picture ( s , & s -> pic ) ;
if ( s1 -> pic . f . data [ 0 ] ) ret = ff_mpeg_ref_picture ( s , & s -> pic , & s1 -> pic ) ;
else ret = update_picture_tables ( & s -> pic , & s1 -> pic ) ;
if ( ret < 0 ) return ret ;
\ }
while ( 0 ) UPDATE_PICTURE ( current_picture ) ;
UPDATE_PICTURE ( last_picture ) ;
UPDATE_PICTURE ( next_picture ) ;
s -> last_picture_ptr = REBASE_PICTURE ( s1 -> last_picture_ptr , s , s1 ) ;
s -> current_picture_ptr = REBASE_PICTURE ( s1 -> current_picture_ptr , s , s1 ) ;
s -> next_picture_ptr = REBASE_PICTURE ( s1 -> next_picture_ptr , s , s1 ) ;
s -> next_p_frame_damaged = s1 -> next_p_frame_damaged ;
s -> workaround_bugs = s1 -> workaround_bugs ;
memcpy ( & s -> time_increment_bits , & s1 -> time_increment_bits , ( char * ) & s1 -> shape - ( char * ) & s1 -> time_increment_bits ) ;
s -> max_b_frames = s1 -> max_b_frames ;
s -> low_delay = s1 -> low_delay ;
s -> droppable = s1 -> droppable ;
s -> divx_packed = s1 -> divx_packed ;
if ( s1 -> bitstream_buffer ) {
if ( s1 -> bitstream_buffer_size + FF_INPUT_BUFFER_PADDING_SIZE > s -> allocated_bitstream_buffer_size ) av_fast_malloc ( & s -> bitstream_buffer , & s -> allocated_bitstream_buffer_size , s1 -> allocated_bitstream_buffer_size ) ;
s -> bitstream_buffer_size = s1 -> bitstream_buffer_size ;
memcpy ( s -> bitstream_buffer , s1 -> bitstream_buffer , s1 -> bitstream_buffer_size ) ;
memset ( s -> bitstream_buffer + s -> bitstream_buffer_size , 0 , FF_INPUT_BUFFER_PADDING_SIZE ) ;
}
if ( ! s -> edge_emu_buffer ) if ( s1 -> linesize ) {
if ( ff_mpv_frame_size_alloc ( s , s1 -> linesize ) < 0 ) {
av_log ( s -> avctx , AV_LOG_ERROR , "Failed to allocate context " "scratch buffers.\n" ) ;
return AVERROR ( ENOMEM ) ;
}
}
else {
av_log ( s -> avctx , AV_LOG_ERROR , "Context scratch buffers could not " "be allocated due to unknown size.\n" ) ;
return AVERROR_BUG ;
}
memcpy ( & s -> progressive_sequence , & s1 -> progressive_sequence , ( char * ) & s1 -> rtp_mode - ( char * ) & s1 -> progressive_sequence ) ;
if ( ! s1 -> first_field ) {
s -> last_pict_type = s1 -> pict_type ;
if ( s1 -> current_picture_ptr ) s -> last_lambda_for [ s1 -> pict_type ] = s1 -> current_picture_ptr -> f . quality ;
if ( s1 -> pict_type != AV_PICTURE_TYPE_B ) {
s -> last_non_b_pict_type = s1 -> pict_type ;
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
Oid get_element_type ( Oid typid ) {
HeapTuple tp ;
tp = SearchSysCache1 ( TYPEOID , ObjectIdGetDatum ( typid ) ) ;
if ( HeapTupleIsValid ( tp ) ) {
Form_pg_type typtup = ( Form_pg_type ) GETSTRUCT ( tp ) ;
Oid result ;
if ( typtup -> typlen == - 1 ) result = typtup -> typelem ;
else result = InvalidOid ;
ReleaseSysCache ( tp ) ;
return result ;
}
else return InvalidOid ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void mainwindows_redraw_dirty ( void ) {
GSList * tmp ;
for ( tmp = mainwindows ;
tmp != NULL ;
tmp = tmp -> next ) {
MAIN_WINDOW_REC * rec = tmp -> data ;
if ( rec -> size_dirty ) {
rec -> size_dirty = FALSE ;
mainwindow_resize_windows ( rec ) ;
}
if ( rec -> dirty ) {
rec -> dirty = FALSE ;
gui_window_redraw ( rec -> active ) ;
}
else if ( WINDOW_GUI ( rec -> active ) -> view -> dirty ) {
gui_window_redraw ( rec -> active ) ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int get_consumed_bytes ( int pos , int buf_size ) {
if ( pos == 0 ) pos = 1 ;
if ( pos + 10 > buf_size ) pos = buf_size ;
return pos ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
RegProcedure get_oprrest ( Oid opno ) {
HeapTuple tp ;
tp = SearchSysCache1 ( OPEROID , ObjectIdGetDatum ( opno ) ) ;
if ( HeapTupleIsValid ( tp ) ) {
Form_pg_operator optup = ( Form_pg_operator ) GETSTRUCT ( tp ) ;
RegProcedure result ;
result = optup -> oprrest ;
ReleaseSysCache ( tp ) ;
return result ;
}
else return ( RegProcedure ) InvalidOid ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean gsm_a_dtap_ss_stat_packet ( void * tapdata , packet_info * pinfo _U_ , epan_dissect_t * edt _U_ , const void * gatr_ptr ) {
return gsm_a_stat_packet ( tapdata , gatr_ptr , BSSAP_PDU_TYPE_DTAP , PD_SS ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ssl3_pending ( const SSL * s ) {
if ( s -> rstate == SSL_ST_READ_BODY ) return 0 ;
return ( s -> s3 -> rrec . type == SSL3_RT_APPLICATION_DATA ) ? s -> s3 -> rrec . length : 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool iswheel ( const char * username ) {
struct group * grp ;
grp = getgrnam ( "wheel" ) ;
if ( ( NULL == grp ) || ( NULL == grp -> gr_mem ) ) {
return false ;
}
return is_on_list ( grp -> gr_mem , username ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ivi_create_huff_from_desc ( const IVIHuffDesc * cb , VLC * vlc , int flag ) {
int pos , i , j , codes_per_row , prefix , not_last_row ;
uint16_t codewords [ 256 ] ;
uint8_t bits [ 256 ] ;
pos = 0 ;
for ( i = 0 ;
i < cb -> num_rows ;
i ++ ) {
codes_per_row = 1 << cb -> xbits [ i ] ;
not_last_row = ( i != cb -> num_rows - 1 ) ;
prefix = ( ( 1 << i ) - 1 ) << ( cb -> xbits [ i ] + not_last_row ) ;
for ( j = 0 ;
j < codes_per_row ;
j ++ ) {
if ( pos >= 256 ) break ;
bits [ pos ] = i + cb -> xbits [ i ] + not_last_row ;
if ( bits [ pos ] > IVI_VLC_BITS ) return - 1 ;
codewords [ pos ] = inv_bits ( ( prefix | j ) , bits [ pos ] ) ;
if ( ! bits [ pos ] ) bits [ pos ] = 1 ;
pos ++ ;
}
}
return init_vlc ( vlc , IVI_VLC_BITS , pos , bits , 1 , 1 , codewords , 2 , 2 , ( flag ? INIT_VLC_USE_NEW_STATIC : 0 ) | INIT_VLC_LE ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int matroska_parse_tracks ( AVFormatContext * s ) {
MatroskaDemuxContext * matroska = s -> priv_data ;
MatroskaTrack * tracks = matroska -> tracks . elem ;
AVStream * st ;
int i , j , ret ;
for ( i = 0 ;
i < matroska -> tracks . nb_elem ;
i ++ ) {
MatroskaTrack * track = & tracks [ i ] ;
enum AVCodecID codec_id = AV_CODEC_ID_NONE ;
EbmlList * encodings_list = & track -> encodings ;
MatroskaTrackEncoding * encodings = encodings_list -> elem ;
uint8_t * extradata = NULL ;
int extradata_size = 0 ;
int extradata_offset = 0 ;
AVIOContext b ;
if ( track -> type != MATROSKA_TRACK_TYPE_VIDEO && track -> type != MATROSKA_TRACK_TYPE_AUDIO && track -> type != MATROSKA_TRACK_TYPE_SUBTITLE ) {
av_log ( matroska -> ctx , AV_LOG_INFO , "Unknown or unsupported track type %" PRIu64 "\n" , track -> type ) ;
continue ;
}
if ( ! track -> codec_id ) continue ;
if ( track -> type == MATROSKA_TRACK_TYPE_VIDEO ) {
if ( ! track -> default_duration && track -> video . frame_rate > 0 ) track -> default_duration = 1000000000 / track -> video . frame_rate ;
if ( ! track -> video . display_width ) track -> video . display_width = track -> video . pixel_width ;
if ( ! track -> video . display_height ) track -> video . display_height = track -> video . pixel_height ;
}
else if ( track -> type == MATROSKA_TRACK_TYPE_AUDIO ) {
if ( ! track -> audio . out_samplerate ) track -> audio . out_samplerate = track -> audio . samplerate ;
}
if ( encodings_list -> nb_elem > 1 ) {
av_log ( matroska -> ctx , AV_LOG_ERROR , "Multiple combined encodings not supported" ) ;
}
else if ( encodings_list -> nb_elem == 1 ) {
if ( encodings [ 0 ] . type || ( # if CONFIG_ZLIB encodings [ 0 ] . compression . algo != MATROSKA_TRACK_ENCODING_COMP_ZLIB && # endif # if CONFIG_BZLIB encodings [ 0 ] . compression . algo != MATROSKA_TRACK_ENCODING_COMP_BZLIB && # endif # if CONFIG_LZO encodings [ 0 ] . compression . algo != MATROSKA_TRACK_ENCODING_COMP_LZO && # endif encodings [ 0 ] . compression . algo != MATROSKA_TRACK_ENCODING_COMP_HEADERSTRIP ) ) {
encodings [ 0 ] . scope = 0 ;
av_log ( matroska -> ctx , AV_LOG_ERROR , "Unsupported encoding type" ) ;
}
else if ( track -> codec_priv . size && encodings [ 0 ] . scope & 2 ) {
uint8_t * codec_priv = track -> codec_priv . data ;
int ret = matroska_decode_buffer ( & track -> codec_priv . data , & track -> codec_priv . size , track ) ;
if ( ret < 0 ) {
track -> codec_priv . data = NULL ;
track -> codec_priv . size = 0 ;
av_log ( matroska -> ctx , AV_LOG_ERROR , "Failed to decode codec private data\n" ) ;
}
if ( codec_priv != track -> codec_priv . data ) av_free ( codec_priv ) ;
}
}
for ( j = 0 ;
ff_mkv_codec_tags [ j ] . id != AV_CODEC_ID_NONE ;
j ++ ) {
if ( ! strncmp ( ff_mkv_codec_tags [ j ] . str , track -> codec_id , strlen ( ff_mkv_codec_tags [ j ] . str ) ) ) {
codec_id = ff_mkv_codec_tags [ j ] . id ;
break ;
}
}
st = track -> stream = avformat_new_stream ( s , NULL ) ;
if ( ! st ) return AVERROR ( ENOMEM ) ;
if ( ! strcmp ( track -> codec_id , "V_MS/VFW/FOURCC" ) && track -> codec_priv . size >= 40 && track -> codec_priv . data ) {
track -> ms_compat = 1 ;
track -> video . fourcc = AV_RL32 ( track -> codec_priv . data + 16 ) ;
codec_id = ff_codec_get_id ( ff_codec_bmp_tags , track -> video . fourcc ) ;
extradata_offset = 40 ;
}
else if ( ! strcmp ( track -> codec_id , "A_MS/ACM" ) && track -> codec_priv . size >= 14 && track -> codec_priv . data ) {
int ret ;
ffio_init_context ( & b , track -> codec_priv . data , track -> codec_priv . size , 0 , NULL , NULL , NULL , NULL ) ;
ret = ff_get_wav_header ( & b , st -> codec , track -> codec_priv . size ) ;
if ( ret < 0 ) return ret ;
codec_id = st -> codec -> codec_id ;
extradata_offset = FFMIN ( track -> codec_priv . size , 18 ) ;
}
else if ( ! strcmp ( track -> codec_id , "V_QUICKTIME" ) && ( track -> codec_priv . size >= 86 ) && ( track -> codec_priv . data ) ) {
track -> video . fourcc = AV_RL32 ( track -> codec_priv . data ) ;
codec_id = ff_codec_get_id ( ff_codec_movvideo_tags , track -> video . fourcc ) ;
}
else if ( codec_id == AV_CODEC_ID_PCM_S16BE ) {
switch ( track -> audio . bitdepth ) {
case 8 : codec_id = AV_CODEC_ID_PCM_U8 ;
break ;
case 24 : codec_id = AV_CODEC_ID_PCM_S24BE ;
break ;
case 32 : codec_id = AV_CODEC_ID_PCM_S32BE ;
break ;
}
}
else if ( codec_id == AV_CODEC_ID_PCM_S16LE ) {
switch ( track -> audio . bitdepth ) {
case 8 : codec_id = AV_CODEC_ID_PCM_U8 ;
break ;
case 24 : codec_id = AV_CODEC_ID_PCM_S24LE ;
break ;
case 32 : codec_id = AV_CODEC_ID_PCM_S32LE ;
break ;
}
}
else if ( codec_id == AV_CODEC_ID_PCM_F32LE && track -> audio . bitdepth == 64 ) {
codec_id = AV_CODEC_ID_PCM_F64LE ;
}
else if ( codec_id == AV_CODEC_ID_AAC && ! track -> codec_priv . size ) {
int profile = matroska_aac_profile ( track -> codec_id ) ;
int sri = matroska_aac_sri ( track -> audio . samplerate ) ;
extradata = av_mallocz ( 5 + FF_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! extradata ) return AVERROR ( ENOMEM ) ;
extradata [ 0 ] = ( profile << 3 ) | ( ( sri & 0x0E ) >> 1 ) ;
extradata [ 1 ] = ( ( sri & 0x01 ) << 7 ) | ( track -> audio . channels << 3 ) ;
if ( strstr ( track -> codec_id , "SBR" ) ) {
sri = matroska_aac_sri ( track -> audio . out_samplerate ) ;
extradata [ 2 ] = 0x56 ;
extradata [ 3 ] = 0xE5 ;
extradata [ 4 ] = 0x80 | ( sri << 3 ) ;
extradata_size = 5 ;
}
else extradata_size = 2 ;
}
else if ( codec_id == AV_CODEC_ID_ALAC && track -> codec_priv . size ) {
extradata_size = 12 + track -> codec_priv . size ;
extradata = av_mallocz ( extradata_size + FF_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! extradata ) return AVERROR ( ENOMEM ) ;
AV_WB32 ( extradata , extradata_size ) ;
memcpy ( & extradata [ 4 ] , "alac" , 4 ) ;
AV_WB32 ( & extradata [ 8 ] , 0 ) ;
memcpy ( & extradata [ 12 ] , track -> codec_priv . data , track -> codec_priv . size ) ;
}
else if ( codec_id == AV_CODEC_ID_TTA ) {
extradata_size = 30 ;
extradata = av_mallocz ( extradata_size ) ;
if ( ! extradata ) return AVERROR ( ENOMEM ) ;
ffio_init_context ( & b , extradata , extradata_size , 1 , NULL , NULL , NULL , NULL ) ;
avio_write ( & b , "TTA1" , 4 ) ;
avio_wl16 ( & b , 1 ) ;
avio_wl16 ( & b , track -> audio . channels ) ;
avio_wl16 ( & b , track -> audio . bitdepth ) ;
avio_wl32 ( & b , track -> audio . out_samplerate ) ;
avio_wl32 ( & b , matroska -> ctx -> duration * track -> audio . out_samplerate ) ;
}
else if ( codec_id == AV_CODEC_ID_RV10 || codec_id == AV_CODEC_ID_RV20 || codec_id == AV_CODEC_ID_RV30 || codec_id == AV_CODEC_ID_RV40 ) {
extradata_offset = 26 ;
}
else if ( codec_id == AV_CODEC_ID_RA_144 ) {
track -> audio . out_samplerate = 8000 ;
track -> audio . channels = 1 ;
}
else if ( codec_id == AV_CODEC_ID_RA_288 || codec_id == AV_CODEC_ID_COOK || codec_id == AV_CODEC_ID_ATRAC3 || codec_id == AV_CODEC_ID_SIPR ) {
int flavor ;
ffio_init_context ( & b , track -> codec_priv . data , track -> codec_priv . size , 0 , NULL , NULL , NULL , NULL ) ;
avio_skip ( & b , 22 ) ;
flavor = avio_rb16 ( & b ) ;
track -> audio . coded_framesize = avio_rb32 ( & b ) ;
avio_skip ( & b , 12 ) ;
track -> audio . sub_packet_h = avio_rb16 ( & b ) ;
track -> audio . frame_size = avio_rb16 ( & b ) ;
track -> audio . sub_packet_size = avio_rb16 ( & b ) ;
if ( flavor <= 0 || track -> audio . coded_framesize <= 0 || track -> audio . sub_packet_h <= 0 || track -> audio . frame_size <= 0 || track -> audio . sub_packet_size <= 0 ) return AVERROR_INVALIDDATA ;
track -> audio . buf = av_malloc ( track -> audio . frame_size * track -> audio . sub_packet_h ) ;
if ( codec_id == AV_CODEC_ID_RA_288 ) {
st -> codec -> block_align = track -> audio . coded_framesize ;
track -> codec_priv . size = 0 ;
}
else {
if ( codec_id == AV_CODEC_ID_SIPR && flavor < 4 ) {
const int sipr_bit_rate [ 4 ] = {
6504 , 8496 , 5000 , 16000 }
;
track -> audio . sub_packet_size = ff_sipr_subpk_size [ flavor ] ;
st -> codec -> bit_rate = sipr_bit_rate [ flavor ] ;
}
st -> codec -> block_align = track -> audio . sub_packet_size ;
extradata_offset = 78 ;
}
}
else if ( codec_id == AV_CODEC_ID_FLAC && track -> codec_priv . size ) {
ret = matroska_parse_flac ( s , track , & extradata_offset ) ;
if ( ret < 0 ) return ret ;
}
track -> codec_priv . size -= extradata_offset ;
if ( codec_id == AV_CODEC_ID_NONE ) av_log ( matroska -> ctx , AV_LOG_INFO , "Unknown/unsupported AVCodecID %s.\n" , track -> codec_id ) ;
if ( track -> time_scale < 0.01 ) track -> time_scale = 1.0 ;
avpriv_set_pts_info ( st , 64 , matroska -> time_scale * track -> time_scale , 1000 * 1000 * 1000 ) ;
track -> codec_delay = av_rescale_q ( track -> codec_delay , ( AVRational ) {
1 , 1000000000 }
, st -> time_base ) ;
st -> codec -> codec_id = codec_id ;
st -> start_time = 0 ;
if ( strcmp ( track -> language , "und" ) ) av_dict_set ( & st -> metadata , "language" , track -> language , 0 ) ;
av_dict_set ( & st -> metadata , "title" , track -> name , 0 ) ;
if ( track -> flag_default ) st -> disposition |= AV_DISPOSITION_DEFAULT ;
if ( track -> flag_forced ) st -> disposition |= AV_DISPOSITION_FORCED ;
if ( ! st -> codec -> extradata ) {
if ( extradata ) {
st -> codec -> extradata = extradata ;
st -> codec -> extradata_size = extradata_size ;
}
else if ( track -> codec_priv . data && track -> codec_priv . size > 0 ) {
st -> codec -> extradata = av_mallocz ( track -> codec_priv . size + FF_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! st -> codec -> extradata ) return AVERROR ( ENOMEM ) ;
st -> codec -> extradata_size = track -> codec_priv . size ;
memcpy ( st -> codec -> extradata , track -> codec_priv . data + extradata_offset , track -> codec_priv . size ) ;
}
}
if ( track -> type == MATROSKA_TRACK_TYPE_VIDEO ) {
st -> codec -> codec_type = AVMEDIA_TYPE_VIDEO ;
st -> codec -> codec_tag = track -> video . fourcc ;
st -> codec -> width = track -> video . pixel_width ;
st -> codec -> height = track -> video . pixel_height ;
av_reduce ( & st -> sample_aspect_ratio . num , & st -> sample_aspect_ratio . den , st -> codec -> height * track -> video . display_width , st -> codec -> width * track -> video . display_height , 255 ) ;
if ( st -> codec -> codec_id != AV_CODEC_ID_H264 && st -> codec -> codec_id != AV_CODEC_ID_HEVC ) st -> need_parsing = AVSTREAM_PARSE_HEADERS ;
if ( track -> default_duration ) {
av_reduce ( & st -> avg_frame_rate . num , & st -> avg_frame_rate . den , 1000000000 , track -> default_duration , 30000 ) ;
}
if ( track -> video . stereo_mode < MATROSKA_VIDEO_STEREOMODE_TYPE_NB && track -> video . stereo_mode != 10 && track -> video . stereo_mode != 12 ) {
int ret = ff_mkv_stereo3d_conv ( st , track -> video . stereo_mode ) ;
if ( ret < 0 ) return ret ;
}
}
else if ( track -> type == MATROSKA_TRACK_TYPE_AUDIO ) {
st -> codec -> codec_type = AVMEDIA_TYPE_AUDIO ;
st -> codec -> sample_rate = track -> audio . out_samplerate ;
st -> codec -> channels = track -> audio . channels ;
if ( st -> codec -> codec_id != AV_CODEC_ID_AAC ) st -> need_parsing = AVSTREAM_PARSE_HEADERS ;
}
else if ( track -> type == MATROSKA_TRACK_TYPE_SUBTITLE ) {
st -> codec -> codec_type = AVMEDIA_TYPE_SUBTITLE ;
if ( st -> codec -> codec_id == AV_CODEC_ID_SSA ) matroska -> contains_ssa = 1 ;
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
GList * completion_get_aliases ( const char * word ) {
CONFIG_NODE * node ;
GList * list ;
GSList * tmp ;
int len ;
g_return_val_if_fail ( word != NULL , NULL ) ;
len = strlen ( word ) ;
list = NULL ;
node = iconfig_node_traverse ( "aliases" , FALSE ) ;
tmp = node == NULL ? NULL : config_node_first ( node -> value ) ;
for ( ;
tmp != NULL ;
tmp = config_node_next ( tmp ) ) {
node = tmp -> data ;
if ( node -> type != NODE_TYPE_KEY ) continue ;
if ( len != 0 && g_ascii_strncasecmp ( node -> key , word , len ) != 0 ) continue ;
list = g_list_append ( list , g_strdup ( node -> key ) ) ;
}
return list ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( PageLoadMetricsBrowserTest , NoPaintForEmptyDocumentInChildFrame ) {
ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ;
GURL a_url ( embedded_test_server ( ) -> GetURL ( "/page_load_metrics/empty_iframe.html" ) ) ;
auto waiter = CreatePageLoadMetricsWaiter ( ) ;
waiter -> AddPageExpectation ( TimingField : : FIRST_LAYOUT ) ;
waiter -> AddPageExpectation ( TimingField : : LOAD_EVENT ) ;
waiter -> AddSubFrameExpectation ( TimingField : : FIRST_LAYOUT ) ;
waiter -> AddSubFrameExpectation ( TimingField : : LOAD_EVENT ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , a_url ) ;
waiter -> Wait ( ) ;
EXPECT_FALSE ( waiter -> DidObserveInPage ( TimingField : : FIRST_PAINT ) ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHistogramFirstLayout , 1 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHistogramLoad , 1 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHistogramFirstPaint , 0 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHistogramFirstContentfulPaint , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static PGconn * connectDatabase ( const char * dbname , const char * connection_string , const char * pghost , const char * pgport , const char * pguser , trivalue prompt_password , bool fail_on_error ) {
PGconn * conn ;
bool new_pass ;
const char * remoteversion_str ;
int my_version ;
static char * password = NULL ;
const char * * keywords = NULL ;
const char * * values = NULL ;
PQconninfoOption * conn_opts = NULL ;
if ( prompt_password == TRI_YES && ! password ) password = simple_prompt ( "Password: " , 100 , false ) ;
do {
int argcount = 6 ;
PQconninfoOption * conn_opt ;
char * err_msg = NULL ;
int i = 0 ;
if ( keywords ) free ( keywords ) ;
if ( values ) free ( values ) ;
if ( conn_opts ) PQconninfoFree ( conn_opts ) ;
if ( connection_string ) {
conn_opts = PQconninfoParse ( connection_string , & err_msg ) ;
if ( conn_opts == NULL ) {
fprintf ( stderr , "%s: %s" , progname , err_msg ) ;
exit_nicely ( 1 ) ;
}
for ( conn_opt = conn_opts ;
conn_opt -> keyword != NULL ;
conn_opt ++ ) {
if ( conn_opt -> val != NULL && conn_opt -> val [ 0 ] != '\0' ) argcount ++ ;
}
keywords = pg_malloc0 ( ( argcount + 1 ) * sizeof ( * keywords ) ) ;
values = pg_malloc0 ( ( argcount + 1 ) * sizeof ( * values ) ) ;
for ( conn_opt = conn_opts ;
conn_opt -> keyword != NULL ;
conn_opt ++ ) {
if ( conn_opt -> val != NULL && conn_opt -> val [ 0 ] != '\0' ) {
keywords [ i ] = conn_opt -> keyword ;
values [ i ] = conn_opt -> val ;
i ++ ;
}
}
}
else {
keywords = pg_malloc0 ( ( argcount + 1 ) * sizeof ( * keywords ) ) ;
values = pg_malloc0 ( ( argcount + 1 ) * sizeof ( * values ) ) ;
}
if ( pghost ) {
keywords [ i ] = "host" ;
values [ i ] = pghost ;
i ++ ;
}
if ( pgport ) {
keywords [ i ] = "port" ;
values [ i ] = pgport ;
i ++ ;
}
if ( pguser ) {
keywords [ i ] = "user" ;
values [ i ] = pguser ;
i ++ ;
}
if ( password ) {
keywords [ i ] = "password" ;
values [ i ] = password ;
i ++ ;
}
if ( dbname ) {
keywords [ i ] = "dbname" ;
values [ i ] = dbname ;
i ++ ;
}
keywords [ i ] = "fallback_application_name" ;
values [ i ] = progname ;
i ++ ;
new_pass = false ;
conn = PQconnectdbParams ( keywords , values , true ) ;
if ( ! conn ) {
fprintf ( stderr , _ ( "%s: could not connect to database \"%s\"\n" ) , progname , dbname ) ;
exit_nicely ( 1 ) ;
}
if ( PQstatus ( conn ) == CONNECTION_BAD && PQconnectionNeedsPassword ( conn ) && password == NULL && prompt_password != TRI_NO ) {
PQfinish ( conn ) ;
password = simple_prompt ( "Password: " , 100 , false ) ;
new_pass = true ;
}
}
while ( new_pass ) ;
if ( PQstatus ( conn ) == CONNECTION_BAD ) {
if ( fail_on_error ) {
fprintf ( stderr , _ ( "%s: could not connect to database \"%s\": %s\n" ) , progname , dbname , PQerrorMessage ( conn ) ) ;
exit_nicely ( 1 ) ;
}
else {
PQfinish ( conn ) ;
free ( keywords ) ;
free ( values ) ;
PQconninfoFree ( conn_opts ) ;
return NULL ;
}
}
connstr = constructConnStr ( keywords , values ) ;
free ( keywords ) ;
free ( values ) ;
PQconninfoFree ( conn_opts ) ;
remoteversion_str = PQparameterStatus ( conn , "server_version" ) ;
if ( ! remoteversion_str ) {
fprintf ( stderr , _ ( "%s: could not get server version\n" ) , progname ) ;
exit_nicely ( 1 ) ;
}
server_version = PQserverVersion ( conn ) ;
if ( server_version == 0 ) {
fprintf ( stderr , _ ( "%s: could not parse server version \"%s\"\n" ) , progname , remoteversion_str ) ;
exit_nicely ( 1 ) ;
}
my_version = PG_VERSION_NUM ;
if ( my_version != server_version && ( server_version < 70000 || ( server_version / 100 ) > ( my_version / 100 ) ) ) {
fprintf ( stderr , _ ( "server version: %s;
%s version: %s\n" ) , remoteversion_str , progname , PG_VERSION ) ;
fprintf ( stderr , _ ( "aborting because of server version mismatch\n" ) ) ;
exit_nicely ( 1 ) ;
}
if ( server_version >= 70300 ) executeCommand ( conn , "SET search_path = pg_catalog" ) ;
return conn ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void eval_ir ( const float * Az , int pitch_lag , float * freq , float pitch_sharp_factor ) {
float tmp1 [ SUBFR_SIZE + 1 ] , tmp2 [ LP_FILTER_ORDER + 1 ] ;
int i ;
tmp1 [ 0 ] = 1. ;
for ( i = 0 ;
i < LP_FILTER_ORDER ;
i ++ ) {
tmp1 [ i + 1 ] = Az [ i ] * ff_pow_0_55 [ i ] ;
tmp2 [ i ] = Az [ i ] * ff_pow_0_7 [ i ] ;
}
memset ( tmp1 + 11 , 0 , 37 * sizeof ( float ) ) ;
ff_celp_lp_synthesis_filterf ( freq , tmp2 , tmp1 , SUBFR_SIZE , LP_FILTER_ORDER ) ;
pitch_sharpening ( pitch_lag , pitch_sharp_factor , freq ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean should_get_mime_list ( NautilusFile * file ) {
return lacks_mime_list ( file ) && ! file -> details -> loading_directory ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void mime_field_value_extend_comma_val ( HdrHeap * heap , MIMEHdrImpl * mh , MIMEField * field , int idx , const char * new_piece_str , int new_piece_len ) {
Str * cell ;
StrList list ( false ) ;
int trimmed , len ;
size_t extended_len ;
char * dest , * temp_ptr , temp_buf [ 128 ] ;
HttpCompat : : parse_tok_list ( & list , 0 , field -> m_ptr_value , field -> m_len_value , ',' ) ;
if ( ( idx < 0 ) || ( idx >= list . count ) ) {
return ;
}
cell = list . get_idx ( idx ) ;
ink_assert ( cell != nullptr ) ;
if ( ( cell -> len >= 2 ) && ( cell -> str [ 0 ] == '\"' ) && ( cell -> str [ cell -> len - 1 ] == '\"' ) ) {
trimmed = 1 ;
cell -> str += 1 ;
cell -> len -= 2 ;
}
else {
trimmed = 0 ;
}
extended_len = cell -> len + new_piece_len + ( trimmed ? 2 : 0 ) ;
if ( extended_len <= sizeof ( temp_buf ) ) {
temp_ptr = temp_buf ;
}
else {
temp_ptr = ( char * ) ats_malloc ( extended_len ) ;
}
dest = temp_ptr ;
if ( trimmed ) {
* dest ++ = '\"' ;
}
memcpy ( dest , cell -> str , cell -> len ) ;
dest += cell -> len ;
memcpy ( dest , new_piece_str , new_piece_len ) ;
dest += new_piece_len ;
if ( trimmed ) {
* dest ++ = '\"' ;
}
ink_assert ( ( size_t ) ( dest - temp_ptr ) == extended_len ) ;
cell -> str = temp_ptr ;
cell -> len = extended_len ;
field -> m_ptr_value = mime_field_value_str_from_strlist ( heap , & len , & list ) ;
field -> m_len_value = len ;
field -> m_n_v_raw_printable = 0 ;
if ( field -> is_live ( ) && field -> is_cooked ( ) ) {
mh -> recompute_cooked_stuff ( field ) ;
}
if ( extended_len > sizeof ( temp_buf ) ) {
ats_free ( temp_ptr ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void report_broken_symbolic_link ( GtkWindow * parent_window , NautilusFile * file ) {
char * target_path ;
char * display_name ;
char * prompt ;
char * detail ;
GtkDialog * dialog ;
GList file_as_list ;
int response ;
gboolean can_trash ;
g_assert ( nautilus_file_is_broken_symbolic_link ( file ) ) ;
display_name = nautilus_file_get_display_name ( file ) ;
can_trash = nautilus_file_can_trash ( file ) && ! nautilus_file_is_in_trash ( file ) ;
if ( can_trash ) {
prompt = g_strdup_printf ( _ ( "The link “%s” is broken. Move it to Trash?" ) , display_name ) ;
}
else {
prompt = g_strdup_printf ( _ ( "The link “%s” is broken." ) , display_name ) ;
}
g_free ( display_name ) ;
target_path = nautilus_file_get_symbolic_link_target_path ( file ) ;
if ( target_path == NULL ) {
detail = g_strdup ( _ ( "This link cannot be used because it has no target." ) ) ;
}
else {
detail = g_strdup_printf ( _ ( "This link cannot be used because its target " "“%s” doesn’t exist." ) , target_path ) ;
}
if ( ! can_trash ) {
eel_run_simple_dialog ( GTK_WIDGET ( parent_window ) , FALSE , GTK_MESSAGE_WARNING , prompt , detail , _ ( "_Cancel" ) , NULL ) ;
goto out ;
}
dialog = eel_show_yes_no_dialog ( prompt , detail , _ ( "Mo_ve to Trash" ) , _ ( "_Cancel" ) , parent_window ) ;
gtk_dialog_set_default_response ( dialog , GTK_RESPONSE_CANCEL ) ;
response = gtk_dialog_run ( dialog ) ;
gtk_widget_destroy ( GTK_WIDGET ( dialog ) ) ;
if ( response == GTK_RESPONSE_YES ) {
file_as_list . data = file ;
file_as_list . next = NULL ;
file_as_list . prev = NULL ;
trash_or_delete_files ( parent_window , & file_as_list , TRUE ) ;
}
out : g_free ( prompt ) ;
g_free ( target_path ) ;
g_free ( detail ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static REFERENCE_MODE read_block_reference_mode ( VP9_COMMON * cm , const MACROBLOCKD * xd , vp9_reader * r ) {
if ( cm -> reference_mode == REFERENCE_MODE_SELECT ) {
const int ctx = vp9_get_reference_mode_context ( cm , xd ) ;
const REFERENCE_MODE mode = ( REFERENCE_MODE ) vp9_read ( r , cm -> fc . comp_inter_prob [ ctx ] ) ;
if ( ! cm -> frame_parallel_decoding_mode ) ++ cm -> counts . comp_inter [ ctx ] [ mode ] ;
return mode ;
}
else {
return cm -> reference_mode ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint32_t U_CALLCONV _enumTypeValue ( const void * context , uint32_t value ) {
( void ) context ;
return GET_CATEGORY ( value ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
struct mszipd_stream * mszipd_init ( struct mspack_system * system , struct mspack_file * input , struct mspack_file * output , int input_buffer_size , int repair_mode ) {
struct mszipd_stream * zip ;
if ( ! system ) return NULL ;
input_buffer_size = ( input_buffer_size + 1 ) & - 2 ;
if ( ! input_buffer_size ) return NULL ;
if ( ! ( zip = ( struct mszipd_stream * ) system -> alloc ( system , sizeof ( struct mszipd_stream ) ) ) ) {
return NULL ;
}
zip -> inbuf = ( unsigned char * ) system -> alloc ( system , ( size_t ) input_buffer_size ) ;
if ( ! zip -> inbuf ) {
system -> free ( zip ) ;
return NULL ;
}
zip -> sys = system ;
zip -> input = input ;
zip -> output = output ;
zip -> inbuf_size = input_buffer_size ;
zip -> input_end = 0 ;
zip -> error = MSPACK_ERR_OK ;
zip -> repair_mode = repair_mode ;
zip -> flush_window = & mszipd_flush_window ;
zip -> i_ptr = zip -> i_end = & zip -> inbuf [ 0 ] ;
zip -> o_ptr = zip -> o_end = NULL ;
zip -> bit_buffer = 0 ;
zip -> bits_left = 0 ;
return zip ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void yy_symbol_print ( FILE * yyoutput , int yytype , YYSTYPE const * const yyvaluep ) # else static void yy_symbol_print ( yyoutput , yytype , yyvaluep ) FILE * yyoutput ;
int yytype ;
YYSTYPE const * const yyvaluep ;
# endif {
if ( yytype < YYNTOKENS ) YYFPRINTF ( yyoutput , "token %s (" , yytname [ yytype ] ) ;
else YYFPRINTF ( yyoutput , "nterm %s (" , yytname [ yytype ] ) ;
yy_symbol_value_print ( yyoutput , yytype , yyvaluep ) ;
YYFPRINTF ( yyoutput , ")" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void init_threaded_search ( void ) {
init_recursive_mutex ( & read_mutex ) ;
pthread_mutex_init ( & cache_mutex , NULL ) ;
pthread_mutex_init ( & progress_mutex , NULL ) ;
pthread_cond_init ( & progress_cond , NULL ) ;
old_try_to_free_routine = set_try_to_free_routine ( try_to_free_from_threads ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void TSMimeFieldValueInsert ( TSMBuffer bufp , TSMLoc field_obj , const char * value , int length , int idx ) {
MIMEFieldSDKHandle * handle = ( MIMEFieldSDKHandle * ) field_obj ;
HdrHeap * heap = ( ( HdrHeapSDKHandle * ) bufp ) -> m_heap ;
if ( length == - 1 ) {
length = strlen ( value ) ;
}
mime_field_value_insert_comma_val ( heap , handle -> mh , handle -> field_ptr , idx , value , length ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * cmd_request_body_limit ( cmd_parms * cmd , void * _dcfg , const char * p1 ) {
directory_config * dcfg = ( directory_config * ) _dcfg ;
long int limit ;
if ( dcfg == NULL ) return NULL ;
limit = strtol ( p1 , NULL , 10 ) ;
if ( ( limit == LONG_MAX ) || ( limit == LONG_MIN ) || ( limit <= 0 ) ) {
return apr_psprintf ( cmd -> pool , "ModSecurity: Invalid value for SecRequestBodyLimit: %s" , p1 ) ;
}
dcfg -> reqbody_limit = limit ;
return NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int SpoolssEnumPrinterData_q ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep _U_ ) {
guint32 ndx ;
proto_item * hidden_item ;
hidden_item = proto_tree_add_uint ( tree , hf_printerdata , tvb , offset , 0 , 1 ) ;
PROTO_ITEM_SET_HIDDEN ( hidden_item ) ;
offset = dissect_nt_policy_hnd ( tvb , offset , pinfo , tree , di , drep , hf_hnd , NULL , NULL , FALSE , FALSE ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_enumprinterdata_enumindex , & ndx ) ;
col_append_fstr ( pinfo -> cinfo , COL_INFO , ", index %d" , ndx ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_enumprinterdata_value_offered , NULL ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_enumprinterdata_data_offered , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void decode_4p_track ( int * out , int code , int m , int off ) {
int half_4p , subhalf_2p ;
int b_offset = 1 << ( m - 1 ) ;
switch ( BIT_STR ( code , 4 * m - 2 , 2 ) ) {
case 0 : half_4p = BIT_POS ( code , 4 * m - 3 ) << ( m - 1 ) ;
subhalf_2p = BIT_POS ( code , 2 * m - 3 ) << ( m - 2 ) ;
decode_2p_track ( out , BIT_STR ( code , 0 , 2 * m - 3 ) , m - 2 , off + half_4p + subhalf_2p ) ;
decode_2p_track ( out + 2 , BIT_STR ( code , 2 * m - 2 , 2 * m - 1 ) , m - 1 , off + half_4p ) ;
break ;
case 1 : decode_1p_track ( out , BIT_STR ( code , 3 * m - 2 , m ) , m - 1 , off ) ;
decode_3p_track ( out + 1 , BIT_STR ( code , 0 , 3 * m - 2 ) , m - 1 , off + b_offset ) ;
break ;
case 2 : decode_2p_track ( out , BIT_STR ( code , 2 * m - 1 , 2 * m - 1 ) , m - 1 , off ) ;
decode_2p_track ( out + 2 , BIT_STR ( code , 0 , 2 * m - 1 ) , m - 1 , off + b_offset ) ;
break ;
case 3 : decode_3p_track ( out , BIT_STR ( code , m , 3 * m - 2 ) , m - 1 , off ) ;
decode_1p_track ( out + 3 , BIT_STR ( code , 0 , m ) , m - 1 , off + b_offset ) ;
break ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static UFILE * finit_owner ( FILE * f , const char * locale , const char * codepage , UBool takeOwnership ) {
UErrorCode status = U_ZERO_ERROR ;
UFILE * result ;
if ( f == NULL ) {
return 0 ;
}
result = ( UFILE * ) uprv_malloc ( sizeof ( UFILE ) ) ;
if ( result == NULL ) {
return 0 ;
}
uprv_memset ( result , 0 , sizeof ( UFILE ) ) ;
result -> fFileno = fileno ( f ) ;
result -> fFile = f ;
result -> str . fBuffer = result -> fUCBuffer ;
result -> str . fPos = result -> fUCBuffer ;
result -> str . fLimit = result -> fUCBuffer ;
# if ! UCONFIG_NO_FORMATTING if ( u_locbund_init ( & result -> str . fBundle , locale ) == 0 ) {
uprv_free ( result ) ;
return 0 ;
}
# endif if ( codepage == NULL || * codepage != '\0' ) {
result -> fConverter = ucnv_open ( codepage , & status ) ;
}
if ( U_SUCCESS ( status ) ) {
result -> fOwnFile = takeOwnership ;
}
else {
# if ! UCONFIG_NO_FORMATTING u_locbund_close ( & result -> str . fBundle ) ;
# endif uprv_free ( result ) ;
result = NULL ;
}
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int vp9_mv_bit_cost ( const MV * mv , const MV * ref , const int * mvjcost , int * mvcost [ 2 ] , int weight ) {
const MV diff = {
mv -> row - ref -> row , mv -> col - ref -> col }
;
return ROUND_POWER_OF_TWO ( mv_cost ( & diff , mvjcost , mvcost ) * weight , 7 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
long dtls1_get_message ( SSL * s , int st1 , int stn , int mt , long max , int * ok ) {
int i , al ;
struct hm_header_st * msg_hdr ;
unsigned char * p ;
unsigned long msg_len ;
if ( s -> s3 -> tmp . reuse_message ) {
s -> s3 -> tmp . reuse_message = 0 ;
if ( ( mt >= 0 ) && ( s -> s3 -> tmp . message_type != mt ) ) {
al = SSL_AD_UNEXPECTED_MESSAGE ;
SSLerr ( SSL_F_DTLS1_GET_MESSAGE , SSL_R_UNEXPECTED_MESSAGE ) ;
goto f_err ;
}
* ok = 1 ;
s -> init_msg = s -> init_buf -> data + DTLS1_HM_HEADER_LENGTH ;
s -> init_num = ( int ) s -> s3 -> tmp . message_size ;
return s -> init_num ;
}
msg_hdr = & s -> d1 -> r_msg_hdr ;
memset ( msg_hdr , 0x00 , sizeof ( struct hm_header_st ) ) ;
again : i = dtls1_get_message_fragment ( s , st1 , stn , max , ok ) ;
if ( i == DTLS1_HM_BAD_FRAGMENT || i == DTLS1_HM_FRAGMENT_RETRY ) goto again ;
else if ( i <= 0 && ! * ok ) return i ;
p = ( unsigned char * ) s -> init_buf -> data ;
msg_len = msg_hdr -> msg_len ;
* ( p ++ ) = msg_hdr -> type ;
l2n3 ( msg_len , p ) ;
s2n ( msg_hdr -> seq , p ) ;
l2n3 ( 0 , p ) ;
l2n3 ( msg_len , p ) ;
if ( s -> version != DTLS1_BAD_VER ) {
p -= DTLS1_HM_HEADER_LENGTH ;
msg_len += DTLS1_HM_HEADER_LENGTH ;
}
ssl3_finish_mac ( s , p , msg_len ) ;
if ( s -> msg_callback ) s -> msg_callback ( 0 , s -> version , SSL3_RT_HANDSHAKE , p , msg_len , s , s -> msg_callback_arg ) ;
memset ( msg_hdr , 0x00 , sizeof ( struct hm_header_st ) ) ;
if ( ! s -> d1 -> listen ) s -> d1 -> handshake_read_seq ++ ;
s -> init_msg = s -> init_buf -> data + DTLS1_HM_HEADER_LENGTH ;
return s -> init_num ;
f_err : ssl3_send_alert ( s , SSL3_AL_FATAL , al ) ;
* ok = 0 ;
return - 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int kvm_get_fpu ( X86CPU * cpu ) {
CPUX86State * env = & cpu -> env ;
struct kvm_fpu fpu ;
int i , ret ;
ret = kvm_vcpu_ioctl ( CPU ( cpu ) , KVM_GET_FPU , & fpu ) ;
if ( ret < 0 ) {
return ret ;
}
env -> fpstt = ( fpu . fsw >> 11 ) & 7 ;
env -> fpus = fpu . fsw ;
env -> fpuc = fpu . fcw ;
env -> fpop = fpu . last_opcode ;
env -> fpip = fpu . last_ip ;
env -> fpdp = fpu . last_dp ;
for ( i = 0 ;
i < 8 ;
++ i ) {
env -> fptags [ i ] = ! ( ( fpu . ftwx >> i ) & 1 ) ;
}
memcpy ( env -> fpregs , fpu . fpr , sizeof env -> fpregs ) ;
for ( i = 0 ;
i < CPU_NB_REGS ;
i ++ ) {
env -> xmm_regs [ i ] . ZMM_Q ( 0 ) = ldq_p ( & fpu . xmm [ i ] [ 0 ] ) ;
env -> xmm_regs [ i ] . ZMM_Q ( 1 ) = ldq_p ( & fpu . xmm [ i ] [ 8 ] ) ;
}
env -> mxcsr = fpu . mxcsr ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_idct32x32_34_add_c ( const int16_t * input , uint8_t * dest , int stride ) {
int16_t out [ 32 * 32 ] = {
0 }
;
int16_t * outptr = out ;
int i , j ;
int16_t temp_in [ 32 ] , temp_out [ 32 ] ;
for ( i = 0 ;
i < 8 ;
++ i ) {
idct32 ( input , outptr ) ;
input += 32 ;
outptr += 32 ;
}
for ( i = 0 ;
i < 32 ;
++ i ) {
for ( j = 0 ;
j < 32 ;
++ j ) temp_in [ j ] = out [ j * 32 + i ] ;
idct32 ( temp_in , temp_out ) ;
for ( j = 0 ;
j < 32 ;
++ j ) dest [ j * stride + i ] = clip_pixel ( ROUND_POWER_OF_TWO ( temp_out [ j ] , 6 ) + dest [ j * stride + i ] ) ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dcc_ctcp_resume_parse ( int type , const char * data , const char * nick , FILE_DCC_REC * * dcc , uoff_t * size , int * pasv_id ) {
char * * params ;
int paramcount , fileparams ;
int port ;
params = g_strsplit ( data , " " , - 1 ) ;
paramcount = g_strv_length ( params ) ;
if ( paramcount < 3 ) return 0 ;
fileparams = get_file_params_count_resume ( params , paramcount ) ;
if ( paramcount >= fileparams + 2 ) {
port = atoi ( params [ fileparams ] ) ;
* size = str_to_uofft ( params [ fileparams + 1 ] ) ;
* pasv_id = ( ( port == 0 ) && ( paramcount == fileparams + 3 ) ) ? atoi ( params [ fileparams + 2 ] ) : - 1 ;
* dcc = dcc_resume_find ( type , nick , port ) ;
g_strfreev ( params ) ;
return ( ( * dcc != NULL ) && ( ( * dcc ) -> pasv_id == * pasv_id ) ) ;
}
g_strfreev ( params ) ;
return FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void udev_hotplug_event ( struct udev_device * udev_dev ) {
const char * udev_action ;
const char * sys_name = NULL ;
uint8_t busnum = 0 , devaddr = 0 ;
int detached ;
int r ;
do {
udev_action = device : : udev_device_get_action ( udev_dev ) ;
if ( ! udev_action ) {
break ;
}
detached = ! strncmp ( udev_action , "remove" , 6 ) ;
r = udev_device_info ( NULL , detached , udev_dev , & busnum , & devaddr , & sys_name ) ;
if ( LIBUSB_SUCCESS != r ) {
break ;
}
usbi_dbg ( "udev hotplug event. action: %s." , udev_action ) ;
if ( strncmp ( udev_action , "add" , 3 ) == 0 ) {
linux_hotplug_enumerate ( busnum , devaddr , sys_name ) ;
}
else if ( detached ) {
linux_device_disconnected ( busnum , devaddr , sys_name ) ;
}
else {
usbi_err ( NULL , "ignoring udev action %s" , udev_action ) ;
}
}
while ( 0 ) ;
device : : udev_device_unref ( udev_dev ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
gcry_error_t gcry_pk_sign ( gcry_sexp_t * r_sig , gcry_sexp_t s_hash , gcry_sexp_t s_skey ) {
gcry_mpi_t * skey = NULL , hash = NULL , * result = NULL ;
gcry_pk_spec_t * pubkey = NULL ;
gcry_module_t module = NULL ;
const char * algo_name , * algo_elems ;
struct pk_encoding_ctx ctx ;
int i ;
int is_ecc ;
gcry_err_code_t rc ;
* r_sig = NULL ;
REGISTER_DEFAULT_PUBKEYS ;
rc = sexp_to_key ( s_skey , 1 , GCRY_PK_USAGE_SIGN , NULL , & skey , & module , & is_ecc ) ;
if ( rc ) goto leave ;
gcry_assert ( module ) ;
pubkey = ( gcry_pk_spec_t * ) module -> spec ;
algo_name = pubkey -> aliases ? * pubkey -> aliases : NULL ;
if ( ! algo_name || ! * algo_name ) algo_name = pubkey -> name ;
algo_elems = pubkey -> elements_sig ;
init_encoding_ctx ( & ctx , PUBKEY_OP_SIGN , is_ecc ? 0 : gcry_pk_get_nbits ( s_skey ) ) ;
rc = sexp_data_to_mpi ( s_hash , & hash , & ctx ) ;
if ( rc ) goto leave ;
result = gcry_calloc ( strlen ( algo_elems ) + 1 , sizeof ( * result ) ) ;
if ( ! result ) {
rc = gpg_err_code_from_syserror ( ) ;
goto leave ;
}
rc = pubkey_sign ( module -> mod_id , result , hash , skey , & ctx ) ;
if ( rc ) goto leave ;
if ( ctx . encoding == PUBKEY_ENC_PSS || ctx . encoding == PUBKEY_ENC_PKCS1 ) {
unsigned char * em ;
size_t emlen = ( ctx . nbits + 7 ) / 8 ;
rc = octet_string_from_mpi ( & em , NULL , result [ 0 ] , emlen ) ;
if ( rc ) goto leave ;
rc = gcry_err_code ( gcry_sexp_build ( r_sig , NULL , "(sig-val(%s(s%b)))" , algo_name , ( int ) emlen , em ) ) ;
gcry_free ( em ) ;
if ( rc ) goto leave ;
}
else {
char * string , * p ;
size_t nelem , needed = strlen ( algo_name ) + 20 ;
void * * arg_list ;
nelem = strlen ( algo_elems ) ;
needed += 10 * nelem ;
string = p = gcry_malloc ( needed ) ;
if ( ! string ) {
rc = gpg_err_code_from_syserror ( ) ;
goto leave ;
}
p = stpcpy ( p , "(sig-val(" ) ;
p = stpcpy ( p , algo_name ) ;
for ( i = 0 ;
algo_elems [ i ] ;
i ++ ) {
* p ++ = '(' ;
* p ++ = algo_elems [ i ] ;
p = stpcpy ( p , "%M)" ) ;
}
strcpy ( p , "))" ) ;
arg_list = malloc ( nelem * sizeof * arg_list ) ;
if ( ! arg_list ) {
rc = gpg_err_code_from_syserror ( ) ;
goto leave ;
}
for ( i = 0 ;
i < nelem ;
i ++ ) arg_list [ i ] = result + i ;
rc = gcry_sexp_build_array ( r_sig , NULL , string , arg_list ) ;
free ( arg_list ) ;
if ( rc ) BUG ( ) ;
gcry_free ( string ) ;
}
leave : if ( skey ) {
if ( is_ecc ) for ( i = 0 ;
i < 7 ;
i ++ ) {
if ( skey [ i ] ) mpi_free ( skey [ i ] ) ;
skey [ i ] = NULL ;
}
else release_mpi_array ( skey ) ;
gcry_free ( skey ) ;
}
if ( hash ) mpi_free ( hash ) ;
if ( result ) {
release_mpi_array ( result ) ;
gcry_free ( result ) ;
}
return gcry_error ( rc ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_FECData ( 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_FECData , FECData_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
field_info * proto_find_field_from_offset ( proto_tree * tree , guint offset , tvbuff_t * tvb ) {
offset_search_t offsearch ;
offsearch . offset = offset ;
offsearch . finfo = NULL ;
offsearch . tvb = tvb ;
proto_tree_traverse_pre_order ( tree , check_for_offset , & offsearch ) ;
return offsearch . finfo ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SPL_METHOD ( SplFileObject , fgetcsv ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
char delimiter = intern -> u . file . delimiter , enclosure = intern -> u . file . enclosure , escape = intern -> u . file . escape ;
char * delim = NULL , * enclo = NULL , * esc = NULL ;
int d_len = 0 , e_len = 0 , esc_len = 0 ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "|sss" , & delim , & d_len , & enclo , & e_len , & esc , & esc_len ) == SUCCESS ) {
switch ( ZEND_NUM_ARGS ( ) ) {
case 3 : if ( esc_len != 1 ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "escape must be a character" ) ;
RETURN_FALSE ;
}
escape = esc [ 0 ] ;
case 2 : if ( e_len != 1 ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "enclosure must be a character" ) ;
RETURN_FALSE ;
}
enclosure = enclo [ 0 ] ;
case 1 : if ( d_len != 1 ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "delimiter must be a character" ) ;
RETURN_FALSE ;
}
delimiter = delim [ 0 ] ;
case 0 : break ;
}
spl_filesystem_file_read_csv ( intern , delimiter , enclosure , escape , return_value TSRMLS_CC ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dwarf_get_elf ( Dwarf_Debug dbg , dwarf_elf_handle * elf , Dwarf_Error * error ) {
struct Dwarf_Obj_Access_Interface_s * obj = 0 ;
if ( dbg == NULL ) {
_dwarf_error ( NULL , error , DW_DLE_DBG_NULL ) ;
return ( DW_DLV_ERROR ) ;
}
obj = dbg -> de_obj_file ;
if ( obj ) {
dwarf_elf_object_access_internals_t * internals = ( dwarf_elf_object_access_internals_t * ) obj -> object ;
if ( internals -> elf == NULL ) {
_dwarf_error ( dbg , error , DW_DLE_FNO ) ;
return ( DW_DLV_ERROR ) ;
}
* elf = internals -> elf ;
return DW_DLV_OK ;
}
_dwarf_error ( dbg , error , DW_DLE_FNO ) ;
return DW_DLV_ERROR ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_prepare_resultset ( ) {
MYSQL_STMT * stmt ;
int rc ;
MYSQL_RES * result ;
myheader ( "test_prepare_resultset" ) ;
rc = mysql_autocommit ( mysql , TRUE ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS test_prepare_resultset" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE test_prepare_resultset(id int, \ name varchar(50), extra double)" ) ;
myquery ( rc ) ;
stmt = mysql_simple_prepare ( mysql , "SELECT * FROM test_prepare_resultset" ) ;
check_stmt ( stmt ) ;
verify_param_count ( stmt , 0 ) ;
result = mysql_stmt_result_metadata ( stmt ) ;
mytest ( result ) ;
my_print_result_metadata ( result ) ;
mysql_free_result ( result ) ;
mysql_stmt_close ( stmt ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int vp9_pattern_search ( const MACROBLOCK * x , MV * ref_mv , int search_param , int sad_per_bit , int do_init_search , int * sad_list , const vp9_variance_fn_ptr_t * vfp , int use_mvcost , const MV * center_mv , MV * best_mv , const int num_candidates [ MAX_PATTERN_SCALES ] , const MV candidates [ MAX_PATTERN_SCALES ] [ MAX_PATTERN_CANDIDATES ] ) {
const MACROBLOCKD * const xd = & x -> e_mbd ;
static const int search_param_to_steps [ MAX_MVSEARCH_STEPS ] = {
10 , 9 , 8 , 7 , 6 , 5 , 4 , 3 , 2 , 1 , 0 , }
;
int i , s , t ;
const struct buf_2d * const what = & x -> plane [ 0 ] . src ;
const struct buf_2d * const in_what = & xd -> plane [ 0 ] . pre [ 0 ] ;
int br , bc ;
int bestsad = INT_MAX ;
int thissad ;
int k = - 1 ;
const MV fcenter_mv = {
center_mv -> row >> 3 , center_mv -> col >> 3 }
;
int best_init_s = search_param_to_steps [ search_param ] ;
clamp_mv ( ref_mv , x -> mv_col_min , x -> mv_col_max , x -> mv_row_min , x -> mv_row_max ) ;
br = ref_mv -> row ;
bc = ref_mv -> col ;
bestsad = vfp -> sdf ( what -> buf , what -> stride , get_buf_from_mv ( in_what , ref_mv ) , in_what -> stride ) + mvsad_err_cost ( x , ref_mv , & fcenter_mv , sad_per_bit ) ;
if ( do_init_search ) {
s = best_init_s ;
best_init_s = - 1 ;
for ( t = 0 ;
t <= s ;
++ t ) {
int best_site = - 1 ;
if ( check_bounds ( x , br , bc , 1 << t ) ) {
for ( i = 0 ;
i < num_candidates [ t ] ;
i ++ ) {
const MV this_mv = {
br + candidates [ t ] [ i ] . row , bc + candidates [ t ] [ i ] . col }
;
thissad = vfp -> sdf ( what -> buf , what -> stride , get_buf_from_mv ( in_what , & this_mv ) , in_what -> stride ) ;
CHECK_BETTER }
}
else {
for ( i = 0 ;
i < num_candidates [ t ] ;
i ++ ) {
const MV this_mv = {
br + candidates [ t ] [ i ] . row , bc + candidates [ t ] [ i ] . col }
;
if ( ! is_mv_in ( x , & this_mv ) ) continue ;
thissad = vfp -> sdf ( what -> buf , what -> stride , get_buf_from_mv ( in_what , & this_mv ) , in_what -> stride ) ;
CHECK_BETTER }
}
if ( best_site == - 1 ) {
continue ;
}
else {
best_init_s = t ;
k = best_site ;
}
}
if ( best_init_s != - 1 ) {
br += candidates [ best_init_s ] [ k ] . row ;
bc += candidates [ best_init_s ] [ k ] . col ;
}
}
if ( best_init_s != - 1 ) {
int best_site = - 1 ;
s = best_init_s ;
do {
if ( ! do_init_search || s != best_init_s ) {
if ( check_bounds ( x , br , bc , 1 << s ) ) {
for ( i = 0 ;
i < num_candidates [ s ] ;
i ++ ) {
const MV this_mv = {
br + candidates [ s ] [ i ] . row , bc + candidates [ s ] [ i ] . col }
;
thissad = vfp -> sdf ( what -> buf , what -> stride , get_buf_from_mv ( in_what , & this_mv ) , in_what -> stride ) ;
CHECK_BETTER }
}
else {
for ( i = 0 ;
i < num_candidates [ s ] ;
i ++ ) {
const MV this_mv = {
br + candidates [ s ] [ i ] . row , bc + candidates [ s ] [ i ] . col }
;
if ( ! is_mv_in ( x , & this_mv ) ) continue ;
thissad = vfp -> sdf ( what -> buf , what -> stride , get_buf_from_mv ( in_what , & this_mv ) , in_what -> stride ) ;
CHECK_BETTER }
}
if ( best_site == - 1 ) {
continue ;
}
else {
br += candidates [ s ] [ best_site ] . row ;
bc += candidates [ s ] [ best_site ] . col ;
k = best_site ;
}
}
do {
int next_chkpts_indices [ PATTERN_CANDIDATES_REF ] ;
best_site = - 1 ;
next_chkpts_indices [ 0 ] = ( k == 0 ) ? num_candidates [ s ] - 1 : k - 1 ;
next_chkpts_indices [ 1 ] = k ;
next_chkpts_indices [ 2 ] = ( k == num_candidates [ s ] - 1 ) ? 0 : k + 1 ;
if ( check_bounds ( x , br , bc , 1 << s ) ) {
for ( i = 0 ;
i < PATTERN_CANDIDATES_REF ;
i ++ ) {
const MV this_mv = {
br + candidates [ s ] [ next_chkpts_indices [ i ] ] . row , bc + candidates [ s ] [ next_chkpts_indices [ i ] ] . col }
;
thissad = vfp -> sdf ( what -> buf , what -> stride , get_buf_from_mv ( in_what , & this_mv ) , in_what -> stride ) ;
CHECK_BETTER }
}
else {
for ( i = 0 ;
i < PATTERN_CANDIDATES_REF ;
i ++ ) {
const MV this_mv = {
br + candidates [ s ] [ next_chkpts_indices [ i ] ] . row , bc + candidates [ s ] [ next_chkpts_indices [ i ] ] . col }
;
if ( ! is_mv_in ( x , & this_mv ) ) continue ;
thissad = vfp -> sdf ( what -> buf , what -> stride , get_buf_from_mv ( in_what , & this_mv ) , in_what -> stride ) ;
CHECK_BETTER }
}
if ( best_site != - 1 ) {
k = next_chkpts_indices [ best_site ] ;
br += candidates [ s ] [ k ] . row ;
bc += candidates [ s ] [ k ] . col ;
}
}
while ( best_site != - 1 ) ;
}
while ( s -- ) ;
}
if ( sad_list ) {
static const MV neighbors [ 4 ] = {
{
0 , - 1 }
, {
- 1 , 0 }
, {
0 , 1 }
, {
1 , 0 }
}
;
sad_list [ 0 ] = bestsad ;
if ( check_bounds ( x , br , bc , 1 ) ) {
for ( i = 0 ;
i < 4 ;
i ++ ) {
const MV this_mv = {
br + neighbors [ i ] . row , bc + neighbors [ i ] . col }
;
sad_list [ i + 1 ] = vfp -> sdf ( what -> buf , what -> stride , get_buf_from_mv ( in_what , & this_mv ) , in_what -> stride ) ;
}
}
else {
for ( i = 0 ;
i < 4 ;
i ++ ) {
const MV this_mv = {
br + neighbors [ i ] . row , bc + neighbors [ i ] . col }
;
if ( ! is_mv_in ( x , & this_mv ) ) sad_list [ i + 1 ] = INT_MAX ;
else sad_list [ i + 1 ] = vfp -> sdf ( what -> buf , what -> stride , get_buf_from_mv ( in_what , & this_mv ) , in_what -> stride ) ;
}
}
}
best_mv -> row = br ;
best_mv -> col = bc ;
return bestsad ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void col_append_info_by_handle ( packet_info * pinfo , guint16 handle , bluetooth_data_t * bluetooth_data ) {
bluetooth_uuid_t service_uuid ;
bluetooth_uuid_t characteristic_uuid ;
bluetooth_uuid_t uuid ;
service_uuid = get_service_uuid_from_handle ( pinfo , handle , bluetooth_data ) ;
characteristic_uuid = get_characteristic_uuid_from_handle ( pinfo , handle , bluetooth_data ) ;
uuid = get_uuid_from_handle ( pinfo , handle , bluetooth_data ) ;
if ( ! memcmp ( & service_uuid , & uuid , sizeof ( uuid ) ) ) {
col_append_fstr ( pinfo -> cinfo , COL_INFO , ", Handle: 0x%04x (%s)" , handle , print_uuid ( & uuid ) ) ;
}
else if ( ! memcmp ( & characteristic_uuid , & uuid , sizeof ( uuid ) ) ) {
col_append_fstr ( pinfo -> cinfo , COL_INFO , ", Handle: 0x%04x (%s: %s)" , handle , print_uuid ( & service_uuid ) , print_uuid ( & uuid ) ) ;
}
else {
col_append_fstr ( pinfo -> cinfo , COL_INFO , ", Handle: 0x%04x (%s: %s: %s)" , handle , print_uuid ( & service_uuid ) , print_uuid ( & characteristic_uuid ) , print_uuid ( & uuid ) ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int vp9_get_quantizer ( VP9_COMP * cpi ) {
return cpi -> common . base_qindex ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int virLogSetDefaultOutput ( const char * filename , bool godaemon , bool privileged ) {
if ( ! godaemon ) return virLogSetDefaultOutputToStderr ( ) ;
if ( access ( "/run/systemd/journal/socket" , W_OK ) >= 0 ) return virLogSetDefaultOutputToJournald ( ) ;
return virLogSetDefaultOutputToFile ( filename , privileged ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int ohci_put_ed ( OHCIState * ohci , dma_addr_t addr , struct ohci_ed * ed ) {
return put_dwords ( ohci , addr + ED_WBACK_OFFSET , ( uint32_t * ) ( ( char * ) ed + ED_WBACK_OFFSET ) , ED_WBACK_SIZE >> 2 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int v410_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
AVFrame * pic = avctx -> coded_frame ;
uint8_t * src = avpkt -> data ;
uint16_t * y , * u , * v ;
uint32_t val ;
int i , j ;
if ( pic -> data [ 0 ] ) avctx -> release_buffer ( avctx , pic ) ;
if ( avpkt -> size < 4 * avctx -> height * avctx -> width ) {
av_log ( avctx , AV_LOG_ERROR , "Insufficient input data.\n" ) ;
return AVERROR ( EINVAL ) ;
}
pic -> reference = 0 ;
if ( ff_get_buffer ( avctx , pic ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "Could not allocate buffer.\n" ) ;
return AVERROR ( ENOMEM ) ;
}
pic -> key_frame = 1 ;
pic -> pict_type = AV_PICTURE_TYPE_I ;
y = ( uint16_t * ) pic -> data [ 0 ] ;
u = ( uint16_t * ) pic -> data [ 1 ] ;
v = ( uint16_t * ) pic -> data [ 2 ] ;
for ( i = 0 ;
i < avctx -> height ;
i ++ ) {
for ( j = 0 ;
j < avctx -> width ;
j ++ ) {
val = AV_RL32 ( src ) ;
u [ j ] = ( val >> 2 ) & 0x3FF ;
y [ j ] = ( val >> 12 ) & 0x3FF ;
v [ j ] = ( val >> 22 ) ;
src += 4 ;
}
y += pic -> linesize [ 0 ] >> 1 ;
u += pic -> linesize [ 1 ] >> 1 ;
v += pic -> linesize [ 2 ] >> 1 ;
}
* got_frame = 1 ;
* ( AVFrame * ) data = * pic ;
return avpkt -> size ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ff_h264_get_slice_type ( const H264Context * h ) {
switch ( h -> slice_type ) {
case AV_PICTURE_TYPE_P : return 0 ;
case AV_PICTURE_TYPE_B : return 1 ;
case AV_PICTURE_TYPE_I : return 2 ;
case AV_PICTURE_TYPE_SP : return 3 ;
case AV_PICTURE_TYPE_SI : return 4 ;
default : return AVERROR_INVALIDDATA ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void convert_string_to_scalar ( char * value , double * scaledvalue , char * lobound , double * scaledlobound , char * hibound , double * scaledhibound ) {
int rangelo , rangehi ;
char * sptr ;
rangelo = rangehi = ( unsigned char ) hibound [ 0 ] ;
for ( sptr = lobound ;
* sptr ;
sptr ++ ) {
if ( rangelo > ( unsigned char ) * sptr ) rangelo = ( unsigned char ) * sptr ;
if ( rangehi < ( unsigned char ) * sptr ) rangehi = ( unsigned char ) * sptr ;
}
for ( sptr = hibound ;
* sptr ;
sptr ++ ) {
if ( rangelo > ( unsigned char ) * sptr ) rangelo = ( unsigned char ) * sptr ;
if ( rangehi < ( unsigned char ) * sptr ) rangehi = ( unsigned char ) * sptr ;
}
if ( rangelo <= 'Z' && rangehi >= 'A' ) {
if ( rangelo > 'A' ) rangelo = 'A' ;
if ( rangehi < 'Z' ) rangehi = 'Z' ;
}
if ( rangelo <= 'z' && rangehi >= 'a' ) {
if ( rangelo > 'a' ) rangelo = 'a' ;
if ( rangehi < 'z' ) rangehi = 'z' ;
}
if ( rangelo <= '9' && rangehi >= '0' ) {
if ( rangelo > '0' ) rangelo = '0' ;
if ( rangehi < '9' ) rangehi = '9' ;
}
if ( rangehi - rangelo < 9 ) {
rangelo = ' ' ;
rangehi = 127 ;
}
while ( * lobound ) {
if ( * lobound != * hibound || * lobound != * value ) break ;
lobound ++ , hibound ++ , value ++ ;
}
* scaledvalue = convert_one_string_to_scalar ( value , rangelo , rangehi ) ;
* scaledlobound = convert_one_string_to_scalar ( lobound , rangelo , rangehi ) ;
* scaledhibound = convert_one_string_to_scalar ( hibound , rangelo , rangehi ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void sig_channel_destroyed ( CHANNEL_REC * channel ) {
MODULE_CHANNEL_REC * mchannel ;
g_return_if_fail ( channel != NULL ) ;
mchannel = MODULE_DATA ( channel ) ;
while ( mchannel -> lastmsgs != NULL ) {
last_msg_destroy ( & mchannel -> lastmsgs , mchannel -> lastmsgs -> data ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void transfer_add_file_to_count ( GFile * file , CommonJob * job , TransferInfo * transfer_info ) {
g_autoptr ( GFileInfo ) file_info = NULL ;
if ( g_cancellable_is_cancelled ( job -> cancellable ) ) {
return ;
}
file_info = g_file_query_info ( file , G_FILE_ATTRIBUTE_STANDARD_SIZE , G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS , job -> cancellable , NULL ) ;
transfer_info -> num_files ++ ;
if ( file_info != NULL ) {
transfer_info -> num_bytes += g_file_info_get_size ( file_info ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void _slurm_rpc_complete_batch_script ( slurm_msg_t * msg , bool * run_scheduler , bool running_composite ) {
static int active_rpc_cnt = 0 ;
int error_code = SLURM_SUCCESS , i ;
DEF_TIMERS ;
complete_batch_script_msg_t * comp_msg = ( complete_batch_script_msg_t * ) msg -> data ;
slurmctld_lock_t job_write_lock = {
NO_LOCK , WRITE_LOCK , WRITE_LOCK , NO_LOCK , READ_LOCK }
;
uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ;
bool job_requeue = false ;
bool dump_job = false , dump_node = false ;
struct job_record * job_ptr = NULL ;
char * msg_title = "node(s)" ;
char * nodes = comp_msg -> node_name ;
# ifdef HAVE_BG update_block_msg_t block_desc ;
memset ( & block_desc , 0 , sizeof ( update_block_msg_t ) ) ;
# endif START_TIMER ;
debug2 ( "Processing RPC: REQUEST_COMPLETE_BATCH_SCRIPT from " "uid=%u JobId=%u" , uid , comp_msg -> job_id ) ;
if ( ! validate_slurm_user ( uid ) ) {
error ( "A non superuser %u tried to complete batch job %u" , uid , comp_msg -> job_id ) ;
END_TIMER2 ( "_slurm_rpc_complete_batch_script" ) ;
return ;
}
if ( ! running_composite ) {
_throttle_start ( & active_rpc_cnt ) ;
lock_slurmctld ( job_write_lock ) ;
}
job_ptr = find_job_record ( comp_msg -> job_id ) ;
if ( job_ptr && job_ptr -> batch_host && comp_msg -> node_name && xstrcmp ( job_ptr -> batch_host , comp_msg -> node_name ) ) {
error ( "Batch completion for job %u sent from wrong node " "(%s rather than %s). " "Was the job requeued due to node failure?" , comp_msg -> job_id , comp_msg -> node_name , job_ptr -> batch_host ) ;
if ( ! running_composite ) {
unlock_slurmctld ( job_write_lock ) ;
_throttle_fini ( & active_rpc_cnt ) ;
}
slurm_send_rc_msg ( msg , error_code ) ;
return ;
}
if ( association_based_accounting && job_ptr && ( job_ptr -> job_state != JOB_PENDING ) ) {
struct step_record batch_step ;
memset ( & batch_step , 0 , sizeof ( struct step_record ) ) ;
batch_step . job_ptr = job_ptr ;
batch_step . step_id = SLURM_BATCH_SCRIPT ;
batch_step . jobacct = comp_msg -> jobacct ;
batch_step . exit_code = comp_msg -> job_rc ;
# ifdef HAVE_FRONT_END nodes = job_ptr -> nodes ;
# endif batch_step . gres = nodes ;
if ( node_name2bitmap ( batch_step . gres , false , & batch_step . step_node_bitmap ) != 0 ) {
error ( "%s: job %u has invalide node list (%s)" , __func__ , job_ptr -> job_id , batch_step . gres ) ;
}
batch_step . requid = - 1 ;
batch_step . start_time = job_ptr -> start_time ;
batch_step . name = "batch" ;
batch_step . select_jobinfo = job_ptr -> select_jobinfo ;
step_set_alloc_tres ( & batch_step , 1 , false , false ) ;
jobacct_storage_g_step_start ( acct_db_conn , & batch_step ) ;
jobacct_storage_g_step_complete ( acct_db_conn , & batch_step ) ;
FREE_NULL_BITMAP ( batch_step . step_node_bitmap ) ;
xfree ( batch_step . tres_alloc_str ) ;
}
# ifdef HAVE_FRONT_END if ( job_ptr && job_ptr -> front_end_ptr ) nodes = job_ptr -> front_end_ptr -> name ;
msg_title = "front_end" ;
# endif if ( ( comp_msg -> slurm_rc == ESLURMD_JOB_NOTRUNNING ) || ( comp_msg -> slurm_rc == ESLURM_ALREADY_DONE ) || ( comp_msg -> slurm_rc == ESLURMD_CREDENTIAL_REVOKED ) ) {
info ( "slurmd error running JobId=%u from %s=%s: %s" , comp_msg -> job_id , msg_title , nodes , slurm_strerror ( comp_msg -> slurm_rc ) ) ;
comp_msg -> slurm_rc = SLURM_SUCCESS ;
# ifdef HAVE_ALPS_CRAY }
else if ( comp_msg -> slurm_rc == ESLURM_RESERVATION_NOT_USABLE ) {
error ( "ALPS reservation for JobId %u failed: %s" , comp_msg -> job_id , slurm_strerror ( comp_msg -> slurm_rc ) ) ;
dump_job = job_requeue = true ;
# endif }
else if ( ( comp_msg -> slurm_rc == SLURM_COMMUNICATIONS_SEND_ERROR ) || ( comp_msg -> slurm_rc == ESLURM_USER_ID_MISSING ) || ( comp_msg -> slurm_rc == ESLURMD_UID_NOT_FOUND ) || ( comp_msg -> slurm_rc == ESLURMD_GID_NOT_FOUND ) || ( comp_msg -> slurm_rc == ESLURMD_INVALID_ACCT_FREQ ) ) {
error ( "Slurmd error running JobId=%u on %s=%s: %s" , comp_msg -> job_id , msg_title , nodes , slurm_strerror ( comp_msg -> slurm_rc ) ) ;
}
else if ( comp_msg -> slurm_rc != SLURM_SUCCESS ) {
error ( "slurmd error running JobId=%u on %s=%s: %s" , comp_msg -> job_id , msg_title , nodes , slurm_strerror ( comp_msg -> slurm_rc ) ) ;
slurmctld_diag_stats . jobs_failed ++ ;
if ( error_code == SLURM_SUCCESS ) {
# ifdef HAVE_BG if ( job_ptr ) {
select_g_select_jobinfo_get ( job_ptr -> select_jobinfo , SELECT_JOBDATA_BLOCK_ID , & block_desc . bg_block_id ) ;
}
# else # ifdef HAVE_FRONT_END if ( job_ptr && job_ptr -> front_end_ptr ) {
update_front_end_msg_t update_node_msg ;
memset ( & update_node_msg , 0 , sizeof ( update_front_end_msg_t ) ) ;
update_node_msg . name = job_ptr -> front_end_ptr -> name ;
update_node_msg . node_state = NODE_STATE_DRAIN ;
update_node_msg . reason = "batch job complete failure" ;
error_code = update_front_end ( & update_node_msg ) ;
}
# else error_code = drain_nodes ( comp_msg -> node_name , "batch job complete failure" , slurmctld_conf . slurm_user_id ) ;
# endif # endif if ( ( comp_msg -> job_rc != SLURM_SUCCESS ) && job_ptr && job_ptr -> details && job_ptr -> details -> requeue ) job_requeue = true ;
dump_job = true ;
dump_node = true ;
}
}
if ( msg -> msg_type == REQUEST_COMPLETE_BATCH_JOB ) job_epilog_complete ( comp_msg -> job_id , comp_msg -> node_name , 0 ) ;
i = job_complete ( comp_msg -> job_id , uid , job_requeue , false , comp_msg -> job_rc ) ;
error_code = MAX ( error_code , i ) ;
if ( ! running_composite ) {
unlock_slurmctld ( job_write_lock ) ;
_throttle_fini ( & active_rpc_cnt ) ;
}
# ifdef HAVE_BG if ( block_desc . bg_block_id ) {
block_desc . reason = slurm_strerror ( comp_msg -> slurm_rc ) ;
block_desc . state = BG_BLOCK_ERROR_FLAG ;
i = select_g_update_block ( & block_desc ) ;
error_code = MAX ( error_code , i ) ;
xfree ( block_desc . bg_block_id ) ;
}
# endif END_TIMER2 ( "_slurm_rpc_complete_batch_script" ) ;
if ( ( powercap_get_cluster_current_cap ( ) != 0 ) && ( which_power_layout ( ) == 2 ) ) {
layouts_entity_pull_kv ( "power" , "Cluster" , "CurrentSumPower" ) ;
}
if ( error_code ) {
debug2 ( "_slurm_rpc_complete_batch_script JobId=%u: %s " , comp_msg -> job_id , slurm_strerror ( error_code ) ) ;
slurm_send_rc_msg ( msg , error_code ) ;
}
else {
debug2 ( "_slurm_rpc_complete_batch_script JobId=%u %s" , comp_msg -> job_id , TIME_STR ) ;
slurmctld_diag_stats . jobs_completed ++ ;
dump_job = true ;
if ( replace_batch_job ( msg , job_ptr , running_composite ) ) * run_scheduler = true ;
}
if ( ! running_composite && * run_scheduler ) ( void ) schedule ( 0 ) ;
if ( dump_job ) ( void ) schedule_job_save ( ) ;
if ( dump_node ) ( void ) schedule_node_save ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static UConverter * _HZ_SafeClone ( const UConverter * cnv , void * stackBuffer , int32_t * pBufferSize , UErrorCode * status ) {
struct cloneHZStruct * localClone ;
int32_t size , bufferSizeNeeded = sizeof ( struct cloneHZStruct ) ;
if ( U_FAILURE ( * status ) ) {
return 0 ;
}
if ( * pBufferSize == 0 ) {
* pBufferSize = bufferSizeNeeded ;
return 0 ;
}
localClone = ( struct cloneHZStruct * ) stackBuffer ;
uprv_memcpy ( & localClone -> mydata , cnv -> extraInfo , sizeof ( UConverterDataHZ ) ) ;
localClone -> cnv . extraInfo = & localClone -> mydata ;
localClone -> cnv . isExtraLocal = TRUE ;
size = ( int32_t ) ( sizeof ( UConverter ) + sizeof ( UAlignedMemory ) ) ;
( ( UConverterDataHZ * ) localClone -> cnv . extraInfo ) -> gbConverter = ucnv_safeClone ( ( ( UConverterDataHZ * ) cnv -> extraInfo ) -> gbConverter , & localClone -> subCnv , & size , status ) ;
return & localClone -> cnv ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint32_t e1000e_mac_read_clr8 ( E1000ECore * core , int index ) {
uint32_t ret = core -> mac [ index ] ;
core -> mac [ index ] = 0 ;
core -> mac [ index - 1 ] = 0 ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( ExtensionWelcomeNotificationTest , ShowWelcomeNotificationAgain ) {
StartPreferenceSyncing ( ) ;
SetBooleanPref ( prefs : : kWelcomeNotificationPreviouslyPoppedUp , true ) ;
EXPECT_FALSE ( GetBooleanPref ( prefs : : kWelcomeNotificationDismissed ) ) ;
EXPECT_FALSE ( GetBooleanPref ( prefs : : kWelcomeNotificationDismissedLocal ) ) ;
EXPECT_TRUE ( GetBooleanPref ( prefs : : kWelcomeNotificationPreviouslyPoppedUp ) ) ;
ShowChromeNowNotification ( ) ;
EXPECT_EQ ( message_center ( ) -> add_notification_calls ( ) , 1 ) ;
EXPECT_EQ ( message_center ( ) -> remove_notification_calls ( ) , 0 ) ;
EXPECT_EQ ( message_center ( ) -> notifications_with_shown_as_popup ( ) , 1 ) ;
EXPECT_FALSE ( GetBooleanPref ( prefs : : kWelcomeNotificationDismissed ) ) ;
EXPECT_FALSE ( GetBooleanPref ( prefs : : kWelcomeNotificationDismissedLocal ) ) ;
EXPECT_TRUE ( GetBooleanPref ( prefs : : kWelcomeNotificationPreviouslyPoppedUp ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * ultag_getExtensionValue ( const ULanguageTag * langtag , int32_t idx ) {
const char * val = NULL ;
ExtensionListEntry * cur = langtag -> extensions ;
int32_t i = 0 ;
while ( cur ) {
if ( i == idx ) {
val = cur -> value ;
break ;
}
cur = cur -> next ;
i ++ ;
}
return val ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
vpx_codec_err_t vpx_svc_set_scale_factors ( SvcContext * svc_ctx , const char * scale_factors ) {
SvcInternal * const si = get_svc_internal ( svc_ctx ) ;
if ( svc_ctx == NULL || scale_factors == NULL || si == NULL ) {
return VPX_CODEC_INVALID_PARAM ;
}
strncpy ( si -> scale_factors , scale_factors , sizeof ( si -> scale_factors ) ) ;
si -> scale_factors [ sizeof ( si -> scale_factors ) - 1 ] = '\0' ;
return VPX_CODEC_OK ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
char * TSMatcherLineName ( TSMatcherLine ml , int element ) {
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) ml ) == TS_SUCCESS ) ;
return ( ( ( matcher_line * ) ml ) -> line ) [ 0 ] [ element ] ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
struct st_connection * find_connection_by_name ( const char * name ) {
struct st_connection * con ;
for ( con = connections ;
con < next_con ;
con ++ ) {
if ( ! strcmp ( con -> name , name ) ) {
return con ;
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void gen_vector_table24 ( TrueMotion1Context * s , const uint8_t * sel_vector_table ) {
int len , i , j ;
unsigned char delta_pair ;
for ( i = 0 ;
i < 1024 ;
i += 4 ) {
len = * sel_vector_table ++ / 2 ;
for ( j = 0 ;
j < len ;
j ++ ) {
delta_pair = * sel_vector_table ++ ;
s -> y_predictor_table [ i + j ] = 0xfffffffe & make_ydt24_entry ( delta_pair >> 4 , delta_pair & 0xf , s -> ydt ) ;
s -> c_predictor_table [ i + j ] = 0xfffffffe & make_cdt24_entry ( delta_pair >> 4 , delta_pair & 0xf , s -> cdt ) ;
s -> fat_y_predictor_table [ i + j ] = 0xfffffffe & make_ydt24_entry ( delta_pair >> 4 , delta_pair & 0xf , s -> fat_ydt ) ;
s -> fat_c_predictor_table [ i + j ] = 0xfffffffe & make_cdt24_entry ( delta_pair >> 4 , delta_pair & 0xf , s -> fat_cdt ) ;
}
s -> y_predictor_table [ i + ( j - 1 ) ] |= 1 ;
s -> c_predictor_table [ i + ( j - 1 ) ] |= 1 ;
s -> fat_y_predictor_table [ i + ( j - 1 ) ] |= 1 ;
s -> fat_c_predictor_table [ i + ( j - 1 ) ] |= 1 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int qemuAssignDeviceRedirdevAlias ( virDomainDefPtr def , virDomainRedirdevDefPtr redirdev , int idx ) {
if ( idx == - 1 ) {
size_t i ;
idx = 0 ;
for ( i = 0 ;
i < def -> nredirdevs ;
i ++ ) {
int thisidx ;
if ( ( thisidx = qemuDomainDeviceAliasIndex ( & def -> redirdevs [ i ] -> info , "redir" ) ) < 0 ) {
virReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "Unable to determine device index for redirected device" ) ) ;
return - 1 ;
}
if ( thisidx >= idx ) idx = thisidx + 1 ;
}
}
if ( virAsprintf ( & redirdev -> info . alias , "redir%d" , idx ) < 0 ) return - 1 ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void reconstruct_inter_block ( int plane , int block , BLOCK_SIZE plane_bsize , TX_SIZE tx_size , void * arg ) {
struct inter_args * args = ( struct inter_args * ) arg ;
VP9_COMMON * const cm = args -> cm ;
MACROBLOCKD * const xd = args -> xd ;
struct macroblockd_plane * const pd = & xd -> plane [ plane ] ;
int x , y , eob ;
txfrm_block_to_raster_xy ( plane_bsize , tx_size , block , & x , & y ) ;
eob = vp9_decode_block_tokens ( cm , xd , plane , block , plane_bsize , x , y , tx_size , args -> r ) ;
inverse_transform_block ( xd , plane , block , tx_size , & pd -> dst . buf [ 4 * y * pd -> dst . stride + 4 * x ] , pd -> dst . stride , eob ) ;
* args -> eobtotal += eob ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void zero_hpel ( uint8_t * a , const uint8_t * b , ptrdiff_t stride , int h ) {
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean dissect_usb_ms_bulk_heur ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) {
const gchar usbc [ ] = {
0x55 , 0x53 , 0x42 , 0x43 }
;
const gchar usbs [ ] = {
0x55 , 0x53 , 0x42 , 0x53 }
;
if ( tvb_reported_length ( tvb ) < 4 ) return FALSE ;
if ( tvb_memeql ( tvb , 0 , usbc , sizeof ( usbc ) ) == 0 || tvb_memeql ( tvb , 0 , usbs , sizeof ( usbs ) ) == 0 ) {
dissect_usb_ms_bulk ( tvb , pinfo , tree , data ) ;
return TRUE ;
}
return FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void finishup ( SplineFont * sf , struct alltabs * at ) {
int strlen , shlen , glen , enclen , csetlen , cstrlen , prvlen ;
int base , eotop , strhead ;
int output_enc = ( at -> format == ff_cff && ! isStdEncoding ( sf , at -> map ) ) ;
storesid ( at , NULL ) ;
strlen = ftell ( at -> sidf ) + ( shlen = ftell ( at -> sidh ) ) ;
glen = sizeof ( short ) ;
enclen = ftell ( at -> encoding ) ;
csetlen = ftell ( at -> charset ) ;
cstrlen = ftell ( at -> charstrings ) ;
prvlen = ftell ( at -> private ) ;
base = ftell ( at -> cfff ) ;
if ( base + 6 * 3 + strlen + glen + enclen + csetlen + cstrlen + prvlen > 32767 ) {
at -> cfflongoffset = true ;
base += 5 * 5 + 4 ;
}
else base += 5 * 3 + 4 ;
strhead = 2 + ( at -> sidcnt > 1 ) ;
base += strhead ;
dumpsizedint ( at -> cfff , at -> cfflongoffset , base + strlen + glen , 15 ) ;
if ( output_enc ) dumpsizedint ( at -> cfff , at -> cfflongoffset , base + strlen + glen + csetlen , 16 ) ;
else {
dumpsizedint ( at -> cfff , at -> cfflongoffset , 0 , 16 ) ;
enclen = 0 ;
}
dumpsizedint ( at -> cfff , at -> cfflongoffset , base + strlen + glen + csetlen + enclen , 17 ) ;
dumpsizedint ( at -> cfff , at -> cfflongoffset , at -> privatelen , - 1 ) ;
dumpsizedint ( at -> cfff , at -> cfflongoffset , base + strlen + glen + csetlen + enclen + cstrlen , 18 ) ;
eotop = base - strhead - at -> lenpos - 1 ;
if ( at -> cfflongoffset ) {
fseek ( at -> cfff , 3 , SEEK_SET ) ;
putc ( 4 , at -> cfff ) ;
}
fseek ( at -> cfff , at -> lenpos , SEEK_SET ) ;
putshort ( at -> cfff , eotop ) ;
fseek ( at -> cfff , 0 , SEEK_END ) ;
putshort ( at -> cfff , at -> sidcnt - 1 ) ;
if ( at -> sidcnt != 1 ) {
putc ( at -> sidlongoffset ? 4 : 2 , at -> cfff ) ;
if ( ! ttfcopyfile ( at -> cfff , at -> sidh , base , "CFF-StringBase" ) ) at -> error = true ;
if ( ! ttfcopyfile ( at -> cfff , at -> sidf , base + shlen , "CFF-StringData" ) ) at -> error = true ;
}
putshort ( at -> cfff , 0 ) ;
if ( ! ttfcopyfile ( at -> cfff , at -> charset , base + strlen + glen , "CFF-Charset" ) ) at -> error = true ;
if ( ! ttfcopyfile ( at -> cfff , at -> encoding , base + strlen + glen + csetlen , "CFF-Encoding" ) ) at -> error = true ;
if ( ! ttfcopyfile ( at -> cfff , at -> charstrings , base + strlen + glen + csetlen + enclen , "CFF-CharStrings" ) ) at -> error = true ;
if ( ! ttfcopyfile ( at -> cfff , at -> private , base + strlen + glen + csetlen + enclen + cstrlen , "CFF-Private" ) ) at -> error = true ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint32_t vmsvga_index_read ( void * opaque , uint32_t address ) {
struct vmsvga_state_s * s = opaque ;
return s -> index ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_IS13818AudioSampling ( 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_IS13818AudioSampling , IS13818AudioSampling_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dorestore ( i_ctx_t * i_ctx_p , alloc_save_t * asave ) {
os_ptr op = osp ;
bool last ;
vm_save_t * vmsave ;
int code ;
osp -- ;
restore_fix_stack ( i_ctx_p , & o_stack , asave , false ) ;
restore_fix_stack ( i_ctx_p , & e_stack , asave , true ) ;
restore_fix_stack ( i_ctx_p , & d_stack , asave , false ) ;
do {
vmsave = alloc_save_client_data ( alloc_save_current ( idmemory ) ) ;
gs_grestoreall_for_restore ( igs , vmsave -> gsave ) ;
vmsave -> gsave = 0 ;
code = alloc_restore_step_in ( idmemory , asave ) ;
if ( code < 0 ) return code ;
last = code ;
}
while ( ! last ) ;
{
uint space = icurrent_space ;
ialloc_set_space ( idmemory , avm_local ) ;
ifree_object ( vmsave , "zrestore" ) ;
ialloc_set_space ( idmemory , space ) ;
}
dict_set_top ( ) ;
if ( I_VALIDATE_AFTER_RESTORE ) ivalidate_clean_spaces ( i_ctx_p ) ;
i_ctx_p -> LockFilePermissions = false ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void AbortTTF ( struct alltabs * at , SplineFont * sf ) {
int i ;
if ( at -> loca != NULL ) fclose ( at -> loca ) ;
if ( at -> name != NULL ) fclose ( at -> name ) ;
if ( at -> post != NULL ) fclose ( at -> post ) ;
if ( at -> gpos != NULL ) fclose ( at -> gpos ) ;
if ( at -> gsub != NULL ) fclose ( at -> gsub ) ;
if ( at -> gdef != NULL ) fclose ( at -> gdef ) ;
if ( at -> kern != NULL ) fclose ( at -> kern ) ;
if ( at -> cmap != NULL ) fclose ( at -> cmap ) ;
if ( at -> headf != NULL ) fclose ( at -> headf ) ;
if ( at -> hheadf != NULL ) fclose ( at -> hheadf ) ;
if ( at -> maxpf != NULL ) fclose ( at -> maxpf ) ;
if ( at -> os2f != NULL ) fclose ( at -> os2f ) ;
if ( at -> cvtf != NULL ) fclose ( at -> cvtf ) ;
if ( at -> vheadf != NULL ) fclose ( at -> vheadf ) ;
if ( at -> vorgf != NULL ) fclose ( at -> vorgf ) ;
if ( at -> cfff != NULL ) fclose ( at -> cfff ) ;
if ( at -> gi . glyphs != NULL ) fclose ( at -> gi . glyphs ) ;
if ( at -> gi . hmtx != NULL ) fclose ( at -> gi . hmtx ) ;
if ( at -> gi . vmtx != NULL ) fclose ( at -> gi . vmtx ) ;
if ( at -> fpgmf != NULL ) fclose ( at -> fpgmf ) ;
if ( at -> prepf != NULL ) fclose ( at -> prepf ) ;
if ( at -> gaspf != NULL ) fclose ( at -> gaspf ) ;
if ( at -> sidf != NULL ) fclose ( at -> sidf ) ;
if ( at -> sidh != NULL ) fclose ( at -> sidh ) ;
if ( at -> charset != NULL ) fclose ( at -> charset ) ;
if ( at -> encoding != NULL ) fclose ( at -> encoding ) ;
if ( at -> private != NULL ) fclose ( at -> private ) ;
if ( at -> charstrings != NULL ) fclose ( at -> charstrings ) ;
if ( at -> fdselect != NULL ) fclose ( at -> fdselect ) ;
if ( at -> fdarray != NULL ) fclose ( at -> fdarray ) ;
if ( at -> bdat != NULL ) fclose ( at -> bdat ) ;
if ( at -> bloc != NULL ) fclose ( at -> bloc ) ;
if ( at -> ebsc != NULL ) fclose ( at -> ebsc ) ;
if ( at -> prop != NULL ) fclose ( at -> prop ) ;
if ( at -> opbd != NULL ) fclose ( at -> opbd ) ;
if ( at -> acnt != NULL ) fclose ( at -> acnt ) ;
if ( at -> lcar != NULL ) fclose ( at -> lcar ) ;
if ( at -> feat != NULL ) fclose ( at -> feat ) ;
if ( at -> morx != NULL ) fclose ( at -> morx ) ;
if ( at -> pfed != NULL ) fclose ( at -> pfed ) ;
if ( at -> tex != NULL ) fclose ( at -> tex ) ;
if ( at -> gvar != NULL ) fclose ( at -> gvar ) ;
if ( at -> fvar != NULL ) fclose ( at -> fvar ) ;
if ( at -> cvar != NULL ) fclose ( at -> cvar ) ;
if ( at -> avar != NULL ) fclose ( at -> avar ) ;
for ( i = 0 ;
i < sf -> subfontcnt ;
++ i ) {
if ( at -> fds [ i ] . private != NULL ) fclose ( at -> fds [ i ] . private ) ;
}
if ( sf -> subfontcnt != 0 ) {
free ( sf -> glyphs ) ;
sf -> glyphs = NULL ;
sf -> glyphcnt = sf -> glyphmax = 0 ;
}
free ( at -> fds ) ;
free ( at -> gi . bygid ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_RequestSeqNum ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 736 "./asn1/h225/h225.cnf" h225_packet_info * h225_pi ;
h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
if ( h225_pi != NULL ) {
offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 1U , 65535U , & ( h225_pi -> requestSeqNum ) , FALSE ) ;
# line 744 "./asn1/h225/h225.cnf" }
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void set_glyph ( hb_glyph_info_t & info , hb_font_t * font ) {
font -> get_glyph ( info . codepoint , 0 , & info . glyph_index ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_nlm4_granted ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) {
return dissect_nlm_granted ( tvb , 0 , pinfo , tree , 4 , ( rpc_call_info_value * ) data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int header_afiol ( struct archive_read * a , struct cpio * cpio , struct archive_entry * entry , size_t * namelength , size_t * name_pad ) {
const void * h ;
const char * header ;
a -> archive . archive_format = ARCHIVE_FORMAT_CPIO_AFIO_LARGE ;
a -> archive . archive_format_name = "afio large ASCII" ;
h = __archive_read_ahead ( a , afiol_header_size , NULL ) ;
if ( h == NULL ) return ( ARCHIVE_FATAL ) ;
header = ( const char * ) h ;
archive_entry_set_dev ( entry , ( dev_t ) atol16 ( header + afiol_dev_offset , afiol_dev_size ) ) ;
archive_entry_set_ino ( entry , atol16 ( header + afiol_ino_offset , afiol_ino_size ) ) ;
archive_entry_set_mode ( entry , ( mode_t ) atol8 ( header + afiol_mode_offset , afiol_mode_size ) ) ;
archive_entry_set_uid ( entry , atol16 ( header + afiol_uid_offset , afiol_uid_size ) ) ;
archive_entry_set_gid ( entry , atol16 ( header + afiol_gid_offset , afiol_gid_size ) ) ;
archive_entry_set_nlink ( entry , ( unsigned int ) atol16 ( header + afiol_nlink_offset , afiol_nlink_size ) ) ;
archive_entry_set_rdev ( entry , ( dev_t ) atol16 ( header + afiol_rdev_offset , afiol_rdev_size ) ) ;
archive_entry_set_mtime ( entry , atol16 ( header + afiol_mtime_offset , afiol_mtime_size ) , 0 ) ;
* namelength = ( size_t ) atol16 ( header + afiol_namesize_offset , afiol_namesize_size ) ;
* name_pad = 0 ;
cpio -> entry_bytes_remaining = atol16 ( header + afiol_filesize_offset , afiol_filesize_size ) ;
archive_entry_set_size ( entry , cpio -> entry_bytes_remaining ) ;
cpio -> entry_padding = 0 ;
__archive_read_consume ( a , afiol_header_size ) ;
return ( ARCHIVE_OK ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int qemuMonitorTextSetLink ( qemuMonitorPtr mon , const char * name , enum virDomainNetInterfaceLinkState state ) {
char * info = NULL ;
char * cmd = NULL ;
const char * st_str = NULL ;
if ( state == VIR_DOMAIN_NET_INTERFACE_LINK_STATE_DOWN ) st_str = "off" ;
else st_str = "on" ;
if ( virAsprintf ( & cmd , "set_link %s %s" , name , st_str ) < 0 ) {
virReportOOMError ( ) ;
goto error ;
}
if ( qemuMonitorHMPCommand ( mon , cmd , & info ) < 0 ) {
qemuReportError ( VIR_ERR_OPERATION_FAILED , "%s" , _ ( "set_link operation failed" ) ) ;
goto error ;
}
if ( strstr ( info , "\nunknown " ) ) {
qemuReportError ( VIR_ERR_NO_SUPPORT , "%s" , _ ( "\'set_link\' not supported by this qemu" ) ) ;
goto error ;
}
if ( strstr ( info , "\nDevice " ) ) {
qemuReportError ( VIR_ERR_OPERATION_FAILED , "%s" , _ ( "device name rejected" ) ) ;
goto error ;
}
VIR_FREE ( info ) ;
VIR_FREE ( cmd ) ;
return 0 ;
error : VIR_FREE ( info ) ;
VIR_FREE ( cmd ) ;
return - 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint16 de_tp_epc_ellipsoid_point_with_alt ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len _U_ , gchar * add_string _U_ , int string_len _U_ ) {
guint32 curr_offset ;
guint32 longitude ;
curr_offset = offset ;
proto_tree_add_bits_item ( tree , hf_gsm_a_dtap_epc_latitude_sign , tvb , curr_offset << 3 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_bits_item ( tree , hf_gsm_a_dtap_epc_degrees_latitude , tvb , ( curr_offset << 3 ) + 1 , 23 , ENC_BIG_ENDIAN ) ;
curr_offset += 3 ;
longitude = tvb_get_ntoh24 ( tvb , curr_offset ) ;
proto_tree_add_int_format ( tree , hf_gsm_a_dtap_epc_degrees_longitude , tvb , curr_offset , 3 , longitude , "%s = %s: %d" , decode_bits_in_field ( curr_offset << 3 , 24 , longitude ) , proto_registrar_get_name ( hf_gsm_a_dtap_epc_degrees_longitude ) , longitude - 8388608 ) ;
curr_offset += 3 ;
proto_tree_add_bits_item ( tree , hf_gsm_a_dtap_epc_altitude_dir , tvb , curr_offset << 3 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_bits_item ( tree , hf_gsm_a_dtap_epc_altitude , tvb , ( curr_offset << 3 ) + 1 , 15 , ENC_BIG_ENDIAN ) ;
curr_offset += 2 ;
return ( curr_offset - offset ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
VirtIOS390Device * s390_virtio_bus_console ( VirtIOS390Bus * bus ) {
return bus -> console ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( MultiProfileDownloadNotificationTest , DownloadMultipleFiles ) {
AddAllUsers ( ) ;
GURL url ( net : : URLRequestSlowDownloadJob : : kUnknownSizeUrl ) ;
Profile * profile1 = GetProfileByIndex ( 1 ) ;
Profile * profile2 = GetProfileByIndex ( 2 ) ;
Browser * browser1 = CreateBrowser ( profile1 ) ;
Browser * browser2 = CreateBrowser ( profile2 ) ;
EXPECT_NE ( browser1 , browser2 ) ;
display_service1_ = std : : make_unique < NotificationDisplayServiceTester > ( profile1 ) ;
display_service2_ = std : : make_unique < NotificationDisplayServiceTester > ( profile2 ) ;
ui_test_utils : : NavigateToURL ( browser1 , url ) ;
WaitForDownloadNotificationForDisplayService ( display_service1_ . get ( ) ) ;
std : : vector < download : : DownloadItem * > downloads ;
GetDownloadManager ( browser1 ) -> GetAllDownloads ( & downloads ) ;
EXPECT_EQ ( 1u , downloads . size ( ) ) ;
download : : DownloadItem * download1 = downloads [ 0 ] ;
auto notifications1 = display_service1_ -> GetDisplayedNotificationsForType ( NotificationHandler : : Type : : TRANSIENT ) ;
ASSERT_EQ ( 1u , notifications1 . size ( ) ) ;
std : : string notification_id_user1 = notifications1 [ 0 ] . id ( ) ;
EXPECT_FALSE ( notification_id_user1 . empty ( ) ) ;
ui_test_utils : : NavigateToURL ( browser2 , url ) ;
WaitForDownloadNotificationForDisplayService ( display_service2_ . get ( ) ) ;
auto notifications2 = display_service2_ -> GetDisplayedNotificationsForType ( NotificationHandler : : Type : : TRANSIENT ) ;
ASSERT_EQ ( 1u , notifications2 . size ( ) ) ;
std : : string notification_id_user2 = notifications2 [ 0 ] . id ( ) ;
EXPECT_FALSE ( notification_id_user2 . empty ( ) ) ;
downloads . clear ( ) ;
GetDownloadManager ( browser2 ) -> GetAllDownloads ( & downloads ) ;
ASSERT_EQ ( 1u , downloads . size ( ) ) ;
ui_test_utils : : NavigateToURL ( browser2 , url ) ;
WaitForDownloadNotificationForDisplayService ( display_service2_ . get ( ) ) ;
notifications2 = display_service2_ -> GetDisplayedNotificationsForType ( NotificationHandler : : Type : : TRANSIENT ) ;
ASSERT_EQ ( 2u , notifications2 . size ( ) ) ;
downloads . clear ( ) ;
GetDownloadManager ( browser2 ) -> GetAllDownloads ( & downloads ) ;
ASSERT_EQ ( 2u , downloads . size ( ) ) ;
download : : DownloadItem * download2 = downloads [ 0 ] ;
download : : DownloadItem * download3 = downloads [ 1 ] ;
EXPECT_NE ( download1 , download2 ) ;
EXPECT_NE ( download1 , download3 ) ;
EXPECT_NE ( download2 , download3 ) ;
downloads . clear ( ) ;
GetDownloadManager ( browser1 ) -> GetAllDownloads ( & downloads ) ;
ASSERT_EQ ( 1u , downloads . size ( ) ) ;
EXPECT_EQ ( download1 , downloads [ 0 ] ) ;
EXPECT_EQ ( message_center : : NOTIFICATION_TYPE_PROGRESS , display_service1_ -> GetNotification ( notification_id_user1 ) -> type ( ) ) ;
EXPECT_EQ ( - 1 , display_service1_ -> GetNotification ( notification_id_user1 ) -> progress ( ) ) ;
notifications2 = display_service2_ -> GetDisplayedNotificationsForType ( NotificationHandler : : Type : : TRANSIENT ) ;
EXPECT_EQ ( 2u , notifications2 . size ( ) ) ;
for ( const auto & notification : notifications2 ) {
EXPECT_EQ ( message_center : : NOTIFICATION_TYPE_PROGRESS , notification . type ( ) ) ;
EXPECT_EQ ( - 1 , notification . progress ( ) ) ;
}
content : : DownloadTestObserverTerminal download_terminal_observer ( GetDownloadManager ( browser1 ) , 1u , content : : DownloadTestObserver : : ON_DANGEROUS_DOWNLOAD_FAIL ) ;
content : : DownloadTestObserverTerminal download_terminal_observer2 ( GetDownloadManager ( browser2 ) , 2u , content : : DownloadTestObserver : : ON_DANGEROUS_DOWNLOAD_FAIL ) ;
ui_test_utils : : NavigateToURL ( browser1 , GURL ( net : : URLRequestSlowDownloadJob : : kFinishDownloadUrl ) ) ;
ui_test_utils : : NavigateToURL ( browser2 , GURL ( net : : URLRequestSlowDownloadJob : : kFinishDownloadUrl ) ) ;
download_terminal_observer . WaitForFinished ( ) ;
download_terminal_observer2 . WaitForFinished ( ) ;
EXPECT_EQ ( message_center : : NOTIFICATION_TYPE_BASE_FORMAT , display_service1_ -> GetNotification ( notification_id_user1 ) -> type ( ) ) ;
notifications2 = display_service2_ -> GetDisplayedNotificationsForType ( NotificationHandler : : Type : : TRANSIENT ) ;
EXPECT_EQ ( 2u , notifications2 . size ( ) ) ;
for ( const auto & notification : notifications2 ) {
EXPECT_EQ ( message_center : : NOTIFICATION_TYPE_BASE_FORMAT , notification . type ( ) ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void log_invalid_scale_factor ( SvcContext * svc_ctx , const char * value ) {
svc_log ( svc_ctx , SVC_LOG_ERROR , "svc scale-factors: invalid value %s\n" , value ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
fz_pixmap * fz_expand_indexed_pixmap ( fz_context * ctx , const fz_pixmap * src , int alpha ) {
struct indexed * idx ;
fz_pixmap * dst ;
const unsigned char * s ;
unsigned char * d ;
int y , x , k , n , high ;
unsigned char * lookup ;
fz_irect bbox ;
int s_line_inc , d_line_inc ;
assert ( src -> colorspace -> to_ccs == indexed_to_rgb || src -> colorspace -> to_ccs == indexed_to_alt ) ;
assert ( src -> n == 1 + alpha ) ;
idx = src -> colorspace -> data ;
high = idx -> high ;
lookup = idx -> lookup ;
n = idx -> base -> n ;
dst = fz_new_pixmap_with_bbox ( ctx , idx -> base , fz_pixmap_bbox ( ctx , src , & bbox ) , src -> seps , alpha ) ;
s = src -> samples ;
d = dst -> samples ;
s_line_inc = src -> stride - src -> w * src -> n ;
d_line_inc = dst -> stride - dst -> w * dst -> n ;
if ( alpha ) {
for ( y = 0 ;
y < src -> h ;
y ++ ) {
for ( x = 0 ;
x < src -> w ;
x ++ ) {
int v = * s ++ ;
int a = * s ++ ;
int aa = a + ( a >> 7 ) ;
v = fz_mini ( v , high ) ;
for ( k = 0 ;
k < n ;
k ++ ) * d ++ = ( aa * lookup [ v * n + k ] + 128 ) >> 8 ;
* d ++ = a ;
}
s += s_line_inc ;
d += d_line_inc ;
}
}
else {
for ( y = 0 ;
y < src -> h ;
y ++ ) {
for ( x = 0 ;
x < src -> w ;
x ++ ) {
int v = * s ++ ;
v = fz_mini ( v , high ) ;
for ( k = 0 ;
k < n ;
k ++ ) * d ++ = lookup [ v * n + k ] ;
}
s += s_line_inc ;
d += d_line_inc ;
}
}
if ( src -> flags & FZ_PIXMAP_FLAG_INTERPOLATE ) dst -> flags |= FZ_PIXMAP_FLAG_INTERPOLATE ;
else dst -> flags &= ~ FZ_PIXMAP_FLAG_INTERPOLATE ;
return dst ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_IndR_multiplex ( 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_IndR_multiplex , IndR_multiplex_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ssl3_read_bytes ( SSL * s , int type , int * recvd_type , unsigned char * buf , int len , int peek ) {
int al , i , j , ret ;
unsigned int n , curr_rec , num_recs , read_bytes ;
SSL3_RECORD * rr ;
SSL3_BUFFER * rbuf ;
void ( * cb ) ( const SSL * ssl , int type2 , int val ) = NULL ;
rbuf = & s -> rlayer . rbuf ;
if ( ! SSL3_BUFFER_is_initialised ( rbuf ) ) {
if ( ! ssl3_setup_read_buffer ( s ) ) return ( - 1 ) ;
}
if ( ( type && ( type != SSL3_RT_APPLICATION_DATA ) && ( type != SSL3_RT_HANDSHAKE ) ) || ( peek && ( type != SSL3_RT_APPLICATION_DATA ) ) ) {
SSLerr ( SSL_F_SSL3_READ_BYTES , ERR_R_INTERNAL_ERROR ) ;
return - 1 ;
}
if ( ( type == SSL3_RT_HANDSHAKE ) && ( s -> rlayer . handshake_fragment_len > 0 ) ) {
unsigned char * src = s -> rlayer . handshake_fragment ;
unsigned char * dst = buf ;
unsigned int k ;
n = 0 ;
while ( ( len > 0 ) && ( s -> rlayer . handshake_fragment_len > 0 ) ) {
* dst ++ = * src ++ ;
len -- ;
s -> rlayer . handshake_fragment_len -- ;
n ++ ;
}
for ( k = 0 ;
k < s -> rlayer . handshake_fragment_len ;
k ++ ) s -> rlayer . handshake_fragment [ k ] = * src ++ ;
if ( recvd_type != NULL ) * recvd_type = SSL3_RT_HANDSHAKE ;
return n ;
}
if ( ! ossl_statem_get_in_handshake ( s ) && SSL_in_init ( s ) ) {
i = s -> handshake_func ( s ) ;
if ( i < 0 ) return ( i ) ;
if ( i == 0 ) {
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_R_SSL_HANDSHAKE_FAILURE ) ;
return ( - 1 ) ;
}
}
start : s -> rwstate = SSL_NOTHING ;
rr = s -> rlayer . rrec ;
num_recs = RECORD_LAYER_get_numrpipes ( & s -> rlayer ) ;
do {
if ( num_recs == 0 ) {
ret = ssl3_get_record ( s ) ;
if ( ret <= 0 ) return ( ret ) ;
num_recs = RECORD_LAYER_get_numrpipes ( & s -> rlayer ) ;
if ( num_recs == 0 ) {
al = SSL_AD_INTERNAL_ERROR ;
SSLerr ( SSL_F_SSL3_READ_BYTES , ERR_R_INTERNAL_ERROR ) ;
goto f_err ;
}
}
for ( curr_rec = 0 ;
curr_rec < num_recs && SSL3_RECORD_is_read ( & rr [ curr_rec ] ) ;
curr_rec ++ ) ;
if ( curr_rec == num_recs ) {
RECORD_LAYER_set_numrpipes ( & s -> rlayer , 0 ) ;
num_recs = 0 ;
curr_rec = 0 ;
}
}
while ( num_recs == 0 ) ;
rr = & rr [ curr_rec ] ;
if ( s -> s3 -> change_cipher_spec && ( SSL3_RECORD_get_type ( rr ) != SSL3_RT_HANDSHAKE ) ) {
al = SSL_AD_UNEXPECTED_MESSAGE ;
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_R_DATA_BETWEEN_CCS_AND_FINISHED ) ;
goto f_err ;
}
if ( s -> shutdown & SSL_RECEIVED_SHUTDOWN ) {
SSL3_RECORD_set_length ( rr , 0 ) ;
s -> rwstate = SSL_NOTHING ;
return ( 0 ) ;
}
if ( type == SSL3_RECORD_get_type ( rr ) || ( SSL3_RECORD_get_type ( rr ) == SSL3_RT_CHANGE_CIPHER_SPEC && type == SSL3_RT_HANDSHAKE && recvd_type != NULL ) ) {
if ( SSL_in_init ( s ) && ( type == SSL3_RT_APPLICATION_DATA ) && ( s -> enc_read_ctx == NULL ) ) {
al = SSL_AD_UNEXPECTED_MESSAGE ;
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_R_APP_DATA_IN_HANDSHAKE ) ;
goto f_err ;
}
if ( type == SSL3_RT_HANDSHAKE && SSL3_RECORD_get_type ( rr ) == SSL3_RT_CHANGE_CIPHER_SPEC && s -> rlayer . handshake_fragment_len > 0 ) {
al = SSL_AD_UNEXPECTED_MESSAGE ;
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_R_CCS_RECEIVED_EARLY ) ;
goto f_err ;
}
if ( recvd_type != NULL ) * recvd_type = SSL3_RECORD_get_type ( rr ) ;
if ( len <= 0 ) return ( len ) ;
read_bytes = 0 ;
do {
if ( ( unsigned int ) len - read_bytes > SSL3_RECORD_get_length ( rr ) ) n = SSL3_RECORD_get_length ( rr ) ;
else n = ( unsigned int ) len - read_bytes ;
memcpy ( buf , & ( rr -> data [ rr -> off ] ) , n ) ;
buf += n ;
if ( ! peek ) {
SSL3_RECORD_sub_length ( rr , n ) ;
SSL3_RECORD_add_off ( rr , n ) ;
if ( SSL3_RECORD_get_length ( rr ) == 0 ) {
s -> rlayer . rstate = SSL_ST_READ_HEADER ;
SSL3_RECORD_set_off ( rr , 0 ) ;
SSL3_RECORD_set_read ( rr ) ;
}
}
if ( SSL3_RECORD_get_length ( rr ) == 0 || ( peek && n == SSL3_RECORD_get_length ( rr ) ) ) {
curr_rec ++ ;
rr ++ ;
}
read_bytes += n ;
}
while ( type == SSL3_RT_APPLICATION_DATA && curr_rec < num_recs && read_bytes < ( unsigned int ) len ) ;
if ( read_bytes == 0 ) {
goto start ;
}
if ( ! peek && curr_rec == num_recs && ( s -> mode & SSL_MODE_RELEASE_BUFFERS ) && SSL3_BUFFER_get_left ( rbuf ) == 0 ) ssl3_release_read_buffer ( s ) ;
return read_bytes ;
}
if ( rr -> rec_version == SSL2_VERSION ) {
al = SSL_AD_INTERNAL_ERROR ;
SSLerr ( SSL_F_SSL3_READ_BYTES , ERR_R_INTERNAL_ERROR ) ;
goto f_err ;
}
if ( s -> method -> version == TLS_ANY_VERSION && ( s -> server || rr -> type != SSL3_RT_ALERT ) ) {
s -> version = rr -> rec_version ;
al = SSL_AD_UNEXPECTED_MESSAGE ;
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_R_UNEXPECTED_MESSAGE ) ;
goto f_err ;
}
{
unsigned int dest_maxlen = 0 ;
unsigned char * dest = NULL ;
unsigned int * dest_len = NULL ;
if ( SSL3_RECORD_get_type ( rr ) == SSL3_RT_HANDSHAKE ) {
dest_maxlen = sizeof s -> rlayer . handshake_fragment ;
dest = s -> rlayer . handshake_fragment ;
dest_len = & s -> rlayer . handshake_fragment_len ;
}
else if ( SSL3_RECORD_get_type ( rr ) == SSL3_RT_ALERT ) {
dest_maxlen = sizeof s -> rlayer . alert_fragment ;
dest = s -> rlayer . alert_fragment ;
dest_len = & s -> rlayer . alert_fragment_len ;
}
if ( dest_maxlen > 0 ) {
n = dest_maxlen - * dest_len ;
if ( SSL3_RECORD_get_length ( rr ) < n ) n = SSL3_RECORD_get_length ( rr ) ;
while ( n -- > 0 ) {
dest [ ( * dest_len ) ++ ] = SSL3_RECORD_get_data ( rr ) [ SSL3_RECORD_get_off ( rr ) ] ;
SSL3_RECORD_add_off ( rr , 1 ) ;
SSL3_RECORD_add_length ( rr , - 1 ) ;
}
if ( * dest_len < dest_maxlen ) {
SSL3_RECORD_set_read ( rr ) ;
goto start ;
}
}
}
if ( ( ! s -> server ) && ( s -> rlayer . handshake_fragment_len >= 4 ) && ( s -> rlayer . handshake_fragment [ 0 ] == SSL3_MT_HELLO_REQUEST ) && ( s -> session != NULL ) && ( s -> session -> cipher != NULL ) ) {
s -> rlayer . handshake_fragment_len = 0 ;
if ( ( s -> rlayer . handshake_fragment [ 1 ] != 0 ) || ( s -> rlayer . handshake_fragment [ 2 ] != 0 ) || ( s -> rlayer . handshake_fragment [ 3 ] != 0 ) ) {
al = SSL_AD_DECODE_ERROR ;
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_R_BAD_HELLO_REQUEST ) ;
goto f_err ;
}
if ( s -> msg_callback ) s -> msg_callback ( 0 , s -> version , SSL3_RT_HANDSHAKE , s -> rlayer . handshake_fragment , 4 , s , s -> msg_callback_arg ) ;
if ( SSL_is_init_finished ( s ) && ! ( s -> s3 -> flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS ) && ! s -> s3 -> renegotiate ) {
ssl3_renegotiate ( s ) ;
if ( ssl3_renegotiate_check ( s ) ) {
i = s -> handshake_func ( s ) ;
if ( i < 0 ) return ( i ) ;
if ( i == 0 ) {
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_R_SSL_HANDSHAKE_FAILURE ) ;
return ( - 1 ) ;
}
if ( ! ( s -> mode & SSL_MODE_AUTO_RETRY ) ) {
if ( SSL3_BUFFER_get_left ( rbuf ) == 0 ) {
BIO * bio ;
s -> rwstate = SSL_READING ;
bio = SSL_get_rbio ( s ) ;
BIO_clear_retry_flags ( bio ) ;
BIO_set_retry_read ( bio ) ;
return ( - 1 ) ;
}
}
}
}
goto start ;
}
if ( s -> server && SSL_is_init_finished ( s ) && ! s -> s3 -> send_connection_binding && ( s -> version > SSL3_VERSION ) && ( s -> rlayer . handshake_fragment_len >= 4 ) && ( s -> rlayer . handshake_fragment [ 0 ] == SSL3_MT_CLIENT_HELLO ) && ( s -> session != NULL ) && ( s -> session -> cipher != NULL ) && ! ( s -> ctx -> options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION ) ) {
SSL3_RECORD_set_length ( rr , 0 ) ;
SSL3_RECORD_set_read ( rr ) ;
ssl3_send_alert ( s , SSL3_AL_WARNING , SSL_AD_NO_RENEGOTIATION ) ;
goto start ;
}
if ( s -> rlayer . alert_fragment_len >= 2 ) {
int alert_level = s -> rlayer . alert_fragment [ 0 ] ;
int alert_descr = s -> rlayer . alert_fragment [ 1 ] ;
s -> rlayer . alert_fragment_len = 0 ;
if ( s -> msg_callback ) s -> msg_callback ( 0 , s -> version , SSL3_RT_ALERT , s -> rlayer . alert_fragment , 2 , s , s -> msg_callback_arg ) ;
if ( s -> info_callback != NULL ) cb = s -> info_callback ;
else if ( s -> ctx -> info_callback != NULL ) cb = s -> ctx -> info_callback ;
if ( cb != NULL ) {
j = ( alert_level << 8 ) | alert_descr ;
cb ( s , SSL_CB_READ_ALERT , j ) ;
}
if ( alert_level == SSL3_AL_WARNING ) {
s -> s3 -> warn_alert = alert_descr ;
SSL3_RECORD_set_read ( rr ) ;
if ( alert_descr == SSL_AD_CLOSE_NOTIFY ) {
s -> shutdown |= SSL_RECEIVED_SHUTDOWN ;
return ( 0 ) ;
}
else if ( alert_descr == SSL_AD_NO_RENEGOTIATION ) {
al = SSL_AD_HANDSHAKE_FAILURE ;
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_R_NO_RENEGOTIATION ) ;
goto f_err ;
}
# ifdef SSL_AD_MISSING_SRP_USERNAME else if ( alert_descr == SSL_AD_MISSING_SRP_USERNAME ) return ( 0 ) ;
# endif }
else if ( alert_level == SSL3_AL_FATAL ) {
char tmp [ 16 ] ;
s -> rwstate = SSL_NOTHING ;
s -> s3 -> fatal_alert = alert_descr ;
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_AD_REASON_OFFSET + alert_descr ) ;
BIO_snprintf ( tmp , sizeof tmp , "%d" , alert_descr ) ;
ERR_add_error_data ( 2 , "SSL alert number " , tmp ) ;
s -> shutdown |= SSL_RECEIVED_SHUTDOWN ;
SSL3_RECORD_set_read ( rr ) ;
SSL_CTX_remove_session ( s -> session_ctx , s -> session ) ;
return ( 0 ) ;
}
else {
al = SSL_AD_ILLEGAL_PARAMETER ;
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_R_UNKNOWN_ALERT_TYPE ) ;
goto f_err ;
}
goto start ;
}
if ( s -> shutdown & SSL_SENT_SHUTDOWN ) {
s -> rwstate = SSL_NOTHING ;
SSL3_RECORD_set_length ( rr , 0 ) ;
SSL3_RECORD_set_read ( rr ) ;
return ( 0 ) ;
}
if ( SSL3_RECORD_get_type ( rr ) == SSL3_RT_CHANGE_CIPHER_SPEC ) {
al = SSL_AD_UNEXPECTED_MESSAGE ;
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_R_CCS_RECEIVED_EARLY ) ;
goto f_err ;
}
if ( ( s -> rlayer . handshake_fragment_len >= 4 ) && ! ossl_statem_get_in_handshake ( s ) ) {
if ( SSL_is_init_finished ( s ) && ! ( s -> s3 -> flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS ) ) {
ossl_statem_set_in_init ( s , 1 ) ;
s -> renegotiate = 1 ;
s -> new_session = 1 ;
}
i = s -> handshake_func ( s ) ;
if ( i < 0 ) return ( i ) ;
if ( i == 0 ) {
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_R_SSL_HANDSHAKE_FAILURE ) ;
return ( - 1 ) ;
}
if ( ! ( s -> mode & SSL_MODE_AUTO_RETRY ) ) {
if ( SSL3_BUFFER_get_left ( rbuf ) == 0 ) {
BIO * bio ;
s -> rwstate = SSL_READING ;
bio = SSL_get_rbio ( s ) ;
BIO_clear_retry_flags ( bio ) ;
BIO_set_retry_read ( bio ) ;
return ( - 1 ) ;
}
}
goto start ;
}
switch ( SSL3_RECORD_get_type ( rr ) ) {
default : if ( s -> version >= TLS1_VERSION && s -> version <= TLS1_1_VERSION ) {
SSL3_RECORD_set_length ( rr , 0 ) ;
SSL3_RECORD_set_read ( rr ) ;
goto start ;
}
al = SSL_AD_UNEXPECTED_MESSAGE ;
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_R_UNEXPECTED_RECORD ) ;
goto f_err ;
case SSL3_RT_CHANGE_CIPHER_SPEC : case SSL3_RT_ALERT : case SSL3_RT_HANDSHAKE : al = SSL_AD_UNEXPECTED_MESSAGE ;
SSLerr ( SSL_F_SSL3_READ_BYTES , ERR_R_INTERNAL_ERROR ) ;
goto f_err ;
case SSL3_RT_APPLICATION_DATA : if ( ossl_statem_app_data_allowed ( s ) ) {
s -> s3 -> in_read_app_data = 2 ;
return ( - 1 ) ;
}
else {
al = SSL_AD_UNEXPECTED_MESSAGE ;
SSLerr ( SSL_F_SSL3_READ_BYTES , SSL_R_UNEXPECTED_RECORD ) ;
goto f_err ;
}
}
f_err : ssl3_send_alert ( s , SSL3_AL_FATAL , al ) ;
return ( - 1 ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static err_status_t srtp_unprotect_aead ( srtp_ctx_t * ctx , srtp_stream_ctx_t * stream , int delta , xtd_seq_num_t est , void * srtp_hdr , unsigned int * pkt_octet_len ) {
srtp_hdr_t * hdr = ( srtp_hdr_t * ) srtp_hdr ;
uint32_t * enc_start ;
unsigned int enc_octet_len = 0 ;
v128_t iv ;
err_status_t status ;
int tag_len ;
unsigned int aad_len ;
debug_print ( mod_srtp , "function srtp_unprotect_aead" , NULL ) ;
# ifdef NO_64BIT_MATH debug_print2 ( mod_srtp , "estimated u_packet index: %08x%08x" , high32 ( est ) , low32 ( est ) ) ;
# else debug_print ( mod_srtp , "estimated u_packet index: %016llx" , est ) ;
# endif tag_len = auth_get_tag_length ( stream -> rtp_auth ) ;
srtp_calc_aead_iv ( stream , & iv , & est , hdr ) ;
status = cipher_set_iv ( stream -> rtp_cipher , & iv , direction_decrypt ) ;
if ( status ) {
return err_status_cipher_fail ;
}
enc_start = ( uint32_t * ) hdr + uint32s_in_rtp_header + hdr -> cc ;
if ( hdr -> x == 1 ) {
srtp_hdr_xtnd_t * xtn_hdr = ( srtp_hdr_xtnd_t * ) enc_start ;
enc_start += ( ntohs ( xtn_hdr -> length ) + 1 ) ;
}
if ( ! ( ( uint8_t * ) enc_start < ( uint8_t * ) hdr + * pkt_octet_len ) ) return err_status_parse_err ;
enc_octet_len = ( unsigned int ) ( * pkt_octet_len - ( ( uint8_t * ) enc_start - ( uint8_t * ) hdr ) ) ;
if ( enc_octet_len < ( unsigned int ) tag_len ) {
return err_status_cipher_fail ;
}
switch ( key_limit_update ( stream -> limit ) ) {
case key_event_normal : break ;
case key_event_soft_limit : srtp_handle_event ( ctx , stream , event_key_soft_limit ) ;
break ;
case key_event_hard_limit : srtp_handle_event ( ctx , stream , event_key_hard_limit ) ;
return err_status_key_expired ;
default : break ;
}
aad_len = ( uint8_t * ) enc_start - ( uint8_t * ) hdr ;
status = cipher_set_aad ( stream -> rtp_cipher , ( uint8_t * ) hdr , aad_len ) ;
if ( status ) {
return ( err_status_cipher_fail ) ;
}
status = cipher_decrypt ( stream -> rtp_cipher , ( uint8_t * ) enc_start , & enc_octet_len ) ;
if ( status ) {
return status ;
}
if ( stream -> direction != dir_srtp_receiver ) {
if ( stream -> direction == dir_unknown ) {
stream -> direction = dir_srtp_receiver ;
}
else {
srtp_handle_event ( ctx , stream , event_ssrc_collision ) ;
}
}
if ( stream == ctx -> stream_template ) {
srtp_stream_ctx_t * new_stream ;
status = srtp_stream_clone ( ctx -> stream_template , hdr -> ssrc , & new_stream ) ;
if ( status ) {
return status ;
}
new_stream -> next = ctx -> stream_list ;
ctx -> stream_list = new_stream ;
stream = new_stream ;
}
rdbx_add_index ( & stream -> rtp_rdbx , delta ) ;
* pkt_octet_len -= tag_len ;
return err_status_ok ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_order_param ( ) {
MYSQL_STMT * stmt ;
int rc ;
myheader ( "test_order_param" ) ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS t1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE t1(a INT, b char(10))" ) ;
myquery ( rc ) ;
stmt = mysql_simple_prepare ( mysql , "select sum(a) + 200, 1 from t1 " " union distinct " "select sum(a) + 200, 1 from t1 group by b " ) ;
check_stmt ( stmt ) ;
mysql_stmt_close ( stmt ) ;
stmt = mysql_simple_prepare ( mysql , "select sum(a) + 200, ? from t1 group by b " " union distinct " "select sum(a) + 200, 1 from t1 group by b " ) ;
check_stmt ( stmt ) ;
mysql_stmt_close ( stmt ) ;
stmt = mysql_simple_prepare ( mysql , "select sum(a) + 200, ? from t1 " " union distinct " "select sum(a) + 200, 1 from t1 group by b " ) ;
check_stmt ( stmt ) ;
mysql_stmt_close ( stmt ) ;
rc = mysql_query ( mysql , "DROP TABLE t1" ) ;
myquery ( rc ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int tls1_enc ( SSL * s , SSL3_RECORD * recs , unsigned int n_recs , int send ) {
EVP_CIPHER_CTX * ds ;
size_t reclen [ SSL_MAX_PIPELINES ] ;
unsigned char buf [ SSL_MAX_PIPELINES ] [ EVP_AEAD_TLS1_AAD_LEN ] ;
int bs , i , j , k , pad = 0 , ret , mac_size = 0 ;
const EVP_CIPHER * enc ;
unsigned int ctr ;
if ( send ) {
if ( EVP_MD_CTX_md ( s -> write_hash ) ) {
int n = EVP_MD_CTX_size ( s -> write_hash ) ;
OPENSSL_assert ( n >= 0 ) ;
}
ds = s -> enc_write_ctx ;
if ( s -> enc_write_ctx == NULL ) enc = NULL ;
else {
int ivlen ;
enc = EVP_CIPHER_CTX_cipher ( s -> enc_write_ctx ) ;
if ( SSL_USE_EXPLICIT_IV ( s ) && EVP_CIPHER_mode ( enc ) == EVP_CIPH_CBC_MODE ) ivlen = EVP_CIPHER_iv_length ( enc ) ;
else ivlen = 0 ;
if ( ivlen > 1 ) {
for ( ctr = 0 ;
ctr < n_recs ;
ctr ++ ) {
if ( recs [ ctr ] . data != recs [ ctr ] . input ) {
SSLerr ( SSL_F_TLS1_ENC , ERR_R_INTERNAL_ERROR ) ;
return - 1 ;
}
else if ( RAND_bytes ( recs [ ctr ] . input , ivlen ) <= 0 ) {
SSLerr ( SSL_F_TLS1_ENC , ERR_R_INTERNAL_ERROR ) ;
return - 1 ;
}
}
}
}
}
else {
if ( EVP_MD_CTX_md ( s -> read_hash ) ) {
int n = EVP_MD_CTX_size ( s -> read_hash ) ;
OPENSSL_assert ( n >= 0 ) ;
}
ds = s -> enc_read_ctx ;
if ( s -> enc_read_ctx == NULL ) enc = NULL ;
else enc = EVP_CIPHER_CTX_cipher ( s -> enc_read_ctx ) ;
}
if ( ( s -> session == NULL ) || ( ds == NULL ) || ( enc == NULL ) ) {
for ( ctr = 0 ;
ctr < n_recs ;
ctr ++ ) {
memmove ( recs [ ctr ] . data , recs [ ctr ] . input , recs [ ctr ] . length ) ;
recs [ ctr ] . input = recs [ ctr ] . data ;
}
ret = 1 ;
}
else {
bs = EVP_CIPHER_block_size ( EVP_CIPHER_CTX_cipher ( ds ) ) ;
if ( n_recs > 1 ) {
if ( ! ( EVP_CIPHER_flags ( EVP_CIPHER_CTX_cipher ( ds ) ) & EVP_CIPH_FLAG_PIPELINE ) ) {
SSLerr ( SSL_F_TLS1_ENC , SSL_R_PIPELINE_FAILURE ) ;
return - 1 ;
}
}
for ( ctr = 0 ;
ctr < n_recs ;
ctr ++ ) {
reclen [ ctr ] = recs [ ctr ] . length ;
if ( EVP_CIPHER_flags ( EVP_CIPHER_CTX_cipher ( ds ) ) & EVP_CIPH_FLAG_AEAD_CIPHER ) {
unsigned char * seq ;
seq = send ? RECORD_LAYER_get_write_sequence ( & s -> rlayer ) : RECORD_LAYER_get_read_sequence ( & s -> rlayer ) ;
if ( SSL_IS_DTLS ( s ) ) {
unsigned char dtlsseq [ 9 ] , * p = dtlsseq ;
s2n ( send ? DTLS_RECORD_LAYER_get_w_epoch ( & s -> rlayer ) : DTLS_RECORD_LAYER_get_r_epoch ( & s -> rlayer ) , p ) ;
memcpy ( p , & seq [ 2 ] , 6 ) ;
memcpy ( buf [ ctr ] , dtlsseq , 8 ) ;
}
else {
memcpy ( buf [ ctr ] , seq , 8 ) ;
for ( i = 7 ;
i >= 0 ;
i -- ) {
++ seq [ i ] ;
if ( seq [ i ] != 0 ) break ;
}
}
buf [ ctr ] [ 8 ] = recs [ ctr ] . type ;
buf [ ctr ] [ 9 ] = ( unsigned char ) ( s -> version >> 8 ) ;
buf [ ctr ] [ 10 ] = ( unsigned char ) ( s -> version ) ;
buf [ ctr ] [ 11 ] = recs [ ctr ] . length >> 8 ;
buf [ ctr ] [ 12 ] = recs [ ctr ] . length & 0xff ;
pad = EVP_CIPHER_CTX_ctrl ( ds , EVP_CTRL_AEAD_TLS1_AAD , EVP_AEAD_TLS1_AAD_LEN , buf [ ctr ] ) ;
if ( pad <= 0 ) return - 1 ;
if ( send ) {
reclen [ ctr ] += pad ;
recs [ ctr ] . length += pad ;
}
}
else if ( ( bs != 1 ) && send ) {
i = bs - ( ( int ) reclen [ ctr ] % bs ) ;
j = i - 1 ;
for ( k = ( int ) reclen [ ctr ] ;
k < ( int ) ( reclen [ ctr ] + i ) ;
k ++ ) recs [ ctr ] . input [ k ] = j ;
reclen [ ctr ] += i ;
recs [ ctr ] . length += i ;
}
if ( ! send ) {
if ( reclen [ ctr ] == 0 || reclen [ ctr ] % bs != 0 ) return 0 ;
}
}
if ( n_recs > 1 ) {
unsigned char * data [ SSL_MAX_PIPELINES ] ;
for ( ctr = 0 ;
ctr < n_recs ;
ctr ++ ) {
data [ ctr ] = recs [ ctr ] . data ;
}
if ( EVP_CIPHER_CTX_ctrl ( ds , EVP_CTRL_SET_PIPELINE_OUTPUT_BUFS , n_recs , data ) <= 0 ) {
SSLerr ( SSL_F_TLS1_ENC , SSL_R_PIPELINE_FAILURE ) ;
}
for ( ctr = 0 ;
ctr < n_recs ;
ctr ++ ) {
data [ ctr ] = recs [ ctr ] . input ;
}
if ( EVP_CIPHER_CTX_ctrl ( ds , EVP_CTRL_SET_PIPELINE_INPUT_BUFS , n_recs , data ) <= 0 || EVP_CIPHER_CTX_ctrl ( ds , EVP_CTRL_SET_PIPELINE_INPUT_LENS , n_recs , reclen ) <= 0 ) {
SSLerr ( SSL_F_TLS1_ENC , SSL_R_PIPELINE_FAILURE ) ;
return - 1 ;
}
}
i = EVP_Cipher ( ds , recs [ 0 ] . data , recs [ 0 ] . input , reclen [ 0 ] ) ;
if ( ( EVP_CIPHER_flags ( EVP_CIPHER_CTX_cipher ( ds ) ) & EVP_CIPH_FLAG_CUSTOM_CIPHER ) ? ( i < 0 ) : ( i == 0 ) ) return - 1 ;
if ( send == 0 ) {
if ( EVP_CIPHER_mode ( enc ) == EVP_CIPH_GCM_MODE ) {
for ( ctr = 0 ;
ctr < n_recs ;
ctr ++ ) {
recs [ ctr ] . data += EVP_GCM_TLS_EXPLICIT_IV_LEN ;
recs [ ctr ] . input += EVP_GCM_TLS_EXPLICIT_IV_LEN ;
recs [ ctr ] . length -= EVP_GCM_TLS_EXPLICIT_IV_LEN ;
}
}
else if ( EVP_CIPHER_mode ( enc ) == EVP_CIPH_CCM_MODE ) {
for ( ctr = 0 ;
ctr < n_recs ;
ctr ++ ) {
recs [ ctr ] . data += EVP_CCM_TLS_EXPLICIT_IV_LEN ;
recs [ ctr ] . input += EVP_CCM_TLS_EXPLICIT_IV_LEN ;
recs [ ctr ] . length -= EVP_CCM_TLS_EXPLICIT_IV_LEN ;
}
}
}
ret = 1 ;
if ( ! SSL_USE_ETM ( s ) && EVP_MD_CTX_md ( s -> read_hash ) != NULL ) mac_size = EVP_MD_CTX_size ( s -> read_hash ) ;
if ( ( bs != 1 ) && ! send ) {
int tmpret ;
for ( ctr = 0 ;
ctr < n_recs ;
ctr ++ ) {
tmpret = tls1_cbc_remove_padding ( s , & recs [ ctr ] , bs , mac_size ) ;
if ( tmpret == 0 ) return 0 ;
ret = constant_time_select_int ( constant_time_eq_int ( tmpret , 1 ) , ret , - 1 ) ;
}
}
if ( pad && ! send ) {
for ( ctr = 0 ;
ctr < n_recs ;
ctr ++ ) {
recs [ ctr ] . length -= pad ;
}
}
}
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static chr newline ( void ) {
return CHR ( '\n' ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void xsltCompileAttr ( xsltStylesheetPtr style , xmlAttrPtr attr ) {
const xmlChar * str ;
const xmlChar * cur ;
xmlChar * ret = NULL ;
xmlChar * expr = NULL ;
xsltAttrVTPtr avt ;
int i = 0 , lastavt = 0 ;
if ( ( style == NULL ) || ( attr == NULL ) || ( attr -> children == NULL ) ) return ;
if ( ( attr -> children -> type != XML_TEXT_NODE ) || ( attr -> children -> next != NULL ) ) {
xsltTransformError ( NULL , style , attr -> parent , "Attribute '%s': The content is expected to be a single text " "node when compiling an AVT.\n" , attr -> name ) ;
style -> errors ++ ;
return ;
}
str = attr -> children -> content ;
if ( ( xmlStrchr ( str , '{
' ) == NULL ) && ( xmlStrchr ( str , '}
' ) == NULL ) ) return ;
# ifdef WITH_XSLT_DEBUG_AVT xsltGenericDebug ( xsltGenericDebugContext , "Found AVT %s: %s\n" , attr -> name , str ) ;
# endif if ( attr -> psvi != NULL ) {
# ifdef WITH_XSLT_DEBUG_AVT xsltGenericDebug ( xsltGenericDebugContext , "AVT %s: already compiled\n" , attr -> name ) ;
# endif return ;
}
avt = xsltNewAttrVT ( style ) ;
if ( avt == NULL ) return ;
attr -> psvi = avt ;
avt -> nsList = xmlGetNsList ( attr -> doc , attr -> parent ) ;
if ( avt -> nsList != NULL ) {
while ( avt -> nsList [ i ] != NULL ) i ++ ;
}
avt -> nsNr = i ;
cur = str ;
while ( * cur != 0 ) {
if ( * cur == '{
' ) {
if ( * ( cur + 1 ) == '{
' ) {
cur ++ ;
ret = xmlStrncat ( ret , str , cur - str ) ;
cur ++ ;
str = cur ;
continue ;
}
if ( * ( cur + 1 ) == '}
' ) {
ret = xmlStrncat ( ret , str , cur - str ) ;
cur += 2 ;
str = cur ;
continue ;
}
if ( ( ret != NULL ) || ( cur - str > 0 ) ) {
ret = xmlStrncat ( ret , str , cur - str ) ;
str = cur ;
if ( avt -> nb_seg == 0 ) avt -> strstart = 1 ;
if ( ( avt = xsltSetAttrVTsegment ( avt , ( void * ) ret ) ) == NULL ) goto error ;
ret = NULL ;
lastavt = 0 ;
}
cur ++ ;
while ( ( * cur != 0 ) && ( * cur != '}
' ) ) {
if ( ( * cur == '\'' ) || ( * cur == '"' ) ) {
char delim = * ( cur ++ ) ;
while ( ( * cur != 0 ) && ( * cur != delim ) ) cur ++ ;
if ( * cur != 0 ) cur ++ ;
}
else cur ++ ;
}
if ( * cur == 0 ) {
xsltTransformError ( NULL , style , attr -> parent , "Attribute '%s': The AVT has an unmatched '{
'.\n" , attr -> name ) ;
style -> errors ++ ;
goto error ;
}
str ++ ;
expr = xmlStrndup ( str , cur - str ) ;
if ( expr == NULL ) {
XSLT_TODO goto error ;
}
else {
xmlXPathCompExprPtr comp ;
comp = xsltXPathCompile ( style , expr ) ;
if ( comp == NULL ) {
xsltTransformError ( NULL , style , attr -> parent , "Attribute '%s': Failed to compile the expression " "'%s' in the AVT.\n" , attr -> name , expr ) ;
style -> errors ++ ;
goto error ;
}
if ( avt -> nb_seg == 0 ) avt -> strstart = 0 ;
if ( lastavt == 1 ) {
if ( ( avt = xsltSetAttrVTsegment ( avt , NULL ) ) == NULL ) goto error ;
}
if ( ( avt = xsltSetAttrVTsegment ( avt , ( void * ) comp ) ) == NULL ) goto error ;
lastavt = 1 ;
xmlFree ( expr ) ;
expr = NULL ;
}
cur ++ ;
str = cur ;
}
else if ( * cur == '}
' ) {
cur ++ ;
if ( * cur == '}
' ) {
ret = xmlStrncat ( ret , str , cur - str ) ;
cur ++ ;
str = cur ;
continue ;
}
else {
xsltTransformError ( NULL , style , attr -> parent , "Attribute '%s': The AVT has an unmatched '}
'.\n" , attr -> name ) ;
goto error ;
}
}
else cur ++ ;
}
if ( ( ret != NULL ) || ( cur - str > 0 ) ) {
ret = xmlStrncat ( ret , str , cur - str ) ;
str = cur ;
if ( avt -> nb_seg == 0 ) avt -> strstart = 1 ;
if ( ( avt = xsltSetAttrVTsegment ( avt , ( void * ) ret ) ) == NULL ) goto error ;
ret = NULL ;
}
error : if ( avt == NULL ) {
xsltTransformError ( NULL , style , attr -> parent , "xsltCompileAttr: malloc problem\n" ) ;
}
else {
if ( attr -> psvi != avt ) {
attr -> psvi = avt ;
style -> attVTs = avt ;
}
}
if ( ret != NULL ) xmlFree ( ret ) ;
if ( expr != NULL ) xmlFree ( expr ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint16 de_stream_id ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len _U_ , gchar * add_string , int string_len ) {
guint32 curr_offset ;
guint8 oct ;
curr_offset = offset ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
if ( oct == 0x00 ) {
proto_tree_add_uint_format_value ( tree , hf_gsm_a_dtap_stream_identifier , tvb , curr_offset , 1 , oct , "No Bearer (%u)" , oct ) ;
if ( add_string ) g_snprintf ( add_string , string_len , " - (No Bearer)" ) ;
}
else {
proto_tree_add_item ( tree , hf_gsm_a_dtap_stream_identifier , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
if ( add_string ) g_snprintf ( add_string , string_len , " - (%u)" , oct ) ;
}
curr_offset ++ ;
EXTRANEOUS_DATA_CHECK ( len , curr_offset - offset , pinfo , & ei_gsm_a_dtap_extraneous_data ) ;
return ( len ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SPL_METHOD ( SplFileInfo , getFilename ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
int path_len ;
if ( zend_parse_parameters_none ( ) == FAILURE ) {
return ;
}
spl_filesystem_object_get_path ( intern , & path_len TSRMLS_CC ) ;
if ( path_len && path_len < intern -> file_name_len ) {
RETURN_STRINGL ( intern -> file_name + path_len + 1 , intern -> file_name_len - ( path_len + 1 ) , 1 ) ;
}
else {
RETURN_STRINGL ( intern -> file_name , intern -> file_name_len , 1 ) ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
Gif_Stream * Gif_FullReadRecord ( const Gif_Record * gifrec , int read_flags , const char * landmark , Gif_ReadErrorHandler h ) {
Gif_Reader grr ;
if ( ! gifrec ) return 0 ;
make_data_reader ( & grr , gifrec -> data , gifrec -> length ) ;
if ( read_flags & GIF_READ_CONST_RECORD ) read_flags |= GIF_READ_COMPRESSED ;
return read_gif ( & grr , read_flags , landmark , h ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( TemplateURLTest , ExtractSearchTermsFromUTF8URL ) {
TemplateURLData data ;
data . SetURL ( "http://utf-8.ru/?q={
searchTerms}
" ) ;
data . alternate_urls . push_back ( "http://utf-8.ru/#q={
searchTerms}
" ) ;
data . alternate_urls . push_back ( "http://utf-8.ru/path/{
searchTerms}
" ) ;
TemplateURL url ( data ) ;
base : : string16 result ;
EXPECT_TRUE ( url . ExtractSearchTermsFromURL ( GURL ( "http://utf-8.ru/?q=%D0%97%D0%B4%D1%80%D0%B0%D0%B2%D1%81%D1%82" "%D0%B2%D1%83%D0%B9,+%D0%BC%D0%B8%D1%80!" ) , search_terms_data_ , & result ) ) ;
EXPECT_EQ ( base : : WideToUTF16 ( L"\x0417\x0434\x0440\x0430\x0432\x0441\x0442\x0432\x0443\x0439, " L"\x043C\x0438\x0440!" ) , result ) ;
EXPECT_TRUE ( url . ExtractSearchTermsFromURL ( GURL ( "http://utf-8.ru/#q=%D0%B4%D0%B2%D0%B0+%D1%81%D0%BB%D0%BE%D0%B2" "%D0%B0" ) , search_terms_data_ , & result ) ) ;
EXPECT_EQ ( base : : WideToUTF16 ( L"\x0434\x0432\x0430 \x0441\x043B\x043E\x0432\x0430" ) , result ) ;
EXPECT_TRUE ( url . ExtractSearchTermsFromURL ( GURL ( "http://utf-8.ru/path/%D0%B1%D1%83%D0%BA%D0%B2%D1%8B%20%D0%90%20" "%D0%B8%20A" ) , search_terms_data_ , & result ) ) ;
EXPECT_EQ ( base : : WideToUTF16 ( L"\x0431\x0443\x043A\x0432\x044B \x0410 \x0438 A" ) , result ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint nr_of_decimals ( const char * str , const char * end ) {
const char * decimal_point ;
for ( ;
;
) {
if ( str == end ) return 0 ;
if ( * str == 'e' || * str == 'E' ) return NOT_FIXED_DEC ;
if ( * str ++ == '.' ) break ;
}
decimal_point = str ;
for ( ;
str < end && my_isdigit ( system_charset_info , * str ) ;
str ++ ) ;
if ( str < end && ( * str == 'e' || * str == 'E' ) ) return NOT_FIXED_DEC ;
return ( uint ) ( str - decimal_point ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int parse_CInGroupSortAggregSet_type ( tvbuff_t * tvb , int offset , proto_tree * tree , enum CInGroupSortAggregSet_type * type ) {
guint8 tmp = tvb_get_guint8 ( tvb , offset ) ;
switch ( tmp ) {
case GroupIdDefault : * type = GroupIdDefault ;
break ;
case GroupIdMinValue : * type = GroupIdMinValue ;
break ;
case GroupIdNull : * type = GroupIdNull ;
break ;
case GroupIdValue : * type = GroupIdValue ;
break ;
default : DISSECTOR_ASSERT ( FALSE ) ;
break ;
}
proto_tree_add_uint ( tree , hf_mswsp_cingroupsortaggregset_type , tvb , offset , 1 , * type ) ;
return offset + 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_usb_vid_control ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) {
gboolean is_request = ( pinfo -> srcport == NO_ENDPOINT ) ;
usb_conv_info_t * usb_conv_info ;
usb_trans_info_t * usb_trans_info ;
int offset = 0 ;
usb_setup_dissector dissector = NULL ;
const usb_setup_dissector_table_t * tmp ;
if ( data == NULL || ( ( usb_conv_info_t * ) data ) -> usb_trans_info == NULL ) return 0 ;
usb_conv_info = ( usb_conv_info_t * ) data ;
usb_trans_info = usb_conv_info -> usb_trans_info ;
for ( tmp = setup_dissectors ;
tmp -> dissector ;
tmp ++ ) {
if ( tmp -> request == usb_trans_info -> setup . request ) {
dissector = tmp -> dissector ;
break ;
}
}
if ( ! dissector ) return 0 ;
col_set_str ( pinfo -> cinfo , COL_PROTOCOL , "USBVIDEO" ) ;
col_add_fstr ( pinfo -> cinfo , COL_INFO , "%s %s" , val_to_str ( usb_trans_info -> setup . request , setup_request_names_vals , "Unknown type %x" ) , is_request ? "Request " : "Response" ) ;
if ( is_request ) {
proto_tree_add_item ( tree , hf_usb_vid_request , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
offset += 1 ;
}
offset = dissector ( pinfo , tree , tvb , offset , is_request , usb_trans_info , usb_conv_info ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void signal_cb ( int fd , short event , void * arg ) {
struct event * ev = arg ;
signal_del ( ev ) ;
test_ok = 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int flic_decode_frame_15_16BPP ( AVCodecContext * avctx , void * data , int * got_frame , const uint8_t * buf , int buf_size ) {
FlicDecodeContext * s = avctx -> priv_data ;
GetByteContext g2 ;
int pixel_ptr ;
unsigned char palette_idx1 ;
unsigned int frame_size ;
int num_chunks ;
unsigned int chunk_size ;
int chunk_type ;
int i , j , ret ;
int lines ;
int compressed_lines ;
signed short line_packets ;
int y_ptr ;
int byte_run ;
int pixel_skip ;
int pixel_countdown ;
unsigned char * pixels ;
int pixel ;
unsigned int pixel_limit ;
bytestream2_init ( & g2 , buf , buf_size ) ;
if ( ( ret = ff_reget_buffer ( avctx , & s -> frame ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ;
return ret ;
}
pixels = s -> frame . data [ 0 ] ;
pixel_limit = s -> avctx -> height * s -> frame . linesize [ 0 ] ;
frame_size = bytestream2_get_le32 ( & g2 ) ;
bytestream2_skip ( & g2 , 2 ) ;
num_chunks = bytestream2_get_le16 ( & g2 ) ;
bytestream2_skip ( & g2 , 8 ) ;
frame_size -= 16 ;
while ( ( frame_size > 0 ) && ( num_chunks > 0 ) ) {
chunk_size = bytestream2_get_le32 ( & g2 ) ;
chunk_type = bytestream2_get_le16 ( & g2 ) ;
switch ( chunk_type ) {
case FLI_256_COLOR : case FLI_COLOR : av_dlog ( avctx , "Unexpected Palette chunk %d in non-palettized FLC\n" , chunk_type ) ;
bytestream2_skip ( & g2 , chunk_size - 6 ) ;
break ;
case FLI_DELTA : case FLI_DTA_LC : y_ptr = 0 ;
compressed_lines = bytestream2_get_le16 ( & g2 ) ;
while ( compressed_lines > 0 ) {
line_packets = bytestream2_get_le16 ( & g2 ) ;
if ( line_packets < 0 ) {
line_packets = - line_packets ;
y_ptr += line_packets * s -> frame . linesize [ 0 ] ;
}
else {
compressed_lines -- ;
pixel_ptr = y_ptr ;
CHECK_PIXEL_PTR ( 0 ) ;
pixel_countdown = s -> avctx -> width ;
for ( i = 0 ;
i < line_packets ;
i ++ ) {
pixel_skip = bytestream2_get_byte ( & g2 ) ;
pixel_ptr += ( pixel_skip * 2 ) ;
pixel_countdown -= pixel_skip ;
byte_run = sign_extend ( bytestream2_get_byte ( & g2 ) , 8 ) ;
if ( byte_run < 0 ) {
byte_run = - byte_run ;
pixel = bytestream2_get_le16 ( & g2 ) ;
CHECK_PIXEL_PTR ( 2 * byte_run ) ;
for ( j = 0 ;
j < byte_run ;
j ++ , pixel_countdown -= 2 ) {
* ( ( signed short * ) ( & pixels [ pixel_ptr ] ) ) = pixel ;
pixel_ptr += 2 ;
}
}
else {
CHECK_PIXEL_PTR ( 2 * byte_run ) ;
for ( j = 0 ;
j < byte_run ;
j ++ , pixel_countdown -- ) {
* ( ( signed short * ) ( & pixels [ pixel_ptr ] ) ) = bytestream2_get_le16 ( & g2 ) ;
pixel_ptr += 2 ;
}
}
}
y_ptr += s -> frame . linesize [ 0 ] ;
}
}
break ;
case FLI_LC : av_log ( avctx , AV_LOG_ERROR , "Unexpected FLI_LC chunk in non-paletised FLC\n" ) ;
bytestream2_skip ( & g2 , chunk_size - 6 ) ;
break ;
case FLI_BLACK : memset ( pixels , 0x0000 , s -> frame . linesize [ 0 ] * s -> avctx -> height ) ;
break ;
case FLI_BRUN : y_ptr = 0 ;
for ( lines = 0 ;
lines < s -> avctx -> height ;
lines ++ ) {
pixel_ptr = y_ptr ;
bytestream2_skip ( & g2 , 1 ) ;
pixel_countdown = ( s -> avctx -> width * 2 ) ;
while ( pixel_countdown > 0 ) {
byte_run = sign_extend ( bytestream2_get_byte ( & g2 ) , 8 ) ;
if ( byte_run > 0 ) {
palette_idx1 = bytestream2_get_byte ( & g2 ) ;
CHECK_PIXEL_PTR ( byte_run ) ;
for ( j = 0 ;
j < byte_run ;
j ++ ) {
pixels [ pixel_ptr ++ ] = palette_idx1 ;
pixel_countdown -- ;
if ( pixel_countdown < 0 ) av_log ( avctx , AV_LOG_ERROR , "pixel_countdown < 0 (%d) (linea%d)\n" , pixel_countdown , lines ) ;
}
}
else {
byte_run = - byte_run ;
CHECK_PIXEL_PTR ( byte_run ) ;
for ( j = 0 ;
j < byte_run ;
j ++ ) {
palette_idx1 = bytestream2_get_byte ( & g2 ) ;
pixels [ pixel_ptr ++ ] = palette_idx1 ;
pixel_countdown -- ;
if ( pixel_countdown < 0 ) av_log ( avctx , AV_LOG_ERROR , "pixel_countdown < 0 (%d) at line %d\n" , pixel_countdown , lines ) ;
}
}
}
# if HAVE_BIGENDIAN pixel_ptr = y_ptr ;
pixel_countdown = s -> avctx -> width ;
while ( pixel_countdown > 0 ) {
* ( ( signed short * ) ( & pixels [ pixel_ptr ] ) ) = AV_RL16 ( & buf [ pixel_ptr ] ) ;
pixel_ptr += 2 ;
}
# endif y_ptr += s -> frame . linesize [ 0 ] ;
}
break ;
case FLI_DTA_BRUN : y_ptr = 0 ;
for ( lines = 0 ;
lines < s -> avctx -> height ;
lines ++ ) {
pixel_ptr = y_ptr ;
bytestream2_skip ( & g2 , 1 ) ;
pixel_countdown = s -> avctx -> width ;
while ( pixel_countdown > 0 ) {
byte_run = sign_extend ( bytestream2_get_byte ( & g2 ) , 8 ) ;
if ( byte_run > 0 ) {
pixel = bytestream2_get_le16 ( & g2 ) ;
CHECK_PIXEL_PTR ( 2 * byte_run ) ;
for ( j = 0 ;
j < byte_run ;
j ++ ) {
* ( ( signed short * ) ( & pixels [ pixel_ptr ] ) ) = pixel ;
pixel_ptr += 2 ;
pixel_countdown -- ;
if ( pixel_countdown < 0 ) av_log ( avctx , AV_LOG_ERROR , "pixel_countdown < 0 (%d)\n" , pixel_countdown ) ;
}
}
else {
byte_run = - byte_run ;
CHECK_PIXEL_PTR ( 2 * byte_run ) ;
for ( j = 0 ;
j < byte_run ;
j ++ ) {
* ( ( signed short * ) ( & pixels [ pixel_ptr ] ) ) = bytestream2_get_le16 ( & g2 ) ;
pixel_ptr += 2 ;
pixel_countdown -- ;
if ( pixel_countdown < 0 ) av_log ( avctx , AV_LOG_ERROR , "pixel_countdown < 0 (%d)\n" , pixel_countdown ) ;
}
}
}
y_ptr += s -> frame . linesize [ 0 ] ;
}
break ;
case FLI_COPY : case FLI_DTA_COPY : if ( chunk_size - 6 > ( unsigned int ) ( s -> avctx -> width * s -> avctx -> height ) * 2 ) {
av_log ( avctx , AV_LOG_ERROR , "In chunk FLI_COPY : source data (%d bytes) " \ "bigger than image, skipping chunk\n" , chunk_size - 6 ) ;
bytestream2_skip ( & g2 , chunk_size - 6 ) ;
}
else {
for ( y_ptr = 0 ;
y_ptr < s -> frame . linesize [ 0 ] * s -> avctx -> height ;
y_ptr += s -> frame . linesize [ 0 ] ) {
pixel_countdown = s -> avctx -> width ;
pixel_ptr = 0 ;
while ( pixel_countdown > 0 ) {
* ( ( signed short * ) ( & pixels [ y_ptr + pixel_ptr ] ) ) = bytestream2_get_le16 ( & g2 ) ;
pixel_ptr += 2 ;
pixel_countdown -- ;
}
}
}
break ;
case FLI_MINI : bytestream2_skip ( & g2 , chunk_size - 6 ) ;
break ;
default : av_log ( avctx , AV_LOG_ERROR , "Unrecognized chunk type: %d\n" , chunk_type ) ;
break ;
}
frame_size -= chunk_size ;
num_chunks -- ;
}
if ( ( bytestream2_get_bytes_left ( & g2 ) != 0 ) && ( bytestream2_get_bytes_left ( & g2 ) != 1 ) ) av_log ( avctx , AV_LOG_ERROR , "Processed FLI chunk where chunk size = %d " \ "and final chunk ptr = %d\n" , buf_size , bytestream2_tell ( & g2 ) ) ;
if ( ( ret = av_frame_ref ( data , & s -> frame ) ) < 0 ) return ret ;
* got_frame = 1 ;
return buf_size ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * Type_MPEmatrix_Read ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , cmsUInt32Number * nItems , cmsUInt32Number SizeOfTag ) {
cmsStage * mpe ;
cmsUInt16Number InputChans , OutputChans ;
cmsUInt32Number nElems , i ;
cmsFloat64Number * Matrix ;
cmsFloat64Number * Offsets ;
if ( ! _cmsReadUInt16Number ( io , & InputChans ) ) return NULL ;
if ( ! _cmsReadUInt16Number ( io , & OutputChans ) ) return NULL ;
nElems = InputChans * OutputChans ;
Matrix = ( cmsFloat64Number * ) _cmsCalloc ( self -> ContextID , nElems , sizeof ( cmsFloat64Number ) ) ;
if ( Matrix == NULL ) return NULL ;
Offsets = ( cmsFloat64Number * ) _cmsCalloc ( self -> ContextID , OutputChans , sizeof ( cmsFloat64Number ) ) ;
if ( Offsets == NULL ) {
_cmsFree ( self -> ContextID , Matrix ) ;
return NULL ;
}
for ( i = 0 ;
i < nElems ;
i ++ ) {
cmsFloat32Number v ;
if ( ! _cmsReadFloat32Number ( io , & v ) ) return NULL ;
Matrix [ i ] = v ;
}
for ( i = 0 ;
i < OutputChans ;
i ++ ) {
cmsFloat32Number v ;
if ( ! _cmsReadFloat32Number ( io , & v ) ) return NULL ;
Offsets [ i ] = v ;
}
mpe = cmsStageAllocMatrix ( self -> ContextID , OutputChans , InputChans , Matrix , Offsets ) ;
_cmsFree ( self -> ContextID , Matrix ) ;
_cmsFree ( self -> ContextID , Offsets ) ;
* nItems = 1 ;
return mpe ;
cmsUNUSED_PARAMETER ( SizeOfTag ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static PyObject * string_rjust ( PyStringObject * self , PyObject * args ) {
Py_ssize_t width ;
char fillchar = ' ' ;
if ( ! PyArg_ParseTuple ( args , "n|c:rjust" , & width , & fillchar ) ) return NULL ;
if ( PyString_GET_SIZE ( self ) >= width && PyString_CheckExact ( self ) ) {
Py_INCREF ( self ) ;
return ( PyObject * ) self ;
}
return pad ( self , width - PyString_GET_SIZE ( self ) , 0 , fillchar ) ;
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.