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 int dtls1_retrieve_buffered_fragment ( SSL * s , int * ok ) { pitem * item ; hm_fragment * frag ; int al ; * ok = 0 ; do { item = pqueue_peek ( s -> d1 -> buffered_messages ) ; if ( item == NULL ) return 0 ; frag = ( hm_fragment * ) item -> data ; if ( frag -> msg_header . seq < s -> d1 -> handshake_read_seq ) { pqueue_pop ( s -> d1 -> buffered_messages ) ; dtls1_hm_fragment_free ( frag ) ; pitem_free ( item ) ; item = NULL ; frag = NULL ; } } while ( item == NULL ) ; if ( frag -> reassembly != NULL ) return 0 ; if ( s -> d1 -> handshake_read_seq == frag -> msg_header . seq ) { unsigned long frag_len = frag -> msg_header . frag_len ; pqueue_pop ( s -> d1 -> buffered_messages ) ; al = dtls1_preprocess_fragment ( s , & frag -> msg_header ) ; if ( al == 0 ) { unsigned char * p = ( unsigned char * ) s -> init_buf -> data + DTLS1_HM_HEADER_LENGTH ; memcpy ( & p [ frag -> msg_header . frag_off ] , frag -> fragment , frag -> msg_header . frag_len ) ; } dtls1_hm_fragment_free ( frag ) ; pitem_free ( item ) ; if ( al == 0 ) { * ok = 1 ; return frag_len ; } ssl3_send_alert ( s , SSL3_AL_FATAL , al ) ; s -> init_num = 0 ; * ok = 0 ; return - 1 ; } else return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void proto_register_fields_section ( const int parent , header_field_info * hfi , const int num_records ) { int i ; protocol_t * proto ; proto = find_protocol_by_id ( parent ) ; for ( i = 0 ; i < num_records ; i ++ ) { if ( hfi [ i ] . id != - 1 ) { fprintf ( stderr , "Duplicate field detected in call to proto_register_fields: %s is already registered\n" , hfi [ i ] . abbrev ) ; return ; } proto_register_field_common ( proto , & hfi [ i ] , parent ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int file_eofer ( Gif_Reader * grr ) { int c = getc ( grr -> f ) ; if ( c == EOF ) return 1 ; else { ungetc ( c , grr -> f ) ; return 0 ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorTextDeleteSnapshot ( qemuMonitorPtr mon , const char * name ) { char * cmd = NULL ; char * reply = NULL ; int ret = - 1 ; char * safename ; if ( ! ( safename = qemuMonitorEscapeArg ( name ) ) || virAsprintf ( & cmd , "delvm \"%s\"" , safename ) < 0 ) { virReportOOMError ( ) ; goto cleanup ; } if ( qemuMonitorHMPCommand ( mon , cmd , & reply ) ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , _ ( "failed to delete snapshot using command '%s'" ) , cmd ) ; goto cleanup ; } if ( strstr ( reply , "No block device supports snapshots" ) != NULL ) { qemuReportError ( VIR_ERR_OPERATION_INVALID , "%s" , _ ( "this domain does not have a device to delete snapshots" ) ) ; goto cleanup ; } else if ( strstr ( reply , "Snapshots not supported on device" ) != NULL ) { qemuReportError ( VIR_ERR_OPERATION_INVALID , "%s" , reply ) ; goto cleanup ; } else if ( strstr ( reply , "Error" ) != NULL && strstr ( reply , "while deleting snapshot" ) != NULL ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , "%s" , reply ) ; goto cleanup ; } ret = 0 ; cleanup : VIR_FREE ( safename ) ; VIR_FREE ( cmd ) ; VIR_FREE ( reply ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void Type_Text_Description_Free ( struct _cms_typehandler_struct * self , void * Ptr ) { cmsMLU * mlu = ( cmsMLU * ) Ptr ; cmsMLUfree ( mlu ) ; return ; cmsUNUSED_PARAMETER ( self ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline PixelTrait GetPixelCyanTraits ( const Image * restrict image ) { return ( image -> channel_map [ CyanPixelChannel ] . traits ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean is_forward_circuit ( guint circuit_id , const iax_call_data * iax_call ) { guint i ; for ( i = 0 ; i < iax_call -> n_forward_circuit_ids ; i ++ ) { if ( circuit_id == iax_call -> forward_circuit_ids [ i ] ) return TRUE ; } return FALSE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int tls_process_cke_dhe ( SSL * s , PACKET * pkt , int * al ) { # ifndef OPENSSL_NO_DH EVP_PKEY * skey = NULL ; DH * cdh ; unsigned int i ; BIGNUM * pub_key ; const unsigned char * data ; EVP_PKEY * ckey = NULL ; int ret = 0 ; if ( ! PACKET_get_net_2 ( pkt , & i ) || PACKET_remaining ( pkt ) != i ) { * al = SSL_AD_HANDSHAKE_FAILURE ; SSLerr ( SSL_F_TLS_PROCESS_CKE_DHE , SSL_R_DH_PUBLIC_VALUE_LENGTH_IS_WRONG ) ; goto err ; } skey = s -> s3 -> tmp . pkey ; if ( skey == NULL ) { * al = SSL_AD_HANDSHAKE_FAILURE ; SSLerr ( SSL_F_TLS_PROCESS_CKE_DHE , SSL_R_MISSING_TMP_DH_KEY ) ; goto err ; } if ( PACKET_remaining ( pkt ) == 0L ) { * al = SSL_AD_HANDSHAKE_FAILURE ; SSLerr ( SSL_F_TLS_PROCESS_CKE_DHE , SSL_R_MISSING_TMP_DH_KEY ) ; goto err ; } if ( ! PACKET_get_bytes ( pkt , & data , i ) ) { * al = SSL_AD_INTERNAL_ERROR ; SSLerr ( SSL_F_TLS_PROCESS_CKE_DHE , ERR_R_INTERNAL_ERROR ) ; goto err ; } ckey = EVP_PKEY_new ( ) ; if ( ckey == NULL || EVP_PKEY_copy_parameters ( ckey , skey ) == 0 ) { SSLerr ( SSL_F_TLS_PROCESS_CKE_DHE , SSL_R_BN_LIB ) ; goto err ; } cdh = EVP_PKEY_get0_DH ( ckey ) ; pub_key = BN_bin2bn ( data , i , NULL ) ; if ( pub_key == NULL || ! DH_set0_key ( cdh , pub_key , NULL ) ) { SSLerr ( SSL_F_TLS_PROCESS_CKE_DHE , ERR_R_INTERNAL_ERROR ) ; if ( pub_key != NULL ) BN_free ( pub_key ) ; goto err ; } if ( ssl_derive ( s , skey , ckey ) == 0 ) { * al = SSL_AD_INTERNAL_ERROR ; SSLerr ( SSL_F_TLS_PROCESS_CKE_DHE , ERR_R_INTERNAL_ERROR ) ; goto err ; } ret = 1 ; EVP_PKEY_free ( s -> s3 -> tmp . pkey ) ; s -> s3 -> tmp . pkey = NULL ; err : EVP_PKEY_free ( ckey ) ; return ret ; # else * al = SSL_AD_INTERNAL_ERROR ; SSLerr ( SSL_F_TLS_PROCESS_CKE_DHE , ERR_R_INTERNAL_ERROR ) ; return 0 ; # endif }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void skip_file ( CommonJob * common , GFile * file ) { if ( common -> skip_files == NULL ) { common -> skip_files = g_hash_table_new_full ( g_file_hash , ( GEqualFunc ) g_file_equal , g_object_unref , NULL ) ; } g_hash_table_insert ( common -> skip_files , g_object_ref ( file ) , file ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static struct mspack_file * mspack_fmap_open ( struct mspack_system * self , const char * filename , int mode ) { struct mspack_name * mspack_name ; struct mspack_handle * mspack_handle ; struct mspack_system_ex * self_ex ; const char * fmode ; const struct mspack_system * mptr = self ; if ( ! filename ) { cli_dbgmsg ( "%s() failed at %d\n" , __func__ , __LINE__ ) ; return NULL ; } mspack_handle = malloc ( sizeof ( * mspack_handle ) ) ; if ( ! mspack_handle ) { cli_dbgmsg ( "%s() failed at %d\n" , __func__ , __LINE__ ) ; return NULL ; } switch ( mode ) { case MSPACK_SYS_OPEN_READ : mspack_handle -> type = FILETYPE_FMAP ; mspack_name = ( struct mspack_name * ) filename ; mspack_handle -> fmap = mspack_name -> fmap ; mspack_handle -> org = mspack_name -> org ; mspack_handle -> offset = 0 ; return ( struct mspack_file * ) mspack_handle ; case MSPACK_SYS_OPEN_WRITE : fmode = "wb" ; break ; case MSPACK_SYS_OPEN_UPDATE : fmode = "r+b" ; break ; case MSPACK_SYS_OPEN_APPEND : fmode = "ab" ; break ; default : cli_dbgmsg ( "%s() wrong mode\n" , __func__ ) ; goto out_err ; } mspack_handle -> type = FILETYPE_FILENAME ; mspack_handle -> f = fopen ( filename , fmode ) ; if ( ! mspack_handle -> f ) { cli_dbgmsg ( "%s() failed %d\n" , __func__ , __LINE__ ) ; goto out_err ; } self_ex = ( struct mspack_system_ex * ) ( ( char * ) mptr - offsetof ( struct mspack_system_ex , ops ) ) ; mspack_handle -> max_size = self_ex -> max_size ; return ( struct mspack_file * ) mspack_handle ; out_err : free ( mspack_handle ) ; return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void ac3_upmix_delay ( AC3DecodeContext * s ) { int channel_data_size = sizeof ( s -> delay [ 0 ] ) ; switch ( s -> channel_mode ) { case AC3_CHMODE_DUALMONO : case AC3_CHMODE_STEREO : memcpy ( s -> delay [ 1 ] , s -> delay [ 0 ] , channel_data_size ) ; break ; case AC3_CHMODE_2F2R : memset ( s -> delay [ 3 ] , 0 , channel_data_size ) ; case AC3_CHMODE_2F1R : memset ( s -> delay [ 2 ] , 0 , channel_data_size ) ; break ; case AC3_CHMODE_3F2R : memset ( s -> delay [ 4 ] , 0 , channel_data_size ) ; case AC3_CHMODE_3F1R : memset ( s -> delay [ 3 ] , 0 , channel_data_size ) ; case AC3_CHMODE_3F : memcpy ( s -> delay [ 2 ] , s -> delay [ 1 ] , channel_data_size ) ; memset ( s -> delay [ 1 ] , 0 , channel_data_size ) ; break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gpgme_error_t gpgsm_genkey ( void * engine , gpgme_data_t help_data , int use_armor , gpgme_data_t pubkey , gpgme_data_t seckey ) { engine_gpgsm_t gpgsm = engine ; gpgme_error_t err ; if ( ! gpgsm || ! pubkey || seckey ) return gpg_error ( GPG_ERR_INV_VALUE ) ; gpgsm -> input_cb . data = help_data ; err = gpgsm_set_fd ( gpgsm , INPUT_FD , map_data_enc ( gpgsm -> input_cb . data ) ) ; if ( err ) return err ; gpgsm -> output_cb . data = pubkey ; err = gpgsm_set_fd ( gpgsm , OUTPUT_FD , use_armor ? "--armor" : map_data_enc ( gpgsm -> output_cb . data ) ) ; if ( err ) return err ; gpgsm_clear_fd ( gpgsm , MESSAGE_FD ) ; gpgsm -> inline_data = NULL ; err = start ( gpgsm , "GENKEY" ) ; return err ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_INTEGER_0_63 ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 0U , 63U , NULL , FALSE ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void printLast ( UBreakIterator * boundary , UChar * str ) { int32_t start ; int32_t end = ubrk_last ( boundary ) ; start = ubrk_previous ( boundary ) ; printTextRange ( str , start , end ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static PHP_NAMED_FUNCTION ( zif_zip_open ) { char * filename ; int filename_len ; char resolved_path [ MAXPATHLEN + 1 ] ; zip_rsrc * rsrc_int ; int err = 0 ; if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "p" , & filename , & filename_len ) == FAILURE ) { return ; } if ( filename_len == 0 ) { php_error_docref ( NULL TSRMLS_CC , E_WARNING , "Empty string as source" ) ; RETURN_FALSE ; } if ( ZIP_OPENBASEDIR_CHECKPATH ( filename ) ) { RETURN_FALSE ; } if ( ! expand_filepath ( filename , resolved_path TSRMLS_CC ) ) { RETURN_FALSE ; } rsrc_int = ( zip_rsrc * ) emalloc ( sizeof ( zip_rsrc ) ) ; rsrc_int -> za = zip_open ( resolved_path , 0 , & err ) ; if ( rsrc_int -> za == NULL ) { efree ( rsrc_int ) ; RETURN_LONG ( ( long ) err ) ; } rsrc_int -> index_current = 0 ; rsrc_int -> num_files = zip_get_num_files ( rsrc_int -> za ) ; ZEND_REGISTER_RESOURCE ( return_value , rsrc_int , le_zip_dir ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int inttgt_to_output ( int inttgt ) { int i ; for ( i = 0 ; i < ARRAY_SIZE ( inttgt_output ) ; i ++ ) { if ( inttgt_output [ i ] [ 0 ] == inttgt ) { return inttgt_output [ i ] [ 1 ] ; } } fprintf ( stderr , "%s: unsupported inttgt %d\n" , __func__ , inttgt ) ; return OPENPIC_OUTPUT_INT ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int dtls1_get_record ( SSL * s ) { int ssl_major , ssl_minor ; int i , n ; SSL3_RECORD * rr ; unsigned char * p = NULL ; unsigned short version ; DTLS1_BITMAP * bitmap ; unsigned int is_next_epoch ; rr = RECORD_LAYER_get_rrec ( & s -> rlayer ) ; again : if ( dtls1_process_buffered_records ( s ) < 0 ) return - 1 ; if ( dtls1_get_processed_record ( s ) ) return 1 ; if ( ( RECORD_LAYER_get_rstate ( & s -> rlayer ) != SSL_ST_READ_BODY ) || ( RECORD_LAYER_get_packet_length ( & s -> rlayer ) < DTLS1_RT_HEADER_LENGTH ) ) { n = ssl3_read_n ( s , DTLS1_RT_HEADER_LENGTH , SSL3_BUFFER_get_len ( & s -> rlayer . rbuf ) , 0 , 1 ) ; if ( n <= 0 ) return ( n ) ; if ( RECORD_LAYER_get_packet_length ( & s -> rlayer ) != DTLS1_RT_HEADER_LENGTH ) { RECORD_LAYER_reset_packet_length ( & s -> rlayer ) ; goto again ; } RECORD_LAYER_set_rstate ( & s -> rlayer , SSL_ST_READ_BODY ) ; p = RECORD_LAYER_get_packet ( & s -> rlayer ) ; if ( s -> msg_callback ) s -> msg_callback ( 0 , 0 , SSL3_RT_HEADER , p , DTLS1_RT_HEADER_LENGTH , s , s -> msg_callback_arg ) ; rr -> type = * ( p ++ ) ; ssl_major = * ( p ++ ) ; ssl_minor = * ( p ++ ) ; version = ( ssl_major << 8 ) | ssl_minor ; n2s ( p , rr -> epoch ) ; memcpy ( & ( RECORD_LAYER_get_read_sequence ( & s -> rlayer ) [ 2 ] ) , p , 6 ) ; p += 6 ; n2s ( p , rr -> length ) ; if ( ! s -> first_packet ) { if ( version != s -> version ) { rr -> length = 0 ; RECORD_LAYER_reset_packet_length ( & s -> rlayer ) ; goto again ; } } if ( ( version & 0xff00 ) != ( s -> version & 0xff00 ) ) { rr -> length = 0 ; RECORD_LAYER_reset_packet_length ( & s -> rlayer ) ; goto again ; } if ( rr -> length > SSL3_RT_MAX_ENCRYPTED_LENGTH ) { rr -> length = 0 ; RECORD_LAYER_reset_packet_length ( & s -> rlayer ) ; goto again ; } } if ( rr -> length > RECORD_LAYER_get_packet_length ( & s -> rlayer ) - DTLS1_RT_HEADER_LENGTH ) { i = rr -> length ; n = ssl3_read_n ( s , i , i , 1 , 1 ) ; if ( n != i ) { rr -> length = 0 ; RECORD_LAYER_reset_packet_length ( & s -> rlayer ) ; goto again ; } } RECORD_LAYER_set_rstate ( & s -> rlayer , SSL_ST_READ_HEADER ) ; bitmap = dtls1_get_bitmap ( s , rr , & is_next_epoch ) ; if ( bitmap == NULL ) { rr -> length = 0 ; RECORD_LAYER_reset_packet_length ( & s -> rlayer ) ; goto again ; } # ifndef OPENSSL_NO_SCTP if ( ! BIO_dgram_is_sctp ( SSL_get_rbio ( s ) ) ) { # endif if ( ! dtls1_record_replay_check ( s , bitmap ) ) { rr -> length = 0 ; RECORD_LAYER_reset_packet_length ( & s -> rlayer ) ; goto again ; } # ifndef OPENSSL_NO_SCTP } # endif if ( rr -> length == 0 ) goto again ; if ( is_next_epoch ) { if ( ( SSL_in_init ( s ) || ossl_statem_get_in_handshake ( s ) ) ) { if ( dtls1_buffer_record ( s , & ( DTLS_RECORD_LAYER_get_unprocessed_rcds ( & s -> rlayer ) ) , rr -> seq_num ) < 0 ) return - 1 ; dtls1_record_bitmap_update ( s , bitmap ) ; } rr -> length = 0 ; RECORD_LAYER_reset_packet_length ( & s -> rlayer ) ; goto again ; } if ( ! dtls1_process_record ( s ) ) { rr -> length = 0 ; RECORD_LAYER_reset_packet_length ( & s -> rlayer ) ; goto again ; } dtls1_record_bitmap_update ( s , bitmap ) ; return ( 1 ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static uint32_t e1000e_mac_low ## num ## _read ( E1000ECore * core , int index ) { return core -> mac [ index ] & ( BIT ( num ) - 1 ) ; } # define E1000E_LOW_BITS_READ ( num ) e1000e_mac_low ## num ## _read E1000E_LOW_BITS_READ_FUNC ( 4 ) ; E1000E_LOW_BITS_READ_FUNC ( 6 ) ; E1000E_LOW_BITS_READ_FUNC ( 11 )
0False
Categorize the following code snippet as vulnerable or not. True or False
static void midi_data_reassemble_cleanup ( void ) { reassembly_table_destroy ( & midi_data_reassembly_table ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void ff_mpeg_flush ( AVCodecContext * avctx ) { int i ; MpegEncContext * s = avctx -> priv_data ; if ( s == NULL || s -> picture == NULL ) return ; for ( i = 0 ; i < MAX_PICTURE_COUNT ; i ++ ) ff_mpeg_unref_picture ( s , & s -> picture [ i ] ) ; s -> current_picture_ptr = s -> last_picture_ptr = s -> next_picture_ptr = NULL ; s -> mb_x = s -> mb_y = 0 ; s -> parse_context . state = - 1 ; s -> parse_context . frame_start_found = 0 ; s -> parse_context . overread = 0 ; s -> parse_context . overread_index = 0 ; s -> parse_context . index = 0 ; s -> parse_context . last_index = 0 ; s -> bitstream_buffer_size = 0 ; s -> pp_time = 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void remove_tap_listener_rtp_event ( void ) { remove_tap_listener ( & ( the_tapinfo_rtp_struct . rtp_event_dummy ) ) ; have_rtp_event_tap_listener = FALSE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorJSONAddPCIDisk ( qemuMonitorPtr mon ATTRIBUTE_UNUSED , const char * path ATTRIBUTE_UNUSED , const char * bus ATTRIBUTE_UNUSED , virDomainDevicePCIAddress * guestAddr ATTRIBUTE_UNUSED ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "pci_add not suppported in JSON mode" ) ) ; return - 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( HistoryQuickProviderTest , DeleteMatch ) { GURL test_url ( "http://slashdot.org/favorite_page.html" ) ; std : : vector < std : : string > expected_urls ; expected_urls . push_back ( test_url . spec ( ) ) ; RunTest ( ASCIIToUTF16 ( "slashdot" ) , false , expected_urls , true , ASCIIToUTF16 ( "slashdot.org/favorite_page.html" ) , ASCIIToUTF16 ( ".org/favorite_page.html" ) ) ; EXPECT_EQ ( 1U , ac_matches_ . size ( ) ) ; EXPECT_TRUE ( GetURLProxy ( test_url ) ) ; provider_ -> DeleteMatch ( ac_matches_ [ 0 ] ) ; WaitForURLsDeletedNotification ( client_ -> GetHistoryService ( ) ) ; EXPECT_FALSE ( GetURLProxy ( test_url ) ) ; expected_urls . clear ( ) ; RunTest ( ASCIIToUTF16 ( "slashdot" ) , false , expected_urls , true , ASCIIToUTF16 ( "NONE EXPECTED" ) , base : : string16 ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void * xmlHashQLookup2 ( xmlHashTablePtr table , const xmlChar * prefix , const xmlChar * name , const xmlChar * prefix2 , const xmlChar * name2 ) { return ( xmlHashQLookup3 ( table , prefix , name , prefix2 , name2 , NULL , NULL ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void convert_to_format_v1 ( char * query ) { int last_c_was_quote = 0 ; char * p = query , * to = query ; char * end = strend ( query ) ; char last_c ; while ( p <= end ) { if ( * p == '\n' && ! last_c_was_quote ) { * to ++ = * p ++ ; while ( * p && my_isspace ( charset_info , * p ) ) p ++ ; last_c_was_quote = 0 ; } else if ( * p == '\'' || * p == '"' || * p == '`' ) { last_c = * p ; * to ++ = * p ++ ; while ( * p && * p != last_c ) * to ++ = * p ++ ; * to ++ = * p ++ ; last_c_was_quote = 1 ; } else { * to ++ = * p ++ ; last_c_was_quote = 0 ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
gcry_mpi_t gcry_sexp_nth_mpi ( gcry_sexp_t list , int number , int mpifmt ) { const char * s ; size_t n ; gcry_mpi_t a ; if ( ! mpifmt ) mpifmt = GCRYMPI_FMT_STD ; s = sexp_nth_data ( list , number , & n ) ; if ( ! s ) return NULL ; if ( gcry_mpi_scan ( & a , mpifmt , s , n , NULL ) ) return NULL ; return a ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void xmlHashScan3 ( xmlHashTablePtr table , const xmlChar * name , const xmlChar * name2 , const xmlChar * name3 , xmlHashScanner f , void * data ) { xmlHashScanFull3 ( table , name , name2 , name3 , ( xmlHashScannerFull ) f , data ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
void vp9_fht16x16_c ( const int16_t * input , tran_low_t * output , int stride , int tx_type ) { if ( tx_type == DCT_DCT ) { vp9_fdct16x16_c ( input , output , stride ) ; } else { tran_low_t out [ 256 ] ; tran_low_t * outptr = & out [ 0 ] ; int i , j ; tran_low_t temp_in [ 16 ] , temp_out [ 16 ] ; const transform_2d ht = FHT_16 [ tx_type ] ; for ( i = 0 ; i < 16 ; ++ i ) { for ( j = 0 ; j < 16 ; ++ j ) temp_in [ j ] = input [ j * stride + i ] * 4 ; ht . cols ( temp_in , temp_out ) ; for ( j = 0 ; j < 16 ; ++ j ) outptr [ j * 16 + i ] = ( temp_out [ j ] + 1 + ( temp_out [ j ] < 0 ) ) >> 2 ; } for ( i = 0 ; i < 16 ; ++ i ) { for ( j = 0 ; j < 16 ; ++ j ) temp_in [ j ] = out [ j + i * 16 ] ; ht . rows ( temp_in , temp_out ) ; for ( j = 0 ; j < 16 ; ++ j ) output [ j + i * 16 ] = temp_out [ j ] ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static VALUE ossl_asn1_ ## klass ( int argc , VALUE * argv , VALUE self ) \ { return rb_funcall3 ( cASN1 ## klass , rb_intern ( "new" ) , argc , argv ) ; } OSSL_ASN1_IMPL_FACTORY_METHOD ( Boolean ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Integer ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Enumerated )
0False
Categorize the following code snippet as vulnerable or not. True or False
void del_event ( event_info * ep ) { if ( ep -> e_prev ) ep -> e_prev -> e_next = ep -> e_next ; else event_hash [ ep -> e_event % EVENT_HASH ] = ep -> e_next ; if ( ep -> e_next ) ep -> e_next -> e_prev = ep -> e_prev ; switch ( ep -> e_mtype ) { case TM_INIT : case TM_SPAWN : case TM_SIGNAL : case TM_OBIT : case TM_POSTINFO : break ; case TM_TASKS : case TM_GETINFO : case TM_RESOURCES : free ( ep -> e_info ) ; break ; default : TM_DBPRT ( ( "del_event: unknown event command %d\n" , ep -> e_mtype ) ) break ; } free ( ep ) ; if ( -- event_count == 0 ) { close ( local_conn ) ; local_conn = - 1 ; } return ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int16_t * ff_h263_pred_motion ( MpegEncContext * s , int block , int dir , int * px , int * py ) { int wrap ; int16_t * A , * B , * C , ( * mot_val ) [ 2 ] ; static const int off [ 4 ] = { 2 , 1 , 1 , - 1 } ; wrap = s -> b8_stride ; mot_val = s -> current_picture . f . motion_val [ dir ] + s -> block_index [ block ] ; A = mot_val [ - 1 ] ; if ( s -> first_slice_line && block < 3 ) { if ( block == 0 ) { if ( s -> mb_x == s -> resync_mb_x ) { * px = * py = 0 ; } else if ( s -> mb_x + 1 == s -> resync_mb_x && s -> h263_pred ) { C = mot_val [ off [ block ] - wrap ] ; if ( s -> mb_x == 0 ) { * px = C [ 0 ] ; * py = C [ 1 ] ; } else { * px = mid_pred ( A [ 0 ] , 0 , C [ 0 ] ) ; * py = mid_pred ( A [ 1 ] , 0 , C [ 1 ] ) ; } } else { * px = A [ 0 ] ; * py = A [ 1 ] ; } } else if ( block == 1 ) { if ( s -> mb_x + 1 == s -> resync_mb_x && s -> h263_pred ) { C = mot_val [ off [ block ] - wrap ] ; * px = mid_pred ( A [ 0 ] , 0 , C [ 0 ] ) ; * py = mid_pred ( A [ 1 ] , 0 , C [ 1 ] ) ; } else { * px = A [ 0 ] ; * py = A [ 1 ] ; } } else { B = mot_val [ - wrap ] ; C = mot_val [ off [ block ] - wrap ] ; if ( s -> mb_x == s -> resync_mb_x ) A [ 0 ] = A [ 1 ] = 0 ; * px = mid_pred ( A [ 0 ] , B [ 0 ] , C [ 0 ] ) ; * py = mid_pred ( A [ 1 ] , B [ 1 ] , C [ 1 ] ) ; } } else { B = mot_val [ - wrap ] ; C = mot_val [ off [ block ] - wrap ] ; * px = mid_pred ( A [ 0 ] , B [ 0 ] , C [ 0 ] ) ; * py = mid_pred ( A [ 1 ] , B [ 1 ] , C [ 1 ] ) ; } return * mot_val ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int myisamchk ( MI_CHECK * param , char * filename ) { int error , lock_type , recreate ; int rep_quick = param -> testflag & ( T_QUICK | T_FORCE_UNIQUENESS ) ; MI_INFO * info ; File datafile ; char llbuff [ 22 ] , llbuff2 [ 22 ] ; my_bool state_updated = 0 ; MYISAM_SHARE * share ; DBUG_ENTER ( "myisamchk" ) ; param -> out_flag = error = param -> warning_printed = param -> error_printed = recreate = 0 ; datafile = 0 ; param -> isam_file_name = filename ; if ( ! ( info = mi_open ( filename , ( param -> testflag & ( T_DESCRIPT | T_READONLY ) ) ? O_RDONLY : O_RDWR , HA_OPEN_FOR_REPAIR | ( ( param -> testflag & T_WAIT_FOREVER ) ? HA_OPEN_WAIT_IF_LOCKED : ( param -> testflag & T_DESCRIPT ) ? HA_OPEN_IGNORE_IF_LOCKED : HA_OPEN_ABORT_IF_LOCKED ) ) ) ) { param -> error_printed = 1 ; switch ( my_errno ) { case HA_ERR_CRASHED : mi_check_print_error ( param , "'%s' doesn't have a correct index definition. You need to recreate it before you can do a repair" , filename ) ; break ; case HA_ERR_NOT_A_TABLE : mi_check_print_error ( param , "'%s' is not a MyISAM-table" , filename ) ; break ; case HA_ERR_CRASHED_ON_USAGE : mi_check_print_error ( param , "'%s' is marked as crashed" , filename ) ; break ; case HA_ERR_CRASHED_ON_REPAIR : mi_check_print_error ( param , "'%s' is marked as crashed after last repair" , filename ) ; break ; case HA_ERR_OLD_FILE : mi_check_print_error ( param , "'%s' is an old type of MyISAM-table" , filename ) ; break ; case HA_ERR_END_OF_FILE : mi_check_print_error ( param , "Couldn't read complete header from '%s'" , filename ) ; break ; case EAGAIN : mi_check_print_error ( param , "'%s' is locked. Use -w to wait until unlocked" , filename ) ; break ; case ENOENT : mi_check_print_error ( param , "File '%s' doesn't exist" , filename ) ; break ; case EACCES : mi_check_print_error ( param , "You don't have permission to use '%s'" , filename ) ; break ; default : mi_check_print_error ( param , "%d when opening MyISAM-table '%s'" , my_errno , filename ) ; break ; } DBUG_RETURN ( 1 ) ; } share = info -> s ; share -> options &= ~ HA_OPTION_READ_ONLY_DATA ; share -> tot_locks -= share -> r_locks ; share -> r_locks = 0 ; if ( param -> testflag & ( T_FAST | T_CHECK_ONLY_CHANGED ) ) { my_bool need_to_check = mi_is_crashed ( info ) || share -> state . open_count != 0 ; if ( ( param -> testflag & ( T_REP_ANY | T_SORT_RECORDS ) ) && ( ( share -> state . changed & ( STATE_CHANGED | STATE_CRASHED | STATE_CRASHED_ON_REPAIR ) || ! ( param -> testflag & T_CHECK_ONLY_CHANGED ) ) ) ) need_to_check = 1 ; if ( info -> s -> base . keys && info -> state -> records ) { if ( ( param -> testflag & T_STATISTICS ) && ( share -> state . changed & STATE_NOT_ANALYZED ) ) need_to_check = 1 ; if ( ( param -> testflag & T_SORT_INDEX ) && ( share -> state . changed & STATE_NOT_SORTED_PAGES ) ) need_to_check = 1 ; if ( ( param -> testflag & T_REP_BY_SORT ) && ( share -> state . changed & STATE_NOT_OPTIMIZED_KEYS ) ) need_to_check = 1 ; } if ( ( param -> testflag & T_CHECK_ONLY_CHANGED ) && ( share -> state . changed & ( STATE_CHANGED | STATE_CRASHED | STATE_CRASHED_ON_REPAIR ) ) ) need_to_check = 1 ; if ( ! need_to_check ) { if ( ! ( param -> testflag & T_SILENT ) || param -> testflag & T_INFO ) printf ( "MyISAM file: %s is already checked\n" , filename ) ; if ( mi_close ( info ) ) { mi_check_print_error ( param , "%d when closing MyISAM-table '%s'" , my_errno , filename ) ; DBUG_RETURN ( 1 ) ; } DBUG_RETURN ( 0 ) ; } } if ( ( param -> testflag & ( T_REP_ANY | T_STATISTICS | T_SORT_RECORDS | T_SORT_INDEX ) ) && ( ( ( param -> testflag & T_UNPACK ) && share -> data_file_type == COMPRESSED_RECORD ) || mi_uint2korr ( share -> state . header . state_info_length ) != MI_STATE_INFO_SIZE || mi_uint2korr ( share -> state . header . base_info_length ) != MI_BASE_INFO_SIZE || mi_is_any_intersect_keys_active ( param -> keys_in_use , share -> base . keys , ~ share -> state . key_map ) || test_if_almost_full ( info ) || info -> s -> state . header . file_version [ 3 ] != myisam_file_magic [ 3 ] || ( set_collation && set_collation -> number != share -> state . header . language ) || myisam_block_size != MI_KEY_BLOCK_LENGTH ) ) { if ( set_collation ) param -> language = set_collation -> number ; if ( recreate_table ( param , & info , filename ) ) { ( void ) fprintf ( stderr , "MyISAM-table '%s' is not fixed because of errors\n" , filename ) ; return ( - 1 ) ; } recreate = 1 ; if ( ! ( param -> testflag & T_REP_ANY ) ) { param -> testflag |= T_REP_BY_SORT ; if ( ! ( param -> testflag & T_SILENT ) ) printf ( "- '%s' has old table-format. Recreating index\n" , filename ) ; rep_quick |= T_QUICK ; } share = info -> s ; share -> tot_locks -= share -> r_locks ; share -> r_locks = 0 ; } if ( param -> testflag & T_DESCRIPT ) { param -> total_files ++ ; param -> total_records += info -> state -> records ; param -> total_deleted += info -> state -> del ; descript ( param , info , filename ) ; } else { if ( ! stopwords_inited ++ ) ft_init_stopwords ( ) ; if ( ! ( param -> testflag & T_READONLY ) ) lock_type = F_WRLCK ; else lock_type = F_RDLCK ; if ( info -> lock_type == F_RDLCK ) info -> lock_type = F_UNLCK ; if ( _mi_readinfo ( info , lock_type , 0 ) ) { mi_check_print_error ( param , "Can't lock indexfile of '%s', error: %d" , filename , my_errno ) ; param -> error_printed = 0 ; goto end2 ; } mi_lock_database ( info , F_EXTRA_LCK ) ; datafile = info -> dfile ; if ( param -> testflag & ( T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX ) ) { if ( param -> testflag & T_REP_ANY ) { ulonglong tmp = share -> state . key_map ; mi_copy_keys_active ( share -> state . key_map , share -> base . keys , param -> keys_in_use ) ; if ( tmp != share -> state . key_map ) info -> update |= HA_STATE_CHANGED ; } if ( rep_quick && chk_del ( param , info , param -> testflag & ~ T_VERBOSE ) ) { if ( param -> testflag & T_FORCE_CREATE ) { rep_quick = 0 ; mi_check_print_info ( param , "Creating new data file\n" ) ; } else { error = 1 ; mi_check_print_error ( param , "Quick-recover aborted; Run recovery without switch 'q'" ) ; } } if ( ! error ) { if ( ( param -> testflag & ( T_REP_BY_SORT | T_REP_PARALLEL ) ) && ( mi_is_any_key_active ( share -> state . key_map ) || ( rep_quick && ! param -> keys_in_use && ! recreate ) ) && mi_test_if_sort_rep ( info , info -> state -> records , info -> s -> state . key_map , param -> force_sort ) ) { if ( param -> testflag & T_REP_BY_SORT ) error = mi_repair_by_sort ( param , info , filename , rep_quick , FALSE ) ; else error = mi_repair_parallel ( param , info , filename , rep_quick , FALSE ) ; state_updated = 1 ; } else if ( param -> testflag & T_REP_ANY ) error = mi_repair ( param , info , filename , rep_quick , FALSE ) ; } if ( ! error && param -> testflag & T_SORT_RECORDS ) { # ifndef TO_BE_REMOVED if ( param -> out_flag & O_NEW_DATA ) { ( void ) my_close ( info -> dfile , MYF ( MY_WME ) ) ; error |= change_to_newfile ( filename , MI_NAME_DEXT , DATA_TMP_EXT , MYF ( 0 ) ) ; if ( mi_open_datafile ( info , info -> s , NULL , - 1 ) ) error = 1 ; param -> out_flag &= ~ O_NEW_DATA ; param -> read_cache . file = info -> dfile ; } # endif if ( ! error ) { uint key ; my_bool update_index = 1 ; for ( key = 0 ; key < share -> base . keys ; key ++ ) if ( share -> keyinfo [ key ] . flag & ( HA_BINARY_PACK_KEY | HA_FULLTEXT ) ) update_index = 0 ; error = mi_sort_records ( param , info , filename , param -> opt_sort_key , ( my_bool ) ! ( param -> testflag & T_REP ) , update_index ) ; datafile = info -> dfile ; if ( ! error && ! update_index ) { if ( param -> verbose ) puts ( "Table had a compressed index; We must now recreate the index" ) ; error = mi_repair_by_sort ( param , info , filename , 1 , FALSE ) ; } } } if ( ! error && param -> testflag & T_SORT_INDEX ) error = mi_sort_index ( param , info , filename , FALSE ) ; if ( ! error ) share -> state . changed &= ~ ( STATE_CHANGED | STATE_CRASHED | STATE_CRASHED_ON_REPAIR ) ; else mi_mark_crashed ( info ) ; } else if ( ( param -> testflag & T_CHECK ) || ! ( param -> testflag & T_AUTO_INC ) ) { if ( ! ( param -> testflag & T_SILENT ) || param -> testflag & T_INFO ) printf ( "Checking MyISAM file: %s\n" , filename ) ; if ( ! ( param -> testflag & T_SILENT ) ) printf ( "Data records: %7s Deleted blocks: %7s\n" , llstr ( info -> state -> records , llbuff ) , llstr ( info -> state -> del , llbuff2 ) ) ; error = chk_status ( param , info ) ; mi_intersect_keys_active ( share -> state . key_map , param -> keys_in_use ) ; error = chk_size ( param , info ) ; if ( ! error || ! ( param -> testflag & ( T_FAST | T_FORCE_CREATE ) ) ) error |= chk_del ( param , info , param -> testflag ) ; if ( ( ! error || ( ! ( param -> testflag & ( T_FAST | T_FORCE_CREATE ) ) && ! param -> start_check_pos ) ) ) { error |= chk_key ( param , info ) ; if ( ! error && ( param -> testflag & ( T_STATISTICS | T_AUTO_INC ) ) ) error = update_state_info ( param , info , ( ( param -> testflag & T_STATISTICS ) ? UPDATE_STAT : 0 ) | ( ( param -> testflag & T_AUTO_INC ) ? UPDATE_AUTO_INC : 0 ) ) ; } if ( ( ! rep_quick && ! error ) || ! ( param -> testflag & ( T_FAST | T_FORCE_CREATE ) ) ) { if ( param -> testflag & ( T_EXTEND | T_MEDIUM ) ) ( void ) init_key_cache ( dflt_key_cache , opt_key_cache_block_size , param -> use_buffers , 0 , 0 ) ; ( void ) init_io_cache ( & param -> read_cache , datafile , ( uint ) param -> read_buffer_length , READ_CACHE , ( param -> start_check_pos ? param -> start_check_pos : share -> pack . header_length ) , 1 , MYF ( MY_WME ) ) ; lock_memory ( param ) ; if ( ( info -> s -> options & ( HA_OPTION_PACK_RECORD | HA_OPTION_COMPRESS_RECORD ) ) || ( param -> testflag & ( T_EXTEND | T_MEDIUM ) ) ) error |= chk_data_link ( param , info , param -> testflag & T_EXTEND ) ; error |= flush_blocks ( param , share -> key_cache , share -> kfile ) ; ( void ) end_io_cache ( & param -> read_cache ) ; } if ( ! error ) { if ( ( share -> state . changed & STATE_CHANGED ) && ( param -> testflag & T_UPDATE_STATE ) ) info -> update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED ; share -> state . changed &= ~ ( STATE_CHANGED | STATE_CRASHED | STATE_CRASHED_ON_REPAIR ) ; } else if ( ! mi_is_crashed ( info ) && ( param -> testflag & T_UPDATE_STATE ) ) { mi_mark_crashed ( info ) ; info -> update |= HA_STATE_CHANGED | HA_STATE_ROW_CHANGED ; } } } if ( ( param -> testflag & T_AUTO_INC ) || ( ( param -> testflag & T_REP_ANY ) && info -> s -> base . auto_key ) ) update_auto_increment_key ( param , info , ( my_bool ) ! test ( param -> testflag & T_AUTO_INC ) ) ; if ( ! ( param -> testflag & T_DESCRIPT ) ) { if ( info -> update & HA_STATE_CHANGED && ! ( param -> testflag & T_READONLY ) ) error |= update_state_info ( param , info , UPDATE_OPEN_COUNT | ( ( ( param -> testflag & T_REP_ANY ) ? UPDATE_TIME : 0 ) | ( state_updated ? UPDATE_STAT : 0 ) | ( ( param -> testflag & T_SORT_RECORDS ) ? UPDATE_SORT : 0 ) ) ) ; ( void ) lock_file ( param , share -> kfile , 0L , F_UNLCK , "indexfile" , filename ) ; info -> update &= ~ HA_STATE_CHANGED ; } mi_lock_database ( info , F_UNLCK ) ; end2 : if ( mi_close ( info ) ) { mi_check_print_error ( param , "%d when closing MyISAM-table '%s'" , my_errno , filename ) ; DBUG_RETURN ( 1 ) ; } if ( error == 0 ) { if ( param -> out_flag & O_NEW_DATA ) error |= change_to_newfile ( filename , MI_NAME_DEXT , DATA_TMP_EXT , ( ( param -> testflag & T_BACKUP_DATA ) ? MYF ( MY_REDEL_MAKE_BACKUP ) : MYF ( 0 ) ) ) ; if ( param -> out_flag & O_NEW_INDEX ) error |= change_to_newfile ( filename , MI_NAME_IEXT , INDEX_TMP_EXT , MYF ( 0 ) ) ; } ( void ) fflush ( stdout ) ; ( void ) fflush ( stderr ) ; if ( param -> error_printed ) { if ( param -> testflag & ( T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX ) ) { ( void ) fprintf ( stderr , "MyISAM-table '%s' is not fixed because of errors\n" , filename ) ; if ( param -> testflag & T_REP_ANY ) ( void ) fprintf ( stderr , "Try fixing it by using the --safe-recover (-o), the --force (-f) option or by not using the --quick (-q) flag\n" ) ; } else if ( ! ( param -> error_printed & 2 ) && ! ( param -> testflag & T_FORCE_CREATE ) ) ( void ) fprintf ( stderr , "MyISAM-table '%s' is corrupted\nFix it using switch \"-r\" or \"-o\"\n" , filename ) ; } else if ( param -> warning_printed && ! ( param -> testflag & ( T_REP_ANY | T_SORT_RECORDS | T_SORT_INDEX | T_FORCE_CREATE ) ) ) ( void ) fprintf ( stderr , "MyISAM-table '%s' is usable but should be fixed\n" , filename ) ; ( void ) fflush ( stderr ) ; DBUG_RETURN ( error ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void vc1_decode_b_mb ( VC1Context * v ) { MpegEncContext * s = & v -> s ; GetBitContext * gb = & s -> gb ; int i , j ; int mb_pos = s -> mb_x + s -> mb_y * s -> mb_stride ; int cbp = 0 ; int mqdiff , mquant ; int ttmb = v -> ttfrm ; int mb_has_coeffs = 0 ; int index , index1 ; int val , sign ; int first_block = 1 ; int dst_idx , off ; int skipped , direct ; int dmv_x [ 2 ] , dmv_y [ 2 ] ; int bmvtype = BMV_TYPE_BACKWARD ; mquant = v -> pq ; s -> mb_intra = 0 ; if ( v -> dmb_is_raw ) direct = get_bits1 ( gb ) ; else direct = v -> direct_mb_plane [ mb_pos ] ; if ( v -> skip_is_raw ) skipped = get_bits1 ( gb ) ; else skipped = v -> s . mbskip_table [ mb_pos ] ; dmv_x [ 0 ] = dmv_x [ 1 ] = dmv_y [ 0 ] = dmv_y [ 1 ] = 0 ; for ( i = 0 ; i < 6 ; i ++ ) { v -> mb_type [ 0 ] [ s -> block_index [ i ] ] = 0 ; s -> dc_val [ 0 ] [ s -> block_index [ i ] ] = 0 ; } s -> current_picture . qscale_table [ mb_pos ] = 0 ; if ( ! direct ) { if ( ! skipped ) { GET_MVDATA ( dmv_x [ 0 ] , dmv_y [ 0 ] ) ; dmv_x [ 1 ] = dmv_x [ 0 ] ; dmv_y [ 1 ] = dmv_y [ 0 ] ; } if ( skipped || ! s -> mb_intra ) { bmvtype = decode012 ( gb ) ; switch ( bmvtype ) { case 0 : bmvtype = ( v -> bfraction >= ( B_FRACTION_DEN / 2 ) ) ? BMV_TYPE_BACKWARD : BMV_TYPE_FORWARD ; break ; case 1 : bmvtype = ( v -> bfraction >= ( B_FRACTION_DEN / 2 ) ) ? BMV_TYPE_FORWARD : BMV_TYPE_BACKWARD ; break ; case 2 : bmvtype = BMV_TYPE_INTERPOLATED ; dmv_x [ 0 ] = dmv_y [ 0 ] = 0 ; } } } for ( i = 0 ; i < 6 ; i ++ ) v -> mb_type [ 0 ] [ s -> block_index [ i ] ] = s -> mb_intra ; if ( skipped ) { if ( direct ) bmvtype = BMV_TYPE_INTERPOLATED ; vc1_pred_b_mv ( v , dmv_x , dmv_y , direct , bmvtype ) ; vc1_b_mc ( v , dmv_x , dmv_y , direct , bmvtype ) ; return ; } if ( direct ) { cbp = get_vlc2 ( & v -> s . gb , v -> cbpcy_vlc -> table , VC1_CBPCY_P_VLC_BITS , 2 ) ; GET_MQUANT ( ) ; s -> mb_intra = 0 ; s -> current_picture . qscale_table [ mb_pos ] = mquant ; if ( ! v -> ttmbf ) ttmb = get_vlc2 ( gb , ff_vc1_ttmb_vlc [ v -> tt_index ] . table , VC1_TTMB_VLC_BITS , 2 ) ; dmv_x [ 0 ] = dmv_y [ 0 ] = dmv_x [ 1 ] = dmv_y [ 1 ] = 0 ; vc1_pred_b_mv ( v , dmv_x , dmv_y , direct , bmvtype ) ; vc1_b_mc ( v , dmv_x , dmv_y , direct , bmvtype ) ; } else { if ( ! mb_has_coeffs && ! s -> mb_intra ) { vc1_pred_b_mv ( v , dmv_x , dmv_y , direct , bmvtype ) ; vc1_b_mc ( v , dmv_x , dmv_y , direct , bmvtype ) ; return ; } if ( s -> mb_intra && ! mb_has_coeffs ) { GET_MQUANT ( ) ; s -> current_picture . qscale_table [ mb_pos ] = mquant ; s -> ac_pred = get_bits1 ( gb ) ; cbp = 0 ; vc1_pred_b_mv ( v , dmv_x , dmv_y , direct , bmvtype ) ; } else { if ( bmvtype == BMV_TYPE_INTERPOLATED ) { GET_MVDATA ( dmv_x [ 0 ] , dmv_y [ 0 ] ) ; if ( ! mb_has_coeffs ) { vc1_pred_b_mv ( v , dmv_x , dmv_y , direct , bmvtype ) ; vc1_b_mc ( v , dmv_x , dmv_y , direct , bmvtype ) ; return ; } } vc1_pred_b_mv ( v , dmv_x , dmv_y , direct , bmvtype ) ; if ( ! s -> mb_intra ) { vc1_b_mc ( v , dmv_x , dmv_y , direct , bmvtype ) ; } if ( s -> mb_intra ) s -> ac_pred = get_bits1 ( gb ) ; cbp = get_vlc2 ( & v -> s . gb , v -> cbpcy_vlc -> table , VC1_CBPCY_P_VLC_BITS , 2 ) ; GET_MQUANT ( ) ; s -> current_picture . qscale_table [ mb_pos ] = mquant ; if ( ! v -> ttmbf && ! s -> mb_intra && mb_has_coeffs ) ttmb = get_vlc2 ( gb , ff_vc1_ttmb_vlc [ v -> tt_index ] . table , VC1_TTMB_VLC_BITS , 2 ) ; } } dst_idx = 0 ; for ( i = 0 ; i < 6 ; i ++ ) { s -> dc_val [ 0 ] [ s -> block_index [ i ] ] = 0 ; dst_idx += i >> 2 ; val = ( ( cbp >> ( 5 - i ) ) & 1 ) ; off = ( i & 4 ) ? 0 : ( ( i & 1 ) * 8 + ( i & 2 ) * 4 * s -> linesize ) ; v -> mb_type [ 0 ] [ s -> block_index [ i ] ] = s -> mb_intra ; if ( s -> mb_intra ) { v -> a_avail = v -> c_avail = 0 ; if ( i == 2 || i == 3 || ! s -> first_slice_line ) v -> a_avail = v -> mb_type [ 0 ] [ s -> block_index [ i ] - s -> block_wrap [ i ] ] ; if ( i == 1 || i == 3 || s -> mb_x ) v -> c_avail = v -> mb_type [ 0 ] [ s -> block_index [ i ] - 1 ] ; vc1_decode_intra_block ( v , s -> block [ i ] , i , val , mquant , ( i & 4 ) ? v -> codingset2 : v -> codingset ) ; if ( ( i > 3 ) && ( s -> flags & CODEC_FLAG_GRAY ) ) continue ; v -> vc1dsp . vc1_inv_trans_8x8 ( s -> block [ i ] ) ; if ( v -> rangeredfrm ) for ( j = 0 ; j < 64 ; j ++ ) s -> block [ i ] [ j ] <<= 1 ; s -> dsp . put_signed_pixels_clamped ( s -> block [ i ] , s -> dest [ dst_idx ] + off , i & 4 ? s -> uvlinesize : s -> linesize ) ; } else if ( val ) { vc1_decode_p_block ( v , s -> block [ i ] , i , mquant , ttmb , first_block , s -> dest [ dst_idx ] + off , ( i & 4 ) ? s -> uvlinesize : s -> linesize , ( i & 4 ) && ( s -> flags & CODEC_FLAG_GRAY ) , NULL ) ; if ( ! v -> ttmbf && ttmb < 8 ) ttmb = - 1 ; first_block = 0 ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void update_alt_ref_frame_stats ( VP8_COMP * cpi ) { VP8_COMMON * cm = & cpi -> common ; if ( ! cpi -> auto_gold ) cpi -> frames_till_gf_update_due = DEFAULT_GF_INTERVAL ; if ( ( cpi -> pass != 2 ) && cpi -> frames_till_gf_update_due ) { cpi -> current_gf_interval = cpi -> frames_till_gf_update_due ; cpi -> gf_overspend_bits += cpi -> projected_frame_size ; cpi -> non_gf_bitrate_adjustment = cpi -> gf_overspend_bits / cpi -> frames_till_gf_update_due ; } vpx_memset ( cpi -> gf_active_flags , 1 , ( cm -> mb_rows * cm -> mb_cols ) ) ; cpi -> gf_active_count = cm -> mb_rows * cm -> mb_cols ; cpi -> frames_since_golden = 0 ; cpi -> source_alt_ref_pending = 0 ; cpi -> source_alt_ref_active = 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dissect_zcl_identify_identify ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) { proto_tree_add_item ( tree , hf_zbee_zcl_identify_identify_time , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ; * offset += 2 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_date_time ( ) { int rc ; myheader ( "test_date_time" ) ; rc = mysql_query ( mysql , "DROP TABLE IF EXISTS test_date" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "CREATE TABLE test_date(c1 TIME, \ c2 TIME, \ c3 TIME, \ c4 TIME)" ) ; myquery ( rc ) ; bind_date_conv ( 3 , FALSE ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_T_ip6Address ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_T_ip6Address , T_ip6Address_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void e1000e_phy_reg_write ( E1000ECore * core , uint8_t page , uint32_t addr , uint16_t data ) { assert ( page < E1000E_PHY_PAGES ) ; assert ( addr < E1000E_PHY_PAGE_SIZE ) ; if ( e1000e_phyreg_writeops [ page ] [ addr ] ) { e1000e_phyreg_writeops [ page ] [ addr ] ( core , addr , data ) ; } else { core -> phy [ page ] [ addr ] = data ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
const char * SSL_state_string_long ( const SSL * s ) { const char * str ; switch ( s -> state ) { case SSL_ST_BEFORE : str = "before SSL initialization" ; break ; case SSL_ST_ACCEPT : str = "before accept initialization" ; break ; case SSL_ST_CONNECT : str = "before connect initialization" ; break ; case SSL_ST_OK : str = "SSL negotiation finished successfully" ; break ; case SSL_ST_RENEGOTIATE : str = "SSL renegotiate ciphers" ; break ; case SSL_ST_BEFORE | SSL_ST_CONNECT : str = "before/connect initialization" ; break ; case SSL_ST_OK | SSL_ST_CONNECT : str = "ok/connect SSL initialization" ; break ; case SSL_ST_BEFORE | SSL_ST_ACCEPT : str = "before/accept initialization" ; break ; case SSL_ST_OK | SSL_ST_ACCEPT : str = "ok/accept SSL initialization" ; break ; # ifndef OPENSSL_NO_SSL2 case SSL2_ST_CLIENT_START_ENCRYPTION : str = "SSLv2 client start encryption" ; break ; case SSL2_ST_SERVER_START_ENCRYPTION : str = "SSLv2 server start encryption" ; break ; case SSL2_ST_SEND_CLIENT_HELLO_A : str = "SSLv2 write client hello A" ; break ; case SSL2_ST_SEND_CLIENT_HELLO_B : str = "SSLv2 write client hello B" ; break ; case SSL2_ST_GET_SERVER_HELLO_A : str = "SSLv2 read server hello A" ; break ; case SSL2_ST_GET_SERVER_HELLO_B : str = "SSLv2 read server hello B" ; break ; case SSL2_ST_SEND_CLIENT_MASTER_KEY_A : str = "SSLv2 write client master key A" ; break ; case SSL2_ST_SEND_CLIENT_MASTER_KEY_B : str = "SSLv2 write client master key B" ; break ; case SSL2_ST_SEND_CLIENT_FINISHED_A : str = "SSLv2 write client finished A" ; break ; case SSL2_ST_SEND_CLIENT_FINISHED_B : str = "SSLv2 write client finished B" ; break ; case SSL2_ST_SEND_CLIENT_CERTIFICATE_A : str = "SSLv2 write client certificate A" ; break ; case SSL2_ST_SEND_CLIENT_CERTIFICATE_B : str = "SSLv2 write client certificate B" ; break ; case SSL2_ST_SEND_CLIENT_CERTIFICATE_C : str = "SSLv2 write client certificate C" ; break ; case SSL2_ST_SEND_CLIENT_CERTIFICATE_D : str = "SSLv2 write client certificate D" ; break ; case SSL2_ST_GET_SERVER_VERIFY_A : str = "SSLv2 read server verify A" ; break ; case SSL2_ST_GET_SERVER_VERIFY_B : str = "SSLv2 read server verify B" ; break ; case SSL2_ST_GET_SERVER_FINISHED_A : str = "SSLv2 read server finished A" ; break ; case SSL2_ST_GET_SERVER_FINISHED_B : str = "SSLv2 read server finished B" ; break ; case SSL2_ST_GET_CLIENT_HELLO_A : str = "SSLv2 read client hello A" ; break ; case SSL2_ST_GET_CLIENT_HELLO_B : str = "SSLv2 read client hello B" ; break ; case SSL2_ST_GET_CLIENT_HELLO_C : str = "SSLv2 read client hello C" ; break ; case SSL2_ST_SEND_SERVER_HELLO_A : str = "SSLv2 write server hello A" ; break ; case SSL2_ST_SEND_SERVER_HELLO_B : str = "SSLv2 write server hello B" ; break ; case SSL2_ST_GET_CLIENT_MASTER_KEY_A : str = "SSLv2 read client master key A" ; break ; case SSL2_ST_GET_CLIENT_MASTER_KEY_B : str = "SSLv2 read client master key B" ; break ; case SSL2_ST_SEND_SERVER_VERIFY_A : str = "SSLv2 write server verify A" ; break ; case SSL2_ST_SEND_SERVER_VERIFY_B : str = "SSLv2 write server verify B" ; break ; case SSL2_ST_SEND_SERVER_VERIFY_C : str = "SSLv2 write server verify C" ; break ; case SSL2_ST_GET_CLIENT_FINISHED_A : str = "SSLv2 read client finished A" ; break ; case SSL2_ST_GET_CLIENT_FINISHED_B : str = "SSLv2 read client finished B" ; break ; case SSL2_ST_SEND_SERVER_FINISHED_A : str = "SSLv2 write server finished A" ; break ; case SSL2_ST_SEND_SERVER_FINISHED_B : str = "SSLv2 write server finished B" ; break ; case SSL2_ST_SEND_REQUEST_CERTIFICATE_A : str = "SSLv2 write request certificate A" ; break ; case SSL2_ST_SEND_REQUEST_CERTIFICATE_B : str = "SSLv2 write request certificate B" ; break ; case SSL2_ST_SEND_REQUEST_CERTIFICATE_C : str = "SSLv2 write request certificate C" ; break ; case SSL2_ST_SEND_REQUEST_CERTIFICATE_D : str = "SSLv2 write request certificate D" ; break ; case SSL2_ST_X509_GET_SERVER_CERTIFICATE : str = "SSLv2 X509 read server certificate" ; break ; case SSL2_ST_X509_GET_CLIENT_CERTIFICATE : str = "SSLv2 X509 read client certificate" ; break ; # endif # ifndef OPENSSL_NO_SSL3 case SSL3_ST_CW_CLNT_HELLO_A : str = "SSLv3 write client hello A" ; break ; case SSL3_ST_CW_CLNT_HELLO_B : str = "SSLv3 write client hello B" ; break ; case SSL3_ST_CR_SRVR_HELLO_A : str = "SSLv3 read server hello A" ; break ; case SSL3_ST_CR_SRVR_HELLO_B : str = "SSLv3 read server hello B" ; break ; case SSL3_ST_CR_CERT_A : str = "SSLv3 read server certificate A" ; break ; case SSL3_ST_CR_CERT_B : str = "SSLv3 read server certificate B" ; break ; case SSL3_ST_CR_KEY_EXCH_A : str = "SSLv3 read server key exchange A" ; break ; case SSL3_ST_CR_KEY_EXCH_B : str = "SSLv3 read server key exchange B" ; break ; case SSL3_ST_CR_CERT_REQ_A : str = "SSLv3 read server certificate request A" ; break ; case SSL3_ST_CR_CERT_REQ_B : str = "SSLv3 read server certificate request B" ; break ; case SSL3_ST_CR_SESSION_TICKET_A : str = "SSLv3 read server session ticket A" ; break ; case SSL3_ST_CR_SESSION_TICKET_B : str = "SSLv3 read server session ticket B" ; break ; case SSL3_ST_CR_SRVR_DONE_A : str = "SSLv3 read server done A" ; break ; case SSL3_ST_CR_SRVR_DONE_B : str = "SSLv3 read server done B" ; break ; case SSL3_ST_CW_CERT_A : str = "SSLv3 write client certificate A" ; break ; case SSL3_ST_CW_CERT_B : str = "SSLv3 write client certificate B" ; break ; case SSL3_ST_CW_CERT_C : str = "SSLv3 write client certificate C" ; break ; case SSL3_ST_CW_CERT_D : str = "SSLv3 write client certificate D" ; break ; case SSL3_ST_CW_KEY_EXCH_A : str = "SSLv3 write client key exchange A" ; break ; case SSL3_ST_CW_KEY_EXCH_B : str = "SSLv3 write client key exchange B" ; break ; case SSL3_ST_CW_CERT_VRFY_A : str = "SSLv3 write certificate verify A" ; break ; case SSL3_ST_CW_CERT_VRFY_B : str = "SSLv3 write certificate verify B" ; break ; case SSL3_ST_CW_CHANGE_A : case SSL3_ST_SW_CHANGE_A : str = "SSLv3 write change cipher spec A" ; break ; case SSL3_ST_CW_CHANGE_B : case SSL3_ST_SW_CHANGE_B : str = "SSLv3 write change cipher spec B" ; break ; case SSL3_ST_CW_FINISHED_A : case SSL3_ST_SW_FINISHED_A : str = "SSLv3 write finished A" ; break ; case SSL3_ST_CW_FINISHED_B : case SSL3_ST_SW_FINISHED_B : str = "SSLv3 write finished B" ; break ; case SSL3_ST_CR_CHANGE_A : case SSL3_ST_SR_CHANGE_A : str = "SSLv3 read change cipher spec A" ; break ; case SSL3_ST_CR_CHANGE_B : case SSL3_ST_SR_CHANGE_B : str = "SSLv3 read change cipher spec B" ; break ; case SSL3_ST_CR_FINISHED_A : case SSL3_ST_SR_FINISHED_A : str = "SSLv3 read finished A" ; break ; case SSL3_ST_CR_FINISHED_B : case SSL3_ST_SR_FINISHED_B : str = "SSLv3 read finished B" ; break ; case SSL3_ST_CW_FLUSH : case SSL3_ST_SW_FLUSH : str = "SSLv3 flush data" ; break ; case SSL3_ST_SR_CLNT_HELLO_A : str = "SSLv3 read client hello A" ; break ; case SSL3_ST_SR_CLNT_HELLO_B : str = "SSLv3 read client hello B" ; break ; case SSL3_ST_SR_CLNT_HELLO_C : str = "SSLv3 read client hello C" ; break ; case SSL3_ST_SW_HELLO_REQ_A : str = "SSLv3 write hello request A" ; break ; case SSL3_ST_SW_HELLO_REQ_B : str = "SSLv3 write hello request B" ; break ; case SSL3_ST_SW_HELLO_REQ_C : str = "SSLv3 write hello request C" ; break ; case SSL3_ST_SW_SRVR_HELLO_A : str = "SSLv3 write server hello A" ; break ; case SSL3_ST_SW_SRVR_HELLO_B : str = "SSLv3 write server hello B" ; break ; case SSL3_ST_SW_CERT_A : str = "SSLv3 write certificate A" ; break ; case SSL3_ST_SW_CERT_B : str = "SSLv3 write certificate B" ; break ; case SSL3_ST_SW_KEY_EXCH_A : str = "SSLv3 write key exchange A" ; break ; case SSL3_ST_SW_KEY_EXCH_B : str = "SSLv3 write key exchange B" ; break ; case SSL3_ST_SW_CERT_REQ_A : str = "SSLv3 write certificate request A" ; break ; case SSL3_ST_SW_CERT_REQ_B : str = "SSLv3 write certificate request B" ; break ; case SSL3_ST_SW_SESSION_TICKET_A : str = "SSLv3 write session ticket A" ; break ; case SSL3_ST_SW_SESSION_TICKET_B : str = "SSLv3 write session ticket B" ; break ; case SSL3_ST_SW_SRVR_DONE_A : str = "SSLv3 write server done A" ; break ; case SSL3_ST_SW_SRVR_DONE_B : str = "SSLv3 write server done B" ; break ; case SSL3_ST_SR_CERT_A : str = "SSLv3 read client certificate A" ; break ; case SSL3_ST_SR_CERT_B : str = "SSLv3 read client certificate B" ; break ; case SSL3_ST_SR_KEY_EXCH_A : str = "SSLv3 read client key exchange A" ; break ; case SSL3_ST_SR_KEY_EXCH_B : str = "SSLv3 read client key exchange B" ; break ; case SSL3_ST_SR_CERT_VRFY_A : str = "SSLv3 read certificate verify A" ; break ; case SSL3_ST_SR_CERT_VRFY_B : str = "SSLv3 read certificate verify B" ; break ; # endif case SSL23_ST_CW_CLNT_HELLO_A : str = "SSLv2/v3 write client hello A" ; break ; case SSL23_ST_CW_CLNT_HELLO_B : str = "SSLv2/v3 write client hello B" ; break ; case SSL23_ST_CR_SRVR_HELLO_A : str = "SSLv2/v3 read server hello A" ; break ; case SSL23_ST_CR_SRVR_HELLO_B : str = "SSLv2/v3 read server hello B" ; break ; case SSL23_ST_SR_CLNT_HELLO_A : str = "SSLv2/v3 read client hello A" ; break ; case SSL23_ST_SR_CLNT_HELLO_B : str = "SSLv2/v3 read client hello B" ; break ; case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_A : str = "DTLS1 read hello verify request A" ; break ; case DTLS1_ST_CR_HELLO_VERIFY_REQUEST_B : str = "DTLS1 read hello verify request B" ; break ; case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_A : str = "DTLS1 write hello verify request A" ; break ; case DTLS1_ST_SW_HELLO_VERIFY_REQUEST_B : str = "DTLS1 write hello verify request B" ; break ; default : str = "unknown state" ; break ; } return ( str ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void dequant_lsp10r ( GetBitContext * gb , double * i_lsps , const double * old , double * a1 , double * a2 , int q_mode ) { static const uint16_t vec_sizes [ 3 ] = { 128 , 64 , 64 } ; static const double mul_lsf [ 3 ] = { 2.5807601174e-3 , 1.2354460219e-3 , 1.1763821673e-3 } ; static const double base_lsf [ 3 ] = { M_PI * - 1.07448e-1 , M_PI * - 5.2706e-2 , M_PI * - 5.1634e-2 } ; const float ( * ipol_tab ) [ 2 ] [ 10 ] = q_mode ? wmavoice_lsp10_intercoeff_b : wmavoice_lsp10_intercoeff_a ; uint16_t interpol , v [ 3 ] ; int n ; dequant_lsp10i ( gb , i_lsps ) ; interpol = get_bits ( gb , 5 ) ; v [ 0 ] = get_bits ( gb , 7 ) ; v [ 1 ] = get_bits ( gb , 6 ) ; v [ 2 ] = get_bits ( gb , 6 ) ; for ( n = 0 ; n < 10 ; n ++ ) { double delta = old [ n ] - i_lsps [ n ] ; a1 [ n ] = ipol_tab [ interpol ] [ 0 ] [ n ] * delta + i_lsps [ n ] ; a1 [ 10 + n ] = ipol_tab [ interpol ] [ 1 ] [ n ] * delta + i_lsps [ n ] ; } dequant_lsps ( a2 , 20 , v , vec_sizes , 3 , wmavoice_dq_lsp10r , mul_lsf , base_lsf ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void proto_register_aptx ( void ) { static hf_register_info hf [ ] = { { & hf_aptx_data , { "Data" , "aptx.data" , FT_BYTES , BASE_NONE , NULL , 0x00 , NULL , HFILL } } , { & hf_aptx_cumulative_frame_duration , { "Cumulative Frame Duration" , "aptx.cumulative_frame_duration" , FT_DOUBLE , BASE_NONE | BASE_UNIT_STRING , & units_milliseconds , 0x00 , NULL , HFILL } } , { & hf_aptx_delta_time , { "Delta time" , "aptx.delta_time" , FT_DOUBLE , BASE_NONE | BASE_UNIT_STRING , & units_milliseconds , 0x00 , NULL , HFILL } } , { & hf_aptx_avrcp_song_position , { "AVRCP Song Position" , "aptx.avrcp_song_position" , FT_DOUBLE , BASE_NONE | BASE_UNIT_STRING , & units_milliseconds , 0x00 , NULL , HFILL } } , { & hf_aptx_delta_time_from_the_beginning , { "Delta time from the beginning" , "aptx.delta_time_from_the_beginning" , FT_DOUBLE , BASE_NONE | BASE_UNIT_STRING , & units_milliseconds , 0x00 , NULL , HFILL } } , { & hf_aptx_cumulative_duration , { "Cumulative Music Duration" , "aptx.cumulative_music_duration" , FT_DOUBLE , BASE_NONE | BASE_UNIT_STRING , & units_milliseconds , 0x00 , NULL , HFILL } } , { & hf_aptx_diff , { "Diff" , "aptx.diff" , FT_DOUBLE , BASE_NONE | BASE_UNIT_STRING , & units_milliseconds , 0x00 , NULL , HFILL } } , } ; static gint * ett [ ] = { & ett_aptx } ; proto_aptx = proto_register_protocol ( "APT-X Codec" , "APT-X" , "aptx" ) ; proto_register_field_array ( proto_aptx , hf , array_length ( hf ) ) ; proto_register_subtree_array ( ett , array_length ( ett ) ) ; aptx_handle = register_dissector ( "aptx" , dissect_aptx , proto_aptx ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static VALUE decode_int ( unsigned char * der , long length ) { ASN1_INTEGER * ai ; const unsigned char * p ; VALUE ret ; int status = 0 ; p = der ; if ( ! ( ai = d2i_ASN1_INTEGER ( NULL , & p , length ) ) ) ossl_raise ( eASN1Error , NULL ) ; ret = rb_protect ( ( VALUE ( * ) ( VALUE ) ) asn1integer_to_num , ( VALUE ) ai , & status ) ; ASN1_INTEGER_free ( ai ) ; if ( status ) rb_jump_tag ( status ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( DownloadExtensionTest , DownloadExtensionTest_OnDeterminingFilename_Override ) { GoOnTheRecord ( ) ; LoadExtension ( "downloads_split" ) ; AddFilenameDeterminer ( ) ; ASSERT_TRUE ( StartEmbeddedTestServer ( ) ) ; std : : string download_url = embedded_test_server ( ) -> GetURL ( "/slow?0" ) . spec ( ) ; std : : unique_ptr < base : : Value > result ( RunFunctionAndReturnResult ( new DownloadsDownloadFunction ( ) , base : : StringPrintf ( "[{ \"url\": \"%s\"} ]" , download_url . c_str ( ) ) ) ) ; ASSERT_TRUE ( result . get ( ) ) ; int result_id = - 1 ; ASSERT_TRUE ( result -> GetAsInteger ( & result_id ) ) ; DownloadItem * item = GetCurrentManager ( ) -> GetDownload ( result_id ) ; ASSERT_TRUE ( item ) ; ScopedCancellingItem canceller ( item ) ; ASSERT_EQ ( download_url , item -> GetOriginalUrl ( ) . spec ( ) ) ; ASSERT_TRUE ( WaitFor ( downloads : : OnCreated : : kEventName , base : : StringPrintf ( "[{ \"danger\": \"safe\"," " \"incognito\": false," " \"id\": %d," " \"mime\": \"text/plain\"," " \"paused\": false," " \"url\": \"%s\"} ]" , result_id , download_url . c_str ( ) ) ) ) ; ASSERT_TRUE ( WaitFor ( downloads : : OnDeterminingFilename : : kEventName , base : : StringPrintf ( "[{ \"id\": %d," " \"filename\":\"slow.txt\"} ]" , result_id ) ) ) ; ASSERT_TRUE ( item -> GetTargetFilePath ( ) . empty ( ) ) ; ASSERT_EQ ( DownloadItem : : IN_PROGRESS , item -> GetState ( ) ) ; std : : string error ; ASSERT_TRUE ( ExtensionDownloadsEventRouter : : DetermineFilename ( browser ( ) -> profile ( ) , false , GetExtensionId ( ) , result_id , base : : FilePath ( ) , downloads : : FILENAME_CONFLICT_ACTION_UNIQUIFY , & error ) ) ; EXPECT_EQ ( "" , error ) ; ASSERT_TRUE ( WaitFor ( downloads : : OnChanged : : kEventName , base : : StringPrintf ( "[{ \"id\": %d," " \"filename\": { " " \"previous\": \"\"," " \"current\": \"%s\"} } ]" , result_id , GetFilename ( "slow.txt" ) . c_str ( ) ) ) ) ; ASSERT_TRUE ( WaitFor ( downloads : : OnChanged : : kEventName , base : : StringPrintf ( "[{ \"id\": %d," " \"state\": { " " \"previous\": \"in_progress\"," " \"current\": \"complete\"} } ]" , result_id ) ) ) ; result . reset ( RunFunctionAndReturnResult ( new DownloadsDownloadFunction ( ) , base : : StringPrintf ( "[{ \"url\": \"%s\"} ]" , download_url . c_str ( ) ) ) ) ; ASSERT_TRUE ( result . get ( ) ) ; result_id = - 1 ; ASSERT_TRUE ( result -> GetAsInteger ( & result_id ) ) ; item = GetCurrentManager ( ) -> GetDownload ( result_id ) ; ASSERT_TRUE ( item ) ; ScopedCancellingItem canceller2 ( item ) ; ASSERT_EQ ( download_url , item -> GetOriginalUrl ( ) . spec ( ) ) ; ASSERT_TRUE ( WaitFor ( downloads : : OnCreated : : kEventName , base : : StringPrintf ( "[{ \"danger\": \"safe\"," " \"incognito\": false," " \"id\": %d," " \"mime\": \"text/plain\"," " \"paused\": false," " \"url\": \"%s\"} ]" , result_id , download_url . c_str ( ) ) ) ) ; ASSERT_TRUE ( WaitFor ( downloads : : OnDeterminingFilename : : kEventName , base : : StringPrintf ( "[{ \"id\": %d," " \"filename\":\"slow.txt\"} ]" , result_id ) ) ) ; ASSERT_TRUE ( item -> GetTargetFilePath ( ) . empty ( ) ) ; ASSERT_EQ ( DownloadItem : : IN_PROGRESS , item -> GetState ( ) ) ; error = "" ; ASSERT_TRUE ( ExtensionDownloadsEventRouter : : DetermineFilename ( browser ( ) -> profile ( ) , false , GetExtensionId ( ) , result_id , base : : FilePath ( FILE_PATH_LITERAL ( "foo" ) ) , downloads : : FILENAME_CONFLICT_ACTION_OVERWRITE , & error ) ) ; EXPECT_EQ ( "" , error ) ; ASSERT_TRUE ( WaitFor ( downloads : : OnChanged : : kEventName , base : : StringPrintf ( "[{ \"id\": %d," " \"filename\": { " " \"previous\": \"\"," " \"current\": \"%s\"} } ]" , result_id , GetFilename ( "foo" ) . c_str ( ) ) ) ) ; ASSERT_TRUE ( WaitFor ( downloads : : OnChanged : : kEventName , base : : StringPrintf ( "[{ \"id\": %d," " \"state\": { " " \"previous\": \"in_progress\"," " \"current\": \"complete\"} } ]" , result_id ) ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void isofile_init_entry_list ( struct iso9660 * iso9660 ) { iso9660 -> all_file_list . first = NULL ; iso9660 -> all_file_list . last = & ( iso9660 -> all_file_list . first ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static TRBCCode xhci_alloc_device_streams ( XHCIState * xhci , unsigned int slotid , uint32_t epmask ) { XHCIEPContext * epctxs [ 30 ] ; USBEndpoint * eps [ 30 ] ; int i , r , nr_eps , req_nr_streams , dev_max_streams ; nr_eps = xhci_epmask_to_eps_with_streams ( xhci , slotid , epmask , epctxs , eps ) ; if ( nr_eps == 0 ) { return CC_SUCCESS ; } req_nr_streams = epctxs [ 0 ] -> nr_pstreams ; dev_max_streams = eps [ 0 ] -> max_streams ; for ( i = 1 ; i < nr_eps ; i ++ ) { if ( epctxs [ i ] -> nr_pstreams != req_nr_streams ) { FIXME ( "guest streams config not identical for all eps" ) ; return CC_RESOURCE_ERROR ; } if ( eps [ i ] -> max_streams != dev_max_streams ) { FIXME ( "device streams config not identical for all eps" ) ; return CC_RESOURCE_ERROR ; } } if ( req_nr_streams > dev_max_streams ) { req_nr_streams = dev_max_streams ; } r = usb_device_alloc_streams ( eps [ 0 ] -> dev , eps , nr_eps , req_nr_streams ) ; if ( r != 0 ) { DPRINTF ( "xhci: alloc streams failed\n" ) ; return CC_RESOURCE_ERROR ; } return CC_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
VALUE rb_dlhandle_sym ( VALUE self , VALUE sym ) { void ( * func ) ( ) ; struct dl_handle * dlhandle ; void * handle ; const char * name ; const char * err ; int i ; # if defined ( HAVE_DLERROR ) # define CHECK_DLERROR if ( err = dlerror ( ) ) { func = 0 ; } # else # define CHECK_DLERROR # endif rb_secure ( 2 ) ; name = StringValuePtr ( sym ) ; Data_Get_Struct ( self , struct dl_handle , dlhandle ) ; if ( ! dlhandle -> open ) { rb_raise ( rb_eDLError , "closed handle" ) ; } handle = dlhandle -> ptr ; func = dlsym ( handle , name ) ; CHECK_DLERROR ; # if defined ( FUNC_STDCALL ) if ( ! func ) { int len = strlen ( name ) ; char * name_n ; # if defined ( __CYGWIN__ ) || defined ( _WIN32 ) || defined ( __MINGW32__ ) { char * name_a = ( char * ) xmalloc ( len + 2 ) ; strcpy ( name_a , name ) ; name_n = name_a ; name_a [ len ] = 'A' ; name_a [ len + 1 ] = '\0' ; func = dlsym ( handle , name_a ) ; CHECK_DLERROR ; if ( func ) goto found ; name_n = xrealloc ( name_a , len + 6 ) ; } # else name_n = ( char * ) xmalloc ( len + 6 ) ; # endif memcpy ( name_n , name , len ) ; name_n [ len ++ ] = '@' ; for ( i = 0 ; i < 256 ; i += 4 ) { sprintf ( name_n + len , "%d" , i ) ; func = dlsym ( handle , name_n ) ; CHECK_DLERROR ; if ( func ) break ; } if ( func ) goto found ; name_n [ len - 1 ] = 'A' ; name_n [ len ++ ] = '@' ; for ( i = 0 ; i < 256 ; i += 4 ) { sprintf ( name_n + len , "%d" , i ) ; func = dlsym ( handle , name_n ) ; CHECK_DLERROR ; if ( func ) break ; } found : xfree ( name_n ) ; } # endif if ( ! func ) { rb_raise ( rb_eDLError , "unknown symbol \"%s\"" , name ) ; } return PTR2NUM ( func ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int allocate_buffers ( ALACContext * alac ) { int ch ; int buf_size = alac -> max_samples_per_frame * sizeof ( int32_t ) ; for ( ch = 0 ; ch < FFMIN ( alac -> channels , 2 ) ; ch ++ ) { FF_ALLOC_OR_GOTO ( alac -> avctx , alac -> predict_error_buffer [ ch ] , buf_size , buf_alloc_fail ) ; if ( alac -> sample_size == 16 ) { FF_ALLOC_OR_GOTO ( alac -> avctx , alac -> output_samples_buffer [ ch ] , buf_size , buf_alloc_fail ) ; } FF_ALLOC_OR_GOTO ( alac -> avctx , alac -> extra_bits_buffer [ ch ] , buf_size , buf_alloc_fail ) ; } return 0 ; buf_alloc_fail : alac_decode_close ( alac -> avctx ) ; return AVERROR ( ENOMEM ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void fn_print_char ( netdissect_options * ndo , u_char c ) { 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 ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int ohci_port_set_if_connected ( OHCIState * ohci , int i , uint32_t val ) { int ret = 1 ; if ( val == 0 ) return 0 ; if ( ! ( ohci -> rhport [ i ] . ctrl & OHCI_PORT_CCS ) ) { ohci -> rhport [ i ] . ctrl |= OHCI_PORT_CSC ; if ( ohci -> rhstatus & OHCI_RHS_DRWE ) { } return 0 ; } if ( ohci -> rhport [ i ] . ctrl & val ) ret = 0 ; ohci -> rhport [ i ] . ctrl |= val ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
double double_from_string_with_check ( CHARSET_INFO * cs , const char * cptr , const char * end ) { int error ; char * end_of_num = ( char * ) end ; double tmp ; tmp = my_strntod ( cs , ( char * ) cptr , end - cptr , & end_of_num , & error ) ; if ( error || ( end != end_of_num && ! check_if_only_end_space ( cs , end_of_num , end ) ) ) { ErrConvString err ( cptr , end - cptr , cs ) ; push_warning_printf ( current_thd , MYSQL_ERROR : : WARN_LEVEL_WARN , ER_TRUNCATED_WRONG_VALUE , ER ( ER_TRUNCATED_WRONG_VALUE ) , "DOUBLE" , err . ptr ( ) ) ; } return tmp ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ulmbcs_byte_t FindLMBCSLocale ( const char * LocaleID ) { const struct _LocaleLMBCSGrpMap * pTable = LocaleLMBCSGrpMap ; if ( ( ! LocaleID ) || ( ! * LocaleID ) ) { return 0 ; } while ( pTable -> LocaleID ) { if ( * pTable -> LocaleID == * LocaleID ) { if ( uprv_strncmp ( pTable -> LocaleID , LocaleID , strlen ( pTable -> LocaleID ) ) == 0 ) return pTable -> OptGroup ; } else if ( * pTable -> LocaleID > * LocaleID ) break ; pTable ++ ; } return ULMBCS_GRP_L1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_SEQUENCE_OF_Endpoint ( 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_SEQUENCE_OF_Endpoint , SEQUENCE_OF_Endpoint_sequence_of ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dct_unquantize_mpeg2_intra_bitexact ( MpegEncContext * s , int16_t * block , int n , int qscale ) { int i , level , nCoeffs ; const uint16_t * quant_matrix ; int sum = - 1 ; if ( s -> alternate_scan ) nCoeffs = 63 ; else nCoeffs = s -> block_last_index [ n ] ; if ( n < 4 ) block [ 0 ] = block [ 0 ] * s -> y_dc_scale ; else block [ 0 ] = block [ 0 ] * s -> c_dc_scale ; quant_matrix = s -> intra_matrix ; for ( i = 1 ; i <= nCoeffs ; i ++ ) { int j = s -> intra_scantable . permutated [ i ] ; level = block [ j ] ; if ( level ) { if ( level < 0 ) { level = - level ; level = ( int ) ( level * qscale * quant_matrix [ j ] ) >> 3 ; level = - level ; } else { level = ( int ) ( level * qscale * quant_matrix [ j ] ) >> 3 ; } block [ j ] = level ; sum += level ; } } block [ 63 ] ^= sum & 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static PyObject * string_splitlines ( PyStringObject * self , PyObject * args ) { int keepends = 0 ; if ( ! PyArg_ParseTuple ( args , "|i:splitlines" , & keepends ) ) return NULL ; return stringlib_splitlines ( ( PyObject * ) self , PyString_AS_STRING ( self ) , PyString_GET_SIZE ( self ) , keepends ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( TemplateURLTest , ReplaceCurrentPageUrl ) { struct TestData { const base : : string16 search_term ; const std : : string current_page_url ; const std : : string url ; const std : : string expected_result ; } test_data [ ] = { { ASCIIToUTF16 ( "foo" ) , "http://www.google.com/" , "{ google:baseURL} ?{ searchTerms} &{ google:currentPageUrl} " , "http://www.google.com/?foo&url=http%3A%2F%2Fwww.google.com%2F&" } , { ASCIIToUTF16 ( "foo" ) , "" , "{ google:baseURL} ?{ searchTerms} &{ google:currentPageUrl} " , "http://www.google.com/?foo&" } , { ASCIIToUTF16 ( "foo" ) , "http://g.com/+-/*&=" , "{ google:baseURL} ?{ searchTerms} &{ google:currentPageUrl} " , "http://www.google.com/?foo&url=http%3A%2F%2Fg.com%2F%2B-%2F*%26%3D&" } , } ; TemplateURLData data ; data . input_encodings . push_back ( "UTF-8" ) ; for ( size_t i = 0 ; i < arraysize ( test_data ) ; ++ i ) { data . SetURL ( test_data [ i ] . url ) ; TemplateURL url ( data ) ; EXPECT_TRUE ( url . url_ref ( ) . IsValid ( search_terms_data_ ) ) ; ASSERT_TRUE ( url . url_ref ( ) . SupportsReplacement ( search_terms_data_ ) ) ; TemplateURLRef : : SearchTermsArgs search_terms_args ( test_data [ i ] . search_term ) ; search_terms_args . current_page_url = test_data [ i ] . current_page_url ; GURL result ( url . url_ref ( ) . ReplaceSearchTerms ( search_terms_args , search_terms_data_ ) ) ; ASSERT_TRUE ( result . is_valid ( ) ) ; EXPECT_EQ ( test_data [ i ] . expected_result , result . spec ( ) ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int decrypt_key_data ( krb5_context context , int n_key_data , krb5_key_data * key_data , krb5_keyblock * * keyblocks , int * n_keys ) { krb5_keyblock * keys ; int ret , i ; keys = ( krb5_keyblock * ) malloc ( n_key_data * sizeof ( krb5_keyblock ) ) ; if ( keys == NULL ) return ENOMEM ; memset ( keys , 0 , n_key_data * sizeof ( krb5_keyblock ) ) ; for ( i = 0 ; i < n_key_data ; i ++ ) { ret = krb5_dbe_decrypt_key_data ( context , NULL , & key_data [ i ] , & keys [ i ] , NULL ) ; if ( ret ) { for ( ; i >= 0 ; i -- ) { if ( keys [ i ] . contents ) { memset ( keys [ i ] . contents , 0 , keys [ i ] . length ) ; free ( keys [ i ] . contents ) ; } } memset ( keys , 0 , n_key_data * sizeof ( krb5_keyblock ) ) ; free ( keys ) ; return ret ; } } * keyblocks = keys ; if ( n_keys ) * n_keys = n_key_data ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void callOnErr ( const relpTcp_t * __restrict__ const pThis , char * __restrict__ const emsg , const relpRetVal ecode ) { char objinfo [ 1024 ] ; pThis -> pEngine -> dbgprint ( "librelp: generic error: ecode %d, " "emsg '%s'\n" , ecode , emsg ) ; if ( pThis -> pEngine -> onErr != NULL ) { if ( pThis -> pSrv == NULL ) { snprintf ( objinfo , sizeof ( objinfo ) , "conn to srvr %s:%s" , pThis -> pClt -> pSess -> srvAddr , pThis -> pClt -> pSess -> srvPort ) ; } else if ( pThis -> pRemHostIP == NULL ) { snprintf ( objinfo , sizeof ( objinfo ) , "lstn %s" , pThis -> pSrv -> pLstnPort ) ; } else { snprintf ( objinfo , sizeof ( objinfo ) , "lstn %s: conn to clt %s/%s" , pThis -> pSrv -> pLstnPort , pThis -> pRemHostIP , pThis -> pRemHostName ) ; } objinfo [ sizeof ( objinfo ) - 1 ] = '\0' ; pThis -> pEngine -> onErr ( pThis -> pUsr , objinfo , emsg , ecode ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void ps2_common_post_load ( PS2State * s ) { PS2Queue * q = & s -> queue ; uint8_t i , size ; uint8_t tmp_data [ PS2_QUEUE_SIZE ] ; size = ( q -> count < 0 || q -> count > PS2_QUEUE_SIZE ) ? 0 : q -> count ; for ( i = 0 ; i < size ; i ++ ) { if ( q -> rptr < 0 || q -> rptr >= sizeof ( q -> data ) ) { q -> rptr = 0 ; } tmp_data [ i ] = q -> data [ q -> rptr ++ ] ; } memcpy ( q -> data , tmp_data , size ) ; q -> rptr = 0 ; q -> wptr = size ; q -> count = size ; s -> update_irq ( s -> update_arg , q -> count != 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
gpg_error_t keydb_search_fpr ( KEYDB_HANDLE hd , const byte * fpr ) { KEYDB_SEARCH_DESC desc ; memset ( & desc , 0 , sizeof desc ) ; desc . mode = KEYDB_SEARCH_MODE_FPR ; memcpy ( desc . u . fpr , fpr , MAX_FINGERPRINT_LEN ) ; return keydb_search ( hd , & desc , 1 , NULL ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int pfkey_send_acquire ( struct xfrm_state * x , struct xfrm_tmpl * t , struct xfrm_policy * xp ) { struct sk_buff * skb ; struct sadb_msg * hdr ; struct sadb_address * addr ; struct sadb_x_policy * pol ; int sockaddr_size ; int size ; struct sadb_x_sec_ctx * sec_ctx ; struct xfrm_sec_ctx * xfrm_ctx ; int ctx_size = 0 ; sockaddr_size = pfkey_sockaddr_size ( x -> props . family ) ; if ( ! sockaddr_size ) return - EINVAL ; size = sizeof ( struct sadb_msg ) + ( sizeof ( struct sadb_address ) * 2 ) + ( sockaddr_size * 2 ) + sizeof ( struct sadb_x_policy ) ; if ( x -> id . proto == IPPROTO_AH ) size += count_ah_combs ( t ) ; else if ( x -> id . proto == IPPROTO_ESP ) size += count_esp_combs ( t ) ; if ( ( xfrm_ctx = x -> security ) ) { ctx_size = PFKEY_ALIGN8 ( xfrm_ctx -> ctx_len ) ; size += sizeof ( struct sadb_x_sec_ctx ) + ctx_size ; } skb = alloc_skb ( size + 16 , GFP_ATOMIC ) ; if ( skb == NULL ) return - ENOMEM ; hdr = ( struct sadb_msg * ) skb_put ( skb , sizeof ( struct sadb_msg ) ) ; hdr -> sadb_msg_version = PF_KEY_V2 ; hdr -> sadb_msg_type = SADB_ACQUIRE ; hdr -> sadb_msg_satype = pfkey_proto2satype ( x -> id . proto ) ; hdr -> sadb_msg_len = size / sizeof ( uint64_t ) ; hdr -> sadb_msg_errno = 0 ; hdr -> sadb_msg_reserved = 0 ; hdr -> sadb_msg_seq = x -> km . seq = get_acqseq ( ) ; hdr -> sadb_msg_pid = 0 ; addr = ( struct sadb_address * ) skb_put ( skb , sizeof ( struct sadb_address ) + sockaddr_size ) ; addr -> sadb_address_len = ( sizeof ( struct sadb_address ) + sockaddr_size ) / sizeof ( uint64_t ) ; addr -> sadb_address_exttype = SADB_EXT_ADDRESS_SRC ; addr -> sadb_address_proto = 0 ; addr -> sadb_address_reserved = 0 ; addr -> sadb_address_prefixlen = pfkey_sockaddr_fill ( & x -> props . saddr , 0 , ( struct sockaddr * ) ( addr + 1 ) , x -> props . family ) ; if ( ! addr -> sadb_address_prefixlen ) BUG ( ) ; addr = ( struct sadb_address * ) skb_put ( skb , sizeof ( struct sadb_address ) + sockaddr_size ) ; addr -> sadb_address_len = ( sizeof ( struct sadb_address ) + sockaddr_size ) / sizeof ( uint64_t ) ; addr -> sadb_address_exttype = SADB_EXT_ADDRESS_DST ; addr -> sadb_address_proto = 0 ; addr -> sadb_address_reserved = 0 ; addr -> sadb_address_prefixlen = pfkey_sockaddr_fill ( & x -> id . daddr , 0 , ( struct sockaddr * ) ( addr + 1 ) , x -> props . family ) ; if ( ! addr -> sadb_address_prefixlen ) BUG ( ) ; pol = ( struct sadb_x_policy * ) skb_put ( skb , sizeof ( struct sadb_x_policy ) ) ; pol -> sadb_x_policy_len = sizeof ( struct sadb_x_policy ) / sizeof ( uint64_t ) ; pol -> sadb_x_policy_exttype = SADB_X_EXT_POLICY ; pol -> sadb_x_policy_type = IPSEC_POLICY_IPSEC ; pol -> sadb_x_policy_dir = XFRM_POLICY_OUT + 1 ; pol -> sadb_x_policy_id = xp -> index ; if ( x -> id . proto == IPPROTO_AH ) dump_ah_combs ( skb , t ) ; else if ( x -> id . proto == IPPROTO_ESP ) dump_esp_combs ( skb , t ) ; if ( xfrm_ctx ) { sec_ctx = ( struct sadb_x_sec_ctx * ) skb_put ( skb , sizeof ( struct sadb_x_sec_ctx ) + ctx_size ) ; sec_ctx -> sadb_x_sec_len = ( sizeof ( struct sadb_x_sec_ctx ) + ctx_size ) / sizeof ( uint64_t ) ; sec_ctx -> sadb_x_sec_exttype = SADB_X_EXT_SEC_CTX ; sec_ctx -> sadb_x_ctx_doi = xfrm_ctx -> ctx_doi ; sec_ctx -> sadb_x_ctx_alg = xfrm_ctx -> ctx_alg ; sec_ctx -> sadb_x_ctx_len = xfrm_ctx -> ctx_len ; memcpy ( sec_ctx + 1 , xfrm_ctx -> ctx_str , xfrm_ctx -> ctx_len ) ; } return pfkey_broadcast ( skb , GFP_ATOMIC , BROADCAST_REGISTERED , NULL , xs_net ( x ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int FLTIsNumeric ( const char * pszValue ) { if ( pszValue != NULL && * pszValue != '\0' && ! isspace ( * pszValue ) ) { # if defined ( _WIN32 ) && ! defined ( __CYGWIN__ ) int i = 0 , nLength = 0 , bString = 0 ; nLength = strlen ( pszValue ) ; for ( i = 0 ; i < nLength ; i ++ ) { if ( i == 0 ) { if ( ! isdigit ( pszValue [ i ] ) && pszValue [ i ] != '-' ) { bString = 1 ; break ; } } else if ( ! isdigit ( pszValue [ i ] ) && pszValue [ i ] != '.' ) { bString = 1 ; break ; } } if ( ! bString ) return MS_TRUE ; # else char * p ; strtod ( pszValue , & p ) ; if ( p != pszValue && * p == '\0' ) return MS_TRUE ; # endif } return MS_FALSE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
MIMEField * mime_field_create_named ( HdrHeap * heap , MIMEHdrImpl * mh , const char * name , int length ) { MIMEField * field = mime_field_create ( heap , mh ) ; int field_name_wks_idx = hdrtoken_tokenize ( name , length ) ; mime_field_name_set ( heap , mh , field , field_name_wks_idx , name , length , true ) ; return field ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int decode_pal ( MSS12Context * ctx , ArithCoder * acoder ) { int i , ncol , r , g , b ; uint32_t * pal = ctx -> pal + 256 - ctx -> free_colours ; if ( ! ctx -> free_colours ) return 0 ; ncol = arith_get_number ( acoder , ctx -> free_colours + 1 ) ; for ( i = 0 ; i < ncol ; i ++ ) { r = arith_get_bits ( acoder , 8 ) ; g = arith_get_bits ( acoder , 8 ) ; b = arith_get_bits ( acoder , 8 ) ; * pal ++ = ( r << 16 ) | ( g << 8 ) | b ; } return ! ! ncol ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static afs_int32 nameToID ( struct rx_call * call , namelist * aname , idlist * aid ) { afs_int32 code ; struct ubik_trans * tt ; afs_int32 i ; int size ; int count = 0 ; aid -> idlist_len = 0 ; aid -> idlist_val = NULL ; size = aname -> namelist_len ; if ( size == 0 ) return 0 ; if ( size < 0 ) return PRTOOMANY ; aid -> idlist_val = ( afs_int32 * ) malloc ( size * sizeof ( afs_int32 ) ) ; if ( ! aid -> idlist_val ) return PRNOMEM ; code = Initdb ( ) ; if ( code != PRSUCCESS ) return code ; code = ubik_BeginTransReadAny ( dbase , UBIK_READTRANS , & tt ) ; if ( code ) return code ; code = ubik_SetLock ( tt , 1 , 1 , LOCKREAD ) ; if ( code ) ABORT_WITH ( tt , code ) ; code = read_DbHeader ( tt ) ; if ( code ) ABORT_WITH ( tt , code ) ; for ( i = 0 ; i < aname -> namelist_len ; i ++ ) { char vname [ 256 ] ; char * nameinst , * cell ; strncpy ( vname , aname -> namelist_val [ i ] , sizeof ( vname ) ) ; vname [ sizeof ( vname ) - 1 ] = '\0' ; nameinst = vname ; cell = strchr ( vname , '@' ) ; if ( cell ) { * cell = '\0' ; cell ++ ; } if ( cell && afs_is_foreign_ticket_name ( nameinst , NULL , cell , pr_realmName ) ) code = NameToID ( tt , aname -> namelist_val [ i ] , & aid -> idlist_val [ i ] ) ; else code = NameToID ( tt , nameinst , & aid -> idlist_val [ i ] ) ; if ( code != PRSUCCESS ) aid -> idlist_val [ i ] = ANONYMOUSID ; osi_audit ( PTS_NmToIdEvent , code , AUD_STR , aname -> namelist_val [ i ] , AUD_ID , aid -> idlist_val [ i ] , AUD_END ) ; ViceLog ( 125 , ( "PTS_NameToID: code %d aname %s aid %d\n" , code , aname -> namelist_val [ i ] , aid -> idlist_val [ i ] ) ) ; if ( count ++ > 50 ) { # ifndef AFS_PTHREAD_ENV IOMGR_Poll ( ) ; # endif count = 0 ; } } aid -> idlist_len = aname -> namelist_len ; code = ubik_EndTrans ( tt ) ; if ( code ) return code ; return PRSUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int64_t TSHttpTxnClientReqBodyBytesGet ( TSHttpTxn txnp ) { sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ; HttpSM * sm = ( HttpSM * ) txnp ; return sm -> client_request_body_bytes ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new ( sk_ ## t1 ## _compfunc compare ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new ( ( OPENSSL_sk_compfunc ) compare ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_null ( void ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_null ( ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_reserve ( sk_ ## t1 ## _compfunc compare , int n ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_reserve ( ( OPENSSL_sk_compfunc ) compare , n ) ; } static ossl_inline int sk_ ## t1 ## _reserve ( STACK_OF ( t1 ) * sk , int n ) { return OPENSSL_sk_reserve ( ( OPENSSL_STACK * ) sk , n ) ; } 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 ) typedef void * OPENSSL_BLOCK ; DEFINE_SPECIAL_STACK_OF ( OPENSSL_BLOCK , void )
1True
Categorize the following code snippet as vulnerable or not. True or False
static size_t get_internal_buffer ( const gcry_sexp_t list , size_t * r_off ) { const unsigned char * p ; DATALEN n ; int type ; int level = 0 ; * r_off = 0 ; if ( list ) { p = list -> d ; while ( ( type = * p ) != ST_STOP ) { p ++ ; if ( type == ST_DATA ) { memcpy ( & n , p , sizeof n ) ; p += sizeof n + n ; } else if ( type == ST_OPEN ) { if ( ! level ) * r_off = ( p - 1 ) - list -> d ; level ++ ; } else if ( type == ST_CLOSE ) { level -- ; if ( ! level ) return p - list -> d ; } } } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const float * do_pitchfilter ( float memory [ 303 ] , const float v_in [ 160 ] , const float gain [ 4 ] , const uint8_t * lag , const uint8_t pfrac [ 4 ] ) { int i , j ; float * v_lag , * v_out ; const float * v_len ; v_out = memory + 143 ; for ( i = 0 ; i < 4 ; i ++ ) { if ( gain [ i ] ) { v_lag = memory + 143 + 40 * i - lag [ i ] ; for ( v_len = v_in + 40 ; v_in < v_len ; v_in ++ ) { if ( pfrac [ i ] ) { for ( j = 0 , * v_out = 0. ; j < 4 ; j ++ ) * v_out += qcelp_hammsinc_table [ j ] * ( v_lag [ j - 4 ] + v_lag [ 3 - j ] ) ; } else * v_out = * v_lag ; * v_out = * v_in + gain [ i ] * * v_out ; v_lag ++ ; v_out ++ ; } } else { memcpy ( v_out , v_in , 40 * sizeof ( float ) ) ; v_in += 40 ; v_out += 40 ; } } memmove ( memory , memory + 160 , 143 * sizeof ( float ) ) ; return memory + 143 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
proto_item * proto_tree_add_uint_format_value ( proto_tree * tree , int hfindex , tvbuff_t * tvb , gint start , gint length , guint32 value , const char * format , ... ) { proto_item * pi ; va_list ap ; pi = proto_tree_add_uint ( tree , hfindex , tvb , start , length , value ) ; if ( pi != tree ) { va_start ( ap , format ) ; proto_tree_set_representation_value ( pi , format , ap ) ; va_end ( ap ) ; } return pi ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void process_gitlink ( struct rev_info * revs , const unsigned char * sha1 , show_object_fn show , struct name_path * path , const char * name , void * cb_data ) { }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_H322Caps ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_H322Caps , H322Caps_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static __inline__ unsigned int tipc_cluster ( __u32 addr ) { return ( addr & TIPC_CLUSTER_MASK ) >> TIPC_CLUSTER_OFFSET ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( HttpsEngagementPageLoadMetricsBrowserTest , Navigate_Https ) { StartHttpsServer ( false ) ; NavigateTwiceInTabAndClose ( https_test_server_ -> GetURL ( "/simple.html" ) , GURL ( chrome : : kChromeUIVersionURL ) ) ; histogram_tester_ . ExpectTotalCount ( internal : : kHttpEngagementHistogram , 0 ) ; histogram_tester_ . ExpectTotalCount ( internal : : kHttpsEngagementHistogram , 1 ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int tscc2_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { const uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; TSCC2Context * c = avctx -> priv_data ; GetByteContext gb ; uint32_t frame_type , size ; int i , val , len , pos = 0 ; int num_mb = c -> mb_width * c -> mb_height ; int ret ; bytestream2_init ( & gb , buf , buf_size ) ; frame_type = bytestream2_get_byte ( & gb ) ; if ( frame_type > 1 ) { av_log ( avctx , AV_LOG_ERROR , "Incorrect frame type %d\n" , frame_type ) ; return AVERROR_INVALIDDATA ; } if ( ( ret = ff_reget_buffer ( avctx , & c -> pic ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ; return ret ; } if ( frame_type == 0 ) { * got_frame = 1 ; if ( ( ret = av_frame_ref ( data , & c -> pic ) ) < 0 ) return ret ; return buf_size ; } if ( bytestream2_get_bytes_left ( & gb ) < 4 ) { av_log ( avctx , AV_LOG_ERROR , "Frame is too short\n" ) ; return AVERROR_INVALIDDATA ; } c -> quant [ 0 ] = bytestream2_get_byte ( & gb ) ; c -> quant [ 1 ] = bytestream2_get_byte ( & gb ) ; if ( c -> quant [ 0 ] < 2 || c -> quant [ 0 ] > NUM_VLC_SETS + 1 || c -> quant [ 1 ] < 2 || c -> quant [ 1 ] > NUM_VLC_SETS + 1 ) { av_log ( avctx , AV_LOG_ERROR , "Invalid quantisers %d / %d\n" , c -> quant [ 0 ] , c -> quant [ 1 ] ) ; return AVERROR_INVALIDDATA ; } for ( i = 0 ; i < 3 ; i ++ ) { c -> q [ 0 ] [ i ] = tscc2_quants [ c -> quant [ 0 ] - 2 ] [ i ] ; c -> q [ 1 ] [ i ] = tscc2_quants [ c -> quant [ 1 ] - 2 ] [ i ] ; } bytestream2_skip ( & gb , 1 ) ; size = bytestream2_get_le32 ( & gb ) ; if ( size > bytestream2_get_bytes_left ( & gb ) ) { av_log ( avctx , AV_LOG_ERROR , "Slice properties chunk is too large\n" ) ; return AVERROR_INVALIDDATA ; } for ( i = 0 ; i < size ; i ++ ) { val = bytestream2_get_byte ( & gb ) ; len = val & 0x3F ; val >>= 6 ; if ( pos + len > num_mb ) { av_log ( avctx , AV_LOG_ERROR , "Too many slice properties\n" ) ; return AVERROR_INVALIDDATA ; } memset ( c -> slice_quants + pos , val , len ) ; pos += len ; } if ( pos < num_mb ) { av_log ( avctx , AV_LOG_ERROR , "Too few slice properties (%d / %d)\n" , pos , num_mb ) ; return AVERROR_INVALIDDATA ; } for ( i = 0 ; i < c -> mb_height ; i ++ ) { size = bytestream2_peek_byte ( & gb ) ; if ( size & 1 ) { size = bytestream2_get_byte ( & gb ) - 1 ; } else { size = bytestream2_get_le32 ( & gb ) >> 1 ; } if ( ! size ) { int skip_row = 1 , j , off = i * c -> mb_width ; for ( j = 0 ; j < c -> mb_width ; j ++ ) { if ( c -> slice_quants [ off + j ] == 1 || c -> slice_quants [ off + j ] == 2 ) { skip_row = 0 ; break ; } } if ( ! skip_row ) { av_log ( avctx , AV_LOG_ERROR , "Non-skip row with zero size\n" ) ; return AVERROR_INVALIDDATA ; } } if ( bytestream2_get_bytes_left ( & gb ) < size ) { av_log ( avctx , AV_LOG_ERROR , "Invalid slice size (%d/%d)\n" , size , bytestream2_get_bytes_left ( & gb ) ) ; return AVERROR_INVALIDDATA ; } ret = tscc2_decode_slice ( c , i , buf + bytestream2_tell ( & gb ) , size ) ; if ( ret ) { av_log ( avctx , AV_LOG_ERROR , "Error decoding slice %d\n" , i ) ; return ret ; } bytestream2_skip ( & gb , size ) ; } * got_frame = 1 ; if ( ( ret = av_frame_ref ( data , & c -> pic ) ) < 0 ) return ret ; return buf_size ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void openpic_update_irq ( OpenPICState * opp , int n_IRQ ) { IRQSource * src ; bool active , was_active ; int i ; src = & opp -> src [ n_IRQ ] ; active = src -> pending ; if ( ( src -> ivpr & IVPR_MASK_MASK ) && ! src -> nomask ) { DPRINTF ( "%s: IRQ %d is disabled\n" , __func__ , n_IRQ ) ; active = false ; } was_active = ! ! ( src -> ivpr & IVPR_ACTIVITY_MASK ) ; if ( ! active && ! was_active ) { DPRINTF ( "%s: IRQ %d is already inactive\n" , __func__ , n_IRQ ) ; return ; } if ( active ) { src -> ivpr |= IVPR_ACTIVITY_MASK ; } else { src -> ivpr &= ~ IVPR_ACTIVITY_MASK ; } if ( src -> destmask == 0 ) { DPRINTF ( "%s: IRQ %d has no target\n" , __func__ , n_IRQ ) ; return ; } if ( src -> destmask == ( 1 << src -> last_cpu ) ) { IRQ_local_pipe ( opp , src -> last_cpu , n_IRQ , active , was_active ) ; } else if ( ! ( src -> ivpr & IVPR_MODE_MASK ) ) { for ( i = 0 ; i < opp -> nb_cpus ; i ++ ) { if ( src -> destmask & ( 1 << i ) ) { IRQ_local_pipe ( opp , i , n_IRQ , active , was_active ) ; } } } else { for ( i = src -> last_cpu + 1 ; i != src -> last_cpu ; i ++ ) { if ( i == opp -> nb_cpus ) { i = 0 ; } if ( src -> destmask & ( 1 << i ) ) { IRQ_local_pipe ( opp , i , n_IRQ , active , was_active ) ; src -> last_cpu = i ; break ; } } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static uint32_t debugCB_nextSerial ( ) { static uint32_t n = 1 ; return ( n ++ ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gcry_err_code_t sexp_to_key ( gcry_sexp_t sexp , int want_private , int use , const char * override_elems , gcry_mpi_t * * retarray , gcry_module_t * retalgo , int * r_is_ecc ) { gcry_err_code_t err = 0 ; gcry_sexp_t list , l2 ; char * name ; const char * elems ; gcry_mpi_t * array ; gcry_module_t module ; gcry_pk_spec_t * pubkey ; pk_extra_spec_t * extraspec ; int is_ecc ; list = gcry_sexp_find_token ( sexp , want_private ? "private-key" : "public-key" , 0 ) ; if ( ! list && ! want_private ) list = gcry_sexp_find_token ( sexp , "private-key" , 0 ) ; if ( ! list ) return GPG_ERR_INV_OBJ ; l2 = gcry_sexp_cadr ( list ) ; gcry_sexp_release ( list ) ; list = l2 ; name = _gcry_sexp_nth_string ( list , 0 ) ; if ( ! name ) { gcry_sexp_release ( list ) ; return GPG_ERR_INV_OBJ ; } if ( ! strcmp ( name , "ecc" ) ) is_ecc = 2 ; else if ( ! strcmp ( name , "ecdsa" ) || ! strcmp ( name , "ecdh" ) ) is_ecc = 1 ; else is_ecc = 0 ; ath_mutex_lock ( & pubkeys_registered_lock ) ; if ( is_ecc == 2 && ( use & GCRY_PK_USAGE_SIGN ) ) module = gcry_pk_lookup_name ( "ecdsa" ) ; else if ( is_ecc == 2 && ( use & GCRY_PK_USAGE_ENCR ) ) module = gcry_pk_lookup_name ( "ecdh" ) ; else module = gcry_pk_lookup_name ( name ) ; ath_mutex_unlock ( & pubkeys_registered_lock ) ; gcry_free ( name ) ; if ( ! module ) { gcry_sexp_release ( list ) ; return GPG_ERR_PUBKEY_ALGO ; } else { pubkey = ( gcry_pk_spec_t * ) module -> spec ; extraspec = module -> extraspec ; } if ( override_elems ) elems = override_elems ; else if ( want_private ) elems = pubkey -> elements_skey ; else elems = pubkey -> elements_pkey ; array = gcry_calloc ( strlen ( elems ) + 1 , sizeof ( * array ) ) ; if ( ! array ) err = gpg_err_code_from_syserror ( ) ; if ( ! err ) { if ( is_ecc ) err = sexp_elements_extract_ecc ( list , elems , array , extraspec , want_private ) ; else err = sexp_elements_extract ( list , elems , array , pubkey -> name , 0 ) ; } gcry_sexp_release ( list ) ; if ( err ) { gcry_free ( array ) ; ath_mutex_lock ( & pubkeys_registered_lock ) ; _gcry_module_release ( module ) ; ath_mutex_unlock ( & pubkeys_registered_lock ) ; } else { * retarray = array ; * retalgo = module ; if ( r_is_ecc ) * r_is_ecc = is_ecc ; } return err ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void virtio_net_exit ( VirtIODevice * vdev ) { VirtIONet * n = DO_UPCAST ( VirtIONet , vdev , vdev ) ; virtio_net_set_status ( vdev , 0 ) ; qemu_purge_queued_packets ( & n -> nic -> nc ) ; unregister_savevm ( n -> qdev , "virtio-net" , n ) ; g_free ( n -> mac_table . macs ) ; g_free ( n -> vlans ) ; if ( n -> tx_timer ) { qemu_del_timer ( n -> tx_timer ) ; qemu_free_timer ( n -> tx_timer ) ; } else { qemu_bh_delete ( n -> tx_bh ) ; } qemu_del_vlan_client ( & n -> nic -> nc ) ; virtio_cleanup ( & n -> vdev ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void termsig_handler ( int signum ) { atomic_cmpxchg ( & state , RUNNING , TERMINATE ) ; qemu_notify_event ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int write_rr_ER ( struct archive_write * a ) { unsigned char * p ; p = wb_buffptr ( a ) ; memset ( p , 0 , LOGICAL_BLOCK_SIZE ) ; p [ 0 ] = 'E' ; p [ 1 ] = 'R' ; p [ 3 ] = 0x01 ; p [ 2 ] = RRIP_ER_SIZE ; p [ 4 ] = RRIP_ER_ID_SIZE ; p [ 5 ] = RRIP_ER_DSC_SIZE ; p [ 6 ] = RRIP_ER_SRC_SIZE ; p [ 7 ] = 0x01 ; memcpy ( & p [ 8 ] , rrip_identifier , p [ 4 ] ) ; memcpy ( & p [ 8 + p [ 4 ] ] , rrip_descriptor , p [ 5 ] ) ; memcpy ( & p [ 8 + p [ 4 ] + p [ 5 ] ] , rrip_source , p [ 6 ] ) ; return ( wb_consume ( a , LOGICAL_BLOCK_SIZE ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
extern List as_mysql_modify_clusters ( mysql_conn_t * mysql_conn , uint32_t uid , slurmdb_cluster_cond_t * cluster_cond , slurmdb_cluster_rec_t * cluster ) { List ret_list = NULL ; int rc = SLURM_SUCCESS ; char * object = NULL ; char * vals = NULL , * extra = NULL , * query = NULL , * name_char = NULL ; time_t now = time ( NULL ) ; char * user_name = NULL ; int set = 0 ; MYSQL_RES * result = NULL ; MYSQL_ROW row ; bool clust_reg = false , fed_update = false ; if ( ! cluster_cond || ! cluster ) { error ( "we need something to change" ) ; return NULL ; } if ( check_connection ( mysql_conn ) != SLURM_SUCCESS ) return NULL ; if ( ! is_user_min_admin_level ( mysql_conn , uid , SLURMDB_ADMIN_SUPER_USER ) ) { errno = ESLURM_ACCESS_DENIED ; return NULL ; } cluster_cond -> with_deleted = 0 ; _setup_cluster_cond_limits ( cluster_cond , & extra ) ; if ( ! mysql_conn -> cluster_name && cluster_cond -> cluster_list && list_count ( cluster_cond -> cluster_list ) ) mysql_conn -> cluster_name = xstrdup ( list_peek ( cluster_cond -> cluster_list ) ) ; set = 0 ; if ( cluster -> control_host ) { xstrfmtcat ( vals , ", control_host='%s'" , cluster -> control_host ) ; set ++ ; clust_reg = true ; } if ( cluster -> control_port ) { xstrfmtcat ( vals , ", control_port=%u, last_port=%u" , cluster -> control_port , cluster -> control_port ) ; set ++ ; clust_reg = true ; } if ( cluster -> rpc_version ) { xstrfmtcat ( vals , ", rpc_version=%u" , cluster -> rpc_version ) ; set ++ ; clust_reg = true ; } if ( cluster -> dimensions ) { xstrfmtcat ( vals , ", dimensions=%u" , cluster -> dimensions ) ; clust_reg = true ; } if ( cluster -> plugin_id_select ) { xstrfmtcat ( vals , ", plugin_id_select=%u" , cluster -> plugin_id_select ) ; clust_reg = true ; } if ( cluster -> flags != NO_VAL ) { xstrfmtcat ( vals , ", flags=%u" , cluster -> flags ) ; clust_reg = true ; } if ( cluster -> classification ) { xstrfmtcat ( vals , ", classification=%u" , cluster -> classification ) ; } if ( cluster -> fed . name ) { xstrfmtcat ( vals , ", federation='%s'" , cluster -> fed . name ) ; fed_update = true ; } if ( cluster -> fed . state != NO_VAL ) { xstrfmtcat ( vals , ", fed_state=%u" , cluster -> fed . state ) ; fed_update = true ; } if ( cluster -> fed . weight != NO_VAL ) { xstrfmtcat ( vals , ", fed_weight=%d" , cluster -> fed . weight ) ; fed_update = true ; } if ( ! vals ) { xfree ( extra ) ; errno = SLURM_NO_CHANGE_IN_DATA ; error ( "Nothing to change" ) ; return NULL ; } else if ( clust_reg && ( set != 3 ) ) { xfree ( vals ) ; xfree ( extra ) ; errno = EFAULT ; error ( "Need control host, port and rpc version " "to register a cluster" ) ; return NULL ; } xstrfmtcat ( query , "select name, control_port, federation from %s%s; " , cluster_table , extra ) ; if ( debug_flags & DEBUG_FLAG_DB_ASSOC ) DB_DEBUG ( mysql_conn -> conn , "query\n%s" , query ) ; if ( ! ( result = mysql_db_query_ret ( mysql_conn , query , 0 ) ) ) { xfree ( query ) ; xfree ( vals ) ; error ( "no result given for %s" , extra ) ; xfree ( extra ) ; return NULL ; } xfree ( extra ) ; ret_list = list_create ( slurm_destroy_char ) ; user_name = uid_to_string ( ( uid_t ) uid ) ; while ( ( row = mysql_fetch_row ( result ) ) ) { char * tmp_vals = xstrdup ( vals ) ; object = xstrdup ( row [ 0 ] ) ; if ( cluster -> fed . name ) { int id = 0 ; char * curr_fed = NULL ; uint32_t set_state = NO_VAL ; if ( cluster -> fed . name [ 0 ] != '\0' ) { rc = as_mysql_get_fed_cluster_id ( mysql_conn , object , cluster -> fed . name , - 1 , & id ) ; if ( rc ) { error ( "failed to get cluster id for " "federation" ) ; xfree ( tmp_vals ) ; xfree ( object ) ; FREE_NULL_LIST ( ret_list ) ; mysql_free_result ( result ) ; goto end_it ; } } xstrfmtcat ( tmp_vals , ", fed_id=%d" , id ) ; curr_fed = xstrdup ( row [ 2 ] ) ; if ( cluster -> fed . name [ 0 ] == '\0' ) set_state = CLUSTER_FED_STATE_NA ; else if ( cluster -> fed . state != NO_VAL ) { } else if ( xstrcmp ( curr_fed , cluster -> fed . name ) ) set_state = CLUSTER_FED_STATE_ACTIVE ; if ( set_state != NO_VAL ) xstrfmtcat ( tmp_vals , ", fed_state=%u" , set_state ) ; xfree ( curr_fed ) ; } list_append ( ret_list , object ) ; xstrfmtcat ( name_char , "name='%s'" , object ) ; rc = modify_common ( mysql_conn , DBD_MODIFY_CLUSTERS , now , user_name , cluster_table , name_char , tmp_vals , NULL ) ; xfree ( name_char ) ; xfree ( tmp_vals ) ; if ( rc == SLURM_ERROR ) { error ( "Couldn't modify cluster 1" ) ; FREE_NULL_LIST ( ret_list ) ; mysql_free_result ( result ) ; goto end_it ; } } mysql_free_result ( result ) ; xfree ( user_name ) ; if ( ! list_count ( ret_list ) ) { errno = SLURM_NO_CHANGE_IN_DATA ; if ( debug_flags & DEBUG_FLAG_DB_ASSOC ) DB_DEBUG ( mysql_conn -> conn , "didn't effect anything\n%s" , query ) ; xfree ( name_char ) ; xfree ( vals ) ; xfree ( query ) ; return ret_list ; } if ( fed_update ) as_mysql_add_feds_to_update_list ( mysql_conn ) ; end_it : xfree ( query ) ; xfree ( vals ) ; xfree ( user_name ) ; return ret_list ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void udvm_state_free ( guint8 buff [ ] _U_ , guint16 p_id_start _U_ , guint16 p_id_length _U_ ) { }
0False
Categorize the following code snippet as vulnerable or not. True or False
int xps_count_font_encodings ( fz_font * font ) { FT_Face face = font -> ft_face ; return face -> num_charmaps ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int qemuAgentIORead ( qemuAgentPtr mon ) { size_t avail = mon -> bufferLength - mon -> bufferOffset ; int ret = 0 ; if ( avail < 1024 ) { if ( mon -> bufferLength >= QEMU_AGENT_MAX_RESPONSE ) { virReportSystemError ( ERANGE , _ ( "No complete agent response found in %d bytes" ) , QEMU_AGENT_MAX_RESPONSE ) ; return - 1 ; } if ( VIR_REALLOC_N ( mon -> buffer , mon -> bufferLength + 1024 ) < 0 ) return - 1 ; mon -> bufferLength += 1024 ; avail += 1024 ; } while ( avail > 1 ) { int got ; got = read ( mon -> fd , mon -> buffer + mon -> bufferOffset , avail - 1 ) ; if ( got < 0 ) { if ( errno == EAGAIN ) break ; virReportSystemError ( errno , "%s" , _ ( "Unable to read from monitor" ) ) ; ret = - 1 ; break ; } if ( got == 0 ) break ; ret += got ; avail -= got ; mon -> bufferOffset += got ; mon -> buffer [ mon -> bufferOffset ] = '\0' ; } # if DEBUG_IO VIR_DEBUG ( "Now read %zu bytes of data" , mon -> bufferOffset ) ; # endif return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int i2d_ ## name ( type * a , unsigned char * * out ) ; DECLARE_ASN1_ITEM ( itname ) # define DECLARE_ASN1_ENCODE_FUNCTIONS_const ( type , name ) type * d2i_ ## name ( type * * a , const unsigned char * * in , long len ) ; int i2d_ ## name ( const type * a , unsigned char * * out ) ; DECLARE_ASN1_ITEM ( name ) # define DECLARE_ASN1_NDEF_FUNCTION ( name ) int i2d_ ## name ## _NDEF ( name * a , unsigned char * * out ) ; # define DECLARE_ASN1_FUNCTIONS_const ( name ) DECLARE_ASN1_ALLOC_FUNCTIONS ( name ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( name , name ) # define DECLARE_ASN1_ALLOC_FUNCTIONS_name ( type , name ) type * name ## _new ( void ) ; 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 ) ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup ( const ASN1_OCTET_STRING * a ) ; int ASN1_OCTET_STRING_cmp ( const ASN1_OCTET_STRING * a , const ASN1_OCTET_STRING * b ) ; int ASN1_OCTET_STRING_set ( ASN1_OCTET_STRING * str , const unsigned char * data , int len ) ; DECLARE_ASN1_FUNCTIONS ( ASN1_VISIBLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UNIVERSALSTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UTF8STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_NULL ) DECLARE_ASN1_FUNCTIONS ( ASN1_BMPSTRING ) int UTF8_getc ( const unsigned char * str , int len , unsigned long * val ) ; int UTF8_putc ( unsigned char * str , int len , unsigned long value ) ; DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , ASN1_PRINTABLE ) DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , DIRECTORYSTRING ) DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , DISPLAYTEXT ) DECLARE_ASN1_FUNCTIONS ( ASN1_PRINTABLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_T61STRING )
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void qemu_get_8s ( QEMUFile * f , uint8_t * pv ) { * pv = qemu_get_byte ( f ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_amf ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data _U_ ) { proto_item * ti ; proto_tree * amf_tree , * headers_tree , * messages_tree ; int offset ; guint header_count , message_count , i ; guint string_length ; guint header_length , message_length ; gboolean amf3_encoding = FALSE ; ti = proto_tree_add_item ( tree , proto_amf , tvb , 0 , - 1 , ENC_NA ) ; amf_tree = proto_item_add_subtree ( ti , ett_amf ) ; offset = 0 ; proto_tree_add_item ( amf_tree , hf_amf_version , tvb , offset , 2 , ENC_BIG_ENDIAN ) ; offset += 2 ; header_count = tvb_get_ntohs ( tvb , offset ) ; proto_tree_add_uint ( amf_tree , hf_amf_header_count , tvb , offset , 2 , header_count ) ; offset += 2 ; if ( header_count != 0 ) { headers_tree = proto_tree_add_subtree ( amf_tree , tvb , offset , - 1 , ett_amf_headers , NULL , "Headers" ) ; for ( i = 0 ; i < header_count ; i ++ ) { string_length = tvb_get_ntohs ( tvb , offset ) ; proto_tree_add_item ( headers_tree , hf_amf_header_name , tvb , offset , 2 , ENC_UTF_8 | ENC_BIG_ENDIAN ) ; offset += 2 + string_length ; proto_tree_add_item ( headers_tree , hf_amf_header_must_understand , tvb , offset , 1 , ENC_NA ) ; offset += 1 ; header_length = tvb_get_ntohl ( tvb , offset ) ; if ( header_length == 0xFFFFFFFF ) proto_tree_add_uint_format_value ( headers_tree , hf_amf_header_length , tvb , offset , 4 , header_length , "Unknown" ) ; else proto_tree_add_uint ( headers_tree , hf_amf_header_length , tvb , offset , 4 , header_length ) ; offset += 4 ; if ( amf3_encoding ) offset = dissect_amf3_value_type ( tvb , offset , headers_tree , NULL ) ; else offset = dissect_amf0_value_type ( tvb , offset , headers_tree , & amf3_encoding , NULL ) ; } } message_count = tvb_get_ntohs ( tvb , offset ) ; proto_tree_add_uint ( amf_tree , hf_amf_message_count , tvb , offset , 2 , message_count ) ; offset += 2 ; if ( message_count != 0 ) { messages_tree = proto_tree_add_subtree ( amf_tree , tvb , offset , - 1 , ett_amf_messages , NULL , "Messages" ) ; for ( i = 0 ; i < message_count ; i ++ ) { string_length = tvb_get_ntohs ( tvb , offset ) ; proto_tree_add_item ( messages_tree , hf_amf_message_target_uri , tvb , offset , 2 , ENC_UTF_8 | ENC_BIG_ENDIAN ) ; offset += 2 + string_length ; string_length = tvb_get_ntohs ( tvb , offset ) ; proto_tree_add_item ( messages_tree , hf_amf_message_response_uri , tvb , offset , 2 , ENC_UTF_8 | ENC_BIG_ENDIAN ) ; offset += 2 + string_length ; message_length = tvb_get_ntohl ( tvb , offset ) ; if ( message_length == 0xFFFFFFFF ) proto_tree_add_uint_format_value ( messages_tree , hf_amf_message_length , tvb , offset , 4 , message_length , "Unknown" ) ; else proto_tree_add_uint ( messages_tree , hf_amf_message_length , tvb , offset , 4 , message_length ) ; offset += 4 ; offset = dissect_rtmpt_body_command ( tvb , offset , messages_tree , FALSE ) ; } } return tvb_captured_length ( tvb ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int fz_colorspace_is_rgb ( fz_context * ctx , const fz_colorspace * cs ) { return cs && cs -> type == FZ_COLORSPACE_RGB ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void ohci_mem_write ( void * opaque , hwaddr addr , uint64_t val , unsigned size ) { OHCIState * ohci = opaque ; if ( addr & 3 ) { trace_usb_ohci_mem_write_unaligned ( addr ) ; return ; } if ( addr >= 0x54 && addr < 0x54 + ohci -> num_ports * 4 ) { ohci_port_set_status ( ohci , ( addr - 0x54 ) >> 2 , val ) ; return ; } switch ( addr >> 2 ) { case 1 : ohci_set_ctl ( ohci , val ) ; break ; case 2 : val = ( val & ~ OHCI_STATUS_SOC ) ; ohci -> status |= val ; if ( ohci -> status & OHCI_STATUS_HCR ) ohci_soft_reset ( ohci ) ; break ; case 3 : ohci -> intr_status &= ~ val ; ohci_intr_update ( ohci ) ; break ; case 4 : ohci -> intr |= val ; ohci_intr_update ( ohci ) ; break ; case 5 : ohci -> intr &= ~ val ; ohci_intr_update ( ohci ) ; break ; case 6 : ohci -> hcca = val & OHCI_HCCA_MASK ; break ; case 7 : break ; case 8 : ohci -> ctrl_head = val & OHCI_EDPTR_MASK ; break ; case 9 : ohci -> ctrl_cur = val & OHCI_EDPTR_MASK ; break ; case 10 : ohci -> bulk_head = val & OHCI_EDPTR_MASK ; break ; case 11 : ohci -> bulk_cur = val & OHCI_EDPTR_MASK ; break ; case 13 : ohci -> fsmps = ( val & OHCI_FMI_FSMPS ) >> 16 ; ohci -> fit = ( val & OHCI_FMI_FIT ) >> 31 ; ohci_set_frame_interval ( ohci , val ) ; break ; case 15 : break ; case 16 : ohci -> pstart = val & 0xffff ; break ; case 17 : ohci -> lst = val & 0xffff ; break ; case 18 : ohci -> rhdesc_a &= ~ OHCI_RHA_RW_MASK ; ohci -> rhdesc_a |= val & OHCI_RHA_RW_MASK ; break ; case 19 : break ; case 20 : ohci_set_hub_status ( ohci , val ) ; break ; case 24 : ohci -> hstatus &= ~ ( val & ohci -> hmask ) ; break ; case 25 : ohci -> hreset = val & ~ OHCI_HRESET_FSBIR ; if ( val & OHCI_HRESET_FSBIR ) ohci_hard_reset ( ohci ) ; break ; case 26 : ohci -> hmask = val ; break ; case 27 : ohci -> htest = val ; break ; default : trace_usb_ohci_mem_write_bad_offset ( addr ) ; break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
const EVP_CIPHER * EVP_aes_128_wrap ( void ) { return & aes_128_wrap ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int key_payload_reserve ( struct key * key , size_t datalen ) { int delta = ( int ) datalen - key -> datalen ; int ret = 0 ; key_check ( key ) ; if ( delta != 0 && test_bit ( KEY_FLAG_IN_QUOTA , & key -> flags ) ) { unsigned maxbytes = uid_eq ( key -> user -> uid , GLOBAL_ROOT_UID ) ? key_quota_root_maxbytes : key_quota_maxbytes ; spin_lock ( & key -> user -> lock ) ; if ( delta > 0 && ( key -> user -> qnbytes + delta >= maxbytes || key -> user -> qnbytes + delta < key -> user -> qnbytes ) ) { ret = - EDQUOT ; } else { key -> user -> qnbytes += delta ; key -> quotalen += delta ; } spin_unlock ( & key -> user -> lock ) ; } if ( ret == 0 ) key -> datalen = datalen ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_GatekeeperRejectReason ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 592 "./asn1/h225/h225.cnf" gint32 value ; h225_packet_info * h225_pi ; h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ; offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h225_GatekeeperRejectReason , GatekeeperRejectReason_choice , & value ) ; if ( h225_pi != NULL ) { h225_pi -> reason = value ; } return offset ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int ogg_packet ( AVFormatContext * s , int * sid , int * dstart , int * dsize , int64_t * fpos ) { struct ogg * ogg = s -> priv_data ; int idx , i , ret ; struct ogg_stream * os ; int complete = 0 ; int segp = 0 , psize = 0 ; av_log ( s , AV_LOG_TRACE , "ogg_packet: curidx=%i\n" , ogg -> curidx ) ; if ( sid ) * sid = - 1 ; do { idx = ogg -> curidx ; while ( idx < 0 ) { ret = ogg_read_page ( s , & idx ) ; if ( ret < 0 ) return ret ; } os = ogg -> streams + idx ; av_log ( s , AV_LOG_TRACE , "ogg_packet: idx=%d pstart=%d psize=%d segp=%d nsegs=%d\n" , idx , os -> pstart , os -> psize , os -> segp , os -> nsegs ) ; if ( ! os -> codec ) { if ( os -> header < 0 ) { os -> codec = ogg_find_codec ( os -> buf , os -> bufpos ) ; if ( ! os -> codec ) { av_log ( s , AV_LOG_WARNING , "Codec not found\n" ) ; os -> header = 0 ; return 0 ; } } else { return 0 ; } } segp = os -> segp ; psize = os -> psize ; while ( os -> segp < os -> nsegs ) { int ss = os -> segments [ os -> segp ++ ] ; os -> psize += ss ; if ( ss < 255 ) { complete = 1 ; break ; } } if ( ! complete && os -> segp == os -> nsegs ) { ogg -> curidx = - 1 ; os -> incomplete = ! ! os -> psize ; } } while ( ! complete ) ; if ( os -> granule == - 1 ) av_log ( s , AV_LOG_WARNING , "Page at %" PRId64 " is missing granule\n" , os -> page_pos ) ; ogg -> curidx = idx ; os -> incomplete = 0 ; if ( os -> header ) { os -> header = os -> codec -> header ( s , idx ) ; if ( ! os -> header ) { os -> segp = segp ; os -> psize = psize ; ogg -> headers = 1 ; if ( ! s -> internal -> data_offset ) s -> internal -> data_offset = os -> sync_pos ; for ( i = 0 ; i < ogg -> nstreams ; i ++ ) { struct ogg_stream * cur_os = ogg -> streams + i ; if ( cur_os -> incomplete ) s -> internal -> data_offset = FFMIN ( s -> internal -> data_offset , cur_os -> sync_pos ) ; } } else { os -> nb_header ++ ; os -> pstart += os -> psize ; os -> psize = 0 ; } } else { os -> pflags = 0 ; os -> pduration = 0 ; if ( os -> codec && os -> codec -> packet ) os -> codec -> packet ( s , idx ) ; if ( sid ) * sid = idx ; if ( dstart ) * dstart = os -> pstart ; if ( dsize ) * dsize = os -> psize ; if ( fpos ) * fpos = os -> sync_pos ; os -> pstart += os -> psize ; os -> psize = 0 ; if ( os -> pstart == os -> bufpos ) os -> bufpos = os -> pstart = 0 ; os -> sync_pos = os -> page_pos ; } os -> page_end = 1 ; for ( i = os -> segp ; i < os -> nsegs ; i ++ ) if ( os -> segments [ i ] < 255 ) { os -> page_end = 0 ; break ; } if ( os -> segp == os -> nsegs ) ogg -> curidx = - 1 ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void xhci_run ( XHCIState * xhci ) { trace_usb_xhci_run ( ) ; xhci -> usbsts &= ~ USBSTS_HCH ; xhci -> mfindex_start = qemu_clock_get_ns ( QEMU_CLOCK_VIRTUAL ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void ff_vdpau_vc1_decode_picture ( MpegEncContext * s , const uint8_t * buf , int buf_size ) { VC1Context * v = s -> avctx -> priv_data ; struct vdpau_render_state * render , * last , * next ; render = ( struct vdpau_render_state * ) s -> current_picture . f . data [ 0 ] ; assert ( render ) ; render -> info . vc1 . frame_coding_mode = v -> fcm ; render -> info . vc1 . postprocflag = v -> postprocflag ; render -> info . vc1 . pulldown = v -> broadcast ; render -> info . vc1 . interlace = v -> interlace ; render -> info . vc1 . tfcntrflag = v -> tfcntrflag ; render -> info . vc1 . finterpflag = v -> finterpflag ; render -> info . vc1 . psf = v -> psf ; render -> info . vc1 . dquant = v -> dquant ; render -> info . vc1 . panscan_flag = v -> panscanflag ; render -> info . vc1 . refdist_flag = v -> refdist_flag ; render -> info . vc1 . quantizer = v -> quantizer_mode ; render -> info . vc1 . extended_mv = v -> extended_mv ; render -> info . vc1 . extended_dmv = v -> extended_dmv ; render -> info . vc1 . overlap = v -> overlap ; render -> info . vc1 . vstransform = v -> vstransform ; render -> info . vc1 . loopfilter = v -> s . loop_filter ; render -> info . vc1 . fastuvmc = v -> fastuvmc ; render -> info . vc1 . range_mapy_flag = v -> range_mapy_flag ; render -> info . vc1 . range_mapy = v -> range_mapy ; render -> info . vc1 . range_mapuv_flag = v -> range_mapuv_flag ; render -> info . vc1 . range_mapuv = v -> range_mapuv ; render -> info . vc1 . multires = v -> multires ; render -> info . vc1 . syncmarker = v -> s . resync_marker ; render -> info . vc1 . rangered = v -> rangered | ( v -> rangeredfrm << 1 ) ; render -> info . vc1 . maxbframes = v -> s . max_b_frames ; render -> info . vc1 . deblockEnable = v -> postprocflag & 1 ; render -> info . vc1 . pquant = v -> pq ; render -> info . vc1 . forward_reference = VDP_INVALID_HANDLE ; render -> info . vc1 . backward_reference = VDP_INVALID_HANDLE ; if ( v -> bi_type ) render -> info . vc1 . picture_type = 4 ; else render -> info . vc1 . picture_type = s -> pict_type - 1 + s -> pict_type / 3 ; switch ( s -> pict_type ) { case AV_PICTURE_TYPE_B : next = ( struct vdpau_render_state * ) s -> next_picture . f . data [ 0 ] ; assert ( next ) ; render -> info . vc1 . backward_reference = next -> surface ; case AV_PICTURE_TYPE_P : last = ( struct vdpau_render_state * ) s -> last_picture . f . data [ 0 ] ; if ( ! last ) last = render ; render -> info . vc1 . forward_reference = last -> surface ; } ff_vdpau_add_data_chunk ( s -> current_picture_ptr -> f . data [ 0 ] , buf , buf_size ) ; render -> info . vc1 . slice_count = 1 ; ff_mpeg_draw_horiz_band ( s , 0 , s -> avctx -> height ) ; render -> bitstream_buffers_used = 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static Image * ReadHDRImage ( const ImageInfo * image_info , ExceptionInfo * exception ) { char format [ MagickPathExtent ] , keyword [ MagickPathExtent ] , tag [ MagickPathExtent ] , value [ MagickPathExtent ] ; double gamma ; Image * image ; int c ; MagickBooleanType status , value_expected ; register Quantum * q ; register ssize_t i , x ; register unsigned char * p ; ssize_t count , y ; unsigned char * end , pixel [ 4 ] , * pixels ; assert ( image_info != ( const ImageInfo * ) NULL ) ; assert ( image_info -> signature == MagickCoreSignature ) ; if ( image_info -> debug != MagickFalse ) ( void ) LogMagickEvent ( TraceEvent , GetMagickModule ( ) , "%s" , image_info -> filename ) ; assert ( exception != ( ExceptionInfo * ) NULL ) ; assert ( exception -> signature == MagickCoreSignature ) ; image = AcquireImage ( image_info , exception ) ; status = OpenBlob ( image_info , image , ReadBinaryBlobMode , exception ) ; if ( status == MagickFalse ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } image -> columns = 0 ; image -> rows = 0 ; * format = '\0' ; c = ReadBlobByte ( image ) ; if ( c == EOF ) { image = DestroyImage ( image ) ; return ( ( Image * ) NULL ) ; } while ( isgraph ( c ) && ( image -> columns == 0 ) && ( image -> rows == 0 ) ) { if ( c == ( int ) '#' ) { char * comment ; register char * p ; size_t length ; length = MagickPathExtent ; comment = AcquireString ( ( char * ) NULL ) ; for ( p = comment ; comment != ( char * ) NULL ; p ++ ) { c = ReadBlobByte ( image ) ; if ( ( c == EOF ) || ( c == ( int ) '\n' ) ) break ; if ( ( size_t ) ( p - comment + 1 ) >= length ) { * p = '\0' ; length <<= 1 ; comment = ( char * ) ResizeQuantumMemory ( comment , length + MagickPathExtent , sizeof ( * comment ) ) ; if ( comment == ( char * ) NULL ) break ; p = comment + strlen ( comment ) ; } * p = ( char ) c ; } if ( comment == ( char * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; * p = '\0' ; ( void ) SetImageProperty ( image , "comment" , comment , exception ) ; comment = DestroyString ( comment ) ; c = ReadBlobByte ( image ) ; } else if ( isalnum ( c ) == MagickFalse ) c = ReadBlobByte ( image ) ; else { register char * p ; p = keyword ; do { if ( ( size_t ) ( p - keyword ) < ( MagickPathExtent - 1 ) ) * p ++ = c ; c = ReadBlobByte ( image ) ; } while ( isalnum ( c ) || ( c == '_' ) ) ; * p = '\0' ; value_expected = MagickFalse ; while ( ( isspace ( ( int ) ( ( unsigned char ) c ) ) != 0 ) || ( c == '=' ) ) { if ( c == '=' ) value_expected = MagickTrue ; c = ReadBlobByte ( image ) ; } if ( LocaleCompare ( keyword , "Y" ) == 0 ) value_expected = MagickTrue ; if ( value_expected == MagickFalse ) continue ; p = value ; while ( ( c != '\n' ) && ( c != '\0' ) && ( c != EOF ) ) { if ( ( size_t ) ( p - value ) < ( MagickPathExtent - 1 ) ) * p ++ = c ; c = ReadBlobByte ( image ) ; } * p = '\0' ; switch ( * keyword ) { case 'F' : case 'f' : { if ( LocaleCompare ( keyword , "format" ) == 0 ) { ( void ) CopyMagickString ( format , value , MagickPathExtent ) ; break ; } ( void ) FormatLocaleString ( tag , MagickPathExtent , "hdr:%s" , keyword ) ; ( void ) SetImageProperty ( image , tag , value , exception ) ; break ; } case 'G' : case 'g' : { if ( LocaleCompare ( keyword , "gamma" ) == 0 ) { image -> gamma = StringToDouble ( value , ( char * * ) NULL ) ; break ; } ( void ) FormatLocaleString ( tag , MagickPathExtent , "hdr:%s" , keyword ) ; ( void ) SetImageProperty ( image , tag , value , exception ) ; break ; } case 'P' : case 'p' : { if ( LocaleCompare ( keyword , "primaries" ) == 0 ) { float chromaticity [ 6 ] , white_point [ 2 ] ; int count ; count = sscanf ( value , "%g %g %g %g %g %g %g %g" , & chromaticity [ 0 ] , & chromaticity [ 1 ] , & chromaticity [ 2 ] , & chromaticity [ 3 ] , & chromaticity [ 4 ] , & chromaticity [ 5 ] , & white_point [ 0 ] , & white_point [ 1 ] ) ; if ( count == 8 ) { image -> chromaticity . red_primary . x = chromaticity [ 0 ] ; image -> chromaticity . red_primary . y = chromaticity [ 1 ] ; image -> chromaticity . green_primary . x = chromaticity [ 2 ] ; image -> chromaticity . green_primary . y = chromaticity [ 3 ] ; image -> chromaticity . blue_primary . x = chromaticity [ 4 ] ; image -> chromaticity . blue_primary . y = chromaticity [ 5 ] ; image -> chromaticity . white_point . x = white_point [ 0 ] , image -> chromaticity . white_point . y = white_point [ 1 ] ; } break ; } ( void ) FormatLocaleString ( tag , MagickPathExtent , "hdr:%s" , keyword ) ; ( void ) SetImageProperty ( image , tag , value , exception ) ; break ; } case 'Y' : case 'y' : { char target [ ] = "Y" ; if ( strcmp ( keyword , target ) == 0 ) { int height , width ; if ( sscanf ( value , "%d +X %d" , & height , & width ) == 2 ) { image -> columns = ( size_t ) width ; image -> rows = ( size_t ) height ; } break ; } ( void ) FormatLocaleString ( tag , MagickPathExtent , "hdr:%s" , keyword ) ; ( void ) SetImageProperty ( image , tag , value , exception ) ; break ; } default : { ( void ) FormatLocaleString ( tag , MagickPathExtent , "hdr:%s" , keyword ) ; ( void ) SetImageProperty ( image , tag , value , exception ) ; break ; } } } if ( ( image -> columns == 0 ) && ( image -> rows == 0 ) ) while ( isspace ( ( int ) ( ( unsigned char ) c ) ) != 0 ) c = ReadBlobByte ( image ) ; } if ( ( LocaleCompare ( format , "32-bit_rle_rgbe" ) != 0 ) && ( LocaleCompare ( format , "32-bit_rle_xyze" ) != 0 ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; if ( ( image -> columns == 0 ) || ( image -> rows == 0 ) ) ThrowReaderException ( CorruptImageError , "NegativeOrZeroImageSize" ) ; ( void ) SetImageColorspace ( image , RGBColorspace , exception ) ; if ( LocaleCompare ( format , "32-bit_rle_xyze" ) == 0 ) ( void ) SetImageColorspace ( image , XYZColorspace , exception ) ; image -> compression = ( image -> columns < 8 ) || ( image -> columns > 0x7ffff ) ? NoCompression : RLECompression ; if ( image_info -> ping != MagickFalse ) { ( void ) CloseBlob ( image ) ; return ( GetFirstImageInList ( image ) ) ; } status = SetImageExtent ( image , image -> columns , image -> rows , exception ) ; if ( status == MagickFalse ) return ( DestroyImageList ( image ) ) ; pixels = ( unsigned char * ) AcquireQuantumMemory ( image -> columns , 4 * sizeof ( * pixels ) ) ; if ( pixels == ( unsigned char * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; for ( y = 0 ; y < ( ssize_t ) image -> rows ; y ++ ) { if ( image -> compression != RLECompression ) { count = ReadBlob ( image , 4 * image -> columns * sizeof ( * pixels ) , pixels ) ; if ( count != ( ssize_t ) ( 4 * image -> columns * sizeof ( * pixels ) ) ) break ; } else { count = ReadBlob ( image , 4 * sizeof ( * pixel ) , pixel ) ; if ( count != 4 ) break ; if ( ( size_t ) ( ( ( ( size_t ) pixel [ 2 ] ) << 8 ) | pixel [ 3 ] ) != image -> columns ) { ( void ) memcpy ( pixels , pixel , 4 * sizeof ( * pixel ) ) ; count = ReadBlob ( image , 4 * ( image -> columns - 1 ) * sizeof ( * pixels ) , pixels + 4 ) ; image -> compression = NoCompression ; } else { p = pixels ; for ( i = 0 ; i < 4 ; i ++ ) { end = & pixels [ ( i + 1 ) * image -> columns ] ; while ( p < end ) { count = ReadBlob ( image , 2 * sizeof ( * pixel ) , pixel ) ; if ( count < 1 ) break ; if ( pixel [ 0 ] > 128 ) { count = ( ssize_t ) pixel [ 0 ] - 128 ; if ( ( count == 0 ) || ( count > ( ssize_t ) ( end - p ) ) ) break ; while ( count -- > 0 ) * p ++ = pixel [ 1 ] ; } else { count = ( ssize_t ) pixel [ 0 ] ; if ( ( count == 0 ) || ( count > ( ssize_t ) ( end - p ) ) ) break ; * p ++ = pixel [ 1 ] ; if ( -- count > 0 ) { count = ReadBlob ( image , ( size_t ) count * sizeof ( * p ) , p ) ; if ( count < 1 ) break ; p += count ; } } } } } } q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( Quantum * ) NULL ) break ; i = 0 ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) { if ( image -> compression == RLECompression ) { pixel [ 0 ] = pixels [ x ] ; pixel [ 1 ] = pixels [ x + image -> columns ] ; pixel [ 2 ] = pixels [ x + 2 * image -> columns ] ; pixel [ 3 ] = pixels [ x + 3 * image -> columns ] ; } else { pixel [ 0 ] = pixels [ i ++ ] ; pixel [ 1 ] = pixels [ i ++ ] ; pixel [ 2 ] = pixels [ i ++ ] ; pixel [ 3 ] = pixels [ i ++ ] ; } SetPixelRed ( image , 0 , q ) ; SetPixelGreen ( image , 0 , q ) ; SetPixelBlue ( image , 0 , q ) ; if ( pixel [ 3 ] != 0 ) { gamma = pow ( 2.0 , pixel [ 3 ] - ( 128.0 + 8.0 ) ) ; SetPixelRed ( image , ClampToQuantum ( QuantumRange * gamma * pixel [ 0 ] ) , q ) ; SetPixelGreen ( image , ClampToQuantum ( QuantumRange * gamma * pixel [ 1 ] ) , q ) ; SetPixelBlue ( image , ClampToQuantum ( QuantumRange * gamma * pixel [ 2 ] ) , q ) ; } q += GetPixelChannels ( image ) ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) y , image -> rows ) ; if ( status == MagickFalse ) break ; } pixels = ( unsigned char * ) RelinquishMagickMemory ( pixels ) ; if ( EOFBlob ( image ) != MagickFalse ) ThrowFileException ( exception , CorruptImageError , "UnexpectedEndOfFile" , image -> filename ) ; ( void ) CloseBlob ( image ) ; return ( GetFirstImageInList ( image ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void handle_full_packet ( int tun_fd , int dns_fd , int userid ) { unsigned long outlen ; char out [ 64 * 1024 ] ; int touser ; int ret ; outlen = sizeof ( out ) ; ret = uncompress ( ( uint8_t * ) out , & outlen , ( uint8_t * ) users [ userid ] . inpacket . data , users [ userid ] . inpacket . len ) ; if ( ret == Z_OK ) { struct ip * hdr ; hdr = ( struct ip * ) ( out + 4 ) ; touser = find_user_by_ip ( hdr -> ip_dst . s_addr ) ; if ( touser == - 1 ) { write_tun ( tun_fd , out , outlen ) ; } else { if ( users [ touser ] . conn == CONN_DNS_NULL ) { if ( users [ touser ] . outpacket . len == 0 ) { start_new_outpacket ( touser , users [ userid ] . inpacket . data , users [ userid ] . inpacket . len ) ; if ( users [ touser ] . q_sendrealsoon . id != 0 ) send_chunk_or_dataless ( dns_fd , touser , & users [ touser ] . q_sendrealsoon ) ; else if ( users [ touser ] . q . id != 0 ) send_chunk_or_dataless ( dns_fd , touser , & users [ touser ] . q ) ; # ifdef OUTPACKETQ_LEN } else { save_to_outpacketq ( touser , users [ userid ] . inpacket . data , users [ userid ] . inpacket . len ) ; # endif } } else { send_raw ( dns_fd , users [ userid ] . inpacket . data , users [ userid ] . inpacket . len , touser , RAW_HDR_CMD_DATA , & users [ touser ] . q ) ; } } } else { if ( debug >= 1 ) fprintf ( stderr , "Discarded data, uncompress() result: %d\n" , ret ) ; } users [ userid ] . inpacket . len = 0 ; users [ userid ] . inpacket . offset = 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void TIFFCvtIEEEDoubleToNative ( TIFF * tif , u_int n , double * f ) { double_t * fp = ( double_t * ) f ; while ( n -- > 0 ) { IEEEDOUBLE2NATIVE ( fp ) ; fp ++ ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( NativeBackendLibsecretTest , BasicUpdateLogin ) { NativeBackendLibsecret backend ( 42 ) ; VerifiedAdd ( & backend , form_google_ ) ; PasswordForm new_form_google ( form_google_ ) ; new_form_google . times_used = 1 ; new_form_google . action = GURL ( "http://www.google.com/different/login" ) ; EXPECT_EQ ( 1u , global_mock_libsecret_items -> size ( ) ) ; if ( ! global_mock_libsecret_items -> empty ( ) ) { CheckMockSecretItem ( ( * global_mock_libsecret_items ) [ 0 ] , form_google_ , "chrome-42" ) ; } VerifiedUpdate ( & backend , new_form_google ) ; EXPECT_EQ ( 1u , global_mock_libsecret_items -> size ( ) ) ; if ( ! global_mock_libsecret_items -> empty ( ) ) CheckMockSecretItem ( ( * global_mock_libsecret_items ) [ 0 ] , new_form_google , "chrome-42" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int xmlIsDigit ( unsigned int ch ) { return ( xmlIsDigitQ ( ch ) ) ; }
0False