instruction
stringclasses 1
value | input
stringlengths 31
235k
| output
class label 2
classes |
---|---|---|
Categorize the following code snippet as vulnerable or not. True or False
|
static void rv34_pred_mv_b ( RV34DecContext * r , int block_type , int dir ) {
MpegEncContext * s = & r -> s ;
int mb_pos = s -> mb_x + s -> mb_y * s -> mb_stride ;
int mv_pos = s -> mb_x * 2 + s -> mb_y * 2 * s -> b8_stride ;
int A [ 2 ] = {
0 }
, B [ 2 ] = {
0 }
, C [ 2 ] = {
0 }
;
int has_A = 0 , has_B = 0 , has_C = 0 ;
int mx , my ;
int i , j ;
Picture * cur_pic = s -> current_picture_ptr ;
const int mask = dir ? MB_TYPE_L1 : MB_TYPE_L0 ;
int type = cur_pic -> mb_type [ mb_pos ] ;
if ( ( r -> avail_cache [ 6 - 1 ] & type ) & mask ) {
A [ 0 ] = cur_pic -> motion_val [ dir ] [ mv_pos - 1 ] [ 0 ] ;
A [ 1 ] = cur_pic -> motion_val [ dir ] [ mv_pos - 1 ] [ 1 ] ;
has_A = 1 ;
}
if ( ( r -> avail_cache [ 6 - 4 ] & type ) & mask ) {
B [ 0 ] = cur_pic -> motion_val [ dir ] [ mv_pos - s -> b8_stride ] [ 0 ] ;
B [ 1 ] = cur_pic -> motion_val [ dir ] [ mv_pos - s -> b8_stride ] [ 1 ] ;
has_B = 1 ;
}
if ( r -> avail_cache [ 6 - 4 ] && ( r -> avail_cache [ 6 - 2 ] & type ) & mask ) {
C [ 0 ] = cur_pic -> motion_val [ dir ] [ mv_pos - s -> b8_stride + 2 ] [ 0 ] ;
C [ 1 ] = cur_pic -> motion_val [ dir ] [ mv_pos - s -> b8_stride + 2 ] [ 1 ] ;
has_C = 1 ;
}
else if ( ( s -> mb_x + 1 ) == s -> mb_width && ( r -> avail_cache [ 6 - 5 ] & type ) & mask ) {
C [ 0 ] = cur_pic -> motion_val [ dir ] [ mv_pos - s -> b8_stride - 1 ] [ 0 ] ;
C [ 1 ] = cur_pic -> motion_val [ dir ] [ mv_pos - s -> b8_stride - 1 ] [ 1 ] ;
has_C = 1 ;
}
rv34_pred_b_vector ( A , B , C , has_A , has_B , has_C , & mx , & my ) ;
mx += r -> dmv [ dir ] [ 0 ] ;
my += r -> dmv [ dir ] [ 1 ] ;
for ( j = 0 ;
j < 2 ;
j ++ ) {
for ( i = 0 ;
i < 2 ;
i ++ ) {
cur_pic -> motion_val [ dir ] [ mv_pos + i + j * s -> b8_stride ] [ 0 ] = mx ;
cur_pic -> motion_val [ dir ] [ mv_pos + i + j * s -> b8_stride ] [ 1 ] = my ;
}
}
if ( block_type == RV34_MB_B_BACKWARD || block_type == RV34_MB_B_FORWARD ) {
ZERO8x2 ( cur_pic -> motion_val [ ! dir ] [ mv_pos ] , s -> b8_stride ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSMimeHdrFieldCopyValues ( TSMBuffer dest_bufp , TSMLoc dest_hdr , TSMLoc dest_field , TSMBuffer src_bufp , TSMLoc src_hdr , TSMLoc src_field ) {
sdk_assert ( sdk_sanity_check_mbuffer ( src_bufp ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_mbuffer ( dest_bufp ) == TS_SUCCESS ) ;
sdk_assert ( ( sdk_sanity_check_mime_hdr_handle ( src_hdr ) == TS_SUCCESS ) || ( sdk_sanity_check_http_hdr_handle ( src_hdr ) == TS_SUCCESS ) ) ;
sdk_assert ( ( sdk_sanity_check_mime_hdr_handle ( dest_hdr ) == TS_SUCCESS ) || ( sdk_sanity_check_http_hdr_handle ( dest_hdr ) == TS_SUCCESS ) ) ;
sdk_assert ( sdk_sanity_check_field_handle ( src_field , src_hdr ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_field_handle ( dest_field , dest_hdr ) == TS_SUCCESS ) ;
if ( ! isWriteable ( dest_bufp ) ) {
return TS_ERROR ;
}
MIMEFieldSDKHandle * s_handle = ( MIMEFieldSDKHandle * ) src_field ;
MIMEFieldSDKHandle * d_handle = ( MIMEFieldSDKHandle * ) dest_field ;
HdrHeap * d_heap = ( ( HdrHeapSDKHandle * ) dest_bufp ) -> m_heap ;
MIMEField * s_field , * d_field ;
s_field = s_handle -> field_ptr ;
d_field = d_handle -> field_ptr ;
mime_field_value_set ( d_heap , d_handle -> mh , d_field , s_field -> m_ptr_value , s_field -> m_len_value , true ) ;
return TS_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
gboolean proto_tracking_interesting_fields ( const proto_tree * tree ) {
GHashTable * interesting_hfids ;
if ( ! tree ) return FALSE ;
interesting_hfids = PTREE_DATA ( tree ) -> interesting_hfids ;
return ( interesting_hfids != NULL ) && g_hash_table_size ( interesting_hfids ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void preprocess_text_hangul ( const hb_ot_shape_plan_t * plan , hb_buffer_t * buffer , hb_font_t * font ) {
HB_BUFFER_ALLOCATE_VAR ( buffer , hangul_shaping_feature ) ;
buffer -> clear_output ( ) ;
unsigned int start = 0 , end = 0 ;
unsigned int count = buffer -> len ;
for ( buffer -> idx = 0 ;
buffer -> idx < count ;
) {
hb_codepoint_t u = buffer -> cur ( ) . codepoint ;
if ( isHangulTone ( u ) ) {
if ( start < end && end == buffer -> out_len ) {
buffer -> next_glyph ( ) ;
if ( ! is_zero_width_char ( font , u ) ) {
hb_glyph_info_t * info = buffer -> out_info ;
hb_glyph_info_t tone = info [ end ] ;
memmove ( & info [ start + 1 ] , & info [ start ] , ( end - start ) * sizeof ( hb_glyph_info_t ) ) ;
info [ start ] = tone ;
buffer -> merge_out_clusters ( start , end + 1 ) ;
}
}
else {
if ( font -> has_glyph ( 0x25CCu ) ) {
hb_codepoint_t chars [ 2 ] ;
if ( ! is_zero_width_char ( font , u ) ) {
chars [ 0 ] = u ;
chars [ 1 ] = 0x25CCu ;
}
else {
chars [ 0 ] = 0x25CCu ;
chars [ 1 ] = u ;
}
buffer -> replace_glyphs ( 1 , 2 , chars ) ;
}
else {
buffer -> next_glyph ( ) ;
}
}
start = end = buffer -> out_len ;
continue ;
}
start = buffer -> out_len ;
if ( isL ( u ) && buffer -> idx + 1 < count ) {
hb_codepoint_t l = u ;
hb_codepoint_t v = buffer -> cur ( + 1 ) . codepoint ;
if ( isV ( v ) ) {
hb_codepoint_t t = 0 ;
unsigned int tindex = 0 ;
if ( buffer -> idx + 2 < count ) {
t = buffer -> cur ( + 2 ) . codepoint ;
if ( isT ( t ) ) tindex = t - TBase ;
else t = 0 ;
}
if ( isCombiningL ( l ) && isCombiningV ( v ) && ( t == 0 || isCombiningT ( t ) ) ) {
hb_codepoint_t s = SBase + ( l - LBase ) * NCount + ( v - VBase ) * TCount + tindex ;
if ( font -> has_glyph ( s ) ) {
buffer -> replace_glyphs ( t ? 3 : 2 , 1 , & s ) ;
if ( unlikely ( buffer -> in_error ) ) return ;
end = start + 1 ;
continue ;
}
}
buffer -> cur ( ) . hangul_shaping_feature ( ) = LJMO ;
buffer -> next_glyph ( ) ;
buffer -> cur ( ) . hangul_shaping_feature ( ) = VJMO ;
buffer -> next_glyph ( ) ;
if ( t ) {
buffer -> cur ( ) . hangul_shaping_feature ( ) = TJMO ;
buffer -> next_glyph ( ) ;
end = start + 3 ;
}
else end = start + 2 ;
if ( buffer -> cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES ) buffer -> merge_out_clusters ( start , end ) ;
continue ;
}
}
else if ( isCombinedS ( u ) ) {
hb_codepoint_t s = u ;
bool has_glyph = font -> has_glyph ( s ) ;
unsigned int lindex = ( s - SBase ) / NCount ;
unsigned int nindex = ( s - SBase ) % NCount ;
unsigned int vindex = nindex / TCount ;
unsigned int tindex = nindex % TCount ;
if ( ! tindex && buffer -> idx + 1 < count && isCombiningT ( buffer -> cur ( + 1 ) . codepoint ) ) {
unsigned int new_tindex = buffer -> cur ( + 1 ) . codepoint - TBase ;
hb_codepoint_t new_s = s + new_tindex ;
if ( font -> has_glyph ( new_s ) ) {
buffer -> replace_glyphs ( 2 , 1 , & new_s ) ;
if ( unlikely ( buffer -> in_error ) ) return ;
end = start + 1 ;
continue ;
}
}
if ( ! has_glyph || ( ! tindex && buffer -> idx + 1 < count && isT ( buffer -> cur ( + 1 ) . codepoint ) ) ) {
hb_codepoint_t decomposed [ 3 ] = {
LBase + lindex , VBase + vindex , TBase + tindex }
;
if ( font -> has_glyph ( decomposed [ 0 ] ) && font -> has_glyph ( decomposed [ 1 ] ) && ( ! tindex || font -> has_glyph ( decomposed [ 2 ] ) ) ) {
unsigned int s_len = tindex ? 3 : 2 ;
buffer -> replace_glyphs ( 1 , s_len , decomposed ) ;
if ( unlikely ( buffer -> in_error ) ) return ;
hb_glyph_info_t * info = buffer -> out_info ;
if ( has_glyph && ! tindex ) {
buffer -> next_glyph ( ) ;
s_len ++ ;
}
end = start + s_len ;
unsigned int i = start ;
info [ i ++ ] . hangul_shaping_feature ( ) = LJMO ;
info [ i ++ ] . hangul_shaping_feature ( ) = VJMO ;
if ( i < end ) info [ i ++ ] . hangul_shaping_feature ( ) = TJMO ;
if ( buffer -> cluster_level == HB_BUFFER_CLUSTER_LEVEL_MONOTONE_GRAPHEMES ) buffer -> merge_out_clusters ( start , end ) ;
continue ;
}
}
if ( has_glyph ) {
end = start + 1 ;
buffer -> next_glyph ( ) ;
continue ;
}
}
buffer -> next_glyph ( ) ;
}
buffer -> swap_buffers ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void isoent_free_all ( struct isoent * isoent ) {
struct isoent * np , * np_temp ;
if ( isoent == NULL ) return ;
np = isoent ;
for ( ;
;
) {
if ( np -> dir ) {
if ( np -> children . first != NULL ) {
np = np -> children . first ;
continue ;
}
}
for ( ;
;
) {
np_temp = np ;
if ( np -> chnext == NULL ) {
np = np -> parent ;
_isoent_free ( np_temp ) ;
if ( np == np_temp ) return ;
}
else {
np = np -> chnext ;
_isoent_free ( np_temp ) ;
break ;
}
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
teReqs TocIDRequired ( ArchiveHandle * AH , DumpId id ) {
TocEntry * te = getTocEntryByDumpId ( AH , id ) ;
if ( ! te ) return 0 ;
return te -> reqs ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gint64 steamdiscover_dissect_header ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , gint offset , gint bytes_left ) {
gint len ;
gint64 value ;
gint64 msg_type = - 1 ;
protobuf_desc_t pb = {
tvb , offset , bytes_left }
;
protobuf_tag_t tag = {
0 , 0 , 0 }
;
while ( protobuf_iter_next ( & pb , & tag ) ) {
switch ( tag . field_number ) {
case STEAMDISCOVER_FN_HEADER_CLIENTID : STEAMDISCOVER_ENSURE_WIRETYPE ( PROTOBUF_WIRETYPE_VARINT ) ;
value = get_varint64 ( pb . tvb , pb . offset , pb . bytes_left , & len ) ;
proto_tree_add_uint64 ( tree , hf_steam_ihs_discovery_header_clientid , pb . tvb , pb . offset , len , ( guint64 ) value ) ;
break ;
case STEAMDISCOVER_FN_HEADER_MSGTYPE : STEAMDISCOVER_ENSURE_WIRETYPE ( PROTOBUF_WIRETYPE_VARINT ) ;
value = get_varint64 ( pb . tvb , pb . offset , pb . bytes_left , & len ) ;
msg_type = value ;
proto_tree_add_uint64 ( tree , hf_steam_ihs_discovery_header_msgtype , pb . tvb , pb . offset , len , ( guint64 ) value ) ;
break ;
case STEAMDISCOVER_FN_HEADER_INSTANCEID : STEAMDISCOVER_ENSURE_WIRETYPE ( PROTOBUF_WIRETYPE_VARINT ) ;
value = get_varint64 ( pb . tvb , pb . offset , pb . bytes_left , & len ) ;
proto_tree_add_uint64 ( tree , hf_steam_ihs_discovery_header_instanceid , pb . tvb , pb . offset , len , ( guint64 ) value ) ;
break ;
default : len = protobuf_dissect_unknown_field ( & pb , & tag , pinfo , tree , NULL ) ;
break ;
}
protobuf_seek_forward ( & pb , len ) ;
}
return msg_type ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int kvm_put_xcrs ( X86CPU * cpu ) {
CPUX86State * env = & cpu -> env ;
struct kvm_xcrs xcrs = {
}
;
if ( ! has_xcrs ) {
return 0 ;
}
xcrs . nr_xcrs = 1 ;
xcrs . flags = 0 ;
xcrs . xcrs [ 0 ] . xcr = 0 ;
xcrs . xcrs [ 0 ] . value = env -> xcr0 ;
return kvm_vcpu_ioctl ( CPU ( cpu ) , KVM_SET_XCRS , & xcrs ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void extract_task_thread_func ( GTask * task , gpointer source_object , gpointer task_data , GCancellable * cancellable ) {
ExtractJob * extract_job = task_data ;
GList * l ;
GList * existing_output_files = NULL ;
gint total_files ;
g_autofree guint64 * archive_compressed_sizes = NULL ;
gint i ;
g_timer_start ( extract_job -> common . time ) ;
nautilus_progress_info_start ( extract_job -> common . progress ) ;
nautilus_progress_info_set_details ( extract_job -> common . progress , _ ( "Preparing to extract" ) ) ;
total_files = g_list_length ( extract_job -> source_files ) ;
archive_compressed_sizes = g_malloc0_n ( total_files , sizeof ( guint64 ) ) ;
extract_job -> total_compressed_size = 0 ;
for ( l = extract_job -> source_files , i = 0 ;
l != NULL && ! job_aborted ( ( CommonJob * ) extract_job ) ;
l = l -> next , i ++ ) {
GFile * source_file ;
g_autoptr ( GFileInfo ) info = NULL ;
source_file = G_FILE ( l -> data ) ;
info = g_file_query_info ( source_file , G_FILE_ATTRIBUTE_STANDARD_SIZE , G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS , extract_job -> common . cancellable , NULL ) ;
if ( info ) {
archive_compressed_sizes [ i ] = g_file_info_get_size ( info ) ;
extract_job -> total_compressed_size += archive_compressed_sizes [ i ] ;
}
}
extract_job -> base_progress = 0 ;
for ( l = extract_job -> source_files , i = 0 ;
l != NULL && ! job_aborted ( ( CommonJob * ) extract_job ) ;
l = l -> next , i ++ ) {
g_autoptr ( AutoarExtractor ) extractor = NULL ;
extractor = autoar_extractor_new ( G_FILE ( l -> data ) , extract_job -> destination_directory ) ;
autoar_extractor_set_notify_interval ( extractor , PROGRESS_NOTIFY_INTERVAL ) ;
g_signal_connect ( extractor , "error" , G_CALLBACK ( extract_job_on_error ) , extract_job ) ;
g_signal_connect ( extractor , "decide-destination" , G_CALLBACK ( extract_job_on_decide_destination ) , extract_job ) ;
g_signal_connect ( extractor , "progress" , G_CALLBACK ( extract_job_on_progress ) , extract_job ) ;
g_signal_connect ( extractor , "completed" , G_CALLBACK ( extract_job_on_completed ) , extract_job ) ;
extract_job -> archive_compressed_size = archive_compressed_sizes [ i ] ;
autoar_extractor_start ( extractor , extract_job -> common . cancellable ) ;
g_signal_handlers_disconnect_by_data ( extractor , extract_job ) ;
extract_job -> base_progress += ( gdouble ) extract_job -> archive_compressed_size / ( gdouble ) extract_job -> total_compressed_size ;
}
if ( ! job_aborted ( ( CommonJob * ) extract_job ) ) {
report_extract_final_progress ( extract_job , total_files ) ;
}
for ( l = extract_job -> output_files ;
l != NULL ;
l = l -> next ) {
GFile * output_file ;
output_file = G_FILE ( l -> data ) ;
if ( g_file_query_exists ( output_file , NULL ) ) {
existing_output_files = g_list_prepend ( existing_output_files , g_object_ref ( output_file ) ) ;
}
}
g_list_free_full ( extract_job -> output_files , g_object_unref ) ;
extract_job -> output_files = existing_output_files ;
if ( extract_job -> common . undo_info ) {
if ( extract_job -> output_files ) {
NautilusFileUndoInfoExtract * undo_info ;
undo_info = NAUTILUS_FILE_UNDO_INFO_EXTRACT ( extract_job -> common . undo_info ) ;
nautilus_file_undo_info_extract_set_outputs ( undo_info , extract_job -> output_files ) ;
}
else {
g_clear_object ( & extract_job -> common . undo_info ) ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void Win32ErrorHandler ( const char * module , const char * fmt , va_list ap ) {
# ifndef TIF_PLATFORM_CONSOLE LPTSTR szTitle ;
LPTSTR szTmp ;
LPCTSTR szTitleText = "%s Error" ;
LPCTSTR szDefaultModule = "LIBTIFF" ;
LPCTSTR szTmpModule = ( module == NULL ) ? szDefaultModule : module ;
SIZE_T nBufSize = ( strlen ( szTmpModule ) + strlen ( szTitleText ) + strlen ( fmt ) + 256 ) * sizeof ( char ) ;
if ( ( szTitle = ( LPTSTR ) LocalAlloc ( LMEM_FIXED , nBufSize ) ) == NULL ) return ;
sprintf ( szTitle , szTitleText , szTmpModule ) ;
szTmp = szTitle + ( strlen ( szTitle ) + 2 ) * sizeof ( char ) ;
vsnprintf ( szTmp , nBufSize - ( strlen ( szTitle ) + 2 ) * sizeof ( char ) , fmt , ap ) ;
MessageBoxA ( GetFocus ( ) , szTmp , szTitle , MB_OK | MB_ICONEXCLAMATION ) ;
LocalFree ( szTitle ) ;
return ;
# else if ( module != NULL ) fprintf ( stderr , "%s: " , module ) ;
vfprintf ( stderr , fmt , ap ) ;
fprintf ( stderr , ".\n" ) ;
# endif }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ssize_t ReadBlobBlock ( Image * image , unsigned char * data ) {
ssize_t count ;
unsigned char block_count ;
assert ( image != ( Image * ) NULL ) ;
assert ( image -> signature == MagickSignature ) ;
assert ( data != ( unsigned char * ) NULL ) ;
count = ReadBlob ( image , 1 , & block_count ) ;
if ( count != 1 ) return ( 0 ) ;
count = ReadBlob ( image , ( size_t ) block_count , data ) ;
if ( count != ( ssize_t ) block_count ) return ( 0 ) ;
return ( count ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SPL_METHOD ( SplFileObject , fputcsv ) {
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 , ret ;
zval * fields = NULL ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "a|sss" , & fields , & delim , & d_len , & enclo , & e_len , & esc , & esc_len ) == SUCCESS ) {
switch ( ZEND_NUM_ARGS ( ) ) {
case 4 : if ( esc_len != 1 ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "escape must be a character" ) ;
RETURN_FALSE ;
}
escape = esc [ 0 ] ;
case 3 : if ( e_len != 1 ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "enclosure must be a character" ) ;
RETURN_FALSE ;
}
enclosure = enclo [ 0 ] ;
case 2 : if ( d_len != 1 ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "delimiter must be a character" ) ;
RETURN_FALSE ;
}
delimiter = delim [ 0 ] ;
case 1 : case 0 : break ;
}
ret = php_fputcsv ( intern -> u . file . stream , fields , delimiter , enclosure , escape TSRMLS_CC ) ;
RETURN_LONG ( ret ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_frame_headers ( Indeo3DecodeContext * ctx , AVCodecContext * avctx , const uint8_t * buf , int buf_size ) {
const uint8_t * buf_ptr = buf , * bs_hdr ;
uint32_t frame_num , word2 , check_sum , data_size ;
uint32_t y_offset , u_offset , v_offset , starts [ 3 ] , ends [ 3 ] ;
uint16_t height , width ;
int i , j ;
frame_num = bytestream_get_le32 ( & buf_ptr ) ;
word2 = bytestream_get_le32 ( & buf_ptr ) ;
check_sum = bytestream_get_le32 ( & buf_ptr ) ;
data_size = bytestream_get_le32 ( & buf_ptr ) ;
if ( ( frame_num ^ word2 ^ data_size ^ OS_HDR_ID ) != check_sum ) {
av_log ( avctx , AV_LOG_ERROR , "OS header checksum mismatch!\n" ) ;
return AVERROR_INVALIDDATA ;
}
bs_hdr = buf_ptr ;
if ( bytestream_get_le16 ( & buf_ptr ) != 32 ) {
av_log ( avctx , AV_LOG_ERROR , "Unsupported codec version!\n" ) ;
return AVERROR_INVALIDDATA ;
}
ctx -> frame_num = frame_num ;
ctx -> frame_flags = bytestream_get_le16 ( & buf_ptr ) ;
ctx -> data_size = ( bytestream_get_le32 ( & buf_ptr ) + 7 ) >> 3 ;
ctx -> cb_offset = * buf_ptr ++ ;
if ( ctx -> data_size == 16 ) return 4 ;
if ( ctx -> data_size > buf_size ) ctx -> data_size = buf_size ;
buf_ptr += 3 ;
height = bytestream_get_le16 ( & buf_ptr ) ;
width = bytestream_get_le16 ( & buf_ptr ) ;
if ( av_image_check_size ( width , height , 0 , avctx ) ) return AVERROR_INVALIDDATA ;
if ( width != ctx -> width || height != ctx -> height ) {
int res ;
av_dlog ( avctx , "Frame dimensions changed!\n" ) ;
if ( width < 16 || width > 640 || height < 16 || height > 480 || width & 3 || height & 3 ) {
av_log ( avctx , AV_LOG_ERROR , "Invalid picture dimensions: %d x %d!\n" , width , height ) ;
return AVERROR_INVALIDDATA ;
}
ctx -> width = width ;
ctx -> height = height ;
free_frame_buffers ( ctx ) ;
if ( ( res = allocate_frame_buffers ( ctx , avctx ) ) < 0 ) return res ;
avcodec_set_dimensions ( avctx , width , height ) ;
}
y_offset = bytestream_get_le32 ( & buf_ptr ) ;
v_offset = bytestream_get_le32 ( & buf_ptr ) ;
u_offset = bytestream_get_le32 ( & buf_ptr ) ;
starts [ 0 ] = y_offset ;
starts [ 1 ] = v_offset ;
starts [ 2 ] = u_offset ;
for ( j = 0 ;
j < 3 ;
j ++ ) {
ends [ j ] = ctx -> data_size ;
for ( i = 2 ;
i >= 0 ;
i -- ) if ( starts [ i ] < ends [ j ] && starts [ i ] > starts [ j ] ) ends [ j ] = starts [ i ] ;
}
ctx -> y_data_size = ends [ 0 ] - starts [ 0 ] ;
ctx -> v_data_size = ends [ 1 ] - starts [ 1 ] ;
ctx -> u_data_size = ends [ 2 ] - starts [ 2 ] ;
if ( FFMAX3 ( y_offset , v_offset , u_offset ) >= ctx -> data_size - 16 || FFMIN3 ( ctx -> y_data_size , ctx -> v_data_size , ctx -> u_data_size ) <= 0 ) {
av_log ( avctx , AV_LOG_ERROR , "One of the y/u/v offsets is invalid\n" ) ;
return AVERROR_INVALIDDATA ;
}
ctx -> y_data_ptr = bs_hdr + y_offset ;
ctx -> v_data_ptr = bs_hdr + v_offset ;
ctx -> u_data_ptr = bs_hdr + u_offset ;
ctx -> alt_quant = buf_ptr + sizeof ( uint32_t ) ;
if ( ctx -> data_size == 16 ) {
av_log ( avctx , AV_LOG_DEBUG , "Sync frame encountered!\n" ) ;
return 16 ;
}
if ( ctx -> frame_flags & BS_8BIT_PEL ) {
av_log_ask_for_sample ( avctx , "8-bit pixel format\n" ) ;
return AVERROR_PATCHWELCOME ;
}
if ( ctx -> frame_flags & BS_MV_X_HALF || ctx -> frame_flags & BS_MV_Y_HALF ) {
av_log_ask_for_sample ( avctx , "halfpel motion vectors\n" ) ;
return AVERROR_PATCHWELCOME ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void U_CALLCONV _LMBCSOpen ## n ( UConverter * _this , UConverterLoadArgs * pArgs , UErrorCode * err ) \ {
_LMBCSOpenWorker ( _this , pArgs , err , n ) ;
}
static void _LMBCSOpenWorker ( UConverter * _this , UConverterLoadArgs * pArgs , UErrorCode * err , ulmbcs_byte_t OptGroup ) {
UConverterDataLMBCS * extraInfo = ( UConverterDataLMBCS * ) uprv_malloc ( sizeof ( UConverterDataLMBCS ) ) ;
_this -> extraInfo = extraInfo ;
if ( extraInfo != NULL ) {
UConverterNamePieces stackPieces ;
UConverterLoadArgs stackArgs = UCNV_LOAD_ARGS_INITIALIZER ;
ulmbcs_byte_t i ;
uprv_memset ( extraInfo , 0 , sizeof ( UConverterDataLMBCS ) ) ;
stackArgs . onlyTestIsLoadable = pArgs -> onlyTestIsLoadable ;
for ( i = 0 ;
i <= ULMBCS_GRP_LAST && U_SUCCESS ( * err ) ;
i ++ ) {
if ( OptGroupByteToCPName [ i ] != NULL ) {
extraInfo -> OptGrpConverter [ i ] = ucnv_loadSharedData ( OptGroupByteToCPName [ i ] , & stackPieces , & stackArgs , err ) ;
}
}
if ( U_FAILURE ( * err ) || pArgs -> onlyTestIsLoadable ) {
_LMBCSClose ( _this ) ;
return ;
}
extraInfo -> OptGroup = OptGroup ;
extraInfo -> localeConverterIndex = FindLMBCSLocale ( pArgs -> locale ) ;
}
else {
* err = U_MEMORY_ALLOCATION_ERROR ;
}
}
U_CDECL_BEGIN static void U_CALLCONV _LMBCSClose ( UConverter * _this ) {
if ( _this -> extraInfo != NULL ) {
ulmbcs_byte_t Ix ;
UConverterDataLMBCS * extraInfo = ( UConverterDataLMBCS * ) _this -> extraInfo ;
for ( Ix = 0 ;
Ix <= ULMBCS_GRP_LAST ;
Ix ++ ) {
if ( extraInfo -> OptGrpConverter [ Ix ] != NULL ) ucnv_unloadSharedDataIfReady ( extraInfo -> OptGrpConverter [ Ix ] ) ;
}
if ( ! _this -> isExtraLocal ) {
uprv_free ( _this -> extraInfo ) ;
_this -> extraInfo = NULL ;
}
}
}
typedef struct LMBCSClone {
UConverter cnv ;
UConverterDataLMBCS lmbcs ;
}
LMBCSClone ;
static UConverter * U_CALLCONV _LMBCSSafeClone ( const UConverter * cnv , void * stackBuffer , int32_t * pBufferSize , UErrorCode * status ) {
( void ) status ;
LMBCSClone * newLMBCS ;
UConverterDataLMBCS * extraInfo ;
int32_t i ;
if ( * pBufferSize <= 0 ) {
* pBufferSize = ( int32_t ) sizeof ( LMBCSClone ) ;
return NULL ;
}
extraInfo = ( UConverterDataLMBCS * ) cnv -> extraInfo ;
newLMBCS = ( LMBCSClone * ) stackBuffer ;
uprv_memcpy ( & newLMBCS -> lmbcs , extraInfo , sizeof ( UConverterDataLMBCS ) ) ;
for ( i = 0 ;
i <= ULMBCS_GRP_LAST ;
++ i ) {
if ( extraInfo -> OptGrpConverter [ i ] != NULL ) {
ucnv_incrementRefCount ( extraInfo -> OptGrpConverter [ i ] ) ;
}
}
newLMBCS -> cnv . extraInfo = & newLMBCS -> lmbcs ;
newLMBCS -> cnv . isExtraLocal = TRUE ;
return & newLMBCS -> cnv ;
}
static size_t LMBCSConversionWorker ( UConverterDataLMBCS * extraInfo , ulmbcs_byte_t group , ulmbcs_byte_t * pStartLMBCS , UChar * pUniChar , ulmbcs_byte_t * lastConverterIndex , UBool * groups_tried ) {
ulmbcs_byte_t * pLMBCS = pStartLMBCS ;
UConverterSharedData * xcnv = extraInfo -> OptGrpConverter [ group ] ;
int bytesConverted ;
uint32_t value ;
ulmbcs_byte_t firstByte ;
U_ASSERT ( xcnv ) ;
U_ASSERT ( group < ULMBCS_GRP_UNICODE ) ;
bytesConverted = ucnv_MBCSFromUChar32 ( xcnv , * pUniChar , & value , FALSE ) ;
if ( bytesConverted > 0 ) {
firstByte = ( ulmbcs_byte_t ) ( value >> ( ( bytesConverted - 1 ) * 8 ) ) ;
}
else {
groups_tried [ group ] = TRUE ;
return 0 ;
}
* lastConverterIndex = group ;
U_ASSERT ( ( firstByte <= ULMBCS_C0END ) || ( firstByte >= ULMBCS_C1START ) || ( group == ULMBCS_GRP_EXCEPT ) ) ;
if ( group != ULMBCS_GRP_EXCEPT && extraInfo -> OptGroup != group ) {
* pLMBCS ++ = group ;
if ( bytesConverted == 1 && group >= ULMBCS_DOUBLEOPTGROUP_START ) {
* pLMBCS ++ = group ;
}
}
if ( bytesConverted == 1 && firstByte < 0x20 ) return 0 ;
switch ( bytesConverted ) {
case 4 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 24 ) ;
U_FALLTHROUGH ;
case 3 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 16 ) ;
U_FALLTHROUGH ;
case 2 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 8 ) ;
U_FALLTHROUGH ;
case 1 : * pLMBCS ++ = ( ulmbcs_byte_t ) value ;
U_FALLTHROUGH ;
default : break ;
}
return ( pLMBCS - pStartLMBCS ) ;
}
static size_t LMBCSConvertUni ( ulmbcs_byte_t * pLMBCS , UChar uniChar ) {
uint8_t LowCh = ( uint8_t ) ( uniChar & 0x00FF ) ;
uint8_t HighCh = ( uint8_t ) ( uniChar >> 8 ) ;
* pLMBCS ++ = ULMBCS_GRP_UNICODE ;
if ( LowCh == 0 ) {
* pLMBCS ++ = ULMBCS_UNICOMPATZERO ;
* pLMBCS ++ = HighCh ;
}
else {
* pLMBCS ++ = HighCh ;
* pLMBCS ++ = LowCh ;
}
return ULMBCS_UNICODE_SIZE ;
}
static void U_CALLCONV _LMBCSFromUnicode ( UConverterFromUnicodeArgs * args , UErrorCode * err ) {
ulmbcs_byte_t lastConverterIndex = 0 ;
UChar uniChar ;
ulmbcs_byte_t LMBCS [ ULMBCS_CHARSIZE_MAX ] ;
ulmbcs_byte_t * pLMBCS ;
int32_t bytes_written ;
UBool groups_tried [ ULMBCS_GRP_LAST + 1 ] ;
UConverterDataLMBCS * extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
int sourceIndex = 0 ;
ulmbcs_byte_t OldConverterIndex = 0 ;
while ( args -> source < args -> sourceLimit && ! U_FAILURE ( * err ) ) {
OldConverterIndex = extraInfo -> localeConverterIndex ;
if ( args -> target >= args -> targetLimit ) {
* err = U_BUFFER_OVERFLOW_ERROR ;
break ;
}
uniChar = * ( args -> source ) ;
bytes_written = 0 ;
pLMBCS = LMBCS ;
if ( ( uniChar >= 0x80 ) && ( uniChar <= 0xff ) && ( uniChar != 0xB1 ) && ( uniChar != 0xD7 ) && ( uniChar != 0xF7 ) && ( uniChar != 0xB0 ) && ( uniChar != 0xB4 ) && ( uniChar != 0xB6 ) && ( uniChar != 0xA7 ) && ( uniChar != 0xA8 ) ) {
extraInfo -> localeConverterIndex = ULMBCS_GRP_L1 ;
}
if ( ( ( uniChar > ULMBCS_C0END ) && ( uniChar < ULMBCS_C1START ) ) || uniChar == 0 || uniChar == ULMBCS_HT || uniChar == ULMBCS_CR || uniChar == ULMBCS_LF || uniChar == ULMBCS_123SYSTEMRANGE ) {
* pLMBCS ++ = ( ulmbcs_byte_t ) uniChar ;
bytes_written = 1 ;
}
if ( ! bytes_written ) {
ulmbcs_byte_t group = FindLMBCSUniRange ( uniChar ) ;
if ( group == ULMBCS_GRP_UNICODE ) {
pLMBCS += LMBCSConvertUni ( pLMBCS , uniChar ) ;
bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ;
}
else if ( group == ULMBCS_GRP_CTRL ) {
if ( uniChar <= ULMBCS_C0END ) {
* pLMBCS ++ = ULMBCS_GRP_CTRL ;
* pLMBCS ++ = ( ulmbcs_byte_t ) ( ULMBCS_CTRLOFFSET + uniChar ) ;
}
else if ( uniChar >= ULMBCS_C1START && uniChar <= ULMBCS_C1START + ULMBCS_CTRLOFFSET ) {
* pLMBCS ++ = ULMBCS_GRP_CTRL ;
* pLMBCS ++ = ( ulmbcs_byte_t ) ( uniChar & 0x00FF ) ;
}
bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ;
}
else if ( group < ULMBCS_GRP_UNICODE ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , group , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
if ( ! bytes_written ) {
uprv_memset ( groups_tried , 0 , sizeof ( groups_tried ) ) ;
if ( ( extraInfo -> OptGroup != 1 ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , extraInfo -> OptGroup ) ) ) {
if ( extraInfo -> localeConverterIndex < ULMBCS_DOUBLEOPTGROUP_START ) {
bytes_written = LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_L1 , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
if ( ! bytes_written ) {
bytes_written = LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_EXCEPT , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
if ( ! bytes_written ) {
bytes_written = LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
}
else {
bytes_written = LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
}
if ( ! bytes_written && ( extraInfo -> localeConverterIndex ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , extraInfo -> localeConverterIndex ) ) ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
if ( ! bytes_written && ( lastConverterIndex ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , lastConverterIndex ) ) ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , lastConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
if ( ! bytes_written ) {
ulmbcs_byte_t grp_start ;
ulmbcs_byte_t grp_end ;
ulmbcs_byte_t grp_ix ;
grp_start = ( ulmbcs_byte_t ) ( ( group == ULMBCS_AMBIGUOUS_MBCS ) ? ULMBCS_DOUBLEOPTGROUP_START : ULMBCS_GRP_L1 ) ;
grp_end = ( ulmbcs_byte_t ) ( ( group == ULMBCS_AMBIGUOUS_MBCS ) ? ULMBCS_GRP_LAST : ULMBCS_GRP_TH ) ;
if ( group == ULMBCS_AMBIGUOUS_ALL ) {
grp_start = ULMBCS_GRP_L1 ;
grp_end = ULMBCS_GRP_LAST ;
}
for ( grp_ix = grp_start ;
grp_ix <= grp_end && ! bytes_written ;
grp_ix ++ ) {
if ( extraInfo -> OptGrpConverter [ grp_ix ] && ! groups_tried [ grp_ix ] ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , grp_ix , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
}
if ( ! bytes_written && grp_start == ULMBCS_GRP_L1 ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_EXCEPT , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
}
if ( ! bytes_written ) {
pLMBCS += LMBCSConvertUni ( pLMBCS , uniChar ) ;
bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ;
}
}
}
args -> source ++ ;
pLMBCS = LMBCS ;
while ( args -> target < args -> targetLimit && bytes_written -- ) {
* ( args -> target ) ++ = * pLMBCS ++ ;
if ( args -> offsets ) {
* ( args -> offsets ) ++ = sourceIndex ;
}
}
sourceIndex ++ ;
if ( bytes_written > 0 ) {
uint8_t * pErrorBuffer = args -> converter -> charErrorBuffer ;
* err = U_BUFFER_OVERFLOW_ERROR ;
args -> converter -> charErrorBufferLength = ( int8_t ) bytes_written ;
while ( bytes_written -- ) {
* pErrorBuffer ++ = * pLMBCS ++ ;
}
}
extraInfo -> localeConverterIndex = OldConverterIndex ;
}
}
static UChar GetUniFromLMBCSUni ( char const * * ppLMBCSin ) {
uint8_t HighCh = * ( * ppLMBCSin ) ++ ;
uint8_t LowCh = * ( * ppLMBCSin ) ++ ;
if ( HighCh == ULMBCS_UNICOMPATZERO ) {
HighCh = LowCh ;
LowCh = 0 ;
}
return ( UChar ) ( ( HighCh << 8 ) | LowCh ) ;
}
# define CHECK_SOURCE_LIMIT ( index ) if ( args -> source + index > args -> sourceLimit ) {
* err = U_TRUNCATED_CHAR_FOUND ;
args -> source = args -> sourceLimit ;
return 0xffff ;
}
static UChar32 U_CALLCONV _LMBCSGetNextUCharWorker ( UConverterToUnicodeArgs * args , UErrorCode * err ) {
UChar32 uniChar = 0 ;
ulmbcs_byte_t CurByte ;
if ( args -> source >= args -> sourceLimit ) {
* err = U_ILLEGAL_ARGUMENT_ERROR ;
return 0xffff ;
}
CurByte = * ( ( ulmbcs_byte_t * ) ( args -> source ++ ) ) ;
if ( ( ( CurByte > ULMBCS_C0END ) && ( CurByte < ULMBCS_C1START ) ) || ( CurByte == 0 ) || CurByte == ULMBCS_HT || CurByte == ULMBCS_CR || CurByte == ULMBCS_LF || CurByte == ULMBCS_123SYSTEMRANGE ) {
uniChar = CurByte ;
}
else {
UConverterDataLMBCS * extraInfo ;
ulmbcs_byte_t group ;
UConverterSharedData * cnv ;
if ( CurByte == ULMBCS_GRP_CTRL ) {
ulmbcs_byte_t C0C1byte ;
CHECK_SOURCE_LIMIT ( 1 ) ;
C0C1byte = * ( args -> source ) ++ ;
uniChar = ( C0C1byte < ULMBCS_C1START ) ? C0C1byte - ULMBCS_CTRLOFFSET : C0C1byte ;
}
else if ( CurByte == ULMBCS_GRP_UNICODE ) {
CHECK_SOURCE_LIMIT ( 2 ) ;
return GetUniFromLMBCSUni ( & ( args -> source ) ) ;
}
else if ( CurByte <= ULMBCS_CTRLOFFSET ) {
group = CurByte ;
extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
if ( group > ULMBCS_GRP_LAST || ( cnv = extraInfo -> OptGrpConverter [ group ] ) == NULL ) {
* err = U_INVALID_CHAR_FOUND ;
}
else if ( group >= ULMBCS_DOUBLEOPTGROUP_START ) {
CHECK_SOURCE_LIMIT ( 2 ) ;
if ( * args -> source == group ) {
++ args -> source ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source , 1 , FALSE ) ;
++ args -> source ;
}
else {
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source , 2 , FALSE ) ;
args -> source += 2 ;
}
}
else {
CHECK_SOURCE_LIMIT ( 1 ) ;
CurByte = * ( args -> source ) ++ ;
if ( CurByte >= ULMBCS_C1START ) {
uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP ( cnv , CurByte ) ;
}
else {
char bytes [ 2 ] ;
extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
cnv = extraInfo -> OptGrpConverter [ ULMBCS_GRP_EXCEPT ] ;
bytes [ 0 ] = group ;
bytes [ 1 ] = CurByte ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , bytes , 2 , FALSE ) ;
}
}
}
else if ( CurByte >= ULMBCS_C1START ) {
extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
group = extraInfo -> OptGroup ;
cnv = extraInfo -> OptGrpConverter [ group ] ;
if ( group >= ULMBCS_DOUBLEOPTGROUP_START ) {
if ( ! ucnv_MBCSIsLeadByte ( cnv , CurByte ) ) {
CHECK_SOURCE_LIMIT ( 0 ) ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source - 1 , 1 , FALSE ) ;
}
else {
CHECK_SOURCE_LIMIT ( 1 ) ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source - 1 , 2 , FALSE ) ;
++ args -> source ;
}
}
else {
uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP ( cnv , CurByte ) ;
}
}
}
return uniChar ;
}
static void U_CALLCONV _LMBCSToUnicodeWithOffsets ( UConverterToUnicodeArgs * args , UErrorCode * err ) {
char LMBCS [ ULMBCS_CHARSIZE_MAX ] ;
UChar uniChar ;
const char * saveSource ;
const char * pStartLMBCS = args -> source ;
const char * errSource = NULL ;
int8_t savebytes = 0 ;
while ( U_SUCCESS ( * err ) && args -> sourceLimit > args -> source && args -> targetLimit > args -> target ) {
saveSource = args -> source ;
if ( args -> converter -> toULength ) {
const char * saveSourceLimit ;
size_t size_old = args -> converter -> toULength ;
size_t size_new_maybe_1 = sizeof ( LMBCS ) - size_old ;
size_t size_new_maybe_2 = args -> sourceLimit - args -> source ;
size_t size_new = ( size_new_maybe_1 < size_new_maybe_2 ) ? size_new_maybe_1 : size_new_maybe_2 ;
uprv_memcpy ( LMBCS , args -> converter -> toUBytes , size_old ) ;
uprv_memcpy ( LMBCS + size_old , args -> source , size_new ) ;
saveSourceLimit = args -> sourceLimit ;
args -> source = errSource = LMBCS ;
args -> sourceLimit = LMBCS + size_old + size_new ;
savebytes = ( int8_t ) ( size_old + size_new ) ;
uniChar = ( UChar ) _LMBCSGetNextUCharWorker ( args , err ) ;
args -> source = saveSource + ( ( args -> source - LMBCS ) - size_old ) ;
args -> sourceLimit = saveSourceLimit ;
if ( * err == U_TRUNCATED_CHAR_FOUND ) {
args -> converter -> toULength = savebytes ;
uprv_memcpy ( args -> converter -> toUBytes , LMBCS , savebytes ) ;
args -> source = args -> sourceLimit ;
* err = U_ZERO_ERROR ;
return ;
}
else {
args -> converter -> toULength = 0 ;
}
}
else {
errSource = saveSource ;
uniChar = ( UChar ) _LMBCSGetNextUCharWorker ( args , err ) ;
savebytes = ( int8_t ) ( args -> source - saveSource ) ;
}
if ( U_SUCCESS ( * err ) ) {
if ( uniChar < 0xfffe ) {
* ( args -> target ) ++ = uniChar ;
if ( args -> offsets ) {
* ( args -> offsets ) ++ = ( int32_t ) ( saveSource - pStartLMBCS ) ;
}
}
else if ( uniChar == 0xfffe ) {
* err = U_INVALID_CHAR_FOUND ;
}
else {
* err = U_ILLEGAL_CHAR_FOUND ;
}
}
}
if ( U_SUCCESS ( * err ) && args -> sourceLimit > args -> source && args -> targetLimit <= args -> target ) {
* err = U_BUFFER_OVERFLOW_ERROR ;
}
else if ( U_FAILURE ( * err ) ) {
args -> converter -> toULength = savebytes ;
if ( savebytes > 0 ) {
uprv_memcpy ( args -> converter -> toUBytes , errSource , savebytes ) ;
}
if ( * err == U_TRUNCATED_CHAR_FOUND ) {
* err = U_ZERO_ERROR ;
}
}
}
DEFINE_LMBCS_OPEN ( 1 ) DEFINE_LMBCS_OPEN ( 2 ) DEFINE_LMBCS_OPEN ( 3 ) DEFINE_LMBCS_OPEN ( 4 ) DEFINE_LMBCS_OPEN ( 5 ) DEFINE_LMBCS_OPEN ( 6 ) DEFINE_LMBCS_OPEN ( 8 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
inline static void _slurm_rpc_set_debug_level ( slurm_msg_t * msg ) {
int debug_level ;
uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ;
slurmctld_lock_t config_write_lock = {
WRITE_LOCK , NO_LOCK , NO_LOCK , NO_LOCK , NO_LOCK }
;
set_debug_level_msg_t * request_msg = ( set_debug_level_msg_t * ) msg -> data ;
log_options_t log_opts = LOG_OPTS_INITIALIZER ;
debug2 ( "Processing RPC: REQUEST_SET_DEBUG_LEVEL from uid=%d" , uid ) ;
if ( ! validate_super_user ( uid ) ) {
error ( "set debug level request from non-super user uid=%d" , uid ) ;
slurm_send_rc_msg ( msg , EACCES ) ;
return ;
}
debug_level = MIN ( request_msg -> debug_level , ( LOG_LEVEL_END - 1 ) ) ;
debug_level = MAX ( debug_level , LOG_LEVEL_QUIET ) ;
lock_slurmctld ( config_write_lock ) ;
if ( slurmctld_config . daemonize ) {
log_opts . stderr_level = LOG_LEVEL_QUIET ;
if ( slurmctld_conf . slurmctld_logfile ) {
log_opts . logfile_level = debug_level ;
log_opts . syslog_level = LOG_LEVEL_QUIET ;
}
else {
log_opts . syslog_level = debug_level ;
log_opts . logfile_level = LOG_LEVEL_QUIET ;
}
}
else {
log_opts . syslog_level = LOG_LEVEL_QUIET ;
log_opts . stderr_level = debug_level ;
if ( slurmctld_conf . slurmctld_logfile ) log_opts . logfile_level = debug_level ;
else log_opts . logfile_level = LOG_LEVEL_QUIET ;
}
log_alter ( log_opts , LOG_DAEMON , slurmctld_conf . slurmctld_logfile ) ;
unlock_slurmctld ( config_write_lock ) ;
if ( debug_level != slurmctld_conf . slurmctld_debug ) info ( "Set debug level to %d" , debug_level ) ;
slurmctld_conf . slurmctld_debug = debug_level ;
slurmctld_conf . last_update = time ( NULL ) ;
slurm_send_rc_msg ( msg , SLURM_SUCCESS ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void _SCSUToUnicodeWithOffsets ( UConverterToUnicodeArgs * pArgs , UErrorCode * pErrorCode ) {
UConverter * cnv ;
SCSUData * scsu ;
const uint8_t * source , * sourceLimit ;
UChar * target ;
const UChar * targetLimit ;
int32_t * offsets ;
UBool isSingleByteMode ;
uint8_t state , byteOne ;
int8_t quoteWindow , dynamicWindow ;
int32_t sourceIndex , nextSourceIndex ;
uint8_t b ;
cnv = pArgs -> converter ;
scsu = ( SCSUData * ) cnv -> extraInfo ;
source = ( const uint8_t * ) pArgs -> source ;
sourceLimit = ( const uint8_t * ) pArgs -> sourceLimit ;
target = pArgs -> target ;
targetLimit = pArgs -> targetLimit ;
offsets = pArgs -> offsets ;
isSingleByteMode = scsu -> toUIsSingleByteMode ;
state = scsu -> toUState ;
quoteWindow = scsu -> toUQuoteWindow ;
dynamicWindow = scsu -> toUDynamicWindow ;
byteOne = scsu -> toUByteOne ;
sourceIndex = state == readCommand ? 0 : - 1 ;
nextSourceIndex = 0 ;
if ( isSingleByteMode ) {
if ( state == readCommand ) {
fastSingle : while ( source < sourceLimit && target < targetLimit && ( b = * source ) >= 0x20 ) {
++ source ;
++ nextSourceIndex ;
if ( b <= 0x7f ) {
* target ++ = ( UChar ) b ;
if ( offsets != NULL ) {
* offsets ++ = sourceIndex ;
}
}
else {
uint32_t c = scsu -> toUDynamicOffsets [ dynamicWindow ] + ( b & 0x7f ) ;
if ( c <= 0xffff ) {
* target ++ = ( UChar ) c ;
if ( offsets != NULL ) {
* offsets ++ = sourceIndex ;
}
}
else {
* target ++ = ( UChar ) ( 0xd7c0 + ( c >> 10 ) ) ;
if ( target < targetLimit ) {
* target ++ = ( UChar ) ( 0xdc00 | ( c & 0x3ff ) ) ;
if ( offsets != NULL ) {
* offsets ++ = sourceIndex ;
* offsets ++ = sourceIndex ;
}
}
else {
if ( offsets != NULL ) {
* offsets ++ = sourceIndex ;
}
cnv -> UCharErrorBuffer [ 0 ] = ( UChar ) ( 0xdc00 | ( c & 0x3ff ) ) ;
cnv -> UCharErrorBufferLength = 1 ;
* pErrorCode = U_BUFFER_OVERFLOW_ERROR ;
goto endloop ;
}
}
}
sourceIndex = nextSourceIndex ;
}
}
singleByteMode : while ( source < sourceLimit ) {
if ( target >= targetLimit ) {
* pErrorCode = U_BUFFER_OVERFLOW_ERROR ;
break ;
}
b = * source ++ ;
++ nextSourceIndex ;
switch ( state ) {
case readCommand : if ( ( 1UL << b ) & 0x2601 ) {
* target ++ = ( UChar ) b ;
if ( offsets != NULL ) {
* offsets ++ = sourceIndex ;
}
sourceIndex = nextSourceIndex ;
goto fastSingle ;
}
else if ( SC0 <= b ) {
if ( b <= SC7 ) {
dynamicWindow = ( int8_t ) ( b - SC0 ) ;
sourceIndex = nextSourceIndex ;
goto fastSingle ;
}
else {
dynamicWindow = ( int8_t ) ( b - SD0 ) ;
state = defineOne ;
}
}
else if ( b <= SQ7 ) {
quoteWindow = ( int8_t ) ( b - SQ0 ) ;
state = quoteOne ;
}
else if ( b == SDX ) {
state = definePairOne ;
}
else if ( b == SQU ) {
state = quotePairOne ;
}
else if ( b == SCU ) {
sourceIndex = nextSourceIndex ;
isSingleByteMode = FALSE ;
goto fastUnicode ;
}
else {
* pErrorCode = U_ILLEGAL_CHAR_FOUND ;
cnv -> toUBytes [ 0 ] = b ;
cnv -> toULength = 1 ;
goto endloop ;
}
cnv -> toUBytes [ 0 ] = b ;
cnv -> toULength = 1 ;
break ;
case quotePairOne : byteOne = b ;
cnv -> toUBytes [ 1 ] = b ;
cnv -> toULength = 2 ;
state = quotePairTwo ;
break ;
case quotePairTwo : * target ++ = ( UChar ) ( ( byteOne << 8 ) | b ) ;
if ( offsets != NULL ) {
* offsets ++ = sourceIndex ;
}
sourceIndex = nextSourceIndex ;
state = readCommand ;
goto fastSingle ;
case quoteOne : if ( b < 0x80 ) {
* target ++ = ( UChar ) ( staticOffsets [ quoteWindow ] + b ) ;
if ( offsets != NULL ) {
* offsets ++ = sourceIndex ;
}
}
else {
uint32_t c = scsu -> toUDynamicOffsets [ quoteWindow ] + ( b & 0x7f ) ;
if ( c <= 0xffff ) {
* target ++ = ( UChar ) c ;
if ( offsets != NULL ) {
* offsets ++ = sourceIndex ;
}
}
else {
* target ++ = ( UChar ) ( 0xd7c0 + ( c >> 10 ) ) ;
if ( target < targetLimit ) {
* target ++ = ( UChar ) ( 0xdc00 | ( c & 0x3ff ) ) ;
if ( offsets != NULL ) {
* offsets ++ = sourceIndex ;
* offsets ++ = sourceIndex ;
}
}
else {
if ( offsets != NULL ) {
* offsets ++ = sourceIndex ;
}
cnv -> UCharErrorBuffer [ 0 ] = ( UChar ) ( 0xdc00 | ( c & 0x3ff ) ) ;
cnv -> UCharErrorBufferLength = 1 ;
* pErrorCode = U_BUFFER_OVERFLOW_ERROR ;
goto endloop ;
}
}
}
sourceIndex = nextSourceIndex ;
state = readCommand ;
goto fastSingle ;
case definePairOne : dynamicWindow = ( int8_t ) ( ( b >> 5 ) & 7 ) ;
byteOne = ( uint8_t ) ( b & 0x1f ) ;
cnv -> toUBytes [ 1 ] = b ;
cnv -> toULength = 2 ;
state = definePairTwo ;
break ;
case definePairTwo : scsu -> toUDynamicOffsets [ dynamicWindow ] = 0x10000 + ( byteOne << 15UL | b << 7UL ) ;
sourceIndex = nextSourceIndex ;
state = readCommand ;
goto fastSingle ;
case defineOne : if ( b == 0 ) {
cnv -> toUBytes [ 1 ] = b ;
cnv -> toULength = 2 ;
goto endloop ;
}
else if ( b < gapThreshold ) {
scsu -> toUDynamicOffsets [ dynamicWindow ] = b << 7UL ;
}
else if ( ( uint8_t ) ( b - gapThreshold ) < ( reservedStart - gapThreshold ) ) {
scsu -> toUDynamicOffsets [ dynamicWindow ] = ( b << 7UL ) + gapOffset ;
}
else if ( b >= fixedThreshold ) {
scsu -> toUDynamicOffsets [ dynamicWindow ] = fixedOffsets [ b - fixedThreshold ] ;
}
else {
cnv -> toUBytes [ 1 ] = b ;
cnv -> toULength = 2 ;
goto endloop ;
}
sourceIndex = nextSourceIndex ;
state = readCommand ;
goto fastSingle ;
}
}
}
else {
if ( state == readCommand ) {
fastUnicode : while ( source + 1 < sourceLimit && target < targetLimit && ( uint8_t ) ( ( b = * source ) - UC0 ) > ( Urs - UC0 ) ) {
* target ++ = ( UChar ) ( ( b << 8 ) | source [ 1 ] ) ;
if ( offsets != NULL ) {
* offsets ++ = sourceIndex ;
}
sourceIndex = nextSourceIndex ;
nextSourceIndex += 2 ;
source += 2 ;
}
}
while ( source < sourceLimit ) {
if ( target >= targetLimit ) {
* pErrorCode = U_BUFFER_OVERFLOW_ERROR ;
break ;
}
b = * source ++ ;
++ nextSourceIndex ;
switch ( state ) {
case readCommand : if ( ( uint8_t ) ( b - UC0 ) > ( Urs - UC0 ) ) {
byteOne = b ;
cnv -> toUBytes [ 0 ] = b ;
cnv -> toULength = 1 ;
state = quotePairTwo ;
}
else if ( b <= UC7 ) {
dynamicWindow = ( int8_t ) ( b - UC0 ) ;
sourceIndex = nextSourceIndex ;
isSingleByteMode = TRUE ;
goto fastSingle ;
}
else if ( b <= UD7 ) {
dynamicWindow = ( int8_t ) ( b - UD0 ) ;
isSingleByteMode = TRUE ;
cnv -> toUBytes [ 0 ] = b ;
cnv -> toULength = 1 ;
state = defineOne ;
goto singleByteMode ;
}
else if ( b == UDX ) {
isSingleByteMode = TRUE ;
cnv -> toUBytes [ 0 ] = b ;
cnv -> toULength = 1 ;
state = definePairOne ;
goto singleByteMode ;
}
else if ( b == UQU ) {
cnv -> toUBytes [ 0 ] = b ;
cnv -> toULength = 1 ;
state = quotePairOne ;
}
else {
* pErrorCode = U_ILLEGAL_CHAR_FOUND ;
cnv -> toUBytes [ 0 ] = b ;
cnv -> toULength = 1 ;
goto endloop ;
}
break ;
case quotePairOne : byteOne = b ;
cnv -> toUBytes [ 1 ] = b ;
cnv -> toULength = 2 ;
state = quotePairTwo ;
break ;
case quotePairTwo : * target ++ = ( UChar ) ( ( byteOne << 8 ) | b ) ;
if ( offsets != NULL ) {
* offsets ++ = sourceIndex ;
}
sourceIndex = nextSourceIndex ;
state = readCommand ;
goto fastUnicode ;
}
}
}
endloop : if ( U_FAILURE ( * pErrorCode ) && * pErrorCode != U_BUFFER_OVERFLOW_ERROR ) {
state = readCommand ;
}
else if ( state == readCommand ) {
cnv -> toULength = 0 ;
}
scsu -> toUIsSingleByteMode = isSingleByteMode ;
scsu -> toUState = state ;
scsu -> toUQuoteWindow = quoteWindow ;
scsu -> toUDynamicWindow = dynamicWindow ;
scsu -> toUByteOne = byteOne ;
pArgs -> source = ( const char * ) source ;
pArgs -> target = target ;
pArgs -> offsets = offsets ;
return ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
header_field_info * proto_get_first_protocol_field ( const int proto_id , void * * cookie ) {
protocol_t * protocol = find_protocol_by_id ( proto_id ) ;
if ( ( protocol == NULL ) || ( protocol -> fields -> len == 0 ) ) return NULL ;
* cookie = GUINT_TO_POINTER ( 0 + 1 ) ;
return ( header_field_info * ) g_ptr_array_index ( protocol -> fields , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
bool agg_item_set_converter ( DTCollation & coll , const char * fname , Item * * args , uint nargs , uint flags , int item_sep ) {
Item * * arg , * safe_args [ 2 ] = {
NULL , NULL }
;
if ( nargs >= 2 && nargs <= 3 ) {
safe_args [ 0 ] = args [ 0 ] ;
safe_args [ 1 ] = args [ item_sep ] ;
}
THD * thd = current_thd ;
bool res = FALSE ;
uint i ;
Query_arena backup ;
Query_arena * arena = thd -> stmt_arena -> is_stmt_prepare ( ) ? thd -> activate_stmt_arena_if_needed ( & backup ) : NULL ;
for ( i = 0 , arg = args ;
i < nargs ;
i ++ , arg += item_sep ) {
Item * conv ;
uint32 dummy_offset ;
if ( ! String : : needs_conversion ( 1 , ( * arg ) -> collation . collation , coll . collation , & dummy_offset ) ) continue ;
if ( ( * arg ) -> collation . derivation == DERIVATION_NUMERIC && ( * arg ) -> collation . repertoire == MY_REPERTOIRE_ASCII && ! ( ( * arg ) -> collation . collation -> state & MY_CS_NONASCII ) && ! ( coll . collation -> state & MY_CS_NONASCII ) ) continue ;
if ( ! ( conv = ( * arg ) -> safe_charset_converter ( coll . collation ) ) && ( ( * arg ) -> collation . repertoire == MY_REPERTOIRE_ASCII ) ) conv = new Item_func_conv_charset ( * arg , coll . collation , 1 ) ;
if ( ! conv ) {
if ( nargs >= 2 && nargs <= 3 ) {
args [ 0 ] = safe_args [ 0 ] ;
args [ item_sep ] = safe_args [ 1 ] ;
}
my_coll_agg_error ( args , nargs , fname , item_sep ) ;
res = TRUE ;
break ;
}
if ( ( * arg ) -> type ( ) == Item : : FIELD_ITEM ) ( ( Item_field * ) ( * arg ) ) -> no_const_subst = 1 ;
if ( thd -> stmt_arena -> is_stmt_prepare ( ) ) * arg = conv ;
else thd -> change_item_tree ( arg , conv ) ;
if ( conv -> fix_fields ( thd , arg ) ) {
res = TRUE ;
break ;
}
}
if ( arena ) thd -> restore_active_arena ( arena , & backup ) ;
return res ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const chr * scanplain ( struct vars * v ) {
const chr * endp ;
assert ( SEE ( COLLEL ) || SEE ( ECLASS ) || SEE ( CCLASS ) ) ;
NEXT ( ) ;
endp = v -> now ;
while ( SEE ( PLAIN ) ) {
endp = v -> now ;
NEXT ( ) ;
}
assert ( SEE ( END ) || ISERR ( ) ) ;
NEXT ( ) ;
return endp ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * Type_LUT16_Dup ( struct _cms_typehandler_struct * self , const void * Ptr , cmsUInt32Number n ) {
return ( void * ) cmsPipelineDup ( ( cmsPipeline * ) Ptr ) ;
cmsUNUSED_PARAMETER ( n ) ;
cmsUNUSED_PARAMETER ( self ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void purple_chat_list ( struct im_connection * ic , const char * server ) {
PurpleRoomlist * list ;
struct purple_data * pd = ic -> proto_data ;
PurplePlugin * prpl = purple_plugins_find_with_id ( pd -> account -> protocol_id ) ;
PurplePluginProtocolInfo * pi = prpl -> info -> extra_info ;
if ( ! pi || ! pi -> roomlist_get_list ) {
imcb_log ( ic , "Room listing unsupported by this purple plugin" ) ;
return ;
}
g_free ( pd -> chat_list_server ) ;
pd -> chat_list_server = ( server && * server ) ? g_strdup ( server ) : NULL ;
list = purple_roomlist_get_list ( pd -> account -> gc ) ;
if ( list ) {
struct purple_roomlist_data * rld = list -> ui_data ;
rld -> initialized = TRUE ;
purple_roomlist_ref ( list ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void _slurm_rpc_node_registration ( slurm_msg_t * msg , bool running_composite ) {
DEF_TIMERS ;
int error_code = SLURM_SUCCESS ;
bool newly_up = false ;
slurm_node_registration_status_msg_t * node_reg_stat_msg = ( slurm_node_registration_status_msg_t * ) msg -> data ;
slurmctld_lock_t job_write_lock = {
READ_LOCK , WRITE_LOCK , WRITE_LOCK , NO_LOCK , READ_LOCK }
;
uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ;
START_TIMER ;
debug2 ( "Processing RPC: MESSAGE_NODE_REGISTRATION_STATUS from uid=%d" , uid ) ;
if ( ! validate_slurm_user ( uid ) ) {
error_code = ESLURM_USER_ID_MISSING ;
error ( "Security violation, NODE_REGISTER RPC from uid=%d" , uid ) ;
}
if ( msg -> protocol_version != SLURM_PROTOCOL_VERSION ) info ( "Node %s appears to have a different version " "of Slurm than ours. Please update at your earliest " "convenience." , node_reg_stat_msg -> node_name ) ;
if ( error_code == SLURM_SUCCESS ) {
if ( ! ( slurmctld_conf . debug_flags & DEBUG_FLAG_NO_CONF_HASH ) && ( node_reg_stat_msg -> hash_val != NO_VAL ) && ( node_reg_stat_msg -> hash_val != slurm_get_hash_val ( ) ) ) {
error ( "Node %s appears to have a different slurm.conf " "than the slurmctld. This could cause issues " "with communication and functionality. " "Please review both files and make sure they " "are the same. If this is expected ignore, and " "set DebugFlags=NO_CONF_HASH in your slurm.conf." , node_reg_stat_msg -> node_name ) ;
}
if ( ! running_composite ) lock_slurmctld ( job_write_lock ) ;
# ifdef HAVE_FRONT_END error_code = validate_nodes_via_front_end ( node_reg_stat_msg , msg -> protocol_version , & newly_up ) ;
# else validate_jobs_on_node ( node_reg_stat_msg ) ;
error_code = validate_node_specs ( node_reg_stat_msg , msg -> protocol_version , & newly_up ) ;
# endif if ( ! running_composite ) unlock_slurmctld ( job_write_lock ) ;
END_TIMER2 ( "_slurm_rpc_node_registration" ) ;
if ( newly_up ) {
queue_job_scheduler ( ) ;
}
}
if ( error_code ) {
error ( "_slurm_rpc_node_registration node=%s: %s" , node_reg_stat_msg -> node_name , slurm_strerror ( error_code ) ) ;
slurm_send_rc_msg ( msg , error_code ) ;
}
else {
debug2 ( "_slurm_rpc_node_registration complete for %s %s" , node_reg_stat_msg -> node_name , TIME_STR ) ;
slurm_send_rc_msg ( msg , SLURM_SUCCESS ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * spl_ptr_llist_last ( spl_ptr_llist * llist ) {
spl_ptr_llist_element * tail = llist -> tail ;
if ( tail == NULL ) {
return NULL ;
}
else {
return tail -> data ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int32_t _appendKeywordsToLanguageTag ( const char * localeID , char * appendAt , int32_t capacity , UBool strict , UBool hadPosix , UErrorCode * status ) {
char buf [ ULOC_KEYWORD_AND_VALUES_CAPACITY ] ;
char attrBuf [ ULOC_KEYWORD_AND_VALUES_CAPACITY ] = {
0 }
;
int32_t attrBufLength = 0 ;
UEnumeration * keywordEnum = NULL ;
int32_t reslen = 0 ;
keywordEnum = uloc_openKeywords ( localeID , status ) ;
if ( U_FAILURE ( * status ) && ! hadPosix ) {
uenum_close ( keywordEnum ) ;
return 0 ;
}
if ( keywordEnum != NULL || hadPosix ) {
int32_t len ;
const char * key ;
ExtensionListEntry * firstExt = NULL ;
ExtensionListEntry * ext ;
AttributeListEntry * firstAttr = NULL ;
AttributeListEntry * attr ;
char * attrValue ;
char extBuf [ ULOC_KEYWORD_AND_VALUES_CAPACITY ] ;
char * pExtBuf = extBuf ;
int32_t extBufCapacity = sizeof ( extBuf ) ;
const char * bcpKey = nullptr , * bcpValue = nullptr ;
UErrorCode tmpStatus = U_ZERO_ERROR ;
int32_t keylen ;
UBool isBcpUExt ;
while ( TRUE ) {
key = uenum_next ( keywordEnum , NULL , status ) ;
if ( key == NULL ) {
break ;
}
len = uloc_getKeywordValue ( localeID , key , buf , sizeof ( buf ) , & tmpStatus ) ;
if ( U_FAILURE ( tmpStatus ) || tmpStatus == U_STRING_NOT_TERMINATED_WARNING ) {
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
tmpStatus = U_ZERO_ERROR ;
continue ;
}
keylen = ( int32_t ) uprv_strlen ( key ) ;
isBcpUExt = ( keylen > 1 ) ;
if ( uprv_strcmp ( key , LOCALE_ATTRIBUTE_KEY ) == 0 ) {
if ( len > 0 ) {
int32_t i = 0 ;
while ( TRUE ) {
attrBufLength = 0 ;
for ( ;
i < len ;
i ++ ) {
if ( buf [ i ] != '-' ) {
attrBuf [ attrBufLength ++ ] = buf [ i ] ;
}
else {
i ++ ;
break ;
}
}
if ( attrBufLength > 0 ) {
attrBuf [ attrBufLength ] = 0 ;
}
else if ( i >= len ) {
break ;
}
attr = ( AttributeListEntry * ) uprv_malloc ( sizeof ( AttributeListEntry ) ) ;
if ( attr == NULL ) {
* status = U_MEMORY_ALLOCATION_ERROR ;
break ;
}
attrValue = ( char * ) uprv_malloc ( attrBufLength + 1 ) ;
if ( attrValue == NULL ) {
* status = U_MEMORY_ALLOCATION_ERROR ;
break ;
}
uprv_strcpy ( attrValue , attrBuf ) ;
attr -> attribute = attrValue ;
if ( ! _addAttributeToList ( & firstAttr , attr ) ) {
uprv_free ( attr ) ;
uprv_free ( attrValue ) ;
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
}
}
bcpKey = LOCALE_ATTRIBUTE_KEY ;
bcpValue = NULL ;
}
}
else if ( isBcpUExt ) {
bcpKey = uloc_toUnicodeLocaleKey ( key ) ;
if ( bcpKey == NULL ) {
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
continue ;
}
bcpValue = uloc_toUnicodeLocaleType ( key , buf ) ;
if ( bcpValue == NULL ) {
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
continue ;
}
if ( bcpValue == buf ) {
int32_t bcpValueLen = uprv_strlen ( bcpValue ) ;
if ( bcpValueLen < extBufCapacity ) {
uprv_strcpy ( pExtBuf , bcpValue ) ;
T_CString_toLowerCase ( pExtBuf ) ;
bcpValue = pExtBuf ;
pExtBuf += ( bcpValueLen + 1 ) ;
extBufCapacity -= ( bcpValueLen + 1 ) ;
}
else {
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
continue ;
}
}
}
else {
if ( * key == PRIVATEUSE ) {
if ( ! _isPrivateuseValueSubtags ( buf , len ) ) {
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
continue ;
}
}
else {
if ( ! _isExtensionSingleton ( key , keylen ) || ! _isExtensionSubtags ( buf , len ) ) {
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
continue ;
}
}
bcpKey = key ;
if ( ( len + 1 ) < extBufCapacity ) {
uprv_memcpy ( pExtBuf , buf , len ) ;
bcpValue = pExtBuf ;
pExtBuf += len ;
* pExtBuf = 0 ;
pExtBuf ++ ;
extBufCapacity -= ( len + 1 ) ;
}
else {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
}
ext = ( ExtensionListEntry * ) uprv_malloc ( sizeof ( ExtensionListEntry ) ) ;
if ( ext == NULL ) {
* status = U_MEMORY_ALLOCATION_ERROR ;
break ;
}
ext -> key = bcpKey ;
ext -> value = bcpValue ;
if ( ! _addExtensionToList ( & firstExt , ext , TRUE ) ) {
uprv_free ( ext ) ;
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
}
}
if ( hadPosix ) {
ext = ( ExtensionListEntry * ) uprv_malloc ( sizeof ( ExtensionListEntry ) ) ;
if ( ext == NULL ) {
* status = U_MEMORY_ALLOCATION_ERROR ;
goto cleanup ;
}
ext -> key = POSIX_KEY ;
ext -> value = POSIX_VALUE ;
if ( ! _addExtensionToList ( & firstExt , ext , TRUE ) ) {
uprv_free ( ext ) ;
}
}
if ( U_SUCCESS ( * status ) && ( firstExt != NULL || firstAttr != NULL ) ) {
UBool startLDMLExtension = FALSE ;
for ( ext = firstExt ;
ext ;
ext = ext -> next ) {
if ( ! startLDMLExtension && uprv_strlen ( ext -> key ) > 1 ) {
if ( reslen < capacity ) {
* ( appendAt + reslen ) = SEP ;
}
reslen ++ ;
if ( reslen < capacity ) {
* ( appendAt + reslen ) = LDMLEXT ;
}
reslen ++ ;
startLDMLExtension = TRUE ;
}
if ( uprv_strcmp ( ext -> key , LOCALE_ATTRIBUTE_KEY ) == 0 ) {
for ( attr = firstAttr ;
attr ;
attr = attr -> next ) {
if ( reslen < capacity ) {
* ( appendAt + reslen ) = SEP ;
}
reslen ++ ;
len = ( int32_t ) uprv_strlen ( attr -> attribute ) ;
if ( reslen < capacity ) {
uprv_memcpy ( appendAt + reslen , attr -> attribute , uprv_min ( len , capacity - reslen ) ) ;
}
reslen += len ;
}
}
else {
if ( reslen < capacity ) {
* ( appendAt + reslen ) = SEP ;
}
reslen ++ ;
len = ( int32_t ) uprv_strlen ( ext -> key ) ;
if ( reslen < capacity ) {
uprv_memcpy ( appendAt + reslen , ext -> key , uprv_min ( len , capacity - reslen ) ) ;
}
reslen += len ;
if ( reslen < capacity ) {
* ( appendAt + reslen ) = SEP ;
}
reslen ++ ;
len = ( int32_t ) uprv_strlen ( ext -> value ) ;
if ( reslen < capacity ) {
uprv_memcpy ( appendAt + reslen , ext -> value , uprv_min ( len , capacity - reslen ) ) ;
}
reslen += len ;
}
}
}
cleanup : ext = firstExt ;
while ( ext != NULL ) {
ExtensionListEntry * tmpExt = ext -> next ;
uprv_free ( ext ) ;
ext = tmpExt ;
}
attr = firstAttr ;
while ( attr != NULL ) {
AttributeListEntry * tmpAttr = attr -> next ;
char * pValue = ( char * ) attr -> attribute ;
uprv_free ( pValue ) ;
uprv_free ( attr ) ;
attr = tmpAttr ;
}
uenum_close ( keywordEnum ) ;
if ( U_FAILURE ( * status ) ) {
return 0 ;
}
}
return u_terminateChars ( appendAt , capacity , reslen , status ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void addFile ( const char * filename , const char * name , const char * source , UBool sourceTOC , UBool verbose ) {
char * s ;
uint32_t length ;
char * fullPath = NULL ;
if ( fileCount == fileMax ) {
fileMax += CHUNK_FILE_COUNT ;
files = ( File * ) uprv_realloc ( files , fileMax * sizeof ( files [ 0 ] ) ) ;
if ( files == NULL ) {
fprintf ( stderr , "pkgdata/gencmn: Could not allocate %u bytes for %d files\n" , ( unsigned int ) ( fileMax * sizeof ( files [ 0 ] ) ) , fileCount ) ;
exit ( U_MEMORY_ALLOCATION_ERROR ) ;
}
}
if ( ! sourceTOC ) {
FileStream * file ;
if ( uprv_pathIsAbsolute ( filename ) ) {
fprintf ( stderr , "gencmn: Error: absolute path encountered. Old style paths are not supported. Use relative paths such as 'fur.res' or 'translit%cfur.res'.\n\tBad path: '%s'\n" , U_FILE_SEP_CHAR , filename ) ;
exit ( U_ILLEGAL_ARGUMENT_ERROR ) ;
}
fullPath = pathToFullPath ( filename , source ) ;
length = ( uint32_t ) ( uprv_strlen ( filename ) + 1 + uprv_strlen ( name ) + 1 ) ;
s = allocString ( length ) ;
uprv_strcpy ( s , name ) ;
uprv_strcat ( s , U_TREE_ENTRY_SEP_STRING ) ;
uprv_strcat ( s , filename ) ;
fixDirToTreePath ( s ) ;
files [ fileCount ] . basename = s ;
files [ fileCount ] . basenameLength = length ;
files [ fileCount ] . pathname = fullPath ;
basenameTotal += length ;
file = T_FileStream_open ( fullPath , "rb" ) ;
if ( file == NULL ) {
fprintf ( stderr , "gencmn: unable to open listed file %s\n" , fullPath ) ;
exit ( U_FILE_ACCESS_ERROR ) ;
}
length = T_FileStream_size ( file ) ;
if ( T_FileStream_error ( file ) || length <= 20 ) {
fprintf ( stderr , "gencmn: unable to get length of listed file %s\n" , fullPath ) ;
exit ( U_FILE_ACCESS_ERROR ) ;
}
T_FileStream_close ( file ) ;
if ( maxSize && length > maxSize ) {
if ( verbose ) {
printf ( "%s ignored (size %ld > %ld)\n" , fullPath , ( long ) length , ( long ) maxSize ) ;
}
return ;
}
files [ fileCount ] . fileSize = length ;
}
else {
char * t ;
length = ( uint32_t ) ( uprv_strlen ( filename ) + 1 + uprv_strlen ( name ) + 1 ) ;
s = allocString ( length ) ;
uprv_strcpy ( s , name ) ;
uprv_strcat ( s , U_TREE_ENTRY_SEP_STRING ) ;
uprv_strcat ( s , filename ) ;
fixDirToTreePath ( s ) ;
files [ fileCount ] . basename = s ;
t = files [ fileCount ] . pathname = allocString ( length ) ;
while ( -- length > 0 ) {
if ( * s == '.' || * s == '-' || * s == '/' ) {
* t = '_' ;
}
else {
* t = * s ;
}
++ s ;
++ t ;
}
* t = 0 ;
}
++ fileCount ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void nameserver_ready_callback ( int fd , short events , void * arg ) {
struct nameserver * ns = ( struct nameserver * ) arg ;
( void ) fd ;
if ( events & EV_WRITE ) {
ns -> choked = 0 ;
if ( ! evdns_transmit ( ) ) {
nameserver_write_waiting ( ns , 0 ) ;
}
}
if ( events & EV_READ ) {
nameserver_read ( ns ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
unsigned long # endif # undef mul # undef mul_add # define mul_add ( r , a , word , carry ) do {
\ register BN_ULONG high , low ;
\ asm ( "mulq %3" \ : "=a" ( low ) , "=d" ( high ) \ : "a" ( word ) , "m" ( a ) \ : "cc" ) ;
\ asm ( "addq %2,%0;
adcq %3,%1" \ : "+r" ( carry ) , "+d" ( high ) \ : "a" ( low ) , "g" ( 0 ) \ : "cc" ) ;
\ asm ( "addq %2,%0;
adcq %3,%1" \ : "+m" ( r ) , "+d" ( high ) \ : "r" ( carry ) , "g" ( 0 ) \ : "cc" ) ;
\ carry = high ;
\ }
while ( 0 ) # define mul ( r , a , word , carry ) do {
\ register BN_ULONG high , low ;
\ asm ( "mulq %3" \ : "=a" ( low ) , "=d" ( high ) \ : "a" ( word ) , "g" ( a ) \ : "cc" ) ;
\ asm ( "addq %2,%0;
adcq %3,%1" \ : "+r" ( carry ) , "+d" ( high ) \ : "a" ( low ) , "g" ( 0 ) \ : "cc" ) ;
\ ( r ) = carry , carry = high ;
\ }
while ( 0 ) # undef sqr # define sqr ( r0 , r1 , a ) \ asm ( "mulq %2" \ : "=a" ( r0 ) , "=d" ( r1 ) \ : "a" ( a ) \ : "cc" ) ;
BN_ULONG bn_mul_add_words ( BN_ULONG * rp , const BN_ULONG * ap , int num , BN_ULONG w ) {
BN_ULONG c1 = 0 ;
if ( num <= 0 ) return ( c1 ) ;
while ( num & ~ 3 ) {
mul_add ( rp [ 0 ] , ap [ 0 ] , w , c1 ) ;
mul_add ( rp [ 1 ] , ap [ 1 ] , w , c1 ) ;
mul_add ( rp [ 2 ] , ap [ 2 ] , w , c1 ) ;
mul_add ( rp [ 3 ] , ap [ 3 ] , w , c1 ) ;
ap += 4 ;
rp += 4 ;
num -= 4 ;
}
if ( num ) {
mul_add ( rp [ 0 ] , ap [ 0 ] , w , c1 ) ;
if ( -- num == 0 ) return c1 ;
mul_add ( rp [ 1 ] , ap [ 1 ] , w , c1 ) ;
if ( -- num == 0 ) return c1 ;
mul_add ( rp [ 2 ] , ap [ 2 ] , w , c1 ) ;
return c1 ;
}
return ( c1 ) ;
}
BN_ULONG bn_mul_words ( BN_ULONG * rp , const BN_ULONG * ap , int num , BN_ULONG w ) {
BN_ULONG c1 = 0 ;
if ( num <= 0 ) return ( c1 ) ;
while ( num & ~ 3 ) {
mul ( rp [ 0 ] , ap [ 0 ] , w , c1 ) ;
mul ( rp [ 1 ] , ap [ 1 ] , w , c1 ) ;
mul ( rp [ 2 ] , ap [ 2 ] , w , c1 ) ;
mul ( rp [ 3 ] , ap [ 3 ] , w , c1 ) ;
ap += 4 ;
rp += 4 ;
num -= 4 ;
}
if ( num ) {
mul ( rp [ 0 ] , ap [ 0 ] , w , c1 ) ;
if ( -- num == 0 ) return c1 ;
mul ( rp [ 1 ] , ap [ 1 ] , w , c1 ) ;
if ( -- num == 0 ) return c1 ;
mul ( rp [ 2 ] , ap [ 2 ] , w , c1 ) ;
}
return ( c1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void encode_with_recode_loop ( VP9_COMP * cpi , size_t * size , uint8_t * dest , int q , int bottom_index , int top_index ) {
VP9_COMMON * const cm = & cpi -> common ;
RATE_CONTROL * const rc = & cpi -> rc ;
int loop_count = 0 ;
int loop = 0 ;
int overshoot_seen = 0 ;
int undershoot_seen = 0 ;
int q_low = bottom_index , q_high = top_index ;
int frame_over_shoot_limit ;
int frame_under_shoot_limit ;
vp9_rc_compute_frame_size_bounds ( cpi , rc -> this_frame_target , & frame_under_shoot_limit , & frame_over_shoot_limit ) ;
do {
vp9_clear_system_state ( ) ;
vp9_set_quantizer ( cm , q ) ;
if ( loop_count == 0 ) setup_frame ( cpi ) ;
if ( cpi -> oxcf . aq_mode == VARIANCE_AQ ) {
vp9_vaq_frame_setup ( cpi ) ;
}
else if ( cpi -> oxcf . aq_mode == COMPLEXITY_AQ ) {
vp9_setup_in_frame_q_adj ( cpi ) ;
}
vp9_encode_frame ( cpi ) ;
vp9_clear_system_state ( ) ;
if ( cpi -> sf . recode_loop >= ALLOW_RECODE_KFARFGF ) {
save_coding_context ( cpi ) ;
if ( ! cpi -> sf . use_nonrd_pick_mode ) vp9_pack_bitstream ( cpi , dest , size ) ;
rc -> projected_frame_size = ( int ) ( * size ) << 3 ;
restore_coding_context ( cpi ) ;
if ( frame_over_shoot_limit == 0 ) frame_over_shoot_limit = 1 ;
}
if ( cpi -> oxcf . rc_mode == VPX_Q ) {
loop = 0 ;
}
else {
if ( ( cm -> frame_type == KEY_FRAME ) && rc -> this_key_frame_forced && ( rc -> projected_frame_size < rc -> max_frame_bandwidth ) ) {
int last_q = q ;
int kf_err = vp9_get_y_sse ( cpi -> Source , get_frame_new_buffer ( cm ) ) ;
int high_err_target = cpi -> ambient_err ;
int low_err_target = cpi -> ambient_err >> 1 ;
kf_err += ! kf_err ;
if ( ( kf_err > high_err_target && rc -> projected_frame_size <= frame_over_shoot_limit ) || ( kf_err > low_err_target && rc -> projected_frame_size <= frame_under_shoot_limit ) ) {
q_high = q > q_low ? q - 1 : q_low ;
q = ( q * high_err_target ) / kf_err ;
q = MIN ( q , ( q_high + q_low ) >> 1 ) ;
}
else if ( kf_err < low_err_target && rc -> projected_frame_size >= frame_under_shoot_limit ) {
q_low = q < q_high ? q + 1 : q_high ;
q = ( q * low_err_target ) / kf_err ;
q = MIN ( q , ( q_high + q_low + 1 ) >> 1 ) ;
}
q = clamp ( q , q_low , q_high ) ;
loop = q != last_q ;
}
else if ( recode_loop_test ( cpi , frame_over_shoot_limit , frame_under_shoot_limit , q , MAX ( q_high , top_index ) , bottom_index ) ) {
int last_q = q ;
int retries = 0 ;
if ( rc -> projected_frame_size > rc -> this_frame_target ) {
if ( rc -> projected_frame_size >= rc -> max_frame_bandwidth ) q_high = rc -> worst_quality ;
q_low = q < q_high ? q + 1 : q_high ;
if ( undershoot_seen || loop_count > 1 ) {
vp9_rc_update_rate_correction_factors ( cpi , 1 ) ;
q = ( q_high + q_low + 1 ) / 2 ;
}
else {
vp9_rc_update_rate_correction_factors ( cpi , 0 ) ;
q = vp9_rc_regulate_q ( cpi , rc -> this_frame_target , bottom_index , MAX ( q_high , top_index ) ) ;
while ( q < q_low && retries < 10 ) {
vp9_rc_update_rate_correction_factors ( cpi , 0 ) ;
q = vp9_rc_regulate_q ( cpi , rc -> this_frame_target , bottom_index , MAX ( q_high , top_index ) ) ;
retries ++ ;
}
}
overshoot_seen = 1 ;
}
else {
q_high = q > q_low ? q - 1 : q_low ;
if ( overshoot_seen || loop_count > 1 ) {
vp9_rc_update_rate_correction_factors ( cpi , 1 ) ;
q = ( q_high + q_low ) / 2 ;
}
else {
vp9_rc_update_rate_correction_factors ( cpi , 0 ) ;
q = vp9_rc_regulate_q ( cpi , rc -> this_frame_target , bottom_index , top_index ) ;
if ( cpi -> oxcf . rc_mode == VPX_CQ && q < q_low ) {
q_low = q ;
}
while ( q > q_high && retries < 10 ) {
vp9_rc_update_rate_correction_factors ( cpi , 0 ) ;
q = vp9_rc_regulate_q ( cpi , rc -> this_frame_target , bottom_index , top_index ) ;
retries ++ ;
}
}
undershoot_seen = 1 ;
}
q = clamp ( q , q_low , q_high ) ;
loop = q != last_q ;
}
else {
loop = 0 ;
}
}
if ( rc -> is_src_frame_alt_ref && rc -> projected_frame_size < rc -> max_frame_bandwidth ) loop = 0 ;
if ( loop ) {
loop_count ++ ;
# if CONFIG_INTERNAL_STATS cpi -> tot_recode_hits ++ ;
# endif }
}
while ( loop ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int udpv6_sendmsg ( struct kiocb * iocb , struct sock * sk , struct msghdr * msg , size_t len ) {
struct ipv6_txoptions opt_space ;
struct udp_sock * up = udp_sk ( sk ) ;
struct inet_sock * inet = inet_sk ( sk ) ;
struct ipv6_pinfo * np = inet6_sk ( sk ) ;
struct sockaddr_in6 * sin6 = ( struct sockaddr_in6 * ) msg -> msg_name ;
struct in6_addr * daddr , * final_p = NULL , final ;
struct ipv6_txoptions * opt = NULL ;
struct ip6_flowlabel * flowlabel = NULL ;
struct flowi fl ;
struct dst_entry * dst ;
int addr_len = msg -> msg_namelen ;
int ulen = len ;
int hlimit = - 1 ;
int tclass = - 1 ;
int dontfrag = - 1 ;
int corkreq = up -> corkflag || msg -> msg_flags & MSG_MORE ;
int err ;
int connected = 0 ;
int is_udplite = IS_UDPLITE ( sk ) ;
int ( * getfrag ) ( void * , char * , int , int , int , struct sk_buff * ) ;
if ( sin6 ) {
if ( addr_len < offsetof ( struct sockaddr , sa_data ) ) return - EINVAL ;
switch ( sin6 -> sin6_family ) {
case AF_INET6 : if ( addr_len < SIN6_LEN_RFC2133 ) return - EINVAL ;
daddr = & sin6 -> sin6_addr ;
break ;
case AF_INET : goto do_udp_sendmsg ;
case AF_UNSPEC : msg -> msg_name = sin6 = NULL ;
msg -> msg_namelen = addr_len = 0 ;
daddr = NULL ;
break ;
default : return - EINVAL ;
}
}
else if ( ! up -> pending ) {
if ( sk -> sk_state != TCP_ESTABLISHED ) return - EDESTADDRREQ ;
daddr = & np -> daddr ;
}
else daddr = NULL ;
if ( daddr ) {
if ( ipv6_addr_v4mapped ( daddr ) ) {
struct sockaddr_in sin ;
sin . sin_family = AF_INET ;
sin . sin_port = sin6 ? sin6 -> sin6_port : inet -> inet_dport ;
sin . sin_addr . s_addr = daddr -> s6_addr32 [ 3 ] ;
msg -> msg_name = & sin ;
msg -> msg_namelen = sizeof ( sin ) ;
do_udp_sendmsg : if ( __ipv6_only_sock ( sk ) ) return - ENETUNREACH ;
return udp_sendmsg ( iocb , sk , msg , len ) ;
}
}
if ( up -> pending == AF_INET ) return udp_sendmsg ( iocb , sk , msg , len ) ;
if ( len > INT_MAX - sizeof ( struct udphdr ) ) return - EMSGSIZE ;
if ( up -> pending ) {
lock_sock ( sk ) ;
if ( likely ( up -> pending ) ) {
if ( unlikely ( up -> pending != AF_INET6 ) ) {
release_sock ( sk ) ;
return - EAFNOSUPPORT ;
}
dst = NULL ;
goto do_append_data ;
}
release_sock ( sk ) ;
}
ulen += sizeof ( struct udphdr ) ;
memset ( & fl , 0 , sizeof ( fl ) ) ;
if ( sin6 ) {
if ( sin6 -> sin6_port == 0 ) return - EINVAL ;
fl . fl_ip_dport = sin6 -> sin6_port ;
daddr = & sin6 -> sin6_addr ;
if ( np -> sndflow ) {
fl . fl6_flowlabel = sin6 -> sin6_flowinfo & IPV6_FLOWINFO_MASK ;
if ( fl . fl6_flowlabel & IPV6_FLOWLABEL_MASK ) {
flowlabel = fl6_sock_lookup ( sk , fl . fl6_flowlabel ) ;
if ( flowlabel == NULL ) return - EINVAL ;
daddr = & flowlabel -> dst ;
}
}
if ( sk -> sk_state == TCP_ESTABLISHED && ipv6_addr_equal ( daddr , & np -> daddr ) ) daddr = & np -> daddr ;
if ( addr_len >= sizeof ( struct sockaddr_in6 ) && sin6 -> sin6_scope_id && ipv6_addr_type ( daddr ) & IPV6_ADDR_LINKLOCAL ) fl . oif = sin6 -> sin6_scope_id ;
}
else {
if ( sk -> sk_state != TCP_ESTABLISHED ) return - EDESTADDRREQ ;
fl . fl_ip_dport = inet -> inet_dport ;
daddr = & np -> daddr ;
fl . fl6_flowlabel = np -> flow_label ;
connected = 1 ;
}
if ( ! fl . oif ) fl . oif = sk -> sk_bound_dev_if ;
if ( ! fl . oif ) fl . oif = np -> sticky_pktinfo . ipi6_ifindex ;
fl . mark = sk -> sk_mark ;
if ( msg -> msg_controllen ) {
opt = & opt_space ;
memset ( opt , 0 , sizeof ( struct ipv6_txoptions ) ) ;
opt -> tot_len = sizeof ( * opt ) ;
err = datagram_send_ctl ( sock_net ( sk ) , msg , & fl , opt , & hlimit , & tclass , & dontfrag ) ;
if ( err < 0 ) {
fl6_sock_release ( flowlabel ) ;
return err ;
}
if ( ( fl . fl6_flowlabel & IPV6_FLOWLABEL_MASK ) && ! flowlabel ) {
flowlabel = fl6_sock_lookup ( sk , fl . fl6_flowlabel ) ;
if ( flowlabel == NULL ) return - EINVAL ;
}
if ( ! ( opt -> opt_nflen | opt -> opt_flen ) ) opt = NULL ;
connected = 0 ;
}
if ( opt == NULL ) opt = np -> opt ;
if ( flowlabel ) opt = fl6_merge_options ( & opt_space , flowlabel , opt ) ;
opt = ipv6_fixup_options ( & opt_space , opt ) ;
fl . proto = sk -> sk_protocol ;
if ( ! ipv6_addr_any ( daddr ) ) ipv6_addr_copy ( & fl . fl6_dst , daddr ) ;
else fl . fl6_dst . s6_addr [ 15 ] = 0x1 ;
if ( ipv6_addr_any ( & fl . fl6_src ) && ! ipv6_addr_any ( & np -> saddr ) ) ipv6_addr_copy ( & fl . fl6_src , & np -> saddr ) ;
fl . fl_ip_sport = inet -> inet_sport ;
if ( opt && opt -> srcrt ) {
struct rt0_hdr * rt0 = ( struct rt0_hdr * ) opt -> srcrt ;
ipv6_addr_copy ( & final , & fl . fl6_dst ) ;
ipv6_addr_copy ( & fl . fl6_dst , rt0 -> addr ) ;
final_p = & final ;
connected = 0 ;
}
if ( ! fl . oif && ipv6_addr_is_multicast ( & fl . fl6_dst ) ) {
fl . oif = np -> mcast_oif ;
connected = 0 ;
}
security_sk_classify_flow ( sk , & fl ) ;
err = ip6_sk_dst_lookup ( sk , & dst , & fl ) ;
if ( err ) goto out ;
if ( final_p ) ipv6_addr_copy ( & fl . fl6_dst , final_p ) ;
err = __xfrm_lookup ( sock_net ( sk ) , & dst , & fl , sk , XFRM_LOOKUP_WAIT ) ;
if ( err < 0 ) {
if ( err == - EREMOTE ) err = ip6_dst_blackhole ( sk , & dst , & fl ) ;
if ( err < 0 ) goto out ;
}
if ( hlimit < 0 ) {
if ( ipv6_addr_is_multicast ( & fl . fl6_dst ) ) hlimit = np -> mcast_hops ;
else hlimit = np -> hop_limit ;
if ( hlimit < 0 ) hlimit = ip6_dst_hoplimit ( dst ) ;
}
if ( tclass < 0 ) tclass = np -> tclass ;
if ( dontfrag < 0 ) dontfrag = np -> dontfrag ;
if ( msg -> msg_flags & MSG_CONFIRM ) goto do_confirm ;
back_from_confirm : lock_sock ( sk ) ;
if ( unlikely ( up -> pending ) ) {
release_sock ( sk ) ;
LIMIT_NETDEBUG ( KERN_DEBUG "udp cork app bug 2\n" ) ;
err = - EINVAL ;
goto out ;
}
up -> pending = AF_INET6 ;
do_append_data : up -> len += ulen ;
getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag ;
err = ip6_append_data ( sk , getfrag , msg -> msg_iov , ulen , sizeof ( struct udphdr ) , hlimit , tclass , opt , & fl , ( struct rt6_info * ) dst , corkreq ? msg -> msg_flags | MSG_MORE : msg -> msg_flags , dontfrag ) ;
if ( err ) udp_v6_flush_pending_frames ( sk ) ;
else if ( ! corkreq ) err = udp_v6_push_pending_frames ( sk ) ;
else if ( unlikely ( skb_queue_empty ( & sk -> sk_write_queue ) ) ) up -> pending = 0 ;
if ( dst ) {
if ( connected ) {
ip6_dst_store ( sk , dst , ipv6_addr_equal ( & fl . fl6_dst , & np -> daddr ) ? & np -> daddr : NULL , # ifdef CONFIG_IPV6_SUBTREES ipv6_addr_equal ( & fl . fl6_src , & np -> saddr ) ? & np -> saddr : # endif NULL ) ;
}
else {
dst_release ( dst ) ;
}
dst = NULL ;
}
if ( err > 0 ) err = np -> recverr ? net_xmit_errno ( err ) : 0 ;
release_sock ( sk ) ;
out : dst_release ( dst ) ;
fl6_sock_release ( flowlabel ) ;
if ( ! err ) return len ;
if ( err == - ENOBUFS || test_bit ( SOCK_NOSPACE , & sk -> sk_socket -> flags ) ) {
UDP6_INC_STATS_USER ( sock_net ( sk ) , UDP_MIB_SNDBUFERRORS , is_udplite ) ;
}
return err ;
do_confirm : dst_confirm ( dst ) ;
if ( ! ( msg -> msg_flags & MSG_PROBE ) || len ) goto back_from_confirm ;
err = 0 ;
goto out ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int _TIFFmemcmp ( const tdata_t p1 , const tdata_t p2 , tsize_t c ) {
return ( memcmp ( p1 , p2 , ( size_t ) c ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static LDOUBLE abs_val ( LDOUBLE value ) {
LDOUBLE result = value ;
if ( value < 0 ) result = - value ;
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ff_h264_get_profile ( SPS * sps ) {
int profile = sps -> profile_idc ;
switch ( sps -> profile_idc ) {
case FF_PROFILE_H264_BASELINE : profile |= ( sps -> constraint_set_flags & 1 << 1 ) ? FF_PROFILE_H264_CONSTRAINED : 0 ;
break ;
case FF_PROFILE_H264_HIGH_10 : case FF_PROFILE_H264_HIGH_422 : case FF_PROFILE_H264_HIGH_444_PREDICTIVE : profile |= ( sps -> constraint_set_flags & 1 << 3 ) ? FF_PROFILE_H264_INTRA : 0 ;
break ;
}
return profile ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint64_t xhci_runtime_read ( void * ptr , hwaddr reg , unsigned size ) {
XHCIState * xhci = ptr ;
uint32_t ret = 0 ;
if ( reg < 0x20 ) {
switch ( reg ) {
case 0x00 : ret = xhci_mfindex_get ( xhci ) & 0x3fff ;
break ;
default : trace_usb_xhci_unimplemented ( "runtime read" , reg ) ;
break ;
}
}
else {
int v = ( reg - 0x20 ) / 0x20 ;
XHCIInterrupter * intr = & xhci -> intr [ v ] ;
switch ( reg & 0x1f ) {
case 0x00 : ret = intr -> iman ;
break ;
case 0x04 : ret = intr -> imod ;
break ;
case 0x08 : ret = intr -> erstsz ;
break ;
case 0x10 : ret = intr -> erstba_low ;
break ;
case 0x14 : ret = intr -> erstba_high ;
break ;
case 0x18 : ret = intr -> erdp_low ;
break ;
case 0x1c : ret = intr -> erdp_high ;
break ;
}
}
trace_usb_xhci_runtime_read ( reg , ret ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint16 de_clg_party_sub_addr ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo , guint32 offset , guint len , gchar * add_string _U_ , int string_len _U_ ) {
gchar * extr_addr ;
de_sub_addr ( tvb , tree , pinfo , offset , len , & extr_addr ) ;
if ( extr_addr && add_string ) g_snprintf ( add_string , string_len , " - (%s)" , extr_addr ) ;
return ( len ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void copy_clog_xlog_xid ( void ) {
copy_subdir_files ( "pg_clog" ) ;
prep_status ( "Setting next transaction ID and epoch for new cluster" ) ;
exec_prog ( UTILITY_LOG_FILE , NULL , true , "\"%s/pg_resetxlog\" -f -x %u \"%s\"" , new_cluster . bindir , old_cluster . controldata . chkpnt_nxtxid , new_cluster . pgdata ) ;
exec_prog ( UTILITY_LOG_FILE , NULL , true , "\"%s/pg_resetxlog\" -f -e %u \"%s\"" , new_cluster . bindir , old_cluster . controldata . chkpnt_nxtepoch , new_cluster . pgdata ) ;
exec_prog ( UTILITY_LOG_FILE , NULL , true , "\"%s/pg_resetxlog\" -f -c %u,%u \"%s\"" , new_cluster . bindir , old_cluster . controldata . chkpnt_nxtxid , old_cluster . controldata . chkpnt_nxtxid , new_cluster . pgdata ) ;
check_ok ( ) ;
if ( old_cluster . controldata . cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER && new_cluster . controldata . cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER ) {
copy_subdir_files ( "pg_multixact/offsets" ) ;
copy_subdir_files ( "pg_multixact/members" ) ;
prep_status ( "Setting next multixact ID and offset for new cluster" ) ;
exec_prog ( UTILITY_LOG_FILE , NULL , true , "\"%s/pg_resetxlog\" -O %u -m %u,%u \"%s\"" , new_cluster . bindir , old_cluster . controldata . chkpnt_nxtmxoff , old_cluster . controldata . chkpnt_nxtmulti , old_cluster . controldata . chkpnt_oldstMulti , new_cluster . pgdata ) ;
check_ok ( ) ;
}
else if ( new_cluster . controldata . cat_ver >= MULTIXACT_FORMATCHANGE_CAT_VER ) {
remove_new_subdir ( "pg_multixact/offsets" , false ) ;
prep_status ( "Setting oldest multixact ID on new cluster" ) ;
exec_prog ( UTILITY_LOG_FILE , NULL , true , "\"%s/pg_resetxlog\" -m %u,%u \"%s\"" , new_cluster . bindir , old_cluster . controldata . chkpnt_nxtmulti + 1 , old_cluster . controldata . chkpnt_nxtmulti , new_cluster . pgdata ) ;
check_ok ( ) ;
}
prep_status ( "Resetting WAL archives" ) ;
exec_prog ( UTILITY_LOG_FILE , NULL , true , "\"%s/pg_resetxlog\" -l 00000001%s \"%s\"" , new_cluster . bindir , old_cluster . controldata . nextxlogfile + 8 , new_cluster . pgdata ) ;
check_ok ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( HQPOrderingTest , TEMatch ) {
std : : vector < std : : string > expected_urls ;
expected_urls . push_back ( "http://techmeme.com/" ) ;
expected_urls . push_back ( "http://www.teamliquid.net/" ) ;
expected_urls . push_back ( "http://www.teamliquid.net/tlpd" ) ;
RunTest ( ASCIIToUTF16 ( "te" ) , false , expected_urls , true , ASCIIToUTF16 ( "techmeme.com" ) , ASCIIToUTF16 ( "chmeme.com" ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dict_spot_params ( const ref * pdict , gs_spot_halftone * psp , ref * psproc , ref * ptproc , gs_memory_t * mem ) {
int code ;
check_dict_read ( * pdict ) ;
if ( ( code = dict_float_param ( pdict , "Frequency" , 0.0 , & psp -> screen . frequency ) ) != 0 || ( code = dict_float_param ( pdict , "Angle" , 0.0 , & psp -> screen . angle ) ) != 0 || ( code = dict_proc_param ( pdict , "SpotFunction" , psproc , false ) ) != 0 || ( code = dict_bool_param ( pdict , "AccurateScreens" , gs_currentaccuratescreens ( mem ) , & psp -> accurate_screens ) ) < 0 || ( code = dict_proc_param ( pdict , "TransferFunction" , ptproc , false ) ) < 0 ) return ( code < 0 ? code : gs_error_undefined ) ;
psp -> transfer = ( code > 0 ? ( gs_mapping_proc ) 0 : gs_mapped_transfer ) ;
psp -> transfer_closure . proc = 0 ;
psp -> transfer_closure . data = 0 ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
char * gcry_sexp_nth_string ( const gcry_sexp_t list , int number ) {
const char * s ;
size_t n ;
char * buf ;
s = sexp_nth_data ( list , number , & n ) ;
if ( ! s || n < 1 || ( n + 1 ) < 1 ) return NULL ;
buf = gcry_malloc ( n + 1 ) ;
if ( ! buf ) return NULL ;
memcpy ( buf , s , n ) ;
buf [ n ] = 0 ;
return buf ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline Quantum GetPixelGreen ( const Image * restrict image , const Quantum * restrict pixel ) {
return ( pixel [ image -> channel_map [ GreenPixelChannel ] . offset ] ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void rd_use_partition ( VP9_COMP * cpi , const TileInfo * const tile , MODE_INFO * mi_8x8 , TOKENEXTRA * * tp , int mi_row , int mi_col , BLOCK_SIZE bsize , int * rate , int64_t * dist , int do_recon , PC_TREE * pc_tree ) {
VP9_COMMON * const cm = & cpi -> common ;
MACROBLOCK * const x = & cpi -> mb ;
MACROBLOCKD * const xd = & x -> e_mbd ;
const int mis = cm -> mi_stride ;
const int bsl = b_width_log2 ( bsize ) ;
const int mi_step = num_4x4_blocks_wide_lookup [ bsize ] / 2 ;
const int bss = ( 1 << bsl ) / 4 ;
int i , pl ;
PARTITION_TYPE partition = PARTITION_NONE ;
BLOCK_SIZE subsize ;
ENTROPY_CONTEXT l [ 16 * MAX_MB_PLANE ] , a [ 16 * MAX_MB_PLANE ] ;
PARTITION_CONTEXT sl [ 8 ] , sa [ 8 ] ;
int last_part_rate = INT_MAX ;
int64_t last_part_dist = INT64_MAX ;
int64_t last_part_rd = INT64_MAX ;
int none_rate = INT_MAX ;
int64_t none_dist = INT64_MAX ;
int64_t none_rd = INT64_MAX ;
int chosen_rate = INT_MAX ;
int64_t chosen_dist = INT64_MAX ;
int64_t chosen_rd = INT64_MAX ;
BLOCK_SIZE sub_subsize = BLOCK_4X4 ;
int splits_below = 0 ;
BLOCK_SIZE bs_type = mi_8x8 [ 0 ] . src_mi -> mbmi . sb_type ;
int do_partition_search = 1 ;
PICK_MODE_CONTEXT * ctx = & pc_tree -> none ;
if ( mi_row >= cm -> mi_rows || mi_col >= cm -> mi_cols ) return ;
assert ( num_4x4_blocks_wide_lookup [ bsize ] == num_4x4_blocks_high_lookup [ bsize ] ) ;
partition = partition_lookup [ bsl ] [ bs_type ] ;
subsize = get_subsize ( bsize , partition ) ;
pc_tree -> partitioning = partition ;
save_context ( cpi , mi_row , mi_col , a , l , sa , sl , bsize ) ;
if ( bsize == BLOCK_16X16 && cpi -> oxcf . aq_mode ) {
set_offsets ( cpi , tile , mi_row , mi_col , bsize ) ;
x -> mb_energy = vp9_block_energy ( cpi , x , bsize ) ;
}
if ( do_partition_search && cpi -> sf . partition_search_type == SEARCH_PARTITION && cpi -> sf . adjust_partitioning_from_last_frame ) {
if ( partition == PARTITION_SPLIT && subsize > BLOCK_8X8 ) {
sub_subsize = get_subsize ( subsize , PARTITION_SPLIT ) ;
splits_below = 1 ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
int jj = i >> 1 , ii = i & 0x01 ;
MODE_INFO * this_mi = mi_8x8 [ jj * bss * mis + ii * bss ] . src_mi ;
if ( this_mi && this_mi -> mbmi . sb_type >= sub_subsize ) {
splits_below = 0 ;
}
}
}
if ( partition != PARTITION_NONE && ! splits_below && mi_row + ( mi_step >> 1 ) < cm -> mi_rows && mi_col + ( mi_step >> 1 ) < cm -> mi_cols ) {
pc_tree -> partitioning = PARTITION_NONE ;
rd_pick_sb_modes ( cpi , tile , mi_row , mi_col , & none_rate , & none_dist , bsize , ctx , INT64_MAX , 0 ) ;
pl = partition_plane_context ( xd , mi_row , mi_col , bsize ) ;
if ( none_rate < INT_MAX ) {
none_rate += cpi -> partition_cost [ pl ] [ PARTITION_NONE ] ;
none_rd = RDCOST ( x -> rdmult , x -> rddiv , none_rate , none_dist ) ;
}
restore_context ( cpi , mi_row , mi_col , a , l , sa , sl , bsize ) ;
mi_8x8 [ 0 ] . src_mi -> mbmi . sb_type = bs_type ;
pc_tree -> partitioning = partition ;
}
}
switch ( partition ) {
case PARTITION_NONE : rd_pick_sb_modes ( cpi , tile , mi_row , mi_col , & last_part_rate , & last_part_dist , bsize , ctx , INT64_MAX , 0 ) ;
break ;
case PARTITION_HORZ : rd_pick_sb_modes ( cpi , tile , mi_row , mi_col , & last_part_rate , & last_part_dist , subsize , & pc_tree -> horizontal [ 0 ] , INT64_MAX , 0 ) ;
if ( last_part_rate != INT_MAX && bsize >= BLOCK_8X8 && mi_row + ( mi_step >> 1 ) < cm -> mi_rows ) {
int rt = 0 ;
int64_t dt = 0 ;
PICK_MODE_CONTEXT * ctx = & pc_tree -> horizontal [ 0 ] ;
update_state ( cpi , ctx , mi_row , mi_col , subsize , 0 ) ;
encode_superblock ( cpi , tp , 0 , mi_row , mi_col , subsize , ctx ) ;
rd_pick_sb_modes ( cpi , tile , mi_row + ( mi_step >> 1 ) , mi_col , & rt , & dt , subsize , & pc_tree -> horizontal [ 1 ] , INT64_MAX , 1 ) ;
if ( rt == INT_MAX || dt == INT64_MAX ) {
last_part_rate = INT_MAX ;
last_part_dist = INT64_MAX ;
break ;
}
last_part_rate += rt ;
last_part_dist += dt ;
}
break ;
case PARTITION_VERT : rd_pick_sb_modes ( cpi , tile , mi_row , mi_col , & last_part_rate , & last_part_dist , subsize , & pc_tree -> vertical [ 0 ] , INT64_MAX , 0 ) ;
if ( last_part_rate != INT_MAX && bsize >= BLOCK_8X8 && mi_col + ( mi_step >> 1 ) < cm -> mi_cols ) {
int rt = 0 ;
int64_t dt = 0 ;
PICK_MODE_CONTEXT * ctx = & pc_tree -> vertical [ 0 ] ;
update_state ( cpi , ctx , mi_row , mi_col , subsize , 0 ) ;
encode_superblock ( cpi , tp , 0 , mi_row , mi_col , subsize , ctx ) ;
rd_pick_sb_modes ( cpi , tile , mi_row , mi_col + ( mi_step >> 1 ) , & rt , & dt , subsize , & pc_tree -> vertical [ bsize > BLOCK_8X8 ] , INT64_MAX , 1 ) ;
if ( rt == INT_MAX || dt == INT64_MAX ) {
last_part_rate = INT_MAX ;
last_part_dist = INT64_MAX ;
break ;
}
last_part_rate += rt ;
last_part_dist += dt ;
}
break ;
case PARTITION_SPLIT : if ( bsize == BLOCK_8X8 ) {
rd_pick_sb_modes ( cpi , tile , mi_row , mi_col , & last_part_rate , & last_part_dist , subsize , pc_tree -> leaf_split [ 0 ] , INT64_MAX , 0 ) ;
break ;
}
last_part_rate = 0 ;
last_part_dist = 0 ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
int x_idx = ( i & 1 ) * ( mi_step >> 1 ) ;
int y_idx = ( i >> 1 ) * ( mi_step >> 1 ) ;
int jj = i >> 1 , ii = i & 0x01 ;
int rt ;
int64_t dt ;
if ( ( mi_row + y_idx >= cm -> mi_rows ) || ( mi_col + x_idx >= cm -> mi_cols ) ) continue ;
rd_use_partition ( cpi , tile , mi_8x8 + jj * bss * mis + ii * bss , tp , mi_row + y_idx , mi_col + x_idx , subsize , & rt , & dt , i != 3 , pc_tree -> split [ i ] ) ;
if ( rt == INT_MAX || dt == INT64_MAX ) {
last_part_rate = INT_MAX ;
last_part_dist = INT64_MAX ;
break ;
}
last_part_rate += rt ;
last_part_dist += dt ;
}
break ;
default : assert ( 0 ) ;
break ;
}
pl = partition_plane_context ( xd , mi_row , mi_col , bsize ) ;
if ( last_part_rate < INT_MAX ) {
last_part_rate += cpi -> partition_cost [ pl ] [ partition ] ;
last_part_rd = RDCOST ( x -> rdmult , x -> rddiv , last_part_rate , last_part_dist ) ;
}
if ( do_partition_search && cpi -> sf . adjust_partitioning_from_last_frame && cpi -> sf . partition_search_type == SEARCH_PARTITION && partition != PARTITION_SPLIT && bsize > BLOCK_8X8 && ( mi_row + mi_step < cm -> mi_rows || mi_row + ( mi_step >> 1 ) == cm -> mi_rows ) && ( mi_col + mi_step < cm -> mi_cols || mi_col + ( mi_step >> 1 ) == cm -> mi_cols ) ) {
BLOCK_SIZE split_subsize = get_subsize ( bsize , PARTITION_SPLIT ) ;
chosen_rate = 0 ;
chosen_dist = 0 ;
restore_context ( cpi , mi_row , mi_col , a , l , sa , sl , bsize ) ;
pc_tree -> partitioning = PARTITION_SPLIT ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
int x_idx = ( i & 1 ) * ( mi_step >> 1 ) ;
int y_idx = ( i >> 1 ) * ( mi_step >> 1 ) ;
int rt = 0 ;
int64_t dt = 0 ;
ENTROPY_CONTEXT l [ 16 * MAX_MB_PLANE ] , a [ 16 * MAX_MB_PLANE ] ;
PARTITION_CONTEXT sl [ 8 ] , sa [ 8 ] ;
if ( ( mi_row + y_idx >= cm -> mi_rows ) || ( mi_col + x_idx >= cm -> mi_cols ) ) continue ;
save_context ( cpi , mi_row , mi_col , a , l , sa , sl , bsize ) ;
pc_tree -> split [ i ] -> partitioning = PARTITION_NONE ;
rd_pick_sb_modes ( cpi , tile , mi_row + y_idx , mi_col + x_idx , & rt , & dt , split_subsize , & pc_tree -> split [ i ] -> none , INT64_MAX , i ) ;
restore_context ( cpi , mi_row , mi_col , a , l , sa , sl , bsize ) ;
if ( rt == INT_MAX || dt == INT64_MAX ) {
chosen_rate = INT_MAX ;
chosen_dist = INT64_MAX ;
break ;
}
chosen_rate += rt ;
chosen_dist += dt ;
if ( i != 3 ) encode_sb ( cpi , tile , tp , mi_row + y_idx , mi_col + x_idx , 0 , split_subsize , pc_tree -> split [ i ] ) ;
pl = partition_plane_context ( xd , mi_row + y_idx , mi_col + x_idx , split_subsize ) ;
chosen_rate += cpi -> partition_cost [ pl ] [ PARTITION_NONE ] ;
}
pl = partition_plane_context ( xd , mi_row , mi_col , bsize ) ;
if ( chosen_rate < INT_MAX ) {
chosen_rate += cpi -> partition_cost [ pl ] [ PARTITION_SPLIT ] ;
chosen_rd = RDCOST ( x -> rdmult , x -> rddiv , chosen_rate , chosen_dist ) ;
}
}
if ( last_part_rd < chosen_rd ) {
mi_8x8 [ 0 ] . src_mi -> mbmi . sb_type = bsize ;
if ( bsize >= BLOCK_8X8 ) pc_tree -> partitioning = partition ;
chosen_rate = last_part_rate ;
chosen_dist = last_part_dist ;
chosen_rd = last_part_rd ;
}
if ( none_rd < chosen_rd ) {
if ( bsize >= BLOCK_8X8 ) pc_tree -> partitioning = PARTITION_NONE ;
chosen_rate = none_rate ;
chosen_dist = none_dist ;
}
restore_context ( cpi , mi_row , mi_col , a , l , sa , sl , bsize ) ;
if ( bsize == BLOCK_64X64 ) assert ( chosen_rate < INT_MAX && chosen_dist < INT64_MAX ) ;
if ( do_recon ) {
int output_enabled = ( bsize == BLOCK_64X64 ) ;
if ( ( cpi -> oxcf . aq_mode == COMPLEXITY_AQ ) && cm -> seg . update_map ) {
vp9_select_in_frame_q_segment ( cpi , mi_row , mi_col , output_enabled , chosen_rate ) ;
}
if ( cpi -> oxcf . aq_mode == CYCLIC_REFRESH_AQ ) vp9_cyclic_refresh_set_rate_and_dist_sb ( cpi -> cyclic_refresh , chosen_rate , chosen_dist ) ;
encode_sb ( cpi , tile , tp , mi_row , mi_col , output_enabled , bsize , pc_tree ) ;
}
* rate = chosen_rate ;
* dist = chosen_dist ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int usbdev_mmap ( struct file * file , struct vm_area_struct * vma ) {
struct usb_memory * usbm = NULL ;
struct usb_dev_state * ps = file -> private_data ;
size_t size = vma -> vm_end - vma -> vm_start ;
void * mem ;
unsigned long flags ;
dma_addr_t dma_handle ;
int ret ;
ret = usbfs_increase_memory_usage ( size + sizeof ( struct usb_memory ) ) ;
if ( ret ) goto error ;
usbm = kzalloc ( sizeof ( struct usb_memory ) , GFP_KERNEL ) ;
if ( ! usbm ) {
ret = - ENOMEM ;
goto error_decrease_mem ;
}
mem = usb_alloc_coherent ( ps -> dev , size , GFP_USER , & dma_handle ) ;
if ( ! mem ) {
ret = - ENOMEM ;
goto error_free_usbm ;
}
memset ( mem , 0 , size ) ;
usbm -> mem = mem ;
usbm -> dma_handle = dma_handle ;
usbm -> size = size ;
usbm -> ps = ps ;
usbm -> vm_start = vma -> vm_start ;
usbm -> vma_use_count = 1 ;
INIT_LIST_HEAD ( & usbm -> memlist ) ;
if ( remap_pfn_range ( vma , vma -> vm_start , virt_to_phys ( usbm -> mem ) >> PAGE_SHIFT , size , vma -> vm_page_prot ) < 0 ) {
dec_usb_memory_use_count ( usbm , & usbm -> vma_use_count ) ;
return - EAGAIN ;
}
vma -> vm_flags |= VM_IO ;
vma -> vm_flags |= ( VM_DONTEXPAND | VM_DONTDUMP ) ;
vma -> vm_ops = & usbdev_vm_ops ;
vma -> vm_private_data = usbm ;
spin_lock_irqsave ( & ps -> lock , flags ) ;
list_add_tail ( & usbm -> memlist , & ps -> memory_list ) ;
spin_unlock_irqrestore ( & ps -> lock , flags ) ;
return 0 ;
error_free_usbm : kfree ( usbm ) ;
error_decrease_mem : usbfs_decrease_memory_usage ( size + sizeof ( struct usb_memory ) ) ;
error : return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int evbuffer_expand ( struct evbuffer * buf , size_t datlen ) {
size_t need = buf -> misalign + buf -> off + datlen ;
if ( buf -> totallen >= need ) return ( 0 ) ;
if ( buf -> misalign >= datlen ) {
evbuffer_align ( buf ) ;
}
else {
void * newbuf ;
size_t length = buf -> totallen ;
if ( length < 256 ) length = 256 ;
while ( length < need ) length <<= 1 ;
if ( buf -> orig_buffer != buf -> buffer ) evbuffer_align ( buf ) ;
if ( ( newbuf = realloc ( buf -> buffer , length ) ) == NULL ) return ( - 1 ) ;
buf -> orig_buffer = buf -> buffer = newbuf ;
buf -> totallen = length ;
}
return ( 0 ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void kvm_unpoison_all ( void * param ) {
HWPoisonPage * page , * next_page ;
QLIST_FOREACH_SAFE ( page , & hwpoison_page_list , list , next_page ) {
QLIST_REMOVE ( page , list ) ;
qemu_ram_remap ( page -> ram_addr , TARGET_PAGE_SIZE ) ;
g_free ( page ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
ssize_t TSFetchReadData ( TSFetchSM fetch_sm , void * buf , size_t len ) {
sdk_assert ( sdk_sanity_check_fetch_sm ( fetch_sm ) == TS_SUCCESS ) ;
return ( ( FetchSM * ) fetch_sm ) -> ext_read_data ( ( char * ) buf , len ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ff_print_debug_info ( MpegEncContext * s , Picture * p ) {
AVFrame * pict ;
if ( s -> avctx -> hwaccel || ! p || ! p -> mb_type ) return ;
pict = & p -> f ;
if ( s -> avctx -> debug & ( FF_DEBUG_SKIP | FF_DEBUG_QP | FF_DEBUG_MB_TYPE ) ) {
int x , y ;
av_log ( s -> avctx , AV_LOG_DEBUG , "New frame, type: " ) ;
switch ( pict -> pict_type ) {
case AV_PICTURE_TYPE_I : av_log ( s -> avctx , AV_LOG_DEBUG , "I\n" ) ;
break ;
case AV_PICTURE_TYPE_P : av_log ( s -> avctx , AV_LOG_DEBUG , "P\n" ) ;
break ;
case AV_PICTURE_TYPE_B : av_log ( s -> avctx , AV_LOG_DEBUG , "B\n" ) ;
break ;
case AV_PICTURE_TYPE_S : av_log ( s -> avctx , AV_LOG_DEBUG , "S\n" ) ;
break ;
case AV_PICTURE_TYPE_SI : av_log ( s -> avctx , AV_LOG_DEBUG , "SI\n" ) ;
break ;
case AV_PICTURE_TYPE_SP : av_log ( s -> avctx , AV_LOG_DEBUG , "SP\n" ) ;
break ;
}
for ( y = 0 ;
y < s -> mb_height ;
y ++ ) {
for ( x = 0 ;
x < s -> mb_width ;
x ++ ) {
if ( s -> avctx -> debug & FF_DEBUG_SKIP ) {
int count = s -> mbskip_table [ x + y * s -> mb_stride ] ;
if ( count > 9 ) count = 9 ;
av_log ( s -> avctx , AV_LOG_DEBUG , "%1d" , count ) ;
}
if ( s -> avctx -> debug & FF_DEBUG_QP ) {
av_log ( s -> avctx , AV_LOG_DEBUG , "%2d" , p -> qscale_table [ x + y * s -> mb_stride ] ) ;
}
if ( s -> avctx -> debug & FF_DEBUG_MB_TYPE ) {
int mb_type = p -> mb_type [ x + y * s -> mb_stride ] ;
if ( IS_PCM ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "P" ) ;
else if ( IS_INTRA ( mb_type ) && IS_ACPRED ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "A" ) ;
else if ( IS_INTRA4x4 ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "i" ) ;
else if ( IS_INTRA16x16 ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "I" ) ;
else if ( IS_DIRECT ( mb_type ) && IS_SKIP ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "d" ) ;
else if ( IS_DIRECT ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "D" ) ;
else if ( IS_GMC ( mb_type ) && IS_SKIP ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "g" ) ;
else if ( IS_GMC ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "G" ) ;
else if ( IS_SKIP ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "S" ) ;
else if ( ! USES_LIST ( mb_type , 1 ) ) av_log ( s -> avctx , AV_LOG_DEBUG , ">" ) ;
else if ( ! USES_LIST ( mb_type , 0 ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "<" ) ;
else {
assert ( USES_LIST ( mb_type , 0 ) && USES_LIST ( mb_type , 1 ) ) ;
av_log ( s -> avctx , AV_LOG_DEBUG , "X" ) ;
}
if ( IS_8X8 ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "+" ) ;
else if ( IS_16X8 ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "-" ) ;
else if ( IS_8X16 ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "|" ) ;
else if ( IS_INTRA ( mb_type ) || IS_16X16 ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , " " ) ;
else av_log ( s -> avctx , AV_LOG_DEBUG , "?" ) ;
if ( IS_INTERLACED ( mb_type ) ) av_log ( s -> avctx , AV_LOG_DEBUG , "=" ) ;
else av_log ( s -> avctx , AV_LOG_DEBUG , " " ) ;
}
}
av_log ( s -> avctx , AV_LOG_DEBUG , "\n" ) ;
}
}
if ( ( s -> avctx -> debug & ( FF_DEBUG_VIS_QP | FF_DEBUG_VIS_MB_TYPE ) ) || ( s -> avctx -> debug_mv ) ) {
const int shift = 1 + s -> quarter_sample ;
int mb_y ;
uint8_t * ptr ;
int i ;
int h_chroma_shift , v_chroma_shift , block_height ;
const int width = s -> avctx -> width ;
const int height = s -> avctx -> height ;
const int mv_sample_log2 = 4 - pict -> motion_subsample_log2 ;
const int mv_stride = ( s -> mb_width << mv_sample_log2 ) + ( s -> codec_id == AV_CODEC_ID_H264 ? 0 : 1 ) ;
s -> low_delay = 0 ;
av_pix_fmt_get_chroma_sub_sample ( s -> avctx -> pix_fmt , & h_chroma_shift , & v_chroma_shift ) ;
for ( i = 0 ;
i < 3 ;
i ++ ) {
memcpy ( s -> visualization_buffer [ i ] , pict -> data [ i ] , ( i == 0 ) ? pict -> linesize [ i ] * height : pict -> linesize [ i ] * height >> v_chroma_shift ) ;
pict -> data [ i ] = s -> visualization_buffer [ i ] ;
}
ptr = pict -> data [ 0 ] ;
block_height = 16 >> v_chroma_shift ;
for ( mb_y = 0 ;
mb_y < s -> mb_height ;
mb_y ++ ) {
int mb_x ;
for ( mb_x = 0 ;
mb_x < s -> mb_width ;
mb_x ++ ) {
const int mb_index = mb_x + mb_y * s -> mb_stride ;
if ( ( s -> avctx -> debug_mv ) && p -> motion_val ) {
int type ;
for ( type = 0 ;
type < 3 ;
type ++ ) {
int direction = 0 ;
switch ( type ) {
case 0 : if ( ( ! ( s -> avctx -> debug_mv & FF_DEBUG_VIS_MV_P_FOR ) ) || ( pict -> pict_type != AV_PICTURE_TYPE_P ) ) continue ;
direction = 0 ;
break ;
case 1 : if ( ( ! ( s -> avctx -> debug_mv & FF_DEBUG_VIS_MV_B_FOR ) ) || ( pict -> pict_type != AV_PICTURE_TYPE_B ) ) continue ;
direction = 0 ;
break ;
case 2 : if ( ( ! ( s -> avctx -> debug_mv & FF_DEBUG_VIS_MV_B_BACK ) ) || ( pict -> pict_type != AV_PICTURE_TYPE_B ) ) continue ;
direction = 1 ;
break ;
}
if ( ! USES_LIST ( p -> mb_type [ mb_index ] , direction ) ) continue ;
if ( IS_8X8 ( p -> mb_type [ mb_index ] ) ) {
int i ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
int sx = mb_x * 16 + 4 + 8 * ( i & 1 ) ;
int sy = mb_y * 16 + 4 + 8 * ( i >> 1 ) ;
int xy = ( mb_x * 2 + ( i & 1 ) + ( mb_y * 2 + ( i >> 1 ) ) * mv_stride ) << ( mv_sample_log2 - 1 ) ;
int mx = ( p -> motion_val [ direction ] [ xy ] [ 0 ] >> shift ) + sx ;
int my = ( p -> motion_val [ direction ] [ xy ] [ 1 ] >> shift ) + sy ;
draw_arrow ( ptr , sx , sy , mx , my , width , height , s -> linesize , 100 ) ;
}
}
else if ( IS_16X8 ( p -> mb_type [ mb_index ] ) ) {
int i ;
for ( i = 0 ;
i < 2 ;
i ++ ) {
int sx = mb_x * 16 + 8 ;
int sy = mb_y * 16 + 4 + 8 * i ;
int xy = ( mb_x * 2 + ( mb_y * 2 + i ) * mv_stride ) << ( mv_sample_log2 - 1 ) ;
int mx = ( p -> motion_val [ direction ] [ xy ] [ 0 ] >> shift ) ;
int my = ( p -> motion_val [ direction ] [ xy ] [ 1 ] >> shift ) ;
if ( IS_INTERLACED ( p -> mb_type [ mb_index ] ) ) my *= 2 ;
draw_arrow ( ptr , sx , sy , mx + sx , my + sy , width , height , s -> linesize , 100 ) ;
}
}
else if ( IS_8X16 ( p -> mb_type [ mb_index ] ) ) {
int i ;
for ( i = 0 ;
i < 2 ;
i ++ ) {
int sx = mb_x * 16 + 4 + 8 * i ;
int sy = mb_y * 16 + 8 ;
int xy = ( mb_x * 2 + i + mb_y * 2 * mv_stride ) << ( mv_sample_log2 - 1 ) ;
int mx = p -> motion_val [ direction ] [ xy ] [ 0 ] >> shift ;
int my = p -> motion_val [ direction ] [ xy ] [ 1 ] >> shift ;
if ( IS_INTERLACED ( p -> mb_type [ mb_index ] ) ) my *= 2 ;
draw_arrow ( ptr , sx , sy , mx + sx , my + sy , width , height , s -> linesize , 100 ) ;
}
}
else {
int sx = mb_x * 16 + 8 ;
int sy = mb_y * 16 + 8 ;
int xy = ( mb_x + mb_y * mv_stride ) << mv_sample_log2 ;
int mx = p -> motion_val [ direction ] [ xy ] [ 0 ] >> shift + sx ;
int my = p -> motion_val [ direction ] [ xy ] [ 1 ] >> shift + sy ;
draw_arrow ( ptr , sx , sy , mx , my , width , height , s -> linesize , 100 ) ;
}
}
}
if ( ( s -> avctx -> debug & FF_DEBUG_VIS_QP ) && p -> motion_val ) {
uint64_t c = ( p -> qscale_table [ mb_index ] * 128 / 31 ) * 0x0101010101010101ULL ;
int y ;
for ( y = 0 ;
y < block_height ;
y ++ ) {
* ( uint64_t * ) ( pict -> data [ 1 ] + 8 * mb_x + ( block_height * mb_y + y ) * pict -> linesize [ 1 ] ) = c ;
* ( uint64_t * ) ( pict -> data [ 2 ] + 8 * mb_x + ( block_height * mb_y + y ) * pict -> linesize [ 2 ] ) = c ;
}
}
if ( ( s -> avctx -> debug & FF_DEBUG_VIS_MB_TYPE ) && p -> motion_val ) {
int mb_type = p -> mb_type [ mb_index ] ;
uint64_t u , v ;
int y ;
# define COLOR ( theta , r ) u = ( int ) ( 128 + r * cos ( theta * 3.141592 / 180 ) ) ;
v = ( int ) ( 128 + r * sin ( theta * 3.141592 / 180 ) ) ;
u = v = 128 ;
if ( IS_PCM ( mb_type ) ) {
COLOR ( 120 , 48 ) }
else if ( ( IS_INTRA ( mb_type ) && IS_ACPRED ( mb_type ) ) || IS_INTRA16x16 ( mb_type ) ) {
COLOR ( 30 , 48 ) }
else if ( IS_INTRA4x4 ( mb_type ) ) {
COLOR ( 90 , 48 ) }
else if ( IS_DIRECT ( mb_type ) && IS_SKIP ( mb_type ) ) {
}
else if ( IS_DIRECT ( mb_type ) ) {
COLOR ( 150 , 48 ) }
else if ( IS_GMC ( mb_type ) && IS_SKIP ( mb_type ) ) {
COLOR ( 170 , 48 ) }
else if ( IS_GMC ( mb_type ) ) {
COLOR ( 190 , 48 ) }
else if ( IS_SKIP ( mb_type ) ) {
}
else if ( ! USES_LIST ( mb_type , 1 ) ) {
COLOR ( 240 , 48 ) }
else if ( ! USES_LIST ( mb_type , 0 ) ) {
COLOR ( 0 , 48 ) }
else {
assert ( USES_LIST ( mb_type , 0 ) && USES_LIST ( mb_type , 1 ) ) ;
COLOR ( 300 , 48 ) }
u *= 0x0101010101010101ULL ;
v *= 0x0101010101010101ULL ;
for ( y = 0 ;
y < block_height ;
y ++ ) {
* ( uint64_t * ) ( pict -> data [ 1 ] + 8 * mb_x + ( block_height * mb_y + y ) * pict -> linesize [ 1 ] ) = u ;
* ( uint64_t * ) ( pict -> data [ 2 ] + 8 * mb_x + ( block_height * mb_y + y ) * pict -> linesize [ 2 ] ) = v ;
}
if ( IS_8X8 ( mb_type ) || IS_16X8 ( mb_type ) ) {
* ( uint64_t * ) ( pict -> data [ 0 ] + 16 * mb_x + 0 + ( 16 * mb_y + 8 ) * pict -> linesize [ 0 ] ) ^= 0x8080808080808080ULL ;
* ( uint64_t * ) ( pict -> data [ 0 ] + 16 * mb_x + 8 + ( 16 * mb_y + 8 ) * pict -> linesize [ 0 ] ) ^= 0x8080808080808080ULL ;
}
if ( IS_8X8 ( mb_type ) || IS_8X16 ( mb_type ) ) {
for ( y = 0 ;
y < 16 ;
y ++ ) pict -> data [ 0 ] [ 16 * mb_x + 8 + ( 16 * mb_y + y ) * pict -> linesize [ 0 ] ] ^= 0x80 ;
}
if ( IS_8X8 ( mb_type ) && mv_sample_log2 >= 2 ) {
int dm = 1 << ( mv_sample_log2 - 2 ) ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
int sx = mb_x * 16 + 8 * ( i & 1 ) ;
int sy = mb_y * 16 + 8 * ( i >> 1 ) ;
int xy = ( mb_x * 2 + ( i & 1 ) + ( mb_y * 2 + ( i >> 1 ) ) * mv_stride ) << ( mv_sample_log2 - 1 ) ;
int32_t * mv = ( int32_t * ) & p -> motion_val [ 0 ] [ xy ] ;
if ( mv [ 0 ] != mv [ dm ] || mv [ dm * mv_stride ] != mv [ dm * ( mv_stride + 1 ) ] ) for ( y = 0 ;
y < 8 ;
y ++ ) pict -> data [ 0 ] [ sx + 4 + ( sy + y ) * pict -> linesize [ 0 ] ] ^= 0x80 ;
if ( mv [ 0 ] != mv [ dm * mv_stride ] || mv [ dm ] != mv [ dm * ( mv_stride + 1 ) ] ) * ( uint64_t * ) ( pict -> data [ 0 ] + sx + ( sy + 4 ) * pict -> linesize [ 0 ] ) ^= 0x8080808080808080ULL ;
}
}
if ( IS_INTERLACED ( mb_type ) && s -> codec_id == AV_CODEC_ID_H264 ) {
}
}
s -> mbskip_table [ mb_index ] = 0 ;
}
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * pkt ) {
BinkContext * const c = avctx -> priv_data ;
GetBitContext gb ;
int plane , plane_idx , ret ;
int bits_count = pkt -> size << 3 ;
if ( c -> version > 'b' ) {
if ( c -> pic -> data [ 0 ] ) avctx -> release_buffer ( avctx , c -> pic ) ;
if ( ( ret = ff_get_buffer ( avctx , c -> pic ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
}
else {
if ( ( ret = avctx -> reget_buffer ( avctx , c -> pic ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ;
return ret ;
}
}
init_get_bits ( & gb , pkt -> data , bits_count ) ;
if ( c -> has_alpha ) {
if ( c -> version >= 'i' ) skip_bits_long ( & gb , 32 ) ;
if ( ( ret = bink_decode_plane ( c , & gb , 3 , 0 ) ) < 0 ) return ret ;
}
if ( c -> version >= 'i' ) skip_bits_long ( & gb , 32 ) ;
for ( plane = 0 ;
plane < 3 ;
plane ++ ) {
plane_idx = ( ! plane || ! c -> swap_planes ) ? plane : ( plane ^ 3 ) ;
if ( c -> version > 'b' ) {
if ( ( ret = bink_decode_plane ( c , & gb , plane_idx , ! ! plane ) ) < 0 ) return ret ;
}
else {
if ( ( ret = binkb_decode_plane ( c , & gb , plane_idx , ! avctx -> frame_number , ! ! plane ) ) < 0 ) return ret ;
}
if ( get_bits_count ( & gb ) >= bits_count ) break ;
}
emms_c ( ) ;
* got_frame = 1 ;
* ( AVFrame * ) data = * c -> pic ;
if ( c -> version > 'b' ) FFSWAP ( AVFrame * , c -> pic , c -> last ) ;
return pkt -> size ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void SSL3_RECORD_clear ( SSL3_RECORD * r , unsigned int num_recs ) {
unsigned char * comp ;
unsigned int i ;
for ( i = 0 ;
i < num_recs ;
i ++ ) {
comp = r [ i ] . comp ;
memset ( & r [ i ] , 0 , sizeof ( * r ) ) ;
r [ i ] . comp = comp ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( HistoryQuickProviderTest , TypedCountMatches ) {
std : : vector < std : : string > expected_urls ;
expected_urls . push_back ( "http://typeredest.com/y/a" ) ;
expected_urls . push_back ( "http://typeredest.com/y/b" ) ;
expected_urls . push_back ( "http://typeredest.com/x/c" ) ;
RunTest ( ASCIIToUTF16 ( "typeredest" ) , false , expected_urls , true , ASCIIToUTF16 ( "typeredest.com/y/a" ) , ASCIIToUTF16 ( ".com/y/a" ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int qemuMonitorTextGetBlockInfo ( qemuMonitorPtr mon , const char * devname , struct qemuDomainDiskInfo * info ) {
char * reply = NULL ;
int ret = - 1 ;
char * dummy ;
const char * p , * eol ;
int devnamelen = strlen ( devname ) ;
int tmp ;
if ( qemuMonitorHMPCommand ( mon , "info block" , & reply ) < 0 ) {
qemuReportError ( VIR_ERR_OPERATION_FAILED , "%s" , _ ( "info block command failed" ) ) ;
goto cleanup ;
}
if ( strstr ( reply , "\ninfo " ) ) {
qemuReportError ( VIR_ERR_OPERATION_INVALID , "%s" , _ ( "info block not supported by this qemu" ) ) ;
goto cleanup ;
}
p = reply ;
while ( * p ) {
if ( STRPREFIX ( p , QEMU_DRIVE_HOST_PREFIX ) ) p += strlen ( QEMU_DRIVE_HOST_PREFIX ) ;
if ( STREQLEN ( p , devname , devnamelen ) && p [ devnamelen ] == ':' && p [ devnamelen + 1 ] == ' ' ) {
eol = strchr ( p , '\n' ) ;
if ( ! eol ) eol = p + strlen ( p ) ;
p += devnamelen + 2 ;
while ( * p ) {
if ( STRPREFIX ( p , "removable=" ) ) {
p += strlen ( "removable=" ) ;
if ( virStrToLong_i ( p , & dummy , 10 , & tmp ) == - 1 ) VIR_DEBUG ( "error reading removable: %s" , p ) ;
else info -> removable = ( tmp != 0 ) ;
}
else if ( STRPREFIX ( p , "locked=" ) ) {
p += strlen ( "locked=" ) ;
if ( virStrToLong_i ( p , & dummy , 10 , & tmp ) == - 1 ) VIR_DEBUG ( "error reading locked: %s" , p ) ;
else info -> locked = ( tmp != 0 ) ;
}
else if ( STRPREFIX ( p , "tray_open=" ) ) {
p += strlen ( "tray_open=" ) ;
if ( virStrToLong_i ( p , & dummy , 10 , & tmp ) == - 1 ) VIR_DEBUG ( "error reading tray_open: %s" , p ) ;
else info -> tray_open = ( tmp != 0 ) ;
}
else {
}
p = strchr ( p , ' ' ) ;
if ( ! p || p >= eol ) break ;
p ++ ;
}
ret = 0 ;
goto cleanup ;
}
p = strchr ( p , '\n' ) ;
if ( ! p ) break ;
p ++ ;
}
qemuReportError ( VIR_ERR_INVALID_ARG , _ ( "no info for device '%s'" ) , devname ) ;
cleanup : VIR_FREE ( reply ) ;
return ret ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gint dissect_vdp_cp_scms_t ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data _U_ ) {
proto_item * main_item ;
proto_tree * main_tree ;
gint offset = 0 ;
main_item = proto_tree_add_item ( tree , proto_btvdp_cph_scms_t , tvb , offset , 1 , ENC_NA ) ;
main_tree = proto_item_add_subtree ( main_item , ett_btvdp_cph_scms_t ) ;
proto_tree_add_item ( main_tree , hf_btvdp_reserved , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( main_tree , hf_btvdp_cp_bit , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( main_tree , hf_btvdp_l_bit , tvb , offset , 1 , ENC_NA ) ;
offset += 1 ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int isoent_cmp_node ( const struct archive_rb_node * n1 , const struct archive_rb_node * n2 ) {
const struct isoent * e1 = ( const struct isoent * ) n1 ;
const struct isoent * e2 = ( const struct isoent * ) n2 ;
return ( strcmp ( e1 -> file -> basename . s , e2 -> file -> basename . s ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( DownloadNotificationTest , CancelDownload ) {
CreateDownload ( ) ;
display_service_ -> SimulateClick ( NotificationHandler : : Type : : TRANSIENT , notification_id ( ) , 1 , base : : nullopt ) ;
EXPECT_FALSE ( notification ( ) ) ;
EXPECT_EQ ( 0u , GetDownloadNotifications ( ) . size ( ) ) ;
std : : vector < download : : DownloadItem * > downloads ;
GetDownloadManager ( browser ( ) ) -> GetAllDownloads ( & downloads ) ;
ASSERT_EQ ( 1u , downloads . size ( ) ) ;
EXPECT_EQ ( download : : DownloadItem : : CANCELLED , downloads [ 0 ] -> GetState ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool tsc_khz_needed ( void * opaque ) {
X86CPU * cpu = opaque ;
CPUX86State * env = & cpu -> env ;
MachineClass * mc = MACHINE_GET_CLASS ( qdev_get_machine ( ) ) ;
PCMachineClass * pcmc = PC_MACHINE_CLASS ( mc ) ;
return env -> tsc_khz && pcmc -> save_tsc_khz ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int main ( int argc , char * * argv ) {
if ( argc > 1 && ! strcmp ( argv [ 1 ] , "--verbose" ) ) verbose = 1 ;
else if ( argc > 1 && ! strcmp ( argv [ 1 ] , "--debug" ) ) verbose = debug = 1 ;
if ( ! gcry_check_version ( GCRYPT_VERSION ) ) die ( "version mismatch\n" ) ;
gcry_control ( GCRYCTL_DISABLE_SECMEM , 0 ) ;
gcry_control ( GCRYCTL_ENABLE_QUICK_RANDOM , 0 ) ;
if ( debug ) gcry_control ( GCRYCTL_SET_DEBUG_FLAGS , 1u , 0 ) ;
gcry_control ( GCRYCTL_INITIALIZATION_FINISHED , 0 ) ;
set_get_point ( ) ;
context_alloc ( ) ;
context_param ( ) ;
basic_ec_math ( ) ;
basic_ec_math_simplified ( ) ;
show ( "All tests completed. Errors: %d\n" , error_count ) ;
return error_count ? 1 : 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static struct subre * parse ( struct vars * v , int stopper , int type , struct state * init , struct state * final ) {
struct state * left ;
struct state * right ;
struct subre * branches ;
struct subre * branch ;
struct subre * t ;
int firstbranch ;
assert ( stopper == ')' || stopper == EOS ) ;
branches = subre ( v , '|' , LONGER , init , final ) ;
NOERRN ( ) ;
branch = branches ;
firstbranch = 1 ;
do {
if ( ! firstbranch ) {
branch -> right = subre ( v , '|' , LONGER , init , final ) ;
NOERRN ( ) ;
branch = branch -> right ;
}
firstbranch = 0 ;
left = newstate ( v -> nfa ) ;
right = newstate ( v -> nfa ) ;
NOERRN ( ) ;
EMPTYARC ( init , left ) ;
EMPTYARC ( right , final ) ;
NOERRN ( ) ;
branch -> left = parsebranch ( v , stopper , type , left , right , 0 ) ;
NOERRN ( ) ;
branch -> flags |= UP ( branch -> flags | branch -> left -> flags ) ;
if ( ( branch -> flags & ~ branches -> flags ) != 0 ) for ( t = branches ;
t != branch ;
t = t -> right ) t -> flags |= branch -> flags ;
}
while ( EAT ( '|' ) ) ;
assert ( SEE ( stopper ) || SEE ( EOS ) ) ;
if ( ! SEE ( stopper ) ) {
assert ( stopper == ')' && SEE ( EOS ) ) ;
ERR ( REG_EPAREN ) ;
}
if ( branch == branches ) {
assert ( branch -> right == NULL ) ;
t = branch -> left ;
branch -> left = NULL ;
freesubre ( v , branches ) ;
branches = t ;
}
else if ( ! MESSY ( branches -> flags ) ) {
freesubre ( v , branches -> left ) ;
branches -> left = NULL ;
freesubre ( v , branches -> right ) ;
branches -> right = NULL ;
branches -> op = '=' ;
}
return branches ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_s_supervisor_exception_detail_warning ( packet_info * pinfo , proto_tree * tree , proto_item * item , tvbuff_t * tvb , int offset , int total_len ) {
proto_item * pi ;
proto_tree * item_tree ;
int total_size = 0 , size ;
item_tree = proto_tree_add_subtree ( tree , tvb , offset , 1 , ett_exception_detail_warning_common , & pi , "Common Exception Detail" ) ;
size = dissect_s_supervisor_exception_detail ( item_tree , pi , tvb , offset , hf_cip_ssupervisor_exception_detail_warning_ced_size , hf_cip_ssupervisor_exception_detail_warning_ced_detail ) ;
if ( size == 0 ) {
expert_add_info ( pinfo , item , & ei_mal_ssupervisor_detail_warning_ced ) ;
return total_len ;
}
total_size += size ;
item_tree = proto_tree_add_subtree ( tree , tvb , offset , 1 , ett_exception_detail_warning_device , & pi , "Device Exception Detail" ) ;
size = dissect_s_supervisor_exception_detail ( item_tree , pi , tvb , offset , hf_cip_ssupervisor_exception_detail_warning_ded_size , hf_cip_ssupervisor_exception_detail_warning_ded_detail ) ;
if ( size == 0 ) {
expert_add_info ( pinfo , item , & ei_mal_ssupervisor_detail_warning_ded ) ;
return total_len ;
}
total_size += size ;
item_tree = proto_tree_add_subtree ( tree , tvb , offset , 1 , ett_exception_detail_warning_manufacturer , & pi , "Manufacturer Exception Detail" ) ;
size = dissect_s_supervisor_exception_detail ( item_tree , pi , tvb , offset , hf_cip_ssupervisor_exception_detail_warning_med_size , hf_cip_ssupervisor_exception_detail_warning_med_detail ) ;
if ( size == 0 ) {
expert_add_info ( pinfo , item , & ei_mal_ssupervisor_detail_warning_med ) ;
return total_len ;
}
total_size += size ;
return total_size ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static size_t fd_boot_image_size ( int media_type ) {
switch ( media_type ) {
case BOOT_MEDIA_1_2M_DISKETTE : return ( FD_1_2M_SIZE ) ;
case BOOT_MEDIA_1_44M_DISKETTE : return ( FD_1_44M_SIZE ) ;
case BOOT_MEDIA_2_88M_DISKETTE : return ( FD_2_88M_SIZE ) ;
default : return ( 0 ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ptvcursor_pop_subtree ( ptvcursor_t * ptvc ) {
subtree_lvl * subtree ;
if ( ptvc -> pushed_tree_index <= 0 ) return ;
ptvc -> pushed_tree_index -- ;
subtree = ptvc -> pushed_tree + ptvc -> pushed_tree_index ;
if ( subtree -> it != NULL ) proto_item_set_len ( subtree -> it , ptvcursor_current_offset ( ptvc ) - subtree -> cursor_offset ) ;
ptvc -> tree = subtree -> tree ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void implicit_weight_table ( H264Context * h , int field ) {
int ref0 , ref1 , i , cur_poc , ref_start , ref_count0 , ref_count1 ;
for ( i = 0 ;
i < 2 ;
i ++ ) {
h -> luma_weight_flag [ i ] = 0 ;
h -> chroma_weight_flag [ i ] = 0 ;
}
if ( field < 0 ) {
if ( h -> picture_structure == PICT_FRAME ) {
cur_poc = h -> cur_pic_ptr -> poc ;
}
else {
cur_poc = h -> cur_pic_ptr -> field_poc [ h -> picture_structure - 1 ] ;
}
if ( h -> ref_count [ 0 ] == 1 && h -> ref_count [ 1 ] == 1 && ! FRAME_MBAFF ( h ) && h -> ref_list [ 0 ] [ 0 ] . poc + h -> ref_list [ 1 ] [ 0 ] . poc == 2 * cur_poc ) {
h -> use_weight = 0 ;
h -> use_weight_chroma = 0 ;
return ;
}
ref_start = 0 ;
ref_count0 = h -> ref_count [ 0 ] ;
ref_count1 = h -> ref_count [ 1 ] ;
}
else {
cur_poc = h -> cur_pic_ptr -> field_poc [ field ] ;
ref_start = 16 ;
ref_count0 = 16 + 2 * h -> ref_count [ 0 ] ;
ref_count1 = 16 + 2 * h -> ref_count [ 1 ] ;
}
h -> use_weight = 2 ;
h -> use_weight_chroma = 2 ;
h -> luma_log2_weight_denom = 5 ;
h -> chroma_log2_weight_denom = 5 ;
for ( ref0 = ref_start ;
ref0 < ref_count0 ;
ref0 ++ ) {
int poc0 = h -> ref_list [ 0 ] [ ref0 ] . poc ;
for ( ref1 = ref_start ;
ref1 < ref_count1 ;
ref1 ++ ) {
int w = 32 ;
if ( ! h -> ref_list [ 0 ] [ ref0 ] . long_ref && ! h -> ref_list [ 1 ] [ ref1 ] . long_ref ) {
int poc1 = h -> ref_list [ 1 ] [ ref1 ] . poc ;
int td = av_clip ( poc1 - poc0 , - 128 , 127 ) ;
if ( td ) {
int tb = av_clip ( cur_poc - poc0 , - 128 , 127 ) ;
int tx = ( 16384 + ( FFABS ( td ) >> 1 ) ) / td ;
int dist_scale_factor = ( tb * tx + 32 ) >> 8 ;
if ( dist_scale_factor >= - 64 && dist_scale_factor <= 128 ) w = 64 - dist_scale_factor ;
}
}
if ( field < 0 ) {
h -> implicit_weight [ ref0 ] [ ref1 ] [ 0 ] = h -> implicit_weight [ ref0 ] [ ref1 ] [ 1 ] = w ;
}
else {
h -> implicit_weight [ ref0 ] [ ref1 ] [ field ] = w ;
}
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int do_done ( struct st_command * command ) {
if ( cur_block == block_stack ) {
if ( * command -> query != '}
' ) die ( "Stray 'end' command - end of block before beginning" ) ;
die ( "Stray '}
' - end of block before beginning" ) ;
}
if ( cur_block -> ok && cur_block -> cmd == cmd_while ) {
cur_block -- ;
parser . current_line = cur_block -> line ;
}
else {
if ( * cur_block -> delim ) {
strcpy ( delimiter , cur_block -> delim ) ;
delimiter_length = strlen ( delimiter ) ;
}
cur_block -- ;
parser . current_line ++ ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void putfixed ( FILE * file , real dval ) {
int val ;
int mant ;
val = floor ( dval ) ;
mant = floor ( 65536. * ( dval - val ) ) ;
val = ( val << 16 ) | mant ;
putlong ( file , val ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int PEM_write_bio_ ## name ( BIO * bp , type * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
# define DECLARE_PEM_write ( name , type ) DECLARE_PEM_write_bio ( name , type ) DECLARE_PEM_write_fp ( name , type ) # define DECLARE_PEM_write_const ( name , type ) DECLARE_PEM_write_bio_const ( name , type ) DECLARE_PEM_write_fp_const ( name , type ) # define DECLARE_PEM_write_cb ( name , type ) DECLARE_PEM_write_cb_bio ( name , type ) DECLARE_PEM_write_cb_fp ( name , type ) # define DECLARE_PEM_read ( name , type ) DECLARE_PEM_read_bio ( name , type ) DECLARE_PEM_read_fp ( name , type ) # define DECLARE_PEM_rw ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write ( name , type ) # define DECLARE_PEM_rw_const ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write_const ( name , type ) # define DECLARE_PEM_rw_cb ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write_cb ( name , type ) typedef int pem_password_cb ( char * buf , int size , int rwflag , void * userdata ) ;
int PEM_get_EVP_CIPHER_INFO ( char * header , EVP_CIPHER_INFO * cipher ) ;
int PEM_do_header ( EVP_CIPHER_INFO * cipher , unsigned char * data , long * len , pem_password_cb * callback , void * u ) ;
int PEM_read_bio ( BIO * bp , char * * name , char * * header , unsigned char * * data , long * len ) ;
# define PEM_FLAG_SECURE 0x1 # define PEM_FLAG_EAY_COMPATIBLE 0x2 # define PEM_FLAG_ONLY_B64 0x4 int PEM_read_bio_ex ( BIO * bp , char * * name , char * * header , unsigned char * * data , long * len , unsigned int flags ) ;
int PEM_bytes_read_bio_secmem ( unsigned char * * pdata , long * plen , char * * pnm , const char * name , BIO * bp , pem_password_cb * cb , void * u ) ;
int PEM_write_bio ( BIO * bp , const char * name , const char * hdr , const unsigned char * data , long len ) ;
int PEM_bytes_read_bio ( unsigned char * * pdata , long * plen , char * * pnm , const char * name , BIO * bp , pem_password_cb * cb , void * u ) ;
void * PEM_ASN1_read_bio ( d2i_of_void * d2i , const char * name , BIO * bp , void * * x , pem_password_cb * cb , void * u ) ;
int PEM_ASN1_write_bio ( i2d_of_void * i2d , const char * name , BIO * bp , void * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
STACK_OF ( X509_INFO ) * PEM_X509_INFO_read_bio ( BIO * bp , STACK_OF ( X509_INFO ) * sk , pem_password_cb * cb , void * u ) ;
int PEM_X509_INFO_write_bio ( BIO * bp , X509_INFO * xi , EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cd , void * u ) ;
# ifndef OPENSSL_NO_STDIO int PEM_read ( FILE * fp , char * * name , char * * header , unsigned char * * data , long * len ) ;
int PEM_write ( FILE * fp , const char * name , const char * hdr , const unsigned char * data , long len ) ;
void * PEM_ASN1_read ( d2i_of_void * d2i , const char * name , FILE * fp , void * * x , pem_password_cb * cb , void * u ) ;
int PEM_ASN1_write ( i2d_of_void * i2d , const char * name , FILE * fp , void * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * callback , void * u ) ;
STACK_OF ( X509_INFO ) * PEM_X509_INFO_read ( FILE * fp , STACK_OF ( X509_INFO ) * sk , pem_password_cb * cb , void * u ) ;
# endif int PEM_SignInit ( EVP_MD_CTX * ctx , EVP_MD * type ) ;
int PEM_SignUpdate ( EVP_MD_CTX * ctx , unsigned char * d , unsigned int cnt ) ;
int PEM_SignFinal ( EVP_MD_CTX * ctx , unsigned char * sigret , unsigned int * siglen , EVP_PKEY * pkey ) ;
int PEM_def_callback ( char * buf , int num , int rwflag , void * userdata ) ;
void PEM_proc_type ( char * buf , int type ) ;
void PEM_dek_info ( char * buf , const char * type , int len , char * str ) ;
# include < openssl / symhacks . h > DECLARE_PEM_rw ( X509 , X509 ) DECLARE_PEM_rw ( X509_AUX , X509 ) DECLARE_PEM_rw ( X509_REQ , X509_REQ ) DECLARE_PEM_write ( X509_REQ_NEW , X509_REQ ) DECLARE_PEM_rw ( X509_CRL , X509_CRL ) DECLARE_PEM_rw ( PKCS7 , PKCS7 ) DECLARE_PEM_rw ( NETSCAPE_CERT_SEQUENCE , NETSCAPE_CERT_SEQUENCE ) DECLARE_PEM_rw ( PKCS8 , X509_SIG ) DECLARE_PEM_rw ( PKCS8_PRIV_KEY_INFO , PKCS8_PRIV_KEY_INFO ) # ifndef OPENSSL_NO_RSA DECLARE_PEM_rw_cb ( RSAPrivateKey , RSA ) DECLARE_PEM_rw_const ( RSAPublicKey , RSA ) DECLARE_PEM_rw ( RSA_PUBKEY , RSA ) # endif # ifndef OPENSSL_NO_DSA DECLARE_PEM_rw_cb ( DSAPrivateKey , DSA ) DECLARE_PEM_rw ( DSA_PUBKEY , DSA ) DECLARE_PEM_rw_const ( DSAparams , DSA ) # endif # ifndef OPENSSL_NO_EC DECLARE_PEM_rw_const ( ECPKParameters , EC_GROUP ) DECLARE_PEM_rw_cb ( ECPrivateKey , EC_KEY ) DECLARE_PEM_rw ( EC_PUBKEY , EC_KEY ) # endif # ifndef OPENSSL_NO_DH DECLARE_PEM_rw_const ( DHparams , DH ) DECLARE_PEM_write_const ( DHxparams , DH ) # endif DECLARE_PEM_rw_cb ( PrivateKey , EVP_PKEY )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void reduce_dependencies ( ArchiveHandle * AH , TocEntry * te , TocEntry * ready_list ) {
int i ;
ahlog ( AH , 2 , "reducing dependencies for %d\n" , te -> dumpId ) ;
for ( i = 0 ;
i < te -> nRevDeps ;
i ++ ) {
TocEntry * otherte = AH -> tocsByDumpId [ te -> revDeps [ i ] ] ;
otherte -> depCount -- ;
if ( otherte -> depCount == 0 && otherte -> par_prev != NULL ) {
par_list_remove ( otherte ) ;
par_list_append ( ready_list , otherte ) ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static GstFlowReturn gst_asf_demux_push_complete_payloads ( GstASFDemux * demux , gboolean force ) {
AsfStream * stream ;
GstFlowReturn ret = GST_FLOW_OK ;
if ( G_UNLIKELY ( ! demux -> activated_streams ) ) {
if ( ! gst_asf_demux_check_activate_streams ( demux , force ) ) return GST_FLOW_OK ;
}
while ( ( stream = gst_asf_demux_find_stream_with_complete_payload ( demux ) ) ) {
AsfPayload * payload ;
GstClockTime timestamp = GST_CLOCK_TIME_NONE ;
GstClockTime duration = GST_CLOCK_TIME_NONE ;
if ( G_UNLIKELY ( demux -> need_newsegment && ! GST_CLOCK_TIME_IS_VALID ( demux -> segment_ts ) ) ) return GST_FLOW_OK ;
if ( GST_ASF_DEMUX_IS_REVERSE_PLAYBACK ( demux -> segment ) && stream -> is_video && stream -> payloads -> len ) {
payload = & g_array_index ( stream -> payloads , AsfPayload , stream -> kf_pos ) ;
}
else {
payload = & g_array_index ( stream -> payloads , AsfPayload , 0 ) ;
}
if ( ( G_UNLIKELY ( demux -> need_newsegment ) ) ) {
GstEvent * segment_event ;
if ( ! GST_CLOCK_TIME_IS_VALID ( demux -> in_gap ) ) demux -> in_gap = 0 ;
if ( demux -> segment . stop == GST_CLOCK_TIME_NONE && demux -> segment . duration > 0 ) {
demux -> segment . stop = demux -> segment . duration + demux -> in_gap ;
}
if ( G_LIKELY ( ! demux -> keyunit_sync && ! demux -> accurate && ( GST_CLOCK_TIME_IS_VALID ( payload -> ts ) ) ) && ! GST_ASF_DEMUX_IS_REVERSE_PLAYBACK ( demux -> segment ) ) {
GST_DEBUG ( "Adjusting newsegment start to %" GST_TIME_FORMAT , GST_TIME_ARGS ( payload -> ts ) ) ;
demux -> segment . start = payload -> ts ;
demux -> segment . time = payload -> ts ;
}
GST_DEBUG_OBJECT ( demux , "sending new-segment event %" GST_SEGMENT_FORMAT , & demux -> segment ) ;
segment_event = gst_event_new_segment ( & demux -> segment ) ;
if ( demux -> segment_seqnum ) gst_event_set_seqnum ( segment_event , demux -> segment_seqnum ) ;
gst_asf_demux_send_event_unlocked ( demux , segment_event ) ;
if ( demux -> taglist == NULL ) {
demux -> taglist = gst_tag_list_new_empty ( ) ;
gst_tag_list_set_scope ( demux -> taglist , GST_TAG_SCOPE_GLOBAL ) ;
}
gst_tag_list_add ( demux -> taglist , GST_TAG_MERGE_REPLACE , GST_TAG_CONTAINER_FORMAT , "ASF" , NULL ) ;
GST_DEBUG_OBJECT ( demux , "global tags: %" GST_PTR_FORMAT , demux -> taglist ) ;
gst_asf_demux_send_event_unlocked ( demux , gst_event_new_tag ( demux -> taglist ) ) ;
demux -> taglist = NULL ;
demux -> need_newsegment = FALSE ;
demux -> segment_seqnum = 0 ;
demux -> segment_running = TRUE ;
}
if ( G_UNLIKELY ( stream -> pending_tags ) ) {
GST_LOG_OBJECT ( stream -> pad , "%" GST_PTR_FORMAT , stream -> pending_tags ) ;
gst_pad_push_event ( stream -> pad , gst_event_new_tag ( stream -> pending_tags ) ) ;
stream -> pending_tags = NULL ;
}
if ( G_UNLIKELY ( stream -> span > 1 ) ) {
gst_asf_demux_descramble_buffer ( demux , stream , & payload -> buf ) ;
}
payload -> buf = gst_buffer_make_writable ( payload -> buf ) ;
if ( G_LIKELY ( ! payload -> keyframe ) ) {
GST_BUFFER_FLAG_SET ( payload -> buf , GST_BUFFER_FLAG_DELTA_UNIT ) ;
}
if ( G_UNLIKELY ( stream -> discont ) ) {
GST_DEBUG_OBJECT ( stream -> pad , "marking DISCONT on stream" ) ;
GST_BUFFER_FLAG_SET ( payload -> buf , GST_BUFFER_FLAG_DISCONT ) ;
stream -> discont = FALSE ;
}
if ( G_UNLIKELY ( stream -> is_video && payload -> par_x && payload -> par_y && ( payload -> par_x != stream -> par_x ) && ( payload -> par_y != stream -> par_y ) ) ) {
GST_DEBUG ( "Updating PAR (%d/%d => %d/%d)" , stream -> par_x , stream -> par_y , payload -> par_x , payload -> par_y ) ;
stream -> par_x = payload -> par_x ;
stream -> par_y = payload -> par_y ;
stream -> caps = gst_caps_make_writable ( stream -> caps ) ;
gst_caps_set_simple ( stream -> caps , "pixel-aspect-ratio" , GST_TYPE_FRACTION , stream -> par_x , stream -> par_y , NULL ) ;
gst_pad_set_caps ( stream -> pad , stream -> caps ) ;
}
if ( G_UNLIKELY ( stream -> interlaced != payload -> interlaced ) ) {
GST_DEBUG ( "Updating interlaced status (%d => %d)" , stream -> interlaced , payload -> interlaced ) ;
stream -> interlaced = payload -> interlaced ;
stream -> caps = gst_caps_make_writable ( stream -> caps ) ;
gst_caps_set_simple ( stream -> caps , "interlace-mode" , G_TYPE_BOOLEAN , ( stream -> interlaced ? "mixed" : "progressive" ) , NULL ) ;
gst_pad_set_caps ( stream -> pad , stream -> caps ) ;
}
timestamp = payload -> ts ;
if ( GST_CLOCK_TIME_IS_VALID ( timestamp ) && ! GST_ASF_DEMUX_IS_REVERSE_PLAYBACK ( demux -> segment ) ) {
timestamp += demux -> in_gap ;
if ( demux -> segment . stop != - 1 && timestamp > demux -> segment . stop ) {
GST_DEBUG_OBJECT ( stream -> pad , "Payload after segment stop %" GST_TIME_FORMAT , GST_TIME_ARGS ( demux -> segment . stop ) ) ;
ret = gst_flow_combiner_update_pad_flow ( demux -> flowcombiner , stream -> pad , GST_FLOW_EOS ) ;
gst_buffer_unref ( payload -> buf ) ;
payload -> buf = NULL ;
g_array_remove_index ( stream -> payloads , 0 ) ;
if ( G_UNLIKELY ( ret != GST_FLOW_OK ) ) break ;
continue ;
}
}
GST_BUFFER_PTS ( payload -> buf ) = timestamp ;
if ( payload -> duration == GST_CLOCK_TIME_NONE && stream -> ext_props . avg_time_per_frame != 0 ) {
duration = stream -> ext_props . avg_time_per_frame * 100 ;
}
else {
duration = payload -> duration ;
}
GST_BUFFER_DURATION ( payload -> buf ) = duration ;
GST_LOG_OBJECT ( stream -> pad , "pushing buffer, %" GST_PTR_FORMAT , payload -> buf ) ;
if ( GST_ASF_DEMUX_IS_REVERSE_PLAYBACK ( demux -> segment ) && stream -> is_video ) {
if ( stream -> reverse_kf_ready == TRUE && stream -> kf_pos == 0 ) {
GST_BUFFER_FLAG_SET ( payload -> buf , GST_BUFFER_FLAG_DISCONT ) ;
}
}
else if ( GST_ASF_DEMUX_IS_REVERSE_PLAYBACK ( demux -> segment ) ) {
GST_BUFFER_FLAG_SET ( payload -> buf , GST_BUFFER_FLAG_DISCONT ) ;
}
if ( stream -> active ) {
if ( G_UNLIKELY ( stream -> first_buffer ) ) {
if ( stream -> streamheader != NULL ) {
GST_DEBUG_OBJECT ( stream -> pad , "Pushing streamheader before first buffer" ) ;
gst_pad_push ( stream -> pad , gst_buffer_ref ( stream -> streamheader ) ) ;
}
stream -> first_buffer = FALSE ;
}
if ( GST_CLOCK_TIME_IS_VALID ( timestamp ) && timestamp > demux -> segment . position ) {
demux -> segment . position = timestamp ;
if ( GST_CLOCK_TIME_IS_VALID ( duration ) ) demux -> segment . position += timestamp ;
}
ret = gst_pad_push ( stream -> pad , payload -> buf ) ;
ret = gst_flow_combiner_update_pad_flow ( demux -> flowcombiner , stream -> pad , ret ) ;
}
else {
gst_buffer_unref ( payload -> buf ) ;
ret = GST_FLOW_OK ;
}
payload -> buf = NULL ;
if ( GST_ASF_DEMUX_IS_REVERSE_PLAYBACK ( demux -> segment ) && stream -> is_video && stream -> reverse_kf_ready ) {
g_array_remove_index ( stream -> payloads , stream -> kf_pos ) ;
stream -> kf_pos -- ;
if ( stream -> reverse_kf_ready == TRUE && stream -> kf_pos < 0 ) {
stream -> kf_pos = 0 ;
stream -> reverse_kf_ready = FALSE ;
}
}
else {
g_array_remove_index ( stream -> payloads , 0 ) ;
}
if ( G_UNLIKELY ( ret != GST_FLOW_OK ) ) break ;
}
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static char * pathToFullPath ( const char * path , const char * source ) {
int32_t length ;
int32_t newLength ;
char * fullPath ;
int32_t n ;
length = ( uint32_t ) ( uprv_strlen ( path ) + 1 ) ;
newLength = ( length + 1 + ( int32_t ) uprv_strlen ( source ) ) ;
fullPath = uprv_malloc ( newLength ) ;
if ( source != NULL ) {
uprv_strcpy ( fullPath , source ) ;
uprv_strcat ( fullPath , U_FILE_SEP_STRING ) ;
}
else {
fullPath [ 0 ] = 0 ;
}
n = ( int32_t ) uprv_strlen ( fullPath ) ;
fullPath [ n ] = 0 ;
uprv_strcat ( fullPath , path ) ;
# if ( U_FILE_ALT_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR ) # if ( U_FILE_ALT_SEP_CHAR != U_FILE_SEP_CHAR ) for ( ;
fullPath [ n ] ;
n ++ ) {
if ( fullPath [ n ] == U_FILE_ALT_SEP_CHAR ) {
fullPath [ n ] = U_FILE_SEP_CHAR ;
}
}
# endif # endif # if ( U_FILE_SEP_CHAR != U_TREE_ENTRY_SEP_CHAR ) for ( ;
fullPath [ n ] ;
n ++ ) {
if ( fullPath [ n ] == U_TREE_ENTRY_SEP_CHAR ) {
fullPath [ n ] = U_FILE_SEP_CHAR ;
}
}
# endif return fullPath ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_bug42373 ( ) {
int rc ;
MYSQL con ;
MYSQL_STMT * stmt ;
DBUG_ENTER ( "test_bug42373" ) ;
myheader ( "test_42373" ) ;
rc = mysql_query ( mysql , "DROP PROCEDURE IF EXISTS p1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE PROCEDURE p1()" " BEGIN" " SELECT 1;
" " INSERT INTO t1 VALUES (2);
" "END;
" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS t1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE t1 (a INT)" ) ;
myquery ( rc ) ;
DIE_UNLESS ( mysql_client_init ( & con ) ) ;
mysql_options ( & con , MYSQL_INIT_COMMAND , "CALL p1()" ) ;
DIE_UNLESS ( mysql_real_connect ( & con , opt_host , opt_user , opt_password , current_db , opt_port , opt_unix_socket , CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS ) ) ;
stmt = mysql_simple_prepare ( & con , "SELECT a FROM t1" ) ;
check_stmt ( stmt ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
rc = my_process_stmt_result ( stmt ) ;
DIE_UNLESS ( rc == 1 ) ;
mysql_stmt_close ( stmt ) ;
mysql_close ( & con ) ;
DIE_UNLESS ( mysql_client_init ( & con ) ) ;
mysql_options ( & con , MYSQL_INIT_COMMAND , "SELECT 3;
INSERT INTO t1 VALUES (4)" ) ;
DIE_UNLESS ( mysql_real_connect ( & con , opt_host , opt_user , opt_password , current_db , opt_port , opt_unix_socket , CLIENT_MULTI_STATEMENTS | CLIENT_MULTI_RESULTS ) ) ;
stmt = mysql_simple_prepare ( & con , "SELECT a FROM t1" ) ;
check_stmt ( stmt ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
rc = my_process_stmt_result ( stmt ) ;
DIE_UNLESS ( rc == 2 ) ;
mysql_stmt_close ( stmt ) ;
mysql_close ( & con ) ;
rc = mysql_query ( mysql , "DROP TABLE t1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "DROP PROCEDURE p1" ) ;
myquery ( rc ) ;
DBUG_VOID_RETURN ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void isup_calls_init_tap ( void ) {
GString * error_string ;
if ( have_isup_tap_listener == FALSE ) {
error_string = register_tap_listener ( "isup" , & ( the_tapinfo_struct . isup_dummy ) , NULL , 0 , voip_calls_dlg_reset , isup_calls_packet , voip_calls_dlg_draw ) ;
if ( error_string != NULL ) {
simple_dialog ( ESD_TYPE_ERROR , ESD_BTN_OK , "%s" , error_string -> str ) ;
g_string_free ( error_string , TRUE ) ;
exit ( 1 ) ;
}
have_isup_tap_listener = TRUE ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static struct cgroup_meta_data * lxc_cgroup_get_meta ( struct cgroup_meta_data * meta_data ) {
meta_data -> ref ++ ;
return meta_data ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void adapt_coef_probs ( VP9_COMMON * cm , TX_SIZE tx_size , unsigned int count_sat , unsigned int update_factor ) {
const FRAME_CONTEXT * pre_fc = & cm -> frame_contexts [ cm -> frame_context_idx ] ;
vp9_coeff_probs_model * const probs = cm -> fc . coef_probs [ tx_size ] ;
const vp9_coeff_probs_model * const pre_probs = pre_fc -> coef_probs [ tx_size ] ;
vp9_coeff_count_model * counts = cm -> counts . coef [ tx_size ] ;
unsigned int ( * eob_counts ) [ REF_TYPES ] [ COEF_BANDS ] [ COEFF_CONTEXTS ] = cm -> counts . eob_branch [ tx_size ] ;
int i , j , k , l , m ;
for ( i = 0 ;
i < PLANE_TYPES ;
++ i ) for ( j = 0 ;
j < REF_TYPES ;
++ j ) for ( k = 0 ;
k < COEF_BANDS ;
++ k ) for ( l = 0 ;
l < BAND_COEFF_CONTEXTS ( k ) ;
++ l ) {
const int n0 = counts [ i ] [ j ] [ k ] [ l ] [ ZERO_TOKEN ] ;
const int n1 = counts [ i ] [ j ] [ k ] [ l ] [ ONE_TOKEN ] ;
const int n2 = counts [ i ] [ j ] [ k ] [ l ] [ TWO_TOKEN ] ;
const int neob = counts [ i ] [ j ] [ k ] [ l ] [ EOB_MODEL_TOKEN ] ;
const unsigned int branch_ct [ UNCONSTRAINED_NODES ] [ 2 ] = {
{
neob , eob_counts [ i ] [ j ] [ k ] [ l ] - neob }
, {
n0 , n1 + n2 }
, {
n1 , n2 }
}
;
for ( m = 0 ;
m < UNCONSTRAINED_NODES ;
++ m ) probs [ i ] [ j ] [ k ] [ l ] [ m ] = merge_probs ( pre_probs [ i ] [ j ] [ k ] [ l ] [ m ] , branch_ct [ m ] , count_sat , update_factor ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static struct archive_wstring * archive_wstring_append ( struct archive_wstring * as , const wchar_t * p , size_t s ) {
if ( archive_wstring_ensure ( as , as -> length + s + 1 ) == NULL ) return ( NULL ) ;
wmemmove ( as -> s + as -> length , p , s ) ;
as -> length += s ;
as -> s [ as -> length ] = 0 ;
return ( as ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void vga_draw_cursor_line ( uint8_t * d1 , const uint8_t * src1 , int poffset , int w , unsigned int color0 , unsigned int color1 , unsigned int color_xor ) {
const uint8_t * plane0 , * plane1 ;
int x , b0 , b1 ;
uint8_t * d ;
d = d1 ;
plane0 = src1 ;
plane1 = src1 + poffset ;
for ( x = 0 ;
x < w ;
x ++ ) {
b0 = ( plane0 [ x >> 3 ] >> ( 7 - ( x & 7 ) ) ) & 1 ;
b1 = ( plane1 [ x >> 3 ] >> ( 7 - ( x & 7 ) ) ) & 1 ;
switch ( b0 | ( b1 << 1 ) ) {
case 0 : break ;
case 1 : ( ( uint32_t * ) d ) [ 0 ] ^= color_xor ;
break ;
case 2 : ( ( uint32_t * ) d ) [ 0 ] = color0 ;
break ;
case 3 : ( ( uint32_t * ) d ) [ 0 ] = color1 ;
break ;
}
d += 4 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static hm_fragment * dtls1_hm_fragment_new ( unsigned long frag_len , int reassembly ) {
hm_fragment * frag = NULL ;
unsigned char * buf = NULL ;
unsigned char * bitmask = NULL ;
frag = ( hm_fragment * ) OPENSSL_malloc ( sizeof ( hm_fragment ) ) ;
if ( frag == NULL ) return NULL ;
if ( frag_len ) {
buf = ( unsigned char * ) OPENSSL_malloc ( frag_len ) ;
if ( buf == NULL ) {
OPENSSL_free ( frag ) ;
return NULL ;
}
}
frag -> fragment = buf ;
if ( reassembly ) {
bitmask = ( unsigned char * ) OPENSSL_malloc ( RSMBLY_BITMASK_SIZE ( frag_len ) ) ;
if ( bitmask == NULL ) {
if ( buf != NULL ) OPENSSL_free ( buf ) ;
OPENSSL_free ( frag ) ;
return NULL ;
}
memset ( bitmask , 0 , RSMBLY_BITMASK_SIZE ( frag_len ) ) ;
}
frag -> reassembly = bitmask ;
return frag ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dtap_cc_setup ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) {
guint32 curr_offset ;
guint32 consumed ;
guint curr_len ;
curr_offset = offset ;
curr_len = len ;
is_uplink = IS_UPLINK_TRUE ;
ELEM_OPT_TV_SHORT ( 0xd0 , GSM_A_PDU_TYPE_DTAP , DE_REPEAT_IND , " BC repeat indicator" ) ;
ELEM_OPT_TLV ( 0x04 , GSM_A_PDU_TYPE_DTAP , DE_BEARER_CAP , " 1" ) ;
ELEM_OPT_TLV ( 0x04 , GSM_A_PDU_TYPE_DTAP , DE_BEARER_CAP , " 2" ) ;
ELEM_OPT_TLV ( 0x1c , GSM_A_PDU_TYPE_DTAP , DE_FACILITY , NULL ) ;
ELEM_OPT_TLV ( 0x1e , GSM_A_PDU_TYPE_DTAP , DE_PROG_IND , NULL ) ;
ELEM_OPT_TV ( 0x34 , GSM_A_PDU_TYPE_DTAP , DE_SIGNAL , NULL ) ;
ELEM_OPT_TLV ( 0x5c , GSM_A_PDU_TYPE_DTAP , DE_CLG_PARTY_BCD_NUM , NULL ) ;
ELEM_OPT_TLV ( 0x5d , GSM_A_PDU_TYPE_DTAP , DE_CLG_PARTY_SUB_ADDR , NULL ) ;
ELEM_OPT_TLV ( 0x5e , GSM_A_PDU_TYPE_DTAP , DE_CLD_PARTY_BCD_NUM , NULL ) ;
ELEM_OPT_TLV ( 0x6d , GSM_A_PDU_TYPE_DTAP , DE_CLD_PARTY_SUB_ADDR , NULL ) ;
ELEM_OPT_TLV ( 0x74 , GSM_A_PDU_TYPE_DTAP , DE_RED_PARTY_BCD_NUM , NULL ) ;
ELEM_OPT_TLV ( 0x75 , GSM_A_PDU_TYPE_DTAP , DE_RED_PARTY_SUB_ADDR , NULL ) ;
ELEM_OPT_TV_SHORT ( 0xd0 , GSM_A_PDU_TYPE_DTAP , DE_REPEAT_IND , " LLC repeat indicator" ) ;
ELEM_OPT_TLV ( 0x7c , GSM_A_PDU_TYPE_DTAP , DE_LLC , " 1" ) ;
ELEM_OPT_TLV ( 0x7c , GSM_A_PDU_TYPE_DTAP , DE_LLC , " 2" ) ;
ELEM_OPT_TV_SHORT ( 0xd0 , GSM_A_PDU_TYPE_DTAP , DE_REPEAT_IND , " HLC repeat indicator" ) ;
ELEM_OPT_TLV ( 0x7d , GSM_A_PDU_TYPE_DTAP , DE_HLC , " 1" ) ;
ELEM_OPT_TLV ( 0x7d , GSM_A_PDU_TYPE_DTAP , DE_HLC , " 2" ) ;
ELEM_OPT_TLV ( 0x7e , GSM_A_PDU_TYPE_DTAP , DE_USER_USER , NULL ) ;
ELEM_OPT_TV_SHORT ( 0x80 , GSM_A_PDU_TYPE_COMMON , DE_PRIO , NULL ) ;
ELEM_OPT_TLV ( 0x19 , GSM_A_PDU_TYPE_DTAP , DE_ALERT_PATTERN , NULL ) ;
ELEM_OPT_TLV ( 0x2f , GSM_A_PDU_TYPE_DTAP , DE_NET_CC_CAP , NULL ) ;
ELEM_OPT_TLV ( 0x3a , GSM_A_PDU_TYPE_DTAP , DE_CAUSE_NO_CLI , NULL ) ;
ELEM_OPT_TLV ( 0x41 , GSM_A_PDU_TYPE_DTAP , DE_BEARER_CAP , NULL ) ;
ELEM_OPT_TLV ( 0x7f , GSM_A_PDU_TYPE_DTAP , DE_SS_VER_IND , NULL ) ;
ELEM_OPT_T ( 0xa1 , GSM_A_PDU_TYPE_DTAP , DE_CLIR_SUP , NULL ) ;
ELEM_OPT_T ( 0xa2 , GSM_A_PDU_TYPE_DTAP , DE_CLIR_INV , NULL ) ;
ELEM_OPT_TLV ( 0x15 , GSM_A_PDU_TYPE_DTAP , DE_CC_CAP , NULL ) ;
ELEM_OPT_TLV ( 0x1d , GSM_A_PDU_TYPE_DTAP , DE_FACILITY , " $(CCBS)$ (advanced recall alignment)" ) ;
ELEM_OPT_TLV ( 0x1b , GSM_A_PDU_TYPE_DTAP , DE_FACILITY , " (recall alignment Not essential) $(CCBS)$" ) ;
ELEM_OPT_TLV ( 0x2d , GSM_A_PDU_TYPE_DTAP , DE_SI , NULL ) ;
ELEM_OPT_TLV ( 0x40 , GSM_A_PDU_TYPE_DTAP , DE_SUP_CODEC_LIST , NULL ) ;
ELEM_OPT_T ( 0xA3 , GSM_A_PDU_TYPE_DTAP , DE_REDIAL , NULL ) ;
EXTRANEOUS_DATA_CHECK ( curr_len , 0 , pinfo , & ei_gsm_a_dtap_extraneous_data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint32 dissect_trunkpacket ( tvbuff_t * tvb , guint32 offset , guint16 scallno_param _U_ , packet_info * pinfo , proto_tree * iax2_tree , proto_tree * main_tree _U_ ) {
guint8 cmddata , trunkts ;
guint nframes = 0 , ncalls = 0 ;
proto_item * cd , * nc = NULL ;
proto_tree * field_tree = NULL ;
call_list * calls = NULL ;
cmddata = tvb_get_guint8 ( tvb , offset + 1 ) ;
trunkts = cmddata & IAX2_TRUNK_TS ;
if ( iax2_tree ) {
proto_tree_add_item ( iax2_tree , hf_iax2_trunk_metacmd , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
cd = proto_tree_add_uint ( iax2_tree , hf_iax2_trunk_cmddata , tvb , offset + 1 , 1 , cmddata ) ;
field_tree = proto_item_add_subtree ( cd , ett_iax2_trunk_cmddata ) ;
if ( trunkts ) proto_item_append_text ( cd , " (trunk timestamps)" ) ;
proto_tree_add_boolean ( field_tree , hf_iax2_trunk_cmddata_ts , tvb , offset + 1 , 1 , cmddata ) ;
proto_tree_add_item ( iax2_tree , hf_iax2_trunk_ts , tvb , offset + 2 , 4 , ENC_BIG_ENDIAN ) ;
}
offset += 6 ;
if ( trunkts ) {
while ( tvb_captured_length_remaining ( tvb , offset ) >= 6 ) {
guint16 scallno ;
offset = dissect_trunkcall_ts ( tvb , offset , iax2_tree , & scallno ) ;
if ( ! call_list_find ( calls , scallno ) ) {
calls = call_list_append ( calls , scallno ) ;
}
nframes ++ ;
}
}
else {
while ( tvb_captured_length_remaining ( tvb , offset ) >= 4 ) {
guint16 scallno ;
offset = dissect_trunkcall_nots ( tvb , offset , iax2_tree , & scallno ) ;
if ( ! call_list_find ( calls , scallno ) ) {
calls = call_list_append ( calls , scallno ) ;
}
nframes ++ ;
}
}
ncalls = call_list_length ( calls ) ;
if ( iax2_tree ) {
nc = proto_tree_add_uint ( iax2_tree , hf_iax2_trunk_ncalls , NULL , 0 , 0 , ncalls ) ;
PROTO_ITEM_SET_GENERATED ( nc ) ;
}
col_add_fstr ( pinfo -> cinfo , COL_INFO , "Trunk packet with %d media frame%s for %d call%s" , nframes , plurality ( nframes , "" , "s" ) , ncalls , plurality ( ncalls , "" , "s" ) ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST ( WinUtils , IsPipe ) {
using sandbox : : IsPipe ;
base : : string16 pipe_name = L"\\??\\pipe\\mypipe" ;
EXPECT_TRUE ( IsPipe ( pipe_name ) ) ;
pipe_name = L"\\??\\PiPe\\mypipe" ;
EXPECT_TRUE ( IsPipe ( pipe_name ) ) ;
pipe_name = L"\\??\\pipe" ;
EXPECT_FALSE ( IsPipe ( pipe_name ) ) ;
pipe_name = L"\\??\\_pipe_\\mypipe" ;
EXPECT_FALSE ( IsPipe ( pipe_name ) ) ;
pipe_name = L"\\??\\ABCD\\mypipe" ;
EXPECT_FALSE ( IsPipe ( pipe_name ) ) ;
pipe_name = L"/??/pipe/mypipe" ;
EXPECT_FALSE ( IsPipe ( pipe_name ) ) ;
pipe_name = L"\\XX\\pipe\\mypipe" ;
EXPECT_FALSE ( IsPipe ( pipe_name ) ) ;
pipe_name = L"\\Device\\NamedPipe\\mypipe" ;
EXPECT_FALSE ( IsPipe ( pipe_name ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
const char * qemuAliasDiskDriveSkipPrefix ( const char * dev_name ) {
if ( STRPREFIX ( dev_name , QEMU_DRIVE_HOST_PREFIX ) ) dev_name += strlen ( QEMU_DRIVE_HOST_PREFIX ) ;
return dev_name ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void rawprint ( int datatype , int length , const char * data , int status , int quiet , FILE * fp ) {
const char * cp ;
const char * cpend ;
cp = data ;
cpend = data + length ;
if ( ! quiet ) ( void ) fprintf ( fp , "status=0x%04x,\n" , status ) ;
while ( cp < cpend ) {
if ( * cp == '\r' ) {
if ( cp == ( cpend - 1 ) || * ( cp + 1 ) != '\n' ) makeascii ( 1 , cp , fp ) ;
}
else if ( isspace ( ( unsigned char ) * cp ) || isprint ( ( unsigned char ) * cp ) ) putc ( * cp , fp ) ;
else makeascii ( 1 , cp , fp ) ;
cp ++ ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void gpgsm_release ( void * engine ) {
engine_gpgsm_t gpgsm = engine ;
if ( ! gpgsm ) return ;
gpgsm_cancel ( engine ) ;
free ( gpgsm -> colon . attic . line ) ;
free ( gpgsm ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static private_x509_cert_t * create_empty ( void ) {
private_x509_cert_t * this ;
INIT ( this , . public = {
. interface = {
. interface = {
. get_type = _get_type , . get_subject = _get_subject , . get_issuer = _get_issuer , . has_subject = _has_subject , . has_issuer = _has_issuer , . issued_by = _issued_by , . get_public_key = _get_public_key , . get_validity = _get_validity , . get_encoding = _get_encoding , . equals = _equals , . get_ref = _get_ref , . destroy = _destroy , }
, . get_flags = _get_flags , . get_serial = _get_serial , . get_subjectKeyIdentifier = _get_subjectKeyIdentifier , . get_authKeyIdentifier = _get_authKeyIdentifier , . get_constraint = _get_constraint , . create_subjectAltName_enumerator = _create_subjectAltName_enumerator , . create_crl_uri_enumerator = _create_crl_uri_enumerator , . create_ocsp_uri_enumerator = _create_ocsp_uri_enumerator , . create_ipAddrBlock_enumerator = _create_ipAddrBlock_enumerator , . create_name_constraint_enumerator = _create_name_constraint_enumerator , . create_cert_policy_enumerator = _create_cert_policy_enumerator , . create_policy_mapping_enumerator = _create_policy_mapping_enumerator , }
, }
, . version = 1 , . subjectAltNames = linked_list_create ( ) , . crl_uris = linked_list_create ( ) , . ocsp_uris = linked_list_create ( ) , . ipAddrBlocks = linked_list_create ( ) , . permitted_names = linked_list_create ( ) , . excluded_names = linked_list_create ( ) , . cert_policies = linked_list_create ( ) , . policy_mappings = linked_list_create ( ) , . pathLenConstraint = X509_NO_CONSTRAINT , . require_explicit = X509_NO_CONSTRAINT , . inhibit_mapping = X509_NO_CONSTRAINT , . inhibit_any = X509_NO_CONSTRAINT , . ref = 1 , ) ;
return this ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
kadm5_ret_t kadm5_get_principal ( void * server_handle , krb5_principal principal , kadm5_principal_ent_t entry , long in_mask ) {
krb5_db_entry * kdb ;
osa_princ_ent_rec adb ;
krb5_error_code ret = 0 ;
long mask ;
int i ;
kadm5_server_handle_t handle = server_handle ;
CHECK_HANDLE ( server_handle ) ;
krb5_clear_error_message ( handle -> context ) ;
mask = in_mask ;
memset ( entry , 0 , sizeof ( * entry ) ) ;
if ( principal == NULL ) return EINVAL ;
if ( ( ret = kdb_get_entry ( handle , principal , & kdb , & adb ) ) ) return ret ;
if ( ( mask & KADM5_POLICY ) && adb . policy && ( adb . aux_attributes & KADM5_POLICY ) ) {
if ( ( entry -> policy = strdup ( adb . policy ) ) == NULL ) {
ret = ENOMEM ;
goto done ;
}
}
if ( mask & KADM5_AUX_ATTRIBUTES ) entry -> aux_attributes = adb . aux_attributes ;
if ( ( mask & KADM5_PRINCIPAL ) && ( ret = krb5_copy_principal ( handle -> context , kdb -> princ , & entry -> principal ) ) ) {
goto done ;
}
if ( mask & KADM5_PRINC_EXPIRE_TIME ) entry -> princ_expire_time = kdb -> expiration ;
if ( ( mask & KADM5_LAST_PWD_CHANGE ) && ( ret = krb5_dbe_lookup_last_pwd_change ( handle -> context , kdb , & ( entry -> last_pwd_change ) ) ) ) {
goto done ;
}
if ( mask & KADM5_PW_EXPIRATION ) entry -> pw_expiration = kdb -> pw_expiration ;
if ( mask & KADM5_MAX_LIFE ) entry -> max_life = kdb -> max_life ;
if ( ( mask & KADM5_MOD_NAME ) || ( mask & KADM5_MOD_TIME ) ) {
ret = krb5_dbe_lookup_mod_princ_data ( handle -> context , kdb , & ( entry -> mod_date ) , & ( entry -> mod_name ) ) ;
if ( ret ) {
goto done ;
}
if ( ! ( mask & KADM5_MOD_TIME ) ) entry -> mod_date = 0 ;
if ( ! ( mask & KADM5_MOD_NAME ) ) {
krb5_free_principal ( handle -> context , entry -> mod_name ) ;
entry -> mod_name = NULL ;
}
}
if ( mask & KADM5_ATTRIBUTES ) entry -> attributes = kdb -> attributes ;
if ( mask & KADM5_KVNO ) for ( entry -> kvno = 0 , i = 0 ;
i < kdb -> n_key_data ;
i ++ ) if ( ( krb5_kvno ) kdb -> key_data [ i ] . key_data_kvno > entry -> kvno ) entry -> kvno = kdb -> key_data [ i ] . key_data_kvno ;
if ( mask & KADM5_MKVNO ) {
ret = krb5_dbe_get_mkvno ( handle -> context , kdb , & entry -> mkvno ) ;
if ( ret ) goto done ;
}
if ( mask & KADM5_MAX_RLIFE ) entry -> max_renewable_life = kdb -> max_renewable_life ;
if ( mask & KADM5_LAST_SUCCESS ) entry -> last_success = kdb -> last_success ;
if ( mask & KADM5_LAST_FAILED ) entry -> last_failed = kdb -> last_failed ;
if ( mask & KADM5_FAIL_AUTH_COUNT ) entry -> fail_auth_count = kdb -> fail_auth_count ;
if ( mask & KADM5_TL_DATA ) {
krb5_tl_data * tl , * tl2 ;
entry -> tl_data = NULL ;
tl = kdb -> tl_data ;
while ( tl ) {
if ( tl -> tl_data_type > 255 ) {
if ( ( tl2 = dup_tl_data ( tl ) ) == NULL ) {
ret = ENOMEM ;
goto done ;
}
tl2 -> tl_data_next = entry -> tl_data ;
entry -> tl_data = tl2 ;
entry -> n_tl_data ++ ;
}
tl = tl -> tl_data_next ;
}
}
if ( mask & KADM5_KEY_DATA ) {
entry -> n_key_data = kdb -> n_key_data ;
if ( entry -> n_key_data ) {
entry -> key_data = k5calloc ( entry -> n_key_data , sizeof ( krb5_key_data ) , & ret ) ;
if ( entry -> key_data == NULL ) goto done ;
}
else entry -> key_data = NULL ;
for ( i = 0 ;
i < entry -> n_key_data ;
i ++ ) ret = krb5_copy_key_data_contents ( handle -> context , & kdb -> key_data [ i ] , & entry -> key_data [ i ] ) ;
if ( ret ) goto done ;
}
ret = KADM5_OK ;
done : if ( ret && entry -> principal ) {
krb5_free_principal ( handle -> context , entry -> principal ) ;
entry -> principal = NULL ;
}
kdb_free_entry ( handle , kdb , & adb ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static UBool isInOffsetWindowOrDirect ( uint32_t offset , uint32_t c ) {
return ( UBool ) ( c <= offset + 0x7f && ( c >= offset || ( c <= 0x7f && ( c >= 0x20 || ( 1UL << c ) & 0x2601 ) ) ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void evhttp_send_reply_chunk ( struct evhttp_request * req , struct evbuffer * databuf ) {
struct evhttp_connection * evcon = req -> evcon ;
if ( evcon == NULL ) return ;
if ( req -> chunked ) {
evbuffer_add_printf ( evcon -> output_buffer , "%x\r\n" , ( unsigned ) EVBUFFER_LENGTH ( databuf ) ) ;
}
evbuffer_add_buffer ( evcon -> output_buffer , databuf ) ;
if ( req -> chunked ) {
evbuffer_add ( evcon -> output_buffer , "\r\n" , 2 ) ;
}
evhttp_write_buffer ( evcon , NULL , NULL ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
bool get_op_hash_functions ( Oid opno , RegProcedure * lhs_procno , RegProcedure * rhs_procno ) {
bool result = false ;
CatCList * catlist ;
int i ;
if ( lhs_procno ) * lhs_procno = InvalidOid ;
if ( rhs_procno ) * rhs_procno = InvalidOid ;
catlist = SearchSysCacheList1 ( AMOPOPID , ObjectIdGetDatum ( opno ) ) ;
for ( i = 0 ;
i < catlist -> n_members ;
i ++ ) {
HeapTuple tuple = & catlist -> members [ i ] -> tuple ;
Form_pg_amop aform = ( Form_pg_amop ) GETSTRUCT ( tuple ) ;
if ( aform -> amopmethod == HASH_AM_OID && aform -> amopstrategy == HTEqualStrategyNumber ) {
if ( lhs_procno ) {
* lhs_procno = get_opfamily_proc ( aform -> amopfamily , aform -> amoplefttype , aform -> amoplefttype , HASHPROC ) ;
if ( ! OidIsValid ( * lhs_procno ) ) continue ;
if ( ! rhs_procno ) {
result = true ;
break ;
}
if ( aform -> amoplefttype == aform -> amoprighttype ) {
* rhs_procno = * lhs_procno ;
result = true ;
break ;
}
}
if ( rhs_procno ) {
* rhs_procno = get_opfamily_proc ( aform -> amopfamily , aform -> amoprighttype , aform -> amoprighttype , HASHPROC ) ;
if ( ! OidIsValid ( * rhs_procno ) ) {
if ( lhs_procno ) * lhs_procno = InvalidOid ;
continue ;
}
result = true ;
break ;
}
}
}
ReleaseSysCacheList ( catlist ) ;
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dtap_mm_cm_srvc_prompt ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) {
guint32 curr_offset ;
guint32 consumed ;
guint curr_len ;
curr_offset = offset ;
curr_len = len ;
is_uplink = IS_UPLINK_FALSE ;
ELEM_MAND_V ( GSM_A_PDU_TYPE_COMMON , DE_PD_SAPI , NULL ) ;
EXTRANEOUS_DATA_CHECK ( curr_len , 0 , pinfo , & ei_gsm_a_dtap_extraneous_data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_T_availableBitRates ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_T_availableBitRates , T_availableBitRates_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pdf_run_S ( fz_context * ctx , pdf_processor * proc ) {
pdf_run_processor * pr = ( pdf_run_processor * ) proc ;
pdf_show_path ( ctx , pr , 0 , 0 , 1 , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void mc_part_std ( AVSContext * h , int chroma_height , int delta , uint8_t * dest_y , uint8_t * dest_cb , uint8_t * dest_cr , int x_offset , int y_offset , qpel_mc_func * qpix_put , h264_chroma_mc_func chroma_put , qpel_mc_func * qpix_avg , h264_chroma_mc_func chroma_avg , cavs_vector * mv ) {
qpel_mc_func * qpix_op = qpix_put ;
h264_chroma_mc_func chroma_op = chroma_put ;
dest_y += 2 * x_offset + 2 * y_offset * h -> l_stride ;
dest_cb += x_offset + y_offset * h -> c_stride ;
dest_cr += x_offset + y_offset * h -> c_stride ;
x_offset += 8 * h -> mbx ;
y_offset += 8 * h -> mby ;
if ( mv -> ref >= 0 ) {
AVFrame * ref = h -> DPB [ mv -> ref ] . f ;
mc_dir_part ( h , ref , chroma_height , delta , 0 , dest_y , dest_cb , dest_cr , x_offset , y_offset , qpix_op , chroma_op , mv ) ;
qpix_op = qpix_avg ;
chroma_op = chroma_avg ;
}
if ( ( mv + MV_BWD_OFFS ) -> ref >= 0 ) {
AVFrame * ref = h -> DPB [ 0 ] . f ;
mc_dir_part ( h , ref , chroma_height , delta , 1 , dest_y , dest_cb , dest_cr , x_offset , y_offset , qpix_op , chroma_op , mv + MV_BWD_OFFS ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int rv34_decode_slice ( RV34DecContext * r , int end , const uint8_t * buf , int buf_size ) {
MpegEncContext * s = & r -> s ;
GetBitContext * gb = & s -> gb ;
int mb_pos , slice_type ;
int res ;
init_get_bits ( & r -> s . gb , buf , buf_size * 8 ) ;
res = r -> parse_slice_header ( r , gb , & r -> si ) ;
if ( res < 0 ) {
av_log ( s -> avctx , AV_LOG_ERROR , "Incorrect or unknown slice header\n" ) ;
return - 1 ;
}
slice_type = r -> si . type ? r -> si . type : AV_PICTURE_TYPE_I ;
if ( slice_type != s -> pict_type ) {
av_log ( s -> avctx , AV_LOG_ERROR , "Slice type mismatch\n" ) ;
return AVERROR_INVALIDDATA ;
}
r -> si . end = end ;
s -> qscale = r -> si . quant ;
s -> mb_num_left = r -> si . end - r -> si . start ;
r -> s . mb_skip_run = 0 ;
mb_pos = s -> mb_x + s -> mb_y * s -> mb_width ;
if ( r -> si . start != mb_pos ) {
av_log ( s -> avctx , AV_LOG_ERROR , "Slice indicates MB offset %d, got %d\n" , r -> si . start , mb_pos ) ;
s -> mb_x = r -> si . start % s -> mb_width ;
s -> mb_y = r -> si . start / s -> mb_width ;
}
memset ( r -> intra_types_hist , - 1 , r -> intra_types_stride * 4 * 2 * sizeof ( * r -> intra_types_hist ) ) ;
s -> first_slice_line = 1 ;
s -> resync_mb_x = s -> mb_x ;
s -> resync_mb_y = s -> mb_y ;
ff_init_block_index ( s ) ;
while ( ! check_slice_end ( r , s ) ) {
ff_update_block_index ( s ) ;
if ( r -> si . type ) res = rv34_decode_inter_macroblock ( r , r -> intra_types + s -> mb_x * 4 + 4 ) ;
else res = rv34_decode_intra_macroblock ( r , r -> intra_types + s -> mb_x * 4 + 4 ) ;
if ( res < 0 ) {
ff_er_add_slice ( & s -> er , s -> resync_mb_x , s -> resync_mb_y , s -> mb_x - 1 , s -> mb_y , ER_MB_ERROR ) ;
return - 1 ;
}
if ( ++ s -> mb_x == s -> mb_width ) {
s -> mb_x = 0 ;
s -> mb_y ++ ;
ff_init_block_index ( s ) ;
memmove ( r -> intra_types_hist , r -> intra_types , r -> intra_types_stride * 4 * sizeof ( * r -> intra_types_hist ) ) ;
memset ( r -> intra_types , - 1 , r -> intra_types_stride * 4 * sizeof ( * r -> intra_types_hist ) ) ;
if ( r -> loop_filter && s -> mb_y >= 2 ) r -> loop_filter ( r , s -> mb_y - 2 ) ;
if ( HAVE_THREADS && ( s -> avctx -> active_thread_type & FF_THREAD_FRAME ) ) ff_thread_report_progress ( & s -> current_picture_ptr -> tf , s -> mb_y - 2 , 0 ) ;
}
if ( s -> mb_x == s -> resync_mb_x ) s -> first_slice_line = 0 ;
s -> mb_num_left -- ;
}
ff_er_add_slice ( & s -> er , s -> resync_mb_x , s -> resync_mb_y , s -> mb_x - 1 , s -> mb_y , ER_MB_END ) ;
return s -> mb_y == s -> mb_height ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void parseVariant ( proto_tree * tree , tvbuff_t * tvb , packet_info * pinfo , gint * pOffset , const char * szFieldName ) {
proto_item * ti ;
proto_tree * subtree = proto_tree_add_subtree_format ( tree , tvb , * pOffset , - 1 , ett_opcua_variant , & ti , "%s: Variant" , szFieldName ) ;
gint iOffset = * pOffset ;
guint8 EncodingMask ;
gint32 ArrayDimensions = 0 ;
EncodingMask = tvb_get_guint8 ( tvb , iOffset ) ;
proto_tree_add_item ( subtree , hf_opcua_variant_encodingmask , tvb , iOffset , 1 , ENC_LITTLE_ENDIAN ) ;
iOffset ++ ;
if ( EncodingMask & VARIANT_ARRAYMASK ) {
switch ( EncodingMask & 0x3f ) {
case OpcUaType_Null : break ;
case OpcUaType_Boolean : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Boolean" , "Boolean" , hf_opcua_Boolean , parseBoolean , ett_opcua_array_Boolean ) ;
break ;
case OpcUaType_SByte : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "SByte" , "SByte" , hf_opcua_SByte , parseSByte , ett_opcua_array_SByte ) ;
break ;
case OpcUaType_Byte : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Byte" , "Byte" , hf_opcua_Byte , parseByte , ett_opcua_array_Byte ) ;
break ;
case OpcUaType_Int16 : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Int16" , "Int16" , hf_opcua_Int16 , parseInt16 , ett_opcua_array_Int16 ) ;
break ;
case OpcUaType_UInt16 : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "UInt16" , "UInt16" , hf_opcua_UInt16 , parseUInt16 , ett_opcua_array_UInt16 ) ;
break ;
case OpcUaType_Int32 : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Int32" , "Int32" , hf_opcua_Int32 , parseInt32 , ett_opcua_array_Int32 ) ;
break ;
case OpcUaType_UInt32 : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "UInt32" , "UInt32" , hf_opcua_UInt32 , parseUInt32 , ett_opcua_array_UInt32 ) ;
break ;
case OpcUaType_Int64 : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Int64" , "Int64" , hf_opcua_Int64 , parseInt64 , ett_opcua_array_Int64 ) ;
break ;
case OpcUaType_UInt64 : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "UInt64" , "UInt64" , hf_opcua_UInt64 , parseUInt64 , ett_opcua_array_UInt64 ) ;
break ;
case OpcUaType_Float : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Float" , "Float" , hf_opcua_Float , parseFloat , ett_opcua_array_Float ) ;
break ;
case OpcUaType_Double : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Double" , "Double" , hf_opcua_Double , parseDouble , ett_opcua_array_Double ) ;
break ;
case OpcUaType_String : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "String" , "String" , hf_opcua_String , parseString , ett_opcua_array_String ) ;
break ;
case OpcUaType_DateTime : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "DateTime" , "DateTime" , hf_opcua_DateTime , parseDateTime , ett_opcua_array_DateTime ) ;
break ;
case OpcUaType_Guid : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "Guid" , "Guid" , hf_opcua_Guid , parseGuid , ett_opcua_array_Guid ) ;
break ;
case OpcUaType_ByteString : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "ByteString" , "ByteString" , hf_opcua_ByteString , parseByteString , ett_opcua_array_ByteString ) ;
break ;
case OpcUaType_XmlElement : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "XmlElement" , "XmlElement" , hf_opcua_XmlElement , parseXmlElement , ett_opcua_array_XmlElement ) ;
break ;
case OpcUaType_NodeId : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "NodeId" , "NodeId" , parseNodeId , ett_opcua_array_NodeId ) ;
break ;
case OpcUaType_ExpandedNodeId : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "ExpandedNodeId" , "ExpandedNodeId" , parseExpandedNodeId , ett_opcua_array_ExpandedNodeId ) ;
break ;
case OpcUaType_StatusCode : parseArraySimple ( subtree , tvb , pinfo , & iOffset , "StatusCode" , "StatusCode" , hf_opcua_StatusCode , parseStatusCode , ett_opcua_array_StatusCode ) ;
break ;
case OpcUaType_DiagnosticInfo : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "DiagnosticInfo" , "DiagnosticInfo" , parseDiagnosticInfo , ett_opcua_array_DiagnosticInfo ) ;
break ;
case OpcUaType_QualifiedName : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "QualifiedName" , "QualifiedName" , parseQualifiedName , ett_opcua_array_QualifiedName ) ;
break ;
case OpcUaType_LocalizedText : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "LocalizedText" , "LocalizedText" , parseLocalizedText , ett_opcua_array_LocalizedText ) ;
break ;
case OpcUaType_ExtensionObject : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "ExtensionObject" , "ExtensionObject" , parseExtensionObject , ett_opcua_array_ExtensionObject ) ;
break ;
case OpcUaType_DataValue : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "DataValue" , "DataValue" , parseDataValue , ett_opcua_array_DataValue ) ;
break ;
case OpcUaType_Variant : parseArrayComplex ( subtree , tvb , pinfo , & iOffset , "Variant" , "Variant" , parseVariant , ett_opcua_array_Variant ) ;
break ;
}
if ( EncodingMask & VARIANT_ARRAYDIMENSIONS ) {
proto_item * ti_2 ;
proto_tree * subtree_2 = proto_tree_add_subtree ( subtree , tvb , iOffset , - 1 , ett_opcua_variant_arraydims , & ti_2 , "ArrayDimensions" ) ;
int i ;
ArrayDimensions = tvb_get_letohl ( tvb , iOffset ) ;
proto_tree_add_item ( subtree_2 , hf_opcua_ArraySize , tvb , iOffset , 4 , ENC_LITTLE_ENDIAN ) ;
if ( ArrayDimensions > MAX_ARRAY_LEN ) {
proto_tree_add_expert_format ( subtree_2 , pinfo , & ei_array_length , tvb , iOffset , 4 , "ArrayDimensions length %d too large to process" , ArrayDimensions ) ;
return ;
}
iOffset += 4 ;
for ( i = 0 ;
i < ArrayDimensions ;
i ++ ) {
parseInt32 ( subtree_2 , tvb , pinfo , & iOffset , hf_opcua_Int32 ) ;
}
proto_item_set_end ( ti_2 , tvb , iOffset ) ;
}
}
else {
switch ( EncodingMask & 0x3f ) {
case OpcUaType_Null : break ;
case OpcUaType_Boolean : parseBoolean ( subtree , tvb , pinfo , & iOffset , hf_opcua_Boolean ) ;
break ;
case OpcUaType_SByte : parseSByte ( subtree , tvb , pinfo , & iOffset , hf_opcua_SByte ) ;
break ;
case OpcUaType_Byte : parseByte ( subtree , tvb , pinfo , & iOffset , hf_opcua_Byte ) ;
break ;
case OpcUaType_Int16 : parseInt16 ( subtree , tvb , pinfo , & iOffset , hf_opcua_Int16 ) ;
break ;
case OpcUaType_UInt16 : parseUInt16 ( subtree , tvb , pinfo , & iOffset , hf_opcua_UInt16 ) ;
break ;
case OpcUaType_Int32 : parseInt32 ( subtree , tvb , pinfo , & iOffset , hf_opcua_Int32 ) ;
break ;
case OpcUaType_UInt32 : parseUInt32 ( subtree , tvb , pinfo , & iOffset , hf_opcua_UInt32 ) ;
break ;
case OpcUaType_Int64 : parseInt64 ( subtree , tvb , pinfo , & iOffset , hf_opcua_Int64 ) ;
break ;
case OpcUaType_UInt64 : parseUInt64 ( subtree , tvb , pinfo , & iOffset , hf_opcua_UInt64 ) ;
break ;
case OpcUaType_Float : parseFloat ( subtree , tvb , pinfo , & iOffset , hf_opcua_Float ) ;
break ;
case OpcUaType_Double : parseDouble ( subtree , tvb , pinfo , & iOffset , hf_opcua_Double ) ;
break ;
case OpcUaType_String : parseString ( subtree , tvb , pinfo , & iOffset , hf_opcua_String ) ;
break ;
case OpcUaType_DateTime : parseDateTime ( subtree , tvb , pinfo , & iOffset , hf_opcua_DateTime ) ;
break ;
case OpcUaType_Guid : parseGuid ( subtree , tvb , pinfo , & iOffset , hf_opcua_Guid ) ;
break ;
case OpcUaType_ByteString : parseByteString ( subtree , tvb , pinfo , & iOffset , hf_opcua_ByteString ) ;
break ;
case OpcUaType_XmlElement : parseXmlElement ( subtree , tvb , pinfo , & iOffset , hf_opcua_XmlElement ) ;
break ;
case OpcUaType_NodeId : parseNodeId ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_ExpandedNodeId : parseExpandedNodeId ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_StatusCode : parseStatusCode ( subtree , tvb , pinfo , & iOffset , hf_opcua_StatusCode ) ;
break ;
case OpcUaType_DiagnosticInfo : parseDiagnosticInfo ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_QualifiedName : parseQualifiedName ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_LocalizedText : parseLocalizedText ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_ExtensionObject : parseExtensionObject ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_DataValue : parseDataValue ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
case OpcUaType_Variant : parseVariant ( subtree , tvb , pinfo , & iOffset , "Value" ) ;
break ;
}
}
proto_item_set_end ( ti , tvb , iOffset ) ;
* pOffset = iOffset ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int64_t put_header ( AVIOContext * pb , const ff_asf_guid * g ) {
int64_t pos ;
pos = avio_tell ( pb ) ;
ff_put_guid ( pb , g ) ;
avio_wl64 ( pb , 24 ) ;
return pos ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void tcg_exec_all ( void ) {
int r ;
qemu_clock_warp ( vm_clock ) ;
if ( next_cpu == NULL ) {
next_cpu = first_cpu ;
}
for ( ;
next_cpu != NULL && ! exit_request ;
next_cpu = next_cpu -> next_cpu ) {
CPUArchState * env = next_cpu ;
CPUState * cpu = ENV_GET_CPU ( env ) ;
qemu_clock_enable ( vm_clock , ( env -> singlestep_enabled & SSTEP_NOTIMER ) == 0 ) ;
if ( cpu_can_run ( cpu ) ) {
r = tcg_cpu_exec ( env ) ;
if ( r == EXCP_DEBUG ) {
cpu_handle_guest_debug ( cpu ) ;
break ;
}
}
else if ( cpu -> stop || cpu -> stopped ) {
break ;
}
}
exit_request = 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int tm2_read_deltas ( TM2Context * ctx , int stream_id ) {
int d , mb ;
int i , v ;
d = get_bits ( & ctx -> gb , 9 ) ;
mb = get_bits ( & ctx -> gb , 5 ) ;
if ( ( d < 1 ) || ( d > TM2_DELTAS ) || ( mb < 1 ) || ( mb > 32 ) ) {
av_log ( ctx -> avctx , AV_LOG_ERROR , "Incorrect delta table: %i deltas x %i bits\n" , d , mb ) ;
return AVERROR_INVALIDDATA ;
}
for ( i = 0 ;
i < d ;
i ++ ) {
v = get_bits_long ( & ctx -> gb , mb ) ;
if ( v & ( 1 << ( mb - 1 ) ) ) ctx -> deltas [ stream_id ] [ i ] = v - ( 1 << mb ) ;
else ctx -> deltas [ stream_id ] [ i ] = v ;
}
for ( ;
i < TM2_DELTAS ;
i ++ ) ctx -> deltas [ stream_id ] [ i ] = 0 ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( UnloadTest , BrowserCloseInfiniteBeforeUnload ) {
LoadUrlAndQuitBrowser ( INFINITE_BEFORE_UNLOAD_HTML , "infinitebeforeunload" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint32 dissect_netb_data_first_middle ( tvbuff_t * tvb , packet_info * pinfo _U_ , int offset , proto_tree * tree ) {
guint8 remote_session , local_session ;
netbios_data_first_middle_flags ( tvb , tree , offset + NB_FLAGS ) ;
nb_resync_indicator ( tvb , offset , tree , "DATA FIRST MIDDLE" ) ;
nb_xmit_corrl ( tvb , offset , tree ) ;
nb_resp_corrl ( tvb , offset , tree ) ;
remote_session = nb_remote_session ( tvb , offset , tree ) ;
local_session = nb_local_session ( tvb , offset , tree ) ;
return ( remote_session << 8 ) + local_session ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_rsl_ie_ch_id ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset , gboolean is_mandatory ) {
proto_item * ti ;
proto_tree * ie_tree ;
guint8 length ;
int ie_offset ;
guint8 ie_id ;
if ( is_mandatory == FALSE ) {
ie_id = tvb_get_guint8 ( tvb , offset ) ;
if ( ie_id != RSL_IE_CH_ID ) return offset ;
}
ie_tree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_ie_ch_id , & ti , "Channel Identification IE" ) ;
proto_tree_add_item ( ie_tree , hf_rsl_ie_id , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
length = tvb_get_guint8 ( tvb , offset ) ;
proto_item_set_len ( ti , length + 2 ) ;
proto_tree_add_item ( ie_tree , hf_rsl_ie_length , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
ie_offset = offset ;
proto_tree_add_item ( ie_tree , hf_rsl_channel_description_tag , tvb , offset , 1 , ENC_NA ) ;
de_rr_ch_dsc ( tvb , ie_tree , pinfo , offset + 1 , length , NULL , 0 ) ;
offset += 4 ;
proto_tree_add_item ( ie_tree , hf_rsl_mobile_allocation_tag , tvb , offset , 2 , ENC_NA ) ;
return ie_offset + length ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int amrnb_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) {
AMRContext * p = avctx -> priv_data ;
AVFrame * frame = data ;
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
float * buf_out ;
int i , subframe , ret ;
float fixed_gain_factor ;
AMRFixed fixed_sparse = {
0 }
;
float spare_vector [ AMR_SUBFRAME_SIZE ] ;
float synth_fixed_gain ;
const float * synth_fixed_vector ;
frame -> nb_samples = AMR_BLOCK_SIZE ;
if ( ( ret = ff_get_buffer ( avctx , frame , 0 ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
buf_out = ( float * ) frame -> data [ 0 ] ;
p -> cur_frame_mode = unpack_bitstream ( p , buf , buf_size ) ;
if ( p -> cur_frame_mode == NO_DATA ) {
av_log ( avctx , AV_LOG_ERROR , "Corrupt bitstream\n" ) ;
return AVERROR_INVALIDDATA ;
}
if ( p -> cur_frame_mode == MODE_DTX ) {
av_log_missing_feature ( avctx , "dtx mode" , 1 ) ;
return AVERROR_PATCHWELCOME ;
}
if ( p -> cur_frame_mode == MODE_12k2 ) {
lsf2lsp_5 ( p ) ;
}
else lsf2lsp_3 ( p ) ;
for ( i = 0 ;
i < 4 ;
i ++ ) ff_acelp_lspd2lpc ( p -> lsp [ i ] , p -> lpc [ i ] , 5 ) ;
for ( subframe = 0 ;
subframe < 4 ;
subframe ++ ) {
const AMRNBSubframe * amr_subframe = & p -> frame . subframe [ subframe ] ;
decode_pitch_vector ( p , amr_subframe , subframe ) ;
decode_fixed_sparse ( & fixed_sparse , amr_subframe -> pulses , p -> cur_frame_mode , subframe ) ;
decode_gains ( p , amr_subframe , p -> cur_frame_mode , subframe , & fixed_gain_factor ) ;
pitch_sharpening ( p , subframe , p -> cur_frame_mode , & fixed_sparse ) ;
if ( fixed_sparse . pitch_lag == 0 ) {
av_log ( avctx , AV_LOG_ERROR , "The file is corrupted, pitch_lag = 0 is not allowed\n" ) ;
return AVERROR_INVALIDDATA ;
}
ff_set_fixed_vector ( p -> fixed_vector , & fixed_sparse , 1.0 , AMR_SUBFRAME_SIZE ) ;
p -> fixed_gain [ 4 ] = ff_amr_set_fixed_gain ( fixed_gain_factor , avpriv_scalarproduct_float_c ( p -> fixed_vector , p -> fixed_vector , AMR_SUBFRAME_SIZE ) / AMR_SUBFRAME_SIZE , p -> prediction_error , energy_mean [ p -> cur_frame_mode ] , energy_pred_fac ) ;
for ( i = 0 ;
i < AMR_SUBFRAME_SIZE ;
i ++ ) p -> excitation [ i ] *= p -> pitch_gain [ 4 ] ;
ff_set_fixed_vector ( p -> excitation , & fixed_sparse , p -> fixed_gain [ 4 ] , AMR_SUBFRAME_SIZE ) ;
for ( i = 0 ;
i < AMR_SUBFRAME_SIZE ;
i ++ ) p -> excitation [ i ] = truncf ( p -> excitation [ i ] ) ;
synth_fixed_gain = fixed_gain_smooth ( p , p -> lsf_q [ subframe ] , p -> lsf_avg , p -> cur_frame_mode ) ;
synth_fixed_vector = anti_sparseness ( p , & fixed_sparse , p -> fixed_vector , synth_fixed_gain , spare_vector ) ;
if ( synthesis ( p , p -> lpc [ subframe ] , synth_fixed_gain , synth_fixed_vector , & p -> samples_in [ LP_FILTER_ORDER ] , 0 ) ) synthesis ( p , p -> lpc [ subframe ] , synth_fixed_gain , synth_fixed_vector , & p -> samples_in [ LP_FILTER_ORDER ] , 1 ) ;
postfilter ( p , p -> lpc [ subframe ] , buf_out + subframe * AMR_SUBFRAME_SIZE ) ;
ff_clear_fixed_vector ( p -> fixed_vector , & fixed_sparse , AMR_SUBFRAME_SIZE ) ;
update_state ( p ) ;
}
ff_acelp_apply_order_2_transfer_function ( buf_out , buf_out , highpass_zeros , highpass_poles , highpass_gain * AMR_SAMPLE_SCALE , p -> high_pass_mem , AMR_BLOCK_SIZE ) ;
ff_weighted_vector_sumf ( p -> lsf_avg , p -> lsf_avg , p -> lsf_q [ 3 ] , 0.84 , 0.16 , LP_FILTER_ORDER ) ;
* got_frame_ptr = 1 ;
return frame_sizes_nb [ p -> cur_frame_mode ] + 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
hb_bool_t hb_blob_set_user_data ( hb_blob_t * blob , hb_user_data_key_t * key , void * data , hb_destroy_func_t destroy , hb_bool_t replace ) {
return hb_object_set_user_data ( blob , key , data , destroy , replace ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void login_settings_deinit ( void ) {
if ( set_cache != NULL ) master_service_settings_cache_deinit ( & set_cache ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * Type_CrdInfo_Dup ( struct _cms_typehandler_struct * self , const void * Ptr , cmsUInt32Number n ) {
return ( void * ) cmsMLUdup ( ( cmsMLU * ) Ptr ) ;
cmsUNUSED_PARAMETER ( n ) ;
cmsUNUSED_PARAMETER ( self ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static AsfStream * gst_asf_demux_parse_stream_object ( GstASFDemux * demux , guint8 * data , guint64 size ) {
AsfCorrectionType correction_type ;
AsfStreamType stream_type ;
GstClockTime time_offset ;
gboolean is_encrypted G_GNUC_UNUSED ;
guint16 stream_id ;
guint16 flags ;
ASFGuid guid ;
guint stream_specific_size ;
guint type_specific_size G_GNUC_UNUSED ;
guint unknown G_GNUC_UNUSED ;
gboolean inspect_payload = FALSE ;
AsfStream * stream = NULL ;
if ( size < ( 16 + 16 + 8 + 4 + 4 + 2 + 4 ) ) goto not_enough_data ;
gst_asf_demux_get_guid ( & guid , & data , & size ) ;
stream_type = gst_asf_demux_identify_guid ( asf_stream_guids , & guid ) ;
gst_asf_demux_get_guid ( & guid , & data , & size ) ;
correction_type = gst_asf_demux_identify_guid ( asf_correction_guids , & guid ) ;
time_offset = gst_asf_demux_get_uint64 ( & data , & size ) * 100 ;
type_specific_size = gst_asf_demux_get_uint32 ( & data , & size ) ;
stream_specific_size = gst_asf_demux_get_uint32 ( & data , & size ) ;
flags = gst_asf_demux_get_uint16 ( & data , & size ) ;
stream_id = flags & 0x7f ;
is_encrypted = ! ! ( ( flags & 0x8000 ) << 15 ) ;
unknown = gst_asf_demux_get_uint32 ( & data , & size ) ;
GST_DEBUG_OBJECT ( demux , "Found stream %u, time_offset=%" GST_TIME_FORMAT , stream_id , GST_TIME_ARGS ( time_offset ) ) ;
if ( stream_type == ASF_STREAM_EXT_EMBED_HEADER ) {
AsfExtStreamType ext_stream_type ;
gst_asf_demux_get_guid ( & guid , & data , & size ) ;
ext_stream_type = gst_asf_demux_identify_guid ( asf_ext_stream_guids , & guid ) ;
if ( ext_stream_type == ASF_EXT_STREAM_AUDIO ) {
inspect_payload = TRUE ;
gst_asf_demux_get_guid ( & guid , & data , & size ) ;
gst_asf_demux_get_uint32 ( & data , & size ) ;
gst_asf_demux_get_uint32 ( & data , & size ) ;
gst_asf_demux_get_uint32 ( & data , & size ) ;
gst_asf_demux_get_guid ( & guid , & data , & size ) ;
gst_asf_demux_get_uint32 ( & data , & size ) ;
stream_type = ASF_STREAM_AUDIO ;
}
}
switch ( stream_type ) {
case ASF_STREAM_AUDIO : {
asf_stream_audio audio_object ;
if ( ! gst_asf_demux_get_stream_audio ( & audio_object , & data , & size ) ) goto not_enough_data ;
GST_INFO ( "Object is an audio stream with %u bytes of additional data" , audio_object . size ) ;
stream = gst_asf_demux_add_audio_stream ( demux , & audio_object , stream_id , & data , & size ) ;
switch ( correction_type ) {
case ASF_CORRECTION_ON : {
guint span , packet_size , chunk_size , data_size , silence_data ;
GST_INFO ( "Using error correction" ) ;
if ( size < ( 1 + 2 + 2 + 2 + 1 ) ) goto not_enough_data ;
span = gst_asf_demux_get_uint8 ( & data , & size ) ;
packet_size = gst_asf_demux_get_uint16 ( & data , & size ) ;
chunk_size = gst_asf_demux_get_uint16 ( & data , & size ) ;
data_size = gst_asf_demux_get_uint16 ( & data , & size ) ;
silence_data = gst_asf_demux_get_uint8 ( & data , & size ) ;
stream -> span = span ;
GST_DEBUG_OBJECT ( demux , "Descrambling ps:%u cs:%u ds:%u s:%u sd:%u" , packet_size , chunk_size , data_size , span , silence_data ) ;
if ( stream -> span > 1 ) {
if ( chunk_size == 0 || ( ( packet_size / chunk_size ) <= 1 ) ) {
stream -> span = 0 ;
}
else {
stream -> ds_packet_size = packet_size ;
stream -> ds_chunk_size = chunk_size ;
}
}
else {
stream -> ds_packet_size = packet_size ;
stream -> ds_chunk_size = chunk_size ;
}
# if 0 if ( data_size > 1 ) gst_bytestream_flush ( demux -> bs , data_size - 1 ) ;
# else if ( data_size > 1 ) {
if ( ! gst_asf_demux_skip_bytes ( data_size - 1 , & data , & size ) ) {
goto not_enough_data ;
}
}
# endif break ;
}
case ASF_CORRECTION_OFF : {
GST_INFO ( "Error correction off" ) ;
if ( ! gst_asf_demux_skip_bytes ( stream_specific_size , & data , & size ) ) goto not_enough_data ;
break ;
}
default : GST_ELEMENT_ERROR ( demux , STREAM , DEMUX , ( NULL ) , ( "Audio stream using unknown error correction" ) ) ;
return NULL ;
}
break ;
}
case ASF_STREAM_VIDEO : {
asf_stream_video_format video_format_object ;
asf_stream_video video_object ;
guint16 vsize ;
if ( ! gst_asf_demux_get_stream_video ( & video_object , & data , & size ) ) goto not_enough_data ;
vsize = video_object . size - 40 ;
GST_INFO ( "object is a video stream with %u bytes of " "additional data" , vsize ) ;
if ( ! gst_asf_demux_get_stream_video_format ( & video_format_object , & data , & size ) ) {
goto not_enough_data ;
}
stream = gst_asf_demux_add_video_stream ( demux , & video_format_object , stream_id , & data , & size ) ;
break ;
}
default : GST_WARNING_OBJECT ( demux , "Unknown stream type for stream %u" , stream_id ) ;
demux -> other_streams = g_slist_append ( demux -> other_streams , GINT_TO_POINTER ( stream_id ) ) ;
break ;
}
if ( stream ) stream -> inspect_payload = inspect_payload ;
return stream ;
not_enough_data : {
GST_WARNING_OBJECT ( demux , "Unexpected end of data parsing stream object" ) ;
return NULL ;
}
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.