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 unsigned char conv_ascii2bin ( unsigned char a ) { if ( a & 0x80 ) return B64_ERROR ; return data_ascii2bin [ a ] ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void hb_set_add ( hb_set_t * set , hb_codepoint_t codepoint ) { set -> add ( codepoint ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void rlvl_destroy ( jpc_enc_rlvl_t * rlvl ) { jpc_enc_band_t * band ; uint_fast16_t bandno ; if ( rlvl -> bands ) { for ( bandno = 0 , band = rlvl -> bands ; bandno < rlvl -> numbands ; ++ bandno , ++ band ) { band_destroy ( band ) ; } jas_free ( rlvl -> bands ) ; rlvl -> bands = NULL ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void pdf_process_BMC ( fz_context * ctx , pdf_processor * proc , pdf_csi * csi , const char * name ) { if ( proc -> op_BMC ) proc -> op_BMC ( ctx , proc , name ) ; if ( proc -> hidden > 0 ) ++ proc -> hidden ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void * Type_Data_Dup ( struct _cms_typehandler_struct * self , const void * Ptr , cmsUInt32Number n ) { cmsICCData * BinData = ( cmsICCData * ) Ptr ; return _cmsDupMem ( self -> ContextID , Ptr , sizeof ( cmsICCData ) + BinData -> len - 1 ) ; cmsUNUSED_PARAMETER ( n ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void unmap_linear_vram ( CirrusVGAState * s ) { if ( s -> bustype == CIRRUS_BUSTYPE_PCI && s -> linear_vram ) { s -> linear_vram = false ; memory_region_del_subregion ( & s -> pci_bar , & s -> vga . vram ) ; } memory_region_set_enabled ( & s -> cirrus_bank [ 0 ] , false ) ; memory_region_set_enabled ( & s -> cirrus_bank [ 1 ] , false ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static guint pvfs2_io_tracking_hash ( gconstpointer k ) { const pvfs2_io_tracking_key_t * key = ( const pvfs2_io_tracking_key_t * ) k ; return ( guint ) ( ( key -> tag >> 32 ) ^ ( ( guint32 ) key -> tag ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void jbig2_ctx_free ( Jbig2Ctx * ctx ) { Jbig2Allocator * ca = ctx -> allocator ; int i ; jbig2_free ( ca , ctx -> buf ) ; if ( ctx -> segments != NULL ) { for ( i = 0 ; i < ctx -> n_segments ; i ++ ) jbig2_free_segment ( ctx , ctx -> segments [ i ] ) ; jbig2_free ( ca , ctx -> segments ) ; } if ( ctx -> pages != NULL ) { for ( i = 0 ; i <= ctx -> current_page ; i ++ ) if ( ctx -> pages [ i ] . image != NULL ) jbig2_image_release ( ctx , ctx -> pages [ i ] . image ) ; jbig2_free ( ca , ctx -> pages ) ; } jbig2_free ( ca , ctx ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TSReturnCode TSMimeHdrFieldValueDelete ( TSMBuffer bufp , TSMLoc hdr , TSMLoc field , int idx ) { sdk_assert ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) ; sdk_assert ( ( sdk_sanity_check_mime_hdr_handle ( hdr ) == TS_SUCCESS ) || ( sdk_sanity_check_http_hdr_handle ( hdr ) == TS_SUCCESS ) ) ; sdk_assert ( sdk_sanity_check_field_handle ( field , hdr ) == TS_SUCCESS ) ; sdk_assert ( idx >= 0 ) ; if ( ! isWriteable ( bufp ) ) { return TS_ERROR ; } MIMEFieldSDKHandle * handle = ( MIMEFieldSDKHandle * ) field ; HdrHeap * heap = ( ( HdrHeapSDKHandle * ) bufp ) -> m_heap ; mime_field_value_delete_comma_val ( heap , handle -> mh , handle -> field_ptr , idx ) ; return TS_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( FullscreenControllerInteractiveTest , DISABLED_TestFullscreenBubbleMouseLockState ) { ASSERT_TRUE ( test_server ( ) -> Start ( ) ) ; AddTabAtIndex ( 0 , GURL ( url : : kAboutBlankURL ) , PAGE_TRANSITION_TYPED ) ; AddTabAtIndex ( 1 , GURL ( url : : kAboutBlankURL ) , PAGE_TRANSITION_TYPED ) ; ASSERT_NO_FATAL_FAILURE ( ToggleTabFullscreen ( true ) ) ; RequestToLockMouse ( true , false ) ; ASSERT_TRUE ( IsMouseLockPermissionRequested ( ) ) ; AcceptCurrentFullscreenOrMouseLockRequest ( ) ; ASSERT_FALSE ( IsFullscreenBubbleDisplayingButtons ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void compress_job_on_completed ( AutoarCompressor * compressor , gpointer user_data ) { CompressJob * compress_job = user_data ; g_autoptr ( GFile ) destination_directory = NULL ; char * status ; if ( compress_job -> total_files == 1 ) { status = f ( _ ( "Compressed β€œ%B” into β€œ%B”" ) , G_FILE ( compress_job -> source_files -> data ) , compress_job -> output_file ) ; } else { status = f ( ngettext ( "Compressed %'d file into β€œ%B”" , "Compressed %'d files into β€œ%B”" , compress_job -> total_files ) , compress_job -> total_files , compress_job -> output_file ) ; } nautilus_progress_info_take_status ( compress_job -> common . progress , status ) ; nautilus_file_changes_queue_file_added ( compress_job -> output_file ) ; destination_directory = g_file_get_parent ( compress_job -> output_file ) ; nautilus_progress_info_set_destination ( compress_job -> common . progress , destination_directory ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void default_print_section_header ( WriterContext * wctx ) { DefaultContext * def = wctx -> priv ; char buf [ 32 ] ; const struct section * section = wctx -> section [ wctx -> level ] ; const struct section * parent_section = wctx -> level ? wctx -> section [ wctx -> level - 1 ] : NULL ; av_bprint_clear ( & wctx -> section_pbuf [ wctx -> level ] ) ; if ( parent_section && ! ( parent_section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) { def -> nested_section [ wctx -> level ] = 1 ; av_bprintf ( & wctx -> section_pbuf [ wctx -> level ] , "%s%s:" , wctx -> section_pbuf [ wctx -> level - 1 ] . str , upcase_string ( buf , sizeof ( buf ) , av_x_if_null ( section -> element_name , section -> name ) ) ) ; } if ( def -> noprint_wrappers || def -> nested_section [ wctx -> level ] ) return ; if ( ! ( section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) printf ( "[%s]\n" , upcase_string ( buf , sizeof ( buf ) , section -> name ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_date_date ( ) { int rc ; myheader ( "test_date_date" ) ; rc = mysql_query ( mysql , "DROP TABLE IF EXISTS test_date" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "CREATE TABLE test_date(c1 DATE, \ c2 DATE, \ c3 DATE, \ c4 DATE)" ) ; myquery ( rc ) ; bind_date_conv ( 3 , FALSE ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void ohci_td_pkt ( const char * msg , const uint8_t * buf , size_t len ) { }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int ipvideo_decode_block_opcode_0x0 ( IpvideoContext * s , AVFrame * frame ) { return copy_from ( s , s -> last_frame , frame , 0 , 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void save_handle ( packet_info * pinfo , bluetooth_uuid_t uuid , guint32 handle , enum attribute_type attribute_type , bluetooth_data_t * bluetooth_data ) { if ( ! handle && uuid . size != 2 && uuid . size != 16 ) return ; if ( have_tap_listener ( btatt_tap_handles ) ) { tap_handles_t * tap_handles ; tap_handles = wmem_new ( wmem_packet_scope ( ) , tap_handles_t ) ; tap_handles -> handle = handle ; tap_handles -> uuid = uuid ; tap_queue_packet ( btatt_tap_handles , pinfo , tap_handles ) ; } if ( ! pinfo -> fd -> flags . visited && bluetooth_data ) { wmem_tree_key_t key [ 5 ] ; guint32 frame_number ; handle_data_t * handle_data ; frame_number = pinfo -> num ; key [ 0 ] . length = 1 ; key [ 0 ] . key = & bluetooth_data -> interface_id ; key [ 1 ] . length = 1 ; key [ 1 ] . key = & bluetooth_data -> adapter_id ; key [ 2 ] . length = 1 ; key [ 2 ] . key = & handle ; key [ 3 ] . length = 1 ; key [ 3 ] . key = & frame_number ; key [ 4 ] . length = 0 ; key [ 4 ] . key = NULL ; handle_data = wmem_new ( wmem_file_scope ( ) , handle_data_t ) ; handle_data -> uuid = uuid ; handle_data -> type = attribute_type ; wmem_tree_insert32_array ( handle_to_uuid , key , handle_data ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_simpleread ( void ) { struct event ev ; setup_test ( "Simple read: " ) ; write ( pair [ 0 ] , TEST1 , strlen ( TEST1 ) + 1 ) ; shutdown ( pair [ 0 ] , SHUT_WR ) ; event_set ( & ev , pair [ 1 ] , EV_READ , simple_read_cb , & ev ) ; if ( event_add ( & ev , NULL ) == - 1 ) exit ( 1 ) ; event_dispatch ( ) ; cleanup_test ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline void lh_ ## type ## _node_stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) { OPENSSL_LH_node_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ; } static ossl_inline void lh_ ## type ## _node_usage_stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) { OPENSSL_LH_node_usage_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ; } static ossl_inline void lh_ ## type ## _stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) { OPENSSL_LH_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ; } static ossl_inline unsigned long lh_ ## type ## _get_down_load ( LHASH_OF ( type ) * lh ) { return OPENSSL_LH_get_down_load ( ( OPENSSL_LHASH * ) lh ) ; } static ossl_inline void lh_ ## type ## _set_down_load ( LHASH_OF ( type ) * lh , unsigned long dl ) { OPENSSL_LH_set_down_load ( ( OPENSSL_LHASH * ) lh , dl ) ; } static ossl_inline void lh_ ## type ## _doall ( LHASH_OF ( type ) * lh , void ( * doall ) ( type * ) ) { OPENSSL_LH_doall ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNC ) doall ) ; } LHASH_OF ( type ) # define IMPLEMENT_LHASH_DOALL_ARG_CONST ( type , argtype ) int_implement_lhash_doall ( type , argtype , const type ) # define IMPLEMENT_LHASH_DOALL_ARG ( type , argtype ) int_implement_lhash_doall ( type , argtype , type ) # define int_implement_lhash_doall ( type , argtype , cbargtype ) static ossl_inline void lh_ ## type ## _doall_ ## argtype ( LHASH_OF ( type ) * lh , void ( * fn ) ( cbargtype * , argtype * ) , argtype * arg ) { OPENSSL_LH_doall_arg ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNCARG ) fn , ( void * ) arg ) ; } LHASH_OF ( type ) DEFINE_LHASH_OF ( OPENSSL_STRING ) ; # ifdef _MSC_VER # pragma warning ( push ) # pragma warning ( disable : 4090 ) # endif DEFINE_LHASH_OF ( OPENSSL_CSTRING )
1True
Categorize the following code snippet as vulnerable or not. True or False
int mi_repair_parallel ( MI_CHECK * param , register MI_INFO * info , const char * name , int rep_quick ) { int got_error ; uint i , key , total_key_length , istep ; ulong rec_length ; ha_rows start_records ; my_off_t new_header_length , del ; File new_file ; MI_SORT_PARAM * sort_param = 0 ; MYISAM_SHARE * share = info -> s ; ulong * rec_per_key_part ; HA_KEYSEG * keyseg ; char llbuff [ 22 ] ; IO_CACHE new_data_cache ; IO_CACHE_SHARE io_share ; SORT_INFO sort_info ; ulonglong UNINIT_VAR ( key_map ) ; pthread_attr_t thr_attr ; ulong max_pack_reclength ; int error ; DBUG_ENTER ( "mi_repair_parallel" ) ; start_records = info -> state -> records ; got_error = 1 ; new_file = - 1 ; new_header_length = ( param -> testflag & T_UNPACK ) ? 0 : share -> pack . header_length ; if ( ! ( param -> testflag & T_SILENT ) ) { printf ( "- parallel recovering (with sort) MyISAM-table '%s'\n" , name ) ; printf ( "Data records: %s\n" , llstr ( start_records , llbuff ) ) ; } param -> testflag |= T_REP ; if ( info -> s -> options & ( HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD ) ) param -> testflag |= T_CALC_CHECKSUM ; DBUG_PRINT ( "info" , ( "is quick repair: %d" , rep_quick ) ) ; bzero ( ( char * ) & sort_info , sizeof ( sort_info ) ) ; mysql_mutex_init ( mi_key_mutex_MI_SORT_INFO_mutex , & sort_info . mutex , MY_MUTEX_INIT_FAST ) ; mysql_cond_init ( mi_key_cond_MI_SORT_INFO_cond , & sort_info . cond , 0 ) ; mysql_mutex_init ( mi_key_mutex_MI_CHECK_print_msg , & param -> print_msg_mutex , MY_MUTEX_INIT_FAST ) ; param -> need_print_msg_lock = 1 ; if ( ! ( sort_info . key_block = alloc_key_blocks ( param , ( uint ) param -> sort_key_blocks , share -> base . max_key_block_length ) ) || init_io_cache ( & param -> read_cache , info -> dfile , ( uint ) param -> read_buffer_length , READ_CACHE , share -> pack . header_length , 1 , MYF ( MY_WME ) ) || ( ! rep_quick && ( init_io_cache ( & info -> rec_cache , info -> dfile , ( uint ) param -> write_buffer_length , WRITE_CACHE , new_header_length , 1 , MYF ( MY_WME | MY_WAIT_IF_FULL ) & param -> myf_rw ) || init_io_cache ( & new_data_cache , - 1 , ( uint ) param -> write_buffer_length , READ_CACHE , new_header_length , 1 , MYF ( MY_WME | MY_DONT_CHECK_FILESIZE ) ) ) ) ) goto err ; sort_info . key_block_end = sort_info . key_block + param -> sort_key_blocks ; info -> opt_flag |= WRITE_CACHE_USED ; info -> rec_cache . file = info -> dfile ; if ( ! rep_quick ) { if ( ( new_file = mysql_file_create ( mi_key_file_datatmp , fn_format ( param -> temp_filename , share -> data_file_name , "" , DATA_TMP_EXT , 2 + 4 ) , 0 , param -> tmpfile_createflag , MYF ( 0 ) ) ) < 0 ) { mi_check_print_error ( param , "Can't create new tempfile: '%s'" , param -> temp_filename ) ; goto err ; } if ( new_header_length && filecopy ( param , new_file , info -> dfile , 0L , new_header_length , "datafile-header" ) ) goto err ; if ( param -> testflag & T_UNPACK ) { share -> options &= ~ HA_OPTION_COMPRESS_RECORD ; mi_int2store ( share -> state . header . options , share -> options ) ; } share -> state . dellink = HA_OFFSET_ERROR ; info -> rec_cache . file = new_file ; } info -> update = ( short ) ( HA_STATE_CHANGED | HA_STATE_ROW_CHANGED ) ; mi_drop_all_indexes ( param , info , FALSE ) ; key_map = share -> state . key_map ; if ( param -> testflag & T_CREATE_MISSING_KEYS ) { key_map = ~ key_map ; } sort_info . info = info ; sort_info . param = param ; set_data_file_type ( & sort_info , share ) ; sort_info . dupp = 0 ; sort_info . buff = 0 ; param -> read_cache . end_of_file = sort_info . filelength = mysql_file_seek ( param -> read_cache . file , 0L , MY_SEEK_END , MYF ( 0 ) ) ; if ( share -> data_file_type == DYNAMIC_RECORD ) rec_length = max ( share -> base . min_pack_length + 1 , share -> base . min_block_length ) ; else if ( share -> data_file_type == COMPRESSED_RECORD ) rec_length = share -> base . min_block_length ; else rec_length = share -> base . pack_reclength ; sort_info . max_records = ( ( param -> testflag & T_CREATE_MISSING_KEYS ) ? info -> state -> records + 1 : ( ha_rows ) ( sort_info . filelength / rec_length + 1 ) ) ; del = info -> state -> del ; param -> glob_crc = 0 ; max_pack_reclength = share -> base . pack_reclength ; if ( share -> options & HA_OPTION_COMPRESS_RECORD ) set_if_bigger ( max_pack_reclength , share -> max_pack_length ) ; if ( ! ( sort_param = ( MI_SORT_PARAM * ) my_malloc ( ( uint ) share -> base . keys * ( sizeof ( MI_SORT_PARAM ) + max_pack_reclength ) , MYF ( MY_ZEROFILL ) ) ) ) { mi_check_print_error ( param , "Not enough memory for key!" ) ; goto err ; } total_key_length = 0 ; rec_per_key_part = param -> rec_per_key_part ; info -> state -> records = info -> state -> del = share -> state . split = 0 ; info -> state -> empty = 0 ; for ( i = key = 0 , istep = 1 ; key < share -> base . keys ; rec_per_key_part += sort_param [ i ] . keyinfo -> keysegs , i += istep , key ++ ) { sort_param [ i ] . key = key ; sort_param [ i ] . keyinfo = share -> keyinfo + key ; sort_param [ i ] . seg = sort_param [ i ] . keyinfo -> seg ; if ( ! mi_is_key_active ( key_map , key ) ) { memcpy ( ( char * ) rec_per_key_part , ( char * ) ( share -> state . rec_per_key_part + ( uint ) ( rec_per_key_part - param -> rec_per_key_part ) ) , sort_param [ i ] . keyinfo -> keysegs * sizeof ( * rec_per_key_part ) ) ; istep = 0 ; continue ; } istep = 1 ; if ( ( ! ( param -> testflag & T_SILENT ) ) ) printf ( "- Fixing index %d\n" , key + 1 ) ; if ( sort_param [ i ] . keyinfo -> flag & HA_FULLTEXT ) { sort_param [ i ] . key_read = sort_ft_key_read ; sort_param [ i ] . key_write = sort_ft_key_write ; } else { sort_param [ i ] . key_read = sort_key_read ; sort_param [ i ] . key_write = sort_key_write ; } sort_param [ i ] . key_cmp = sort_key_cmp ; sort_param [ i ] . lock_in_memory = lock_memory ; sort_param [ i ] . tmpdir = param -> tmpdir ; sort_param [ i ] . sort_info = & sort_info ; sort_param [ i ] . master = 0 ; sort_param [ i ] . fix_datafile = 0 ; sort_param [ i ] . calc_checksum = 0 ; sort_param [ i ] . filepos = new_header_length ; sort_param [ i ] . max_pos = sort_param [ i ] . pos = share -> pack . header_length ; sort_param [ i ] . record = ( ( ( uchar * ) ( sort_param + share -> base . keys ) ) + ( max_pack_reclength * i ) ) ; if ( ! mi_alloc_rec_buff ( info , - 1 , & sort_param [ i ] . rec_buff ) ) { mi_check_print_error ( param , "Not enough memory!" ) ; goto err ; } sort_param [ i ] . key_length = share -> rec_reflength ; for ( keyseg = sort_param [ i ] . seg ; keyseg -> type != HA_KEYTYPE_END ; keyseg ++ ) { sort_param [ i ] . key_length += keyseg -> length ; if ( keyseg -> flag & HA_SPACE_PACK ) sort_param [ i ] . key_length += get_pack_length ( keyseg -> length ) ; if ( keyseg -> flag & ( HA_BLOB_PART | HA_VAR_LENGTH_PART ) ) sort_param [ i ] . key_length += 2 + test ( keyseg -> length >= 127 ) ; if ( keyseg -> flag & HA_NULL_PART ) sort_param [ i ] . key_length ++ ; } total_key_length += sort_param [ i ] . key_length ; if ( sort_param [ i ] . keyinfo -> flag & HA_FULLTEXT ) { uint ft_max_word_len_for_sort = FT_MAX_WORD_LEN_FOR_SORT * sort_param [ i ] . keyinfo -> seg -> charset -> mbmaxlen ; sort_param [ i ] . key_length += ft_max_word_len_for_sort - HA_FT_MAXBYTELEN ; init_alloc_root ( & sort_param [ i ] . wordroot , FTPARSER_MEMROOT_ALLOC_SIZE , 0 ) ; } } sort_info . total_keys = i ; sort_param [ 0 ] . master = 1 ; sort_param [ 0 ] . fix_datafile = ( my_bool ) ( ! rep_quick ) ; sort_param [ 0 ] . calc_checksum = test ( param -> testflag & T_CALC_CHECKSUM ) ; if ( ! ftparser_alloc_param ( info ) ) goto err ; sort_info . got_error = 0 ; mysql_mutex_lock ( & sort_info . mutex ) ; if ( i > 1 ) { if ( rep_quick ) init_io_cache_share ( & param -> read_cache , & io_share , NULL , i ) ; else init_io_cache_share ( & new_data_cache , & io_share , & info -> rec_cache , i ) ; } else io_share . total_threads = 0 ; ( void ) pthread_attr_init ( & thr_attr ) ; ( void ) pthread_attr_setdetachstate ( & thr_attr , PTHREAD_CREATE_DETACHED ) ; for ( i = 0 ; i < sort_info . total_keys ; i ++ ) { sort_param [ i ] . read_cache = ( ( rep_quick || ! i ) ? param -> read_cache : new_data_cache ) ; DBUG_PRINT ( "io_cache_share" , ( "thread: %u read_cache: 0x%lx" , i , ( long ) & sort_param [ i ] . read_cache ) ) ; sort_param [ i ] . sortbuff_size = # ifndef USING_SECOND_APPROACH param -> sort_buffer_length / sort_info . total_keys ; # else param -> sort_buffer_length * sort_param [ i ] . key_length / total_key_length ; # endif if ( ( error = mysql_thread_create ( mi_key_thread_find_all_keys , & sort_param [ i ] . thr , & thr_attr , thr_find_all_keys , ( void * ) ( sort_param + i ) ) ) ) { mi_check_print_error ( param , "Cannot start a repair thread (errno= %d)" , error ) ; if ( io_share . total_threads ) remove_io_thread ( & sort_param [ i ] . read_cache ) ; DBUG_PRINT ( "error" , ( "Cannot start a repair thread" ) ) ; sort_info . got_error = 1 ; } else sort_info . threads_running ++ ; } ( void ) pthread_attr_destroy ( & thr_attr ) ; while ( sort_info . threads_running ) mysql_cond_wait ( & sort_info . cond , & sort_info . mutex ) ; mysql_mutex_unlock ( & sort_info . mutex ) ; if ( ( got_error = thr_write_keys ( sort_param ) ) ) { param -> retry_repair = 1 ; goto err ; } got_error = 1 ; if ( sort_param [ 0 ] . fix_datafile ) { if ( write_data_suffix ( & sort_info , 1 ) || end_io_cache ( & info -> rec_cache ) ) goto err ; if ( param -> testflag & T_SAFE_REPAIR ) { if ( info -> state -> records + 1 < start_records ) { info -> state -> records = start_records ; goto err ; } } share -> state . state . data_file_length = info -> state -> data_file_length = sort_param -> filepos ; share -> state . version = ( ulong ) time ( ( time_t * ) 0 ) ; mysql_file_close ( info -> dfile , MYF ( 0 ) ) ; info -> dfile = new_file ; share -> data_file_type = sort_info . new_data_file_type ; share -> pack . header_length = ( ulong ) new_header_length ; } else info -> state -> data_file_length = sort_param -> max_pos ; if ( rep_quick && del + sort_info . dupp != info -> state -> del ) { mi_check_print_error ( param , "Couldn't fix table with quick recovery: Found wrong number of deleted records" ) ; mi_check_print_error ( param , "Run recovery again without -q" ) ; param -> retry_repair = 1 ; param -> testflag |= T_RETRY_WITHOUT_QUICK ; goto err ; } if ( rep_quick & T_FORCE_UNIQUENESS ) { my_off_t skr = info -> state -> data_file_length + ( share -> options & HA_OPTION_COMPRESS_RECORD ? MEMMAP_EXTRA_MARGIN : 0 ) ; # ifdef USE_RELOC if ( share -> data_file_type == STATIC_RECORD && skr < share -> base . reloc * share -> base . min_pack_length ) skr = share -> base . reloc * share -> base . min_pack_length ; # endif if ( skr != sort_info . filelength ) if ( mysql_file_chsize ( info -> dfile , skr , 0 , MYF ( 0 ) ) ) mi_check_print_warning ( param , "Can't change size of datafile, error: %d" , my_errno ) ; } if ( param -> testflag & T_CALC_CHECKSUM ) info -> state -> checksum = param -> glob_crc ; if ( mysql_file_chsize ( share -> kfile , info -> state -> key_file_length , 0 , MYF ( 0 ) ) ) mi_check_print_warning ( param , "Can't change size of indexfile, error: %d" , my_errno ) ; if ( ! ( param -> testflag & T_SILENT ) ) { if ( start_records != info -> state -> records ) printf ( "Data records: %s\n" , llstr ( info -> state -> records , llbuff ) ) ; if ( sort_info . dupp ) mi_check_print_warning ( param , "%s records have been removed" , llstr ( sort_info . dupp , llbuff ) ) ; } got_error = 0 ; if ( & share -> state . state != info -> state ) memcpy ( & share -> state . state , info -> state , sizeof ( * info -> state ) ) ; err : got_error |= flush_blocks ( param , share -> key_cache , share -> kfile ) ; ( void ) end_io_cache ( & info -> rec_cache ) ; if ( ! rep_quick ) ( void ) end_io_cache ( & new_data_cache ) ; if ( ! got_error ) { if ( new_file >= 0 ) { mysql_file_close ( new_file , MYF ( 0 ) ) ; info -> dfile = new_file = - 1 ; if ( change_to_newfile ( share -> data_file_name , MI_NAME_DEXT , DATA_TMP_EXT , ( param -> testflag & T_BACKUP_DATA ? MYF ( MY_REDEL_MAKE_BACKUP ) : MYF ( 0 ) ) ) || mi_open_datafile ( info , share , name , - 1 ) ) got_error = 1 ; } } if ( got_error ) { if ( ! param -> error_printed ) mi_check_print_error ( param , "%d when fixing table" , my_errno ) ; if ( new_file >= 0 ) { ( void ) mysql_file_close ( new_file , MYF ( 0 ) ) ; ( void ) mysql_file_delete ( mi_key_file_datatmp , param -> temp_filename , MYF ( MY_WME ) ) ; if ( info -> dfile == new_file ) if ( unlikely ( mi_open_datafile ( info , share , name , - 1 ) ) ) param -> retry_repair = 0 ; } mi_mark_crashed_on_repair ( info ) ; } else if ( key_map == share -> state . key_map ) share -> state . changed &= ~ STATE_NOT_OPTIMIZED_KEYS ; share -> state . changed |= STATE_NOT_SORTED_PAGES ; mysql_cond_destroy ( & sort_info . cond ) ; mysql_mutex_destroy ( & sort_info . mutex ) ; mysql_mutex_destroy ( & param -> print_msg_mutex ) ; param -> need_print_msg_lock = 0 ; my_free ( sort_info . ft_buf ) ; my_free ( sort_info . key_block ) ; my_free ( sort_param ) ; my_free ( sort_info . buff ) ; ( void ) end_io_cache ( & param -> read_cache ) ; info -> opt_flag &= ~ ( READ_CACHE_USED | WRITE_CACHE_USED ) ; if ( ! got_error && ( param -> testflag & T_UNPACK ) ) { share -> state . header . options [ 0 ] &= ( uchar ) ~ HA_OPTION_COMPRESS_RECORD ; share -> pack . header_length = 0 ; } DBUG_RETURN ( got_error ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void malta_fpga_update_display ( void * opaque ) { char leds_text [ 9 ] ; int i ; MaltaFPGAState * s = opaque ; for ( i = 7 ; i >= 0 ; i -- ) { if ( s -> leds & ( 1 << i ) ) leds_text [ i ] = '#' ; else leds_text [ i ] = ' ' ; } leds_text [ 8 ] = '\0' ; qemu_chr_fe_printf ( s -> display , "\e[H\n\n|\e[32m%-8.8s\e[00m|\r\n" , leds_text ) ; qemu_chr_fe_printf ( s -> display , "\n\n\n\n|\e[31m%-8.8s\e[00m|" , s -> display_text ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void kvm_arch_reset_vcpu ( X86CPU * cpu ) { CPUX86State * env = & cpu -> env ; env -> xcr0 = 1 ; if ( kvm_irqchip_in_kernel ( ) ) { env -> mp_state = cpu_is_bsp ( cpu ) ? KVM_MP_STATE_RUNNABLE : KVM_MP_STATE_UNINITIALIZED ; } else { env -> mp_state = KVM_MP_STATE_RUNNABLE ; } if ( cpu -> hyperv_synic ) { int i ; for ( i = 0 ; i < ARRAY_SIZE ( env -> msr_hv_synic_sint ) ; i ++ ) { env -> msr_hv_synic_sint [ i ] = HV_SINT_MASKED ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void cid_done_loader ( CID_Loader * loader ) { CID_Parser * parser = & loader -> parser ; cid_parser_done ( parser ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static unsigned int do_16x16_motion_iteration ( VP9_COMP * cpi , const MV * ref_mv , MV * dst_mv , int mb_row , int mb_col ) { MACROBLOCK * const x = & cpi -> mb ; MACROBLOCKD * const xd = & x -> e_mbd ; const MV_SPEED_FEATURES * const mv_sf = & cpi -> sf . mv ; const vp9_variance_fn_ptr_t v_fn_ptr = cpi -> fn_ptr [ BLOCK_16X16 ] ; const int tmp_col_min = x -> mv_col_min ; const int tmp_col_max = x -> mv_col_max ; const int tmp_row_min = x -> mv_row_min ; const int tmp_row_max = x -> mv_row_max ; MV ref_full ; int sad_list [ 5 ] ; int step_param = mv_sf -> reduce_first_step_size ; step_param = MIN ( step_param , MAX_MVSEARCH_STEPS - 2 ) ; vp9_set_mv_search_range ( x , ref_mv ) ; ref_full . col = ref_mv -> col >> 3 ; ref_full . row = ref_mv -> row >> 3 ; vp9_hex_search ( x , & ref_full , step_param , x -> errorperbit , 0 , cond_sad_list ( cpi , sad_list ) , & v_fn_ptr , 0 , ref_mv , dst_mv ) ; { int distortion ; unsigned int sse ; cpi -> find_fractional_mv_step ( x , dst_mv , ref_mv , cpi -> common . allow_high_precision_mv , x -> errorperbit , & v_fn_ptr , 0 , mv_sf -> subpel_iters_per_step , cond_sad_list ( cpi , sad_list ) , NULL , NULL , & distortion , & sse , NULL , 0 , 0 ) ; } xd -> mi [ 0 ] . src_mi -> mbmi . mode = NEWMV ; xd -> mi [ 0 ] . src_mi -> mbmi . mv [ 0 ] . as_mv = * dst_mv ; vp9_build_inter_predictors_sby ( xd , mb_row , mb_col , BLOCK_16X16 ) ; x -> mv_col_min = tmp_col_min ; x -> mv_col_max = tmp_col_max ; x -> mv_row_min = tmp_row_min ; x -> mv_row_max = tmp_row_max ; return vp9_sad16x16 ( x -> plane [ 0 ] . src . buf , x -> plane [ 0 ] . src . stride , xd -> plane [ 0 ] . dst . buf , xd -> plane [ 0 ] . dst . stride ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void voutf ( struct GlobalConfig * config , const char * prefix , const char * fmt , va_list ap ) { size_t width = ( 79 - strlen ( prefix ) ) ; if ( ! config -> mute ) { size_t len ; char * ptr ; char * print_buffer ; print_buffer = curlx_mvaprintf ( fmt , ap ) ; if ( ! print_buffer ) return ; len = strlen ( print_buffer ) ; ptr = print_buffer ; while ( len > 0 ) { fputs ( prefix , config -> errors ) ; if ( len > width ) { size_t cut = width - 1 ; while ( ! ISSPACE ( ptr [ cut ] ) && cut ) { cut -- ; } if ( 0 == cut ) cut = width - 1 ; ( void ) fwrite ( ptr , cut + 1 , 1 , config -> errors ) ; fputs ( "\n" , config -> errors ) ; ptr += cut + 1 ; len -= cut + 1 ; } else { fputs ( ptr , config -> errors ) ; len = 0 ; } } curl_free ( print_buffer ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void ohci_sysbus_class_init ( ObjectClass * klass , void * data ) { DeviceClass * dc = DEVICE_CLASS ( klass ) ; dc -> realize = ohci_realize_pxa ; set_bit ( DEVICE_CATEGORY_USB , dc -> categories ) ; dc -> desc = "OHCI USB Controller" ; dc -> props = ohci_sysbus_properties ; dc -> reset = usb_ohci_reset_sysbus ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
gboolean nautilus_directory_is_file_list_monitored ( NautilusDirectory * directory ) { return directory -> details -> file_list_monitored ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void usage ( void ) { const char * p ; p = lafe_getprogname ( ) ; fprintf ( stderr , "Brief Usage:\n" ) ; fprintf ( stderr , " List: %s -it < archive\n" , p ) ; fprintf ( stderr , " Extract: %s -i < archive\n" , p ) ; fprintf ( stderr , " Create: %s -o < filenames > archive\n" , p ) ; fprintf ( stderr , " Help: %s --help\n" , p ) ; exit ( 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void file_deleted_callback ( GFile * file , GError * error , gpointer callback_data ) { DeleteData * data = callback_data ; CommonJob * job ; SourceInfo * source_info ; TransferInfo * transfer_info ; GFileType file_type ; char * primary ; char * secondary ; char * details = NULL ; int response ; job = data -> job ; source_info = data -> source_info ; transfer_info = data -> transfer_info ; data -> transfer_info -> num_files ++ ; if ( error == NULL ) { nautilus_file_changes_queue_file_removed ( file ) ; report_delete_progress ( data -> job , data -> source_info , data -> transfer_info ) ; return ; } if ( job_aborted ( job ) || job -> skip_all_error || should_skip_file ( job , file ) || should_skip_readdir_error ( job , file ) ) { return ; } primary = f ( _ ( "Error while deleting." ) ) ; file_type = g_file_query_file_type ( file , G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS , job -> cancellable ) ; if ( file_type == G_FILE_TYPE_DIRECTORY ) { secondary = IS_IO_ERROR ( error , PERMISSION_DENIED ) ? f ( _ ( "There was an error deleting the folder β€œ%B”." ) , file ) : f ( _ ( "You do not have sufficient permissions to delete the folder β€œ%B”." ) , file ) ; } else { secondary = IS_IO_ERROR ( error , PERMISSION_DENIED ) ? f ( _ ( "There was an error deleting the file β€œ%B”." ) , file ) : f ( _ ( "You do not have sufficient permissions to delete the file β€œ%B”." ) , file ) ; } details = error -> message ; response = run_cancel_or_skip_warning ( job , primary , secondary , details , source_info -> num_files , source_info -> num_files - transfer_info -> num_files ) ; if ( response == 0 || response == GTK_RESPONSE_DELETE_EVENT ) { abort_job ( job ) ; } else if ( response == 1 ) { job -> skip_all_error = TRUE ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
hb_language_t hb_ot_tag_to_language ( hb_tag_t tag ) { unsigned int i ; if ( tag == HB_OT_TAG_DEFAULT_LANGUAGE ) return NULL ; for ( i = 0 ; i < ARRAY_LENGTH ( ot_languages ) ; i ++ ) if ( ot_languages [ i ] . tag == tag ) return hb_language_from_string ( ot_languages [ i ] . language , - 1 ) ; if ( ( tag & 0xFFFF0000u ) == 0x5A480000u ) { switch ( tag ) { case HB_TAG ( 'Z' , 'H' , 'H' , ' ' ) : return hb_language_from_string ( "zh-hk" , - 1 ) ; case HB_TAG ( 'Z' , 'H' , 'S' , ' ' ) : return hb_language_from_string ( "zh-Hans" , - 1 ) ; case HB_TAG ( 'Z' , 'H' , 'T' , ' ' ) : return hb_language_from_string ( "zh-Hant" , - 1 ) ; default : break ; } } { unsigned char buf [ 11 ] = "x-hbot" ; buf [ 6 ] = tag >> 24 ; buf [ 7 ] = ( tag >> 16 ) & 0xFF ; buf [ 8 ] = ( tag >> 8 ) & 0xFF ; buf [ 9 ] = tag & 0xFF ; if ( buf [ 9 ] == 0x20 ) buf [ 9 ] = '\0' ; buf [ 10 ] = '\0' ; return hb_language_from_string ( ( char * ) buf , - 1 ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const char * mgs_readable_cvm ( mgs_client_verification_method_e m ) { switch ( m ) { case mgs_cvm_unset : return "unset" ; case mgs_cvm_cartel : return "cartel" ; case mgs_cvm_msva : return "msva" ; } return "unknown" ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int append_warnings ( DYNAMIC_STRING * ds , MYSQL * mysql ) { uint count ; MYSQL_RES * warn_res ; DBUG_ENTER ( "append_warnings" ) ; if ( ! ( count = mysql_warning_count ( mysql ) ) ) DBUG_RETURN ( 0 ) ; DBUG_ASSERT ( ! mysql_more_results ( mysql ) ) ; if ( mysql_real_query ( mysql , "SHOW WARNINGS" , 13 ) ) die ( "Error running query \"SHOW WARNINGS\": %s" , mysql_error ( mysql ) ) ; if ( ! ( warn_res = mysql_store_result ( mysql ) ) ) die ( "Warning count is %u but didn't get any warnings" , count ) ; append_result ( ds , warn_res ) ; mysql_free_result ( warn_res ) ; DBUG_PRINT ( "warnings" , ( "%s" , ds -> str ) ) ; DBUG_RETURN ( count ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int zfor ( i_ctx_t * i_ctx_p ) { os_ptr op = osp ; register es_ptr ep ; int code ; float params [ 3 ] ; if ( ( code = float_params ( op - 1 , 3 , params ) ) < 0 ) return code ; if ( params [ 0 ] == 0.0 && params [ 1 ] == 0.0 ) { pop ( 4 ) ; return 0 ; } check_estack ( 7 ) ; ep = esp + 6 ; check_proc ( * op ) ; if ( r_has_type ( op - 3 , t_integer ) && r_has_type ( op - 2 , t_integer ) ) { make_int ( ep - 4 , op [ - 3 ] . value . intval ) ; make_int ( ep - 3 , op [ - 2 ] . value . intval ) ; switch ( r_type ( op - 1 ) ) { case t_integer : make_int ( ep - 2 , op [ - 1 ] . value . intval ) ; break ; case t_real : make_int ( ep - 2 , ( long ) op [ - 1 ] . value . realval ) ; break ; default : return_op_typecheck ( op - 1 ) ; } if ( ep [ - 3 ] . value . intval >= 0 ) make_op_estack ( ep , for_pos_int_continue ) ; else make_op_estack ( ep , for_neg_int_continue ) ; } else { make_real ( ep - 4 , params [ 0 ] ) ; make_real ( ep - 3 , params [ 1 ] ) ; make_real ( ep - 2 , params [ 2 ] ) ; make_op_estack ( ep , for_real_continue ) ; } make_mark_estack ( ep - 5 , es_for , no_cleanup ) ; ref_assign ( ep - 1 , op ) ; esp = ep ; pop ( 4 ) ; return o_push_estack ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( FullscreenControllerInteractiveTest , DISABLED_PrivilegedMouseLockAndFullscreen ) { ASSERT_TRUE ( test_server ( ) -> Start ( ) ) ; ui_test_utils : : NavigateToURL ( browser ( ) , test_server ( ) -> GetURL ( kFullscreenMouseLockHTML ) ) ; ASSERT_FALSE ( IsFullscreenBubbleDisplayed ( ) ) ; SetPrivilegedFullscreen ( true ) ; FullscreenNotificationObserver fullscreen_observer ; ASSERT_TRUE ( ui_test_utils : : SendKeyPressAndWait ( browser ( ) , ui : : VKEY_B , false , true , false , false , chrome : : NOTIFICATION_MOUSE_LOCK_CHANGED , content : : NotificationService : : AllSources ( ) ) ) ; fullscreen_observer . Wait ( ) ; ASSERT_FALSE ( IsFullscreenBubbleDisplayed ( ) ) ; ASSERT_FALSE ( IsFullscreenPermissionRequested ( ) ) ; ASSERT_FALSE ( IsMouseLockPermissionRequested ( ) ) ; ASSERT_TRUE ( IsMouseLocked ( ) ) ; ASSERT_TRUE ( IsWindowFullscreenForTabOrPending ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _ASCIIGetUnicodeSet ( const UConverter * cnv , const USetAdder * sa , UConverterUnicodeSet which , UErrorCode * pErrorCode ) { sa -> addRange ( sa -> set , 0 , 0x7f ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
int32 get_atttypmod ( Oid relid , AttrNumber attnum ) { HeapTuple tp ; tp = SearchSysCache2 ( ATTNUM , ObjectIdGetDatum ( relid ) , Int16GetDatum ( attnum ) ) ; if ( HeapTupleIsValid ( tp ) ) { Form_pg_attribute att_tup = ( Form_pg_attribute ) GETSTRUCT ( tp ) ; int32 result ; result = att_tup -> atttypmod ; ReleaseSysCache ( tp ) ; return result ; } else return - 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
rfbBool rfbSendRectEncodingRaw ( rfbClientPtr cl , int x , int y , int w , int h ) { rfbFramebufferUpdateRectHeader rect ; int nlines ; int bytesPerLine = w * ( cl -> format . bitsPerPixel / 8 ) ; char * fbptr = ( cl -> scaledScreen -> frameBuffer + ( cl -> scaledScreen -> paddedWidthInBytes * y ) + ( x * ( cl -> scaledScreen -> bitsPerPixel / 8 ) ) ) ; if ( cl -> ublen > 0 ) { if ( ! rfbSendUpdateBuf ( cl ) ) return FALSE ; } rect . r . x = Swap16IfLE ( x ) ; rect . r . y = Swap16IfLE ( y ) ; rect . r . w = Swap16IfLE ( w ) ; rect . r . h = Swap16IfLE ( h ) ; rect . encoding = Swap32IfLE ( rfbEncodingRaw ) ; memcpy ( & cl -> updateBuf [ cl -> ublen ] , ( char * ) & rect , sz_rfbFramebufferUpdateRectHeader ) ; cl -> ublen += sz_rfbFramebufferUpdateRectHeader ; rfbStatRecordEncodingSent ( cl , rfbEncodingRaw , sz_rfbFramebufferUpdateRectHeader + bytesPerLine * h , sz_rfbFramebufferUpdateRectHeader + bytesPerLine * h ) ; nlines = ( UPDATE_BUF_SIZE - cl -> ublen ) / bytesPerLine ; while ( TRUE ) { if ( nlines > h ) nlines = h ; ( * cl -> translateFn ) ( cl -> translateLookupTable , & ( cl -> screen -> serverFormat ) , & cl -> format , fbptr , & cl -> updateBuf [ cl -> ublen ] , cl -> scaledScreen -> paddedWidthInBytes , w , nlines ) ; cl -> ublen += nlines * bytesPerLine ; h -= nlines ; if ( h == 0 ) return TRUE ; if ( ! rfbSendUpdateBuf ( cl ) ) return FALSE ; fbptr += ( cl -> scaledScreen -> paddedWidthInBytes * nlines ) ; nlines = ( UPDATE_BUF_SIZE - cl -> ublen ) / bytesPerLine ; if ( nlines == 0 ) { rfbErr ( "rfbSendRectEncodingRaw: send buffer too small for %d " "bytes per line\n" , bytesPerLine ) ; rfbCloseClient ( cl ) ; return FALSE ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
hb_tag_t hb_ot_tag_from_language ( hb_language_t language ) { const char * lang_str , * s ; if ( language == HB_LANGUAGE_INVALID ) return HB_OT_TAG_DEFAULT_LANGUAGE ; lang_str = hb_language_to_string ( language ) ; s = strstr ( lang_str , "x-hbot" ) ; if ( s ) { char tag [ 4 ] ; int i ; s += 6 ; for ( i = 0 ; i < 4 && ISALPHA ( s [ i ] ) ; i ++ ) tag [ i ] = TOUPPER ( s [ i ] ) ; if ( i ) { for ( ; i < 4 ; i ++ ) tag [ i ] = ' ' ; return HB_TAG_CHAR4 ( tag ) ; } } { const LangTag * lang_tag ; lang_tag = ( LangTag * ) bsearch ( lang_str , ot_languages , ARRAY_LENGTH ( ot_languages ) , sizeof ( LangTag ) , ( hb_compare_func_t ) lang_compare_first_component ) ; if ( lang_tag ) return lang_tag -> tag ; } if ( 0 == lang_compare_first_component ( lang_str , "zh" ) ) { unsigned int i ; for ( i = 0 ; i < ARRAY_LENGTH ( ot_languages_zh ) ; i ++ ) { const LangTagLong * lang_tag ; lang_tag = & ot_languages_zh [ i ] ; if ( lang_matches ( lang_str , lang_tag -> language ) ) return lang_tag -> tag ; } return HB_TAG ( 'Z' , 'H' , 'S' , ' ' ) ; } s = strchr ( lang_str , '-' ) ; if ( ! s ) s = lang_str + strlen ( lang_str ) ; if ( s - lang_str == 3 ) { return hb_tag_from_string ( lang_str , s - lang_str ) & ~ 0x20202000u ; } return HB_OT_TAG_DEFAULT_LANGUAGE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void udp6_hwcsum_outgoing ( struct sock * sk , struct sk_buff * skb , const struct in6_addr * saddr , const struct in6_addr * daddr , int len ) { unsigned int offset ; struct udphdr * uh = udp_hdr ( skb ) ; __wsum csum = 0 ; if ( skb_queue_len ( & sk -> sk_write_queue ) == 1 ) { skb -> csum_start = skb_transport_header ( skb ) - skb -> head ; skb -> csum_offset = offsetof ( struct udphdr , check ) ; uh -> check = ~ csum_ipv6_magic ( saddr , daddr , len , IPPROTO_UDP , 0 ) ; } else { offset = skb_transport_offset ( skb ) ; skb -> csum = skb_checksum ( skb , offset , skb -> len - offset , 0 ) ; skb -> ip_summed = CHECKSUM_NONE ; skb_queue_walk ( & sk -> sk_write_queue , skb ) { csum = csum_add ( csum , skb -> csum ) ; } uh -> check = csum_ipv6_magic ( saddr , daddr , len , IPPROTO_UDP , csum ) ; if ( uh -> check == 0 ) uh -> check = CSUM_MANGLED_0 ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int opt_show_ ## section ( const char * opt , const char * arg ) { mark_section_show_entries ( SECTION_ID_ ## target_section_id , 1 , NULL ) ; return 0 ; } DEFINE_OPT_SHOW_SECTION ( chapters , CHAPTERS ) DEFINE_OPT_SHOW_SECTION ( error , ERROR ) DEFINE_OPT_SHOW_SECTION ( format , FORMAT ) DEFINE_OPT_SHOW_SECTION ( frames , FRAMES ) DEFINE_OPT_SHOW_SECTION ( library_versions , LIBRARY_VERSIONS )
0False
Categorize the following code snippet as vulnerable or not. True or False
const vpx_codec_cx_pkt_t * vpx_codec_get_cx_data ( vpx_codec_ctx_t * ctx , vpx_codec_iter_t * iter ) { const vpx_codec_cx_pkt_t * pkt = NULL ; if ( ctx ) { if ( ! iter ) ctx -> err = VPX_CODEC_INVALID_PARAM ; else if ( ! ctx -> iface || ! ctx -> priv ) ctx -> err = VPX_CODEC_ERROR ; else if ( ! ( ctx -> iface -> caps & VPX_CODEC_CAP_ENCODER ) ) ctx -> err = VPX_CODEC_INCAPABLE ; else pkt = ctx -> iface -> enc . get_cx_data ( get_alg_priv ( ctx ) , iter ) ; } if ( pkt && pkt -> kind == VPX_CODEC_CX_FRAME_PKT ) { vpx_codec_priv_t * const priv = ctx -> priv ; char * const dst_buf = ( char * ) priv -> enc . cx_data_dst_buf . buf ; if ( dst_buf && pkt -> data . raw . buf != dst_buf && pkt -> data . raw . sz + priv -> enc . cx_data_pad_before + priv -> enc . cx_data_pad_after <= priv -> enc . cx_data_dst_buf . sz ) { vpx_codec_cx_pkt_t * modified_pkt = & priv -> enc . cx_data_pkt ; memcpy ( dst_buf + priv -> enc . cx_data_pad_before , pkt -> data . raw . buf , pkt -> data . raw . sz ) ; * modified_pkt = * pkt ; modified_pkt -> data . raw . buf = dst_buf ; modified_pkt -> data . raw . sz += priv -> enc . cx_data_pad_before + priv -> enc . cx_data_pad_after ; pkt = modified_pkt ; } if ( dst_buf == pkt -> data . raw . buf ) { priv -> enc . cx_data_dst_buf . buf = dst_buf + pkt -> data . raw . sz ; priv -> enc . cx_data_dst_buf . sz -= pkt -> data . raw . sz ; } } return pkt ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static uint64_t xhci_mfindex_get ( XHCIState * xhci ) { int64_t now = qemu_clock_get_ns ( QEMU_CLOCK_VIRTUAL ) ; return ( now - xhci -> mfindex_start ) / 125000 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( ShortcutsProviderTest , MultiMatch ) { base : : string16 text ( ASCIIToUTF16 ( "NEWS" ) ) ; ExpectedURLs expected_urls ; expected_urls . push_back ( ExpectedURLAndAllowedToBeDefault ( "http://slashdot.org/" , false ) ) ; expected_urls . push_back ( ExpectedURLAndAllowedToBeDefault ( "http://sports.yahoo.com/" , false ) ) ; expected_urls . push_back ( ExpectedURLAndAllowedToBeDefault ( "http://www.cnn.com/index.html" , false ) ) ; RunShortcutsProviderTest ( provider_ , text , false , expected_urls , "http://slashdot.org/" , base : : string16 ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void set_data_file_type ( SORT_INFO * sort_info , MYISAM_SHARE * share ) { if ( ( sort_info -> new_data_file_type = share -> data_file_type ) == COMPRESSED_RECORD && sort_info -> param -> testflag & T_UNPACK ) { MYISAM_SHARE tmp ; if ( share -> options & HA_OPTION_PACK_RECORD ) sort_info -> new_data_file_type = DYNAMIC_RECORD ; else sort_info -> new_data_file_type = STATIC_RECORD ; memcpy ( ( char * ) & tmp , share , sizeof ( * share ) ) ; tmp . options = ~ HA_OPTION_COMPRESS_RECORD ; mi_setup_functions ( & tmp ) ; share -> delete_record = tmp . delete_record ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int vp9_get_frame_buffer ( void * cb_priv , size_t min_size , vpx_codec_frame_buffer_t * fb ) { int i ; InternalFrameBufferList * const int_fb_list = ( InternalFrameBufferList * ) cb_priv ; if ( int_fb_list == NULL ) return - 1 ; for ( i = 0 ; i < int_fb_list -> num_internal_frame_buffers ; ++ i ) { if ( ! int_fb_list -> int_fb [ i ] . in_use ) break ; } if ( i == int_fb_list -> num_internal_frame_buffers ) return - 1 ; if ( int_fb_list -> int_fb [ i ] . size < min_size ) { int_fb_list -> int_fb [ i ] . data = ( uint8_t * ) vpx_realloc ( int_fb_list -> int_fb [ i ] . data , min_size ) ; if ( ! int_fb_list -> int_fb [ i ] . data ) return - 1 ; int_fb_list -> int_fb [ i ] . size = min_size ; } fb -> data = int_fb_list -> int_fb [ i ] . data ; fb -> size = int_fb_list -> int_fb [ i ] . size ; int_fb_list -> int_fb [ i ] . in_use = 1 ; fb -> priv = & int_fb_list -> int_fb [ i ] ; return 0 ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static struct sock * __udp6_lib_lookup ( struct net * net , struct in6_addr * saddr , __be16 sport , struct in6_addr * daddr , __be16 dport , int dif , struct udp_table * udptable ) { struct sock * sk , * result ; struct hlist_nulls_node * node ; unsigned short hnum = ntohs ( dport ) ; unsigned int hash2 , slot2 , slot = udp_hashfn ( net , hnum , udptable -> mask ) ; struct udp_hslot * hslot2 , * hslot = & udptable -> hash [ slot ] ; int score , badness ; rcu_read_lock ( ) ; if ( hslot -> count > 10 ) { hash2 = udp6_portaddr_hash ( net , daddr , hnum ) ; slot2 = hash2 & udptable -> mask ; hslot2 = & udptable -> hash2 [ slot2 ] ; if ( hslot -> count < hslot2 -> count ) goto begin ; result = udp6_lib_lookup2 ( net , saddr , sport , daddr , hnum , dif , hslot2 , slot2 ) ; if ( ! result ) { hash2 = udp6_portaddr_hash ( net , & in6addr_any , hnum ) ; slot2 = hash2 & udptable -> mask ; hslot2 = & udptable -> hash2 [ slot2 ] ; if ( hslot -> count < hslot2 -> count ) goto begin ; result = udp6_lib_lookup2 ( net , saddr , sport , & in6addr_any , hnum , dif , hslot2 , slot2 ) ; } rcu_read_unlock ( ) ; return result ; } begin : result = NULL ; badness = - 1 ; sk_nulls_for_each_rcu ( sk , node , & hslot -> head ) { score = compute_score ( sk , net , hnum , saddr , sport , daddr , dport , dif ) ; if ( score > badness ) { result = sk ; badness = score ; } } if ( get_nulls_value ( node ) != slot ) goto begin ; if ( result ) { if ( unlikely ( ! atomic_inc_not_zero ( & result -> sk_refcnt ) ) ) result = NULL ; else if ( unlikely ( compute_score ( result , net , hnum , saddr , sport , daddr , dport , dif ) < badness ) ) { sock_put ( result ) ; goto begin ; } } rcu_read_unlock ( ) ; return result ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int zexec ( i_ctx_t * i_ctx_p ) { os_ptr op = osp ; int code ; check_op ( 1 ) ; code = check_for_exec ( op ) ; if ( code < 0 ) { return code ; } if ( ! r_has_attr ( op , a_executable ) ) { return 0 ; } check_estack ( 1 ) ; ++ esp ; ref_assign ( esp , op ) ; esfile_check_cache ( ) ; pop ( 1 ) ; return o_push_estack ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void qio_channel_websock_encode_buffer ( QIOChannelWebsock * ioc , Buffer * output , uint8_t opcode , Buffer * buffer ) { size_t header_size ; union { char buf [ QIO_CHANNEL_WEBSOCK_HEADER_LEN_64_BIT ] ; QIOChannelWebsockHeader ws ; } header ; header . ws . b0 = QIO_CHANNEL_WEBSOCK_HEADER_FIELD_FIN | ( opcode & QIO_CHANNEL_WEBSOCK_HEADER_FIELD_OPCODE ) ; if ( buffer -> offset < QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_THRESHOLD_7_BIT ) { header . ws . b1 = ( uint8_t ) buffer -> offset ; header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_7_BIT ; } else if ( buffer -> offset < QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_THRESHOLD_16_BIT ) { header . ws . b1 = QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_MAGIC_16_BIT ; header . ws . u . s16 . l16 = cpu_to_be16 ( ( uint16_t ) buffer -> offset ) ; header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_16_BIT ; } else { header . ws . b1 = QIO_CHANNEL_WEBSOCK_PAYLOAD_LEN_MAGIC_64_BIT ; header . ws . u . s64 . l64 = cpu_to_be64 ( buffer -> offset ) ; header_size = QIO_CHANNEL_WEBSOCK_HEADER_LEN_64_BIT ; } header_size -= QIO_CHANNEL_WEBSOCK_HEADER_LEN_MASK ; trace_qio_channel_websock_encode ( ioc , opcode , header_size , buffer -> offset ) ; buffer_reserve ( output , header_size + buffer -> offset ) ; buffer_append ( output , header . buf , header_size ) ; buffer_append ( output , buffer -> buffer , buffer -> offset ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static char * get_link_name ( const char * name , int count , int max_length ) { const char * format ; char * result ; int unshortened_length ; gboolean use_count ; g_assert ( name != NULL ) ; if ( count < 0 ) { g_warning ( "bad count in get_link_name" ) ; count = 0 ; } if ( count <= 2 ) { switch ( count ) { default : { g_assert_not_reached ( ) ; } case 0 : { format = "%s" ; } break ; case 1 : { format = _ ( "Link to %s" ) ; } break ; case 2 : { format = _ ( "Another link to %s" ) ; } break ; } use_count = FALSE ; } else { switch ( count % 10 ) { case 1 : { format = _ ( "%'dst link to %s" ) ; } break ; case 2 : { format = _ ( "%'dnd link to %s" ) ; } break ; case 3 : { format = _ ( "%'drd link to %s" ) ; } break ; default : { format = _ ( "%'dth link to %s" ) ; } break ; } use_count = TRUE ; } # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wformat-nonliteral" if ( use_count ) { result = g_strdup_printf ( format , count , name ) ; } else { result = g_strdup_printf ( format , name ) ; } if ( max_length > 0 && ( unshortened_length = strlen ( result ) ) > max_length ) { char * new_name ; new_name = shorten_utf8_string ( name , unshortened_length - max_length ) ; if ( new_name ) { g_free ( result ) ; if ( use_count ) { result = g_strdup_printf ( format , count , new_name ) ; } else { result = g_strdup_printf ( format , new_name ) ; } g_assert ( strlen ( result ) <= max_length ) ; g_free ( new_name ) ; } } # pragma GCC diagnostic pop return result ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
hb_bool_t hb_shape_plan_execute ( hb_shape_plan_t * shape_plan , hb_font_t * font , hb_buffer_t * buffer , const hb_feature_t * features , unsigned int num_features ) { DEBUG_MSG_FUNC ( SHAPE_PLAN , shape_plan , "num_features=%d shaper_func=%p" , num_features , shape_plan -> shaper_func ) ; if ( unlikely ( hb_object_is_inert ( shape_plan ) || hb_object_is_inert ( buffer ) ) ) return false ; assert ( shape_plan -> face_unsafe == font -> face ) ; assert ( hb_segment_properties_equal ( & shape_plan -> props , & buffer -> props ) ) ; # define HB_SHAPER_EXECUTE ( shaper ) HB_STMT_START { return HB_SHAPER_DATA ( shaper , shape_plan ) && hb_ ## shaper ## _shaper_font_data_ensure ( font ) && _hb_ ## shaper ## _shape ( shape_plan , font , buffer , features , num_features ) ; } HB_STMT_END if ( 0 ) ; # define HB_SHAPER_IMPLEMENT ( shaper ) else if ( shape_plan -> shaper_func == _hb_ ## shaper ## _shape ) HB_SHAPER_EXECUTE ( shaper ) ; # include "hb-shaper-list.hh" # undef HB_SHAPER_IMPLEMENT # undef HB_SHAPER_EXECUTE return false ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int qemuMonitorJSONGetGuestDriveAddress ( virJSONValuePtr reply , virDomainDeviceDriveAddress * driveAddr ) { virJSONValuePtr addr ; addr = virJSONValueObjectGet ( reply , "return" ) ; if ( ! addr || addr -> type != VIR_JSON_TYPE_OBJECT ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "drive_add reply was missing device address" ) ) ; return - 1 ; } if ( virJSONValueObjectGetNumberUint ( addr , "bus" , & driveAddr -> bus ) < 0 ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "drive_add reply was missing device bus number" ) ) ; return - 1 ; } if ( virJSONValueObjectGetNumberUint ( addr , "unit" , & driveAddr -> unit ) < 0 ) { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "drive_add reply was missing device unit number" ) ) ; return - 1 ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void convolve_avg_vert ( const uint8_t * src , ptrdiff_t src_stride , uint8_t * dst , ptrdiff_t dst_stride , const InterpKernel * y_filters , int y0_q4 , int y_step_q4 , int w , int h ) { int x , y ; src -= src_stride * ( SUBPEL_TAPS / 2 - 1 ) ; for ( x = 0 ; x < w ; ++ x ) { int y_q4 = y0_q4 ; for ( y = 0 ; y < h ; ++ y ) { const unsigned char * src_y = & src [ ( y_q4 >> SUBPEL_BITS ) * src_stride ] ; const int16_t * const y_filter = y_filters [ y_q4 & SUBPEL_MASK ] ; int k , sum = 0 ; for ( k = 0 ; k < SUBPEL_TAPS ; ++ k ) sum += src_y [ k * src_stride ] * y_filter [ k ] ; dst [ y * dst_stride ] = ROUND_POWER_OF_TWO ( dst [ y * dst_stride ] + clip_pixel ( ROUND_POWER_OF_TWO ( sum , FILTER_BITS ) ) , 1 ) ; y_q4 += y_step_q4 ; } ++ src ; ++ dst ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static my_bool get_view_structure ( char * table , char * db ) { MYSQL_RES * table_res ; MYSQL_ROW row ; MYSQL_FIELD * field ; char * result_table , * opt_quoted_table ; char table_buff [ NAME_LEN * 2 + 3 ] ; char table_buff2 [ NAME_LEN * 2 + 3 ] ; char query [ QUERY_LENGTH ] ; FILE * sql_file = md_result_file ; DBUG_ENTER ( "get_view_structure" ) ; if ( opt_no_create_info ) DBUG_RETURN ( 0 ) ; verbose_msg ( "-- Retrieving view structure for table %s...\n" , table ) ; # ifdef NOT_REALLY_USED_YET dynstr_append_checked ( & insert_pat , "SET SQL_QUOTE_SHOW_CREATE=" ) ; dynstr_append_checked ( & insert_pat , ( opt_quoted || opt_keywords ) ? "1" : "0" ) ; # endif result_table = quote_name ( table , table_buff , 1 ) ; opt_quoted_table = quote_name ( table , table_buff2 , 0 ) ; if ( switch_character_set_results ( mysql , "binary" ) ) DBUG_RETURN ( 1 ) ; my_snprintf ( query , sizeof ( query ) , "SHOW CREATE TABLE %s" , result_table ) ; if ( mysql_query_with_error_report ( mysql , & table_res , query ) ) { switch_character_set_results ( mysql , default_charset ) ; DBUG_RETURN ( 0 ) ; } field = mysql_fetch_field_direct ( table_res , 0 ) ; if ( strcmp ( field -> name , "View" ) != 0 ) { mysql_free_result ( table_res ) ; switch_character_set_results ( mysql , default_charset ) ; verbose_msg ( "-- It's base table, skipped\n" ) ; DBUG_RETURN ( 0 ) ; } if ( path ) { if ( ! ( sql_file = open_sql_file_for_table ( table , O_WRONLY ) ) ) { mysql_free_result ( table_res ) ; DBUG_RETURN ( 1 ) ; } write_header ( sql_file , db ) ; } print_comment ( sql_file , 0 , "\n--\n-- Final view structure for view %s\n--\n\n" , fix_for_comment ( result_table ) ) ; fprintf ( sql_file , "/*!50001 DROP TABLE IF EXISTS %s*/; \n" , opt_quoted_table ) ; if ( opt_drop ) { fprintf ( sql_file , "/*!50001 DROP VIEW IF EXISTS %s*/; \n" , opt_quoted_table ) ; check_io ( sql_file ) ; } my_snprintf ( query , sizeof ( query ) , "SELECT CHECK_OPTION, DEFINER, SECURITY_TYPE, " " CHARACTER_SET_CLIENT, COLLATION_CONNECTION " "FROM information_schema.views " "WHERE table_name=\"%s\" AND table_schema=\"%s\"" , table , db ) ; if ( mysql_query ( mysql , query ) ) { row = mysql_fetch_row ( table_res ) ; fprintf ( sql_file , "/*!50001 %s */; \n" , row [ 1 ] ) ; check_io ( sql_file ) ; mysql_free_result ( table_res ) ; } else { char * ptr ; ulong * lengths ; char search_buf [ 256 ] , replace_buf [ 256 ] ; ulong search_len , replace_len ; DYNAMIC_STRING ds_view ; row = mysql_fetch_row ( table_res ) ; lengths = mysql_fetch_lengths ( table_res ) ; init_dynamic_string_checked ( & ds_view , row [ 1 ] , lengths [ 1 ] + 1 , 1024 ) ; mysql_free_result ( table_res ) ; if ( ! ( table_res = mysql_store_result ( mysql ) ) || ! ( row = mysql_fetch_row ( table_res ) ) ) { if ( table_res ) mysql_free_result ( table_res ) ; dynstr_free ( & ds_view ) ; DB_error ( mysql , "when trying to save the result of SHOW CREATE TABLE in ds_view." ) ; DBUG_RETURN ( 1 ) ; } lengths = mysql_fetch_lengths ( table_res ) ; if ( strcmp ( row [ 0 ] , "NONE" ) ) { ptr = search_buf ; search_len = ( ulong ) ( strxmov ( ptr , "WITH " , row [ 0 ] , " CHECK OPTION" , NullS ) - ptr ) ; ptr = replace_buf ; replace_len = ( ulong ) ( strxmov ( ptr , "*/\n/*!50002 WITH " , row [ 0 ] , " CHECK OPTION" , NullS ) - ptr ) ; replace ( & ds_view , search_buf , search_len , replace_buf , replace_len ) ; } { size_t user_name_len ; char user_name_str [ USERNAME_LENGTH + 1 ] ; char quoted_user_name_str [ USERNAME_LENGTH * 2 + 3 ] ; size_t host_name_len ; char host_name_str [ HOSTNAME_LENGTH + 1 ] ; char quoted_host_name_str [ HOSTNAME_LENGTH * 2 + 3 ] ; parse_user ( row [ 1 ] , lengths [ 1 ] , user_name_str , & user_name_len , host_name_str , & host_name_len ) ; ptr = search_buf ; search_len = ( ulong ) ( strxmov ( ptr , "DEFINER=" , quote_name ( user_name_str , quoted_user_name_str , FALSE ) , "@" , quote_name ( host_name_str , quoted_host_name_str , FALSE ) , " SQL SECURITY " , row [ 2 ] , NullS ) - ptr ) ; ptr = replace_buf ; replace_len = ( ulong ) ( strxmov ( ptr , "*/\n/*!50013 DEFINER=" , quote_name ( user_name_str , quoted_user_name_str , FALSE ) , "@" , quote_name ( host_name_str , quoted_host_name_str , FALSE ) , " SQL SECURITY " , row [ 2 ] , " */\n/*!50001" , NullS ) - ptr ) ; replace ( & ds_view , search_buf , search_len , replace_buf , replace_len ) ; } fprintf ( sql_file , "/*!50001 SET @saved_cs_client = @@character_set_client */; \n" "/*!50001 SET @saved_cs_results = @@character_set_results */; \n" "/*!50001 SET @saved_col_connection = @@collation_connection */; \n" "/*!50001 SET character_set_client = %s */; \n" "/*!50001 SET character_set_results = %s */; \n" "/*!50001 SET collation_connection = %s */; \n" "/*!50001 %s */; \n" "/*!50001 SET character_set_client = @saved_cs_client */; \n" "/*!50001 SET character_set_results = @saved_cs_results */; \n" "/*!50001 SET collation_connection = @saved_col_connection */; \n" , ( const char * ) row [ 3 ] , ( const char * ) row [ 3 ] , ( const char * ) row [ 4 ] , ( const char * ) ds_view . str ) ; check_io ( sql_file ) ; mysql_free_result ( table_res ) ; dynstr_free ( & ds_view ) ; } if ( switch_character_set_results ( mysql , default_charset ) ) DBUG_RETURN ( 1 ) ; if ( sql_file != md_result_file ) { fputs ( "\n" , sql_file ) ; write_footer ( sql_file ) ; my_fclose ( sql_file , MYF ( MY_WME ) ) ; } DBUG_RETURN ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorTextAddUSBDeviceMatch ( qemuMonitorPtr mon , int vendor , int product ) { int ret ; char * addr ; if ( virAsprintf ( & addr , "host:%.4x:%.4x" , vendor , product ) < 0 ) { virReportOOMError ( ) ; return - 1 ; } ret = qemuMonitorTextAddUSBDevice ( mon , addr ) ; VIR_FREE ( addr ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline int bitmap_position_packfile ( const unsigned char * sha1 ) { off_t offset = find_pack_entry_one ( sha1 , bitmap_git . pack ) ; if ( ! offset ) return - 1 ; return find_revindex_position ( bitmap_git . pack , offset ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void * _conf_to_memberp ( TSOverridableConfigKey conf , OverridableHttpConfigParams * overridableHttpConfig , OverridableDataType * typep ) { OverridableDataType typ = OVERRIDABLE_TYPE_BYTE ; void * ret = nullptr ; switch ( conf ) { case TS_CONFIG_URL_REMAP_PRISTINE_HOST_HDR : ret = & overridableHttpConfig -> maintain_pristine_host_hdr ; break ; case TS_CONFIG_HTTP_CHUNKING_ENABLED : ret = & overridableHttpConfig -> chunking_enabled ; break ; case TS_CONFIG_HTTP_NEGATIVE_CACHING_ENABLED : ret = & overridableHttpConfig -> negative_caching_enabled ; break ; case TS_CONFIG_HTTP_NEGATIVE_CACHING_LIFETIME : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> negative_caching_lifetime ; break ; case TS_CONFIG_HTTP_CACHE_WHEN_TO_REVALIDATE : ret = & overridableHttpConfig -> cache_when_to_revalidate ; break ; case TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_IN : ret = & overridableHttpConfig -> keep_alive_enabled_in ; break ; case TS_CONFIG_HTTP_KEEP_ALIVE_ENABLED_OUT : ret = & overridableHttpConfig -> keep_alive_enabled_out ; break ; case TS_CONFIG_HTTP_KEEP_ALIVE_POST_OUT : ret = & overridableHttpConfig -> keep_alive_post_out ; break ; case TS_CONFIG_HTTP_SERVER_SESSION_SHARING_MATCH : ret = & overridableHttpConfig -> server_session_sharing_match ; break ; case TS_CONFIG_NET_SOCK_RECV_BUFFER_SIZE_OUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> sock_recv_buffer_size_out ; break ; case TS_CONFIG_NET_SOCK_SEND_BUFFER_SIZE_OUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> sock_send_buffer_size_out ; break ; case TS_CONFIG_NET_SOCK_OPTION_FLAG_OUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> sock_option_flag_out ; break ; case TS_CONFIG_HTTP_FORWARD_PROXY_AUTH_TO_PARENT : ret = & overridableHttpConfig -> fwd_proxy_auth_to_parent ; break ; case TS_CONFIG_HTTP_ANONYMIZE_REMOVE_FROM : ret = & overridableHttpConfig -> anonymize_remove_from ; break ; case TS_CONFIG_HTTP_ANONYMIZE_REMOVE_REFERER : ret = & overridableHttpConfig -> anonymize_remove_referer ; break ; case TS_CONFIG_HTTP_ANONYMIZE_REMOVE_USER_AGENT : ret = & overridableHttpConfig -> anonymize_remove_user_agent ; break ; case TS_CONFIG_HTTP_ANONYMIZE_REMOVE_COOKIE : ret = & overridableHttpConfig -> anonymize_remove_cookie ; break ; case TS_CONFIG_HTTP_ANONYMIZE_REMOVE_CLIENT_IP : ret = & overridableHttpConfig -> anonymize_remove_client_ip ; break ; case TS_CONFIG_HTTP_ANONYMIZE_INSERT_CLIENT_IP : ret = & overridableHttpConfig -> anonymize_insert_client_ip ; break ; case TS_CONFIG_HTTP_RESPONSE_SERVER_ENABLED : ret = & overridableHttpConfig -> proxy_response_server_enabled ; break ; case TS_CONFIG_HTTP_INSERT_SQUID_X_FORWARDED_FOR : ret = & overridableHttpConfig -> insert_squid_x_forwarded_for ; break ; case TS_CONFIG_HTTP_SERVER_TCP_INIT_CWND : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> server_tcp_init_cwnd ; break ; case TS_CONFIG_HTTP_SEND_HTTP11_REQUESTS : ret = & overridableHttpConfig -> send_http11_requests ; break ; case TS_CONFIG_HTTP_CACHE_HTTP : ret = & overridableHttpConfig -> cache_http ; break ; case TS_CONFIG_HTTP_CACHE_CLUSTER_CACHE_LOCAL : ret = & overridableHttpConfig -> cache_cluster_cache_local ; break ; case TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_NO_CACHE : ret = & overridableHttpConfig -> cache_ignore_client_no_cache ; break ; case TS_CONFIG_HTTP_CACHE_IGNORE_CLIENT_CC_MAX_AGE : ret = & overridableHttpConfig -> cache_ignore_client_cc_max_age ; break ; case TS_CONFIG_HTTP_CACHE_IMS_ON_CLIENT_NO_CACHE : ret = & overridableHttpConfig -> cache_ims_on_client_no_cache ; break ; case TS_CONFIG_HTTP_CACHE_IGNORE_SERVER_NO_CACHE : ret = & overridableHttpConfig -> cache_ignore_server_no_cache ; break ; case TS_CONFIG_HTTP_CACHE_CACHE_RESPONSES_TO_COOKIES : ret = & overridableHttpConfig -> cache_responses_to_cookies ; break ; case TS_CONFIG_HTTP_CACHE_IGNORE_AUTHENTICATION : ret = & overridableHttpConfig -> cache_ignore_auth ; break ; case TS_CONFIG_HTTP_CACHE_CACHE_URLS_THAT_LOOK_DYNAMIC : ret = & overridableHttpConfig -> cache_urls_that_look_dynamic ; break ; case TS_CONFIG_HTTP_CACHE_REQUIRED_HEADERS : ret = & overridableHttpConfig -> cache_required_headers ; break ; case TS_CONFIG_HTTP_INSERT_REQUEST_VIA_STR : ret = & overridableHttpConfig -> insert_request_via_string ; break ; case TS_CONFIG_HTTP_INSERT_RESPONSE_VIA_STR : ret = & overridableHttpConfig -> insert_response_via_string ; break ; case TS_CONFIG_HTTP_CACHE_HEURISTIC_MIN_LIFETIME : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> cache_heuristic_min_lifetime ; break ; case TS_CONFIG_HTTP_CACHE_HEURISTIC_MAX_LIFETIME : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> cache_heuristic_max_lifetime ; break ; case TS_CONFIG_HTTP_CACHE_GUARANTEED_MIN_LIFETIME : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> cache_guaranteed_min_lifetime ; break ; case TS_CONFIG_HTTP_CACHE_GUARANTEED_MAX_LIFETIME : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> cache_guaranteed_max_lifetime ; break ; case TS_CONFIG_HTTP_CACHE_MAX_STALE_AGE : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> cache_max_stale_age ; break ; case TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_IN : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> keep_alive_no_activity_timeout_in ; break ; case TS_CONFIG_HTTP_KEEP_ALIVE_NO_ACTIVITY_TIMEOUT_OUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> keep_alive_no_activity_timeout_out ; break ; case TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_IN : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> transaction_no_activity_timeout_in ; break ; case TS_CONFIG_HTTP_TRANSACTION_NO_ACTIVITY_TIMEOUT_OUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> transaction_no_activity_timeout_out ; break ; case TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_OUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> transaction_active_timeout_out ; break ; case TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> origin_max_connections ; break ; case TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> connect_attempts_max_retries ; break ; case TS_CONFIG_HTTP_CONNECT_ATTEMPTS_MAX_RETRIES_DEAD_SERVER : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> connect_attempts_max_retries_dead_server ; break ; case TS_CONFIG_HTTP_CONNECT_ATTEMPTS_RR_RETRIES : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> connect_attempts_rr_retries ; break ; case TS_CONFIG_HTTP_CONNECT_ATTEMPTS_TIMEOUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> connect_attempts_timeout ; break ; case TS_CONFIG_HTTP_POST_CONNECT_ATTEMPTS_TIMEOUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> post_connect_attempts_timeout ; break ; case TS_CONFIG_HTTP_DOWN_SERVER_CACHE_TIME : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> down_server_timeout ; break ; case TS_CONFIG_HTTP_DOWN_SERVER_ABORT_THRESHOLD : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> client_abort_threshold ; break ; case TS_CONFIG_HTTP_CACHE_FUZZ_TIME : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> freshness_fuzz_time ; break ; case TS_CONFIG_HTTP_CACHE_FUZZ_MIN_TIME : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> freshness_fuzz_min_time ; break ; case TS_CONFIG_HTTP_DOC_IN_CACHE_SKIP_DNS : ret = & overridableHttpConfig -> doc_in_cache_skip_dns ; break ; case TS_CONFIG_HTTP_BACKGROUND_FILL_ACTIVE_TIMEOUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> background_fill_active_timeout ; break ; case TS_CONFIG_HTTP_RESPONSE_SERVER_STR : typ = OVERRIDABLE_TYPE_STRING ; ret = & overridableHttpConfig -> proxy_response_server_string ; break ; case TS_CONFIG_HTTP_CACHE_HEURISTIC_LM_FACTOR : typ = OVERRIDABLE_TYPE_FLOAT ; ret = & overridableHttpConfig -> cache_heuristic_lm_factor ; break ; case TS_CONFIG_HTTP_CACHE_FUZZ_PROBABILITY : typ = OVERRIDABLE_TYPE_FLOAT ; ret = & overridableHttpConfig -> freshness_fuzz_prob ; break ; case TS_CONFIG_HTTP_BACKGROUND_FILL_COMPLETED_THRESHOLD : typ = OVERRIDABLE_TYPE_FLOAT ; ret = & overridableHttpConfig -> background_fill_threshold ; break ; case TS_CONFIG_NET_SOCK_PACKET_MARK_OUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> sock_packet_mark_out ; break ; case TS_CONFIG_NET_SOCK_PACKET_TOS_OUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> sock_packet_tos_out ; break ; case TS_CONFIG_HTTP_INSERT_AGE_IN_RESPONSE : ret = & overridableHttpConfig -> insert_age_in_response ; break ; case TS_CONFIG_HTTP_CHUNKING_SIZE : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> http_chunking_size ; break ; case TS_CONFIG_HTTP_FLOW_CONTROL_ENABLED : ret = & overridableHttpConfig -> flow_control_enabled ; break ; case TS_CONFIG_HTTP_FLOW_CONTROL_LOW_WATER_MARK : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> flow_low_water_mark ; break ; case TS_CONFIG_HTTP_FLOW_CONTROL_HIGH_WATER_MARK : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> flow_high_water_mark ; break ; case TS_CONFIG_HTTP_CACHE_RANGE_LOOKUP : ret = & overridableHttpConfig -> cache_range_lookup ; break ; case TS_CONFIG_HTTP_NORMALIZE_AE_GZIP : ret = & overridableHttpConfig -> normalize_ae_gzip ; break ; case TS_CONFIG_HTTP_DEFAULT_BUFFER_SIZE : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> default_buffer_size_index ; break ; case TS_CONFIG_HTTP_DEFAULT_BUFFER_WATER_MARK : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> default_buffer_water_mark ; break ; case TS_CONFIG_HTTP_REQUEST_HEADER_MAX_SIZE : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> request_hdr_max_size ; break ; case TS_CONFIG_HTTP_RESPONSE_HEADER_MAX_SIZE : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> response_hdr_max_size ; break ; case TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_ENABLED : ret = & overridableHttpConfig -> negative_revalidating_enabled ; break ; case TS_CONFIG_HTTP_NEGATIVE_REVALIDATING_LIFETIME : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> negative_revalidating_lifetime ; break ; case TS_CONFIG_SSL_HSTS_MAX_AGE : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> proxy_response_hsts_max_age ; break ; case TS_CONFIG_SSL_HSTS_INCLUDE_SUBDOMAINS : ret = & overridableHttpConfig -> proxy_response_hsts_include_subdomains ; break ; case TS_CONFIG_HTTP_CACHE_OPEN_READ_RETRY_TIME : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> cache_open_read_retry_time ; break ; case TS_CONFIG_HTTP_CACHE_MAX_OPEN_READ_RETRIES : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> max_cache_open_read_retries ; break ; case TS_CONFIG_HTTP_CACHE_RANGE_WRITE : ret = & overridableHttpConfig -> cache_range_write ; break ; case TS_CONFIG_HTTP_POST_CHECK_CONTENT_LENGTH_ENABLED : ret = & overridableHttpConfig -> post_check_content_length_enabled ; break ; case TS_CONFIG_HTTP_GLOBAL_USER_AGENT_HEADER : typ = OVERRIDABLE_TYPE_STRING ; ret = & overridableHttpConfig -> global_user_agent_header ; break ; case TS_CONFIG_HTTP_AUTH_SERVER_SESSION_PRIVATE : ret = & overridableHttpConfig -> auth_server_session_private ; break ; case TS_CONFIG_HTTP_SLOW_LOG_THRESHOLD : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> slow_log_threshold ; break ; case TS_CONFIG_HTTP_CACHE_GENERATION : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> cache_generation_number ; break ; case TS_CONFIG_BODY_FACTORY_TEMPLATE_BASE : typ = OVERRIDABLE_TYPE_STRING ; ret = & overridableHttpConfig -> body_factory_template_base ; break ; case TS_CONFIG_HTTP_CACHE_OPEN_WRITE_FAIL_ACTION : ret = & overridableHttpConfig -> cache_open_write_fail_action ; break ; case TS_CONFIG_HTTP_ENABLE_REDIRECTION : ret = & overridableHttpConfig -> redirection_enabled ; break ; case TS_CONFIG_HTTP_NUMBER_OF_REDIRECTIONS : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> number_of_redirections ; break ; case TS_CONFIG_HTTP_CACHE_MAX_OPEN_WRITE_RETRIES : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> max_cache_open_write_retries ; break ; case TS_CONFIG_HTTP_REDIRECT_USE_ORIG_CACHE_KEY : ret = & overridableHttpConfig -> redirect_use_orig_cache_key ; break ; case TS_CONFIG_HTTP_ATTACH_SERVER_SESSION_TO_CLIENT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> attach_server_session_to_client ; break ; case TS_CONFIG_HTTP_SAFE_REQUESTS_RETRYABLE : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> safe_requests_retryable ; break ; case TS_CONFIG_HTTP_ORIGIN_MAX_CONNECTIONS_QUEUE : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> origin_max_connections_queue ; break ; case TS_CONFIG_WEBSOCKET_NO_ACTIVITY_TIMEOUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> websocket_inactive_timeout ; break ; case TS_CONFIG_WEBSOCKET_ACTIVE_TIMEOUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> websocket_active_timeout ; break ; case TS_CONFIG_HTTP_UNCACHEABLE_REQUESTS_BYPASS_PARENT : ret = & overridableHttpConfig -> uncacheable_requests_bypass_parent ; break ; case TS_CONFIG_HTTP_PARENT_PROXY_TOTAL_CONNECT_ATTEMPTS : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> parent_connect_attempts ; break ; case TS_CONFIG_HTTP_TRANSACTION_ACTIVE_TIMEOUT_IN : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> transaction_active_timeout_in ; break ; case TS_CONFIG_SRV_ENABLED : ret = & overridableHttpConfig -> srv_enabled ; break ; case TS_CONFIG_HTTP_FORWARD_CONNECT_METHOD : ret = & overridableHttpConfig -> forward_connect_method ; break ; case TS_CONFIG_SSL_CERT_FILENAME : typ = OVERRIDABLE_TYPE_STRING ; ret = & overridableHttpConfig -> client_cert_filename ; break ; case TS_CONFIG_SSL_CERT_FILEPATH : typ = OVERRIDABLE_TYPE_STRING ; ret = & overridableHttpConfig -> client_cert_filepath ; break ; case TS_CONFIG_PARENT_FAILURES_UPDATE_HOSTDB : ret = & overridableHttpConfig -> parent_failures_update_hostdb ; break ; case TS_CONFIG_SSL_CLIENT_VERIFY_SERVER : ret = & overridableHttpConfig -> ssl_client_verify_server ; break ; case TS_CONFIG_HTTP_PARENT_PROXY_FAIL_THRESHOLD : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> parent_fail_threshold ; break ; case TS_CONFIG_HTTP_PARENT_PROXY_RETRY_TIME : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> parent_retry_time ; break ; case TS_CONFIG_HTTP_PER_PARENT_CONNECT_ATTEMPTS : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> per_parent_connect_attempts ; break ; case TS_CONFIG_HTTP_PARENT_CONNECT_ATTEMPT_TIMEOUT : typ = OVERRIDABLE_TYPE_INT ; ret = & overridableHttpConfig -> parent_connect_timeout ; break ; case TS_CONFIG_NULL : case TS_CONFIG_LAST_ENTRY : typ = OVERRIDABLE_TYPE_NULL ; ret = nullptr ; break ; } * typep = typ ; return ret ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static VALUE mBignum_to_json ( int argc , VALUE * argv , VALUE self ) { GENERATE_JSON ( bignum ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void appendStringLiteralConn ( PQExpBuffer buf , const char * str , PGconn * conn ) { size_t length = strlen ( str ) ; if ( strchr ( str , '\\' ) != NULL && PQserverVersion ( conn ) >= 80100 ) { if ( buf -> len > 0 && buf -> data [ buf -> len - 1 ] != ' ' ) appendPQExpBufferChar ( buf , ' ' ) ; appendPQExpBufferChar ( buf , ESCAPE_STRING_SYNTAX ) ; appendStringLiteral ( buf , str , PQclientEncoding ( conn ) , false ) ; return ; } if ( ! enlargePQExpBuffer ( buf , 2 * length + 2 ) ) return ; appendPQExpBufferChar ( buf , '\'' ) ; buf -> len += PQescapeStringConn ( conn , buf -> data + buf -> len , str , length , NULL ) ; appendPQExpBufferChar ( buf , '\'' ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void * Type_UcrBg_Dup ( struct _cms_typehandler_struct * self , const void * Ptr , cmsUInt32Number n ) { cmsUcrBg * Src = ( cmsUcrBg * ) Ptr ; cmsUcrBg * NewUcrBg = ( cmsUcrBg * ) _cmsMallocZero ( self -> ContextID , sizeof ( cmsUcrBg ) ) ; if ( NewUcrBg == NULL ) return NULL ; NewUcrBg -> Bg = cmsDupToneCurve ( Src -> Bg ) ; NewUcrBg -> Ucr = cmsDupToneCurve ( Src -> Ucr ) ; NewUcrBg -> Desc = cmsMLUdup ( Src -> Desc ) ; return ( void * ) NewUcrBg ; cmsUNUSED_PARAMETER ( n ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int is_single_file ( const char * outfile_pattern ) { const char * p = outfile_pattern ; do { p = strchr ( p , '%' ) ; if ( p && p [ 1 ] >= '1' && p [ 1 ] <= '9' ) return 0 ; if ( p ) p ++ ; } while ( p ) ; return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_T_reason ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_T_reason , T_reason_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int write_command_to_file ( char * cmd ) { char * buffer ; char * ip_address ; int dummy ; char * p ; FILE * fp ; struct stat statbuf ; char error_string [ MAX_INPUT_BUFFER ] ; if ( ! cmd || ! * cmd || strchr ( cmd , '\n' ) ) return ERROR ; if ( stat ( command_file , & statbuf ) ) { snprintf ( error_string , sizeof ( error_string ) , "Error: Could not stat() command file '%s'!" , command_file ) ; error_string [ sizeof ( error_string ) - 1 ] = '\x0' ; print_generic_error_message ( error_string , "The external command file may be missing, Icinga may not be running, and/or Icinga may not be checking external commands." , 2 ) ; return ERROR ; } fp = fopen ( command_file , "w" ) ; if ( fp == NULL ) { snprintf ( error_string , sizeof ( error_string ) , "Error: Could not open command file '%s' for update!" , command_file ) ; error_string [ sizeof ( error_string ) - 1 ] = '\x0' ; print_generic_error_message ( error_string , "The permissions on the external command file and/or directory may be incorrect. Read the FAQs on how to setup proper permissions." , 2 ) ; return ERROR ; } if ( use_logging == TRUE ) { p = strchr ( cmd , ']' ) ; if ( p != NULL ) p += 2 ; else p = & cmd [ 0 ] ; ip_address = strdup ( getenv ( "REMOTE_ADDR" ) ) ; dummy = asprintf ( & buffer , "EXTERNAL COMMAND: %s; %s; %s" , current_authdata . username , ( ip_address != NULL ) ? ip_address : "unknown remote address" , p ) ; write_to_cgi_log ( buffer ) ; if ( enforce_comments_on_actions == TRUE ) { my_free ( buffer ) ; dummy = asprintf ( & buffer , "FORCED COMMENT: %s; %s; %s; %s" , current_authdata . username , ( ip_address != NULL ) ? ip_address : "unknown remote address" , comment_author , comment_data ) ; write_to_cgi_log ( buffer ) ; } my_free ( buffer ) ; } fprintf ( fp , "%s\n" , cmd ) ; fflush ( fp ) ; fclose ( fp ) ; return OK ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int answer_from_qmem ( int dns_fd , struct query * q , unsigned char * qmem_cmc , unsigned short * qmem_type , int qmem_len , unsigned char * cmc_to_check ) { int i ; for ( i = 0 ; i < qmem_len ; i ++ ) { if ( qmem_type [ i ] == T_UNSET ) continue ; if ( qmem_type [ i ] != q -> type ) continue ; if ( memcmp ( qmem_cmc + i * 4 , cmc_to_check , 4 ) ) continue ; if ( debug >= 1 ) fprintf ( stderr , "OUT from qmem for %s == duplicate, sending illegal reply\n" , q -> name ) ; write_dns ( dns_fd , q , "x" , 1 , 'T' ) ; q -> id = 0 ; return 1 ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int decode_seq_header ( AVSContext * h ) { int frame_rate_code ; int width , height ; h -> profile = get_bits ( & h -> gb , 8 ) ; h -> level = get_bits ( & h -> gb , 8 ) ; skip_bits1 ( & h -> gb ) ; width = get_bits ( & h -> gb , 14 ) ; height = get_bits ( & h -> gb , 14 ) ; if ( ( h -> width || h -> height ) && ( h -> width != width || h -> height != height ) ) { av_log_missing_feature ( h -> avctx , "Width/height changing in CAVS" , 0 ) ; return AVERROR_PATCHWELCOME ; } h -> width = width ; h -> height = height ; skip_bits ( & h -> gb , 2 ) ; skip_bits ( & h -> gb , 3 ) ; h -> aspect_ratio = get_bits ( & h -> gb , 4 ) ; frame_rate_code = get_bits ( & h -> gb , 4 ) ; skip_bits ( & h -> gb , 18 ) ; skip_bits1 ( & h -> gb ) ; skip_bits ( & h -> gb , 12 ) ; h -> low_delay = get_bits1 ( & h -> gb ) ; h -> mb_width = ( h -> width + 15 ) >> 4 ; h -> mb_height = ( h -> height + 15 ) >> 4 ; h -> avctx -> time_base . den = ff_mpeg12_frame_rate_tab [ frame_rate_code ] . num ; h -> avctx -> time_base . num = ff_mpeg12_frame_rate_tab [ frame_rate_code ] . den ; h -> avctx -> width = h -> width ; h -> avctx -> height = h -> height ; if ( ! h -> top_qp ) ff_cavs_init_top_lines ( h ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void directory_count_state_free ( DirectoryCountState * state ) { if ( state -> enumerator ) { if ( ! g_file_enumerator_is_closed ( state -> enumerator ) ) { g_file_enumerator_close_async ( state -> enumerator , 0 , NULL , NULL , NULL ) ; } g_object_unref ( state -> enumerator ) ; } g_object_unref ( state -> cancellable ) ; nautilus_directory_unref ( state -> directory ) ; g_free ( state ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_P ( BrowserCloseManagerBrowserTest , TestAddTabWithBeforeUnloadDuringShutdown ) { browsers_ . push_back ( CreateBrowser ( browser ( ) -> profile ( ) ) ) ; ASSERT_NO_FATAL_FAILURE ( ui_test_utils : : NavigateToURL ( browsers_ [ 0 ] , embedded_test_server ( ) -> GetURL ( "/beforeunload.html" ) ) ) ; ASSERT_NO_FATAL_FAILURE ( ui_test_utils : : NavigateToURL ( browsers_ [ 1 ] , embedded_test_server ( ) -> GetURL ( "/beforeunload.html" ) ) ) ; PrepareForDialog ( browsers_ [ 0 ] ) ; PrepareForDialog ( browsers_ [ 1 ] ) ; RepeatedNotificationObserver cancel_observer ( chrome : : NOTIFICATION_BROWSER_CLOSE_CANCELLED , 2 ) ; chrome : : CloseAllBrowsersAndQuit ( ) ; ASSERT_NO_FATAL_FAILURE ( AcceptClose ( ) ) ; AddBlankTabAndShow ( browsers_ [ 0 ] ) ; ASSERT_NO_FATAL_FAILURE ( ui_test_utils : : NavigateToURL ( browsers_ [ 0 ] , embedded_test_server ( ) -> GetURL ( "/beforeunload.html" ) ) ) ; AddBlankTabAndShow ( browsers_ [ 1 ] ) ; ASSERT_NO_FATAL_FAILURE ( ui_test_utils : : NavigateToURL ( browsers_ [ 1 ] , embedded_test_server ( ) -> GetURL ( "/beforeunload.html" ) ) ) ; PrepareForDialog ( browsers_ [ 0 ] ) ; PrepareForDialog ( browsers_ [ 1 ] ) ; ASSERT_NO_FATAL_FAILURE ( AcceptClose ( ) ) ; ASSERT_NO_FATAL_FAILURE ( CancelClose ( ) ) ; cancel_observer . Wait ( ) ; EXPECT_FALSE ( browser_shutdown : : IsTryingToQuit ( ) ) ; EXPECT_EQ ( 2 , browsers_ [ 0 ] -> tab_strip_model ( ) -> count ( ) ) ; EXPECT_EQ ( 2 , browsers_ [ 1 ] -> tab_strip_model ( ) -> count ( ) ) ; RepeatedNotificationObserver close_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , 2 ) ; chrome : : CloseAllBrowsersAndQuit ( ) ; ASSERT_NO_FATAL_FAILURE ( AcceptClose ( ) ) ; ASSERT_NO_FATAL_FAILURE ( AcceptClose ( ) ) ; ASSERT_NO_FATAL_FAILURE ( AcceptClose ( ) ) ; 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 guint16 de_conn_num ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo , guint32 offset , guint len , gchar * add_string , int string_len ) { const gchar * extr_addr ; de_bcd_num ( tvb , tree , pinfo , offset , len , hf_gsm_a_dtap_conn_num , & extr_addr ) ; if ( extr_addr && add_string ) g_snprintf ( add_string , string_len , " - (%s)" , extr_addr ) ; return ( len ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int prepare_search ( KEYRING_HANDLE hd ) { if ( hd -> current . error ) { if ( gpg_err_code ( hd -> current . error ) == GPG_ERR_LEGACY_KEY ) hd -> current . error = 0 ; else return hd -> current . error ; } if ( hd -> current . kr && ! hd -> current . eof ) { if ( ! hd -> current . iobuf ) return GPG_ERR_GENERAL ; return 0 ; } if ( ! hd -> current . kr && hd -> current . eof ) return - 1 ; if ( ! hd -> current . kr ) { hd -> current . kr = hd -> resource ; if ( ! hd -> current . kr ) { hd -> current . eof = 1 ; return - 1 ; } assert ( ! hd -> current . iobuf ) ; } else { iobuf_close ( hd -> current . iobuf ) ; hd -> current . iobuf = NULL ; hd -> current . kr = NULL ; hd -> current . eof = 1 ; return - 1 ; } hd -> current . eof = 0 ; hd -> current . iobuf = iobuf_open ( hd -> current . kr -> fname ) ; if ( ! hd -> current . iobuf ) { hd -> current . error = gpg_error_from_syserror ( ) ; log_error ( _ ( "can't open '%s'\n" ) , hd -> current . kr -> fname ) ; return hd -> current . error ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void cmd_server_connect ( const char * data ) { GHashTable * optlist ; char * addr ; void * free_arg ; if ( ! cmd_get_params ( data , & free_arg , 1 | PARAM_FLAG_OPTIONS , "connect" , & optlist , & addr ) ) return ; if ( * addr == '\0' || g_strcmp0 ( addr , "+" ) == 0 ) cmd_param_error ( CMDERR_NOT_ENOUGH_PARAMS ) ; if ( * addr == '+' ) window_create ( NULL , FALSE ) ; cmd_params_free ( free_arg ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void cmd_network ( const char * data , SERVER_REC * server , WI_ITEM_REC * item ) { if ( * data == '\0' ) cmd_network_list ( ) ; else command_runsub ( "network" , data , server , item ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void mem_swap_byte_rect ( byte * base , uint raster , int x , int w , int h , bool store ) { int xbit = x & 31 ; if ( store ) { if ( xbit + w > 64 ) { if ( xbit != 0 ) mem_swap_byte_rect ( base , raster , x , 1 , h , false ) ; x += w - 1 ; xbit = x & 31 ; if ( xbit == 31 ) return ; w = 1 ; } } { byte * row = base + ( ( x >> 5 ) << 2 ) ; int nw = ( xbit + w + 31 ) >> 5 ; int ny ; for ( ny = h ; ny > 0 ; row += raster , -- ny ) { int nx = nw ; bits32 * pw = ( bits32 * ) row ; do { bits32 w = * pw ; * pw ++ = ( w >> 24 ) + ( ( w >> 8 ) & 0xff00 ) + ( ( w & 0xff00 ) << 8 ) + ( w << 24 ) ; } while ( -- nx ) ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void virtio_balloon_handle_output ( VirtIODevice * vdev , VirtQueue * vq ) { VirtIOBalloon * s = to_virtio_balloon ( vdev ) ; VirtQueueElement elem ; MemoryRegionSection section ; while ( virtqueue_pop ( vq , & elem ) ) { size_t offset = 0 ; uint32_t pfn ; while ( iov_to_buf ( elem . out_sg , elem . out_num , offset , & pfn , 4 ) == 4 ) { ram_addr_t pa ; ram_addr_t addr ; pa = ( ram_addr_t ) ldl_p ( & pfn ) << VIRTIO_BALLOON_PFN_SHIFT ; offset += 4 ; section = memory_region_find ( get_system_memory ( ) , pa , 1 ) ; if ( ! section . size || ! memory_region_is_ram ( section . mr ) ) continue ; addr = section . offset_within_region ; balloon_page ( memory_region_get_ram_ptr ( section . mr ) + addr , ! ! ( vq == s -> dvq ) ) ; } virtqueue_push ( vq , & elem , offset ) ; virtio_notify ( vdev , vq ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vp9_rd_pick_intra_mode_sb ( VP9_COMP * cpi , MACROBLOCK * x , int * returnrate , int64_t * returndist , BLOCK_SIZE bsize , PICK_MODE_CONTEXT * ctx , int64_t best_rd ) { VP9_COMMON * const cm = & cpi -> common ; MACROBLOCKD * const xd = & x -> e_mbd ; struct macroblockd_plane * const pd = xd -> plane ; int rate_y = 0 , rate_uv = 0 , rate_y_tokenonly = 0 , rate_uv_tokenonly = 0 ; int y_skip = 0 , uv_skip = 0 ; int64_t dist_y = 0 , dist_uv = 0 , tx_cache [ TX_MODES ] = { 0 } ; TX_SIZE max_uv_tx_size ; x -> skip_encode = 0 ; ctx -> skip = 0 ; xd -> mi [ 0 ] -> mbmi . ref_frame [ 0 ] = INTRA_FRAME ; if ( bsize >= BLOCK_8X8 ) { if ( rd_pick_intra_sby_mode ( cpi , x , & rate_y , & rate_y_tokenonly , & dist_y , & y_skip , bsize , tx_cache , best_rd ) >= best_rd ) { * returnrate = INT_MAX ; return ; } max_uv_tx_size = get_uv_tx_size_impl ( xd -> mi [ 0 ] -> mbmi . tx_size , bsize , pd [ 1 ] . subsampling_x , pd [ 1 ] . subsampling_y ) ; rd_pick_intra_sbuv_mode ( cpi , x , ctx , & rate_uv , & rate_uv_tokenonly , & dist_uv , & uv_skip , bsize , max_uv_tx_size ) ; } else { y_skip = 0 ; if ( rd_pick_intra_sub_8x8_y_mode ( cpi , x , & rate_y , & rate_y_tokenonly , & dist_y , best_rd ) >= best_rd ) { * returnrate = INT_MAX ; return ; } max_uv_tx_size = get_uv_tx_size_impl ( xd -> mi [ 0 ] -> mbmi . tx_size , bsize , pd [ 1 ] . subsampling_x , pd [ 1 ] . subsampling_y ) ; rd_pick_intra_sbuv_mode ( cpi , x , ctx , & rate_uv , & rate_uv_tokenonly , & dist_uv , & uv_skip , BLOCK_8X8 , max_uv_tx_size ) ; } if ( y_skip && uv_skip ) { * returnrate = rate_y + rate_uv - rate_y_tokenonly - rate_uv_tokenonly + vp9_cost_bit ( vp9_get_skip_prob ( cm , xd ) , 1 ) ; * returndist = dist_y + dist_uv ; vp9_zero ( ctx -> tx_rd_diff ) ; } else { int i ; * returnrate = rate_y + rate_uv + vp9_cost_bit ( vp9_get_skip_prob ( cm , xd ) , 0 ) ; * returndist = dist_y + dist_uv ; if ( cpi -> sf . tx_size_search_method == USE_FULL_RD ) for ( i = 0 ; i < TX_MODES ; i ++ ) { if ( tx_cache [ i ] < INT64_MAX && tx_cache [ cm -> tx_mode ] < INT64_MAX ) ctx -> tx_rd_diff [ i ] = tx_cache [ i ] - tx_cache [ cm -> tx_mode ] ; else ctx -> tx_rd_diff [ i ] = 0 ; } } ctx -> mic = * xd -> mi [ 0 ] ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static SORT_KEY_BLOCKS * alloc_key_blocks ( MI_CHECK * param , uint blocks , uint buffer_length ) { reg1 uint i ; SORT_KEY_BLOCKS * block ; DBUG_ENTER ( "alloc_key_blocks" ) ; if ( ! ( block = ( SORT_KEY_BLOCKS * ) my_malloc ( ( sizeof ( SORT_KEY_BLOCKS ) + buffer_length + IO_SIZE ) * blocks , MYF ( 0 ) ) ) ) { mi_check_print_error ( param , "Not enough memory for sort-key-blocks" ) ; return ( 0 ) ; } for ( i = 0 ; i < blocks ; i ++ ) { block [ i ] . inited = 0 ; block [ i ] . buff = ( uchar * ) ( block + blocks ) + ( buffer_length + IO_SIZE ) * i ; } DBUG_RETURN ( block ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int selinux_sb_statfs ( struct dentry * dentry ) { const struct cred * cred = current_cred ( ) ; struct common_audit_data ad ; ad . type = LSM_AUDIT_DATA_DENTRY ; ad . u . dentry = dentry -> d_sb -> s_root ; return superblock_has_perm ( cred , dentry -> d_sb , FILESYSTEM__GETATTR , & ad ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( PageLoadMetricsBrowserTest , UseCounterAnimatedCSSPropertiesMixedContent ) { net : : EmbeddedTestServer https_server ( net : : EmbeddedTestServer : : TYPE_HTTPS ) ; https_server . AddDefaultHandlers ( base : : FilePath ( FILE_PATH_LITERAL ( "chrome/test/data" ) ) ) ; ASSERT_TRUE ( https_server . Start ( ) ) ; auto waiter = CreatePageLoadMetricsWaiter ( ) ; waiter -> AddPageExpectation ( TimingField : : LOAD_EVENT ) ; ui_test_utils : : NavigateToURL ( browser ( ) , https_server . GetURL ( "/page_load_metrics/use_counter_features.html" ) ) ; waiter -> Wait ( ) ; NavigateToUntrackedUrl ( ) ; histogram_tester_ . ExpectBucketCount ( internal : : kAnimatedCssPropertiesHistogramName , 161 , 1 ) ; histogram_tester_ . ExpectBucketCount ( internal : : kAnimatedCssPropertiesHistogramName , 91 , 1 ) ; histogram_tester_ . ExpectBucketCount ( internal : : kAnimatedCssPropertiesHistogramName , blink : : mojom : : kTotalPagesMeasuredCSSSampleId , 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void * Type_CrdInfo_Read ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , cmsUInt32Number * nItems , cmsUInt32Number SizeOfTag ) { cmsMLU * mlu = cmsMLUalloc ( self -> ContextID , 5 ) ; * nItems = 0 ; if ( ! ReadCountAndSting ( self , io , mlu , & SizeOfTag , "nm" ) ) goto Error ; if ( ! ReadCountAndSting ( self , io , mlu , & SizeOfTag , "#0" ) ) goto Error ; if ( ! ReadCountAndSting ( self , io , mlu , & SizeOfTag , "#1" ) ) goto Error ; if ( ! ReadCountAndSting ( self , io , mlu , & SizeOfTag , "#2" ) ) goto Error ; if ( ! ReadCountAndSting ( self , io , mlu , & SizeOfTag , "#3" ) ) goto Error ; * nItems = 1 ; return ( void * ) mlu ; Error : cmsMLUfree ( mlu ) ; return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
extern bool validate_super_user ( uid_t uid ) { # ifndef NDEBUG if ( drop_priv ) return false ; # endif if ( ( uid == 0 ) || ( uid == slurmctld_conf . slurm_user_id ) || assoc_mgr_get_admin_level ( acct_db_conn , uid ) >= SLURMDB_ADMIN_SUPER_USER ) return true ; else return false ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void proto_reg_handoff_btvdp ( void ) { h263_handle = find_dissector_add_dependency ( "h263" , proto_btvdp ) ; mp4v_es_handle = find_dissector_add_dependency ( "mp4v-es" , proto_btvdp ) ; rtp_handle = find_dissector_add_dependency ( "rtp" , proto_btvdp ) ; dissector_add_string ( "bluetooth.uuid" , "1303" , btvdp_handle ) ; dissector_add_string ( "bluetooth.uuid" , "1304" , btvdp_handle ) ; dissector_add_string ( "bluetooth.uuid" , "1305" , btvdp_handle ) ; dissector_add_for_decode_as ( "btl2cap.cid" , btvdp_handle ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int jas_image_encode ( jas_image_t * image , jas_stream_t * out , int fmt , char * optstr ) { jas_image_fmtinfo_t * fmtinfo ; if ( ! ( fmtinfo = jas_image_lookupfmtbyid ( fmt ) ) ) { return - 1 ; } return ( fmtinfo -> ops . encode ) ? ( * fmtinfo -> ops . encode ) ( image , out , optstr ) : ( - 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void keydb_rebuild_caches ( int noisy ) { int i , rc ; keyblock_cache_clear ( ) ; for ( i = 0 ; i < used_resources ; i ++ ) { if ( ! keyring_is_writable ( all_resources [ i ] . token ) ) continue ; switch ( all_resources [ i ] . type ) { case KEYDB_RESOURCE_TYPE_NONE : break ; case KEYDB_RESOURCE_TYPE_KEYRING : rc = keyring_rebuild_cache ( all_resources [ i ] . token , noisy ) ; if ( rc ) log_error ( _ ( "failed to rebuild keyring cache: %s\n" ) , gpg_strerror ( rc ) ) ; break ; case KEYDB_RESOURCE_TYPE_KEYBOX : break ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const char * _ISCIIgetName ( const UConverter * cnv ) { if ( cnv -> extraInfo ) { UConverterDataISCII * myData = ( UConverterDataISCII * ) cnv -> extraInfo ; return myData -> name ; } return NULL ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
xmlChar * xsltAttrTemplateValueProcess ( xsltTransformContextPtr ctxt , const xmlChar * str ) { return ( xsltAttrTemplateValueProcessNode ( ctxt , str , NULL ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int jbig2_halftone_region ( Jbig2Ctx * ctx , Jbig2Segment * segment , const byte * segment_data ) { int offset = 0 ; Jbig2RegionSegmentInfo region_info ; Jbig2HalftoneRegionParams params ; Jbig2Image * image = NULL ; Jbig2ArithCx * GB_stats = NULL ; int code = 0 ; if ( segment -> data_length < 17 ) goto too_short ; jbig2_get_region_segment_info ( & region_info , segment_data ) ; offset += 17 ; if ( segment -> data_length < 18 ) goto too_short ; params . flags = segment_data [ offset ] ; params . HMMR = params . flags & 1 ; params . HTEMPLATE = ( params . flags & 6 ) >> 1 ; params . HENABLESKIP = ( params . flags & 8 ) >> 3 ; params . op = ( Jbig2ComposeOp ) ( ( params . flags & 0x70 ) >> 4 ) ; params . HDEFPIXEL = ( params . flags & 0x80 ) >> 7 ; offset += 1 ; jbig2_error ( ctx , JBIG2_SEVERITY_INFO , segment -> number , "halftone region: %d x %d @ (%x,%d) flags=%02x" , region_info . width , region_info . height , region_info . x , region_info . y , params . flags ) ; if ( params . HMMR && params . HTEMPLATE ) { jbig2_error ( ctx , JBIG2_SEVERITY_WARNING , segment -> number , "HTEMPLATE is %d when HMMR is %d, contrary to spec" , params . HTEMPLATE , params . HMMR ) ; } if ( params . HMMR && params . HENABLESKIP ) { jbig2_error ( ctx , JBIG2_SEVERITY_WARNING , segment -> number , "HENABLESKIP is %d when HMMR is %d, contrary to spec" , params . HENABLESKIP , params . HMMR ) ; } if ( segment -> data_length - offset < 16 ) goto too_short ; params . HGW = jbig2_get_uint32 ( segment_data + offset ) ; params . HGH = jbig2_get_uint32 ( segment_data + offset + 4 ) ; params . HGX = jbig2_get_int32 ( segment_data + offset + 8 ) ; params . HGY = jbig2_get_int32 ( segment_data + offset + 12 ) ; offset += 16 ; if ( segment -> data_length - offset < 4 ) goto too_short ; params . HRX = jbig2_get_uint16 ( segment_data + offset ) ; params . HRY = jbig2_get_uint16 ( segment_data + offset + 2 ) ; offset += 4 ; jbig2_error ( ctx , JBIG2_SEVERITY_INFO , segment -> number , " grid %d x %d @ (%d.%d,%d.%d) vector (%d.%d,%d.%d)" , params . HGW , params . HGH , params . HGX >> 8 , params . HGX & 0xff , params . HGY >> 8 , params . HGY & 0xff , params . HRX >> 8 , params . HRX & 0xff , params . HRY >> 8 , params . HRY & 0xff ) ; if ( ! params . HMMR ) { int stats_size = jbig2_generic_stats_size ( ctx , params . HTEMPLATE ) ; GB_stats = jbig2_new ( ctx , Jbig2ArithCx , stats_size ) ; if ( GB_stats == NULL ) { return jbig2_error ( ctx , JBIG2_SEVERITY_FATAL , segment -> number , "failed to allocate GB_stats in halftone region" ) ; } memset ( GB_stats , 0 , stats_size ) ; } image = jbig2_image_new ( ctx , region_info . width , region_info . height ) ; if ( image == NULL ) { jbig2_free ( ctx -> allocator , GB_stats ) ; return jbig2_error ( ctx , JBIG2_SEVERITY_WARNING , segment -> number , "unable to allocate halftone image" ) ; } code = jbig2_decode_halftone_region ( ctx , segment , & params , segment_data + offset , segment -> data_length - offset , image , GB_stats ) ; if ( ! params . HMMR ) { jbig2_free ( ctx -> allocator , GB_stats ) ; } jbig2_page_add_result ( ctx , & ctx -> pages [ ctx -> current_page ] , image , region_info . x , region_info . y , region_info . op ) ; jbig2_image_release ( ctx , image ) ; return code ; too_short : return jbig2_error ( ctx , JBIG2_SEVERITY_FATAL , segment -> number , "Segment too short" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int TS_ASN1_INTEGER_print_bio ( BIO * bio , const ASN1_INTEGER * num ) { BIGNUM * num_bn ; int result = 0 ; char * hex ; num_bn = BN_new ( ) ; if ( num_bn == NULL ) return - 1 ; ASN1_INTEGER_to_BN ( num , num_bn ) ; if ( ( hex = BN_bn2hex ( num_bn ) ) ) { result = BIO_write ( bio , "0x" , 2 ) > 0 ; result = result && BIO_write ( bio , hex , strlen ( hex ) ) > 0 ; OPENSSL_free ( hex ) ; } BN_free ( num_bn ) ; return result ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int curl_mvsnprintf ( char * buffer , size_t maxlength , const char * format , va_list ap_save ) { int retcode ; struct nsprintf info ; info . buffer = buffer ; info . length = 0 ; info . max = maxlength ; retcode = dprintf_formatf ( & info , addbyter , format , ap_save ) ; if ( ( retcode != - 1 ) && info . max ) { if ( info . max == info . length ) info . buffer [ - 1 ] = 0 ; else info . buffer [ 0 ] = 0 ; } return retcode ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static bool avx512_needed ( void * opaque ) { X86CPU * cpu = opaque ; CPUX86State * env = & cpu -> env ; unsigned int i ; for ( i = 0 ; i < NB_OPMASK_REGS ; i ++ ) { if ( env -> opmask_regs [ i ] ) { return true ; } } for ( i = 0 ; i < CPU_NB_REGS ; i ++ ) { # define ENV_XMM ( reg , field ) ( env -> xmm_regs [ reg ] . ZMM_Q ( field ) ) if ( ENV_XMM ( i , 4 ) || ENV_XMM ( i , 6 ) || ENV_XMM ( i , 5 ) || ENV_XMM ( i , 7 ) ) { return true ; } # ifdef TARGET_X86_64 if ( ENV_XMM ( i + 16 , 0 ) || ENV_XMM ( i + 16 , 1 ) || ENV_XMM ( i + 16 , 2 ) || ENV_XMM ( i + 16 , 3 ) || ENV_XMM ( i + 16 , 4 ) || ENV_XMM ( i + 16 , 5 ) || ENV_XMM ( i + 16 , 6 ) || ENV_XMM ( i + 16 , 7 ) ) { return true ; } # endif } return false ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int ipvideo_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { const uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; IpvideoContext * s = avctx -> priv_data ; int ret ; s -> decoding_map_size = avctx -> width * avctx -> height / ( 8 * 8 * 2 ) ; if ( buf_size < s -> decoding_map_size ) return buf_size ; s -> decoding_map = buf ; bytestream2_init ( & s -> stream_ptr , buf + s -> decoding_map_size , buf_size - s -> decoding_map_size ) ; s -> current_frame . reference = 3 ; if ( ( ret = ff_get_buffer ( avctx , & s -> current_frame ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , " Interplay Video: get_buffer() failed\n" ) ; return ret ; } if ( ! s -> is_16bpp ) { const uint8_t * pal = av_packet_get_side_data ( avpkt , AV_PKT_DATA_PALETTE , NULL ) ; if ( pal ) { s -> current_frame . palette_has_changed = 1 ; memcpy ( s -> pal , pal , AVPALETTE_SIZE ) ; } } ipvideo_decode_opcodes ( s ) ; * got_frame = 1 ; * ( AVFrame * ) data = s -> current_frame ; if ( s -> second_last_frame . data [ 0 ] ) avctx -> release_buffer ( avctx , & s -> second_last_frame ) ; s -> second_last_frame = s -> last_frame ; s -> last_frame = s -> current_frame ; s -> current_frame . data [ 0 ] = NULL ; return buf_size ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int server_request_free ( struct server_request * req ) { int i , rc = 1 ; if ( req -> base . questions ) { for ( i = 0 ; i < req -> base . nquestions ; ++ i ) free ( req -> base . questions [ i ] ) ; free ( req -> base . questions ) ; } if ( req -> port ) { if ( req -> port -> pending_replies == req ) { if ( req -> next_pending ) req -> port -> pending_replies = req -> next_pending ; else req -> port -> pending_replies = NULL ; } rc = -- req -> port -> refcnt ; } if ( req -> response ) { free ( req -> response ) ; } server_request_free_answers ( req ) ; if ( req -> next_pending && req -> next_pending != req ) { req -> next_pending -> prev_pending = req -> prev_pending ; req -> prev_pending -> next_pending = req -> next_pending ; } if ( rc == 0 ) { server_port_free ( req -> port ) ; free ( req ) ; return ( 1 ) ; } free ( req ) ; return ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
xmlChar * xsltEvalXPathString ( xsltTransformContextPtr ctxt , xmlXPathCompExprPtr comp ) { return ( xsltEvalXPathStringNs ( ctxt , comp , 0 , NULL ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
unsigned int hb_face_get_glyph_count ( hb_face_t * face ) { return face -> get_num_glyphs ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int tablefilematch ( struct taboff * tab , FILE * ttc , struct alltabs * all , int pos ) { int i , ch1 , ch2 ; struct taboff * test ; unsigned len ; for ( i = 0 ; i < pos ; ++ i ) { test = findtabindir ( & all [ i ] . tabdir , tab -> tag ) ; if ( test == NULL || test -> data == ( void * ) ( intpt ) - 1 || test -> length != tab -> length ) continue ; rewind ( tab -> data ) ; fseek ( ttc , test -> offset , SEEK_SET ) ; for ( len = 0 ; len < tab -> length && ( ch1 = getc ( tab -> data ) ) != EOF && ( ch2 = getc ( ttc ) ) != EOF ; ++ len ) { if ( ch1 != ch2 ) break ; } if ( len == tab -> length ) { rewind ( tab -> data ) ; fseek ( ttc , 0 , SEEK_END ) ; return ( i ) ; } } rewind ( tab -> data ) ; fseek ( ttc , 0 , SEEK_END ) ; return ( - 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int mv_read_packet ( AVFormatContext * avctx , AVPacket * pkt ) { MvContext * mv = avctx -> priv_data ; AVIOContext * pb = avctx -> pb ; AVStream * st = avctx -> streams [ mv -> stream_index ] ; const AVIndexEntry * index ; int frame = mv -> frame [ mv -> stream_index ] ; int64_t ret ; uint64_t pos ; if ( frame < st -> nb_index_entries ) { index = & st -> index_entries [ frame ] ; pos = avio_tell ( pb ) ; if ( index -> pos > pos ) avio_skip ( pb , index -> pos - pos ) ; else if ( index -> pos < pos ) { if ( ! ( pb -> seekable & AVIO_SEEKABLE_NORMAL ) ) return AVERROR ( EIO ) ; ret = avio_seek ( pb , index -> pos , SEEK_SET ) ; if ( ret < 0 ) return ret ; } ret = av_get_packet ( pb , pkt , index -> size ) ; if ( ret < 0 ) return ret ; pkt -> stream_index = mv -> stream_index ; pkt -> pts = index -> timestamp ; pkt -> flags |= AV_PKT_FLAG_KEY ; mv -> frame [ mv -> stream_index ] ++ ; mv -> eof_count = 0 ; } else { mv -> eof_count ++ ; if ( mv -> eof_count >= avctx -> nb_streams ) return AVERROR_EOF ; return AVERROR ( EAGAIN ) ; } mv -> stream_index ++ ; if ( mv -> stream_index >= avctx -> nb_streams ) mv -> stream_index = 0 ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
PHP_FUNCTION ( locale_parse ) { const char * loc_name = NULL ; int loc_name_len = 0 ; int grOffset = 0 ; intl_error_reset ( NULL TSRMLS_CC ) ; if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "s" , & loc_name , & loc_name_len ) == FAILURE ) { intl_error_set ( NULL , U_ILLEGAL_ARGUMENT_ERROR , "locale_parse: unable to parse input params" , 0 TSRMLS_CC ) ; RETURN_FALSE ; } if ( loc_name_len == 0 ) { loc_name = intl_locale_get_default ( TSRMLS_C ) ; } array_init ( return_value ) ; grOffset = findOffset ( LOC_GRANDFATHERED , loc_name ) ; if ( grOffset >= 0 ) { add_assoc_string ( return_value , LOC_GRANDFATHERED_LANG_TAG , estrdup ( loc_name ) , FALSE ) ; } else { add_array_entry ( loc_name , return_value , LOC_LANG_TAG TSRMLS_CC ) ; add_array_entry ( loc_name , return_value , LOC_SCRIPT_TAG TSRMLS_CC ) ; add_array_entry ( loc_name , return_value , LOC_REGION_TAG TSRMLS_CC ) ; add_array_entry ( loc_name , return_value , LOC_VARIANT_TAG TSRMLS_CC ) ; add_array_entry ( loc_name , return_value , LOC_PRIVATE_TAG TSRMLS_CC ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
TSReturnCode TSHttpHdrClone ( TSMBuffer dest_bufp , TSMBuffer src_bufp , TSMLoc src_hdr , TSMLoc * locp ) { sdk_assert ( sdk_sanity_check_mbuffer ( dest_bufp ) == TS_SUCCESS ) ; sdk_assert ( sdk_sanity_check_mbuffer ( src_bufp ) == TS_SUCCESS ) ; sdk_assert ( sdk_sanity_check_http_hdr_handle ( src_hdr ) == TS_SUCCESS ) ; if ( ! isWriteable ( dest_bufp ) ) { return TS_ERROR ; } HdrHeap * s_heap , * d_heap ; HTTPHdrImpl * s_hh , * d_hh ; s_heap = ( ( HdrHeapSDKHandle * ) src_bufp ) -> m_heap ; d_heap = ( ( HdrHeapSDKHandle * ) dest_bufp ) -> m_heap ; s_hh = ( HTTPHdrImpl * ) src_hdr ; if ( s_hh -> m_type != HDR_HEAP_OBJ_HTTP_HEADER ) { return TS_ERROR ; } d_hh = http_hdr_clone ( s_hh , s_heap , d_heap ) ; * locp = ( TSMLoc ) d_hh ; return TS_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int i2d_EC_PUBKEY_bio ( BIO * bp , EC_KEY * ecdsa ) { return ASN1_i2d_bio_of ( EC_KEY , i2d_EC_PUBKEY , bp , ecdsa ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int SpoolssEnumPrinterData_r ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep _U_ ) { guint32 value_len , type ; char * value ; proto_item * value_item ; proto_tree * value_subtree ; proto_item * hidden_item ; hidden_item = proto_tree_add_uint ( tree , hf_printerdata , tvb , offset , 0 , 1 ) ; PROTO_ITEM_SET_HIDDEN ( hidden_item ) ; value_subtree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_printerdata_value , & value_item , "Value" ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , value_subtree , di , drep , hf_enumprinterdata_value_len , & value_len ) ; if ( value_len ) { dissect_spoolss_uint16uni ( tvb , offset , pinfo , value_subtree , drep , & value , hf_value_name ) ; offset += value_len * 2 ; if ( value && value [ 0 ] ) col_append_fstr ( pinfo -> cinfo , COL_INFO , ", %s" , value ) ; proto_item_append_text ( value_item , ": %s" , value ) ; hidden_item = proto_tree_add_string ( tree , hf_printerdata_value , tvb , offset , 0 , value ) ; PROTO_ITEM_SET_HIDDEN ( hidden_item ) ; g_free ( value ) ; } proto_item_set_len ( value_item , value_len * 2 + 4 ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , value_subtree , di , drep , hf_enumprinterdata_value_needed , NULL ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_printerdata_type , & type ) ; offset = dissect_printerdata_data ( tvb , offset , pinfo , tree , di , drep , type ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_enumprinterdata_data_needed , NULL ) ; offset = dissect_doserror ( tvb , offset , pinfo , tree , di , drep , hf_rc , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int lexescape ( struct vars * v ) { chr c ; static const chr alert [ ] = { CHR ( 'a' ) , CHR ( 'l' ) , CHR ( 'e' ) , CHR ( 'r' ) , CHR ( 't' ) } ; static const chr esc [ ] = { CHR ( 'E' ) , CHR ( 'S' ) , CHR ( 'C' ) } ; const chr * save ; assert ( v -> cflags & REG_ADVF ) ; assert ( ! ATEOS ( ) ) ; c = * v -> now ++ ; if ( ! iscalnum ( c ) ) RETV ( PLAIN , c ) ; NOTE ( REG_UNONPOSIX ) ; switch ( c ) { case CHR ( 'a' ) : RETV ( PLAIN , chrnamed ( v , alert , ENDOF ( alert ) , CHR ( '\007' ) ) ) ; break ; case CHR ( 'A' ) : RETV ( SBEGIN , 0 ) ; break ; case CHR ( 'b' ) : RETV ( PLAIN , CHR ( '\b' ) ) ; break ; case CHR ( 'B' ) : RETV ( PLAIN , CHR ( '\\' ) ) ; break ; case CHR ( 'c' ) : NOTE ( REG_UUNPORT ) ; if ( ATEOS ( ) ) FAILW ( REG_EESCAPE ) ; RETV ( PLAIN , ( chr ) ( * v -> now ++ & 037 ) ) ; break ; case CHR ( 'd' ) : NOTE ( REG_ULOCALE ) ; RETV ( CCLASS , 'd' ) ; break ; case CHR ( 'D' ) : NOTE ( REG_ULOCALE ) ; RETV ( CCLASS , 'D' ) ; break ; case CHR ( 'e' ) : NOTE ( REG_UUNPORT ) ; RETV ( PLAIN , chrnamed ( v , esc , ENDOF ( esc ) , CHR ( '\033' ) ) ) ; break ; case CHR ( 'f' ) : RETV ( PLAIN , CHR ( '\f' ) ) ; break ; case CHR ( 'm' ) : RET ( '<' ) ; break ; case CHR ( 'M' ) : RET ( '>' ) ; break ; case CHR ( 'n' ) : RETV ( PLAIN , CHR ( '\n' ) ) ; break ; case CHR ( 'r' ) : RETV ( PLAIN , CHR ( '\r' ) ) ; break ; case CHR ( 's' ) : NOTE ( REG_ULOCALE ) ; RETV ( CCLASS , 's' ) ; break ; case CHR ( 'S' ) : NOTE ( REG_ULOCALE ) ; RETV ( CCLASS , 'S' ) ; break ; case CHR ( 't' ) : RETV ( PLAIN , CHR ( '\t' ) ) ; break ; case CHR ( 'u' ) : c = lexdigits ( v , 16 , 4 , 4 ) ; if ( ISERR ( ) || c < CHR_MIN || c > CHR_MAX ) FAILW ( REG_EESCAPE ) ; RETV ( PLAIN , c ) ; break ; case CHR ( 'U' ) : c = lexdigits ( v , 16 , 8 , 8 ) ; if ( ISERR ( ) || c < CHR_MIN || c > CHR_MAX ) FAILW ( REG_EESCAPE ) ; RETV ( PLAIN , c ) ; break ; case CHR ( 'v' ) : RETV ( PLAIN , CHR ( '\v' ) ) ; break ; case CHR ( 'w' ) : NOTE ( REG_ULOCALE ) ; RETV ( CCLASS , 'w' ) ; break ; case CHR ( 'W' ) : NOTE ( REG_ULOCALE ) ; RETV ( CCLASS , 'W' ) ; break ; case CHR ( 'x' ) : NOTE ( REG_UUNPORT ) ; c = lexdigits ( v , 16 , 1 , 255 ) ; if ( ISERR ( ) || c < CHR_MIN || c > CHR_MAX ) FAILW ( REG_EESCAPE ) ; RETV ( PLAIN , c ) ; break ; case CHR ( 'y' ) : NOTE ( REG_ULOCALE ) ; RETV ( WBDRY , 0 ) ; break ; case CHR ( 'Y' ) : NOTE ( REG_ULOCALE ) ; RETV ( NWBDRY , 0 ) ; break ; case CHR ( 'Z' ) : RETV ( SEND , 0 ) ; break ; case CHR ( '1' ) : case CHR ( '2' ) : case CHR ( '3' ) : case CHR ( '4' ) : case CHR ( '5' ) : case CHR ( '6' ) : case CHR ( '7' ) : case CHR ( '8' ) : case CHR ( '9' ) : save = v -> now ; v -> now -- ; c = lexdigits ( v , 10 , 1 , 255 ) ; if ( ISERR ( ) ) FAILW ( REG_EESCAPE ) ; if ( v -> now == save || ( ( int ) c > 0 && ( int ) c <= v -> nsubexp ) ) { NOTE ( REG_UBACKREF ) ; RETV ( BACKREF , ( chr ) c ) ; } v -> now = save ; case CHR ( '0' ) : NOTE ( REG_UUNPORT ) ; v -> now -- ; c = lexdigits ( v , 8 , 1 , 3 ) ; if ( ISERR ( ) ) FAILW ( REG_EESCAPE ) ; if ( c > 0xff ) { v -> now -- ; c >>= 3 ; } RETV ( PLAIN , c ) ; break ; default : assert ( iscalpha ( c ) ) ; FAILW ( REG_EESCAPE ) ; break ; } assert ( NOTREACHED ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
PyObject * PyString_FromFormat ( const char * format , ... ) { PyObject * ret ; va_list vargs ; # ifdef HAVE_STDARG_PROTOTYPES va_start ( vargs , format ) ; # else va_start ( vargs ) ; # endif ret = PyString_FromFormatV ( format , vargs ) ; va_end ( vargs ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_RequestMultiplexEntryRelease ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_RequestMultiplexEntryRelease , RequestMultiplexEntryRelease_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int input_DecoderSetCcState ( decoder_t * p_dec , bool b_decode , int i_channel ) { decoder_owner_sys_t * p_owner = p_dec -> p_owner ; if ( i_channel < 0 || i_channel >= 4 || ! p_owner -> cc . pb_present [ i_channel ] ) return VLC_EGENERIC ; if ( b_decode ) { static const vlc_fourcc_t fcc [ 4 ] = { VLC_FOURCC ( 'c' , 'c' , '1' , ' ' ) , VLC_FOURCC ( 'c' , 'c' , '2' , ' ' ) , VLC_FOURCC ( 'c' , 'c' , '3' , ' ' ) , VLC_FOURCC ( 'c' , 'c' , '4' , ' ' ) , } ; decoder_t * p_cc ; es_format_t fmt ; es_format_Init ( & fmt , SPU_ES , fcc [ i_channel ] ) ; p_cc = input_DecoderNew ( p_owner -> p_input , & fmt , p_dec -> p_owner -> p_clock , p_owner -> p_sout ) ; if ( ! p_cc ) { msg_Err ( p_dec , "could not create decoder" ) ; dialog_Fatal ( p_dec , _ ( "Streaming / Transcoding failed" ) , "%s" , _ ( "VLC could not open the decoder module." ) ) ; return VLC_EGENERIC ; } else if ( ! p_cc -> p_module ) { DecoderUnsupportedCodec ( p_dec , fcc [ i_channel ] ) ; input_DecoderDelete ( p_cc ) ; return VLC_EGENERIC ; } p_cc -> p_owner -> p_clock = p_owner -> p_clock ; vlc_mutex_lock ( & p_owner -> lock ) ; p_owner -> cc . pp_decoder [ i_channel ] = p_cc ; vlc_mutex_unlock ( & p_owner -> lock ) ; } else { decoder_t * p_cc ; vlc_mutex_lock ( & p_owner -> lock ) ; p_cc = p_owner -> cc . pp_decoder [ i_channel ] ; p_owner -> cc . pp_decoder [ i_channel ] = NULL ; vlc_mutex_unlock ( & p_owner -> lock ) ; if ( p_cc ) input_DecoderDelete ( p_cc ) ; } return VLC_SUCCESS ; }
0False