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
|
gr_font # include "hb-shaper-impl-private.hh" # include "hb-graphite2.h" # include < graphite2 / Segment . h > HB_SHAPER_DATA_ENSURE_DECLARE ( graphite2 , face ) HB_SHAPER_DATA_ENSURE_DECLARE ( graphite2 , font ) typedef struct hb_graphite2_tablelist_t {
struct hb_graphite2_tablelist_t * next ;
hb_blob_t * blob ;
unsigned int tag ;
}
hb_graphite2_tablelist_t ;
struct hb_graphite2_shaper_face_data_t {
hb_face_t * face ;
gr_face * grface ;
hb_graphite2_tablelist_t * tlist ;
}
;
static const void * hb_graphite2_get_table ( const void * data , unsigned int tag , size_t * len ) {
hb_graphite2_shaper_face_data_t * face_data = ( hb_graphite2_shaper_face_data_t * ) data ;
hb_graphite2_tablelist_t * tlist = face_data -> tlist ;
hb_blob_t * blob = NULL ;
for ( hb_graphite2_tablelist_t * p = tlist ;
p ;
p = p -> next ) if ( p -> tag == tag ) {
blob = p -> blob ;
break ;
}
if ( unlikely ( ! blob ) ) {
blob = face_data -> face -> reference_table ( tag ) ;
hb_graphite2_tablelist_t * p = ( hb_graphite2_tablelist_t * ) calloc ( 1 , sizeof ( hb_graphite2_tablelist_t ) ) ;
if ( unlikely ( ! p ) ) {
hb_blob_destroy ( blob ) ;
return NULL ;
}
p -> blob = blob ;
p -> tag = tag ;
p -> next = face_data -> tlist ;
face_data -> tlist = p ;
}
unsigned int tlen ;
const char * d = hb_blob_get_data ( blob , & tlen ) ;
* len = tlen ;
return d ;
}
hb_graphite2_shaper_face_data_t * _hb_graphite2_shaper_face_data_create ( hb_face_t * face ) {
hb_blob_t * silf_blob = face -> reference_table ( HB_GRAPHITE2_TAG_SILF ) ;
if ( ! hb_blob_get_length ( silf_blob ) ) {
hb_blob_destroy ( silf_blob ) ;
return NULL ;
}
hb_blob_destroy ( silf_blob ) ;
hb_graphite2_shaper_face_data_t * data = ( hb_graphite2_shaper_face_data_t * ) calloc ( 1 , sizeof ( hb_graphite2_shaper_face_data_t ) ) ;
if ( unlikely ( ! data ) ) return NULL ;
data -> face = face ;
data -> grface = gr_make_face ( data , & hb_graphite2_get_table , gr_face_preloadAll ) ;
if ( unlikely ( ! data -> grface ) ) {
free ( data ) ;
return NULL ;
}
return data ;
}
void _hb_graphite2_shaper_face_data_destroy ( hb_graphite2_shaper_face_data_t * data ) {
hb_graphite2_tablelist_t * tlist = data -> tlist ;
while ( tlist ) {
hb_graphite2_tablelist_t * old = tlist ;
hb_blob_destroy ( tlist -> blob ) ;
tlist = tlist -> next ;
free ( old ) ;
}
gr_face_destroy ( data -> grface ) ;
free ( data ) ;
}
gr_face * hb_graphite2_face_get_gr_face ( hb_face_t * face ) {
if ( unlikely ( ! hb_graphite2_shaper_face_data_ensure ( face ) ) ) return NULL ;
return HB_SHAPER_DATA_GET ( face ) -> grface ;
}
static float hb_graphite2_get_advance ( const void * hb_font , unsigned short gid ) {
return ( ( hb_font_t * ) hb_font ) -> get_glyph_h_advance ( gid ) ;
}
hb_graphite2_shaper_font_data_t * _hb_graphite2_shaper_font_data_create ( hb_font_t * font ) {
if ( unlikely ( ! hb_graphite2_shaper_face_data_ensure ( font -> face ) ) ) return NULL ;
hb_face_t * face = font -> face ;
hb_graphite2_shaper_face_data_t * face_data = HB_SHAPER_DATA_GET ( face ) ;
return gr_make_font_with_advance_fn ( font -> x_scale , font , & hb_graphite2_get_advance , face_data -> grface ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
const char * message_decoder_current_content_type ( struct message_decoder_context * ctx ) {
return ctx -> content_type ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void getTypeOutputInfo ( Oid type , Oid * typOutput , bool * typIsVarlena ) {
HeapTuple typeTuple ;
Form_pg_type pt ;
typeTuple = SearchSysCache1 ( TYPEOID , ObjectIdGetDatum ( type ) ) ;
if ( ! HeapTupleIsValid ( typeTuple ) ) elog ( ERROR , "cache lookup failed for type %u" , type ) ;
pt = ( Form_pg_type ) GETSTRUCT ( typeTuple ) ;
if ( ! pt -> typisdefined ) ereport ( ERROR , ( errcode ( ERRCODE_UNDEFINED_OBJECT ) , errmsg ( "type %s is only a shell" , format_type_be ( type ) ) ) ) ;
if ( ! OidIsValid ( pt -> typoutput ) ) ereport ( ERROR , ( errcode ( ERRCODE_UNDEFINED_FUNCTION ) , errmsg ( "no output function available for type %s" , format_type_be ( type ) ) ) ) ;
* typOutput = pt -> typoutput ;
* typIsVarlena = ( ! pt -> typbyval ) && ( pt -> typlen == - 1 ) ;
ReleaseSysCache ( typeTuple ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint16 de_tp_mode_flag ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len _U_ , gchar * add_string _U_ , int string_len _U_ ) {
guint32 curr_offset = offset ;
proto_tree_add_item ( tree , hf_gsm_a_dtap_mode_flag , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( tree , hf_gsm_a_dtap_downlink_timeslot_offset , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
curr_offset += 1 ;
return ( curr_offset - offset ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void evhttp_free ( struct evhttp * http ) {
struct evhttp_cb * http_cb ;
struct evhttp_connection * evcon ;
struct evhttp_bound_socket * bound ;
int fd ;
while ( ( bound = TAILQ_FIRST ( & http -> sockets ) ) != NULL ) {
TAILQ_REMOVE ( & http -> sockets , bound , next ) ;
fd = bound -> bind_ev . ev_fd ;
event_del ( & bound -> bind_ev ) ;
EVUTIL_CLOSESOCKET ( fd ) ;
free ( bound ) ;
}
while ( ( evcon = TAILQ_FIRST ( & http -> connections ) ) != NULL ) {
evhttp_connection_free ( evcon ) ;
}
while ( ( http_cb = TAILQ_FIRST ( & http -> callbacks ) ) != NULL ) {
TAILQ_REMOVE ( & http -> callbacks , http_cb , next ) ;
free ( http_cb -> what ) ;
free ( http_cb ) ;
}
free ( http ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int libevt_record_values_initialize ( libevt_record_values_t * * record_values , libcerror_error_t * * error ) {
static char * function = "libevt_record_values_initialize" ;
if ( record_values == NULL ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_ARGUMENTS , LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE , "%s: invalid record values." , function ) ;
return ( - 1 ) ;
}
if ( * record_values != NULL ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_RUNTIME , LIBCERROR_RUNTIME_ERROR_VALUE_ALREADY_SET , "%s: invalid record values value already set." , function ) ;
return ( - 1 ) ;
}
* record_values = memory_allocate_structure ( libevt_record_values_t ) ;
if ( * record_values == NULL ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_MEMORY , LIBCERROR_MEMORY_ERROR_INSUFFICIENT , "%s: unable to create record values." , function ) ;
goto on_error ;
}
if ( memory_set ( * record_values , 0 , sizeof ( libevt_record_values_t ) ) == NULL ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_MEMORY , LIBCERROR_MEMORY_ERROR_SET_FAILED , "%s: unable to clear record values." , function ) ;
goto on_error ;
}
return ( 1 ) ;
on_error : if ( * record_values != NULL ) {
memory_free ( * record_values ) ;
* record_values = NULL ;
}
return ( - 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
TM2Context * const l = avctx -> priv_data ;
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size & ~ 3 ;
AVFrame * const p = & l -> pic ;
int offset = TM2_HEADER_SIZE ;
int i , t , ret ;
uint8_t * swbuf ;
swbuf = av_malloc ( buf_size + FF_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! swbuf ) {
av_log ( avctx , AV_LOG_ERROR , "Cannot allocate temporary buffer\n" ) ;
return AVERROR ( ENOMEM ) ;
}
if ( ( ret = ff_reget_buffer ( avctx , p ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
av_free ( swbuf ) ;
return ret ;
}
l -> dsp . bswap_buf ( ( uint32_t * ) swbuf , ( const uint32_t * ) buf , buf_size >> 2 ) ;
if ( ( ret = tm2_read_header ( l , swbuf ) ) < 0 ) {
av_free ( swbuf ) ;
return ret ;
}
for ( i = 0 ;
i < TM2_NUM_STREAMS ;
i ++ ) {
if ( offset >= buf_size ) {
av_free ( swbuf ) ;
return AVERROR_INVALIDDATA ;
}
t = tm2_read_stream ( l , swbuf + offset , tm2_stream_order [ i ] , buf_size - offset ) ;
if ( t < 0 ) {
av_free ( swbuf ) ;
return t ;
}
offset += t ;
}
p -> key_frame = tm2_decode_blocks ( l , p ) ;
if ( p -> key_frame ) p -> pict_type = AV_PICTURE_TYPE_I ;
else p -> pict_type = AV_PICTURE_TYPE_P ;
l -> cur = ! l -> cur ;
* got_frame = 1 ;
ret = av_frame_ref ( data , & l -> pic ) ;
av_free ( swbuf ) ;
return ( ret < 0 ) ? ret : buf_size ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean purple_menu_cmp ( const char * a , const char * b ) {
while ( * a && * b ) {
while ( * a == '_' ) {
a ++ ;
}
while ( * b == '_' ) {
b ++ ;
}
if ( g_ascii_tolower ( * a ) != g_ascii_tolower ( * b ) ) {
return FALSE ;
}
a ++ ;
b ++ ;
}
return ( * a == '\0' && * b == '\0' ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int main ( int argc ATTRIBUTE_UNUSED , char * * argv ATTRIBUTE_UNUSED ) {
printf ( "%s : XPath/Debug support not compiled in\n" , argv [ 0 ] ) ;
return ( 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_init_context_buffers ( VP9_COMMON * cm ) {
setup_mi ( cm ) ;
if ( cm -> last_frame_seg_map ) vpx_memset ( cm -> last_frame_seg_map , 0 , cm -> mi_rows * cm -> mi_cols ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void check_for_prepared_transactions ( ClusterInfo * cluster ) {
PGresult * res ;
PGconn * conn = connectToServer ( cluster , "template1" ) ;
prep_status ( "Checking for prepared transactions" ) ;
res = executeQueryOrDie ( conn , "SELECT * " "FROM pg_catalog.pg_prepared_xacts" ) ;
if ( PQntuples ( res ) != 0 ) pg_fatal ( "The %s cluster contains prepared transactions\n" , CLUSTER_NAME ( cluster ) ) ;
PQclear ( res ) ;
PQfinish ( conn ) ;
check_ok ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_select_prepare ( ) {
int rc ;
MYSQL_STMT * stmt ;
myheader ( "test_select_prepare" ) ;
rc = mysql_autocommit ( mysql , TRUE ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS test_select" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE test_select(id int, name varchar(50))" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "INSERT INTO test_select VALUES(10, 'venu')" ) ;
myquery ( rc ) ;
rc = mysql_commit ( mysql ) ;
myquery ( rc ) ;
stmt = mysql_simple_prepare ( mysql , "SELECT * FROM test_select" ) ;
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 ) ;
rc = mysql_query ( mysql , "DROP TABLE test_select" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE test_select(id tinyint, id1 int, " " id2 float, id3 float, " " name varchar(50))" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "INSERT INTO test_select(id, id1, id2, name) VALUES(10, 5, 2.3, 'venu')" ) ;
myquery ( rc ) ;
rc = mysql_commit ( mysql ) ;
myquery ( rc ) ;
stmt = mysql_simple_prepare ( mysql , "SELECT * FROM test_select" ) ;
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 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void PNGAPI png_set_unknown_chunk_location ( png_structp png_ptr , png_infop info_ptr , int chunk , int location ) {
if ( png_ptr != NULL && info_ptr != NULL && chunk >= 0 && chunk < ( int ) info_ptr -> unknown_chunks_num ) info_ptr -> unknown_chunks [ chunk ] . location = ( png_byte ) location ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int best_effort_strncat_from_utf16le ( struct archive_string * as , const void * _p , size_t bytes , struct archive_string_conv * sc ) {
return ( best_effort_strncat_from_utf16 ( as , _p , bytes , sc , 0 ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * simple_avp ( diam_ctx_t * c , diam_avp_t * a , tvbuff_t * tvb , diam_sub_dis_t * diam_sub_dis_inf _U_ ) {
char * label = NULL ;
if ( c -> tree ) {
proto_item * pi = proto_tree_add_item ( c -> tree , a -> hf_value , tvb , 0 , tvb_reported_length ( tvb ) , ENC_BIG_ENDIAN ) ;
label = ( char * ) wmem_alloc ( wmem_packet_scope ( ) , ITEM_LABEL_LENGTH + 1 ) ;
proto_item_fill_label ( PITEM_FINFO ( pi ) , label ) ;
label = strstr ( label , ": " ) + 2 ;
}
return label ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void cleanup_and_exit ( int exit_code ) {
free_used_memory ( ) ;
if ( server_initialized ) mysql_server_end ( ) ;
fclose ( stderr ) ;
my_end ( my_end_arg ) ;
if ( ! silent ) {
switch ( exit_code ) {
case 1 : printf ( "not ok\n" ) ;
break ;
case 0 : printf ( "ok\n" ) ;
break ;
case 62 : printf ( "skipped\n" ) ;
break ;
default : printf ( "unknown exit code: %d\n" , exit_code ) ;
DBUG_ASSERT ( 0 ) ;
}
}
sf_leaking_memory = 0 ;
exit ( exit_code ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dec_gain ( TwinContext * tctx , GetBitContext * gb , enum FrameType ftype , float * out ) {
const ModeTab * mtab = tctx -> mtab ;
int i , j ;
int sub = mtab -> fmode [ ftype ] . sub ;
float step = AMP_MAX / ( ( 1 << GAIN_BITS ) - 1 ) ;
float sub_step = SUB_AMP_MAX / ( ( 1 << SUB_GAIN_BITS ) - 1 ) ;
if ( ftype == FT_LONG ) {
for ( i = 0 ;
i < tctx -> avctx -> channels ;
i ++ ) out [ i ] = ( 1. / ( 1 << 13 ) ) * mulawinv ( step * 0.5 + step * get_bits ( gb , GAIN_BITS ) , AMP_MAX , MULAW_MU ) ;
}
else {
for ( i = 0 ;
i < tctx -> avctx -> channels ;
i ++ ) {
float val = ( 1. / ( 1 << 23 ) ) * mulawinv ( step * 0.5 + step * get_bits ( gb , GAIN_BITS ) , AMP_MAX , MULAW_MU ) ;
for ( j = 0 ;
j < sub ;
j ++ ) {
out [ i * sub + j ] = val * mulawinv ( sub_step * 0.5 + sub_step * get_bits ( gb , SUB_GAIN_BITS ) , SUB_AMP_MAX , MULAW_MU ) ;
}
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void evhttp_send_reply ( struct evhttp_request * req , int code , const char * reason , struct evbuffer * databuf ) {
evhttp_response_code ( req , code , reason ) ;
evhttp_send ( req , databuf ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static lbmpdm_definition_field_t * lbmpdm_definition_field_find ( lbmpdm_definition_t * definition , guint32 id ) {
lbmpdm_definition_field_t * entry = NULL ;
entry = ( lbmpdm_definition_field_t * ) wmem_tree_lookup32 ( definition -> field_list , id ) ;
return ( entry ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( ProtocolHandlerRegistryTest , TestIsHandledProtocol ) {
registry ( ) -> GetHandlersFor ( "test" ) ;
ASSERT_FALSE ( registry ( ) -> IsHandledProtocol ( "test" ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int zforgetsave ( i_ctx_t * i_ctx_p ) {
os_ptr op = osp ;
alloc_save_t * asave ;
vm_save_t * vmsave ;
int code = restore_check_operand ( op , & asave , idmemory ) ;
if ( code < 0 ) return 0 ;
vmsave = alloc_save_client_data ( asave ) ;
restore_fix_stack ( i_ctx_p , & o_stack , asave , false ) ;
restore_fix_stack ( i_ctx_p , & e_stack , asave , false ) ;
restore_fix_stack ( i_ctx_p , & d_stack , asave , false ) ;
{
gs_gstate * pgs = igs ;
gs_gstate * last ;
while ( gs_gstate_saved ( last = gs_gstate_saved ( pgs ) ) != 0 ) pgs = last ;
gs_gstate_swap_saved ( last , vmsave -> gsave ) ;
gs_grestore ( last ) ;
gs_grestore ( last ) ;
}
code = alloc_forget_save_in ( idmemory , asave ) ;
if ( code < 0 ) return code ;
{
uint space = icurrent_space ;
ialloc_set_space ( idmemory , avm_local ) ;
vmsave -> gsave = 0 ;
ifree_object ( vmsave , "zrestore" ) ;
ialloc_set_space ( idmemory , space ) ;
}
pop ( 1 ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static cmsBool AllocArray ( cmsContext ContextID , _cmsDICarray * a , cmsUInt32Number Count , cmsUInt32Number Length ) {
memset ( a , 0 , sizeof ( _cmsDICarray ) ) ;
if ( ! AllocElem ( ContextID , & a -> Name , Count ) ) goto Error ;
if ( ! AllocElem ( ContextID , & a -> Value , Count ) ) goto Error ;
if ( Length > 16 ) {
if ( ! AllocElem ( ContextID , & a -> DisplayName , Count ) ) goto Error ;
}
if ( Length > 24 ) {
if ( ! AllocElem ( ContextID , & a -> DisplayValue , Count ) ) goto Error ;
}
return TRUE ;
Error : FreeArray ( a ) ;
return FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int replace_db_table ( TABLE * table , const char * db , const LEX_USER & combo , ulong rights , bool revoke_grant ) {
uint i ;
ulong priv , store_rights ;
bool old_row_exists = 0 ;
int error ;
char what = ( revoke_grant ) ? 'N' : 'Y' ;
uchar user_key [ MAX_KEY_LENGTH ] ;
DBUG_ENTER ( "replace_db_table" ) ;
if ( ! initialized ) {
my_error ( ER_OPTION_PREVENTS_STATEMENT , MYF ( 0 ) , "--skip-grant-tables" ) ;
DBUG_RETURN ( - 1 ) ;
}
if ( ! find_acl_user ( combo . host . str , combo . user . str , FALSE ) ) {
my_message ( ER_PASSWORD_NO_MATCH , ER ( ER_PASSWORD_NO_MATCH ) , MYF ( 0 ) ) ;
DBUG_RETURN ( - 1 ) ;
}
table -> use_all_columns ( ) ;
table -> field [ 0 ] -> store ( combo . host . str , combo . host . length , system_charset_info ) ;
table -> field [ 1 ] -> store ( db , ( uint ) strlen ( db ) , system_charset_info ) ;
table -> field [ 2 ] -> store ( combo . user . str , combo . user . length , system_charset_info ) ;
key_copy ( user_key , table -> record [ 0 ] , table -> key_info , table -> key_info -> key_length ) ;
if ( table -> file -> index_read_idx_map ( table -> record [ 0 ] , 0 , user_key , HA_WHOLE_KEY , HA_READ_KEY_EXACT ) ) {
if ( what == 'N' ) {
my_error ( ER_NONEXISTING_GRANT , MYF ( 0 ) , combo . user . str , combo . host . str ) ;
goto abort ;
}
old_row_exists = 0 ;
restore_record ( table , s -> default_values ) ;
table -> field [ 0 ] -> store ( combo . host . str , combo . host . length , system_charset_info ) ;
table -> field [ 1 ] -> store ( db , ( uint ) strlen ( db ) , system_charset_info ) ;
table -> field [ 2 ] -> store ( combo . user . str , combo . user . length , system_charset_info ) ;
}
else {
old_row_exists = 1 ;
store_record ( table , record [ 1 ] ) ;
}
store_rights = get_rights_for_db ( rights ) ;
for ( i = 3 , priv = 1 ;
i < table -> s -> fields ;
i ++ , priv <<= 1 ) {
if ( priv & store_rights ) table -> field [ i ] -> store ( & what , 1 , & my_charset_latin1 ) ;
}
rights = get_access ( table , 3 ) ;
rights = fix_rights_for_db ( rights ) ;
if ( old_row_exists ) {
if ( rights ) {
if ( ( error = table -> file -> ha_update_row ( table -> record [ 1 ] , table -> record [ 0 ] ) ) && error != HA_ERR_RECORD_IS_THE_SAME ) goto table_error ;
}
else {
if ( ( error = table -> file -> ha_delete_row ( table -> record [ 1 ] ) ) ) goto table_error ;
}
}
else if ( rights && ( error = table -> file -> ha_write_row ( table -> record [ 0 ] ) ) ) {
if ( table -> file -> is_fatal_error ( error , HA_CHECK_DUP_KEY ) ) goto table_error ;
}
acl_cache -> clear ( 1 ) ;
if ( old_row_exists ) acl_update_db ( combo . user . str , combo . host . str , db , rights ) ;
else if ( rights ) acl_insert_db ( combo . user . str , combo . host . str , db , rights ) ;
DBUG_RETURN ( 0 ) ;
table_error : table -> file -> print_error ( error , MYF ( 0 ) ) ;
abort : DBUG_RETURN ( - 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static apr_status_t modsecurity_process_phase_request_body ( modsec_rec * msr ) {
apr_time_t time_before ;
apr_status_t rc = 0 ;
if ( ( msr -> allow_scope == ACTION_ALLOW_REQUEST ) || ( msr -> allow_scope == ACTION_ALLOW ) ) {
if ( msr -> txcfg -> debuglog_level >= 4 ) {
msr_log ( msr , 4 , "Skipping phase REQUEST_BODY (allow used)." ) ;
}
return 0 ;
}
else {
if ( msr -> txcfg -> debuglog_level >= 4 ) {
msr_log ( msr , 4 , "Starting phase REQUEST_BODY." ) ;
}
}
time_before = apr_time_now ( ) ;
if ( msr -> txcfg -> ruleset != NULL ) {
rc = msre_ruleset_process_phase ( msr -> txcfg -> ruleset , msr ) ;
}
msr -> time_phase2 = apr_time_now ( ) - time_before ;
return rc ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_rc_set_frame_target ( VP9_COMP * cpi , int target ) {
const VP9_COMMON * const cm = & cpi -> common ;
RATE_CONTROL * const rc = & cpi -> rc ;
rc -> this_frame_target = target ;
rc -> sb64_target_rate = ( ( int64_t ) rc -> this_frame_target * 64 * 64 ) / ( cm -> width * cm -> height ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void msyslog ( int level , const char * fmt , ... ) {
char buf [ 1024 ] ;
va_list ap ;
va_start ( ap , fmt ) ;
mvsnprintf ( buf , sizeof ( buf ) , fmt , ap ) ;
va_end ( ap ) ;
addto_syslog ( level , buf ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void isofile_add_data_file ( struct iso9660 * iso9660 , struct isofile * file ) {
file -> datanext = NULL ;
* iso9660 -> data_file_list . last = file ;
iso9660 -> data_file_list . last = & ( file -> datanext ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
METHOD ( x509_t , create_cert_policy_enumerator , enumerator_t * , private_x509_cert_t * this ) {
return this -> cert_policies -> create_enumerator ( this -> cert_policies ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SPL_METHOD ( SplFileObject , setCsvControl ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
char delimiter = ',' , enclosure = '"' , escape = '\\' ;
char * delim = NULL , * enclo = NULL , * esc = NULL ;
int d_len = 0 , e_len = 0 , esc_len = 0 ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "|sss" , & delim , & d_len , & enclo , & e_len , & esc , & esc_len ) == SUCCESS ) {
switch ( ZEND_NUM_ARGS ( ) ) {
case 3 : if ( esc_len != 1 ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "escape must be a character" ) ;
RETURN_FALSE ;
}
escape = esc [ 0 ] ;
case 2 : if ( e_len != 1 ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "enclosure must be a character" ) ;
RETURN_FALSE ;
}
enclosure = enclo [ 0 ] ;
case 1 : if ( d_len != 1 ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "delimiter must be a character" ) ;
RETURN_FALSE ;
}
delimiter = delim [ 0 ] ;
case 0 : break ;
}
intern -> u . file . delimiter = delimiter ;
intern -> u . file . enclosure = enclosure ;
intern -> u . file . escape = escape ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int fix_pseudo_header ( int encap , Buffer * buf , int len , union wtap_pseudo_header * pseudo_header ) {
const guint8 * pd ;
pd = ws_buffer_start_ptr ( buf ) ;
switch ( encap ) {
case WTAP_ENCAP_PER_PACKET : encap = infer_pkt_encap ( pd , len ) ;
switch ( encap ) {
case WTAP_ENCAP_WFLEET_HDLC : case WTAP_ENCAP_CHDLC_WITH_PHDR : case WTAP_ENCAP_PPP_WITH_PHDR : if ( pseudo_header -> x25 . flags == 0 ) pseudo_header -> p2p . sent = TRUE ;
else pseudo_header -> p2p . sent = FALSE ;
break ;
case WTAP_ENCAP_ISDN : if ( pseudo_header -> x25 . flags == 0x00 ) pseudo_header -> isdn . uton = FALSE ;
else pseudo_header -> isdn . uton = TRUE ;
pseudo_header -> isdn . channel = 0 ;
break ;
}
break ;
case WTAP_ENCAP_ATM_PDUS : if ( pseudo_header -> atm . type == TRAF_LANE && len >= 2 ) {
if ( pd [ 0 ] == 0xff && pd [ 1 ] == 0x00 ) {
pseudo_header -> atm . subtype = TRAF_ST_LANE_LE_CTRL ;
}
else {
if ( pseudo_header -> atm . subtype == TRAF_ST_LANE_LE_CTRL ) {
pseudo_header -> atm . subtype = TRAF_ST_LANE_802_3 ;
}
}
}
break ;
}
return encap ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void proto_register_applemidi ( void ) {
static hf_register_info hf [ ] = {
{
& hf_applemidi_signature , {
"Signature" , "applemidi.signature" , FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_command , {
"Command" , "applemidi.command" , FT_UINT16 , BASE_HEX , VALS ( applemidi_commands ) , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_protocol_version , {
"Protocol Version" , "applemidi.protocol_version" , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_token , {
"Initiator Token" , "applemidi.initiator_token" , FT_UINT32 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_ssrc , {
"Sender SSRC" , "applemidi.sender_ssrc" , FT_UINT32 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_name , {
"Name" , "applemidi.name" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_count , {
"Count" , "applemidi.count" , FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_padding , {
"Padding" , "applemidi.padding" , FT_UINT24 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_timestamp1 , {
"Timestamp 1" , "applemidi.timestamp1" , FT_UINT64 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_timestamp2 , {
"Timestamp 2" , "applemidi.timestamp2" , FT_UINT64 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_timestamp3 , {
"Timestamp 3" , "applemidi.timestamp3" , FT_UINT64 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_sequence_num , {
"Sequence Number" , "applemidi.sequence_number" , FT_UINT32 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_rtp_sequence_num , {
"RTP Sequence Number" , "applemidi.rtp_sequence_number" , FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_rtp_bitrate_limit , {
"Bitrate limit" , "applemidi.bitrate_limit" , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_applemidi_unknown_data , {
"Unknown Data" , "applemidi.unknown_data" , FT_BYTES , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, }
;
static gint * ett [ ] = {
& ett_applemidi , & ett_applemidi_seq_num }
;
proto_applemidi = proto_register_protocol ( APPLEMIDI_DISSECTOR_NAME , APPLEMIDI_DISSECTOR_SHORTNAME , APPLEMIDI_DISSECTOR_ABBREVIATION ) ;
proto_register_field_array ( proto_applemidi , hf , array_length ( hf ) ) ;
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int qemuMonitorJSONCommandWithFd ( qemuMonitorPtr mon , virJSONValuePtr cmd , int scm_fd , virJSONValuePtr * reply ) {
int ret = - 1 ;
qemuMonitorMessage msg ;
char * cmdstr = NULL ;
char * id = NULL ;
virJSONValuePtr exe ;
* reply = NULL ;
memset ( & msg , 0 , sizeof msg ) ;
exe = virJSONValueObjectGet ( cmd , "execute" ) ;
if ( exe ) {
if ( ! ( id = qemuMonitorNextCommandID ( mon ) ) ) goto cleanup ;
if ( virJSONValueObjectAppendString ( cmd , "id" , id ) < 0 ) {
qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "Unable to append command 'id' string" ) ) ;
goto cleanup ;
}
}
if ( ! ( cmdstr = virJSONValueToString ( cmd ) ) ) {
virReportOOMError ( ) ;
goto cleanup ;
}
if ( virAsprintf ( & msg . txBuffer , "%s\r\n" , cmdstr ) < 0 ) {
virReportOOMError ( ) ;
goto cleanup ;
}
msg . txLength = strlen ( msg . txBuffer ) ;
msg . txFD = scm_fd ;
VIR_DEBUG ( "Send command '%s' for write with FD %d" , cmdstr , scm_fd ) ;
ret = qemuMonitorSend ( mon , & msg ) ;
VIR_DEBUG ( "Receive command reply ret=%d rxObject=%p" , ret , msg . rxObject ) ;
if ( ret == 0 ) {
if ( ! msg . rxObject ) {
qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "Missing monitor reply object" ) ) ;
ret = - 1 ;
}
else {
* reply = msg . rxObject ;
}
}
cleanup : VIR_FREE ( id ) ;
VIR_FREE ( cmdstr ) ;
VIR_FREE ( msg . txBuffer ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void free_mi ( VP9_COMMON * cm ) {
int i ;
for ( i = 0 ;
i < 2 ;
++ i ) {
vpx_free ( cm -> mip_array [ i ] ) ;
cm -> mip_array [ i ] = NULL ;
}
cm -> mip = NULL ;
cm -> prev_mip = NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int cirrus_bitblt_videotovideo_copy ( CirrusVGAState * s ) {
if ( blit_is_unsafe ( s , false ) ) return 0 ;
return cirrus_do_copy ( s , s -> cirrus_blt_dstaddr - s -> vga . start_addr , s -> cirrus_blt_srcaddr - s -> vga . start_addr , s -> cirrus_blt_width , s -> cirrus_blt_height ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
char * virLogGetDefaultOutput ( void ) {
return virLogDefaultOutput ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dtls1_read_failed ( SSL * s , int code ) {
if ( code > 0 ) {
fprintf ( stderr , "invalid state reached %s:%d" , __FILE__ , __LINE__ ) ;
return 1 ;
}
if ( ! dtls1_is_timer_expired ( s ) ) {
return code ;
}
# ifndef OPENSSL_NO_HEARTBEATS if ( ! SSL_in_init ( s ) && ! s -> tlsext_hb_pending ) # else if ( ! SSL_in_init ( s ) ) # endif {
BIO_set_flags ( SSL_get_rbio ( s ) , BIO_FLAGS_READ ) ;
return code ;
}
# if 0 item = pqueue_peek ( state -> rcvd_records ) ;
if ( item ) {
}
else # endif # if 0 if ( state -> timeout . read_timeouts >= DTLS1_TMO_READ_COUNT ) ssl3_send_alert ( s , SSL3_AL_WARNING , DTLS1_AD_MISSING_HANDSHAKE_MESSAGE ) ;
# endif return dtls1_handle_timeout ( s ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pmac_ide_writel ( void * opaque , hwaddr addr , uint32_t val ) {
MACIOIDEState * d = opaque ;
addr = ( addr & 0xFFF ) >> 4 ;
val = bswap32 ( val ) ;
if ( addr == 0 ) {
ide_data_writel ( & d -> bus , 0 , val ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_VBDMode ( 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_VBDMode , VBDMode_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static my_bool mi_too_big_key_for_sort ( MI_KEYDEF * key , ha_rows rows ) {
uint key_maxlength = key -> maxlength ;
if ( key -> flag & HA_FULLTEXT ) {
uint ft_max_word_len_for_sort = FT_MAX_WORD_LEN_FOR_SORT * key -> seg -> charset -> mbmaxlen ;
key_maxlength += ft_max_word_len_for_sort - HA_FT_MAXBYTELEN ;
}
return ( key -> flag & HA_SPATIAL ) || ( key -> flag & ( HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT ) && ( ( ulonglong ) rows * key_maxlength > myisam_max_temp_length ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static unsigned int do_preload ( const char * fname , struct link_map * main_map , const char * where ) {
const char * objname ;
const char * err_str = NULL ;
struct map_args args ;
bool malloced ;
args . str = fname ;
args . loader = main_map ;
args . mode = __RTLD_SECURE ;
unsigned int old_nloaded = GL ( dl_ns ) [ LM_ID_BASE ] . _ns_nloaded ;
( void ) _dl_catch_error ( & objname , & err_str , & malloced , map_doit , & args ) ;
if ( __glibc_unlikely ( err_str != NULL ) ) {
_dl_error_printf ( "\ ERROR: ld.so: object '%s' from %s cannot be preloaded (%s): ignored.\n" , fname , where , err_str ) ;
}
else if ( GL ( dl_ns ) [ LM_ID_BASE ] . _ns_nloaded != old_nloaded ) return 1 ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static VALUE ossl_cipher_iv_length ( VALUE self ) {
EVP_CIPHER_CTX * ctx ;
int len = 0 ;
GetCipher ( self , ctx ) ;
# if defined ( HAVE_AUTHENTICATED_ENCRYPTION ) if ( EVP_CIPHER_CTX_flags ( ctx ) & EVP_CIPH_FLAG_AEAD_CIPHER ) len = ( int ) ( VALUE ) EVP_CIPHER_CTX_get_app_data ( ctx ) ;
# endif if ( ! len ) len = EVP_CIPHER_CTX_iv_length ( ctx ) ;
return INT2NUM ( len ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int rtp_packetize_mp4a ( sout_stream_id_sys_t * id , block_t * in ) {
int i_max = rtp_mtu ( id ) - 4 ;
int i_count = ( in -> i_buffer + i_max - 1 ) / i_max ;
uint8_t * p_data = in -> p_buffer ;
int i_data = in -> i_buffer ;
int i ;
for ( i = 0 ;
i < i_count ;
i ++ ) {
int i_payload = __MIN ( i_max , i_data ) ;
block_t * out = block_Alloc ( 16 + i_payload ) ;
rtp_packetize_common ( id , out , ( ( i == i_count - 1 ) ? 1 : 0 ) , ( in -> i_pts > VLC_TS_INVALID ? in -> i_pts : in -> i_dts ) ) ;
out -> p_buffer [ 12 ] = 0 ;
out -> p_buffer [ 13 ] = 2 * 8 ;
SetWBE ( out -> p_buffer + 14 , ( in -> i_buffer << 3 ) | 0 ) ;
memcpy ( & out -> p_buffer [ 16 ] , p_data , i_payload ) ;
out -> i_dts = in -> i_dts + i * in -> i_length / i_count ;
out -> i_length = in -> i_length / i_count ;
rtp_packetize_send ( id , out ) ;
p_data += i_payload ;
i_data -= i_payload ;
}
block_Release ( in ) ;
return VLC_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void splay_insert ( clump_t * cp , gs_ref_memory_t * mem ) {
clump_t * node = NULL ;
clump_t * * root = & mem -> root ;
while ( * root ) {
node = * root ;
if ( PTR_LT ( cp -> cbase , node -> cbase ) ) {
root = & node -> left ;
}
else {
root = & node -> right ;
}
}
* root = cp ;
cp -> left = NULL ;
cp -> right = NULL ;
cp -> parent = node ;
splay_move_to_root ( cp , mem ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline bool cgfs_create ( void * hdata ) {
struct cgfs_data * d = hdata ;
struct cgroup_process_info * i ;
struct cgroup_meta_data * md ;
if ( ! d ) return false ;
md = d -> meta ;
i = lxc_cgroupfs_create ( d -> name , d -> cgroup_pattern , md , NULL ) ;
if ( ! i ) return false ;
d -> info = i ;
return true ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void qdev_init_nofail ( DeviceState * dev ) {
DeviceInfo * info = dev -> info ;
if ( qdev_init ( dev ) < 0 ) hw_error ( "Initialization of device %s failed\n" , info -> name ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_NULL ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_null ( tvb , offset , actx , tree , hf_index ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int test_div_recp ( BIO * bp , BN_CTX * ctx ) {
BIGNUM a , b , c , d , e ;
BN_RECP_CTX recp ;
int i ;
BN_RECP_CTX_init ( & recp ) ;
BN_init ( & a ) ;
BN_init ( & b ) ;
BN_init ( & c ) ;
BN_init ( & d ) ;
BN_init ( & e ) ;
for ( i = 0 ;
i < num0 + num1 ;
i ++ ) {
if ( i < num1 ) {
BN_bntest_rand ( & a , 400 , 0 , 0 ) ;
BN_copy ( & b , & a ) ;
BN_lshift ( & a , & a , i ) ;
BN_add_word ( & a , i ) ;
}
else BN_bntest_rand ( & b , 50 + 3 * ( i - num1 ) , 0 , 0 ) ;
a . neg = rand_neg ( ) ;
b . neg = rand_neg ( ) ;
BN_RECP_CTX_set ( & recp , & b , ctx ) ;
BN_div_recp ( & d , & c , & a , & recp , ctx ) ;
if ( bp != NULL ) {
if ( ! results ) {
BN_print ( bp , & a ) ;
BIO_puts ( bp , " / " ) ;
BN_print ( bp , & b ) ;
BIO_puts ( bp , " - " ) ;
}
BN_print ( bp , & d ) ;
BIO_puts ( bp , "\n" ) ;
if ( ! results ) {
BN_print ( bp , & a ) ;
BIO_puts ( bp , " % " ) ;
BN_print ( bp , & b ) ;
BIO_puts ( bp , " - " ) ;
}
BN_print ( bp , & c ) ;
BIO_puts ( bp , "\n" ) ;
}
BN_mul ( & e , & d , & b , ctx ) ;
BN_add ( & d , & e , & c ) ;
BN_sub ( & d , & d , & a ) ;
if ( ! BN_is_zero ( & d ) ) {
fprintf ( stderr , "Reciprocal division test failed!\n" ) ;
fprintf ( stderr , "a=" ) ;
BN_print_fp ( stderr , & a ) ;
fprintf ( stderr , "\nb=" ) ;
BN_print_fp ( stderr , & b ) ;
fprintf ( stderr , "\n" ) ;
return 0 ;
}
}
BN_free ( & a ) ;
BN_free ( & b ) ;
BN_free ( & c ) ;
BN_free ( & d ) ;
BN_free ( & e ) ;
BN_RECP_CTX_free ( & recp ) ;
return ( 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
restrict_node * create_restrict_node ( address_node * addr , address_node * mask , int_fifo * flags , int line_no ) {
restrict_node * my_node ;
my_node = emalloc_zero ( sizeof ( * my_node ) ) ;
my_node -> addr = addr ;
my_node -> mask = mask ;
my_node -> flags = flags ;
my_node -> line_no = line_no ;
return my_node ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool dprintf_IsQualifierNoDollar ( const char * fmt ) {
# if defined ( MP_HAVE_INT_EXTENSIONS ) if ( ! strncmp ( fmt , "I32" , 3 ) || ! strncmp ( fmt , "I64" , 3 ) ) {
return TRUE ;
}
# endif switch ( * fmt ) {
case '-' : case '+' : case ' ' : case '#' : case '.' : case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' : case 'h' : case 'l' : case 'L' : case 'z' : case 'q' : case '*' : case 'O' : # if defined ( MP_HAVE_INT_EXTENSIONS ) case 'I' : # endif return TRUE ;
default : return FALSE ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int archive_write_set_format_iso9660 ( struct archive * _a ) {
struct archive_write * a = ( struct archive_write * ) _a ;
struct iso9660 * iso9660 ;
archive_check_magic ( _a , ARCHIVE_WRITE_MAGIC , ARCHIVE_STATE_NEW , "archive_write_set_format_iso9660" ) ;
if ( a -> format_free != NULL ) ( a -> format_free ) ( a ) ;
iso9660 = calloc ( 1 , sizeof ( * iso9660 ) ) ;
if ( iso9660 == NULL ) {
archive_set_error ( & a -> archive , ENOMEM , "Can't allocate iso9660 data" ) ;
return ( ARCHIVE_FATAL ) ;
}
iso9660 -> birth_time = 0 ;
iso9660 -> temp_fd = - 1 ;
iso9660 -> cur_file = NULL ;
iso9660 -> primary . max_depth = 0 ;
iso9660 -> primary . vdd_type = VDD_PRIMARY ;
iso9660 -> primary . pathtbl = NULL ;
iso9660 -> joliet . rootent = NULL ;
iso9660 -> joliet . max_depth = 0 ;
iso9660 -> joliet . vdd_type = VDD_JOLIET ;
iso9660 -> joliet . pathtbl = NULL ;
isofile_init_entry_list ( iso9660 ) ;
isofile_init_entry_data_file_list ( iso9660 ) ;
isofile_init_hardlinks ( iso9660 ) ;
iso9660 -> directories_too_deep = NULL ;
iso9660 -> dircnt_max = 1 ;
iso9660 -> wbuff_remaining = wb_buffmax ( ) ;
iso9660 -> wbuff_type = WB_TO_TEMP ;
iso9660 -> wbuff_offset = 0 ;
iso9660 -> wbuff_written = 0 ;
iso9660 -> wbuff_tail = 0 ;
archive_string_init ( & ( iso9660 -> utf16be ) ) ;
archive_string_init ( & ( iso9660 -> mbs ) ) ;
archive_string_init ( & ( iso9660 -> volume_identifier ) ) ;
archive_strcpy ( & ( iso9660 -> volume_identifier ) , "CDROM" ) ;
archive_string_init ( & ( iso9660 -> publisher_identifier ) ) ;
archive_string_init ( & ( iso9660 -> data_preparer_identifier ) ) ;
archive_string_init ( & ( iso9660 -> application_identifier ) ) ;
archive_strcpy ( & ( iso9660 -> application_identifier ) , archive_version_string ( ) ) ;
archive_string_init ( & ( iso9660 -> copyright_file_identifier ) ) ;
archive_string_init ( & ( iso9660 -> abstract_file_identifier ) ) ;
archive_string_init ( & ( iso9660 -> bibliographic_file_identifier ) ) ;
archive_string_init ( & ( iso9660 -> el_torito . catalog_filename ) ) ;
iso9660 -> el_torito . catalog = NULL ;
archive_strcpy ( & ( iso9660 -> el_torito . catalog_filename ) , "boot.catalog" ) ;
archive_string_init ( & ( iso9660 -> el_torito . boot_filename ) ) ;
iso9660 -> el_torito . boot = NULL ;
iso9660 -> el_torito . platform_id = BOOT_PLATFORM_X86 ;
archive_string_init ( & ( iso9660 -> el_torito . id ) ) ;
iso9660 -> el_torito . boot_load_seg = 0 ;
iso9660 -> el_torito . boot_load_size = BOOT_LOAD_SIZE ;
# ifdef HAVE_ZLIB_H iso9660 -> zisofs . block_pointers = NULL ;
iso9660 -> zisofs . block_pointers_allocated = 0 ;
iso9660 -> zisofs . stream_valid = 0 ;
iso9660 -> zisofs . compression_level = 9 ;
memset ( & ( iso9660 -> zisofs . stream ) , 0 , sizeof ( iso9660 -> zisofs . stream ) ) ;
# endif iso9660 -> opt . abstract_file = OPT_ABSTRACT_FILE_DEFAULT ;
iso9660 -> opt . application_id = OPT_APPLICATION_ID_DEFAULT ;
iso9660 -> opt . allow_vernum = OPT_ALLOW_VERNUM_DEFAULT ;
iso9660 -> opt . biblio_file = OPT_BIBLIO_FILE_DEFAULT ;
iso9660 -> opt . boot = OPT_BOOT_DEFAULT ;
iso9660 -> opt . boot_catalog = OPT_BOOT_CATALOG_DEFAULT ;
iso9660 -> opt . boot_info_table = OPT_BOOT_INFO_TABLE_DEFAULT ;
iso9660 -> opt . boot_load_seg = OPT_BOOT_LOAD_SEG_DEFAULT ;
iso9660 -> opt . boot_load_size = OPT_BOOT_LOAD_SIZE_DEFAULT ;
iso9660 -> opt . boot_type = OPT_BOOT_TYPE_DEFAULT ;
iso9660 -> opt . compression_level = OPT_COMPRESSION_LEVEL_DEFAULT ;
iso9660 -> opt . copyright_file = OPT_COPYRIGHT_FILE_DEFAULT ;
iso9660 -> opt . iso_level = OPT_ISO_LEVEL_DEFAULT ;
iso9660 -> opt . joliet = OPT_JOLIET_DEFAULT ;
iso9660 -> opt . limit_depth = OPT_LIMIT_DEPTH_DEFAULT ;
iso9660 -> opt . limit_dirs = OPT_LIMIT_DIRS_DEFAULT ;
iso9660 -> opt . pad = OPT_PAD_DEFAULT ;
iso9660 -> opt . publisher = OPT_PUBLISHER_DEFAULT ;
iso9660 -> opt . rr = OPT_RR_DEFAULT ;
iso9660 -> opt . volume_id = OPT_VOLUME_ID_DEFAULT ;
iso9660 -> opt . zisofs = OPT_ZISOFS_DEFAULT ;
iso9660 -> primary . rootent = isoent_create_virtual_dir ( a , iso9660 , "" ) ;
if ( iso9660 -> primary . rootent == NULL ) {
free ( iso9660 ) ;
archive_set_error ( & a -> archive , ENOMEM , "Can't allocate memory" ) ;
return ( ARCHIVE_FATAL ) ;
}
iso9660 -> primary . rootent -> parent = iso9660 -> primary . rootent ;
iso9660 -> cur_dirent = iso9660 -> primary . rootent ;
archive_string_init ( & ( iso9660 -> cur_dirstr ) ) ;
archive_string_ensure ( & ( iso9660 -> cur_dirstr ) , 1 ) ;
iso9660 -> cur_dirstr . s [ 0 ] = 0 ;
iso9660 -> sconv_to_utf16be = NULL ;
iso9660 -> sconv_from_utf16be = NULL ;
a -> format_data = iso9660 ;
a -> format_name = "iso9660" ;
a -> format_options = iso9660_options ;
a -> format_write_header = iso9660_write_header ;
a -> format_write_data = iso9660_write_data ;
a -> format_finish_entry = iso9660_finish_entry ;
a -> format_close = iso9660_close ;
a -> format_free = iso9660_free ;
a -> archive . archive_format = ARCHIVE_FORMAT_ISO9660 ;
a -> archive . archive_format_name = "ISO9660" ;
return ( ARCHIVE_OK ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void purple_add_deny ( struct im_connection * ic , char * who ) {
struct purple_data * pd = ic -> proto_data ;
purple_privacy_deny_add ( pd -> account , who , FALSE ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_MasterSlaveDeterminationReject ( 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_MasterSlaveDeterminationReject , MasterSlaveDeterminationReject_sequence ) ;
# line 536 "../../asn1/h245/h245.cnf" if ( h245_pi != NULL ) h245_pi -> msg_type = H245_MastSlvDetRjc ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dissect_h245_QOSCapability ( 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_QOSCapability , QOSCapability_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
gx_ttfReader * gx_ttfReader__create ( gs_memory_t * mem ) {
gx_ttfReader * r = gs_alloc_struct ( mem , gx_ttfReader , & st_gx_ttfReader , "gx_ttfReader__create" ) ;
if ( r != NULL ) {
r -> super . Eof = gx_ttfReader__Eof ;
r -> super . Read = gx_ttfReader__Read ;
r -> super . Seek = gx_ttfReader__Seek ;
r -> super . Tell = gx_ttfReader__Tell ;
r -> super . Error = gx_ttfReader__Error ;
r -> super . LoadGlyph = gx_ttfReader__LoadGlyph ;
r -> super . ReleaseGlyph = gx_ttfReader__ReleaseGlyph ;
r -> pos = 0 ;
r -> error = false ;
r -> extra_glyph_index = - 1 ;
memset ( & r -> glyph_data , 0 , sizeof ( r -> glyph_data ) ) ;
r -> pfont = NULL ;
r -> memory = mem ;
gx_ttfReader__Reset ( r ) ;
}
return r ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int cpu_restore_state_from_tb ( TranslationBlock * tb , CPUArchState * env , uintptr_t searched_pc ) {
TCGContext * s = & tcg_ctx ;
int j ;
uintptr_t tc_ptr ;
# ifdef CONFIG_PROFILER int64_t ti ;
# endif # ifdef CONFIG_PROFILER ti = profile_getclock ( ) ;
# endif tcg_func_start ( s ) ;
gen_intermediate_code_pc ( env , tb ) ;
if ( use_icount ) {
env -> icount_decr . u16 . low += tb -> icount ;
env -> can_do_io = 0 ;
}
tc_ptr = ( uintptr_t ) tb -> tc_ptr ;
if ( searched_pc < tc_ptr ) return - 1 ;
s -> tb_next_offset = tb -> tb_next_offset ;
# ifdef USE_DIRECT_JUMP s -> tb_jmp_offset = tb -> tb_jmp_offset ;
s -> tb_next = NULL ;
# else s -> tb_jmp_offset = NULL ;
s -> tb_next = tb -> tb_next ;
# endif j = tcg_gen_code_search_pc ( s , ( uint8_t * ) tc_ptr , searched_pc - tc_ptr ) ;
if ( j < 0 ) return - 1 ;
while ( s -> gen_opc_instr_start [ j ] == 0 ) {
j -- ;
}
env -> icount_decr . u16 . low -= s -> gen_opc_icount [ j ] ;
restore_state_to_opc ( env , tb , j ) ;
# ifdef CONFIG_PROFILER s -> restore_time += profile_getclock ( ) - ti ;
s -> restore_count ++ ;
# endif return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void NVRAM_set_crc ( m48t59_t * nvram , uint32_t addr , uint32_t start , uint32_t count ) {
uint32_t i ;
uint16_t crc = 0xFFFF ;
int odd = 0 ;
if ( count & 1 ) odd = 1 ;
count &= ~ 1 ;
for ( i = 0 ;
i != count ;
i ++ ) {
crc = NVRAM_crc_update ( crc , NVRAM_get_word ( nvram , start + i ) ) ;
}
if ( odd ) {
crc = NVRAM_crc_update ( crc , NVRAM_get_byte ( nvram , start + i ) << 8 ) ;
}
NVRAM_set_word ( nvram , addr , crc ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void initial_reordering_syllable ( const hb_ot_shape_plan_t * plan , hb_face_t * face , hb_buffer_t * buffer , unsigned int start , unsigned int end ) {
syllable_type_t syllable_type = ( syllable_type_t ) ( buffer -> info [ start ] . syllable ( ) & 0x0F ) ;
switch ( syllable_type ) {
case vowel_syllable : case consonant_syllable : initial_reordering_consonant_syllable ( plan , face , buffer , start , end ) ;
break ;
case broken_cluster : case standalone_cluster : initial_reordering_standalone_cluster ( plan , face , buffer , start , end ) ;
break ;
case symbol_cluster : case non_indic_cluster : break ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void setup_tile_info ( VP9_COMMON * cm , struct vp9_read_bit_buffer * rb ) {
int min_log2_tile_cols , max_log2_tile_cols , max_ones ;
vp9_get_tile_n_bits ( cm -> mi_cols , & min_log2_tile_cols , & max_log2_tile_cols ) ;
max_ones = max_log2_tile_cols - min_log2_tile_cols ;
cm -> log2_tile_cols = min_log2_tile_cols ;
while ( max_ones -- && vp9_rb_read_bit ( rb ) ) cm -> log2_tile_cols ++ ;
if ( cm -> log2_tile_cols > 6 ) vpx_internal_error ( & cm -> error , VPX_CODEC_CORRUPT_FRAME , "Invalid number of tile columns" ) ;
cm -> log2_tile_rows = vp9_rb_read_bit ( rb ) ;
if ( cm -> log2_tile_rows ) cm -> log2_tile_rows += vp9_rb_read_bit ( rb ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void SFDefaultOS2Simple ( struct pfminfo * pfminfo , SplineFont * sf ) {
pfminfo -> pfmfamily = 0x11 ;
pfminfo -> panose [ 0 ] = 2 ;
pfminfo -> weight = 400 ;
pfminfo -> panose [ 2 ] = 5 ;
pfminfo -> width = 5 ;
pfminfo -> panose [ 3 ] = 3 ;
pfminfo -> winascent_add = pfminfo -> windescent_add = true ;
pfminfo -> hheadascent_add = pfminfo -> hheaddescent_add = true ;
pfminfo -> typoascent_add = pfminfo -> typodescent_add = true ;
pfminfo -> os2_winascent = pfminfo -> os2_windescent = 0 ;
if ( sf -> subfonts != NULL ) sf = sf -> subfonts [ 0 ] ;
pfminfo -> linegap = pfminfo -> vlinegap = pfminfo -> os2_typolinegap = rint ( .09 * ( sf -> ascent + sf -> descent ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void set_partition_range ( VP9_COMMON * cm , MACROBLOCKD * xd , int mi_row , int mi_col , BLOCK_SIZE bsize , BLOCK_SIZE * min_bs , BLOCK_SIZE * max_bs ) {
int mi_width = num_8x8_blocks_wide_lookup [ bsize ] ;
int mi_height = num_8x8_blocks_high_lookup [ bsize ] ;
int idx , idy ;
MODE_INFO * mi ;
MODE_INFO * * prev_mi = & cm -> prev_mi_grid_visible [ mi_row * cm -> mi_stride + mi_col ] ;
BLOCK_SIZE bs , min_size , max_size ;
min_size = BLOCK_64X64 ;
max_size = BLOCK_4X4 ;
if ( prev_mi ) {
for ( idy = 0 ;
idy < mi_height ;
++ idy ) {
for ( idx = 0 ;
idx < mi_width ;
++ idx ) {
mi = prev_mi [ idy * cm -> mi_stride + idx ] ;
bs = mi ? mi -> mbmi . sb_type : bsize ;
min_size = MIN ( min_size , bs ) ;
max_size = MAX ( max_size , bs ) ;
}
}
}
if ( xd -> left_available ) {
for ( idy = 0 ;
idy < mi_height ;
++ idy ) {
mi = xd -> mi [ idy * cm -> mi_stride - 1 ] ;
bs = mi ? mi -> mbmi . sb_type : bsize ;
min_size = MIN ( min_size , bs ) ;
max_size = MAX ( max_size , bs ) ;
}
}
if ( xd -> up_available ) {
for ( idx = 0 ;
idx < mi_width ;
++ idx ) {
mi = xd -> mi [ idx - cm -> mi_stride ] ;
bs = mi ? mi -> mbmi . sb_type : bsize ;
min_size = MIN ( min_size , bs ) ;
max_size = MAX ( max_size , bs ) ;
}
}
if ( min_size == max_size ) {
min_size = min_partition_size [ min_size ] ;
max_size = max_partition_size [ max_size ] ;
}
* min_bs = min_size ;
* max_bs = max_size ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_rsvp_flowspec ( proto_item * ti , packet_info * pinfo , proto_tree * rsvp_object_tree , tvbuff_t * tvb , int offset , int obj_length , int rsvp_class _U_ , int type ) {
int offset2 = offset + 4 ;
int mylen , signal_type ;
proto_tree * flowspec_tree , * ti2 = NULL ;
proto_tree_add_uint ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type ) ;
mylen = obj_length - 4 ;
switch ( type ) {
case 2 : if ( mylen < 4 ) {
proto_tree_add_expert_format ( rsvp_object_tree , pinfo , & ei_rsvp_invalid_length , tvb , 0 , 0 , "Object length %u < 8" , obj_length ) ;
return ;
}
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_message_format_version , tvb , offset2 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_data_length , tvb , offset2 + 2 , 2 , tvb_get_ntohs ( tvb , offset2 + 2 ) , "%u words, not including header" , tvb_get_ntohs ( tvb , offset2 + 2 ) ) ;
proto_item_set_text ( ti , "FLOWSPEC: " ) ;
mylen -= 4 ;
offset2 += 4 ;
while ( mylen > 0 ) {
guint8 service_num ;
guint length ;
guint8 param_id ;
guint param_len , raw_len ;
guint param_len_processed ;
if ( mylen < 4 ) {
proto_tree_add_expert_format ( rsvp_object_tree , pinfo , & ei_rsvp_invalid_length , tvb , 0 , 0 , "Object length %u not large enough" , obj_length ) ;
return ;
}
service_num = tvb_get_guint8 ( tvb , offset2 ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_service_header , tvb , offset2 , 1 , ENC_BIG_ENDIAN ) ;
length = tvb_get_ntohs ( tvb , offset2 + 2 ) ;
proto_tree_add_uint_format ( rsvp_object_tree , hf_rsvp_data_length , tvb , offset2 + 2 , 2 , length , "Length of service %u data: %u words, not including header" , service_num , length ) ;
mylen -= 4 ;
offset2 += 4 ;
proto_item_append_text ( ti , "%s: " , val_to_str_ext ( service_num , & intsrv_services_str_ext , "Unknown (%d)" ) ) ;
param_len_processed = 0 ;
while ( param_len_processed < length ) {
ti2 = proto_tree_add_item ( rsvp_object_tree , hf_rsvp_parameter , tvb , offset2 , 1 , ENC_NA ) ;
param_id = tvb_get_guint8 ( tvb , offset2 ) ;
raw_len = tvb_get_ntohs ( tvb , offset2 + 2 ) ;
param_len = raw_len + 1 ;
switch ( param_id ) {
case 127 : proto_item_set_len ( ti2 , param_len * 4 ) ;
flowspec_tree = proto_item_add_subtree ( ti2 , TREE ( TT_FLOWSPEC_SUBTREE ) ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_parameter_flags , tvb , offset2 + 1 , 1 , ENC_NA ) ;
proto_tree_add_uint_format_value ( flowspec_tree , hf_rsvp_parameter_length , tvb , offset2 + 2 , 2 , raw_len , "%u words, not including header" , raw_len ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_token_bucket_rate , tvb , offset2 + 4 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_token_bucket_size , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_peak_data_rate , tvb , offset2 + 12 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_minimum_policed_unit , tvb , offset2 + 16 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_maximum_packet_size , tvb , offset2 + 20 , 4 , ENC_BIG_ENDIAN ) ;
proto_item_append_text ( ti , "Token Bucket, %.10g bytes/sec. " , tvb_get_ntohieee_float ( tvb , offset2 + 4 ) ) ;
proto_item_append_text ( ti2 , "Rate=%.10g Burst=%.10g Peak=%.10g m=%u M=%u" , tvb_get_ntohieee_float ( tvb , offset2 + 4 ) , tvb_get_ntohieee_float ( tvb , offset2 + 8 ) , tvb_get_ntohieee_float ( tvb , offset2 + 12 ) , tvb_get_ntohl ( tvb , offset2 + 16 ) , tvb_get_ntohl ( tvb , offset2 + 20 ) ) ;
break ;
case 130 : proto_item_set_len ( ti2 , param_len * 4 ) ;
flowspec_tree = proto_item_add_subtree ( ti2 , TREE ( TT_FLOWSPEC_SUBTREE ) ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_parameter_flags , tvb , offset2 + 1 , 1 , ENC_NA ) ;
proto_tree_add_uint_format_value ( flowspec_tree , hf_rsvp_parameter_length , tvb , offset2 + 2 , 2 , raw_len , "%u words, not including header" , raw_len ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_rate , tvb , offset2 + 4 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_slack_term , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_item_append_text ( ti , "RSpec, %.10g bytes/sec. " , tvb_get_ntohieee_float ( tvb , offset2 + 4 ) ) ;
proto_item_append_text ( ti2 , "R=%.10g, s=%u" , tvb_get_ntohieee_float ( tvb , offset2 + 4 ) , tvb_get_ntohl ( tvb , offset2 + 8 ) ) ;
break ;
case 128 : proto_item_set_len ( ti2 , param_len * 4 ) ;
flowspec_tree = proto_item_add_subtree ( ti2 , TREE ( TT_FLOWSPEC_SUBTREE ) ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_parameter_flags , tvb , offset2 + 1 , 1 , ENC_NA ) ;
proto_tree_add_uint_format_value ( flowspec_tree , hf_rsvp_parameter_length , tvb , offset2 + 2 , 2 , raw_len , "%u words, not including header" , raw_len ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_maximum_packet_size , tvb , offset2 + 4 , 4 , ENC_BIG_ENDIAN ) ;
proto_item_append_text ( ti , "Null Service. M=%u" , tvb_get_ntohl ( tvb , offset2 + 4 ) ) ;
proto_item_append_text ( ti2 , "Max pkt size=%u" , tvb_get_ntohl ( tvb , offset2 + 4 ) ) ;
break ;
default : expert_add_info_format ( pinfo , ti2 , & ei_rsvp_parameter , "Unknown parameter %d, %d words" , param_id , param_len ) ;
break ;
}
param_len_processed += param_len ;
offset2 += param_len * 4 ;
}
mylen -= length * 4 ;
}
break ;
case 4 : proto_item_set_text ( ti , "FLOWSPEC: SONET/SDH, " ) ;
proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type , "4 - SONET/SDH" ) ;
signal_type = tvb_get_guint8 ( tvb , offset2 ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_signal_type_sonet , tvb , offset2 , 1 , ENC_BIG_ENDIAN ) ;
ti2 = proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_requested_concatenation , tvb , offset2 + 1 , 1 , ENC_BIG_ENDIAN ) ;
flowspec_tree = proto_item_add_subtree ( ti2 , TREE ( TT_FLOWSPEC_SUBTREE ) ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_standard_contiguous_concatenation , tvb , offset2 + 1 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_arbitrary_contiguous_concatenation , tvb , offset2 + 1 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_number_of_contiguous_components , tvb , offset2 + 2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_number_of_virtual_components , tvb , offset2 + 4 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_multiplier , tvb , offset2 + 6 , 2 , ENC_BIG_ENDIAN ) ;
ti2 = proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_transparency , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
flowspec_tree = proto_item_add_subtree ( ti2 , TREE ( TT_FLOWSPEC_SUBTREE ) ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_regenerator_section , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_multiplex_section , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_J0_transparency , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_SOH_RSOH_DCC_transparency , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_LOH_MSOH_DCC_transparency , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_LOH_MSOH_extended_DCC_transparency , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_K1_K2_transparency , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_E1_transparency , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_F1_transparency , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_E2_transparency , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_B1_transparency , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_B2_transparency , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_M0_transparency , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( flowspec_tree , hf_rsvp_flowspec_M1_transparency , tvb , offset2 + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_profile , tvb , offset2 + 12 , 4 , ENC_BIG_ENDIAN ) ;
proto_item_append_text ( ti , "Signal [%s], RCC %d, NCC %d, NVC %d, MT %d, Transparency %d, Profile %d" , val_to_str_ext_const ( signal_type , & gmpls_sonet_signal_type_str_ext , "Unknown" ) , tvb_get_guint8 ( tvb , offset2 + 1 ) , tvb_get_ntohs ( tvb , offset2 + 2 ) , tvb_get_ntohs ( tvb , offset2 + 4 ) , tvb_get_ntohs ( tvb , offset2 + 6 ) , tvb_get_ntohl ( tvb , offset2 + 8 ) , tvb_get_ntohl ( tvb , offset2 + 12 ) ) ;
break ;
case 5 : proto_item_set_text ( ti , "FLOWSPEC: G.709, " ) ;
proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type , "5 - G.709" ) ;
signal_type = tvb_get_guint8 ( tvb , offset2 ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_signal_type_g709 , tvb , offset2 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_number_of_multiplexed_components , tvb , offset2 + 2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_number_of_virtual_components , tvb , offset2 + 4 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_multiplier , tvb , offset2 + 6 , 2 , ENC_BIG_ENDIAN ) ;
proto_item_append_text ( ti , "Signal [%s], NMC %d, NVC %d, MT %d" , rval_to_str ( signal_type , gmpls_g709_signal_type_rvals , "Unknown" ) , tvb_get_ntohs ( tvb , offset2 + 2 ) , tvb_get_ntohs ( tvb , offset2 + 4 ) , tvb_get_ntohs ( tvb , offset2 + 6 ) ) ;
break ;
case 6 : proto_item_set_text ( ti , "FLOWSPEC: Ethernet, " ) ;
proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type , "6 - Ethernet" ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_switching_granularity , tvb , offset2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_flowspec_mtu , tvb , offset2 + 2 , 2 , ENC_BIG_ENDIAN ) ;
dissect_rsvp_eth_tspec_tlv ( ti , pinfo , rsvp_object_tree , tvb , offset + 8 , obj_length - 8 , TREE ( TT_FLOWSPEC_SUBTREE ) ) ;
break ;
default : break ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int x ( struct vcache * avc , int afun , struct vrequest * areq , \ struct afs_pdata * ain , struct afs_pdata * aout , \ afs_ucred_t * * acred ) DECL_PIOCTL ( PGetFID ) ;
DECL_PIOCTL ( PSetAcl ) ;
DECL_PIOCTL ( PStoreBehind ) ;
DECL_PIOCTL ( PGCPAGs ) ;
DECL_PIOCTL ( PGetAcl ) ;
DECL_PIOCTL ( PNoop ) ;
DECL_PIOCTL ( PBogus )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_q931_pl_binary_parameters_ie ( tvbuff_t * tvb , int offset , int len , proto_tree * tree ) {
const int * fields [ ] = {
& hf_q931_fast_select , & hf_q931_pl_request , & hf_q931_pl_binary_confirmation , & hf_q931_pl_modulus , NULL }
;
if ( len == 0 ) return ;
proto_tree_add_bitmask_list ( tree , tvb , offset , 1 , fields , ENC_NA ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
const char * TSConfigDirGet ( void ) {
static std : : string sysconfdir = RecConfigReadConfigDir ( ) ;
return sysconfdir . c_str ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_CRCLength ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_CRCLength , CRCLength_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int PEM_write_bio_ ## name ( BIO * bp , type * x ) ;
# define DECLARE_PEM_write_bio_const ( name , type ) int PEM_write_bio_ ## name ( BIO * bp , const type * x ) ;
# define DECLARE_PEM_write_cb_bio ( name , type ) 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 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
relpRetVal relpTcpEnableTLS ( relpTcp_t __attribute__ ( ( unused ) ) * pThis ) {
ENTER_RELPFUNC ;
RELPOBJ_assert ( pThis , Tcp ) ;
# ifdef ENABLE_TLS pThis -> bEnableTLS = 1 ;
# else iRet = RELP_RET_ERR_NO_TLS ;
# endif LEAVE_RELPFUNC ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static char * ts_unix_format ( netdissect_options * ndo # ifndef HAVE_PCAP_SET_TSTAMP_PRECISION _U_ # endif , int sec , int usec , char * buf ) {
const char * format ;
# ifdef HAVE_PCAP_SET_TSTAMP_PRECISION switch ( ndo -> ndo_tstamp_precision ) {
case PCAP_TSTAMP_PRECISION_MICRO : format = "%u.%06u" ;
break ;
case PCAP_TSTAMP_PRECISION_NANO : format = "%u.%09u" ;
break ;
default : format = "%u.{
unknown}
" ;
break ;
}
# else format = "%u.%06u" ;
# endif snprintf ( buf , TS_BUF_SIZE , format , ( unsigned ) sec , ( unsigned ) usec ) ;
return buf ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int remoteSerializeStreamError ( struct qemud_client * client , remote_error * rerr , int proc , int serial ) {
return remoteSerializeError ( client , rerr , REMOTE_PROGRAM , REMOTE_PROTOCOL_VERSION , proc , REMOTE_STREAM , serial ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int pxa2xx_i2c_tx ( I2CSlave * i2c , uint8_t data ) {
PXA2xxI2CSlaveState * slave = FROM_I2C_SLAVE ( PXA2xxI2CSlaveState , i2c ) ;
PXA2xxI2CState * s = slave -> host ;
if ( ( s -> control & ( 1 << 14 ) ) || ! ( s -> control & ( 1 << 6 ) ) ) return 1 ;
if ( ! ( s -> status & ( 1 << 0 ) ) ) {
s -> status |= 1 << 7 ;
s -> data = data ;
}
pxa2xx_i2c_update ( s ) ;
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void fillrd ( struct postproc_state * state , int q , int a ) {
char char_dist [ 300 ] ;
double sigma ;
int i ;
vp8_clear_system_state ( ) ;
sigma = a + .5 + .6 * ( 63 - q ) / 63.0 ;
{
int next , j ;
next = 0 ;
for ( i = - 32 ;
i < 32 ;
i ++ ) {
const int v = ( int ) ( .5 + 256 * vp8_gaussian ( sigma , 0 , i ) ) ;
if ( v ) {
for ( j = 0 ;
j < v ;
j ++ ) {
char_dist [ next + j ] = ( char ) i ;
}
next = next + j ;
}
}
for ( ;
next < 256 ;
next ++ ) char_dist [ next ] = 0 ;
}
for ( i = 0 ;
i < 3072 ;
i ++ ) {
state -> noise [ i ] = char_dist [ rand ( ) & 0xff ] ;
}
for ( i = 0 ;
i < 16 ;
i ++ ) {
state -> blackclamp [ i ] = - char_dist [ 0 ] ;
state -> whiteclamp [ i ] = - char_dist [ 0 ] ;
state -> bothclamp [ i ] = - 2 * char_dist [ 0 ] ;
}
state -> last_q = q ;
state -> last_noise = a ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_encode_sby_pass1 ( MACROBLOCK * x , BLOCK_SIZE bsize ) {
vp9_subtract_plane ( x , bsize , 0 ) ;
vp9_foreach_transformed_block_in_plane ( & x -> e_mbd , bsize , 0 , encode_block_pass1 , x ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int doubledl ( char * * scur , uint8_t * mydlptr , char * buffer , uint32_t buffersize ) {
unsigned char mydl = * mydlptr ;
unsigned char olddl = mydl ;
mydl *= 2 ;
if ( ! ( olddl & 0x7f ) ) {
if ( * scur < buffer || * scur >= buffer + buffersize - 1 ) return - 1 ;
olddl = * * scur ;
mydl = olddl * 2 + 1 ;
* scur = * scur + 1 ;
}
* mydlptr = mydl ;
return ( olddl >> 7 ) & 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void nautilus_file_operations_unmount_mount_full ( GtkWindow * parent_window , GMount * mount , GMountOperation * mount_operation , gboolean eject , gboolean check_trash , NautilusUnmountCallback callback , gpointer callback_data ) {
UnmountData * data ;
int response ;
data = g_new0 ( UnmountData , 1 ) ;
data -> callback = callback ;
data -> callback_data = callback_data ;
if ( parent_window ) {
data -> parent_window = parent_window ;
g_object_add_weak_pointer ( G_OBJECT ( data -> parent_window ) , ( gpointer * ) & data -> parent_window ) ;
}
if ( mount_operation ) {
data -> mount_operation = g_object_ref ( mount_operation ) ;
}
data -> eject = eject ;
data -> mount = g_object_ref ( mount ) ;
if ( check_trash && has_trash_files ( mount ) ) {
response = prompt_empty_trash ( parent_window ) ;
if ( response == GTK_RESPONSE_ACCEPT ) {
GTask * task ;
EmptyTrashJob * job ;
job = op_job_new ( EmptyTrashJob , parent_window ) ;
job -> should_confirm = FALSE ;
job -> trash_dirs = get_trash_dirs_for_mount ( mount ) ;
job -> done_callback = empty_trash_for_unmount_done ;
job -> done_callback_data = data ;
task = g_task_new ( NULL , NULL , empty_trash_task_done , job ) ;
g_task_set_task_data ( task , job , NULL ) ;
g_task_run_in_thread ( task , empty_trash_thread_func ) ;
g_object_unref ( task ) ;
return ;
}
else if ( response == GTK_RESPONSE_CANCEL ) {
if ( callback ) {
callback ( callback_data ) ;
}
unmount_data_free ( data ) ;
return ;
}
}
do_unmount ( data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
PHP_FUNCTION ( locale_accept_from_http ) {
UEnumeration * available ;
char * http_accept = NULL ;
int http_accept_len ;
UErrorCode status = 0 ;
int len ;
char resultLocale [ INTL_MAX_LOCALE_LEN + 1 ] ;
UAcceptResult outResult ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "s" , & http_accept , & http_accept_len ) == FAILURE ) {
intl_error_set ( NULL , U_ILLEGAL_ARGUMENT_ERROR , "locale_accept_from_http: unable to parse input parameters" , 0 TSRMLS_CC ) ;
RETURN_FALSE ;
}
available = ures_openAvailableLocales ( NULL , & status ) ;
INTL_CHECK_STATUS ( status , "locale_accept_from_http: failed to retrieve locale list" ) ;
len = uloc_acceptLanguageFromHTTP ( resultLocale , INTL_MAX_LOCALE_LEN , & outResult , http_accept , available , & status ) ;
uenum_close ( available ) ;
INTL_CHECK_STATUS ( status , "locale_accept_from_http: failed to find acceptable locale" ) ;
if ( len < 0 || outResult == ULOC_ACCEPT_FAILED ) {
RETURN_FALSE ;
}
RETURN_STRINGL ( resultLocale , len , 1 ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void _slurm_rpc_allocate_pack ( slurm_msg_t * msg ) {
static int select_serial = - 1 ;
static int active_rpc_cnt = 0 ;
int error_code = SLURM_SUCCESS , inx , pack_cnt = - 1 ;
DEF_TIMERS ;
job_desc_msg_t * job_desc_msg ;
List job_req_list = ( List ) msg -> data ;
slurmctld_lock_t job_write_lock = {
READ_LOCK , WRITE_LOCK , WRITE_LOCK , READ_LOCK , READ_LOCK }
;
uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ;
uint32_t job_uid = NO_VAL ;
struct job_record * job_ptr , * first_job_ptr = NULL ;
char * err_msg = NULL , * * job_submit_user_msg = NULL ;
ListIterator iter ;
bool priv_user ;
List submit_job_list = NULL ;
uint32_t pack_job_id = 0 , pack_job_offset = 0 ;
hostset_t jobid_hostset = NULL ;
char tmp_str [ 32 ] ;
List resp = NULL ;
slurm_addr_t resp_addr ;
char resp_host [ 16 ] ;
uint16_t port ;
START_TIMER ;
if ( select_serial == - 1 ) {
if ( xstrcmp ( slurmctld_conf . select_type , "select/serial" ) ) select_serial = 0 ;
else select_serial = 1 ;
}
if ( slurmctld_config . submissions_disabled || ( select_serial == 1 ) ) {
info ( "Submissions disabled on system" ) ;
error_code = ESLURM_SUBMISSIONS_DISABLED ;
goto send_msg ;
}
if ( ! _sched_backfill ( ) ) {
error_code = ESLURM_NOT_SUPPORTED ;
goto send_msg ;
}
if ( ! job_req_list || ( list_count ( job_req_list ) == 0 ) ) {
info ( "REQUEST_JOB_PACK_ALLOCATION from uid=%d with empty job list" , uid ) ;
error_code = SLURM_ERROR ;
goto send_msg ;
}
if ( slurm_get_peer_addr ( msg -> conn_fd , & resp_addr ) == 0 ) {
slurm_get_ip_str ( & resp_addr , & port , resp_host , sizeof ( resp_host ) ) ;
}
else {
info ( "REQUEST_JOB_PACK_ALLOCATION from uid=%d , can't get peer addr" , uid ) ;
error_code = SLURM_ERROR ;
goto send_msg ;
}
debug2 ( "sched: Processing RPC: REQUEST_JOB_PACK_ALLOCATION from uid=%d" , uid ) ;
pack_cnt = list_count ( job_req_list ) ;
job_submit_user_msg = xmalloc ( sizeof ( char * ) * pack_cnt ) ;
priv_user = validate_slurm_user ( uid ) ;
submit_job_list = list_create ( NULL ) ;
_throttle_start ( & active_rpc_cnt ) ;
lock_slurmctld ( job_write_lock ) ;
inx = 0 ;
iter = list_iterator_create ( job_req_list ) ;
while ( ( job_desc_msg = ( job_desc_msg_t * ) list_next ( iter ) ) ) {
if ( job_uid == NO_VAL ) job_uid = job_desc_msg -> user_id ;
if ( ( uid != job_desc_msg -> user_id ) && ! priv_user ) {
error_code = ESLURM_USER_ID_MISSING ;
error ( "Security violation, REQUEST_JOB_PACK_ALLOCATION from uid=%d" , uid ) ;
break ;
}
if ( ( job_desc_msg -> alloc_node == NULL ) || ( job_desc_msg -> alloc_node [ 0 ] == '\0' ) ) {
error_code = ESLURM_INVALID_NODE_NAME ;
error ( "REQUEST_JOB_PACK_ALLOCATION lacks alloc_node from uid=%d" , uid ) ;
break ;
}
if ( job_desc_msg -> array_inx ) {
error_code = ESLURM_INVALID_ARRAY ;
break ;
}
if ( job_desc_msg -> immediate ) {
error_code = ESLURM_CAN_NOT_START_IMMEDIATELY ;
break ;
}
job_desc_msg -> pack_job_offset = pack_job_offset ;
error_code = validate_job_create_req ( job_desc_msg , uid , & job_submit_user_msg [ inx ++ ] ) ;
if ( error_code ) break ;
# if HAVE_ALPS_CRAY if ( allocated_session_in_use ( job_desc_msg ) ) {
error_code = ESLURM_RESERVATION_BUSY ;
error ( "attempt to nest ALPS allocation on %s:%d by uid=%d" , job_desc_msg -> alloc_node , job_desc_msg -> alloc_sid , uid ) ;
break ;
}
# endif dump_job_desc ( job_desc_msg ) ;
job_ptr = NULL ;
if ( ! job_desc_msg -> resp_host ) job_desc_msg -> resp_host = xstrdup ( resp_host ) ;
if ( pack_job_offset ) {
job_desc_msg -> mail_type = 0 ;
xfree ( job_desc_msg -> mail_user ) ;
}
job_desc_msg -> pack_job_offset = pack_job_offset ;
error_code = job_allocate ( job_desc_msg , false , false , NULL , true , uid , & job_ptr , & err_msg , msg -> protocol_version ) ;
if ( ! job_ptr ) {
if ( error_code == SLURM_SUCCESS ) error_code = SLURM_ERROR ;
break ;
}
if ( error_code && ( job_ptr -> job_state == JOB_FAILED ) ) break ;
error_code = SLURM_SUCCESS ;
if ( pack_job_id == 0 ) {
pack_job_id = job_ptr -> job_id ;
first_job_ptr = job_ptr ;
}
snprintf ( tmp_str , sizeof ( tmp_str ) , "%u" , job_ptr -> job_id ) ;
if ( jobid_hostset ) hostset_insert ( jobid_hostset , tmp_str ) ;
else jobid_hostset = hostset_create ( tmp_str ) ;
job_ptr -> pack_job_id = pack_job_id ;
job_ptr -> pack_job_offset = pack_job_offset ++ ;
list_append ( submit_job_list , job_ptr ) ;
}
list_iterator_destroy ( iter ) ;
if ( ( error_code == 0 ) && ( ! first_job_ptr ) ) {
error ( "%s: No error, but no pack_job_id" , __func__ ) ;
error_code = SLURM_ERROR ;
}
if ( ( error_code == SLURM_SUCCESS ) && ( accounting_enforce & ACCOUNTING_ENFORCE_LIMITS ) && ! acct_policy_validate_pack ( submit_job_list ) ) {
info ( "Pack job %u exceeded association/QOS limit for user %u" , pack_job_id , job_uid ) ;
error_code = ESLURM_ACCOUNTING_POLICY ;
}
if ( error_code ) {
( void ) list_for_each ( submit_job_list , _pack_job_cancel , NULL ) ;
if ( first_job_ptr ) first_job_ptr -> pack_job_list = submit_job_list ;
else FREE_NULL_LIST ( submit_job_list ) ;
}
else {
resource_allocation_response_msg_t * alloc_msg ;
ListIterator iter ;
int buf_size = pack_job_offset * 16 ;
char * tmp_str = xmalloc ( buf_size ) ;
char * tmp_offset = tmp_str ;
first_job_ptr -> pack_job_list = submit_job_list ;
hostset_ranged_string ( jobid_hostset , buf_size , tmp_str ) ;
if ( tmp_str [ 0 ] == '[' ) {
tmp_offset = strchr ( tmp_str , ']' ) ;
if ( tmp_offset ) tmp_offset [ 0 ] = '\0' ;
tmp_offset = tmp_str + 1 ;
}
inx = 0 ;
iter = list_iterator_create ( submit_job_list ) ;
while ( ( job_ptr = ( struct job_record * ) list_next ( iter ) ) ) {
job_ptr -> pack_job_id_set = xstrdup ( tmp_offset ) ;
if ( ! resp ) resp = list_create ( _del_alloc_pack_msg ) ;
alloc_msg = xmalloc_nz ( sizeof ( resource_allocation_response_msg_t ) ) ;
_build_alloc_msg ( job_ptr , alloc_msg , error_code , job_submit_user_msg [ inx ++ ] ) ;
list_append ( resp , alloc_msg ) ;
if ( slurmctld_conf . debug_flags & DEBUG_FLAG_HETERO_JOBS ) {
char buf [ BUFSIZ ] ;
info ( "Submit %s" , jobid2fmt ( job_ptr , buf , sizeof ( buf ) ) ) ;
}
}
list_iterator_destroy ( iter ) ;
xfree ( tmp_str ) ;
}
unlock_slurmctld ( job_write_lock ) ;
_throttle_fini ( & active_rpc_cnt ) ;
END_TIMER2 ( "_slurm_rpc_allocate_pack" ) ;
if ( resp ) {
slurm_msg_t response_msg ;
slurm_msg_t_init ( & response_msg ) ;
response_msg . conn = msg -> conn ;
response_msg . flags = msg -> flags ;
response_msg . protocol_version = msg -> protocol_version ;
response_msg . msg_type = RESPONSE_JOB_PACK_ALLOCATION ;
response_msg . data = resp ;
if ( slurm_send_node_msg ( msg -> conn_fd , & response_msg ) < 0 ) _kill_job_on_msg_fail ( pack_job_id ) ;
list_destroy ( resp ) ;
}
else {
send_msg : info ( "%s: %s " , __func__ , slurm_strerror ( error_code ) ) ;
if ( err_msg ) slurm_send_rc_err_msg ( msg , error_code , err_msg ) ;
else slurm_send_rc_msg ( msg , error_code ) ;
}
xfree ( err_msg ) ;
for ( inx = 0 ;
inx < pack_cnt ;
inx ++ ) xfree ( job_submit_user_msg [ inx ] ) ;
xfree ( job_submit_user_msg ) ;
if ( jobid_hostset ) hostset_destroy ( jobid_hostset ) ;
schedule_job_save ( ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void start_signal_handler ( void ) {
int error ;
pthread_attr_t thr_attr ;
DBUG_ENTER ( "start_signal_handler" ) ;
( void ) pthread_attr_init ( & thr_attr ) ;
pthread_attr_setscope ( & thr_attr , PTHREAD_SCOPE_SYSTEM ) ;
( void ) pthread_attr_setdetachstate ( & thr_attr , PTHREAD_CREATE_DETACHED ) ;
( void ) my_setstacksize ( & thr_attr , my_thread_stack_size ) ;
mysql_mutex_lock ( & LOCK_thread_count ) ;
if ( ( error = mysql_thread_create ( key_thread_signal_hand , & signal_thread , & thr_attr , signal_hand , 0 ) ) ) {
sql_print_error ( "Can't create interrupt-thread (error %d, errno: %d)" , error , errno ) ;
exit ( 1 ) ;
}
mysql_cond_wait ( & COND_thread_count , & LOCK_thread_count ) ;
mysql_mutex_unlock ( & LOCK_thread_count ) ;
( void ) pthread_attr_destroy ( & thr_attr ) ;
DBUG_VOID_RETURN ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void do_output_subblock ( RA144Context * ractx , const uint16_t * lpc_coefs , int gval , GetBitContext * gb ) {
int cba_idx = get_bits ( gb , 7 ) ;
int gain = get_bits ( gb , 8 ) ;
int cb1_idx = get_bits ( gb , 7 ) ;
int cb2_idx = get_bits ( gb , 7 ) ;
ff_subblock_synthesis ( ractx , lpc_coefs , cba_idx , cb1_idx , cb2_idx , gval , gain ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static char * bittok2str_internal ( register const struct tok * lp , register const char * fmt , register u_int v , const char * sep ) {
static char buf [ 256 ] ;
int buflen = 0 ;
register u_int rotbit ;
register u_int tokval ;
const char * sepstr = "" ;
while ( lp != NULL && lp -> s != NULL ) {
tokval = lp -> v ;
rotbit = 1 ;
while ( rotbit != 0 ) {
if ( tokval == ( v & rotbit ) ) {
buflen += snprintf ( buf + buflen , sizeof ( buf ) - buflen , "%s%s" , sepstr , lp -> s ) ;
sepstr = sep ;
break ;
}
rotbit = rotbit << 1 ;
}
lp ++ ;
}
if ( buflen == 0 ) ( void ) snprintf ( buf , sizeof ( buf ) , fmt == NULL ? "#%08x" : fmt , v ) ;
return ( buf ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_rtp_data ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , proto_tree * rtp_tree , int offset , unsigned int data_len , unsigned int data_reported_len , unsigned int payload_type ) {
tvbuff_t * newtvb ;
struct _rtp_conversation_info * p_conv_data = NULL ;
gboolean must_desegment = FALSE ;
rtp_private_conv_info * finfo = NULL ;
rtp_multisegment_pdu * msp = NULL ;
guint32 seqno ;
p_conv_data = ( struct _rtp_conversation_info * ) p_get_proto_data ( wmem_file_scope ( ) , pinfo , proto_rtp , 0 ) ;
if ( p_conv_data != NULL ) finfo = p_conv_data -> rtp_conv_info ;
if ( finfo == NULL || ! desegment_rtp ) {
newtvb = tvb_new_subset ( tvb , offset , data_len , data_reported_len ) ;
process_rtp_payload ( newtvb , pinfo , tree , rtp_tree , payload_type ) ;
return ;
}
seqno = p_conv_data -> extended_seqno ;
pinfo -> can_desegment = 2 ;
pinfo -> desegment_offset = 0 ;
pinfo -> desegment_len = 0 ;
# ifdef DEBUG_FRAGMENTS g_debug ( "%d: RTP Part of convo %d(%p);
seqno %d" , pinfo -> fd -> num , p_conv_data -> frame_number , p_conv_data , seqno ) ;
# endif msp = ( rtp_multisegment_pdu * ) wmem_tree_lookup32_le ( finfo -> multisegment_pdus , seqno - 1 ) ;
if ( msp && msp -> startseq < seqno && msp -> endseq >= seqno ) {
guint32 fid = msp -> startseq ;
fragment_head * fd_head ;
# ifdef DEBUG_FRAGMENTS g_debug ( "\tContinues fragment %d" , fid ) ;
# endif fd_head = fragment_add_seq ( & rtp_reassembly_table , tvb , offset , pinfo , fid , NULL , seqno - msp -> startseq , data_len , FALSE , 0 ) ;
newtvb = process_reassembled_data ( tvb , offset , pinfo , "Reassembled RTP" , fd_head , & rtp_fragment_items , NULL , tree ) ;
# ifdef DEBUG_FRAGMENTS g_debug ( "\tFragment Coalesced;
fd_head=%p, newtvb=%p (len %d)" , fd_head , newtvb , newtvb ? tvb_reported_length ( newtvb ) : 0 ) ;
# endif if ( newtvb != NULL ) {
process_rtp_payload ( newtvb , pinfo , tree , rtp_tree , payload_type ) ;
if ( pinfo -> desegment_len && pinfo -> desegment_offset == 0 ) {
# ifdef DEBUG_FRAGMENTS g_debug ( "\tNo complete pdus in payload" ) ;
# endif fragment_set_partial_reassembly ( & rtp_reassembly_table , pinfo , fid , NULL ) ;
msp -> endseq = MIN ( msp -> endseq , seqno ) + 1 ;
}
else {
if ( pinfo -> desegment_len ) {
must_desegment = TRUE ;
}
}
}
}
else {
# ifdef DEBUG_FRAGMENTS g_debug ( "\tRTP non-fragment payload" ) ;
# endif newtvb = tvb_new_subset ( tvb , offset , data_len , data_reported_len ) ;
process_rtp_payload ( newtvb , pinfo , tree , rtp_tree , payload_type ) ;
if ( pinfo -> desegment_len ) {
must_desegment = TRUE ;
}
}
if ( must_desegment ) {
guint32 deseg_offset = pinfo -> desegment_offset ;
guint32 frag_len = tvb_reported_length_remaining ( newtvb , deseg_offset ) ;
fragment_head * fd_head = NULL ;
# ifdef DEBUG_FRAGMENTS g_debug ( "\tRTP Must Desegment: tvb_len=%d ds_len=%d %d frag_len=%d ds_off=%d" , tvb_reported_length ( newtvb ) , pinfo -> desegment_len , pinfo -> fd -> flags . visited , frag_len , deseg_offset ) ;
# endif msp = wmem_new ( wmem_file_scope ( ) , rtp_multisegment_pdu ) ;
msp -> startseq = seqno ;
msp -> endseq = seqno + 1 ;
wmem_tree_insert32 ( finfo -> multisegment_pdus , seqno , msp ) ;
fd_head = fragment_add_seq ( & rtp_reassembly_table , newtvb , deseg_offset , pinfo , seqno , NULL , 0 , frag_len , TRUE , 0 ) ;
if ( fd_head != NULL ) {
if ( fd_head -> reassembled_in != 0 && ! ( fd_head -> flags & FD_PARTIAL_REASSEMBLY ) ) {
proto_item * rtp_tree_item ;
rtp_tree_item = proto_tree_add_uint ( tree , hf_rtp_reassembled_in , newtvb , deseg_offset , tvb_reported_length_remaining ( newtvb , deseg_offset ) , fd_head -> reassembled_in ) ;
PROTO_ITEM_SET_GENERATED ( rtp_tree_item ) ;
# ifdef DEBUG_FRAGMENTS g_debug ( "\tReassembled in %d" , fd_head -> reassembled_in ) ;
# endif }
else {
# ifdef DEBUG_FRAGMENTS g_debug ( "\tUnfinished fragment" ) ;
# endif proto_tree_add_text ( tree , tvb , deseg_offset , - 1 , "RTP fragment, unfinished" ) ;
}
}
else {
# ifdef DEBUG_FRAGMENTS g_debug ( "\tnew pdu" ) ;
# endif }
if ( pinfo -> desegment_offset == 0 ) {
col_set_str ( pinfo -> cinfo , COL_PROTOCOL , "RTP" ) ;
col_set_str ( pinfo -> cinfo , COL_INFO , "[RTP segment of a reassembled PDU]" ) ;
}
}
pinfo -> can_desegment = 0 ;
pinfo -> desegment_offset = 0 ;
pinfo -> desegment_len = 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( TemplateURLTest , ParseURLEmpty ) {
TemplateURL url ( ( TemplateURLData ( ) ) ) ;
TemplateURLRef : : Replacements replacements ;
bool valid = false ;
EXPECT_EQ ( std : : string ( ) , url . url_ref ( ) . ParseURL ( std : : string ( ) , & replacements , NULL , & valid ) ) ;
EXPECT_TRUE ( replacements . empty ( ) ) ;
EXPECT_TRUE ( valid ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void virtio_net_tx_complete ( VLANClientState * nc , ssize_t len ) {
VirtIONet * n = DO_UPCAST ( NICState , nc , nc ) -> opaque ;
virtqueue_push ( n -> tx_vq , & n -> async_tx . elem , n -> async_tx . len ) ;
virtio_notify ( & n -> vdev , n -> tx_vq ) ;
n -> async_tx . elem . out_num = n -> async_tx . len = 0 ;
virtio_queue_set_notification ( n -> tx_vq , 1 ) ;
virtio_net_flush_tx ( n , n -> tx_vq ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_usb_ms_reset ( packet_info * pinfo _U_ , proto_tree * tree , tvbuff_t * tvb , int offset , gboolean is_request , usb_trans_info_t * usb_trans_info _U_ , usb_conv_info_t * usb_conv_info _U_ ) {
if ( is_request ) {
proto_tree_add_item ( tree , hf_usb_ms_value , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset += 2 ;
proto_tree_add_item ( tree , hf_usb_ms_index , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset += 2 ;
proto_tree_add_item ( tree , hf_usb_ms_length , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
}
else {
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_cleanup ( void ) {
# if 1 test_unlink ( TEST_TARGET_FILE ) ;
test_unlink ( TEST_SOURCE_FILE ) ;
test_unlink ( TEST_DELTA_FILE ) ;
test_unlink ( TEST_RECON_FILE ) ;
test_unlink ( TEST_RECON2_FILE ) ;
test_unlink ( TEST_COPY_FILE ) ;
test_unlink ( TEST_NOPERM_FILE ) ;
# endif }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TocEntry * getTocEntryByDumpId ( ArchiveHandle * AH , DumpId id ) {
if ( AH -> tocsByDumpId == NULL ) buildTocEntryArrays ( AH ) ;
if ( id > 0 && id <= AH -> maxDumpId ) return AH -> tocsByDumpId [ id ] ;
return NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static __always_inline __u32 __be32_to_cpup ( const __be32 * p ) {
return __swab32p ( ( __u32 * ) p ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
char func_volatile ( Oid funcid ) {
HeapTuple tp ;
char result ;
tp = SearchSysCache1 ( PROCOID , ObjectIdGetDatum ( funcid ) ) ;
if ( ! HeapTupleIsValid ( tp ) ) elog ( ERROR , "cache lookup failed for function %u" , funcid ) ;
result = ( ( Form_pg_proc ) GETSTRUCT ( tp ) ) -> provolatile ;
ReleaseSysCache ( tp ) ;
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( DownloadExtensionTest , DownloadExtensionTest_SetShelfEnabled ) {
LoadExtension ( "downloads_split" ) ;
EXPECT_TRUE ( RunFunction ( new DownloadsSetShelfEnabledFunction ( ) , "[false]" ) ) ;
EXPECT_FALSE ( DownloadCoreServiceFactory : : GetForBrowserContext ( browser ( ) -> profile ( ) ) -> IsShelfEnabled ( ) ) ;
EXPECT_TRUE ( RunFunction ( new DownloadsSetShelfEnabledFunction ( ) , "[true]" ) ) ;
EXPECT_TRUE ( DownloadCoreServiceFactory : : GetForBrowserContext ( browser ( ) -> profile ( ) ) -> IsShelfEnabled ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void Type_NamedColor_Free ( struct _cms_typehandler_struct * self , void * Ptr ) {
cmsFreeNamedColorList ( ( cmsNAMEDCOLORLIST * ) Ptr ) ;
return ;
cmsUNUSED_PARAMETER ( self ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_AdmissionRejectReason ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 657 "./asn1/h225/h225.cnf" gint32 value ;
h225_packet_info * h225_pi ;
h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h225_AdmissionRejectReason , AdmissionRejectReason_choice , & value ) ;
if ( h225_pi != NULL ) {
h225_pi -> reason = value ;
}
return offset ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static Const * string_to_bytea_const ( const char * str , size_t str_len ) {
bytea * bstr = palloc ( VARHDRSZ + str_len ) ;
Datum conval ;
memcpy ( VARDATA ( bstr ) , str , str_len ) ;
SET_VARSIZE ( bstr , VARHDRSZ + str_len ) ;
conval = PointerGetDatum ( bstr ) ;
return makeConst ( BYTEAOID , - 1 , InvalidOid , - 1 , conval , false , false ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gpg_err_code_t octet_string_from_mpi ( unsigned char * * r_frame , void * space , gcry_mpi_t value , size_t nbytes ) {
gpg_err_code_t rc ;
size_t nframe , noff , n ;
unsigned char * frame ;
if ( ! r_frame == ! space ) return GPG_ERR_INV_ARG ;
if ( r_frame ) * r_frame = NULL ;
rc = gcry_err_code ( gcry_mpi_print ( GCRYMPI_FMT_USG , NULL , 0 , & nframe , value ) ) ;
if ( rc ) return rc ;
if ( nframe > nbytes ) return GPG_ERR_TOO_LARGE ;
noff = ( nframe < nbytes ) ? nbytes - nframe : 0 ;
n = nframe + noff ;
if ( space ) frame = space ;
else {
frame = mpi_is_secure ( value ) ? gcry_malloc_secure ( n ) : gcry_malloc ( n ) ;
if ( ! frame ) {
rc = gpg_err_code_from_syserror ( ) ;
return rc ;
}
}
if ( noff ) memset ( frame , 0 , noff ) ;
nframe += noff ;
rc = gcry_err_code ( gcry_mpi_print ( GCRYMPI_FMT_USG , frame + noff , nframe - noff , NULL , value ) ) ;
if ( rc ) {
gcry_free ( frame ) ;
return rc ;
}
if ( r_frame ) * r_frame = frame ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
MPI # ifdef M_DEBUG mpi_debug_copy ( MPI a , const char * info ) # else mpi_copy ( MPI a ) # endif {
int i ;
MPI b ;
if ( a && ( a -> flags & 4 ) ) {
void * p = m_is_secure ( a -> d ) ? xmalloc_secure ( a -> nbits ) : xmalloc ( a -> nbits ) ;
memcpy ( p , a -> d , a -> nbits ) ;
b = mpi_set_opaque ( NULL , p , a -> nbits ) ;
}
else if ( a ) {
# ifdef M_DEBUG b = mpi_is_secure ( a ) ? mpi_debug_alloc_secure ( a -> nlimbs , info ) : mpi_debug_alloc ( a -> nlimbs , info ) ;
# else b = mpi_is_secure ( a ) ? mpi_alloc_secure ( a -> nlimbs ) : mpi_alloc ( a -> nlimbs ) ;
# endif b -> nlimbs = a -> nlimbs ;
b -> sign = a -> sign ;
b -> flags = a -> flags ;
b -> nbits = a -> nbits ;
for ( i = 0 ;
i < b -> nlimbs ;
i ++ ) b -> d [ i ] = a -> d [ i ] ;
}
else b = NULL ;
return b ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int vb_decode_framedata ( VBDecContext * c , int offset ) {
GetByteContext g ;
uint8_t * prev , * cur ;
int blk , blocks , t , blk2 ;
int blocktypes = 0 ;
int x , y , a , b ;
int pattype , pattern ;
const int width = c -> avctx -> width ;
uint8_t * pstart = c -> prev_frame ;
uint8_t * pend = c -> prev_frame + width * c -> avctx -> height ;
g = c -> stream ;
prev = c -> prev_frame + offset ;
cur = c -> frame ;
blocks = ( c -> avctx -> width >> 2 ) * ( c -> avctx -> height >> 2 ) ;
blk2 = 0 ;
for ( blk = 0 ;
blk < blocks ;
blk ++ ) {
if ( ! ( blk & 3 ) ) {
blocktypes = bytestream2_get_byte ( & g ) ;
}
switch ( blocktypes & 0xC0 ) {
case 0x00 : for ( y = 0 ;
y < 4 ;
y ++ ) if ( check_line ( prev + y * width , pstart , pend ) ) memcpy ( cur + y * width , prev + y * width , 4 ) ;
else memset ( cur + y * width , 0 , 4 ) ;
break ;
case 0x40 : t = bytestream2_get_byte ( & g ) ;
if ( ! t ) {
if ( bytestream2_get_bytes_left ( & g ) < 16 ) {
av_log ( c -> avctx , AV_LOG_ERROR , "Insufficient data\n" ) ;
return AVERROR_INVALIDDATA ;
}
for ( y = 0 ;
y < 4 ;
y ++ ) bytestream2_get_buffer ( & g , cur + y * width , 4 ) ;
}
else {
x = ( ( t & 0xF ) ^ 8 ) - 8 ;
y = ( ( t >> 4 ) ^ 8 ) - 8 ;
t = x + y * width ;
for ( y = 0 ;
y < 4 ;
y ++ ) if ( check_line ( prev + t + y * width , pstart , pend ) ) memcpy ( cur + y * width , prev + t + y * width , 4 ) ;
else memset ( cur + y * width , 0 , 4 ) ;
}
break ;
case 0x80 : t = bytestream2_get_byte ( & g ) ;
for ( y = 0 ;
y < 4 ;
y ++ ) memset ( cur + y * width , t , 4 ) ;
break ;
case 0xC0 : t = bytestream2_get_byte ( & g ) ;
pattype = t >> 6 ;
pattern = vb_patterns [ t & 0x3F ] ;
switch ( pattype ) {
case 0 : a = bytestream2_get_byte ( & g ) ;
b = bytestream2_get_byte ( & g ) ;
for ( y = 0 ;
y < 4 ;
y ++ ) for ( x = 0 ;
x < 4 ;
x ++ , pattern >>= 1 ) cur [ x + y * width ] = ( pattern & 1 ) ? b : a ;
break ;
case 1 : pattern = ~ pattern ;
case 2 : a = bytestream2_get_byte ( & g ) ;
for ( y = 0 ;
y < 4 ;
y ++ ) for ( x = 0 ;
x < 4 ;
x ++ , pattern >>= 1 ) if ( pattern & 1 && check_pixel ( prev + x + y * width , pstart , pend ) ) cur [ x + y * width ] = prev [ x + y * width ] ;
else cur [ x + y * width ] = a ;
break ;
case 3 : av_log ( c -> avctx , AV_LOG_ERROR , "Invalid opcode seen @%d\n" , blk ) ;
return AVERROR_INVALIDDATA ;
}
break ;
}
blocktypes <<= 2 ;
cur += 4 ;
prev += 4 ;
blk2 ++ ;
if ( blk2 == ( width >> 2 ) ) {
blk2 = 0 ;
cur += width * 3 ;
prev += width * 3 ;
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static unsigned virtio_s390_get_features ( void * opaque ) {
VirtIOS390Device * dev = ( VirtIOS390Device * ) opaque ;
return dev -> host_features ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST ( AutocompleteMatchTest , MoreRelevant ) {
struct RelevantCases {
int r1 ;
int r2 ;
bool expected_result ;
}
cases [ ] = {
{
10 , 0 , true }
, {
10 , - 5 , true }
, {
- 5 , 10 , false }
, {
0 , 10 , false }
, {
- 10 , - 5 , false }
, {
- 5 , - 10 , true }
, }
;
AutocompleteMatch m1 ( NULL , 0 , false , AutocompleteMatchType : : URL_WHAT_YOU_TYPED ) ;
AutocompleteMatch m2 ( NULL , 0 , false , AutocompleteMatchType : : URL_WHAT_YOU_TYPED ) ;
for ( size_t i = 0 ;
i < arraysize ( cases ) ;
++ i ) {
m1 . relevance = cases [ i ] . r1 ;
m2 . relevance = cases [ i ] . r2 ;
EXPECT_EQ ( cases [ i ] . expected_result , AutocompleteMatch : : MoreRelevant ( m1 , m2 ) ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_cabac_p_mb_sub_type ( H264Context * h ) {
if ( get_cabac ( & h -> cabac , & h -> cabac_state [ 21 ] ) ) return 0 ;
if ( ! get_cabac ( & h -> cabac , & h -> cabac_state [ 22 ] ) ) return 1 ;
if ( get_cabac ( & h -> cabac , & h -> cabac_state [ 23 ] ) ) return 2 ;
return 3 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int test_gf2m_add ( BIO * bp ) {
BIGNUM a , b , c ;
int i , ret = 0 ;
BN_init ( & a ) ;
BN_init ( & b ) ;
BN_init ( & c ) ;
for ( i = 0 ;
i < num0 ;
i ++ ) {
BN_rand ( & a , 512 , 0 , 0 ) ;
BN_copy ( & b , BN_value_one ( ) ) ;
a . neg = rand_neg ( ) ;
b . neg = rand_neg ( ) ;
BN_GF2m_add ( & c , & a , & b ) ;
# if 0 if ( bp != NULL ) {
if ( ! results ) {
BN_print ( bp , & a ) ;
BIO_puts ( bp , " ^ " ) ;
BN_print ( bp , & b ) ;
BIO_puts ( bp , " = " ) ;
}
BN_print ( bp , & c ) ;
BIO_puts ( bp , "\n" ) ;
}
# endif if ( ( BN_is_odd ( & a ) && BN_is_odd ( & c ) ) || ( ! BN_is_odd ( & a ) && ! BN_is_odd ( & c ) ) ) {
fprintf ( stderr , "GF(2^m) addition test (a) failed!\n" ) ;
goto err ;
}
BN_GF2m_add ( & c , & c , & c ) ;
if ( ! BN_is_zero ( & c ) ) {
fprintf ( stderr , "GF(2^m) addition test (b) failed!\n" ) ;
goto err ;
}
}
ret = 1 ;
err : BN_free ( & a ) ;
BN_free ( & b ) ;
BN_free ( & c ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int cinaudio_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) {
AVFrame * frame = data ;
const uint8_t * buf = avpkt -> data ;
CinAudioContext * cin = avctx -> priv_data ;
const uint8_t * buf_end = buf + avpkt -> size ;
int16_t * samples ;
int delta , ret ;
frame -> nb_samples = avpkt -> size - cin -> initial_decode_frame ;
if ( ( ret = ff_get_buffer ( avctx , frame ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
samples = ( int16_t * ) frame -> data [ 0 ] ;
delta = cin -> delta ;
if ( cin -> initial_decode_frame ) {
cin -> initial_decode_frame = 0 ;
delta = sign_extend ( AV_RL16 ( buf ) , 16 ) ;
buf += 2 ;
* samples ++ = delta ;
}
while ( buf < buf_end ) {
delta += cinaudio_delta16_table [ * buf ++ ] ;
delta = av_clip_int16 ( delta ) ;
* samples ++ = delta ;
}
cin -> delta = delta ;
* got_frame_ptr = 1 ;
return avpkt -> size ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ref_frame ( Vp3DecodeContext * s , ThreadFrame * dst , ThreadFrame * src ) {
ff_thread_release_buffer ( s -> avctx , dst ) ;
if ( src -> f -> data [ 0 ] ) return ff_thread_ref_frame ( dst , src ) ;
return 0 ;
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.