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 hb_bool_t _try_make_writable_inplace_unix ( hb_blob_t * blob ) {
# if defined ( HAVE_SYS_MMAN_H ) && defined ( HAVE_MPROTECT ) uintptr_t pagesize = - 1 , mask , length ;
const char * addr ;
# if defined ( HAVE_SYSCONF ) && defined ( _SC_PAGE_SIZE ) pagesize = ( uintptr_t ) sysconf ( _SC_PAGE_SIZE ) ;
# elif defined ( HAVE_SYSCONF ) && defined ( _SC_PAGESIZE ) pagesize = ( uintptr_t ) sysconf ( _SC_PAGESIZE ) ;
# elif defined ( HAVE_GETPAGESIZE ) pagesize = ( uintptr_t ) getpagesize ( ) ;
# endif if ( ( uintptr_t ) - 1L == pagesize ) {
DEBUG_MSG_FUNC ( BLOB , blob , "failed to get pagesize: %s" , strerror ( errno ) ) ;
return false ;
}
DEBUG_MSG_FUNC ( BLOB , blob , "pagesize is %lu" , ( unsigned long ) pagesize ) ;
mask = ~ ( pagesize - 1 ) ;
addr = ( const char * ) ( ( ( uintptr_t ) blob -> data ) & mask ) ;
length = ( const char * ) ( ( ( uintptr_t ) blob -> data + blob -> length + pagesize - 1 ) & mask ) - addr ;
DEBUG_MSG_FUNC ( BLOB , blob , "calling mprotect on [%p..%p] (%lu bytes)" , addr , addr + length , ( unsigned long ) length ) ;
if ( - 1 == mprotect ( ( void * ) addr , length , PROT_READ | PROT_WRITE ) ) {
DEBUG_MSG_FUNC ( BLOB , blob , "mprotect failed: %s" , strerror ( errno ) ) ;
return false ;
}
blob -> mode = HB_MEMORY_MODE_WRITABLE ;
DEBUG_MSG_FUNC ( BLOB , blob , "successfully made [%p..%p] (%lu bytes) writable\n" , addr , addr + length , ( unsigned long ) length ) ;
return true ;
# else return false ;
# endif }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int get_current_cpu ( void ) {
if ( ! current_cpu ) {
return - 1 ;
}
return current_cpu -> cpu_index ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static afs_int32 whereIsIt ( struct rx_call * call , afs_int32 aid , afs_int32 * apos , afs_int32 * cid ) {
afs_int32 code ;
struct ubik_trans * tt ;
afs_int32 temp ;
code = Initdb ( ) ;
if ( code != PRSUCCESS ) return code ;
code = ubik_BeginTransReadAny ( dbase , UBIK_READTRANS , & tt ) ;
if ( code ) return code ;
code = ubik_SetLock ( tt , 1 , 1 , LOCKREAD ) ;
if ( code ) ABORT_WITH ( tt , code ) ;
code = read_DbHeader ( tt ) ;
if ( code ) ABORT_WITH ( tt , code ) ;
code = WhoIsThis ( call , tt , cid ) ;
if ( code ) ABORT_WITH ( tt , PRPERM ) ;
temp = FindByID ( tt , aid ) ;
if ( ! temp ) ABORT_WITH ( tt , PRNOENT ) ;
* apos = temp ;
code = ubik_EndTrans ( tt ) ;
if ( code ) return code ;
return PRSUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dtls1_get_queue_priority ( unsigned short seq , int is_ccs ) {
return seq * 2 - is_ccs ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( SupervisedUserNavigationThrottleTest , DontBlockSubFrame ) {
BlockHost ( kExampleHost2 ) ;
BlockHost ( kIframeHost2 ) ;
WebContents * tab = browser ( ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) ;
GURL allowed_url_with_iframes = embedded_test_server ( ) -> GetURL ( kExampleHost , "/supervised_user/with_iframes.html" ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , allowed_url_with_iframes ) ;
EXPECT_FALSE ( tab -> ShowingInterstitialPage ( ) ) ;
bool loaded1 = false ;
ASSERT_TRUE ( content : : ExecuteScriptAndExtractBool ( tab , "loaded1()" , & loaded1 ) ) ;
EXPECT_TRUE ( loaded1 ) ;
bool loaded2 = false ;
ASSERT_TRUE ( content : : ExecuteScriptAndExtractBool ( tab , "loaded2()" , & loaded2 ) ) ;
EXPECT_TRUE ( loaded2 ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_T_iPSourceRouteAddress ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_T_iPSourceRouteAddress , T_iPSourceRouteAddress_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void bitmap_writer_show_progress ( int show ) {
writer . show_progress = show ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean ber_decode_as_reset ( const char * name _U_ , const gpointer pattern _U_ ) {
ber_decode_as ( NULL ) ;
return FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
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 ) DECLARE_PEM_rw ( PKCS8 , X509_SIG ) DECLARE_PEM_rw ( PKCS8_PRIV_KEY_INFO , PKCS8_PRIV_KEY_INFO ) # ifndef OPENSSL_NO_RSA DECLARE_PEM_rw_cb ( RSAPrivateKey , RSA ) DECLARE_PEM_rw_const ( RSAPublicKey , RSA ) DECLARE_PEM_rw ( RSA_PUBKEY , RSA ) # endif # ifndef OPENSSL_NO_DSA DECLARE_PEM_rw_cb ( DSAPrivateKey , DSA ) DECLARE_PEM_rw ( DSA_PUBKEY , DSA ) DECLARE_PEM_rw_const ( DSAparams , DSA ) # endif # ifndef OPENSSL_NO_EC DECLARE_PEM_rw_const ( ECPKParameters , EC_GROUP ) DECLARE_PEM_rw_cb ( ECPrivateKey , EC_KEY ) DECLARE_PEM_rw ( EC_PUBKEY , EC_KEY ) # endif # ifndef OPENSSL_NO_DH DECLARE_PEM_rw_const ( DHparams , DH ) DECLARE_PEM_write_const ( DHxparams , DH )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_Facility_UUIE ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 441 "./asn1/h225/h225.cnf" h225_packet_info * h225_pi ;
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_Facility_UUIE , Facility_UUIE_sequence ) ;
# line 445 "./asn1/h225/h225.cnf" h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
if ( h225_pi != NULL ) {
h225_pi -> cs_type = H225_FACILITY ;
g_snprintf ( h225_pi -> frame_label , 50 , "%s" , val_to_str ( h225_pi -> cs_type , T_h323_message_body_vals , "<unknown>" ) ) ;
}
return offset ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void jpc_qmfb_split_colres ( jpc_fix_t * a , int numrows , int numcols , int stride , int parity ) {
int bufsize = JPC_CEILDIVPOW2 ( numrows , 1 ) ;
jpc_fix_t splitbuf [ QMFB_SPLITBUFSIZE * JPC_QMFB_COLGRPSIZE ] ;
jpc_fix_t * buf = splitbuf ;
jpc_fix_t * srcptr ;
jpc_fix_t * dstptr ;
register jpc_fix_t * srcptr2 ;
register jpc_fix_t * dstptr2 ;
register int n ;
register int i ;
int m ;
int hstartcol ;
if ( bufsize > QMFB_SPLITBUFSIZE ) {
if ( ! ( buf = jas_alloc2 ( bufsize , sizeof ( jpc_fix_t ) ) ) ) {
abort ( ) ;
}
}
if ( numrows >= 2 ) {
hstartcol = ( numrows + 1 - parity ) >> 1 ;
m = numrows - hstartcol ;
n = m ;
dstptr = buf ;
srcptr = & a [ ( 1 - parity ) * stride ] ;
while ( n -- > 0 ) {
dstptr2 = dstptr ;
srcptr2 = srcptr ;
for ( i = 0 ;
i < numcols ;
++ i ) {
* dstptr2 = * srcptr2 ;
++ dstptr2 ;
++ srcptr2 ;
}
dstptr += numcols ;
srcptr += stride << 1 ;
}
dstptr = & a [ ( 1 - parity ) * stride ] ;
srcptr = & a [ ( 2 - parity ) * stride ] ;
n = numrows - m - ( ! parity ) ;
while ( n -- > 0 ) {
dstptr2 = dstptr ;
srcptr2 = srcptr ;
for ( i = 0 ;
i < numcols ;
++ i ) {
* dstptr2 = * srcptr2 ;
++ dstptr2 ;
++ srcptr2 ;
}
dstptr += stride ;
srcptr += stride << 1 ;
}
dstptr = & a [ hstartcol * stride ] ;
srcptr = buf ;
n = m ;
while ( n -- > 0 ) {
dstptr2 = dstptr ;
srcptr2 = srcptr ;
for ( i = 0 ;
i < numcols ;
++ i ) {
* dstptr2 = * srcptr2 ;
++ dstptr2 ;
++ srcptr2 ;
}
dstptr += stride ;
srcptr += numcols ;
}
}
if ( buf != splitbuf ) {
jas_free ( buf ) ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void evhttp_make_header_request ( struct evhttp_connection * evcon , struct evhttp_request * req ) {
const char * method ;
evhttp_remove_header ( req -> output_headers , "Proxy-Connection" ) ;
method = evhttp_method ( req -> type ) ;
evbuffer_add_printf ( evcon -> output_buffer , "%s %s HTTP/%d.%d\r\n" , method , req -> uri , req -> major , req -> minor ) ;
if ( req -> type == EVHTTP_REQ_POST && evhttp_find_header ( req -> output_headers , "Content-Length" ) == NULL ) {
char size [ 12 ] ;
evutil_snprintf ( size , sizeof ( size ) , "%ld" , ( long ) EVBUFFER_LENGTH ( req -> output_buffer ) ) ;
evhttp_add_header ( req -> output_headers , "Content-Length" , size ) ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline Quantum GetPixelb ( const Image * restrict image , const Quantum * restrict pixel ) {
return ( pixel [ image -> channel_map [ bPixelChannel ] . offset ] ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
char * bittok2str_nosep ( register const struct tok * lp , register const char * fmt , register u_int v ) {
return ( bittok2str_internal ( lp , fmt , v , "" ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
const gchar * rtp_dyn_payload_get_name ( rtp_dyn_payload_t * rtp_dyn_payload , const guint8 pt ) {
encoding_name_and_rate_t * encoding_name_and_rate_pt ;
if ( ! rtp_dyn_payload || ! rtp_dyn_payload -> table ) return NULL ;
encoding_name_and_rate_pt = ( encoding_name_and_rate_t * ) g_hash_table_lookup ( rtp_dyn_payload -> table , GUINT_TO_POINTER ( pt ) ) ;
return ( encoding_name_and_rate_pt ? encoding_name_and_rate_pt -> encoding_name : NULL ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int infer_pkt_encap ( const guint8 * pd , int len ) {
int i ;
if ( len <= 0 ) {
return WTAP_ENCAP_PPP_WITH_PHDR ;
}
if ( pd [ 0 ] == 0xFF ) {
return WTAP_ENCAP_PPP_WITH_PHDR ;
}
if ( len >= 2 ) {
if ( pd [ 0 ] == 0x07 && pd [ 1 ] == 0x03 ) {
return WTAP_ENCAP_WFLEET_HDLC ;
}
else if ( ( pd [ 0 ] == 0x0F && pd [ 1 ] == 0x00 ) || ( pd [ 0 ] == 0x8F && pd [ 1 ] == 0x00 ) ) {
return WTAP_ENCAP_CHDLC_WITH_PHDR ;
}
for ( i = 0 ;
i < len && ( pd [ i ] & 0x01 ) == 0 ;
i ++ ) ;
i ++ ;
if ( i == len ) {
return WTAP_ENCAP_LAPB ;
}
if ( pd [ i ] == 0x03 ) return WTAP_ENCAP_FRELAY_WITH_PHDR ;
}
return WTAP_ENCAP_LAPB ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int read_packets ( WriterContext * w , InputFile * ifile ) {
AVFormatContext * fmt_ctx = ifile -> fmt_ctx ;
int i , ret = 0 ;
int64_t cur_ts = fmt_ctx -> start_time ;
if ( read_intervals_nb == 0 ) {
ReadInterval interval = ( ReadInterval ) {
. has_start = 0 , . has_end = 0 }
;
ret = read_interval_packets ( w , ifile , & interval , & cur_ts ) ;
}
else {
for ( i = 0 ;
i < read_intervals_nb ;
i ++ ) {
ret = read_interval_packets ( w , ifile , & read_intervals [ i ] , & cur_ts ) ;
if ( ret < 0 ) break ;
}
}
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int parse_CDbPropSet ( tvbuff_t * tvb , int offset , proto_tree * parent_tree , proto_tree * pad_tree , const char * fmt , ... ) {
int i , num ;
e_guid_t guid ;
struct GuidPropertySet * pset ;
proto_item * item ;
proto_tree * tree ;
const char * txt ;
va_list ap ;
va_start ( ap , fmt ) ;
txt = wmem_strdup_vprintf ( wmem_packet_scope ( ) , fmt , ap ) ;
va_end ( ap ) ;
tree = proto_tree_add_subtree ( parent_tree , tvb , offset , 0 , ett_CDbPropSet , & item , txt ) ;
offset = parse_guid ( tvb , offset , tree , & guid , "guidPropertySet" ) ;
pset = GuidPropertySet_find_guid ( & guid ) ;
if ( pset ) {
proto_item_append_text ( item , " \"%s\" (%s)" , pset -> desc , pset -> def ) ;
}
else {
const char * guid_str = guid_to_str ( wmem_packet_scope ( ) , & guid ) ;
proto_item_append_text ( item , " {
%s}
" , guid_str ) ;
}
offset = parse_padding ( tvb , offset , 4 , pad_tree , "guidPropertySet" ) ;
num = tvb_get_letohl ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_mswsp_cdbpropset_cprops , tvb , offset , 4 , num ) ;
offset += 4 ;
proto_item_append_text ( item , " Num: %d" , num ) ;
for ( i = 0 ;
i < num ;
i ++ ) {
offset = parse_padding ( tvb , offset , 4 , pad_tree , "aProp[%d]" , i ) ;
offset = parse_CDbProp ( tvb , offset , tree , pad_tree , pset , "aProp[%d]" , i ) ;
}
proto_item_set_end ( item , tvb , offset ) ;
return offset ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_DRIVER_INFO_101 ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) {
proto_tree * subtree ;
int struct_start = offset ;
subtree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_DRIVER_INFO_101 , NULL , "Driver info level 101" ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , subtree , di , drep , hf_driverinfo_cversion , NULL ) ;
offset = dissect_spoolss_relstr ( tvb , offset , pinfo , subtree , di , drep , hf_drivername , struct_start , NULL ) ;
offset = dissect_spoolss_relstr ( tvb , offset , pinfo , subtree , di , drep , hf_environment , struct_start , NULL ) ;
proto_tree_add_expert ( subtree , pinfo , & ei_unknown_data , tvb , offset , 0 ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void cmd_window_ddown ( void ) {
MAIN_WINDOW_REC * rec ;
rec = mainwindows_find_lower ( active_mainwin ) ;
if ( rec == NULL ) rec = mainwindows_find_lower ( NULL ) ;
if ( rec != NULL ) window_set_active ( rec -> active ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int symmetric_dequant ( int code , int levels ) {
return ( ( code - ( levels >> 1 ) ) << 24 ) / levels ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_restore_layer_context ( VP9_COMP * const cpi ) {
LAYER_CONTEXT * const lc = get_layer_context ( cpi ) ;
const int old_frame_since_key = cpi -> rc . frames_since_key ;
const int old_frame_to_key = cpi -> rc . frames_to_key ;
cpi -> rc = lc -> rc ;
cpi -> twopass = lc -> twopass ;
cpi -> oxcf . target_bandwidth = lc -> target_bandwidth ;
cpi -> alt_ref_source = lc -> alt_ref_source ;
if ( cpi -> svc . number_temporal_layers > 1 ) {
cpi -> rc . frames_since_key = old_frame_since_key ;
cpi -> rc . frames_to_key = old_frame_to_key ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int virLogOnceInit ( void ) {
if ( virMutexInit ( & virLogMutex ) < 0 ) return - 1 ;
virLogLock ( ) ;
virLogDefaultPriority = VIR_LOG_DEFAULT ;
if ( VIR_ALLOC_QUIET ( virLogRegex ) >= 0 ) {
if ( regcomp ( virLogRegex , VIR_LOG_REGEX , REG_EXTENDED ) != 0 ) VIR_FREE ( virLogRegex ) ;
}
virLogUnlock ( ) ;
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void s390_virtio_register ( void ) {
s390_virtio_bus_register_withprop ( & s390_virtio_serial ) ;
s390_virtio_bus_register_withprop ( & s390_virtio_blk ) ;
s390_virtio_bus_register_withprop ( & s390_virtio_net ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int xsltCheckFilename ( const char * path ) {
# ifdef HAVE_STAT struct stat stat_buffer ;
# if defined ( WIN32 ) && ! defined ( __CYGWIN__ ) DWORD dwAttrs ;
dwAttrs = GetFileAttributesA ( path ) ;
if ( dwAttrs != INVALID_FILE_ATTRIBUTES ) {
if ( dwAttrs & FILE_ATTRIBUTE_DIRECTORY ) {
return 2 ;
}
}
# endif if ( stat ( path , & stat_buffer ) == - 1 ) return 0 ;
# ifdef S_ISDIR if ( S_ISDIR ( stat_buffer . st_mode ) ) {
return 2 ;
}
# endif # endif return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static Datum ExecEvalConst ( ExprState * exprstate , ExprContext * econtext , bool * isNull , ExprDoneCond * isDone ) {
Const * con = ( Const * ) exprstate -> expr ;
if ( isDone ) * isDone = ExprSingleResult ;
* isNull = con -> constisnull ;
return con -> constvalue ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pdf_process_end ( fz_context * ctx , pdf_processor * proc , pdf_csi * csi ) {
while ( csi -> gstate > 0 ) pdf_process_grestore ( ctx , proc , csi ) ;
if ( proc -> op_END ) proc -> op_END ( ctx , proc ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int curl_mfprintf ( FILE * whereto , const char * format , ... ) {
int retcode ;
va_list ap_save ;
va_start ( ap_save , format ) ;
retcode = dprintf_formatf ( whereto , fputc , format , ap_save ) ;
va_end ( ap_save ) ;
return retcode ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int aes_ccm_tls_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) {
EVP_AES_CCM_CTX * cctx = EVP_C_DATA ( EVP_AES_CCM_CTX , ctx ) ;
CCM128_CONTEXT * ccm = & cctx -> ccm ;
if ( out != in || len < ( EVP_CCM_TLS_EXPLICIT_IV_LEN + ( size_t ) cctx -> M ) ) return - 1 ;
if ( EVP_CIPHER_CTX_encrypting ( ctx ) ) memcpy ( out , EVP_CIPHER_CTX_buf_noconst ( ctx ) , EVP_CCM_TLS_EXPLICIT_IV_LEN ) ;
memcpy ( EVP_CIPHER_CTX_iv_noconst ( ctx ) + EVP_CCM_TLS_FIXED_IV_LEN , in , EVP_CCM_TLS_EXPLICIT_IV_LEN ) ;
len -= EVP_CCM_TLS_EXPLICIT_IV_LEN + cctx -> M ;
if ( CRYPTO_ccm128_setiv ( ccm , EVP_CIPHER_CTX_iv_noconst ( ctx ) , 15 - cctx -> L , len ) ) return - 1 ;
CRYPTO_ccm128_aad ( ccm , EVP_CIPHER_CTX_buf_noconst ( ctx ) , cctx -> tls_aad_len ) ;
in += EVP_CCM_TLS_EXPLICIT_IV_LEN ;
out += EVP_CCM_TLS_EXPLICIT_IV_LEN ;
if ( EVP_CIPHER_CTX_encrypting ( ctx ) ) {
if ( cctx -> str ? CRYPTO_ccm128_encrypt_ccm64 ( ccm , in , out , len , cctx -> str ) : CRYPTO_ccm128_encrypt ( ccm , in , out , len ) ) return - 1 ;
if ( ! CRYPTO_ccm128_tag ( ccm , out + len , cctx -> M ) ) return - 1 ;
return len + EVP_CCM_TLS_EXPLICIT_IV_LEN + cctx -> M ;
}
else {
if ( cctx -> str ? ! CRYPTO_ccm128_decrypt_ccm64 ( ccm , in , out , len , cctx -> str ) : ! CRYPTO_ccm128_decrypt ( ccm , in , out , len ) ) {
unsigned char tag [ 16 ] ;
if ( CRYPTO_ccm128_tag ( ccm , tag , cctx -> M ) ) {
if ( ! CRYPTO_memcmp ( tag , in + len , cctx -> M ) ) return len ;
}
}
OPENSSL_cleanse ( out , len ) ;
return - 1 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void aw_pulse_set2 ( WMAVoiceContext * s , GetBitContext * gb , int block_idx , AMRFixed * fcb ) {
uint16_t use_mask_mem [ 9 ] ;
uint16_t * use_mask = use_mask_mem + 2 ;
int pulse_off = s -> aw_first_pulse_off [ block_idx ] , pulse_start , n , idx , range , aidx , start_off = 0 ;
if ( s -> aw_n_pulses [ block_idx ] > 0 ) while ( pulse_off + s -> aw_pulse_range < 1 ) pulse_off += fcb -> pitch_lag ;
if ( s -> aw_n_pulses [ 0 ] > 0 ) {
if ( block_idx == 0 ) {
range = 32 ;
}
else {
range = 8 ;
if ( s -> aw_n_pulses [ block_idx ] > 0 ) pulse_off = s -> aw_next_pulse_off_cache ;
}
}
else range = 16 ;
pulse_start = s -> aw_n_pulses [ block_idx ] > 0 ? pulse_off - range / 2 : 0 ;
memset ( & use_mask [ - 2 ] , 0 , 2 * sizeof ( use_mask [ 0 ] ) ) ;
memset ( use_mask , - 1 , 5 * sizeof ( use_mask [ 0 ] ) ) ;
memset ( & use_mask [ 5 ] , 0 , 2 * sizeof ( use_mask [ 0 ] ) ) ;
if ( s -> aw_n_pulses [ block_idx ] > 0 ) for ( idx = pulse_off ;
idx < MAX_FRAMESIZE / 2 ;
idx += fcb -> pitch_lag ) {
int excl_range = s -> aw_pulse_range ;
uint16_t * use_mask_ptr = & use_mask [ idx >> 4 ] ;
int first_sh = 16 - ( idx & 15 ) ;
* use_mask_ptr ++ &= 0xFFFFu << first_sh ;
excl_range -= first_sh ;
if ( excl_range >= 16 ) {
* use_mask_ptr ++ = 0 ;
* use_mask_ptr &= 0xFFFF >> ( excl_range - 16 ) ;
}
else * use_mask_ptr &= 0xFFFF >> excl_range ;
}
aidx = get_bits ( gb , s -> aw_n_pulses [ 0 ] > 0 ? 5 - 2 * block_idx : 4 ) ;
for ( n = 0 ;
n <= aidx ;
pulse_start ++ ) {
for ( idx = pulse_start ;
idx < 0 ;
idx += fcb -> pitch_lag ) ;
if ( idx >= MAX_FRAMESIZE / 2 ) {
if ( use_mask [ 0 ] ) idx = 0x0F ;
else if ( use_mask [ 1 ] ) idx = 0x1F ;
else if ( use_mask [ 2 ] ) idx = 0x2F ;
else if ( use_mask [ 3 ] ) idx = 0x3F ;
else if ( use_mask [ 4 ] ) idx = 0x4F ;
else return ;
idx -= av_log2_16bit ( use_mask [ idx >> 4 ] ) ;
}
if ( use_mask [ idx >> 4 ] & ( 0x8000 >> ( idx & 15 ) ) ) {
use_mask [ idx >> 4 ] &= ~ ( 0x8000 >> ( idx & 15 ) ) ;
n ++ ;
start_off = idx ;
}
}
fcb -> x [ fcb -> n ] = start_off ;
fcb -> y [ fcb -> n ] = get_bits1 ( gb ) ? - 1.0 : 1.0 ;
fcb -> n ++ ;
n = ( MAX_FRAMESIZE / 2 - start_off ) % fcb -> pitch_lag ;
s -> aw_next_pulse_off_cache = n ? fcb -> pitch_lag - n : 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_simplewrite ( void ) {
struct event ev ;
setup_test ( "Simple write: " ) ;
event_set ( & ev , pair [ 0 ] , EV_WRITE , simple_write_cb , & ev ) ;
if ( event_add ( & ev , NULL ) == - 1 ) exit ( 1 ) ;
event_dispatch ( ) ;
cleanup_test ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSMgmtFloatGet ( const char * var_name , TSMgmtFloat * result ) {
return RecGetRecordFloat ( ( char * ) var_name , ( RecFloat * ) result ) == REC_ERR_OKAY ? TS_SUCCESS : TS_ERROR ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void cdxl_decode_ham8 ( CDXLVideoContext * c , AVFrame * frame ) {
AVCodecContext * avctx = c -> avctx ;
uint32_t new_palette [ 64 ] , r , g , b ;
uint8_t * ptr , * out , index , op ;
int x , y ;
ptr = c -> new_video ;
out = frame -> data [ 0 ] ;
import_palette ( c , new_palette ) ;
import_format ( c , avctx -> width , c -> new_video ) ;
for ( y = 0 ;
y < avctx -> height ;
y ++ ) {
r = new_palette [ 0 ] & 0xFF0000 ;
g = new_palette [ 0 ] & 0xFF00 ;
b = new_palette [ 0 ] & 0xFF ;
for ( x = 0 ;
x < avctx -> width ;
x ++ ) {
index = * ptr ++ ;
op = index >> 6 ;
index &= 63 ;
switch ( op ) {
case 0 : r = new_palette [ index ] & 0xFF0000 ;
g = new_palette [ index ] & 0xFF00 ;
b = new_palette [ index ] & 0xFF ;
break ;
case 1 : b = ( index << 2 ) | ( b & 3 ) ;
break ;
case 2 : r = ( index << 18 ) | ( r & ( 3 << 16 ) ) ;
break ;
case 3 : g = ( index << 10 ) | ( g & ( 3 << 8 ) ) ;
break ;
}
AV_WL24 ( out + x * 3 , r | g | b ) ;
}
out += frame -> linesize [ 0 ] ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void write_frame_size_with_refs ( VP9_COMP * cpi , struct vp9_write_bit_buffer * wb ) {
VP9_COMMON * const cm = & cpi -> common ;
int found = 0 ;
MV_REFERENCE_FRAME ref_frame ;
for ( ref_frame = LAST_FRAME ;
ref_frame <= ALTREF_FRAME ;
++ ref_frame ) {
YV12_BUFFER_CONFIG * cfg = get_ref_frame_buffer ( cpi , ref_frame ) ;
found = cm -> width == cfg -> y_crop_width && cm -> height == cfg -> y_crop_height ;
if ( cpi -> use_svc && ( ( cpi -> svc . number_temporal_layers > 1 && cpi -> oxcf . rc_mode == VPX_CBR ) || ( cpi -> svc . number_spatial_layers > 1 && cpi -> svc . layer_context [ cpi -> svc . spatial_layer_id ] . is_key_frame ) ) ) {
found = 0 ;
}
vp9_wb_write_bit ( wb , found ) ;
if ( found ) {
break ;
}
}
if ( ! found ) {
vp9_wb_write_literal ( wb , cm -> width - 1 , 16 ) ;
vp9_wb_write_literal ( wb , cm -> height - 1 , 16 ) ;
}
write_display_size ( cm , wb ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static VALUE mString_to_json_raw_object ( VALUE self ) {
VALUE ary ;
VALUE result = rb_hash_new ( ) ;
rb_hash_aset ( result , rb_funcall ( mJSON , i_create_id , 0 ) , rb_class_name ( rb_obj_class ( self ) ) ) ;
ary = rb_funcall ( self , i_unpack , 1 , rb_str_new2 ( "C*" ) ) ;
rb_hash_aset ( result , rb_str_new2 ( "raw" ) , ary ) ;
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void create_script_for_cluster_analyze ( char * * analyze_script_file_name ) {
FILE * script = NULL ;
PQExpBufferData user_specification ;
prep_status ( "Creating script to analyze new cluster" ) ;
initPQExpBuffer ( & user_specification ) ;
if ( os_info . user_specified ) {
appendPQExpBufferStr ( & user_specification , "-U " ) ;
appendShellString ( & user_specification , os_info . user ) ;
appendPQExpBufferChar ( & user_specification , ' ' ) ;
}
* analyze_script_file_name = psprintf ( "%sanalyze_new_cluster.%s" , SCRIPT_PREFIX , SCRIPT_EXT ) ;
if ( ( script = fopen_priv ( * analyze_script_file_name , "w" ) ) == NULL ) pg_fatal ( "Could not open file \"%s\": %s\n" , * analyze_script_file_name , getErrorText ( ) ) ;
# ifndef WIN32 fprintf ( script , "#!/bin/sh\n\n" ) ;
# else fprintf ( script , "@echo off\n" ) ;
# endif fprintf ( script , "echo %sThis script will generate minimal optimizer statistics rapidly%s\n" , ECHO_QUOTE , ECHO_QUOTE ) ;
fprintf ( script , "echo %sso your system is usable, and then gather statistics twice more%s\n" , ECHO_QUOTE , ECHO_QUOTE ) ;
fprintf ( script , "echo %swith increasing accuracy. When it is done, your system will%s\n" , ECHO_QUOTE , ECHO_QUOTE ) ;
fprintf ( script , "echo %shave the default level of optimizer statistics.%s\n" , ECHO_QUOTE , ECHO_QUOTE ) ;
fprintf ( script , "echo%s\n\n" , ECHO_BLANK ) ;
fprintf ( script , "echo %sIf you have used ALTER TABLE to modify the statistics target for%s\n" , ECHO_QUOTE , ECHO_QUOTE ) ;
fprintf ( script , "echo %sany tables, you might want to remove them and restore them after%s\n" , ECHO_QUOTE , ECHO_QUOTE ) ;
fprintf ( script , "echo %srunning this script because they will delay fast statistics generation.%s\n" , ECHO_QUOTE , ECHO_QUOTE ) ;
fprintf ( script , "echo%s\n\n" , ECHO_BLANK ) ;
fprintf ( script , "echo %sIf you would like default statistics as quickly as possible, cancel%s\n" , ECHO_QUOTE , ECHO_QUOTE ) ;
fprintf ( script , "echo %sthis script and run:%s\n" , ECHO_QUOTE , ECHO_QUOTE ) ;
fprintf ( script , "echo %s \"%s/vacuumdb\" %s--all %s%s\n" , ECHO_QUOTE , new_cluster . bindir , user_specification . data , ( GET_MAJOR_VERSION ( old_cluster . major_version ) >= 804 ) ? "--analyze-only" : "--analyze" , ECHO_QUOTE ) ;
fprintf ( script , "echo%s\n\n" , ECHO_BLANK ) ;
fprintf ( script , "\"%s/vacuumdb\" %s--all --analyze-in-stages\n" , new_cluster . bindir , user_specification . data ) ;
if ( GET_MAJOR_VERSION ( old_cluster . major_version ) < 804 ) fprintf ( script , "\"%s/vacuumdb\" %s--all\n" , new_cluster . bindir , user_specification . data ) ;
fprintf ( script , "echo%s\n\n" , ECHO_BLANK ) ;
fprintf ( script , "echo %sDone%s\n" , ECHO_QUOTE , ECHO_QUOTE ) ;
fclose ( script ) ;
# ifndef WIN32 if ( chmod ( * analyze_script_file_name , S_IRWXU ) != 0 ) pg_fatal ( "Could not add execute permission to file \"%s\": %s\n" , * analyze_script_file_name , getErrorText ( ) ) ;
# endif termPQExpBuffer ( & user_specification ) ;
check_ok ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int read_dns ( int fd , int tun_fd , struct query * q ) {
struct sockaddr_in from ;
socklen_t addrlen ;
char packet [ 64 * 1024 ] ;
int r ;
# ifndef WINDOWS32 char address [ 96 ] ;
struct msghdr msg ;
struct iovec iov ;
struct cmsghdr * cmsg ;
addrlen = sizeof ( struct sockaddr ) ;
iov . iov_base = packet ;
iov . iov_len = sizeof ( packet ) ;
msg . msg_name = ( caddr_t ) & from ;
msg . msg_namelen = ( unsigned ) addrlen ;
msg . msg_iov = & iov ;
msg . msg_iovlen = 1 ;
msg . msg_control = address ;
msg . msg_controllen = sizeof ( address ) ;
msg . msg_flags = 0 ;
r = recvmsg ( fd , & msg , 0 ) ;
# else addrlen = sizeof ( struct sockaddr ) ;
r = recvfrom ( fd , packet , sizeof ( packet ) , 0 , ( struct sockaddr * ) & from , & addrlen ) ;
# endif if ( r > 0 ) {
memcpy ( ( struct sockaddr * ) & q -> from , ( struct sockaddr * ) & from , addrlen ) ;
q -> fromlen = addrlen ;
if ( raw_decode ( packet , r , q , fd , tun_fd ) ) {
return 0 ;
}
if ( dns_decode ( NULL , 0 , q , QR_QUERY , packet , r ) < 0 ) {
return 0 ;
}
# ifndef WINDOWS32 for ( cmsg = CMSG_FIRSTHDR ( & msg ) ;
cmsg != NULL ;
cmsg = CMSG_NXTHDR ( & msg , cmsg ) ) {
if ( cmsg -> cmsg_level == IPPROTO_IP && cmsg -> cmsg_type == DSTADDR_SOCKOPT ) {
q -> destination = * dstaddr ( cmsg ) ;
break ;
}
}
# endif return strlen ( q -> name ) ;
}
else if ( r < 0 ) {
warn ( "read dns" ) ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void fixup ( UScriptRun * scriptRun , UScriptCode scriptCode ) {
int32_t fixupSP = DEC ( scriptRun -> parenSP , scriptRun -> fixupCount ) ;
while ( scriptRun -> fixupCount -- > 0 ) {
fixupSP = INC1 ( fixupSP ) ;
scriptRun -> parenStack [ fixupSP ] . scriptCode = scriptCode ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int64_t systick_scale ( nvic_state * s ) {
if ( s -> systick . control & SYSTICK_CLKSOURCE ) return system_clock_scale ;
else return 1000 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_T_route ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h245_T_route , T_route_sequence_of ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int jas_image_copycmpt ( jas_image_t * dstimage , int dstcmptno , jas_image_t * srcimage , int srccmptno ) {
jas_image_cmpt_t * newcmpt ;
if ( dstimage -> numcmpts_ >= dstimage -> maxcmpts_ ) {
if ( jas_image_growcmpts ( dstimage , dstimage -> maxcmpts_ + 128 ) ) {
return - 1 ;
}
}
if ( ! ( newcmpt = jas_image_cmpt_copy ( srcimage -> cmpts_ [ srccmptno ] ) ) ) {
return - 1 ;
}
if ( dstcmptno < dstimage -> numcmpts_ ) {
memmove ( & dstimage -> cmpts_ [ dstcmptno + 1 ] , & dstimage -> cmpts_ [ dstcmptno ] , ( dstimage -> numcmpts_ - dstcmptno ) * sizeof ( jas_image_cmpt_t * ) ) ;
}
dstimage -> cmpts_ [ dstcmptno ] = newcmpt ;
++ dstimage -> numcmpts_ ;
jas_image_setbbox ( dstimage ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_get8x8var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) {
variance ( src_ptr , source_stride , ref_ptr , ref_stride , 8 , 8 , sse , sum ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int chacha20_poly1305_ctrl ( EVP_CIPHER_CTX * ctx , int type , int arg , void * ptr ) {
EVP_CHACHA_AEAD_CTX * actx = aead_data ( ctx ) ;
switch ( type ) {
case EVP_CTRL_INIT : if ( actx == NULL ) actx = ctx -> cipher_data = OPENSSL_zalloc ( sizeof ( * actx ) + Poly1305_ctx_size ( ) ) ;
if ( actx == NULL ) {
EVPerr ( EVP_F_CHACHA20_POLY1305_CTRL , EVP_R_INITIALIZATION_ERROR ) ;
return 0 ;
}
actx -> len . aad = 0 ;
actx -> len . text = 0 ;
actx -> aad = 0 ;
actx -> mac_inited = 0 ;
actx -> tag_len = 0 ;
actx -> nonce_len = 12 ;
actx -> tls_payload_length = NO_TLS_PAYLOAD_LENGTH ;
return 1 ;
case EVP_CTRL_COPY : if ( actx ) {
EVP_CIPHER_CTX * dst = ( EVP_CIPHER_CTX * ) ptr ;
dst -> cipher_data = OPENSSL_memdup ( actx , sizeof ( * actx ) + Poly1305_ctx_size ( ) ) ;
if ( dst -> cipher_data == NULL ) {
EVPerr ( EVP_F_CHACHA20_POLY1305_CTRL , EVP_R_COPY_ERROR ) ;
return 0 ;
}
}
return 1 ;
case EVP_CTRL_AEAD_SET_IVLEN : if ( arg <= 0 || arg > CHACHA_CTR_SIZE ) return 0 ;
actx -> nonce_len = arg ;
return 1 ;
case EVP_CTRL_AEAD_SET_IV_FIXED : if ( arg != 12 ) return 0 ;
actx -> nonce [ 0 ] = actx -> key . counter [ 1 ] = CHACHA_U8TOU32 ( ( unsigned char * ) ptr ) ;
actx -> nonce [ 1 ] = actx -> key . counter [ 2 ] = CHACHA_U8TOU32 ( ( unsigned char * ) ptr + 4 ) ;
actx -> nonce [ 2 ] = actx -> key . counter [ 3 ] = CHACHA_U8TOU32 ( ( unsigned char * ) ptr + 8 ) ;
return 1 ;
case EVP_CTRL_AEAD_SET_TAG : if ( arg <= 0 || arg > POLY1305_BLOCK_SIZE ) return 0 ;
if ( ptr != NULL ) {
memcpy ( actx -> tag , ptr , arg ) ;
actx -> tag_len = arg ;
}
return 1 ;
case EVP_CTRL_AEAD_GET_TAG : if ( arg <= 0 || arg > POLY1305_BLOCK_SIZE || ! ctx -> encrypt ) return 0 ;
memcpy ( ptr , actx -> tag , arg ) ;
return 1 ;
case EVP_CTRL_AEAD_TLS1_AAD : if ( arg != EVP_AEAD_TLS1_AAD_LEN ) return 0 ;
{
unsigned int len ;
unsigned char * aad = ptr , temp [ POLY1305_BLOCK_SIZE ] ;
len = aad [ EVP_AEAD_TLS1_AAD_LEN - 2 ] << 8 | aad [ EVP_AEAD_TLS1_AAD_LEN - 1 ] ;
if ( ! ctx -> encrypt ) {
if ( len < POLY1305_BLOCK_SIZE ) return 0 ;
len -= POLY1305_BLOCK_SIZE ;
memcpy ( temp , aad , EVP_AEAD_TLS1_AAD_LEN - 2 ) ;
aad = temp ;
temp [ EVP_AEAD_TLS1_AAD_LEN - 2 ] = ( unsigned char ) ( len >> 8 ) ;
temp [ EVP_AEAD_TLS1_AAD_LEN - 1 ] = ( unsigned char ) len ;
}
actx -> tls_payload_length = len ;
actx -> key . counter [ 1 ] = actx -> nonce [ 0 ] ;
actx -> key . counter [ 2 ] = actx -> nonce [ 1 ] ^ CHACHA_U8TOU32 ( aad ) ;
actx -> key . counter [ 3 ] = actx -> nonce [ 2 ] ^ CHACHA_U8TOU32 ( aad + 4 ) ;
actx -> mac_inited = 0 ;
chacha20_poly1305_cipher ( ctx , NULL , aad , EVP_AEAD_TLS1_AAD_LEN ) ;
return POLY1305_BLOCK_SIZE ;
}
case EVP_CTRL_AEAD_SET_MAC_KEY : return 1 ;
default : return - 1 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
VideoXLContext * const a = avctx -> priv_data ;
AVFrame * const p = & a -> pic ;
uint8_t * Y , * U , * V ;
int i , j , ret ;
int stride ;
uint32_t val ;
int y0 , y1 , y2 , y3 = 0 , c0 = 0 , c1 = 0 ;
if ( p -> data [ 0 ] ) avctx -> release_buffer ( avctx , p ) ;
p -> reference = 0 ;
if ( ( ret = ff_get_buffer ( avctx , p ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
p -> pict_type = AV_PICTURE_TYPE_I ;
p -> key_frame = 1 ;
Y = a -> pic . data [ 0 ] ;
U = a -> pic . data [ 1 ] ;
V = a -> pic . data [ 2 ] ;
stride = avctx -> width - 4 ;
if ( buf_size < avctx -> width * avctx -> height ) {
av_log ( avctx , AV_LOG_ERROR , "Packet is too small\n" ) ;
return AVERROR_INVALIDDATA ;
}
for ( i = 0 ;
i < avctx -> height ;
i ++ ) {
buf += stride ;
for ( j = 0 ;
j < avctx -> width ;
j += 4 ) {
val = AV_RL32 ( buf ) ;
buf -= 4 ;
val = ( ( val >> 16 ) & 0xFFFF ) | ( ( val & 0xFFFF ) << 16 ) ;
if ( ! j ) y0 = ( val & 0x1F ) << 2 ;
else y0 = y3 + xl_table [ val & 0x1F ] ;
val >>= 5 ;
y1 = y0 + xl_table [ val & 0x1F ] ;
val >>= 5 ;
y2 = y1 + xl_table [ val & 0x1F ] ;
val >>= 6 ;
y3 = y2 + xl_table [ val & 0x1F ] ;
val >>= 5 ;
if ( ! j ) c0 = ( val & 0x1F ) << 2 ;
else c0 += xl_table [ val & 0x1F ] ;
val >>= 5 ;
if ( ! j ) c1 = ( val & 0x1F ) << 2 ;
else c1 += xl_table [ val & 0x1F ] ;
Y [ j + 0 ] = y0 << 1 ;
Y [ j + 1 ] = y1 << 1 ;
Y [ j + 2 ] = y2 << 1 ;
Y [ j + 3 ] = y3 << 1 ;
U [ j >> 2 ] = c0 << 1 ;
V [ j >> 2 ] = c1 << 1 ;
}
buf += avctx -> width + 4 ;
Y += a -> pic . linesize [ 0 ] ;
U += a -> pic . linesize [ 1 ] ;
V += a -> pic . linesize [ 2 ] ;
}
* got_frame = 1 ;
* ( AVFrame * ) data = a -> pic ;
return buf_size ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_SEQUENCE_SIZE_1_512_OF_EnumeratedParameter ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_constrained_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h225_SEQUENCE_SIZE_1_512_OF_EnumeratedParameter , SEQUENCE_SIZE_1_512_OF_EnumeratedParameter_sequence_of , 1 , 512 , FALSE ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_bug11901 ( ) {
int rc ;
const char * stmt_text ;
myheader ( "test_bug11901" ) ;
stmt_text = "drop table if exists t1, t2" ;
rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ;
myquery ( rc ) ;
stmt_text = "create table t1 (" " empno int(11) not null, firstname varchar(20) not null," " midinit varchar(20) not null, lastname varchar(20) not null," " workdept varchar(6) not null, salary double not null," " bonus float not null, primary key (empno), " " unique key (workdept, empno) " ") default charset=latin1 collate=latin1_bin" ;
rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ;
myquery ( rc ) ;
stmt_text = "insert into t1 values " "(10, 'CHRISTINE', 'I', 'HAAS', 'A00', 52750, 1000)," "(20, 'MICHAEL', 'L', 'THOMPSON', 'B01', 41250, 800), " "(30, 'SALLY', 'A', 'KWAN', 'C01', 38250, 800), " "(50, 'JOHN', 'B', 'GEYER', 'E01', 40175, 800), " "(60, 'IRVING', 'F', 'STERN', 'D11', 32250, 500), " "(70, 'EVA', 'D', 'PULASKI', 'D21', 36170, 700), " "(90, 'EILEEN', 'W', 'HENDERSON', 'E11', 29750, 600), " "(100, 'THEODORE', 'Q', 'SPENSER', 'E21', 26150, 500), " "(110, 'VINCENZO', 'G', 'LUCCHESSI', 'A00', 46500, 900), " "(120, 'SEAN', '', 'O\\'CONNELL', 'A00', 29250, 600), " "(130, 'DOLORES', 'M', 'QUINTANA', 'C01', 23800, 500), " "(140, 'HEATHER', 'A', 'NICHOLLS', 'C01', 28420, 600), " "(150, 'BRUCE', '', 'ADAMSON', 'D11', 25280, 500), " "(160, 'ELIZABETH', 'R', 'PIANKA', 'D11', 22250, 400), " "(170, 'MASATOSHI', 'J', 'YOSHIMURA', 'D11', 24680, 500), " "(180, 'MARILYN', 'S', 'SCOUTTEN', 'D11', 21340, 500), " "(190, 'JAMES', 'H', 'WALKER', 'D11', 20450, 400), " "(200, 'DAVID', '', 'BROWN', 'D11', 27740, 600), " "(210, 'WILLIAM', 'T', 'JONES', 'D11', 18270, 400), " "(220, 'JENNIFER', 'K', 'LUTZ', 'D11', 29840, 600), " "(230, 'JAMES', 'J', 'JEFFERSON', 'D21', 22180, 400), " "(240, 'SALVATORE', 'M', 'MARINO', 'D21', 28760, 600), " "(250, 'DANIEL', 'S', 'SMITH', 'D21', 19180, 400), " "(260, 'SYBIL', 'P', 'JOHNSON', 'D21', 17250, 300), " "(270, 'MARIA', 'L', 'PEREZ', 'D21', 27380, 500), " "(280, 'ETHEL', 'R', 'SCHNEIDER', 'E11', 26250, 500), " "(290, 'JOHN', 'R', 'PARKER', 'E11', 15340, 300), " "(300, 'PHILIP', 'X', 'SMITH', 'E11', 17750, 400), " "(310, 'MAUDE', 'F', 'SETRIGHT', 'E11', 15900, 300), " "(320, 'RAMLAL', 'V', 'MEHTA', 'E21', 19950, 400), " "(330, 'WING', '', 'LEE', 'E21', 25370, 500), " "(340, 'JASON', 'R', 'GOUNOT', 'E21', 23840, 500)" ;
rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ;
myquery ( rc ) ;
stmt_text = "create table t2 (" " deptno varchar(6) not null, deptname varchar(20) not null," " mgrno int(11) not null, location varchar(20) not null," " admrdept varchar(6) not null, refcntd int(11) not null," " refcntu int(11) not null, primary key (deptno)" ") default charset=latin1 collate=latin1_bin" ;
rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ;
myquery ( rc ) ;
stmt_text = "insert into t2 values " "('A00', 'SPIFFY COMPUTER SERV', 10, '', 'A00', 0, 0), " "('B01', 'PLANNING', 20, '', 'A00', 0, 0), " "('C01', 'INFORMATION CENTER', 30, '', 'A00', 0, 0), " "('D01', 'DEVELOPMENT CENTER', 0, '', 'A00', 0, 0)," "('D11', 'MANUFACTURING SYSTEM', 60, '', 'D01', 0, 0), " "('D21', 'ADMINISTRATION SYSTE', 70, '', 'D01', 0, 0), " "('E01', 'SUPPORT SERVICES', 50, '', 'A00', 0, 0), " "('E11', 'OPERATIONS', 90, '', 'E01', 0, 0), " "('E21', 'SOFTWARE SUPPORT', 100,'', 'E01', 0, 0)" ;
rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ;
myquery ( rc ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void ll_find_deltas ( struct object_entry * * list , unsigned list_size , int window , int depth , unsigned * processed ) {
struct thread_params * p ;
int i , ret , active_threads = 0 ;
init_threaded_search ( ) ;
if ( delta_search_threads <= 1 ) {
find_deltas ( list , & list_size , window , depth , processed ) ;
cleanup_threaded_search ( ) ;
return ;
}
if ( progress > pack_to_stdout ) fprintf ( stderr , "Delta compression using up to %d threads.\n" , delta_search_threads ) ;
p = xcalloc ( delta_search_threads , sizeof ( * p ) ) ;
for ( i = 0 ;
i < delta_search_threads ;
i ++ ) {
unsigned sub_size = list_size / ( delta_search_threads - i ) ;
if ( sub_size < 2 * window && i + 1 < delta_search_threads ) sub_size = 0 ;
p [ i ] . window = window ;
p [ i ] . depth = depth ;
p [ i ] . processed = processed ;
p [ i ] . working = 1 ;
p [ i ] . data_ready = 0 ;
while ( sub_size && sub_size < list_size && list [ sub_size ] -> hash && list [ sub_size ] -> hash == list [ sub_size - 1 ] -> hash ) sub_size ++ ;
p [ i ] . list = list ;
p [ i ] . list_size = sub_size ;
p [ i ] . remaining = sub_size ;
list += sub_size ;
list_size -= sub_size ;
}
for ( i = 0 ;
i < delta_search_threads ;
i ++ ) {
if ( ! p [ i ] . list_size ) continue ;
pthread_mutex_init ( & p [ i ] . mutex , NULL ) ;
pthread_cond_init ( & p [ i ] . cond , NULL ) ;
ret = pthread_create ( & p [ i ] . thread , NULL , threaded_find_deltas , & p [ i ] ) ;
if ( ret ) die ( "unable to create thread: %s" , strerror ( ret ) ) ;
active_threads ++ ;
}
while ( active_threads ) {
struct thread_params * target = NULL ;
struct thread_params * victim = NULL ;
unsigned sub_size = 0 ;
progress_lock ( ) ;
for ( ;
;
) {
for ( i = 0 ;
! target && i < delta_search_threads ;
i ++ ) if ( ! p [ i ] . working ) target = & p [ i ] ;
if ( target ) break ;
pthread_cond_wait ( & progress_cond , & progress_mutex ) ;
}
for ( i = 0 ;
i < delta_search_threads ;
i ++ ) if ( p [ i ] . remaining > 2 * window && ( ! victim || victim -> remaining < p [ i ] . remaining ) ) victim = & p [ i ] ;
if ( victim ) {
sub_size = victim -> remaining / 2 ;
list = victim -> list + victim -> list_size - sub_size ;
while ( sub_size && list [ 0 ] -> hash && list [ 0 ] -> hash == list [ - 1 ] -> hash ) {
list ++ ;
sub_size -- ;
}
if ( ! sub_size ) {
sub_size = victim -> remaining / 2 ;
list -= sub_size ;
}
target -> list = list ;
victim -> list_size -= sub_size ;
victim -> remaining -= sub_size ;
}
target -> list_size = sub_size ;
target -> remaining = sub_size ;
target -> working = 1 ;
progress_unlock ( ) ;
pthread_mutex_lock ( & target -> mutex ) ;
target -> data_ready = 1 ;
pthread_cond_signal ( & target -> cond ) ;
pthread_mutex_unlock ( & target -> mutex ) ;
if ( ! sub_size ) {
pthread_join ( target -> thread , NULL ) ;
pthread_cond_destroy ( & target -> cond ) ;
pthread_mutex_destroy ( & target -> mutex ) ;
active_threads -- ;
}
}
cleanup_threaded_search ( ) ;
free ( p ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static float tilt_factor ( const float * lpcs , int n_lpcs ) {
float rh0 , rh1 ;
rh0 = 1.0 + avpriv_scalarproduct_float_c ( lpcs , lpcs , n_lpcs ) ;
rh1 = lpcs [ 0 ] + avpriv_scalarproduct_float_c ( lpcs , & lpcs [ 1 ] , n_lpcs - 1 ) ;
return rh1 / rh0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * create_index ( void ) {
const char * tmpfile ;
struct pack_idx_entry * * idx , * * c , * * last ;
struct object_entry * e ;
struct object_entry_pool * o ;
idx = xmalloc ( object_count * sizeof ( * idx ) ) ;
c = idx ;
for ( o = blocks ;
o ;
o = o -> next_pool ) for ( e = o -> next_free ;
e -- != o -> entries ;
) if ( pack_id == e -> pack_id ) * c ++ = & e -> idx ;
last = idx + object_count ;
if ( c != last ) die ( "internal consistency error creating the index" ) ;
tmpfile = write_idx_file ( NULL , idx , object_count , & pack_idx_opts , pack_data -> sha1 ) ;
free ( idx ) ;
return tmpfile ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_rsvp_common ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , gboolean e2ei ) {
guint8 message_type ;
int session_off , tempfilt_off ;
rsvp_conversation_info * rsvph ;
conversation_t * conversation ;
struct rsvp_request_key request_key , * new_request_key ;
struct rsvp_request_val * request_val ;
col_clear ( pinfo -> cinfo , COL_INFO ) ;
message_type = tvb_get_guint8 ( tvb , 1 ) ;
rsvph = wmem_new0 ( wmem_packet_scope ( ) , rsvp_conversation_info ) ;
set_address ( & rsvph -> source , pinfo -> src . type , pinfo -> src . len , pinfo -> src . data ) ;
set_address ( & rsvph -> destination , pinfo -> dst . type , pinfo -> dst . len , pinfo -> dst . data ) ;
col_add_str ( pinfo -> cinfo , COL_INFO , val_to_str_ext ( message_type , & message_type_vals_ext , "Unknown (%u). " ) ) ;
if ( message_type == RSVP_MSG_BUNDLE ) {
col_set_str ( pinfo -> cinfo , COL_INFO , rsvp_bundle_dissect ? "Component Messages Dissected" : "Component Messages Not Dissected" ) ;
}
else {
find_rsvp_session_tempfilt ( tvb , 0 , & session_off , & tempfilt_off ) ;
if ( session_off ) col_append_str ( pinfo -> cinfo , COL_INFO , summary_session ( tvb , session_off ) ) ;
if ( tempfilt_off ) col_append_str ( pinfo -> cinfo , COL_INFO , summary_template ( tvb , tempfilt_off ) ) ;
}
dissect_rsvp_msg_tree ( tvb , pinfo , tree , TREE ( TT_RSVP ) , rsvph , e2ei ) ;
if ( ( message_type == RSVP_MSG_ACK ) || ( message_type == RSVP_MSG_SREFRESH ) || ( message_type == RSVP_MSG_HELLO ) ) return ;
conversation = find_or_create_conversation ( pinfo ) ;
memset ( & request_key , 0 , sizeof ( request_key ) ) ;
request_key . conversation = conversation -> index ;
request_key . session_type = rsvph -> session_type ;
switch ( request_key . session_type ) {
case RSVP_SESSION_TYPE_IPV4 : set_address ( & request_key . u . session_ipv4 . destination , rsvph -> destination . type , rsvph -> destination . len , rsvph -> destination . data ) ;
request_key . u . session_ipv4 . protocol = rsvph -> protocol ;
request_key . u . session_ipv4 . udp_dest_port = rsvph -> udp_dest_port ;
break ;
case RSVP_SESSION_TYPE_IPV6 : break ;
case RSVP_SESSION_TYPE_IPV4_LSP : set_address ( & request_key . u . session_ipv4_lsp . destination , rsvph -> destination . type , rsvph -> destination . len , rsvph -> destination . data ) ;
request_key . u . session_ipv4_lsp . udp_dest_port = rsvph -> udp_dest_port ;
request_key . u . session_ipv4_lsp . ext_tunnel_id = rsvph -> ext_tunnel_id ;
break ;
case RSVP_SESSION_TYPE_AGGREGATE_IPV4 : set_address ( & request_key . u . session_agg_ipv4 . destination , rsvph -> destination . type , rsvph -> destination . len , rsvph -> destination . data ) ;
request_key . u . session_agg_ipv4 . dscp = rsvph -> dscp ;
break ;
case RSVP_SESSION_TYPE_IPV4_UNI : set_address ( & request_key . u . session_ipv4_uni . destination , rsvph -> destination . type , rsvph -> destination . len , rsvph -> destination . data ) ;
request_key . u . session_ipv4_uni . udp_dest_port = rsvph -> udp_dest_port ;
request_key . u . session_ipv4_uni . ext_tunnel_id = rsvph -> ext_tunnel_id ;
break ;
case RSVP_SESSION_TYPE_IPV4_E_NNI : set_address ( & request_key . u . session_ipv4_enni . destination , rsvph -> destination . type , rsvph -> destination . len , rsvph -> destination . data ) ;
request_key . u . session_ipv4_enni . udp_dest_port = rsvph -> udp_dest_port ;
request_key . u . session_ipv4_enni . ext_tunnel_id = rsvph -> ext_tunnel_id ;
break ;
default : proto_tree_add_expert ( tree , pinfo , & ei_rsvp_session_type , tvb , 0 , 0 ) ;
break ;
}
copy_address_wmem ( wmem_file_scope ( ) , & request_key . source_info . source , & rsvph -> source ) ;
request_key . source_info . udp_source_port = rsvph -> udp_source_port ;
request_val = ( struct rsvp_request_val * ) g_hash_table_lookup ( rsvp_request_hash , & request_key ) ;
if ( ! request_val ) {
new_request_key = ( struct rsvp_request_key * ) wmem_memdup ( wmem_file_scope ( ) , & request_key , sizeof ( struct rsvp_request_key ) ) ;
request_val = wmem_new ( wmem_file_scope ( ) , struct rsvp_request_val ) ;
request_val -> value = conversation -> index ;
g_hash_table_insert ( rsvp_request_hash , new_request_key , request_val ) ;
}
tap_queue_packet ( rsvp_tap , pinfo , rsvph ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ff_cavs_init_mb ( AVSContext * h ) {
int i ;
for ( i = 0 ;
i < 3 ;
i ++ ) {
h -> mv [ MV_FWD_B2 + i ] = h -> top_mv [ 0 ] [ h -> mbx * 2 + i ] ;
h -> mv [ MV_BWD_B2 + i ] = h -> top_mv [ 1 ] [ h -> mbx * 2 + i ] ;
}
h -> pred_mode_Y [ 1 ] = h -> top_pred_Y [ h -> mbx * 2 + 0 ] ;
h -> pred_mode_Y [ 2 ] = h -> top_pred_Y [ h -> mbx * 2 + 1 ] ;
if ( ! ( h -> flags & B_AVAIL ) ) {
h -> mv [ MV_FWD_B2 ] = un_mv ;
h -> mv [ MV_FWD_B3 ] = un_mv ;
h -> mv [ MV_BWD_B2 ] = un_mv ;
h -> mv [ MV_BWD_B3 ] = un_mv ;
h -> pred_mode_Y [ 1 ] = h -> pred_mode_Y [ 2 ] = NOT_AVAIL ;
h -> flags &= ~ ( C_AVAIL | D_AVAIL ) ;
}
else if ( h -> mbx ) {
h -> flags |= D_AVAIL ;
}
if ( h -> mbx == h -> mb_width - 1 ) h -> flags &= ~ C_AVAIL ;
if ( ! ( h -> flags & C_AVAIL ) ) {
h -> mv [ MV_FWD_C2 ] = un_mv ;
h -> mv [ MV_BWD_C2 ] = un_mv ;
}
if ( ! ( h -> flags & D_AVAIL ) ) {
h -> mv [ MV_FWD_D3 ] = un_mv ;
h -> mv [ MV_BWD_D3 ] = un_mv ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * Type_DateTime_Dup ( struct _cms_typehandler_struct * self , const void * Ptr , cmsUInt32Number n ) {
return _cmsDupMem ( self -> ContextID , Ptr , sizeof ( struct tm ) ) ;
cmsUNUSED_PARAMETER ( n ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void fill_variance_tree ( void * data , BLOCK_SIZE bsize ) {
variance_node node ;
tree_to_node ( data , bsize , & node ) ;
sum_2_variances ( node . split [ 0 ] , node . split [ 1 ] , & node . part_variances -> horz [ 0 ] ) ;
sum_2_variances ( node . split [ 2 ] , node . split [ 3 ] , & node . part_variances -> horz [ 1 ] ) ;
sum_2_variances ( node . split [ 0 ] , node . split [ 2 ] , & node . part_variances -> vert [ 0 ] ) ;
sum_2_variances ( node . split [ 1 ] , node . split [ 3 ] , & node . part_variances -> vert [ 1 ] ) ;
sum_2_variances ( & node . part_variances -> vert [ 0 ] , & node . part_variances -> vert [ 1 ] , & node . part_variances -> none ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
VALUE rb_dlhandle_s_allocate ( VALUE klass ) {
VALUE obj ;
struct dl_handle * dlhandle ;
obj = Data_Make_Struct ( rb_cDLHandle , struct dl_handle , 0 , dlhandle_free , dlhandle ) ;
dlhandle -> ptr = 0 ;
dlhandle -> open = 0 ;
dlhandle -> enable_close = 0 ;
return obj ;
}
| 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 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
DEFINE_TEST ( test_read_format_mtree_nomagic_v2_form ) {
const char reffile [ ] = "test_read_format_mtree_nomagic2.mtree" ;
char buff [ 16 ] ;
struct archive_entry * ae ;
struct archive * a ;
FILE * f ;
extract_reference_file ( reffile ) ;
assert ( ( a = archive_read_new ( ) ) != NULL ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_support_filter_all ( a ) ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_support_format_all ( a ) ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_set_options ( a , "mtree:checkfs" ) ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_open_filename ( a , reffile , 11 ) ) ;
f = fopen ( "file" , "wb" ) ;
assert ( f != NULL ) ;
assertEqualInt ( 3 , fwrite ( "hi\n" , 1 , 3 , f ) ) ;
fclose ( f ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualInt ( archive_format ( a ) , ARCHIVE_FORMAT_MTREE ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "./file" ) ;
assertEqualInt ( archive_entry_uid ( ae ) , 18 ) ;
assertEqualInt ( AE_IFREG , archive_entry_filetype ( ae ) ) ;
assertEqualInt ( archive_entry_mode ( ae ) , AE_IFREG | 0123 ) ;
assertEqualInt ( archive_entry_size ( ae ) , 3 ) ;
assertEqualInt ( 3 , archive_read_data ( a , buff , 3 ) ) ;
assertEqualMem ( buff , "hi\n" , 3 ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "./dir" ) ;
assertEqualInt ( archive_entry_mode ( ae ) , AE_IFDIR | 0755 ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "./dir/file with space" ) ;
assertEqualInt ( archive_entry_uid ( ae ) , 18 ) ;
assertEqualInt ( archive_entry_mode ( ae ) , AE_IFREG | 0644 ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "./file with space" ) ;
assertEqualInt ( archive_entry_mode ( ae ) , AE_IFREG | 0644 ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "./dir2" ) ;
assertEqualInt ( archive_entry_mode ( ae ) , AE_IFDIR | 0755 ) ;
assertEqualIntA ( a , ARCHIVE_OK , archive_read_next_header ( a , & ae ) ) ;
assertEqualString ( archive_entry_pathname ( ae ) , "./dir2/dir3a" ) ;
assertEqualInt ( archive_entry_mode ( ae ) , AE_IFDIR | 0755 ) ;
assertEqualIntA ( a , ARCHIVE_EOF , archive_read_next_header ( a , & ae ) ) ;
assertEqualInt ( 6 , archive_file_count ( a ) ) ;
assertEqualInt ( ARCHIVE_OK , archive_read_close ( a ) ) ;
assertEqualInt ( ARCHIVE_OK , archive_read_free ( a ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void inverse_transform_block ( MACROBLOCKD * xd , int plane , int block , TX_SIZE tx_size , uint8_t * dst , int stride , int eob ) {
struct macroblockd_plane * const pd = & xd -> plane [ plane ] ;
if ( eob > 0 ) {
TX_TYPE tx_type = DCT_DCT ;
tran_low_t * const dqcoeff = BLOCK_OFFSET ( pd -> dqcoeff , block ) ;
if ( xd -> lossless ) {
tx_type = DCT_DCT ;
vp9_iwht4x4_add ( dqcoeff , dst , stride , eob ) ;
}
else {
const PLANE_TYPE plane_type = pd -> plane_type ;
switch ( tx_size ) {
case TX_4X4 : tx_type = get_tx_type_4x4 ( plane_type , xd , block ) ;
vp9_iht4x4_add ( tx_type , dqcoeff , dst , stride , eob ) ;
break ;
case TX_8X8 : tx_type = get_tx_type ( plane_type , xd ) ;
vp9_iht8x8_add ( tx_type , dqcoeff , dst , stride , eob ) ;
break ;
case TX_16X16 : tx_type = get_tx_type ( plane_type , xd ) ;
vp9_iht16x16_add ( tx_type , dqcoeff , dst , stride , eob ) ;
break ;
case TX_32X32 : tx_type = DCT_DCT ;
vp9_idct32x32_add ( dqcoeff , dst , stride , eob ) ;
break ;
default : assert ( 0 && "Invalid transform size" ) ;
}
}
if ( eob == 1 ) {
vpx_memset ( dqcoeff , 0 , 2 * sizeof ( dqcoeff [ 0 ] ) ) ;
}
else {
if ( tx_type == DCT_DCT && tx_size <= TX_16X16 && eob <= 10 ) vpx_memset ( dqcoeff , 0 , 4 * ( 4 << tx_size ) * sizeof ( dqcoeff [ 0 ] ) ) ;
else if ( tx_size == TX_32X32 && eob <= 34 ) vpx_memset ( dqcoeff , 0 , 256 * sizeof ( dqcoeff [ 0 ] ) ) ;
else vpx_memset ( dqcoeff , 0 , ( 16 << ( tx_size << 1 ) ) * sizeof ( dqcoeff [ 0 ] ) ) ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int vp9_get_tx_size_context ( const MACROBLOCKD * xd ) {
const int max_tx_size = max_txsize_lookup [ xd -> mi [ 0 ] -> mbmi . sb_type ] ;
const MB_MODE_INFO * const above_mbmi = get_mbmi ( get_above_mi ( xd ) ) ;
const MB_MODE_INFO * const left_mbmi = get_mbmi ( get_left_mi ( xd ) ) ;
const int has_above = above_mbmi != NULL ;
const int has_left = left_mbmi != NULL ;
int above_ctx = ( has_above && ! above_mbmi -> skip ) ? ( int ) above_mbmi -> tx_size : max_tx_size ;
int left_ctx = ( has_left && ! left_mbmi -> skip ) ? ( int ) left_mbmi -> tx_size : max_tx_size ;
if ( ! has_left ) left_ctx = above_ctx ;
if ( ! has_above ) above_ctx = left_ctx ;
return ( above_ctx + left_ctx ) > max_tx_size ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int e1000e_can_receive ( E1000ECore * core ) {
int i ;
if ( ! e1000x_rx_ready ( core -> owner , core -> mac ) ) {
return false ;
}
for ( i = 0 ;
i < E1000E_NUM_QUEUES ;
i ++ ) {
E1000E_RxRing rxr ;
e1000e_rx_ring_init ( core , & rxr , i ) ;
if ( e1000e_ring_enabled ( core , rxr . i ) && e1000e_has_rxbufs ( core , rxr . i , 1 ) ) {
trace_e1000e_rx_can_recv ( ) ;
return true ;
}
}
trace_e1000e_rx_can_recv_rings_full ( ) ;
return false ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_btgatt_microbit_led_text ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data ) {
btatt_data_t * att_data = ( btatt_data_t * ) data ;
if ( bluetooth_gatt_has_no_parameter ( att_data -> opcode ) ) return - 1 ;
proto_tree_add_item ( tree , hf_gatt_microbit_led_text , tvb , 0 , tvb_captured_length ( tvb ) , ENC_NA | ENC_UTF_8 ) ;
return tvb_captured_length ( tvb ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void mips_magnum_init ( QEMUMachineInitArgs * args ) {
ram_addr_t ram_size = args -> ram_size ;
const char * cpu_model = args -> cpu_model ;
mips_jazz_init ( get_system_memory ( ) , get_system_io ( ) , ram_size , cpu_model , JAZZ_MAGNUM ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_bug36004 ( ) {
int rc , warning_count = 0 ;
MYSQL_STMT * stmt ;
DBUG_ENTER ( "test_bug36004" ) ;
myheader ( "test_bug36004" ) ;
rc = mysql_query ( mysql , "drop table if exists inexistant" ) ;
myquery ( rc ) ;
DIE_UNLESS ( mysql_warning_count ( mysql ) == 1 ) ;
query_int_variable ( mysql , "@@warning_count" , & warning_count ) ;
DIE_UNLESS ( warning_count ) ;
stmt = mysql_simple_prepare ( mysql , "select 1" ) ;
check_stmt ( stmt ) ;
DIE_UNLESS ( mysql_warning_count ( mysql ) == 0 ) ;
query_int_variable ( mysql , "@@warning_count" , & warning_count ) ;
DIE_UNLESS ( warning_count ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
DIE_UNLESS ( mysql_warning_count ( mysql ) == 0 ) ;
mysql_stmt_close ( stmt ) ;
query_int_variable ( mysql , "@@warning_count" , & warning_count ) ;
DIE_UNLESS ( warning_count ) ;
stmt = mysql_simple_prepare ( mysql , "drop table if exists inexistant" ) ;
check_stmt ( stmt ) ;
query_int_variable ( mysql , "@@warning_count" , & warning_count ) ;
DIE_UNLESS ( warning_count == 0 ) ;
mysql_stmt_close ( stmt ) ;
DBUG_VOID_RETURN ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void fz_drop_link_key ( fz_context * ctx , void * key_ ) {
fz_link_key * key = ( fz_link_key * ) key_ ;
if ( fz_drop_imp ( ctx , key , & key -> refs ) ) fz_free ( ctx , key ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void mpi_swap ( MPI a , MPI b ) {
struct gcry_mpi tmp ;
tmp = * a ;
* a = * b ;
* b = tmp ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int32_t _appendKeywordsToLanguageTag ( const char * localeID , char * appendAt , int32_t capacity , UBool strict , UBool hadPosix , UErrorCode * status ) {
char buf [ ULOC_KEYWORD_AND_VALUES_CAPACITY ] ;
char attrBuf [ ULOC_KEYWORD_AND_VALUES_CAPACITY ] = {
0 }
;
int32_t attrBufLength = 0 ;
UEnumeration * keywordEnum = NULL ;
int32_t reslen = 0 ;
keywordEnum = uloc_openKeywords ( localeID , status ) ;
if ( U_FAILURE ( * status ) && ! hadPosix ) {
uenum_close ( keywordEnum ) ;
return 0 ;
}
if ( keywordEnum != NULL || hadPosix ) {
int32_t len ;
const char * key ;
ExtensionListEntry * firstExt = NULL ;
ExtensionListEntry * ext ;
AttributeListEntry * firstAttr = NULL ;
AttributeListEntry * attr ;
char * attrValue ;
char extBuf [ ULOC_KEYWORD_AND_VALUES_CAPACITY ] ;
char * pExtBuf = extBuf ;
int32_t extBufCapacity = sizeof ( extBuf ) ;
const char * bcpKey , * bcpValue ;
UErrorCode tmpStatus = U_ZERO_ERROR ;
int32_t keylen ;
UBool isBcpUExt ;
while ( TRUE ) {
key = uenum_next ( keywordEnum , NULL , status ) ;
if ( key == NULL ) {
break ;
}
len = uloc_getKeywordValue ( localeID , key , buf , sizeof ( buf ) , & tmpStatus ) ;
if ( U_FAILURE ( tmpStatus ) || tmpStatus == U_STRING_NOT_TERMINATED_WARNING ) {
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
tmpStatus = U_ZERO_ERROR ;
continue ;
}
keylen = ( int32_t ) uprv_strlen ( key ) ;
isBcpUExt = ( keylen > 1 ) ;
if ( uprv_strcmp ( key , LOCALE_ATTRIBUTE_KEY ) == 0 ) {
if ( len > 0 ) {
int32_t i = 0 ;
while ( TRUE ) {
attrBufLength = 0 ;
for ( ;
i < len ;
i ++ ) {
if ( buf [ i ] != '-' ) {
attrBuf [ attrBufLength ++ ] = buf [ i ] ;
}
else {
i ++ ;
break ;
}
}
if ( attrBufLength > 0 ) {
attrBuf [ attrBufLength ] = 0 ;
}
else if ( i >= len ) {
break ;
}
attr = ( AttributeListEntry * ) uprv_malloc ( sizeof ( AttributeListEntry ) ) ;
if ( attr == NULL ) {
* status = U_MEMORY_ALLOCATION_ERROR ;
break ;
}
attrValue = ( char * ) uprv_malloc ( attrBufLength + 1 ) ;
if ( attrValue == NULL ) {
* status = U_MEMORY_ALLOCATION_ERROR ;
break ;
}
uprv_strcpy ( attrValue , attrBuf ) ;
attr -> attribute = attrValue ;
if ( ! _addAttributeToList ( & firstAttr , attr ) ) {
uprv_free ( attr ) ;
uprv_free ( attrValue ) ;
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
}
}
bcpKey = LOCALE_ATTRIBUTE_KEY ;
bcpValue = NULL ;
}
}
else if ( isBcpUExt ) {
bcpKey = uloc_toUnicodeLocaleKey ( key ) ;
if ( bcpKey == NULL ) {
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
continue ;
}
bcpValue = uloc_toUnicodeLocaleType ( key , buf ) ;
if ( bcpValue == NULL ) {
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
continue ;
}
if ( bcpValue == buf ) {
int32_t bcpValueLen = uprv_strlen ( bcpValue ) ;
if ( bcpValueLen < extBufCapacity ) {
uprv_strcpy ( pExtBuf , bcpValue ) ;
T_CString_toLowerCase ( pExtBuf ) ;
bcpValue = pExtBuf ;
pExtBuf += ( bcpValueLen + 1 ) ;
extBufCapacity -= ( bcpValueLen + 1 ) ;
}
else {
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
continue ;
}
}
}
else {
if ( * key == PRIVATEUSE ) {
if ( ! _isPrivateuseValueSubtags ( buf , len ) ) {
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
continue ;
}
}
else {
if ( ! _isExtensionSingleton ( key , keylen ) || ! _isExtensionSubtags ( buf , len ) ) {
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
continue ;
}
}
bcpKey = key ;
if ( ( len + 1 ) < extBufCapacity ) {
uprv_memcpy ( pExtBuf , buf , len ) ;
bcpValue = pExtBuf ;
pExtBuf += len ;
* pExtBuf = 0 ;
pExtBuf ++ ;
extBufCapacity -= ( len + 1 ) ;
}
else {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
}
ext = ( ExtensionListEntry * ) uprv_malloc ( sizeof ( ExtensionListEntry ) ) ;
if ( ext == NULL ) {
* status = U_MEMORY_ALLOCATION_ERROR ;
break ;
}
ext -> key = bcpKey ;
ext -> value = bcpValue ;
if ( ! _addExtensionToList ( & firstExt , ext , TRUE ) ) {
uprv_free ( ext ) ;
if ( strict ) {
* status = U_ILLEGAL_ARGUMENT_ERROR ;
break ;
}
}
}
if ( hadPosix ) {
ext = ( ExtensionListEntry * ) uprv_malloc ( sizeof ( ExtensionListEntry ) ) ;
if ( ext == NULL ) {
* status = U_MEMORY_ALLOCATION_ERROR ;
goto cleanup ;
}
ext -> key = POSIX_KEY ;
ext -> value = POSIX_VALUE ;
if ( ! _addExtensionToList ( & firstExt , ext , TRUE ) ) {
uprv_free ( ext ) ;
}
}
if ( U_SUCCESS ( * status ) && ( firstExt != NULL || firstAttr != NULL ) ) {
UBool startLDMLExtension = FALSE ;
for ( ext = firstExt ;
ext ;
ext = ext -> next ) {
if ( ! startLDMLExtension && uprv_strlen ( ext -> key ) > 1 ) {
if ( reslen < capacity ) {
* ( appendAt + reslen ) = SEP ;
}
reslen ++ ;
if ( reslen < capacity ) {
* ( appendAt + reslen ) = LDMLEXT ;
}
reslen ++ ;
startLDMLExtension = TRUE ;
}
if ( uprv_strcmp ( ext -> key , LOCALE_ATTRIBUTE_KEY ) == 0 ) {
for ( attr = firstAttr ;
attr ;
attr = attr -> next ) {
if ( reslen < capacity ) {
* ( appendAt + reslen ) = SEP ;
}
reslen ++ ;
len = ( int32_t ) uprv_strlen ( attr -> attribute ) ;
if ( reslen < capacity ) {
uprv_memcpy ( appendAt + reslen , attr -> attribute , uprv_min ( len , capacity - reslen ) ) ;
}
reslen += len ;
}
}
else {
if ( reslen < capacity ) {
* ( appendAt + reslen ) = SEP ;
}
reslen ++ ;
len = ( int32_t ) uprv_strlen ( ext -> key ) ;
if ( reslen < capacity ) {
uprv_memcpy ( appendAt + reslen , ext -> key , uprv_min ( len , capacity - reslen ) ) ;
}
reslen += len ;
if ( reslen < capacity ) {
* ( appendAt + reslen ) = SEP ;
}
reslen ++ ;
len = ( int32_t ) uprv_strlen ( ext -> value ) ;
if ( reslen < capacity ) {
uprv_memcpy ( appendAt + reslen , ext -> value , uprv_min ( len , capacity - reslen ) ) ;
}
reslen += len ;
}
}
}
cleanup : ext = firstExt ;
while ( ext != NULL ) {
ExtensionListEntry * tmpExt = ext -> next ;
uprv_free ( ext ) ;
ext = tmpExt ;
}
attr = firstAttr ;
while ( attr != NULL ) {
AttributeListEntry * tmpAttr = attr -> next ;
char * pValue = ( char * ) attr -> attribute ;
uprv_free ( pValue ) ;
uprv_free ( attr ) ;
attr = tmpAttr ;
}
uenum_close ( keywordEnum ) ;
if ( U_FAILURE ( * status ) ) {
return 0 ;
}
}
return u_terminateChars ( appendAt , capacity , reslen , status ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_T_entryDataType ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_T_entryDataType , T_entryDataType_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static MagickBooleanType IsIPL ( const unsigned char * magick , const size_t length ) {
if ( length < 4 ) return ( MagickFalse ) ;
if ( LocaleNCompare ( ( const char * ) magick , "data" , 4 ) == 0 ) return ( MagickTrue ) ;
return ( MagickFalse ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint32_t gic_dist_readb ( void * opaque , hwaddr offset ) {
GICState * s = ( GICState * ) opaque ;
uint32_t res ;
int irq ;
int i ;
int cpu ;
int cm ;
int mask ;
cpu = gic_get_current_cpu ( s ) ;
cm = 1 << cpu ;
if ( offset < 0x100 ) {
if ( offset == 0 ) return s -> enabled ;
if ( offset == 4 ) return ( ( s -> num_irq / 32 ) - 1 ) | ( ( NUM_CPU ( s ) - 1 ) << 5 ) ;
if ( offset < 0x08 ) return 0 ;
if ( offset >= 0x80 ) {
return 0 ;
}
goto bad_reg ;
}
else if ( offset < 0x200 ) {
if ( offset < 0x180 ) irq = ( offset - 0x100 ) * 8 ;
else irq = ( offset - 0x180 ) * 8 ;
irq += GIC_BASE_IRQ ;
if ( irq >= s -> num_irq ) goto bad_reg ;
res = 0 ;
for ( i = 0 ;
i < 8 ;
i ++ ) {
if ( GIC_TEST_ENABLED ( irq + i , cm ) ) {
res |= ( 1 << i ) ;
}
}
}
else if ( offset < 0x300 ) {
if ( offset < 0x280 ) irq = ( offset - 0x200 ) * 8 ;
else irq = ( offset - 0x280 ) * 8 ;
irq += GIC_BASE_IRQ ;
if ( irq >= s -> num_irq ) goto bad_reg ;
res = 0 ;
mask = ( irq < GIC_INTERNAL ) ? cm : ALL_CPU_MASK ;
for ( i = 0 ;
i < 8 ;
i ++ ) {
if ( GIC_TEST_PENDING ( irq + i , mask ) ) {
res |= ( 1 << i ) ;
}
}
}
else if ( offset < 0x400 ) {
irq = ( offset - 0x300 ) * 8 + GIC_BASE_IRQ ;
if ( irq >= s -> num_irq ) goto bad_reg ;
res = 0 ;
mask = ( irq < GIC_INTERNAL ) ? cm : ALL_CPU_MASK ;
for ( i = 0 ;
i < 8 ;
i ++ ) {
if ( GIC_TEST_ACTIVE ( irq + i , mask ) ) {
res |= ( 1 << i ) ;
}
}
}
else if ( offset < 0x800 ) {
irq = ( offset - 0x400 ) + GIC_BASE_IRQ ;
if ( irq >= s -> num_irq ) goto bad_reg ;
res = GIC_GET_PRIORITY ( irq , cpu ) ;
}
else if ( offset < 0xc00 ) {
if ( s -> num_cpu == 1 && s -> revision != REV_11MPCORE ) {
res = 0 ;
}
else {
irq = ( offset - 0x800 ) + GIC_BASE_IRQ ;
if ( irq >= s -> num_irq ) {
goto bad_reg ;
}
if ( irq >= 29 && irq <= 31 ) {
res = cm ;
}
else {
res = GIC_TARGET ( irq ) ;
}
}
}
else if ( offset < 0xf00 ) {
irq = ( offset - 0xc00 ) * 2 + GIC_BASE_IRQ ;
if ( irq >= s -> num_irq ) goto bad_reg ;
res = 0 ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
if ( GIC_TEST_MODEL ( irq + i ) ) res |= ( 1 << ( i * 2 ) ) ;
if ( GIC_TEST_TRIGGER ( irq + i ) ) res |= ( 2 << ( i * 2 ) ) ;
}
}
else if ( offset < 0xfe0 ) {
goto bad_reg ;
}
else {
if ( offset & 3 ) {
res = 0 ;
}
else {
res = gic_id [ ( offset - 0xfe0 ) >> 2 ] ;
}
}
return res ;
bad_reg : qemu_log_mask ( LOG_GUEST_ERROR , "gic_dist_readb: Bad offset %x\n" , ( int ) offset ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int mime_field_presence_get ( MIMEHdrImpl * h , const char * well_known_str ) {
uint64_t mask = mime_field_presence_mask ( well_known_str ) ;
return ( ( mask == 0 ) ? 1 : ( ( h -> m_presence_bits & mask ) == 0 ? 0 : 1 ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void qemu_mutex_lock_iothread ( void ) {
if ( ! tcg_enabled ( ) ) {
qemu_mutex_lock ( & qemu_global_mutex ) ;
}
else {
iothread_requesting_mutex = true ;
if ( qemu_mutex_trylock ( & qemu_global_mutex ) ) {
qemu_cpu_kick_thread ( ENV_GET_CPU ( first_cpu ) ) ;
qemu_mutex_lock ( & qemu_global_mutex ) ;
}
iothread_requesting_mutex = false ;
qemu_cond_broadcast ( & qemu_io_proceeded_cond ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static my_bool query_int_variable ( MYSQL * con , const char * var_name , int * var_value ) {
char str [ 32 ] ;
my_bool is_null = query_str_variable ( con , var_name , str , sizeof ( str ) ) ;
if ( ! is_null ) * var_value = atoi ( str ) ;
return is_null ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void xps_parse_arc_segment ( fz_context * doc , fz_path * path , fz_xml * root , int stroking , int * skipped_stroke ) {
float rotation_angle ;
int is_large_arc , is_clockwise ;
float point_x , point_y ;
float size_x , size_y ;
int is_stroked ;
char * point_att = fz_xml_att ( root , "Point" ) ;
char * size_att = fz_xml_att ( root , "Size" ) ;
char * rotation_angle_att = fz_xml_att ( root , "RotationAngle" ) ;
char * is_large_arc_att = fz_xml_att ( root , "IsLargeArc" ) ;
char * sweep_direction_att = fz_xml_att ( root , "SweepDirection" ) ;
char * is_stroked_att = fz_xml_att ( root , "IsStroked" ) ;
if ( ! point_att || ! size_att || ! rotation_angle_att || ! is_large_arc_att || ! sweep_direction_att ) {
fz_warn ( doc , "ArcSegment element is missing attributes" ) ;
return ;
}
is_stroked = 1 ;
if ( is_stroked_att && ! strcmp ( is_stroked_att , "false" ) ) is_stroked = 0 ;
if ( ! is_stroked ) * skipped_stroke = 1 ;
point_x = point_y = 0 ;
size_x = size_y = 0 ;
xps_parse_point ( point_att , & point_x , & point_y ) ;
xps_parse_point ( size_att , & size_x , & size_y ) ;
rotation_angle = fz_atof ( rotation_angle_att ) ;
is_large_arc = ! strcmp ( is_large_arc_att , "true" ) ;
is_clockwise = ! strcmp ( sweep_direction_att , "Clockwise" ) ;
if ( stroking && ! is_stroked ) {
fz_moveto ( doc , path , point_x , point_y ) ;
return ;
}
xps_draw_arc ( doc , path , size_x , size_y , rotation_angle , is_large_arc , is_clockwise , point_x , point_y ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dovec ( struct vars * v , struct cvec * cv , struct state * lp , struct state * rp ) {
chr ch , from , to ;
const chr * p ;
int i ;
for ( p = cv -> chrs , i = cv -> nchrs ;
i > 0 ;
p ++ , i -- ) {
ch = * p ;
newarc ( v -> nfa , PLAIN , subcolor ( v -> cm , ch ) , lp , rp ) ;
}
for ( p = cv -> ranges , i = cv -> nranges ;
i > 0 ;
p += 2 , i -- ) {
from = * p ;
to = * ( p + 1 ) ;
if ( from <= to ) subrange ( v , from , to , lp , rp ) ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static struct isoent * isoent_new ( struct isofile * file ) {
struct isoent * isoent ;
static const struct archive_rb_tree_ops rb_ops = {
isoent_cmp_node , isoent_cmp_key , }
;
isoent = calloc ( 1 , sizeof ( * isoent ) ) ;
if ( isoent == NULL ) return ( NULL ) ;
isoent -> file = file ;
isoent -> children . first = NULL ;
isoent -> children . last = & ( isoent -> children . first ) ;
__archive_rb_tree_init ( & ( isoent -> rbtree ) , & rb_ops ) ;
isoent -> subdirs . first = NULL ;
isoent -> subdirs . last = & ( isoent -> subdirs . first ) ;
isoent -> extr_rec_list . first = NULL ;
isoent -> extr_rec_list . last = & ( isoent -> extr_rec_list . first ) ;
isoent -> extr_rec_list . current = NULL ;
if ( archive_entry_filetype ( file -> entry ) == AE_IFDIR ) isoent -> dir = 1 ;
return ( isoent ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int qemuMonitorTextArbitraryCommand ( qemuMonitorPtr mon , const char * cmd , char * * reply ) {
char * safecmd = NULL ;
int ret ;
if ( ! ( safecmd = qemuMonitorEscapeArg ( cmd ) ) ) {
virReportOOMError ( ) ;
return - 1 ;
}
ret = qemuMonitorHMPCommand ( mon , safecmd , reply ) ;
if ( ret != 0 ) qemuReportError ( VIR_ERR_OPERATION_FAILED , _ ( "failed to run cmd '%s'" ) , safecmd ) ;
VIR_FREE ( safecmd ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void cchip_write ( void * opaque , hwaddr addr , uint64_t v32 , unsigned size ) {
TyphoonState * s = opaque ;
uint64_t val , oldval , newval ;
if ( addr & 4 ) {
val = v32 << 32 | s -> latch_tmp ;
addr ^= 4 ;
}
else {
s -> latch_tmp = v32 ;
return ;
}
switch ( addr ) {
case 0x0000 : break ;
case 0x0040 : break ;
case 0x0080 : newval = oldval = s -> cchip . misc ;
newval &= ~ ( val & 0x10000ff0 ) ;
if ( val & 0x100000 ) {
newval &= ~ 0xff0000ull ;
}
else {
newval |= val & 0x00f00000 ;
if ( ( newval & 0xf0000 ) == 0 ) {
newval |= val & 0xf0000 ;
}
}
newval |= ( val & 0xf000 ) >> 4 ;
newval &= ~ 0xf0000000000ull ;
newval |= val & 0xf0000000000ull ;
s -> cchip . misc = newval ;
if ( ( newval ^ oldval ) & 0xff0 ) {
int i ;
for ( i = 0 ;
i < 4 ;
++ i ) {
AlphaCPU * cpu = s -> cchip . cpu [ i ] ;
if ( cpu != NULL ) {
CPUState * cs = CPU ( cpu ) ;
if ( newval & ( 1 << ( i + 8 ) ) ) {
cpu_interrupt ( cs , CPU_INTERRUPT_SMP ) ;
}
else {
cpu_reset_interrupt ( cs , CPU_INTERRUPT_SMP ) ;
}
if ( ( newval & ( 1 << ( i + 4 ) ) ) == 0 ) {
cpu_reset_interrupt ( cs , CPU_INTERRUPT_TIMER ) ;
}
}
}
}
break ;
case 0x00c0 : break ;
case 0x0100 : case 0x0140 : case 0x0180 : case 0x01c0 : break ;
case 0x0200 : s -> cchip . dim [ 0 ] = val ;
cpu_irq_change ( s -> cchip . cpu [ 0 ] , val & s -> cchip . drir ) ;
break ;
case 0x0240 : s -> cchip . dim [ 0 ] = val ;
cpu_irq_change ( s -> cchip . cpu [ 1 ] , val & s -> cchip . drir ) ;
break ;
case 0x0280 : case 0x02c0 : case 0x0300 : break ;
case 0x0340 : break ;
case 0x0380 : s -> cchip . iic [ 0 ] = val & 0xffffff ;
break ;
case 0x03c0 : s -> cchip . iic [ 1 ] = val & 0xffffff ;
break ;
case 0x0400 : case 0x0440 : case 0x0480 : case 0x04c0 : break ;
case 0x0580 : break ;
case 0x05c0 : break ;
case 0x0600 : s -> cchip . dim [ 2 ] = val ;
cpu_irq_change ( s -> cchip . cpu [ 2 ] , val & s -> cchip . drir ) ;
break ;
case 0x0640 : s -> cchip . dim [ 3 ] = val ;
cpu_irq_change ( s -> cchip . cpu [ 3 ] , val & s -> cchip . drir ) ;
break ;
case 0x0680 : case 0x06c0 : break ;
case 0x0700 : s -> cchip . iic [ 2 ] = val & 0xffffff ;
break ;
case 0x0740 : s -> cchip . iic [ 3 ] = val & 0xffffff ;
break ;
case 0x0780 : break ;
case 0x0c00 : case 0x0c40 : case 0x0c80 : case 0x0cc0 : break ;
default : cpu_unassigned_access ( current_cpu , addr , true , false , 0 , size ) ;
return ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void skip_space ( char * * cpp ) {
char * cp ;
for ( cp = * cpp ;
* cp == ' ' || * cp == '\t' ;
cp ++ ) ;
* cpp = cp ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char ) typedef void * OPENSSL_BLOCK ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_BLOCK , void )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int my_getc ( FILE * file ) {
if ( line_buffer_pos == line_buffer ) return fgetc ( file ) ;
return * -- line_buffer_pos ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ztoken_get_scanner_option ( const ref * psref , int options , const char * * pname ) {
const named_scanner_option_t * pnso ;
for ( pnso = named_options + countof ( named_options ) ;
pnso -- != named_options ;
) {
if ( ! bytes_compare ( ( const byte * ) pnso -> pname , strlen ( pnso -> pname ) , psref -> value . const_bytes , r_size ( psref ) ) ) {
* pname = pnso -> pname ;
return ( options & pnso -> option ? 1 : 0 ) ;
}
}
return - 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dissect_ber_GeneralString ( asn1_ctx_t * actx , proto_tree * tree , tvbuff_t * tvb , int offset , gint hf_id , char * name_string , guint name_len ) {
tvbuff_t * out_tvb = NULL ;
gint tvb_len ;
offset = dissect_ber_restricted_string ( FALSE , BER_UNI_TAG_GeneralString , actx , tree , tvb , offset , hf_id , ( name_string ) ? & out_tvb : NULL ) ;
if ( name_string ) {
if ( out_tvb ) {
tvb_len = tvb_reported_length ( out_tvb ) ;
if ( ( guint ) tvb_len >= name_len ) {
tvb_memcpy ( out_tvb , ( guint8 * ) name_string , 0 , name_len - 1 ) ;
name_string [ name_len - 1 ] = '\0' ;
}
else {
tvb_memcpy ( out_tvb , ( guint8 * ) name_string , 0 , tvb_len ) ;
name_string [ tvb_len ] = '\0' ;
}
}
}
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void read_coef_probs ( FRAME_CONTEXT * fc , TX_MODE tx_mode , vp9_reader * r ) {
const TX_SIZE max_tx_size = tx_mode_to_biggest_tx_size [ tx_mode ] ;
TX_SIZE tx_size ;
for ( tx_size = TX_4X4 ;
tx_size <= max_tx_size ;
++ tx_size ) read_coef_probs_common ( fc -> coef_probs [ tx_size ] , r ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void xhci_detach ( USBPort * usbport ) {
XHCIState * xhci = usbport -> opaque ;
XHCIPort * port = xhci_lookup_port ( xhci , usbport ) ;
xhci_detach_slot ( xhci , usbport ) ;
xhci_port_update ( port , 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_coap_opt_uri_path ( tvbuff_t * tvb , proto_item * head_item , proto_tree * subtree , gint offset , gint opt_length , coap_info * coinfo , int hf ) {
const guint8 * str = NULL ;
wmem_strbuf_append_c ( coinfo -> uri_str_strbuf , '/' ) ;
if ( opt_length == 0 ) {
str = nullstr ;
}
else {
str = tvb_get_string_enc ( wmem_packet_scope ( ) , tvb , offset , opt_length , ENC_ASCII ) ;
wmem_strbuf_append ( coinfo -> uri_str_strbuf , str ) ;
}
proto_tree_add_string ( subtree , hf , tvb , offset , opt_length , str ) ;
proto_item_append_text ( head_item , ": %s" , str ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool ps2_keyboard_ledstate_needed ( void * opaque ) {
PS2KbdState * s = opaque ;
return s -> ledstate != 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_rsl_ie_req_ref ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset , gboolean is_mandatory ) {
proto_tree * ie_tree ;
guint8 ie_id ;
if ( is_mandatory == FALSE ) {
ie_id = tvb_get_guint8 ( tvb , offset ) ;
if ( ie_id != RSL_IE_REQ_REF ) return offset ;
}
ie_tree = proto_tree_add_subtree ( tree , tvb , offset , 4 , ett_ie_req_ref , NULL , "Request Reference IE " ) ;
proto_tree_add_item ( ie_tree , hf_rsl_ie_id , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
proto_tree_add_item ( ie_tree , hf_rsl_req_ref_ra , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
proto_tree_add_item ( ie_tree , hf_rsl_req_ref_T1prim , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ie_tree , hf_rsl_req_ref_T3 , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset ++ ;
proto_tree_add_item ( ie_tree , hf_rsl_req_ref_T2 , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void write_segment_id ( vp9_writer * w , const struct segmentation * seg , int segment_id ) {
if ( seg -> enabled && seg -> update_map ) vp9_write_tree ( w , vp9_segment_tree , seg -> tree_probs , segment_id , 3 , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static vpx_codec_err_t ctrl_update_entropy ( vpx_codec_alg_priv_t * ctx , va_list args ) {
const int update = va_arg ( args , int ) ;
vp9_update_entropy ( ctx -> cpi , update ) ;
return VPX_CODEC_OK ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void ngsniffer_sequential_close ( wtap * wth ) {
ngsniffer_t * ngsniffer ;
ngsniffer = ( ngsniffer_t * ) wth -> priv ;
if ( ngsniffer -> seq . buf != NULL ) {
g_free ( ngsniffer -> seq . buf ) ;
ngsniffer -> seq . buf = NULL ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_pvfs_io_type ( tvbuff_t * tvb , proto_tree * tree , int offset ) {
proto_tree_add_item ( tree , hf_pvfs_io_type , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( ExtensionServiceSyncTest , DeferredSyncStartupPreInstalledNormal ) {
InitializeGoodInstalledExtensionService ( ) ;
bool flare_was_called = false ;
syncer : : ModelType triggered_type ( syncer : : UNSPECIFIED ) ;
base : : WeakPtrFactory < ExtensionServiceSyncTest > factory ( this ) ;
extension_sync_service ( ) -> SetSyncStartFlareForTesting ( base : : Bind ( & ExtensionServiceSyncTest : : MockSyncStartFlare , factory . GetWeakPtr ( ) , & flare_was_called , & triggered_type ) ) ;
ASSERT_FALSE ( service ( ) -> is_ready ( ) ) ;
service ( ) -> Init ( ) ;
ASSERT_EQ ( 3u , loaded_ . size ( ) ) ;
ASSERT_TRUE ( service ( ) -> is_ready ( ) ) ;
EXPECT_FALSE ( flare_was_called ) ;
ASSERT_EQ ( syncer : : UNSPECIFIED , triggered_type ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( BudgetDatabaseTest , CheckBackgroundBudgetHistogram ) {
base : : SimpleTestClock * clock = SetClockForTesting ( ) ;
SetSiteEngagementScore ( kEngagement ) ;
GetBudgetDetails ( ) ;
clock -> Advance ( base : : TimeDelta : : FromDays ( kDefaultExpirationInDays / 2 ) ) ;
GetBudgetDetails ( ) ;
clock -> Advance ( base : : TimeDelta : : FromMinutes ( 59 ) ) ;
GetBudgetDetails ( ) ;
clock -> Advance ( base : : TimeDelta : : FromDays ( kDefaultExpirationInDays + 1 ) ) ;
GetBudgetDetails ( ) ;
std : : vector < base : : Bucket > buckets = GetHistogramTester ( ) -> GetAllSamples ( "PushMessaging.BackgroundBudget" ) ;
ASSERT_EQ ( 2U , buckets . size ( ) ) ;
double full_award = kMaxDailyBudget * kEngagement / SiteEngagementScore : : kMaxPoints * kDefaultExpirationInDays ;
EXPECT_EQ ( floor ( full_award ) , buckets [ 0 ] . min ) ;
EXPECT_EQ ( 2 , buckets [ 0 ] . count ) ;
EXPECT_EQ ( floor ( full_award * 1.5 ) , buckets [ 1 ] . min ) ;
EXPECT_EQ ( 1 , buckets [ 1 ] . count ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static char * stp_print_bridge_id ( const u_char * p ) {
static char bridge_id_str [ sizeof ( "pppp.aa:bb:cc:dd:ee:ff" ) ] ;
snprintf ( bridge_id_str , sizeof ( bridge_id_str ) , "%.2x%.2x.%.2x:%.2x:%.2x:%.2x:%.2x:%.2x" , p [ 0 ] , p [ 1 ] , p [ 2 ] , p [ 3 ] , p [ 4 ] , p [ 5 ] , p [ 6 ] , p [ 7 ] ) ;
return bridge_id_str ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void stroke_loglevel ( private_stroke_socket_t * this , stroke_msg_t * msg , FILE * out ) {
debug_t group ;
pop_string ( msg , & ( msg -> loglevel . type ) ) ;
DBG1 ( DBG_CFG , "received stroke: loglevel %d for %s" , msg -> loglevel . level , msg -> loglevel . type ) ;
if ( this -> prevent_loglevel_changes ) {
DBG1 ( DBG_CFG , "prevented log level change" ) ;
fprintf ( out , "command not allowed!\n" ) ;
return ;
}
if ( ! enum_from_name ( debug_names , msg -> loglevel . type , & group ) ) {
fprintf ( out , "unknown type '%s'!\n" , msg -> loglevel . type ) ;
return ;
}
charon -> set_level ( charon , group , msg -> loglevel . level ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ipvideo_decode_block_opcode_0xA_16 ( IpvideoContext * s , AVFrame * frame ) {
int x , y ;
uint16_t P [ 8 ] ;
int flags = 0 ;
uint16_t * pixel_ptr = ( uint16_t * ) s -> pixel_ptr ;
for ( x = 0 ;
x < 4 ;
x ++ ) P [ x ] = bytestream2_get_le16 ( & s -> stream_ptr ) ;
if ( ! ( P [ 0 ] & 0x8000 ) ) {
for ( y = 0 ;
y < 16 ;
y ++ ) {
if ( ! ( y & 3 ) ) {
if ( y ) for ( x = 0 ;
x < 4 ;
x ++ ) P [ x ] = bytestream2_get_le16 ( & s -> stream_ptr ) ;
flags = bytestream2_get_le32 ( & s -> stream_ptr ) ;
}
for ( x = 0 ;
x < 4 ;
x ++ , flags >>= 2 ) * pixel_ptr ++ = P [ flags & 0x03 ] ;
pixel_ptr += s -> stride - 4 ;
if ( y == 7 ) pixel_ptr -= 8 * s -> stride - 4 ;
}
}
else {
int vert ;
uint64_t flags = bytestream2_get_le64 ( & s -> stream_ptr ) ;
for ( x = 4 ;
x < 8 ;
x ++ ) P [ x ] = bytestream2_get_le16 ( & s -> stream_ptr ) ;
vert = ! ( P [ 4 ] & 0x8000 ) ;
for ( y = 0 ;
y < 16 ;
y ++ ) {
for ( x = 0 ;
x < 4 ;
x ++ , flags >>= 2 ) * pixel_ptr ++ = P [ flags & 0x03 ] ;
if ( vert ) {
pixel_ptr += s -> stride - 4 ;
if ( y == 7 ) pixel_ptr -= 8 * s -> stride - 4 ;
}
else if ( y & 1 ) pixel_ptr += s -> line_inc ;
if ( y == 7 ) {
memcpy ( P , P + 4 , 8 ) ;
flags = bytestream2_get_le64 ( & s -> stream_ptr ) ;
}
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static struct object_list * * process_tree ( struct tree * tree , struct object_list * * p ) {
struct object * obj = & tree -> object ;
struct tree_desc desc ;
struct name_entry entry ;
obj -> flags |= LOCAL ;
if ( obj -> flags & ( UNINTERESTING | SEEN ) ) return p ;
if ( parse_tree ( tree ) < 0 ) die ( "bad tree object %s" , oid_to_hex ( & obj -> oid ) ) ;
obj -> flags |= SEEN ;
p = add_one_object ( obj , p ) ;
init_tree_desc ( & desc , tree -> buffer , tree -> size ) ;
while ( tree_entry ( & desc , & entry ) ) switch ( object_type ( entry . mode ) ) {
case OBJ_TREE : p = process_tree ( lookup_tree ( entry . sha1 ) , p ) ;
break ;
case OBJ_BLOB : p = process_blob ( lookup_blob ( entry . sha1 ) , p ) ;
break ;
default : break ;
}
free_tree_buffer ( tree ) ;
return p ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_udvm_reference_operand_memory ( guint8 * buff , guint operand_address , guint16 * value , guint * result_dest ) {
guint bytecode ;
guint16 operand ;
guint offset = operand_address ;
guint test_bits ;
guint8 temp_data ;
guint16 temp_data16 ;
bytecode = buff [ operand_address ] ;
test_bits = bytecode >> 7 ;
if ( test_bits == 1 ) {
test_bits = bytecode >> 6 ;
if ( test_bits == 2 ) {
temp_data = buff [ operand_address ] & 0x3f ;
operand = temp_data << 8 ;
temp_data = buff [ ( operand_address + 1 ) & 0xffff ] ;
operand = operand | temp_data ;
operand = ( operand * 2 ) ;
* result_dest = operand ;
temp_data16 = buff [ operand ] << 8 ;
temp_data16 = temp_data16 | buff [ ( operand + 1 ) & 0xffff ] ;
* value = temp_data16 ;
offset = offset + 2 ;
}
else {
operand_address ++ ;
operand = buff [ operand_address ] << 8 ;
operand = operand | buff [ ( operand_address + 1 ) & 0xffff ] ;
* result_dest = operand ;
temp_data16 = buff [ operand ] << 8 ;
temp_data16 = temp_data16 | buff [ ( operand + 1 ) & 0xffff ] ;
* value = temp_data16 ;
offset = offset + 3 ;
}
}
else {
operand = ( bytecode & 0x7f ) ;
operand = ( operand * 2 ) ;
* result_dest = operand ;
temp_data16 = buff [ operand ] << 8 ;
temp_data16 = temp_data16 | buff [ ( operand + 1 ) & 0xffff ] ;
* value = temp_data16 ;
offset ++ ;
}
if ( offset >= UDVM_MEMORY_SIZE || * result_dest >= UDVM_MEMORY_SIZE - 1 ) return 0 ;
return offset ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int tipc_nl_compat_handle ( struct tipc_nl_compat_msg * msg ) {
struct tipc_nl_compat_cmd_dump dump ;
struct tipc_nl_compat_cmd_doit doit ;
memset ( & dump , 0 , sizeof ( dump ) ) ;
memset ( & doit , 0 , sizeof ( doit ) ) ;
switch ( msg -> cmd ) {
case TIPC_CMD_NOOP : msg -> rep = tipc_tlv_alloc ( 0 ) ;
if ( ! msg -> rep ) return - ENOMEM ;
return 0 ;
case TIPC_CMD_GET_BEARER_NAMES : msg -> rep_size = MAX_BEARERS * TLV_SPACE ( TIPC_MAX_BEARER_NAME ) ;
dump . dumpit = tipc_nl_bearer_dump ;
dump . format = tipc_nl_compat_bearer_dump ;
return tipc_nl_compat_dumpit ( & dump , msg ) ;
case TIPC_CMD_ENABLE_BEARER : msg -> req_type = TIPC_TLV_BEARER_CONFIG ;
doit . doit = tipc_nl_bearer_enable ;
doit . transcode = tipc_nl_compat_bearer_enable ;
return tipc_nl_compat_doit ( & doit , msg ) ;
case TIPC_CMD_DISABLE_BEARER : msg -> req_type = TIPC_TLV_BEARER_NAME ;
doit . doit = tipc_nl_bearer_disable ;
doit . transcode = tipc_nl_compat_bearer_disable ;
return tipc_nl_compat_doit ( & doit , msg ) ;
case TIPC_CMD_SHOW_LINK_STATS : msg -> req_type = TIPC_TLV_LINK_NAME ;
msg -> rep_size = ULTRA_STRING_MAX_LEN ;
msg -> rep_type = TIPC_TLV_ULTRA_STRING ;
dump . dumpit = tipc_nl_node_dump_link ;
dump . format = tipc_nl_compat_link_stat_dump ;
return tipc_nl_compat_dumpit ( & dump , msg ) ;
case TIPC_CMD_GET_LINKS : msg -> req_type = TIPC_TLV_NET_ADDR ;
msg -> rep_size = ULTRA_STRING_MAX_LEN ;
dump . dumpit = tipc_nl_node_dump_link ;
dump . format = tipc_nl_compat_link_dump ;
return tipc_nl_compat_dumpit ( & dump , msg ) ;
case TIPC_CMD_SET_LINK_TOL : case TIPC_CMD_SET_LINK_PRI : case TIPC_CMD_SET_LINK_WINDOW : msg -> req_type = TIPC_TLV_LINK_CONFIG ;
doit . doit = tipc_nl_node_set_link ;
doit . transcode = tipc_nl_compat_link_set ;
return tipc_nl_compat_doit ( & doit , msg ) ;
case TIPC_CMD_RESET_LINK_STATS : msg -> req_type = TIPC_TLV_LINK_NAME ;
doit . doit = tipc_nl_node_reset_link_stats ;
doit . transcode = tipc_nl_compat_link_reset_stats ;
return tipc_nl_compat_doit ( & doit , msg ) ;
case TIPC_CMD_SHOW_NAME_TABLE : msg -> req_type = TIPC_TLV_NAME_TBL_QUERY ;
msg -> rep_size = ULTRA_STRING_MAX_LEN ;
msg -> rep_type = TIPC_TLV_ULTRA_STRING ;
dump . header = tipc_nl_compat_name_table_dump_header ;
dump . dumpit = tipc_nl_name_table_dump ;
dump . format = tipc_nl_compat_name_table_dump ;
return tipc_nl_compat_dumpit ( & dump , msg ) ;
case TIPC_CMD_SHOW_PORTS : msg -> rep_size = ULTRA_STRING_MAX_LEN ;
msg -> rep_type = TIPC_TLV_ULTRA_STRING ;
dump . dumpit = tipc_nl_sk_dump ;
dump . format = tipc_nl_compat_sk_dump ;
return tipc_nl_compat_dumpit ( & dump , msg ) ;
case TIPC_CMD_GET_MEDIA_NAMES : msg -> rep_size = MAX_MEDIA * TLV_SPACE ( TIPC_MAX_MEDIA_NAME ) ;
dump . dumpit = tipc_nl_media_dump ;
dump . format = tipc_nl_compat_media_dump ;
return tipc_nl_compat_dumpit ( & dump , msg ) ;
case TIPC_CMD_GET_NODES : msg -> rep_size = ULTRA_STRING_MAX_LEN ;
dump . dumpit = tipc_nl_node_dump ;
dump . format = tipc_nl_compat_node_dump ;
return tipc_nl_compat_dumpit ( & dump , msg ) ;
case TIPC_CMD_SET_NODE_ADDR : msg -> req_type = TIPC_TLV_NET_ADDR ;
doit . doit = tipc_nl_net_set ;
doit . transcode = tipc_nl_compat_net_set ;
return tipc_nl_compat_doit ( & doit , msg ) ;
case TIPC_CMD_SET_NETID : msg -> req_type = TIPC_TLV_UNSIGNED ;
doit . doit = tipc_nl_net_set ;
doit . transcode = tipc_nl_compat_net_set ;
return tipc_nl_compat_doit ( & doit , msg ) ;
case TIPC_CMD_GET_NETID : msg -> rep_size = sizeof ( u32 ) ;
dump . dumpit = tipc_nl_net_dump ;
dump . format = tipc_nl_compat_net_dump ;
return tipc_nl_compat_dumpit ( & dump , msg ) ;
case TIPC_CMD_SHOW_STATS : return tipc_cmd_show_stats_compat ( msg ) ;
}
return - EOPNOTSUPP ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
voip_calls_tapinfo_t * voip_calls_get_info ( void ) {
return & the_tapinfo_struct ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_answer_records ( tvbuff_t * tvb , int cur_off , int dns_data_offset , int count , column_info * cinfo , proto_tree * dns_tree , const char * name , packet_info * pinfo , gboolean is_mdns ) {
int start_off , add_off ;
proto_tree * qatree = NULL ;
proto_item * ti = NULL ;
start_off = cur_off ;
if ( dns_tree ) {
qatree = proto_tree_add_subtree ( dns_tree , tvb , start_off , - 1 , ett_dns_ans , & ti , name ) ;
}
while ( count -- > 0 ) {
add_off = dissect_dns_answer ( tvb , cur_off , dns_data_offset , cinfo , qatree , pinfo , is_mdns ) ;
cur_off += add_off ;
}
if ( ti ) {
proto_item_set_len ( ti , cur_off - start_off ) ;
}
return cur_off - start_off ;
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.