instruction
stringclasses 1
value | input
stringlengths 31
235k
| output
class label 2
classes |
---|---|---|
Categorize the following code snippet as vulnerable or not. True or False
|
static void _doSetSessionAuth ( ArchiveHandle * AH , const char * user ) {
PQExpBuffer cmd = createPQExpBuffer ( ) ;
appendPQExpBufferStr ( cmd , "SET SESSION AUTHORIZATION " ) ;
if ( user && * user ) appendStringLiteralAHX ( cmd , user , AH ) ;
else appendPQExpBufferStr ( cmd , "DEFAULT" ) ;
appendPQExpBufferChar ( cmd , ';
' ) ;
if ( RestoringToDB ( AH ) ) {
PGresult * res ;
res = PQexec ( AH -> connection , cmd -> data ) ;
if ( ! res || PQresultStatus ( res ) != PGRES_COMMAND_OK ) exit_horribly ( modulename , "could not set session user to \"%s\": %s" , user , PQerrorMessage ( AH -> connection ) ) ;
PQclear ( res ) ;
}
else ahprintf ( AH , "%s\n\n" , cmd -> data ) ;
destroyPQExpBuffer ( cmd ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
jas_image_t * jas_image_copy ( jas_image_t * image ) {
jas_image_t * newimage ;
int cmptno ;
newimage = jas_image_create0 ( ) ;
if ( jas_image_growcmpts ( newimage , image -> numcmpts_ ) ) {
goto error ;
}
for ( cmptno = 0 ;
cmptno < image -> numcmpts_ ;
++ cmptno ) {
if ( ! ( newimage -> cmpts_ [ cmptno ] = jas_image_cmpt_copy ( image -> cmpts_ [ cmptno ] ) ) ) {
goto error ;
}
++ newimage -> numcmpts_ ;
}
jas_image_setbbox ( newimage ) ;
if ( image -> cmprof_ ) {
if ( ! ( newimage -> cmprof_ = jas_cmprof_copy ( image -> cmprof_ ) ) ) goto error ;
}
return newimage ;
error : if ( newimage ) {
jas_image_destroy ( newimage ) ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int print_unknown_data ( netdissect_options * ndo , const u_char * cp , const char * ident , int len ) {
if ( len < 0 ) {
ND_PRINT ( ( ndo , "%sDissector error: print_unknown_data called with negative length" , ident ) ) ;
return ( 0 ) ;
}
if ( ndo -> ndo_snapend - cp < len ) len = ndo -> ndo_snapend - cp ;
if ( len < 0 ) {
ND_PRINT ( ( ndo , "%sDissector error: print_unknown_data called with pointer past end of packet" , ident ) ) ;
return ( 0 ) ;
}
hex_print ( ndo , ident , cp , len ) ;
return ( 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void sbr_turnoff ( SpectralBandReplication * sbr ) {
sbr -> start = 0 ;
sbr -> kx [ 1 ] = 32 ;
sbr -> m [ 1 ] = 0 ;
sbr -> data [ 0 ] . e_a [ 1 ] = sbr -> data [ 1 ] . e_a [ 1 ] = - 1 ;
memset ( & sbr -> spectrum_params , - 1 , sizeof ( SpectrumParameters ) ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void nautilus_file_operations_empty_trash ( GtkWidget * parent_view ) {
GTask * task ;
EmptyTrashJob * job ;
GtkWindow * parent_window ;
parent_window = NULL ;
if ( parent_view ) {
parent_window = ( GtkWindow * ) gtk_widget_get_ancestor ( parent_view , GTK_TYPE_WINDOW ) ;
}
job = op_job_new ( EmptyTrashJob , parent_window ) ;
job -> trash_dirs = g_list_prepend ( job -> trash_dirs , g_file_new_for_uri ( "trash:" ) ) ;
job -> should_confirm = TRUE ;
inhibit_power_manager ( ( CommonJob * ) job , _ ( "Emptying Trash" ) ) ;
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 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
unsigned int vp9_sad ## m ## x ## n ## _avg_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , const uint8_t * second_pred ) {
uint8_t comp_pred [ m * n ] ;
vp9_comp_avg_pred ( comp_pred , second_pred , m , n , ref , ref_stride ) ;
return sad ( src , src_stride , comp_pred , m , m , n ) ;
\ }
# define sadMxNxK ( m , n , k ) void vp9_sad ## m ## x ## n ## x ## k ## _c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < k ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , & ref [ i ] , ref_stride ) ;
\ }
# define sadMxNx4D ( m , n ) void vp9_sad ## m ## x ## n ## x4d_c ( const uint8_t * src , int src_stride , const uint8_t * const refs [ ] , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < 4 ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , refs [ i ] , ref_stride ) ;
\ }
sadMxN ( 64 , 64 ) sadMxNxK ( 64 , 64 , 3 ) sadMxNxK ( 64 , 64 , 8 ) sadMxNx4D ( 64 , 64 ) sadMxN ( 64 , 32 ) sadMxNx4D ( 64 , 32 ) sadMxN ( 32 , 64 ) sadMxNx4D ( 32 , 64 ) sadMxN ( 32 , 32 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
mbfl_string * mbfl_buffer_converter_result ( mbfl_buffer_converter * convd , mbfl_string * result ) {
if ( convd == NULL || result == NULL ) {
return NULL ;
}
result -> no_encoding = convd -> to -> no_encoding ;
return mbfl_memory_device_result ( & convd -> device , result ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void xml_start_tag ( void * userData , const char * name , const char * * atts ) {
struct xml_ctx * ctx = ( struct xml_ctx * ) userData ;
const char * c = strchr ( name , ':' ) ;
int old_namelen , new_len ;
if ( c == NULL ) c = name ;
else c ++ ;
old_namelen = strlen ( ctx -> name ) ;
new_len = old_namelen + strlen ( c ) + 2 ;
if ( new_len > ctx -> len ) {
ctx -> name = xrealloc ( ctx -> name , new_len ) ;
ctx -> len = new_len ;
}
xsnprintf ( ctx -> name + old_namelen , ctx -> len - old_namelen , ".%s" , c ) ;
free ( ctx -> cdata ) ;
ctx -> cdata = NULL ;
ctx -> userFunc ( ctx , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void report_clusters_compatible ( void ) {
if ( user_opts . check ) {
pg_log ( PG_REPORT , "\n*Clusters are compatible*\n" ) ;
stop_postmaster ( false ) ;
exit ( 0 ) ;
}
pg_log ( PG_REPORT , "\n" "If pg_upgrade fails after this point, you must re-initdb the\n" "new cluster before continuing.\n" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
jpc_pchg_t * jpc_pchglist_remove ( jpc_pchglist_t * pchglist , int pchgno ) {
int i ;
jpc_pchg_t * pchg ;
assert ( pchgno < pchglist -> numpchgs ) ;
pchg = pchglist -> pchgs [ pchgno ] ;
for ( i = pchgno + 1 ;
i < pchglist -> numpchgs ;
++ i ) {
pchglist -> pchgs [ i - 1 ] = pchglist -> pchgs [ i ] ;
}
-- pchglist -> numpchgs ;
return pchg ;
}
| 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 ) {
AnsiContext * s = avctx -> priv_data ;
uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
const uint8_t * buf_end = buf + buf_size ;
int ret , i , count ;
ret = ff_reget_buffer ( avctx , s -> frame ) ;
if ( ret < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
if ( ! avctx -> frame_number ) {
memset ( s -> frame -> data [ 0 ] , 0 , avctx -> height * FFABS ( s -> frame -> linesize [ 0 ] ) ) ;
memset ( s -> frame -> data [ 1 ] , 0 , AVPALETTE_SIZE ) ;
}
s -> frame -> pict_type = AV_PICTURE_TYPE_I ;
s -> frame -> palette_has_changed = 1 ;
memcpy ( s -> frame -> data [ 1 ] , ff_cga_palette , 16 * 4 ) ;
while ( buf < buf_end ) {
switch ( s -> state ) {
case STATE_NORMAL : switch ( buf [ 0 ] ) {
case 0x00 : case 0x07 : case 0x1A : break ;
case 0x08 : s -> x = FFMAX ( s -> x - 1 , 0 ) ;
break ;
case 0x09 : i = s -> x / FONT_WIDTH ;
count = ( ( i + 8 ) & ~ 7 ) - i ;
for ( i = 0 ;
i < count ;
i ++ ) draw_char ( avctx , ' ' ) ;
break ;
case 0x0A : hscroll ( avctx ) ;
case 0x0D : s -> x = 0 ;
break ;
case 0x0C : erase_screen ( avctx ) ;
break ;
case 0x1B : s -> state = STATE_ESCAPE ;
break ;
default : draw_char ( avctx , buf [ 0 ] ) ;
}
break ;
case STATE_ESCAPE : if ( buf [ 0 ] == '[' ) {
s -> state = STATE_CODE ;
s -> nb_args = 0 ;
s -> args [ 0 ] = 0 ;
}
else {
s -> state = STATE_NORMAL ;
draw_char ( avctx , 0x1B ) ;
continue ;
}
break ;
case STATE_CODE : switch ( buf [ 0 ] ) {
case '0' : case '1' : case '2' : case '3' : case '4' : case '5' : case '6' : case '7' : case '8' : case '9' : if ( s -> nb_args < MAX_NB_ARGS ) s -> args [ s -> nb_args ] = s -> args [ s -> nb_args ] * 10 + buf [ 0 ] - '0' ;
break ;
case ';
' : s -> nb_args ++ ;
if ( s -> nb_args < MAX_NB_ARGS ) s -> args [ s -> nb_args ] = 0 ;
break ;
case 'M' : s -> state = STATE_MUSIC_PREAMBLE ;
break ;
case '=' : case '?' : break ;
default : if ( s -> nb_args > MAX_NB_ARGS ) av_log ( avctx , AV_LOG_WARNING , "args overflow (%i)\n" , s -> nb_args ) ;
if ( s -> nb_args < MAX_NB_ARGS && s -> args [ s -> nb_args ] ) s -> nb_args ++ ;
if ( ( ret = execute_code ( avctx , buf [ 0 ] ) ) < 0 ) return ret ;
s -> state = STATE_NORMAL ;
}
break ;
case STATE_MUSIC_PREAMBLE : if ( buf [ 0 ] == 0x0E || buf [ 0 ] == 0x1B ) s -> state = STATE_NORMAL ;
break ;
}
buf ++ ;
}
* got_frame = 1 ;
if ( ( ret = av_frame_ref ( data , s -> frame ) ) < 0 ) return ret ;
return buf_size ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static GstFlowReturn gst_asf_demux_chain ( GstPad * pad , GstObject * parent , GstBuffer * buf ) {
GstFlowReturn ret = GST_FLOW_OK ;
GstASFDemux * demux ;
demux = GST_ASF_DEMUX ( parent ) ;
GST_LOG_OBJECT ( demux , "buffer: size=%" G_GSIZE_FORMAT ", offset=%" G_GINT64_FORMAT ", time=%" GST_TIME_FORMAT , gst_buffer_get_size ( buf ) , GST_BUFFER_OFFSET ( buf ) , GST_TIME_ARGS ( GST_BUFFER_TIMESTAMP ( buf ) ) ) ;
if ( G_UNLIKELY ( GST_BUFFER_IS_DISCONT ( buf ) ) ) {
GST_DEBUG_OBJECT ( demux , "received DISCONT" ) ;
gst_asf_demux_mark_discont ( demux ) ;
}
if ( G_UNLIKELY ( ( ! GST_CLOCK_TIME_IS_VALID ( demux -> in_gap ) && GST_BUFFER_TIMESTAMP_IS_VALID ( buf ) ) ) ) {
demux -> in_gap = GST_BUFFER_TIMESTAMP ( buf ) - demux -> in_segment . start ;
GST_DEBUG_OBJECT ( demux , "upstream segment start %" GST_TIME_FORMAT ", interpolation gap: %" GST_TIME_FORMAT , GST_TIME_ARGS ( demux -> in_segment . start ) , GST_TIME_ARGS ( demux -> in_gap ) ) ;
}
gst_adapter_push ( demux -> adapter , buf ) ;
switch ( demux -> state ) {
case GST_ASF_DEMUX_STATE_INDEX : {
gint result = gst_asf_demux_check_header ( demux ) ;
if ( result == GST_ASF_DEMUX_CHECK_HEADER_NEED_DATA ) break ;
if ( result == GST_ASF_DEMUX_CHECK_HEADER_NO ) {
GST_LOG_OBJECT ( demux , "Received index object, its EOS" ) ;
goto eos ;
}
else {
GST_INFO_OBJECT ( demux , "Chained asf starting" ) ;
gst_asf_demux_reset ( demux , TRUE ) ;
}
}
case GST_ASF_DEMUX_STATE_HEADER : {
ret = gst_asf_demux_chain_headers ( demux ) ;
if ( demux -> state != GST_ASF_DEMUX_STATE_DATA ) break ;
}
case GST_ASF_DEMUX_STATE_DATA : {
guint64 data_size ;
data_size = demux -> packet_size ;
while ( gst_adapter_available ( demux -> adapter ) >= data_size ) {
GstBuffer * buf ;
GstAsfDemuxParsePacketError err ;
if ( demux -> num_packets == 0 ) {
gint result = gst_asf_demux_check_header ( demux ) ;
if ( result == GST_ASF_DEMUX_CHECK_HEADER_YES ) {
GST_INFO_OBJECT ( demux , "Chained asf starting" ) ;
gst_asf_demux_reset ( demux , TRUE ) ;
break ;
}
}
else if ( G_UNLIKELY ( demux -> num_packets != 0 && demux -> packet >= 0 && demux -> packet >= demux -> num_packets ) ) {
break ;
}
buf = gst_adapter_take_buffer ( demux -> adapter , data_size ) ;
err = gst_asf_demux_parse_packet ( demux , buf ) ;
gst_buffer_unref ( buf ) ;
if ( G_LIKELY ( err == GST_ASF_DEMUX_PARSE_PACKET_ERROR_NONE ) ) ret = gst_asf_demux_push_complete_payloads ( demux , FALSE ) ;
else GST_WARNING_OBJECT ( demux , "Parse error" ) ;
if ( demux -> packet >= 0 ) ++ demux -> packet ;
}
if ( G_UNLIKELY ( demux -> num_packets != 0 && demux -> packet >= 0 && demux -> packet >= demux -> num_packets ) ) {
demux -> state = GST_ASF_DEMUX_STATE_INDEX ;
}
break ;
}
default : g_assert_not_reached ( ) ;
}
done : if ( ret != GST_FLOW_OK ) GST_DEBUG_OBJECT ( demux , "flow: %s" , gst_flow_get_name ( ret ) ) ;
return ret ;
eos : {
GST_DEBUG_OBJECT ( demux , "Handled last packet, setting EOS" ) ;
ret = GST_FLOW_EOS ;
goto done ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static subpicture_t * DecodeBlock ( decoder_t * p_dec , block_t * * pp_block ) {
subpicture_t * p_spu ;
block_t * p_block ;
if ( ! pp_block || * pp_block == NULL ) return NULL ;
p_block = * pp_block ;
if ( p_block -> i_flags & ( BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED ) ) {
block_Release ( p_block ) ;
return NULL ;
}
p_spu = ParseText ( p_dec , p_block ) ;
block_Release ( p_block ) ;
* pp_block = NULL ;
return p_spu ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void version ( struct parse * pcmd , FILE * fp ) {
( void ) fprintf ( fp , "%s\n" , Version ) ;
return ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void prepare_vacuum_command ( PQExpBuffer sql , PGconn * conn , vacuumingOptions * vacopts , const char * table ) {
resetPQExpBuffer ( sql ) ;
if ( vacopts -> analyze_only ) {
appendPQExpBufferStr ( sql , "ANALYZE" ) ;
if ( vacopts -> verbose ) appendPQExpBufferStr ( sql , " VERBOSE" ) ;
}
else {
appendPQExpBufferStr ( sql , "VACUUM" ) ;
if ( PQserverVersion ( conn ) >= 90000 ) {
const char * paren = " (" ;
const char * comma = ", " ;
const char * sep = paren ;
if ( vacopts -> full ) {
appendPQExpBuffer ( sql , "%sFULL" , sep ) ;
sep = comma ;
}
if ( vacopts -> freeze ) {
appendPQExpBuffer ( sql , "%sFREEZE" , sep ) ;
sep = comma ;
}
if ( vacopts -> verbose ) {
appendPQExpBuffer ( sql , "%sVERBOSE" , sep ) ;
sep = comma ;
}
if ( vacopts -> and_analyze ) {
appendPQExpBuffer ( sql , "%sANALYZE" , sep ) ;
sep = comma ;
}
if ( sep != paren ) appendPQExpBufferChar ( sql , ')' ) ;
}
else {
if ( vacopts -> full ) appendPQExpBufferStr ( sql , " FULL" ) ;
if ( vacopts -> freeze ) appendPQExpBufferStr ( sql , " FREEZE" ) ;
if ( vacopts -> verbose ) appendPQExpBufferStr ( sql , " VERBOSE" ) ;
if ( vacopts -> and_analyze ) appendPQExpBufferStr ( sql , " ANALYZE" ) ;
}
}
if ( table ) appendPQExpBuffer ( sql , " %s" , table ) ;
appendPQExpBufferChar ( sql , ';
' ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int match_re ( my_regex_t * re , char * str ) {
while ( my_isspace ( charset_info , * str ) ) str ++ ;
if ( str [ 0 ] == '/' && str [ 1 ] == '*' ) {
char * comm_end = strstr ( str , "*/" ) ;
if ( ! comm_end ) die ( "Statement is unterminated comment" ) ;
str = comm_end + 2 ;
}
int err = my_regexec ( re , str , ( size_t ) 0 , NULL , 0 ) ;
if ( err == 0 ) return 1 ;
else if ( err == REG_NOMATCH ) return 0 ;
{
char erbuf [ 100 ] ;
int len = my_regerror ( err , re , erbuf , sizeof ( erbuf ) ) ;
die ( "error %s, %d/%d `%s'\n" , re_eprint ( err ) , ( int ) len , ( int ) sizeof ( erbuf ) , erbuf ) ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint32 dissect_netb_status_query ( tvbuff_t * tvb , packet_info * pinfo _U_ , int offset , proto_tree * tree ) {
guint8 status_request = tvb_get_guint8 ( tvb , offset + NB_DATA1 ) ;
switch ( status_request ) {
case 0 : proto_tree_add_uint_format_value ( tree , hf_netb_status_request , tvb , offset + NB_DATA1 , 1 , status_request , "NetBIOS 1.x or 2.0" ) ;
break ;
case 1 : proto_tree_add_uint_format_value ( tree , hf_netb_status_request , tvb , offset + NB_DATA1 , 1 , status_request , "NetBIOS 2.1, initial status request" ) ;
break ;
default : proto_tree_add_uint_format_value ( tree , hf_netb_status_request , tvb , offset + NB_DATA1 , 1 , status_request , "NetBIOS 2.1, %u names received so far" , status_request ) ;
break ;
}
nb_data2 ( hf_netb_status_buffer_len , tvb , offset , tree ) ;
nb_resp_corrl ( tvb , offset , tree ) ;
netbios_add_name ( "Receiver's Name" , tvb , offset + NB_RECVER_NAME , tree ) ;
netbios_add_name ( "Sender's Name" , tvb , offset + NB_SENDER_NAME , tree ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int isStdEncoding ( SplineFont * sf , EncMap * map ) {
int i ;
for ( i = 0 ;
i < 256 && i < map -> enccount ;
++ i ) if ( map -> map [ i ] != - 1 && sf -> glyphs [ map -> map [ i ] ] != NULL ) if ( sf -> glyphs [ map -> map [ i ] ] -> unicodeenc != - 1 ) if ( sf -> glyphs [ map -> map [ i ] ] -> unicodeenc != unicode_from_adobestd [ i ] ) return ( 0 ) ;
return ( 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint h225ras_call_hash ( gconstpointer k ) {
const h225ras_call_info_key * key = ( const h225ras_call_info_key * ) k ;
return key -> reqSeqNum + GPOINTER_TO_UINT ( key -> conversation ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
bool check_grant_all_columns ( THD * thd , ulong want_access_arg , Field_iterator_table_ref * fields ) {
Security_context * sctx = thd -> security_ctx ;
ulong want_access = want_access_arg ;
const char * table_name = NULL ;
const char * db_name ;
GRANT_INFO * grant ;
GRANT_TABLE * grant_table = NULL ;
bool using_column_privileges = FALSE ;
rw_rdlock ( & LOCK_grant ) ;
for ( ;
! fields -> end_of_fields ( ) ;
fields -> next ( ) ) {
const char * field_name = fields -> name ( ) ;
if ( table_name != fields -> get_table_name ( ) ) {
table_name = fields -> get_table_name ( ) ;
db_name = fields -> get_db_name ( ) ;
grant = fields -> grant ( ) ;
want_access = want_access_arg & ~ grant -> privilege ;
if ( want_access ) {
if ( grant -> version != grant_version ) {
grant -> grant_table = table_hash_search ( sctx -> host , sctx -> ip , db_name , sctx -> priv_user , table_name , 0 ) ;
grant -> version = grant_version ;
}
grant_table = grant -> grant_table ;
DBUG_ASSERT ( grant_table ) ;
}
}
if ( want_access ) {
GRANT_COLUMN * grant_column = column_hash_search ( grant_table , field_name , ( uint ) strlen ( field_name ) ) ;
if ( grant_column ) using_column_privileges = TRUE ;
if ( ! grant_column || ( ~ grant_column -> rights & want_access ) ) goto err ;
}
}
rw_unlock ( & LOCK_grant ) ;
return 0 ;
err : rw_unlock ( & LOCK_grant ) ;
char command [ 128 ] ;
get_privilege_desc ( command , sizeof ( command ) , want_access ) ;
if ( using_column_privileges ) my_error ( ER_TABLEACCESS_DENIED_ERROR , MYF ( 0 ) , command , sctx -> priv_user , sctx -> host_or_ip , table_name ) ;
else my_error ( ER_COLUMNACCESS_DENIED_ERROR , MYF ( 0 ) , command , sctx -> priv_user , sctx -> host_or_ip , fields -> name ( ) , table_name ) ;
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_init_intra_predictors ( ) {
# define INIT_ALL_SIZES ( p , type ) p [ TX_4X4 ] = vp9_ ## type ## _predictor_4x4 ;
p [ TX_8X8 ] = vp9_ ## type ## _predictor_8x8 ;
p [ TX_16X16 ] = vp9_ ## type ## _predictor_16x16 ;
p [ TX_32X32 ] = vp9_ ## type ## _predictor_32x32 INIT_ALL_SIZES ( pred [ V_PRED ] , v ) ;
INIT_ALL_SIZES ( pred [ H_PRED ] , h ) ;
INIT_ALL_SIZES ( pred [ D207_PRED ] , d207 ) ;
INIT_ALL_SIZES ( pred [ D45_PRED ] , d45 ) ;
INIT_ALL_SIZES ( pred [ D63_PRED ] , d63 ) ;
INIT_ALL_SIZES ( pred [ D117_PRED ] , d117 ) ;
INIT_ALL_SIZES ( pred [ D135_PRED ] , d135 ) ;
INIT_ALL_SIZES ( pred [ D153_PRED ] , d153 ) ;
INIT_ALL_SIZES ( pred [ TM_PRED ] , tm ) ;
INIT_ALL_SIZES ( dc_pred [ 0 ] [ 0 ] , dc_128 ) ;
INIT_ALL_SIZES ( dc_pred [ 0 ] [ 1 ] , dc_top ) ;
INIT_ALL_SIZES ( dc_pred [ 1 ] [ 0 ] , dc_left ) ;
INIT_ALL_SIZES ( dc_pred [ 1 ] [ 1 ] , dc ) ;
# undef INIT_ALL_SIZES }
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
guint16 de_bearer_cap ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len , gchar * add_string , int string_len ) {
guint8 oct ;
guint8 itc ;
gboolean extended ;
guint32 curr_offset ;
guint32 saved_offset ;
proto_tree * subtree ;
proto_item * item ;
const gchar * str ;
# define DE_BC_ITC_SPEECH 0x00 # define DE_BC_ITC_UDI 0x01 # define DE_BC_ITC_EX_PLMN 0x02 # define DE_BC_ITC_FASC_G3 0x03 # define DE_BC_ITC_OTHER_ITC 0x05 # define DE_BC_ITC_RSVD_NET 0x07 curr_offset = offset ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_3 , NULL , "Octet 3" ) ;
extended = ( oct & 0x80 ) ? FALSE : TRUE ;
itc = oct & 0x07 ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
switch ( is_uplink ) {
case IS_UPLINK_FALSE : str = "Spare" ;
break ;
case IS_UPLINK_TRUE : switch ( itc ) {
case DE_BC_ITC_SPEECH : if ( extended ) {
switch ( ( oct & 0x60 ) >> 5 ) {
case 1 : str = "MS supports at least full rate speech version 1 but does not support half rate speech version 1" ;
break ;
case 2 : str = "MS supports at least full rate speech version 1 and half rate speech version 1. MS has a greater preference for half rate speech version 1 than for full rate speech version 1" ;
break ;
case 3 : str = "MS supports at least full rate speech version 1 and half rate speech version 1. MS has a greater preference for full rate speech version 1 than for half rate speech version 1" ;
break ;
default : str = "Reserved" ;
break ;
}
}
else {
switch ( ( oct & 0x60 ) >> 5 ) {
case 1 : str = "Full rate support only MS/fullrate speech version 1 supported" ;
break ;
case 2 : str = "Dual rate support MS/half rate speech version 1 preferred, full rate speech version 1 also supported" ;
break ;
case 3 : str = "Dual rate support MS/full rate speech version 1 preferred, half rate speech version 1 also supported" ;
break ;
default : str = "Reserved" ;
break ;
}
}
break ;
default : switch ( ( oct & 0x60 ) >> 5 ) {
case 1 : str = "Full rate support only MS" ;
break ;
case 2 : str = "Dual rate support MS/half rate preferred" ;
break ;
case 3 : str = "Dual rate support MS/full rate preferred" ;
break ;
default : str = "Reserved" ;
break ;
}
break ;
}
break ;
default : str = "(dissect problem)" ;
break ;
}
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_radio_channel_requirement , tvb , curr_offset , 1 , oct , "%s" , str ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_bearer_cap_coding_standard , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_transfer_mode , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_itc , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
if ( add_string ) g_snprintf ( add_string , string_len , " - (%s)" , str ) ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
switch ( itc ) {
case DE_BC_ITC_SPEECH : subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , - 1 , ett_bc_oct_3a , & item , "Octets 3a - Speech Versions" ) ;
saved_offset = curr_offset ;
do {
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
extended = ( oct & 0x80 ) ? FALSE : TRUE ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_coding , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_bits_item ( subtree , hf_gsm_a_spare_bits , tvb , ( curr_offset << 3 ) + 2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_speech_vers_ind , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
curr_offset ++ ;
}
while ( extended && ( ( len - ( curr_offset - offset ) ) > 0 ) ) ;
proto_item_set_len ( item , curr_offset - saved_offset ) ;
break ;
default : subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_4 , NULL , "Octet 4" ) ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , is_uplink ? hf_gsm_a_dtap_compression_up : hf_gsm_a_dtap_compression , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_structure , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_duplex_mode , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_configuration , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_nirr , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_establishment , tvb , curr_offset , 1 , ENC_NA ) ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_5 , NULL , "Octet 5" ) ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
extended = ( oct & 0x80 ) ? FALSE : TRUE ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_access_identity , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_rate_adaption , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_signalling_access_protocol , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
if ( ! extended ) goto bc_octet_6 ;
subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_5a , NULL , "Octet 5a" ) ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
extended = ( oct & 0x80 ) ? FALSE : TRUE ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_other_itc , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_other_rate_adaption , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_bits_item ( tree , hf_gsm_a_spare_bits , tvb , ( curr_offset << 3 ) + 5 , 3 , ENC_BIG_ENDIAN ) ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
if ( ! extended ) goto bc_octet_6 ;
subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_5b , NULL , "Octet 5b" ) ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_rate_adaption_header , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_multiple_frame_establishment_support , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_mode_of_operation , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_logical_link_identifier_negotiation , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_assignor_assignee , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_in_out_band , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_bits_item ( tree , hf_gsm_a_spare_bits , tvb , ( curr_offset << 3 ) + 7 , 1 , ENC_BIG_ENDIAN ) ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
bc_octet_6 : subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_6 , NULL , "Octet 6" ) ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
extended = ( oct & 0x80 ) ? FALSE : TRUE ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_layer_1_identity , tvb , curr_offset , 1 , oct , "%s" , ( ( oct & 0x60 ) == 0x20 ) ? "Octet identifier" : "Reserved" ) ;
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_user_information_layer_1_protocol , tvb , curr_offset , 1 , oct , "%s" , ( oct & 0x1e ) ? "Reserved" : "Default layer 1 protocol" ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_synchronous , tvb , curr_offset , 1 , ENC_NA ) ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
if ( ! extended ) goto bc_octet_7 ;
subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_6a , NULL , "Octet 6a" ) ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
extended = ( oct & 0x80 ) ? FALSE : TRUE ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_number_of_stop_bits , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_negotiation , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_number_of_data_bits , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_user_rate , tvb , curr_offset , 1 , oct , "%s" , val_to_str_const ( oct & 0xF , gsm_a_dtap_user_rate_vals , "Reserved" ) ) ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
if ( ! extended ) goto bc_octet_7 ;
subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_6b , NULL , "Octet 6b" ) ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
extended = ( oct & 0x80 ) ? FALSE : TRUE ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_v110_x30_rate_adaptation , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_nic_on_tx , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_nic_on_rx , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_parity_information , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
if ( ! extended ) goto bc_octet_7 ;
subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_6c , NULL , "Octet 6c" ) ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
extended = ( oct & 0x80 ) ? FALSE : TRUE ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_connection_element , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_modem_type , tvb , curr_offset , 1 , oct , "%s" , val_to_str_const ( oct & 0x1f , gsm_a_dtap_modem_type_vals , "Reserved" ) ) ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
if ( ! extended ) goto bc_octet_7 ;
subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_6d , NULL , "Octet 6d" ) ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
extended = ( oct & 0x80 ) ? FALSE : TRUE ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_other_modem_type , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_fixed_network_user_rate , tvb , curr_offset , 1 , oct , "%s" , val_to_str_const ( oct & 0x1f , gsm_a_dtap_fixed_network_user_rate_vals , "Reserved" ) ) ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
if ( ! extended ) goto bc_octet_7 ;
subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_6e , NULL , "Octet 6e" ) ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
extended = ( oct & 0x80 ) ? FALSE : TRUE ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
if ( is_uplink == IS_UPLINK_TRUE ) {
proto_tree_add_item ( subtree , hf_gsm_a_dtap_acceptable_channel_codings_TCH_F14_4 , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_acceptable_channel_codings_spare20 , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_acceptable_channel_codings_TCH_F9_6 , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_acceptable_channel_codings_TCH_F4_8 , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_maximum_number_of_traffic_channels , tvb , curr_offset , 1 , ( oct & 0x07 ) + 1 , "%u TCH" , ( oct & 0x07 ) + 1 ) ;
}
else {
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_acceptable_channel_codings_spare78 , tvb , curr_offset , 1 , oct , "Spare" ) ;
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_maximum_number_of_traffic_channels , tvb , curr_offset , 1 , oct , "Spare" ) ;
}
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
if ( ! extended ) goto bc_octet_7 ;
subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_6f , NULL , "Octet 6f" ) ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
extended = ( oct & 0x80 ) ? FALSE : TRUE ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_uimi , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
if ( is_uplink == IS_UPLINK_TRUE ) {
proto_tree_add_item ( subtree , hf_gsm_a_dtap_wanted_air_interface_user_rate , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
}
else {
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_wanted_air_interface_user_rate , tvb , curr_offset , 1 , oct , "Spare" ) ;
}
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
if ( ! extended ) goto bc_octet_7 ;
subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_6g , NULL , "Octet 6g" ) ;
oct = tvb_get_guint8 ( tvb , curr_offset ) ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
if ( is_uplink == IS_UPLINK_TRUE ) {
proto_tree_add_item ( subtree , hf_gsm_a_dtap_acceptable_channel_codings_ext_TCH_F28_8 , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_acceptable_channel_codings_ext_TCH_F32_0 , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_acceptable_channel_codings_ext_TCH_F43_2 , tvb , curr_offset , 1 , ENC_NA ) ;
proto_tree_add_item ( subtree , hf_gsm_a_dtap_channel_coding_asymmetry_indication , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
}
else {
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_edge_channel_codings , tvb , curr_offset , 1 , oct , "Spare" ) ;
}
proto_tree_add_bits_item ( tree , hf_gsm_a_spare_bits , tvb , ( curr_offset << 3 ) + 6 , 2 , ENC_BIG_ENDIAN ) ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
bc_octet_7 : subtree = proto_tree_add_subtree ( tree , tvb , curr_offset , 1 , ett_bc_oct_7 , NULL , "Octet 7" ) ;
proto_tree_add_item ( subtree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_layer_2_identity , tvb , curr_offset , 1 , oct , "%s" , ( ( oct & 0x60 ) == 0x40 ) ? "Octet identifier" : "Reserved" ) ;
proto_tree_add_uint_format_value ( subtree , hf_gsm_a_dtap_user_information_layer_2_protocol , tvb , curr_offset , 1 , oct , "%s" , val_to_str_const ( oct & 0x1F , gsm_a_dtap_user_info_layer2_vals , "Reserved" ) ) ;
break ;
}
EXTRANEOUS_DATA_CHECK ( len , curr_offset - offset , pinfo , & ei_gsm_a_dtap_extraneous_data ) ;
return ( curr_offset - offset ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( PrefsFunctionalTest , TestSessionRestoreShowBookmarkBar ) {
EXPECT_FALSE ( browser ( ) -> profile ( ) -> GetPrefs ( ) -> GetBoolean ( bookmarks : : prefs : : kShowBookmarkBar ) ) ;
browser ( ) -> profile ( ) -> GetPrefs ( ) -> SetBoolean ( bookmarks : : prefs : : kShowBookmarkBar , true ) ;
EXPECT_TRUE ( browser ( ) -> profile ( ) -> GetPrefs ( ) -> GetBoolean ( bookmarks : : prefs : : kShowBookmarkBar ) ) ;
EXPECT_TRUE ( browser ( ) -> profile ( ) -> GetPrefs ( ) -> GetBoolean ( bookmarks : : prefs : : kShowBookmarkBar ) ) ;
EXPECT_EQ ( BookmarkBar : : SHOW , browser ( ) -> bookmark_bar_state ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void run_query_normal ( struct st_connection * cn , struct st_command * command , int flags , char * query , int query_len , DYNAMIC_STRING * ds , DYNAMIC_STRING * ds_warnings ) {
MYSQL_RES * res = 0 ;
MYSQL * mysql = cn -> mysql ;
int err = 0 , counter = 0 ;
DBUG_ENTER ( "run_query_normal" ) ;
DBUG_PRINT ( "enter" , ( "flags: %d" , flags ) ) ;
DBUG_PRINT ( "enter" , ( "query: '%-.60s'" , query ) ) ;
if ( ! mysql ) {
handle_no_active_connection ( command , cn , ds ) ;
DBUG_VOID_RETURN ;
}
if ( flags & QUERY_SEND_FLAG ) {
if ( do_send_query ( cn , query , query_len ) ) {
handle_error ( command , mysql_errno ( mysql ) , mysql_error ( mysql ) , mysql_sqlstate ( mysql ) , ds ) ;
goto end ;
}
}
if ( ! ( flags & QUERY_REAP_FLAG ) ) {
cn -> pending = TRUE ;
DBUG_VOID_RETURN ;
}
do {
if ( ( counter == 0 ) && do_read_query_result ( cn ) ) {
cn -> pending = TRUE ;
handle_error ( command , mysql_errno ( mysql ) , mysql_error ( mysql ) , mysql_sqlstate ( mysql ) , ds ) ;
goto end ;
}
if ( mysql_field_count ( mysql ) && ( ( res = mysql_store_result ( mysql ) ) == 0 ) ) {
handle_error ( command , mysql_errno ( mysql ) , mysql_error ( mysql ) , mysql_sqlstate ( mysql ) , ds ) ;
goto end ;
}
if ( ! disable_result_log ) {
if ( res ) {
MYSQL_FIELD * fields = mysql_fetch_fields ( res ) ;
uint num_fields = mysql_num_fields ( res ) ;
if ( display_metadata ) append_metadata ( ds , fields , num_fields ) ;
if ( ! display_result_vertically ) append_table_headings ( ds , fields , num_fields ) ;
append_result ( ds , res ) ;
}
if ( ! disable_info ) append_info ( ds , mysql_affected_rows ( mysql ) , mysql_info ( mysql ) ) ;
if ( ! disable_warnings && ! mysql_more_results ( mysql ) ) {
if ( append_warnings ( ds_warnings , mysql ) || ds_warnings -> length ) {
dynstr_append_mem ( ds , "Warnings:\n" , 10 ) ;
dynstr_append_mem ( ds , ds_warnings -> str , ds_warnings -> length ) ;
}
}
}
if ( res ) {
mysql_free_result ( res ) ;
res = 0 ;
}
counter ++ ;
}
while ( ! ( err = mysql_next_result ( mysql ) ) ) ;
if ( err > 0 ) {
handle_error ( command , mysql_errno ( mysql ) , mysql_error ( mysql ) , mysql_sqlstate ( mysql ) , ds ) ;
goto end ;
}
DBUG_ASSERT ( err == - 1 ) ;
handle_no_error ( command ) ;
revert_properties ( ) ;
end : cn -> pending = FALSE ;
var_set_errno ( mysql_errno ( mysql ) ) ;
DBUG_VOID_RETURN ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dumpdbl ( FILE * cfff , double d ) {
if ( d - rint ( d ) > - .00001 && d - rint ( d ) < .00001 ) dumpint ( cfff , ( int ) d ) ;
else {
char buffer [ 20 ] , * pt ;
int sofar , n , odd ;
sprintf ( buffer , "%g" , d ) ;
sofar = 0 ;
odd = true ;
putc ( 30 , cfff ) ;
for ( pt = buffer ;
* pt ;
++ pt ) {
if ( isdigit ( * pt ) ) n = * pt - '0' ;
else if ( * pt == '.' ) n = 0xa ;
else if ( * pt == '-' ) n = 0xe ;
else if ( ( * pt == 'E' || * pt == 'e' ) && pt [ 1 ] == '-' ) {
n = 0xc ;
++ pt ;
}
else if ( * pt == 'E' || * pt == 'e' ) n = 0xb ;
else n = 0 ;
if ( odd ) {
sofar = n << 4 ;
odd = false ;
}
else {
putc ( sofar | n , cfff ) ;
sofar = 0 ;
odd = true ;
}
}
if ( sofar == 0 ) putc ( 0xff , cfff ) ;
else putc ( sofar | 0xf , cfff ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void gen_acb_excitation ( int16_t * vector , int16_t * prev_excitation , int pitch_lag , G723_1_Subframe * subfrm , enum Rate cur_rate ) {
int16_t residual [ SUBFRAME_LEN + PITCH_ORDER - 1 ] ;
const int16_t * cb_ptr ;
int lag = pitch_lag + subfrm -> ad_cb_lag - 1 ;
int i ;
int sum ;
get_residual ( residual , prev_excitation , lag ) ;
if ( cur_rate == RATE_6300 && pitch_lag < SUBFRAME_LEN - 2 ) cb_ptr = adaptive_cb_gain85 ;
else cb_ptr = adaptive_cb_gain170 ;
cb_ptr += subfrm -> ad_cb_gain * 20 ;
for ( i = 0 ;
i < SUBFRAME_LEN ;
i ++ ) {
sum = dot_product ( residual + i , cb_ptr , PITCH_ORDER ) ;
vector [ i ] = av_sat_dadd32 ( 1 << 15 , sum ) >> 16 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
const char * TSHttpHdrMethodGet ( TSMBuffer bufp , TSMLoc obj , int * length ) {
sdk_assert ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_http_hdr_handle ( obj ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) length ) == TS_SUCCESS ) ;
HTTPHdr h ;
SET_HTTP_HDR ( h , bufp , obj ) ;
return h . method_get ( length ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_T_excessiveError ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_T_excessiveError , T_excessiveError_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void run_request_queue ( void ) {
# ifdef USE_CURL_MULTI is_running_queue = 1 ;
fill_active_slots ( ) ;
add_fill_function ( NULL , fill_active_slot ) ;
# endif do {
finish_all_active_slots ( ) ;
# ifdef USE_CURL_MULTI fill_active_slots ( ) ;
# endif }
while ( request_queue_head && ! aborted ) ;
# ifdef USE_CURL_MULTI is_running_queue = 0 ;
# endif }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int validate_string ( WriterContext * wctx , char * * dstp , const char * src ) {
const uint8_t * p , * endp ;
AVBPrint dstbuf ;
int invalid_chars_nb = 0 , ret = 0 ;
av_bprint_init ( & dstbuf , 0 , AV_BPRINT_SIZE_UNLIMITED ) ;
endp = src + strlen ( src ) ;
for ( p = ( uint8_t * ) src ;
* p ;
) {
uint32_t code ;
int invalid = 0 ;
const uint8_t * p0 = p ;
if ( av_utf8_decode ( & code , & p , endp , wctx -> string_validation_utf8_flags ) < 0 ) {
AVBPrint bp ;
av_bprint_init ( & bp , 0 , AV_BPRINT_SIZE_AUTOMATIC ) ;
bprint_bytes ( & bp , p0 , p - p0 ) ;
av_log ( wctx , AV_LOG_DEBUG , "Invalid UTF-8 sequence %s found in string '%s'\n" , bp . str , src ) ;
invalid = 1 ;
}
if ( invalid ) {
invalid_chars_nb ++ ;
switch ( wctx -> string_validation ) {
case WRITER_STRING_VALIDATION_FAIL : av_log ( wctx , AV_LOG_ERROR , "Invalid UTF-8 sequence found in string '%s'\n" , src ) ;
ret = AVERROR_INVALIDDATA ;
goto end ;
break ;
case WRITER_STRING_VALIDATION_REPLACE : av_bprintf ( & dstbuf , "%s" , wctx -> string_validation_replacement ) ;
break ;
}
}
if ( ! invalid || wctx -> string_validation == WRITER_STRING_VALIDATION_IGNORE ) av_bprint_append_data ( & dstbuf , p0 , p - p0 ) ;
}
if ( invalid_chars_nb && wctx -> string_validation == WRITER_STRING_VALIDATION_REPLACE ) {
av_log ( wctx , AV_LOG_WARNING , "%d invalid UTF-8 sequence(s) found in string '%s', replaced with '%s'\n" , invalid_chars_nb , src , wctx -> string_validation_replacement ) ;
}
end : av_bprint_finalize ( & dstbuf , dstp ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void cleanst ( struct vars * v ) {
struct subre * t ;
struct subre * next ;
for ( t = v -> treechain ;
t != NULL ;
t = next ) {
next = t -> chain ;
if ( ! ( t -> flags & INUSE ) ) FREE ( t ) ;
}
v -> treechain = NULL ;
v -> treefree = NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_CertSelectionCriteria ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_constrained_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h245_CertSelectionCriteria , CertSelectionCriteria_sequence_of , 1 , 16 , FALSE ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
proto_item * proto_tree_add_float ( proto_tree * tree , int hfindex , tvbuff_t * tvb , gint start , gint length , float value ) {
proto_item * pi ;
header_field_info * hfinfo ;
CHECK_FOR_NULL_TREE ( tree ) ;
TRY_TO_FAKE_THIS_ITEM ( tree , hfindex , hfinfo ) ;
DISSECTOR_ASSERT_FIELD_TYPE ( hfinfo , FT_FLOAT ) ;
pi = proto_tree_add_pi ( tree , hfinfo , tvb , start , & length ) ;
proto_tree_set_float ( PNODE_FINFO ( pi ) , value ) ;
return pi ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int net_slirp_smb ( const char * exported_dir ) {
struct in_addr vserver_addr = {
. s_addr = 0 }
;
if ( legacy_smb_export ) {
fprintf ( stderr , "-smb given twice\n" ) ;
return - 1 ;
}
legacy_smb_export = exported_dir ;
if ( ! QTAILQ_EMPTY ( & slirp_stacks ) ) {
return slirp_smb ( QTAILQ_FIRST ( & slirp_stacks ) , exported_dir , vserver_addr ) ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void remove_short_at_index ( H264Context * h , int i ) {
assert ( i >= 0 && i < h -> short_ref_count ) ;
h -> short_ref [ i ] = NULL ;
if ( -- h -> short_ref_count ) memmove ( & h -> short_ref [ i ] , & h -> short_ref [ i + 1 ] , ( h -> short_ref_count - i ) * sizeof ( Picture * ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dtls1_check_timeout_num ( SSL * s ) {
unsigned int mtu ;
s -> d1 -> timeout . num_alerts ++ ;
if ( s -> d1 -> timeout . num_alerts > 2 && ! ( SSL_get_options ( s ) & SSL_OP_NO_QUERY_MTU ) ) {
mtu = BIO_ctrl ( SSL_get_wbio ( s ) , BIO_CTRL_DGRAM_GET_FALLBACK_MTU , 0 , NULL ) ;
if ( mtu < s -> d1 -> mtu ) s -> d1 -> mtu = mtu ;
}
if ( s -> d1 -> timeout . num_alerts > DTLS1_TMO_ALERT_COUNT ) {
SSLerr ( SSL_F_DTLS1_CHECK_TIMEOUT_NUM , SSL_R_READ_TIMEOUT_EXPIRED ) ;
return - 1 ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
cmsTagTypeHandler * _cmsGetTagTypeHandler ( cmsContext ContextID , cmsTagTypeSignature sig ) {
_cmsTagTypePluginChunkType * ctx = ( _cmsTagTypePluginChunkType * ) _cmsContextGetClientChunk ( ContextID , TagTypePlugin ) ;
return GetHandler ( sig , ctx -> TagTypes , SupportedTagTypes ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int phar_tar_octal ( char * buf , php_uint32 val , int len ) {
char * p = buf ;
int s = len ;
p += len ;
while ( s -- > 0 ) {
* -- p = ( char ) ( '0' + ( val & 7 ) ) ;
val >>= 3 ;
}
if ( val == 0 ) return SUCCESS ;
while ( len -- > 0 ) * p ++ = '7' ;
return FAILURE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( IconLabelBubbleViewTest , SecondClick ) {
generator ( ) -> PressLeftButton ( ) ;
EXPECT_FALSE ( view ( ) -> IsBubbleShowing ( ) ) ;
generator ( ) -> ReleaseLeftButton ( ) ;
EXPECT_TRUE ( view ( ) -> IsBubbleShowing ( ) ) ;
generator ( ) -> PressLeftButton ( ) ;
view ( ) -> HideBubble ( ) ;
EXPECT_FALSE ( view ( ) -> IsBubbleShowing ( ) ) ;
generator ( ) -> ReleaseLeftButton ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline guint16 gst_asf_demux_get_uint16 ( guint8 * * p_data , guint64 * p_size ) {
guint16 ret ;
g_assert ( * p_size >= 2 ) ;
ret = GST_READ_UINT16_LE ( * p_data ) ;
* p_data += sizeof ( guint16 ) ;
* p_size -= sizeof ( guint16 ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static __always_inline __u32 __swab32p ( const __u32 * p ) {
# ifdef __arch_swab32p return __arch_swab32p ( p ) ;
# else return __swab32 ( * p ) ;
# endif }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void selinux_inode_post_setxattr ( struct dentry * dentry , const char * name , const void * value , size_t size , int flags ) {
struct inode * inode = d_backing_inode ( dentry ) ;
struct inode_security_struct * isec ;
u32 newsid ;
int rc ;
if ( strcmp ( name , XATTR_NAME_SELINUX ) ) {
return ;
}
rc = security_context_to_sid_force ( value , size , & newsid ) ;
if ( rc ) {
printk ( KERN_ERR "SELinux: unable to map context to SID" "for (%s, %lu), rc=%d\n" , inode -> i_sb -> s_id , inode -> i_ino , - rc ) ;
return ;
}
isec = backing_inode_security ( dentry ) ;
spin_lock ( & isec -> lock ) ;
isec -> sclass = inode_mode_to_security_class ( inode -> i_mode ) ;
isec -> sid = newsid ;
isec -> initialized = LABEL_INITIALIZED ;
spin_unlock ( & isec -> lock ) ;
return ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SPL_METHOD ( SplFileObject , getChildren ) {
if ( zend_parse_parameters_none ( ) == FAILURE ) {
return ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int vp9_set_size_literal ( VP9_COMP * cpi , unsigned int width , unsigned int height ) {
VP9_COMMON * cm = & cpi -> common ;
check_initial_width ( cpi , 1 , 1 ) ;
if ( width ) {
cm -> width = width ;
if ( cm -> width * 5 < cpi -> initial_width ) {
cm -> width = cpi -> initial_width / 5 + 1 ;
printf ( "Warning: Desired width too small, changed to %d\n" , cm -> width ) ;
}
if ( cm -> width > cpi -> initial_width ) {
cm -> width = cpi -> initial_width ;
printf ( "Warning: Desired width too large, changed to %d\n" , cm -> width ) ;
}
}
if ( height ) {
cm -> height = height ;
if ( cm -> height * 5 < cpi -> initial_height ) {
cm -> height = cpi -> initial_height / 5 + 1 ;
printf ( "Warning: Desired height too small, changed to %d\n" , cm -> height ) ;
}
if ( cm -> height > cpi -> initial_height ) {
cm -> height = cpi -> initial_height ;
printf ( "Warning: Desired height too large, changed to %d\n" , cm -> height ) ;
}
}
assert ( cm -> width <= cpi -> initial_width ) ;
assert ( cm -> height <= cpi -> initial_height ) ;
update_frame_size ( cpi ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
CURLcode Curl_add_bufferf ( Curl_send_buffer * in , const char * fmt , ... ) {
char * s ;
va_list ap ;
va_start ( ap , fmt ) ;
s = vaprintf ( fmt , ap ) ;
va_end ( ap ) ;
if ( s ) {
CURLcode result = Curl_add_buffer ( in , s , strlen ( s ) ) ;
free ( s ) ;
return result ;
}
free ( in -> buffer ) ;
free ( in ) ;
return CURLE_OUT_OF_MEMORY ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( ExtensionServiceSyncTest , DeferredSyncStartupPreInstalledComponent ) {
InitializeEmptyExtensionService ( ) ;
bool flare_was_called = false ;
syncer : : ModelType triggered_type ( syncer : : UNSPECIFIED ) ;
base : : WeakPtrFactory < ExtensionServiceSyncTest > factory ( this ) ;
extension_sync_service ( ) -> SetSyncStartFlareForTesting ( base : : Bind ( & ExtensionServiceSyncTest : : MockSyncStartFlare , factory . GetWeakPtr ( ) , & flare_was_called , & triggered_type ) ) ;
std : : string manifest ;
ASSERT_TRUE ( base : : ReadFileToString ( good0_path ( ) . Append ( extensions : : kManifestFilename ) , & manifest ) ) ;
service ( ) -> component_loader ( ) -> Add ( manifest , good0_path ( ) ) ;
ASSERT_FALSE ( service ( ) -> is_ready ( ) ) ;
service ( ) -> Init ( ) ;
ASSERT_TRUE ( service ( ) -> is_ready ( ) ) ;
EXPECT_FALSE ( flare_was_called ) ;
ASSERT_EQ ( syncer : : UNSPECIFIED , triggered_type ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void qtrle_decode_24bpp ( QtrleContext * s , int row_ptr , int lines_to_change ) {
int rle_code ;
int pixel_ptr ;
int row_inc = s -> frame . linesize [ 0 ] ;
unsigned char r , g , b ;
unsigned char * rgb = s -> frame . data [ 0 ] ;
int pixel_limit = s -> frame . linesize [ 0 ] * s -> avctx -> height ;
while ( lines_to_change -- ) {
pixel_ptr = row_ptr + ( bytestream2_get_byte ( & s -> g ) - 1 ) * 3 ;
CHECK_PIXEL_PTR ( 0 ) ;
while ( ( rle_code = ( signed char ) bytestream2_get_byte ( & s -> g ) ) != - 1 ) {
if ( rle_code == 0 ) {
pixel_ptr += ( bytestream2_get_byte ( & s -> g ) - 1 ) * 3 ;
CHECK_PIXEL_PTR ( 0 ) ;
}
else if ( rle_code < 0 ) {
rle_code = - rle_code ;
r = bytestream2_get_byte ( & s -> g ) ;
g = bytestream2_get_byte ( & s -> g ) ;
b = bytestream2_get_byte ( & s -> g ) ;
CHECK_PIXEL_PTR ( rle_code * 3 ) ;
while ( rle_code -- ) {
rgb [ pixel_ptr ++ ] = r ;
rgb [ pixel_ptr ++ ] = g ;
rgb [ pixel_ptr ++ ] = b ;
}
}
else {
CHECK_PIXEL_PTR ( rle_code * 3 ) ;
while ( rle_code -- ) {
rgb [ pixel_ptr ++ ] = bytestream2_get_byte ( & s -> g ) ;
rgb [ pixel_ptr ++ ] = bytestream2_get_byte ( & s -> g ) ;
rgb [ pixel_ptr ++ ] = bytestream2_get_byte ( & s -> g ) ;
}
}
}
row_ptr += row_inc ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int crypto_authenticate_and_decrypt ( struct crypto_instance * instance , unsigned char * buf , int * buf_len ) {
struct crypto_config_header * cch = ( struct crypto_config_header * ) buf ;
const char * guessed_str ;
if ( cch -> crypto_cipher_type != CRYPTO_CIPHER_TYPE_2_3 ) {
guessed_str = NULL ;
if ( ( cch -> crypto_cipher_type == 0xC0 && cch -> crypto_hash_type == 0x70 ) || ( cch -> crypto_cipher_type == 0x70 && cch -> crypto_hash_type == 0xC0 ) ) {
guessed_str = "Corosync 3.x" ;
}
else if ( cch -> crypto_cipher_type == CRYPTO_CIPHER_TYPE_2_2 ) {
guessed_str = "Corosync 2.2" ;
}
else if ( cch -> crypto_cipher_type == 0x01 ) {
guessed_str = "unencrypted Kronosnet" ;
}
else if ( cch -> crypto_cipher_type >= 0 && cch -> crypto_cipher_type <= 5 ) {
guessed_str = "unencrypted Corosync 2.0/2.1/1.x/OpenAIS" ;
}
else {
guessed_str = "encrypted Kronosnet/Corosync 2.0/2.1/1.x/OpenAIS or unknown" ;
}
log_printf ( instance -> log_level_security , "Unsupported incoming packet (probably sent by %s). Rejecting" , guessed_str ) ;
return - 1 ;
}
if ( cch -> crypto_hash_type != CRYPTO_HASH_TYPE_2_3 ) {
log_printf ( instance -> log_level_security , "Incoming packet has different hash type. Rejecting" ) ;
return - 1 ;
}
if ( authenticate_nss_2_3 ( instance , buf , buf_len ) != 0 ) {
return - 1 ;
}
if ( ( cch -> __pad0 != 0 ) || ( cch -> __pad1 != 0 ) ) {
log_printf ( instance -> log_level_security , "Incoming packet appears to have features not supported by this version of corosync. Rejecting" ) ;
return - 1 ;
}
if ( decrypt_nss_2_3 ( instance , buf , buf_len ) != 0 ) {
return - 1 ;
}
cch = NULL ;
memmove ( buf , buf + sizeof ( struct crypto_config_header ) , * buf_len ) ;
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int capture_android_logcat ( char * interface , char * fifo , const char * adb_server_ip , unsigned short * adb_server_tcp_port ) {
struct extcap_dumper extcap_dumper ;
static char packet [ PACKET_LENGTH ] ;
static char helper_packet [ PACKET_LENGTH ] ;
gssize length ;
size_t used_buffer_length = 0 ;
socket_handle_t sock ;
const char * protocol_name ;
size_t exported_pdu_headers_size = 0 ;
struct exported_pdu_header exported_pdu_header_protocol_events ;
struct exported_pdu_header exported_pdu_header_protocol_normal ;
struct exported_pdu_header * exported_pdu_header_protocol ;
struct exported_pdu_header exported_pdu_header_end = {
0 , 0 }
;
static const char * wireshark_protocol_logcat = "logcat" ;
static const char * wireshark_protocol_logcat_events = "logcat_events" ;
const char * adb_transport = "0012" "host:transport-any" ;
const char * adb_log_main = "0008" "log:main" ;
const char * adb_log_system = "000A" "log:system" ;
const char * adb_log_radio = "0009" "log:radio" ;
const char * adb_log_events = "000A" "log:events" ;
const char * adb_transport_serial_templace = "%04x" "host:transport:%s" ;
const char * adb_command ;
uint16_t * payload_length ;
uint16_t * try_header_size ;
uint32_t * timestamp_secs ;
uint32_t * timestamp_nsecs ;
uint16_t header_size ;
int result ;
char * serial_number = NULL ;
size_t serial_number_length = 0 ;
extcap_dumper = extcap_dumper_open ( fifo , EXTCAP_ENCAP_WIRESHARK_UPPER_PDU ) ;
exported_pdu_header_protocol_events . tag = GUINT16_TO_BE ( WIRESHARK_UPPER_PDU_TAG_DISSECTOR_NAME ) ;
exported_pdu_header_protocol_events . length = GUINT16_TO_BE ( strlen ( wireshark_protocol_logcat_events ) + 2 ) ;
exported_pdu_header_protocol_normal . tag = GUINT16_TO_BE ( WIRESHARK_UPPER_PDU_TAG_DISSECTOR_NAME ) ;
exported_pdu_header_protocol_normal . length = GUINT16_TO_BE ( strlen ( wireshark_protocol_logcat ) + 2 ) ;
sock = adb_connect ( adb_server_ip , adb_server_tcp_port ) ;
if ( sock == INVALID_SOCKET ) return EXIT_CODE_INVALID_SOCKET_9 ;
if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_MAIN ) && strlen ( interface ) > strlen ( INTERFACE_ANDROID_LOGCAT_MAIN ) + 1 ) {
serial_number = interface + strlen ( INTERFACE_ANDROID_LOGCAT_MAIN ) + 1 ;
}
else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_SYSTEM ) && strlen ( interface ) > strlen ( INTERFACE_ANDROID_LOGCAT_SYSTEM ) + 1 ) {
serial_number = interface + strlen ( INTERFACE_ANDROID_LOGCAT_SYSTEM ) + 1 ;
}
else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_RADIO ) && strlen ( interface ) > strlen ( INTERFACE_ANDROID_LOGCAT_RADIO ) + 1 ) {
serial_number = interface + strlen ( INTERFACE_ANDROID_LOGCAT_RADIO ) + 1 ;
}
else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_EVENTS ) && strlen ( interface ) > strlen ( INTERFACE_ANDROID_LOGCAT_EVENTS ) + 1 ) {
serial_number = interface + strlen ( INTERFACE_ANDROID_LOGCAT_EVENTS ) + 1 ;
}
if ( ! serial_number ) {
result = adb_send ( sock , adb_transport ) ;
if ( result ) {
errmsg_print ( "ERROR: Error while setting adb transport" ) ;
closesocket ( sock ) ;
return EXIT_CODE_GENERIC ;
}
}
else {
serial_number_length = strlen ( serial_number ) ;
result = g_snprintf ( packet , PACKET_LENGTH , adb_transport_serial_templace , 15 + serial_number_length , serial_number ) ;
if ( result <= 0 || result > PACKET_LENGTH ) {
errmsg_print ( "ERROR: Error while completing adb packet" ) ;
closesocket ( sock ) ;
return EXIT_CODE_BAD_SIZE_OF_ASSEMBLED_ADB_PACKET_18 ;
}
result = adb_send ( sock , packet ) ;
if ( result ) {
errmsg_print ( "ERROR: Error while setting adb transport" ) ;
closesocket ( sock ) ;
return EXIT_CODE_GENERIC ;
}
}
if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_MAIN ) ) adb_command = adb_log_main ;
else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_SYSTEM ) ) adb_command = adb_log_system ;
else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_RADIO ) ) adb_command = adb_log_radio ;
else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_EVENTS ) ) adb_command = adb_log_events ;
else {
errmsg_print ( "ERROR: Unknown interface: <%s>" , interface ) ;
closesocket ( sock ) ;
return EXIT_CODE_GENERIC ;
}
result = adb_send ( sock , adb_command ) ;
if ( result ) {
errmsg_print ( "ERROR: Error while sending command <%s>" , adb_command ) ;
closesocket ( sock ) ;
return EXIT_CODE_ERROR_WHILE_SENDING_ADB_PACKET_4 ;
}
if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_EVENTS ) ) {
protocol_name = wireshark_protocol_logcat_events ;
exported_pdu_header_protocol = & exported_pdu_header_protocol_events ;
}
else {
protocol_name = wireshark_protocol_logcat ;
exported_pdu_header_protocol = & exported_pdu_header_protocol_normal ;
}
memcpy ( packet , exported_pdu_header_protocol , sizeof ( struct exported_pdu_header ) ) ;
exported_pdu_headers_size += sizeof ( struct exported_pdu_header ) ;
memcpy ( packet + exported_pdu_headers_size , protocol_name , GUINT16_FROM_BE ( exported_pdu_header_protocol -> length ) - 2 ) ;
exported_pdu_headers_size += GUINT16_FROM_BE ( exported_pdu_header_protocol -> length ) ;
packet [ exported_pdu_headers_size - 1 ] = 0 ;
packet [ exported_pdu_headers_size - 2 ] = 0 ;
memcpy ( packet + exported_pdu_headers_size , & exported_pdu_header_end , sizeof ( struct exported_pdu_header ) ) ;
exported_pdu_headers_size += sizeof ( struct exported_pdu_header ) + GUINT16_FROM_BE ( exported_pdu_header_end . length ) ;
SET_DATA ( payload_length , value_u16 , packet + exported_pdu_headers_size + 0 ) ;
SET_DATA ( try_header_size , value_u16 , packet + exported_pdu_headers_size + 2 ) ;
SET_DATA ( timestamp_secs , value_u32 , packet + exported_pdu_headers_size + 12 ) ;
SET_DATA ( timestamp_nsecs , value_u32 , packet + exported_pdu_headers_size + 16 ) ;
while ( endless_loop ) {
errno = 0 ;
length = recv ( sock , packet + exported_pdu_headers_size + used_buffer_length , ( int ) ( PACKET_LENGTH - exported_pdu_headers_size - used_buffer_length ) , 0 ) ;
if ( errno == EAGAIN # if EWOULDBLOCK != EAGAIN || errno == EWOULDBLOCK # endif ) {
continue ;
}
else if ( errno != 0 ) {
errmsg_print ( "ERROR capture: %s" , strerror ( errno ) ) ;
closesocket ( sock ) ;
return EXIT_CODE_GENERIC ;
}
if ( length <= 0 ) {
while ( endless_loop ) {
verbose_print ( "WARNING: Broken socket connection. Try reconnect.\n" ) ;
used_buffer_length = 0 ;
closesocket ( sock ) ;
sock = adb_connect ( adb_server_ip , adb_server_tcp_port ) ;
if ( sock == INVALID_SOCKET ) return EXIT_CODE_INVALID_SOCKET_10 ;
if ( ! serial_number ) {
result = adb_send ( sock , adb_transport ) ;
if ( result ) {
errmsg_print ( "ERROR: Error while setting adb transport for <%s>" , adb_transport ) ;
closesocket ( sock ) ;
return EXIT_CODE_GENERIC ;
}
}
else {
result = g_snprintf ( ( char * ) helper_packet , PACKET_LENGTH , adb_transport_serial_templace , 15 + serial_number_length , serial_number ) ;
if ( result <= 0 || result > PACKET_LENGTH ) {
errmsg_print ( "ERROR: Error while completing adb packet" ) ;
closesocket ( sock ) ;
return EXIT_CODE_BAD_SIZE_OF_ASSEMBLED_ADB_PACKET_19 ;
}
result = adb_send ( sock , helper_packet ) ;
if ( result ) {
errmsg_print ( "ERROR: Error while setting adb transport for <%s>" , helper_packet ) ;
closesocket ( sock ) ;
return EXIT_CODE_GENERIC ;
}
}
if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_MAIN ) ) adb_command = adb_log_main ;
else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_SYSTEM ) ) adb_command = adb_log_system ;
else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_RADIO ) ) adb_command = adb_log_radio ;
else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_EVENTS ) ) adb_command = adb_log_events ;
else {
errmsg_print ( "ERROR: Unknown interface: <%s>" , interface ) ;
closesocket ( sock ) ;
return EXIT_CODE_GENERIC ;
}
result = adb_send ( sock , adb_command ) ;
if ( result ) {
errmsg_print ( "WARNIG: Error while sending command <%s>" , adb_command ) ;
continue ;
}
break ;
}
}
used_buffer_length += length + exported_pdu_headers_size ;
if ( * try_header_size != 24 ) header_size = 20 ;
else header_size = * try_header_size ;
length = ( * payload_length ) + header_size + ( gssize ) exported_pdu_headers_size ;
while ( used_buffer_length >= exported_pdu_headers_size + header_size && ( size_t ) length <= used_buffer_length ) {
endless_loop = extcap_dumper_dump ( extcap_dumper , packet , length , length , * timestamp_secs , * timestamp_nsecs ) ;
memmove ( packet + exported_pdu_headers_size , packet + length , used_buffer_length - length ) ;
used_buffer_length -= length ;
used_buffer_length += exported_pdu_headers_size ;
length = ( * payload_length ) + header_size + ( gssize ) exported_pdu_headers_size ;
if ( * try_header_size != 24 ) header_size = 20 ;
else header_size = * try_header_size ;
}
used_buffer_length -= exported_pdu_headers_size ;
}
closesocket ( sock ) ;
return EXIT_CODE_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint32_t e1000e_mac_low ## num ## _read ( E1000ECore * core , int index ) {
return core -> mac [ index ] & ( BIT ( num ) - 1 ) ;
}
# define E1000E_LOW_BITS_READ ( num ) e1000e_mac_low ## num ## _read E1000E_LOW_BITS_READ_FUNC ( 4 ) ;
E1000E_LOW_BITS_READ_FUNC ( 6 ) ;
E1000E_LOW_BITS_READ_FUNC ( 11 ) ;
E1000E_LOW_BITS_READ_FUNC ( 13 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int parse_CSortAggregSet ( tvbuff_t * tvb , int offset , proto_tree * parent_tree , proto_tree * pad_tree , const char * fmt , ... ) {
guint32 cCount , i ;
proto_item * item ;
proto_tree * tree ;
const char * txt ;
va_list ap ;
va_start ( ap , fmt ) ;
txt = wmem_strdup_vprintf ( wmem_packet_scope ( ) , fmt , ap ) ;
va_end ( ap ) ;
tree = proto_tree_add_subtree ( parent_tree , tvb , offset , 0 , ett_CSortAggregSet , & item , txt ) ;
cCount = tvb_get_letohl ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_mswsp_csortaggregset_count , tvb , offset , 4 , cCount ) ;
offset += 4 ;
for ( i = 0 ;
i < cCount ;
i ++ ) {
offset = parse_CAggregSortKey ( tvb , offset , tree , pad_tree , "SortKeys[%u]" , i ) ;
}
proto_item_set_end ( item , tvb , offset ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int cng_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) {
AVFrame * frame = data ;
CNGContext * p = avctx -> priv_data ;
int buf_size = avpkt -> size ;
int ret , i ;
int16_t * buf_out ;
float e = 1.0 ;
float scaling ;
if ( avpkt -> size ) {
int dbov = - avpkt -> data [ 0 ] ;
p -> target_energy = 1081109975 * pow ( 10 , dbov / 10.0 ) * 0.75 ;
memset ( p -> target_refl_coef , 0 , p -> order * sizeof ( * p -> target_refl_coef ) ) ;
for ( i = 0 ;
i < FFMIN ( avpkt -> size - 1 , p -> order ) ;
i ++ ) {
p -> target_refl_coef [ i ] = ( avpkt -> data [ 1 + i ] - 127 ) / 128.0 ;
}
}
if ( p -> inited ) {
p -> energy = p -> energy / 2 + p -> target_energy / 2 ;
for ( i = 0 ;
i < p -> order ;
i ++ ) p -> refl_coef [ i ] = 0.6 * p -> refl_coef [ i ] + 0.4 * p -> target_refl_coef [ i ] ;
}
else {
p -> energy = p -> target_energy ;
memcpy ( p -> refl_coef , p -> target_refl_coef , p -> order * sizeof ( * p -> refl_coef ) ) ;
p -> inited = 1 ;
}
make_lpc_coefs ( p -> lpc_coef , p -> refl_coef , p -> order ) ;
for ( i = 0 ;
i < p -> order ;
i ++ ) e *= 1.0 - p -> refl_coef [ i ] * p -> refl_coef [ i ] ;
scaling = sqrt ( e * p -> energy / 1081109975 ) ;
for ( i = 0 ;
i < avctx -> frame_size ;
i ++ ) {
int r = ( av_lfg_get ( & p -> lfg ) & 0xffff ) - 0x8000 ;
p -> excitation [ i ] = scaling * r ;
}
ff_celp_lp_synthesis_filterf ( p -> filter_out + p -> order , p -> lpc_coef , p -> excitation , avctx -> frame_size , p -> order ) ;
frame -> nb_samples = avctx -> frame_size ;
if ( ( ret = ff_get_buffer ( avctx , frame ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
buf_out = ( int16_t * ) frame -> data [ 0 ] ;
for ( i = 0 ;
i < avctx -> frame_size ;
i ++ ) buf_out [ i ] = p -> filter_out [ i + p -> order ] ;
memcpy ( p -> filter_out , p -> filter_out + avctx -> frame_size , p -> order * sizeof ( * p -> filter_out ) ) ;
* got_frame_ptr = 1 ;
return buf_size ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void create_pmid_to_name_map_from_candidates ( pcp_conv_info_t * pcp_conv_info , tvbuff_t * tvb , int offset , guint32 num_ids ) {
guint32 i ;
for ( i = 0 ;
i < num_ids ;
i ++ ) {
guint32 pmid ;
guint8 * pmid_name ;
pmid = tvb_get_ntohl ( tvb , offset ) ;
pmid_name = * ( guint8 * * ) wmem_array_index ( pcp_conv_info -> pmid_name_candidates , i ) ;
if ( wmem_map_lookup ( pcp_conv_info -> pmid_to_name , GINT_TO_POINTER ( pmid ) ) == NULL ) {
wmem_map_insert ( pcp_conv_info -> pmid_to_name , GINT_TO_POINTER ( pmid ) , pmid_name ) ;
}
offset += 4 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( NativeBackendLibsecretTest , BasicAddLogin ) {
NativeBackendLibsecret backend ( 42 ) ;
VerifiedAdd ( & backend , form_google_ ) ;
EXPECT_EQ ( 1u , global_mock_libsecret_items -> size ( ) ) ;
if ( ! global_mock_libsecret_items -> empty ( ) ) CheckMockSecretItem ( ( * global_mock_libsecret_items ) [ 0 ] , form_google_ , "chrome-42" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void EVP_ENCODE_CTX_free ( EVP_ENCODE_CTX * ctx ) {
OPENSSL_free ( ctx ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static vpx_codec_err_t encoder_destroy ( vpx_codec_alg_priv_t * ctx ) {
free ( ctx -> cx_data ) ;
vp9_remove_compressor ( ctx -> cpi ) ;
vpx_free ( ctx ) ;
return VPX_CODEC_OK ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void reset_stats ( VirtIOBalloon * dev ) {
int i ;
for ( i = 0 ;
i < VIRTIO_BALLOON_S_NR ;
dev -> stats [ i ++ ] = - 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int curl_msprintf ( char * buffer , const char * format , ... ) {
va_list ap_save ;
int retcode ;
va_start ( ap_save , format ) ;
retcode = dprintf_formatf ( & buffer , storebuffer , format , ap_save ) ;
va_end ( ap_save ) ;
* buffer = 0 ;
return retcode ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gcry_err_code_t sexp_to_sig ( gcry_sexp_t sexp , gcry_mpi_t * * retarray , gcry_module_t * retalgo , int opaque ) {
gcry_err_code_t err = 0 ;
gcry_sexp_t list , l2 ;
char * name ;
const char * elems ;
gcry_mpi_t * array ;
gcry_module_t module ;
gcry_pk_spec_t * pubkey ;
list = gcry_sexp_find_token ( sexp , "sig-val" , 0 ) ;
if ( ! list ) return GPG_ERR_INV_OBJ ;
l2 = gcry_sexp_nth ( list , 1 ) ;
if ( ! l2 ) {
gcry_sexp_release ( list ) ;
return GPG_ERR_NO_OBJ ;
}
name = _gcry_sexp_nth_string ( l2 , 0 ) ;
if ( ! name ) {
gcry_sexp_release ( list ) ;
gcry_sexp_release ( l2 ) ;
return GPG_ERR_INV_OBJ ;
}
else if ( ! strcmp ( name , "flags" ) ) {
gcry_free ( name ) ;
gcry_sexp_release ( l2 ) ;
l2 = gcry_sexp_nth ( list , 2 ) ;
if ( ! l2 ) {
gcry_sexp_release ( list ) ;
return GPG_ERR_INV_OBJ ;
}
name = _gcry_sexp_nth_string ( l2 , 0 ) ;
}
ath_mutex_lock ( & pubkeys_registered_lock ) ;
module = gcry_pk_lookup_name ( name ) ;
ath_mutex_unlock ( & pubkeys_registered_lock ) ;
gcry_free ( name ) ;
name = NULL ;
if ( ! module ) {
gcry_sexp_release ( l2 ) ;
gcry_sexp_release ( list ) ;
return GPG_ERR_PUBKEY_ALGO ;
}
else pubkey = ( gcry_pk_spec_t * ) module -> spec ;
elems = pubkey -> elements_sig ;
array = gcry_calloc ( strlen ( elems ) + 1 , sizeof * array ) ;
if ( ! array ) err = gpg_err_code_from_syserror ( ) ;
if ( ! err ) err = sexp_elements_extract ( list , elems , array , NULL , opaque ) ;
gcry_sexp_release ( l2 ) ;
gcry_sexp_release ( list ) ;
if ( err ) {
ath_mutex_lock ( & pubkeys_registered_lock ) ;
_gcry_module_release ( module ) ;
ath_mutex_unlock ( & pubkeys_registered_lock ) ;
gcry_free ( array ) ;
}
else {
* retarray = array ;
* retalgo = module ;
}
return err ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_H222Capability ( 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_H222Capability , H222Capability_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint32_t record_block_getter ( uint8_t * p , uint32_t s , Gif_Reader * grr ) {
uint32_t ncopy = ( grr -> pos + s <= grr -> length ? s : grr -> length - grr -> pos ) ;
memcpy ( p , & grr -> v [ grr -> pos ] , ncopy ) ;
grr -> pos += ncopy ;
if ( ncopy < s ) memset ( p + ncopy , 0 , s - ncopy ) ;
return ncopy ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SPL_METHOD ( DirectoryIterator , getFilename ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
if ( zend_parse_parameters_none ( ) == FAILURE ) {
return ;
}
RETURN_STRING ( intern -> u . dir . entry . d_name , 1 ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int strncat_from_utf8_to_utf8 ( struct archive_string * as , const void * _p , size_t len , struct archive_string_conv * sc ) {
const char * s ;
char * p , * endp ;
int n , ret = 0 ;
( void ) sc ;
if ( archive_string_ensure ( as , as -> length + len + 1 ) == NULL ) return ( - 1 ) ;
s = ( const char * ) _p ;
p = as -> s + as -> length ;
endp = as -> s + as -> buffer_length - 1 ;
do {
uint32_t uc ;
const char * ss = s ;
size_t w ;
while ( ( n = utf8_to_unicode ( & uc , s , len ) ) > 0 ) {
s += n ;
len -= n ;
}
if ( ss < s ) {
if ( p + ( s - ss ) > endp ) {
as -> length = p - as -> s ;
if ( archive_string_ensure ( as , as -> buffer_length + len + 1 ) == NULL ) return ( - 1 ) ;
p = as -> s + as -> length ;
endp = as -> s + as -> buffer_length - 1 ;
}
memcpy ( p , ss , s - ss ) ;
p += s - ss ;
}
if ( n < 0 ) {
if ( n == - 3 && IS_SURROGATE_PAIR_LA ( uc ) ) {
n = cesu8_to_unicode ( & uc , s , len ) ;
}
if ( n < 0 ) {
ret = - 1 ;
n *= - 1 ;
}
while ( ( w = unicode_to_utf8 ( p , endp - p , uc ) ) == 0 ) {
as -> length = p - as -> s ;
if ( archive_string_ensure ( as , as -> buffer_length + len + 1 ) == NULL ) return ( - 1 ) ;
p = as -> s + as -> length ;
endp = as -> s + as -> buffer_length - 1 ;
}
p += w ;
s += n ;
len -= n ;
}
}
while ( n > 0 ) ;
as -> length = p - as -> s ;
as -> s [ as -> length ] = '\0' ;
return ( ret ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ff_mpeg4_set_direct_mv ( MpegEncContext * s , int mx , int my ) {
const int mb_index = s -> mb_x + s -> mb_y * s -> mb_stride ;
const int colocated_mb_type = s -> next_picture . f . mb_type [ mb_index ] ;
uint16_t time_pp ;
uint16_t time_pb ;
int i ;
if ( IS_8X8 ( colocated_mb_type ) ) {
s -> mv_type = MV_TYPE_8X8 ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
ff_mpeg4_set_one_direct_mv ( s , mx , my , i ) ;
}
return MB_TYPE_DIRECT2 | MB_TYPE_8x8 | MB_TYPE_L0L1 ;
}
else if ( IS_INTERLACED ( colocated_mb_type ) ) {
s -> mv_type = MV_TYPE_FIELD ;
for ( i = 0 ;
i < 2 ;
i ++ ) {
int field_select = s -> next_picture . f . ref_index [ 0 ] [ 4 * mb_index + 2 * i ] ;
s -> field_select [ 0 ] [ i ] = field_select ;
s -> field_select [ 1 ] [ i ] = i ;
if ( s -> top_field_first ) {
time_pp = s -> pp_field_time - field_select + i ;
time_pb = s -> pb_field_time - field_select + i ;
}
else {
time_pp = s -> pp_field_time + field_select - i ;
time_pb = s -> pb_field_time + field_select - i ;
}
s -> mv [ 0 ] [ i ] [ 0 ] = s -> p_field_mv_table [ i ] [ 0 ] [ mb_index ] [ 0 ] * time_pb / time_pp + mx ;
s -> mv [ 0 ] [ i ] [ 1 ] = s -> p_field_mv_table [ i ] [ 0 ] [ mb_index ] [ 1 ] * time_pb / time_pp + my ;
s -> mv [ 1 ] [ i ] [ 0 ] = mx ? s -> mv [ 0 ] [ i ] [ 0 ] - s -> p_field_mv_table [ i ] [ 0 ] [ mb_index ] [ 0 ] : s -> p_field_mv_table [ i ] [ 0 ] [ mb_index ] [ 0 ] * ( time_pb - time_pp ) / time_pp ;
s -> mv [ 1 ] [ i ] [ 1 ] = my ? s -> mv [ 0 ] [ i ] [ 1 ] - s -> p_field_mv_table [ i ] [ 0 ] [ mb_index ] [ 1 ] : s -> p_field_mv_table [ i ] [ 0 ] [ mb_index ] [ 1 ] * ( time_pb - time_pp ) / time_pp ;
}
return MB_TYPE_DIRECT2 | MB_TYPE_16x8 | MB_TYPE_L0L1 | MB_TYPE_INTERLACED ;
}
else {
ff_mpeg4_set_one_direct_mv ( s , mx , my , 0 ) ;
s -> mv [ 0 ] [ 1 ] [ 0 ] = s -> mv [ 0 ] [ 2 ] [ 0 ] = s -> mv [ 0 ] [ 3 ] [ 0 ] = s -> mv [ 0 ] [ 0 ] [ 0 ] ;
s -> mv [ 0 ] [ 1 ] [ 1 ] = s -> mv [ 0 ] [ 2 ] [ 1 ] = s -> mv [ 0 ] [ 3 ] [ 1 ] = s -> mv [ 0 ] [ 0 ] [ 1 ] ;
s -> mv [ 1 ] [ 1 ] [ 0 ] = s -> mv [ 1 ] [ 2 ] [ 0 ] = s -> mv [ 1 ] [ 3 ] [ 0 ] = s -> mv [ 1 ] [ 0 ] [ 0 ] ;
s -> mv [ 1 ] [ 1 ] [ 1 ] = s -> mv [ 1 ] [ 2 ] [ 1 ] = s -> mv [ 1 ] [ 3 ] [ 1 ] = s -> mv [ 1 ] [ 0 ] [ 1 ] ;
if ( ( s -> avctx -> workaround_bugs & FF_BUG_DIRECT_BLOCKSIZE ) || ! s -> quarter_sample ) s -> mv_type = MV_TYPE_16X16 ;
else s -> mv_type = MV_TYPE_8X8 ;
return MB_TYPE_DIRECT2 | MB_TYPE_16x16 | MB_TYPE_L0L1 ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSHttpHdrMethodSet ( TSMBuffer bufp , TSMLoc obj , const char * value , int length ) {
sdk_assert ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_http_hdr_handle ( obj ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) value ) == TS_SUCCESS ) ;
if ( ! isWriteable ( bufp ) ) {
return TS_ERROR ;
}
HTTPHdr h ;
SET_HTTP_HDR ( h , bufp , obj ) ;
if ( length < 0 ) {
length = strlen ( value ) ;
}
h . method_set ( value , length ) ;
return TS_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
unsigned int vp9_variance ## W ## x ## H ## _c ( const uint8_t * a , int a_stride , const uint8_t * b , int b_stride , unsigned int * sse ) {
int sum ;
variance ( a , a_stride , b , b_stride , W , H , sse , & sum ) ;
return * sse - ( ( ( int64_t ) sum * sum ) / ( W * H ) ) ;
\ }
# define SUBPIX_VAR ( W , H ) unsigned int vp9_sub_pixel_variance ## W ## x ## H ## _c ( const uint8_t * src , int src_stride , int xoffset , int yoffset , const uint8_t * dst , int dst_stride , unsigned int * sse ) {
uint16_t fdata3 [ ( H + 1 ) * W ] ;
uint8_t temp2 [ H * W ] ;
var_filter_block2d_bil_first_pass ( src , fdata3 , src_stride , 1 , H + 1 , W , BILINEAR_FILTERS_2TAP ( xoffset ) ) ;
var_filter_block2d_bil_second_pass ( fdata3 , temp2 , W , W , H , W , BILINEAR_FILTERS_2TAP ( yoffset ) ) ;
return vp9_variance ## W ## x ## H ## _c ( temp2 , W , dst , dst_stride , sse ) ;
\ }
# define SUBPIX_AVG_VAR ( W , H ) unsigned int vp9_sub_pixel_avg_variance ## W ## x ## H ## _c ( const uint8_t * src , int src_stride , int xoffset , int yoffset , const uint8_t * dst , int dst_stride , unsigned int * sse , const uint8_t * second_pred ) {
uint16_t fdata3 [ ( H + 1 ) * W ] ;
uint8_t temp2 [ H * W ] ;
DECLARE_ALIGNED_ARRAY ( 16 , uint8_t , temp3 , H * W ) ;
var_filter_block2d_bil_first_pass ( src , fdata3 , src_stride , 1 , H + 1 , W , BILINEAR_FILTERS_2TAP ( xoffset ) ) ;
var_filter_block2d_bil_second_pass ( fdata3 , temp2 , W , W , H , W , BILINEAR_FILTERS_2TAP ( yoffset ) ) ;
vp9_comp_avg_pred ( temp3 , second_pred , W , H , temp2 , W ) ;
return vp9_variance ## W ## x ## H ## _c ( temp3 , W , dst , dst_stride , sse ) ;
\ }
void vp9_get16x16var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) {
variance ( src_ptr , source_stride , ref_ptr , ref_stride , 16 , 16 , sse , sum ) ;
}
void vp9_get8x8var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) {
variance ( src_ptr , source_stride , ref_ptr , ref_stride , 8 , 8 , sse , sum ) ;
}
unsigned int vp9_mse16x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 16 , 16 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse16x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 16 , 8 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse8x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 8 , 16 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse8x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 8 , 8 , sse , & sum ) ;
return * sse ;
}
VAR ( 4 , 4 ) SUBPIX_VAR ( 4 , 4 ) SUBPIX_AVG_VAR ( 4 , 4 ) VAR ( 4 , 8 ) SUBPIX_VAR ( 4 , 8 ) SUBPIX_AVG_VAR ( 4 , 8 ) VAR ( 8 , 4 ) SUBPIX_VAR ( 8 , 4 ) SUBPIX_AVG_VAR ( 8 , 4 ) VAR ( 8 , 8 ) SUBPIX_VAR ( 8 , 8 ) SUBPIX_AVG_VAR ( 8 , 8 ) VAR ( 8 , 16 ) SUBPIX_VAR ( 8 , 16 ) SUBPIX_AVG_VAR ( 8 , 16 ) VAR ( 16 , 8 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_rsl ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ ) {
proto_item * ti ;
proto_tree * rsl_tree ;
guint8 msg_type ;
int offset = 0 ;
col_set_str ( pinfo -> cinfo , COL_PROTOCOL , "RSL" ) ;
col_clear ( pinfo -> cinfo , COL_INFO ) ;
msg_type = tvb_get_guint8 ( tvb , offset + 1 ) & 0x7f ;
col_append_fstr ( pinfo -> cinfo , COL_INFO , "%s " , val_to_str_ext ( msg_type , & rsl_msg_type_vals_ext , "unknown %u" ) ) ;
top_tree = tree ;
ti = proto_tree_add_item ( tree , proto_rsl , tvb , 0 , - 1 , ENC_NA ) ;
if ( ! global_rsl_use_nano_bts ) {
guint8 msg_disc = tvb_get_guint8 ( tvb , offset ) >> 1 ;
if ( msg_disc == RSL_MSGDISC_IPACCESS ) return 0 ;
}
rsl_tree = proto_item_add_subtree ( ti , ett_rsl ) ;
proto_tree_add_item ( rsl_tree , hf_rsl_msg_dsc , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsl_tree , hf_rsl_T_bit , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset = dissct_rsl_msg ( tvb , pinfo , rsl_tree , offset ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void jbig2_free ( Jbig2Allocator * allocator , void * p ) {
allocator -> free ( allocator , p ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_zcl_groups_remove_group ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) {
proto_tree_add_item ( tree , hf_zbee_zcl_groups_group_id , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ff_pre_estimate_p_frame_motion ( MpegEncContext * s , int mb_x , int mb_y ) {
MotionEstContext * const c = & s -> me ;
int mx , my , dmin ;
int P [ 10 ] [ 2 ] ;
const int shift = 1 + s -> quarter_sample ;
const int xy = mb_x + mb_y * s -> mb_stride ;
init_ref ( c , s -> new_picture . f . data , s -> last_picture . f . data , NULL , 16 * mb_x , 16 * mb_y , 0 ) ;
assert ( s -> quarter_sample == 0 || s -> quarter_sample == 1 ) ;
c -> pre_penalty_factor = get_penalty_factor ( s -> lambda , s -> lambda2 , c -> avctx -> me_pre_cmp ) ;
c -> current_mv_penalty = c -> mv_penalty [ s -> f_code ] + MAX_MV ;
get_limits ( s , 16 * mb_x , 16 * mb_y ) ;
c -> skip = 0 ;
P_LEFT [ 0 ] = s -> p_mv_table [ xy + 1 ] [ 0 ] ;
P_LEFT [ 1 ] = s -> p_mv_table [ xy + 1 ] [ 1 ] ;
if ( P_LEFT [ 0 ] < ( c -> xmin << shift ) ) P_LEFT [ 0 ] = ( c -> xmin << shift ) ;
if ( s -> first_slice_line ) {
c -> pred_x = P_LEFT [ 0 ] ;
c -> pred_y = P_LEFT [ 1 ] ;
P_TOP [ 0 ] = P_TOPRIGHT [ 0 ] = P_MEDIAN [ 0 ] = P_TOP [ 1 ] = P_TOPRIGHT [ 1 ] = P_MEDIAN [ 1 ] = 0 ;
}
else {
P_TOP [ 0 ] = s -> p_mv_table [ xy + s -> mb_stride ] [ 0 ] ;
P_TOP [ 1 ] = s -> p_mv_table [ xy + s -> mb_stride ] [ 1 ] ;
P_TOPRIGHT [ 0 ] = s -> p_mv_table [ xy + s -> mb_stride - 1 ] [ 0 ] ;
P_TOPRIGHT [ 1 ] = s -> p_mv_table [ xy + s -> mb_stride - 1 ] [ 1 ] ;
if ( P_TOP [ 1 ] < ( c -> ymin << shift ) ) P_TOP [ 1 ] = ( c -> ymin << shift ) ;
if ( P_TOPRIGHT [ 0 ] > ( c -> xmax << shift ) ) P_TOPRIGHT [ 0 ] = ( c -> xmax << shift ) ;
if ( P_TOPRIGHT [ 1 ] < ( c -> ymin << shift ) ) P_TOPRIGHT [ 1 ] = ( c -> ymin << shift ) ;
P_MEDIAN [ 0 ] = mid_pred ( P_LEFT [ 0 ] , P_TOP [ 0 ] , P_TOPRIGHT [ 0 ] ) ;
P_MEDIAN [ 1 ] = mid_pred ( P_LEFT [ 1 ] , P_TOP [ 1 ] , P_TOPRIGHT [ 1 ] ) ;
c -> pred_x = P_MEDIAN [ 0 ] ;
c -> pred_y = P_MEDIAN [ 1 ] ;
}
dmin = ff_epzs_motion_search ( s , & mx , & my , P , 0 , 0 , s -> p_mv_table , ( 1 << 16 ) >> shift , 0 , 16 ) ;
s -> p_mv_table [ xy ] [ 0 ] = mx << shift ;
s -> p_mv_table [ xy ] [ 1 ] = my << shift ;
return dmin ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_fetch_null ( ) {
MYSQL_STMT * stmt ;
int rc ;
int i , nData ;
MYSQL_BIND my_bind [ 11 ] ;
ulong length [ 11 ] ;
my_bool is_null [ 11 ] ;
char query [ MAX_TEST_QUERY_LENGTH ] ;
myheader ( "test_fetch_null" ) ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS test_fetch_null" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE test_fetch_null(" " col1 tinyint, col2 smallint, " " col3 int, col4 bigint, " " col5 float, col6 double, " " col7 date, col8 time, " " col9 varbinary(10), " " col10 varchar(50), " " col11 char(20))" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "INSERT INTO test_fetch_null (col11) " "VALUES (1000), (88), (389789)" ) ;
myquery ( rc ) ;
rc = mysql_commit ( mysql ) ;
myquery ( rc ) ;
memset ( my_bind , 0 , sizeof ( my_bind ) ) ;
for ( i = 0 ;
i < ( int ) array_elements ( my_bind ) ;
i ++ ) {
my_bind [ i ] . buffer_type = MYSQL_TYPE_LONG ;
my_bind [ i ] . is_null = & is_null [ i ] ;
my_bind [ i ] . length = & length [ i ] ;
}
my_bind [ i - 1 ] . buffer = ( void * ) & nData ;
strmov ( ( char * ) query , "SELECT * FROM test_fetch_null" ) ;
rc = my_stmt_result ( query ) ;
DIE_UNLESS ( rc == 3 ) ;
stmt = mysql_simple_prepare ( mysql , query ) ;
check_stmt ( stmt ) ;
rc = mysql_stmt_bind_result ( stmt , my_bind ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
rc = 0 ;
while ( mysql_stmt_fetch ( stmt ) != MYSQL_NO_DATA ) {
rc ++ ;
for ( i = 0 ;
i < 10 ;
i ++ ) {
if ( ! opt_silent ) fprintf ( stdout , "\n data[%d] : %s" , i , is_null [ i ] ? "NULL" : "NOT NULL" ) ;
DIE_UNLESS ( is_null [ i ] ) ;
}
if ( ! opt_silent ) fprintf ( stdout , "\n data[%d]: %d" , i , nData ) ;
DIE_UNLESS ( nData == 1000 || nData == 88 || nData == 389789 ) ;
DIE_UNLESS ( is_null [ i ] == 0 ) ;
DIE_UNLESS ( length [ i ] == 4 ) ;
}
DIE_UNLESS ( rc == 3 ) ;
mysql_stmt_close ( stmt ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
const struct master_service_settings * master_service_settings_get ( struct master_service * service ATTR_UNUSED ) {
return & set ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSHttpTxnCacheLookupUrlSet ( TSHttpTxn txnp , TSMBuffer bufp , TSMLoc obj ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_url_handle ( obj ) == TS_SUCCESS ) ;
HttpSM * sm = ( HttpSM * ) txnp ;
URL u , * l_url ;
u . m_heap = ( ( HdrHeapSDKHandle * ) bufp ) -> m_heap ;
u . m_url_impl = ( URLImpl * ) obj ;
if ( ! u . valid ( ) ) {
return TS_ERROR ;
}
l_url = sm -> t_state . cache_info . lookup_url ;
if ( ! l_url ) {
sm -> t_state . cache_info . lookup_url_storage . create ( nullptr ) ;
sm -> t_state . cache_info . lookup_url = & ( sm -> t_state . cache_info . lookup_url_storage ) ;
l_url = sm -> t_state . cache_info . lookup_url ;
}
if ( ! l_url || ! l_url -> valid ( ) ) {
return TS_ERROR ;
}
else {
l_url -> copy ( & u ) ;
}
return TS_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int selinux_inode_permission ( struct inode * inode , int mask ) {
const struct cred * cred = current_cred ( ) ;
u32 perms ;
bool from_access ;
unsigned flags = mask & MAY_NOT_BLOCK ;
struct inode_security_struct * isec ;
u32 sid ;
struct av_decision avd ;
int rc , rc2 ;
u32 audited , denied ;
from_access = mask & MAY_ACCESS ;
mask &= ( MAY_READ | MAY_WRITE | MAY_EXEC | MAY_APPEND ) ;
if ( ! mask ) return 0 ;
validate_creds ( cred ) ;
if ( unlikely ( IS_PRIVATE ( inode ) ) ) return 0 ;
perms = file_mask_to_av ( inode -> i_mode , mask ) ;
sid = cred_sid ( cred ) ;
isec = inode_security_rcu ( inode , flags & MAY_NOT_BLOCK ) ;
if ( IS_ERR ( isec ) ) return PTR_ERR ( isec ) ;
rc = avc_has_perm_noaudit ( sid , isec -> sid , isec -> sclass , perms , 0 , & avd ) ;
audited = avc_audit_required ( perms , & avd , rc , from_access ? FILE__AUDIT_ACCESS : 0 , & denied ) ;
if ( likely ( ! audited ) ) return rc ;
rc2 = audit_inode_permission ( inode , perms , audited , denied , rc , flags ) ;
if ( rc2 ) return rc2 ;
return rc ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int libgsm_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) {
int i , ret ;
LibGSMDecodeContext * s = avctx -> priv_data ;
AVFrame * frame = data ;
uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
int16_t * samples ;
if ( buf_size < avctx -> block_align ) {
av_log ( avctx , AV_LOG_ERROR , "Packet is too small\n" ) ;
return AVERROR_INVALIDDATA ;
}
frame -> nb_samples = avctx -> frame_size ;
if ( ( ret = ff_get_buffer ( avctx , frame , 0 ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
samples = ( int16_t * ) frame -> data [ 0 ] ;
for ( i = 0 ;
i < avctx -> frame_size / GSM_FRAME_SIZE ;
i ++ ) {
if ( ( ret = gsm_decode ( s -> state , buf , samples ) ) < 0 ) return - 1 ;
buf += GSM_BLOCK_SIZE ;
samples += GSM_FRAME_SIZE ;
}
* got_frame_ptr = 1 ;
return avctx -> block_align ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static unsigned int mime_application_hash ( GAppInfo * app ) {
const char * id ;
id = g_app_info_get_id ( app ) ;
if ( id == NULL ) {
return GPOINTER_TO_UINT ( app ) ;
}
return g_str_hash ( id ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
extern int name ( int ) __THROW __exctype ( isalnum ) ;
__exctype ( isalpha ) ;
__exctype ( iscntrl ) ;
__exctype ( isdigit ) ;
__exctype ( islower ) ;
__exctype ( isgraph ) ;
__exctype ( isprint ) ;
__exctype ( ispunct ) ;
__exctype ( isspace )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static AsfStream * gst_asf_demux_add_audio_stream ( GstASFDemux * demux , asf_stream_audio * audio , guint16 id , guint8 * * p_data , guint64 * p_size ) {
GstTagList * tags = NULL ;
GstBuffer * extradata = NULL ;
GstPad * src_pad ;
GstCaps * caps ;
guint16 size_left = 0 ;
gchar * codec_name = NULL ;
gchar * name = NULL ;
size_left = audio -> size ;
name = g_strdup_printf ( "audio_%u" , demux -> num_audio_streams ) ;
src_pad = gst_pad_new_from_static_template ( & audio_src_template , name ) ;
g_free ( name ) ;
if ( size_left ) {
GST_INFO_OBJECT ( demux , "Audio header contains %d bytes of " "codec specific data" , size_left ) ;
g_assert ( size_left <= * p_size ) ;
gst_asf_demux_get_buffer ( & extradata , size_left , p_data , p_size ) ;
}
caps = gst_riff_create_audio_caps ( audio -> codec_tag , NULL , ( gst_riff_strf_auds * ) audio , extradata , NULL , & codec_name , NULL ) ;
if ( caps == NULL ) {
caps = gst_caps_new_simple ( "audio/x-asf-unknown" , "codec_id" , G_TYPE_INT , ( gint ) audio -> codec_tag , NULL ) ;
}
if ( codec_name ) {
tags = gst_tag_list_new ( GST_TAG_AUDIO_CODEC , codec_name , NULL ) ;
g_free ( codec_name ) ;
}
if ( audio -> byte_rate > 0 ) {
guint bitrate = audio -> byte_rate * 8 ;
if ( tags == NULL ) tags = gst_tag_list_new_empty ( ) ;
gst_tag_list_add ( tags , GST_TAG_MERGE_KEEP , GST_TAG_BITRATE , bitrate , NULL ) ;
}
if ( extradata ) gst_buffer_unref ( extradata ) ;
GST_INFO ( "Adding audio stream #%u, id %u codec %u (0x%04x), tags=%" GST_PTR_FORMAT , demux -> num_audio_streams , id , audio -> codec_tag , audio -> codec_tag , tags ) ;
++ demux -> num_audio_streams ;
return gst_asf_demux_setup_pad ( demux , src_pad , caps , id , FALSE , NULL , tags ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dsa_cmp_parameters ( const EVP_PKEY * a , const EVP_PKEY * b ) {
if ( BN_cmp ( a -> pkey . dsa -> p , b -> pkey . dsa -> p ) || BN_cmp ( a -> pkey . dsa -> q , b -> pkey . dsa -> q ) || BN_cmp ( a -> pkey . dsa -> g , b -> pkey . dsa -> g ) ) return 0 ;
else return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * lookup_name ( struct cpio * cpio , struct name_cache * * name_cache_variable , int ( * lookup_fn ) ( struct cpio * , const char * * , id_t ) , id_t id ) {
char asnum [ 16 ] ;
struct name_cache * cache ;
const char * name ;
int slot ;
if ( * name_cache_variable == NULL ) {
* name_cache_variable = malloc ( sizeof ( struct name_cache ) ) ;
if ( * name_cache_variable == NULL ) lafe_errc ( 1 , ENOMEM , "No more memory" ) ;
memset ( * name_cache_variable , 0 , sizeof ( struct name_cache ) ) ;
( * name_cache_variable ) -> size = name_cache_size ;
}
cache = * name_cache_variable ;
cache -> probes ++ ;
slot = id % cache -> size ;
if ( cache -> cache [ slot ] . name != NULL ) {
if ( cache -> cache [ slot ] . id == id ) {
cache -> hits ++ ;
return ( cache -> cache [ slot ] . name ) ;
}
free ( cache -> cache [ slot ] . name ) ;
cache -> cache [ slot ] . name = NULL ;
}
if ( lookup_fn ( cpio , & name , id ) == 0 ) {
if ( name == NULL || name [ 0 ] == '\0' ) {
snprintf ( asnum , sizeof ( asnum ) , "%u" , ( unsigned ) id ) ;
name = asnum ;
}
cache -> cache [ slot ] . name = strdup ( name ) ;
if ( cache -> cache [ slot ] . name != NULL ) {
cache -> cache [ slot ] . id = id ;
return ( cache -> cache [ slot ] . name ) ;
}
}
return ( NULL ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void fz_colorspace_name_colorant ( fz_context * ctx , fz_colorspace * cs , int i , const char * name ) {
if ( ! cs ) return ;
if ( i < 0 || i >= cs -> n ) fz_throw ( ctx , FZ_ERROR_GENERIC , "Attempt to name out of range colorant" ) ;
fz_free ( ctx , cs -> colorant [ i ] ) ;
cs -> colorant [ i ] = NULL ;
if ( name ) {
cs -> colorant [ i ] = fz_strdup ( ctx , name ) ;
if ( cs -> type == FZ_COLORSPACE_SEPARATION ) {
if ( i == 0 ) {
if ( strcmp ( name , "Cyan" ) == 0 || strcmp ( name , "Magenta" ) == 0 || strcmp ( name , "Yellow" ) == 0 || strcmp ( name , "Black" ) == 0 ) {
cs -> flags |= FZ_CS_HAS_CMYK ;
}
}
else {
if ( ( cs -> flags & FZ_CS_HAS_CMYK_AND_SPOTS ) != FZ_CS_HAS_CMYK_AND_SPOTS ) {
if ( strcmp ( name , "Cyan" ) == 0 || strcmp ( name , "Magenta" ) == 0 || strcmp ( name , "Yellow" ) == 0 || strcmp ( name , "Black" ) == 0 ) cs -> flags |= FZ_CS_HAS_CMYK ;
else cs -> flags |= FZ_CS_HAS_SPOTS ;
}
}
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static double eqjoinsel_inner ( Oid operator , VariableStatData * vardata1 , VariableStatData * vardata2 ) {
double selec ;
double nd1 ;
double nd2 ;
bool isdefault1 ;
bool isdefault2 ;
Oid opfuncoid ;
Form_pg_statistic stats1 = NULL ;
Form_pg_statistic stats2 = NULL ;
bool have_mcvs1 = false ;
Datum * values1 = NULL ;
int nvalues1 = 0 ;
float4 * numbers1 = NULL ;
int nnumbers1 = 0 ;
bool have_mcvs2 = false ;
Datum * values2 = NULL ;
int nvalues2 = 0 ;
float4 * numbers2 = NULL ;
int nnumbers2 = 0 ;
nd1 = get_variable_numdistinct ( vardata1 , & isdefault1 ) ;
nd2 = get_variable_numdistinct ( vardata2 , & isdefault2 ) ;
opfuncoid = get_opcode ( operator ) ;
if ( HeapTupleIsValid ( vardata1 -> statsTuple ) ) {
stats1 = ( Form_pg_statistic ) GETSTRUCT ( vardata1 -> statsTuple ) ;
if ( statistic_proc_security_check ( vardata1 , opfuncoid ) ) have_mcvs1 = get_attstatsslot ( vardata1 -> statsTuple , vardata1 -> atttype , vardata1 -> atttypmod , STATISTIC_KIND_MCV , InvalidOid , NULL , & values1 , & nvalues1 , & numbers1 , & nnumbers1 ) ;
}
if ( HeapTupleIsValid ( vardata2 -> statsTuple ) ) {
stats2 = ( Form_pg_statistic ) GETSTRUCT ( vardata2 -> statsTuple ) ;
if ( statistic_proc_security_check ( vardata2 , opfuncoid ) ) have_mcvs2 = get_attstatsslot ( vardata2 -> statsTuple , vardata2 -> atttype , vardata2 -> atttypmod , STATISTIC_KIND_MCV , InvalidOid , NULL , & values2 , & nvalues2 , & numbers2 , & nnumbers2 ) ;
}
if ( have_mcvs1 && have_mcvs2 ) {
FmgrInfo eqproc ;
bool * hasmatch1 ;
bool * hasmatch2 ;
double nullfrac1 = stats1 -> stanullfrac ;
double nullfrac2 = stats2 -> stanullfrac ;
double matchprodfreq , matchfreq1 , matchfreq2 , unmatchfreq1 , unmatchfreq2 , otherfreq1 , otherfreq2 , totalsel1 , totalsel2 ;
int i , nmatches ;
fmgr_info ( opfuncoid , & eqproc ) ;
hasmatch1 = ( bool * ) palloc0 ( nvalues1 * sizeof ( bool ) ) ;
hasmatch2 = ( bool * ) palloc0 ( nvalues2 * sizeof ( bool ) ) ;
matchprodfreq = 0.0 ;
nmatches = 0 ;
for ( i = 0 ;
i < nvalues1 ;
i ++ ) {
int j ;
for ( j = 0 ;
j < nvalues2 ;
j ++ ) {
if ( hasmatch2 [ j ] ) continue ;
if ( DatumGetBool ( FunctionCall2Coll ( & eqproc , DEFAULT_COLLATION_OID , values1 [ i ] , values2 [ j ] ) ) ) {
hasmatch1 [ i ] = hasmatch2 [ j ] = true ;
matchprodfreq += numbers1 [ i ] * numbers2 [ j ] ;
nmatches ++ ;
break ;
}
}
}
CLAMP_PROBABILITY ( matchprodfreq ) ;
matchfreq1 = unmatchfreq1 = 0.0 ;
for ( i = 0 ;
i < nvalues1 ;
i ++ ) {
if ( hasmatch1 [ i ] ) matchfreq1 += numbers1 [ i ] ;
else unmatchfreq1 += numbers1 [ i ] ;
}
CLAMP_PROBABILITY ( matchfreq1 ) ;
CLAMP_PROBABILITY ( unmatchfreq1 ) ;
matchfreq2 = unmatchfreq2 = 0.0 ;
for ( i = 0 ;
i < nvalues2 ;
i ++ ) {
if ( hasmatch2 [ i ] ) matchfreq2 += numbers2 [ i ] ;
else unmatchfreq2 += numbers2 [ i ] ;
}
CLAMP_PROBABILITY ( matchfreq2 ) ;
CLAMP_PROBABILITY ( unmatchfreq2 ) ;
pfree ( hasmatch1 ) ;
pfree ( hasmatch2 ) ;
otherfreq1 = 1.0 - nullfrac1 - matchfreq1 - unmatchfreq1 ;
otherfreq2 = 1.0 - nullfrac2 - matchfreq2 - unmatchfreq2 ;
CLAMP_PROBABILITY ( otherfreq1 ) ;
CLAMP_PROBABILITY ( otherfreq2 ) ;
totalsel1 = matchprodfreq ;
if ( nd2 > nvalues2 ) totalsel1 += unmatchfreq1 * otherfreq2 / ( nd2 - nvalues2 ) ;
if ( nd2 > nmatches ) totalsel1 += otherfreq1 * ( otherfreq2 + unmatchfreq2 ) / ( nd2 - nmatches ) ;
totalsel2 = matchprodfreq ;
if ( nd1 > nvalues1 ) totalsel2 += unmatchfreq2 * otherfreq1 / ( nd1 - nvalues1 ) ;
if ( nd1 > nmatches ) totalsel2 += otherfreq2 * ( otherfreq1 + unmatchfreq1 ) / ( nd1 - nmatches ) ;
selec = ( totalsel1 < totalsel2 ) ? totalsel1 : totalsel2 ;
}
else {
double nullfrac1 = stats1 ? stats1 -> stanullfrac : 0.0 ;
double nullfrac2 = stats2 ? stats2 -> stanullfrac : 0.0 ;
selec = ( 1.0 - nullfrac1 ) * ( 1.0 - nullfrac2 ) ;
if ( nd1 > nd2 ) selec /= nd1 ;
else selec /= nd2 ;
}
if ( have_mcvs1 ) free_attstatsslot ( vardata1 -> atttype , values1 , nvalues1 , numbers1 , nnumbers1 ) ;
if ( have_mcvs2 ) free_attstatsslot ( vardata2 -> atttype , values2 , nvalues2 , numbers2 , nnumbers2 ) ;
return selec ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int32_t rleStringToByteArray ( uint16_t * src , int32_t srcLen , uint8_t * target , int32_t tgtLen , UErrorCode * status ) {
int32_t length = 0 ;
UBool nextChar = TRUE ;
uint16_t c = 0 ;
int32_t node = 0 ;
int32_t runLength = 0 ;
int32_t i = 2 ;
int32_t ai = 0 ;
if ( ! status || U_FAILURE ( * status ) ) {
return 0 ;
}
if ( srcLen == - 1 ) {
srcLen = u_strlen ( src ) ;
}
if ( srcLen <= 2 ) {
return 2 ;
}
length = ( ( ( int32_t ) src [ 0 ] ) << 16 ) | ( ( int32_t ) src [ 1 ] ) ;
if ( target == NULL ) {
return length ;
}
if ( tgtLen < length ) {
* status = U_BUFFER_OVERFLOW_ERROR ;
return length ;
}
for ( ;
ai < tgtLen ;
) {
uint8_t b ;
if ( nextChar ) {
c = src [ i ++ ] ;
b = ( uint8_t ) ( c >> 8 ) ;
nextChar = FALSE ;
}
else {
b = ( uint8_t ) ( c & 0xFF ) ;
nextChar = TRUE ;
}
switch ( node ) {
case 0 : if ( b == ESCAPE_BYTE ) {
node = 1 ;
}
else {
target [ ai ++ ] = b ;
}
break ;
case 1 : if ( b == ESCAPE_BYTE ) {
target [ ai ++ ] = ESCAPE_BYTE ;
node = 0 ;
}
else {
runLength = b ;
node = 2 ;
}
break ;
case 2 : {
int j = 0 ;
for ( ;
j < runLength ;
++ j ) {
if ( ai < tgtLen ) {
target [ ai ++ ] = b ;
}
else {
* status = U_BUFFER_OVERFLOW_ERROR ;
return ai ;
}
}
node = 0 ;
break ;
}
}
}
if ( node != 0 ) {
* status = U_INTERNAL_PROGRAM_ERROR ;
return 0 ;
}
if ( i != srcLen ) {
* status = U_INTERNAL_PROGRAM_ERROR ;
return ai ;
}
return ai ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ffv1_common_init ( AVCodecContext * avctx ) {
FFV1Context * s = avctx -> priv_data ;
s -> avctx = avctx ;
s -> flags = avctx -> flags ;
if ( ! avctx -> width || ! avctx -> height ) return AVERROR_INVALIDDATA ;
avcodec_get_frame_defaults ( & s -> picture ) ;
ff_dsputil_init ( & s -> dsp , avctx ) ;
s -> width = avctx -> width ;
s -> height = avctx -> height ;
s -> num_h_slices = 1 ;
s -> num_v_slices = 1 ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void proto_register_btgatt ( void ) {
static hf_register_info hf [ ] = {
{
& hf_gatt_nordic_uart_tx , {
"UART Tx" , "btgatt.nordic.uart_tx" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_nordic_uart_rx , {
"UART Rx" , "btgatt.nordic.uart_rx" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_nordic_dfu_packet , {
"Packet" , "btgatt.nordic.dfu.packet" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_nordic_dfu_control_point_opcode , {
"Opcode" , "btgatt.nordic.dfu.control_point.opcode" , FT_UINT8 , BASE_DEC , VALS ( nordic_dfu_control_point_opcode_vals ) , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_nordic_dfu_control_point_init_packet , {
"Init Packet" , "btgatt.nordic.dfu.control_point.init_packet" , FT_UINT8 , BASE_HEX , VALS ( nordic_dfu_control_point_init_packet_vals ) , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_nordic_dfu_control_point_image_type , {
"Image Type" , "btgatt.nordic.dfu.control_point.image_type" , FT_UINT8 , BASE_HEX , VALS ( nordic_dfu_control_point_image_type_vals ) , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_nordic_dfu_control_point_number_of_bytes , {
"Number of Bytes of Firmware Image Received" , "btgatt.nordic.dfu.control_point.number_of_bytes" , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_nordic_dfu_control_point_number_of_packets , {
"Number of Packets" , "btgatt.nordic.dfu.control_point.number_of_packets" , FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_nordic_dfu_control_point_request_opcode , {
"Request Opcode" , "btgatt.nordic.dfu.control_point.request_opcode" , FT_UINT8 , BASE_DEC , VALS ( nordic_dfu_control_point_opcode_vals ) , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_nordic_dfu_control_point_response_value , {
"Response Value" , "btgatt.nordic.dfu.control_point.response_value" , FT_UINT8 , BASE_DEC , VALS ( nordic_dfu_control_point_response_value_vals ) , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_accelerometer_data , {
"Accelerometer Data" , "btgatt.microbit.accelerometer.data" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_accelerometer_x , {
"X axis" , "btgatt.microbit.accelerometer.x" , FT_DOUBLE , BASE_NONE , NULL , 0x0 , "Accelerometer X axis" , HFILL }
}
, {
& hf_gatt_microbit_accelerometer_y , {
"Y axis" , "btgatt.microbit.accelerometer.y" , FT_DOUBLE , BASE_NONE , NULL , 0x0 , "Accelerometer Y axis" , HFILL }
}
, {
& hf_gatt_microbit_accelerometer_z , {
"Z axis" , "btgatt.microbit.accelerometer.z" , FT_DOUBLE , BASE_NONE , NULL , 0x0 , "Accelerometer Z axis" , HFILL }
}
, {
& hf_gatt_microbit_accelerometer_period , {
"Accelerometer Period" , "btgatt.microbit.accelerometer.period" , FT_UINT16 , BASE_DEC | BASE_UNIT_STRING , & units_milliseconds , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_magnetometer_data , {
"Magnetometer Data" , "btgatt.microbit.magnetometer.data" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_magnetometer_x , {
"X axis" , "btgatt.microbit.magnetometer.x" , FT_DOUBLE , BASE_NONE , NULL , 0x0 , "Magnetometer X axis" , HFILL }
}
, {
& hf_gatt_microbit_magnetometer_y , {
"Y axis" , "btgatt.microbit.magnetometer.y" , FT_DOUBLE , BASE_NONE , NULL , 0x0 , "Magnetometer Y axis" , HFILL }
}
, {
& hf_gatt_microbit_magnetometer_z , {
"Z axis" , "btgatt.microbit.magnetometer.z" , FT_DOUBLE , BASE_NONE , NULL , 0x0 , "Magnetometer Z axis" , HFILL }
}
, {
& hf_gatt_microbit_magnetometer_period , {
"Magnetometer Period" , "btgatt.microbit.magnetometer.period" , FT_UINT16 , BASE_DEC | BASE_UNIT_STRING , & units_milliseconds , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_magnetometer_bearing , {
"Magnetometer Bearing" , "btgatt.microbit.magnetometer.bearing" , FT_UINT16 , BASE_DEC | BASE_UNIT_STRING , & units_degree_bearing , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_button_a_state , {
"Button A" , "btgatt.microbit.button.a" , FT_UINT8 , BASE_DEC , VALS ( btgatt_microbit_button_state_vals ) , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_button_b_state , {
"Button B" , "btgatt.microbit.button.b" , FT_UINT8 , BASE_DEC , VALS ( btgatt_microbit_button_state_vals ) , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_pin_data , {
"Pin Data" , "btgatt.microbit.pin_data" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_pin_number , {
"Pin Number" , "btgatt.microbit.pin_data.number" , FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_pin_value , {
"Pin Value" , "btgatt.microbit.pin_data.value" , FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_pin_ad_config , {
"Pin AD Configuration" , "btgatt.microbit.pin_ad_config.value" , FT_UINT24 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin0 , {
"Pin 0" , "btgatt.microbit.pin_ad_config.pin0" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x000001 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin1 , {
"Pin 1" , "btgatt.microbit.pin_ad_config.pin1" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x000002 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin2 , {
"Pin 2" , "btgatt.microbit.pin_ad_config.pin2" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x000004 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin3 , {
"Pin 3" , "btgatt.microbit.pin_ad_config.pin3" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x000008 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin4 , {
"Pin 4" , "btgatt.microbit.pin_ad_config.pin4" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x000010 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin5 , {
"Pin 5" , "btgatt.microbit.pin_ad_config.pin5" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x000020 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin6 , {
"Pin 6" , "btgatt.microbit.pin_ad_config.pin6" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x000040 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin7 , {
"Pin 7" , "btgatt.microbit.pin_ad_config.pin7" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x000080 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin8 , {
"Pin 8" , "btgatt.microbit.pin_ad_config.pin8" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x000100 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin9 , {
"Pin 9" , "btgatt.microbit.pin_ad_config.pin9" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x000200 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin10 , {
"Pin 10" , "btgatt.microbit.pin_ad_config.pin10" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x000400 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin11 , {
"Pin 11" , "btgatt.microbit.pin_ad_config.pin11" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x000800 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin12 , {
"Pin 12" , "btgatt.microbit.pin_ad_config.pin12" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x001000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin13 , {
"Pin 13" , "btgatt.microbit.pin_ad_config.pin13" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x002000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin14 , {
"Pin 14" , "btgatt.microbit.pin_ad_config.pin14" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x004000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin15 , {
"Pin 15" , "btgatt.microbit.pin_ad_config.pin15" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x008000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin16 , {
"Pin 16" , "btgatt.microbit.pin_ad_config.pin16" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x010000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin17 , {
"Pin 17" , "btgatt.microbit.pin_ad_config.pin17" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x020000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin18 , {
"Pin 18" , "btgatt.microbit.pin_ad_config.pin18" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x040000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_ad_pin19 , {
"Pin 19" , "btgatt.microbit.pin_ad_config.pin19" , FT_BOOLEAN , 20 , TFS ( & microbit_ad_tfs ) , 0x080000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_pin_io_config , {
"Pin IO Configuration" , "btgatt.microbit.pin_io_config.value" , FT_UINT24 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin0 , {
"Pin 0" , "btgatt.microbit.pin_io_config.pin0" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x000001 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin1 , {
"Pin 1" , "btgatt.microbit.pin_io_config.pin1" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x000002 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin2 , {
"Pin 2" , "btgatt.microbit.pin_io_config.pin2" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x000004 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin3 , {
"Pin 3" , "btgatt.microbit.pin_io_config.pin3" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x000008 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin4 , {
"Pin 4" , "btgatt.microbit.pin_io_config.pin4" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x000010 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin5 , {
"Pin 5" , "btgatt.microbit.pin_io_config.pin5" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x000020 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin6 , {
"Pin 6" , "btgatt.microbit.pin_io_config.pin6" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x000040 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin7 , {
"Pin 7" , "btgatt.microbit.pin_io_config.pin7" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x000080 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin8 , {
"Pin 8" , "btgatt.microbit.pin_io_config.pin8" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x000100 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin9 , {
"Pin 9" , "btgatt.microbit.pin_io_config.pin9" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x000200 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin10 , {
"Pin 10" , "btgatt.microbit.pin_io_config.pin10" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x000400 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin11 , {
"Pin 11" , "btgatt.microbit.pin_io_config.pin11" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x000800 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin12 , {
"Pin 12" , "btgatt.microbit.pin_io_config.pin12" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x001000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin13 , {
"Pin 13" , "btgatt.microbit.pin_io_config.pin13" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x002000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin14 , {
"Pin 14" , "btgatt.microbit.pin_io_config.pin14" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x004000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin15 , {
"Pin 15" , "btgatt.microbit.pin_io_config.pin15" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x008000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin16 , {
"Pin 16" , "btgatt.microbit.pin_io_config.pin16" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x010000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin17 , {
"Pin 17" , "btgatt.microbit.pin_io_config.pin17" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x020000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin18 , {
"Pin 18" , "btgatt.microbit.pin_io_config.pin18" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x040000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_io_pin19 , {
"Pin 19" , "btgatt.microbit.pin_io_config.pin19" , FT_BOOLEAN , 20 , TFS ( & microbit_io_tfs ) , 0x080000 , NULL , HFILL }
}
, {
& hf_gatt_microbit_pwm_control , {
"PWM Control" , "btgatt.microbit.pwm_control" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_led_matrix , {
"LED Matrix" , "btgatt.microbit.led_matrix" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_led_text , {
"LED Text" , "btgatt.microbit.led_text" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_scrolling_delay , {
"Scrolling Delay" , "btgatt.microbit.scrolling_delay" , FT_UINT16 , BASE_DEC | BASE_UNIT_STRING , & units_milliseconds , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_microbit_requirements , {
"MicroBit Requirements" , "btgatt.microbit.microbit_requirements" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_microbit_event , {
"MicroBit Event" , "btgatt.microbit.microbit_event" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_client_requirements , {
"Client Requirements" , "btgatt.microbit.client_requirements" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_client_event , {
"Client Event" , "btgatt.microbit.client_event" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_dfu_control , {
"DFU Control" , "btgatt.microbit.dfu_control" , FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_temperature_value , {
"Temperature" , "btgatt.microbit.temperature.value" , FT_INT8 , BASE_DEC | BASE_UNIT_STRING , & units_degree_celsius , 0x0 , NULL , HFILL }
}
, {
& hf_gatt_microbit_temperature_period , {
"Temperature Period" , "btgatt.microbit.temperature.period" , FT_UINT16 , BASE_DEC | BASE_UNIT_STRING , & units_milliseconds , 0x0 , NULL , HFILL }
}
}
;
static gint * ett [ ] = {
& ett_btgatt , & ett_btgatt_microbit_accelerometer , & ett_btgatt_microbit_magnetometer , & ett_btgatt_microbit_pin_data , & ett_btgatt_microbit_pin_ad_config , & ett_btgatt_microbit_pin_io_config , }
;
proto_btgatt = proto_register_protocol ( "Bluetooth GATT Attribute Protocol" , "BT GATT" , "btgatt" ) ;
btgatt_handle = register_dissector ( "btgatt" , dissect_btgatt , proto_btgatt ) ;
proto_register_field_array ( proto_btgatt , 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 dissect_h245_Ind_multiplex ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_Ind_multiplex , Ind_multiplex_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int uwsgi_php_request ( struct wsgi_request * wsgi_req ) {
char real_filename [ PATH_MAX + 1 ] ;
char * path_info = NULL ;
size_t real_filename_len = 0 ;
struct stat php_stat ;
char * filename = NULL ;
int force_empty_script_name = 0 ;
zend_file_handle file_handle ;
# ifdef ZTS TSRMLS_FETCH ( ) ;
# endif SG ( server_context ) = ( void * ) wsgi_req ;
if ( uwsgi_parse_vars ( wsgi_req ) ) {
return - 1 ;
}
char * orig_path_info = wsgi_req -> path_info ;
uint16_t orig_path_info_len = wsgi_req -> path_info_len ;
if ( uphp . docroot ) {
wsgi_req -> document_root = uphp . docroot ;
}
else if ( ! wsgi_req -> document_root_len ) {
wsgi_req -> document_root = uwsgi . cwd ;
}
else {
char * sanitized_docroot = ecalloc ( 1 , PATH_MAX + 1 ) ;
if ( ! uwsgi_expand_path ( wsgi_req -> document_root , wsgi_req -> document_root_len , sanitized_docroot ) ) {
efree ( sanitized_docroot ) ;
return - 1 ;
}
wsgi_req -> document_root = sanitized_docroot ;
}
wsgi_req -> document_root_len = strlen ( wsgi_req -> document_root ) ;
if ( uphp . app ) {
# ifdef UWSGI_PCRE struct uwsgi_regexp_list * bypass = uphp . app_bypass ;
while ( bypass ) {
if ( uwsgi_regexp_match ( bypass -> pattern , bypass -> pattern_extra , wsgi_req -> uri , wsgi_req -> uri_len ) >= 0 ) {
goto oldstyle ;
}
bypass = bypass -> next ;
}
# endif strcpy ( real_filename , uphp . app ) ;
if ( wsgi_req -> path_info_len == 1 && wsgi_req -> path_info [ 0 ] == '/' ) {
goto appready ;
}
if ( uphp . app_qs ) {
size_t app_qs_len = strlen ( uphp . app_qs ) ;
size_t qs_len = wsgi_req -> path_info_len + app_qs_len ;
if ( wsgi_req -> query_string_len > 0 ) {
qs_len += 1 + wsgi_req -> query_string_len ;
}
char * qs = ecalloc ( 1 , qs_len + 1 ) ;
memcpy ( qs , uphp . app_qs , app_qs_len ) ;
memcpy ( qs + app_qs_len , wsgi_req -> path_info , wsgi_req -> path_info_len ) ;
if ( wsgi_req -> query_string_len > 0 ) {
char * ptr = qs + app_qs_len + wsgi_req -> path_info_len ;
* ptr = '&' ;
memcpy ( ptr + 1 , wsgi_req -> query_string , wsgi_req -> query_string_len ) ;
}
wsgi_req -> query_string = qs ;
wsgi_req -> query_string_len = qs_len ;
}
appready : wsgi_req -> path_info = "" ;
wsgi_req -> path_info_len = 0 ;
force_empty_script_name = 1 ;
goto secure2 ;
}
# ifdef UWSGI_PCRE oldstyle : # endif filename = uwsgi_concat4n ( wsgi_req -> document_root , wsgi_req -> document_root_len , "/" , 1 , wsgi_req -> path_info , wsgi_req -> path_info_len , "" , 0 ) ;
if ( uwsgi_php_walk ( wsgi_req , filename , wsgi_req -> document_root , wsgi_req -> document_root_len , & path_info ) ) {
free ( filename ) ;
if ( uphp . fallback || uphp . fallback2 ) {
if ( uphp . fallback ) {
filename = uwsgi_str ( uphp . fallback ) ;
}
else {
filename = uwsgi_concat2n ( wsgi_req -> document_root , strlen ( wsgi_req -> document_root ) , uphp . fallback2 , strlen ( uphp . fallback2 ) ) ;
wsgi_req -> script_name = uphp . fallback2 ;
wsgi_req -> script_name_len = strlen ( uphp . fallback2 ) ;
}
if ( uphp . fallback_qs ) {
size_t fqs_len = strlen ( uphp . fallback_qs ) ;
size_t new_qs_len = orig_path_info_len + fqs_len + 1 + wsgi_req -> query_string_len ;
char * new_qs = ecalloc ( 1 , new_qs_len + 1 ) ;
memcpy ( new_qs , uphp . fallback_qs , fqs_len ) ;
new_qs [ fqs_len ] = '=' ;
memcpy ( new_qs + fqs_len + 1 , orig_path_info , orig_path_info_len ) ;
if ( wsgi_req -> query_string_len ) {
new_qs [ fqs_len + 1 + orig_path_info_len ] = '&' ;
memcpy ( new_qs + fqs_len + 2 + orig_path_info_len , wsgi_req -> query_string , wsgi_req -> query_string_len ) ;
}
wsgi_req -> query_string = new_qs ;
wsgi_req -> query_string_len = new_qs_len ;
}
}
else {
uwsgi_404 ( wsgi_req ) ;
return - 1 ;
}
}
if ( path_info ) {
wsgi_req -> path_info = path_info ;
wsgi_req -> path_info_len = orig_path_info_len - ( path_info - orig_path_info ) ;
}
else {
wsgi_req -> path_info = "" ;
wsgi_req -> path_info_len = 0 ;
}
if ( ! realpath ( filename , real_filename ) ) {
free ( filename ) ;
uwsgi_404 ( wsgi_req ) ;
return - 1 ;
}
free ( filename ) ;
real_filename_len = strlen ( real_filename ) ;
if ( uphp . allowed_docroot ) {
struct uwsgi_string_list * usl = uphp . allowed_docroot ;
while ( usl ) {
if ( ! uwsgi_starts_with ( real_filename , real_filename_len , usl -> value , usl -> len ) ) {
goto secure ;
}
usl = usl -> next ;
}
uwsgi_403 ( wsgi_req ) ;
uwsgi_log ( "PHP security error: %s is not under an allowed docroot\n" , real_filename ) ;
return - 1 ;
}
secure : if ( stat ( real_filename , & php_stat ) ) {
uwsgi_404 ( wsgi_req ) ;
return UWSGI_OK ;
}
if ( S_ISDIR ( php_stat . st_mode ) ) {
if ( orig_path_info_len == 0 || ( orig_path_info_len > 0 && orig_path_info [ orig_path_info_len - 1 ] != '/' ) ) {
wsgi_req -> path_info = orig_path_info ;
wsgi_req -> path_info_len = orig_path_info_len ;
uwsgi_redirect_to_slash ( wsgi_req ) ;
return UWSGI_OK ;
}
struct uwsgi_string_list * upi = uphp . index ;
real_filename [ real_filename_len ] = '/' ;
real_filename_len ++ ;
int found = 0 ;
while ( upi ) {
if ( real_filename_len + upi -> len + 1 < PATH_MAX ) {
memcpy ( real_filename + real_filename_len , upi -> value , upi -> len + 1 ) ;
if ( ! access ( real_filename , R_OK ) ) {
found = 1 ;
break ;
}
}
upi = upi -> next ;
}
if ( ! found ) {
uwsgi_404 ( wsgi_req ) ;
return UWSGI_OK ;
}
real_filename_len = strlen ( real_filename ) ;
}
if ( uphp . allowed_ext ) {
struct uwsgi_string_list * usl = uphp . allowed_ext ;
while ( usl ) {
if ( real_filename_len >= usl -> len ) {
if ( ! uwsgi_strncmp ( real_filename + ( real_filename_len - usl -> len ) , usl -> len , usl -> value , usl -> len ) ) {
goto secure2 ;
}
}
usl = usl -> next ;
}
uwsgi_403 ( wsgi_req ) ;
uwsgi_log ( "PHP security error: %s does not end with an allowed extension\n" , real_filename ) ;
return - 1 ;
}
secure2 : wsgi_req -> file = real_filename ;
wsgi_req -> file_len = strlen ( wsgi_req -> file ) ;
if ( uphp . allowed_scripts ) {
struct uwsgi_string_list * usl = uphp . allowed_scripts ;
while ( usl ) {
if ( ! uwsgi_strncmp ( wsgi_req -> file , wsgi_req -> file_len , usl -> value , usl -> len ) ) {
goto secure3 ;
}
usl = usl -> next ;
}
uwsgi_403 ( wsgi_req ) ;
uwsgi_log ( "PHP security error: %s is not an allowed script\n" , real_filename ) ;
return - 1 ;
}
secure3 : if ( force_empty_script_name ) {
wsgi_req -> script_name = "" ;
wsgi_req -> script_name_len = 0 ;
}
else if ( ! uphp . fallback2 ) {
wsgi_req -> script_name = orig_path_info ;
if ( path_info ) {
wsgi_req -> script_name_len = path_info - orig_path_info ;
}
else {
wsgi_req -> script_name_len = orig_path_info_len ;
}
}
# ifdef UWSGI_DEBUG uwsgi_log ( "php filename = %s script_name = %.*s (%d) document_root = %.*s (%d)\n" , real_filename , wsgi_req -> script_name_len , wsgi_req -> script_name , wsgi_req -> script_name_len , wsgi_req -> document_root_len , wsgi_req -> document_root , wsgi_req -> document_root_len ) ;
# endif SG ( request_info ) . request_uri = estrndup ( wsgi_req -> uri , wsgi_req -> uri_len ) ;
SG ( request_info ) . request_method = estrndup ( wsgi_req -> method , wsgi_req -> method_len ) ;
SG ( request_info ) . proto_num = 1001 ;
SG ( request_info ) . query_string = estrndup ( wsgi_req -> query_string , wsgi_req -> query_string_len ) ;
SG ( request_info ) . content_length = wsgi_req -> post_cl ;
SG ( request_info ) . content_type = estrndup ( wsgi_req -> content_type , wsgi_req -> content_type_len ) ;
SG ( sapi_headers ) . http_response_code = 200 ;
SG ( request_info ) . path_translated = wsgi_req -> file ;
file_handle . type = ZEND_HANDLE_FILENAME ;
file_handle . filename = real_filename ;
file_handle . free_filename = 0 ;
file_handle . opened_path = NULL ;
if ( php_request_startup ( TSRMLS_C ) == FAILURE ) {
uwsgi_500 ( wsgi_req ) ;
return - 1 ;
}
struct uwsgi_string_list * usl = NULL ;
uwsgi_foreach ( usl , uphp . exec_before ) {
if ( zend_eval_string_ex ( usl -> value , NULL , "uWSGI php exec before" , 1 TSRMLS_CC ) == FAILURE ) goto end ;
}
php_execute_script ( & file_handle TSRMLS_CC ) ;
uwsgi_foreach ( usl , uphp . exec_after ) {
if ( zend_eval_string_ex ( usl -> value , NULL , "uWSGI php exec after" , 1 TSRMLS_CC ) == FAILURE ) goto end ;
}
end : php_request_shutdown ( NULL ) ;
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSUrlPortSet ( TSMBuffer bufp , TSMLoc obj , int port ) {
sdk_assert ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_url_handle ( obj ) == TS_SUCCESS ) ;
if ( ! isWriteable ( bufp ) || ( port < 0 ) ) {
return TS_ERROR ;
}
URL u ;
u . m_heap = ( ( HdrHeapSDKHandle * ) bufp ) -> m_heap ;
u . m_url_impl = ( URLImpl * ) obj ;
u . port_set ( port ) ;
return TS_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
GType hb_gobject_ ## name ## _get_type ( void ) \ {
static gsize type_id = 0 ;
if ( g_once_init_enter ( & type_id ) ) {
GType id = g_boxed_type_register_static ( g_intern_static_string ( "hb_" # name "_t" ) , ( GBoxedCopyFunc ) copy_func , ( GBoxedFreeFunc ) free_func ) ;
g_once_init_leave ( & type_id , id ) ;
}
return type_id ;
\ }
# define HB_DEFINE_OBJECT_TYPE ( name ) HB_DEFINE_BOXED_TYPE ( name , hb_ ## name ## _reference , hb_ ## name ## _destroy ) ;
HB_DEFINE_OBJECT_TYPE ( buffer ) HB_DEFINE_OBJECT_TYPE ( blob ) HB_DEFINE_OBJECT_TYPE ( face ) HB_DEFINE_OBJECT_TYPE ( font ) HB_DEFINE_OBJECT_TYPE ( font_funcs ) HB_DEFINE_OBJECT_TYPE ( set ) HB_DEFINE_OBJECT_TYPE ( shape_plan ) HB_DEFINE_OBJECT_TYPE ( unicode_funcs )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( ProfileBrowserTest , URLFetcherUsingMediaContextDuringShutdown ) {
StartActiveFetcherDuringProfileShutdownTest ( content : : BrowserContext : : GetDefaultStoragePartition ( browser ( ) -> profile ( ) ) -> GetMediaURLRequestContext ( ) ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static VALUE decode_obj ( unsigned char * der , long length ) {
ASN1_OBJECT * obj ;
const unsigned char * p ;
VALUE ret ;
int nid ;
BIO * bio ;
p = der ;
if ( ! ( obj = d2i_ASN1_OBJECT ( NULL , & p , length ) ) ) ossl_raise ( eASN1Error , NULL ) ;
if ( ( nid = OBJ_obj2nid ( obj ) ) != NID_undef ) {
ASN1_OBJECT_free ( obj ) ;
ret = rb_str_new2 ( OBJ_nid2sn ( nid ) ) ;
}
else {
if ( ! ( bio = BIO_new ( BIO_s_mem ( ) ) ) ) {
ASN1_OBJECT_free ( obj ) ;
ossl_raise ( eASN1Error , NULL ) ;
}
i2a_ASN1_OBJECT ( bio , obj ) ;
ASN1_OBJECT_free ( obj ) ;
ret = ossl_membio2str ( bio ) ;
}
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSMgmtIntCreate ( TSRecordType rec_type , const char * name , TSMgmtInt data_default , TSRecordUpdateType update_type , TSRecordCheckType check_type , const char * check_regex , TSRecordAccessType access_type ) {
if ( check_regex == nullptr && check_type != TS_RECORDCHECK_NULL ) {
return TS_ERROR ;
}
if ( REC_ERR_OKAY != RecRegisterConfigInt ( ( enum RecT ) rec_type , name , ( RecInt ) data_default , ( enum RecUpdateT ) update_type , ( enum RecCheckT ) check_type , check_regex , REC_SOURCE_PLUGIN , ( enum RecAccessT ) access_type ) ) {
return TS_ERROR ;
}
return TS_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void stop_postmaster ( bool fast ) {
ClusterInfo * cluster ;
if ( os_info . running_cluster == & old_cluster ) cluster = & old_cluster ;
else if ( os_info . running_cluster == & new_cluster ) cluster = & new_cluster ;
else return ;
exec_prog ( SERVER_STOP_LOG_FILE , NULL , ! fast , "\"%s/pg_ctl\" -w -D \"%s\" -o \"%s\" %s stop" , cluster -> bindir , cluster -> pgconfig , cluster -> pgopts ? cluster -> pgopts : "" , fast ? "-m fast" : "" ) ;
os_info . running_cluster = NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_sad ## m ## x ## n ## x4d_c ( const uint8_t * src , int src_stride , const uint8_t * const refs [ ] , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < 4 ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , refs [ i ] , ref_stride ) ;
\ }
sadMxN ( 64 , 64 ) sadMxNxK ( 64 , 64 , 3 ) sadMxNxK ( 64 , 64 , 8 ) sadMxNx4D ( 64 , 64 ) sadMxN ( 64 , 32 ) sadMxNx4D ( 64 , 32 ) sadMxN ( 32 , 64 ) sadMxNx4D ( 32 , 64 ) sadMxN ( 32 , 32 ) sadMxNxK ( 32 , 32 , 3 ) sadMxNxK ( 32 , 32 , 8 ) sadMxNx4D ( 32 , 32 ) sadMxN ( 32 , 16 ) sadMxNx4D ( 32 , 16 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void ctl_flushpkt ( u_char more ) {
size_t i ;
int dlen ;
int sendlen ;
int maclen ;
int totlen ;
keyid_t keyid ;
dlen = datapt - rpkt . u . data ;
if ( ! more && datanotbinflag && dlen + 2 < CTL_MAX_DATA_LEN ) {
* datapt ++ = '\r' ;
* datapt ++ = '\n' ;
dlen += 2 ;
}
sendlen = dlen + CTL_HEADER_LEN ;
while ( sendlen & 0x3 ) {
* datapt ++ = '\0' ;
sendlen ++ ;
}
rpkt . r_m_e_op = CTL_RESPONSE | more | ( res_opcode & CTL_OP_MASK ) ;
rpkt . count = htons ( ( u_short ) dlen ) ;
rpkt . offset = htons ( ( u_short ) res_offset ) ;
if ( res_async ) {
for ( i = 0 ;
i < COUNTOF ( ctl_traps ) ;
i ++ ) {
if ( TRAP_INUSE & ctl_traps [ i ] . tr_flags ) {
rpkt . li_vn_mode = PKT_LI_VN_MODE ( sys_leap , ctl_traps [ i ] . tr_version , MODE_CONTROL ) ;
rpkt . sequence = htons ( ctl_traps [ i ] . tr_sequence ) ;
sendpkt ( & ctl_traps [ i ] . tr_addr , ctl_traps [ i ] . tr_localaddr , - 4 , ( struct pkt * ) & rpkt , sendlen ) ;
if ( ! more ) ctl_traps [ i ] . tr_sequence ++ ;
numasyncmsgs ++ ;
}
}
}
else {
if ( res_authenticate && sys_authenticate ) {
totlen = sendlen ;
while ( totlen & 7 ) {
* datapt ++ = '\0' ;
totlen ++ ;
}
keyid = htonl ( res_keyid ) ;
memcpy ( datapt , & keyid , sizeof ( keyid ) ) ;
maclen = authencrypt ( res_keyid , ( u_int32 * ) & rpkt , totlen ) ;
sendpkt ( rmt_addr , lcl_inter , - 5 , ( struct pkt * ) & rpkt , totlen + maclen ) ;
}
else {
sendpkt ( rmt_addr , lcl_inter , - 6 , ( struct pkt * ) & rpkt , sendlen ) ;
}
if ( more ) numctlfrags ++ ;
else numctlresponses ++ ;
}
res_frags ++ ;
res_offset += dlen ;
datapt = rpkt . u . data ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int selinux_capable ( const struct cred * cred , struct user_namespace * ns , int cap , int audit ) {
return cred_has_capability ( cred , cap , audit , ns == & init_user_ns ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( SessionRestorePageLoadMetricsBrowserTest , InitialForegroundTabChanged ) {
ui_test_utils : : NavigateToURL ( browser ( ) , GetTestURL ( ) ) ;
ui_test_utils : : NavigateToURLWithDisposition ( browser ( ) , GetTestURL ( ) , WindowOpenDisposition : : NEW_BACKGROUND_TAB , ui_test_utils : : BROWSER_TEST_WAIT_FOR_NAVIGATION ) ;
SessionRestorePaintWaiter session_restore_paint_waiter ;
Browser * new_browser = QuitBrowserAndRestore ( browser ( ) ) ;
TabStripModel * tab_strip = new_browser -> tab_strip_model ( ) ;
ASSERT_TRUE ( tab_strip ) ;
ASSERT_EQ ( 2 , tab_strip -> count ( ) ) ;
ASSERT_EQ ( 0 , tab_strip -> active_index ( ) ) ;
tab_strip -> ActivateTabAt ( 1 , true ) ;
session_restore_paint_waiter . WaitForForegroundTabs ( 1 ) ;
ExpectFirstPaintMetricsTotalCount ( 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void synthesis ( AMRWBContext * ctx , float * lpc , float * excitation , float fixed_gain , const float * fixed_vector , float * samples ) {
ff_weighted_vector_sumf ( excitation , ctx -> pitch_vector , fixed_vector , ctx -> pitch_gain [ 0 ] , fixed_gain , AMRWB_SFR_SIZE ) ;
if ( ctx -> pitch_gain [ 0 ] > 0.5 && ctx -> fr_cur_mode <= MODE_8k85 ) {
int i ;
float energy = avpriv_scalarproduct_float_c ( excitation , excitation , AMRWB_SFR_SIZE ) ;
float pitch_factor = 0.25 * ctx -> pitch_gain [ 0 ] * ctx -> pitch_gain [ 0 ] ;
for ( i = 0 ;
i < AMRWB_SFR_SIZE ;
i ++ ) excitation [ i ] += pitch_factor * ctx -> pitch_vector [ i ] ;
ff_scale_vector_to_given_sum_of_squares ( excitation , excitation , energy , AMRWB_SFR_SIZE ) ;
}
ff_celp_lp_synthesis_filterf ( samples , lpc , excitation , AMRWB_SFR_SIZE , LP_ORDER ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void evhttp_handle_request ( struct evhttp_request * req , void * arg ) {
struct evhttp * http = arg ;
struct evhttp_cb * cb = NULL ;
if ( req -> uri == NULL ) {
evhttp_send_error ( req , HTTP_BADREQUEST , "Bad Request" ) ;
return ;
}
if ( ( cb = evhttp_dispatch_callback ( & http -> callbacks , req ) ) != NULL ) {
( * cb -> cb ) ( req , cb -> cbarg ) ;
return ;
}
if ( http -> gencb ) {
( * http -> gencb ) ( req , http -> gencbarg ) ;
return ;
}
else {
# define ERR_FORMAT "<html><head>" "<title>404 Not Found</title>" "</head><body>" "<h1>Not Found</h1>" "<p>The requested URL %s was not found on this server.</p>" "</body></html>\n" char * escaped_html = evhttp_htmlescape ( req -> uri ) ;
struct evbuffer * buf = evbuffer_new ( ) ;
evhttp_response_code ( req , HTTP_NOTFOUND , "Not Found" ) ;
evbuffer_add_printf ( buf , ERR_FORMAT , escaped_html ) ;
free ( escaped_html ) ;
evhttp_send_page ( req , buf ) ;
evbuffer_free ( buf ) ;
# undef ERR_FORMAT }
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int32_t u_scanf_char_handler ( UFILE * input , u_scanf_spec_info * info , ufmt_args * args , const UChar * fmt , int32_t * fmtConsumed , int32_t * argConverted ) {
if ( info -> fWidth < 0 ) {
info -> fWidth = 1 ;
}
info -> fIsString = FALSE ;
return u_scanf_string_handler ( input , info , args , fmt , fmtConsumed , argConverted ) ;
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.