instruction
stringclasses 1
value | input
stringlengths 31
235k
| output
class label 2
classes |
---|---|---|
Categorize the following code snippet as vulnerable or not. True or False
|
static void btatt_handle_prompt ( packet_info * pinfo , gchar * result ) {
guint16 * value_data ;
value_data = ( guint16 * ) p_get_proto_data ( pinfo -> pool , pinfo , proto_btatt , PROTO_DATA_BTATT_HANDLE ) ;
if ( value_data ) g_snprintf ( result , MAX_DECODE_AS_PROMPT_LEN , "ATT Handle 0x%04x as" , ( guint ) * value_data ) ;
else g_snprintf ( result , MAX_DECODE_AS_PROMPT_LEN , "Unknown ATT Handle" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int event_base_loopbreak ( struct event_base * event_base ) {
if ( event_base == NULL ) return ( - 1 ) ;
event_base -> event_break = 1 ;
return ( 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int unpack_SQVH ( COOKContext * q , COOKSubpacket * p , int category , int * subband_coef_index , int * subband_coef_sign ) {
int i , j ;
int vlc , vd , tmp , result ;
vd = vd_tab [ category ] ;
result = 0 ;
for ( i = 0 ;
i < vpr_tab [ category ] ;
i ++ ) {
vlc = get_vlc2 ( & q -> gb , q -> sqvh [ category ] . table , q -> sqvh [ category ] . bits , 3 ) ;
if ( p -> bits_per_subpacket < get_bits_count ( & q -> gb ) ) {
vlc = 0 ;
result = 1 ;
}
for ( j = vd - 1 ;
j >= 0 ;
j -- ) {
tmp = ( vlc * invradix_tab [ category ] ) / 0x100000 ;
subband_coef_index [ vd * i + j ] = vlc - tmp * ( kmax_tab [ category ] + 1 ) ;
vlc = tmp ;
}
for ( j = 0 ;
j < vd ;
j ++ ) {
if ( subband_coef_index [ i * vd + j ] ) {
if ( get_bits_count ( & q -> gb ) < p -> bits_per_subpacket ) {
subband_coef_sign [ i * vd + j ] = get_bits1 ( & q -> gb ) ;
}
else {
result = 1 ;
subband_coef_sign [ i * vd + j ] = 0 ;
}
}
else {
subband_coef_sign [ i * vd + j ] = 0 ;
}
}
}
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void remoteDispatchCopyError ( remote_error * rerr , virErrorPtr verr ) {
rerr -> code = verr -> code ;
rerr -> domain = verr -> domain ;
rerr -> message = verr -> message ? malloc ( sizeof ( char * ) ) : NULL ;
if ( rerr -> message ) * rerr -> message = strdup ( verr -> message ) ;
rerr -> level = verr -> level ;
rerr -> str1 = verr -> str1 ? malloc ( sizeof ( char * ) ) : NULL ;
if ( rerr -> str1 ) * rerr -> str1 = strdup ( verr -> str1 ) ;
rerr -> str2 = verr -> str2 ? malloc ( sizeof ( char * ) ) : NULL ;
if ( rerr -> str2 ) * rerr -> str2 = strdup ( verr -> str2 ) ;
rerr -> str3 = verr -> str3 ? malloc ( sizeof ( char * ) ) : NULL ;
if ( rerr -> str3 ) * rerr -> str3 = strdup ( verr -> str3 ) ;
rerr -> int1 = verr -> int1 ;
rerr -> int2 = verr -> int2 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int PEM_write_bio_ ## name ( BIO * bp , type * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
# define DECLARE_PEM_write ( name , type ) DECLARE_PEM_write_bio ( name , type ) DECLARE_PEM_write_fp ( name , type ) # define DECLARE_PEM_write_const ( name , type ) DECLARE_PEM_write_bio_const ( name , type ) DECLARE_PEM_write_fp_const ( name , type ) # define DECLARE_PEM_write_cb ( name , type ) DECLARE_PEM_write_cb_bio ( name , type ) DECLARE_PEM_write_cb_fp ( name , type ) # define DECLARE_PEM_read ( name , type ) DECLARE_PEM_read_bio ( name , type ) DECLARE_PEM_read_fp ( name , type ) # define DECLARE_PEM_rw ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write ( name , type ) # define DECLARE_PEM_rw_const ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write_const ( name , type ) # define DECLARE_PEM_rw_cb ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write_cb ( name , type ) typedef int pem_password_cb ( char * buf , int size , int rwflag , void * userdata ) ;
int PEM_get_EVP_CIPHER_INFO ( char * header , EVP_CIPHER_INFO * cipher ) ;
int PEM_do_header ( EVP_CIPHER_INFO * cipher , unsigned char * data , long * len , pem_password_cb * callback , void * u ) ;
int PEM_read_bio ( BIO * bp , char * * name , char * * header , unsigned char * * data , long * len ) ;
# define PEM_FLAG_SECURE 0x1 # define PEM_FLAG_EAY_COMPATIBLE 0x2 # define PEM_FLAG_ONLY_B64 0x4 int PEM_read_bio_ex ( BIO * bp , char * * name , char * * header , unsigned char * * data , long * len , unsigned int flags ) ;
int PEM_bytes_read_bio_secmem ( unsigned char * * pdata , long * plen , char * * pnm , const char * name , BIO * bp , pem_password_cb * cb , void * u ) ;
int PEM_write_bio ( BIO * bp , const char * name , const char * hdr , const unsigned char * data , long len ) ;
int PEM_bytes_read_bio ( unsigned char * * pdata , long * plen , char * * pnm , const char * name , BIO * bp , pem_password_cb * cb , void * u ) ;
void * PEM_ASN1_read_bio ( d2i_of_void * d2i , const char * name , BIO * bp , void * * x , pem_password_cb * cb , void * u ) ;
int PEM_ASN1_write_bio ( i2d_of_void * i2d , const char * name , BIO * bp , void * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
STACK_OF ( X509_INFO ) * PEM_X509_INFO_read_bio ( BIO * bp , STACK_OF ( X509_INFO ) * sk , pem_password_cb * cb , void * u ) ;
int PEM_X509_INFO_write_bio ( BIO * bp , X509_INFO * xi , EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cd , void * u ) ;
# ifndef OPENSSL_NO_STDIO int PEM_read ( FILE * fp , char * * name , char * * header , unsigned char * * data , long * len ) ;
int PEM_write ( FILE * fp , const char * name , const char * hdr , const unsigned char * data , long len ) ;
void * PEM_ASN1_read ( d2i_of_void * d2i , const char * name , FILE * fp , void * * x , pem_password_cb * cb , void * u ) ;
int PEM_ASN1_write ( i2d_of_void * i2d , const char * name , FILE * fp , void * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * callback , void * u ) ;
STACK_OF ( X509_INFO ) * PEM_X509_INFO_read ( FILE * fp , STACK_OF ( X509_INFO ) * sk , pem_password_cb * cb , void * u ) ;
# endif int PEM_SignInit ( EVP_MD_CTX * ctx , EVP_MD * type ) ;
int PEM_SignUpdate ( EVP_MD_CTX * ctx , unsigned char * d , unsigned int cnt ) ;
int PEM_SignFinal ( EVP_MD_CTX * ctx , unsigned char * sigret , unsigned int * siglen , EVP_PKEY * pkey ) ;
int PEM_def_callback ( char * buf , int num , int rwflag , void * userdata ) ;
void PEM_proc_type ( char * buf , int type ) ;
void PEM_dek_info ( char * buf , const char * type , int len , char * str ) ;
# include < openssl / symhacks . h > DECLARE_PEM_rw ( X509 , X509 ) DECLARE_PEM_rw ( X509_AUX , X509 ) DECLARE_PEM_rw ( X509_REQ , X509_REQ ) DECLARE_PEM_write ( X509_REQ_NEW , X509_REQ ) DECLARE_PEM_rw ( X509_CRL , X509_CRL ) DECLARE_PEM_rw ( PKCS7 , PKCS7 ) DECLARE_PEM_rw ( NETSCAPE_CERT_SEQUENCE , NETSCAPE_CERT_SEQUENCE ) DECLARE_PEM_rw ( PKCS8 , X509_SIG ) DECLARE_PEM_rw ( PKCS8_PRIV_KEY_INFO , PKCS8_PRIV_KEY_INFO ) # ifndef OPENSSL_NO_RSA DECLARE_PEM_rw_cb ( RSAPrivateKey , RSA )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int encode_frame ( AVCodecContext * c , AVFrame * frame ) {
AVPacket pkt = {
0 }
;
int ret , got_output ;
av_init_packet ( & pkt ) ;
ret = avcodec_encode_video2 ( c , & pkt , frame , & got_output ) ;
if ( ret < 0 ) return ret ;
ret = pkt . size ;
av_free_packet ( & pkt ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean prefix_equal ( gconstpointer ap , gconstpointer bp ) {
const gchar * a = ( const gchar * ) ap ;
const gchar * b = ( const gchar * ) bp ;
do {
gchar ac = * a ++ ;
gchar bc = * b ++ ;
if ( ( ac == '.' || ac == '\0' ) && ( bc == '.' || bc == '\0' ) ) return TRUE ;
if ( ( ac == '.' || ac == '\0' ) && ! ( bc == '.' || bc == '\0' ) ) return FALSE ;
if ( ( bc == '.' || bc == '\0' ) && ! ( ac == '.' || ac == '\0' ) ) return FALSE ;
if ( ac != bc ) return FALSE ;
}
while ( 1 ) ;
return FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_H248PackagesDescriptor ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_octet_string ( tvb , offset , actx , tree , hf_index , NO_BOUND , NO_BOUND , FALSE , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void sub_left_prediction_rgb24 ( HYuvContext * s , uint8_t * dst , const uint8_t * src , int w , int * red , int * green , int * blue ) {
int i ;
int r , g , b ;
r = * red ;
g = * green ;
b = * blue ;
for ( i = 0 ;
i < FFMIN ( w , 16 ) ;
i ++ ) {
const int rt = src [ i * 3 + 0 ] ;
const int gt = src [ i * 3 + 1 ] ;
const int bt = src [ i * 3 + 2 ] ;
dst [ i * 3 + 0 ] = rt - r ;
dst [ i * 3 + 1 ] = gt - g ;
dst [ i * 3 + 2 ] = bt - b ;
r = rt ;
g = gt ;
b = bt ;
}
s -> dsp . diff_bytes ( dst + 48 , src + 48 , src + 48 - 3 , w * 3 - 48 ) ;
* red = src [ ( w - 1 ) * 3 + 0 ] ;
* green = src [ ( w - 1 ) * 3 + 1 ] ;
* blue = src [ ( w - 1 ) * 3 + 2 ] ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int i2d_ECPKParameters ( const EC_GROUP * a , unsigned char * * out ) {
int ret = 0 ;
ECPKPARAMETERS * tmp = ec_asn1_group2pkparameters ( a , NULL ) ;
if ( tmp == NULL ) {
ECerr ( EC_F_I2D_ECPKPARAMETERS , EC_R_GROUP2PKPARAMETERS_FAILURE ) ;
return 0 ;
}
if ( ( ret = i2d_ECPKPARAMETERS ( tmp , out ) ) == 0 ) {
ECerr ( EC_F_I2D_ECPKPARAMETERS , EC_R_I2D_ECPKPARAMETERS_FAILURE ) ;
ECPKPARAMETERS_free ( tmp ) ;
return 0 ;
}
ECPKPARAMETERS_free ( tmp ) ;
return ( ret ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int _evdns_nameserver_add_impl ( unsigned long int address , int port ) {
const struct nameserver * server = server_head , * const started_at = server_head ;
struct nameserver * ns ;
int err = 0 ;
if ( server ) {
do {
if ( server -> address == address ) return 3 ;
server = server -> next ;
}
while ( server != started_at ) ;
}
ns = ( struct nameserver * ) malloc ( sizeof ( struct nameserver ) ) ;
if ( ! ns ) return - 1 ;
memset ( ns , 0 , sizeof ( struct nameserver ) ) ;
evtimer_set ( & ns -> timeout_event , nameserver_prod_callback , ns ) ;
ns -> socket = socket ( PF_INET , SOCK_DGRAM , 0 ) ;
if ( ns -> socket < 0 ) {
err = 1 ;
goto out1 ;
}
FD_CLOSEONEXEC ( ns -> socket ) ;
evutil_make_socket_nonblocking ( ns -> socket ) ;
ns -> address = address ;
ns -> port = htons ( port ) ;
ns -> state = 1 ;
event_set ( & ns -> event , ns -> socket , EV_READ | EV_PERSIST , nameserver_ready_callback , ns ) ;
if ( event_add ( & ns -> event , NULL ) < 0 ) {
err = 2 ;
goto out2 ;
}
log ( EVDNS_LOG_DEBUG , "Added nameserver %s" , debug_ntoa ( address ) ) ;
if ( ! server_head ) {
ns -> next = ns -> prev = ns ;
server_head = ns ;
}
else {
ns -> next = server_head -> next ;
ns -> prev = server_head ;
server_head -> next = ns ;
if ( server_head -> prev == server_head ) {
server_head -> prev = ns ;
}
}
global_good_nameservers ++ ;
return 0 ;
out2 : CLOSE_SOCKET ( ns -> socket ) ;
out1 : free ( ns ) ;
log ( EVDNS_LOG_WARN , "Unable to add nameserver %s: error %d" , debug_ntoa ( address ) , err ) ;
return err ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void loop_filter_rows_mt ( const YV12_BUFFER_CONFIG * const frame_buffer , VP9_COMMON * const cm , struct macroblockd_plane planes [ MAX_MB_PLANE ] , int start , int stop , int y_only , VP9LfSync * const lf_sync , int num_lf_workers ) {
const int num_planes = y_only ? 1 : MAX_MB_PLANE ;
int r , c ;
const int sb_cols = mi_cols_aligned_to_sb ( cm -> mi_cols ) >> MI_BLOCK_SIZE_LOG2 ;
for ( r = start ;
r < stop ;
r += num_lf_workers ) {
const int mi_row = r << MI_BLOCK_SIZE_LOG2 ;
MODE_INFO * * const mi = cm -> mi_grid_visible + mi_row * cm -> mi_stride ;
for ( c = 0 ;
c < sb_cols ;
++ c ) {
const int mi_col = c << MI_BLOCK_SIZE_LOG2 ;
LOOP_FILTER_MASK lfm ;
int plane ;
sync_read ( lf_sync , r , c ) ;
vp9_setup_dst_planes ( planes , frame_buffer , mi_row , mi_col ) ;
vp9_setup_mask ( cm , mi_row , mi_col , mi + mi_col , cm -> mi_stride , & lfm ) ;
for ( plane = 0 ;
plane < num_planes ;
++ plane ) {
vp9_filter_block_plane ( cm , & planes [ plane ] , mi_row , & lfm ) ;
}
sync_write ( lf_sync , r , c , sb_cols ) ;
}
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int vp9_get_segment_id ( const VP9_COMMON * cm , const uint8_t * segment_ids , BLOCK_SIZE bsize , int mi_row , int mi_col ) {
const int mi_offset = mi_row * cm -> mi_cols + mi_col ;
const int bw = num_8x8_blocks_wide_lookup [ bsize ] ;
const int bh = num_8x8_blocks_high_lookup [ bsize ] ;
const int xmis = MIN ( cm -> mi_cols - mi_col , bw ) ;
const int ymis = MIN ( cm -> mi_rows - mi_row , bh ) ;
int x , y , segment_id = INT_MAX ;
for ( y = 0 ;
y < ymis ;
y ++ ) for ( x = 0 ;
x < xmis ;
x ++ ) segment_id = MIN ( segment_id , segment_ids [ mi_offset + y * cm -> mi_cols + x ] ) ;
assert ( segment_id >= 0 && segment_id < MAX_SEGMENTS ) ;
return segment_id ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int jas_image_addcmpt ( jas_image_t * image , int cmptno , jas_image_cmptparm_t * cmptparm ) {
jas_image_cmpt_t * newcmpt ;
if ( cmptno < 0 ) cmptno = image -> numcmpts_ ;
assert ( cmptno >= 0 && cmptno <= image -> numcmpts_ ) ;
if ( image -> numcmpts_ >= image -> maxcmpts_ ) {
if ( jas_image_growcmpts ( image , image -> maxcmpts_ + 128 ) ) {
return - 1 ;
}
}
if ( ! ( newcmpt = jas_image_cmpt_create ( cmptparm -> tlx , cmptparm -> tly , cmptparm -> hstep , cmptparm -> vstep , cmptparm -> width , cmptparm -> height , cmptparm -> prec , cmptparm -> sgnd , 1 ) ) ) {
return - 1 ;
}
if ( cmptno < image -> numcmpts_ ) {
memmove ( & image -> cmpts_ [ cmptno + 1 ] , & image -> cmpts_ [ cmptno ] , ( image -> numcmpts_ - cmptno ) * sizeof ( jas_image_cmpt_t * ) ) ;
}
image -> cmpts_ [ cmptno ] = newcmpt ;
++ image -> numcmpts_ ;
jas_image_setbbox ( image ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void _HZReset ( UConverter * cnv , UConverterResetChoice choice ) {
if ( choice <= UCNV_RESET_TO_UNICODE ) {
cnv -> toUnicodeStatus = 0 ;
cnv -> mode = 0 ;
if ( cnv -> extraInfo != NULL ) {
( ( UConverterDataHZ * ) cnv -> extraInfo ) -> isStateDBCS = FALSE ;
( ( UConverterDataHZ * ) cnv -> extraInfo ) -> isEmptySegment = FALSE ;
}
}
if ( choice != UCNV_RESET_TO_UNICODE ) {
cnv -> fromUnicodeStatus = 0 ;
cnv -> fromUChar32 = 0x0000 ;
if ( cnv -> extraInfo != NULL ) {
( ( UConverterDataHZ * ) cnv -> extraInfo ) -> isEscapeAppended = FALSE ;
( ( UConverterDataHZ * ) cnv -> extraInfo ) -> targetIndex = 0 ;
( ( UConverterDataHZ * ) cnv -> extraInfo ) -> sourceIndex = 0 ;
( ( UConverterDataHZ * ) cnv -> extraInfo ) -> isTargetUCharDBCS = FALSE ;
}
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ssize_t virtio_net_receive ( VLANClientState * nc , const uint8_t * buf , size_t size ) {
VirtIONet * n = DO_UPCAST ( NICState , nc , nc ) -> opaque ;
struct virtio_net_hdr_mrg_rxbuf * mhdr = NULL ;
size_t guest_hdr_len , offset , i , host_hdr_len ;
if ( ! virtio_net_can_receive ( & n -> nic -> nc ) ) return - 1 ;
guest_hdr_len = n -> mergeable_rx_bufs ? sizeof ( struct virtio_net_hdr_mrg_rxbuf ) : sizeof ( struct virtio_net_hdr ) ;
host_hdr_len = n -> has_vnet_hdr ? sizeof ( struct virtio_net_hdr ) : 0 ;
if ( ! virtio_net_has_buffers ( n , size + guest_hdr_len - host_hdr_len ) ) return 0 ;
if ( ! receive_filter ( n , buf , size ) ) return size ;
offset = i = 0 ;
while ( offset < size ) {
VirtQueueElement elem ;
int len , total ;
struct iovec sg [ VIRTQUEUE_MAX_SIZE ] ;
total = 0 ;
if ( virtqueue_pop ( n -> rx_vq , & elem ) == 0 ) {
if ( i == 0 ) return - 1 ;
error_report ( "virtio-net unexpected empty queue: " "i %zd mergeable %d offset %zd, size %zd, " "guest hdr len %zd, host hdr len %zd guest features 0x%x" , i , n -> mergeable_rx_bufs , offset , size , guest_hdr_len , host_hdr_len , n -> vdev . guest_features ) ;
exit ( 1 ) ;
}
if ( elem . in_num < 1 ) {
error_report ( "virtio-net receive queue contains no in buffers" ) ;
exit ( 1 ) ;
}
if ( ! n -> mergeable_rx_bufs && elem . in_sg [ 0 ] . iov_len != guest_hdr_len ) {
error_report ( "virtio-net header not in first element" ) ;
exit ( 1 ) ;
}
memcpy ( & sg , & elem . in_sg [ 0 ] , sizeof ( sg [ 0 ] ) * elem . in_num ) ;
if ( i == 0 ) {
if ( n -> mergeable_rx_bufs ) mhdr = ( struct virtio_net_hdr_mrg_rxbuf * ) sg [ 0 ] . iov_base ;
offset += receive_header ( n , sg , elem . in_num , buf + offset , size - offset , guest_hdr_len ) ;
total += guest_hdr_len ;
}
len = iov_from_buf ( sg , elem . in_num , buf + offset , 0 , size - offset ) ;
total += len ;
offset += len ;
if ( ! n -> mergeable_rx_bufs && offset < size ) {
# if 0 error_report ( "virtio-net truncated non-mergeable packet: " "i %zd mergeable %d offset %zd, size %zd, " "guest hdr len %zd, host hdr len %zd" , i , n -> mergeable_rx_bufs , offset , size , guest_hdr_len , host_hdr_len ) ;
# endif return size ;
}
virtqueue_fill ( n -> rx_vq , & elem , total , i ++ ) ;
}
if ( mhdr ) {
stw_p ( & mhdr -> num_buffers , i ) ;
}
virtqueue_flush ( n -> rx_vq , i ) ;
virtio_notify ( & n -> vdev , n -> rx_vq ) ;
return size ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void CloseDecoder ( vlc_object_t * p_this ) {
decoder_t * p_dec = ( decoder_t * ) p_this ;
decoder_sys_t * p_sys = p_dec -> p_sys ;
schro_decoder_free ( p_sys -> p_schro ) ;
free ( p_sys ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int int_dsa_size ( const EVP_PKEY * pkey ) {
return ( DSA_size ( pkey -> pkey . dsa ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_sad ## m ## x ## n ## x4d_c ( const uint8_t * src , int src_stride , const uint8_t * const refs [ ] , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < 4 ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , refs [ i ] , ref_stride ) ;
\ }
sadMxN ( 64 , 64 ) sadMxNxK ( 64 , 64 , 3 ) sadMxNxK ( 64 , 64 , 8 ) sadMxNx4D ( 64 , 64 ) sadMxN ( 64 , 32 ) sadMxNx4D ( 64 , 32 ) sadMxN ( 32 , 64 ) sadMxNx4D ( 32 , 64 ) sadMxN ( 32 , 32 ) sadMxNxK ( 32 , 32 , 3 ) sadMxNxK ( 32 , 32 , 8 ) sadMxNx4D ( 32 , 32 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static tvbuff_t * reassemble ( tvbuff_t * tvb , body_parts * * body_parts_array , guint16 head_tsn , guint length , mac_is_channel * ch , guint frame_num ) {
mac_is_sdu * sdu ;
mac_is_fragment * f ;
guint16 i ;
GHashTable * sdus ;
sdus = ( GHashTable * ) g_hash_table_lookup ( mac_is_sdus , ch ) ;
if ( sdus == NULL ) {
mac_is_channel * channel ;
sdus = g_hash_table_new ( mac_is_fragment_hash , mac_is_fragment_equal ) ;
channel = wmem_new ( wmem_file_scope ( ) , mac_is_channel ) ;
* channel = * ch ;
g_hash_table_insert ( mac_is_sdus , channel , sdus ) ;
}
sdu = wmem_new ( wmem_file_scope ( ) , mac_is_sdu ) ;
sdu -> length = 0 ;
sdu -> data = ( guint8 * ) wmem_alloc ( wmem_file_scope ( ) , length ) ;
f = body_parts_array [ head_tsn ] -> head ;
g_hash_table_insert ( sdus , f , sdu ) ;
body_parts_array [ head_tsn ] -> head = NULL ;
mac_is_copy ( sdu , f , length , FALSE ) ;
sdu -> fragments = f ;
sdu -> frame_num = frame_num ;
for ( i = ( head_tsn + 1 ) % MAX_TSN ;
body_parts_array [ i ] -> middle != NULL ;
i = ( i + 1 ) % MAX_TSN ) {
f = f -> next = body_parts_array [ i ] -> middle ;
g_hash_table_insert ( sdus , f , sdu ) ;
body_parts_array [ i ] -> middle = NULL ;
mac_is_copy ( sdu , f , length , FALSE ) ;
}
DISSECTOR_ASSERT ( body_parts_array [ i ] -> tail != NULL ) ;
f -> next = body_parts_array [ i ] -> tail ;
g_hash_table_insert ( sdus , f -> next , sdu ) ;
body_parts_array [ i ] -> tail = NULL ;
sdu -> tsn = i ;
mac_is_copy ( sdu , f -> next , length , FALSE ) ;
return tvb_new_child_real_data ( tvb , sdu -> data , sdu -> length , sdu -> length ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( ExtensionPreferenceApiTest , DataReductionProxy ) {
EXPECT_TRUE ( RunExtensionTest ( "preference/data_reduction_proxy" ) ) << message_ ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( NewAvatarMenuButtonTest , MAYBE_SignOut ) {
if ( ! profiles : : IsMultipleProfilesEnabled ( ) ) return ;
CreateTestingProfile ( ) ;
ASSERT_NO_FATAL_FAILURE ( StartAvatarMenu ( ) ) ;
BrowserList * browser_list = BrowserList : : GetInstance ( chrome : : GetActiveDesktop ( ) ) ;
EXPECT_EQ ( 1U , browser_list -> size ( ) ) ;
content : : WindowedNotificationObserver window_close_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , content : : Source < Browser > ( browser ( ) ) ) ;
AvatarMenu * menu = ProfileChooserView : : profile_bubble_ -> avatar_menu_ . get ( ) ;
const AvatarMenu : : Item & menu_item_before = menu -> GetItemAt ( menu -> GetActiveProfileIndex ( ) ) ;
EXPECT_FALSE ( menu_item_before . signin_required ) ;
ui : : MouseEvent mouse_ev ( ui : : ET_MOUSE_RELEASED , gfx : : Point ( ) , gfx : : Point ( ) , 0 , 0 ) ;
ProfileChooserView : : profile_bubble_ -> ButtonPressed ( ProfileChooserView : : profile_bubble_ -> lock_button_ , mouse_ev ) ;
EXPECT_TRUE ( menu -> GetItemAt ( menu -> GetActiveProfileIndex ( ) ) . signin_required ) ;
window_close_observer . Wait ( ) ;
EXPECT_TRUE ( browser_list -> empty ( ) ) ;
if ( ! UserManager : : IsShowing ( ) ) base : : MessageLoop : : current ( ) -> RunUntilIdle ( ) ;
UserManager : : Hide ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void name ## _free ( type * a ) ;
# define DECLARE_ASN1_PRINT_FUNCTION ( stname ) DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , stname ) # define DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , fname ) int fname ## _print_ctx ( BIO * out , stname * x , int indent , const ASN1_PCTX * pctx ) ;
# define D2I_OF ( type ) type * ( * ) ( type * * , const unsigned char * * , long ) # define I2D_OF ( type ) int ( * ) ( type * , unsigned char * * ) # define I2D_OF_const ( type ) int ( * ) ( const type * , unsigned char * * ) # define CHECKED_D2I_OF ( type , d2i ) ( ( d2i_of_void * ) ( 1 ? d2i : ( ( D2I_OF ( type ) ) 0 ) ) ) # define CHECKED_I2D_OF ( type , i2d ) ( ( i2d_of_void * ) ( 1 ? i2d : ( ( I2D_OF ( type ) ) 0 ) ) ) # define CHECKED_NEW_OF ( type , xnew ) ( ( void * ( * ) ( void ) ) ( 1 ? xnew : ( ( type * ( * ) ( void ) ) 0 ) ) ) # define CHECKED_PTR_OF ( type , p ) ( ( void * ) ( 1 ? p : ( type * ) 0 ) ) # define CHECKED_PPTR_OF ( type , p ) ( ( void * * ) ( 1 ? p : ( type * * ) 0 ) ) # define TYPEDEF_D2I_OF ( type ) typedef type * d2i_of_ ## type ( type * * , const unsigned char * * , long ) # define TYPEDEF_I2D_OF ( type ) typedef int i2d_of_ ## type ( type * , unsigned char * * ) # define TYPEDEF_D2I2D_OF ( type ) TYPEDEF_D2I_OF ( type ) ;
TYPEDEF_I2D_OF ( type ) TYPEDEF_D2I2D_OF ( void ) ;
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION typedef const ASN1_ITEM ASN1_ITEM_EXP ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ) # define ASN1_ITEM_ref ( iptr ) ( & ( iptr ## _it ) ) # define ASN1_ITEM_rptr ( ref ) ( & ( ref ## _it ) ) # define DECLARE_ASN1_ITEM ( name ) OPENSSL_EXTERN const ASN1_ITEM name ## _it ;
# else typedef const ASN1_ITEM * ASN1_ITEM_EXP ( void ) ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ( ) ) # define ASN1_ITEM_ref ( iptr ) ( iptr ## _it ) # define ASN1_ITEM_rptr ( ref ) ( ref ## _it ( ) ) # define DECLARE_ASN1_ITEM ( name ) const ASN1_ITEM * name ## _it ( void ) ;
# endif # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 # define ASN1_STRFLGS_ESC_QUOTE 8 # define CHARTYPE_PRINTABLESTRING 0x10 # define CHARTYPE_FIRST_ESC_2253 0x20 # define CHARTYPE_LAST_ESC_2253 0x40 # define ASN1_STRFLGS_UTF8_CONVERT 0x10 # define ASN1_STRFLGS_IGNORE_TYPE 0x20 # define ASN1_STRFLGS_SHOW_TYPE 0x40 # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 # define ASN1_STRFLGS_DUMP_DER 0x200 # define ASN1_STRFLGS_ESC_2254 0x400 # define ASN1_STRFLGS_RFC2253 ( ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER ) DEFINE_STACK_OF ( ASN1_INTEGER ) DEFINE_STACK_OF ( ASN1_GENERALSTRING ) DEFINE_STACK_OF ( ASN1_UTF8STRING ) typedef struct asn1_type_st {
int type ;
union {
char * ptr ;
ASN1_BOOLEAN boolean ;
ASN1_STRING * asn1_string ;
ASN1_OBJECT * object ;
ASN1_INTEGER * integer ;
ASN1_ENUMERATED * enumerated ;
ASN1_BIT_STRING * bit_string ;
ASN1_OCTET_STRING * octet_string ;
ASN1_PRINTABLESTRING * printablestring ;
ASN1_T61STRING * t61string ;
ASN1_IA5STRING * ia5string ;
ASN1_GENERALSTRING * generalstring ;
ASN1_BMPSTRING * bmpstring ;
ASN1_UNIVERSALSTRING * universalstring ;
ASN1_UTCTIME * utctime ;
ASN1_GENERALIZEDTIME * generalizedtime ;
ASN1_VISIBLESTRING * visiblestring ;
ASN1_UTF8STRING * utf8string ;
ASN1_STRING * set ;
ASN1_STRING * sequence ;
ASN1_VALUE * asn1_value ;
}
value ;
}
ASN1_TYPE ;
DEFINE_STACK_OF ( ASN1_TYPE ) typedef STACK_OF ( ASN1_TYPE ) ASN1_SEQUENCE_ANY ;
DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SEQUENCE_ANY ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SET_ANY ) typedef struct BIT_STRING_BITNAME_st {
int bitnum ;
const char * lname ;
const char * sname ;
}
BIT_STRING_BITNAME ;
# define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING DECLARE_ASN1_FUNCTIONS_fname ( ASN1_TYPE , ASN1_ANY , ASN1_TYPE ) int ASN1_TYPE_get ( const ASN1_TYPE * a ) ;
void ASN1_TYPE_set ( ASN1_TYPE * a , int type , void * value ) ;
int ASN1_TYPE_set1 ( ASN1_TYPE * a , int type , const void * value ) ;
int ASN1_TYPE_cmp ( const ASN1_TYPE * a , const ASN1_TYPE * b ) ;
ASN1_TYPE * ASN1_TYPE_pack_sequence ( const ASN1_ITEM * it , void * s , ASN1_TYPE * * t ) ;
void * ASN1_TYPE_unpack_sequence ( const ASN1_ITEM * it , const ASN1_TYPE * t ) ;
ASN1_OBJECT * ASN1_OBJECT_new ( void ) ;
void ASN1_OBJECT_free ( ASN1_OBJECT * a ) ;
int i2d_ASN1_OBJECT ( const ASN1_OBJECT * a , unsigned char * * pp ) ;
ASN1_OBJECT * d2i_ASN1_OBJECT ( ASN1_OBJECT * * a , const unsigned char * * pp , long length ) ;
DECLARE_ASN1_ITEM ( ASN1_OBJECT ) DEFINE_STACK_OF ( ASN1_OBJECT ) ASN1_STRING * ASN1_STRING_new ( void ) ;
void ASN1_STRING_free ( ASN1_STRING * a ) ;
void ASN1_STRING_clear_free ( ASN1_STRING * a ) ;
int ASN1_STRING_copy ( ASN1_STRING * dst , const ASN1_STRING * str ) ;
ASN1_STRING * ASN1_STRING_dup ( const ASN1_STRING * a ) ;
ASN1_STRING * ASN1_STRING_type_new ( int type ) ;
int ASN1_STRING_cmp ( const ASN1_STRING * a , const ASN1_STRING * b ) ;
int ASN1_STRING_set ( ASN1_STRING * str , const void * data , int len ) ;
void ASN1_STRING_set0 ( ASN1_STRING * str , void * data , int len ) ;
int ASN1_STRING_length ( const ASN1_STRING * x ) ;
void ASN1_STRING_length_set ( ASN1_STRING * x , int n ) ;
int ASN1_STRING_type ( const ASN1_STRING * x ) ;
DEPRECATEDIN_1_1_0 ( unsigned char * ASN1_STRING_data ( ASN1_STRING * x ) ) const unsigned char * ASN1_STRING_get0_data ( const ASN1_STRING * x ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_BIT_STRING ) int ASN1_BIT_STRING_set ( ASN1_BIT_STRING * a , unsigned char * d , int length ) ;
int ASN1_BIT_STRING_set_bit ( ASN1_BIT_STRING * a , int n , int value ) ;
int ASN1_BIT_STRING_get_bit ( const ASN1_BIT_STRING * a , int n ) ;
int ASN1_BIT_STRING_check ( const ASN1_BIT_STRING * a , const unsigned char * flags , int flags_len ) ;
int ASN1_BIT_STRING_name_print ( BIO * out , ASN1_BIT_STRING * bs , BIT_STRING_BITNAME * tbl , int indent ) ;
int ASN1_BIT_STRING_num_asc ( const char * name , BIT_STRING_BITNAME * tbl ) ;
int ASN1_BIT_STRING_set_asc ( ASN1_BIT_STRING * bs , const char * name , int value , BIT_STRING_BITNAME * tbl ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_INTEGER ) ASN1_INTEGER * d2i_ASN1_UINTEGER ( ASN1_INTEGER * * a , const unsigned char * * pp , long length ) ;
ASN1_INTEGER * ASN1_INTEGER_dup ( const ASN1_INTEGER * x ) ;
int ASN1_INTEGER_cmp ( const ASN1_INTEGER * x , const ASN1_INTEGER * y ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_ENUMERATED ) int ASN1_UTCTIME_check ( const ASN1_UTCTIME * a ) ;
ASN1_UTCTIME * ASN1_UTCTIME_set ( ASN1_UTCTIME * s , time_t t ) ;
ASN1_UTCTIME * ASN1_UTCTIME_adj ( ASN1_UTCTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_UTCTIME_set_string ( ASN1_UTCTIME * s , const char * str ) ;
int ASN1_UTCTIME_cmp_time_t ( const ASN1_UTCTIME * s , time_t t ) ;
int ASN1_GENERALIZEDTIME_check ( const ASN1_GENERALIZEDTIME * a ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_set ( ASN1_GENERALIZEDTIME * s , time_t t ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_adj ( ASN1_GENERALIZEDTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_GENERALIZEDTIME_set_string ( ASN1_GENERALIZEDTIME * s , const char * str ) ;
int ASN1_TIME_diff ( int * pday , int * psec , const ASN1_TIME * from , const ASN1_TIME * to ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_OCTET_STRING )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_wl4166_4 ( ) {
MYSQL_STMT * stmt ;
int rc ;
const char * stmt_text ;
MYSQL_BIND bind_array [ 2 ] ;
const char * koi8 = "\xee\xd5\x2c\x20\xda\xc1\x20\xd2\xd9\xc2\xc1\xcc\xcb\xd5" ;
const char * cp1251 = "\xcd\xf3\x2c\x20\xe7\xe0\x20\xf0\xfb\xe1\xe0\xeb\xea\xf3" ;
char buf1 [ 16 ] , buf2 [ 16 ] ;
ulong buf1_len , buf2_len ;
myheader ( "test_wl4166_4" ) ;
rc = mysql_query ( mysql , "drop table if exists t1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "create table t1 (c1 varbinary(255), c2 varbinary(255))" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "set character_set_client=koi8r, " "character_set_connection=cp1251, " "character_set_results=koi8r" ) ;
myquery ( rc ) ;
memset ( bind_array , 0 , sizeof ( bind_array ) ) ;
bind_array [ 0 ] . buffer_type = MYSQL_TYPE_STRING ;
bind_array [ 1 ] . buffer_type = MYSQL_TYPE_STRING ;
bind_array [ 1 ] . buffer = ( void * ) koi8 ;
bind_array [ 1 ] . buffer_length = strlen ( koi8 ) ;
stmt = mysql_stmt_init ( mysql ) ;
check_stmt ( stmt ) ;
stmt_text = "insert into t1 (c1, c2) values (?, ?)" ;
rc = mysql_stmt_prepare ( stmt , stmt_text , strlen ( stmt_text ) ) ;
check_execute ( stmt , rc ) ;
mysql_stmt_bind_param ( stmt , bind_array ) ;
mysql_stmt_send_long_data ( stmt , 0 , koi8 , strlen ( koi8 ) ) ;
rc = mysql_query ( mysql , "alter table t1 add column d int" ) ;
myquery ( rc ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
stmt_text = "select c1, c2 from t1" ;
rc = mysql_stmt_prepare ( stmt , stmt_text , strlen ( stmt_text ) ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
bind_array [ 0 ] . buffer = buf1 ;
bind_array [ 0 ] . buffer_length = sizeof ( buf1 ) ;
bind_array [ 0 ] . length = & buf1_len ;
bind_array [ 1 ] . buffer = buf2 ;
bind_array [ 1 ] . buffer_length = sizeof ( buf2 ) ;
bind_array [ 1 ] . length = & buf2_len ;
mysql_stmt_bind_result ( stmt , bind_array ) ;
rc = mysql_stmt_fetch ( stmt ) ;
check_execute ( stmt , rc ) ;
DIE_UNLESS ( buf1_len == strlen ( cp1251 ) ) ;
DIE_UNLESS ( buf2_len == strlen ( cp1251 ) ) ;
DIE_UNLESS ( ! memcmp ( buf1 , cp1251 , buf1_len ) ) ;
DIE_UNLESS ( ! memcmp ( buf2 , cp1251 , buf1_len ) ) ;
rc = mysql_stmt_fetch ( stmt ) ;
DIE_UNLESS ( rc == MYSQL_NO_DATA ) ;
mysql_stmt_close ( stmt ) ;
rc = mysql_query ( mysql , "drop table t1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "set names default" ) ;
myquery ( rc ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int get_flags ( MotionEstContext * c , int direct , int chroma ) {
return ( ( c -> avctx -> flags & CODEC_FLAG_QPEL ) ? FLAG_QPEL : 0 ) + ( direct ? FLAG_DIRECT : 0 ) + ( chroma ? FLAG_CHROMA : 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void read_guest_rom_state ( VAPICROMState * s ) {
cpu_physical_memory_rw ( s -> rom_state_paddr , ( void * ) & s -> rom_state , sizeof ( GuestROMState ) , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int inode_doinit_with_dentry ( struct inode * inode , struct dentry * opt_dentry ) {
struct superblock_security_struct * sbsec = NULL ;
struct inode_security_struct * isec = inode -> i_security ;
u32 task_sid , sid = 0 ;
u16 sclass ;
struct dentry * dentry ;
# define INITCONTEXTLEN 255 char * context = NULL ;
unsigned len = 0 ;
int rc = 0 ;
if ( isec -> initialized == LABEL_INITIALIZED ) return 0 ;
spin_lock ( & isec -> lock ) ;
if ( isec -> initialized == LABEL_INITIALIZED ) goto out_unlock ;
if ( isec -> sclass == SECCLASS_FILE ) isec -> sclass = inode_mode_to_security_class ( inode -> i_mode ) ;
sbsec = inode -> i_sb -> s_security ;
if ( ! ( sbsec -> flags & SE_SBINITIALIZED ) ) {
spin_lock ( & sbsec -> isec_lock ) ;
if ( list_empty ( & isec -> list ) ) list_add ( & isec -> list , & sbsec -> isec_head ) ;
spin_unlock ( & sbsec -> isec_lock ) ;
goto out_unlock ;
}
sclass = isec -> sclass ;
task_sid = isec -> task_sid ;
sid = isec -> sid ;
isec -> initialized = LABEL_PENDING ;
spin_unlock ( & isec -> lock ) ;
switch ( sbsec -> behavior ) {
case SECURITY_FS_USE_NATIVE : break ;
case SECURITY_FS_USE_XATTR : if ( ! ( inode -> i_opflags & IOP_XATTR ) ) {
sid = sbsec -> def_sid ;
break ;
}
if ( opt_dentry ) {
dentry = dget ( opt_dentry ) ;
}
else {
dentry = d_find_alias ( inode ) ;
}
if ( ! dentry ) {
goto out ;
}
len = INITCONTEXTLEN ;
context = kmalloc ( len + 1 , GFP_NOFS ) ;
if ( ! context ) {
rc = - ENOMEM ;
dput ( dentry ) ;
goto out ;
}
context [ len ] = '\0' ;
rc = __vfs_getxattr ( dentry , inode , XATTR_NAME_SELINUX , context , len ) ;
if ( rc == - ERANGE ) {
kfree ( context ) ;
rc = __vfs_getxattr ( dentry , inode , XATTR_NAME_SELINUX , NULL , 0 ) ;
if ( rc < 0 ) {
dput ( dentry ) ;
goto out ;
}
len = rc ;
context = kmalloc ( len + 1 , GFP_NOFS ) ;
if ( ! context ) {
rc = - ENOMEM ;
dput ( dentry ) ;
goto out ;
}
context [ len ] = '\0' ;
rc = __vfs_getxattr ( dentry , inode , XATTR_NAME_SELINUX , context , len ) ;
}
dput ( dentry ) ;
if ( rc < 0 ) {
if ( rc != - ENODATA ) {
printk ( KERN_WARNING "SELinux: %s: getxattr returned " "%d for dev=%s ino=%ld\n" , __func__ , - rc , inode -> i_sb -> s_id , inode -> i_ino ) ;
kfree ( context ) ;
goto out ;
}
sid = sbsec -> def_sid ;
rc = 0 ;
}
else {
rc = security_context_to_sid_default ( context , rc , & sid , sbsec -> def_sid , GFP_NOFS ) ;
if ( rc ) {
char * dev = inode -> i_sb -> s_id ;
unsigned long ino = inode -> i_ino ;
if ( rc == - EINVAL ) {
if ( printk_ratelimit ( ) ) printk ( KERN_NOTICE "SELinux: inode=%lu on dev=%s was found to have an invalid " "context=%s. This indicates you may need to relabel the inode or the " "filesystem in question.\n" , ino , dev , context ) ;
}
else {
printk ( KERN_WARNING "SELinux: %s: context_to_sid(%s) " "returned %d for dev=%s ino=%ld\n" , __func__ , context , - rc , dev , ino ) ;
}
kfree ( context ) ;
rc = 0 ;
break ;
}
}
kfree ( context ) ;
break ;
case SECURITY_FS_USE_TASK : sid = task_sid ;
break ;
case SECURITY_FS_USE_TRANS : sid = sbsec -> sid ;
rc = security_transition_sid ( task_sid , sid , sclass , NULL , & sid ) ;
if ( rc ) goto out ;
break ;
case SECURITY_FS_USE_MNTPOINT : sid = sbsec -> mntpoint_sid ;
break ;
default : sid = sbsec -> sid ;
if ( ( sbsec -> flags & SE_SBGENFS ) && ! S_ISLNK ( inode -> i_mode ) ) {
if ( opt_dentry ) dentry = dget ( opt_dentry ) ;
else dentry = d_find_alias ( inode ) ;
if ( ! dentry ) goto out ;
rc = selinux_genfs_get_sid ( dentry , sclass , sbsec -> flags , & sid ) ;
dput ( dentry ) ;
if ( rc ) goto out ;
}
break ;
}
out : spin_lock ( & isec -> lock ) ;
if ( isec -> initialized == LABEL_PENDING ) {
if ( ! sid || rc ) {
isec -> initialized = LABEL_INVALID ;
goto out_unlock ;
}
isec -> initialized = LABEL_INITIALIZED ;
isec -> sid = sid ;
}
out_unlock : spin_unlock ( & isec -> lock ) ;
return rc ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void _LMBCSOpen ## n ( UConverter * _this , UConverterLoadArgs * pArgs , UErrorCode * err ) \ {
_LMBCSOpenWorker ( _this , pArgs , err , n ) ;
}
static void _LMBCSOpenWorker ( UConverter * _this , UConverterLoadArgs * pArgs , UErrorCode * err , ulmbcs_byte_t OptGroup ) {
UConverterDataLMBCS * extraInfo = _this -> extraInfo = ( UConverterDataLMBCS * ) uprv_malloc ( sizeof ( UConverterDataLMBCS ) ) ;
if ( extraInfo != NULL ) {
UConverterNamePieces stackPieces ;
UConverterLoadArgs stackArgs = {
( int32_t ) sizeof ( UConverterLoadArgs ) }
;
ulmbcs_byte_t i ;
uprv_memset ( extraInfo , 0 , sizeof ( UConverterDataLMBCS ) ) ;
stackArgs . onlyTestIsLoadable = pArgs -> onlyTestIsLoadable ;
for ( i = 0 ;
i <= ULMBCS_GRP_LAST && U_SUCCESS ( * err ) ;
i ++ ) {
if ( OptGroupByteToCPName [ i ] != NULL ) {
extraInfo -> OptGrpConverter [ i ] = ucnv_loadSharedData ( OptGroupByteToCPName [ i ] , & stackPieces , & stackArgs , err ) ;
}
}
if ( U_FAILURE ( * err ) || pArgs -> onlyTestIsLoadable ) {
_LMBCSClose ( _this ) ;
return ;
}
extraInfo -> OptGroup = OptGroup ;
extraInfo -> localeConverterIndex = FindLMBCSLocale ( pArgs -> locale ) ;
}
else {
* err = U_MEMORY_ALLOCATION_ERROR ;
}
}
static void _LMBCSClose ( UConverter * _this ) {
if ( _this -> extraInfo != NULL ) {
ulmbcs_byte_t Ix ;
UConverterDataLMBCS * extraInfo = ( UConverterDataLMBCS * ) _this -> extraInfo ;
for ( Ix = 0 ;
Ix <= ULMBCS_GRP_LAST ;
Ix ++ ) {
if ( extraInfo -> OptGrpConverter [ Ix ] != NULL ) ucnv_unloadSharedDataIfReady ( extraInfo -> OptGrpConverter [ Ix ] ) ;
}
if ( ! _this -> isExtraLocal ) {
uprv_free ( _this -> extraInfo ) ;
_this -> extraInfo = NULL ;
}
}
}
typedef struct LMBCSClone {
UConverter cnv ;
UConverterDataLMBCS lmbcs ;
}
LMBCSClone ;
static UConverter * _LMBCSSafeClone ( const UConverter * cnv , void * stackBuffer , int32_t * pBufferSize , UErrorCode * status ) {
LMBCSClone * newLMBCS ;
UConverterDataLMBCS * extraInfo ;
int32_t i ;
if ( * pBufferSize <= 0 ) {
* pBufferSize = ( int32_t ) sizeof ( LMBCSClone ) ;
return NULL ;
}
extraInfo = ( UConverterDataLMBCS * ) cnv -> extraInfo ;
newLMBCS = ( LMBCSClone * ) stackBuffer ;
uprv_memcpy ( & newLMBCS -> lmbcs , extraInfo , sizeof ( UConverterDataLMBCS ) ) ;
for ( i = 0 ;
i <= ULMBCS_GRP_LAST ;
++ i ) {
if ( extraInfo -> OptGrpConverter [ i ] != NULL ) {
ucnv_incrementRefCount ( extraInfo -> OptGrpConverter [ i ] ) ;
}
}
newLMBCS -> cnv . extraInfo = & newLMBCS -> lmbcs ;
newLMBCS -> cnv . isExtraLocal = TRUE ;
return & newLMBCS -> cnv ;
}
static size_t LMBCSConversionWorker ( UConverterDataLMBCS * extraInfo , ulmbcs_byte_t group , ulmbcs_byte_t * pStartLMBCS , UChar * pUniChar , ulmbcs_byte_t * lastConverterIndex , UBool * groups_tried ) {
ulmbcs_byte_t * pLMBCS = pStartLMBCS ;
UConverterSharedData * xcnv = extraInfo -> OptGrpConverter [ group ] ;
int bytesConverted ;
uint32_t value ;
ulmbcs_byte_t firstByte ;
U_ASSERT ( xcnv ) ;
U_ASSERT ( group < ULMBCS_GRP_UNICODE ) ;
bytesConverted = ucnv_MBCSFromUChar32 ( xcnv , * pUniChar , & value , FALSE ) ;
if ( bytesConverted > 0 ) {
firstByte = ( ulmbcs_byte_t ) ( value >> ( ( bytesConverted - 1 ) * 8 ) ) ;
}
else {
groups_tried [ group ] = TRUE ;
return 0 ;
}
* lastConverterIndex = group ;
U_ASSERT ( ( firstByte <= ULMBCS_C0END ) || ( firstByte >= ULMBCS_C1START ) || ( group == ULMBCS_GRP_EXCEPT ) ) ;
if ( group != ULMBCS_GRP_EXCEPT && extraInfo -> OptGroup != group ) {
* pLMBCS ++ = group ;
if ( bytesConverted == 1 && group >= ULMBCS_DOUBLEOPTGROUP_START ) {
* pLMBCS ++ = group ;
}
}
if ( bytesConverted == 1 && firstByte < 0x20 ) return 0 ;
switch ( bytesConverted ) {
case 4 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 24 ) ;
U_FALLTHROUGH ;
case 3 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 16 ) ;
U_FALLTHROUGH ;
case 2 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 8 ) ;
U_FALLTHROUGH ;
case 1 : * pLMBCS ++ = ( ulmbcs_byte_t ) value ;
U_FALLTHROUGH ;
default : break ;
}
return ( pLMBCS - pStartLMBCS ) ;
}
static size_t LMBCSConvertUni ( ulmbcs_byte_t * pLMBCS , UChar uniChar ) {
uint8_t LowCh = ( uint8_t ) ( uniChar & 0x00FF ) ;
uint8_t HighCh = ( uint8_t ) ( uniChar >> 8 ) ;
* pLMBCS ++ = ULMBCS_GRP_UNICODE ;
if ( LowCh == 0 ) {
* pLMBCS ++ = ULMBCS_UNICOMPATZERO ;
* pLMBCS ++ = HighCh ;
}
else {
* pLMBCS ++ = HighCh ;
* pLMBCS ++ = LowCh ;
}
return ULMBCS_UNICODE_SIZE ;
}
static void _LMBCSFromUnicode ( UConverterFromUnicodeArgs * args , UErrorCode * err ) {
ulmbcs_byte_t lastConverterIndex = 0 ;
UChar uniChar ;
ulmbcs_byte_t LMBCS [ ULMBCS_CHARSIZE_MAX ] ;
ulmbcs_byte_t * pLMBCS ;
int32_t bytes_written ;
UBool groups_tried [ ULMBCS_GRP_LAST + 1 ] ;
UConverterDataLMBCS * extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
int sourceIndex = 0 ;
ulmbcs_byte_t OldConverterIndex = 0 ;
while ( args -> source < args -> sourceLimit && ! U_FAILURE ( * err ) ) {
OldConverterIndex = extraInfo -> localeConverterIndex ;
if ( args -> target >= args -> targetLimit ) {
* err = U_BUFFER_OVERFLOW_ERROR ;
break ;
}
uniChar = * ( args -> source ) ;
bytes_written = 0 ;
pLMBCS = LMBCS ;
if ( ( uniChar >= 0x80 ) && ( uniChar <= 0xff ) && ( uniChar != 0xB1 ) && ( uniChar != 0xD7 ) && ( uniChar != 0xF7 ) && ( uniChar != 0xB0 ) && ( uniChar != 0xB4 ) && ( uniChar != 0xB6 ) && ( uniChar != 0xA7 ) && ( uniChar != 0xA8 ) ) {
extraInfo -> localeConverterIndex = ULMBCS_GRP_L1 ;
}
if ( ( ( uniChar > ULMBCS_C0END ) && ( uniChar < ULMBCS_C1START ) ) || uniChar == 0 || uniChar == ULMBCS_HT || uniChar == ULMBCS_CR || uniChar == ULMBCS_LF || uniChar == ULMBCS_123SYSTEMRANGE ) {
* pLMBCS ++ = ( ulmbcs_byte_t ) uniChar ;
bytes_written = 1 ;
}
if ( ! bytes_written ) {
ulmbcs_byte_t group = FindLMBCSUniRange ( uniChar ) ;
if ( group == ULMBCS_GRP_UNICODE ) {
pLMBCS += LMBCSConvertUni ( pLMBCS , uniChar ) ;
bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ;
}
else if ( group == ULMBCS_GRP_CTRL ) {
if ( uniChar <= ULMBCS_C0END ) {
* pLMBCS ++ = ULMBCS_GRP_CTRL ;
* pLMBCS ++ = ( ulmbcs_byte_t ) ( ULMBCS_CTRLOFFSET + uniChar ) ;
}
else if ( uniChar >= ULMBCS_C1START && uniChar <= ULMBCS_C1START + ULMBCS_CTRLOFFSET ) {
* pLMBCS ++ = ULMBCS_GRP_CTRL ;
* pLMBCS ++ = ( ulmbcs_byte_t ) ( uniChar & 0x00FF ) ;
}
bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ;
}
else if ( group < ULMBCS_GRP_UNICODE ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , group , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
if ( ! bytes_written ) {
uprv_memset ( groups_tried , 0 , sizeof ( groups_tried ) ) ;
if ( ( extraInfo -> OptGroup != 1 ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , extraInfo -> OptGroup ) ) ) {
if ( extraInfo -> localeConverterIndex < ULMBCS_DOUBLEOPTGROUP_START ) {
bytes_written = LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_L1 , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
if ( ! bytes_written ) {
bytes_written = LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_EXCEPT , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
if ( ! bytes_written ) {
bytes_written = LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
}
else {
bytes_written = LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
}
if ( ! bytes_written && ( extraInfo -> localeConverterIndex ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , extraInfo -> localeConverterIndex ) ) ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
if ( ! bytes_written && ( lastConverterIndex ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , lastConverterIndex ) ) ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , lastConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
if ( ! bytes_written ) {
ulmbcs_byte_t grp_start ;
ulmbcs_byte_t grp_end ;
ulmbcs_byte_t grp_ix ;
grp_start = ( ulmbcs_byte_t ) ( ( group == ULMBCS_AMBIGUOUS_MBCS ) ? ULMBCS_DOUBLEOPTGROUP_START : ULMBCS_GRP_L1 ) ;
grp_end = ( ulmbcs_byte_t ) ( ( group == ULMBCS_AMBIGUOUS_MBCS ) ? ULMBCS_GRP_LAST : ULMBCS_GRP_TH ) ;
if ( group == ULMBCS_AMBIGUOUS_ALL ) {
grp_start = ULMBCS_GRP_L1 ;
grp_end = ULMBCS_GRP_LAST ;
}
for ( grp_ix = grp_start ;
grp_ix <= grp_end && ! bytes_written ;
grp_ix ++ ) {
if ( extraInfo -> OptGrpConverter [ grp_ix ] && ! groups_tried [ grp_ix ] ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , grp_ix , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
}
if ( ! bytes_written && grp_start == ULMBCS_GRP_L1 ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_EXCEPT , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
}
if ( ! bytes_written ) {
pLMBCS += LMBCSConvertUni ( pLMBCS , uniChar ) ;
bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ;
}
}
}
args -> source ++ ;
pLMBCS = LMBCS ;
while ( args -> target < args -> targetLimit && bytes_written -- ) {
* ( args -> target ) ++ = * pLMBCS ++ ;
if ( args -> offsets ) {
* ( args -> offsets ) ++ = sourceIndex ;
}
}
sourceIndex ++ ;
if ( bytes_written > 0 ) {
uint8_t * pErrorBuffer = args -> converter -> charErrorBuffer ;
* err = U_BUFFER_OVERFLOW_ERROR ;
args -> converter -> charErrorBufferLength = ( int8_t ) bytes_written ;
while ( bytes_written -- ) {
* pErrorBuffer ++ = * pLMBCS ++ ;
}
}
extraInfo -> localeConverterIndex = OldConverterIndex ;
}
}
static UChar GetUniFromLMBCSUni ( char const * * ppLMBCSin ) {
uint8_t HighCh = * ( * ppLMBCSin ) ++ ;
uint8_t LowCh = * ( * ppLMBCSin ) ++ ;
if ( HighCh == ULMBCS_UNICOMPATZERO ) {
HighCh = LowCh ;
LowCh = 0 ;
}
return ( UChar ) ( ( HighCh << 8 ) | LowCh ) ;
}
# define CHECK_SOURCE_LIMIT ( index ) if ( args -> source + index > args -> sourceLimit ) {
* err = U_TRUNCATED_CHAR_FOUND ;
args -> source = args -> sourceLimit ;
return 0xffff ;
}
static UChar32 _LMBCSGetNextUCharWorker ( UConverterToUnicodeArgs * args , UErrorCode * err ) {
UChar32 uniChar = 0 ;
ulmbcs_byte_t CurByte ;
if ( args -> source >= args -> sourceLimit ) {
* err = U_ILLEGAL_ARGUMENT_ERROR ;
return 0xffff ;
}
CurByte = * ( ( ulmbcs_byte_t * ) ( args -> source ++ ) ) ;
if ( ( ( CurByte > ULMBCS_C0END ) && ( CurByte < ULMBCS_C1START ) ) || ( CurByte == 0 ) || CurByte == ULMBCS_HT || CurByte == ULMBCS_CR || CurByte == ULMBCS_LF || CurByte == ULMBCS_123SYSTEMRANGE ) {
uniChar = CurByte ;
}
else {
UConverterDataLMBCS * extraInfo ;
ulmbcs_byte_t group ;
UConverterSharedData * cnv ;
if ( CurByte == ULMBCS_GRP_CTRL ) {
ulmbcs_byte_t C0C1byte ;
CHECK_SOURCE_LIMIT ( 1 ) ;
C0C1byte = * ( args -> source ) ++ ;
uniChar = ( C0C1byte < ULMBCS_C1START ) ? C0C1byte - ULMBCS_CTRLOFFSET : C0C1byte ;
}
else if ( CurByte == ULMBCS_GRP_UNICODE ) {
CHECK_SOURCE_LIMIT ( 2 ) ;
return GetUniFromLMBCSUni ( & ( args -> source ) ) ;
}
else if ( CurByte <= ULMBCS_CTRLOFFSET ) {
group = CurByte ;
extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
if ( group > ULMBCS_GRP_LAST || ( cnv = extraInfo -> OptGrpConverter [ group ] ) == NULL ) {
* err = U_INVALID_CHAR_FOUND ;
}
else if ( group >= ULMBCS_DOUBLEOPTGROUP_START ) {
CHECK_SOURCE_LIMIT ( 2 ) ;
if ( * args -> source == group ) {
++ args -> source ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source , 1 , FALSE ) ;
++ args -> source ;
}
else {
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source , 2 , FALSE ) ;
args -> source += 2 ;
}
}
else {
CHECK_SOURCE_LIMIT ( 1 ) ;
CurByte = * ( args -> source ) ++ ;
if ( CurByte >= ULMBCS_C1START ) {
uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP ( cnv , CurByte ) ;
}
else {
char bytes [ 2 ] ;
extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
cnv = extraInfo -> OptGrpConverter [ ULMBCS_GRP_EXCEPT ] ;
bytes [ 0 ] = group ;
bytes [ 1 ] = CurByte ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , bytes , 2 , FALSE ) ;
}
}
}
else if ( CurByte >= ULMBCS_C1START ) {
extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
group = extraInfo -> OptGroup ;
cnv = extraInfo -> OptGrpConverter [ group ] ;
if ( group >= ULMBCS_DOUBLEOPTGROUP_START ) {
if ( ! ucnv_MBCSIsLeadByte ( cnv , CurByte ) ) {
CHECK_SOURCE_LIMIT ( 0 ) ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source - 1 , 1 , FALSE ) ;
}
else {
CHECK_SOURCE_LIMIT ( 1 ) ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source - 1 , 2 , FALSE ) ;
++ args -> source ;
}
}
else {
uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP ( cnv , CurByte ) ;
}
}
}
return uniChar ;
}
static void _LMBCSToUnicodeWithOffsets ( UConverterToUnicodeArgs * args , UErrorCode * err ) {
char LMBCS [ ULMBCS_CHARSIZE_MAX ] ;
UChar uniChar ;
const char * saveSource ;
const char * pStartLMBCS = args -> source ;
const char * errSource = NULL ;
int8_t savebytes = 0 ;
while ( U_SUCCESS ( * err ) && args -> sourceLimit > args -> source && args -> targetLimit > args -> target ) {
saveSource = args -> source ;
if ( args -> converter -> toULength ) {
const char * saveSourceLimit ;
size_t size_old = args -> converter -> toULength ;
size_t size_new_maybe_1 = sizeof ( LMBCS ) - size_old ;
size_t size_new_maybe_2 = args -> sourceLimit - args -> source ;
size_t size_new = ( size_new_maybe_1 < size_new_maybe_2 ) ? size_new_maybe_1 : size_new_maybe_2 ;
uprv_memcpy ( LMBCS , args -> converter -> toUBytes , size_old ) ;
uprv_memcpy ( LMBCS + size_old , args -> source , size_new ) ;
saveSourceLimit = args -> sourceLimit ;
args -> source = errSource = LMBCS ;
args -> sourceLimit = LMBCS + size_old + size_new ;
savebytes = ( int8_t ) ( size_old + size_new ) ;
uniChar = ( UChar ) _LMBCSGetNextUCharWorker ( args , err ) ;
args -> source = saveSource + ( ( args -> source - LMBCS ) - size_old ) ;
args -> sourceLimit = saveSourceLimit ;
if ( * err == U_TRUNCATED_CHAR_FOUND ) {
args -> converter -> toULength = savebytes ;
uprv_memcpy ( args -> converter -> toUBytes , LMBCS , savebytes ) ;
args -> source = args -> sourceLimit ;
* err = U_ZERO_ERROR ;
return ;
}
else {
args -> converter -> toULength = 0 ;
}
}
else {
errSource = saveSource ;
uniChar = ( UChar ) _LMBCSGetNextUCharWorker ( args , err ) ;
savebytes = ( int8_t ) ( args -> source - saveSource ) ;
}
if ( U_SUCCESS ( * err ) ) {
if ( uniChar < 0xfffe ) {
* ( args -> target ) ++ = uniChar ;
if ( args -> offsets ) {
* ( args -> offsets ) ++ = ( int32_t ) ( saveSource - pStartLMBCS ) ;
}
}
else if ( uniChar == 0xfffe ) {
* err = U_INVALID_CHAR_FOUND ;
}
else {
* err = U_ILLEGAL_CHAR_FOUND ;
}
}
}
if ( U_SUCCESS ( * err ) && args -> sourceLimit > args -> source && args -> targetLimit <= args -> target ) {
* err = U_BUFFER_OVERFLOW_ERROR ;
}
else if ( U_FAILURE ( * err ) ) {
args -> converter -> toULength = savebytes ;
if ( savebytes > 0 ) {
uprv_memcpy ( args -> converter -> toUBytes , errSource , savebytes ) ;
}
if ( * err == U_TRUNCATED_CHAR_FOUND ) {
* err = U_ZERO_ERROR ;
}
}
}
DEFINE_LMBCS_OPEN ( 1 ) DEFINE_LMBCS_OPEN ( 2 ) DEFINE_LMBCS_OPEN ( 3 ) DEFINE_LMBCS_OPEN ( 4 ) DEFINE_LMBCS_OPEN ( 5 ) DEFINE_LMBCS_OPEN ( 6 ) DEFINE_LMBCS_OPEN ( 8 ) DEFINE_LMBCS_OPEN ( 11 ) DEFINE_LMBCS_OPEN ( 16 ) DEFINE_LMBCS_OPEN ( 17 )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
xsltSecurityPrefsPtr xsltGetDefaultSecurityPrefs ( void ) {
return ( xsltDefaultSecurityPrefs ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void print_help_item ( MYSQL_ROW * cur , int num_name , int num_cat , char * last_char ) {
char ccat = ( * cur ) [ num_cat ] [ 0 ] ;
if ( * last_char != ccat ) {
put_info ( ccat == 'Y' ? "categories:" : "topics:" , INFO_INFO ) ;
* last_char = ccat ;
}
tee_fprintf ( PAGER , " %s\n" , ( * cur ) [ num_name ] ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
afs_int32 SPR_IDToName ( struct rx_call * call , idlist * aid , namelist * aname ) {
afs_int32 code ;
code = idToName ( call , aid , aname ) ;
osi_auditU ( call , PTS_IdToNmEvent , code , AUD_END ) ;
ViceLog ( 125 , ( "PTS_IDToName: code %d\n" , code ) ) ;
return code ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( BrowsingDataRemoverImplTest , RemoveQuotaManagedDataForeverBoth ) {
BlockUntilBrowsingDataRemoved ( base : : Time ( ) , base : : Time : : Max ( ) , BrowsingDataRemover : : REMOVE_FILE_SYSTEMS | BrowsingDataRemover : : REMOVE_WEBSQL | BrowsingDataRemover : : REMOVE_APPCACHE | BrowsingDataRemover : : REMOVE_SERVICE_WORKERS | BrowsingDataRemover : : REMOVE_CACHE_STORAGE | BrowsingDataRemover : : REMOVE_INDEXEDDB , false ) ;
EXPECT_EQ ( BrowsingDataRemover : : REMOVE_FILE_SYSTEMS | BrowsingDataRemover : : REMOVE_WEBSQL | BrowsingDataRemover : : REMOVE_APPCACHE | BrowsingDataRemover : : REMOVE_SERVICE_WORKERS | BrowsingDataRemover : : REMOVE_CACHE_STORAGE | BrowsingDataRemover : : REMOVE_INDEXEDDB , GetRemovalMask ( ) ) ;
EXPECT_EQ ( BrowsingDataHelper : : UNPROTECTED_WEB , GetOriginTypeMask ( ) ) ;
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData ( ) ;
EXPECT_EQ ( removal_data . remove_mask , StoragePartition : : REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition : : REMOVE_DATA_MASK_WEBSQL | StoragePartition : : REMOVE_DATA_MASK_APPCACHE | StoragePartition : : REMOVE_DATA_MASK_SERVICE_WORKERS | StoragePartition : : REMOVE_DATA_MASK_CACHE_STORAGE | StoragePartition : : REMOVE_DATA_MASK_INDEXEDDB ) ;
EXPECT_EQ ( removal_data . quota_storage_remove_mask , StoragePartition : : QUOTA_MANAGED_STORAGE_MASK_ALL ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int tm_destroy_event ( tm_event_t * event ) {
if ( ! init_done ) return TM_BADINIT ;
return TM_ENOTIMPLEMENTED ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * cmd_resquest_body_limit_action ( cmd_parms * cmd , void * _dcfg , const char * p1 ) {
directory_config * dcfg = ( directory_config * ) _dcfg ;
if ( dcfg == NULL ) return NULL ;
if ( dcfg -> is_enabled == MODSEC_DETECTION_ONLY ) {
dcfg -> if_limit_action = REQUEST_BODY_LIMIT_ACTION_PARTIAL ;
return NULL ;
}
if ( strcasecmp ( p1 , "ProcessPartial" ) == 0 ) dcfg -> if_limit_action = REQUEST_BODY_LIMIT_ACTION_PARTIAL ;
else if ( strcasecmp ( p1 , "Reject" ) == 0 ) dcfg -> if_limit_action = REQUEST_BODY_LIMIT_ACTION_REJECT ;
else return apr_psprintf ( cmd -> pool , "ModSecurity: Invalid value for SecRequestBodyLimitAction: %s" , p1 ) ;
return NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void TSHttpTxnReenable ( TSHttpTxn txnp , TSEvent event ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
HttpSM * sm = ( HttpSM * ) txnp ;
EThread * eth = this_ethread ( ) ;
if ( eth == nullptr || eth -> tt != REGULAR ) {
eventProcessor . schedule_imm ( new TSHttpSMCallback ( sm , event ) , ET_NET ) ;
}
else {
MUTEX_TRY_LOCK ( trylock , sm -> mutex , eth ) ;
if ( ! trylock . is_locked ( ) ) {
eventProcessor . schedule_imm ( new TSHttpSMCallback ( sm , event ) , ET_NET ) ;
}
else {
sm -> state_api_callback ( ( int ) event , nullptr ) ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( ExternalProtocolDialogBrowserTest , TestCancelWithChecked ) {
ShowDialog ( ) ;
SetChecked ( true ) ;
EXPECT_TRUE ( dialog_ -> Cancel ( ) ) ;
EXPECT_FALSE ( called_ ) ;
EXPECT_FALSE ( accept_ ) ;
EXPECT_FALSE ( remember_ ) ;
histogram_tester_ . ExpectBucketCount ( ExternalProtocolHandler : : kHandleStateMetric , ExternalProtocolHandler : : DONT_LAUNCH , 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_subframe ( WMAProDecodeCtx * s ) {
int offset = s -> samples_per_frame ;
int subframe_len = s -> samples_per_frame ;
int i ;
int total_samples = s -> samples_per_frame * s -> avctx -> channels ;
int transmit_coeffs = 0 ;
int cur_subwoofer_cutoff ;
s -> subframe_offset = get_bits_count ( & s -> gb ) ;
for ( i = 0 ;
i < s -> avctx -> channels ;
i ++ ) {
s -> channel [ i ] . grouped = 0 ;
if ( offset > s -> channel [ i ] . decoded_samples ) {
offset = s -> channel [ i ] . decoded_samples ;
subframe_len = s -> channel [ i ] . subframe_len [ s -> channel [ i ] . cur_subframe ] ;
}
}
av_dlog ( s -> avctx , "processing subframe with offset %i len %i\n" , offset , subframe_len ) ;
s -> channels_for_cur_subframe = 0 ;
for ( i = 0 ;
i < s -> avctx -> channels ;
i ++ ) {
const int cur_subframe = s -> channel [ i ] . cur_subframe ;
total_samples -= s -> channel [ i ] . decoded_samples ;
if ( offset == s -> channel [ i ] . decoded_samples && subframe_len == s -> channel [ i ] . subframe_len [ cur_subframe ] ) {
total_samples -= s -> channel [ i ] . subframe_len [ cur_subframe ] ;
s -> channel [ i ] . decoded_samples += s -> channel [ i ] . subframe_len [ cur_subframe ] ;
s -> channel_indexes_for_cur_subframe [ s -> channels_for_cur_subframe ] = i ;
++ s -> channels_for_cur_subframe ;
}
}
if ( ! total_samples ) s -> parsed_all_subframes = 1 ;
av_dlog ( s -> avctx , "subframe is part of %i channels\n" , s -> channels_for_cur_subframe ) ;
s -> table_idx = av_log2 ( s -> samples_per_frame / subframe_len ) ;
s -> num_bands = s -> num_sfb [ s -> table_idx ] ;
s -> cur_sfb_offsets = s -> sfb_offsets [ s -> table_idx ] ;
cur_subwoofer_cutoff = s -> subwoofer_cutoffs [ s -> table_idx ] ;
for ( i = 0 ;
i < s -> channels_for_cur_subframe ;
i ++ ) {
int c = s -> channel_indexes_for_cur_subframe [ i ] ;
s -> channel [ c ] . coeffs = & s -> channel [ c ] . out [ ( s -> samples_per_frame >> 1 ) + offset ] ;
}
s -> subframe_len = subframe_len ;
s -> esc_len = av_log2 ( s -> subframe_len - 1 ) + 1 ;
if ( get_bits1 ( & s -> gb ) ) {
int num_fill_bits ;
if ( ! ( num_fill_bits = get_bits ( & s -> gb , 2 ) ) ) {
int len = get_bits ( & s -> gb , 4 ) ;
num_fill_bits = get_bits ( & s -> gb , len ) + 1 ;
}
if ( num_fill_bits >= 0 ) {
if ( get_bits_count ( & s -> gb ) + num_fill_bits > s -> num_saved_bits ) {
av_log ( s -> avctx , AV_LOG_ERROR , "invalid number of fill bits\n" ) ;
return AVERROR_INVALIDDATA ;
}
skip_bits_long ( & s -> gb , num_fill_bits ) ;
}
}
if ( get_bits1 ( & s -> gb ) ) {
av_log_ask_for_sample ( s -> avctx , "reserved bit set\n" ) ;
return AVERROR_PATCHWELCOME ;
}
if ( decode_channel_transform ( s ) < 0 ) return AVERROR_INVALIDDATA ;
for ( i = 0 ;
i < s -> channels_for_cur_subframe ;
i ++ ) {
int c = s -> channel_indexes_for_cur_subframe [ i ] ;
if ( ( s -> channel [ c ] . transmit_coefs = get_bits1 ( & s -> gb ) ) ) transmit_coeffs = 1 ;
}
if ( transmit_coeffs ) {
int step ;
int quant_step = 90 * s -> bits_per_sample >> 4 ;
if ( ( s -> transmit_num_vec_coeffs = get_bits1 ( & s -> gb ) ) ) {
int num_bits = av_log2 ( ( s -> subframe_len + 3 ) / 4 ) + 1 ;
for ( i = 0 ;
i < s -> channels_for_cur_subframe ;
i ++ ) {
int c = s -> channel_indexes_for_cur_subframe [ i ] ;
int num_vec_coeffs = get_bits ( & s -> gb , num_bits ) << 2 ;
if ( num_vec_coeffs > WMAPRO_BLOCK_MAX_SIZE ) {
av_log ( s -> avctx , AV_LOG_ERROR , "num_vec_coeffs %d is too large\n" , num_vec_coeffs ) ;
return AVERROR_INVALIDDATA ;
}
s -> channel [ c ] . num_vec_coeffs = num_vec_coeffs ;
}
}
else {
for ( i = 0 ;
i < s -> channels_for_cur_subframe ;
i ++ ) {
int c = s -> channel_indexes_for_cur_subframe [ i ] ;
s -> channel [ c ] . num_vec_coeffs = s -> subframe_len ;
}
}
step = get_sbits ( & s -> gb , 6 ) ;
quant_step += step ;
if ( step == - 32 || step == 31 ) {
const int sign = ( step == 31 ) - 1 ;
int quant = 0 ;
while ( get_bits_count ( & s -> gb ) + 5 < s -> num_saved_bits && ( step = get_bits ( & s -> gb , 5 ) ) == 31 ) {
quant += 31 ;
}
quant_step += ( ( quant + step ) ^ sign ) - sign ;
}
if ( quant_step < 0 ) {
av_log ( s -> avctx , AV_LOG_DEBUG , "negative quant step\n" ) ;
}
if ( s -> channels_for_cur_subframe == 1 ) {
s -> channel [ s -> channel_indexes_for_cur_subframe [ 0 ] ] . quant_step = quant_step ;
}
else {
int modifier_len = get_bits ( & s -> gb , 3 ) ;
for ( i = 0 ;
i < s -> channels_for_cur_subframe ;
i ++ ) {
int c = s -> channel_indexes_for_cur_subframe [ i ] ;
s -> channel [ c ] . quant_step = quant_step ;
if ( get_bits1 ( & s -> gb ) ) {
if ( modifier_len ) {
s -> channel [ c ] . quant_step += get_bits ( & s -> gb , modifier_len ) + 1 ;
}
else ++ s -> channel [ c ] . quant_step ;
}
}
}
if ( decode_scale_factors ( s ) < 0 ) return AVERROR_INVALIDDATA ;
}
av_dlog ( s -> avctx , "BITSTREAM: subframe header length was %i\n" , get_bits_count ( & s -> gb ) - s -> subframe_offset ) ;
for ( i = 0 ;
i < s -> channels_for_cur_subframe ;
i ++ ) {
int c = s -> channel_indexes_for_cur_subframe [ i ] ;
if ( s -> channel [ c ] . transmit_coefs && get_bits_count ( & s -> gb ) < s -> num_saved_bits ) {
decode_coeffs ( s , c ) ;
}
else memset ( s -> channel [ c ] . coeffs , 0 , sizeof ( * s -> channel [ c ] . coeffs ) * subframe_len ) ;
}
av_dlog ( s -> avctx , "BITSTREAM: subframe length was %i\n" , get_bits_count ( & s -> gb ) - s -> subframe_offset ) ;
if ( transmit_coeffs ) {
FFTContext * mdct = & s -> mdct_ctx [ av_log2 ( subframe_len ) - WMAPRO_BLOCK_MIN_BITS ] ;
inverse_channel_transform ( s ) ;
for ( i = 0 ;
i < s -> channels_for_cur_subframe ;
i ++ ) {
int c = s -> channel_indexes_for_cur_subframe [ i ] ;
const int * sf = s -> channel [ c ] . scale_factors ;
int b ;
if ( c == s -> lfe_channel ) memset ( & s -> tmp [ cur_subwoofer_cutoff ] , 0 , sizeof ( * s -> tmp ) * ( subframe_len - cur_subwoofer_cutoff ) ) ;
for ( b = 0 ;
b < s -> num_bands ;
b ++ ) {
const int end = FFMIN ( s -> cur_sfb_offsets [ b + 1 ] , s -> subframe_len ) ;
const int exp = s -> channel [ c ] . quant_step - ( s -> channel [ c ] . max_scale_factor - * sf ++ ) * s -> channel [ c ] . scale_factor_step ;
const float quant = pow ( 10.0 , exp / 20.0 ) ;
int start = s -> cur_sfb_offsets [ b ] ;
s -> fdsp . vector_fmul_scalar ( s -> tmp + start , s -> channel [ c ] . coeffs + start , quant , end - start ) ;
}
mdct -> imdct_half ( mdct , s -> channel [ c ] . coeffs , s -> tmp ) ;
}
}
wmapro_window ( s ) ;
for ( i = 0 ;
i < s -> channels_for_cur_subframe ;
i ++ ) {
int c = s -> channel_indexes_for_cur_subframe [ i ] ;
if ( s -> channel [ c ] . cur_subframe >= s -> channel [ c ] . num_subframes ) {
av_log ( s -> avctx , AV_LOG_ERROR , "broken subframe\n" ) ;
return AVERROR_INVALIDDATA ;
}
++ s -> channel [ c ] . cur_subframe ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int lang_compare_first_component ( const char * a , const char * b ) {
unsigned int da , db ;
const char * p ;
p = strchr ( a , '-' ) ;
da = p ? ( unsigned int ) ( p - a ) : strlen ( a ) ;
p = strchr ( b , '-' ) ;
db = p ? ( unsigned int ) ( p - b ) : strlen ( b ) ;
return strncmp ( a , b , MAX ( da , db ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int selinux_quotactl ( int cmds , int type , int id , struct super_block * sb ) {
const struct cred * cred = current_cred ( ) ;
int rc = 0 ;
if ( ! sb ) return 0 ;
switch ( cmds ) {
case Q_SYNC : case Q_QUOTAON : case Q_QUOTAOFF : case Q_SETINFO : case Q_SETQUOTA : rc = superblock_has_perm ( cred , sb , FILESYSTEM__QUOTAMOD , NULL ) ;
break ;
case Q_GETFMT : case Q_GETINFO : case Q_GETQUOTA : rc = superblock_has_perm ( cred , sb , FILESYSTEM__QUOTAGET , NULL ) ;
break ;
default : rc = 0 ;
break ;
}
return rc ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void cl_hash ( register count_int chsize , GifCtx * ctx ) {
register count_int * htab_p = ctx -> htab + chsize ;
register long i ;
register long m1 = - 1 ;
i = chsize - 16 ;
do {
* ( htab_p - 16 ) = m1 ;
* ( htab_p - 15 ) = m1 ;
* ( htab_p - 14 ) = m1 ;
* ( htab_p - 13 ) = m1 ;
* ( htab_p - 12 ) = m1 ;
* ( htab_p - 11 ) = m1 ;
* ( htab_p - 10 ) = m1 ;
* ( htab_p - 9 ) = m1 ;
* ( htab_p - 8 ) = m1 ;
* ( htab_p - 7 ) = m1 ;
* ( htab_p - 6 ) = m1 ;
* ( htab_p - 5 ) = m1 ;
* ( htab_p - 4 ) = m1 ;
* ( htab_p - 3 ) = m1 ;
* ( htab_p - 2 ) = m1 ;
* ( htab_p - 1 ) = m1 ;
htab_p -= 16 ;
}
while ( ( i -= 16 ) >= 0 ) ;
for ( i += 16 ;
i > 0 ;
-- i ) {
* -- htab_p = m1 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void init_mv4_ref ( MotionEstContext * c ) {
const int stride = c -> stride ;
c -> ref [ 1 ] [ 0 ] = c -> ref [ 0 ] [ 0 ] + 8 ;
c -> ref [ 2 ] [ 0 ] = c -> ref [ 0 ] [ 0 ] + 8 * stride ;
c -> ref [ 3 ] [ 0 ] = c -> ref [ 2 ] [ 0 ] + 8 ;
c -> src [ 1 ] [ 0 ] = c -> src [ 0 ] [ 0 ] + 8 ;
c -> src [ 2 ] [ 0 ] = c -> src [ 0 ] [ 0 ] + 8 * stride ;
c -> src [ 3 ] [ 0 ] = c -> src [ 2 ] [ 0 ] + 8 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void wmapro_window ( WMAProDecodeCtx * s ) {
int i ;
for ( i = 0 ;
i < s -> channels_for_cur_subframe ;
i ++ ) {
int c = s -> channel_indexes_for_cur_subframe [ i ] ;
float * window ;
int winlen = s -> channel [ c ] . prev_block_len ;
float * start = s -> channel [ c ] . coeffs - ( winlen >> 1 ) ;
if ( s -> subframe_len < winlen ) {
start += ( winlen - s -> subframe_len ) >> 1 ;
winlen = s -> subframe_len ;
}
window = s -> windows [ av_log2 ( winlen ) - WMAPRO_BLOCK_MIN_BITS ] ;
winlen >>= 1 ;
s -> fdsp . vector_fmul_window ( start , start , start + winlen , window , winlen ) ;
s -> channel [ c ] . prev_block_len = s -> subframe_len ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
RSA * d2i_RSAPrivateKey_bio ( BIO * bp , RSA * * rsa ) {
return ASN1_item_d2i_bio ( ASN1_ITEM_rptr ( RSAPrivateKey ) , bp , rsa ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
gcry_error_t _gcry_sexp_vbuild ( gcry_sexp_t * retsexp , size_t * erroff , const char * format , va_list arg_ptr ) {
return vsexp_sscan ( retsexp , erroff , format , strlen ( format ) , 1 , NULL , arg_ptr ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void AddTok ( GrowBuf * gb , char * buf , int islit ) {
if ( islit ) GrowBufferAdd ( gb , '/' ) ;
GrowBufferAddStr ( gb , buf ) ;
GrowBufferAdd ( gb , ' ' ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pk_transaction_dispose ( GObject * object ) {
PkTransaction * transaction ;
g_return_if_fail ( PK_IS_TRANSACTION ( object ) ) ;
transaction = PK_TRANSACTION ( object ) ;
if ( transaction -> priv -> waiting_for_auth ) {
g_cancellable_cancel ( transaction -> priv -> cancellable ) ;
pk_transaction_error_code_emit ( transaction , PK_ERROR_ENUM_NOT_AUTHORIZED , "client did not authorize action" ) ;
pk_transaction_finished_emit ( transaction , PK_EXIT_ENUM_FAILED , 0 ) ;
}
if ( transaction -> priv -> registration_id > 0 ) {
g_dbus_connection_unregister_object ( transaction -> priv -> connection , transaction -> priv -> registration_id ) ;
transaction -> priv -> registration_id = 0 ;
}
if ( transaction -> priv -> connection != NULL ) {
g_debug ( "emitting destroy %s" , transaction -> priv -> tid ) ;
g_dbus_connection_emit_signal ( transaction -> priv -> connection , NULL , transaction -> priv -> tid , PK_DBUS_INTERFACE_TRANSACTION , "Destroy" , NULL , NULL ) ;
}
G_OBJECT_CLASS ( pk_transaction_parent_class ) -> dispose ( object ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void vga_draw_line2d2 ( VGACommonState * s1 , uint8_t * d , const uint8_t * s , int width ) {
uint32_t plane_mask , * palette , data , v ;
int x ;
palette = s1 -> last_palette ;
plane_mask = mask16 [ s1 -> ar [ VGA_ATC_PLANE_ENABLE ] & 0xf ] ;
width >>= 3 ;
for ( x = 0 ;
x < width ;
x ++ ) {
data = ( ( uint32_t * ) s ) [ 0 ] ;
data &= plane_mask ;
v = expand2 [ GET_PLANE ( data , 0 ) ] ;
v |= expand2 [ GET_PLANE ( data , 2 ) ] << 2 ;
PUT_PIXEL2 ( d , 0 , palette [ v >> 12 ] ) ;
PUT_PIXEL2 ( d , 1 , palette [ ( v >> 8 ) & 0xf ] ) ;
PUT_PIXEL2 ( d , 2 , palette [ ( v >> 4 ) & 0xf ] ) ;
PUT_PIXEL2 ( d , 3 , palette [ ( v >> 0 ) & 0xf ] ) ;
v = expand2 [ GET_PLANE ( data , 1 ) ] ;
v |= expand2 [ GET_PLANE ( data , 3 ) ] << 2 ;
PUT_PIXEL2 ( d , 4 , palette [ v >> 12 ] ) ;
PUT_PIXEL2 ( d , 5 , palette [ ( v >> 8 ) & 0xf ] ) ;
PUT_PIXEL2 ( d , 6 , palette [ ( v >> 4 ) & 0xf ] ) ;
PUT_PIXEL2 ( d , 7 , palette [ ( v >> 0 ) & 0xf ] ) ;
d += 64 ;
s += 4 ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int main ( int argc , char * argv [ ] ) {
static struct option long_options [ ] = {
{
"host" , required_argument , NULL , 'h' }
, {
"port" , required_argument , NULL , 'p' }
, {
"username" , required_argument , NULL , 'U' }
, {
"no-password" , no_argument , NULL , 'w' }
, {
"password" , no_argument , NULL , 'W' }
, {
"echo" , no_argument , NULL , 'e' }
, {
"quiet" , no_argument , NULL , 'q' }
, {
"schema" , required_argument , NULL , 'S' }
, {
"dbname" , required_argument , NULL , 'd' }
, {
"all" , no_argument , NULL , 'a' }
, {
"system" , no_argument , NULL , 's' }
, {
"table" , required_argument , NULL , 't' }
, {
"index" , required_argument , NULL , 'i' }
, {
"verbose" , no_argument , NULL , 'v' }
, {
"maintenance-db" , required_argument , NULL , 2 }
, {
NULL , 0 , NULL , 0 }
}
;
const char * progname ;
int optindex ;
int c ;
const char * dbname = NULL ;
const char * maintenance_db = NULL ;
const char * host = NULL ;
const char * port = NULL ;
const char * username = NULL ;
enum trivalue prompt_password = TRI_DEFAULT ;
bool syscatalog = false ;
bool alldb = false ;
bool echo = false ;
bool quiet = false ;
bool verbose = false ;
SimpleStringList indexes = {
NULL , NULL }
;
SimpleStringList tables = {
NULL , NULL }
;
SimpleStringList schemas = {
NULL , NULL }
;
progname = get_progname ( argv [ 0 ] ) ;
set_pglocale_pgservice ( argv [ 0 ] , PG_TEXTDOMAIN ( "pgscripts" ) ) ;
handle_help_version_opts ( argc , argv , "reindexdb" , help ) ;
while ( ( c = getopt_long ( argc , argv , "h:p:U:wWeqS:d:ast:i:v" , long_options , & optindex ) ) != - 1 ) {
switch ( c ) {
case 'h' : host = pg_strdup ( optarg ) ;
break ;
case 'p' : port = pg_strdup ( optarg ) ;
break ;
case 'U' : username = pg_strdup ( optarg ) ;
break ;
case 'w' : prompt_password = TRI_NO ;
break ;
case 'W' : prompt_password = TRI_YES ;
break ;
case 'e' : echo = true ;
break ;
case 'q' : quiet = true ;
break ;
case 'S' : simple_string_list_append ( & schemas , optarg ) ;
break ;
case 'd' : dbname = pg_strdup ( optarg ) ;
break ;
case 'a' : alldb = true ;
break ;
case 's' : syscatalog = true ;
break ;
case 't' : simple_string_list_append ( & tables , optarg ) ;
break ;
case 'i' : simple_string_list_append ( & indexes , optarg ) ;
break ;
case 'v' : verbose = true ;
break ;
case 2 : maintenance_db = pg_strdup ( optarg ) ;
break ;
default : fprintf ( stderr , _ ( "Try \"%s --help\" for more information.\n" ) , progname ) ;
exit ( 1 ) ;
}
}
if ( optind < argc && dbname == NULL ) {
dbname = argv [ optind ] ;
optind ++ ;
}
if ( optind < argc ) {
fprintf ( stderr , _ ( "%s: too many command-line arguments (first is \"%s\")\n" ) , progname , argv [ optind ] ) ;
fprintf ( stderr , _ ( "Try \"%s --help\" for more information.\n" ) , progname ) ;
exit ( 1 ) ;
}
setup_cancel_handler ( ) ;
if ( alldb ) {
if ( dbname ) {
fprintf ( stderr , _ ( "%s: cannot reindex all databases and a specific one at the same time\n" ) , progname ) ;
exit ( 1 ) ;
}
if ( syscatalog ) {
fprintf ( stderr , _ ( "%s: cannot reindex all databases and system catalogs at the same time\n" ) , progname ) ;
exit ( 1 ) ;
}
if ( schemas . head != NULL ) {
fprintf ( stderr , _ ( "%s: cannot reindex specific schema(s) in all databases\n" ) , progname ) ;
exit ( 1 ) ;
}
if ( tables . head != NULL ) {
fprintf ( stderr , _ ( "%s: cannot reindex specific table(s) in all databases\n" ) , progname ) ;
exit ( 1 ) ;
}
if ( indexes . head != NULL ) {
fprintf ( stderr , _ ( "%s: cannot reindex specific index(es) in all databases\n" ) , progname ) ;
exit ( 1 ) ;
}
reindex_all_databases ( maintenance_db , host , port , username , prompt_password , progname , echo , quiet , verbose ) ;
}
else if ( syscatalog ) {
if ( schemas . head != NULL ) {
fprintf ( stderr , _ ( "%s: cannot reindex specific schema(s) and system catalogs at the same time\n" ) , progname ) ;
exit ( 1 ) ;
}
if ( tables . head != NULL ) {
fprintf ( stderr , _ ( "%s: cannot reindex specific table(s) and system catalogs at the same time\n" ) , progname ) ;
exit ( 1 ) ;
}
if ( indexes . head != NULL ) {
fprintf ( stderr , _ ( "%s: cannot reindex specific index(es) and system catalogs at the same time\n" ) , progname ) ;
exit ( 1 ) ;
}
if ( dbname == NULL ) {
if ( getenv ( "PGDATABASE" ) ) dbname = getenv ( "PGDATABASE" ) ;
else if ( getenv ( "PGUSER" ) ) dbname = getenv ( "PGUSER" ) ;
else dbname = get_user_name_or_exit ( progname ) ;
}
reindex_system_catalogs ( dbname , host , port , username , prompt_password , progname , echo , verbose ) ;
}
else {
if ( dbname == NULL ) {
if ( getenv ( "PGDATABASE" ) ) dbname = getenv ( "PGDATABASE" ) ;
else if ( getenv ( "PGUSER" ) ) dbname = getenv ( "PGUSER" ) ;
else dbname = get_user_name_or_exit ( progname ) ;
}
if ( schemas . head != NULL ) {
SimpleStringListCell * cell ;
for ( cell = schemas . head ;
cell ;
cell = cell -> next ) {
reindex_one_database ( cell -> val , dbname , "SCHEMA" , host , port , username , prompt_password , progname , echo , verbose ) ;
}
}
if ( indexes . head != NULL ) {
SimpleStringListCell * cell ;
for ( cell = indexes . head ;
cell ;
cell = cell -> next ) {
reindex_one_database ( cell -> val , dbname , "INDEX" , host , port , username , prompt_password , progname , echo , verbose ) ;
}
}
if ( tables . head != NULL ) {
SimpleStringListCell * cell ;
for ( cell = tables . head ;
cell ;
cell = cell -> next ) {
reindex_one_database ( cell -> val , dbname , "TABLE" , host , port , username , prompt_password , progname , echo , verbose ) ;
}
}
if ( indexes . head == NULL && tables . head == NULL && schemas . head == NULL ) reindex_one_database ( NULL , dbname , "DATABASE" , host , port , username , prompt_password , progname , echo , verbose ) ;
}
exit ( 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void option_depth ( const char * depth ) {
max_depth = ulong_arg ( "--depth" , depth ) ;
if ( max_depth > MAX_DEPTH ) die ( "--depth cannot exceed %u" , MAX_DEPTH ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_MediaDistributionCapability ( 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_MediaDistributionCapability , MediaDistributionCapability_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void kadmin_modprinc ( int argc , char * argv [ ] ) {
kadm5_principal_ent_rec princ , oldprinc ;
krb5_principal kprinc = NULL ;
long mask ;
krb5_error_code retval ;
char * pass , * canon = NULL ;
krb5_boolean randkey = FALSE ;
int n_ks_tuple = 0 ;
krb5_key_salt_tuple * ks_tuple = NULL ;
if ( argc < 2 ) {
kadmin_modprinc_usage ( ) ;
return ;
}
memset ( & oldprinc , 0 , sizeof ( oldprinc ) ) ;
memset ( & princ , 0 , sizeof ( princ ) ) ;
retval = kadmin_parse_name ( argv [ argc - 1 ] , & kprinc ) ;
if ( retval ) {
com_err ( "modify_principal" , retval , _ ( "while parsing principal" ) ) ;
return ;
}
retval = krb5_unparse_name ( context , kprinc , & canon ) ;
if ( retval ) {
com_err ( "modify_principal" , retval , _ ( "while canonicalizing principal" ) ) ;
goto cleanup ;
}
retval = kadm5_get_principal ( handle , kprinc , & oldprinc , KADM5_PRINCIPAL_NORMAL_MASK ) ;
if ( retval ) {
com_err ( "modify_principal" , retval , _ ( "while getting \"%s\"." ) , canon ) ;
goto cleanup ;
}
princ . attributes = oldprinc . attributes ;
kadm5_free_principal_ent ( handle , & oldprinc ) ;
retval = kadmin_parse_princ_args ( argc , argv , & princ , & mask , & pass , & randkey , & ks_tuple , & n_ks_tuple , "modify_principal" ) ;
if ( retval || ks_tuple != NULL || randkey || pass ) {
kadmin_modprinc_usage ( ) ;
goto cleanup ;
}
if ( mask ) {
retval = kadm5_modify_principal ( handle , & princ , mask ) ;
}
if ( retval ) {
com_err ( "modify_principal" , retval , _ ( "while modifying \"%s\"." ) , canon ) ;
goto cleanup ;
}
printf ( _ ( "Principal \"%s\" modified.\n" ) , canon ) ;
cleanup : krb5_free_principal ( context , kprinc ) ;
krb5_free_principal ( context , princ . principal ) ;
kadmin_free_tl_data ( & princ . n_tl_data , & princ . tl_data ) ;
free ( canon ) ;
free ( ks_tuple ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int luaD_protectedparser ( lua_State * L , ZIO * z , const char * name ) {
struct SParser p ;
int status ;
p . z = z ;
p . name = name ;
luaZ_initbuffer ( L , & p . buff ) ;
status = luaD_pcall ( L , f_parser , & p , savestack ( L , L -> top ) , L -> errfunc ) ;
luaZ_freebuffer ( L , & p . buff ) ;
return status ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void proto_reg_handoff_q931 ( void ) {
dissector_add_uint ( "lapd.sapi" , LAPD_SAPI_Q931 , q931_handle ) ;
dissector_add_uint ( "sctp.ppi" , H323_PAYLOAD_PROTOCOL_ID , q931_over_ip_handle ) ;
dissector_add_uint ( "osinl.incl" , NLPID_Q_931 , q931_handle ) ;
h225_handle = find_dissector_add_dependency ( "h225" , proto_q931 ) ;
heur_dissector_add ( "tcp" , dissect_q931_tpkt_heur , "Q.931 over TPKT over TCP" , "q931_tcp" , proto_q931 , HEURISTIC_ENABLE ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void show_object ( struct object * obj , const char * name , void * cb_data ) {
struct rev_list_info * info = cb_data ;
finish_object ( obj , name , cb_data ) ;
if ( info -> flags & REV_LIST_QUIET ) return ;
show_object_with_name ( stdout , obj , name ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_sad ## m ## x ## n ## x ## k ## _c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < k ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , & ref [ i ] , ref_stride ) ;
\ }
# define sadMxNx4D ( m , n ) void vp9_sad ## m ## x ## n ## x4d_c ( const uint8_t * src , int src_stride , const uint8_t * const refs [ ] , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < 4 ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , refs [ i ] , ref_stride ) ;
\ }
sadMxN ( 64 , 64 ) sadMxNxK ( 64 , 64 , 3 ) sadMxNxK ( 64 , 64 , 8 ) sadMxNx4D ( 64 , 64 ) sadMxN ( 64 , 32 ) sadMxNx4D ( 64 , 32 ) sadMxN ( 32 , 64 ) sadMxNx4D ( 32 , 64 ) sadMxN ( 32 , 32 ) sadMxNxK ( 32 , 32 , 3 ) sadMxNxK ( 32 , 32 , 8 ) sadMxNx4D ( 32 , 32 ) sadMxN ( 32 , 16 ) sadMxNx4D ( 32 , 16 ) sadMxN ( 16 , 32 ) sadMxNx4D ( 16 , 32 ) sadMxN ( 16 , 16 ) sadMxNxK ( 16 , 16 , 3 ) sadMxNxK ( 16 , 16 , 8 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int sse_mb ( MpegEncContext * s ) {
int w = 16 ;
int h = 16 ;
if ( s -> mb_x * 16 + 16 > s -> width ) w = s -> width - s -> mb_x * 16 ;
if ( s -> mb_y * 16 + 16 > s -> height ) h = s -> height - s -> mb_y * 16 ;
if ( w == 16 && h == 16 ) if ( s -> avctx -> mb_cmp == FF_CMP_NSSE ) {
return s -> dsp . nsse [ 0 ] ( s , s -> new_picture . f . data [ 0 ] + s -> mb_x * 16 + s -> mb_y * s -> linesize * 16 , s -> dest [ 0 ] , s -> linesize , 16 ) + s -> dsp . nsse [ 1 ] ( s , s -> new_picture . f . data [ 1 ] + s -> mb_x * 8 + s -> mb_y * s -> uvlinesize * 8 , s -> dest [ 1 ] , s -> uvlinesize , 8 ) + s -> dsp . nsse [ 1 ] ( s , s -> new_picture . f . data [ 2 ] + s -> mb_x * 8 + s -> mb_y * s -> uvlinesize * 8 , s -> dest [ 2 ] , s -> uvlinesize , 8 ) ;
}
else {
return s -> dsp . sse [ 0 ] ( NULL , s -> new_picture . f . data [ 0 ] + s -> mb_x * 16 + s -> mb_y * s -> linesize * 16 , s -> dest [ 0 ] , s -> linesize , 16 ) + s -> dsp . sse [ 1 ] ( NULL , s -> new_picture . f . data [ 1 ] + s -> mb_x * 8 + s -> mb_y * s -> uvlinesize * 8 , s -> dest [ 1 ] , s -> uvlinesize , 8 ) + s -> dsp . sse [ 1 ] ( NULL , s -> new_picture . f . data [ 2 ] + s -> mb_x * 8 + s -> mb_y * s -> uvlinesize * 8 , s -> dest [ 2 ] , s -> uvlinesize , 8 ) ;
}
else return sse ( s , s -> new_picture . f . data [ 0 ] + s -> mb_x * 16 + s -> mb_y * s -> linesize * 16 , s -> dest [ 0 ] , w , h , s -> linesize ) + sse ( s , s -> new_picture . f . data [ 1 ] + s -> mb_x * 8 + s -> mb_y * s -> uvlinesize * 8 , s -> dest [ 1 ] , w >> 1 , h >> 1 , s -> uvlinesize ) + sse ( s , s -> new_picture . f . data [ 2 ] + s -> mb_x * 8 + s -> mb_y * s -> uvlinesize * 8 , s -> dest [ 2 ] , w >> 1 , h >> 1 , s -> uvlinesize ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_H261VideoMode ( 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_H261VideoMode , H261VideoMode_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void uprv_start ( UTimer * timer ) {
gettimeofday ( & timer -> start , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int selinux_socket_getpeername ( struct socket * sock ) {
return sock_has_perm ( current , sock -> sk , SOCKET__GETATTR ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void vapic_enable_tpr_reporting ( bool enable ) {
VAPICEnableTPRReporting info = {
. enable = enable , }
;
X86CPU * cpu ;
CPUX86State * env ;
for ( env = first_cpu ;
env != NULL ;
env = env -> next_cpu ) {
cpu = x86_env_get_cpu ( env ) ;
info . apic = env -> apic_state ;
run_on_cpu ( CPU ( cpu ) , vapic_do_enable_tpr_reporting , & info ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int rac_get_bit ( RangeCoder * c ) {
int bit ;
c -> range >>= 1 ;
bit = ( c -> range <= c -> low ) ;
if ( bit ) c -> low -= c -> range ;
if ( c -> range < RAC_BOTTOM ) rac_normalise ( c ) ;
return bit ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void copy_context_after_encode ( MpegEncContext * d , MpegEncContext * s , int type ) {
int i ;
memcpy ( d -> mv , s -> mv , 2 * 4 * 2 * sizeof ( int ) ) ;
memcpy ( d -> last_mv , s -> last_mv , 2 * 2 * 2 * sizeof ( int ) ) ;
d -> mb_skip_run = s -> mb_skip_run ;
for ( i = 0 ;
i < 3 ;
i ++ ) d -> last_dc [ i ] = s -> last_dc [ i ] ;
d -> mv_bits = s -> mv_bits ;
d -> i_tex_bits = s -> i_tex_bits ;
d -> p_tex_bits = s -> p_tex_bits ;
d -> i_count = s -> i_count ;
d -> f_count = s -> f_count ;
d -> b_count = s -> b_count ;
d -> skip_count = s -> skip_count ;
d -> misc_bits = s -> misc_bits ;
d -> mb_intra = s -> mb_intra ;
d -> mb_skipped = s -> mb_skipped ;
d -> mv_type = s -> mv_type ;
d -> mv_dir = s -> mv_dir ;
d -> pb = s -> pb ;
if ( s -> data_partitioning ) {
d -> pb2 = s -> pb2 ;
d -> tex_pb = s -> tex_pb ;
}
d -> block = s -> block ;
for ( i = 0 ;
i < 8 ;
i ++ ) d -> block_last_index [ i ] = s -> block_last_index [ i ] ;
d -> interlaced_dct = s -> interlaced_dct ;
d -> qscale = s -> qscale ;
d -> esc3_level_length = s -> esc3_level_length ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void proto_get_frame_protocols ( const wmem_list_t * layers , gboolean * is_ip , gboolean * is_tcp , gboolean * is_udp , gboolean * is_sctp , gboolean * is_ssl , gboolean * is_rtp , gboolean * is_lte_rlc ) {
wmem_list_frame_t * protos = wmem_list_head ( layers ) ;
int proto_id ;
const char * proto_name ;
while ( protos != NULL ) {
proto_id = GPOINTER_TO_INT ( wmem_list_frame_data ( protos ) ) ;
proto_name = proto_get_protocol_filter_name ( proto_id ) ;
if ( is_ip && ( ( ! strcmp ( proto_name , "ip" ) ) || ( ! strcmp ( proto_name , "ipv6" ) ) ) ) {
* is_ip = TRUE ;
}
else if ( is_tcp && ! strcmp ( proto_name , "tcp" ) ) {
* is_tcp = TRUE ;
}
else if ( is_udp && ! strcmp ( proto_name , "udp" ) ) {
* is_udp = TRUE ;
}
else if ( is_sctp && ! strcmp ( proto_name , "sctp" ) ) {
* is_sctp = TRUE ;
}
else if ( is_ssl && ! strcmp ( proto_name , "ssl" ) ) {
* is_ssl = TRUE ;
}
else if ( is_rtp && ! strcmp ( proto_name , "rtp" ) ) {
* is_rtp = TRUE ;
}
else if ( is_lte_rlc && ! strcmp ( proto_name , "rlc-lte" ) ) {
* is_lte_rlc = TRUE ;
}
protos = wmem_list_frame_next ( protos ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_MultiplexEntrySendReject ( 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_MultiplexEntrySendReject , MultiplexEntrySendReject_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_ScnConnectionType ( 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_h225_ScnConnectionType , ScnConnectionType_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_view_insert_fields ( ) {
MYSQL_STMT * stmt ;
char parm [ 11 ] [ 1000 ] ;
ulong l [ 11 ] ;
int rc , i ;
MYSQL_BIND my_bind [ 11 ] ;
const char * query = "INSERT INTO `v1` ( `K1C4` ,`K2C4` ,`K3C4` ,`K4N4` ,`F1C4` ,`F2I4` ,`F3N5` ,`F7F8` ,`F6N4` ,`F5C8` ,`F9D8` ) VALUES( ? , ? , ? , ? , ? , ? , ? , ? , ? , ? , ? )" ;
myheader ( "test_view_insert_fields" ) ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS t1, v1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "DROP VIEW IF EXISTS t1, v1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE t1 (K1C4 varchar(4) NOT NULL," "K2C4 varchar(4) NOT NULL, K3C4 varchar(4) NOT NULL," "K4N4 varchar(4) NOT NULL default '0000'," "F1C4 varchar(4) NOT NULL, F2I4 int(11) NOT NULL," "F3N5 varchar(5) NOT NULL default '00000'," "F4I4 int(11) NOT NULL default '0', F5C8 varchar(8) NOT NULL," "F6N4 varchar(4) NOT NULL default '0000'," "F7F8 double NOT NULL default '0'," "F8F8 double NOT NULL default '0'," "F9D8 decimal(8,2) NOT NULL default '0.00'," "PRIMARY KEY (K1C4,K2C4,K3C4,K4N4)) " "CHARSET=latin1 COLLATE latin1_bin" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE VIEW v1 AS select sql_no_cache " " K1C4 AS K1C4, K2C4 AS K2C4, K3C4 AS K3C4, K4N4 AS K4N4, " " F1C4 AS F1C4, F2I4 AS F2I4, F3N5 AS F3N5," " F7F8 AS F7F8, F6N4 AS F6N4, F5C8 AS F5C8, F9D8 AS F9D8" " from t1 T0001" ) ;
memset ( my_bind , 0 , sizeof ( my_bind ) ) ;
for ( i = 0 ;
i < 11 ;
i ++ ) {
l [ i ] = 20 ;
my_bind [ i ] . buffer_type = MYSQL_TYPE_STRING ;
my_bind [ i ] . is_null = 0 ;
my_bind [ i ] . buffer = ( char * ) & parm [ i ] ;
strmov ( parm [ i ] , "1" ) ;
my_bind [ i ] . buffer_length = 2 ;
my_bind [ i ] . length = & l [ i ] ;
}
stmt = mysql_stmt_init ( mysql ) ;
rc = mysql_stmt_prepare ( stmt , query , strlen ( query ) ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_bind_param ( stmt , my_bind ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
mysql_stmt_close ( stmt ) ;
query = "select * from t1" ;
stmt = mysql_stmt_init ( mysql ) ;
rc = mysql_stmt_prepare ( stmt , query , strlen ( query ) ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
rc = my_process_stmt_result ( stmt ) ;
DIE_UNLESS ( 1 == rc ) ;
mysql_stmt_close ( stmt ) ;
rc = mysql_query ( mysql , "DROP VIEW v1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "DROP TABLE t1" ) ;
myquery ( rc ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int mspack_fmap_seek ( struct mspack_file * file , off_t offset , int mode ) {
struct mspack_handle * mspack_handle = ( struct mspack_handle * ) file ;
if ( ! mspack_handle ) {
cli_dbgmsg ( "%s() err %d\n" , __func__ , __LINE__ ) ;
return - 1 ;
}
if ( mspack_handle -> type == FILETYPE_FMAP ) {
off_t new_pos ;
switch ( mode ) {
case MSPACK_SYS_SEEK_START : new_pos = offset ;
break ;
case MSPACK_SYS_SEEK_CUR : new_pos = mspack_handle -> offset + offset ;
break ;
case MSPACK_SYS_SEEK_END : new_pos = mspack_handle -> fmap -> len + offset ;
break ;
default : cli_dbgmsg ( "%s() err %d\n" , __func__ , __LINE__ ) ;
return - 1 ;
}
if ( new_pos < 0 || new_pos > mspack_handle -> fmap -> len ) {
cli_dbgmsg ( "%s() err %d\n" , __func__ , __LINE__ ) ;
return - 1 ;
}
mspack_handle -> offset = new_pos ;
return 0 ;
}
switch ( mode ) {
case MSPACK_SYS_SEEK_START : mode = SEEK_SET ;
break ;
case MSPACK_SYS_SEEK_CUR : mode = SEEK_CUR ;
break ;
case MSPACK_SYS_SEEK_END : mode = SEEK_END ;
break ;
default : cli_dbgmsg ( "%s() err %d\n" , __func__ , __LINE__ ) ;
return - 1 ;
}
return fseek ( mspack_handle -> f , offset , mode ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int gfboost_qadjust ( int qindex ) {
const double q = vp9_convert_qindex_to_q ( qindex ) ;
return ( int ) ( ( 0.00000828 * q * q * q ) + ( - 0.0055 * q * q ) + ( 1.32 * q ) + 79.3 ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void update_qscale ( MpegEncContext * s ) {
s -> qscale = ( s -> lambda * 139 + FF_LAMBDA_SCALE * 64 ) >> ( FF_LAMBDA_SHIFT + 7 ) ;
s -> qscale = av_clip ( s -> qscale , s -> avctx -> qmin , s -> avctx -> qmax ) ;
s -> lambda2 = ( s -> lambda * s -> lambda + FF_LAMBDA_SCALE / 2 ) >> FF_LAMBDA_SHIFT ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
proto_item * ptvcursor_add ( ptvcursor_t * ptvc , int hfindex , gint length , const guint encoding ) {
field_info * new_fi ;
header_field_info * hfinfo ;
gint item_length ;
int offset ;
offset = ptvc -> offset ;
PROTO_REGISTRAR_GET_NTH ( hfindex , hfinfo ) ;
get_hfi_length ( hfinfo , ptvc -> tvb , offset , & length , & item_length ) ;
test_length ( hfinfo , ptvc -> tvb , offset , item_length ) ;
ptvc -> offset += get_full_length ( hfinfo , ptvc -> tvb , offset , length , item_length , encoding ) ;
CHECK_FOR_NULL_TREE ( ptvc -> tree ) ;
TRY_TO_FAKE_THIS_ITEM ( ptvc -> tree , hfindex , hfinfo ) ;
new_fi = new_field_info ( ptvc -> tree , hfinfo , ptvc -> tvb , offset , item_length ) ;
return proto_tree_new_item ( new_fi , ptvc -> tree , ptvc -> tvb , offset , length , encoding ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint32 get_uint32 ( tvbuff_t * tvb , gint32 offset , gint encoding ) {
return ( ENC_BIG_ENDIAN == encoding ) ? tvb_get_ntohl ( tvb , offset ) : tvb_get_letohl ( tvb , offset ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint64_t htonll ( uint64_t val ) {
static int config = 0 ;
uint32_t hi ;
uint32_t lo ;
if ( config == 0 ) {
uint16_t h = 0x1234 ;
uint16_t n = htons ( h ) ;
if ( h == n ) config = 1 ;
else config = 2 ;
}
if ( config == 1 ) return ( val ) ;
hi = ( uint32_t ) ( val >> 32 ) ;
lo = ( uint32_t ) ( val & 0x00000000FFFFFFFF ) ;
hi = htonl ( hi ) ;
lo = htonl ( lo ) ;
return ( ( ( ( uint64_t ) lo ) << 32 ) | ( ( uint64_t ) hi ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
const mbfl_encoding * mbfl_encoding_detector_judge2 ( mbfl_encoding_detector * identd ) {
mbfl_identify_filter * filter ;
const mbfl_encoding * encoding = NULL ;
int n ;
if ( identd != NULL ) {
n = identd -> filter_list_size - 1 ;
while ( n >= 0 ) {
filter = identd -> filter_list [ n ] ;
if ( ! filter -> flag ) {
if ( ! identd -> strict || ! filter -> status ) {
encoding = filter -> encoding ;
}
}
n -- ;
}
if ( ! encoding ) {
n = identd -> filter_list_size - 1 ;
while ( n >= 0 ) {
filter = identd -> filter_list [ n ] ;
if ( ! filter -> flag ) {
encoding = filter -> encoding ;
}
n -- ;
}
}
}
return encoding ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void print_short_term ( H264Context * h ) {
uint32_t i ;
if ( h -> avctx -> debug & FF_DEBUG_MMCO ) {
av_log ( h -> avctx , AV_LOG_DEBUG , "short term list:\n" ) ;
for ( i = 0 ;
i < h -> short_ref_count ;
i ++ ) {
Picture * pic = h -> short_ref [ i ] ;
av_log ( h -> avctx , AV_LOG_DEBUG , "%d fn:%d poc:%d %p\n" , i , pic -> frame_num , pic -> poc , pic -> f . data [ 0 ] ) ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int vpx_img_set_rect ( vpx_image_t * img , unsigned int x , unsigned int y , unsigned int w , unsigned int h ) {
unsigned char * data ;
if ( x + w <= img -> w && y + h <= img -> h ) {
img -> d_w = w ;
img -> d_h = h ;
if ( ! ( img -> fmt & VPX_IMG_FMT_PLANAR ) ) {
img -> planes [ VPX_PLANE_PACKED ] = img -> img_data + x * img -> bps / 8 + y * img -> stride [ VPX_PLANE_PACKED ] ;
}
else {
data = img -> img_data ;
if ( img -> fmt & VPX_IMG_FMT_HAS_ALPHA ) {
img -> planes [ VPX_PLANE_ALPHA ] = data + x + y * img -> stride [ VPX_PLANE_ALPHA ] ;
data += img -> h * img -> stride [ VPX_PLANE_ALPHA ] ;
}
img -> planes [ VPX_PLANE_Y ] = data + x + y * img -> stride [ VPX_PLANE_Y ] ;
data += img -> h * img -> stride [ VPX_PLANE_Y ] ;
if ( ! ( img -> fmt & VPX_IMG_FMT_UV_FLIP ) ) {
img -> planes [ VPX_PLANE_U ] = data + ( x >> img -> x_chroma_shift ) + ( y >> img -> y_chroma_shift ) * img -> stride [ VPX_PLANE_U ] ;
data += ( img -> h >> img -> y_chroma_shift ) * img -> stride [ VPX_PLANE_U ] ;
img -> planes [ VPX_PLANE_V ] = data + ( x >> img -> x_chroma_shift ) + ( y >> img -> y_chroma_shift ) * img -> stride [ VPX_PLANE_V ] ;
}
else {
img -> planes [ VPX_PLANE_V ] = data + ( x >> img -> x_chroma_shift ) + ( y >> img -> y_chroma_shift ) * img -> stride [ VPX_PLANE_V ] ;
data += ( img -> h >> img -> y_chroma_shift ) * img -> stride [ VPX_PLANE_V ] ;
img -> planes [ VPX_PLANE_U ] = data + ( x >> img -> x_chroma_shift ) + ( y >> img -> y_chroma_shift ) * img -> stride [ VPX_PLANE_U ] ;
}
}
return 0 ;
}
return - 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSParseResult TSMimeHdrParse ( TSMimeParser parser , TSMBuffer bufp , TSMLoc obj , const char * * start , const char * end ) {
sdk_assert ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) ;
sdk_assert ( ( sdk_sanity_check_mime_hdr_handle ( obj ) == TS_SUCCESS ) || ( sdk_sanity_check_http_hdr_handle ( obj ) == TS_SUCCESS ) ) ;
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) start ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) * start ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) end ) == TS_SUCCESS ) ;
if ( ! isWriteable ( bufp ) ) {
return TS_PARSE_ERROR ;
}
MIMEHdrImpl * mh = _hdr_mloc_to_mime_hdr_impl ( obj ) ;
return ( TSParseResult ) mime_parser_parse ( ( MIMEParser * ) parser , ( ( HdrHeapSDKHandle * ) bufp ) -> m_heap , mh , start , end , false , false ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void _del_alloc_pack_msg ( void * x ) {
resource_allocation_response_msg_t * alloc_msg ;
alloc_msg = ( resource_allocation_response_msg_t * ) x ;
alloc_msg -> working_cluster_rec = NULL ;
slurm_free_resource_allocation_response_msg_members ( alloc_msg ) ;
xfree ( alloc_msg ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void arith_init ( ArithCoder * c , GetBitContext * gb ) {
c -> low = 0 ;
c -> high = 0xFFFF ;
c -> value = get_bits ( gb , 16 ) ;
c -> gbc . gb = gb ;
c -> get_model_sym = arith_get_model_sym ;
c -> get_number = arith_get_number ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void cookedprint ( int datatype , int length , const char * data , int status , int quiet , FILE * fp ) {
char * name ;
char * value ;
char output_raw ;
int fmt ;
l_fp lfp ;
sockaddr_u hval ;
u_long uval ;
int narr ;
size_t len ;
l_fp lfparr [ 8 ] ;
char b [ 12 ] ;
char bn [ 2 * MAXVARLEN ] ;
char bv [ 2 * MAXVALLEN ] ;
UNUSED_ARG ( datatype ) ;
if ( ! quiet ) fprintf ( fp , "status=%04x %s,\n" , status , statustoa ( datatype , status ) ) ;
startoutput ( ) ;
while ( nextvar ( & length , & data , & name , & value ) ) {
fmt = varfmt ( name ) ;
output_raw = 0 ;
switch ( fmt ) {
case PADDING : output_raw = '*' ;
break ;
case TS : if ( ! decodets ( value , & lfp ) ) output_raw = '?' ;
else output ( fp , name , prettydate ( & lfp ) ) ;
break ;
case HA : case NA : if ( ! decodenetnum ( value , & hval ) ) {
output_raw = '?' ;
}
else if ( fmt == HA ) {
output ( fp , name , nntohost ( & hval ) ) ;
}
else {
output ( fp , name , stoa ( & hval ) ) ;
}
break ;
case RF : if ( decodenetnum ( value , & hval ) ) {
if ( ISREFCLOCKADR ( & hval ) ) output ( fp , name , refnumtoa ( & hval ) ) ;
else output ( fp , name , stoa ( & hval ) ) ;
}
else if ( strlen ( value ) <= 4 ) {
output ( fp , name , value ) ;
}
else {
output_raw = '?' ;
}
break ;
case LP : if ( ! decodeuint ( value , & uval ) || uval > 3 ) {
output_raw = '?' ;
}
else {
b [ 0 ] = ( 0x2 & uval ) ? '1' : '0' ;
b [ 1 ] = ( 0x1 & uval ) ? '1' : '0' ;
b [ 2 ] = '\0' ;
output ( fp , name , b ) ;
}
break ;
case OC : if ( ! decodeuint ( value , & uval ) ) {
output_raw = '?' ;
}
else {
snprintf ( b , sizeof ( b ) , "%03lo" , uval ) ;
output ( fp , name , b ) ;
}
break ;
case AR : if ( ! decodearr ( value , & narr , lfparr ) ) output_raw = '?' ;
else outputarr ( fp , name , narr , lfparr ) ;
break ;
case FX : if ( ! decodeuint ( value , & uval ) ) output_raw = '?' ;
else output ( fp , name , tstflags ( uval ) ) ;
break ;
default : fprintf ( stderr , "Internal error in cookedprint, %s=%s, fmt %d\n" , name , value , fmt ) ;
output_raw = '?' ;
break ;
}
if ( output_raw != 0 ) {
atoascii ( name , MAXVARLEN , bn , sizeof ( bn ) ) ;
atoascii ( value , MAXVALLEN , bv , sizeof ( bv ) ) ;
if ( output_raw != '*' ) {
len = strlen ( bv ) ;
bv [ len ] = output_raw ;
bv [ len + 1 ] = '\0' ;
}
output ( fp , bn , bv ) ;
}
}
endoutput ( fp ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_T_messageContent ( 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_h225_T_messageContent , T_messageContent_sequence_of ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int gdev_x_finish_copydevice ( gx_device * dev , const gx_device * from_dev ) {
gx_device_X * xdev = ( gx_device_X * ) dev ;
xdev -> is_open = false ;
xdev -> target = 0 ;
xdev -> buffer = 0 ;
xdev -> dpy = 0 ;
xdev -> scr = 0 ;
xdev -> vinfo = 0 ;
xdev -> win = ( Window ) None ;
xdev -> bpixmap = ( Pixmap ) 0 ;
xdev -> dest = ( Pixmap ) 0 ;
xdev -> cp . pixmap = ( Pixmap ) 0 ;
xdev -> ht . pixmap = ( Pixmap ) 0 ;
xdev -> is_buffered = false ;
set_dev_proc ( xdev , fill_rectangle , dev_proc ( & gs_x11_device , fill_rectangle ) ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gint64 get_varint64 ( tvbuff_t * tvb , gint offset , gint bytes_left , gint * len ) {
guint8 b ;
gint64 result = 0 ;
* len = 0 ;
while ( ( * len ) < bytes_left ) {
b = tvb_get_guint8 ( tvb , offset + ( * len ) ) ;
result |= ( ( gint64 ) b & 0x7f ) << ( ( * len ) * 7 ) ;
( * len ) ++ ;
if ( ( b & 0x80 ) == 0 ) {
break ;
}
}
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void uiserver_release ( void * engine ) {
engine_uiserver_t uiserver = engine ;
if ( ! uiserver ) return ;
uiserver_cancel ( engine ) ;
free ( uiserver -> colon . attic . line ) ;
free ( uiserver ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ogg_reset ( AVFormatContext * s ) {
struct ogg * ogg = s -> priv_data ;
int i ;
int64_t start_pos = avio_tell ( s -> pb ) ;
for ( i = 0 ;
i < ogg -> nstreams ;
i ++ ) {
struct ogg_stream * os = ogg -> streams + i ;
os -> bufpos = 0 ;
os -> pstart = 0 ;
os -> psize = 0 ;
os -> granule = - 1 ;
os -> lastpts = AV_NOPTS_VALUE ;
os -> lastdts = AV_NOPTS_VALUE ;
os -> sync_pos = - 1 ;
os -> page_pos = 0 ;
os -> nsegs = 0 ;
os -> segp = 0 ;
os -> incomplete = 0 ;
os -> got_data = 0 ;
if ( start_pos <= s -> internal -> data_offset ) {
os -> lastpts = 0 ;
}
os -> end_trimming = 0 ;
av_freep ( & os -> new_metadata ) ;
os -> new_metadata_size = 0 ;
}
ogg -> page_pos = - 1 ;
ogg -> curidx = - 1 ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void _LMBCSOpen ## n ( UConverter * _this , UConverterLoadArgs * pArgs , UErrorCode * err ) \ {
_LMBCSOpenWorker ( _this , pArgs , err , n ) ;
}
static void _LMBCSOpenWorker ( UConverter * _this , UConverterLoadArgs * pArgs , UErrorCode * err , ulmbcs_byte_t OptGroup ) {
UConverterDataLMBCS * extraInfo = _this -> extraInfo = ( UConverterDataLMBCS * ) uprv_malloc ( sizeof ( UConverterDataLMBCS ) ) ;
if ( extraInfo != NULL ) {
UConverterNamePieces stackPieces ;
UConverterLoadArgs stackArgs = {
( int32_t ) sizeof ( UConverterLoadArgs ) }
;
ulmbcs_byte_t i ;
uprv_memset ( extraInfo , 0 , sizeof ( UConverterDataLMBCS ) ) ;
stackArgs . onlyTestIsLoadable = pArgs -> onlyTestIsLoadable ;
for ( i = 0 ;
i <= ULMBCS_GRP_LAST && U_SUCCESS ( * err ) ;
i ++ ) {
if ( OptGroupByteToCPName [ i ] != NULL ) {
extraInfo -> OptGrpConverter [ i ] = ucnv_loadSharedData ( OptGroupByteToCPName [ i ] , & stackPieces , & stackArgs , err ) ;
}
}
if ( U_FAILURE ( * err ) || pArgs -> onlyTestIsLoadable ) {
_LMBCSClose ( _this ) ;
return ;
}
extraInfo -> OptGroup = OptGroup ;
extraInfo -> localeConverterIndex = FindLMBCSLocale ( pArgs -> locale ) ;
}
else {
* err = U_MEMORY_ALLOCATION_ERROR ;
}
}
static void _LMBCSClose ( UConverter * _this ) {
if ( _this -> extraInfo != NULL ) {
ulmbcs_byte_t Ix ;
UConverterDataLMBCS * extraInfo = ( UConverterDataLMBCS * ) _this -> extraInfo ;
for ( Ix = 0 ;
Ix <= ULMBCS_GRP_LAST ;
Ix ++ ) {
if ( extraInfo -> OptGrpConverter [ Ix ] != NULL ) ucnv_unloadSharedDataIfReady ( extraInfo -> OptGrpConverter [ Ix ] ) ;
}
if ( ! _this -> isExtraLocal ) {
uprv_free ( _this -> extraInfo ) ;
_this -> extraInfo = NULL ;
}
}
}
typedef struct LMBCSClone {
UConverter cnv ;
UConverterDataLMBCS lmbcs ;
}
LMBCSClone ;
static UConverter * _LMBCSSafeClone ( const UConverter * cnv , void * stackBuffer , int32_t * pBufferSize , UErrorCode * status ) {
LMBCSClone * newLMBCS ;
UConverterDataLMBCS * extraInfo ;
int32_t i ;
if ( * pBufferSize <= 0 ) {
* pBufferSize = ( int32_t ) sizeof ( LMBCSClone ) ;
return NULL ;
}
extraInfo = ( UConverterDataLMBCS * ) cnv -> extraInfo ;
newLMBCS = ( LMBCSClone * ) stackBuffer ;
uprv_memcpy ( & newLMBCS -> lmbcs , extraInfo , sizeof ( UConverterDataLMBCS ) ) ;
for ( i = 0 ;
i <= ULMBCS_GRP_LAST ;
++ i ) {
if ( extraInfo -> OptGrpConverter [ i ] != NULL ) {
ucnv_incrementRefCount ( extraInfo -> OptGrpConverter [ i ] ) ;
}
}
newLMBCS -> cnv . extraInfo = & newLMBCS -> lmbcs ;
newLMBCS -> cnv . isExtraLocal = TRUE ;
return & newLMBCS -> cnv ;
}
static size_t LMBCSConversionWorker ( UConverterDataLMBCS * extraInfo , ulmbcs_byte_t group , ulmbcs_byte_t * pStartLMBCS , UChar * pUniChar , ulmbcs_byte_t * lastConverterIndex , UBool * groups_tried ) {
ulmbcs_byte_t * pLMBCS = pStartLMBCS ;
UConverterSharedData * xcnv = extraInfo -> OptGrpConverter [ group ] ;
int bytesConverted ;
uint32_t value ;
ulmbcs_byte_t firstByte ;
U_ASSERT ( xcnv ) ;
U_ASSERT ( group < ULMBCS_GRP_UNICODE ) ;
bytesConverted = ucnv_MBCSFromUChar32 ( xcnv , * pUniChar , & value , FALSE ) ;
if ( bytesConverted > 0 ) {
firstByte = ( ulmbcs_byte_t ) ( value >> ( ( bytesConverted - 1 ) * 8 ) ) ;
}
else {
groups_tried [ group ] = TRUE ;
return 0 ;
}
* lastConverterIndex = group ;
U_ASSERT ( ( firstByte <= ULMBCS_C0END ) || ( firstByte >= ULMBCS_C1START ) || ( group == ULMBCS_GRP_EXCEPT ) ) ;
if ( group != ULMBCS_GRP_EXCEPT && extraInfo -> OptGroup != group ) {
* pLMBCS ++ = group ;
if ( bytesConverted == 1 && group >= ULMBCS_DOUBLEOPTGROUP_START ) {
* pLMBCS ++ = group ;
}
}
if ( bytesConverted == 1 && firstByte < 0x20 ) return 0 ;
switch ( bytesConverted ) {
case 4 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 24 ) ;
U_FALLTHROUGH ;
case 3 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 16 ) ;
U_FALLTHROUGH ;
case 2 : * pLMBCS ++ = ( ulmbcs_byte_t ) ( value >> 8 ) ;
U_FALLTHROUGH ;
case 1 : * pLMBCS ++ = ( ulmbcs_byte_t ) value ;
U_FALLTHROUGH ;
default : break ;
}
return ( pLMBCS - pStartLMBCS ) ;
}
static size_t LMBCSConvertUni ( ulmbcs_byte_t * pLMBCS , UChar uniChar ) {
uint8_t LowCh = ( uint8_t ) ( uniChar & 0x00FF ) ;
uint8_t HighCh = ( uint8_t ) ( uniChar >> 8 ) ;
* pLMBCS ++ = ULMBCS_GRP_UNICODE ;
if ( LowCh == 0 ) {
* pLMBCS ++ = ULMBCS_UNICOMPATZERO ;
* pLMBCS ++ = HighCh ;
}
else {
* pLMBCS ++ = HighCh ;
* pLMBCS ++ = LowCh ;
}
return ULMBCS_UNICODE_SIZE ;
}
static void _LMBCSFromUnicode ( UConverterFromUnicodeArgs * args , UErrorCode * err ) {
ulmbcs_byte_t lastConverterIndex = 0 ;
UChar uniChar ;
ulmbcs_byte_t LMBCS [ ULMBCS_CHARSIZE_MAX ] ;
ulmbcs_byte_t * pLMBCS ;
int32_t bytes_written ;
UBool groups_tried [ ULMBCS_GRP_LAST + 1 ] ;
UConverterDataLMBCS * extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
int sourceIndex = 0 ;
ulmbcs_byte_t OldConverterIndex = 0 ;
while ( args -> source < args -> sourceLimit && ! U_FAILURE ( * err ) ) {
OldConverterIndex = extraInfo -> localeConverterIndex ;
if ( args -> target >= args -> targetLimit ) {
* err = U_BUFFER_OVERFLOW_ERROR ;
break ;
}
uniChar = * ( args -> source ) ;
bytes_written = 0 ;
pLMBCS = LMBCS ;
if ( ( uniChar >= 0x80 ) && ( uniChar <= 0xff ) && ( uniChar != 0xB1 ) && ( uniChar != 0xD7 ) && ( uniChar != 0xF7 ) && ( uniChar != 0xB0 ) && ( uniChar != 0xB4 ) && ( uniChar != 0xB6 ) && ( uniChar != 0xA7 ) && ( uniChar != 0xA8 ) ) {
extraInfo -> localeConverterIndex = ULMBCS_GRP_L1 ;
}
if ( ( ( uniChar > ULMBCS_C0END ) && ( uniChar < ULMBCS_C1START ) ) || uniChar == 0 || uniChar == ULMBCS_HT || uniChar == ULMBCS_CR || uniChar == ULMBCS_LF || uniChar == ULMBCS_123SYSTEMRANGE ) {
* pLMBCS ++ = ( ulmbcs_byte_t ) uniChar ;
bytes_written = 1 ;
}
if ( ! bytes_written ) {
ulmbcs_byte_t group = FindLMBCSUniRange ( uniChar ) ;
if ( group == ULMBCS_GRP_UNICODE ) {
pLMBCS += LMBCSConvertUni ( pLMBCS , uniChar ) ;
bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ;
}
else if ( group == ULMBCS_GRP_CTRL ) {
if ( uniChar <= ULMBCS_C0END ) {
* pLMBCS ++ = ULMBCS_GRP_CTRL ;
* pLMBCS ++ = ( ulmbcs_byte_t ) ( ULMBCS_CTRLOFFSET + uniChar ) ;
}
else if ( uniChar >= ULMBCS_C1START && uniChar <= ULMBCS_C1START + ULMBCS_CTRLOFFSET ) {
* pLMBCS ++ = ULMBCS_GRP_CTRL ;
* pLMBCS ++ = ( ulmbcs_byte_t ) ( uniChar & 0x00FF ) ;
}
bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ;
}
else if ( group < ULMBCS_GRP_UNICODE ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , group , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
if ( ! bytes_written ) {
uprv_memset ( groups_tried , 0 , sizeof ( groups_tried ) ) ;
if ( ( extraInfo -> OptGroup != 1 ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , extraInfo -> OptGroup ) ) ) {
if ( extraInfo -> localeConverterIndex < ULMBCS_DOUBLEOPTGROUP_START ) {
bytes_written = LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_L1 , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
if ( ! bytes_written ) {
bytes_written = LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_EXCEPT , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
if ( ! bytes_written ) {
bytes_written = LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
}
else {
bytes_written = LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
}
if ( ! bytes_written && ( extraInfo -> localeConverterIndex ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , extraInfo -> localeConverterIndex ) ) ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , extraInfo -> localeConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
if ( ! bytes_written && ( lastConverterIndex ) && ( ULMBCS_AMBIGUOUS_MATCH ( group , lastConverterIndex ) ) ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , lastConverterIndex , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
if ( ! bytes_written ) {
ulmbcs_byte_t grp_start ;
ulmbcs_byte_t grp_end ;
ulmbcs_byte_t grp_ix ;
grp_start = ( ulmbcs_byte_t ) ( ( group == ULMBCS_AMBIGUOUS_MBCS ) ? ULMBCS_DOUBLEOPTGROUP_START : ULMBCS_GRP_L1 ) ;
grp_end = ( ulmbcs_byte_t ) ( ( group == ULMBCS_AMBIGUOUS_MBCS ) ? ULMBCS_GRP_LAST : ULMBCS_GRP_TH ) ;
if ( group == ULMBCS_AMBIGUOUS_ALL ) {
grp_start = ULMBCS_GRP_L1 ;
grp_end = ULMBCS_GRP_LAST ;
}
for ( grp_ix = grp_start ;
grp_ix <= grp_end && ! bytes_written ;
grp_ix ++ ) {
if ( extraInfo -> OptGrpConverter [ grp_ix ] && ! groups_tried [ grp_ix ] ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , grp_ix , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
}
if ( ! bytes_written && grp_start == ULMBCS_GRP_L1 ) {
bytes_written = ( int32_t ) LMBCSConversionWorker ( extraInfo , ULMBCS_GRP_EXCEPT , pLMBCS , & uniChar , & lastConverterIndex , groups_tried ) ;
}
}
if ( ! bytes_written ) {
pLMBCS += LMBCSConvertUni ( pLMBCS , uniChar ) ;
bytes_written = ( int32_t ) ( pLMBCS - LMBCS ) ;
}
}
}
args -> source ++ ;
pLMBCS = LMBCS ;
while ( args -> target < args -> targetLimit && bytes_written -- ) {
* ( args -> target ) ++ = * pLMBCS ++ ;
if ( args -> offsets ) {
* ( args -> offsets ) ++ = sourceIndex ;
}
}
sourceIndex ++ ;
if ( bytes_written > 0 ) {
uint8_t * pErrorBuffer = args -> converter -> charErrorBuffer ;
* err = U_BUFFER_OVERFLOW_ERROR ;
args -> converter -> charErrorBufferLength = ( int8_t ) bytes_written ;
while ( bytes_written -- ) {
* pErrorBuffer ++ = * pLMBCS ++ ;
}
}
extraInfo -> localeConverterIndex = OldConverterIndex ;
}
}
static UChar GetUniFromLMBCSUni ( char const * * ppLMBCSin ) {
uint8_t HighCh = * ( * ppLMBCSin ) ++ ;
uint8_t LowCh = * ( * ppLMBCSin ) ++ ;
if ( HighCh == ULMBCS_UNICOMPATZERO ) {
HighCh = LowCh ;
LowCh = 0 ;
}
return ( UChar ) ( ( HighCh << 8 ) | LowCh ) ;
}
# define CHECK_SOURCE_LIMIT ( index ) if ( args -> source + index > args -> sourceLimit ) {
* err = U_TRUNCATED_CHAR_FOUND ;
args -> source = args -> sourceLimit ;
return 0xffff ;
}
static UChar32 _LMBCSGetNextUCharWorker ( UConverterToUnicodeArgs * args , UErrorCode * err ) {
UChar32 uniChar = 0 ;
ulmbcs_byte_t CurByte ;
if ( args -> source >= args -> sourceLimit ) {
* err = U_ILLEGAL_ARGUMENT_ERROR ;
return 0xffff ;
}
CurByte = * ( ( ulmbcs_byte_t * ) ( args -> source ++ ) ) ;
if ( ( ( CurByte > ULMBCS_C0END ) && ( CurByte < ULMBCS_C1START ) ) || ( CurByte == 0 ) || CurByte == ULMBCS_HT || CurByte == ULMBCS_CR || CurByte == ULMBCS_LF || CurByte == ULMBCS_123SYSTEMRANGE ) {
uniChar = CurByte ;
}
else {
UConverterDataLMBCS * extraInfo ;
ulmbcs_byte_t group ;
UConverterSharedData * cnv ;
if ( CurByte == ULMBCS_GRP_CTRL ) {
ulmbcs_byte_t C0C1byte ;
CHECK_SOURCE_LIMIT ( 1 ) ;
C0C1byte = * ( args -> source ) ++ ;
uniChar = ( C0C1byte < ULMBCS_C1START ) ? C0C1byte - ULMBCS_CTRLOFFSET : C0C1byte ;
}
else if ( CurByte == ULMBCS_GRP_UNICODE ) {
CHECK_SOURCE_LIMIT ( 2 ) ;
return GetUniFromLMBCSUni ( & ( args -> source ) ) ;
}
else if ( CurByte <= ULMBCS_CTRLOFFSET ) {
group = CurByte ;
extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
if ( group > ULMBCS_GRP_LAST || ( cnv = extraInfo -> OptGrpConverter [ group ] ) == NULL ) {
* err = U_INVALID_CHAR_FOUND ;
}
else if ( group >= ULMBCS_DOUBLEOPTGROUP_START ) {
CHECK_SOURCE_LIMIT ( 2 ) ;
if ( * args -> source == group ) {
++ args -> source ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source , 1 , FALSE ) ;
++ args -> source ;
}
else {
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source , 2 , FALSE ) ;
args -> source += 2 ;
}
}
else {
CHECK_SOURCE_LIMIT ( 1 ) ;
CurByte = * ( args -> source ) ++ ;
if ( CurByte >= ULMBCS_C1START ) {
uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP ( cnv , CurByte ) ;
}
else {
char bytes [ 2 ] ;
extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
cnv = extraInfo -> OptGrpConverter [ ULMBCS_GRP_EXCEPT ] ;
bytes [ 0 ] = group ;
bytes [ 1 ] = CurByte ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , bytes , 2 , FALSE ) ;
}
}
}
else if ( CurByte >= ULMBCS_C1START ) {
extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
group = extraInfo -> OptGroup ;
cnv = extraInfo -> OptGrpConverter [ group ] ;
if ( group >= ULMBCS_DOUBLEOPTGROUP_START ) {
if ( ! ucnv_MBCSIsLeadByte ( cnv , CurByte ) ) {
CHECK_SOURCE_LIMIT ( 0 ) ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source - 1 , 1 , FALSE ) ;
}
else {
CHECK_SOURCE_LIMIT ( 1 ) ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source - 1 , 2 , FALSE ) ;
++ args -> source ;
}
}
else {
uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP ( cnv , CurByte ) ;
}
}
}
return uniChar ;
}
static void _LMBCSToUnicodeWithOffsets ( UConverterToUnicodeArgs * args , UErrorCode * err ) {
char LMBCS [ ULMBCS_CHARSIZE_MAX ] ;
UChar uniChar ;
const char * saveSource ;
const char * pStartLMBCS = args -> source ;
const char * errSource = NULL ;
int8_t savebytes = 0 ;
while ( U_SUCCESS ( * err ) && args -> sourceLimit > args -> source && args -> targetLimit > args -> target ) {
saveSource = args -> source ;
if ( args -> converter -> toULength ) {
const char * saveSourceLimit ;
size_t size_old = args -> converter -> toULength ;
size_t size_new_maybe_1 = sizeof ( LMBCS ) - size_old ;
size_t size_new_maybe_2 = args -> sourceLimit - args -> source ;
size_t size_new = ( size_new_maybe_1 < size_new_maybe_2 ) ? size_new_maybe_1 : size_new_maybe_2 ;
uprv_memcpy ( LMBCS , args -> converter -> toUBytes , size_old ) ;
uprv_memcpy ( LMBCS + size_old , args -> source , size_new ) ;
saveSourceLimit = args -> sourceLimit ;
args -> source = errSource = LMBCS ;
args -> sourceLimit = LMBCS + size_old + size_new ;
savebytes = ( int8_t ) ( size_old + size_new ) ;
uniChar = ( UChar ) _LMBCSGetNextUCharWorker ( args , err ) ;
args -> source = saveSource + ( ( args -> source - LMBCS ) - size_old ) ;
args -> sourceLimit = saveSourceLimit ;
if ( * err == U_TRUNCATED_CHAR_FOUND ) {
args -> converter -> toULength = savebytes ;
uprv_memcpy ( args -> converter -> toUBytes , LMBCS , savebytes ) ;
args -> source = args -> sourceLimit ;
* err = U_ZERO_ERROR ;
return ;
}
else {
args -> converter -> toULength = 0 ;
}
}
else {
errSource = saveSource ;
uniChar = ( UChar ) _LMBCSGetNextUCharWorker ( args , err ) ;
savebytes = ( int8_t ) ( args -> source - saveSource ) ;
}
if ( U_SUCCESS ( * err ) ) {
if ( uniChar < 0xfffe ) {
* ( args -> target ) ++ = uniChar ;
if ( args -> offsets ) {
* ( args -> offsets ) ++ = ( int32_t ) ( saveSource - pStartLMBCS ) ;
}
}
else if ( uniChar == 0xfffe ) {
* err = U_INVALID_CHAR_FOUND ;
}
else {
* err = U_ILLEGAL_CHAR_FOUND ;
}
}
}
if ( U_SUCCESS ( * err ) && args -> sourceLimit > args -> source && args -> targetLimit <= args -> target ) {
* err = U_BUFFER_OVERFLOW_ERROR ;
}
else if ( U_FAILURE ( * err ) ) {
args -> converter -> toULength = savebytes ;
if ( savebytes > 0 ) {
uprv_memcpy ( args -> converter -> toUBytes , errSource , savebytes ) ;
}
if ( * err == U_TRUNCATED_CHAR_FOUND ) {
* err = U_ZERO_ERROR ;
}
}
}
DEFINE_LMBCS_OPEN ( 1 ) DEFINE_LMBCS_OPEN ( 2 )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int PSAddImagemask ( EntityChar * ec , struct psstack * stack , int sp , real transform [ 6 ] , Color fillcol ) {
uint8 * data ;
int datalen , width , height , polarity ;
real trans [ 6 ] ;
struct _GImage * base ;
GImage * gi ;
Entity * ent ;
int i , j ;
if ( sp < 5 || ( stack [ sp - 1 ] . type != ps_instr && stack [ sp - 1 ] . type != ps_string ) ) {
LogError ( _ ( "FontForge does not support dictionary based imagemask operators.\n" ) ) ;
return ( sp - 1 ) ;
}
if ( stack [ sp - 2 ] . type != ps_array || stack [ sp - 2 ] . u . dict . cnt != 6 ) {
LogError ( _ ( "Fourth argument of imagemask must be a 6-element transformation matrix.\n" ) ) ;
return ( sp - 5 ) ;
}
if ( stack [ sp - 3 ] . type != ps_bool ) {
LogError ( _ ( "Third argument of imagemask must be a boolean.\n" ) ) ;
return ( sp - 5 ) ;
}
polarity = stack [ sp - 3 ] . u . tf ;
if ( stack [ sp - 4 ] . type != ps_num || stack [ sp - 5 ] . type != ps_num ) {
LogError ( _ ( "First and second arguments of imagemask must be integers.\n" ) ) ;
return ( sp - 5 ) ;
}
height = stack [ sp - 4 ] . u . val ;
width = stack [ sp - 5 ] . u . val ;
data = StringToBytes ( & stack [ sp - 1 ] , & datalen ) ;
if ( width <= 0 || height <= 0 || ( ( width + 7 ) / 8 ) * height > datalen ) {
LogError ( _ ( "Width or height arguments to imagemask contain invalid values\n(either negative or they require more data than provided).\n" ) ) ;
free ( data ) ;
return ( sp - 5 ) ;
}
trans [ 0 ] = stack [ sp - 2 ] . u . dict . entries [ 0 ] . u . val ;
trans [ 1 ] = stack [ sp - 2 ] . u . dict . entries [ 1 ] . u . val ;
trans [ 2 ] = stack [ sp - 2 ] . u . dict . entries [ 2 ] . u . val ;
trans [ 3 ] = stack [ sp - 2 ] . u . dict . entries [ 3 ] . u . val ;
trans [ 4 ] = stack [ sp - 2 ] . u . dict . entries [ 4 ] . u . val ;
trans [ 5 ] = stack [ sp - 2 ] . u . dict . entries [ 5 ] . u . val ;
gi = GImageCreate ( it_mono , width , height ) ;
base = gi -> u . image ;
base -> trans = 1 ;
if ( polarity ) {
for ( i = 0 ;
i < datalen ;
++ i ) data [ i ] ^= 0xff ;
}
if ( trans [ 0 ] > 0 && trans [ 3 ] < 0 ) memcpy ( base -> data , data , datalen ) ;
else if ( trans [ 0 ] > 0 && trans [ 3 ] > 0 ) {
for ( i = 0 ;
i < height ;
++ i ) memcpy ( base -> data + i * base -> bytes_per_line , data + ( height - i ) * base -> bytes_per_line , base -> bytes_per_line ) ;
}
else if ( trans [ 0 ] < 0 && trans [ 3 ] < 0 ) {
for ( i = 0 ;
i < height ;
++ i ) for ( j = 0 ;
j < width ;
++ j ) {
if ( data [ i * base -> bytes_per_line + ( j >> 3 ) ] & ( 0x80 >> ( j & 7 ) ) ) base -> data [ i * base -> bytes_per_line + ( ( width - j - 1 ) >> 3 ) ] |= ( 0x80 >> ( ( width - j - 1 ) & 7 ) ) ;
}
}
else {
for ( i = 0 ;
i < height ;
++ i ) for ( j = 0 ;
j < width ;
++ j ) {
if ( data [ i * base -> bytes_per_line + ( j >> 3 ) ] & ( 0x80 >> ( j & 7 ) ) ) base -> data [ ( height - i - 1 ) * base -> bytes_per_line + ( ( width - j - 1 ) >> 3 ) ] |= ( 0x80 >> ( ( width - j - 1 ) & 7 ) ) ;
}
}
free ( data ) ;
ent = calloc ( 1 , sizeof ( Entity ) ) ;
ent -> type = et_image ;
ent -> u . image . image = gi ;
memcpy ( ent -> u . image . transform , transform , sizeof ( real [ 6 ] ) ) ;
ent -> u . image . transform [ 0 ] /= width ;
ent -> u . image . transform [ 3 ] /= height ;
ent -> u . image . transform [ 5 ] += height ;
ent -> u . image . col = fillcol ;
ent -> next = ec -> splines ;
ec -> splines = ent ;
return ( sp - 5 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void sig_server_quit ( SERVER_REC * server , const char * msg ) {
g_return_if_fail ( server != NULL ) ;
printformat ( server , NULL , MSGLEVEL_CLIENTNOTICE , TXT_SERVER_QUIT , server -> connrec -> address , msg ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * Type_MPE_Read ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , cmsUInt32Number * nItems , cmsUInt32Number SizeOfTag ) {
cmsUInt16Number InputChans , OutputChans ;
cmsUInt32Number ElementCount ;
cmsPipeline * NewLUT = NULL ;
cmsUInt32Number BaseOffset ;
BaseOffset = io -> Tell ( io ) - sizeof ( _cmsTagBase ) ;
if ( ! _cmsReadUInt16Number ( io , & InputChans ) ) return NULL ;
if ( ! _cmsReadUInt16Number ( io , & OutputChans ) ) return NULL ;
NewLUT = cmsPipelineAlloc ( self -> ContextID , InputChans , OutputChans ) ;
if ( NewLUT == NULL ) return NULL ;
if ( ! _cmsReadUInt32Number ( io , & ElementCount ) ) return NULL ;
if ( ! ReadPositionTable ( self , io , ElementCount , BaseOffset , NewLUT , ReadMPEElem ) ) {
if ( NewLUT != NULL ) cmsPipelineFree ( NewLUT ) ;
* nItems = 0 ;
return NULL ;
}
* nItems = 1 ;
return NewLUT ;
cmsUNUSED_PARAMETER ( SizeOfTag ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline void sk_ ## t1 ## _free ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_free ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _zero ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_zero ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete ( STACK_OF ( t1 ) * sk , int i ) {
return ( t2 * ) OPENSSL_sk_delete ( ( OPENSSL_STACK * ) sk , i ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
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 )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void lcc_network_buffer_destroy ( lcc_network_buffer_t * nb ) {
if ( nb == NULL ) return ;
free ( nb -> buffer ) ;
free ( nb ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void e1000e_calc_rxdesclen ( E1000ECore * core ) {
if ( e1000e_rx_use_legacy_descriptor ( core ) ) {
core -> rx_desc_len = sizeof ( struct e1000_rx_desc ) ;
}
else {
if ( core -> mac [ RCTL ] & E1000_RCTL_DTYP_PS ) {
core -> rx_desc_len = sizeof ( union e1000_rx_desc_packet_split ) ;
}
else {
core -> rx_desc_len = sizeof ( union e1000_rx_desc_extended ) ;
}
}
trace_e1000e_rx_desc_len ( core -> rx_desc_len ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void do_sync_with_master ( struct st_command * command ) {
long offset = 0 ;
char * p = command -> first_argument ;
const char * offset_start = p ;
if ( * offset_start ) {
for ( ;
my_isdigit ( charset_info , * p ) ;
p ++ ) offset = offset * 10 + * p - '0' ;
if ( * p && ! my_isspace ( charset_info , * p ) ) die ( "Invalid integer argument \"%s\"" , offset_start ) ;
command -> last_argument = p ;
}
do_sync_with_master2 ( command , offset ) ;
return ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int mbfl_strlen ( mbfl_string * string ) {
int len , n , m , k ;
unsigned char * p ;
const unsigned char * mbtab ;
const mbfl_encoding * encoding ;
encoding = mbfl_no2encoding ( string -> no_encoding ) ;
if ( encoding == NULL || string == NULL ) {
return - 1 ;
}
len = 0 ;
if ( encoding -> flag & MBFL_ENCTYPE_SBCS ) {
len = string -> len ;
}
else if ( encoding -> flag & ( MBFL_ENCTYPE_WCS2BE | MBFL_ENCTYPE_WCS2LE ) ) {
len = string -> len / 2 ;
}
else if ( encoding -> flag & ( MBFL_ENCTYPE_WCS4BE | MBFL_ENCTYPE_WCS4LE ) ) {
len = string -> len / 4 ;
}
else if ( encoding -> mblen_table != NULL ) {
mbtab = encoding -> mblen_table ;
n = 0 ;
p = string -> val ;
k = string -> len ;
if ( p != NULL ) {
while ( n < k ) {
m = mbtab [ * p ] ;
n += m ;
p += m ;
len ++ ;
}
;
}
}
else {
mbfl_convert_filter * filter = mbfl_convert_filter_new ( string -> no_encoding , mbfl_no_encoding_wchar , filter_count_output , 0 , & len ) ;
if ( filter == NULL ) {
return - 1 ;
}
n = string -> len ;
p = string -> val ;
if ( p != NULL ) {
while ( n > 0 ) {
( * filter -> filter_function ) ( * p ++ , filter ) ;
n -- ;
}
}
mbfl_convert_filter_delete ( filter ) ;
}
return len ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int vorbis_parse_setup_hdr_floors ( vorbis_context * vc ) {
GetBitContext * gb = & vc -> gb ;
int i , j , k , ret ;
vc -> floor_count = get_bits ( gb , 6 ) + 1 ;
vc -> floors = av_mallocz ( vc -> floor_count * sizeof ( * vc -> floors ) ) ;
if ( ! vc -> floors ) return AVERROR ( ENOMEM ) ;
for ( i = 0 ;
i < vc -> floor_count ;
++ i ) {
vorbis_floor * floor_setup = & vc -> floors [ i ] ;
floor_setup -> floor_type = get_bits ( gb , 16 ) ;
av_dlog ( NULL , " %d. floor type %d \n" , i , floor_setup -> floor_type ) ;
if ( floor_setup -> floor_type == 1 ) {
int maximum_class = - 1 ;
unsigned rangebits , rangemax , floor1_values = 2 ;
floor_setup -> decode = vorbis_floor1_decode ;
floor_setup -> data . t1 . partitions = get_bits ( gb , 5 ) ;
av_dlog ( NULL , " %d.floor: %d partitions \n" , i , floor_setup -> data . t1 . partitions ) ;
for ( j = 0 ;
j < floor_setup -> data . t1 . partitions ;
++ j ) {
floor_setup -> data . t1 . partition_class [ j ] = get_bits ( gb , 4 ) ;
if ( floor_setup -> data . t1 . partition_class [ j ] > maximum_class ) maximum_class = floor_setup -> data . t1 . partition_class [ j ] ;
av_dlog ( NULL , " %d. floor %d partition class %d \n" , i , j , floor_setup -> data . t1 . partition_class [ j ] ) ;
}
av_dlog ( NULL , " maximum class %d \n" , maximum_class ) ;
for ( j = 0 ;
j <= maximum_class ;
++ j ) {
floor_setup -> data . t1 . class_dimensions [ j ] = get_bits ( gb , 3 ) + 1 ;
floor_setup -> data . t1 . class_subclasses [ j ] = get_bits ( gb , 2 ) ;
av_dlog ( NULL , " %d floor %d class dim: %d subclasses %d \n" , i , j , floor_setup -> data . t1 . class_dimensions [ j ] , floor_setup -> data . t1 . class_subclasses [ j ] ) ;
if ( floor_setup -> data . t1 . class_subclasses [ j ] ) {
GET_VALIDATED_INDEX ( floor_setup -> data . t1 . class_masterbook [ j ] , 8 , vc -> codebook_count ) av_dlog ( NULL , " masterbook: %d \n" , floor_setup -> data . t1 . class_masterbook [ j ] ) ;
}
for ( k = 0 ;
k < ( 1 << floor_setup -> data . t1 . class_subclasses [ j ] ) ;
++ k ) {
int16_t bits = get_bits ( gb , 8 ) - 1 ;
if ( bits != - 1 ) VALIDATE_INDEX ( bits , vc -> codebook_count ) floor_setup -> data . t1 . subclass_books [ j ] [ k ] = bits ;
av_dlog ( NULL , " book %d. : %d \n" , k , floor_setup -> data . t1 . subclass_books [ j ] [ k ] ) ;
}
}
floor_setup -> data . t1 . multiplier = get_bits ( gb , 2 ) + 1 ;
floor_setup -> data . t1 . x_list_dim = 2 ;
for ( j = 0 ;
j < floor_setup -> data . t1 . partitions ;
++ j ) floor_setup -> data . t1 . x_list_dim += floor_setup -> data . t1 . class_dimensions [ floor_setup -> data . t1 . partition_class [ j ] ] ;
floor_setup -> data . t1 . list = av_mallocz ( floor_setup -> data . t1 . x_list_dim * sizeof ( * floor_setup -> data . t1 . list ) ) ;
if ( ! floor_setup -> data . t1 . list ) return AVERROR ( ENOMEM ) ;
rangebits = get_bits ( gb , 4 ) ;
rangemax = ( 1 << rangebits ) ;
if ( rangemax > vc -> blocksize [ 1 ] / 2 ) {
av_log ( vc -> avctx , AV_LOG_ERROR , "Floor value is too large for blocksize: %u (%" PRIu32 ")\n" , rangemax , vc -> blocksize [ 1 ] / 2 ) ;
return AVERROR_INVALIDDATA ;
}
floor_setup -> data . t1 . list [ 0 ] . x = 0 ;
floor_setup -> data . t1 . list [ 1 ] . x = rangemax ;
for ( j = 0 ;
j < floor_setup -> data . t1 . partitions ;
++ j ) {
for ( k = 0 ;
k < floor_setup -> data . t1 . class_dimensions [ floor_setup -> data . t1 . partition_class [ j ] ] ;
++ k , ++ floor1_values ) {
floor_setup -> data . t1 . list [ floor1_values ] . x = get_bits ( gb , rangebits ) ;
av_dlog ( NULL , " %u. floor1 Y coord. %d\n" , floor1_values , floor_setup -> data . t1 . list [ floor1_values ] . x ) ;
}
}
if ( ff_vorbis_ready_floor1_list ( vc -> avctx , floor_setup -> data . t1 . list , floor_setup -> data . t1 . x_list_dim ) ) {
return AVERROR_INVALIDDATA ;
}
}
else if ( floor_setup -> floor_type == 0 ) {
unsigned max_codebook_dim = 0 ;
floor_setup -> decode = vorbis_floor0_decode ;
floor_setup -> data . t0 . order = get_bits ( gb , 8 ) ;
if ( ! floor_setup -> data . t0 . order ) {
av_log ( vc -> avctx , AV_LOG_ERROR , "Floor 0 order is 0.\n" ) ;
return AVERROR_INVALIDDATA ;
}
floor_setup -> data . t0 . rate = get_bits ( gb , 16 ) ;
if ( ! floor_setup -> data . t0 . rate ) {
av_log ( vc -> avctx , AV_LOG_ERROR , "Floor 0 rate is 0.\n" ) ;
return AVERROR_INVALIDDATA ;
}
floor_setup -> data . t0 . bark_map_size = get_bits ( gb , 16 ) ;
if ( ! floor_setup -> data . t0 . bark_map_size ) {
av_log ( vc -> avctx , AV_LOG_ERROR , "Floor 0 bark map size is 0.\n" ) ;
return AVERROR_INVALIDDATA ;
}
floor_setup -> data . t0 . amplitude_bits = get_bits ( gb , 6 ) ;
floor_setup -> data . t0 . amplitude_offset = get_bits ( gb , 8 ) ;
floor_setup -> data . t0 . num_books = get_bits ( gb , 4 ) + 1 ;
floor_setup -> data . t0 . book_list = av_malloc ( floor_setup -> data . t0 . num_books ) ;
if ( ! floor_setup -> data . t0 . book_list ) return AVERROR ( ENOMEM ) ;
{
int idx ;
unsigned book_idx ;
for ( idx = 0 ;
idx < floor_setup -> data . t0 . num_books ;
++ idx ) {
GET_VALIDATED_INDEX ( book_idx , 8 , vc -> codebook_count ) floor_setup -> data . t0 . book_list [ idx ] = book_idx ;
if ( vc -> codebooks [ book_idx ] . dimensions > max_codebook_dim ) max_codebook_dim = vc -> codebooks [ book_idx ] . dimensions ;
}
}
if ( ( ret = create_map ( vc , i ) ) < 0 ) return ret ;
floor_setup -> data . t0 . lsp = av_malloc ( ( floor_setup -> data . t0 . order + 1 + max_codebook_dim ) * sizeof ( * floor_setup -> data . t0 . lsp ) ) ;
if ( ! floor_setup -> data . t0 . lsp ) return AVERROR ( ENOMEM ) ;
av_dlog ( NULL , "floor0 order: %u\n" , floor_setup -> data . t0 . order ) ;
av_dlog ( NULL , "floor0 rate: %u\n" , floor_setup -> data . t0 . rate ) ;
av_dlog ( NULL , "floor0 bark map size: %u\n" , floor_setup -> data . t0 . bark_map_size ) ;
av_dlog ( NULL , "floor0 amplitude bits: %u\n" , floor_setup -> data . t0 . amplitude_bits ) ;
av_dlog ( NULL , "floor0 amplitude offset: %u\n" , floor_setup -> data . t0 . amplitude_offset ) ;
av_dlog ( NULL , "floor0 number of books: %u\n" , floor_setup -> data . t0 . num_books ) ;
av_dlog ( NULL , "floor0 book list pointer: %p\n" , floor_setup -> data . t0 . book_list ) ;
{
int idx ;
for ( idx = 0 ;
idx < floor_setup -> data . t0 . num_books ;
++ idx ) {
av_dlog ( NULL , " Book %d: %u\n" , idx + 1 , floor_setup -> data . t0 . book_list [ idx ] ) ;
}
}
}
else {
av_log ( vc -> avctx , AV_LOG_ERROR , "Invalid floor type!\n" ) ;
return AVERROR_INVALIDDATA ;
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void sun4m_machine_init ( void ) {
qemu_register_machine ( & ss5_machine ) ;
qemu_register_machine ( & ss10_machine ) ;
qemu_register_machine ( & ss600mp_machine ) ;
qemu_register_machine ( & ss20_machine ) ;
qemu_register_machine ( & voyager_machine ) ;
qemu_register_machine ( & ss_lx_machine ) ;
qemu_register_machine ( & ss4_machine ) ;
qemu_register_machine ( & scls_machine ) ;
qemu_register_machine ( & sbook_machine ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * cgfs_get_cgroup ( void * hdata , const char * subsystem ) {
struct cgfs_data * d = hdata ;
if ( ! d ) return NULL ;
return lxc_cgroup_get_hierarchy_path_data ( subsystem , d ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void U_CALLCONV UConverter_fromUnicode_HZ_OFFSETS_LOGIC ( UConverterFromUnicodeArgs * args , UErrorCode * err ) {
const UChar * mySource = args -> source ;
char * myTarget = args -> target ;
int32_t * offsets = args -> offsets ;
int32_t mySourceIndex = 0 ;
int32_t myTargetIndex = 0 ;
int32_t targetLength = ( int32_t ) ( args -> targetLimit - myTarget ) ;
int32_t mySourceLength = ( int32_t ) ( args -> sourceLimit - args -> source ) ;
uint32_t targetUniChar = 0x0000 ;
UChar32 mySourceChar = 0x0000 ;
UConverterDataHZ * myConverterData = ( UConverterDataHZ * ) args -> converter -> extraInfo ;
UBool isTargetUCharDBCS = ( UBool ) myConverterData -> isTargetUCharDBCS ;
UBool oldIsTargetUCharDBCS ;
int len = 0 ;
const char * escSeq = NULL ;
if ( args -> converter -> fromUChar32 != 0 && myTargetIndex < targetLength ) {
goto getTrail ;
}
while ( mySourceIndex < mySourceLength ) {
targetUniChar = missingCharMarker ;
if ( myTargetIndex < targetLength ) {
mySourceChar = ( UChar ) mySource [ mySourceIndex ++ ] ;
oldIsTargetUCharDBCS = isTargetUCharDBCS ;
if ( mySourceChar == UCNV_TILDE ) {
len = ESC_LEN ;
escSeq = TILDE_ESCAPE ;
CONCAT_ESCAPE_MACRO ( args , myTargetIndex , targetLength , escSeq , err , len , mySourceIndex ) ;
continue ;
}
else if ( mySourceChar <= 0x7f ) {
targetUniChar = mySourceChar ;
}
else {
int32_t length = ucnv_MBCSFromUChar32 ( myConverterData -> gbConverter -> sharedData , mySourceChar , & targetUniChar , args -> converter -> useFallback ) ;
if ( length == 2 && ( uint16_t ) ( targetUniChar - 0xa1a1 ) <= ( 0xfdfe - 0xa1a1 ) && ( uint8_t ) ( targetUniChar - 0xa1 ) <= ( 0xfe - 0xa1 ) ) {
targetUniChar -= 0x8080 ;
}
else {
targetUniChar = missingCharMarker ;
}
}
if ( targetUniChar != missingCharMarker ) {
myConverterData -> isTargetUCharDBCS = isTargetUCharDBCS = ( UBool ) ( targetUniChar > 0x00FF ) ;
if ( oldIsTargetUCharDBCS != isTargetUCharDBCS || ! myConverterData -> isEscapeAppended ) {
if ( ! isTargetUCharDBCS ) {
len = ESC_LEN ;
escSeq = SB_ESCAPE ;
CONCAT_ESCAPE_MACRO ( args , myTargetIndex , targetLength , escSeq , err , len , mySourceIndex ) ;
myConverterData -> isEscapeAppended = TRUE ;
}
else {
len = ESC_LEN ;
escSeq = DB_ESCAPE ;
CONCAT_ESCAPE_MACRO ( args , myTargetIndex , targetLength , escSeq , err , len , mySourceIndex ) ;
myConverterData -> isEscapeAppended = TRUE ;
}
}
if ( isTargetUCharDBCS ) {
if ( myTargetIndex < targetLength ) {
myTarget [ myTargetIndex ++ ] = ( char ) ( targetUniChar >> 8 ) ;
if ( offsets ) {
* ( offsets ++ ) = mySourceIndex - 1 ;
}
if ( myTargetIndex < targetLength ) {
myTarget [ myTargetIndex ++ ] = ( char ) targetUniChar ;
if ( offsets ) {
* ( offsets ++ ) = mySourceIndex - 1 ;
}
}
else {
args -> converter -> charErrorBuffer [ args -> converter -> charErrorBufferLength ++ ] = ( char ) targetUniChar ;
* err = U_BUFFER_OVERFLOW_ERROR ;
}
}
else {
args -> converter -> charErrorBuffer [ args -> converter -> charErrorBufferLength ++ ] = ( char ) ( targetUniChar >> 8 ) ;
args -> converter -> charErrorBuffer [ args -> converter -> charErrorBufferLength ++ ] = ( char ) targetUniChar ;
* err = U_BUFFER_OVERFLOW_ERROR ;
}
}
else {
if ( myTargetIndex < targetLength ) {
myTarget [ myTargetIndex ++ ] = ( char ) ( targetUniChar ) ;
if ( offsets ) {
* ( offsets ++ ) = mySourceIndex - 1 ;
}
}
else {
args -> converter -> charErrorBuffer [ args -> converter -> charErrorBufferLength ++ ] = ( char ) targetUniChar ;
* err = U_BUFFER_OVERFLOW_ERROR ;
}
}
}
else {
if ( U16_IS_SURROGATE ( mySourceChar ) ) {
if ( U16_IS_SURROGATE_LEAD ( mySourceChar ) ) {
args -> converter -> fromUChar32 = mySourceChar ;
getTrail : if ( mySourceIndex < mySourceLength ) {
UChar trail = ( UChar ) args -> source [ mySourceIndex ] ;
if ( U16_IS_TRAIL ( trail ) ) {
++ mySourceIndex ;
mySourceChar = U16_GET_SUPPLEMENTARY ( args -> converter -> fromUChar32 , trail ) ;
args -> converter -> fromUChar32 = 0x00 ;
* err = U_INVALID_CHAR_FOUND ;
}
else {
* err = U_ILLEGAL_CHAR_FOUND ;
}
}
else {
* err = U_ZERO_ERROR ;
}
}
else {
* err = U_ILLEGAL_CHAR_FOUND ;
}
}
else {
* err = U_INVALID_CHAR_FOUND ;
}
args -> converter -> fromUChar32 = mySourceChar ;
break ;
}
}
else {
* err = U_BUFFER_OVERFLOW_ERROR ;
break ;
}
targetUniChar = missingCharMarker ;
}
args -> target += myTargetIndex ;
args -> source += mySourceIndex ;
myConverterData -> isTargetUCharDBCS = isTargetUCharDBCS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static socket_handle_t adb_connect ( const char * server_ip , unsigned short * server_tcp_port ) {
socket_handle_t sock ;
socklen_t length ;
struct sockaddr_in server ;
struct sockaddr_in client ;
int status ;
int tries = 0 ;
memset ( & server , 0x0 , sizeof ( server ) ) ;
server . sin_family = AF_INET ;
server . sin_port = GINT16_TO_BE ( * server_tcp_port ) ;
server . sin_addr . s_addr = inet_addr ( server_ip ) ;
if ( ( sock = socket ( AF_INET , SOCK_STREAM , IPPROTO_TCP ) ) == INVALID_SOCKET ) {
errmsg_print ( "ERROR: Cannot open system TCP socket: %s" , strerror ( errno ) ) ;
return INVALID_SOCKET ;
}
useNonBlockingConnectTimeout ( sock ) ;
while ( tries < SOCKET_CONNECT_TIMEOUT_TRIES ) {
status = connect ( sock , ( struct sockaddr * ) & server , ( socklen_t ) sizeof ( server ) ) ;
tries += 1 ;
if ( status != SOCKET_ERROR ) break ;
g_usleep ( SOCKET_CONNECT_DELAY_US ) ;
}
useNormalConnectTimeout ( sock ) ;
if ( status == SOCKET_ERROR ) {
# if 0 # ifdef _WIN32 if ( _execlp ( "adb" , "adb" , "start-server" , NULL ) ) {
# else if ( execlp ( "adb" , "adb" , "start-server" , NULL ) ) {
# endif errmsg ( "WARNING: Cannot execute system command to start adb: %s" , strerror ( errno ) ) ;
closesocket ( sock ) ;
return INVALID_SOCKET ;
}
;
if ( connect ( sock , ( struct sockaddr * ) & server , sizeof ( server ) ) == SOCKET_ERROR ) {
errmsg_print ( "ERROR: Cannot connect to ADB: <%s> Please check that adb daemon is running." , strerror ( errno ) ) ;
closesocket ( sock ) ;
return INVALID_SOCKET ;
}
# else verbose_print ( "Cannot connect to ADB: <%s> Please check that adb daemon is running.\n" , strerror ( errno ) ) ;
closesocket ( sock ) ;
return INVALID_SOCKET ;
# endif }
if ( verbose ) {
length = sizeof ( client ) ;
if ( getsockname ( sock , ( struct sockaddr * ) & client , & length ) ) {
errmsg_print ( "ERROR getsockname: %s" , strerror ( errno ) ) ;
closesocket ( sock ) ;
return INVALID_SOCKET ;
}
if ( length != sizeof ( client ) ) {
errmsg_print ( "ERROR: incorrect length" ) ;
closesocket ( sock ) ;
return INVALID_SOCKET ;
}
verbose_print ( "VERBOSE: Client port %u\n" , GUINT16_FROM_BE ( client . sin_port ) ) ;
}
return sock ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void nice_time ( double sec , char * buff , bool part_second ) {
ulong tmp ;
if ( sec >= 3600.0 * 24 ) {
tmp = ( ulong ) floor ( sec / ( 3600.0 * 24 ) ) ;
sec -= 3600.0 * 24 * tmp ;
buff = int10_to_str ( ( long ) tmp , buff , 10 ) ;
buff = strmov ( buff , tmp > 1 ? " days " : " day " ) ;
}
if ( sec >= 3600.0 ) {
tmp = ( ulong ) floor ( sec / 3600.0 ) ;
sec -= 3600.0 * tmp ;
buff = int10_to_str ( ( long ) tmp , buff , 10 ) ;
buff = strmov ( buff , tmp > 1 ? " hours " : " hour " ) ;
}
if ( sec >= 60.0 ) {
tmp = ( ulong ) floor ( sec / 60.0 ) ;
sec -= 60.0 * tmp ;
buff = int10_to_str ( ( long ) tmp , buff , 10 ) ;
buff = strmov ( buff , " min " ) ;
}
if ( part_second ) sprintf ( buff , "%.2f sec" , sec ) ;
else sprintf ( buff , "%d sec" , ( int ) sec ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
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 )
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.