instruction
stringclasses
1 value
input
stringlengths
31
235k
output
class label
2 classes
Categorize the following code snippet as vulnerable or not. True or False
static void comp_ppf_gains ( int lag , PPFParam * ppf , enum Rate cur_rate , int tgt_eng , int ccr , int res_eng ) { int pf_residual ; int temp1 , temp2 ; ppf -> index = lag ; temp1 = tgt_eng * res_eng >> 1 ; temp2 = ccr * ccr << 1 ; if ( temp2 > temp1 ) { if ( ccr >= res_eng ) { ppf -> opt_gain = ppf_gain_weight [ cur_rate ] ; } else { ppf -> opt_gain = ( ccr << 15 ) / res_eng * ppf_gain_weight [ cur_rate ] >> 15 ; } temp1 = ( tgt_eng << 15 ) + ( ccr * ppf -> opt_gain << 1 ) ; temp2 = ( ppf -> opt_gain * ppf -> opt_gain >> 15 ) * res_eng ; pf_residual = av_sat_add32 ( temp1 , temp2 + ( 1 << 15 ) ) >> 16 ; if ( tgt_eng >= pf_residual << 1 ) { temp1 = 0x7fff ; } else { temp1 = ( tgt_eng << 14 ) / pf_residual ; } ppf -> sc_gain = square_root ( temp1 << 16 ) ; } else { ppf -> opt_gain = 0 ; ppf -> sc_gain = 0x7fff ; } ppf -> opt_gain = av_clip_int16 ( ppf -> opt_gain * ppf -> sc_gain >> 15 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void first_pass_motion_search ( VP9_COMP * cpi , MACROBLOCK * x , const MV * ref_mv , MV * best_mv , int * best_motion_err ) { MACROBLOCKD * const xd = & x -> e_mbd ; MV tmp_mv = { 0 , 0 } ; MV ref_mv_full = { ref_mv -> row >> 3 , ref_mv -> col >> 3 } ; int num00 , tmp_err , n ; const BLOCK_SIZE bsize = xd -> mi [ 0 ] . src_mi -> mbmi . sb_type ; vp9_variance_fn_ptr_t v_fn_ptr = cpi -> fn_ptr [ bsize ] ; const int new_mv_mode_penalty = NEW_MV_MODE_PENALTY ; int step_param = 3 ; int further_steps = ( MAX_MVSEARCH_STEPS - 1 ) - step_param ; const int sr = get_search_range ( & cpi -> common ) ; step_param += sr ; further_steps -= sr ; v_fn_ptr . vf = get_block_variance_fn ( bsize ) ; tmp_err = cpi -> diamond_search_sad ( x , & cpi -> ss_cfg , & ref_mv_full , & tmp_mv , step_param , x -> sadperbit16 , & num00 , & v_fn_ptr , ref_mv ) ; if ( tmp_err < INT_MAX ) tmp_err = vp9_get_mvpred_var ( x , & tmp_mv , ref_mv , & v_fn_ptr , 1 ) ; if ( tmp_err < INT_MAX - new_mv_mode_penalty ) tmp_err += new_mv_mode_penalty ; if ( tmp_err < * best_motion_err ) { * best_motion_err = tmp_err ; * best_mv = tmp_mv ; } n = num00 ; num00 = 0 ; while ( n < further_steps ) { ++ n ; if ( num00 ) { -- num00 ; } else { tmp_err = cpi -> diamond_search_sad ( x , & cpi -> ss_cfg , & ref_mv_full , & tmp_mv , step_param + n , x -> sadperbit16 , & num00 , & v_fn_ptr , ref_mv ) ; if ( tmp_err < INT_MAX ) tmp_err = vp9_get_mvpred_var ( x , & tmp_mv , ref_mv , & v_fn_ptr , 1 ) ; if ( tmp_err < INT_MAX - new_mv_mode_penalty ) tmp_err += new_mv_mode_penalty ; if ( tmp_err < * best_motion_err ) { * best_motion_err = tmp_err ; * best_mv = tmp_mv ; } } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void U_CALLCONV UConverter_fromUnicode_ISCII_OFFSETS_LOGIC ( UConverterFromUnicodeArgs * args , UErrorCode * err ) { const UChar * source = args -> source ; const UChar * sourceLimit = args -> sourceLimit ; unsigned char * target = ( unsigned char * ) args -> target ; unsigned char * targetLimit = ( unsigned char * ) args -> targetLimit ; int32_t * offsets = args -> offsets ; uint32_t targetByteUnit = 0x0000 ; UChar32 sourceChar = 0x0000 ; UChar32 tempContextFromUnicode = 0x0000 ; UConverterDataISCII * converterData ; uint16_t newDelta = 0 ; uint16_t range = 0 ; UBool deltaChanged = FALSE ; if ( ( args -> converter == NULL ) || ( args -> targetLimit < args -> target ) || ( args -> sourceLimit < args -> source ) ) { * err = U_ILLEGAL_ARGUMENT_ERROR ; return ; } converterData = ( UConverterDataISCII * ) args -> converter -> extraInfo ; newDelta = converterData -> currentDeltaFromUnicode ; range = ( uint16_t ) ( newDelta / DELTA ) ; if ( ( sourceChar = args -> converter -> fromUChar32 ) != 0 ) { goto getTrail ; } while ( source < sourceLimit ) { if ( args -> converter -> fromUnicodeStatus == LF ) { targetByteUnit = ATR << 8 ; targetByteUnit += ( uint8_t ) lookupInitialData [ range ] . isciiLang ; args -> converter -> fromUnicodeStatus = 0x0000 ; WRITE_TO_TARGET_FROM_U ( args , offsets , source , target , targetLimit , targetByteUnit , err ) ; if ( U_FAILURE ( * err ) ) { break ; } } sourceChar = * source ++ ; tempContextFromUnicode = converterData -> contextCharFromUnicode ; targetByteUnit = missingCharMarker ; if ( sourceChar <= ASCII_END ) { args -> converter -> fromUnicodeStatus = sourceChar ; WRITE_TO_TARGET_FROM_U ( args , offsets , source , target , targetLimit , sourceChar , err ) ; if ( U_FAILURE ( * err ) ) { break ; } continue ; } switch ( sourceChar ) { case ZWNJ : if ( converterData -> contextCharFromUnicode ) { converterData -> contextCharFromUnicode = 0x00 ; targetByteUnit = ISCII_HALANT ; } else { converterData -> contextCharFromUnicode = 0x00 ; continue ; } break ; case ZWJ : if ( converterData -> contextCharFromUnicode ) { targetByteUnit = ISCII_NUKTA ; } else { targetByteUnit = ISCII_INV ; } converterData -> contextCharFromUnicode = 0x00 ; break ; default : if ( ( uint16_t ) ( INDIC_BLOCK_END - sourceChar ) <= INDIC_RANGE ) { if ( sourceChar != DANDA && sourceChar != DOUBLE_DANDA ) { range = ( uint16_t ) ( ( sourceChar - INDIC_BLOCK_BEGIN ) / DELTA ) ; newDelta = ( uint16_t ) ( range * DELTA ) ; if ( newDelta != converterData -> currentDeltaFromUnicode || converterData -> isFirstBuffer ) { converterData -> currentDeltaFromUnicode = newDelta ; converterData -> currentMaskFromUnicode = lookupInitialData [ range ] . maskEnum ; deltaChanged = TRUE ; converterData -> isFirstBuffer = FALSE ; } if ( converterData -> currentDeltaFromUnicode == PNJ_DELTA ) { if ( sourceChar == PNJ_TIPPI ) { sourceChar = PNJ_BINDI ; } else if ( sourceChar == PNJ_ADHAK ) { converterData -> contextCharFromUnicode = PNJ_ADHAK ; } } sourceChar -= converterData -> currentDeltaFromUnicode ; } targetByteUnit = fromUnicodeTable [ ( uint8_t ) sourceChar ] ; if ( ( validityTable [ ( uint8_t ) sourceChar ] & converterData -> currentMaskFromUnicode ) == 0 ) { if ( converterData -> currentDeltaFromUnicode != ( TELUGU_DELTA ) || sourceChar != VOCALLIC_RR ) { targetByteUnit = missingCharMarker ; } } if ( deltaChanged ) { uint32_t temp = 0 ; temp = ( uint16_t ) ( ATR << 8 ) ; temp += ( uint16_t ) ( ( uint8_t ) lookupInitialData [ range ] . isciiLang ) ; deltaChanged = FALSE ; WRITE_TO_TARGET_FROM_U ( args , offsets , source , target , targetLimit , temp , err ) ; if ( U_FAILURE ( * err ) ) { break ; } } if ( converterData -> currentDeltaFromUnicode == PNJ_DELTA && ( sourceChar + PNJ_DELTA ) == PNJ_ADHAK ) { continue ; } } converterData -> contextCharFromUnicode = 0x00 ; break ; } if ( converterData -> currentDeltaFromUnicode == PNJ_DELTA && tempContextFromUnicode == PNJ_ADHAK && isPNJConsonant ( ( sourceChar + PNJ_DELTA ) ) ) { converterData -> contextCharFromUnicode = 0x0000 ; targetByteUnit = targetByteUnit << 16 | ISCII_HALANT << 8 | targetByteUnit ; WRITE_TO_TARGET_FROM_U ( args , offsets , source , target , targetLimit , targetByteUnit , err ) ; if ( U_FAILURE ( * err ) ) { break ; } } else if ( targetByteUnit != missingCharMarker ) { if ( targetByteUnit == ISCII_HALANT ) { converterData -> contextCharFromUnicode = ( UChar ) targetByteUnit ; } WRITE_TO_TARGET_FROM_U ( args , offsets , source , target , targetLimit , targetByteUnit , err ) ; if ( U_FAILURE ( * err ) ) { break ; } } else { if ( U16_IS_SURROGATE ( sourceChar ) ) { if ( U16_IS_SURROGATE_LEAD ( sourceChar ) ) { getTrail : if ( source < sourceLimit ) { UChar trail = ( * source ) ; if ( U16_IS_TRAIL ( trail ) ) { source ++ ; sourceChar = U16_GET_SUPPLEMENTARY ( sourceChar , trail ) ; * err = U_INVALID_CHAR_FOUND ; } else { * err = U_ILLEGAL_CHAR_FOUND ; } } else { * err = U_ZERO_ERROR ; } } else { * err = U_ILLEGAL_CHAR_FOUND ; } } else { * err = U_INVALID_CHAR_FOUND ; } args -> converter -> fromUChar32 = sourceChar ; break ; } } args -> source = source ; args -> target = ( char * ) target ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_diameter_subscription_id ( tvbuff_t * tvb _U_ , packet_info * pinfo _U_ , proto_tree * tree _U_ , void * data _U_ ) { subscription_id_type = SUBSCRIPTION_ID_TYPE_UNKNOWN ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
vpx_codec_err_t vpx_codec_encode ( vpx_codec_ctx_t * ctx , const vpx_image_t * img , vpx_codec_pts_t pts , unsigned long duration , vpx_enc_frame_flags_t flags , unsigned long deadline ) { vpx_codec_err_t res = VPX_CODEC_OK ; if ( ! ctx || ( img && ! duration ) ) res = VPX_CODEC_INVALID_PARAM ; else if ( ! ctx -> iface || ! ctx -> priv ) res = VPX_CODEC_ERROR ; else if ( ! ( ctx -> iface -> caps & VPX_CODEC_CAP_ENCODER ) ) res = VPX_CODEC_INCAPABLE ; else { unsigned int num_enc = ctx -> priv -> enc . total_encoders ; FLOATING_POINT_INIT ( ) ; if ( num_enc == 1 ) res = ctx -> iface -> enc . encode ( get_alg_priv ( ctx ) , img , pts , duration , flags , deadline ) ; else { int i ; ctx += num_enc - 1 ; if ( img ) img += num_enc - 1 ; for ( i = num_enc - 1 ; i >= 0 ; i -- ) { if ( ( res = ctx -> iface -> enc . encode ( get_alg_priv ( ctx ) , img , pts , duration , flags , deadline ) ) ) break ; ctx -- ; if ( img ) img -- ; } ctx ++ ; } FLOATING_POINT_RESTORE ( ) ; } return SAVE_STATUS ( ctx , res ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_T_h245IpAddress ( 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_h245IpAddress , T_h245IpAddress_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void remove_locks_on_signal ( int signo ) { remove_locks ( ) ; sigchain_pop ( signo ) ; raise ( signo ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int ssl3_get_finished ( SSL * s , int a , int b ) { int al , i , ok ; long n ; unsigned char * p ; # ifdef OPENSSL_NO_NEXTPROTONEG # endif n = s -> method -> ssl_get_message ( s , a , b , SSL3_MT_FINISHED , 64 , & ok ) ; if ( ! ok ) return ( ( int ) n ) ; if ( ! s -> s3 -> change_cipher_spec ) { al = SSL_AD_UNEXPECTED_MESSAGE ; SSLerr ( SSL_F_SSL3_GET_FINISHED , SSL_R_GOT_A_FIN_BEFORE_A_CCS ) ; goto f_err ; } s -> s3 -> change_cipher_spec = 0 ; p = ( unsigned char * ) s -> init_msg ; i = s -> s3 -> tmp . peer_finish_md_len ; if ( i != n ) { al = SSL_AD_DECODE_ERROR ; SSLerr ( SSL_F_SSL3_GET_FINISHED , SSL_R_BAD_DIGEST_LENGTH ) ; goto f_err ; } if ( CRYPTO_memcmp ( p , s -> s3 -> tmp . peer_finish_md , i ) != 0 ) { al = SSL_AD_DECRYPT_ERROR ; SSLerr ( SSL_F_SSL3_GET_FINISHED , SSL_R_DIGEST_CHECK_FAILED ) ; goto f_err ; } if ( s -> type == SSL_ST_ACCEPT ) { OPENSSL_assert ( i <= EVP_MAX_MD_SIZE ) ; memcpy ( s -> s3 -> previous_client_finished , s -> s3 -> tmp . peer_finish_md , i ) ; s -> s3 -> previous_client_finished_len = i ; } else { OPENSSL_assert ( i <= EVP_MAX_MD_SIZE ) ; memcpy ( s -> s3 -> previous_server_finished , s -> s3 -> tmp . peer_finish_md , i ) ; s -> s3 -> previous_server_finished_len = i ; } return ( 1 ) ; f_err : ssl3_send_alert ( s , SSL3_AL_FATAL , al ) ; return ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static guint16 de_setup_cont ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo , guint32 offset , guint len , gchar * add_string _U_ , int string_len _U_ ) { dtap_cc_setup ( tvb , tree , pinfo , offset , len ) ; return ( len ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int BrotliStateIsStreamStart ( const BrotliState * s ) { return ( s -> state == BROTLI_STATE_UNINITED && BrotliGetAvailableBits ( & s -> br ) == 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int fz_colorspace_is_icc ( fz_context * ctx , const fz_colorspace * cs ) { return cs && ( cs -> flags & FZ_COLORSPACE_IS_ICC ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void macio_ide_init_drives ( MACIOIDEState * s , DriveInfo * * hd_table ) { int i ; for ( i = 0 ; i < 2 ; i ++ ) { if ( hd_table [ i ] ) { ide_create_drive ( & s -> bus , i , hd_table [ i ] ) ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
struct evdns_server_port * evdns_add_server_port ( int socket , int is_tcp , evdns_request_callback_fn_type cb , void * user_data ) { struct evdns_server_port * port ; if ( ! ( port = malloc ( sizeof ( struct evdns_server_port ) ) ) ) return NULL ; memset ( port , 0 , sizeof ( struct evdns_server_port ) ) ; assert ( ! is_tcp ) ; port -> socket = socket ; port -> refcnt = 1 ; port -> choked = 0 ; port -> closing = 0 ; port -> user_callback = cb ; port -> user_data = user_data ; port -> pending_replies = NULL ; event_set ( & port -> event , port -> socket , EV_READ | EV_PERSIST , server_port_ready_callback , port ) ; event_add ( & port -> event , NULL ) ; return port ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dissect_q931_cause_ie_unsafe ( tvbuff_t * tvb , int offset , int len , proto_tree * tree , int hf_cause_value , guint8 * cause_value , const value_string * ie_vals ) { guint8 octet ; guint8 coding_standard ; guint8 rejection_reason ; if ( len == 0 ) return ; octet = tvb_get_guint8 ( tvb , offset ) ; coding_standard = octet & 0x60 ; if ( coding_standard != Q931_ITU_STANDARDIZED_CODING && ! g931_iso_iec_cause && coding_standard != Q931_ISO_IEC_STANDARDIZED_CODING ) { proto_tree_add_uint ( tree , hf_q931_coding_standard , tvb , offset , 1 , octet ) ; proto_tree_add_item ( tree , hf_q931_cause_data , tvb , offset , len , ENC_NA ) ; return ; } proto_tree_add_uint ( tree , hf_q931_cause_location , tvb , offset , 1 , octet ) ; proto_tree_add_uint ( tree , hf_q931_coding_standard , tvb , offset , 1 , octet ) ; proto_tree_add_boolean ( tree , hf_q931_extension_ind , tvb , offset , 1 , octet ) ; offset += 1 ; len -= 1 ; if ( ! ( octet & Q931_IE_VL_EXTENSION ) ) { if ( len == 0 ) return ; octet = tvb_get_guint8 ( tvb , offset ) ; proto_tree_add_item ( tree , hf_q931_cause_recommendation , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_boolean ( tree , hf_q931_extension_ind , tvb , offset , 1 , octet ) ; offset += 1 ; len -= 1 ; } if ( len == 0 ) return ; octet = tvb_get_guint8 ( tvb , offset ) ; * cause_value = octet & 0x7F ; if ( have_valid_q931_pi ) { q931_pi -> cause_value = * cause_value ; } proto_tree_add_uint ( tree , hf_cause_value , tvb , offset , 1 , * cause_value ) ; proto_tree_add_boolean ( tree , hf_q931_extension_ind , tvb , offset , 1 , octet ) ; offset += 1 ; len -= 1 ; if ( len == 0 ) return ; switch ( * cause_value ) { case Q931_CAUSE_UNALLOC_NUMBER : case Q931_CAUSE_NO_ROUTE_TO_DEST : case Q931_CAUSE_QOS_UNAVAILABLE : proto_tree_add_item ( tree , hf_q931_network_service , tvb , offset , 1 , ENC_NA ) ; proto_tree_add_item ( tree , hf_q931_extension_condition_type , tvb , offset , 1 , ENC_NA ) ; proto_tree_add_item ( tree , hf_q931_extension_condition , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; break ; case Q931_CAUSE_CALL_REJECTED : rejection_reason = octet & 0x7C ; proto_tree_add_item ( tree , hf_q931_cause_call_rejection_reason , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_q931_cause_call_condition , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset += 1 ; len -= 1 ; if ( len == 0 ) return ; switch ( rejection_reason ) { case Q931_REJ_USER_SPECIFIC : proto_tree_add_item ( tree , hf_q931_cause_call_user_specific_diagnostic , tvb , offset , len , ENC_NA ) ; break ; case Q931_REJ_IE_MISSING : proto_tree_add_uint_format_value ( tree , hf_q931_missing_info_element , tvb , offset , 1 , tvb_get_guint8 ( tvb , offset ) , "%s" , val_to_str ( tvb_get_guint8 ( tvb , offset ) , ie_vals , "Unknown (0x%02X)" ) ) ; break ; case Q931_REJ_IE_INSUFFICIENT : proto_tree_add_uint_format_value ( tree , hf_q931_insufficient_info_element , tvb , offset , 1 , tvb_get_guint8 ( tvb , offset ) , "%s" , val_to_str ( tvb_get_guint8 ( tvb , offset ) , ie_vals , "Unknown (0x%02X)" ) ) ; break ; default : proto_tree_add_item ( tree , hf_q931_cause_call_diagnostic , tvb , offset , len , ENC_NA ) ; break ; } break ; case Q931_CAUSE_ACCESS_INFO_DISC : case Q931_CAUSE_INCOMPATIBLE_DEST : case Q931_CAUSE_MAND_IE_MISSING : case Q931_CAUSE_IE_NONEX_OR_UNIMPL : case Q931_CAUSE_INVALID_IE_CONTENTS : do { proto_tree_add_uint_format_value ( tree , hf_q931_information_element , tvb , offset , 1 , tvb_get_guint8 ( tvb , offset ) , "%s" , val_to_str ( tvb_get_guint8 ( tvb , offset ) , ie_vals , "Unknown (0x%02X)" ) ) ; offset += 1 ; len -= 1 ; } while ( len != 0 ) ; break ; case Q931_CAUSE_MT_NONEX_OR_UNIMPL : case Q931_CAUSE_MSG_INCOMPAT_W_CS : proto_tree_add_item ( tree , hf_q931_cause_call_message_type , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; break ; case Q931_CAUSE_REC_TIMER_EXP : if ( len < 3 ) return ; proto_tree_add_item ( tree , hf_q931_cause_call_rec_timer , tvb , offset , 3 , ENC_NA | ENC_ASCII ) ; break ; default : proto_tree_add_item ( tree , hf_q931_cause_call_diagnostic , tvb , offset , len , ENC_NA ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( ExtensionServiceSyncTest , DisableExtensionFromSync ) { base : : FilePath source_install_dir = data_dir ( ) . AppendASCII ( "good" ) . AppendASCII ( "Extensions" ) ; base : : FilePath pref_path = source_install_dir . DirName ( ) . Append ( chrome : : kPreferencesFilename ) ; InitializeInstalledExtensionService ( pref_path , source_install_dir ) ; browser_sync : : ProfileSyncService * sync_service = ProfileSyncServiceFactory : : GetForProfile ( profile ( ) ) ; sync_service -> SetFirstSetupComplete ( ) ; service ( ) -> Init ( ) ; ASSERT_TRUE ( service ( ) -> is_ready ( ) ) ; ASSERT_EQ ( 3u , loaded_ . size ( ) ) ; const Extension * extension = service ( ) -> GetExtensionById ( good0 , true ) ; ASSERT_TRUE ( extension ) ; ASSERT_TRUE ( service ( ) -> IsExtensionEnabled ( good0 ) ) ; extension_sync_service ( ) -> MergeDataAndStartSyncing ( syncer : : EXTENSIONS , syncer : : SyncDataList ( ) , base : : MakeUnique < syncer : : FakeSyncChangeProcessor > ( ) , base : : MakeUnique < syncer : : SyncErrorFactoryMock > ( ) ) ; ExtensionSyncData disable_good_crx ( * extension , false , extensions : : disable_reason : : DISABLE_USER_ACTION , false , false , ExtensionSyncData : : BOOLEAN_UNSET , false ) ; SyncChangeList list ( 1 , disable_good_crx . GetSyncChange ( SyncChange : : ACTION_UPDATE ) ) ; extension_sync_service ( ) -> ProcessSyncChanges ( FROM_HERE , list ) ; ASSERT_FALSE ( service ( ) -> IsExtensionEnabled ( good0 ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void simplestring_addn ( simplestring * target , const char * source , int add_len ) { if ( target && source ) { if ( ! target -> str ) { simplestring_init_str ( target ) ; } if ( target -> len + add_len + 1 > target -> size ) { int newsize = target -> len + add_len + 1 ; int incr = target -> size * 2 ; newsize = newsize - ( newsize % incr ) + incr ; target -> str = ( char * ) realloc ( target -> str , newsize ) ; target -> size = target -> str ? newsize : 0 ; } if ( target -> str ) { if ( add_len ) { memcpy ( target -> str + target -> len , source , add_len ) ; } target -> len += add_len ; target -> str [ target -> len ] = 0 ; } } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void application_unhandled_uri ( ActivateParameters * parameters , char * uri ) { gboolean show_install_mime ; char * mime_type ; NautilusFile * file ; ActivateParametersInstall * parameters_install ; file = nautilus_file_get_by_uri ( uri ) ; mime_type = nautilus_file_get_mime_type ( file ) ; parameters_install = g_new0 ( ActivateParametersInstall , 1 ) ; parameters_install -> slot = parameters -> slot ; g_object_add_weak_pointer ( G_OBJECT ( parameters_install -> slot ) , ( gpointer * ) & parameters_install -> slot ) ; if ( parameters -> parent_window ) { parameters_install -> parent_window = parameters -> parent_window ; g_object_add_weak_pointer ( G_OBJECT ( parameters_install -> parent_window ) , ( gpointer * ) & parameters_install -> parent_window ) ; } parameters_install -> activation_directory = g_strdup ( parameters -> activation_directory ) ; parameters_install -> file = file ; parameters_install -> files = get_file_list_for_launch_locations ( parameters -> locations ) ; parameters_install -> flags = parameters -> flags ; parameters_install -> user_confirmation = parameters -> user_confirmation ; parameters_install -> uri = g_strdup ( uri ) ; # ifdef ENABLE_PACKAGEKIT show_install_mime = g_settings_get_boolean ( nautilus_preferences , NAUTILUS_PREFERENCES_INSTALL_MIME_ACTIVATION ) ; # else show_install_mime = FALSE ; # endif if ( g_content_type_is_unknown ( mime_type ) ) { show_install_mime = FALSE ; } g_free ( mime_type ) ; if ( ! show_install_mime ) { goto out ; } g_dbus_proxy_new_for_bus ( G_BUS_TYPE_SESSION , G_DBUS_PROXY_FLAGS_NONE , NULL , "org.freedesktop.PackageKit" , "/org/freedesktop/PackageKit" , "org.freedesktop.PackageKit.Modify" , NULL , pk_proxy_appeared_cb , parameters_install ) ; return ; out : show_unhandled_type_error ( parameters_install ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int rm_assemble_video_frame ( AVFormatContext * s , AVIOContext * pb , RMDemuxContext * rm , RMStream * vst , AVPacket * pkt , int len , int * pseq , int64_t * timestamp ) { int hdr ; int seq = 0 , pic_num = 0 , len2 = 0 , pos = 0 ; int type ; int ret ; hdr = avio_r8 ( pb ) ; len -- ; type = hdr >> 6 ; if ( type != 3 ) { seq = avio_r8 ( pb ) ; len -- ; } if ( type != 1 ) { len2 = get_num ( pb , & len ) ; pos = get_num ( pb , & len ) ; pic_num = avio_r8 ( pb ) ; len -- ; } if ( len < 0 ) { av_log ( s , AV_LOG_ERROR , "Insufficient data\n" ) ; return - 1 ; } rm -> remaining_len = len ; if ( type & 1 ) { if ( type == 3 ) { len = len2 ; * timestamp = pos ; } if ( rm -> remaining_len < len ) { av_log ( s , AV_LOG_ERROR , "Insufficient remaining len\n" ) ; return - 1 ; } rm -> remaining_len -= len ; if ( av_new_packet ( pkt , len + 9 ) < 0 ) return AVERROR ( EIO ) ; pkt -> data [ 0 ] = 0 ; AV_WL32 ( pkt -> data + 1 , 1 ) ; AV_WL32 ( pkt -> data + 5 , 0 ) ; if ( ( ret = avio_read ( pb , pkt -> data + 9 , len ) ) != len ) { av_packet_unref ( pkt ) ; av_log ( s , AV_LOG_ERROR , "Failed to read %d bytes\n" , len ) ; return ret < 0 ? ret : AVERROR ( EIO ) ; } return 0 ; } / ow we have to deal with single slice * pseq = seq ; if ( ( seq & 0x7F ) == 1 || vst -> curpic_num != pic_num ) { if ( len2 > ffio_limit ( pb , len2 ) ) { av_log ( s , AV_LOG_ERROR , "Impossibly sized packet\n" ) ; return AVERROR_INVALIDDATA ; } vst -> slices = ( ( hdr & 0x3F ) << 1 ) + 1 ; vst -> videobufsize = len2 + 8 * vst -> slices + 1 ; av_packet_unref ( & vst -> pkt ) ; if ( av_new_packet ( & vst -> pkt , vst -> videobufsize ) < 0 ) return AVERROR ( ENOMEM ) ; memset ( vst -> pkt . data , 0 , vst -> pkt . size ) ; vst -> videobufpos = 8 * vst -> slices + 1 ; vst -> cur_slice = 0 ; vst -> curpic_num = pic_num ; vst -> pktpos = avio_tell ( pb ) ; } if ( type == 2 ) len = FFMIN ( len , pos ) ; if ( ++ vst -> cur_slice > vst -> slices ) { av_log ( s , AV_LOG_ERROR , "cur slice %d, too large\n" , vst -> cur_slice ) ; return 1 ; } if ( ! vst -> pkt . data ) return AVERROR ( ENOMEM ) ; AV_WL32 ( vst -> pkt . data - 7 + 8 * vst -> cur_slice , 1 ) ; AV_WL32 ( vst -> pkt . data - 3 + 8 * vst -> cur_slice , vst -> videobufpos - 8 * vst -> slices - 1 ) ; if ( vst -> videobufpos + len > vst -> videobufsize ) { av_log ( s , AV_LOG_ERROR , "outside videobufsize\n" ) ; return 1 ; } if ( avio_read ( pb , vst -> pkt . data + vst -> videobufpos , len ) != len ) return AVERROR ( EIO ) ; vst -> videobufpos += len ; rm -> remaining_len -= len ; if ( type == 2 || vst -> videobufpos == vst -> videobufsize ) { vst -> pkt . data [ 0 ] = vst -> cur_slice - 1 ; * pkt = vst -> pkt ; vst -> pkt . data = NULL ; vst -> pkt . size = 0 ; vst -> pkt . buf = NULL ; if ( vst -> slices != vst -> cur_slice ) memmove ( pkt -> data + 1 + 8 * vst -> cur_slice , pkt -> data + 1 + 8 * vst -> slices , vst -> videobufpos - 1 - 8 * vst -> slices ) ; pkt -> size = vst -> videobufpos + 8 * ( vst -> cur_slice - vst -> slices ) ; pkt -> pts = AV_NOPTS_VALUE ; pkt -> pos = vst -> pktpos ; vst -> slices = 0 ; return 0 ; } return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void typhoon_pcihost_class_init ( ObjectClass * klass , void * data ) { DeviceClass * dc = DEVICE_CLASS ( klass ) ; SysBusDeviceClass * k = SYS_BUS_DEVICE_CLASS ( klass ) ; k -> init = typhoon_pcihost_init ; dc -> no_user = 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int dissect_h225_TimeToLive ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 1U , 4294967295U , NULL , FALSE ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void T_UConverter_fromUnicode_UTF32_BE_OFFSET_LOGIC ( UConverterFromUnicodeArgs * args , UErrorCode * err ) { const UChar * mySource = args -> source ; unsigned char * myTarget ; int32_t * myOffsets ; const UChar * sourceLimit = args -> sourceLimit ; const unsigned char * targetLimit = ( unsigned char * ) args -> targetLimit ; UChar32 ch , ch2 ; int32_t offsetNum = 0 ; unsigned int indexToWrite ; unsigned char temp [ sizeof ( uint32_t ) ] ; if ( mySource >= sourceLimit ) { return ; } if ( args -> converter -> fromUnicodeStatus == UCNV_NEED_TO_WRITE_BOM ) { static const char bom [ ] = { 0 , 0 , ( char ) 0xfe , ( char ) 0xff } ; ucnv_fromUWriteBytes ( args -> converter , bom , 4 , & args -> target , args -> targetLimit , & args -> offsets , - 1 , err ) ; args -> converter -> fromUnicodeStatus = 0 ; } myTarget = ( unsigned char * ) args -> target ; myOffsets = args -> offsets ; temp [ 0 ] = 0 ; if ( args -> converter -> fromUChar32 ) { ch = args -> converter -> fromUChar32 ; args -> converter -> fromUChar32 = 0 ; goto lowsurogate ; } while ( mySource < sourceLimit && myTarget < targetLimit ) { ch = * ( mySource ++ ) ; if ( U_IS_SURROGATE ( ch ) ) { if ( U_IS_LEAD ( ch ) ) { lowsurogate : if ( mySource < sourceLimit ) { ch2 = * mySource ; if ( U_IS_TRAIL ( ch2 ) ) { ch = ( ( ch - SURROGATE_HIGH_START ) << HALF_SHIFT ) + ch2 + SURROGATE_LOW_BASE ; mySource ++ ; } else { args -> converter -> fromUChar32 = ch ; * err = U_ILLEGAL_CHAR_FOUND ; break ; } } else { args -> converter -> fromUChar32 = ch ; if ( args -> flush ) { * err = U_ILLEGAL_CHAR_FOUND ; } break ; } } else { args -> converter -> fromUChar32 = ch ; * err = U_ILLEGAL_CHAR_FOUND ; break ; } } temp [ 1 ] = ( uint8_t ) ( ch >> 16 & 0x1F ) ; temp [ 2 ] = ( uint8_t ) ( ch >> 8 ) ; temp [ 3 ] = ( uint8_t ) ( ch ) ; for ( indexToWrite = 0 ; indexToWrite <= sizeof ( uint32_t ) - 1 ; indexToWrite ++ ) { if ( myTarget < targetLimit ) { * ( myTarget ++ ) = temp [ indexToWrite ] ; * ( myOffsets ++ ) = offsetNum ; } else { args -> converter -> charErrorBuffer [ args -> converter -> charErrorBufferLength ++ ] = temp [ indexToWrite ] ; * err = U_BUFFER_OVERFLOW_ERROR ; } } offsetNum = offsetNum + 1 + ( temp [ 1 ] != 0 ) ; } if ( mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS ( * err ) ) { * err = U_BUFFER_OVERFLOW_ERROR ; } args -> target = ( char * ) myTarget ; args -> source = mySource ; args -> offsets = myOffsets ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static subpicture_t * spu_new_buffer ( decoder_t * p_dec , const subpicture_updater_t * p_updater ) { decoder_owner_sys_t * p_owner = p_dec -> p_owner ; vout_thread_t * p_vout = NULL ; subpicture_t * p_subpic ; int i_attempts = 30 ; while ( i_attempts -- ) { if ( DecoderIsExitRequested ( p_dec ) || p_dec -> b_error ) break ; p_vout = input_resource_HoldVout ( p_owner -> p_resource ) ; if ( p_vout ) break ; msleep ( DECODER_SPU_VOUT_WAIT_DURATION ) ; } if ( ! p_vout ) { msg_Warn ( p_dec , "no vout found, dropping subpicture" ) ; return NULL ; } if ( p_owner -> p_spu_vout != p_vout ) { p_owner -> i_spu_channel = vout_RegisterSubpictureChannel ( p_vout ) ; p_owner -> i_spu_order = 0 ; p_owner -> p_spu_vout = p_vout ; } p_subpic = subpicture_New ( p_updater ) ; if ( p_subpic ) { p_subpic -> i_channel = p_owner -> i_spu_channel ; p_subpic -> i_order = p_owner -> i_spu_order ++ ; p_subpic -> b_subtitle = true ; } vlc_object_release ( p_vout ) ; return p_subpic ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
bool RegisterAccountChooserDialogAndroid ( JNIEnv * env ) { return RegisterNativesImpl ( env ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int x ( struct vcache * avc , int afun , struct vrequest * areq , \ struct afs_pdata * ain , struct afs_pdata * aout , \ afs_ucred_t * * acred ) DECL_PIOCTL ( PGetFID ) ; DECL_PIOCTL ( PSetAcl ) ; DECL_PIOCTL ( PStoreBehind ) ; DECL_PIOCTL ( PGCPAGs ) ; DECL_PIOCTL ( PGetAcl ) ; DECL_PIOCTL ( PNoop ) ; DECL_PIOCTL ( PBogus ) ; DECL_PIOCTL ( PGetFileCell ) ; DECL_PIOCTL ( PGetWSCell ) ; DECL_PIOCTL ( PGetUserCell ) ; DECL_PIOCTL ( PSetTokens ) ; DECL_PIOCTL ( PGetVolumeStatus ) ; DECL_PIOCTL ( PSetVolumeStatus ) ; DECL_PIOCTL ( PFlush ) ; DECL_PIOCTL ( PNewStatMount ) ; DECL_PIOCTL ( PGetTokens ) ; DECL_PIOCTL ( PUnlog ) ; DECL_PIOCTL ( PMariner ) ; DECL_PIOCTL ( PCheckServers ) ; DECL_PIOCTL ( PCheckVolNames ) ; DECL_PIOCTL ( PCheckAuth ) ; DECL_PIOCTL ( PFindVolume ) ; DECL_PIOCTL ( PViceAccess ) ; DECL_PIOCTL ( PSetCacheSize ) ; DECL_PIOCTL ( PGetCacheSize ) ; DECL_PIOCTL ( PRemoveCallBack ) ; DECL_PIOCTL ( PNewCell ) ; DECL_PIOCTL ( PNewAlias ) ; DECL_PIOCTL ( PListCells ) ; DECL_PIOCTL ( PListAliases ) ; DECL_PIOCTL ( PRemoveMount ) ; DECL_PIOCTL ( PGetCellStatus )
0False
Categorize the following code snippet as vulnerable or not. True or False
static fz_path * xps_parse_abbreviated_geometry ( xps_document * doc , char * geom , int * fill_rule ) { fz_path * path ; char * * args ; char * * pargs ; char * s = geom ; fz_point pt ; int i , n ; int cmd , old ; float x1 , y1 , x2 , y2 , x3 , y3 ; float smooth_x , smooth_y ; int reset_smooth ; path = fz_new_path ( doc -> ctx ) ; args = fz_malloc_array ( doc -> ctx , strlen ( geom ) + 1 , sizeof ( char * ) ) ; pargs = args ; while ( * s ) { if ( ( * s >= 'A' && * s <= 'Z' ) || ( * s >= 'a' && * s <= 'z' ) ) { * pargs ++ = s ++ ; } else if ( ( * s >= '0' && * s <= '9' ) || * s == '.' || * s == '+' || * s == '-' || * s == 'e' || * s == 'E' ) { * pargs ++ = s ; while ( ( * s >= '0' && * s <= '9' ) || * s == '.' || * s == '+' || * s == '-' || * s == 'e' || * s == 'E' ) s ++ ; } else { s ++ ; } } * pargs = s ; n = pargs - args ; i = 0 ; old = 0 ; reset_smooth = 1 ; smooth_x = 0 ; smooth_y = 0 ; while ( i < n ) { cmd = args [ i ] [ 0 ] ; if ( cmd == '+' || cmd == '.' || cmd == '-' || ( cmd >= '0' && cmd <= '9' ) ) cmd = old ; else i ++ ; if ( reset_smooth ) { smooth_x = 0 ; smooth_y = 0 ; } reset_smooth = 1 ; switch ( cmd ) { case 'F' : if ( i >= n ) break ; * fill_rule = atoi ( args [ i ] ) ; i ++ ; break ; case 'M' : if ( i + 1 >= n ) break ; fz_moveto ( doc -> ctx , path , fz_atof ( args [ i ] ) , fz_atof ( args [ i + 1 ] ) ) ; i += 2 ; break ; case 'm' : if ( i + 1 >= n ) break ; pt = fz_currentpoint ( doc -> ctx , path ) ; fz_moveto ( doc -> ctx , path , pt . x + fz_atof ( args [ i ] ) , pt . y + fz_atof ( args [ i + 1 ] ) ) ; i += 2 ; break ; case 'L' : if ( i + 1 >= n ) break ; fz_lineto ( doc -> ctx , path , fz_atof ( args [ i ] ) , fz_atof ( args [ i + 1 ] ) ) ; i += 2 ; break ; case 'l' : if ( i + 1 >= n ) break ; pt = fz_currentpoint ( doc -> ctx , path ) ; fz_lineto ( doc -> ctx , path , pt . x + fz_atof ( args [ i ] ) , pt . y + fz_atof ( args [ i + 1 ] ) ) ; i += 2 ; break ; case 'H' : if ( i >= n ) break ; pt = fz_currentpoint ( doc -> ctx , path ) ; fz_lineto ( doc -> ctx , path , fz_atof ( args [ i ] ) , pt . y ) ; i += 1 ; break ; case 'h' : if ( i >= n ) break ; pt = fz_currentpoint ( doc -> ctx , path ) ; fz_lineto ( doc -> ctx , path , pt . x + fz_atof ( args [ i ] ) , pt . y ) ; i += 1 ; break ; case 'V' : if ( i >= n ) break ; pt = fz_currentpoint ( doc -> ctx , path ) ; fz_lineto ( doc -> ctx , path , pt . x , fz_atof ( args [ i ] ) ) ; i += 1 ; break ; case 'v' : if ( i >= n ) break ; pt = fz_currentpoint ( doc -> ctx , path ) ; fz_lineto ( doc -> ctx , path , pt . x , pt . y + fz_atof ( args [ i ] ) ) ; i += 1 ; break ; case 'C' : if ( i + 5 >= n ) break ; x1 = fz_atof ( args [ i + 0 ] ) ; y1 = fz_atof ( args [ i + 1 ] ) ; x2 = fz_atof ( args [ i + 2 ] ) ; y2 = fz_atof ( args [ i + 3 ] ) ; x3 = fz_atof ( args [ i + 4 ] ) ; y3 = fz_atof ( args [ i + 5 ] ) ; fz_curveto ( doc -> ctx , path , x1 , y1 , x2 , y2 , x3 , y3 ) ; i += 6 ; reset_smooth = 0 ; smooth_x = x3 - x2 ; smooth_y = y3 - y2 ; break ; case 'c' : if ( i + 5 >= n ) break ; pt = fz_currentpoint ( doc -> ctx , path ) ; x1 = fz_atof ( args [ i + 0 ] ) + pt . x ; y1 = fz_atof ( args [ i + 1 ] ) + pt . y ; x2 = fz_atof ( args [ i + 2 ] ) + pt . x ; y2 = fz_atof ( args [ i + 3 ] ) + pt . y ; x3 = fz_atof ( args [ i + 4 ] ) + pt . x ; y3 = fz_atof ( args [ i + 5 ] ) + pt . y ; fz_curveto ( doc -> ctx , path , x1 , y1 , x2 , y2 , x3 , y3 ) ; i += 6 ; reset_smooth = 0 ; smooth_x = x3 - x2 ; smooth_y = y3 - y2 ; break ; case 'S' : if ( i + 3 >= n ) break ; pt = fz_currentpoint ( doc -> ctx , path ) ; x1 = fz_atof ( args [ i + 0 ] ) ; y1 = fz_atof ( args [ i + 1 ] ) ; x2 = fz_atof ( args [ i + 2 ] ) ; y2 = fz_atof ( args [ i + 3 ] ) ; fz_curveto ( doc -> ctx , path , pt . x + smooth_x , pt . y + smooth_y , x1 , y1 , x2 , y2 ) ; i += 4 ; reset_smooth = 0 ; smooth_x = x2 - x1 ; smooth_y = y2 - y1 ; break ; case 's' : if ( i + 3 >= n ) break ; pt = fz_currentpoint ( doc -> ctx , path ) ; x1 = fz_atof ( args [ i + 0 ] ) + pt . x ; y1 = fz_atof ( args [ i + 1 ] ) + pt . y ; x2 = fz_atof ( args [ i + 2 ] ) + pt . x ; y2 = fz_atof ( args [ i + 3 ] ) + pt . y ; fz_curveto ( doc -> ctx , path , pt . x + smooth_x , pt . y + smooth_y , x1 , y1 , x2 , y2 ) ; i += 4 ; reset_smooth = 0 ; smooth_x = x2 - x1 ; smooth_y = y2 - y1 ; break ; case 'Q' : if ( i + 3 >= n ) break ; pt = fz_currentpoint ( doc -> ctx , path ) ; x1 = fz_atof ( args [ i + 0 ] ) ; y1 = fz_atof ( args [ i + 1 ] ) ; x2 = fz_atof ( args [ i + 2 ] ) ; y2 = fz_atof ( args [ i + 3 ] ) ; fz_curveto ( doc -> ctx , path , ( pt . x + 2 * x1 ) / 3 , ( pt . y + 2 * y1 ) / 3 , ( x2 + 2 * x1 ) / 3 , ( y2 + 2 * y1 ) / 3 , x2 , y2 ) ; i += 4 ; break ; case 'q' : if ( i + 3 >= n ) break ; pt = fz_currentpoint ( doc -> ctx , path ) ; x1 = fz_atof ( args [ i + 0 ] ) + pt . x ; y1 = fz_atof ( args [ i + 1 ] ) + pt . y ; x2 = fz_atof ( args [ i + 2 ] ) + pt . x ; y2 = fz_atof ( args [ i + 3 ] ) + pt . y ; fz_curveto ( doc -> ctx , path , ( pt . x + 2 * x1 ) / 3 , ( pt . y + 2 * y1 ) / 3 , ( x2 + 2 * x1 ) / 3 , ( y2 + 2 * y1 ) / 3 , x2 , y2 ) ; i += 4 ; break ; case 'A' : if ( i + 6 >= n ) break ; xps_draw_arc ( doc -> ctx , path , fz_atof ( args [ i + 0 ] ) , fz_atof ( args [ i + 1 ] ) , fz_atof ( args [ i + 2 ] ) , atoi ( args [ i + 3 ] ) , atoi ( args [ i + 4 ] ) , fz_atof ( args [ i + 5 ] ) , fz_atof ( args [ i + 6 ] ) ) ; i += 7 ; break ; case 'a' : if ( i + 6 >= n ) break ; pt = fz_currentpoint ( doc -> ctx , path ) ; xps_draw_arc ( doc -> ctx , path , fz_atof ( args [ i + 0 ] ) , fz_atof ( args [ i + 1 ] ) , fz_atof ( args [ i + 2 ] ) , atoi ( args [ i + 3 ] ) , atoi ( args [ i + 4 ] ) , fz_atof ( args [ i + 5 ] ) + pt . x , fz_atof ( args [ i + 6 ] ) + pt . y ) ; i += 7 ; break ; case 'Z' : case 'z' : fz_closepath ( doc -> ctx , path ) ; break ; default : fz_warn ( doc -> ctx , "ignoring invalid command '%c'" , cmd ) ; while ( i < n && ( args [ i ] [ 0 ] == '+' || args [ i ] [ 0 ] == '.' || args [ i ] [ 0 ] == '-' || ( args [ i ] [ 0 ] >= '0' && args [ i ] [ 0 ] <= '9' ) ) ) i ++ ; break ; } old = cmd ; } fz_free ( doc -> ctx , args ) ; return path ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void update_mb_info ( MpegEncContext * s , int startcode ) { if ( ! s -> mb_info ) return ; if ( put_bits_count ( & s -> pb ) - s -> prev_mb_info * 8 >= s -> mb_info * 8 ) { s -> mb_info_size += 12 ; s -> prev_mb_info = s -> last_mb_info ; } if ( startcode ) { s -> prev_mb_info = put_bits_count ( & s -> pb ) / 8 ; return ; } s -> last_mb_info = put_bits_count ( & s -> pb ) / 8 ; if ( ! s -> mb_info_size ) s -> mb_info_size += 12 ; write_mb_info ( s ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gcry_err_code_t sexp_data_to_mpi ( gcry_sexp_t input , gcry_mpi_t * ret_mpi , struct pk_encoding_ctx * ctx ) { gcry_err_code_t rc = 0 ; gcry_sexp_t ldata , lhash , lvalue ; int i ; size_t n ; const char * s ; int unknown_flag = 0 ; int parsed_flags = 0 ; int explicit_raw = 0 ; * ret_mpi = NULL ; ldata = gcry_sexp_find_token ( input , "data" , 0 ) ; if ( ! ldata ) { * ret_mpi = gcry_sexp_nth_mpi ( input , 0 , 0 ) ; return * ret_mpi ? GPG_ERR_NO_ERROR : GPG_ERR_INV_OBJ ; } { gcry_sexp_t lflags = gcry_sexp_find_token ( ldata , "flags" , 0 ) ; if ( lflags ) { for ( i = gcry_sexp_length ( lflags ) - 1 ; i > 0 ; i -- ) { s = gcry_sexp_nth_data ( lflags , i , & n ) ; if ( ! s ) ; else if ( n == 7 && ! memcmp ( s , "rfc6979" , 7 ) ) parsed_flags |= PUBKEY_FLAG_RFC6979 ; else if ( n == 5 && ! memcmp ( s , "eddsa" , 5 ) ) { ctx -> encoding = PUBKEY_ENC_RAW ; parsed_flags |= PUBKEY_FLAG_EDDSA ; } else if ( n == 3 && ! memcmp ( s , "raw" , 3 ) && ctx -> encoding == PUBKEY_ENC_UNKNOWN ) { ctx -> encoding = PUBKEY_ENC_RAW ; explicit_raw = 1 ; } else if ( n == 5 && ! memcmp ( s , "pkcs1" , 5 ) && ctx -> encoding == PUBKEY_ENC_UNKNOWN ) ctx -> encoding = PUBKEY_ENC_PKCS1 ; else if ( n == 4 && ! memcmp ( s , "oaep" , 4 ) && ctx -> encoding == PUBKEY_ENC_UNKNOWN ) ctx -> encoding = PUBKEY_ENC_OAEP ; else if ( n == 3 && ! memcmp ( s , "pss" , 3 ) && ctx -> encoding == PUBKEY_ENC_UNKNOWN ) ctx -> encoding = PUBKEY_ENC_PSS ; else if ( n == 11 && ! memcmp ( s , "no-blinding" , 11 ) ) parsed_flags |= PUBKEY_FLAG_NO_BLINDING ; else unknown_flag = 1 ; } gcry_sexp_release ( lflags ) ; } } if ( ctx -> encoding == PUBKEY_ENC_UNKNOWN ) ctx -> encoding = PUBKEY_ENC_RAW ; lhash = gcry_sexp_find_token ( ldata , "hash" , 0 ) ; lvalue = lhash ? NULL : gcry_sexp_find_token ( ldata , "value" , 0 ) ; if ( ! ( ! lhash ^ ! lvalue ) ) rc = GPG_ERR_INV_OBJ ; else if ( unknown_flag ) rc = GPG_ERR_INV_FLAG ; else if ( ctx -> encoding == PUBKEY_ENC_RAW && ( parsed_flags & PUBKEY_FLAG_EDDSA ) ) { gcry_sexp_t list ; void * value ; size_t valuelen ; if ( ! lvalue ) { rc = GPG_ERR_INV_OBJ ; goto leave ; } list = gcry_sexp_find_token ( ldata , "hash-algo" , 0 ) ; if ( list ) { s = gcry_sexp_nth_data ( list , 1 , & n ) ; if ( ! s ) rc = GPG_ERR_NO_OBJ ; else { ctx -> hash_algo = get_hash_algo ( s , n ) ; if ( ! ctx -> hash_algo ) rc = GPG_ERR_DIGEST_ALGO ; } gcry_sexp_release ( list ) ; } else rc = GPG_ERR_INV_OBJ ; if ( rc ) goto leave ; value = gcry_sexp_nth_buffer ( lvalue , 1 , & valuelen ) ; if ( ! value ) rc = GPG_ERR_INV_OBJ ; else if ( ( valuelen * 8 ) < valuelen ) { gcry_free ( value ) ; rc = GPG_ERR_TOO_LARGE ; } if ( rc ) goto leave ; * ret_mpi = gcry_mpi_set_opaque ( NULL , value , valuelen * 8 ) ; } else if ( ctx -> encoding == PUBKEY_ENC_RAW && lhash && ( explicit_raw || ( parsed_flags & PUBKEY_FLAG_RFC6979 ) ) ) { if ( gcry_sexp_length ( lhash ) != 3 ) rc = GPG_ERR_INV_OBJ ; else if ( ! ( s = gcry_sexp_nth_data ( lhash , 1 , & n ) ) || ! n ) rc = GPG_ERR_INV_OBJ ; else { void * value ; size_t valuelen ; ctx -> hash_algo = get_hash_algo ( s , n ) ; if ( ! ctx -> hash_algo ) rc = GPG_ERR_DIGEST_ALGO ; else if ( ! ( value = gcry_sexp_nth_buffer ( lhash , 2 , & valuelen ) ) ) rc = GPG_ERR_INV_OBJ ; else if ( ( valuelen * 8 ) < valuelen ) { gcry_free ( value ) ; rc = GPG_ERR_TOO_LARGE ; } else * ret_mpi = gcry_mpi_set_opaque ( NULL , value , valuelen * 8 ) ; } } else if ( ctx -> encoding == PUBKEY_ENC_RAW && lvalue ) { if ( parsed_flags & PUBKEY_FLAG_RFC6979 ) { rc = GPG_ERR_CONFLICT ; goto leave ; } * ret_mpi = gcry_sexp_nth_mpi ( lvalue , 1 , GCRYMPI_FMT_USG ) ; if ( ! * ret_mpi ) rc = GPG_ERR_INV_OBJ ; } else if ( ctx -> encoding == PUBKEY_ENC_PKCS1 && lvalue && ctx -> op == PUBKEY_OP_ENCRYPT ) { const void * value ; size_t valuelen ; gcry_sexp_t list ; void * random_override = NULL ; size_t random_override_len = 0 ; if ( ! ( value = gcry_sexp_nth_data ( lvalue , 1 , & valuelen ) ) || ! valuelen ) rc = GPG_ERR_INV_OBJ ; else { list = gcry_sexp_find_token ( ldata , "random-override" , 0 ) ; if ( list ) { s = gcry_sexp_nth_data ( list , 1 , & n ) ; if ( ! s ) rc = GPG_ERR_NO_OBJ ; else if ( n > 0 ) { random_override = gcry_malloc ( n ) ; if ( ! random_override ) rc = gpg_err_code_from_syserror ( ) ; else { memcpy ( random_override , s , n ) ; random_override_len = n ; } } gcry_sexp_release ( list ) ; if ( rc ) goto leave ; } rc = pkcs1_encode_for_encryption ( ret_mpi , ctx -> nbits , value , valuelen , random_override , random_override_len ) ; gcry_free ( random_override ) ; } } else if ( ctx -> encoding == PUBKEY_ENC_PKCS1 && lhash && ( ctx -> op == PUBKEY_OP_SIGN || ctx -> op == PUBKEY_OP_VERIFY ) ) { if ( gcry_sexp_length ( lhash ) != 3 ) rc = GPG_ERR_INV_OBJ ; else if ( ! ( s = gcry_sexp_nth_data ( lhash , 1 , & n ) ) || ! n ) rc = GPG_ERR_INV_OBJ ; else { const void * value ; size_t valuelen ; ctx -> hash_algo = get_hash_algo ( s , n ) ; if ( ! ctx -> hash_algo ) rc = GPG_ERR_DIGEST_ALGO ; else if ( ! ( value = gcry_sexp_nth_data ( lhash , 2 , & valuelen ) ) || ! valuelen ) rc = GPG_ERR_INV_OBJ ; else rc = pkcs1_encode_for_signature ( ret_mpi , ctx -> nbits , value , valuelen , ctx -> hash_algo ) ; } } else if ( ctx -> encoding == PUBKEY_ENC_OAEP && lvalue && ctx -> op == PUBKEY_OP_ENCRYPT ) { const void * value ; size_t valuelen ; if ( ! ( value = gcry_sexp_nth_data ( lvalue , 1 , & valuelen ) ) || ! valuelen ) rc = GPG_ERR_INV_OBJ ; else { gcry_sexp_t list ; void * random_override = NULL ; size_t random_override_len = 0 ; list = gcry_sexp_find_token ( ldata , "hash-algo" , 0 ) ; if ( list ) { s = gcry_sexp_nth_data ( list , 1 , & n ) ; if ( ! s ) rc = GPG_ERR_NO_OBJ ; else { ctx -> hash_algo = get_hash_algo ( s , n ) ; if ( ! ctx -> hash_algo ) rc = GPG_ERR_DIGEST_ALGO ; } gcry_sexp_release ( list ) ; if ( rc ) goto leave ; } list = gcry_sexp_find_token ( ldata , "label" , 0 ) ; if ( list ) { s = gcry_sexp_nth_data ( list , 1 , & n ) ; if ( ! s ) rc = GPG_ERR_NO_OBJ ; else if ( n > 0 ) { ctx -> label = gcry_malloc ( n ) ; if ( ! ctx -> label ) rc = gpg_err_code_from_syserror ( ) ; else { memcpy ( ctx -> label , s , n ) ; ctx -> labellen = n ; } } gcry_sexp_release ( list ) ; if ( rc ) goto leave ; } list = gcry_sexp_find_token ( ldata , "random-override" , 0 ) ; if ( list ) { s = gcry_sexp_nth_data ( list , 1 , & n ) ; if ( ! s ) rc = GPG_ERR_NO_OBJ ; else if ( n > 0 ) { random_override = gcry_malloc ( n ) ; if ( ! random_override ) rc = gpg_err_code_from_syserror ( ) ; else { memcpy ( random_override , s , n ) ; random_override_len = n ; } } gcry_sexp_release ( list ) ; if ( rc ) goto leave ; } rc = oaep_encode ( ret_mpi , ctx -> nbits , ctx -> hash_algo , value , valuelen , ctx -> label , ctx -> labellen , random_override , random_override_len ) ; gcry_free ( random_override ) ; } } else if ( ctx -> encoding == PUBKEY_ENC_PSS && lhash && ctx -> op == PUBKEY_OP_SIGN ) { if ( gcry_sexp_length ( lhash ) != 3 ) rc = GPG_ERR_INV_OBJ ; else if ( ! ( s = gcry_sexp_nth_data ( lhash , 1 , & n ) ) || ! n ) rc = GPG_ERR_INV_OBJ ; else { const void * value ; size_t valuelen ; void * random_override = NULL ; size_t random_override_len = 0 ; ctx -> hash_algo = get_hash_algo ( s , n ) ; if ( ! ctx -> hash_algo ) rc = GPG_ERR_DIGEST_ALGO ; else if ( ! ( value = gcry_sexp_nth_data ( lhash , 2 , & valuelen ) ) || ! valuelen ) rc = GPG_ERR_INV_OBJ ; else { gcry_sexp_t list ; list = gcry_sexp_find_token ( ldata , "salt-length" , 0 ) ; if ( list ) { s = gcry_sexp_nth_data ( list , 1 , & n ) ; if ( ! s ) { rc = GPG_ERR_NO_OBJ ; goto leave ; } ctx -> saltlen = ( unsigned int ) strtoul ( s , NULL , 10 ) ; gcry_sexp_release ( list ) ; } list = gcry_sexp_find_token ( ldata , "random-override" , 0 ) ; if ( list ) { s = gcry_sexp_nth_data ( list , 1 , & n ) ; if ( ! s ) rc = GPG_ERR_NO_OBJ ; else if ( n > 0 ) { random_override = gcry_malloc ( n ) ; if ( ! random_override ) rc = gpg_err_code_from_syserror ( ) ; else { memcpy ( random_override , s , n ) ; random_override_len = n ; } } gcry_sexp_release ( list ) ; if ( rc ) goto leave ; } rc = pss_encode ( ret_mpi , ctx -> nbits - 1 , ctx -> hash_algo , value , valuelen , ctx -> saltlen , random_override , random_override_len ) ; gcry_free ( random_override ) ; } } } else if ( ctx -> encoding == PUBKEY_ENC_PSS && lhash && ctx -> op == PUBKEY_OP_VERIFY ) { if ( gcry_sexp_length ( lhash ) != 3 ) rc = GPG_ERR_INV_OBJ ; else if ( ! ( s = gcry_sexp_nth_data ( lhash , 1 , & n ) ) || ! n ) rc = GPG_ERR_INV_OBJ ; else { ctx -> hash_algo = get_hash_algo ( s , n ) ; if ( ! ctx -> hash_algo ) rc = GPG_ERR_DIGEST_ALGO ; else { * ret_mpi = gcry_sexp_nth_mpi ( lhash , 2 , GCRYMPI_FMT_USG ) ; if ( ! * ret_mpi ) rc = GPG_ERR_INV_OBJ ; ctx -> verify_cmp = pss_verify_cmp ; ctx -> verify_arg = * ret_mpi ; } } } else rc = GPG_ERR_CONFLICT ; leave : gcry_sexp_release ( ldata ) ; gcry_sexp_release ( lhash ) ; gcry_sexp_release ( lvalue ) ; if ( ! rc ) ctx -> flags = parsed_flags ; else { gcry_free ( ctx -> label ) ; ctx -> label = NULL ; } return rc ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static Datum ExecEvalFunc ( FuncExprState * fcache , ExprContext * econtext , bool * isNull , ExprDoneCond * isDone ) { FuncExpr * func = ( FuncExpr * ) fcache -> xprstate . expr ; init_fcache ( func -> funcid , func -> inputcollid , fcache , econtext -> ecxt_per_query_memory , true ) ; if ( fcache -> func . fn_retset || expression_returns_set ( ( Node * ) func -> args ) ) { fcache -> xprstate . evalfunc = ( ExprStateEvalFunc ) ExecMakeFunctionResult ; return ExecMakeFunctionResult ( fcache , econtext , isNull , isDone ) ; } else { fcache -> xprstate . evalfunc = ( ExprStateEvalFunc ) ExecMakeFunctionResultNoSets ; return ExecMakeFunctionResultNoSets ( fcache , econtext , isNull , isDone ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void fix_interp_filter ( VP9_COMMON * cm ) { if ( cm -> interp_filter == SWITCHABLE ) { int count [ SWITCHABLE_FILTERS ] ; int i , j , c = 0 ; for ( i = 0 ; i < SWITCHABLE_FILTERS ; ++ i ) { count [ i ] = 0 ; for ( j = 0 ; j < SWITCHABLE_FILTER_CONTEXTS ; ++ j ) count [ i ] += cm -> counts . switchable_interp [ j ] [ i ] ; c += ( count [ i ] > 0 ) ; } if ( c == 1 ) { for ( i = 0 ; i < SWITCHABLE_FILTERS ; ++ i ) { if ( count [ i ] ) { cm -> interp_filter = i ; break ; } } } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
proto_item * proto_tree_add_item_new ( proto_tree * tree , header_field_info * hfinfo , tvbuff_t * tvb , const gint start , gint length , const guint encoding ) { field_info * new_fi ; gint item_length ; DISSECTOR_ASSERT_HINT ( hfinfo != NULL , "Not passed hfi!" ) ; get_hfi_length ( hfinfo , tvb , start , & length , & item_length ) ; test_length ( hfinfo , tvb , start , item_length ) ; CHECK_FOR_NULL_TREE ( tree ) ; TRY_TO_FAKE_THIS_ITEM ( tree , hfinfo -> id , hfinfo ) ; new_fi = new_field_info ( tree , hfinfo , tvb , start , item_length ) ; return proto_tree_new_item ( new_fi , tree , tvb , start , length , encoding ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void modsecurity_child_init ( msc_engine * msce ) { xmlInitParser ( ) ; if ( msce -> auditlog_lock != NULL ) { apr_status_t rc = apr_global_mutex_child_init ( & msce -> auditlog_lock , NULL , msce -> mp ) ; if ( rc != APR_SUCCESS ) { } } if ( msce -> geo_lock != NULL ) { apr_status_t rc = apr_global_mutex_child_init ( & msce -> geo_lock , NULL , msce -> mp ) ; if ( rc != APR_SUCCESS ) { } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int archive_read_support_format_ar ( struct archive * _a ) { struct archive_read * a = ( struct archive_read * ) _a ; struct ar * ar ; int r ; archive_check_magic ( _a , ARCHIVE_READ_MAGIC , ARCHIVE_STATE_NEW , "archive_read_support_format_ar" ) ; ar = ( struct ar * ) malloc ( sizeof ( * ar ) ) ; if ( ar == NULL ) { archive_set_error ( & a -> archive , ENOMEM , "Can't allocate ar data" ) ; return ( ARCHIVE_FATAL ) ; } memset ( ar , 0 , sizeof ( * ar ) ) ; ar -> strtab = NULL ; r = __archive_read_register_format ( a , ar , "ar" , archive_read_format_ar_bid , NULL , archive_read_format_ar_read_header , archive_read_format_ar_read_data , archive_read_format_ar_skip , NULL , archive_read_format_ar_cleanup , NULL , NULL ) ; if ( r != ARCHIVE_OK ) { free ( ar ) ; return ( r ) ; } return ( ARCHIVE_OK ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_T_rfc_number ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 1U , 32768U , & rfc_number , TRUE ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorJSONGetBlockExtent ( qemuMonitorPtr mon , const char * dev_name , unsigned long long * extent ) { int ret = - 1 ; int i ; int found = 0 ; virJSONValuePtr cmd = qemuMonitorJSONMakeCommand ( "query-blockstats" , NULL ) ; virJSONValuePtr reply = NULL ; virJSONValuePtr devices ; * extent = 0 ; if ( ! cmd ) return - 1 ; ret = qemuMonitorJSONCommand ( mon , cmd , & reply ) ; if ( ret == 0 ) ret = qemuMonitorJSONCheckError ( cmd , reply ) ; if ( ret < 0 ) goto cleanup ; ret = - 1 ; devices = virJSONValueObjectGet ( reply , "return" ) ; if ( ! devices || devices -> type != VIR_JSON_TYPE_ARRAY ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "blockstats reply was missing device list" ) ) ; goto cleanup ; } for ( i = 0 ; i < virJSONValueArraySize ( devices ) ; i ++ ) { virJSONValuePtr dev = virJSONValueArrayGet ( devices , i ) ; virJSONValuePtr stats ; virJSONValuePtr parent ; const char * thisdev ; if ( ! dev || dev -> type != VIR_JSON_TYPE_OBJECT ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "blockstats device entry was not in expected format" ) ) ; goto cleanup ; } if ( ( thisdev = virJSONValueObjectGetString ( dev , "device" ) ) == NULL ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "blockstats device entry was not in expected format" ) ) ; goto cleanup ; } if ( STRPREFIX ( thisdev , QEMU_DRIVE_HOST_PREFIX ) ) thisdev += strlen ( QEMU_DRIVE_HOST_PREFIX ) ; if ( STRNEQ ( thisdev , dev_name ) ) continue ; found = 1 ; if ( ( parent = virJSONValueObjectGet ( dev , "parent" ) ) == NULL || parent -> type != VIR_JSON_TYPE_OBJECT ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "blockstats parent entry was not in expected format" ) ) ; goto cleanup ; } if ( ( stats = virJSONValueObjectGet ( parent , "stats" ) ) == NULL || stats -> type != VIR_JSON_TYPE_OBJECT ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "blockstats stats entry was not in expected format" ) ) ; goto cleanup ; } if ( virJSONValueObjectGetNumberUlong ( stats , "wr_highest_offset" , extent ) < 0 ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , _ ( "cannot read %s statistic" ) , "wr_highest_offset" ) ; goto cleanup ; } } if ( ! found ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , _ ( "cannot find statistics for device '%s'" ) , dev_name ) ; goto cleanup ; } ret = 0 ; cleanup : virJSONValueFree ( cmd ) ; virJSONValueFree ( reply ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void spl_filesystem_info_set_filename ( spl_filesystem_object * intern , char * path , int len , int use_copy TSRMLS_DC ) { char * p1 , * p2 ; if ( intern -> file_name ) { efree ( intern -> file_name ) ; } intern -> file_name = use_copy ? estrndup ( path , len ) : path ; intern -> file_name_len = len ; while ( IS_SLASH_AT ( intern -> file_name , intern -> file_name_len - 1 ) && intern -> file_name_len > 1 ) { intern -> file_name [ intern -> file_name_len - 1 ] = 0 ; intern -> file_name_len -- ; } p1 = strrchr ( intern -> file_name , '/' ) ; # if defined ( PHP_WIN32 ) || defined ( NETWARE ) p2 = strrchr ( intern -> file_name , '\\' ) ; # else p2 = 0 ; # endif if ( p1 || p2 ) { intern -> _path_len = ( p1 > p2 ? p1 : p2 ) - intern -> file_name ; } else { intern -> _path_len = 0 ; } if ( intern -> _path ) { efree ( intern -> _path ) ; } intern -> _path = estrndup ( path , intern -> _path_len ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
void rtp_dyn_payload_insert ( rtp_dyn_payload_t * rtp_dyn_payload , const guint8 pt , const gchar * encoding_name , const int sample_rate ) { if ( rtp_dyn_payload && rtp_dyn_payload -> table ) { encoding_name_and_rate_t * encoding_name_and_rate_pt = wmem_new ( wmem_file_scope ( ) , encoding_name_and_rate_t ) ; encoding_name_and_rate_pt -> encoding_name = wmem_strdup ( wmem_file_scope ( ) , encoding_name ) ; encoding_name_and_rate_pt -> sample_rate = sample_rate ; g_hash_table_insert ( rtp_dyn_payload -> table , GUINT_TO_POINTER ( pt ) , encoding_name_and_rate_pt ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
zend_object_iterator * pdo_stmt_iter_get ( zend_class_entry * ce , zval * object , int by_ref TSRMLS_DC ) { pdo_stmt_t * stmt = ( pdo_stmt_t * ) zend_object_store_get_object ( object TSRMLS_CC ) ; struct php_pdo_iterator * I ; if ( by_ref ) { zend_error ( E_ERROR , "An iterator cannot be used with foreach by reference" ) ; } I = ecalloc ( 1 , sizeof ( * I ) ) ; I -> iter . funcs = & pdo_stmt_iter_funcs ; I -> iter . data = I ; I -> stmt = stmt ; stmt -> refcount ++ ; MAKE_STD_ZVAL ( I -> fetch_ahead ) ; if ( ! do_fetch ( I -> stmt , TRUE , I -> fetch_ahead , PDO_FETCH_USE_DEFAULT , PDO_FETCH_ORI_NEXT , 0 , 0 TSRMLS_CC ) ) { PDO_HANDLE_STMT_ERR ( ) ; I -> key = ( ulong ) - 1 ; FREE_ZVAL ( I -> fetch_ahead ) ; I -> fetch_ahead = NULL ; } return & I -> iter ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void list_item_verbose ( struct cpio * cpio , struct archive_entry * entry ) { char size [ 32 ] ; char date [ 32 ] ; char uids [ 16 ] , gids [ 16 ] ; const char * uname , * gname ; FILE * out = stdout ; const char * fmt ; time_t mtime ; static time_t now ; if ( ! now ) time ( & now ) ; if ( cpio -> option_numeric_uid_gid ) { strcpy ( uids , cpio_i64toa ( archive_entry_uid ( entry ) ) ) ; uname = uids ; strcpy ( gids , cpio_i64toa ( archive_entry_gid ( entry ) ) ) ; gname = gids ; } else { uname = archive_entry_uname ( entry ) ; if ( uname == NULL ) uname = lookup_uname ( cpio , ( uid_t ) archive_entry_uid ( entry ) ) ; gname = archive_entry_gname ( entry ) ; if ( gname == NULL ) gname = lookup_gname ( cpio , ( uid_t ) archive_entry_gid ( entry ) ) ; } if ( archive_entry_filetype ( entry ) == AE_IFCHR || archive_entry_filetype ( entry ) == AE_IFBLK ) { snprintf ( size , sizeof ( size ) , "%lu,%lu" , ( unsigned long ) archive_entry_rdevmajor ( entry ) , ( unsigned long ) archive_entry_rdevminor ( entry ) ) ; } else { strcpy ( size , cpio_i64toa ( archive_entry_size ( entry ) ) ) ; } mtime = archive_entry_mtime ( entry ) ; # if defined ( _WIN32 ) && ! defined ( __CYGWIN__ ) if ( mtime - now > 365 * 86400 / 2 || mtime - now < - 365 * 86400 / 2 ) fmt = cpio -> day_first ? "%d %b %Y" : "%b %d %Y" ; else fmt = cpio -> day_first ? "%d %b %H:%M" : "%b %d %H:%M" ; # else if ( mtime - now > 365 * 86400 / 2 || mtime - now < - 365 * 86400 / 2 ) fmt = cpio -> day_first ? "%e %b %Y" : "%b %e %Y" ; else fmt = cpio -> day_first ? "%e %b %H:%M" : "%b %e %H:%M" ; # endif strftime ( date , sizeof ( date ) , fmt , localtime ( & mtime ) ) ; fprintf ( out , "%s%3d %-8s %-8s %8s %12s %s" , archive_entry_strmode ( entry ) , archive_entry_nlink ( entry ) , uname , gname , size , date , archive_entry_pathname ( entry ) ) ; if ( archive_entry_hardlink ( entry ) ) fprintf ( out , " link to %s" , archive_entry_hardlink ( entry ) ) ; else if ( archive_entry_symlink ( entry ) ) fprintf ( out , " -> %s" , archive_entry_symlink ( entry ) ) ; fprintf ( out , "\n" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int parse_CNodeRestriction ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * parent_tree , proto_tree * pad_tree , struct CNodeRestriction * v , const char * fmt , ... ) { proto_tree * tree ; proto_item * item ; unsigned i ; const char * txt ; va_list ap ; va_start ( ap , fmt ) ; txt = wmem_strdup_vprintf ( wmem_packet_scope ( ) , fmt , ap ) ; va_end ( ap ) ; tree = proto_tree_add_subtree ( parent_tree , tvb , offset , 0 , ett_CNodeRestriction , & item , txt ) ; v -> cNode = tvb_get_letohl ( tvb , offset ) ; proto_tree_add_uint ( tree , hf_mswsp_cnoderestrict_cnode , tvb , offset , 4 , v -> cNode ) ; offset += 4 ; for ( i = 0 ; i < v -> cNode ; i ++ ) { struct CRestriction r ; ZERO_STRUCT ( r ) ; offset = parse_CRestriction ( tvb , pinfo , offset , tree , pad_tree , & r , "paNode[%u]" , i ) ; offset = parse_padding ( tvb , offset , 4 , tree , "padding_paNode[%u]" , i ) ; } proto_item_set_end ( item , tvb , offset ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void pmac_ide_atapi_transfer_cb ( void * opaque , int ret ) { DBDMA_io * io = opaque ; MACIOIDEState * m = io -> opaque ; IDEState * s = idebus_active_if ( & m -> bus ) ; int unaligned ; if ( ret < 0 ) { m -> aiocb = NULL ; qemu_sglist_destroy ( & s -> sg ) ; ide_atapi_io_error ( s , ret ) ; io -> remainder_len = 0 ; goto done ; } if ( ! m -> dma_active ) { MACIO_DPRINTF ( "waiting for data (%#x - %#x - %x)\n" , s -> nsector , io -> len , s -> status ) ; io -> processing = false ; return ; } MACIO_DPRINTF ( "io_buffer_size = %#x\n" , s -> io_buffer_size ) ; if ( s -> io_buffer_size > 0 ) { m -> aiocb = NULL ; qemu_sglist_destroy ( & s -> sg ) ; s -> packet_transfer_size -= s -> io_buffer_size ; s -> io_buffer_index += s -> io_buffer_size ; s -> lba += s -> io_buffer_index >> 11 ; s -> io_buffer_index &= 0x7ff ; } s -> io_buffer_size = MIN ( io -> len , s -> packet_transfer_size ) ; MACIO_DPRINTF ( "remainder: %d io->len: %d size: %d\n" , io -> remainder_len , io -> len , s -> packet_transfer_size ) ; if ( io -> remainder_len && io -> len ) { int remainder_len = MIN ( io -> remainder_len , io -> len ) ; MACIO_DPRINTF ( "copying remainder %d bytes\n" , remainder_len ) ; cpu_physical_memory_write ( io -> addr , io -> remainder + 0x200 - remainder_len , remainder_len ) ; io -> addr += remainder_len ; io -> len -= remainder_len ; s -> io_buffer_size = remainder_len ; io -> remainder_len -= remainder_len ; qemu_sglist_init ( & s -> sg , DEVICE ( m ) , io -> len / MACIO_PAGE_SIZE + 1 , & address_space_memory ) ; pmac_ide_atapi_transfer_cb ( opaque , 0 ) ; return ; } if ( ! s -> packet_transfer_size ) { MACIO_DPRINTF ( "end of transfer\n" ) ; ide_atapi_cmd_ok ( s ) ; m -> dma_active = false ; } if ( io -> len == 0 ) { MACIO_DPRINTF ( "end of DMA\n" ) ; goto done ; } unaligned = io -> len & 0x1ff ; if ( unaligned ) { int sector_num = ( s -> lba << 2 ) + ( s -> io_buffer_index >> 9 ) ; int nsector = io -> len >> 9 ; MACIO_DPRINTF ( "precopying unaligned %d bytes to %#" HWADDR_PRIx "\n" , unaligned , io -> addr + io -> len - unaligned ) ; blk_read ( s -> blk , sector_num + nsector , io -> remainder , 1 ) ; cpu_physical_memory_write ( io -> addr + io -> len - unaligned , io -> remainder , unaligned ) ; io -> len -= unaligned ; } MACIO_DPRINTF ( "io->len = %#x\n" , io -> len ) ; qemu_sglist_init ( & s -> sg , DEVICE ( m ) , io -> len / MACIO_PAGE_SIZE + 1 , & address_space_memory ) ; qemu_sglist_add ( & s -> sg , io -> addr , io -> len ) ; io -> addr += s -> io_buffer_size ; io -> remainder_len = MIN ( s -> packet_transfer_size - s -> io_buffer_size , ( 0x200 - unaligned ) & 0x1ff ) ; MACIO_DPRINTF ( "set remainder to: %d\n" , io -> remainder_len ) ; if ( ! io -> len ) { pmac_ide_atapi_transfer_cb ( opaque , 0 ) ; return ; } io -> len = 0 ; MACIO_DPRINTF ( "sector_num=%d size=%d, cmd_cmd=%d\n" , ( s -> lba << 2 ) + ( s -> io_buffer_index >> 9 ) , s -> packet_transfer_size , s -> dma_cmd ) ; m -> aiocb = dma_blk_read ( s -> blk , & s -> sg , ( int64_t ) ( s -> lba << 2 ) + ( s -> io_buffer_index >> 9 ) , pmac_ide_atapi_transfer_cb , io ) ; return ; done : MACIO_DPRINTF ( "done DMA\n" ) ; block_acct_done ( blk_get_stats ( s -> blk ) , & s -> acct ) ; io -> dma_end ( opaque ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline unsigned int decompose ( const hb_ot_shape_normalize_context_t * c , bool shortest , hb_codepoint_t ab ) { hb_codepoint_t a , b , a_glyph , b_glyph ; hb_buffer_t * const buffer = c -> buffer ; hb_font_t * const font = c -> font ; if ( ! c -> decompose ( c , ab , & a , & b ) || ( b && ! font -> get_glyph ( b , 0 , & b_glyph ) ) ) return 0 ; bool has_a = font -> get_glyph ( a , 0 , & a_glyph ) ; if ( shortest && has_a ) { output_char ( buffer , a , a_glyph ) ; if ( likely ( b ) ) { output_char ( buffer , b , b_glyph ) ; return 2 ; } return 1 ; } unsigned int ret ; if ( ( ret = decompose ( c , shortest , a ) ) ) { if ( b ) { output_char ( buffer , b , b_glyph ) ; return ret + 1 ; } return ret ; } if ( has_a ) { output_char ( buffer , a , a_glyph ) ; if ( likely ( b ) ) { output_char ( buffer , b , b_glyph ) ; return 2 ; } return 1 ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
GType hb_gobject_ ## name ## _get_type ( void ) \ { static gsize type_id = 0 ; if ( g_once_init_enter ( & type_id ) ) { GType id = g_boxed_type_register_static ( g_intern_static_string ( "hb_" # name "_t" ) , ( GBoxedCopyFunc ) copy_func , ( GBoxedFreeFunc ) free_func ) ; g_once_init_leave ( & type_id , id ) ; } return type_id ; \ } # define HB_DEFINE_OBJECT_TYPE ( name ) HB_DEFINE_BOXED_TYPE ( name , hb_ ## name ## _reference , hb_ ## name ## _destroy ) ; # define HB_DEFINE_VALUE_TYPE ( name ) static hb_ ## name ## _t * _hb_ ## name ## _reference ( const hb_ ## name ## _t * l ) { hb_ ## name ## _t * c = ( hb_ ## name ## _t * ) calloc ( 1 , sizeof ( hb_ ## name ## _t ) ) ; if ( unlikely ( ! c ) ) return NULL ; * c = * l ; return c ; } static void _hb_ ## name ## _destroy ( hb_ ## name ## _t * l ) { free ( l ) ; } HB_DEFINE_BOXED_TYPE ( name , _hb_ ## name ## _reference , _hb_ ## name ## _destroy ) ; HB_DEFINE_OBJECT_TYPE ( buffer ) HB_DEFINE_OBJECT_TYPE ( blob ) HB_DEFINE_OBJECT_TYPE ( face ) HB_DEFINE_OBJECT_TYPE ( font ) HB_DEFINE_OBJECT_TYPE ( font_funcs ) HB_DEFINE_OBJECT_TYPE ( set ) HB_DEFINE_OBJECT_TYPE ( shape_plan ) HB_DEFINE_OBJECT_TYPE ( unicode_funcs ) HB_DEFINE_VALUE_TYPE ( feature ) HB_DEFINE_VALUE_TYPE ( glyph_info ) HB_DEFINE_VALUE_TYPE ( glyph_position )
0False
Categorize the following code snippet as vulnerable or not. True or False
static int DecoderGetDisplayRate ( decoder_t * p_dec ) { decoder_owner_sys_t * p_owner = p_dec -> p_owner ; if ( ! p_owner -> p_clock ) return INPUT_RATE_DEFAULT ; return input_clock_GetRate ( p_owner -> p_clock ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int ipvideo_decode_block_opcode_0xE ( IpvideoContext * s ) { int y ; unsigned char pix ; pix = bytestream2_get_byte ( & s -> stream_ptr ) ; for ( y = 0 ; y < 8 ; y ++ ) { memset ( s -> pixel_ptr , pix , 8 ) ; s -> pixel_ptr += s -> stride ; } return 0 ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
void av_image_fill_max_pixsteps ( int max_pixsteps [ 4 ] , int max_pixstep_comps [ 4 ] , const AVPixFmtDescriptor * pixdesc ) { int i ; memset ( max_pixsteps , 0 , 4 * sizeof ( max_pixsteps [ 0 ] ) ) ; if ( max_pixstep_comps ) memset ( max_pixstep_comps , 0 , 4 * sizeof ( max_pixstep_comps [ 0 ] ) ) ; for ( i = 0 ; i < 4 ; i ++ ) { const AVComponentDescriptor * comp = & ( pixdesc -> comp [ i ] ) ; if ( ( comp -> step_minus1 + 1 ) > max_pixsteps [ comp -> plane ] ) { max_pixsteps [ comp -> plane ] = comp -> step_minus1 + 1 ; if ( max_pixstep_comps ) max_pixstep_comps [ comp -> plane ] = i ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void exsltSaxonSystemIdFunction ( xmlXPathParserContextPtr ctxt , int nargs ) { if ( ctxt == NULL ) return ; if ( nargs != 0 ) { xmlXPathSetArityError ( ctxt ) ; return ; } if ( ( ctxt -> context ) && ( ctxt -> context -> doc ) && ( ctxt -> context -> doc -> URL ) ) valuePush ( ctxt , xmlXPathNewString ( ctxt -> context -> doc -> URL ) ) ; else valuePush ( ctxt , xmlXPathNewString ( BAD_CAST "" ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dump_page_info ( Jbig2Ctx * ctx , Jbig2Segment * segment , Jbig2Page * page ) { if ( page -> x_resolution == 0 ) { jbig2_error ( ctx , JBIG2_SEVERITY_INFO , segment -> number , "page %d image is %dx%d (unknown res)" , page -> number , page -> width , page -> height ) ; } else if ( page -> x_resolution == page -> y_resolution ) { jbig2_error ( ctx , JBIG2_SEVERITY_INFO , segment -> number , "page %d image is %dx%d (%d ppm)" , page -> number , page -> width , page -> height , page -> x_resolution ) ; } else { jbig2_error ( ctx , JBIG2_SEVERITY_INFO , segment -> number , "page %d image is %dx%d (%dx%d ppm)" , page -> number , page -> width , page -> height , page -> x_resolution , page -> y_resolution ) ; } if ( page -> striped ) { jbig2_error ( ctx , JBIG2_SEVERITY_INFO , segment -> number , "\tmaximum stripe size: %d" , page -> stripe_size ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static timelib_sll timelib_get_nr ( char * * ptr , int max_length ) { char * begin , * end , * str ; timelib_sll tmp_nr = TIMELIB_UNSET ; int len = 0 ; while ( ( * * ptr < '0' ) || ( * * ptr > '9' ) ) { if ( * * ptr == '\0' ) { return TIMELIB_UNSET ; } ++ * ptr ; } begin = * ptr ; while ( ( * * ptr >= '0' ) && ( * * ptr <= '9' ) && len < max_length ) { ++ * ptr ; ++ len ; } end = * ptr ; str = calloc ( 1 , end - begin + 1 ) ; memcpy ( str , begin , end - begin ) ; tmp_nr = strtoll ( str , NULL , 10 ) ; free ( str ) ; return tmp_nr ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void remoteDispatchAuthError ( remote_error * rerr ) { remoteDispatchStringError ( rerr , VIR_ERR_AUTH_FAILED , "authentication failed" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TSHttpParser TSHttpParserCreate ( void ) { TSHttpParser parser = reinterpret_cast < TSHttpParser > ( ats_malloc ( sizeof ( HTTPParser ) ) ) ; http_parser_init ( ( HTTPParser * ) parser ) ; return parser ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void add_pbase_object ( struct tree_desc * tree , const char * name , int cmplen , const char * fullname ) { struct name_entry entry ; int cmp ; while ( tree_entry ( tree , & entry ) ) { if ( S_ISGITLINK ( entry . mode ) ) continue ; cmp = tree_entry_len ( & entry ) != cmplen ? 1 : memcmp ( name , entry . path , cmplen ) ; if ( cmp > 0 ) continue ; if ( cmp < 0 ) return ; if ( name [ cmplen ] != '/' ) { add_object_entry ( entry . sha1 , object_type ( entry . mode ) , fullname , 1 ) ; return ; } if ( S_ISDIR ( entry . mode ) ) { struct tree_desc sub ; struct pbase_tree_cache * tree ; const char * down = name + cmplen + 1 ; int downlen = name_cmp_len ( down ) ; tree = pbase_tree_get ( entry . sha1 ) ; if ( ! tree ) return ; init_tree_desc ( & sub , tree -> tree_data , tree -> tree_size ) ; add_pbase_object ( & sub , down , downlen , fullname ) ; pbase_tree_put ( tree ) ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_bufferevent_watermarks ( void ) { struct bufferevent * bev1 , * bev2 ; char buffer [ 65000 ] ; int i ; setup_test ( "Bufferevent Watermarks: " ) ; bev1 = bufferevent_new ( pair [ 0 ] , NULL , wm_writecb , wm_errorcb , NULL ) ; bev2 = bufferevent_new ( pair [ 1 ] , wm_readcb , NULL , wm_errorcb , NULL ) ; bufferevent_disable ( bev1 , EV_READ ) ; bufferevent_enable ( bev2 , EV_READ ) ; for ( i = 0 ; i < sizeof ( buffer ) ; i ++ ) buffer [ i ] = i ; bufferevent_write ( bev1 , buffer , sizeof ( buffer ) ) ; bufferevent_setwatermark ( bev2 , EV_READ , 10 , 20 ) ; event_dispatch ( ) ; bufferevent_free ( bev1 ) ; bufferevent_free ( bev2 ) ; if ( test_ok != 2 ) test_ok = 0 ; cleanup_test ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void pdo_stmt_init ( TSRMLS_D ) { zend_class_entry ce ; INIT_CLASS_ENTRY ( ce , "PDOStatement" , pdo_dbstmt_functions ) ; pdo_dbstmt_ce = zend_register_internal_class ( & ce TSRMLS_CC ) ; pdo_dbstmt_ce -> get_iterator = pdo_stmt_iter_get ; pdo_dbstmt_ce -> create_object = pdo_dbstmt_new ; zend_class_implements ( pdo_dbstmt_ce TSRMLS_CC , 1 , zend_ce_traversable ) ; zend_declare_property_null ( pdo_dbstmt_ce , "queryString" , sizeof ( "queryString" ) - 1 , ZEND_ACC_PUBLIC TSRMLS_CC ) ; memcpy ( & pdo_dbstmt_object_handlers , & std_object_handlers , sizeof ( zend_object_handlers ) ) ; pdo_dbstmt_object_handlers . write_property = dbstmt_prop_write ; pdo_dbstmt_object_handlers . unset_property = dbstmt_prop_delete ; pdo_dbstmt_object_handlers . get_method = dbstmt_method_get ; pdo_dbstmt_object_handlers . compare_objects = dbstmt_compare ; pdo_dbstmt_object_handlers . clone_obj = dbstmt_clone_obj ; INIT_CLASS_ENTRY ( ce , "PDORow" , pdo_row_functions ) ; pdo_row_ce = zend_register_internal_class ( & ce TSRMLS_CC ) ; pdo_row_ce -> ce_flags |= ZEND_ACC_FINAL_CLASS ; pdo_row_ce -> create_object = pdo_row_new ; pdo_row_ce -> serialize = pdo_row_serialize ; pdo_row_ce -> unserialize = zend_class_unserialize_deny ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int evhttp_append_to_last_header ( struct evkeyvalq * headers , const char * line ) { struct evkeyval * header = TAILQ_LAST ( headers , evkeyvalq ) ; char * newval ; size_t old_len , line_len ; if ( header == NULL ) return ( - 1 ) ; old_len = strlen ( header -> value ) ; line_len = strlen ( line ) ; newval = realloc ( header -> value , old_len + line_len + 1 ) ; if ( newval == NULL ) return ( - 1 ) ; memcpy ( newval + old_len , line , line_len + 1 ) ; header -> value = newval ; return ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static struct matrix build_lut_matrix ( struct lutType * lut ) { struct matrix result ; if ( lut ) { result . m [ 0 ] [ 0 ] = s15Fixed16Number_to_float ( lut -> e00 ) ; result . m [ 0 ] [ 1 ] = s15Fixed16Number_to_float ( lut -> e01 ) ; result . m [ 0 ] [ 2 ] = s15Fixed16Number_to_float ( lut -> e02 ) ; result . m [ 1 ] [ 0 ] = s15Fixed16Number_to_float ( lut -> e10 ) ; result . m [ 1 ] [ 1 ] = s15Fixed16Number_to_float ( lut -> e11 ) ; result . m [ 1 ] [ 2 ] = s15Fixed16Number_to_float ( lut -> e12 ) ; result . m [ 2 ] [ 0 ] = s15Fixed16Number_to_float ( lut -> e20 ) ; result . m [ 2 ] [ 1 ] = s15Fixed16Number_to_float ( lut -> e21 ) ; result . m [ 2 ] [ 2 ] = s15Fixed16Number_to_float ( lut -> e22 ) ; result . invalid = false ; } else { memset ( & result , 0 , sizeof ( struct matrix ) ) ; result . invalid = true ; } return result ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_FunctionNotSupportedCause ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_FunctionNotSupportedCause , FunctionNotSupportedCause_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int X509_REQ_add1_attr_by_txt ( X509_REQ * req , const char * attrname , int type , const unsigned char * bytes , int len ) { if ( X509at_add1_attr_by_txt ( & req -> req_info -> attributes , attrname , type , bytes , len ) ) return 1 ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int read_frame ( struct VpxDecInputContext * input , uint8_t * * buf , size_t * bytes_in_buffer , size_t * buffer_size ) { switch ( input -> vpx_input_ctx -> file_type ) { # if CONFIG_WEBM_IO case FILE_TYPE_WEBM : return webm_read_frame ( input -> webm_ctx , buf , bytes_in_buffer , buffer_size ) ; # endif case FILE_TYPE_RAW : return raw_read_frame ( input -> vpx_input_ctx -> file , buf , bytes_in_buffer , buffer_size ) ; case FILE_TYPE_IVF : return ivf_read_frame ( input -> vpx_input_ctx -> file , buf , bytes_in_buffer , buffer_size ) ; default : return 1 ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void cpu_stop_current ( void ) { if ( cpu_single_env ) { CPUState * cpu_single_cpu = ENV_GET_CPU ( cpu_single_env ) ; cpu_single_cpu -> stop = false ; cpu_single_cpu -> stopped = true ; cpu_exit ( cpu_single_cpu ) ; qemu_cond_signal ( & qemu_pause_cond ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
int uwsgi_php_init ( void ) { struct uwsgi_string_list * pset = uphp . set ; struct uwsgi_string_list * append_config = uphp . append_config ; # ifdef ZTS tsrm_startup ( 1 , 1 , 0 , NULL ) ; # endif sapi_startup ( & uwsgi_sapi_module ) ; while ( append_config ) { uwsgi_php_append_config ( append_config -> value ) ; append_config = append_config -> next ; } while ( pset ) { uwsgi_php_set ( pset -> value ) ; pset = pset -> next ; } if ( uphp . dump_config ) { uwsgi_log ( "--- PHP custom config ---\n\n" ) ; uwsgi_log ( "%s\n" , uwsgi_sapi_module . ini_entries ) ; uwsgi_log ( "--- end of PHP custom config ---\n" ) ; } if ( uphp . docroot ) { char * orig_docroot = uphp . docroot ; uphp . docroot = uwsgi_expand_path ( uphp . docroot , strlen ( uphp . docroot ) , NULL ) ; if ( ! uphp . docroot ) { uwsgi_log ( "unable to set php docroot to %s\n" , orig_docroot ) ; exit ( 1 ) ; } } if ( uphp . sapi_name ) { uwsgi_sapi_module . name = uphp . sapi_name ; } uwsgi_sapi_module . startup ( & uwsgi_sapi_module ) ; uwsgi_log ( "PHP %s initialized\n" , PHP_VERSION ) ; return 0 ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int h261_decode_mb ( H261Context * h ) { MpegEncContext * const s = & h -> s ; int i , cbp , xy ; cbp = 63 ; do { h -> mba_diff = get_vlc2 ( & s -> gb , h261_mba_vlc . table , H261_MBA_VLC_BITS , 2 ) ; if ( h -> mba_diff == MBA_STARTCODE ) { h -> gob_start_code_skipped = 1 ; return SLICE_END ; } } while ( h -> mba_diff == MBA_STUFFING ) ; if ( h -> mba_diff < 0 ) { if ( get_bits_left ( & s -> gb ) <= 7 ) return SLICE_END ; av_log ( s -> avctx , AV_LOG_ERROR , "illegal mba at %d %d\n" , s -> mb_x , s -> mb_y ) ; return SLICE_ERROR ; } h -> mba_diff += 1 ; h -> current_mba += h -> mba_diff ; if ( h -> current_mba > MBA_STUFFING ) return SLICE_ERROR ; s -> mb_x = ( ( h -> gob_number - 1 ) % 2 ) * 11 + ( ( h -> current_mba - 1 ) % 11 ) ; s -> mb_y = ( ( h -> gob_number - 1 ) / 2 ) * 3 + ( ( h -> current_mba - 1 ) / 11 ) ; xy = s -> mb_x + s -> mb_y * s -> mb_stride ; ff_init_block_index ( s ) ; ff_update_block_index ( s ) ; h -> mtype = get_vlc2 ( & s -> gb , h261_mtype_vlc . table , H261_MTYPE_VLC_BITS , 2 ) ; h -> mtype = h261_mtype_map [ h -> mtype ] ; if ( IS_QUANT ( h -> mtype ) ) { ff_set_qscale ( s , get_bits ( & s -> gb , 5 ) ) ; } s -> mb_intra = IS_INTRA4x4 ( h -> mtype ) ; if ( IS_16X16 ( h -> mtype ) ) { if ( ( h -> current_mba == 1 ) || ( h -> current_mba == 12 ) || ( h -> current_mba == 23 ) || ( h -> mba_diff != 1 ) ) { h -> current_mv_x = 0 ; h -> current_mv_y = 0 ; } h -> current_mv_x = decode_mv_component ( & s -> gb , h -> current_mv_x ) ; h -> current_mv_y = decode_mv_component ( & s -> gb , h -> current_mv_y ) ; } else { h -> current_mv_x = 0 ; h -> current_mv_y = 0 ; } if ( HAS_CBP ( h -> mtype ) ) { cbp = get_vlc2 ( & s -> gb , h261_cbp_vlc . table , H261_CBP_VLC_BITS , 2 ) + 1 ; } if ( s -> mb_intra ) { s -> current_picture . mb_type [ xy ] = MB_TYPE_INTRA ; goto intra ; } s -> mv_dir = MV_DIR_FORWARD ; s -> mv_type = MV_TYPE_16X16 ; s -> current_picture . mb_type [ xy ] = MB_TYPE_16x16 | MB_TYPE_L0 ; s -> mv [ 0 ] [ 0 ] [ 0 ] = h -> current_mv_x * 2 ; s -> mv [ 0 ] [ 0 ] [ 1 ] = h -> current_mv_y * 2 ; intra : if ( s -> mb_intra || HAS_CBP ( h -> mtype ) ) { s -> dsp . clear_blocks ( s -> block [ 0 ] ) ; for ( i = 0 ; i < 6 ; i ++ ) { if ( h261_decode_block ( h , s -> block [ i ] , i , cbp & 32 ) < 0 ) { return SLICE_ERROR ; } cbp += cbp ; } } else { for ( i = 0 ; i < 6 ; i ++ ) s -> block_last_index [ i ] = - 1 ; } ff_MPV_decode_mb ( s , s -> block ) ; return SLICE_OK ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void su_failure ( const char * tty , bool su_to_root ) { sulog ( tty , false , caller_name , name ) ; # ifdef USE_SYSLOG if ( getdef_bool ( "SYSLOG_SU_ENAB" ) ) { SYSLOG ( ( su_to_root ? LOG_NOTICE : LOG_INFO , "- %s %s:%s" , tty , ( '\0' != caller_name [ 0 ] ) ? caller_name : "???" , ( '\0' != name [ 0 ] ) ? name : "???" ) ) ; } closelog ( ) ; # endif # ifdef WITH_AUDIT audit_fd = audit_open ( ) ; audit_log_acct_message ( audit_fd , AUDIT_USER_ROLE_CHANGE , NULL , "su" , ( '\0' != caller_name [ 0 ] ) ? caller_name : "???" , AUDIT_NO_ID , "localhost" , NULL , tty , 0 ) ; close ( audit_fd ) ; # endif exit ( 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static char * main_format_millis ( long millis , shortbuf * buf ) { if ( millis < 1000 ) { short_sprintf ( * buf , "%lu ms" , millis ) ; } else if ( millis < 10000 ) { short_sprintf ( * buf , "%.1f sec" , millis / 1000.0 ) ; } else { short_sprintf ( * buf , "%lu sec" , millis / 1000L ) ; } return buf -> buf ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int no_try_delta ( const char * path ) { struct git_attr_check check [ 1 ] ; setup_delta_attr_check ( check ) ; if ( git_check_attr ( path , ARRAY_SIZE ( check ) , check ) ) return 0 ; if ( ATTR_FALSE ( check -> value ) ) return 1 ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dissect_rsvp_scope ( proto_item * ti _U_ , proto_tree * rsvp_object_tree , tvbuff_t * tvb , int offset , int obj_length , int rsvp_class _U_ , int type ) { int offset2 = offset + 4 ; int mylen ; mylen = obj_length - 4 ; switch ( type ) { case 1 : { proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type , "1 - IPv4" ) ; while ( mylen > 0 ) { proto_tree_add_item ( rsvp_object_tree , hf_rsvp_scope_ipv4_address , tvb , offset2 , 4 , ENC_BIG_ENDIAN ) ; offset2 += 4 ; mylen -= 4 ; } break ; } case 2 : { proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type , "2 - IPv6" ) ; while ( mylen > 0 ) { proto_tree_add_item ( rsvp_object_tree , hf_rsvp_scope_ipv6_address , tvb , offset2 , 16 , ENC_NA ) ; offset2 += 16 ; mylen -= 16 ; } break ; } default : proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type , "Unknown (%u)" , type ) ; proto_tree_add_item ( rsvp_object_tree , hf_rsvp_scope_data , tvb , offset2 , mylen , ENC_NA ) ; break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const char * _UTF7GetName ( const UConverter * cnv ) { switch ( cnv -> fromUnicodeStatus >> 28 ) { case 1 : return "UTF-7,version=1" ; default : return "UTF-7" ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static gchar * rtmpt_get_packet_desc ( tvbuff_t * tvb , guint32 offset , guint32 remain , rtmpt_conv_t * rconv , int cdir , rtmpt_packet_t * tp , gint * deschasopcode ) { if ( tp -> cmd == RTMPT_TYPE_CHUNK_SIZE || tp -> cmd == RTMPT_TYPE_ABORT_MESSAGE || tp -> cmd == RTMPT_TYPE_ACKNOWLEDGEMENT || tp -> cmd == RTMPT_TYPE_WINDOW ) { if ( tp -> len >= 4 && remain >= 4 ) { * deschasopcode = TRUE ; return wmem_strdup_printf ( wmem_packet_scope ( ) , "%s %d" , val_to_str ( tp -> cmd , rtmpt_opcode_vals , "Unknown (0x%01x)" ) , tvb_get_ntohl ( tvb , offset ) ) ; } } else if ( tp -> cmd == RTMPT_TYPE_PEER_BANDWIDTH ) { if ( tp -> len >= 5 && remain >= 5 ) { * deschasopcode = TRUE ; return wmem_strdup_printf ( wmem_packet_scope ( ) , "%s %d,%s" , val_to_str ( tp -> cmd , rtmpt_opcode_vals , "Unknown (0x%01x)" ) , tvb_get_ntohl ( tvb , offset ) , val_to_str ( tvb_get_guint8 ( tvb , offset + 4 ) , rtmpt_limit_vals , "Unknown (%d)" ) ) ; } } else if ( tp -> cmd == RTMPT_TYPE_UCM ) { guint16 iUCM = - 1 ; const gchar * sFunc ; const gchar * sParam = "" ; if ( tp -> len < 2 || remain < 2 ) return NULL ; iUCM = tvb_get_ntohs ( tvb , offset ) ; sFunc = try_val_to_str ( iUCM , rtmpt_ucm_vals ) ; if ( sFunc == NULL ) { * deschasopcode = TRUE ; sFunc = wmem_strdup_printf ( wmem_packet_scope ( ) , "User Control Message 0x%01x" , iUCM ) ; } if ( iUCM == RTMPT_UCM_STREAM_BEGIN || iUCM == RTMPT_UCM_STREAM_EOF || iUCM == RTMPT_UCM_STREAM_DRY || iUCM == RTMPT_UCM_STREAM_ISRECORDED ) { if ( tp -> len >= 6 && remain >= 6 ) { sParam = wmem_strdup_printf ( wmem_packet_scope ( ) , " %d" , tvb_get_ntohl ( tvb , offset + 2 ) ) ; } } else if ( iUCM == RTMPT_UCM_SET_BUFFER ) { if ( tp -> len >= 10 && remain >= 10 ) { sParam = wmem_strdup_printf ( wmem_packet_scope ( ) , " %d,%dms" , tvb_get_ntohl ( tvb , offset + 2 ) , tvb_get_ntohl ( tvb , offset + 6 ) ) ; } } return wmem_strdup_printf ( wmem_packet_scope ( ) , "%s%s" , sFunc , sParam ) ; } else if ( tp -> cmd == RTMPT_TYPE_COMMAND_AMF0 || tp -> cmd == RTMPT_TYPE_COMMAND_AMF3 || tp -> cmd == RTMPT_TYPE_DATA_AMF0 || tp -> cmd == RTMPT_TYPE_DATA_AMF3 ) { guint32 slen = 0 ; guint32 soff = 0 ; gchar * sFunc = NULL ; gchar * sParam = NULL ; if ( tp -> cmd == RTMPT_TYPE_COMMAND_AMF3 || tp -> cmd == RTMPT_TYPE_DATA_AMF3 ) { soff = 1 ; } if ( tp -> len >= 3 + soff && remain >= 3 + soff ) { slen = tvb_get_ntohs ( tvb , offset + 1 + soff ) ; } if ( slen > 0 ) { sFunc = tvb_get_string_enc ( wmem_packet_scope ( ) , tvb , offset + 3 + soff , slen , ENC_ASCII ) ; RTMPT_DEBUG ( "got function call '%s'\n" , sFunc ) ; if ( strcmp ( sFunc , "connect" ) == 0 ) { sParam = rtmpt_get_amf_param ( tvb , offset + soff , 2 , "app" ) ; } else if ( strcmp ( sFunc , "play" ) == 0 ) { sParam = rtmpt_get_amf_param ( tvb , offset + soff , 3 , NULL ) ; } else if ( strcmp ( sFunc , "play2" ) == 0 ) { sParam = rtmpt_get_amf_param ( tvb , offset + soff , 3 , "streamName" ) ; } else if ( strcmp ( sFunc , "releaseStream" ) == 0 ) { sParam = rtmpt_get_amf_param ( tvb , offset + soff , 3 , NULL ) ; } else if ( strcmp ( sFunc , "FCPublish" ) == 0 ) { sParam = rtmpt_get_amf_param ( tvb , offset + soff , 3 , NULL ) ; } else if ( strcmp ( sFunc , "publish" ) == 0 ) { sParam = rtmpt_get_amf_param ( tvb , offset + soff , 3 , NULL ) ; } else if ( strcmp ( sFunc , "onStatus" ) == 0 ) { if ( tp -> cmd == RTMPT_TYPE_COMMAND_AMF0 || tp -> cmd == RTMPT_TYPE_COMMAND_AMF3 ) { sParam = rtmpt_get_amf_param ( tvb , offset + soff , 3 , "code" ) ; } else { sParam = rtmpt_get_amf_param ( tvb , offset + soff , 1 , "code" ) ; } } else if ( strcmp ( sFunc , "onPlayStatus" ) == 0 ) { sParam = rtmpt_get_amf_param ( tvb , offset + soff , 1 , "code" ) ; } else if ( strcmp ( sFunc , "_result" ) == 0 ) { sParam = rtmpt_get_amf_param ( tvb , offset + soff , 3 , "code" ) ; tp -> isresponse = TRUE ; } else if ( strcmp ( sFunc , "_error" ) == 0 ) { sParam = rtmpt_get_amf_param ( tvb , offset + soff , 3 , "code" ) ; tp -> isresponse = TRUE ; } if ( tp -> txid != 0 && tp -> otherframe == 0 ) { tp -> otherframe = GPOINTER_TO_INT ( wmem_tree_lookup32 ( rconv -> txids [ cdir ^ 1 ] , tp -> txid ) ) ; if ( tp -> otherframe ) { RTMPT_DEBUG ( "got otherframe=%d\n" , tp -> otherframe ) ; } } } if ( sFunc ) { if ( sParam ) { return wmem_strdup_printf ( wmem_packet_scope ( ) , "%s('%s')" , sFunc , sParam ) ; } else { return wmem_strdup_printf ( wmem_packet_scope ( ) , "%s()" , sFunc ) ; } } } return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void selinux_cred_free ( struct cred * cred ) { struct task_security_struct * tsec = cred -> security ; BUG_ON ( cred -> security && ( unsigned long ) cred -> security < PAGE_SIZE ) ; cred -> security = ( void * ) 0x7UL ; kfree ( tsec ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void tokenize_b ( int plane , int block , BLOCK_SIZE plane_bsize , TX_SIZE tx_size , void * arg ) { struct tokenize_b_args * const args = arg ; VP9_COMP * cpi = args -> cpi ; MACROBLOCKD * xd = args -> xd ; TOKENEXTRA * * tp = args -> tp ; uint8_t token_cache [ 32 * 32 ] ; struct macroblock_plane * p = & cpi -> mb . plane [ plane ] ; struct macroblockd_plane * pd = & xd -> plane [ plane ] ; MB_MODE_INFO * mbmi = & xd -> mi [ 0 ] . src_mi -> mbmi ; int pt ; int c ; TOKENEXTRA * t = * tp ; int eob = p -> eobs [ block ] ; const PLANE_TYPE type = pd -> plane_type ; const tran_low_t * qcoeff = BLOCK_OFFSET ( p -> qcoeff , block ) ; const int segment_id = mbmi -> segment_id ; const int16_t * scan , * nb ; const scan_order * so ; const int ref = is_inter_block ( mbmi ) ; unsigned int ( * const counts ) [ COEFF_CONTEXTS ] [ ENTROPY_TOKENS ] = cpi -> coef_counts [ tx_size ] [ type ] [ ref ] ; vp9_prob ( * const coef_probs ) [ COEFF_CONTEXTS ] [ UNCONSTRAINED_NODES ] = cpi -> common . fc . coef_probs [ tx_size ] [ type ] [ ref ] ; unsigned int ( * const eob_branch ) [ COEFF_CONTEXTS ] = cpi -> common . counts . eob_branch [ tx_size ] [ type ] [ ref ] ; const uint8_t * const band = get_band_translate ( tx_size ) ; const int seg_eob = get_tx_eob ( & cpi -> common . seg , segment_id , tx_size ) ; const TOKENVALUE * dct_value_tokens ; int aoff , loff ; txfrm_block_to_raster_xy ( plane_bsize , tx_size , block , & aoff , & loff ) ; pt = get_entropy_context ( tx_size , pd -> above_context + aoff , pd -> left_context + loff ) ; so = get_scan ( xd , tx_size , type , block ) ; scan = so -> scan ; nb = so -> neighbors ; c = 0 ; # if CONFIG_VP9_HIGH && CONFIG_HIGH_QUANT if ( cpi -> common . profile >= PROFILE_2 ) { dct_value_tokens = ( cpi -> common . bit_depth == VPX_BITS_10 ? vp9_dct_value_tokens_high10_ptr : vp9_dct_value_tokens_high12_ptr ) ; } else { dct_value_tokens = vp9_dct_value_tokens_ptr ; } # else dct_value_tokens = vp9_dct_value_tokens_ptr ; # endif while ( c < eob ) { int v = 0 ; int skip_eob = 0 ; v = qcoeff [ scan [ c ] ] ; while ( ! v ) { add_token_no_extra ( & t , coef_probs [ band [ c ] ] [ pt ] , ZERO_TOKEN , skip_eob , counts [ band [ c ] ] [ pt ] ) ; eob_branch [ band [ c ] ] [ pt ] += ! skip_eob ; skip_eob = 1 ; token_cache [ scan [ c ] ] = 0 ; ++ c ; pt = get_coef_context ( nb , token_cache , c ) ; v = qcoeff [ scan [ c ] ] ; } add_token ( & t , coef_probs [ band [ c ] ] [ pt ] , dct_value_tokens [ v ] . extra , ( uint8_t ) dct_value_tokens [ v ] . token , ( uint8_t ) skip_eob , counts [ band [ c ] ] [ pt ] ) ; eob_branch [ band [ c ] ] [ pt ] += ! skip_eob ; token_cache [ scan [ c ] ] = vp9_pt_energy_class [ dct_value_tokens [ v ] . token ] ; ++ c ; pt = get_coef_context ( nb , token_cache , c ) ; } if ( c < seg_eob ) { add_token_no_extra ( & t , coef_probs [ band [ c ] ] [ pt ] , EOB_TOKEN , 0 , counts [ band [ c ] ] [ pt ] ) ; ++ eob_branch [ band [ c ] ] [ pt ] ; } * tp = t ; vp9_set_contexts ( xd , pd , plane_bsize , tx_size , c > 0 , aoff , loff ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int avs_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { const uint8_t * buf = avpkt -> data ; const uint8_t * buf_end = avpkt -> data + avpkt -> size ; int buf_size = avpkt -> size ; AvsContext * const avs = avctx -> priv_data ; AVFrame * picture = data ; AVFrame * const p = & avs -> picture ; const uint8_t * table , * vect ; uint8_t * out ; int i , j , x , y , stride , ret , vect_w = 3 , vect_h = 3 ; AvsVideoSubType sub_type ; AvsBlockType type ; GetBitContext change_map ; if ( ( ret = avctx -> reget_buffer ( avctx , p ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ; return ret ; } p -> reference = 1 ; p -> pict_type = AV_PICTURE_TYPE_P ; p -> key_frame = 0 ; out = avs -> picture . data [ 0 ] ; stride = avs -> picture . linesize [ 0 ] ; if ( buf_end - buf < 4 ) return AVERROR_INVALIDDATA ; sub_type = buf [ 0 ] ; type = buf [ 1 ] ; buf += 4 ; if ( type == AVS_PALETTE ) { int first , last ; uint32_t * pal = ( uint32_t * ) avs -> picture . data [ 1 ] ; first = AV_RL16 ( buf ) ; last = first + AV_RL16 ( buf + 2 ) ; if ( first >= 256 || last > 256 || buf_end - buf < 4 + 4 + 3 * ( last - first ) ) return AVERROR_INVALIDDATA ; buf += 4 ; for ( i = first ; i < last ; i ++ , buf += 3 ) pal [ i ] = ( buf [ 0 ] << 18 ) | ( buf [ 1 ] << 10 ) | ( buf [ 2 ] << 2 ) ; sub_type = buf [ 0 ] ; type = buf [ 1 ] ; buf += 4 ; } if ( type != AVS_VIDEO ) return AVERROR_INVALIDDATA ; switch ( sub_type ) { case AVS_I_FRAME : p -> pict_type = AV_PICTURE_TYPE_I ; p -> key_frame = 1 ; case AVS_P_FRAME_3X3 : vect_w = 3 ; vect_h = 3 ; break ; case AVS_P_FRAME_2X2 : vect_w = 2 ; vect_h = 2 ; break ; case AVS_P_FRAME_2X3 : vect_w = 2 ; vect_h = 3 ; break ; default : return AVERROR_INVALIDDATA ; } if ( buf_end - buf < 256 * vect_w * vect_h ) return AVERROR_INVALIDDATA ; table = buf + ( 256 * vect_w * vect_h ) ; if ( sub_type != AVS_I_FRAME ) { int map_size = ( ( 318 / vect_w + 7 ) / 8 ) * ( 198 / vect_h ) ; if ( buf_end - table < map_size ) return AVERROR_INVALIDDATA ; init_get_bits ( & change_map , table , map_size * 8 ) ; table += map_size ; } for ( y = 0 ; y < 198 ; y += vect_h ) { for ( x = 0 ; x < 318 ; x += vect_w ) { if ( sub_type == AVS_I_FRAME || get_bits1 ( & change_map ) ) { if ( buf_end - table < 1 ) return AVERROR_INVALIDDATA ; vect = & buf [ * table ++ * ( vect_w * vect_h ) ] ; for ( j = 0 ; j < vect_w ; j ++ ) { out [ ( y + 0 ) * stride + x + j ] = vect [ ( 0 * vect_w ) + j ] ; out [ ( y + 1 ) * stride + x + j ] = vect [ ( 1 * vect_w ) + j ] ; if ( vect_h == 3 ) out [ ( y + 2 ) * stride + x + j ] = vect [ ( 2 * vect_w ) + j ] ; } } } if ( sub_type != AVS_I_FRAME ) align_get_bits ( & change_map ) ; } * picture = avs -> picture ; * got_frame = 1 ; return buf_size ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { WNV1Context * const l = avctx -> priv_data ; const uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; AVFrame * const p = data ; unsigned char * Y , * U , * V ; int i , j , ret ; int prev_y = 0 , prev_u = 0 , prev_v = 0 ; uint8_t * rbuf ; rbuf = av_malloc ( buf_size + FF_INPUT_BUFFER_PADDING_SIZE ) ; if ( ! rbuf ) { av_log ( avctx , AV_LOG_ERROR , "Cannot allocate temporary buffer\n" ) ; return AVERROR ( ENOMEM ) ; } if ( ( ret = ff_get_buffer ( avctx , p , 0 ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ; av_free ( rbuf ) ; return ret ; } p -> key_frame = 1 ; for ( i = 8 ; i < buf_size ; i ++ ) rbuf [ i ] = ff_reverse [ buf [ i ] ] ; init_get_bits ( & l -> gb , rbuf + 8 , ( buf_size - 8 ) * 8 ) ; if ( buf [ 2 ] >> 4 == 6 ) l -> shift = 2 ; else { l -> shift = 8 - ( buf [ 2 ] >> 4 ) ; if ( l -> shift > 4 ) { av_log_ask_for_sample ( avctx , "Unknown WNV1 frame header value %i\n" , buf [ 2 ] >> 4 ) ; l -> shift = 4 ; } if ( l -> shift < 1 ) { av_log_ask_for_sample ( avctx , "Unknown WNV1 frame header value %i\n" , buf [ 2 ] >> 4 ) ; l -> shift = 1 ; } } Y = p -> data [ 0 ] ; U = p -> data [ 1 ] ; V = p -> data [ 2 ] ; for ( j = 0 ; j < avctx -> height ; j ++ ) { for ( i = 0 ; i < avctx -> width / 2 ; i ++ ) { Y [ i * 2 ] = wnv1_get_code ( l , prev_y ) ; prev_u = U [ i ] = wnv1_get_code ( l , prev_u ) ; prev_y = Y [ ( i * 2 ) + 1 ] = wnv1_get_code ( l , Y [ i * 2 ] ) ; prev_v = V [ i ] = wnv1_get_code ( l , prev_v ) ; } Y += p -> linesize [ 0 ] ; U += p -> linesize [ 1 ] ; V += p -> linesize [ 2 ] ; } * got_frame = 1 ; av_free ( rbuf ) ; return buf_size ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_t38_T_secondary_ifp_packets ( 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_t38_T_secondary_ifp_packets , T_secondary_ifp_packets_sequence_of ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int query_get_string ( MYSQL * mysql , const char * query , int column , DYNAMIC_STRING * ds ) { MYSQL_RES * res = NULL ; MYSQL_ROW row ; if ( mysql_query ( mysql , query ) ) { report_or_die ( "'%s' failed: %d %s" , query , mysql_errno ( mysql ) , mysql_error ( mysql ) ) ; return 1 ; } if ( ( res = mysql_store_result ( mysql ) ) == NULL ) { report_or_die ( "Failed to store result: %d %s" , mysql_errno ( mysql ) , mysql_error ( mysql ) ) ; return 1 ; } if ( ( row = mysql_fetch_row ( res ) ) == NULL ) { mysql_free_result ( res ) ; return 1 ; } init_dynamic_string ( ds , ( row [ column ] ? row [ column ] : "NULL" ) , ~ 0 , 32 ) ; mysql_free_result ( res ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int lookup_uname_helper ( struct cpio * cpio , const char * * name , id_t id ) { struct passwd * pwent ; ( void ) cpio ; errno = 0 ; pwent = getpwuid ( ( uid_t ) id ) ; if ( pwent == NULL ) { * name = NULL ; if ( errno != 0 && errno != ENOENT ) lafe_warnc ( errno , "getpwuid(%s) failed" , cpio_i64toa ( ( int64_t ) id ) ) ; return ( errno ) ; } * name = pwent -> pw_name ; return ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_P ( GLES2DecoderTestWithCHROMIUMPathRendering , MatrixLoadfCHROMIUMImmediateValidArgs ) { cmds : : MatrixLoadfCHROMIUMImmediate & cmd = * GetImmediateAs < cmds : : MatrixLoadfCHROMIUMImmediate > ( ) ; SpecializedSetup < cmds : : MatrixLoadfCHROMIUMImmediate , 0 > ( true ) ; GLfloat temp [ 16 ] = { 0 , } ; cmd . Init ( GL_PATH_PROJECTION_CHROMIUM , & temp [ 0 ] ) ; EXPECT_CALL ( * gl_ , MatrixLoadfEXT ( GL_PATH_PROJECTION_CHROMIUM , PointsToArray ( temp , 16 ) ) ) ; EXPECT_EQ ( error : : kNoError , ExecuteImmediateCmd ( cmd , sizeof ( temp ) ) ) ; EXPECT_EQ ( GL_NO_ERROR , GetGLError ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( UnloadTest , BrowserCloseTwoSecondBeforeUnloadAlert ) { LoadUrlAndQuitBrowser ( TWO_SECOND_BEFORE_UNLOAD_ALERT_HTML , "twosecondbeforeunloadalert" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void LaunchPermissionUpdateInfoBar ( JNIEnv * env , const JavaParamRef < jclass > & clazz , const JavaParamRef < jobject > & tab , const JavaParamRef < jstring > & jpermission , jlong callback_id ) { TabAndroid * tab_android = TabAndroid : : GetNativeTab ( env , tab ) ; std : : string permission = base : : android : : ConvertJavaStringToUTF8 ( env , jpermission ) ; scoped_ptr < DownloadControllerAndroid : : AcquireFileAccessPermissionCallback > cb ( reinterpret_cast < DownloadControllerAndroid : : AcquireFileAccessPermissionCallback * > ( callback_id ) ) ; std : : vector < std : : string > permissions ; permissions . push_back ( permission ) ; PermissionUpdateInfoBarDelegate : : Create ( tab_android -> web_contents ( ) , permissions , IDS_MISSING_STORAGE_PERMISSION_DOWNLOAD_EDUCATION_TEXT , * cb ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void spl_ptr_llist_unshift ( spl_ptr_llist * llist , void * data TSRMLS_DC ) { spl_ptr_llist_element * elem = emalloc ( sizeof ( spl_ptr_llist_element ) ) ; elem -> data = data ; elem -> rc = 1 ; elem -> prev = NULL ; elem -> next = llist -> head ; if ( llist -> head ) { llist -> head -> prev = elem ; } else { llist -> tail = elem ; } llist -> head = elem ; llist -> count ++ ; if ( llist -> ctor ) { llist -> ctor ( elem TSRMLS_CC ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static Selectivity mcelem_array_contained_selec ( Datum * mcelem , int nmcelem , float4 * numbers , int nnumbers , Datum * array_data , int nitems , float4 * hist , int nhist , Oid operator , FmgrInfo * cmpfunc ) { int mcelem_index , i , unique_nitems = 0 ; float selec , minfreq , nullelem_freq ; float * dist , * mcelem_dist , * hist_part ; float avg_count , mult , rest ; float * elem_selec ; if ( numbers == NULL || nnumbers != nmcelem + 3 ) return DEFAULT_CONTAIN_SEL ; if ( hist == NULL || nhist < 3 ) return DEFAULT_CONTAIN_SEL ; minfreq = numbers [ nmcelem ] ; nullelem_freq = numbers [ nmcelem + 2 ] ; avg_count = hist [ nhist - 1 ] ; rest = avg_count ; mult = 1.0f ; elem_selec = ( float * ) palloc ( sizeof ( float ) * nitems ) ; mcelem_index = 0 ; for ( i = 0 ; i < nitems ; i ++ ) { bool match = false ; if ( i > 0 && element_compare ( & array_data [ i - 1 ] , & array_data [ i ] , cmpfunc ) == 0 ) continue ; while ( mcelem_index < nmcelem ) { int cmp = element_compare ( & mcelem [ mcelem_index ] , & array_data [ i ] , cmpfunc ) ; if ( cmp < 0 ) { mult *= ( 1.0f - numbers [ mcelem_index ] ) ; rest -= numbers [ mcelem_index ] ; mcelem_index ++ ; } else { if ( cmp == 0 ) match = true ; break ; } } if ( match ) { elem_selec [ unique_nitems ] = numbers [ mcelem_index ] ; rest -= numbers [ mcelem_index ] ; mcelem_index ++ ; } else { elem_selec [ unique_nitems ] = Min ( DEFAULT_CONTAIN_SEL , minfreq / 2 ) ; } unique_nitems ++ ; } while ( mcelem_index < nmcelem ) { mult *= ( 1.0f - numbers [ mcelem_index ] ) ; rest -= numbers [ mcelem_index ] ; mcelem_index ++ ; } mult *= exp ( - rest ) ; # define EFFORT 100 if ( ( nmcelem + unique_nitems ) > 0 && unique_nitems > EFFORT * nmcelem / ( nmcelem + unique_nitems ) ) { double b = ( double ) nmcelem ; int n ; n = ( int ) ( ( sqrt ( b * b + 4 * EFFORT * b ) - b ) / 2 ) ; qsort ( elem_selec , unique_nitems , sizeof ( float ) , float_compare_desc ) ; unique_nitems = n ; } dist = calc_distr ( elem_selec , unique_nitems , unique_nitems , 0.0f ) ; mcelem_dist = calc_distr ( numbers , nmcelem , unique_nitems , rest ) ; hist_part = calc_hist ( hist , nhist - 1 , unique_nitems ) ; selec = 0.0f ; for ( i = 0 ; i <= unique_nitems ; i ++ ) { if ( mcelem_dist [ i ] > 0 ) selec += hist_part [ i ] * mult * dist [ i ] / mcelem_dist [ i ] ; } pfree ( dist ) ; pfree ( mcelem_dist ) ; pfree ( hist_part ) ; pfree ( elem_selec ) ; selec *= ( 1.0f - nullelem_freq ) ; CLAMP_PROBABILITY ( selec ) ; return selec ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void mime_list_one ( MimeListState * state , GFileInfo * info ) { const char * mime_type ; if ( should_skip_file ( NULL , info ) ) { g_object_unref ( info ) ; return ; } mime_type = g_file_info_get_content_type ( info ) ; if ( mime_type != NULL ) { istr_set_insert ( state -> mime_list_hash , mime_type ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int WriteTTFFont ( char * fontname , SplineFont * sf , enum fontformat format , int32 * bsizes , enum bitmapformat bf , int flags , EncMap * map , int layer ) { FILE * ttf ; int ret ; if ( strstr ( fontname , "://" ) != NULL ) { if ( ( ttf = tmpfile ( ) ) == NULL ) return ( 0 ) ; } else { if ( ( ttf = fopen ( fontname , "wb+" ) ) == NULL ) return ( 0 ) ; } ret = _WriteTTFFont ( ttf , sf , format , bsizes , bf , flags , map , layer ) ; if ( strstr ( fontname , "://" ) != NULL && ret ) ret = URLFromFile ( fontname , ttf ) ; if ( ret && ( flags & ttf_flag_glyphmap ) ) DumpGlyphToNameMap ( fontname , sf ) ; if ( fclose ( ttf ) == - 1 ) return ( 0 ) ; return ( ret ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int capture_android_logcat_text ( char * interface , char * fifo , const char * adb_server_ip , unsigned short * adb_server_tcp_port ) { struct extcap_dumper extcap_dumper ; static char packet [ PACKET_LENGTH ] ; gssize length ; size_t used_buffer_length = 0 ; socket_handle_t sock ; const char * protocol_name ; size_t exported_pdu_headers_size = 0 ; struct exported_pdu_header exported_pdu_header_protocol_normal ; struct exported_pdu_header * exported_pdu_header_protocol ; struct exported_pdu_header exported_pdu_header_end = { 0 , 0 } ; static const char * wireshark_protocol_logcat_text = "logcat_text_threadtime" ; const char * adb_transport = "0012" "host:transport-any" ; const char * adb_logcat_template = "%04x" "shell:export ANDROID_LOG_TAGS=\"\" ; exec logcat -v threadtime%s%s" ; const char * adb_transport_serial_templace = "%04x" "host:transport:%s" ; char * serial_number = NULL ; size_t serial_number_length = 0 ; int result ; char * pos ; const char * logcat_buffer ; extcap_dumper = extcap_dumper_open ( fifo , EXTCAP_ENCAP_WIRESHARK_UPPER_PDU ) ; exported_pdu_header_protocol_normal . tag = GUINT16_TO_BE ( WIRESHARK_UPPER_PDU_TAG_DISSECTOR_NAME ) ; exported_pdu_header_protocol_normal . length = GUINT16_TO_BE ( strlen ( wireshark_protocol_logcat_text ) + 2 ) ; sock = adb_connect ( adb_server_ip , adb_server_tcp_port ) ; if ( sock == INVALID_SOCKET ) return EXIT_CODE_INVALID_SOCKET_8 ; if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_MAIN ) && strlen ( interface ) > strlen ( INTERFACE_ANDROID_LOGCAT_MAIN ) + 1 ) { serial_number = interface + strlen ( INTERFACE_ANDROID_LOGCAT_MAIN ) + 1 ; } else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_SYSTEM ) && strlen ( interface ) > strlen ( INTERFACE_ANDROID_LOGCAT_SYSTEM ) + 1 ) { serial_number = interface + strlen ( INTERFACE_ANDROID_LOGCAT_SYSTEM ) + 1 ; } else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_RADIO ) && strlen ( interface ) > strlen ( INTERFACE_ANDROID_LOGCAT_RADIO ) + 1 ) { serial_number = interface + strlen ( INTERFACE_ANDROID_LOGCAT_RADIO ) + 1 ; } else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_EVENTS ) && strlen ( interface ) > strlen ( INTERFACE_ANDROID_LOGCAT_EVENTS ) + 1 ) { serial_number = interface + strlen ( INTERFACE_ANDROID_LOGCAT_EVENTS ) + 1 ; } else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_TEXT_MAIN ) && strlen ( interface ) > strlen ( INTERFACE_ANDROID_LOGCAT_TEXT_MAIN ) + 1 ) { serial_number = interface + strlen ( INTERFACE_ANDROID_LOGCAT_TEXT_MAIN ) + 1 ; } else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_TEXT_SYSTEM ) && strlen ( interface ) > strlen ( INTERFACE_ANDROID_LOGCAT_TEXT_SYSTEM ) + 1 ) { serial_number = interface + strlen ( INTERFACE_ANDROID_LOGCAT_TEXT_SYSTEM ) + 1 ; } else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_TEXT_RADIO ) && strlen ( interface ) > strlen ( INTERFACE_ANDROID_LOGCAT_TEXT_RADIO ) + 1 ) { serial_number = interface + strlen ( INTERFACE_ANDROID_LOGCAT_TEXT_RADIO ) + 1 ; } else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_TEXT_EVENTS ) && strlen ( interface ) > strlen ( INTERFACE_ANDROID_LOGCAT_TEXT_EVENTS ) + 1 ) { serial_number = interface + strlen ( INTERFACE_ANDROID_LOGCAT_TEXT_EVENTS ) + 1 ; } else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_TEXT_CRASH ) && strlen ( interface ) > strlen ( INTERFACE_ANDROID_LOGCAT_TEXT_CRASH ) + 1 ) { serial_number = interface + strlen ( INTERFACE_ANDROID_LOGCAT_TEXT_CRASH ) + 1 ; } if ( ! serial_number ) { result = adb_send ( sock , adb_transport ) ; if ( result ) { errmsg_print ( "ERROR: Error while setting adb transport for <%s>" , adb_transport ) ; closesocket ( sock ) ; return EXIT_CODE_GENERIC ; } } else { serial_number_length = strlen ( serial_number ) ; result = g_snprintf ( ( char * ) packet , PACKET_LENGTH , adb_transport_serial_templace , 15 + serial_number_length , serial_number ) ; if ( result <= 0 || result > PACKET_LENGTH ) { errmsg_print ( "ERROR: Error while completing adb packet" ) ; closesocket ( sock ) ; return EXIT_CODE_BAD_SIZE_OF_ASSEMBLED_ADB_PACKET_16 ; } result = adb_send ( sock , packet ) ; if ( result ) { errmsg_print ( "ERROR: Error while setting adb transport for <%s>" , packet ) ; closesocket ( sock ) ; return EXIT_CODE_GENERIC ; } } if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_MAIN ) || is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_TEXT_MAIN ) ) logcat_buffer = " -b main" ; else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_SYSTEM ) || is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_TEXT_SYSTEM ) ) logcat_buffer = " -b system" ; else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_RADIO ) || is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_TEXT_RADIO ) ) logcat_buffer = " -b radio" ; else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_EVENTS ) || is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_TEXT_EVENTS ) ) logcat_buffer = " -b events" ; else if ( is_specified_interface ( interface , INTERFACE_ANDROID_LOGCAT_TEXT_CRASH ) ) logcat_buffer = " -b crash" ; else { errmsg_print ( "ERROR: Unknown interface: <%s>" , interface ) ; closesocket ( sock ) ; return EXIT_CODE_GENERIC ; } result = g_snprintf ( ( char * ) packet , PACKET_LENGTH , adb_logcat_template , strlen ( adb_logcat_template ) + - 8 + strlen ( logcat_buffer ) , logcat_buffer , "" ) ; if ( result <= 0 || result > PACKET_LENGTH ) { errmsg_print ( "ERROR: Error while completing adb packet" ) ; closesocket ( sock ) ; return EXIT_CODE_BAD_SIZE_OF_ASSEMBLED_ADB_PACKET_17 ; } result = adb_send ( sock , packet ) ; if ( result ) { errmsg_print ( "ERROR: Error while sending command <%s>" , packet ) ; closesocket ( sock ) ; return EXIT_CODE_ERROR_WHILE_SENDING_ADB_PACKET_3 ; } protocol_name = wireshark_protocol_logcat_text ; exported_pdu_header_protocol = & exported_pdu_header_protocol_normal ; memcpy ( packet , exported_pdu_header_protocol , sizeof ( struct exported_pdu_header ) ) ; exported_pdu_headers_size += sizeof ( struct exported_pdu_header ) ; memcpy ( packet + exported_pdu_headers_size , protocol_name , GUINT16_FROM_BE ( exported_pdu_header_protocol -> length ) - 2 ) ; exported_pdu_headers_size += GUINT16_FROM_BE ( exported_pdu_header_protocol -> length ) ; packet [ exported_pdu_headers_size - 1 ] = 0 ; packet [ exported_pdu_headers_size - 2 ] = 0 ; memcpy ( packet + exported_pdu_headers_size , & exported_pdu_header_end , sizeof ( struct exported_pdu_header ) ) ; exported_pdu_headers_size += sizeof ( struct exported_pdu_header ) + GUINT16_FROM_BE ( exported_pdu_header_end . length ) ; used_buffer_length = 0 ; while ( endless_loop ) { errno = 0 ; length = recv ( sock , packet + exported_pdu_headers_size + used_buffer_length , ( int ) ( PACKET_LENGTH - exported_pdu_headers_size - used_buffer_length ) , 0 ) ; if ( errno == EAGAIN # if EWOULDBLOCK != EAGAIN || errno == EWOULDBLOCK # endif ) { continue ; } else if ( errno != 0 ) { errmsg_print ( "ERROR capture: %s" , strerror ( errno ) ) ; closesocket ( sock ) ; return EXIT_CODE_GENERIC ; } if ( length <= 0 ) { errmsg_print ( "ERROR: Broken socket connection. Try reconnect." ) ; closesocket ( sock ) ; return EXIT_CODE_GENERIC ; } used_buffer_length += length ; while ( used_buffer_length > 0 && ( pos = ( char * ) memchr ( packet + exported_pdu_headers_size , '\n' , used_buffer_length ) ) ) { int ms ; struct tm date ; time_t seconds ; time_t secs = 0 ; int nsecs = 0 ; length = ( gssize ) ( pos - packet ) + 1 ; if ( 6 == sscanf ( packet + exported_pdu_headers_size , "%d-%d %d:%d:%d.%d" , & date . tm_mon , & date . tm_mday , & date . tm_hour , & date . tm_min , & date . tm_sec , & ms ) ) { date . tm_year = 70 ; date . tm_mon -= 1 ; seconds = mktime ( & date ) ; secs = ( time_t ) seconds ; nsecs = ( int ) ( ms * 1e6 ) ; } endless_loop = extcap_dumper_dump ( extcap_dumper , packet , length , length , secs , nsecs ) ; memmove ( packet + exported_pdu_headers_size , packet + length , used_buffer_length + exported_pdu_headers_size - length ) ; used_buffer_length -= length - exported_pdu_headers_size ; } } closesocket ( sock ) ; return EXIT_CODE_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int convert_to_string ( const gs_memory_t * mem , os_ptr op1 , os_ptr op ) { uint len ; const byte * pstr = 0 ; int code = obj_cvs ( mem , op1 , op -> value . bytes , r_size ( op ) , & len , & pstr ) ; if ( code < 0 ) { if ( code == gs_error_rangecheck ) switch ( r_btype ( op1 ) ) { case t_oparray : case t_operator : if ( pstr != 0 ) switch ( * pstr ) { case '%' : case '.' : case '@' : len = r_size ( op ) ; memcpy ( op -> value . bytes , pstr , len ) ; goto ok ; } } return code ; } ok : * op1 = * op ; r_set_size ( op1 , len ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vp9_iwht4x4_add ( const tran_low_t * input , uint8_t * dest , int stride , int eob ) { if ( eob > 1 ) vp9_iwht4x4_16_add ( input , dest , stride ) ; else vp9_iwht4x4_1_add ( input , dest , stride ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void hashcostestimate ( PlannerInfo * root , IndexPath * path , double loop_count , Cost * indexStartupCost , Cost * indexTotalCost , Selectivity * indexSelectivity , double * indexCorrelation ) { List * qinfos ; GenericCosts costs ; qinfos = deconstruct_indexquals ( path ) ; MemSet ( & costs , 0 , sizeof ( costs ) ) ; genericcostestimate ( root , path , loop_count , qinfos , & costs ) ; * indexStartupCost = costs . indexStartupCost ; * indexTotalCost = costs . indexTotalCost ; * indexSelectivity = costs . indexSelectivity ; * indexCorrelation = costs . indexCorrelation ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int ebml_read_uint ( AVIOContext * pb , int size , uint64_t * num ) { int n = 0 ; if ( size > 8 ) return AVERROR_INVALIDDATA ; * num = 0 ; while ( n ++ < size ) * num = ( * num << 8 ) | avio_r8 ( pb ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_P ( BrowserCloseManagerBrowserTest , TestShutdownMoreThanOnce ) { ASSERT_NO_FATAL_FAILURE ( ui_test_utils : : NavigateToURL ( browser ( ) , embedded_test_server ( ) -> GetURL ( "/beforeunload.html" ) ) ) ; PrepareForDialog ( browser ( ) ) ; RepeatedNotificationObserver cancel_observer ( chrome : : NOTIFICATION_BROWSER_CLOSE_CANCELLED , 1 ) ; chrome : : CloseAllBrowsersAndQuit ( ) ; chrome : : CloseAllBrowsersAndQuit ( ) ; ASSERT_NO_FATAL_FAILURE ( CancelClose ( ) ) ; cancel_observer . Wait ( ) ; EXPECT_FALSE ( browser_shutdown : : IsTryingToQuit ( ) ) ; EXPECT_EQ ( 1 , browser ( ) -> tab_strip_model ( ) -> count ( ) ) ; RepeatedNotificationObserver close_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , 1 ) ; chrome : : CloseAllBrowsersAndQuit ( ) ; chrome : : CloseAllBrowsersAndQuit ( ) ; ASSERT_NO_FATAL_FAILURE ( AcceptClose ( ) ) ; close_observer . Wait ( ) ; EXPECT_TRUE ( browser_shutdown : : IsTryingToQuit ( ) ) ; EXPECT_TRUE ( BrowserList : : GetInstance ( ) -> empty ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void pk_transaction_depends_on ( PkTransaction * transaction , GVariant * params , GDBusMethodInvocation * context ) { gboolean ret ; gchar * package_ids_temp ; guint length ; PkBitfield filter ; gboolean recursive ; g_autofree gchar * * package_ids = NULL ; g_autoptr ( GError ) error = NULL ; g_return_if_fail ( PK_IS_TRANSACTION ( transaction ) ) ; g_return_if_fail ( transaction -> priv -> tid != NULL ) ; g_variant_get ( params , "(t^a&sb)" , & filter , & package_ids , & recursive ) ; package_ids_temp = pk_package_ids_to_string ( package_ids ) ; g_debug ( "DependsOn method called: %s (recursive %i)" , package_ids_temp , recursive ) ; if ( ! pk_backend_is_implemented ( transaction -> priv -> backend , PK_ROLE_ENUM_DEPENDS_ON ) ) { g_set_error ( & error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_NOT_SUPPORTED , "DependsOn not supported by backend" ) ; pk_transaction_set_state ( transaction , PK_TRANSACTION_STATE_ERROR ) ; goto out ; } length = g_strv_length ( package_ids ) ; if ( length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS ) { g_set_error ( & error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID , "Too many packages to process (%i/%i)" , length , PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS ) ; pk_transaction_set_state ( transaction , PK_TRANSACTION_STATE_ERROR ) ; goto out ; } ret = pk_package_ids_check ( package_ids ) ; if ( ! ret ) { g_set_error ( & error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID , "The package id's '%s' are not valid" , package_ids_temp ) ; pk_transaction_set_state ( transaction , PK_TRANSACTION_STATE_ERROR ) ; goto out ; } transaction -> priv -> cached_filters = filter ; transaction -> priv -> cached_package_ids = g_strdupv ( package_ids ) ; transaction -> priv -> cached_force = recursive ; pk_transaction_set_role ( transaction , PK_ROLE_ENUM_DEPENDS_ON ) ; pk_transaction_set_state ( transaction , PK_TRANSACTION_STATE_READY ) ; out : pk_transaction_dbus_return ( context , error ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void add_prefix ( smart_str * loc_name , char * key_name ) { if ( strncmp ( key_name , LOC_PRIVATE_TAG , 7 ) == 0 ) { smart_str_appendl ( loc_name , SEPARATOR , sizeof ( SEPARATOR ) - 1 ) ; smart_str_appendl ( loc_name , PRIVATE_PREFIX , sizeof ( PRIVATE_PREFIX ) - 1 ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_RequestInProgress ( 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_RequestInProgress , RequestInProgress_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( TemplateURLTest , SuggestQueryParams ) { TemplateURLData data ; data . SetURL ( "{ google:baseURL} search?q={ searchTerms} " "#{ google:originalQueryForSuggestion} x" ) ; TemplateURL url ( data ) ; TemplateURLRef : : SearchTermsArgs search_terms ( ASCIIToUTF16 ( "abc" ) ) ; search_terms . original_query = ASCIIToUTF16 ( "def" ) ; search_terms . accepted_suggestion = 0 ; EXPECT_EQ ( "http://www.google.com/search?q=abc#oq=def&x" , url . url_ref ( ) . ReplaceSearchTerms ( search_terms , search_terms_data_ ) ) ; search_terms . suggest_query_params = "pq=xyz" ; EXPECT_EQ ( "http://www.google.com/search?pq=xyz&q=abc#oq=def&x" , url . url_ref ( ) . ReplaceSearchTerms ( search_terms , search_terms_data_ ) ) ; search_terms . append_extra_query_params = true ; base : : CommandLine : : ForCurrentProcess ( ) -> AppendSwitchASCII ( switches : : kExtraSearchQueryParams , "a=b" ) ; EXPECT_EQ ( "http://www.google.com/search?a=b&pq=xyz&q=abc#oq=def&x" , url . url_ref ( ) . ReplaceSearchTerms ( search_terms , search_terms_data_ ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( ContentFaviconDriverTest , AssociateIconWithInitialPageDespiteMetaRefreshTagAndLandingPageCached ) { ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ; GURL url_with_meta_refresh_tag = embedded_test_server ( ) -> GetURL ( "/favicon/page_with_meta_refresh_tag.html" ) ; GURL landing_url = embedded_test_server ( ) -> GetURL ( "/favicon/page_with_favicon.html" ) ; { PendingTaskWaiter waiter ( web_contents ( ) ) ; ui_test_utils : : NavigateToURLWithDisposition ( browser ( ) , landing_url , WindowOpenDisposition : : CURRENT_TAB , ui_test_utils : : BROWSER_TEST_NONE ) ; waiter . Wait ( ) ; } ASSERT_NE ( nullptr , GetFaviconForPageURL ( landing_url , favicon_base : : IconType : : kFavicon ) . bitmap_data ) ; PendingTaskWaiter waiter ( web_contents ( ) ) ; waiter . AlsoRequireUrl ( landing_url ) ; ui_test_utils : : NavigateToURLWithDisposition ( browser ( ) , url_with_meta_refresh_tag , WindowOpenDisposition : : CURRENT_TAB , ui_test_utils : : BROWSER_TEST_NONE ) ; waiter . Wait ( ) ; EXPECT_NE ( nullptr , GetFaviconForPageURL ( url_with_meta_refresh_tag , favicon_base : : IconType : : kFavicon ) . bitmap_data ) ; EXPECT_NE ( nullptr , GetFaviconForPageURL ( landing_url , favicon_base : : IconType : : kFavicon ) . bitmap_data ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int selinux_file_alloc_security ( struct file * file ) { return file_alloc_security ( file ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int BIO_vsnprintf ( char * buf , size_t n , const char * format , va_list args ) { size_t retlen ; int truncated ; if ( ! _dopr ( & buf , NULL , & n , & retlen , & truncated , format , args ) ) return - 1 ; if ( truncated ) return - 1 ; else return ( retlen <= INT_MAX ) ? ( int ) retlen : - 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_rsl_ie_codec_conf ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset , gboolean is_mandatory ) { proto_item * ti ; proto_tree * ie_tree ; guint length ; guint8 ie_id ; if ( is_mandatory == FALSE ) { ie_id = tvb_get_guint8 ( tvb , offset ) ; if ( ie_id != RSL_IE_CODEC_CONF ) return offset ; } ie_tree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_ie_codec_conf , & ti , "Codec Configuration IE" ) ; proto_tree_add_item ( ie_tree , hf_rsl_ie_id , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; length = tvb_get_guint8 ( tvb , offset ) ; proto_item_set_len ( ti , length + 2 ) ; proto_tree_add_item ( ie_tree , hf_rsl_ie_length , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; return offset + length ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static zend_object_value spl_dllist_object_clone ( zval * zobject TSRMLS_DC ) { zend_object_value new_obj_val ; zend_object * old_object ; zend_object * new_object ; zend_object_handle handle = Z_OBJ_HANDLE_P ( zobject ) ; spl_dllist_object * intern ; old_object = zend_objects_get_address ( zobject TSRMLS_CC ) ; new_obj_val = spl_dllist_object_new_ex ( old_object -> ce , & intern , zobject , 1 TSRMLS_CC ) ; new_object = & intern -> std ; zend_objects_clone_members ( new_object , new_obj_val , old_object , handle TSRMLS_CC ) ; return new_obj_val ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( ExtensionWelcomeNotificationTest , WelcomeNotificationPreviouslyDismissed ) { StartPreferenceSyncing ( ) ; SetBooleanPref ( prefs : : kWelcomeNotificationDismissed , true ) ; EXPECT_TRUE ( GetBooleanPref ( prefs : : kWelcomeNotificationDismissed ) ) ; EXPECT_FALSE ( GetBooleanPref ( prefs : : kWelcomeNotificationDismissedLocal ) ) ; EXPECT_FALSE ( GetBooleanPref ( prefs : : kWelcomeNotificationPreviouslyPoppedUp ) ) ; ShowChromeNowNotification ( ) ; EXPECT_EQ ( message_center ( ) -> add_notification_calls ( ) , 0 ) ; EXPECT_EQ ( message_center ( ) -> remove_notification_calls ( ) , 0 ) ; EXPECT_EQ ( message_center ( ) -> notifications_with_shown_as_popup ( ) , 0 ) ; EXPECT_TRUE ( GetBooleanPref ( prefs : : kWelcomeNotificationDismissed ) ) ; EXPECT_FALSE ( GetBooleanPref ( prefs : : kWelcomeNotificationDismissedLocal ) ) ; EXPECT_FALSE ( GetBooleanPref ( prefs : : kWelcomeNotificationPreviouslyPoppedUp ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const char * cmd_server_signature ( cmd_parms * cmd , void * _dcfg , const char * p1 ) { if ( cmd -> server -> is_virtual ) { return "ModSecurity: SecServerSignature not allowed in VirtualHost" ; } new_server_signature = ( char * ) p1 ; return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dump_table ( char * table , char * db ) { char ignore_flag ; char buf [ 200 ] , table_buff [ NAME_LEN + 3 ] ; DYNAMIC_STRING query_string ; char table_type [ NAME_LEN ] ; char * result_table , table_buff2 [ NAME_LEN * 2 + 3 ] , * opt_quoted_table ; int error = 0 ; ulong rownr , row_break , total_length , init_length ; uint num_fields ; MYSQL_RES * res ; MYSQL_FIELD * field ; MYSQL_ROW row ; DBUG_ENTER ( "dump_table" ) ; num_fields = get_table_structure ( table , db , table_type , & ignore_flag ) ; if ( strcmp ( table_type , "VIEW" ) == 0 ) DBUG_VOID_RETURN ; if ( opt_no_data ) { verbose_msg ( "-- Skipping dump data for table '%s', --no-data was used\n" , table ) ; DBUG_VOID_RETURN ; } DBUG_PRINT ( "info" , ( "ignore_flag: %x num_fields: %d" , ( int ) ignore_flag , num_fields ) ) ; if ( ignore_flag & IGNORE_DATA ) { verbose_msg ( "-- Warning: Skipping data for table '%s' because " "it's of type %s\n" , table , table_type ) ; DBUG_VOID_RETURN ; } if ( num_fields == 0 ) { verbose_msg ( "-- Skipping dump data for table '%s', it has no fields\n" , table ) ; DBUG_VOID_RETURN ; } if ( ! opt_events && ! my_strcasecmp ( & my_charset_latin1 , db , "mysql" ) && ! my_strcasecmp ( & my_charset_latin1 , table , "event" ) ) { verbose_msg ( "-- Skipping data table mysql.event, --skip-events was used\n" ) ; DBUG_VOID_RETURN ; } result_table = quote_name ( table , table_buff , 1 ) ; opt_quoted_table = quote_name ( table , table_buff2 , 0 ) ; verbose_msg ( "-- Sending SELECT query...\n" ) ; init_dynamic_string_checked ( & query_string , "" , 1024 , 1024 ) ; if ( path ) { char filename [ FN_REFLEN ] , tmp_path [ FN_REFLEN ] ; convert_dirname ( tmp_path , path , NullS ) ; my_load_path ( tmp_path , tmp_path , NULL ) ; fn_format ( filename , table , tmp_path , ".txt" , MYF ( MY_UNPACK_FILENAME ) ) ; my_delete ( filename , MYF ( 0 ) ) ; to_unix_path ( filename ) ; dynstr_append_checked ( & query_string , "SELECT /*!40001 SQL_NO_CACHE */ * INTO OUTFILE '" ) ; dynstr_append_checked ( & query_string , filename ) ; dynstr_append_checked ( & query_string , "'" ) ; dynstr_append_checked ( & query_string , " /*!50138 CHARACTER SET " ) ; dynstr_append_checked ( & query_string , default_charset == mysql_universal_client_charset ? my_charset_bin . name : default_charset ) ; dynstr_append_checked ( & query_string , " */" ) ; if ( fields_terminated || enclosed || opt_enclosed || escaped ) dynstr_append_checked ( & query_string , " FIELDS" ) ; add_load_option ( & query_string , " TERMINATED BY " , fields_terminated ) ; add_load_option ( & query_string , " ENCLOSED BY " , enclosed ) ; add_load_option ( & query_string , " OPTIONALLY ENCLOSED BY " , opt_enclosed ) ; add_load_option ( & query_string , " ESCAPED BY " , escaped ) ; add_load_option ( & query_string , " LINES TERMINATED BY " , lines_terminated ) ; dynstr_append_checked ( & query_string , " FROM " ) ; dynstr_append_checked ( & query_string , result_table ) ; if ( where ) { dynstr_append_checked ( & query_string , " WHERE " ) ; dynstr_append_checked ( & query_string , where ) ; } if ( order_by ) { dynstr_append_checked ( & query_string , " ORDER BY " ) ; dynstr_append_checked ( & query_string , order_by ) ; } if ( mysql_real_query ( mysql , query_string . str , query_string . length ) ) { DB_error ( mysql , "when executing 'SELECT INTO OUTFILE'" ) ; dynstr_free ( & query_string ) ; DBUG_VOID_RETURN ; } } else { print_comment ( md_result_file , 0 , "\n--\n-- Dumping data for table %s\n--\n" , result_table ) ; dynstr_append_checked ( & query_string , "SELECT /*!40001 SQL_NO_CACHE */ * FROM " ) ; dynstr_append_checked ( & query_string , result_table ) ; if ( where ) { print_comment ( md_result_file , 0 , "-- WHERE: %s\n" , where ) ; dynstr_append_checked ( & query_string , " WHERE " ) ; dynstr_append_checked ( & query_string , where ) ; } if ( order_by ) { print_comment ( md_result_file , 0 , "-- ORDER BY: %s\n" , order_by ) ; dynstr_append_checked ( & query_string , " ORDER BY " ) ; dynstr_append_checked ( & query_string , order_by ) ; } if ( ! opt_xml && ! opt_compact ) { fputs ( "\n" , md_result_file ) ; check_io ( md_result_file ) ; } if ( mysql_query_with_error_report ( mysql , 0 , query_string . str ) ) { DB_error ( mysql , "when retrieving data from server" ) ; goto err ; } if ( quick ) res = mysql_use_result ( mysql ) ; else res = mysql_store_result ( mysql ) ; if ( ! res ) { DB_error ( mysql , "when retrieving data from server" ) ; goto err ; } verbose_msg ( "-- Retrieving rows...\n" ) ; if ( mysql_num_fields ( res ) != num_fields ) { fprintf ( stderr , "%s: Error in field count for table: %s ! Aborting.\n" , my_progname_short , result_table ) ; error = EX_CONSCHECK ; goto err ; } if ( opt_lock ) { fprintf ( md_result_file , "LOCK TABLES %s WRITE; \n" , opt_quoted_table ) ; check_io ( md_result_file ) ; } if ( opt_disable_keys ) { fprintf ( md_result_file , "/*!40000 ALTER TABLE %s DISABLE KEYS */; \n" , opt_quoted_table ) ; check_io ( md_result_file ) ; } total_length = opt_net_buffer_length ; row_break = 0 ; rownr = 0 ; init_length = ( uint ) insert_pat . length + 4 ; if ( opt_xml ) print_xml_tag ( md_result_file , "\t" , "\n" , "table_data" , "name=" , table , NullS ) ; if ( opt_autocommit ) { fprintf ( md_result_file , "set autocommit=0; \n" ) ; check_io ( md_result_file ) ; } while ( ( row = mysql_fetch_row ( res ) ) ) { uint i ; ulong * lengths = mysql_fetch_lengths ( res ) ; rownr ++ ; if ( ! extended_insert && ! opt_xml ) { fputs ( insert_pat . str , md_result_file ) ; check_io ( md_result_file ) ; } mysql_field_seek ( res , 0 ) ; if ( opt_xml ) { fputs ( "\t<row>\n" , md_result_file ) ; check_io ( md_result_file ) ; } for ( i = 0 ; i < mysql_num_fields ( res ) ; i ++ ) { int is_blob ; ulong length = lengths [ i ] ; if ( ! ( field = mysql_fetch_field ( res ) ) ) die ( EX_CONSCHECK , "Not enough fields from table %s! Aborting.\n" , result_table ) ; is_blob = ( opt_hex_blob && field -> charsetnr == 63 && ( field -> type == MYSQL_TYPE_BIT || field -> type == MYSQL_TYPE_STRING || field -> type == MYSQL_TYPE_VAR_STRING || field -> type == MYSQL_TYPE_VARCHAR || field -> type == MYSQL_TYPE_BLOB || field -> type == MYSQL_TYPE_LONG_BLOB || field -> type == MYSQL_TYPE_MEDIUM_BLOB || field -> type == MYSQL_TYPE_TINY_BLOB || field -> type == MYSQL_TYPE_GEOMETRY ) ) ? 1 : 0 ; if ( extended_insert && ! opt_xml ) { if ( i == 0 ) dynstr_set_checked ( & extended_row , "(" ) ; else dynstr_append_checked ( & extended_row , "," ) ; if ( row [ i ] ) { if ( length ) { if ( ! ( field -> flags & NUM_FLAG ) ) { dynstr_realloc_checked ( & extended_row , length * 2 + 2 + 1 ) ; if ( opt_hex_blob && is_blob ) { dynstr_append_checked ( & extended_row , "0x" ) ; extended_row . length += mysql_hex_string ( extended_row . str + extended_row . length , row [ i ] , length ) ; DBUG_ASSERT ( extended_row . length + 1 <= extended_row . max_length ) ; DBUG_ASSERT ( extended_row . str [ extended_row . length ] == '\0' ) ; } else { dynstr_append_checked ( & extended_row , "'" ) ; extended_row . length += mysql_real_escape_string ( & mysql_connection , & extended_row . str [ extended_row . length ] , row [ i ] , length ) ; extended_row . str [ extended_row . length ] = '\0' ; dynstr_append_checked ( & extended_row , "'" ) ; } } else { char * ptr = row [ i ] ; if ( my_isalpha ( charset_info , * ptr ) || ( * ptr == '-' && my_isalpha ( charset_info , ptr [ 1 ] ) ) ) dynstr_append_checked ( & extended_row , "NULL" ) ; else { if ( field -> type == MYSQL_TYPE_DECIMAL ) { dynstr_append_checked ( & extended_row , "'" ) ; dynstr_append_checked ( & extended_row , ptr ) ; dynstr_append_checked ( & extended_row , "'" ) ; } else dynstr_append_checked ( & extended_row , ptr ) ; } } } else dynstr_append_checked ( & extended_row , "''" ) ; } else dynstr_append_checked ( & extended_row , "NULL" ) ; } else { if ( i && ! opt_xml ) { fputc ( ',' , md_result_file ) ; check_io ( md_result_file ) ; } if ( row [ i ] ) { if ( ! ( field -> flags & NUM_FLAG ) ) { if ( opt_xml ) { if ( opt_hex_blob && is_blob && length ) { print_xml_tag ( md_result_file , "\t\t" , "" , "field" , "name=" , field -> name , "xsi:type=" , "xs:hexBinary" , NullS ) ; print_blob_as_hex ( md_result_file , row [ i ] , length ) ; } else { print_xml_tag ( md_result_file , "\t\t" , "" , "field" , "name=" , field -> name , NullS ) ; print_quoted_xml ( md_result_file , row [ i ] , length , 0 ) ; } fputs ( "</field>\n" , md_result_file ) ; } else if ( opt_hex_blob && is_blob && length ) { fputs ( "0x" , md_result_file ) ; print_blob_as_hex ( md_result_file , row [ i ] , length ) ; } else unescape ( md_result_file , row [ i ] , length ) ; } else { char * ptr = row [ i ] ; if ( opt_xml ) { print_xml_tag ( md_result_file , "\t\t" , "" , "field" , "name=" , field -> name , NullS ) ; fputs ( ! my_isalpha ( charset_info , * ptr ) ? ptr : "NULL" , md_result_file ) ; fputs ( "</field>\n" , md_result_file ) ; } else if ( my_isalpha ( charset_info , * ptr ) || ( * ptr == '-' && my_isalpha ( charset_info , ptr [ 1 ] ) ) ) fputs ( "NULL" , md_result_file ) ; else if ( field -> type == MYSQL_TYPE_DECIMAL ) { fputc ( '\'' , md_result_file ) ; fputs ( ptr , md_result_file ) ; fputc ( '\'' , md_result_file ) ; } else fputs ( ptr , md_result_file ) ; } } else { if ( ! opt_xml ) fputs ( "NULL" , md_result_file ) ; else print_xml_null_tag ( md_result_file , "\t\t" , "field name=" , field -> name , "\n" ) ; } check_io ( md_result_file ) ; } } if ( opt_xml ) { fputs ( "\t</row>\n" , md_result_file ) ; check_io ( md_result_file ) ; } if ( extended_insert ) { ulong row_length ; dynstr_append_checked ( & extended_row , ")" ) ; row_length = 2 + extended_row . length ; if ( total_length + row_length < opt_net_buffer_length ) { total_length += row_length ; fputc ( ',' , md_result_file ) ; fputs ( extended_row . str , md_result_file ) ; } else { if ( row_break ) fputs ( "; \n" , md_result_file ) ; row_break = 1 ; fputs ( insert_pat . str , md_result_file ) ; fputs ( extended_row . str , md_result_file ) ; total_length = row_length + init_length ; } check_io ( md_result_file ) ; } else if ( ! opt_xml ) { fputs ( "); \n" , md_result_file ) ; check_io ( md_result_file ) ; } } if ( opt_xml ) fputs ( "\t</table_data>\n" , md_result_file ) ; else if ( extended_insert && row_break ) fputs ( "; \n" , md_result_file ) ; fflush ( md_result_file ) ; check_io ( md_result_file ) ; if ( mysql_errno ( mysql ) ) { my_snprintf ( buf , sizeof ( buf ) , "%s: Error %d: %s when dumping table %s at row: %ld\n" , my_progname_short , mysql_errno ( mysql ) , mysql_error ( mysql ) , result_table , rownr ) ; fputs ( buf , stderr ) ; error = EX_CONSCHECK ; goto err ; } if ( opt_disable_keys ) { fprintf ( md_result_file , "/*!40000 ALTER TABLE %s ENABLE KEYS */; \n" , opt_quoted_table ) ; check_io ( md_result_file ) ; } if ( opt_lock ) { fputs ( "UNLOCK TABLES; \n" , md_result_file ) ; check_io ( md_result_file ) ; } if ( opt_autocommit ) { fprintf ( md_result_file , "commit; \n" ) ; check_io ( md_result_file ) ; } mysql_free_result ( res ) ; } dynstr_free ( & query_string ) ; DBUG_VOID_RETURN ; err : dynstr_free ( & query_string ) ; maybe_exit ( error ) ; DBUG_VOID_RETURN ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int virtio_net_init_pci ( PCIDevice * pci_dev ) { VirtIOPCIProxy * proxy = DO_UPCAST ( VirtIOPCIProxy , pci_dev , pci_dev ) ; VirtIODevice * vdev ; vdev = virtio_net_init ( & pci_dev -> qdev , & proxy -> nic ) ; vdev -> nvectors = proxy -> nvectors ; virtio_init_pci ( proxy , vdev , PCI_VENDOR_ID_REDHAT_QUMRANET , PCI_DEVICE_ID_VIRTIO_NET , PCI_CLASS_NETWORK_ETHERNET , 0x00 ) ; proxy -> nvectors = vdev -> nvectors ; return 0 ; }
0False