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 MagickBooleanType IsXCF ( const unsigned char * magick , const size_t length ) {
if ( length < 8 ) return ( MagickFalse ) ;
if ( LocaleNCompare ( ( char * ) magick , "gimp xcf" , 8 ) == 0 ) return ( MagickTrue ) ;
return ( MagickFalse ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int elg_generate ( int algo , unsigned nbits , MPI * skey , MPI * * retfactors ) {
ELG_secret_key sk ;
if ( ! is_ELGAMAL ( algo ) ) return G10ERR_PUBKEY_ALGO ;
generate ( & sk , nbits , retfactors ) ;
skey [ 0 ] = sk . p ;
skey [ 1 ] = sk . g ;
skey [ 2 ] = sk . y ;
skey [ 3 ] = sk . x ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void min_heap_shift_up_ ( min_heap_t * s , unsigned hole_index , struct event * e ) {
unsigned parent = ( hole_index - 1 ) / 2 ;
while ( hole_index && min_heap_elem_greater ( s -> p [ parent ] , e ) ) {
( s -> p [ hole_index ] = s -> p [ parent ] ) -> min_heap_idx = hole_index ;
hole_index = parent ;
parent = ( hole_index - 1 ) / 2 ;
}
( s -> p [ hole_index ] = e ) -> min_heap_idx = hole_index ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_idct8x8_64_add_c ( const tran_low_t * input , uint8_t * dest , int stride ) {
tran_low_t out [ 8 * 8 ] ;
tran_low_t * outptr = out ;
int i , j ;
tran_low_t temp_in [ 8 ] , temp_out [ 8 ] ;
for ( i = 0 ;
i < 8 ;
++ i ) {
idct8 ( input , outptr ) ;
input += 8 ;
outptr += 8 ;
}
for ( i = 0 ;
i < 8 ;
++ i ) {
for ( j = 0 ;
j < 8 ;
++ j ) temp_in [ j ] = out [ j * 8 + i ] ;
idct8 ( temp_in , temp_out ) ;
for ( j = 0 ;
j < 8 ;
++ j ) dest [ j * stride + i ] = clip_pixel ( ROUND_POWER_OF_TWO ( temp_out [ j ] , 5 ) + dest [ j * stride + i ] ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int alloc_frame_buffer ( MpegEncContext * s , Picture * pic ) {
int r , ret ;
if ( s -> avctx -> hwaccel ) {
assert ( ! pic -> hwaccel_picture_private ) ;
if ( s -> avctx -> hwaccel -> priv_data_size ) {
pic -> hwaccel_picture_private = av_mallocz ( s -> avctx -> hwaccel -> priv_data_size ) ;
if ( ! pic -> hwaccel_picture_private ) {
av_log ( s -> avctx , AV_LOG_ERROR , "alloc_frame_buffer() failed (hwaccel private data allocation)\n" ) ;
return - 1 ;
}
}
}
pic -> tf . f = & pic -> f ;
if ( s -> codec_id != AV_CODEC_ID_WMV3IMAGE && s -> codec_id != AV_CODEC_ID_VC1IMAGE && s -> codec_id != AV_CODEC_ID_MSS2 ) r = ff_thread_get_buffer ( s -> avctx , & pic -> tf , pic -> reference ? AV_GET_BUFFER_FLAG_REF : 0 ) ;
else {
pic -> f . width = s -> avctx -> width ;
pic -> f . height = s -> avctx -> height ;
pic -> f . format = s -> avctx -> pix_fmt ;
r = avcodec_default_get_buffer2 ( s -> avctx , & pic -> f , 0 ) ;
}
if ( r < 0 || ! pic -> f . data [ 0 ] ) {
av_log ( s -> avctx , AV_LOG_ERROR , "get_buffer() failed (%d %p)\n" , r , pic -> f . data [ 0 ] ) ;
av_freep ( & pic -> hwaccel_picture_private ) ;
return - 1 ;
}
if ( s -> linesize && ( s -> linesize != pic -> f . linesize [ 0 ] || s -> uvlinesize != pic -> f . linesize [ 1 ] ) ) {
av_log ( s -> avctx , AV_LOG_ERROR , "get_buffer() failed (stride changed)\n" ) ;
ff_mpeg_unref_picture ( s , pic ) ;
return - 1 ;
}
if ( pic -> f . linesize [ 1 ] != pic -> f . linesize [ 2 ] ) {
av_log ( s -> avctx , AV_LOG_ERROR , "get_buffer() failed (uv stride mismatch)\n" ) ;
ff_mpeg_unref_picture ( s , pic ) ;
return - 1 ;
}
if ( ! s -> edge_emu_buffer && ( ret = ff_mpv_frame_size_alloc ( s , pic -> f . linesize [ 0 ] ) ) < 0 ) {
av_log ( s -> avctx , AV_LOG_ERROR , "get_buffer() failed to allocate context scratch buffers.\n" ) ;
ff_mpeg_unref_picture ( s , pic ) ;
return ret ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int PEM_write_bio_ ## name ( BIO * bp , type * x ) ;
# define DECLARE_PEM_write_bio_const ( name , type ) int PEM_write_bio_ ## name ( BIO * bp , const type * x ) ;
# define DECLARE_PEM_write_cb_bio ( name , type ) int PEM_write_bio_ ## name ( BIO * bp , type * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
# define DECLARE_PEM_write ( name , type ) DECLARE_PEM_write_bio ( name , type ) DECLARE_PEM_write_fp ( name , type ) # define DECLARE_PEM_write_const ( name , type ) DECLARE_PEM_write_bio_const ( name , type ) DECLARE_PEM_write_fp_const ( name , type ) # define DECLARE_PEM_write_cb ( name , type ) DECLARE_PEM_write_cb_bio ( name , type ) DECLARE_PEM_write_cb_fp ( name , type ) # define DECLARE_PEM_read ( name , type ) DECLARE_PEM_read_bio ( name , type ) DECLARE_PEM_read_fp ( name , type ) # define DECLARE_PEM_rw ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write ( name , type ) # define DECLARE_PEM_rw_const ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write_const ( name , type ) # define DECLARE_PEM_rw_cb ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write_cb ( name , type ) typedef int pem_password_cb ( char * buf , int size , int rwflag , void * userdata ) ;
int PEM_get_EVP_CIPHER_INFO ( char * header , EVP_CIPHER_INFO * cipher ) ;
int PEM_do_header ( EVP_CIPHER_INFO * cipher , unsigned char * data , long * len , pem_password_cb * callback , void * u ) ;
int PEM_read_bio ( BIO * bp , char * * name , char * * header , unsigned char * * data , long * len ) ;
# define PEM_FLAG_SECURE 0x1 # define PEM_FLAG_EAY_COMPATIBLE 0x2 # define PEM_FLAG_ONLY_B64 0x4 int PEM_read_bio_ex ( BIO * bp , char * * name , char * * header , unsigned char * * data , long * len , unsigned int flags ) ;
int PEM_bytes_read_bio_secmem ( unsigned char * * pdata , long * plen , char * * pnm , const char * name , BIO * bp , pem_password_cb * cb , void * u ) ;
int PEM_write_bio ( BIO * bp , const char * name , const char * hdr , const unsigned char * data , long len ) ;
int PEM_bytes_read_bio ( unsigned char * * pdata , long * plen , char * * pnm , const char * name , BIO * bp , pem_password_cb * cb , void * u ) ;
void * PEM_ASN1_read_bio ( d2i_of_void * d2i , const char * name , BIO * bp , void * * x , pem_password_cb * cb , void * u ) ;
int PEM_ASN1_write_bio ( i2d_of_void * i2d , const char * name , BIO * bp , void * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
STACK_OF ( X509_INFO ) * PEM_X509_INFO_read_bio ( BIO * bp , STACK_OF ( X509_INFO ) * sk , pem_password_cb * cb , void * u ) ;
int PEM_X509_INFO_write_bio ( BIO * bp , X509_INFO * xi , EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cd , void * u ) ;
# ifndef OPENSSL_NO_STDIO int PEM_read ( FILE * fp , char * * name , char * * header , unsigned char * * data , long * len ) ;
int PEM_write ( FILE * fp , const char * name , const char * hdr , const unsigned char * data , long len ) ;
void * PEM_ASN1_read ( d2i_of_void * d2i , const char * name , FILE * fp , void * * x , pem_password_cb * cb , void * u ) ;
int PEM_ASN1_write ( i2d_of_void * i2d , const char * name , FILE * fp , void * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * callback , void * u ) ;
STACK_OF ( X509_INFO ) * PEM_X509_INFO_read ( FILE * fp , STACK_OF ( X509_INFO ) * sk , pem_password_cb * cb , void * u ) ;
# endif int PEM_SignInit ( EVP_MD_CTX * ctx , EVP_MD * type ) ;
int PEM_SignUpdate ( EVP_MD_CTX * ctx , unsigned char * d , unsigned int cnt ) ;
int PEM_SignFinal ( EVP_MD_CTX * ctx , unsigned char * sigret , unsigned int * siglen , EVP_PKEY * pkey ) ;
int PEM_def_callback ( char * buf , int num , int rwflag , void * userdata ) ;
void PEM_proc_type ( char * buf , int type ) ;
void PEM_dek_info ( char * buf , const char * type , int len , char * str ) ;
# include < openssl / symhacks . h > DECLARE_PEM_rw ( X509 , X509 ) DECLARE_PEM_rw ( X509_AUX , X509 ) DECLARE_PEM_rw ( X509_REQ , X509_REQ ) DECLARE_PEM_write ( X509_REQ_NEW , X509_REQ ) DECLARE_PEM_rw ( X509_CRL , X509_CRL ) DECLARE_PEM_rw ( PKCS7 , PKCS7 ) DECLARE_PEM_rw ( NETSCAPE_CERT_SEQUENCE , NETSCAPE_CERT_SEQUENCE )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void imc_calculate_coeffs ( IMCContext * q , float * flcoeffs1 , float * flcoeffs2 , int * bandWidthT , float * flcoeffs3 , float * flcoeffs5 ) {
float workT1 [ BANDS ] ;
float workT2 [ BANDS ] ;
float workT3 [ BANDS ] ;
float snr_limit = 1.e-30 ;
float accum = 0.0 ;
int i , cnt2 ;
for ( i = 0 ;
i < BANDS ;
i ++ ) {
flcoeffs5 [ i ] = workT2 [ i ] = 0.0 ;
if ( bandWidthT [ i ] ) {
workT1 [ i ] = flcoeffs1 [ i ] * flcoeffs1 [ i ] ;
flcoeffs3 [ i ] = 2.0 * flcoeffs2 [ i ] ;
}
else {
workT1 [ i ] = 0.0 ;
flcoeffs3 [ i ] = - 30000.0 ;
}
workT3 [ i ] = bandWidthT [ i ] * workT1 [ i ] * 0.01 ;
if ( workT3 [ i ] <= snr_limit ) workT3 [ i ] = 0.0 ;
}
for ( i = 0 ;
i < BANDS ;
i ++ ) {
for ( cnt2 = i ;
cnt2 < q -> cyclTab [ i ] ;
cnt2 ++ ) flcoeffs5 [ cnt2 ] = flcoeffs5 [ cnt2 ] + workT3 [ i ] ;
workT2 [ cnt2 - 1 ] = workT2 [ cnt2 - 1 ] + workT3 [ i ] ;
}
for ( i = 1 ;
i < BANDS ;
i ++ ) {
accum = ( workT2 [ i - 1 ] + accum ) * q -> weights1 [ i - 1 ] ;
flcoeffs5 [ i ] += accum ;
}
for ( i = 0 ;
i < BANDS ;
i ++ ) workT2 [ i ] = 0.0 ;
for ( i = 0 ;
i < BANDS ;
i ++ ) {
for ( cnt2 = i - 1 ;
cnt2 > q -> cyclTab2 [ i ] ;
cnt2 -- ) flcoeffs5 [ cnt2 ] += workT3 [ i ] ;
workT2 [ cnt2 + 1 ] += workT3 [ i ] ;
}
accum = 0.0 ;
for ( i = BANDS - 2 ;
i >= 0 ;
i -- ) {
accum = ( workT2 [ i + 1 ] + accum ) * q -> weights2 [ i ] ;
flcoeffs5 [ i ] += accum ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int SpoolssGeneric_r ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep _U_ ) {
int len = tvb_reported_length ( tvb ) ;
proto_tree_add_expert ( tree , pinfo , & ei_unimplemented_dissector , tvb , offset , 0 ) ;
offset = dissect_doserror ( tvb , len - 4 , pinfo , tree , di , drep , hf_rc , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_INTEGER_1_4294967295 ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 1U , 4294967295U , NULL , FALSE ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void vacuum_one_database ( const char * dbname , vacuumingOptions * vacopts , int stage , SimpleStringList * tables , const char * host , const char * port , const char * username , enum trivalue prompt_password , int concurrentCons , const char * progname , bool echo , bool quiet ) {
PQExpBufferData sql ;
PGconn * conn ;
SimpleStringListCell * cell ;
ParallelSlot * slots = NULL ;
SimpleStringList dbtables = {
NULL , NULL }
;
int i ;
bool failed = false ;
bool parallel = concurrentCons > 1 ;
const char * stage_commands [ ] = {
"SET default_statistics_target=1;
SET vacuum_cost_delay=0;
" , "SET default_statistics_target=10;
RESET vacuum_cost_delay;
" , "RESET default_statistics_target;
" }
;
const char * stage_messages [ ] = {
gettext_noop ( "Generating minimal optimizer statistics (1 target)" ) , gettext_noop ( "Generating medium optimizer statistics (10 targets)" ) , gettext_noop ( "Generating default (full) optimizer statistics" ) }
;
Assert ( stage == ANALYZE_NO_STAGE || ( stage >= 0 && stage < ANALYZE_NUM_STAGES ) ) ;
conn = connectDatabase ( dbname , host , port , username , prompt_password , progname , false , true ) ;
if ( ! quiet ) {
if ( stage != ANALYZE_NO_STAGE ) printf ( _ ( "%s: processing database \"%s\": %s\n" ) , progname , PQdb ( conn ) , stage_messages [ stage ] ) ;
else printf ( _ ( "%s: vacuuming database \"%s\"\n" ) , progname , PQdb ( conn ) ) ;
fflush ( stdout ) ;
}
initPQExpBuffer ( & sql ) ;
if ( parallel && ( ! tables || ! tables -> head ) ) {
PQExpBufferData buf ;
PGresult * res ;
int ntups ;
int i ;
initPQExpBuffer ( & buf ) ;
res = executeQuery ( conn , "SELECT c.relname, ns.nspname FROM pg_class c, pg_namespace ns\n" " WHERE relkind IN (\'r\', \'m\') AND c.relnamespace = ns.oid\n" " ORDER BY c.relpages DESC;
" , progname , echo ) ;
ntups = PQntuples ( res ) ;
for ( i = 0 ;
i < ntups ;
i ++ ) {
appendPQExpBufferStr ( & buf , fmtQualifiedId ( PQserverVersion ( conn ) , PQgetvalue ( res , i , 1 ) , PQgetvalue ( res , i , 0 ) ) ) ;
simple_string_list_append ( & dbtables , buf . data ) ;
resetPQExpBuffer ( & buf ) ;
}
termPQExpBuffer ( & buf ) ;
tables = & dbtables ;
if ( concurrentCons > ntups ) concurrentCons = ntups ;
if ( concurrentCons <= 1 ) parallel = false ;
PQclear ( res ) ;
}
slots = ( ParallelSlot * ) pg_malloc ( sizeof ( ParallelSlot ) * concurrentCons ) ;
init_slot ( slots , conn , progname ) ;
if ( parallel ) {
for ( i = 1 ;
i < concurrentCons ;
i ++ ) {
conn = connectDatabase ( dbname , host , port , username , prompt_password , progname , false , true ) ;
init_slot ( slots + i , conn , progname ) ;
}
}
if ( stage != ANALYZE_NO_STAGE ) {
int j ;
for ( j = 0 ;
j < concurrentCons ;
j ++ ) executeCommand ( ( slots + j ) -> connection , stage_commands [ stage ] , progname , echo ) ;
}
cell = tables ? tables -> head : NULL ;
do {
ParallelSlot * free_slot ;
const char * tabname = cell ? cell -> val : NULL ;
prepare_vacuum_command ( & sql , conn , vacopts , tabname ) ;
if ( CancelRequested ) {
failed = true ;
goto finish ;
}
if ( parallel ) {
free_slot = GetIdleSlot ( slots , concurrentCons , progname ) ;
if ( ! free_slot ) {
failed = true ;
goto finish ;
}
free_slot -> isFree = false ;
}
else free_slot = slots ;
run_vacuum_command ( free_slot -> connection , sql . data , echo , tabname , progname , parallel ) ;
if ( cell ) cell = cell -> next ;
}
while ( cell != NULL ) ;
if ( parallel ) {
int j ;
for ( j = 0 ;
j < concurrentCons ;
j ++ ) {
if ( ! GetQueryResult ( ( slots + j ) -> connection , progname ) ) goto finish ;
( slots + j ) -> isFree = true ;
}
}
finish : for ( i = 0 ;
i < concurrentCons ;
i ++ ) DisconnectDatabase ( slots + i ) ;
pfree ( slots ) ;
termPQExpBuffer ( & sql ) ;
if ( failed ) exit ( 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
ssize_t libevt_record_values_read ( libevt_record_values_t * record_values , libbfio_handle_t * file_io_handle , libevt_io_handle_t * io_handle , off64_t * file_offset , uint8_t strict_mode , libcerror_error_t * * error ) {
uint8_t record_size_data [ 4 ] ;
uint8_t * record_data = NULL ;
static char * function = "libevt_record_values_read" ;
size_t read_size = 0 ;
size_t record_data_offset = 0 ;
ssize_t read_count = 0 ;
ssize_t total_read_count = 0 ;
uint32_t record_data_size = 0 ;
if ( record_values == NULL ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_ARGUMENTS , LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE , "%s: invalid record values." , function ) ;
return ( - 1 ) ;
}
if ( io_handle == NULL ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_ARGUMENTS , LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE , "%s: invalid IO handle." , function ) ;
return ( - 1 ) ;
}
if ( file_offset == NULL ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_ARGUMENTS , LIBCERROR_ARGUMENT_ERROR_INVALID_VALUE , "%s: invalid file offset." , function ) ;
return ( - 1 ) ;
}
record_values -> offset = * file_offset ;
read_count = libbfio_handle_read_buffer ( file_io_handle , record_size_data , sizeof ( uint32_t ) , error ) ;
if ( read_count != ( ssize_t ) sizeof ( uint32_t ) ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_IO , LIBCERROR_IO_ERROR_READ_FAILED , "%s: unable to read record size data." , function ) ;
goto on_error ;
}
* file_offset += read_count ;
total_read_count = read_count ;
byte_stream_copy_to_uint32_little_endian ( record_size_data , record_data_size ) ;
if ( record_data_size < 4 ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_RUNTIME , LIBCERROR_RUNTIME_ERROR_VALUE_OUT_OF_BOUNDS , "%s: record data size value out of bounds." , function ) ;
goto on_error ;
}
# if SIZEOF_SIZE_T <= 4 if ( ( size_t ) record_data_size > ( size_t ) SSIZE_MAX ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_RUNTIME , LIBCERROR_RUNTIME_ERROR_VALUE_EXCEEDS_MAXIMUM , "%s: invalid record data size value exceeds maximum." , function ) ;
goto on_error ;
}
# endif record_data = ( uint8_t * ) memory_allocate ( sizeof ( uint8_t ) * record_data_size ) ;
if ( record_data == NULL ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_MEMORY , LIBCERROR_MEMORY_ERROR_INSUFFICIENT , "%s: unable to create record data." , function ) ;
goto on_error ;
}
byte_stream_copy_from_uint32_little_endian ( record_data , record_data_size ) ;
record_data_offset = 4 ;
read_size = record_data_size - record_data_offset ;
if ( ( ( size64_t ) * file_offset + read_size ) > io_handle -> file_size ) {
read_size = ( size_t ) ( io_handle -> file_size - * file_offset ) ;
}
read_count = libbfio_handle_read_buffer ( file_io_handle , & ( record_data [ record_data_offset ] ) , read_size , error ) ;
if ( read_count != ( ssize_t ) read_size ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_IO , LIBCERROR_IO_ERROR_READ_FAILED , "%s: unable to read record data." , function ) ;
goto on_error ;
}
* file_offset += read_count ;
record_data_offset += read_count ;
total_read_count += read_count ;
if ( record_data_offset < ( size_t ) record_data_size ) {
if ( libbfio_handle_seek_offset ( file_io_handle , ( off64_t ) sizeof ( evt_file_header_t ) , SEEK_SET , error ) == - 1 ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_IO , LIBCERROR_IO_ERROR_SEEK_FAILED , "%s: unable to seek file header offset: %" PRIzd "." , function , sizeof ( evt_file_header_t ) ) ;
goto on_error ;
}
* file_offset = ( off64_t ) sizeof ( evt_file_header_t ) ;
read_size = ( size_t ) record_data_size - record_data_offset ;
read_count = libbfio_handle_read_buffer ( file_io_handle , & ( record_data [ record_data_offset ] ) , read_size , error ) ;
if ( read_count != ( ssize_t ) read_size ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_IO , LIBCERROR_IO_ERROR_READ_FAILED , "%s: unable to read record data." , function ) ;
goto on_error ;
}
* file_offset += read_count ;
total_read_count += read_count ;
}
# if defined ( HAVE_DEBUG_OUTPUT ) if ( libcnotify_verbose != 0 ) {
libcnotify_printf ( "%s: record data:\n" , function ) ;
libcnotify_print_data ( record_data , ( size_t ) record_data_size , LIBCNOTIFY_PRINT_DATA_FLAG_GROUP_DATA ) ;
}
# endif if ( memory_compare ( & ( record_data [ 4 ] ) , evt_file_signature , ) == 0 ) {
record_values -> type = LIBEVT_RECORD_TYPE_EVENT ;
}
else if ( memory_compare ( & ( record_data [ 4 ] ) , evt_end_of_file_record_signature1 , ) == 0 ) {
record_values -> type = LIBEVT_RECORD_TYPE_END_OF_FILE ;
}
else {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_RUNTIME , LIBCERROR_RUNTIME_ERROR_UNSUPPORTED_VALUE , "%s: unsupported record values signature." , function ) ;
goto on_error ;
}
if ( record_values -> type == LIBEVT_RECORD_TYPE_EVENT ) {
if ( libevt_record_values_read_event ( record_values , record_data , ( size_t ) record_data_size , strict_mode , error ) != 1 ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_IO , LIBCERROR_IO_ERROR_READ_FAILED , "%s: unable to read event record values." , function ) ;
goto on_error ;
}
}
else if ( record_values -> type == LIBEVT_RECORD_TYPE_END_OF_FILE ) {
if ( libevt_record_values_read_end_of_file ( record_values , record_data , ( size_t ) record_data_size , error ) != 1 ) {
libcerror_error_set ( error , LIBCERROR_ERROR_DOMAIN_IO , LIBCERROR_IO_ERROR_READ_FAILED , "%s: unable to read end of file record values." , function ) ;
goto on_error ;
}
}
memory_free ( record_data ) ;
return ( total_read_count ) ;
on_error : if ( record_data != NULL ) {
memory_free ( record_data ) ;
}
return ( - 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int estimate_bits_at_q ( FRAME_TYPE frame_type , int q , int mbs , double correction_factor ) {
const int bpm = ( int ) ( vp9_rc_bits_per_mb ( frame_type , q , correction_factor ) ) ;
return ( ( uint64_t ) bpm * mbs ) >> BPER_MB_NORMBITS ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int selinux_inode_getsecctx ( struct inode * inode , void * * ctx , u32 * ctxlen ) {
int len = 0 ;
len = selinux_inode_getsecurity ( inode , XATTR_SELINUX_SUFFIX , ctx , true ) ;
if ( len < 0 ) return len ;
* ctxlen = len ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void decode_lpc ( int32_t * coeffs , int mode , int length ) {
int i ;
if ( length < 2 ) return ;
if ( mode == 1 ) {
int a1 = * coeffs ++ ;
for ( i = 0 ;
i < length - 1 >> 1 ;
i ++ ) {
* coeffs += a1 ;
coeffs [ 1 ] += * coeffs ;
a1 = coeffs [ 1 ] ;
coeffs += 2 ;
}
if ( length - 1 & 1 ) * coeffs += a1 ;
}
else if ( mode == 2 ) {
int a1 = coeffs [ 1 ] ;
int a2 = a1 + * coeffs ;
coeffs [ 1 ] = a2 ;
if ( length > 2 ) {
coeffs += 2 ;
for ( i = 0 ;
i < length - 2 >> 1 ;
i ++ ) {
int a3 = * coeffs + a1 ;
int a4 = a3 + a2 ;
* coeffs = a4 ;
a1 = coeffs [ 1 ] + a3 ;
a2 = a1 + a4 ;
coeffs [ 1 ] = a2 ;
coeffs += 2 ;
}
if ( length & 1 ) * coeffs += a1 + a2 ;
}
}
else if ( mode == 3 ) {
int a1 = coeffs [ 1 ] ;
int a2 = a1 + * coeffs ;
coeffs [ 1 ] = a2 ;
if ( length > 2 ) {
int a3 = coeffs [ 2 ] ;
int a4 = a3 + a1 ;
int a5 = a4 + a2 ;
coeffs += 3 ;
for ( i = 0 ;
i < length - 3 ;
i ++ ) {
a3 += * coeffs ;
a4 += a3 ;
a5 += a4 ;
* coeffs = a5 ;
coeffs ++ ;
}
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int event_base_priority_init ( struct event_base * base , int npriorities ) {
int i ;
if ( base -> event_count_active ) return ( - 1 ) ;
if ( base -> nactivequeues && npriorities != base -> nactivequeues ) {
for ( i = 0 ;
i < base -> nactivequeues ;
++ i ) {
free ( base -> activequeues [ i ] ) ;
}
free ( base -> activequeues ) ;
}
base -> nactivequeues = npriorities ;
base -> activequeues = ( struct event_list * * ) calloc ( base -> nactivequeues , sizeof ( struct event_list * ) ) ;
if ( base -> activequeues == NULL ) event_err ( 1 , "%s: calloc" , __func__ ) ;
for ( i = 0 ;
i < base -> nactivequeues ;
++ i ) {
base -> activequeues [ i ] = malloc ( sizeof ( struct event_list ) ) ;
if ( base -> activequeues [ i ] == NULL ) event_err ( 1 , "%s: malloc" , __func__ ) ;
TAILQ_INIT ( base -> activequeues [ i ] ) ;
}
return ( 0 ) ;
}
| 1True
|
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 ) sadMxNxK ( 32 , 32 , 3 ) sadMxNxK ( 32 , 32 , 8 ) sadMxNx4D ( 32 , 32 ) sadMxN ( 32 , 16 ) sadMxNx4D ( 32 , 16 ) sadMxN ( 16 , 32 ) sadMxNx4D ( 16 , 32 ) sadMxN ( 16 , 16 ) sadMxNxK ( 16 , 16 , 3 ) sadMxNxK ( 16 , 16 , 8 ) sadMxNx4D ( 16 , 16 ) sadMxN ( 16 , 8 ) sadMxNxK ( 16 , 8 , 3 ) sadMxNxK ( 16 , 8 , 8 ) sadMxNx4D ( 16 , 8 ) sadMxN ( 8 , 16 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
u_short varfmt ( const char * varname ) {
u_int n ;
for ( n = 0 ;
n < COUNTOF ( cookedvars ) ;
n ++ ) if ( ! strcmp ( varname , cookedvars [ n ] . varname ) ) return cookedvars [ n ] . fmt ;
return PADDING ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static GRANT_NAME * name_hash_search ( HASH * name_hash , const char * host , const char * ip , const char * db , const char * user , const char * tname , bool exact , bool name_tolower ) {
char helping [ NAME_LEN * 2 + USERNAME_LENGTH + 3 ] , * name_ptr ;
uint len ;
GRANT_NAME * grant_name , * found = 0 ;
HASH_SEARCH_STATE state ;
name_ptr = strmov ( strmov ( helping , user ) + 1 , db ) + 1 ;
len = ( uint ) ( strmov ( name_ptr , tname ) - helping ) + 1 ;
if ( name_tolower ) my_casedn_str ( files_charset_info , name_ptr ) ;
for ( grant_name = ( GRANT_NAME * ) hash_first ( name_hash , ( uchar * ) helping , len , & state ) ;
grant_name ;
grant_name = ( GRANT_NAME * ) hash_next ( name_hash , ( uchar * ) helping , len , & state ) ) {
if ( exact ) {
if ( ! grant_name -> host . hostname || ( host && ! my_strcasecmp ( system_charset_info , host , grant_name -> host . hostname ) ) || ( ip && ! strcmp ( ip , grant_name -> host . hostname ) ) ) return grant_name ;
}
else {
if ( compare_hostname ( & grant_name -> host , host , ip ) && ( ! found || found -> sort < grant_name -> sort ) ) found = grant_name ;
}
}
return found ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int test_probable_prime_coprime ( BIO * bp , BN_CTX * ctx ) {
int i , j , ret = 0 ;
BIGNUM r ;
BN_ULONG primes [ 5 ] = {
2 , 3 , 5 , 7 , 11 }
;
BN_init ( & r ) ;
for ( i = 0 ;
i < 1000 ;
i ++ ) {
if ( ! bn_probable_prime_dh_coprime ( & r , 1024 , ctx ) ) goto err ;
for ( j = 0 ;
j < 5 ;
j ++ ) {
if ( BN_mod_word ( & r , primes [ j ] ) == 0 ) {
BIO_printf ( bp , "Number generated is not coprime to %ld:\n" , primes [ j ] ) ;
BN_print_fp ( stdout , & r ) ;
BIO_printf ( bp , "\n" ) ;
goto err ;
}
}
}
ret = 1 ;
err : BN_clear ( & r ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int fill_vaapi_ReferenceFrames ( VAPictureParameterBufferH264 * pic_param , H264Context * h ) {
DPB dpb ;
int i ;
dpb . size = 0 ;
dpb . max_size = FF_ARRAY_ELEMS ( pic_param -> ReferenceFrames ) ;
dpb . va_pics = pic_param -> ReferenceFrames ;
for ( i = 0 ;
i < dpb . max_size ;
i ++ ) init_vaapi_pic ( & dpb . va_pics [ i ] ) ;
for ( i = 0 ;
i < h -> short_ref_count ;
i ++ ) {
Picture * const pic = h -> short_ref [ i ] ;
if ( pic && pic -> f . reference && dpb_add ( & dpb , pic ) < 0 ) return - 1 ;
}
for ( i = 0 ;
i < 16 ;
i ++ ) {
Picture * const pic = h -> long_ref [ i ] ;
if ( pic && pic -> f . reference && dpb_add ( & dpb , pic ) < 0 ) return - 1 ;
}
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void fz_set_default_rgb ( fz_context * ctx , fz_default_colorspaces * default_cs , fz_colorspace * cs ) {
if ( cs -> n == 3 ) {
fz_drop_colorspace ( ctx , default_cs -> rgb ) ;
default_cs -> rgb = fz_keep_colorspace ( ctx , cs ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_PublicPartyNumber ( 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_h225_PublicPartyNumber , PublicPartyNumber_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
bool add_edge_h ( connection_t * c ) {
edge_t * e ;
node_t * from , * to ;
char from_name [ MAX_STRING_SIZE ] ;
char to_name [ MAX_STRING_SIZE ] ;
char to_address [ MAX_STRING_SIZE ] ;
char to_port [ MAX_STRING_SIZE ] ;
sockaddr_t address ;
uint32_t options ;
int weight ;
if ( sscanf ( c -> buffer , "%*d %*x " MAX_STRING " " MAX_STRING " " MAX_STRING " " MAX_STRING " %x %d" , from_name , to_name , to_address , to_port , & options , & weight ) != 6 ) {
logger ( LOG_ERR , "Got bad %s from %s (%s)" , "ADD_EDGE" , c -> name , c -> hostname ) ;
return false ;
}
if ( ! check_id ( from_name ) || ! check_id ( to_name ) ) {
logger ( LOG_ERR , "Got bad %s from %s (%s): %s" , "ADD_EDGE" , c -> name , c -> hostname , "invalid name" ) ;
return false ;
}
if ( seen_request ( c -> buffer ) ) {
return true ;
}
from = lookup_node ( from_name ) ;
to = lookup_node ( to_name ) ;
if ( tunnelserver && from != myself && from != c -> node && to != myself && to != c -> node ) {
ifdebug ( PROTOCOL ) logger ( LOG_WARNING , "Ignoring indirect %s from %s (%s)" , "ADD_EDGE" , c -> name , c -> hostname ) ;
return true ;
}
if ( ! from ) {
from = new_node ( ) ;
from -> name = xstrdup ( from_name ) ;
node_add ( from ) ;
}
if ( ! to ) {
to = new_node ( ) ;
to -> name = xstrdup ( to_name ) ;
node_add ( to ) ;
}
address = str2sockaddr ( to_address , to_port ) ;
e = lookup_edge ( from , to ) ;
if ( e ) {
if ( e -> weight != weight || e -> options != options || sockaddrcmp ( & e -> address , & address ) ) {
if ( from == myself ) {
ifdebug ( PROTOCOL ) logger ( LOG_WARNING , "Got %s from %s (%s) for ourself which does not match existing entry" , "ADD_EDGE" , c -> name , c -> hostname ) ;
send_add_edge ( c , e ) ;
return true ;
}
else {
ifdebug ( PROTOCOL ) logger ( LOG_WARNING , "Got %s from %s (%s) which does not match existing entry" , "ADD_EDGE" , c -> name , c -> hostname ) ;
e -> options = options ;
if ( sockaddrcmp ( & e -> address , & address ) ) {
sockaddrfree ( & e -> address ) ;
e -> address = address ;
}
if ( e -> weight != weight ) {
avl_node_t * node = avl_unlink ( edge_weight_tree , e ) ;
e -> weight = weight ;
avl_insert_node ( edge_weight_tree , node ) ;
}
goto done ;
}
}
else {
return true ;
}
}
else if ( from == myself ) {
ifdebug ( PROTOCOL ) logger ( LOG_WARNING , "Got %s from %s (%s) for ourself which does not exist" , "ADD_EDGE" , c -> name , c -> hostname ) ;
contradicting_add_edge ++ ;
e = new_edge ( ) ;
e -> from = from ;
e -> to = to ;
send_del_edge ( c , e ) ;
free_edge ( e ) ;
return true ;
}
e = new_edge ( ) ;
e -> from = from ;
e -> to = to ;
e -> address = address ;
e -> options = options ;
e -> weight = weight ;
edge_add ( e ) ;
done : if ( ! tunnelserver ) {
forward_request ( c ) ;
}
graph ( ) ;
return true ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static UBool isPNJConsonant ( UChar32 c ) {
if ( c < 0xa00 || 0xa50 <= c ) {
return FALSE ;
}
else {
return ( UBool ) ( pnjMap [ c - 0xa00 ] & 1 ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int main ( int argc , char * * argv ) {
char inputbuf [ 4096 ] ;
unsigned char * buf ;
size_t len ;
gpg_error_t err ;
if ( argc == 2 && ! strcmp ( argv [ 1 ] , "--to-str" ) ) {
fread ( inputbuf , 1 , sizeof inputbuf , stdin ) ;
if ( ! feof ( stdin ) ) fail ( "read error or input too large" ) ;
fail ( "not yet implemented" ) ;
}
else if ( argc == 2 && ! strcmp ( argv [ 1 ] , "--to-der" ) ) {
fread ( inputbuf , 1 , sizeof inputbuf , stdin ) ;
if ( ! feof ( stdin ) ) fail ( "read error or input too large" ) ;
err = ksba_dn_str2der ( inputbuf , & buf , & len ) ;
fail_if_err ( err ) ;
fwrite ( buf , len , 1 , stdout ) ;
}
else if ( argc == 1 ) {
test_0 ( ) ;
test_1 ( ) ;
test_2 ( ) ;
}
else {
fprintf ( stderr , "usage: t-dnparser [--to-str|--to-der]\n" ) ;
return 1 ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int encode_bgra_bitstream ( HYuvContext * s , int count , int planes ) {
int i ;
if ( s -> pb . buf_end - s -> pb . buf - ( put_bits_count ( & s -> pb ) >> 3 ) < 4 * planes * count ) {
av_log ( s -> avctx , AV_LOG_ERROR , "encoded frame too large\n" ) ;
return - 1 ;
}
# define LOAD3 \ int g = s -> temp [ 0 ] [ planes == 3 ? 3 * i + 1 : 4 * i + G ] ;
\ int b = ( s -> temp [ 0 ] [ planes == 3 ? 3 * i + 2 : 4 * i + B ] - g ) & 0xff ;
\ int r = ( s -> temp [ 0 ] [ planes == 3 ? 3 * i + 0 : 4 * i + R ] - g ) & 0xff ;
\ int a = s -> temp [ 0 ] [ planes * i + A ] ;
# define STAT3 \ s -> stats [ 0 ] [ b ] ++ ;
\ s -> stats [ 1 ] [ g ] ++ ;
\ s -> stats [ 2 ] [ r ] ++ ;
\ if ( planes == 4 ) s -> stats [ 2 ] [ a ] ++ ;
# define WRITE3 \ put_bits ( & s -> pb , s -> len [ 1 ] [ g ] , s -> bits [ 1 ] [ g ] ) ;
\ put_bits ( & s -> pb , s -> len [ 0 ] [ b ] , s -> bits [ 0 ] [ b ] ) ;
\ put_bits ( & s -> pb , s -> len [ 2 ] [ r ] , s -> bits [ 2 ] [ r ] ) ;
\ if ( planes == 4 ) put_bits ( & s -> pb , s -> len [ 2 ] [ a ] , s -> bits [ 2 ] [ a ] ) ;
if ( ( s -> flags & CODEC_FLAG_PASS1 ) && ( s -> avctx -> flags2 & CODEC_FLAG2_NO_OUTPUT ) ) {
for ( i = 0 ;
i < count ;
i ++ ) {
LOAD3 ;
STAT3 ;
}
}
else if ( s -> context || ( s -> flags & CODEC_FLAG_PASS1 ) ) {
for ( i = 0 ;
i < count ;
i ++ ) {
LOAD3 ;
STAT3 ;
WRITE3 ;
}
}
else {
for ( i = 0 ;
i < count ;
i ++ ) {
LOAD3 ;
WRITE3 ;
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint64_t xhci_oper_read ( void * ptr , hwaddr reg , unsigned size ) {
XHCIState * xhci = ptr ;
uint32_t ret ;
switch ( reg ) {
case 0x00 : ret = xhci -> usbcmd ;
break ;
case 0x04 : ret = xhci -> usbsts ;
break ;
case 0x08 : ret = 1 ;
break ;
case 0x14 : ret = xhci -> dnctrl ;
break ;
case 0x18 : ret = xhci -> crcr_low & ~ 0xe ;
break ;
case 0x1c : ret = xhci -> crcr_high ;
break ;
case 0x30 : ret = xhci -> dcbaap_low ;
break ;
case 0x34 : ret = xhci -> dcbaap_high ;
break ;
case 0x38 : ret = xhci -> config ;
break ;
default : trace_usb_xhci_unimplemented ( "oper read" , reg ) ;
ret = 0 ;
}
trace_usb_xhci_oper_read ( reg , ret ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline guint64 get_uint64_value ( proto_tree * tree , tvbuff_t * tvb , gint offset , guint length , const guint encoding ) {
guint64 value ;
gboolean length_error ;
switch ( length ) {
case 1 : value = tvb_get_guint8 ( tvb , offset ) ;
break ;
case 2 : value = ( encoding & ENC_LITTLE_ENDIAN ) ? tvb_get_letohs ( tvb , offset ) : tvb_get_ntohs ( tvb , offset ) ;
break ;
case 3 : value = ( encoding & ENC_LITTLE_ENDIAN ) ? tvb_get_letoh24 ( tvb , offset ) : tvb_get_ntoh24 ( tvb , offset ) ;
break ;
case 4 : value = ( encoding & ENC_LITTLE_ENDIAN ) ? tvb_get_letohl ( tvb , offset ) : tvb_get_ntohl ( tvb , offset ) ;
break ;
case 5 : value = ( encoding & ENC_LITTLE_ENDIAN ) ? tvb_get_letoh40 ( tvb , offset ) : tvb_get_ntoh40 ( tvb , offset ) ;
break ;
case 6 : value = ( encoding & ENC_LITTLE_ENDIAN ) ? tvb_get_letoh48 ( tvb , offset ) : tvb_get_ntoh48 ( tvb , offset ) ;
break ;
case 7 : value = ( encoding & ENC_LITTLE_ENDIAN ) ? tvb_get_letoh56 ( tvb , offset ) : tvb_get_ntoh56 ( tvb , offset ) ;
break ;
case 8 : value = ( encoding & ENC_LITTLE_ENDIAN ) ? tvb_get_letoh64 ( tvb , offset ) : tvb_get_ntoh64 ( tvb , offset ) ;
break ;
default : if ( length < 1 ) {
length_error = TRUE ;
value = 0 ;
}
else {
length_error = FALSE ;
value = ( encoding & ENC_LITTLE_ENDIAN ) ? tvb_get_letoh64 ( tvb , offset ) : tvb_get_ntoh64 ( tvb , offset ) ;
}
report_type_length_mismatch ( tree , "an unsigned integer" , length , length_error ) ;
break ;
}
return value ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_pcp_message_creds ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , int offset ) {
guint32 creds_length ;
guint32 i ;
col_append_fstr ( pinfo -> cinfo , COL_INFO , "[%s]" , val_to_str ( PCP_PDU_CREDS , packettypenames , "Unknown Type:0x%02x" ) ) ;
proto_tree_add_item ( tree , hf_pcp_creds_number_of , tvb , offset , 4 , ENC_BIG_ENDIAN ) ;
creds_length = tvb_get_ntohl ( tvb , offset ) ;
offset += 4 ;
for ( i = 0 ;
i < creds_length ;
i ++ ) {
proto_tree_add_item ( tree , hf_pcp_creds_type , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset += 1 ;
proto_tree_add_item ( tree , hf_pcp_creds_version , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset += 1 ;
offset = dissect_pcp_partial_features ( tvb , pinfo , tree , offset ) ;
}
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int sort_write_record ( MI_SORT_PARAM * sort_param ) {
int flag ;
uint length ;
ulong block_length , reclength ;
uchar * from ;
uchar block_buff [ 8 ] ;
SORT_INFO * sort_info = sort_param -> sort_info ;
MI_CHECK * param = sort_info -> param ;
MI_INFO * info = sort_info -> info ;
MYISAM_SHARE * share = info -> s ;
DBUG_ENTER ( "sort_write_record" ) ;
if ( sort_param -> fix_datafile ) {
switch ( sort_info -> new_data_file_type ) {
case STATIC_RECORD : if ( my_b_write ( & info -> rec_cache , sort_param -> record , share -> base . pack_reclength ) ) {
mi_check_print_error ( param , "%d when writing to datafile" , my_errno ) ;
DBUG_RETURN ( 1 ) ;
}
sort_param -> filepos += share -> base . pack_reclength ;
info -> s -> state . split ++ ;
break ;
case DYNAMIC_RECORD : if ( ! info -> blobs ) from = sort_param -> rec_buff ;
else {
reclength = info -> s -> base . pack_reclength + _my_calc_total_blob_length ( info , sort_param -> record ) + ALIGN_SIZE ( MI_MAX_DYN_BLOCK_HEADER ) + MI_SPLIT_LENGTH + MI_DYN_DELETE_BLOCK_HEADER ;
if ( sort_info -> buff_length < reclength ) {
if ( ! ( sort_info -> buff = my_realloc ( sort_info -> buff , ( uint ) reclength , MYF ( MY_FREE_ON_ERROR | MY_ALLOW_ZERO_PTR ) ) ) ) DBUG_RETURN ( 1 ) ;
sort_info -> buff_length = reclength ;
}
from = sort_info -> buff + ALIGN_SIZE ( MI_MAX_DYN_BLOCK_HEADER ) ;
}
info -> checksum = mi_checksum ( info , sort_param -> record ) ;
reclength = _mi_rec_pack ( info , from , sort_param -> record ) ;
flag = 0 ;
do {
block_length = reclength + 3 + test ( reclength >= ( 65520 - 3 ) ) ;
if ( block_length < share -> base . min_block_length ) block_length = share -> base . min_block_length ;
info -> update |= HA_STATE_WRITE_AT_END ;
block_length = MY_ALIGN ( block_length , MI_DYN_ALIGN_SIZE ) ;
if ( block_length > MI_MAX_BLOCK_LENGTH ) block_length = MI_MAX_BLOCK_LENGTH ;
if ( _mi_write_part_record ( info , 0L , block_length , sort_param -> filepos + block_length , & from , & reclength , & flag ) ) {
mi_check_print_error ( param , "%d when writing to datafile" , my_errno ) ;
DBUG_RETURN ( 1 ) ;
}
sort_param -> filepos += block_length ;
info -> s -> state . split ++ ;
}
while ( reclength ) ;
break ;
case COMPRESSED_RECORD : reclength = info -> packed_length ;
length = save_pack_length ( ( uint ) share -> pack . version , block_buff , reclength ) ;
if ( info -> s -> base . blobs ) length += save_pack_length ( ( uint ) share -> pack . version , block_buff + length , info -> blob_length ) ;
if ( my_b_write ( & info -> rec_cache , block_buff , length ) || my_b_write ( & info -> rec_cache , ( uchar * ) sort_param -> rec_buff , reclength ) ) {
mi_check_print_error ( param , "%d when writing to datafile" , my_errno ) ;
DBUG_RETURN ( 1 ) ;
}
sort_param -> filepos += reclength + length ;
info -> s -> state . split ++ ;
break ;
case BLOCK_RECORD : assert ( 0 ) ;
}
}
if ( sort_param -> master ) {
info -> state -> records ++ ;
if ( ( param -> testflag & T_WRITE_LOOP ) && ( info -> state -> records % WRITE_COUNT ) == 0 ) {
char llbuff [ 22 ] ;
printf ( "%s\r" , llstr ( info -> state -> records , llbuff ) ) ;
( void ) fflush ( stdout ) ;
}
}
DBUG_RETURN ( 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static List * simplify_or_arguments ( List * args , eval_const_expressions_context * context , bool * haveNull , bool * forceTrue ) {
List * newargs = NIL ;
List * unprocessed_args ;
unprocessed_args = list_copy ( args ) ;
while ( unprocessed_args ) {
Node * arg = ( Node * ) linitial ( unprocessed_args ) ;
unprocessed_args = list_delete_first ( unprocessed_args ) ;
if ( or_clause ( arg ) ) {
List * subargs = list_copy ( ( ( BoolExpr * ) arg ) -> args ) ;
if ( ! unprocessed_args ) unprocessed_args = subargs ;
else {
List * oldhdr = unprocessed_args ;
unprocessed_args = list_concat ( subargs , unprocessed_args ) ;
pfree ( oldhdr ) ;
}
continue ;
}
arg = eval_const_expressions_mutator ( arg , context ) ;
if ( or_clause ( arg ) ) {
List * subargs = list_copy ( ( ( BoolExpr * ) arg ) -> args ) ;
unprocessed_args = list_concat ( subargs , unprocessed_args ) ;
continue ;
}
if ( IsA ( arg , Const ) ) {
Const * const_input = ( Const * ) arg ;
if ( const_input -> constisnull ) * haveNull = true ;
else if ( DatumGetBool ( const_input -> constvalue ) ) {
* forceTrue = true ;
return NIL ;
}
continue ;
}
newargs = lappend ( newargs , arg ) ;
}
return newargs ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int mp_gradient ( MotionPixelsContext * mp , int component , int v ) {
int delta ;
delta = ( v - 7 ) * mp -> gradient_scale [ component ] ;
mp -> gradient_scale [ component ] = ( v == 0 || v == 14 ) ? 2 : 1 ;
return delta ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static VALUE ossl_cipher_update ( int argc , VALUE * argv , VALUE self ) {
EVP_CIPHER_CTX * ctx ;
unsigned char * in ;
long in_len , out_len ;
VALUE data , str ;
rb_scan_args ( argc , argv , "11" , & data , & str ) ;
StringValue ( data ) ;
in = ( unsigned char * ) RSTRING_PTR ( data ) ;
if ( ( in_len = RSTRING_LEN ( data ) ) == 0 ) ossl_raise ( rb_eArgError , "data must not be empty" ) ;
GetCipher ( self , ctx ) ;
out_len = in_len + EVP_CIPHER_CTX_block_size ( ctx ) ;
if ( out_len <= 0 ) {
ossl_raise ( rb_eRangeError , "data too big to make output buffer: %ld bytes" , in_len ) ;
}
if ( NIL_P ( str ) ) {
str = rb_str_new ( 0 , out_len ) ;
}
else {
StringValue ( str ) ;
rb_str_resize ( str , out_len ) ;
}
if ( ! ossl_cipher_update_long ( ctx , ( unsigned char * ) RSTRING_PTR ( str ) , & out_len , in , in_len ) ) ossl_raise ( eCipherError , NULL ) ;
assert ( out_len < RSTRING_LEN ( str ) ) ;
rb_str_set_len ( str , out_len ) ;
return str ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void add_candidate_name_for_pmid_resolution ( packet_info * pinfo , tvbuff_t * tvb , int offset , int name_len ) {
pcp_conv_info_t * pcp_conv_info ;
guint8 * name ;
pcp_conv_info = get_pcp_conversation_info ( pinfo ) ;
if ( is_unvisited_pmns_names_frame ( pinfo ) ) {
name = tvb_get_string_enc ( wmem_file_scope ( ) , tvb , offset , name_len , ENC_ASCII ) ;
wmem_array_append_one ( pcp_conv_info -> pmid_name_candidates , name ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void language_destroy ( hb_language_t * l ) {
free ( l ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gint dissect_capabilities ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , gint offset , gint * codec , gint * content_protection_type , guint32 * vendor_id , guint16 * vendor_codec , guint32 * configuration_offset , guint8 * configuration_length ) {
proto_item * pitem = NULL ;
proto_item * ptree = NULL ;
proto_tree * capabilities_tree ;
proto_item * capabilities_item ;
proto_tree * service_tree = NULL ;
proto_item * service_item = NULL ;
gint service_category = 0 ;
gint losc = 0 ;
gint recovery_type = 0 ;
gint maximum_recovery_window_size = 0 ;
gint maximum_number_of_media_packet_in_parity_code = 0 ;
gint media_type = 0 ;
gint media_codec_type = 0 ;
capabilities_item = proto_tree_add_item ( tree , hf_btavdtp_capabilities , tvb , offset , tvb_reported_length ( tvb ) - offset , ENC_NA ) ;
capabilities_tree = proto_item_add_subtree ( capabilities_item , ett_btavdtp_capabilities ) ;
if ( codec ) * codec = - 1 ;
if ( vendor_id ) * vendor_id = 0x003F ;
if ( vendor_codec ) * vendor_codec = 0 ;
if ( configuration_length ) * configuration_length = 0 ;
if ( configuration_offset ) * configuration_offset = 0 ;
while ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) {
service_category = tvb_get_guint8 ( tvb , offset ) ;
losc = tvb_get_guint8 ( tvb , offset + 1 ) ;
service_item = proto_tree_add_none_format ( capabilities_tree , hf_btavdtp_service , tvb , offset , 2 + losc , "Service: %s" , val_to_str_const ( service_category , service_category_vals , "RFD" ) ) ;
service_tree = proto_item_add_subtree ( service_item , ett_btavdtp_service ) ;
proto_tree_add_item ( service_tree , hf_btavdtp_service_category , tvb , offset , 1 , ENC_NA ) ;
offset += 1 ;
proto_tree_add_item ( service_tree , hf_btavdtp_length_of_service_category , tvb , offset , 1 , ENC_NA ) ;
offset += 1 ;
switch ( service_category ) {
case SERVICE_CATEGORY_MEDIA_TRANSPORT : case SERVICE_CATEGORY_REPORTING : case SERVICE_CATEGORY_DELAY_REPORTING : break ;
case SERVICE_CATEGORY_RECOVERY : recovery_type = tvb_get_guint8 ( tvb , offset ) ;
pitem = proto_tree_add_item ( service_tree , hf_btavdtp_recovery_type , tvb , offset , 1 , ENC_NA ) ;
proto_item_append_text ( pitem , " (%s)" , val_to_str_const ( recovery_type , recovery_type_vals , "RFD" ) ) ;
offset += 1 ;
losc -= 1 ;
maximum_recovery_window_size = tvb_get_guint8 ( tvb , offset ) ;
pitem = proto_tree_add_item ( service_tree , hf_btavdtp_maximum_recovery_window_size , tvb , offset , 1 , ENC_NA ) ;
if ( maximum_recovery_window_size == 0x00 ) {
proto_item_append_text ( pitem , " (Forbidden)" ) ;
}
else if ( maximum_recovery_window_size >= 0x18 ) {
proto_item_append_text ( pitem , " (Undocumented)" ) ;
}
offset += 1 ;
losc -= 1 ;
maximum_number_of_media_packet_in_parity_code = tvb_get_guint8 ( tvb , offset ) ;
proto_tree_add_item ( service_tree , hf_btavdtp_maximum_number_of_media_packet_in_parity_code , tvb , offset , 1 , ENC_NA ) ;
pitem = proto_tree_add_item ( service_tree , hf_btavdtp_maximum_recovery_window_size , tvb , offset , 1 , ENC_NA ) ;
if ( maximum_number_of_media_packet_in_parity_code == 0x00 ) {
proto_item_append_text ( pitem , " (Forbidden)" ) ;
}
else if ( maximum_number_of_media_packet_in_parity_code >= 0x18 ) {
proto_item_append_text ( pitem , " (Undocumented)" ) ;
}
offset += 1 ;
losc -= 1 ;
break ;
case SERVICE_CATEGORY_MEDIA_CODEC : if ( configuration_length ) * configuration_length = losc ;
if ( configuration_offset ) * configuration_offset = offset ;
media_type = tvb_get_guint8 ( tvb , offset ) >> 4 ;
proto_tree_add_item ( service_tree , hf_btavdtp_media_codec_media_type , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( service_tree , hf_btavdtp_media_codec_rfa , tvb , offset , 1 , ENC_NA ) ;
offset += 1 ;
losc -= 1 ;
media_codec_type = tvb_get_guint8 ( tvb , offset ) ;
if ( codec ) {
* codec = media_codec_type ;
}
if ( media_type == MEDIA_TYPE_AUDIO ) {
proto_tree_add_item ( service_tree , hf_btavdtp_media_codec_audio_type , tvb , offset , 1 , ENC_NA ) ;
proto_item_append_text ( service_item , " - Audio %s" , val_to_str_const ( media_codec_type , media_codec_audio_type_vals , "unknown codec" ) ) ;
col_append_fstr ( pinfo -> cinfo , COL_INFO , " - Audio %s" , val_to_str_const ( media_codec_type , media_codec_audio_type_vals , "unknown codec" ) ) ;
}
else if ( media_type == MEDIA_TYPE_VIDEO ) {
proto_tree_add_item ( service_tree , hf_btavdtp_media_codec_video_type , tvb , offset , 1 , ENC_NA ) ;
proto_item_append_text ( service_item , " - Video %s" , val_to_str_const ( media_codec_type , media_codec_video_type_vals , "unknown codec" ) ) ;
col_append_fstr ( pinfo -> cinfo , COL_INFO , " - Video %s" , val_to_str_const ( media_codec_type , media_codec_video_type_vals , "unknown codec" ) ) ;
}
else {
proto_tree_add_item ( service_tree , hf_btavdtp_media_codec_unknown_type , tvb , offset , 1 , ENC_NA ) ;
proto_item_append_text ( service_item , " - Unknown 0x%02x" , media_codec_type ) ;
col_append_fstr ( pinfo -> cinfo , COL_INFO , " - Unknown 0x%02x" , media_codec_type ) ;
}
offset += 1 ;
losc -= 1 ;
offset = dissect_codec ( tvb , pinfo , service_item , service_tree , offset , losc , media_type , media_codec_type , vendor_id , vendor_codec ) ;
losc = 0 ;
break ;
case SERVICE_CATEGORY_CONTENT_PROTECTION : proto_tree_add_item ( service_tree , hf_btavdtp_content_protection_type , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
if ( content_protection_type ) {
* content_protection_type = tvb_get_letohs ( tvb , offset ) ;
}
proto_item_append_text ( service_item , " - %s" , val_to_str_const ( tvb_get_letohs ( tvb , offset ) , content_protection_type_vals , "unknown" ) ) ;
offset += 2 ;
losc -= 2 ;
if ( losc > 0 ) {
proto_tree_add_item ( service_tree , hf_btavdtp_data , tvb , offset , losc , ENC_NA ) ;
offset += losc ;
losc = 0 ;
}
break ;
case SERVICE_CATEGORY_HEADER_COMPRESSION : proto_tree_add_item ( service_tree , hf_btavdtp_header_compression_backch , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( service_tree , hf_btavdtp_header_compression_media , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( service_tree , hf_btavdtp_header_compression_recovery , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( service_tree , hf_btavdtp_header_compression_rfa , tvb , offset , 1 , ENC_NA ) ;
offset += 1 ;
losc -= 1 ;
break ;
case SERVICE_CATEGORY_MULTIPLEXING : proto_tree_add_item ( service_tree , hf_btavdtp_multiplexing_fragmentation , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( service_tree , hf_btavdtp_multiplexing_rfa , tvb , offset , 1 , ENC_NA ) ;
offset += 1 ;
losc -= 1 ;
if ( losc >= 2 ) {
pitem = proto_tree_add_none_format ( service_tree , hf_btavdtp_service_multiplexing_entry , tvb , offset , 1 + losc , "Entry: Media Transport Session" ) ;
ptree = proto_item_add_subtree ( pitem , ett_btavdtp_service ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_tsid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_entry_rfa , tvb , offset , 1 , ENC_NA ) ;
offset += 1 ;
losc -= 1 ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_tcid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_entry_rfa , tvb , offset , 1 , ENC_NA ) ;
offset += 1 ;
losc -= 1 ;
}
if ( losc >= 2 ) {
pitem = proto_tree_add_none_format ( service_tree , hf_btavdtp_service_multiplexing_entry , tvb , offset , 1 + losc , "Entry: Reporting Transport Session" ) ;
ptree = proto_item_add_subtree ( pitem , ett_btavdtp_service ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_tsid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_entry_rfa , tvb , offset , 1 , ENC_NA ) ;
offset += 1 ;
losc -= 1 ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_tcid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_entry_rfa , tvb , offset , 1 , ENC_NA ) ;
offset += 1 ;
losc -= 1 ;
}
if ( losc >= 2 ) {
pitem = proto_tree_add_none_format ( service_tree , hf_btavdtp_service_multiplexing_entry , tvb , offset , 1 + losc , "Entry: Recovery Transport Session" ) ;
ptree = proto_item_add_subtree ( pitem , ett_btavdtp_service ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_tsid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_entry_rfa , tvb , offset , 1 , ENC_NA ) ;
offset += 1 ;
losc -= 1 ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_tcid , tvb , offset , 1 , ENC_NA ) ;
proto_tree_add_item ( ptree , hf_btavdtp_multiplexing_entry_rfa , tvb , offset , 1 , ENC_NA ) ;
offset += 1 ;
losc -= 1 ;
}
break ;
default : proto_tree_add_item ( service_tree , hf_btavdtp_data , tvb , offset , losc , ENC_NA ) ;
offset += losc ;
losc = 0 ;
}
if ( losc > 0 ) {
pitem = proto_tree_add_item ( service_tree , hf_btavdtp_data , tvb , offset , losc , ENC_NA ) ;
offset += losc ;
expert_add_info ( pinfo , pitem , & ei_btavdtp_unexpected_losc_data ) ;
}
}
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void parse_content_type ( struct attachment_istream * astream , const struct message_header_line * hdr ) {
struct rfc822_parser_context parser ;
string_t * content_type ;
if ( astream -> part . content_type != NULL ) return ;
rfc822_parser_init ( & parser , hdr -> full_value , hdr -> full_value_len , NULL ) ;
rfc822_skip_lwsp ( & parser ) ;
T_BEGIN {
content_type = t_str_new ( 64 ) ;
( void ) rfc822_parse_content_type ( & parser , content_type ) ;
astream -> part . content_type = i_strdup ( str_c ( content_type ) ) ;
}
T_END ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void filter_selectively_horiz ( uint8_t * s , int pitch , unsigned int mask_16x16 , unsigned int mask_8x8 , unsigned int mask_4x4 , unsigned int mask_4x4_int , const loop_filter_info_n * lfi_n , const uint8_t * lfl ) {
unsigned int mask ;
int count ;
for ( mask = mask_16x16 | mask_8x8 | mask_4x4 | mask_4x4_int ;
mask ;
mask >>= count ) {
const loop_filter_thresh * lfi = lfi_n -> lfthr + * lfl ;
count = 1 ;
if ( mask & 1 ) {
if ( mask_16x16 & 1 ) {
if ( ( mask_16x16 & 3 ) == 3 ) {
vp9_lpf_horizontal_16 ( s , pitch , lfi -> mblim , lfi -> lim , lfi -> hev_thr , 2 ) ;
count = 2 ;
}
else {
vp9_lpf_horizontal_16 ( s , pitch , lfi -> mblim , lfi -> lim , lfi -> hev_thr , 1 ) ;
}
}
else if ( mask_8x8 & 1 ) {
if ( ( mask_8x8 & 3 ) == 3 ) {
const loop_filter_thresh * lfin = lfi_n -> lfthr + * ( lfl + 1 ) ;
vp9_lpf_horizontal_8_dual ( s , pitch , lfi -> mblim , lfi -> lim , lfi -> hev_thr , lfin -> mblim , lfin -> lim , lfin -> hev_thr ) ;
if ( ( mask_4x4_int & 3 ) == 3 ) {
vp9_lpf_horizontal_4_dual ( s + 4 * pitch , pitch , lfi -> mblim , lfi -> lim , lfi -> hev_thr , lfin -> mblim , lfin -> lim , lfin -> hev_thr ) ;
}
else {
if ( mask_4x4_int & 1 ) vp9_lpf_horizontal_4 ( s + 4 * pitch , pitch , lfi -> mblim , lfi -> lim , lfi -> hev_thr , 1 ) ;
else if ( mask_4x4_int & 2 ) vp9_lpf_horizontal_4 ( s + 8 + 4 * pitch , pitch , lfin -> mblim , lfin -> lim , lfin -> hev_thr , 1 ) ;
}
count = 2 ;
}
else {
vp9_lpf_horizontal_8 ( s , pitch , lfi -> mblim , lfi -> lim , lfi -> hev_thr , 1 ) ;
if ( mask_4x4_int & 1 ) vp9_lpf_horizontal_4 ( s + 4 * pitch , pitch , lfi -> mblim , lfi -> lim , lfi -> hev_thr , 1 ) ;
}
}
else if ( mask_4x4 & 1 ) {
if ( ( mask_4x4 & 3 ) == 3 ) {
const loop_filter_thresh * lfin = lfi_n -> lfthr + * ( lfl + 1 ) ;
vp9_lpf_horizontal_4_dual ( s , pitch , lfi -> mblim , lfi -> lim , lfi -> hev_thr , lfin -> mblim , lfin -> lim , lfin -> hev_thr ) ;
if ( ( mask_4x4_int & 3 ) == 3 ) {
vp9_lpf_horizontal_4_dual ( s + 4 * pitch , pitch , lfi -> mblim , lfi -> lim , lfi -> hev_thr , lfin -> mblim , lfin -> lim , lfin -> hev_thr ) ;
}
else {
if ( mask_4x4_int & 1 ) vp9_lpf_horizontal_4 ( s + 4 * pitch , pitch , lfi -> mblim , lfi -> lim , lfi -> hev_thr , 1 ) ;
else if ( mask_4x4_int & 2 ) vp9_lpf_horizontal_4 ( s + 8 + 4 * pitch , pitch , lfin -> mblim , lfin -> lim , lfin -> hev_thr , 1 ) ;
}
count = 2 ;
}
else {
vp9_lpf_horizontal_4 ( s , pitch , lfi -> mblim , lfi -> lim , lfi -> hev_thr , 1 ) ;
if ( mask_4x4_int & 1 ) vp9_lpf_horizontal_4 ( s + 4 * pitch , pitch , lfi -> mblim , lfi -> lim , lfi -> hev_thr , 1 ) ;
}
}
else if ( mask_4x4_int & 1 ) {
vp9_lpf_horizontal_4 ( s + 4 * pitch , pitch , lfi -> mblim , lfi -> lim , lfi -> hev_thr , 1 ) ;
}
}
s += 8 * count ;
lfl += count ;
mask_16x16 >>= count ;
mask_8x8 >>= count ;
mask_4x4 >>= count ;
mask_4x4_int >>= count ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
unsigned int TSrandom ( ) {
return this_ethread ( ) -> generator . random ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_cyclic_refresh_update_segment ( VP9_COMP * const cpi , MB_MODE_INFO * const mbmi , int mi_row , int mi_col , BLOCK_SIZE bsize , int use_rd ) {
const VP9_COMMON * const cm = & cpi -> common ;
CYCLIC_REFRESH * const cr = cpi -> cyclic_refresh ;
const int bw = num_8x8_blocks_wide_lookup [ bsize ] ;
const int bh = num_8x8_blocks_high_lookup [ bsize ] ;
const int xmis = MIN ( cm -> mi_cols - mi_col , bw ) ;
const int ymis = MIN ( cm -> mi_rows - mi_row , bh ) ;
const int block_index = mi_row * cm -> mi_cols + mi_col ;
const int refresh_this_block = cpi -> mb . in_static_area || candidate_refresh_aq ( cr , mbmi , bsize , use_rd ) ;
int new_map_value = cr -> map [ block_index ] ;
int x = 0 ;
int y = 0 ;
if ( mbmi -> segment_id > 0 && ! refresh_this_block ) mbmi -> segment_id = 0 ;
if ( mbmi -> segment_id == 1 ) {
new_map_value = - cr -> time_for_refresh ;
}
else if ( refresh_this_block ) {
if ( cr -> map [ block_index ] == 1 ) new_map_value = 0 ;
}
else {
new_map_value = 1 ;
}
for ( y = 0 ;
y < ymis ;
y ++ ) for ( x = 0 ;
x < xmis ;
x ++ ) {
cr -> map [ block_index + y * cm -> mi_cols + x ] = new_map_value ;
cpi -> segmentation_map [ block_index + y * cm -> mi_cols + x ] = mbmi -> segment_id ;
}
if ( mbmi -> segment_id ) cr -> num_seg_blocks += xmis * ymis ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int typhoon_pcihost_init ( SysBusDevice * dev ) {
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
size_t compile_tree ( struct filter_op * * fop ) {
int i = 1 ;
struct filter_op * array = NULL ;
struct unfold_elm * ue ;
if ( tree_root == NULL ) return 0 ;
fprintf ( stdout , " Unfolding the meta-tree " ) ;
fflush ( stdout ) ;
unfold_blk ( & tree_root ) ;
fprintf ( stdout , " done.\n\n" ) ;
labels_to_offsets ( ) ;
TAILQ_FOREACH ( ue , & unfolded_tree , next ) {
if ( ue -> label == 0 ) {
SAFE_REALLOC ( array , i * sizeof ( struct filter_op ) ) ;
memcpy ( & array [ i - 1 ] , & ue -> fop , sizeof ( struct filter_op ) ) ;
i ++ ;
}
}
SAFE_REALLOC ( array , i * sizeof ( struct filter_op ) ) ;
array [ i - 1 ] . opcode = FOP_EXIT ;
* fop = array ;
return ( i ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int remoteRemoveClientStream ( struct qemud_client * client , struct qemud_client_stream * stream ) {
VIR_DEBUG ( "client=%p proc=%d serial=%d" , client , stream -> procedure , stream -> serial ) ;
struct qemud_client_stream * curr = client -> streams ;
struct qemud_client_stream * prev = NULL ;
struct qemud_client_filter * filter = NULL ;
if ( client -> filters == & stream -> filter ) {
client -> filters = client -> filters -> next ;
}
else {
filter = client -> filters ;
while ( filter ) {
if ( filter -> next == & stream -> filter ) {
filter -> next = filter -> next -> next ;
break ;
}
filter = filter -> next ;
}
}
if ( ! stream -> closed ) {
virStreamEventRemoveCallback ( stream -> st ) ;
virStreamAbort ( stream -> st ) ;
}
while ( curr ) {
if ( curr == stream ) {
if ( prev ) prev -> next = curr -> next ;
else client -> streams = curr -> next ;
remoteFreeClientStream ( client , stream ) ;
return 0 ;
}
prev = curr ;
curr = curr -> next ;
}
return - 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool e1000e_intrmgr_delay_rx_causes ( E1000ECore * core , uint32_t * causes ) {
uint32_t delayable_causes ;
uint32_t rdtr = core -> mac [ RDTR ] ;
uint32_t radv = core -> mac [ RADV ] ;
uint32_t raid = core -> mac [ RAID ] ;
if ( msix_enabled ( core -> owner ) ) {
return false ;
}
delayable_causes = E1000_ICR_RXQ0 | E1000_ICR_RXQ1 | E1000_ICR_RXT0 ;
if ( ! ( core -> mac [ RFCTL ] & E1000_RFCTL_ACK_DIS ) ) {
delayable_causes |= E1000_ICR_ACK ;
}
core -> delayed_causes |= * causes & delayable_causes ;
* causes &= ~ delayable_causes ;
if ( ( rdtr == 0 ) || ( * causes != 0 ) ) {
return false ;
}
if ( ( raid == 0 ) && ( core -> delayed_causes & E1000_ICR_ACK ) ) {
return false ;
}
e1000e_intrmgr_rearm_timer ( & core -> rdtr ) ;
if ( ! core -> radv . running && ( radv != 0 ) ) {
e1000e_intrmgr_rearm_timer ( & core -> radv ) ;
}
if ( ! core -> raid . running && ( core -> delayed_causes & E1000_ICR_ACK ) ) {
e1000e_intrmgr_rearm_timer ( & core -> raid ) ;
}
return true ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void read_partition ( uint8_t * p , struct partition_record * r ) {
r -> bootable = p [ 0 ] ;
r -> start_head = p [ 1 ] ;
r -> start_cylinder = p [ 3 ] | ( ( p [ 2 ] << 2 ) & 0x0300 ) ;
r -> start_sector = p [ 2 ] & 0x3f ;
r -> system = p [ 4 ] ;
r -> end_head = p [ 5 ] ;
r -> end_cylinder = p [ 7 ] | ( ( p [ 6 ] << 2 ) & 0x300 ) ;
r -> end_sector = p [ 6 ] & 0x3f ;
r -> start_sector_abs = ldl_le_p ( p + 8 ) ;
r -> nb_sectors_abs = ldl_le_p ( p + 12 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void search_postfix_clear ( void ) {
search_state_decref ( global_search_state ) ;
global_search_state = search_state_new ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int asf_write_packet ( AVFormatContext * s , AVPacket * pkt ) {
ASFContext * asf = s -> priv_data ;
AVIOContext * pb = s -> pb ;
ASFStream * stream ;
AVCodecContext * codec ;
uint32_t packet_number ;
int64_t pts ;
int start_sec ;
int flags = pkt -> flags ;
int ret ;
uint64_t offset = avio_tell ( pb ) ;
codec = s -> streams [ pkt -> stream_index ] -> codec ;
stream = & asf -> streams [ pkt -> stream_index ] ;
if ( codec -> codec_type == AVMEDIA_TYPE_AUDIO ) flags &= ~ AV_PKT_FLAG_KEY ;
pts = ( pkt -> pts != AV_NOPTS_VALUE ) ? pkt -> pts : pkt -> dts ;
av_assert0 ( pts != AV_NOPTS_VALUE ) ;
pts *= 10000 ;
asf -> duration = FFMAX ( asf -> duration , pts + pkt -> duration * 10000 ) ;
packet_number = asf -> nb_packets ;
put_frame ( s , stream , s -> streams [ pkt -> stream_index ] , pkt -> dts , pkt -> data , pkt -> size , flags ) ;
start_sec = ( int ) ( ( PREROLL_TIME * 10000 + pts + ASF_INDEXED_INTERVAL - 1 ) / ASF_INDEXED_INTERVAL ) ;
if ( ( ! asf -> is_streamed ) && ( flags & AV_PKT_FLAG_KEY ) ) {
uint16_t packet_count = asf -> nb_packets - packet_number ;
ret = update_index ( s , start_sec , packet_number , packet_count , offset ) ;
if ( ret < 0 ) return ret ;
}
asf -> end_sec = start_sec ;
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * _CompoundTextgetName ( const UConverter * cnv ) {
return "x11-compound-text" ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void stroke_export ( private_stroke_socket_t * this , stroke_msg_t * msg , FILE * out ) {
pop_string ( msg , & msg -> export . selector ) ;
if ( msg -> export . flags & EXPORT_X509 ) {
enumerator_t * enumerator ;
identification_t * id ;
certificate_t * cert ;
id = identification_create_from_string ( msg -> export . selector ) ;
enumerator = lib -> credmgr -> create_cert_enumerator ( lib -> credmgr , CERT_X509 , KEY_ANY , id , FALSE ) ;
while ( enumerator -> enumerate ( enumerator , & cert ) ) {
print_pem_cert ( out , cert ) ;
}
enumerator -> destroy ( enumerator ) ;
id -> destroy ( id ) ;
}
if ( msg -> export . flags & ( EXPORT_CONN_CERT | EXPORT_CONN_CHAIN ) ) {
enumerator_t * sas , * auths , * certs ;
ike_sa_t * ike_sa ;
auth_cfg_t * auth ;
certificate_t * cert ;
auth_rule_t rule ;
sas = charon -> ike_sa_manager -> create_enumerator ( charon -> ike_sa_manager , TRUE ) ;
while ( sas -> enumerate ( sas , & ike_sa ) ) {
if ( streq ( msg -> export . selector , ike_sa -> get_name ( ike_sa ) ) ) {
auths = ike_sa -> create_auth_cfg_enumerator ( ike_sa , FALSE ) ;
while ( auths -> enumerate ( auths , & auth ) ) {
bool got_subject = FALSE ;
certs = auth -> create_enumerator ( auth ) ;
while ( certs -> enumerate ( certs , & rule , & cert ) ) {
switch ( rule ) {
case AUTH_RULE_CA_CERT : case AUTH_RULE_IM_CERT : if ( msg -> export . flags & EXPORT_CONN_CHAIN ) {
print_pem_cert ( out , cert ) ;
}
break ;
case AUTH_RULE_SUBJECT_CERT : if ( ! got_subject ) {
print_pem_cert ( out , cert ) ;
got_subject = TRUE ;
}
break ;
default : break ;
}
}
certs -> destroy ( certs ) ;
}
auths -> destroy ( auths ) ;
}
}
sas -> destroy ( sas ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int get_gf_active_quality ( const RATE_CONTROL * const rc , int q ) {
return get_active_quality ( q , rc -> gfu_boost , gf_low , gf_high , arfgf_low_motion_minq , arfgf_high_motion_minq ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static GstFlowReturn gst_asf_demux_chain_headers ( GstASFDemux * demux ) {
AsfObject obj ;
guint8 * header_data , * data = NULL ;
const guint8 * cdata = NULL ;
guint64 header_size ;
GstFlowReturn flow = GST_FLOW_OK ;
cdata = ( guint8 * ) gst_adapter_map ( demux -> adapter , ASF_OBJECT_HEADER_SIZE ) ;
if ( cdata == NULL ) goto need_more_data ;
if ( ! asf_demux_peek_object ( demux , cdata , ASF_OBJECT_HEADER_SIZE , & obj , TRUE ) ) goto parse_failed ;
if ( obj . id != ASF_OBJ_HEADER ) goto wrong_type ;
GST_LOG_OBJECT ( demux , "header size = %u" , ( guint ) obj . size ) ;
if ( gst_adapter_available ( demux -> adapter ) < obj . size + 50 ) goto need_more_data ;
data = gst_adapter_take ( demux -> adapter , obj . size + 50 ) ;
header_data = data ;
header_size = obj . size ;
flow = gst_asf_demux_process_object ( demux , & header_data , & header_size ) ;
if ( flow != GST_FLOW_OK ) goto parse_failed ;
demux -> data_offset = obj . size + 50 ;
if ( ! gst_asf_demux_parse_data_object_start ( demux , data + obj . size ) ) goto wrong_type ;
if ( demux -> num_streams == 0 ) goto no_streams ;
g_free ( data ) ;
return GST_FLOW_OK ;
need_more_data : {
GST_LOG_OBJECT ( demux , "not enough data in adapter yet" ) ;
return GST_FLOW_OK ;
}
wrong_type : {
GST_ELEMENT_ERROR ( demux , STREAM , WRONG_TYPE , ( NULL ) , ( "This doesn't seem to be an ASF file" ) ) ;
g_free ( data ) ;
return GST_FLOW_ERROR ;
}
no_streams : parse_failed : {
GST_ELEMENT_ERROR ( demux , STREAM , DEMUX , ( NULL ) , ( "header parsing failed, or no streams found, flow = %s" , gst_flow_get_name ( flow ) ) ) ;
g_free ( data ) ;
return GST_FLOW_ERROR ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static SvcInternal * get_svc_internal ( SvcContext * svc_ctx ) {
if ( svc_ctx == NULL ) return NULL ;
if ( svc_ctx -> internal == NULL ) {
SvcInternal * const si = ( SvcInternal * ) malloc ( sizeof ( * si ) ) ;
if ( si != NULL ) {
memset ( si , 0 , sizeof ( * si ) ) ;
}
svc_ctx -> internal = si ;
}
return ( SvcInternal * ) svc_ctx -> internal ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_set_speed_features ( VP9_COMP * cpi ) {
SPEED_FEATURES * const sf = & cpi -> sf ;
VP9_COMMON * const cm = & cpi -> common ;
const VP9EncoderConfig * const oxcf = & cpi -> oxcf ;
int i ;
sf -> frame_parameter_update = 1 ;
sf -> mv . search_method = NSTEP ;
sf -> recode_loop = ALLOW_RECODE ;
sf -> mv . subpel_search_method = SUBPEL_TREE ;
sf -> mv . subpel_iters_per_step = 2 ;
sf -> mv . subpel_force_stop = 0 ;
sf -> optimize_coefficients = ! is_lossless_requested ( & cpi -> oxcf ) ;
sf -> mv . reduce_first_step_size = 0 ;
sf -> mv . auto_mv_step_size = 0 ;
sf -> mv . fullpel_search_step_param = 6 ;
sf -> comp_inter_joint_search_thresh = BLOCK_4X4 ;
sf -> adaptive_rd_thresh = 0 ;
sf -> use_lastframe_partitioning = LAST_FRAME_PARTITION_OFF ;
sf -> tx_size_search_method = USE_FULL_RD ;
sf -> use_lp32x32fdct = 0 ;
sf -> adaptive_motion_search = 0 ;
sf -> adaptive_pred_interp_filter = 0 ;
sf -> adaptive_mode_search = 0 ;
sf -> cb_pred_filter_search = 0 ;
sf -> cb_partition_search = 0 ;
sf -> motion_field_mode_search = 0 ;
sf -> alt_ref_search_fp = 0 ;
sf -> use_quant_fp = 0 ;
sf -> reference_masking = 0 ;
sf -> partition_search_type = SEARCH_PARTITION ;
sf -> less_rectangular_check = 0 ;
sf -> use_square_partition_only = 0 ;
sf -> auto_min_max_partition_size = NOT_IN_USE ;
sf -> max_partition_size = BLOCK_64X64 ;
sf -> min_partition_size = BLOCK_4X4 ;
sf -> adjust_partitioning_from_last_frame = 0 ;
sf -> last_partitioning_redo_frequency = 4 ;
sf -> constrain_copy_partition = 0 ;
sf -> disable_split_mask = 0 ;
sf -> mode_search_skip_flags = 0 ;
sf -> force_frame_boost = 0 ;
sf -> max_delta_qindex = 0 ;
sf -> disable_filter_search_var_thresh = 0 ;
sf -> adaptive_interp_filter_search = 0 ;
for ( i = 0 ;
i < TX_SIZES ;
i ++ ) {
sf -> intra_y_mode_mask [ i ] = INTRA_ALL ;
sf -> intra_uv_mode_mask [ i ] = INTRA_ALL ;
}
sf -> use_rd_breakout = 0 ;
sf -> skip_encode_sb = 0 ;
sf -> use_uv_intra_rd_estimate = 0 ;
sf -> allow_skip_recode = 0 ;
sf -> lpf_pick = LPF_PICK_FROM_FULL_IMAGE ;
sf -> use_fast_coef_updates = TWO_LOOP ;
sf -> use_fast_coef_costing = 0 ;
sf -> mode_skip_start = MAX_MODES ;
sf -> use_nonrd_pick_mode = 0 ;
for ( i = 0 ;
i < BLOCK_SIZES ;
++ i ) sf -> inter_mode_mask [ i ] = INTER_ALL ;
sf -> max_intra_bsize = BLOCK_64X64 ;
sf -> reuse_inter_pred_sby = 0 ;
sf -> always_this_block_size = BLOCK_16X16 ;
sf -> search_type_check_frequency = 50 ;
sf -> encode_breakout_thresh = 0 ;
sf -> elevate_newmv_thresh = 0 ;
sf -> recode_tolerance = 25 ;
sf -> default_interp_filter = SWITCHABLE ;
sf -> tx_size_search_breakout = 0 ;
sf -> partition_search_breakout_dist_thr = 0 ;
sf -> partition_search_breakout_rate_thr = 0 ;
if ( oxcf -> mode == REALTIME ) set_rt_speed_feature ( cpi , sf , oxcf -> speed , oxcf -> content ) ;
else if ( oxcf -> mode == GOOD ) set_good_speed_feature ( cpi , cm , sf , oxcf -> speed ) ;
cpi -> full_search_sad = vp9_full_search_sad ;
cpi -> diamond_search_sad = oxcf -> mode == BEST ? vp9_full_range_search : vp9_diamond_search_sad ;
cpi -> refining_search_sad = vp9_refining_search_sad ;
if ( oxcf -> pass == 1 ) sf -> optimize_coefficients = 0 ;
if ( oxcf -> pass == 0 ) {
sf -> recode_loop = DISALLOW_RECODE ;
sf -> optimize_coefficients = 0 ;
}
if ( sf -> mv . subpel_search_method == SUBPEL_TREE ) {
cpi -> find_fractional_mv_step = vp9_find_best_sub_pixel_tree ;
}
else if ( sf -> mv . subpel_search_method == SUBPEL_TREE_PRUNED ) {
cpi -> find_fractional_mv_step = vp9_find_best_sub_pixel_tree_pruned ;
}
cpi -> mb . optimize = sf -> optimize_coefficients == 1 && oxcf -> pass != 1 ;
if ( sf -> disable_split_mask == DISABLE_ALL_SPLIT ) sf -> adaptive_pred_interp_filter = 0 ;
if ( ! cpi -> oxcf . frame_periodic_boost ) {
sf -> max_delta_qindex = 0 ;
}
if ( cpi -> encode_breakout && oxcf -> mode == REALTIME && sf -> encode_breakout_thresh > cpi -> encode_breakout ) cpi -> encode_breakout = sf -> encode_breakout_thresh ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int gs_main_finit ( gs_main_instance * minst , int exit_status , int code ) {
i_ctx_t * i_ctx_p = minst -> i_ctx_p ;
gs_dual_memory_t dmem = {
0 }
;
int exit_code ;
ref error_object ;
char * tempnames ;
tempnames = gs_main_tempnames ( minst ) ;
gs_finit_push_systemdict ( i_ctx_p ) ;
if ( minst -> init_done >= 2 ) {
gs_main_run_string ( minst , "/BGPrint /GetDeviceParam .special_op \ {
{
<</BeginPage {
pop}
/EndPage {
pop pop //false }
\ /BGPrint false /NumRenderingThreads 0>> setpagedevice}
if}
if \ serverdict /.jobsavelevel get 0 eq {
/quit}
{
/stop}
ifelse \ .systemvar exec" , 0 , & exit_code , & error_object ) ;
}
if ( minst -> init_done >= 2 ) {
int code = 0 ;
if ( idmemory -> reclaim != 0 ) {
code = interp_reclaim ( & minst -> i_ctx_p , avm_global ) ;
if ( code < 0 ) {
ref error_name ;
if ( tempnames ) free ( tempnames ) ;
if ( gs_errorname ( i_ctx_p , code , & error_name ) >= 0 ) {
char err_str [ 32 ] = {
0 }
;
name_string_ref ( imemory , & error_name , & error_name ) ;
memcpy ( err_str , error_name . value . const_bytes , r_size ( & error_name ) ) ;
emprintf2 ( imemory , "ERROR: %s (%d) reclaiming the memory while the interpreter finalization.\n" , err_str , code ) ;
}
else {
emprintf1 ( imemory , "UNKNOWN ERROR %d reclaiming the memory while the interpreter finalization.\n" , code ) ;
}
# ifdef MEMENTO_SQUEEZE_BUILD if ( code != gs_error_VMerror ) return gs_error_Fatal ;
# else return gs_error_Fatal ;
# endif }
i_ctx_p = minst -> i_ctx_p ;
}
if ( i_ctx_p -> pgs != NULL && i_ctx_p -> pgs -> device != NULL ) {
gx_device * pdev = i_ctx_p -> pgs -> device ;
const char * dname = pdev -> dname ;
rc_adjust ( pdev , 1 , "gs_main_finit" ) ;
gs_main_run_string ( minst , ".uninstallpagedevice serverdict \ /.jobsavelevel get 0 eq {
/quit}
{
/stop}
ifelse .systemvar exec" , 0 , & exit_code , & error_object ) ;
code = gs_closedevice ( pdev ) ;
if ( code < 0 ) {
ref error_name ;
if ( gs_errorname ( i_ctx_p , code , & error_name ) >= 0 ) {
char err_str [ 32 ] = {
0 }
;
name_string_ref ( imemory , & error_name , & error_name ) ;
memcpy ( err_str , error_name . value . const_bytes , r_size ( & error_name ) ) ;
emprintf3 ( imemory , "ERROR: %s (%d) on closing %s device.\n" , err_str , code , dname ) ;
}
else {
emprintf2 ( imemory , "UNKNOWN ERROR %d closing %s device.\n" , code , dname ) ;
}
}
rc_decrement ( pdev , "gs_main_finit" ) ;
if ( exit_status == 0 || exit_status == gs_error_Quit ) exit_status = code ;
}
gs_main_run_string ( minst , "(%stdout) (w) file closefile (%stderr) (w) file closefile \ serverdict /.jobsavelevel get 0 eq {
/quit}
{
/stop}
ifelse .systemexec \ systemdict /savedinitialgstate .forceundef" , 0 , & exit_code , & error_object ) ;
}
gp_readline_finit ( minst -> readline_data ) ;
i_ctx_p = minst -> i_ctx_p ;
if ( gs_debug_c ( ':' ) ) {
print_resource_usage ( minst , & gs_imemory , "Final" ) ;
dmprintf1 ( minst -> heap , "%% Exiting instance 0x%p\n" , minst ) ;
}
if ( minst -> init_done >= 1 ) {
gs_memory_t * mem_raw = i_ctx_p -> memory . current -> non_gc_memory ;
i_plugin_holder * h = i_ctx_p -> plugin_list ;
dmem = * idmemory ;
code = alloc_restore_all ( i_ctx_p ) ;
if ( code < 0 ) emprintf1 ( mem_raw , "ERROR %d while the final restore. See gs/psi/ierrors.h for code explanation.\n" , code ) ;
i_iodev_finit ( & dmem ) ;
i_plugin_finit ( mem_raw , h ) ;
}
if ( minst -> heap -> gs_lib_ctx -> fstdout2 && ( minst -> heap -> gs_lib_ctx -> fstdout2 != minst -> heap -> gs_lib_ctx -> fstdout ) && ( minst -> heap -> gs_lib_ctx -> fstdout2 != minst -> heap -> gs_lib_ctx -> fstderr ) ) {
fclose ( minst -> heap -> gs_lib_ctx -> fstdout2 ) ;
minst -> heap -> gs_lib_ctx -> fstdout2 = ( FILE * ) NULL ;
}
minst -> heap -> gs_lib_ctx -> stdout_is_redirected = 0 ;
minst -> heap -> gs_lib_ctx -> stdout_to_stderr = 0 ;
if ( tempnames ) {
char * p = tempnames ;
while ( * p ) {
unlink ( p ) ;
p += strlen ( p ) + 1 ;
}
free ( tempnames ) ;
}
gs_lib_finit ( exit_status , code , minst -> heap ) ;
gs_free_object ( minst -> heap , minst -> lib_path . container . value . refs , "lib_path array" ) ;
ialloc_finit ( & dmem ) ;
return exit_status ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool DecoderWaitUnblock ( decoder_t * p_dec ) {
decoder_owner_sys_t * p_owner = p_dec -> p_owner ;
vlc_assert_locked ( & p_owner -> lock ) ;
for ( ;
;
) {
if ( p_owner -> b_flushing ) break ;
if ( p_owner -> b_paused ) {
if ( p_owner -> b_waiting && ! p_owner -> b_has_data ) break ;
if ( p_owner -> pause . i_ignore > 0 ) {
p_owner -> pause . i_ignore -- ;
break ;
}
}
else {
if ( ! p_owner -> b_waiting || ! p_owner -> b_has_data ) break ;
}
vlc_cond_wait ( & p_owner -> wait_request , & p_owner -> lock ) ;
}
return p_owner -> b_flushing ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int eval_sse ( const uint8_t * a , const uint8_t * b , int count ) {
int diff = 0 ;
while ( count -- ) diff += square ( * b ++ - * a ++ ) ;
return diff ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_GenericParameter ( 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_GenericParameter , GenericParameter_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
struct message_decoder_context * message_decoder_init ( normalizer_func_t * normalizer , enum message_decoder_flags flags ) {
struct message_decoder_context * ctx ;
ctx = i_new ( struct message_decoder_context , 1 ) ;
ctx -> flags = flags ;
ctx -> normalizer = normalizer ;
ctx -> buf = buffer_create_dynamic ( default_pool , 8192 ) ;
ctx -> buf2 = buffer_create_dynamic ( default_pool , 8192 ) ;
ctx -> encoding_buf = buffer_create_dynamic ( default_pool , 128 ) ;
return ctx ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool e1000e_tx_pkt_send ( E1000ECore * core , struct e1000e_tx * tx , int queue_index ) {
int target_queue = MIN ( core -> max_queue_num , queue_index ) ;
NetClientState * queue = qemu_get_subqueue ( core -> owner_nic , target_queue ) ;
e1000e_setup_tx_offloads ( core , tx ) ;
net_tx_pkt_dump ( tx -> tx_pkt ) ;
if ( ( core -> phy [ 0 ] [ PHY_CTRL ] & MII_CR_LOOPBACK ) || ( ( core -> mac [ RCTL ] & E1000_RCTL_LBM_MAC ) == E1000_RCTL_LBM_MAC ) ) {
return net_tx_pkt_send_loopback ( tx -> tx_pkt , queue ) ;
}
else {
return net_tx_pkt_send ( tx -> tx_pkt , queue ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void write_interp_filter ( INTERP_FILTER filter , struct vp9_write_bit_buffer * wb ) {
const int filter_to_literal [ ] = {
1 , 0 , 2 , 3 }
;
vp9_wb_write_bit ( wb , filter == SWITCHABLE ) ;
if ( filter != SWITCHABLE ) vp9_wb_write_literal ( wb , filter_to_literal [ filter ] , 2 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void jas_image_writecmptsample ( jas_image_t * image , int cmptno , int x , int y , int_fast32_t v ) {
jas_image_cmpt_t * cmpt ;
uint_fast32_t t ;
int k ;
int c ;
cmpt = image -> cmpts_ [ cmptno ] ;
if ( jas_stream_seek ( cmpt -> stream_ , ( cmpt -> width_ * y + x ) * cmpt -> cps_ , SEEK_SET ) < 0 ) {
return ;
}
t = inttobits ( v , cmpt -> prec_ , cmpt -> sgnd_ ) ;
for ( k = cmpt -> cps_ ;
k > 0 ;
-- k ) {
c = ( t >> ( 8 * ( cmpt -> cps_ - 1 ) ) ) & 0xff ;
if ( jas_stream_putc ( cmpt -> stream_ , ( unsigned char ) c ) == EOF ) {
return ;
}
t <<= 8 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void add_tl_data ( krb5_int16 * n_tl_datap , krb5_tl_data * * tl_datap , krb5_int16 tl_type , krb5_ui_2 len , krb5_octet * contents ) {
krb5_tl_data * tl_data ;
krb5_octet * copy ;
copy = malloc ( len ) ;
tl_data = calloc ( 1 , sizeof ( * tl_data ) ) ;
if ( copy == NULL || tl_data == NULL ) {
fprintf ( stderr , _ ( "Not enough memory\n" ) ) ;
exit ( 1 ) ;
}
memcpy ( copy , contents , len ) ;
tl_data -> tl_data_type = tl_type ;
tl_data -> tl_data_length = len ;
tl_data -> tl_data_contents = copy ;
tl_data -> tl_data_next = NULL ;
for ( ;
* tl_datap != NULL ;
tl_datap = & ( * tl_datap ) -> tl_data_next ) ;
* tl_datap = tl_data ;
( * n_tl_datap ) ++ ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static VALUE ossl_cipher_encrypt ( int argc , VALUE * argv , VALUE self ) {
return ossl_cipher_init ( argc , argv , self , 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ff_mpeg4_pred_ac ( MpegEncContext * s , int16_t * block , int n , int dir ) {
int i ;
int16_t * ac_val , * ac_val1 ;
int8_t * const qscale_table = s -> current_picture . f . qscale_table ;
ac_val = s -> ac_val [ 0 ] [ 0 ] + s -> block_index [ n ] * 16 ;
ac_val1 = ac_val ;
if ( s -> ac_pred ) {
if ( dir == 0 ) {
const int xy = s -> mb_x - 1 + s -> mb_y * s -> mb_stride ;
ac_val -= 16 ;
if ( s -> mb_x == 0 || s -> qscale == qscale_table [ xy ] || n == 1 || n == 3 ) {
for ( i = 1 ;
i < 8 ;
i ++ ) {
block [ s -> dsp . idct_permutation [ i << 3 ] ] += ac_val [ i ] ;
}
}
else {
for ( i = 1 ;
i < 8 ;
i ++ ) {
block [ s -> dsp . idct_permutation [ i << 3 ] ] += ROUNDED_DIV ( ac_val [ i ] * qscale_table [ xy ] , s -> qscale ) ;
}
}
}
else {
const int xy = s -> mb_x + s -> mb_y * s -> mb_stride - s -> mb_stride ;
ac_val -= 16 * s -> block_wrap [ n ] ;
if ( s -> mb_y == 0 || s -> qscale == qscale_table [ xy ] || n == 2 || n == 3 ) {
for ( i = 1 ;
i < 8 ;
i ++ ) {
block [ s -> dsp . idct_permutation [ i ] ] += ac_val [ i + 8 ] ;
}
}
else {
for ( i = 1 ;
i < 8 ;
i ++ ) {
block [ s -> dsp . idct_permutation [ i ] ] += ROUNDED_DIV ( ac_val [ i + 8 ] * qscale_table [ xy ] , s -> qscale ) ;
}
}
}
}
for ( i = 1 ;
i < 8 ;
i ++ ) ac_val1 [ i ] = block [ s -> dsp . idct_permutation [ i << 3 ] ] ;
for ( i = 1 ;
i < 8 ;
i ++ ) ac_val1 [ 8 + i ] = block [ s -> dsp . idct_permutation [ i ] ] ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int parse_RowsBuffer ( tvbuff_t * tvb , packet_info * pinfo , int offset , guint32 num_rows , struct CPMSetBindingsIn * bindingsin , struct rows_data * rowsin , gboolean is64bit , proto_tree * parent_tree , const char * fmt , ... ) {
proto_tree * tree ;
proto_item * item ;
guint32 num ;
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_GetRowsRow , & item , txt ) ;
for ( num = 0 ;
num < num_rows ;
++ num ) {
guint32 col ;
proto_tree * row_tree ;
row_tree = proto_tree_add_subtree_format ( tree , tvb , offset , 0 , ett_GetRowsRow , NULL , "Row[%d]" , num ) ;
for ( col = 0 ;
col < bindingsin -> ccolumns ;
col ++ ) {
parse_RowsBufferCol ( tvb , pinfo , offset , num , col , bindingsin , rowsin , is64bit , row_tree , "Col[%d]" , col ) ;
}
}
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
gboolean logcat_text_time_dump_open ( wtap_dumper * wdh , int * err _U_ ) {
struct dumper_t * dumper ;
dumper = ( struct dumper_t * ) g_malloc ( sizeof ( struct dumper_t ) ) ;
dumper -> type = DUMP_TIME ;
wdh -> priv = dumper ;
wdh -> subtype_write = logcat_dump_text ;
wdh -> subtype_close = NULL ;
return TRUE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( ClientHintsBrowserTest , ClientHintsHttps ) {
base : : HistogramTester histogram_tester ;
ui_test_utils : : NavigateToURL ( browser ( ) , accept_ch_with_lifetime_url ( ) ) ;
histogram_tester . ExpectUniqueSample ( "ClientHints.UpdateEventCount" , 1 , 1 ) ;
content : : FetchHistogramsFromChildProcesses ( ) ;
SubprocessMetricsProvider : : MergeHistogramDeltasForTesting ( ) ;
histogram_tester . ExpectUniqueSample ( "ClientHints.UpdateSize" , 3 , 1 ) ;
histogram_tester . ExpectUniqueSample ( "ClientHints.PersistDuration" , * 1000 , 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
unsigned long # define BN_LONG long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK ( 0xffffffffffffffffffffffffffffffffLL ) # define BN_MASK2 ( 0xffffffffffffffffL ) # define BN_MASK2l ( 0xffffffffL ) # define BN_MASK2h ( 0xffffffff00000000L ) # define BN_MASK2h1 ( 0xffffffff80000000L ) # define BN_TBIT ( 0x8000000000000000L ) # define BN_DEC_CONV ( 10000000000000000000UL ) # define BN_DEC_FMT1 "%lu" # define BN_DEC_FMT2 "%019lu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%lX" # define BN_HEX_FMT2 "%016lX" # endif # ifdef SIXTY_FOUR_BIT # undef BN_LLONG # undef BN_ULLONG # define BN_ULONG unsigned long long # define BN_LONG long long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK2 ( 0xffffffffffffffffLL ) # define BN_MASK2l ( 0xffffffffL ) # define BN_MASK2h ( 0xffffffff00000000LL ) # define BN_MASK2h1 ( 0xffffffff80000000LL ) # define BN_TBIT ( 0x8000000000000000LL ) # define BN_DEC_CONV ( 10000000000000000000ULL ) # define BN_DEC_FMT1 "%llu" # define BN_DEC_FMT2 "%019llu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%llX" # define BN_HEX_FMT2 "%016llX" # endif # ifdef THIRTY_TWO_BIT # ifdef BN_LLONG # if defined ( _WIN32 ) && ! defined ( __GNUC__ ) # define BN_ULLONG unsigned __int64 # define BN_MASK ( 0xffffffffffffffffI64 ) # else # define BN_ULLONG unsigned long long # define BN_MASK ( 0xffffffffffffffffLL ) # endif # endif # define BN_ULONG unsigned int # define BN_LONG int # define BN_BITS 64 # define BN_BYTES 4 # define BN_BITS2 32 # define BN_BITS4 16 # define BN_MASK2 ( 0xffffffffL ) # define BN_MASK2l ( 0xffff ) # define BN_MASK2h1 ( 0xffff8000L ) # define BN_MASK2h ( 0xffff0000L ) # define BN_TBIT ( 0x80000000L ) # define BN_DEC_CONV ( 1000000000L ) # define BN_DEC_FMT1 "%u" # define BN_DEC_FMT2 "%09u" # define BN_DEC_NUM 9 # define BN_HEX_FMT1 "%X" # define BN_HEX_FMT2 "%08X" # endif # define BN_DEFAULT_BITS 1280 # define BN_FLG_MALLOCED 0x01 # define BN_FLG_STATIC_DATA 0x02 # define BN_FLG_CONSTTIME 0x04 # ifndef OPENSSL_NO_DEPRECATED # define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME # endif # ifndef OPENSSL_NO_DEPRECATED # define BN_FLG_FREE 0x8000 # endif # define BN_set_flags ( b , n ) ( ( b ) -> flags |= ( n ) ) # define BN_get_flags ( b , n ) ( ( b ) -> flags & ( n ) ) # define BN_with_flags ( dest , b , n ) ( ( dest ) -> d = ( b ) -> d , \ ( dest ) -> top = ( b ) -> top , \ ( dest ) -> dmax = ( b ) -> dmax , \ ( dest ) -> neg = ( b ) -> neg , \ ( dest ) -> flags = ( ( ( dest ) -> flags & BN_FLG_MALLOCED ) \ | ( ( b ) -> flags & ~ BN_FLG_MALLOCED ) \ | BN_FLG_STATIC_DATA \ | ( n ) ) ) # if 0 typedef struct bignum_st BIGNUM ;
typedef struct bignum_ctx BN_CTX ;
typedef struct bn_blinding_st BN_BLINDING ;
typedef struct bn_mont_ctx_st BN_MONT_CTX ;
typedef struct bn_recp_ctx_st BN_RECP_CTX ;
typedef struct bn_gencb_st BN_GENCB ;
# endif struct bignum_st {
BN_ULONG * d ;
int top ;
int dmax ;
int neg ;
int flags ;
}
;
struct bn_mont_ctx_st {
int ri ;
BIGNUM RR ;
BIGNUM N ;
BIGNUM Ni ;
BN_ULONG n0 [ 2 ] ;
int flags ;
}
;
struct bn_recp_ctx_st {
BIGNUM N ;
BIGNUM Nr ;
int num_bits ;
int shift ;
int flags ;
}
;
struct bn_gencb_st {
unsigned int ver ;
void * arg ;
union {
void ( * cb_1 ) ( int , int , void * ) ;
int ( * cb_2 ) ( int , int , BN_GENCB * ) ;
}
cb ;
}
;
int BN_GENCB_call ( BN_GENCB * cb , int a , int b ) ;
# define BN_GENCB_set_old ( gencb , callback , cb_arg ) {
\ BN_GENCB * tmp_gencb = ( gencb ) ;
\ tmp_gencb -> ver = 1 ;
\ tmp_gencb -> arg = ( cb_arg ) ;
\ tmp_gencb -> cb . cb_1 = ( callback ) ;
}
# define BN_GENCB_set ( gencb , callback , cb_arg ) {
\ BN_GENCB * tmp_gencb = ( gencb ) ;
\ tmp_gencb -> ver = 2 ;
\ tmp_gencb -> arg = ( cb_arg ) ;
\ tmp_gencb -> cb . cb_2 = ( callback ) ;
}
# define BN_prime_checks 0 # define BN_prime_checks_for_size ( b ) ( ( b ) >= 1300 ? 2 : \ ( b ) >= 850 ? 3 : \ ( b ) >= 650 ? 4 : \ ( b ) >= 550 ? 5 : \ ( b ) >= 450 ? 6 : \ ( b ) >= 400 ? 7 : \ ( b ) >= 350 ? 8 : \ ( b ) >= 300 ? 9 : \ ( b ) >= 250 ? 12 : \ ( b ) >= 200 ? 15 : \ ( b ) >= 150 ? 18 : \ 27 ) # define BN_num_bytes ( a ) ( ( BN_num_bits ( a ) + 7 ) / 8 ) # define BN_abs_is_word ( a , w ) ( ( ( ( a ) -> top == 1 ) && ( ( a ) -> d [ 0 ] == ( BN_ULONG ) ( w ) ) ) || \ ( ( ( w ) == 0 ) && ( ( a ) -> top == 0 ) ) ) # define BN_is_zero ( a ) ( ( a ) -> top == 0 ) # define BN_is_one ( a ) ( BN_abs_is_word ( ( a ) , 1 ) && ! ( a ) -> neg ) # define BN_is_word ( a , w ) ( BN_abs_is_word ( ( a ) , ( w ) ) && ( ! ( w ) || ! ( a ) -> neg ) ) # define BN_is_odd ( a ) ( ( ( a ) -> top > 0 ) && ( ( a ) -> d [ 0 ] & 1 ) ) # define BN_one ( a ) ( BN_set_word ( ( a ) , 1 ) ) # define BN_zero_ex ( a ) \ do {
\ BIGNUM * _tmp_bn = ( a ) ;
\ _tmp_bn -> top = 0 ;
\ _tmp_bn -> neg = 0 ;
\ }
while ( 0 ) # ifdef OPENSSL_NO_DEPRECATED # define BN_zero ( a ) BN_zero_ex ( a ) # else # define BN_zero ( a ) ( BN_set_word ( ( a ) , 0 ) ) # endif const BIGNUM * BN_value_one ( void ) ;
char * BN_options ( void ) ;
BN_CTX * BN_CTX_new ( void ) ;
# ifndef OPENSSL_NO_DEPRECATED void BN_CTX_init ( BN_CTX * c ) ;
# endif void BN_CTX_free ( BN_CTX * c ) ;
void BN_CTX_start ( BN_CTX * ctx ) ;
BIGNUM * BN_CTX_get ( BN_CTX * ctx ) ;
void BN_CTX_end ( BN_CTX * ctx ) ;
int BN_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ;
int BN_pseudo_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ;
int BN_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ;
int BN_pseudo_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ;
int BN_num_bits ( const BIGNUM * a ) ;
int BN_num_bits_word ( BN_ULONG l ) ;
BIGNUM * BN_new ( void ) ;
void BN_init ( BIGNUM * ) ;
void BN_clear_free ( BIGNUM * a ) ;
BIGNUM * BN_copy ( BIGNUM * a , const BIGNUM * b ) ;
void BN_swap ( BIGNUM * a , BIGNUM * b ) ;
BIGNUM * BN_bin2bn ( const unsigned char * s , int len , BIGNUM * ret ) ;
int BN_bn2bin ( const BIGNUM * a , unsigned char * to ) ;
BIGNUM * BN_mpi2bn ( const unsigned char * s , int len , BIGNUM * ret ) ;
int BN_bn2mpi ( const BIGNUM * a , unsigned char * to ) ;
int BN_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_usub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_uadd ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
int BN_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ;
int BN_sqr ( BIGNUM * r , const BIGNUM * a , BN_CTX * ctx ) ;
void BN_set_negative ( BIGNUM * b , int n ) ;
# define BN_is_negative ( a ) ( ( a ) -> neg != 0 ) int BN_div ( BIGNUM * dv , BIGNUM * rem , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ;
# define BN_mod ( rem , m , d , ctx ) BN_div ( NULL , ( rem ) , ( m ) , ( d ) , ( ctx ) ) int BN_nnmod ( BIGNUM * r , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ;
int BN_mod_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_add_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ;
int BN_mod_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_sub_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ;
int BN_mod_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_sqr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_lshift1 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_lshift1_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m ) ;
int BN_mod_lshift ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_lshift_quick ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m ) ;
BN_ULONG BN_mod_word ( const BIGNUM * a , BN_ULONG w ) ;
BN_ULONG BN_div_word ( BIGNUM * a , BN_ULONG w ) ;
int BN_mul_word ( BIGNUM * a , BN_ULONG w ) ;
int BN_add_word ( BIGNUM * a , BN_ULONG w ) ;
int BN_sub_word ( BIGNUM * a , BN_ULONG w ) ;
int BN_set_word ( BIGNUM * a , BN_ULONG w ) ;
BN_ULONG BN_get_word ( const BIGNUM * a ) ;
int BN_cmp ( const BIGNUM * a , const BIGNUM * b ) ;
void BN_free ( BIGNUM * a ) ;
int BN_is_bit_set ( const BIGNUM * a , int n ) ;
int BN_lshift ( BIGNUM * r , const BIGNUM * a , int n ) ;
int BN_lshift1 ( BIGNUM * r , const BIGNUM * a ) ;
int BN_exp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_mod_exp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mod_exp_mont ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) ;
int BN_mod_exp_mont_consttime ( BIGNUM * rr , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * in_mont ) ;
int BN_mod_exp_mont_word ( BIGNUM * r , BN_ULONG a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) ;
int BN_mod_exp2_mont ( BIGNUM * r , const BIGNUM * a1 , const BIGNUM * p1 , const BIGNUM * a2 , const BIGNUM * p2 , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) ;
int BN_mod_exp_simple ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_mask_bits ( BIGNUM * a , int n ) ;
# ifndef OPENSSL_NO_FP_API int BN_print_fp ( FILE * fp , const BIGNUM * a ) ;
# endif # ifdef HEADER_BIO_H int BN_print ( BIO * fp , const BIGNUM * a ) ;
# else int BN_print ( void * fp , const BIGNUM * a ) ;
# endif int BN_reciprocal ( BIGNUM * r , const BIGNUM * m , int len , BN_CTX * ctx ) ;
int BN_rshift ( BIGNUM * r , const BIGNUM * a , int n ) ;
int BN_rshift1 ( BIGNUM * r , const BIGNUM * a ) ;
void BN_clear ( BIGNUM * a ) ;
BIGNUM * BN_dup ( const BIGNUM * a ) ;
int BN_ucmp ( const BIGNUM * a , const BIGNUM * b ) ;
int BN_set_bit ( BIGNUM * a , int n ) ;
int BN_clear_bit ( BIGNUM * a , int n ) ;
char * BN_bn2hex ( const BIGNUM * a ) ;
char * BN_bn2dec ( const BIGNUM * a ) ;
int BN_hex2bn ( BIGNUM * * a , const char * str ) ;
int BN_dec2bn ( BIGNUM * * a , const char * str ) ;
int BN_asc2bn ( BIGNUM * * a , const char * str ) ;
int BN_gcd ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ;
int BN_kronecker ( const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ;
BIGNUM * BN_mod_inverse ( BIGNUM * ret , const BIGNUM * a , const BIGNUM * n , BN_CTX * ctx ) ;
BIGNUM * BN_mod_sqrt ( BIGNUM * ret , const BIGNUM * a , const BIGNUM * n , BN_CTX * ctx ) ;
void BN_consttime_swap ( BN_ULONG swap , BIGNUM * a , BIGNUM * b , int nwords ) ;
# ifndef OPENSSL_NO_DEPRECATED BIGNUM * BN_generate_prime ( BIGNUM * ret , int bits , int safe , const BIGNUM * add , const BIGNUM * rem , void ( * callback ) ( int , int , void * ) , void * cb_arg ) ;
int BN_is_prime ( const BIGNUM * p , int nchecks , void ( * callback ) ( int , int , void * ) , BN_CTX * ctx , void * cb_arg ) ;
int BN_is_prime_fasttest ( const BIGNUM * p , int nchecks , void ( * callback ) ( int , int , void * ) , BN_CTX * ctx , void * cb_arg , int do_trial_division ) ;
# endif int BN_generate_prime_ex ( BIGNUM * ret , int bits , int safe , const BIGNUM * add , const BIGNUM * rem , BN_GENCB * cb ) ;
int BN_is_prime_ex ( const BIGNUM * p , int nchecks , BN_CTX * ctx , BN_GENCB * cb ) ;
int BN_is_prime_fasttest_ex ( const BIGNUM * p , int nchecks , BN_CTX * ctx , int do_trial_division , BN_GENCB * cb ) ;
int BN_X931_generate_Xpq ( BIGNUM * Xp , BIGNUM * Xq , int nbits , BN_CTX * ctx ) ;
int BN_X931_derive_prime_ex ( BIGNUM * p , BIGNUM * p1 , BIGNUM * p2 , const BIGNUM * Xp , const BIGNUM * Xp1 , const BIGNUM * Xp2 , const BIGNUM * e , BN_CTX * ctx , BN_GENCB * cb ) ;
int BN_X931_generate_prime_ex ( BIGNUM * p , BIGNUM * p1 , BIGNUM * p2 , BIGNUM * Xp1 , BIGNUM * Xp2 , const BIGNUM * Xp , const BIGNUM * e , BN_CTX * ctx , BN_GENCB * cb ) ;
BN_MONT_CTX * BN_MONT_CTX_new ( void ) ;
void BN_MONT_CTX_init ( BN_MONT_CTX * ctx ) ;
int BN_mod_mul_montgomery ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_MONT_CTX * mont , BN_CTX * ctx ) ;
# define BN_to_montgomery ( r , a , mont , ctx ) BN_mod_mul_montgomery ( \ ( r ) , ( a ) , & ( ( mont ) -> RR ) , ( mont ) , ( ctx ) ) int BN_from_montgomery ( BIGNUM * r , const BIGNUM * a , BN_MONT_CTX * mont , BN_CTX * ctx ) ;
void BN_MONT_CTX_free ( BN_MONT_CTX * mont ) ;
int BN_MONT_CTX_set ( BN_MONT_CTX * mont , const BIGNUM * mod , BN_CTX * ctx ) ;
BN_MONT_CTX * BN_MONT_CTX_copy ( BN_MONT_CTX * to , BN_MONT_CTX * from ) ;
BN_MONT_CTX * BN_MONT_CTX_set_locked ( BN_MONT_CTX * * pmont , int lock , const BIGNUM * mod , BN_CTX * ctx ) ;
# define BN_BLINDING_NO_UPDATE 0x00000001 # define BN_BLINDING_NO_RECREATE 0x00000002 BN_BLINDING * BN_BLINDING_new ( const BIGNUM * A , const BIGNUM * Ai , BIGNUM * mod ) ;
void BN_BLINDING_free ( BN_BLINDING * b ) ;
int BN_BLINDING_update ( BN_BLINDING * b , BN_CTX * ctx ) ;
int BN_BLINDING_convert ( BIGNUM * n , BN_BLINDING * b , BN_CTX * ctx ) ;
int BN_BLINDING_invert ( BIGNUM * n , BN_BLINDING * b , BN_CTX * ctx ) ;
int BN_BLINDING_convert_ex ( BIGNUM * n , BIGNUM * r , BN_BLINDING * b , BN_CTX * ) ;
int BN_BLINDING_invert_ex ( BIGNUM * n , const BIGNUM * r , BN_BLINDING * b , BN_CTX * ) ;
# ifndef OPENSSL_NO_DEPRECATED unsigned long BN_BLINDING_get_thread_id ( const BN_BLINDING * ) ;
void BN_BLINDING_set_thread_id ( BN_BLINDING * , unsigned long ) ;
# endif CRYPTO_THREADID * BN_BLINDING_thread_id ( BN_BLINDING * ) ;
unsigned long BN_BLINDING_get_flags ( const BN_BLINDING * ) ;
void BN_BLINDING_set_flags ( BN_BLINDING * , unsigned long ) ;
BN_BLINDING * BN_BLINDING_create_param ( BN_BLINDING * b , const BIGNUM * e , BIGNUM * m , BN_CTX * ctx , int ( * bn_mod_exp ) ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) , BN_MONT_CTX * m_ctx ) ;
# ifndef OPENSSL_NO_DEPRECATED void BN_set_params ( int mul , int high , int low , int mont ) ;
int BN_get_params ( int which ) ;
# endif void BN_RECP_CTX_init ( BN_RECP_CTX * recp ) ;
BN_RECP_CTX * BN_RECP_CTX_new ( void ) ;
void BN_RECP_CTX_free ( BN_RECP_CTX * recp ) ;
int BN_RECP_CTX_set ( BN_RECP_CTX * recp , const BIGNUM * rdiv , BN_CTX * ctx ) ;
int BN_mod_mul_reciprocal ( BIGNUM * r , const BIGNUM * x , const BIGNUM * y , BN_RECP_CTX * recp , BN_CTX * ctx ) ;
int BN_mod_exp_recp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx ) ;
int BN_div_recp ( BIGNUM * dv , BIGNUM * rem , const BIGNUM * m , BN_RECP_CTX * recp , BN_CTX * ctx ) ;
# ifndef OPENSSL_NO_EC2M int BN_GF2m_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ;
# define BN_GF2m_sub ( r , a , b ) BN_GF2m_add ( r , a , b ) int BN_GF2m_mod ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p ) ;
int BN_GF2m_mod_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_sqr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_inv ( BIGNUM * r , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_div ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_exp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_sqrt ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_GF2m_mod_solve_quad ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
# define BN_GF2m_cmp ( a , b ) BN_ucmp ( ( a ) , ( b ) ) int BN_GF2m_mod_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] ) ;
int BN_GF2m_mod_mul_arr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_sqr_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_inv_arr ( BIGNUM * r , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_div_arr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_exp_arr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_sqrt_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_mod_solve_quad_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] , BN_CTX * ctx ) ;
int BN_GF2m_poly2arr ( const BIGNUM * a , int p [ ] , int max ) ;
int BN_GF2m_arr2poly ( const int p [ ] , BIGNUM * a ) ;
# endif int BN_nist_mod_192 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_nist_mod_224 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_nist_mod_256 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_nist_mod_384 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
int BN_nist_mod_521 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ;
const BIGNUM * BN_get0_nist_prime_192 ( void ) ;
const BIGNUM * BN_get0_nist_prime_224 ( void ) ;
const BIGNUM * BN_get0_nist_prime_256 ( void ) ;
const BIGNUM * BN_get0_nist_prime_384 ( void ) ;
const BIGNUM * BN_get0_nist_prime_521 ( void ) ;
int ( * BN_nist_mod_func ( const BIGNUM * p ) ) ( BIGNUM * r , const BIGNUM * a , const BIGNUM * field , BN_CTX * ctx ) ;
int BN_generate_dsa_nonce ( BIGNUM * out , const BIGNUM * range , const BIGNUM * priv , const unsigned char * message , size_t message_len , BN_CTX * ctx ) ;
# define bn_expand ( a , bits ) ( ( ( ( ( ( bits + BN_BITS2 - 1 ) ) / BN_BITS2 ) ) <= ( a ) -> dmax ) ? \ ( a ) : bn_expand2 ( ( a ) , ( bits + BN_BITS2 - 1 ) / BN_BITS2 ) ) # define bn_wexpand ( a , words ) ( ( ( words ) <= ( a ) -> dmax ) ? ( a ) : bn_expand2 ( ( a ) , ( words ) ) ) BIGNUM * bn_expand2 ( BIGNUM * a , int words ) ;
# ifndef OPENSSL_NO_DEPRECATED BIGNUM * bn_dup_expand ( const BIGNUM * a , int words ) ;
# endif # ifdef BN_DEBUG # include < assert . h > # ifdef BN_DEBUG_RAND # ifndef RAND_pseudo_bytes int RAND_pseudo_bytes ( unsigned char * buf , int num ) ;
# define BN_DEBUG_TRIX # endif # define bn_pollute ( a ) \ do {
\ const BIGNUM * _bnum1 = ( a ) ;
\ if ( _bnum1 -> top < _bnum1 -> dmax ) {
\ unsigned char _tmp_char ;
\ \ BN_ULONG * _not_const ;
\ memcpy ( & _not_const , & _bnum1 -> d , sizeof ( BN_ULONG * ) ) ;
\ RAND_pseudo_bytes ( & _tmp_char , 1 ) ;
\ memset ( ( unsigned char * ) ( _not_const + _bnum1 -> top ) , _tmp_char , \ ( _bnum1 -> dmax - _bnum1 -> top ) * sizeof ( BN_ULONG ) ) ;
\ }
\ }
while ( 0 ) # ifdef BN_DEBUG_TRIX # undef RAND_pseudo_bytes # endif # else # define bn_pollute ( a ) # endif # define bn_check_top ( a ) \ do {
\ const BIGNUM * _bnum2 = ( a ) ;
\ if ( _bnum2 != NULL ) {
\ assert ( ( _bnum2 -> top == 0 ) || \ ( _bnum2 -> d [ _bnum2 -> top - 1 ] != 0 ) ) ;
\ bn_pollute ( _bnum2 ) ;
\ }
\ }
while ( 0 ) # define bn_fix_top ( a ) bn_check_top ( a ) # define bn_check_size ( bn , bits ) bn_wcheck_size ( bn , ( ( bits + BN_BITS2 - 1 ) ) / BN_BITS2 ) # define bn_wcheck_size ( bn , words ) \ do {
\ const BIGNUM * _bnum2 = ( bn ) ;
\ assert ( words <= ( _bnum2 ) -> dmax && words >= ( _bnum2 ) -> top ) ;
\ }
while ( 0 ) # else # define bn_pollute ( a ) # define bn_check_top ( a ) # define bn_fix_top ( a ) bn_correct_top ( a ) # define bn_check_size ( bn , bits ) # define bn_wcheck_size ( bn , words ) # endif # define bn_correct_top ( a ) \ {
\ BN_ULONG * ftl ;
\ int tmp_top = ( a ) -> top ;
\ if ( tmp_top > 0 ) \ {
\ for ( ftl = & ( ( a ) -> d [ tmp_top - 1 ] ) ;
tmp_top > 0 ;
tmp_top -- ) \ if ( * ( ftl -- ) ) break ;
\ ( a ) -> top = tmp_top ;
\ }
\ bn_pollute ( a ) ;
\ }
BN_ULONG bn_mul_add_words ( BN_ULONG * rp , const BN_ULONG * ap , int num , BN_ULONG w ) ;
BN_ULONG bn_mul_words ( BN_ULONG * rp , const BN_ULONG * ap , int num , BN_ULONG w ) ;
void bn_sqr_words ( BN_ULONG * rp , const BN_ULONG * ap , int num ) ;
BN_ULONG bn_div_words ( BN_ULONG h , BN_ULONG l , BN_ULONG d ) ;
BN_ULONG bn_add_words ( BN_ULONG * rp , const BN_ULONG * ap , const BN_ULONG * bp , int num )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint32 dissect_netb_datagram_bcast ( tvbuff_t * tvb , packet_info * pinfo _U_ , int offset , proto_tree * tree ) {
if ( tvb_memeql ( tvb , offset + NB_SENDER_NAME , zeroes , 10 ) == 0 ) {
proto_tree_add_item ( tree , hf_netb_datagram_bcast_mac , tvb , offset + NB_SENDER_NAME + 10 , 6 , ENC_NA ) ;
}
else {
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
|
SPL_METHOD ( SplDoublyLinkedList , prev ) {
spl_dllist_object * intern = ( spl_dllist_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
if ( zend_parse_parameters_none ( ) == FAILURE ) {
return ;
}
spl_dllist_it_helper_move_forward ( & intern -> traverse_pointer , & intern -> traverse_position , intern -> llist , intern -> flags ^ SPL_DLLIST_IT_LIFO TSRMLS_CC ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int collector_strimwidth ( int c , void * data ) {
struct collector_strimwidth_data * pc = ( struct collector_strimwidth_data * ) data ;
switch ( pc -> status ) {
case 10 : ( * pc -> decoder -> filter_function ) ( c , pc -> decoder ) ;
break ;
default : if ( pc -> outchar >= pc -> from ) {
pc -> outwidth += ( is_fullwidth ( c ) ? 2 : 1 ) ;
if ( pc -> outwidth > pc -> width ) {
if ( pc -> status == 0 ) {
pc -> endpos = pc -> device . pos ;
mbfl_convert_filter_copy ( pc -> decoder , pc -> decoder_backup ) ;
}
pc -> status ++ ;
( * pc -> decoder -> filter_function ) ( c , pc -> decoder ) ;
c = - 1 ;
}
else {
( * pc -> decoder -> filter_function ) ( c , pc -> decoder ) ;
}
}
pc -> outchar ++ ;
break ;
}
return c ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
clump_t * clump_splay_walk_fwd ( clump_splay_walker * sw ) {
clump_t * cp = sw -> cp ;
int from = sw -> from ;
if ( cp == NULL ) return NULL ;
while ( 1 ) {
if ( from == SPLAY_FROM_ABOVE ) {
if ( cp -> left ) {
cp = cp -> left ;
from = SPLAY_FROM_ABOVE ;
continue ;
}
from = SPLAY_FROM_LEFT ;
if ( cp == sw -> end ) cp = NULL ;
break ;
}
if ( from == SPLAY_FROM_LEFT ) {
if ( cp -> right ) {
cp = cp -> right ;
from = SPLAY_FROM_ABOVE ;
continue ;
}
from = SPLAY_FROM_RIGHT ;
}
if ( from == SPLAY_FROM_RIGHT ) {
clump_t * old = cp ;
cp = cp -> parent ;
if ( cp == NULL ) {
if ( sw -> end == NULL ) break ;
cp = old ;
from = SPLAY_FROM_ABOVE ;
}
else {
from = ( cp -> left == old ? SPLAY_FROM_LEFT : SPLAY_FROM_RIGHT ) ;
if ( from == SPLAY_FROM_LEFT ) {
if ( cp == sw -> end ) cp = NULL ;
break ;
}
}
}
}
sw -> cp = cp ;
sw -> from = from ;
return cp ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void purple_initmodule ( ) {
struct prpl funcs ;
GList * prots ;
GString * help ;
char * dir ;
if ( purple_get_core ( ) != NULL ) {
log_message ( LOGLVL_ERROR , "libpurple already initialized. " "Please use inetd or ForkDaemon mode instead." ) ;
return ;
}
g_assert ( ( int ) B_EV_IO_READ == ( int ) PURPLE_INPUT_READ ) ;
g_assert ( ( int ) B_EV_IO_WRITE == ( int ) PURPLE_INPUT_WRITE ) ;
dir = g_strdup_printf ( "%s/purple" , global . conf -> configdir ) ;
purple_util_set_user_dir ( dir ) ;
g_free ( dir ) ;
dir = g_strdup_printf ( "%s/purple" , global . conf -> plugindir ) ;
purple_plugins_add_search_path ( dir ) ;
g_free ( dir ) ;
purple_debug_set_enabled ( FALSE ) ;
purple_core_set_ui_ops ( & bee_core_uiops ) ;
purple_eventloop_set_ui_ops ( & glib_eventloops ) ;
if ( ! purple_core_init ( "BitlBee" ) ) {
fprintf ( stderr , "libpurple initialization failed.\n" ) ;
abort ( ) ;
}
if ( proxytype != PROXY_NONE ) {
PurpleProxyInfo * pi = purple_global_proxy_get_info ( ) ;
switch ( proxytype ) {
case PROXY_SOCKS4A : case PROXY_SOCKS4 : purple_proxy_info_set_type ( pi , PURPLE_PROXY_SOCKS4 ) ;
break ;
case PROXY_SOCKS5 : purple_proxy_info_set_type ( pi , PURPLE_PROXY_SOCKS5 ) ;
break ;
case PROXY_HTTP : purple_proxy_info_set_type ( pi , PURPLE_PROXY_HTTP ) ;
break ;
}
purple_proxy_info_set_host ( pi , proxyhost ) ;
purple_proxy_info_set_port ( pi , proxyport ) ;
purple_proxy_info_set_username ( pi , proxyuser ) ;
purple_proxy_info_set_password ( pi , proxypass ) ;
}
purple_set_blist ( purple_blist_new ( ) ) ;
purple_signal_connect ( purple_conversations_get_handle ( ) , "buddy-typing" , & funcs , PURPLE_CALLBACK ( prplcb_buddy_typing ) , NULL ) ;
purple_signal_connect ( purple_conversations_get_handle ( ) , "buddy-typed" , & funcs , PURPLE_CALLBACK ( prplcb_buddy_typing ) , NULL ) ;
purple_signal_connect ( purple_conversations_get_handle ( ) , "buddy-typing-stopped" , & funcs , PURPLE_CALLBACK ( prplcb_buddy_typing ) , NULL ) ;
memset ( & funcs , 0 , sizeof ( funcs ) ) ;
funcs . login = purple_login ;
funcs . init = purple_init ;
funcs . logout = purple_logout ;
funcs . buddy_msg = purple_buddy_msg ;
funcs . away_states = purple_away_states ;
funcs . set_away = purple_set_away ;
funcs . add_buddy = purple_add_buddy ;
funcs . remove_buddy = purple_remove_buddy ;
funcs . add_permit = purple_add_permit ;
funcs . add_deny = purple_add_deny ;
funcs . rem_permit = purple_rem_permit ;
funcs . rem_deny = purple_rem_deny ;
funcs . get_info = purple_get_info ;
funcs . keepalive = purple_keepalive ;
funcs . send_typing = purple_send_typing ;
funcs . handle_cmp = g_strcasecmp ;
funcs . chat_msg = purple_chat_msg ;
funcs . chat_with = purple_chat_with ;
funcs . chat_invite = purple_chat_invite ;
funcs . chat_topic = purple_chat_set_topic ;
funcs . chat_kick = purple_chat_kick ;
funcs . chat_leave = purple_chat_leave ;
funcs . chat_join = purple_chat_join ;
funcs . chat_list = purple_chat_list ;
funcs . transfer_request = purple_transfer_request ;
help = g_string_new ( "BitlBee libpurple module supports the following IM protocols:\n" ) ;
for ( prots = purple_plugins_get_protocols ( ) ;
prots ;
prots = prots -> next ) {
PurplePlugin * prot = prots -> data ;
struct prpl * ret ;
if ( find_protocol ( prot -> info -> id ) ) {
continue ;
}
ret = g_memdup ( & funcs , sizeof ( funcs ) ) ;
ret -> name = ret -> data = prot -> info -> id ;
if ( strncmp ( ret -> name , "prpl-" , 5 ) == 0 ) {
ret -> name += 5 ;
}
register_protocol ( ret ) ;
g_string_append_printf ( help , "\n* %s (%s)" , ret -> name , prot -> info -> name ) ;
if ( g_strcasecmp ( prot -> info -> id , "prpl-aim" ) == 0 ) {
ret = g_memdup ( & funcs , sizeof ( funcs ) ) ;
ret -> name = "oscar" ;
ret -> data = NULL ;
register_protocol ( ret ) ;
}
}
g_string_append ( help , "\n\nFor used protocols, more information about available " "settings can be found using \x02help purple <protocol name>\x02 " "(create an account using that protocol first!)" ) ;
help_add_mem ( & global . help , "purple" , help -> str ) ;
g_string_free ( help , TRUE ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void TSfclose ( TSFile filep ) {
FileImpl * file = ( FileImpl * ) filep ;
file -> fclose ( ) ;
delete file ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void mergejoinscansel ( PlannerInfo * root , Node * clause , Oid opfamily , int strategy , bool nulls_first , Selectivity * leftstart , Selectivity * leftend , Selectivity * rightstart , Selectivity * rightend ) {
Node * left , * right ;
VariableStatData leftvar , rightvar ;
int op_strategy ;
Oid op_lefttype ;
Oid op_righttype ;
Oid opno , lsortop , rsortop , lstatop , rstatop , ltop , leop , revltop , revleop ;
bool isgt ;
Datum leftmin , leftmax , rightmin , rightmax ;
double selec ;
* leftstart = * rightstart = 0.0 ;
* leftend = * rightend = 1.0 ;
if ( ! is_opclause ( clause ) ) return ;
opno = ( ( OpExpr * ) clause ) -> opno ;
left = get_leftop ( ( Expr * ) clause ) ;
right = get_rightop ( ( Expr * ) clause ) ;
if ( ! right ) return ;
examine_variable ( root , left , 0 , & leftvar ) ;
examine_variable ( root , right , 0 , & rightvar ) ;
get_op_opfamily_properties ( opno , opfamily , false , & op_strategy , & op_lefttype , & op_righttype ) ;
Assert ( op_strategy == BTEqualStrategyNumber ) ;
switch ( strategy ) {
case BTLessStrategyNumber : isgt = false ;
if ( op_lefttype == op_righttype ) {
ltop = get_opfamily_member ( opfamily , op_lefttype , op_righttype , BTLessStrategyNumber ) ;
leop = get_opfamily_member ( opfamily , op_lefttype , op_righttype , BTLessEqualStrategyNumber ) ;
lsortop = ltop ;
rsortop = ltop ;
lstatop = lsortop ;
rstatop = rsortop ;
revltop = ltop ;
revleop = leop ;
}
else {
ltop = get_opfamily_member ( opfamily , op_lefttype , op_righttype , BTLessStrategyNumber ) ;
leop = get_opfamily_member ( opfamily , op_lefttype , op_righttype , BTLessEqualStrategyNumber ) ;
lsortop = get_opfamily_member ( opfamily , op_lefttype , op_lefttype , BTLessStrategyNumber ) ;
rsortop = get_opfamily_member ( opfamily , op_righttype , op_righttype , BTLessStrategyNumber ) ;
lstatop = lsortop ;
rstatop = rsortop ;
revltop = get_opfamily_member ( opfamily , op_righttype , op_lefttype , BTLessStrategyNumber ) ;
revleop = get_opfamily_member ( opfamily , op_righttype , op_lefttype , BTLessEqualStrategyNumber ) ;
}
break ;
case BTGreaterStrategyNumber : isgt = true ;
if ( op_lefttype == op_righttype ) {
ltop = get_opfamily_member ( opfamily , op_lefttype , op_righttype , BTGreaterStrategyNumber ) ;
leop = get_opfamily_member ( opfamily , op_lefttype , op_righttype , BTGreaterEqualStrategyNumber ) ;
lsortop = ltop ;
rsortop = ltop ;
lstatop = get_opfamily_member ( opfamily , op_lefttype , op_lefttype , BTLessStrategyNumber ) ;
rstatop = lstatop ;
revltop = ltop ;
revleop = leop ;
}
else {
ltop = get_opfamily_member ( opfamily , op_lefttype , op_righttype , BTGreaterStrategyNumber ) ;
leop = get_opfamily_member ( opfamily , op_lefttype , op_righttype , BTGreaterEqualStrategyNumber ) ;
lsortop = get_opfamily_member ( opfamily , op_lefttype , op_lefttype , BTGreaterStrategyNumber ) ;
rsortop = get_opfamily_member ( opfamily , op_righttype , op_righttype , BTGreaterStrategyNumber ) ;
lstatop = get_opfamily_member ( opfamily , op_lefttype , op_lefttype , BTLessStrategyNumber ) ;
rstatop = get_opfamily_member ( opfamily , op_righttype , op_righttype , BTLessStrategyNumber ) ;
revltop = get_opfamily_member ( opfamily , op_righttype , op_lefttype , BTGreaterStrategyNumber ) ;
revleop = get_opfamily_member ( opfamily , op_righttype , op_lefttype , BTGreaterEqualStrategyNumber ) ;
}
break ;
default : goto fail ;
}
if ( ! OidIsValid ( lsortop ) || ! OidIsValid ( rsortop ) || ! OidIsValid ( lstatop ) || ! OidIsValid ( rstatop ) || ! OidIsValid ( ltop ) || ! OidIsValid ( leop ) || ! OidIsValid ( revltop ) || ! OidIsValid ( revleop ) ) goto fail ;
if ( ! isgt ) {
if ( ! get_variable_range ( root , & leftvar , lstatop , & leftmin , & leftmax ) ) goto fail ;
if ( ! get_variable_range ( root , & rightvar , rstatop , & rightmin , & rightmax ) ) goto fail ;
}
else {
if ( ! get_variable_range ( root , & leftvar , lstatop , & leftmax , & leftmin ) ) goto fail ;
if ( ! get_variable_range ( root , & rightvar , rstatop , & rightmax , & rightmin ) ) goto fail ;
}
selec = scalarineqsel ( root , leop , isgt , & leftvar , rightmax , op_righttype ) ;
if ( selec != DEFAULT_INEQ_SEL ) * leftend = selec ;
selec = scalarineqsel ( root , revleop , isgt , & rightvar , leftmax , op_lefttype ) ;
if ( selec != DEFAULT_INEQ_SEL ) * rightend = selec ;
if ( * leftend > * rightend ) * leftend = 1.0 ;
else if ( * leftend < * rightend ) * rightend = 1.0 ;
else * leftend = * rightend = 1.0 ;
selec = scalarineqsel ( root , ltop , isgt , & leftvar , rightmin , op_righttype ) ;
if ( selec != DEFAULT_INEQ_SEL ) * leftstart = selec ;
selec = scalarineqsel ( root , revltop , isgt , & rightvar , leftmin , op_lefttype ) ;
if ( selec != DEFAULT_INEQ_SEL ) * rightstart = selec ;
if ( * leftstart < * rightstart ) * leftstart = 0.0 ;
else if ( * leftstart > * rightstart ) * rightstart = 0.0 ;
else * leftstart = * rightstart = 0.0 ;
if ( nulls_first ) {
Form_pg_statistic stats ;
if ( HeapTupleIsValid ( leftvar . statsTuple ) ) {
stats = ( Form_pg_statistic ) GETSTRUCT ( leftvar . statsTuple ) ;
* leftstart += stats -> stanullfrac ;
CLAMP_PROBABILITY ( * leftstart ) ;
* leftend += stats -> stanullfrac ;
CLAMP_PROBABILITY ( * leftend ) ;
}
if ( HeapTupleIsValid ( rightvar . statsTuple ) ) {
stats = ( Form_pg_statistic ) GETSTRUCT ( rightvar . statsTuple ) ;
* rightstart += stats -> stanullfrac ;
CLAMP_PROBABILITY ( * rightstart ) ;
* rightend += stats -> stanullfrac ;
CLAMP_PROBABILITY ( * rightend ) ;
}
}
if ( * leftstart >= * leftend ) {
* leftstart = 0.0 ;
* leftend = 1.0 ;
}
if ( * rightstart >= * rightend ) {
* rightstart = 0.0 ;
* rightend = 1.0 ;
}
fail : ReleaseVariableStats ( leftvar ) ;
ReleaseVariableStats ( rightvar ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void StartTransaction ( Archive * AHX ) {
ArchiveHandle * AH = ( ArchiveHandle * ) AHX ;
ExecuteSqlCommand ( AH , "BEGIN" , "could not start database transaction" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void read_sbr_invf ( SpectralBandReplication * sbr , GetBitContext * gb , SBRData * ch_data ) {
int i ;
memcpy ( ch_data -> bs_invf_mode [ 1 ] , ch_data -> bs_invf_mode [ 0 ] , 5 * sizeof ( uint8_t ) ) ;
for ( i = 0 ;
i < sbr -> n_q ;
i ++ ) ch_data -> bs_invf_mode [ 0 ] [ i ] = get_bits ( gb , 2 ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
afs_int32 SPR_GetCPS ( struct rx_call * call , afs_int32 aid , prlist * alist , afs_int32 * over ) {
afs_int32 code ;
afs_int32 cid = ANONYMOUSID ;
code = getCPS ( call , aid , alist , over , & cid ) ;
osi_auditU ( call , PTS_GetCPSEvent , code , AUD_ID , aid , AUD_END ) ;
ViceLog ( 125 , ( "PTS_GetCPS: code %d cid %d aid %d\n" , code , cid , aid ) ) ;
return code ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
char * qemuDomainGetMasterKeyAlias ( void ) {
char * alias ;
ignore_value ( VIR_STRDUP ( alias , "masterKey0" ) ) ;
return alias ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_fdct8x8_1_c ( const int16_t * input , int16_t * output , int stride ) {
int r , c ;
int16_t sum = 0 ;
for ( r = 0 ;
r < 8 ;
++ r ) for ( c = 0 ;
c < 8 ;
++ c ) sum += input [ r * stride + c ] ;
output [ 0 ] = sum ;
output [ 1 ] = 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( ExtensionMessageBubbleViewBrowserTest , ExtensionBubbleShowsOnStartup ) {
TestBubbleShowsOnStartup ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void set_seg ( struct kvm_segment * lhs , const SegmentCache * rhs ) {
unsigned flags = rhs -> flags ;
lhs -> selector = rhs -> selector ;
lhs -> base = rhs -> base ;
lhs -> limit = rhs -> limit ;
lhs -> type = ( flags >> DESC_TYPE_SHIFT ) & 15 ;
lhs -> present = ( flags & DESC_P_MASK ) != 0 ;
lhs -> dpl = ( flags >> DESC_DPL_SHIFT ) & 3 ;
lhs -> db = ( flags >> DESC_B_SHIFT ) & 1 ;
lhs -> s = ( flags & DESC_S_MASK ) != 0 ;
lhs -> l = ( flags >> DESC_L_SHIFT ) & 1 ;
lhs -> g = ( flags & DESC_G_MASK ) != 0 ;
lhs -> avl = ( flags & DESC_AVL_MASK ) != 0 ;
lhs -> unusable = ! lhs -> present ;
lhs -> padding = 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dissect_ber_constrained_integer ( gboolean implicit_tag , asn1_ctx_t * actx , proto_tree * tree , tvbuff_t * tvb , int offset , gint32 min_len , gint32 max_len , gint hf_id , guint32 * value ) {
gint64 val ;
offset = dissect_ber_integer64 ( implicit_tag , actx , tree , tvb , offset , hf_id , & val ) ;
if ( value ) {
* value = ( guint32 ) val ;
}
ber_check_value ( ( guint32 ) val , min_len , max_len , actx , actx -> created_item ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int chacha20_poly1305_init_key ( EVP_CIPHER_CTX * ctx , const unsigned char * inkey , const unsigned char * iv , int enc ) {
EVP_CHACHA_AEAD_CTX * actx = aead_data ( ctx ) ;
if ( ! inkey && ! iv ) return 1 ;
actx -> len . aad = 0 ;
actx -> len . text = 0 ;
actx -> aad = 0 ;
actx -> mac_inited = 0 ;
actx -> tls_payload_length = NO_TLS_PAYLOAD_LENGTH ;
if ( iv != NULL ) {
unsigned char temp [ CHACHA_CTR_SIZE ] = {
0 }
;
if ( actx -> nonce_len <= CHACHA_CTR_SIZE ) memcpy ( temp + CHACHA_CTR_SIZE - actx -> nonce_len , iv , actx -> nonce_len ) ;
chacha_init_key ( ctx , inkey , temp , enc ) ;
actx -> nonce [ 0 ] = actx -> key . counter [ 1 ] ;
actx -> nonce [ 1 ] = actx -> key . counter [ 2 ] ;
actx -> nonce [ 2 ] = actx -> key . counter [ 3 ] ;
}
else {
chacha_init_key ( ctx , inkey , NULL , enc ) ;
}
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int main ( int argc , char * * argv ) {
char bin_log_name [ FN_REFLEN ] ;
int exit_code ;
int consistent_binlog_pos = 0 ;
MY_INIT ( argv [ 0 ] ) ;
sf_leaking_memory = 1 ;
compatible_mode_normal_str [ 0 ] = 0 ;
default_charset = ( char * ) mysql_universal_client_charset ;
bzero ( ( char * ) & ignore_table , sizeof ( ignore_table ) ) ;
exit_code = get_options ( & argc , & argv ) ;
if ( exit_code ) {
free_resources ( ) ;
exit ( exit_code ) ;
}
sf_leaking_memory = 0 ;
if ( opt_xml && ! opt_comments_used ) opt_comments = 0 ;
if ( log_error_file ) {
if ( ! ( stderror_file = freopen ( log_error_file , "a+" , stderr ) ) ) {
free_resources ( ) ;
exit ( EX_MYSQLERR ) ;
}
}
if ( connect_to_db ( current_host , current_user , opt_password ) ) {
free_resources ( ) ;
exit ( EX_MYSQLERR ) ;
}
if ( ! path ) write_header ( md_result_file , * argv ) ;
if ( opt_slave_data && do_stop_slave_sql ( mysql ) ) goto err ;
if ( opt_single_transaction && opt_master_data ) {
consistent_binlog_pos = check_consistent_binlog_pos ( NULL , NULL ) ;
}
if ( ( opt_lock_all_tables || ( opt_master_data && ! consistent_binlog_pos ) || ( opt_single_transaction && flush_logs ) ) && do_flush_tables_read_lock ( mysql ) ) goto err ;
if ( opt_lock_all_tables || opt_master_data || ( opt_single_transaction && flush_logs ) || opt_delete_master_logs ) {
if ( flush_logs || opt_delete_master_logs ) {
if ( mysql_refresh ( mysql , REFRESH_LOG ) ) goto err ;
verbose_msg ( "-- main : logs flushed successfully!\n" ) ;
}
flush_logs = 0 ;
}
if ( opt_delete_master_logs ) {
if ( get_bin_log_name ( mysql , bin_log_name , sizeof ( bin_log_name ) ) ) goto err ;
}
if ( opt_single_transaction && start_transaction ( mysql ) ) goto err ;
if ( opt_slave_apply && add_stop_slave ( ) ) goto err ;
if ( opt_master_data && do_show_master_status ( mysql , consistent_binlog_pos ) ) goto err ;
if ( opt_slave_data && do_show_slave_status ( mysql ) ) goto err ;
if ( opt_single_transaction && do_unlock_tables ( mysql ) ) goto err ;
if ( opt_alltspcs ) dump_all_tablespaces ( ) ;
if ( extended_insert ) init_dynamic_string_checked ( & extended_row , "" , 1024 , 1024 ) ;
if ( opt_alldbs ) {
if ( ! opt_alltspcs && ! opt_notspcs ) dump_all_tablespaces ( ) ;
dump_all_databases ( ) ;
}
else {
int argument ;
for ( argument = 0 ;
argument < argc ;
argument ++ ) {
size_t argument_length = strlen ( argv [ argument ] ) ;
if ( argument_length > NAME_LEN ) {
die ( EX_CONSCHECK , "[ERROR] Argument '%s' is too long, it cannot be " "name for any table or database.\n" , argv [ argument ] ) ;
}
}
if ( argc > 1 && ! opt_databases ) {
if ( ! opt_alltspcs && ! opt_notspcs ) dump_tablespaces_for_tables ( * argv , ( argv + 1 ) , ( argc - 1 ) ) ;
dump_selected_tables ( * argv , ( argv + 1 ) , ( argc - 1 ) ) ;
}
else {
if ( ! opt_alltspcs && ! opt_notspcs ) dump_tablespaces_for_databases ( argv ) ;
dump_databases ( argv ) ;
}
}
if ( opt_slave_apply && add_slave_statements ( ) ) goto err ;
if ( md_result_file && fflush ( md_result_file ) ) {
if ( ! first_error ) first_error = EX_MYSQLERR ;
goto err ;
}
if ( opt_delete_master_logs && purge_bin_logs_to ( mysql , bin_log_name ) ) goto err ;
err : if ( opt_slave_data ) do_start_slave_sql ( mysql ) ;
# ifdef HAVE_SMEM my_free ( shared_memory_base_name ) ;
# endif dbDisconnect ( current_host ) ;
if ( ! path ) write_footer ( md_result_file ) ;
free_resources ( ) ;
if ( stderror_file ) fclose ( stderror_file ) ;
return ( first_error ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void jpc_picomp_destroy ( jpc_picomp_t * picomp ) {
int rlvlno ;
jpc_pirlvl_t * pirlvl ;
if ( picomp -> pirlvls ) {
for ( rlvlno = 0 , pirlvl = picomp -> pirlvls ;
rlvlno < picomp -> numrlvls ;
++ rlvlno , ++ pirlvl ) {
pirlvl_destroy ( pirlvl ) ;
}
jas_free ( picomp -> pirlvls ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void set_tile_limits ( VP9_COMP * cpi ) {
VP9_COMMON * const cm = & cpi -> common ;
int min_log2_tile_cols , max_log2_tile_cols ;
vp9_get_tile_n_bits ( cm -> mi_cols , & min_log2_tile_cols , & max_log2_tile_cols ) ;
cm -> log2_tile_cols = clamp ( cpi -> oxcf . tile_columns , min_log2_tile_cols , max_log2_tile_cols ) ;
cm -> log2_tile_rows = cpi -> oxcf . tile_rows ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int qemuMonitorJSONMigrate ( qemuMonitorPtr mon , unsigned int flags , const char * uri ) {
int ret ;
virJSONValuePtr cmd = qemuMonitorJSONMakeCommand ( "migrate" , "b:detach" , flags & QEMU_MONITOR_MIGRATE_BACKGROUND ? 1 : 0 , "b:blk" , flags & QEMU_MONITOR_MIGRATE_NON_SHARED_DISK ? 1 : 0 , "b:inc" , flags & QEMU_MONITOR_MIGRATE_NON_SHARED_INC ? 1 : 0 , "s:uri" , uri , NULL ) ;
virJSONValuePtr reply = NULL ;
if ( ! cmd ) return - 1 ;
ret = qemuMonitorJSONCommand ( mon , cmd , & reply ) ;
if ( ret == 0 ) ret = qemuMonitorJSONCheckError ( cmd , reply ) ;
virJSONValueFree ( cmd ) ;
virJSONValueFree ( reply ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( SSLErrorAssistantTest , DynamicInterstitialListCommonNameMismatch ) {
ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ;
EXPECT_EQ ( 1u , ssl_info ( ) . public_key_hashes . size ( ) ) ;
auto config_proto = std : : make_unique < chrome_browser_ssl : : SSLErrorAssistantConfig > ( ) ;
config_proto -> set_version_id ( kLargeVersionId ) ;
chrome_browser_ssl : : DynamicInterstitial * filter = config_proto -> add_dynamic_interstitial ( ) ;
filter -> set_interstitial_type ( chrome_browser_ssl : : DynamicInterstitial : : INTERSTITIAL_PAGE_SSL ) ;
filter -> set_cert_error ( chrome_browser_ssl : : DynamicInterstitial : : UNKNOWN_CERT_ERROR ) ;
filter -> add_sha256_hash ( "sha256uthatch" ) ;
filter -> add_sha256_hash ( ssl_info ( ) . public_key_hashes [ 0 ] . ToString ( ) ) ;
filter -> add_sha256_hash ( "sha256/treecreeper" ) ;
filter -> set_issuer_common_name_regex ( "beeeater" ) ;
filter -> set_issuer_organization_regex ( issuer_organization_name ( ) ) ;
filter -> set_mitm_software_name ( "UwS" ) ;
error_assistant ( ) -> SetErrorAssistantProto ( std : : move ( config_proto ) ) ;
EXPECT_FALSE ( error_assistant ( ) -> MatchDynamicInterstitial ( ssl_info ( ) ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint change_call_num_graph ( voip_calls_tapinfo_t * tapinfo _U_ , guint16 call_num , guint16 new_call_num ) {
seq_analysis_item_t * gai ;
GList * list ;
guint items_changed ;
items_changed = 0 ;
list = g_list_first ( tapinfo -> graph_analysis -> list ) ;
while ( list ) {
gai = ( seq_analysis_item_t * ) list -> data ;
if ( gai -> conv_num == call_num ) {
gai -> conv_num = new_call_num ;
items_changed ++ ;
}
list = g_list_next ( list ) ;
}
return items_changed ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
EVP_PKEY * d2i_PUBKEY_bio ( BIO * bp , EVP_PKEY * * a ) {
return ASN1_d2i_bio_of ( EVP_PKEY , EVP_PKEY_new , d2i_PUBKEY , bp , a ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int auth_server_input_spid ( struct auth_server_connection * conn , const char * const * args ) {
if ( conn -> handshake_received ) {
i_error ( "BUG: Authentication server already sent handshake" ) ;
return - 1 ;
}
if ( str_to_uint ( args [ 0 ] , & conn -> server_pid ) < 0 ) {
i_error ( "BUG: Authentication server sent invalid PID" ) ;
return - 1 ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void U_CALLCONV _HZReset ( UConverter * cnv , UConverterResetChoice choice ) {
if ( choice <= UCNV_RESET_TO_UNICODE ) {
cnv -> toUnicodeStatus = 0 ;
cnv -> mode = 0 ;
if ( cnv -> extraInfo != NULL ) {
( ( UConverterDataHZ * ) cnv -> extraInfo ) -> isStateDBCS = FALSE ;
( ( UConverterDataHZ * ) cnv -> extraInfo ) -> isEmptySegment = FALSE ;
}
}
if ( choice != UCNV_RESET_TO_UNICODE ) {
cnv -> fromUnicodeStatus = 0 ;
cnv -> fromUChar32 = 0x0000 ;
if ( cnv -> extraInfo != NULL ) {
( ( UConverterDataHZ * ) cnv -> extraInfo ) -> isEscapeAppended = FALSE ;
( ( UConverterDataHZ * ) cnv -> extraInfo ) -> targetIndex = 0 ;
( ( UConverterDataHZ * ) cnv -> extraInfo ) -> sourceIndex = 0 ;
( ( UConverterDataHZ * ) cnv -> extraInfo ) -> isTargetUCharDBCS = FALSE ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void parseMappings ( const char * filename , UBool reportError , UErrorCode * pErrorCode ) {
char * fields [ 3 ] [ 2 ] ;
if ( pErrorCode == NULL || U_FAILURE ( * pErrorCode ) ) {
return ;
}
u_parseDelimitedFile ( filename , ';
' , fields , 3 , strprepProfileLineFn , ( void * ) filename , pErrorCode ) ;
if ( U_FAILURE ( * pErrorCode ) && ( reportError || * pErrorCode != U_FILE_ACCESS_ERROR ) ) {
fprintf ( stderr , "gensprep error: u_parseDelimitedFile(\"%s\") failed - %s\n" , filename , u_errorName ( * pErrorCode ) ) ;
exit ( * pErrorCode ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int fill_schema_schema_privileges ( THD * thd , TABLE_LIST * tables , COND * cond ) {
# ifndef NO_EMBEDDED_ACCESS_CHECKS int error = 0 ;
uint counter ;
ACL_DB * acl_db ;
ulong want_access ;
char buff [ 100 ] ;
TABLE * table = tables -> table ;
bool no_global_access = check_access ( thd , SELECT_ACL , "mysql" , 0 , 1 , 1 , 0 ) ;
char * curr_host = thd -> security_ctx -> priv_host_name ( ) ;
DBUG_ENTER ( "fill_schema_schema_privileges" ) ;
if ( ! initialized ) DBUG_RETURN ( 0 ) ;
pthread_mutex_lock ( & acl_cache -> lock ) ;
for ( counter = 0 ;
counter < acl_dbs . elements ;
counter ++ ) {
const char * user , * host , * is_grantable = "YES" ;
acl_db = dynamic_element ( & acl_dbs , counter , ACL_DB * ) ;
if ( ! ( user = acl_db -> user ) ) user = "" ;
if ( ! ( host = acl_db -> host . hostname ) ) host = "" ;
if ( no_global_access && ( strcmp ( thd -> security_ctx -> priv_user , user ) || my_strcasecmp ( system_charset_info , curr_host , host ) ) ) continue ;
want_access = acl_db -> access ;
if ( want_access ) {
if ( ! ( want_access & GRANT_ACL ) ) {
is_grantable = "NO" ;
}
strxmov ( buff , "'" , user , "'@'" , host , "'" , NullS ) ;
if ( ! ( want_access & ~ GRANT_ACL ) ) {
if ( update_schema_privilege ( thd , table , buff , acl_db -> db , 0 , 0 , 0 , STRING_WITH_LEN ( "USAGE" ) , is_grantable ) ) {
error = 1 ;
goto err ;
}
}
else {
int cnt ;
ulong j , test_access = want_access & ~ GRANT_ACL ;
for ( cnt = 0 , j = SELECT_ACL ;
j <= DB_ACLS ;
cnt ++ , j <<= 1 ) if ( test_access & j ) {
if ( update_schema_privilege ( thd , table , buff , acl_db -> db , 0 , 0 , 0 , command_array [ cnt ] , command_lengths [ cnt ] , is_grantable ) ) {
error = 1 ;
goto err ;
}
}
}
}
}
err : pthread_mutex_unlock ( & acl_cache -> lock ) ;
DBUG_RETURN ( error ) ;
# else return ( 0 ) ;
# endif }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void ssl3_take_mac ( SSL * s ) {
const char * sender ;
int slen ;
if ( s -> s3 -> tmp . new_cipher == NULL ) return ;
if ( ! s -> server ) {
sender = s -> method -> ssl3_enc -> server_finished_label ;
slen = s -> method -> ssl3_enc -> server_finished_label_len ;
}
else {
sender = s -> method -> ssl3_enc -> client_finished_label ;
slen = s -> method -> ssl3_enc -> client_finished_label_len ;
}
s -> s3 -> tmp . peer_finish_md_len = s -> method -> ssl3_enc -> final_finish_mac ( s , sender , slen , s -> s3 -> tmp . peer_finish_md ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int rtp_packetize_swab ( sout_stream_id_sys_t * id , block_t * in ) {
unsigned max = rtp_mtu ( id ) ;
while ( in -> i_buffer > 0 ) {
unsigned payload = ( max < in -> i_buffer ) ? max : in -> i_buffer ;
unsigned duration = ( in -> i_length * payload ) / in -> i_buffer ;
bool marker = ( in -> i_flags & BLOCK_FLAG_DISCONTINUITY ) != 0 ;
block_t * out = block_Alloc ( 12 + payload ) ;
if ( unlikely ( out == NULL ) ) {
block_Release ( in ) ;
return VLC_ENOMEM ;
}
rtp_packetize_common ( id , out , marker , in -> i_pts ) ;
swab ( in -> p_buffer , out -> p_buffer + 12 , payload ) ;
rtp_packetize_send ( id , out ) ;
in -> p_buffer += payload ;
in -> i_buffer -= payload ;
in -> i_pts += duration ;
in -> i_length -= duration ;
in -> i_flags &= ~ BLOCK_FLAG_DISCONTINUITY ;
}
block_Release ( in ) ;
return VLC_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void client_query ( ) {
int rc ;
myheader ( "client_query" ) ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS t1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE t1(" "id int primary key auto_increment, " "name varchar(20))" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE t1(id int, name varchar(20))" ) ;
myquery_r ( rc ) ;
rc = mysql_query ( mysql , "INSERT INTO t1(name) VALUES('mysql')" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "INSERT INTO t1(name) VALUES('monty')" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "INSERT INTO t1(name) VALUES('venu')" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "INSERT INTO t1(name) VALUES('deleted')" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "INSERT INTO t1(name) VALUES('deleted')" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "UPDATE t1 SET name= 'updated' " "WHERE name= 'deleted'" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "UPDATE t1 SET id= 3 WHERE name= 'updated'" ) ;
myquery_r ( rc ) ;
myquery ( mysql_query ( mysql , "drop table t1" ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool DecoderIsFlushing ( decoder_t * p_dec ) {
decoder_owner_sys_t * p_owner = p_dec -> p_owner ;
bool b_flushing ;
vlc_mutex_lock ( & p_owner -> lock ) ;
b_flushing = p_owner -> b_flushing ;
vlc_mutex_unlock ( & p_owner -> lock ) ;
return b_flushing ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int __udp6_lib_rcv ( struct sk_buff * skb , struct udp_table * udptable , int proto ) {
struct net * net = dev_net ( skb -> dev ) ;
struct sock * sk ;
struct udphdr * uh ;
struct in6_addr * saddr , * daddr ;
u32 ulen = 0 ;
if ( ! pskb_may_pull ( skb , sizeof ( struct udphdr ) ) ) goto short_packet ;
saddr = & ipv6_hdr ( skb ) -> saddr ;
daddr = & ipv6_hdr ( skb ) -> daddr ;
uh = udp_hdr ( skb ) ;
ulen = ntohs ( uh -> len ) ;
if ( ulen > skb -> len ) goto short_packet ;
if ( proto == IPPROTO_UDP ) {
if ( ulen == 0 ) ulen = skb -> len ;
if ( ulen < sizeof ( * uh ) ) goto short_packet ;
if ( ulen < skb -> len ) {
if ( pskb_trim_rcsum ( skb , ulen ) ) goto short_packet ;
saddr = & ipv6_hdr ( skb ) -> saddr ;
daddr = & ipv6_hdr ( skb ) -> daddr ;
uh = udp_hdr ( skb ) ;
}
}
if ( udp6_csum_init ( skb , uh , proto ) ) goto discard ;
if ( ipv6_addr_is_multicast ( daddr ) ) return __udp6_lib_mcast_deliver ( net , skb , saddr , daddr , udptable ) ;
sk = __udp6_lib_lookup_skb ( skb , uh -> source , uh -> dest , udptable ) ;
if ( sk == NULL ) {
if ( ! xfrm6_policy_check ( NULL , XFRM_POLICY_IN , skb ) ) goto discard ;
if ( udp_lib_checksum_complete ( skb ) ) goto discard ;
UDP6_INC_STATS_BH ( net , UDP_MIB_NOPORTS , proto == IPPROTO_UDPLITE ) ;
icmpv6_send ( skb , ICMPV6_DEST_UNREACH , ICMPV6_PORT_UNREACH , 0 ) ;
kfree_skb ( skb ) ;
return 0 ;
}
if ( sk_rcvqueues_full ( sk , skb ) ) {
sock_put ( sk ) ;
goto discard ;
}
bh_lock_sock ( sk ) ;
if ( ! sock_owned_by_user ( sk ) ) udpv6_queue_rcv_skb ( sk , skb ) ;
else if ( sk_add_backlog ( sk , skb ) ) {
atomic_inc ( & sk -> sk_drops ) ;
bh_unlock_sock ( sk ) ;
sock_put ( sk ) ;
goto discard ;
}
bh_unlock_sock ( sk ) ;
sock_put ( sk ) ;
return 0 ;
short_packet : LIMIT_NETDEBUG ( KERN_DEBUG "UDP%sv6: short packet: %d/%u\n" , proto == IPPROTO_UDPLITE ? "-Lite" : "" , ulen , skb -> len ) ;
discard : UDP6_INC_STATS_BH ( net , UDP_MIB_INERRORS , proto == IPPROTO_UDPLITE ) ;
kfree_skb ( skb ) ;
return 0 ;
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.