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 long nfatree ( struct vars * v , struct subre * t , FILE * f ) {
assert ( t != NULL && t -> begin != NULL ) ;
if ( t -> left != NULL ) ( DISCARD ) nfatree ( v , t -> left , f ) ;
if ( t -> right != NULL ) ( DISCARD ) nfatree ( v , t -> right , f ) ;
return nfanode ( v , t , 0 , f ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void save_bits ( WMAProDecodeCtx * s , GetBitContext * gb , int len , int append ) {
int buflen ;
if ( ! append ) {
s -> frame_offset = get_bits_count ( gb ) & 7 ;
s -> num_saved_bits = s -> frame_offset ;
init_put_bits ( & s -> pb , s -> frame_data , MAX_FRAMESIZE ) ;
}
buflen = ( s -> num_saved_bits + len + 8 ) >> 3 ;
if ( len <= 0 || buflen > MAX_FRAMESIZE ) {
av_log_ask_for_sample ( s -> avctx , "input buffer too small\n" ) ;
s -> packet_loss = 1 ;
return ;
}
s -> num_saved_bits += len ;
if ( ! append ) {
avpriv_copy_bits ( & s -> pb , gb -> buffer + ( get_bits_count ( gb ) >> 3 ) , s -> num_saved_bits ) ;
}
else {
int align = 8 - ( get_bits_count ( gb ) & 7 ) ;
align = FFMIN ( align , len ) ;
put_bits ( & s -> pb , align , get_bits ( gb , align ) ) ;
len -= align ;
avpriv_copy_bits ( & s -> pb , gb -> buffer + ( get_bits_count ( gb ) >> 3 ) , len ) ;
}
skip_bits_long ( gb , len ) ;
{
PutBitContext tmp = s -> pb ;
flush_put_bits ( & tmp ) ;
}
init_get_bits ( & s -> gb , s -> frame_data , s -> num_saved_bits ) ;
skip_bits ( & s -> gb , s -> frame_offset ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( SoundContentSettingObserverTest , AudioMutingUpdatesWithContentSetting ) {
EXPECT_FALSE ( web_contents ( ) -> IsAudioMuted ( ) ) ;
ChangeSoundContentSettingTo ( CONTENT_SETTING_BLOCK ) ;
EXPECT_TRUE ( web_contents ( ) -> IsAudioMuted ( ) ) ;
ChangeSoundContentSettingTo ( CONTENT_SETTING_ALLOW ) ;
EXPECT_FALSE ( web_contents ( ) -> IsAudioMuted ( ) ) ;
ChangeSoundContentSettingTo ( CONTENT_SETTING_DEFAULT ) ;
EXPECT_FALSE ( web_contents ( ) -> IsAudioMuted ( ) ) ;
ChangeDefaultSoundContentSettingTo ( CONTENT_SETTING_BLOCK ) ;
EXPECT_TRUE ( web_contents ( ) -> IsAudioMuted ( ) ) ;
ChangeSoundContentSettingTo ( CONTENT_SETTING_ALLOW ) ;
EXPECT_FALSE ( web_contents ( ) -> IsAudioMuted ( ) ) ;
ChangeSoundContentSettingTo ( CONTENT_SETTING_DEFAULT ) ;
EXPECT_TRUE ( web_contents ( ) -> IsAudioMuted ( ) ) ;
ChangeDefaultSoundContentSettingTo ( CONTENT_SETTING_ALLOW ) ;
EXPECT_FALSE ( web_contents ( ) -> IsAudioMuted ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int mysql_real_query_for_lazy ( const char * buf , int length ) {
for ( uint retry = 0 ;
;
retry ++ ) {
int error ;
if ( ! mysql_real_query ( & mysql , buf , length ) ) return 0 ;
error = put_error ( & mysql ) ;
if ( mysql_errno ( & mysql ) != CR_SERVER_GONE_ERROR || retry > 1 || ! opt_reconnect ) return error ;
if ( reconnect ( ) ) return error ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void qdev_free ( DeviceState * dev ) {
BusState * bus ;
if ( dev -> state == DEV_STATE_INITIALIZED ) {
while ( dev -> num_child_bus ) {
bus = QLIST_FIRST ( & dev -> child_bus ) ;
qbus_free ( bus ) ;
}
if ( dev -> info -> vmsd ) vmstate_unregister ( dev -> info -> vmsd , dev ) ;
if ( dev -> info -> exit ) dev -> info -> exit ( dev ) ;
if ( dev -> opts ) qemu_opts_del ( dev -> opts ) ;
}
qemu_unregister_reset ( qdev_reset , dev ) ;
QLIST_REMOVE ( dev , sibling ) ;
qemu_free ( dev ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pfkey_dump_sp_done ( struct pfkey_sock * pfk ) {
xfrm_policy_walk_done ( & pfk -> dump . u . policy ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_T_empty_flg ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 375 "./asn1/h225/h225.cnf" h225_packet_info * h225_pi ;
offset = dissect_per_null ( tvb , offset , actx , tree , hf_index ) ;
# line 379 "./asn1/h225/h225.cnf" h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
if ( h225_pi != NULL ) {
h225_pi -> cs_type = H225_EMPTY ;
}
return offset ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int fts_build_data ( struct fts_mail_build_context * ctx , const unsigned char * data , size_t size , bool last ) {
if ( ( ctx -> update_ctx -> backend -> flags & FTS_BACKEND_FLAG_TOKENIZED_INPUT ) != 0 ) {
return fts_build_tokenized ( ctx , data , size , last ) ;
}
else if ( ( ctx -> update_ctx -> backend -> flags & FTS_BACKEND_FLAG_BUILD_FULL_WORDS ) != 0 ) {
return fts_build_full_words ( ctx , data , size , last ) ;
}
else {
return fts_backend_update_build_more ( ctx -> update_ctx , data , size ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void virtio_ioport_write ( void * opaque , uint32_t addr , uint32_t val ) {
VirtIOPCIProxy * proxy = opaque ;
VirtIODevice * vdev = proxy -> vdev ;
target_phys_addr_t pa ;
switch ( addr ) {
case VIRTIO_PCI_GUEST_FEATURES : if ( val & ( 1 << VIRTIO_F_BAD_FEATURE ) ) {
if ( vdev -> bad_features ) val = proxy -> host_features & vdev -> bad_features ( vdev ) ;
else val = 0 ;
}
if ( vdev -> set_features ) vdev -> set_features ( vdev , val ) ;
vdev -> guest_features = val ;
break ;
case VIRTIO_PCI_QUEUE_PFN : pa = ( target_phys_addr_t ) val << VIRTIO_PCI_QUEUE_ADDR_SHIFT ;
if ( pa == 0 ) {
virtio_reset ( proxy -> vdev ) ;
msix_unuse_all_vectors ( & proxy -> pci_dev ) ;
}
else virtio_queue_set_addr ( vdev , vdev -> queue_sel , pa ) ;
break ;
case VIRTIO_PCI_QUEUE_SEL : if ( val < VIRTIO_PCI_QUEUE_MAX ) vdev -> queue_sel = val ;
break ;
case VIRTIO_PCI_QUEUE_NOTIFY : virtio_queue_notify ( vdev , val ) ;
break ;
case VIRTIO_PCI_STATUS : vdev -> status = val & 0xFF ;
if ( vdev -> status == 0 ) {
virtio_reset ( proxy -> vdev ) ;
msix_unuse_all_vectors ( & proxy -> pci_dev ) ;
}
break ;
case VIRTIO_MSI_CONFIG_VECTOR : msix_vector_unuse ( & proxy -> pci_dev , vdev -> config_vector ) ;
if ( msix_vector_use ( & proxy -> pci_dev , val ) < 0 ) val = VIRTIO_NO_VECTOR ;
vdev -> config_vector = val ;
break ;
case VIRTIO_MSI_QUEUE_VECTOR : msix_vector_unuse ( & proxy -> pci_dev , virtio_queue_vector ( vdev , vdev -> queue_sel ) ) ;
if ( msix_vector_use ( & proxy -> pci_dev , val ) < 0 ) val = VIRTIO_NO_VECTOR ;
virtio_queue_set_vector ( vdev , vdev -> queue_sel , val ) ;
break ;
default : fprintf ( stderr , "%s: unexpected address 0x%x value 0x%x\n" , __func__ , addr , val ) ;
break ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int padr_bcast ( PCNetState * s , const uint8_t * buf , int size ) {
static const uint8_t BCAST [ 6 ] = {
0xff , 0xff , 0xff , 0xff , 0xff , 0xff }
;
struct qemu_ether_header * hdr = ( void * ) buf ;
int result = ! CSR_DRCVBC ( s ) && ! memcmp ( hdr -> ether_dhost , BCAST , 6 ) ;
# ifdef PCNET_DEBUG_MATCH printf ( "padr_bcast result=%d\n" , result ) ;
# endif return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void xps_measure_font_glyph ( xps_document * doc , fz_font * font , int gid , xps_glyph_metrics * mtx ) {
int mask = FT_LOAD_NO_SCALE | FT_LOAD_IGNORE_TRANSFORM ;
FT_Face face = font -> ft_face ;
FT_Fixed hadv , vadv ;
fz_context * ctx = doc -> ctx ;
fz_lock ( ctx , FZ_LOCK_FREETYPE ) ;
FT_Get_Advance ( face , gid , mask , & hadv ) ;
FT_Get_Advance ( face , gid , mask | FT_LOAD_VERTICAL_LAYOUT , & vadv ) ;
fz_unlock ( ctx , FZ_LOCK_FREETYPE ) ;
mtx -> hadv = hadv / ( float ) face -> units_per_EM ;
mtx -> vadv = vadv / ( float ) face -> units_per_EM ;
mtx -> vorg = face -> ascender / ( float ) face -> units_per_EM ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_iht8x8_add ( TX_TYPE tx_type , const tran_low_t * input , uint8_t * dest , int stride , int eob ) {
if ( tx_type == DCT_DCT ) {
vp9_idct8x8_add ( input , dest , stride , eob ) ;
}
else {
vp9_iht8x8_64_add ( input , dest , stride , tx_type ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
MSG_PROCESS_RETURN ossl_statem_server_process_message ( SSL * s , PACKET * pkt ) {
OSSL_STATEM * st = & s -> statem ;
switch ( st -> hand_state ) {
case TLS_ST_SR_CLNT_HELLO : return tls_process_client_hello ( s , pkt ) ;
case TLS_ST_SR_CERT : return tls_process_client_certificate ( s , pkt ) ;
case TLS_ST_SR_KEY_EXCH : return tls_process_client_key_exchange ( s , pkt ) ;
case TLS_ST_SR_CERT_VRFY : return tls_process_cert_verify ( s , pkt ) ;
# ifndef OPENSSL_NO_NEXTPROTONEG case TLS_ST_SR_NEXT_PROTO : return tls_process_next_proto ( s , pkt ) ;
# endif case TLS_ST_SR_CHANGE : return tls_process_change_cipher_spec ( s , pkt ) ;
case TLS_ST_SR_FINISHED : return tls_process_finished ( s , pkt ) ;
default : break ;
}
return MSG_PROCESS_ERROR ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int wpa_sess_get ( u_char * sta , struct wpa_sa * sa ) {
struct wpa_session * e ;
pthread_mutex_lock ( & root_mutex ) ;
LIST_FOREACH ( e , & wpa_sess_root , next ) {
if ( ! memcmp ( & e -> sta , sta , ETH_ADDR_LEN ) ) {
memcpy ( sa , & e -> sa , sizeof ( struct wpa_sa ) ) ;
pthread_mutex_unlock ( & root_mutex ) ;
return E_SUCCESS ;
}
}
pthread_mutex_unlock ( & root_mutex ) ;
return - E_NOTFOUND ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
long jas_stream_tell ( jas_stream_t * stream ) {
int adjust ;
int offset ;
if ( stream -> bufmode_ & JAS_STREAM_RDBUF ) {
adjust = - stream -> cnt_ ;
}
else if ( stream -> bufmode_ & JAS_STREAM_WRBUF ) {
adjust = stream -> ptr_ - stream -> bufstart_ ;
}
else {
adjust = 0 ;
}
if ( ( offset = ( * stream -> ops_ -> seek_ ) ( stream -> obj_ , 0 , SEEK_CUR ) ) < 0 ) {
return - 1 ;
}
return offset + adjust ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void openpic_gcr_write ( OpenPICState * opp , uint64_t val ) {
bool mpic_proxy = false ;
if ( val & GCR_RESET ) {
openpic_reset ( DEVICE ( opp ) ) ;
return ;
}
opp -> gcr &= ~ opp -> mpic_mode_mask ;
opp -> gcr |= val & opp -> mpic_mode_mask ;
if ( ( val & opp -> mpic_mode_mask ) == GCR_MODE_PROXY ) {
mpic_proxy = true ;
}
ppce500_set_mpic_proxy ( mpic_proxy ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static u32 gen_reqid ( struct net * net ) {
struct xfrm_policy_walk walk ;
u32 start ;
int rc ;
static u32 reqid = IPSEC_MANUAL_REQID_MAX ;
start = reqid ;
do {
++ reqid ;
if ( reqid == 0 ) reqid = IPSEC_MANUAL_REQID_MAX + 1 ;
xfrm_policy_walk_init ( & walk , XFRM_POLICY_TYPE_MAIN ) ;
rc = xfrm_policy_walk ( net , & walk , check_reqid , ( void * ) & reqid ) ;
xfrm_policy_walk_done ( & walk ) ;
if ( rc != - EEXIST ) return reqid ;
}
while ( reqid != start ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void dcc_resume_init ( void ) {
signal_add ( "ctcp msg dcc resume" , ( SIGNAL_FUNC ) ctcp_msg_dcc_resume ) ;
signal_add ( "ctcp msg dcc accept" , ( SIGNAL_FUNC ) ctcp_msg_dcc_accept ) ;
command_bind ( "dcc resume" , NULL , ( SIGNAL_FUNC ) cmd_dcc_resume ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( TemplateURLTest , InputEncodingBeforeSearchTerm ) {
TemplateURLData data ;
data . SetURL ( "http://foox{
inputEncoding?}
a{
searchTerms}
y{
outputEncoding?}
b" ) ;
TemplateURL url ( data ) ;
EXPECT_TRUE ( url . url_ref ( ) . IsValid ( search_terms_data_ ) ) ;
ASSERT_TRUE ( url . url_ref ( ) . SupportsReplacement ( search_terms_data_ ) ) ;
GURL result ( url . url_ref ( ) . ReplaceSearchTerms ( TemplateURLRef : : SearchTermsArgs ( ASCIIToUTF16 ( "X" ) ) , search_terms_data_ ) ) ;
ASSERT_TRUE ( result . is_valid ( ) ) ;
EXPECT_EQ ( "http://fooxutf-8axyb/" , result . spec ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void mark_trusted_task_thread_func ( GTask * task , gpointer source_object , gpointer task_data , GCancellable * cancellable ) {
MarkTrustedJob * job = task_data ;
CommonJob * common ;
common = ( CommonJob * ) job ;
nautilus_progress_info_start ( job -> common . progress ) ;
mark_desktop_file_trusted ( common , cancellable , job -> file , job -> interactive ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int matroska_read_seek ( AVFormatContext * s , int stream_index , int64_t timestamp , int flags ) {
MatroskaDemuxContext * matroska = s -> priv_data ;
MatroskaTrack * tracks = matroska -> tracks . elem ;
AVStream * st = s -> streams [ stream_index ] ;
int i , index , index_sub , index_min ;
if ( matroska -> cues_parsing_deferred ) {
matroska_parse_cues ( matroska ) ;
matroska -> cues_parsing_deferred = 0 ;
}
if ( ! st -> nb_index_entries ) return 0 ;
timestamp = FFMAX ( timestamp , st -> index_entries [ 0 ] . timestamp ) ;
if ( ( index = av_index_search_timestamp ( st , timestamp , flags ) ) < 0 ) {
avio_seek ( s -> pb , st -> index_entries [ st -> nb_index_entries - 1 ] . pos , SEEK_SET ) ;
matroska -> current_id = 0 ;
while ( ( index = av_index_search_timestamp ( st , timestamp , flags ) ) < 0 ) {
matroska_clear_queue ( matroska ) ;
if ( matroska_parse_cluster ( matroska ) < 0 ) break ;
}
}
matroska_clear_queue ( matroska ) ;
if ( index < 0 ) return 0 ;
index_min = index ;
for ( i = 0 ;
i < matroska -> tracks . nb_elem ;
i ++ ) {
tracks [ i ] . audio . pkt_cnt = 0 ;
tracks [ i ] . audio . sub_packet_cnt = 0 ;
tracks [ i ] . audio . buf_timecode = AV_NOPTS_VALUE ;
tracks [ i ] . end_timecode = 0 ;
if ( tracks [ i ] . type == MATROSKA_TRACK_TYPE_SUBTITLE && tracks [ i ] . stream -> discard != AVDISCARD_ALL ) {
index_sub = av_index_search_timestamp ( tracks [ i ] . stream , st -> index_entries [ index ] . timestamp , AVSEEK_FLAG_BACKWARD ) ;
if ( index_sub >= 0 && st -> index_entries [ index_sub ] . pos < st -> index_entries [ index_min ] . pos && st -> index_entries [ index ] . timestamp - st -> index_entries [ index_sub ] . timestamp < 30000000000 / matroska -> time_scale ) index_min = index_sub ;
}
}
avio_seek ( s -> pb , st -> index_entries [ index_min ] . pos , SEEK_SET ) ;
matroska -> current_id = 0 ;
matroska -> skip_to_keyframe = ! ( flags & AVSEEK_FLAG_ANY ) ;
matroska -> skip_to_timecode = st -> index_entries [ index ] . timestamp ;
matroska -> done = 0 ;
ff_update_cur_dts ( s , st , st -> index_entries [ index ] . timestamp ) ;
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int user_key_allowed ( struct ssh * ssh , struct passwd * pw , struct sshkey * key , int auth_attempt , struct sshauthopt * * authoptsp ) {
u_int success , i ;
char * file ;
struct sshauthopt * opts = NULL ;
if ( authoptsp != NULL ) * authoptsp = NULL ;
if ( auth_key_is_revoked ( key ) ) return 0 ;
if ( sshkey_is_cert ( key ) && auth_key_is_revoked ( key -> cert -> signature_key ) ) return 0 ;
if ( ( success = user_cert_trusted_ca ( ssh , pw , key , & opts ) ) != 0 ) goto out ;
sshauthopt_free ( opts ) ;
opts = NULL ;
if ( ( success = user_key_command_allowed2 ( ssh , pw , key , & opts ) ) != 0 ) goto out ;
sshauthopt_free ( opts ) ;
opts = NULL ;
for ( i = 0 ;
! success && i < options . num_authkeys_files ;
i ++ ) {
if ( strcasecmp ( options . authorized_keys_files [ i ] , "none" ) == 0 ) continue ;
file = expand_authorized_keys ( options . authorized_keys_files [ i ] , pw ) ;
success = user_key_allowed2 ( ssh , pw , key , file , & opts ) ;
free ( file ) ;
}
out : if ( success && authoptsp != NULL ) {
* authoptsp = opts ;
opts = NULL ;
}
sshauthopt_free ( opts ) ;
return success ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int i2d_RSAPrivateKey_bio ( BIO * bp , RSA * rsa ) {
return ASN1_item_i2d_bio ( ASN1_ITEM_rptr ( RSAPrivateKey ) , bp , rsa ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int event_loopbreak ( void ) {
return ( event_base_loopbreak ( current_base ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void register_number_string_decoding_error ( void ) {
static ei_register_info ei [ ] = {
{
& ei_number_string_decoding_failed_error , {
"_ws.number_string.decoding_error.failed" , PI_MALFORMED , PI_ERROR , "Failed to decode number from string" , EXPFILL }
}
, {
& ei_number_string_decoding_erange_error , {
"_ws.number_string.decoding_error.erange" , PI_MALFORMED , PI_ERROR , "Decoded number from string is out of valid range" , EXPFILL }
}
, }
;
expert_module_t * expert_number_string_decoding_error ;
proto_number_string_decoding_error = proto_register_protocol ( "Number-String Decoding Error" , "Number-string decoding error" , "_ws.number_string.decoding_error" ) ;
expert_number_string_decoding_error = expert_register_protocol ( proto_number_string_decoding_error ) ;
expert_register_field_array ( expert_number_string_decoding_error , ei , array_length ( ei ) ) ;
proto_set_cant_toggle ( proto_number_string_decoding_error ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int my_system ( DYNAMIC_STRING * ds_cmd ) {
# if defined __WIN__ && defined USE_CYGWIN str_to_file ( tmp_sh_name , ds_cmd -> str , ds_cmd -> length ) ;
return system ( tmp_sh_cmd ) ;
# else return system ( ds_cmd -> str ) ;
# endif }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int virtio_blk_exit_pci ( PCIDevice * pci_dev ) {
VirtIOPCIProxy * proxy = DO_UPCAST ( VirtIOPCIProxy , pci_dev , pci_dev ) ;
drive_uninit ( proxy -> dinfo ) ;
return virtio_exit_pci ( pci_dev ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline void lh_ ## type ## _node_usage_stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) {
OPENSSL_LH_node_usage_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ;
}
static ossl_inline void lh_ ## type ## _stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) {
OPENSSL_LH_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ;
}
static ossl_inline unsigned long lh_ ## type ## _get_down_load ( LHASH_OF ( type ) * lh ) {
return OPENSSL_LH_get_down_load ( ( OPENSSL_LHASH * ) lh ) ;
}
static ossl_inline void lh_ ## type ## _set_down_load ( LHASH_OF ( type ) * lh , unsigned long dl ) {
OPENSSL_LH_set_down_load ( ( OPENSSL_LHASH * ) lh , dl ) ;
}
static ossl_inline void lh_ ## type ## _doall ( LHASH_OF ( type ) * lh , void ( * doall ) ( type * ) ) {
OPENSSL_LH_doall ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNC ) doall ) ;
}
LHASH_OF ( type ) # define IMPLEMENT_LHASH_DOALL_ARG_CONST ( type , argtype ) int_implement_lhash_doall ( type , argtype , const type ) # define IMPLEMENT_LHASH_DOALL_ARG ( type , argtype ) int_implement_lhash_doall ( type , argtype , type ) # define int_implement_lhash_doall ( type , argtype , cbargtype ) static ossl_inline void lh_ ## type ## _doall_ ## argtype ( LHASH_OF ( type ) * lh , void ( * fn ) ( cbargtype * , argtype * ) , argtype * arg ) {
OPENSSL_LH_doall_arg ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNCARG ) fn , ( void * ) arg ) ;
}
LHASH_OF ( type ) DEFINE_LHASH_OF ( OPENSSL_STRING )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ff_vdpau_h264_picture_start ( H264Context * h ) {
struct vdpau_render_state * render ;
int i ;
render = ( struct vdpau_render_state * ) h -> cur_pic_ptr -> f . data [ 0 ] ;
assert ( render ) ;
for ( i = 0 ;
i < 2 ;
++ i ) {
int foc = h -> cur_pic_ptr -> field_poc [ i ] ;
if ( foc == INT_MAX ) foc = 0 ;
render -> info . h264 . field_order_cnt [ i ] = foc ;
}
render -> info . h264 . frame_num = h -> frame_num ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int64_t TSCacheHttpInfoSizeGet ( TSCacheHttpInfo infop ) {
CacheHTTPInfo * info = ( CacheHTTPInfo * ) infop ;
return info -> object_size_get ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void sig_message_private ( SERVER_REC * server , const char * msg , const char * nick , const char * address ) {
g_return_if_fail ( server != NULL ) ;
g_return_if_fail ( nick != NULL ) ;
SERVER_LAST_MSG_ADD ( server , nick ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void qemuMonitorJSONHandleVNCInitialize ( qemuMonitorPtr mon , virJSONValuePtr data ) {
qemuMonitorJSONHandleVNC ( mon , data , VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean ng_file_skip_seq ( wtap * wth , gint64 delta , int * err , gchar * * err_info ) {
ngsniffer_t * ngsniffer ;
char * buf ;
unsigned int amount_to_read ;
ngsniffer = ( ngsniffer_t * ) wth -> priv ;
if ( wth -> file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED ) {
ngsniffer -> seq . uncomp_offset += delta ;
return file_skip ( wth -> fh , delta , err ) ;
}
g_assert ( delta >= 0 ) ;
buf = ( char * ) g_malloc ( INBUF_SIZE ) ;
while ( delta != 0 ) {
if ( delta > INBUF_SIZE ) amount_to_read = INBUF_SIZE ;
else amount_to_read = ( unsigned int ) delta ;
if ( ! ng_read_bytes ( wth , buf , amount_to_read , FALSE , err , err_info ) ) {
g_free ( buf ) ;
return FALSE ;
}
delta -= amount_to_read ;
}
g_free ( buf ) ;
return TRUE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void proto_reg_handoff_pkt_ccc ( void ) {
static gboolean initialized = FALSE ;
static dissector_handle_t pkt_ccc_handle ;
static guint saved_pkt_ccc_udp_port ;
if ( ! initialized ) {
pkt_ccc_handle = find_dissector ( "pkt_ccc" ) ;
dissector_add_handle ( "udp.port" , pkt_ccc_handle ) ;
initialized = TRUE ;
}
else {
if ( saved_pkt_ccc_udp_port != 0 ) {
dissector_delete_uint ( "udp.port" , saved_pkt_ccc_udp_port , pkt_ccc_handle ) ;
}
}
if ( global_pkt_ccc_udp_port != 0 ) {
dissector_add_uint ( "udp.port" , global_pkt_ccc_udp_port , pkt_ccc_handle ) ;
}
saved_pkt_ccc_udp_port = global_pkt_ccc_udp_port ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int event_reinit ( struct event_base * base ) {
const struct eventop * evsel = base -> evsel ;
void * evbase = base -> evbase ;
int res = 0 ;
struct event * ev ;
if ( ! evsel -> need_reinit ) return ( 0 ) ;
if ( base -> sig . ev_signal_added ) {
event_queue_remove ( base , & base -> sig . ev_signal , EVLIST_INSERTED ) ;
if ( base -> sig . ev_signal . ev_flags & EVLIST_ACTIVE ) event_queue_remove ( base , & base -> sig . ev_signal , EVLIST_ACTIVE ) ;
base -> sig . ev_signal_added = 0 ;
}
if ( base -> evsel -> dealloc != NULL ) base -> evsel -> dealloc ( base , base -> evbase ) ;
evbase = base -> evbase = evsel -> init ( base ) ;
if ( base -> evbase == NULL ) event_errx ( 1 , "%s: could not reinitialize event mechanism" , __func__ ) ;
TAILQ_FOREACH ( ev , & base -> eventqueue , ev_next ) {
if ( evsel -> add ( evbase , ev ) == - 1 ) res = - 1 ;
}
return ( res ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void sig_nick_changed ( CHANNEL_REC * channel , NICK_REC * nick , const char * oldnick ) {
MODULE_CHANNEL_REC * mchannel ;
LAST_MSG_REC * rec ;
mchannel = MODULE_DATA ( channel ) ;
rec = last_msg_find ( mchannel -> lastmsgs , oldnick ) ;
if ( rec != NULL ) {
g_free ( rec -> nick ) ;
rec -> nick = g_strdup ( nick -> nick ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void psf_init_files ( SF_PRIVATE * psf ) {
psf -> file . filedes = - 1 ;
psf -> rsrc . filedes = - 1 ;
psf -> file . savedes = - 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_btgatt_microbit_microbit_event ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data ) {
btatt_data_t * att_data = ( btatt_data_t * ) data ;
if ( bluetooth_gatt_has_no_parameter ( att_data -> opcode ) ) return - 1 ;
proto_tree_add_item ( tree , hf_gatt_microbit_microbit_event , tvb , 0 , tvb_captured_length ( tvb ) , ENC_NA ) ;
return tvb_captured_length ( tvb ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void gs_memory_set_gc_status ( gs_ref_memory_t * mem , const gs_memory_gc_status_t * pstat ) {
mem -> gc_status = * pstat ;
ialloc_set_limit ( mem ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
inline const OldUChar * toOldUCharPtr ( const char16_t * p ) {
# ifdef U_ALIASING_BARRIER U_ALIASING_BARRIER ( p ) ;
# endif return reinterpret_cast < const OldUChar * > ( p ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int free_context_frame ( MpegEncContext * s ) {
int i , j , k ;
av_freep ( & s -> mb_type ) ;
av_freep ( & s -> p_mv_table_base ) ;
av_freep ( & s -> b_forw_mv_table_base ) ;
av_freep ( & s -> b_back_mv_table_base ) ;
av_freep ( & s -> b_bidir_forw_mv_table_base ) ;
av_freep ( & s -> b_bidir_back_mv_table_base ) ;
av_freep ( & s -> b_direct_mv_table_base ) ;
s -> p_mv_table = NULL ;
s -> b_forw_mv_table = NULL ;
s -> b_back_mv_table = NULL ;
s -> b_bidir_forw_mv_table = NULL ;
s -> b_bidir_back_mv_table = NULL ;
s -> b_direct_mv_table = NULL ;
for ( i = 0 ;
i < 2 ;
i ++ ) {
for ( j = 0 ;
j < 2 ;
j ++ ) {
for ( k = 0 ;
k < 2 ;
k ++ ) {
av_freep ( & s -> b_field_mv_table_base [ i ] [ j ] [ k ] ) ;
s -> b_field_mv_table [ i ] [ j ] [ k ] = NULL ;
}
av_freep ( & s -> b_field_select_table [ i ] [ j ] ) ;
av_freep ( & s -> p_field_mv_table_base [ i ] [ j ] ) ;
s -> p_field_mv_table [ i ] [ j ] = NULL ;
}
av_freep ( & s -> p_field_select_table [ i ] ) ;
}
av_freep ( & s -> dc_val_base ) ;
av_freep ( & s -> coded_block_base ) ;
av_freep ( & s -> mbintra_table ) ;
av_freep ( & s -> cbp_table ) ;
av_freep ( & s -> pred_dir_table ) ;
av_freep ( & s -> mbskip_table ) ;
av_freep ( & s -> er . error_status_table ) ;
av_freep ( & s -> er . er_temp_buffer ) ;
av_freep ( & s -> mb_index2xy ) ;
av_freep ( & s -> lambda_table ) ;
av_freep ( & s -> cplx_tab ) ;
av_freep ( & s -> bits_tab ) ;
s -> linesize = s -> uvlinesize = 0 ;
for ( i = 0 ;
i < 3 ;
i ++ ) av_freep ( & s -> visualization_buffer [ i ] ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void die_on_query_failure ( ArchiveHandle * AH , const char * modulename , const char * query ) {
write_msg ( modulename , "query failed: %s" , PQerrorMessage ( AH -> connection ) ) ;
exit_horribly ( modulename , "query was: %s\n" , query ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void armv7m_nvic_instance_init ( Object * obj ) {
GICState * s = ARM_GIC_COMMON ( obj ) ;
s -> num_irq = 64 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void ns_parse_questions ( tvbuff_t * tvb , gint * offset , proto_tree * alljoyn_tree , guint8 questions , guint message_version ) {
while ( questions -- ) {
proto_item * alljoyn_questions_ti ;
proto_tree * alljoyn_questions_tree ;
gint count ;
alljoyn_questions_ti = proto_tree_add_item ( alljoyn_tree , hf_alljoyn_ns_whohas , tvb , * offset , 2 , ENC_NA ) ;
alljoyn_questions_tree = proto_item_add_subtree ( alljoyn_questions_ti , ett_alljoyn_whohas ) ;
if ( 0 == message_version ) {
proto_tree_add_item ( alljoyn_questions_tree , hf_alljoyn_ns_whohas_t_flag , tvb , * offset , 1 , ENC_NA ) ;
proto_tree_add_item ( alljoyn_questions_tree , hf_alljoyn_ns_whohas_u_flag , tvb , * offset , 1 , ENC_NA ) ;
proto_tree_add_item ( alljoyn_questions_tree , hf_alljoyn_ns_whohas_s_flag , tvb , * offset , 1 , ENC_NA ) ;
proto_tree_add_item ( alljoyn_questions_tree , hf_alljoyn_ns_whohas_f_flag , tvb , * offset , 1 , ENC_NA ) ;
}
( * offset ) += 1 ;
proto_tree_add_item ( alljoyn_questions_tree , hf_alljoyn_ns_whohas_count , tvb , * offset , 1 , ENC_NA ) ;
count = tvb_get_guint8 ( tvb , * offset ) ;
( * offset ) += 1 ;
while ( count -- ) {
proto_item * alljoyn_bus_name_ti ;
proto_tree * alljoyn_bus_name_tree ;
gint bus_name_size = 0 ;
bus_name_size = tvb_get_guint8 ( tvb , * offset ) ;
alljoyn_bus_name_ti = proto_tree_add_item ( alljoyn_questions_tree , hf_alljoyn_string , tvb , * offset , 1 + bus_name_size , ENC_NA ) ;
alljoyn_bus_name_tree = proto_item_add_subtree ( alljoyn_bus_name_ti , ett_alljoyn_ns_string ) ;
proto_tree_add_item ( alljoyn_bus_name_tree , hf_alljoyn_string_size_8bit , tvb , * offset , 1 , ENC_NA ) ;
( * offset ) += 1 ;
proto_tree_add_item ( alljoyn_bus_name_tree , hf_alljoyn_string_data , tvb , * offset , bus_name_size , ENC_ASCII | ENC_NA ) ;
( * offset ) += bus_name_size ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_TerminalLabel ( 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_TerminalLabel , TerminalLabel_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void gtkui_inject_file ( const char * filename , int side ) {
int fd ;
void * buf ;
size_t size , ret ;
DEBUG_MSG ( "inject_file %s" , filename ) ;
if ( ( fd = open ( filename , O_RDONLY | O_BINARY ) ) == - 1 ) {
ui_error ( "Can't load the file" ) ;
return ;
}
size = lseek ( fd , 0 , SEEK_END ) ;
SAFE_CALLOC ( buf , size , sizeof ( char ) ) ;
lseek ( fd , 0 , SEEK_SET ) ;
ret = read ( fd , buf , size ) ;
close ( fd ) ;
if ( ret != size ) {
ui_error ( "Cannot read the file into memory" ) ;
return ;
}
if ( side == 1 || side == 2 ) {
user_inject ( buf , size , curr_conn , side ) ;
}
SAFE_FREE ( buf ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int compress_filter ( void * opaque , int control , IOBUF a , byte * buf , size_t * ret_len ) {
size_t size = * ret_len ;
compress_filter_context_t * zfx = opaque ;
z_stream * zs = zfx -> opaque ;
int rc = 0 ;
if ( control == IOBUFCTRL_UNDERFLOW ) {
if ( ! zfx -> status ) {
zs = zfx -> opaque = xmalloc_clear ( sizeof * zs ) ;
init_uncompress ( zfx , zs ) ;
zfx -> status = 1 ;
}
# ifndef __riscos__ zs -> next_out = buf ;
# else zs -> next_out = ( Bytef * ) buf ;
# endif zs -> avail_out = size ;
zfx -> outbufsize = size ;
rc = do_uncompress ( zfx , zs , a , ret_len ) ;
}
else if ( control == IOBUFCTRL_FLUSH ) {
if ( ! zfx -> status ) {
PACKET pkt ;
PKT_compressed cd ;
if ( zfx -> algo != COMPRESS_ALGO_ZIP && zfx -> algo != COMPRESS_ALGO_ZLIB ) BUG ( ) ;
memset ( & cd , 0 , sizeof cd ) ;
cd . len = 0 ;
cd . algorithm = zfx -> algo ;
init_packet ( & pkt ) ;
pkt . pkttype = PKT_COMPRESSED ;
pkt . pkt . compressed = & cd ;
if ( build_packet ( a , & pkt ) ) log_bug ( "build_packet(PKT_COMPRESSED) failed\n" ) ;
zs = zfx -> opaque = xmalloc_clear ( sizeof * zs ) ;
init_compress ( zfx , zs ) ;
zfx -> status = 2 ;
}
# ifndef __riscos__ zs -> next_in = buf ;
# else zs -> next_in = ( Bytef * ) buf ;
# endif zs -> avail_in = size ;
rc = do_compress ( zfx , zs , Z_NO_FLUSH , a ) ;
}
else if ( control == IOBUFCTRL_FREE ) {
if ( zfx -> status == 1 ) {
inflateEnd ( zs ) ;
xfree ( zs ) ;
zfx -> opaque = NULL ;
xfree ( zfx -> outbuf ) ;
zfx -> outbuf = NULL ;
}
else if ( zfx -> status == 2 ) {
# ifndef __riscos__ zs -> next_in = buf ;
# else zs -> next_in = ( Bytef * ) buf ;
# endif zs -> avail_in = 0 ;
do_compress ( zfx , zs , Z_FINISH , a ) ;
deflateEnd ( zs ) ;
xfree ( zs ) ;
zfx -> opaque = NULL ;
xfree ( zfx -> outbuf ) ;
zfx -> outbuf = NULL ;
}
if ( zfx -> release ) zfx -> release ( zfx ) ;
}
else if ( control == IOBUFCTRL_DESC ) * ( char * * ) buf = "compress_filter" ;
return rc ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void bprint_bytes ( AVBPrint * bp , const uint8_t * ubuf , size_t ubuf_size ) {
int i ;
av_bprintf ( bp , "0X" ) ;
for ( i = 0 ;
i < ubuf_size ;
i ++ ) av_bprintf ( bp , "%02X" , ubuf [ i ] ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void cpu_check_irqs ( CPUSPARCState * env ) {
CPUState * cs ;
if ( env -> pil_in && ( env -> interrupt_index == 0 || ( env -> interrupt_index & ~ 15 ) == TT_EXTINT ) ) {
unsigned int i ;
for ( i = 15 ;
i > 0 ;
i -- ) {
if ( env -> pil_in & ( 1 << i ) ) {
int old_interrupt = env -> interrupt_index ;
env -> interrupt_index = TT_EXTINT | i ;
if ( old_interrupt != env -> interrupt_index ) {
cs = CPU ( sparc_env_get_cpu ( env ) ) ;
trace_sun4m_cpu_interrupt ( i ) ;
cpu_interrupt ( cs , CPU_INTERRUPT_HARD ) ;
}
break ;
}
}
}
else if ( ! env -> pil_in && ( env -> interrupt_index & ~ 15 ) == TT_EXTINT ) {
cs = CPU ( sparc_env_get_cpu ( env ) ) ;
trace_sun4m_cpu_reset_interrupt ( env -> interrupt_index & 15 ) ;
env -> interrupt_index = 0 ;
cpu_reset_interrupt ( cs , CPU_INTERRUPT_HARD ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int32_t u_scanf_simple_percent_handler ( UFILE * input , u_scanf_spec_info * info , ufmt_args * args , const UChar * fmt , int32_t * fmtConsumed , int32_t * argConverted ) {
( void ) info ;
( void ) args ;
( void ) fmt ;
( void ) fmtConsumed ;
* argConverted = 0 ;
if ( u_fgetc ( input ) != 0x0025 ) {
* argConverted = - 1 ;
}
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
GList * completion_get_channels ( SERVER_REC * server , const char * word ) {
GList * list ;
GSList * tmp ;
int len ;
g_return_val_if_fail ( word != NULL , NULL ) ;
len = strlen ( word ) ;
list = NULL ;
tmp = server == NULL ? NULL : server -> channels ;
for ( ;
tmp != NULL ;
tmp = tmp -> next ) {
CHANNEL_REC * rec = tmp -> data ;
if ( g_ascii_strncasecmp ( rec -> visible_name , word , len ) == 0 ) list = g_list_append ( list , g_strdup ( rec -> visible_name ) ) ;
else if ( g_ascii_strncasecmp ( rec -> name , word , len ) == 0 ) list = g_list_append ( list , g_strdup ( rec -> name ) ) ;
}
for ( tmp = setupchannels ;
tmp != NULL ;
tmp = tmp -> next ) {
CHANNEL_SETUP_REC * rec = tmp -> data ;
if ( g_ascii_strncasecmp ( rec -> name , word , len ) == 0 && glist_find_icase_string ( list , rec -> name ) == NULL ) list = g_list_append ( list , g_strdup ( rec -> name ) ) ;
}
return list ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ff_h264_parse_sprop_parameter_sets ( AVFormatContext * s , uint8_t * * data_ptr , int * size_ptr , const char * value ) {
char base64packet [ 1024 ] ;
uint8_t decoded_packet [ 1024 ] ;
int packet_size ;
while ( * value ) {
char * dst = base64packet ;
while ( * value && * value != ',' && ( dst - base64packet ) < sizeof ( base64packet ) - 1 ) {
* dst ++ = * value ++ ;
}
* dst ++ = '\0' ;
if ( * value == ',' ) value ++ ;
packet_size = av_base64_decode ( decoded_packet , base64packet , sizeof ( decoded_packet ) ) ;
if ( packet_size > 0 ) {
uint8_t * dest = av_realloc ( * data_ptr , packet_size + sizeof ( start_sequence ) + * size_ptr + AV_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! dest ) {
av_log ( s , AV_LOG_ERROR , "Unable to allocate memory for extradata!\n" ) ;
return AVERROR ( ENOMEM ) ;
}
* data_ptr = dest ;
memcpy ( dest + * size_ptr , start_sequence , sizeof ( start_sequence ) ) ;
memcpy ( dest + * size_ptr + sizeof ( start_sequence ) , decoded_packet , packet_size ) ;
memset ( dest + * size_ptr + sizeof ( start_sequence ) + packet_size , 0 , AV_INPUT_BUFFER_PADDING_SIZE ) ;
* size_ptr += sizeof ( start_sequence ) + packet_size ;
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSVConn TSVConnCreate ( TSEventFunc event_funcp , TSMutex mutexp ) {
if ( mutexp == nullptr ) {
mutexp = ( TSMutex ) new_ProxyMutex ( ) ;
}
sdk_assert ( sdk_sanity_check_mutex ( mutexp ) == TS_SUCCESS ) ;
INKVConnInternal * i = INKVConnAllocator . alloc ( ) ;
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) i ) == TS_SUCCESS ) ;
i -> init ( event_funcp , mutexp ) ;
return reinterpret_cast < TSVConn > ( i ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void main_cpu_reset ( void * opaque ) {
SPARCCPU * cpu = opaque ;
CPUState * cs = CPU ( cpu ) ;
cpu_reset ( cs ) ;
cs -> halted = 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void short_usage ( FILE * f ) {
short_usage_sub ( f ) ;
fprintf ( f , "For more options, use %s --help\n" , my_progname_short ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ff_h263_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
MpegEncContext * s = avctx -> priv_data ;
int ret ;
AVFrame * pict = data ;
# ifdef PRINT_FRAME_TIME uint64_t time = rdtsc ( ) ;
# endif s -> flags = avctx -> flags ;
s -> flags2 = avctx -> flags2 ;
if ( buf_size == 0 ) {
if ( s -> low_delay == 0 && s -> next_picture_ptr ) {
if ( ( ret = av_frame_ref ( pict , & s -> next_picture_ptr -> f ) ) < 0 ) return ret ;
s -> next_picture_ptr = NULL ;
* got_frame = 1 ;
}
return 0 ;
}
if ( s -> flags & CODEC_FLAG_TRUNCATED ) {
int next ;
if ( CONFIG_MPEG4_DECODER && s -> codec_id == AV_CODEC_ID_MPEG4 ) {
next = ff_mpeg4_find_frame_end ( & s -> parse_context , buf , buf_size ) ;
}
else if ( CONFIG_H263_DECODER && s -> codec_id == AV_CODEC_ID_H263 ) {
next = ff_h263_find_frame_end ( & s -> parse_context , buf , buf_size ) ;
}
else {
av_log ( s -> avctx , AV_LOG_ERROR , "this codec does not support truncated bitstreams\n" ) ;
return - 1 ;
}
if ( ff_combine_frame ( & s -> parse_context , next , ( const uint8_t * * ) & buf , & buf_size ) < 0 ) return buf_size ;
}
retry : if ( s -> bitstream_buffer_size && ( s -> divx_packed || buf_size < 20 ) ) {
init_get_bits ( & s -> gb , s -> bitstream_buffer , s -> bitstream_buffer_size * 8 ) ;
}
else init_get_bits ( & s -> gb , buf , buf_size * 8 ) ;
s -> bitstream_buffer_size = 0 ;
if ( ! s -> context_initialized ) {
if ( ff_MPV_common_init ( s ) < 0 ) return - 1 ;
}
if ( s -> current_picture_ptr == NULL || s -> current_picture_ptr -> f . data [ 0 ] ) {
int i = ff_find_unused_picture ( s , 0 ) ;
if ( i < 0 ) return i ;
s -> current_picture_ptr = & s -> picture [ i ] ;
}
if ( CONFIG_WMV2_DECODER && s -> msmpeg4_version == 5 ) {
ret = ff_wmv2_decode_picture_header ( s ) ;
}
else if ( CONFIG_MSMPEG4_DECODER && s -> msmpeg4_version ) {
ret = ff_msmpeg4_decode_picture_header ( s ) ;
}
else if ( CONFIG_MPEG4_DECODER && s -> h263_pred ) {
if ( s -> avctx -> extradata_size && s -> picture_number == 0 ) {
GetBitContext gb ;
init_get_bits ( & gb , s -> avctx -> extradata , s -> avctx -> extradata_size * 8 ) ;
ret = ff_mpeg4_decode_picture_header ( s , & gb ) ;
}
ret = ff_mpeg4_decode_picture_header ( s , & s -> gb ) ;
}
else if ( CONFIG_H263I_DECODER && s -> codec_id == AV_CODEC_ID_H263I ) {
ret = ff_intel_h263_decode_picture_header ( s ) ;
}
else if ( CONFIG_FLV_DECODER && s -> h263_flv ) {
ret = ff_flv_decode_picture_header ( s ) ;
}
else {
ret = ff_h263_decode_picture_header ( s ) ;
}
if ( ret == FRAME_SKIPPED ) return get_consumed_bytes ( s , buf_size ) ;
if ( ret < 0 ) {
av_log ( s -> avctx , AV_LOG_ERROR , "header damaged\n" ) ;
return - 1 ;
}
avctx -> has_b_frames = ! s -> low_delay ;
if ( s -> xvid_build == - 1 && s -> divx_version == - 1 && s -> lavc_build == - 1 ) {
if ( s -> stream_codec_tag == AV_RL32 ( "XVID" ) || s -> codec_tag == AV_RL32 ( "XVID" ) || s -> codec_tag == AV_RL32 ( "XVIX" ) || s -> codec_tag == AV_RL32 ( "RMP4" ) || s -> codec_tag == AV_RL32 ( "ZMP4" ) || s -> codec_tag == AV_RL32 ( "SIPP" ) ) s -> xvid_build = 0 ;
# if 0 if ( s -> codec_tag == AV_RL32 ( "DIVX" ) && s -> vo_type == 0 && s -> vol_control_parameters == 1 && s -> padding_bug_score > 0 && s -> low_delay ) s -> xvid_build = 0 ;
# endif }
if ( s -> xvid_build == - 1 && s -> divx_version == - 1 && s -> lavc_build == - 1 ) {
if ( s -> codec_tag == AV_RL32 ( "DIVX" ) && s -> vo_type == 0 && s -> vol_control_parameters == 0 ) s -> divx_version = 400 ;
}
if ( s -> xvid_build >= 0 && s -> divx_version >= 0 ) {
s -> divx_version = s -> divx_build = - 1 ;
}
if ( s -> workaround_bugs & FF_BUG_AUTODETECT ) {
if ( s -> codec_tag == AV_RL32 ( "XVIX" ) ) s -> workaround_bugs |= FF_BUG_XVID_ILACE ;
if ( s -> codec_tag == AV_RL32 ( "UMP4" ) ) {
s -> workaround_bugs |= FF_BUG_UMP4 ;
}
if ( s -> divx_version >= 500 && s -> divx_build < 1814 ) {
s -> workaround_bugs |= FF_BUG_QPEL_CHROMA ;
}
if ( s -> divx_version > 502 && s -> divx_build < 1814 ) {
s -> workaround_bugs |= FF_BUG_QPEL_CHROMA2 ;
}
if ( s -> xvid_build <= 3U ) s -> padding_bug_score = 256 * 256 * 256 * 64 ;
if ( s -> xvid_build <= 1U ) s -> workaround_bugs |= FF_BUG_QPEL_CHROMA ;
if ( s -> xvid_build <= 12U ) s -> workaround_bugs |= FF_BUG_EDGE ;
if ( s -> xvid_build <= 32U ) s -> workaround_bugs |= FF_BUG_DC_CLIP ;
# define SET_QPEL_FUNC ( postfix1 , postfix2 ) s -> dsp . put_ ## postfix1 = ff_put_ ## postfix2 ;
s -> dsp . put_no_rnd_ ## postfix1 = ff_put_no_rnd_ ## postfix2 ;
s -> dsp . avg_ ## postfix1 = ff_avg_ ## postfix2 ;
if ( s -> lavc_build < 4653U ) s -> workaround_bugs |= FF_BUG_STD_QPEL ;
if ( s -> lavc_build < 4655U ) s -> workaround_bugs |= FF_BUG_DIRECT_BLOCKSIZE ;
if ( s -> lavc_build < 4670U ) {
s -> workaround_bugs |= FF_BUG_EDGE ;
}
if ( s -> lavc_build <= 4712U ) s -> workaround_bugs |= FF_BUG_DC_CLIP ;
if ( s -> divx_version >= 0 ) s -> workaround_bugs |= FF_BUG_DIRECT_BLOCKSIZE ;
if ( s -> divx_version == 501 && s -> divx_build == 20020416 ) s -> padding_bug_score = 256 * 256 * 256 * 64 ;
if ( s -> divx_version < 500U ) {
s -> workaround_bugs |= FF_BUG_EDGE ;
}
if ( s -> divx_version >= 0 ) s -> workaround_bugs |= FF_BUG_HPEL_CHROMA ;
# if 0 if ( s -> divx_version == 500 ) s -> padding_bug_score = 256 * 256 * 256 * 64 ;
if ( s -> resync_marker == 0 && s -> data_partitioning == 0 && s -> divx_version == - 1 && s -> codec_id == AV_CODEC_ID_MPEG4 && s -> vo_type == 0 ) s -> workaround_bugs |= FF_BUG_NO_PADDING ;
if ( s -> lavc_build < 4609U ) s -> workaround_bugs |= FF_BUG_NO_PADDING ;
# endif }
if ( s -> workaround_bugs & FF_BUG_STD_QPEL ) {
SET_QPEL_FUNC ( qpel_pixels_tab [ 0 ] [ 5 ] , qpel16_mc11_old_c ) SET_QPEL_FUNC ( qpel_pixels_tab [ 0 ] [ 7 ] , qpel16_mc31_old_c ) SET_QPEL_FUNC ( qpel_pixels_tab [ 0 ] [ 9 ] , qpel16_mc12_old_c ) SET_QPEL_FUNC ( qpel_pixels_tab [ 0 ] [ 11 ] , qpel16_mc32_old_c ) SET_QPEL_FUNC ( qpel_pixels_tab [ 0 ] [ 13 ] , qpel16_mc13_old_c ) SET_QPEL_FUNC ( qpel_pixels_tab [ 0 ] [ 15 ] , qpel16_mc33_old_c ) SET_QPEL_FUNC ( qpel_pixels_tab [ 1 ] [ 5 ] , qpel8_mc11_old_c ) SET_QPEL_FUNC ( qpel_pixels_tab [ 1 ] [ 7 ] , qpel8_mc31_old_c ) SET_QPEL_FUNC ( qpel_pixels_tab [ 1 ] [ 9 ] , qpel8_mc12_old_c ) SET_QPEL_FUNC ( qpel_pixels_tab [ 1 ] [ 11 ] , qpel8_mc32_old_c ) SET_QPEL_FUNC ( qpel_pixels_tab [ 1 ] [ 13 ] , qpel8_mc13_old_c ) SET_QPEL_FUNC ( qpel_pixels_tab [ 1 ] [ 15 ] , qpel8_mc33_old_c ) }
if ( avctx -> debug & FF_DEBUG_BUGS ) av_log ( s -> avctx , AV_LOG_DEBUG , "bugs: %X lavc_build:%d xvid_build:%d divx_version:%d divx_build:%d %s\n" , s -> workaround_bugs , s -> lavc_build , s -> xvid_build , s -> divx_version , s -> divx_build , s -> divx_packed ? "p" : "" ) ;
# if HAVE_MMX if ( s -> codec_id == AV_CODEC_ID_MPEG4 && s -> xvid_build >= 0 && avctx -> idct_algo == FF_IDCT_AUTO && ( av_get_cpu_flags ( ) & AV_CPU_FLAG_MMX ) ) {
avctx -> idct_algo = FF_IDCT_XVIDMMX ;
ff_dct_common_init ( s ) ;
s -> picture_number = 0 ;
}
# endif if ( ! avctx -> coded_width || ! avctx -> coded_height ) {
ParseContext pc = s -> parse_context ;
s -> parse_context . buffer = 0 ;
ff_MPV_common_end ( s ) ;
s -> parse_context = pc ;
avcodec_set_dimensions ( avctx , s -> width , s -> height ) ;
goto retry ;
}
if ( s -> width != avctx -> coded_width || s -> height != avctx -> coded_height || s -> context_reinit ) {
s -> context_reinit = 0 ;
avcodec_set_dimensions ( avctx , s -> width , s -> height ) ;
if ( ( ret = ff_MPV_common_frame_size_change ( s ) ) ) return ret ;
}
if ( ( s -> codec_id == AV_CODEC_ID_H263 || s -> codec_id == AV_CODEC_ID_H263P || s -> codec_id == AV_CODEC_ID_H263I ) ) s -> gob_index = ff_h263_get_gob_height ( s ) ;
s -> current_picture . f . pict_type = s -> pict_type ;
s -> current_picture . f . key_frame = s -> pict_type == AV_PICTURE_TYPE_I ;
if ( s -> last_picture_ptr == NULL && ( s -> pict_type == AV_PICTURE_TYPE_B || s -> droppable ) ) return get_consumed_bytes ( s , buf_size ) ;
if ( ( avctx -> skip_frame >= AVDISCARD_NONREF && s -> pict_type == AV_PICTURE_TYPE_B ) || ( avctx -> skip_frame >= AVDISCARD_NONKEY && s -> pict_type != AV_PICTURE_TYPE_I ) || avctx -> skip_frame >= AVDISCARD_ALL ) return get_consumed_bytes ( s , buf_size ) ;
if ( s -> next_p_frame_damaged ) {
if ( s -> pict_type == AV_PICTURE_TYPE_B ) return get_consumed_bytes ( s , buf_size ) ;
else s -> next_p_frame_damaged = 0 ;
}
if ( ( ! s -> no_rounding ) || s -> pict_type == AV_PICTURE_TYPE_B ) {
s -> me . qpel_put = s -> dsp . put_qpel_pixels_tab ;
s -> me . qpel_avg = s -> dsp . avg_qpel_pixels_tab ;
}
else {
s -> me . qpel_put = s -> dsp . put_no_rnd_qpel_pixels_tab ;
s -> me . qpel_avg = s -> dsp . avg_qpel_pixels_tab ;
}
if ( ff_MPV_frame_start ( s , avctx ) < 0 ) return - 1 ;
if ( ! s -> divx_packed ) ff_thread_finish_setup ( avctx ) ;
if ( CONFIG_MPEG4_VDPAU_DECODER && ( s -> avctx -> codec -> capabilities & CODEC_CAP_HWACCEL_VDPAU ) ) {
ff_vdpau_mpeg4_decode_picture ( s , s -> gb . buffer , s -> gb . buffer_end - s -> gb . buffer ) ;
goto frame_end ;
}
if ( avctx -> hwaccel ) {
if ( avctx -> hwaccel -> start_frame ( avctx , s -> gb . buffer , s -> gb . buffer_end - s -> gb . buffer ) < 0 ) return - 1 ;
}
ff_mpeg_er_frame_start ( s ) ;
if ( CONFIG_WMV2_DECODER && s -> msmpeg4_version == 5 ) {
ret = ff_wmv2_decode_secondary_picture_header ( s ) ;
if ( ret < 0 ) return ret ;
if ( ret == 1 ) goto intrax8_decoded ;
}
s -> mb_x = 0 ;
s -> mb_y = 0 ;
ret = decode_slice ( s ) ;
while ( s -> mb_y < s -> mb_height ) {
if ( s -> msmpeg4_version ) {
if ( s -> slice_height == 0 || s -> mb_x != 0 || ( s -> mb_y % s -> slice_height ) != 0 || get_bits_left ( & s -> gb ) < 0 ) break ;
}
else {
int prev_x = s -> mb_x , prev_y = s -> mb_y ;
if ( ff_h263_resync ( s ) < 0 ) break ;
if ( prev_y * s -> mb_width + prev_x < s -> mb_y * s -> mb_width + s -> mb_x ) s -> er . error_occurred = 1 ;
}
if ( s -> msmpeg4_version < 4 && s -> h263_pred ) ff_mpeg4_clean_buffers ( s ) ;
if ( decode_slice ( s ) < 0 ) ret = AVERROR_INVALIDDATA ;
}
if ( s -> msmpeg4_version && s -> msmpeg4_version < 4 && s -> pict_type == AV_PICTURE_TYPE_I ) if ( ! CONFIG_MSMPEG4_DECODER || ff_msmpeg4_decode_ext_header ( s , buf_size ) < 0 ) {
s -> er . error_status_table [ s -> mb_num - 1 ] = ER_MB_ERROR ;
}
assert ( s -> bitstream_buffer_size == 0 ) ;
frame_end : if ( s -> codec_id == AV_CODEC_ID_MPEG4 && s -> divx_packed ) {
int current_pos = get_bits_count ( & s -> gb ) >> 3 ;
int startcode_found = 0 ;
if ( buf_size - current_pos > 5 ) {
int i ;
for ( i = current_pos ;
i < buf_size - 3 ;
i ++ ) {
if ( buf [ i ] == 0 && buf [ i + 1 ] == 0 && buf [ i + 2 ] == 1 && buf [ i + 3 ] == 0xB6 ) {
startcode_found = 1 ;
break ;
}
}
}
if ( s -> gb . buffer == s -> bitstream_buffer && buf_size > 7 && s -> xvid_build >= 0 ) {
startcode_found = 1 ;
current_pos = 0 ;
}
if ( startcode_found ) {
av_fast_malloc ( & s -> bitstream_buffer , & s -> allocated_bitstream_buffer_size , buf_size - current_pos + FF_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! s -> bitstream_buffer ) return AVERROR ( ENOMEM ) ;
memcpy ( s -> bitstream_buffer , buf + current_pos , buf_size - current_pos ) ;
s -> bitstream_buffer_size = buf_size - current_pos ;
}
}
intrax8_decoded : ff_er_frame_end ( & s -> er ) ;
if ( avctx -> hwaccel ) {
if ( avctx -> hwaccel -> end_frame ( avctx ) < 0 ) return - 1 ;
}
ff_MPV_frame_end ( s ) ;
assert ( s -> current_picture . f . pict_type == s -> current_picture_ptr -> f . pict_type ) ;
assert ( s -> current_picture . f . pict_type == s -> pict_type ) ;
if ( s -> pict_type == AV_PICTURE_TYPE_B || s -> low_delay ) {
if ( ( ret = av_frame_ref ( pict , & s -> current_picture_ptr -> f ) ) < 0 ) return ret ;
ff_print_debug_info ( s , s -> current_picture_ptr ) ;
}
else if ( s -> last_picture_ptr != NULL ) {
if ( ( ret = av_frame_ref ( pict , & s -> last_picture_ptr -> f ) ) < 0 ) return ret ;
ff_print_debug_info ( s , s -> last_picture_ptr ) ;
}
if ( s -> last_picture_ptr || s -> low_delay ) {
* got_frame = 1 ;
}
# ifdef PRINT_FRAME_TIME av_log ( avctx , AV_LOG_DEBUG , "%" PRId64 "\n" , rdtsc ( ) - time ) ;
# endif return ( ret && ( avctx -> err_recognition & AV_EF_EXPLODE ) ) ? ret : get_consumed_bytes ( s , buf_size ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static FILE * NeedsVariationSequenceTable ( SplineFont * sf , int * vslen ) {
int gid , vs_cnt = 0 , vs_max = 512 , i , j , k , cnt , mingid , maxgid ;
struct altuni * altuni , * au ;
int32 vsbuf [ 512 ] , * vses = vsbuf ;
FILE * format14 ;
uint32 * avail = NULL ;
enum vs_type {
vs_default = ( 1 << 24 ) , vs_nondefault = ( 2 << 24 ) }
;
SplineChar * sc ;
uint32 here ;
int any ;
mingid = maxgid = - 1 ;
for ( gid = 0 ;
gid < sf -> glyphcnt ;
++ gid ) if ( ( sc = sf -> glyphs [ gid ] ) != NULL ) {
for ( altuni = sc -> altuni ;
altuni != NULL ;
altuni = altuni -> next ) {
if ( altuni -> unienc != - 1 && ( uint32 ) altuni -> unienc < unicode4_size && altuni -> vs != - 1 && altuni -> fid == 0 ) {
for ( i = 0 ;
i < vs_cnt ;
++ i ) if ( vses [ i ] == altuni -> vs ) break ;
if ( i >= vs_cnt ) {
if ( i >= vs_max ) {
if ( vses == vsbuf ) {
vses = malloc ( ( vs_max *= 2 ) * sizeof ( uint32 ) ) ;
memcpy ( vses , vsbuf , sizeof ( vsbuf ) ) ;
}
else vses = realloc ( vses , ( vs_max += 512 ) * sizeof ( uint32 ) ) ;
}
vses [ vs_cnt ++ ] = altuni -> vs ;
}
if ( mingid == - 1 ) mingid = maxgid = gid ;
else maxgid = gid ;
}
}
}
if ( vs_cnt == 0 ) {
* vslen = 0 ;
return ( NULL ) ;
}
for ( i = 0 ;
i < vs_cnt ;
++ i ) for ( j = i + 1 ;
j < vs_cnt ;
++ j ) {
if ( vses [ i ] > vses [ j ] ) {
int temp = vses [ i ] ;
vses [ i ] = vses [ j ] ;
vses [ j ] = temp ;
}
}
avail = malloc ( unicode4_size * sizeof ( uint32 ) ) ;
format14 = tmpfile ( ) ;
putshort ( format14 , 14 ) ;
putlong ( format14 , 0 ) ;
putlong ( format14 , vs_cnt ) ;
for ( i = 0 ;
i < vs_cnt ;
++ i ) {
putu24 ( format14 , vses [ i ] ) ;
putlong ( format14 , 0 ) ;
putlong ( format14 , 0 ) ;
}
for ( i = 0 ;
i < vs_cnt ;
++ i ) {
memset ( avail , 0 , unicode4_size * sizeof ( uint32 ) ) ;
any = 0 ;
for ( gid = mingid ;
gid <= maxgid ;
++ gid ) if ( ( sc = sf -> glyphs [ gid ] ) != NULL ) {
for ( altuni = sc -> altuni ;
altuni != NULL ;
altuni = altuni -> next ) {
if ( altuni -> unienc != - 1 && altuni -> unienc < ( int ) unicode4_size && altuni -> vs == vses [ i ] && altuni -> fid == 0 ) {
for ( au = sc -> altuni ;
au != NULL ;
au = au -> next ) if ( au -> unienc == altuni -> unienc && au -> vs == - 1 && au -> fid == 0 ) break ;
if ( altuni -> unienc == sc -> unicodeenc || au != NULL ) {
avail [ altuni -> unienc ] = gid | vs_default ;
any |= vs_default ;
}
else {
avail [ altuni -> unienc ] = gid | vs_nondefault ;
any |= vs_nondefault ;
}
}
}
}
if ( any & vs_default ) {
here = ftell ( format14 ) ;
fseek ( format14 , 10 + i * 11 + 3 , SEEK_SET ) ;
putlong ( format14 , here ) ;
fseek ( format14 , 0 , SEEK_END ) ;
cnt = 0 ;
for ( j = 0 ;
( unsigned ) j < unicode4_size ;
++ j ) if ( avail [ j ] & vs_default ) {
for ( k = j + 1 ;
( unsigned ) k < unicode4_size && ( avail [ k ] & vs_default ) ;
++ k ) ;
if ( k - j > 256 ) k = j + 256 ;
++ cnt ;
j = k - 1 ;
}
putlong ( format14 , cnt ) ;
for ( j = 0 ;
( unsigned ) j < unicode4_size ;
++ j ) if ( avail [ j ] & vs_default ) {
for ( k = j + 1 ;
( unsigned ) k < unicode4_size && ( avail [ k ] & vs_default ) ;
++ k ) ;
if ( k - j > 256 ) k = j + 256 ;
putu24 ( format14 , j ) ;
putc ( k - j - 1 , format14 ) ;
j = k - 1 ;
}
}
if ( any & vs_nondefault ) {
here = ftell ( format14 ) ;
fseek ( format14 , 10 + i * 11 + 7 , SEEK_SET ) ;
putlong ( format14 , here ) ;
fseek ( format14 , 0 , SEEK_END ) ;
cnt = 0 ;
for ( j = 0 ;
( unsigned ) j < unicode4_size ;
++ j ) if ( avail [ j ] & vs_nondefault ) ++ cnt ;
putlong ( format14 , cnt ) ;
for ( j = 0 ;
( unsigned ) j < unicode4_size ;
++ j ) if ( avail [ j ] & vs_nondefault ) {
putu24 ( format14 , j ) ;
putshort ( format14 , sf -> glyphs [ avail [ j ] & 0xffff ] -> ttf_glyph ) ;
}
}
}
here = ftell ( format14 ) ;
fseek ( format14 , 2 , SEEK_SET ) ;
putlong ( format14 , here ) ;
fseek ( format14 , 0 , SEEK_END ) ;
if ( here & 1 ) {
putc ( '\0' , format14 ) ;
++ here ;
}
if ( here & 2 ) {
putshort ( format14 , 0 ) ;
here += 2 ;
}
* vslen = here ;
free ( avail ) ;
if ( vses != vsbuf ) free ( vses ) ;
return ( format14 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void skip_readdir_error ( CommonJob * common , GFile * dir ) {
if ( common -> skip_readdir_error == NULL ) {
common -> skip_readdir_error = g_hash_table_new_full ( g_file_hash , ( GEqualFunc ) g_file_equal , g_object_unref , NULL ) ;
}
g_hash_table_insert ( common -> skip_readdir_error , g_object_ref ( dir ) , dir ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void xps_identify_font_encoding ( fz_font * font , int idx , int * pid , int * eid ) {
FT_Face face = font -> ft_face ;
* pid = face -> charmaps [ idx ] -> platform_id ;
* eid = face -> charmaps [ idx ] -> encoding_id ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
proto_item * proto_tree_add_oid ( proto_tree * tree , int hfindex , tvbuff_t * tvb , gint start , gint length , const guint8 * value_ptr ) {
proto_item * pi ;
header_field_info * hfinfo ;
CHECK_FOR_NULL_TREE ( tree ) ;
TRY_TO_FAKE_THIS_ITEM ( tree , hfindex , hfinfo ) ;
DISSECTOR_ASSERT_FIELD_TYPE ( hfinfo , FT_OID ) ;
pi = proto_tree_add_pi ( tree , hfinfo , tvb , start , & length ) ;
proto_tree_set_oid ( PNODE_FINFO ( pi ) , value_ptr , length ) ;
return pi ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static cmsBool Type_ProfileSequenceId_Write ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , void * Ptr , cmsUInt32Number nItems ) {
cmsSEQ * Seq = ( cmsSEQ * ) Ptr ;
cmsUInt32Number BaseOffset ;
BaseOffset = io -> Tell ( io ) - sizeof ( _cmsTagBase ) ;
if ( ! _cmsWriteUInt32Number ( io , Seq -> n ) ) return FALSE ;
if ( ! WritePositionTable ( self , io , 0 , Seq -> n , BaseOffset , Seq , WriteSeqID ) ) return FALSE ;
return TRUE ;
cmsUNUSED_PARAMETER ( nItems ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int aes_init_key ( EVP_CIPHER_CTX * ctx , const unsigned char * key , const unsigned char * iv , int enc ) {
int ret , mode ;
EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ;
mode = EVP_CIPHER_CTX_mode ( ctx ) ;
if ( ( mode == EVP_CIPH_ECB_MODE || mode == EVP_CIPH_CBC_MODE ) && ! enc ) {
# ifdef HWAES_CAPABLE if ( HWAES_CAPABLE ) {
ret = HWAES_set_decrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) HWAES_decrypt ;
dat -> stream . cbc = NULL ;
# ifdef HWAES_cbc_encrypt if ( mode == EVP_CIPH_CBC_MODE ) dat -> stream . cbc = ( cbc128_f ) HWAES_cbc_encrypt ;
# endif }
else # endif # ifdef BSAES_CAPABLE if ( BSAES_CAPABLE && mode == EVP_CIPH_CBC_MODE ) {
ret = AES_set_decrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) AES_decrypt ;
dat -> stream . cbc = ( cbc128_f ) bsaes_cbc_encrypt ;
}
else # endif # ifdef VPAES_CAPABLE if ( VPAES_CAPABLE ) {
ret = vpaes_set_decrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) vpaes_decrypt ;
dat -> stream . cbc = mode == EVP_CIPH_CBC_MODE ? ( cbc128_f ) vpaes_cbc_encrypt : NULL ;
}
else # endif {
ret = AES_set_decrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) AES_decrypt ;
dat -> stream . cbc = mode == EVP_CIPH_CBC_MODE ? ( cbc128_f ) AES_cbc_encrypt : NULL ;
}
}
else # ifdef HWAES_CAPABLE if ( HWAES_CAPABLE ) {
ret = HWAES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) HWAES_encrypt ;
dat -> stream . cbc = NULL ;
# ifdef HWAES_cbc_encrypt if ( mode == EVP_CIPH_CBC_MODE ) dat -> stream . cbc = ( cbc128_f ) HWAES_cbc_encrypt ;
else # endif # ifdef HWAES_ctr32_encrypt_blocks if ( mode == EVP_CIPH_CTR_MODE ) dat -> stream . ctr = ( ctr128_f ) HWAES_ctr32_encrypt_blocks ;
else # endif ( void ) 0 ;
}
else # endif # ifdef BSAES_CAPABLE if ( BSAES_CAPABLE && mode == EVP_CIPH_CTR_MODE ) {
ret = AES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) AES_encrypt ;
dat -> stream . ctr = ( ctr128_f ) bsaes_ctr32_encrypt_blocks ;
}
else # endif # ifdef VPAES_CAPABLE if ( VPAES_CAPABLE ) {
ret = vpaes_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) vpaes_encrypt ;
dat -> stream . cbc = mode == EVP_CIPH_CBC_MODE ? ( cbc128_f ) vpaes_cbc_encrypt : NULL ;
}
else # endif {
ret = AES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) AES_encrypt ;
dat -> stream . cbc = mode == EVP_CIPH_CBC_MODE ? ( cbc128_f ) AES_cbc_encrypt : NULL ;
# ifdef AES_CTR_ASM if ( mode == EVP_CIPH_CTR_MODE ) dat -> stream . ctr = ( ctr128_f ) AES_ctr32_encrypt ;
# endif }
if ( ret < 0 ) {
EVPerr ( EVP_F_AES_INIT_KEY , EVP_R_AES_KEY_SETUP_FAILED ) ;
return 0 ;
}
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int file_exists ( const u_char * filename , unsigned int throttle_rate ) {
return get_file_type ( filename , throttle_rate ) == FT_FILE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SPL_METHOD ( DirectoryIterator , getBasename ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
char * suffix = 0 , * fname ;
int slen = 0 ;
size_t flen ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "|s" , & suffix , & slen ) == FAILURE ) {
return ;
}
php_basename ( intern -> u . dir . entry . d_name , strlen ( intern -> u . dir . entry . d_name ) , suffix , slen , & fname , & flen TSRMLS_CC ) ;
RETURN_STRINGL ( fname , flen , 0 ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void hb_set_union ( hb_set_t * set , const hb_set_t * other ) {
set -> union_ ( other ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static size_t read_uncompressed_header ( VP9Decoder * pbi , struct vp9_read_bit_buffer * rb ) {
VP9_COMMON * const cm = & pbi -> common ;
size_t sz ;
int i ;
cm -> last_frame_type = cm -> frame_type ;
if ( vp9_rb_read_literal ( rb , 2 ) != VP9_FRAME_MARKER ) vpx_internal_error ( & cm -> error , VPX_CODEC_UNSUP_BITSTREAM , "Invalid frame marker" ) ;
cm -> profile = vp9_read_profile ( rb ) ;
if ( cm -> profile >= MAX_PROFILES ) vpx_internal_error ( & cm -> error , VPX_CODEC_UNSUP_BITSTREAM , "Unsupported bitstream profile" ) ;
cm -> show_existing_frame = vp9_rb_read_bit ( rb ) ;
if ( cm -> show_existing_frame ) {
const int frame_to_show = cm -> ref_frame_map [ vp9_rb_read_literal ( rb , 3 ) ] ;
if ( frame_to_show < 0 || cm -> frame_bufs [ frame_to_show ] . ref_count < 1 ) vpx_internal_error ( & cm -> error , VPX_CODEC_UNSUP_BITSTREAM , "Buffer %d does not contain a decoded frame" , frame_to_show ) ;
ref_cnt_fb ( cm -> frame_bufs , & cm -> new_fb_idx , frame_to_show ) ;
pbi -> refresh_frame_flags = 0 ;
cm -> lf . filter_level = 0 ;
cm -> show_frame = 1 ;
return 0 ;
}
cm -> frame_type = ( FRAME_TYPE ) vp9_rb_read_bit ( rb ) ;
cm -> show_frame = vp9_rb_read_bit ( rb ) ;
cm -> error_resilient_mode = vp9_rb_read_bit ( rb ) ;
if ( cm -> frame_type == KEY_FRAME ) {
if ( ! vp9_read_sync_code ( rb ) ) vpx_internal_error ( & cm -> error , VPX_CODEC_UNSUP_BITSTREAM , "Invalid frame sync code" ) ;
read_bitdepth_colorspace_sampling ( cm , rb ) ;
pbi -> refresh_frame_flags = ( 1 << REF_FRAMES ) - 1 ;
for ( i = 0 ;
i < REFS_PER_FRAME ;
++ i ) {
cm -> frame_refs [ i ] . idx = - 1 ;
cm -> frame_refs [ i ] . buf = NULL ;
}
setup_frame_size ( cm , rb ) ;
}
else {
cm -> intra_only = cm -> show_frame ? 0 : vp9_rb_read_bit ( rb ) ;
cm -> reset_frame_context = cm -> error_resilient_mode ? : vp9_rb_read_literal ( rb , 2 ) ;
if ( cm -> intra_only ) {
if ( ! vp9_read_sync_code ( rb ) ) vpx_internal_error ( & cm -> error , VPX_CODEC_UNSUP_BITSTREAM , "Invalid frame sync code" ) ;
if ( cm -> profile > PROFILE_0 ) {
read_bitdepth_colorspace_sampling ( cm , rb ) ;
}
else {
cm -> color_space = BT_601 ;
cm -> subsampling_y = cm -> subsampling_x = 1 ;
}
pbi -> refresh_frame_flags = vp9_rb_read_literal ( rb , REF_FRAMES ) ;
setup_frame_size ( cm , rb ) ;
}
else {
pbi -> refresh_frame_flags = vp9_rb_read_literal ( rb , REF_FRAMES ) ;
for ( i = 0 ;
i < REFS_PER_FRAME ;
++ i ) {
const int ref = vp9_rb_read_literal ( rb , REF_FRAMES_LOG2 ) ;
const int idx = cm -> ref_frame_map [ ref ] ;
RefBuffer * const ref_frame = & cm -> frame_refs [ i ] ;
ref_frame -> idx = idx ;
ref_frame -> buf = & cm -> frame_bufs [ idx ] . buf ;
cm -> ref_frame_sign_bias [ LAST_FRAME + i ] = vp9_rb_read_bit ( rb ) ;
}
setup_frame_size_with_refs ( cm , rb ) ;
cm -> allow_high_precision_mv = vp9_rb_read_bit ( rb ) ;
cm -> interp_filter = read_interp_filter ( rb ) ;
for ( i = 0 ;
i < REFS_PER_FRAME ;
++ i ) {
RefBuffer * const ref_buf = & cm -> frame_refs [ i ] ;
vp9_setup_scale_factors_for_frame ( & ref_buf -> sf , ref_buf -> buf -> y_crop_width , ref_buf -> buf -> y_crop_height , cm -> width , cm -> height ) ;
if ( vp9_is_scaled ( & ref_buf -> sf ) ) vp9_extend_frame_borders ( ref_buf -> buf ) ;
}
}
}
if ( ! cm -> error_resilient_mode ) {
cm -> refresh_frame_context = vp9_rb_read_bit ( rb ) ;
cm -> frame_parallel_decoding_mode = vp9_rb_read_bit ( rb ) ;
}
else {
cm -> refresh_frame_context = 0 ;
cm -> frame_parallel_decoding_mode = 1 ;
}
cm -> frame_context_idx = vp9_rb_read_literal ( rb , FRAME_CONTEXTS_LOG2 ) ;
if ( frame_is_intra_only ( cm ) || cm -> error_resilient_mode ) vp9_setup_past_independence ( cm ) ;
setup_loopfilter ( & cm -> lf , rb ) ;
setup_quantization ( cm , & pbi -> mb , rb ) ;
setup_segmentation ( & cm -> seg , rb ) ;
setup_tile_info ( cm , rb ) ;
sz = vp9_rb_read_literal ( rb , 16 ) ;
if ( sz == 0 ) vpx_internal_error ( & cm -> error , VPX_CODEC_CORRUPT_FRAME , "Invalid header size" ) ;
return sz ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
const char * TSUrlHttpFragmentGet ( TSMBuffer bufp , TSMLoc obj , int * length ) {
return URLPartGet ( bufp , obj , length , & URL : : fragment_get ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void _TIFFmemset ( tdata_t p , int v , tsize_t c ) {
memset ( p , v , ( size_t ) c ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_rbsp_trailing ( H264Context * h , const uint8_t * src ) {
int v = * src ;
int r ;
tprintf ( h -> avctx , "rbsp trailing %X\n" , v ) ;
for ( r = 1 ;
r < 9 ;
r ++ ) {
if ( v & 1 ) return r ;
v >>= 1 ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void event_process_active ( struct event_base * base ) {
struct event * ev ;
struct event_list * activeq = NULL ;
int i ;
short ncalls ;
for ( i = 0 ;
i < base -> nactivequeues ;
++ i ) {
if ( TAILQ_FIRST ( base -> activequeues [ i ] ) != NULL ) {
activeq = base -> activequeues [ i ] ;
break ;
}
}
assert ( activeq != NULL ) ;
for ( ev = TAILQ_FIRST ( activeq ) ;
ev ;
ev = TAILQ_FIRST ( activeq ) ) {
if ( ev -> ev_events & EV_PERSIST ) event_queue_remove ( base , ev , EVLIST_ACTIVE ) ;
else event_del ( ev ) ;
ncalls = ev -> ev_ncalls ;
ev -> ev_pncalls = & ncalls ;
while ( ncalls ) {
ncalls -- ;
ev -> ev_ncalls = ncalls ;
( * ev -> ev_callback ) ( ( int ) ev -> ev_fd , ev -> ev_res , ev -> ev_arg ) ;
if ( base -> event_break ) return ;
}
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int sse_diff_thresh ( BLOCK_SIZE bs , int increase_denoising , int mv_row , int mv_col ) {
if ( mv_row * mv_row + mv_col * mv_col > noise_motion_thresh ( bs , increase_denoising ) ) {
return 0 ;
}
else {
return widths [ bs ] * heights [ bs ] * 20 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static VALUE mString_to_json_raw ( int argc , VALUE * argv , VALUE self ) {
VALUE obj = mString_to_json_raw_object ( self ) ;
Check_Type ( obj , T_HASH ) ;
return mHash_to_json ( argc , argv , obj ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void ohci_bus_stop ( OHCIState * ohci ) {
trace_usb_ohci_stop ( ohci -> name ) ;
timer_del ( ohci -> eof_timer ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int h261_decode_mb_skipped ( H261Context * h , int mba1 , int mba2 ) {
MpegEncContext * const s = & h -> s ;
int i ;
s -> mb_intra = 0 ;
for ( i = mba1 ;
i < mba2 ;
i ++ ) {
int j , xy ;
s -> mb_x = ( ( h -> gob_number - 1 ) % 2 ) * 11 + i % 11 ;
s -> mb_y = ( ( h -> gob_number - 1 ) / 2 ) * 3 + i / 11 ;
xy = s -> mb_x + s -> mb_y * s -> mb_stride ;
ff_init_block_index ( s ) ;
ff_update_block_index ( s ) ;
for ( j = 0 ;
j < 6 ;
j ++ ) s -> block_last_index [ j ] = - 1 ;
s -> mv_dir = MV_DIR_FORWARD ;
s -> mv_type = MV_TYPE_16X16 ;
s -> current_picture . f . mb_type [ xy ] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0 ;
s -> mv [ 0 ] [ 0 ] [ 0 ] = 0 ;
s -> mv [ 0 ] [ 0 ] [ 1 ] = 0 ;
s -> mb_skipped = 1 ;
h -> mtype &= ~ MB_TYPE_H261_FIL ;
ff_MPV_decode_mb ( s , s -> block ) ;
}
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dump_triggers_for_table ( char * table_name , char * db_name ) {
char name_buff [ NAME_LEN * 4 + 3 ] ;
char query_buff [ QUERY_LENGTH ] ;
uint old_opt_compatible_mode = opt_compatible_mode ;
MYSQL_RES * show_triggers_rs ;
MYSQL_ROW row ;
FILE * sql_file = md_result_file ;
char db_cl_name [ MY_CS_NAME_SIZE ] ;
int ret = TRUE ;
DBUG_ENTER ( "dump_triggers_for_table" ) ;
DBUG_PRINT ( "enter" , ( "db: %s, table_name: %s" , db_name , table_name ) ) ;
if ( path && ! ( sql_file = open_sql_file_for_table ( table_name , O_WRONLY | O_APPEND ) ) ) DBUG_RETURN ( 1 ) ;
opt_compatible_mode &= ~ MASK_ANSI_QUOTES ;
if ( switch_character_set_results ( mysql , "binary" ) ) goto done ;
if ( fetch_db_collation ( db_name , db_cl_name , sizeof ( db_cl_name ) ) ) goto done ;
my_snprintf ( query_buff , sizeof ( query_buff ) , "SHOW TRIGGERS LIKE %s" , quote_for_like ( table_name , name_buff ) ) ;
if ( mysql_query_with_error_report ( mysql , & show_triggers_rs , query_buff ) ) goto done ;
if ( ! mysql_num_rows ( show_triggers_rs ) ) goto skip ;
if ( opt_xml ) print_xml_tag ( sql_file , "\t" , "\n" , "triggers" , "name=" , table_name , NullS ) ;
while ( ( row = mysql_fetch_row ( show_triggers_rs ) ) ) {
my_snprintf ( query_buff , sizeof ( query_buff ) , "SHOW CREATE TRIGGER %s" , quote_name ( row [ 0 ] , name_buff , TRUE ) ) ;
if ( mysql_query ( mysql , query_buff ) ) {
dump_trigger_old ( sql_file , show_triggers_rs , & row , table_name ) ;
}
else {
MYSQL_RES * show_create_trigger_rs = mysql_store_result ( mysql ) ;
if ( ! show_create_trigger_rs || dump_trigger ( sql_file , show_create_trigger_rs , db_name , db_cl_name ) ) goto done ;
mysql_free_result ( show_create_trigger_rs ) ;
}
}
if ( opt_xml ) {
fputs ( "\t</triggers>\n" , sql_file ) ;
check_io ( sql_file ) ;
}
skip : mysql_free_result ( show_triggers_rs ) ;
if ( switch_character_set_results ( mysql , default_charset ) ) goto done ;
opt_compatible_mode = old_opt_compatible_mode ;
ret = FALSE ;
done : if ( path ) my_fclose ( sql_file , MYF ( 0 ) ) ;
DBUG_RETURN ( ret ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void advertise_sasl ( struct Client * client_p ) {
if ( ! ConfigFileEntry . sasl_service ) return ;
if ( irccmp ( client_p -> name , ConfigFileEntry . sasl_service ) ) return ;
sendto_local_clients_with_capability ( CLICAP_CAP_NOTIFY , ":%s CAP * NEW :sasl" , me . name ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int mbfl_encoding_detector_feed ( mbfl_encoding_detector * identd , mbfl_string * string ) {
int i , n , num , bad , res ;
unsigned char * p ;
mbfl_identify_filter * filter ;
res = 0 ;
if ( identd != NULL && string != NULL && string -> val != NULL ) {
num = identd -> filter_list_size ;
n = string -> len ;
p = string -> val ;
bad = 0 ;
while ( n > 0 ) {
for ( i = 0 ;
i < num ;
i ++ ) {
filter = identd -> filter_list [ i ] ;
if ( ! filter -> flag ) {
( * filter -> filter_function ) ( * p , filter ) ;
if ( filter -> flag ) {
bad ++ ;
}
}
}
if ( ( num - 1 ) <= bad ) {
res = 1 ;
break ;
}
p ++ ;
n -- ;
}
}
return res ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void free_sets ( REP_SETS * sets ) {
my_free ( sets -> set_buffer ) ;
my_free ( sets -> bit_buffer ) ;
return ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void vga_draw_line16_be ( VGACommonState * s1 , uint8_t * d , const uint8_t * s , int width ) {
int w ;
uint32_t v , r , g , b ;
w = width ;
do {
v = lduw_be_p ( ( void * ) s ) ;
r = ( v >> 8 ) & 0xf8 ;
g = ( v >> 3 ) & 0xfc ;
b = ( v << 3 ) & 0xf8 ;
( ( uint32_t * ) d ) [ 0 ] = rgb_to_pixel32 ( r , g , b ) ;
s += 2 ;
d += 4 ;
}
while ( -- w != 0 ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void init_username ( ) {
my_free ( full_username ) ;
my_free ( part_username ) ;
MYSQL_RES * result ;
LINT_INIT ( result ) ;
if ( ! mysql_query ( & mysql , "select USER()" ) && ( result = mysql_use_result ( & mysql ) ) ) {
MYSQL_ROW cur = mysql_fetch_row ( result ) ;
full_username = my_strdup ( cur [ 0 ] , MYF ( MY_WME ) ) ;
part_username = my_strdup ( strtok ( cur [ 0 ] , "@" ) , MYF ( MY_WME ) ) ;
( void ) mysql_fetch_row ( result ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void openpic_set_irq ( void * opaque , int n_IRQ , int level ) {
OpenPICState * opp = opaque ;
IRQSource * src ;
if ( n_IRQ >= OPENPIC_MAX_IRQ ) {
fprintf ( stderr , "%s: IRQ %d out of range\n" , __func__ , n_IRQ ) ;
abort ( ) ;
}
src = & opp -> src [ n_IRQ ] ;
DPRINTF ( "openpic: set irq %d = %d ivpr=0x%08x\n" , n_IRQ , level , src -> ivpr ) ;
if ( src -> level ) {
src -> pending = level ;
openpic_update_irq ( opp , n_IRQ ) ;
}
else {
if ( level ) {
src -> pending = 1 ;
openpic_update_irq ( opp , n_IRQ ) ;
}
if ( src -> output != OPENPIC_OUTPUT_INT ) {
src -> pending = 0 ;
openpic_update_irq ( opp , n_IRQ ) ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_predict_intra_block ( const MACROBLOCKD * xd , int block_idx , int bwl_in , TX_SIZE tx_size , PREDICTION_MODE mode , const uint8_t * ref , int ref_stride , uint8_t * dst , int dst_stride , int aoff , int loff , int plane ) {
const int bwl = bwl_in - tx_size ;
const int wmask = ( 1 << bwl ) - 1 ;
const int have_top = ( block_idx >> bwl ) || xd -> up_available ;
const int have_left = ( block_idx & wmask ) || xd -> left_available ;
const int have_right = ( ( block_idx & wmask ) != wmask ) ;
const int x = aoff * 4 ;
const int y = loff * 4 ;
assert ( bwl >= 0 ) ;
# if CONFIG_VP9_HIGHBITDEPTH if ( xd -> cur_buf -> flags & YV12_FLAG_HIGHBITDEPTH ) {
build_intra_predictors_high ( xd , ref , ref_stride , dst , dst_stride , mode , tx_size , have_top , have_left , have_right , x , y , plane , xd -> bd ) ;
return ;
}
# endif build_intra_predictors ( xd , ref , ref_stride , dst , dst_stride , mode , tx_size , have_top , have_left , have_right , x , y , plane ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void spl_filesystem_file_rewind ( zval * this_ptr , spl_filesystem_object * intern TSRMLS_DC ) {
if ( - 1 == php_stream_rewind ( intern -> u . file . stream ) ) {
zend_throw_exception_ex ( spl_ce_RuntimeException , 0 TSRMLS_CC , "Cannot rewind file %s" , intern -> file_name ) ;
}
else {
spl_filesystem_file_free_line ( intern TSRMLS_CC ) ;
intern -> u . file . current_line_num = 0 ;
}
if ( SPL_HAS_FLAG ( intern -> flags , SPL_FILE_OBJECT_READ_AHEAD ) ) {
spl_filesystem_file_read_line ( this_ptr , intern , 1 TSRMLS_CC ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int xmlCharInRange ( unsigned int val , const xmlChRangeGroup * rptr ) {
int low , high , mid ;
const xmlChSRange * sptr ;
const xmlChLRange * lptr ;
if ( rptr == NULL ) return ( 0 ) ;
if ( val < 0x10000 ) {
if ( rptr -> nbShortRange == 0 ) return 0 ;
low = 0 ;
high = rptr -> nbShortRange - 1 ;
sptr = rptr -> shortRange ;
while ( low <= high ) {
mid = ( low + high ) / 2 ;
if ( ( unsigned short ) val < sptr [ mid ] . low ) {
high = mid - 1 ;
}
else {
if ( ( unsigned short ) val > sptr [ mid ] . high ) {
low = mid + 1 ;
}
else {
return 1 ;
}
}
}
}
else {
if ( rptr -> nbLongRange == 0 ) {
return 0 ;
}
low = 0 ;
high = rptr -> nbLongRange - 1 ;
lptr = rptr -> longRange ;
while ( low <= high ) {
mid = ( low + high ) / 2 ;
if ( val < lptr [ mid ] . low ) {
high = mid - 1 ;
}
else {
if ( val > lptr [ mid ] . high ) {
low = mid + 1 ;
}
else {
return 1 ;
}
}
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool contain_nonstrict_functions_checker ( Oid func_id , void * context ) {
return ! func_strict ( func_id ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char ) typedef void * OPENSSL_BLOCK ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_BLOCK , void )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int vorbis_floor0_decode ( vorbis_context * vc , vorbis_floor_data * vfu , float * vec ) {
vorbis_floor0 * vf = & vfu -> t0 ;
float * lsp = vf -> lsp ;
unsigned amplitude , book_idx ;
unsigned blockflag = vc -> modes [ vc -> mode_number ] . blockflag ;
if ( ! vf -> amplitude_bits ) return 1 ;
amplitude = get_bits ( & vc -> gb , vf -> amplitude_bits ) ;
if ( amplitude > 0 ) {
float last = 0 ;
unsigned idx , lsp_len = 0 ;
vorbis_codebook codebook ;
book_idx = get_bits ( & vc -> gb , ilog ( vf -> num_books ) ) ;
if ( book_idx >= vf -> num_books ) {
av_log ( vc -> avctx , AV_LOG_ERROR , "floor0 dec: booknumber too high!\n" ) ;
book_idx = 0 ;
}
av_dlog ( NULL , "floor0 dec: booknumber: %u\n" , book_idx ) ;
codebook = vc -> codebooks [ vf -> book_list [ book_idx ] ] ;
if ( ! codebook . codevectors ) return AVERROR_INVALIDDATA ;
while ( lsp_len < vf -> order ) {
int vec_off ;
av_dlog ( NULL , "floor0 dec: book dimension: %d\n" , codebook . dimensions ) ;
av_dlog ( NULL , "floor0 dec: maximum depth: %d\n" , codebook . maxdepth ) ;
vec_off = get_vlc2 ( & vc -> gb , codebook . vlc . table , codebook . nb_bits , codebook . maxdepth ) * codebook . dimensions ;
av_dlog ( NULL , "floor0 dec: vector offset: %d\n" , vec_off ) ;
for ( idx = 0 ;
idx < codebook . dimensions ;
++ idx ) lsp [ lsp_len + idx ] = codebook . codevectors [ vec_off + idx ] + last ;
last = lsp [ lsp_len + idx - 1 ] ;
lsp_len += codebook . dimensions ;
}
{
int idx ;
for ( idx = 0 ;
idx < lsp_len ;
++ idx ) av_dlog ( NULL , "floor0 dec: coeff at %d is %f\n" , idx , lsp [ idx ] ) ;
}
{
int i ;
int order = vf -> order ;
float wstep = M_PI / vf -> bark_map_size ;
for ( i = 0 ;
i < order ;
i ++ ) lsp [ i ] = 2.0f * cos ( lsp [ i ] ) ;
av_dlog ( NULL , "floor0 synth: map_size = %" PRIu32 ";
m = %d;
wstep = %f\n" , vf -> map_size [ blockflag ] , order , wstep ) ;
i = 0 ;
while ( i < vf -> map_size [ blockflag ] ) {
int j , iter_cond = vf -> map [ blockflag ] [ i ] ;
float p = 0.5f ;
float q = 0.5f ;
float two_cos_w = 2.0f * cos ( wstep * iter_cond ) ;
for ( j = 0 ;
j + 1 < order ;
j += 2 ) {
q *= lsp [ j ] - two_cos_w ;
p *= lsp [ j + 1 ] - two_cos_w ;
}
if ( j == order ) {
p *= p * ( 2.0f - two_cos_w ) ;
q *= q * ( 2.0f + two_cos_w ) ;
}
else {
q *= two_cos_w - lsp [ j ] ;
p *= p * ( 4.f - two_cos_w * two_cos_w ) ;
q *= q ;
}
q = exp ( ( ( ( amplitude * vf -> amplitude_offset ) / ( ( ( 1 << vf -> amplitude_bits ) - 1 ) * sqrt ( p + q ) ) ) - vf -> amplitude_offset ) * .11512925f ) ;
do {
vec [ i ] = q ;
++ i ;
}
while ( vf -> map [ blockflag ] [ i ] == iter_cond ) ;
}
}
}
else {
return 1 ;
}
av_dlog ( NULL , " Floor0 decoded\n" ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void selinux_secmark_refcount_dec ( void ) {
atomic_dec ( & selinux_secmark_refcount ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void decode_subblock1 ( int16_t * dst , int code , GetBitContext * gb , VLC * vlc , int q ) {
int coeff = modulo_three_table [ code ] >> 6 ;
decode_coeff ( dst , coeff , 3 , gb , vlc , q ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static hb_bool_t hb_font_get_glyph_extents_nil ( hb_font_t * font , void * font_data HB_UNUSED , hb_codepoint_t glyph , hb_glyph_extents_t * extents , void * user_data HB_UNUSED ) {
if ( font -> parent ) {
hb_bool_t ret = font -> parent -> get_glyph_extents ( glyph , extents ) ;
if ( ret ) {
font -> parent_scale_position ( & extents -> x_bearing , & extents -> y_bearing ) ;
font -> parent_scale_distance ( & extents -> width , & extents -> height ) ;
}
return ret ;
}
memset ( extents , 0 , sizeof ( * extents ) ) ;
return false ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
proto_item * parseString ( proto_tree * tree , tvbuff_t * tvb , packet_info * pinfo _U_ , gint * pOffset , int hfIndex ) {
proto_item * item = NULL ;
char * szValue ;
gint iOffset = * pOffset ;
gint32 iLen = tvb_get_letohl ( tvb , * pOffset ) ;
iOffset += 4 ;
if ( iLen == - 1 ) {
item = proto_tree_add_item ( tree , hfIndex , tvb , * pOffset , 0 , ENC_NA ) ;
proto_item_append_text ( item , "[OpcUa Null String]" ) ;
proto_item_set_end ( item , tvb , * pOffset + 4 ) ;
}
else if ( iLen == 0 ) {
item = proto_tree_add_item ( tree , hfIndex , tvb , * pOffset , 0 , ENC_NA ) ;
proto_item_append_text ( item , "[OpcUa Empty String]" ) ;
proto_item_set_end ( item , tvb , * pOffset + 4 ) ;
}
else if ( iLen > 0 ) {
item = proto_tree_add_item ( tree , hfIndex , tvb , iOffset , iLen , ENC_UTF_8 | ENC_NA ) ;
iOffset += iLen ;
}
else {
item = proto_tree_add_item ( tree , hfIndex , tvb , * pOffset , 0 , ENC_NA ) ;
szValue = wmem_strdup_printf ( wmem_packet_scope ( ) , "[Invalid String] Invalid length: %d" , iLen ) ;
proto_item_append_text ( item , "%s" , szValue ) ;
proto_item_set_end ( item , tvb , * pOffset + 4 ) ;
}
* pOffset = iOffset ;
return item ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void tree_content_replace ( struct tree_entry * root , const unsigned char * sha1 , const uint16_t mode , struct tree_content * newtree ) {
if ( ! S_ISDIR ( mode ) ) die ( "Root cannot be a non-directory" ) ;
hashclr ( root -> versions [ 0 ] . sha1 ) ;
hashcpy ( root -> versions [ 1 ] . sha1 , sha1 ) ;
if ( root -> tree ) release_tree_content_recursive ( root -> tree ) ;
root -> tree = newtree ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int SpoolssWritePrinter_q ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) {
e_ctx_hnd policy_hnd ;
char * pol_name ;
guint32 size ;
proto_item * item ;
proto_tree * subtree ;
offset = dissect_nt_policy_hnd ( tvb , offset , pinfo , tree , di , drep , hf_hnd , & policy_hnd , NULL , FALSE , FALSE ) ;
dcerpc_fetch_polhnd_data ( & policy_hnd , & pol_name , NULL , NULL , NULL , pinfo -> num ) ;
if ( pol_name ) col_append_fstr ( pinfo -> cinfo , COL_INFO , ", %s" , pol_name ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_buffer_size , & size ) ;
col_append_fstr ( pinfo -> cinfo , COL_INFO , ", %d bytes" , size ) ;
subtree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_writeprinter_buffer , & item , "Buffer" ) ;
offset = dissect_ndr_uint8s ( tvb , offset , pinfo , subtree , di , drep , hf_buffer_data , size , NULL ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , subtree , di , drep , hf_buffer_size , NULL ) ;
proto_item_set_len ( item , size + 4 ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dtap_ss_register ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) {
guint32 curr_offset ;
guint32 consumed ;
guint curr_len ;
curr_offset = offset ;
curr_len = len ;
is_uplink = IS_UPLINK_TRUE ;
ELEM_MAND_TLV ( 0x1c , GSM_A_PDU_TYPE_DTAP , DE_FACILITY , NULL , ei_gsm_a_dtap_missing_mandatory_element ) ;
ELEM_OPT_TLV ( 0x7f , GSM_A_PDU_TYPE_DTAP , DE_SS_VER_IND , NULL ) ;
EXTRANEOUS_DATA_CHECK ( curr_len , 0 , pinfo , & ei_gsm_a_dtap_extraneous_data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int SDK_RPRINT ( RegressionTest * t , const char * api_name , const char * testcase_name , int status , const char * err_details_format , ... ) {
int l ;
char buffer [ 8192 ] ;
char format2 [ 8192 ] ;
snprintf ( format2 , sizeof ( format2 ) , "[%s] %s : [%s] <<%s>> {
%s }
\n" , t -> name , api_name , testcase_name , status == TC_PASS ? "PASS" : "FAIL" , err_details_format ) ;
va_list ap ;
va_start ( ap , err_details_format ) ;
l = ink_bvsprintf ( buffer , format2 , ap ) ;
va_end ( ap ) ;
fputs ( buffer , stderr ) ;
return ( l ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( TemplateURLParserTest , PassOnHTTPS ) {
ASSERT_NO_FATAL_FAILURE ( ParseFile ( "https.xml" , nullptr ) ) ;
EXPECT_TRUE ( template_url_ ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int jbig2_decode_get_run ( Jbig2MmrCtx * mmr , const mmr_table_node * table , int initial_bits ) {
int result = 0 ;
int val ;
do {
val = jbig2_decode_get_code ( mmr , table , initial_bits ) ;
result += val ;
}
while ( val >= 64 ) ;
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void gtkui_connections_attach ( void ) {
gtkui_kill_connections ( ) ;
gtkui_show_connections ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
u_int fn_printztn ( netdissect_options * ndo , register const u_char * s , register u_int n , register const u_char * ep ) {
register u_int bytes ;
register u_char c ;
bytes = 0 ;
for ( ;
;
) {
if ( n == 0 || ( ep != NULL && s >= ep ) ) {
bytes = 0 ;
break ;
}
c = * s ++ ;
bytes ++ ;
n -- ;
if ( c == '\0' ) {
break ;
}
if ( ! ND_ISASCII ( c ) ) {
c = ND_TOASCII ( c ) ;
ND_PRINT ( ( ndo , "M-" ) ) ;
}
if ( ! ND_ISPRINT ( c ) ) {
c ^= 0x40 ;
ND_PRINT ( ( ndo , "^" ) ) ;
}
ND_PRINT ( ( ndo , "%c" , c ) ) ;
}
return ( bytes ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void directory_load_cancel ( NautilusDirectory * directory ) {
NautilusFile * file ;
DirectoryLoadState * state ;
state = directory -> details -> directory_load_in_progress ;
if ( state != NULL ) {
file = state -> load_directory_file ;
file -> details -> loading_directory = FALSE ;
if ( file -> details -> directory != directory ) {
nautilus_directory_async_state_changed ( file -> details -> directory ) ;
}
g_cancellable_cancel ( state -> cancellable ) ;
state -> directory = NULL ;
directory -> details -> directory_load_in_progress = NULL ;
async_job_end ( directory , "file list" ) ;
}
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.