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
const char * evhttp_request_uri ( struct evhttp_request * req ) { if ( req -> uri == NULL ) event_debug ( ( "%s: request %p has no uri\n" , __func__ , req ) ) ; return ( req -> uri ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean ngsniffer_read ( wtap * wth , int * err , gchar * * err_info , gint64 * data_offset ) { ngsniffer_t * ngsniffer ; int ret ; guint padding ; ngsniffer = ( ngsniffer_t * ) wth -> priv ; for ( ; ; ) { * data_offset = ngsniffer -> seq . uncomp_offset ; ret = ngsniffer_process_record ( wth , FALSE , & padding , & wth -> phdr , wth -> frame_buffer , err , err_info ) ; if ( ret < 0 ) { return FALSE ; } switch ( ret ) { case REC_FRAME2 : case REC_FRAME4 : case REC_FRAME6 : if ( padding != 0 ) { if ( ! ng_file_skip_seq ( wth , padding , err , err_info ) ) return FALSE ; } return TRUE ; case REC_EOF : * err = 0 ; return FALSE ; default : if ( padding != 0 ) { if ( ! ng_file_skip_seq ( wth , padding , err , err_info ) ) return FALSE ; } break ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void sun4m_hw_init ( const struct sun4m_hwdef * hwdef , ram_addr_t RAM_size , const char * boot_device , const char * kernel_filename , const char * kernel_cmdline , const char * initrd_filename , const char * cpu_model ) { unsigned int i ; void * iommu , * espdma , * ledma , * nvram ; qemu_irq * cpu_irqs [ MAX_CPUS ] , slavio_irq [ 32 ] , slavio_cpu_irq [ MAX_CPUS ] , espdma_irq , ledma_irq ; qemu_irq esp_reset , dma_enable ; qemu_irq fdc_tc ; qemu_irq * cpu_halt ; unsigned long kernel_size ; DriveInfo * fd [ MAX_FD ] ; FWCfgState * fw_cfg ; unsigned int num_vsimms ; if ( ! cpu_model ) cpu_model = hwdef -> default_cpu_model ; for ( i = 0 ; i < smp_cpus ; i ++ ) { cpu_devinit ( cpu_model , i , hwdef -> slavio_base , & cpu_irqs [ i ] ) ; } for ( i = smp_cpus ; i < MAX_CPUS ; i ++ ) cpu_irqs [ i ] = qemu_allocate_irqs ( dummy_cpu_set_irq , NULL , MAX_PILS ) ; ram_init ( 0 , RAM_size , hwdef -> max_mem ) ; if ( ! hwdef -> ecc_base ) { empty_slot_init ( RAM_size , hwdef -> max_mem - RAM_size ) ; } prom_init ( hwdef -> slavio_base , bios_name ) ; slavio_intctl = slavio_intctl_init ( hwdef -> intctl_base , hwdef -> intctl_base + 0x10000ULL , cpu_irqs ) ; for ( i = 0 ; i < 32 ; i ++ ) { slavio_irq [ i ] = qdev_get_gpio_in ( slavio_intctl , i ) ; } for ( i = 0 ; i < MAX_CPUS ; i ++ ) { slavio_cpu_irq [ i ] = qdev_get_gpio_in ( slavio_intctl , 32 + i ) ; } if ( hwdef -> idreg_base ) { idreg_init ( hwdef -> idreg_base ) ; } if ( hwdef -> afx_base ) { afx_init ( hwdef -> afx_base ) ; } iommu = iommu_init ( hwdef -> iommu_base , hwdef -> iommu_version , slavio_irq [ 30 ] ) ; if ( hwdef -> iommu_pad_base ) { empty_slot_init ( hwdef -> iommu_pad_base , hwdef -> iommu_pad_len ) ; } espdma = sparc32_dma_init ( hwdef -> dma_base , slavio_irq [ 18 ] , iommu , & espdma_irq , 0 ) ; ledma = sparc32_dma_init ( hwdef -> dma_base + 16ULL , slavio_irq [ 16 ] , iommu , & ledma_irq , 1 ) ; if ( graphic_depth != 8 && graphic_depth != 24 ) { fprintf ( stderr , "qemu: Unsupported depth: %d\n" , graphic_depth ) ; exit ( 1 ) ; } num_vsimms = 0 ; if ( num_vsimms == 0 ) { tcx_init ( hwdef -> tcx_base , 0x00100000 , graphic_width , graphic_height , graphic_depth ) ; } for ( i = num_vsimms ; i < MAX_VSIMMS ; i ++ ) { if ( hwdef -> vsimm [ i ] . reg_base ) { empty_slot_init ( hwdef -> vsimm [ i ] . reg_base , 0x2000 ) ; } } if ( hwdef -> sx_base ) { empty_slot_init ( hwdef -> sx_base , 0x2000 ) ; } lance_init ( & nd_table [ 0 ] , hwdef -> le_base , ledma , ledma_irq ) ; nvram = m48t59_init ( slavio_irq [ 0 ] , hwdef -> nvram_base , 0 , 0x2000 , 8 ) ; slavio_timer_init_all ( hwdef -> counter_base , slavio_irq [ 19 ] , slavio_cpu_irq , smp_cpus ) ; slavio_serial_ms_kbd_init ( hwdef -> ms_kb_base , slavio_irq [ 14 ] , display_type == DT_NOGRAPHIC , ESCC_CLOCK , 1 ) ; escc_init ( hwdef -> serial_base , slavio_irq [ 15 ] , slavio_irq [ 15 ] , serial_hds [ 0 ] , serial_hds [ 1 ] , ESCC_CLOCK , 1 ) ; cpu_halt = qemu_allocate_irqs ( cpu_halt_signal , NULL , 1 ) ; if ( hwdef -> apc_base ) { apc_init ( hwdef -> apc_base , cpu_halt [ 0 ] ) ; } if ( hwdef -> fd_base ) { memset ( fd , 0 , sizeof ( fd ) ) ; fd [ 0 ] = drive_get ( IF_FLOPPY , 0 , 0 ) ; sun4m_fdctrl_init ( slavio_irq [ 22 ] , hwdef -> fd_base , fd , & fdc_tc ) ; } else { fdc_tc = * qemu_allocate_irqs ( dummy_fdc_tc , NULL , 1 ) ; } slavio_misc_init ( hwdef -> slavio_base , hwdef -> aux1_base , hwdef -> aux2_base , slavio_irq [ 30 ] , fdc_tc ) ; if ( drive_get_max_bus ( IF_SCSI ) > 0 ) { fprintf ( stderr , "qemu: too many SCSI bus\n" ) ; exit ( 1 ) ; } esp_init ( hwdef -> esp_base , 2 , espdma_memory_read , espdma_memory_write , espdma , espdma_irq , & esp_reset , & dma_enable ) ; qdev_connect_gpio_out ( espdma , 0 , esp_reset ) ; qdev_connect_gpio_out ( espdma , 1 , dma_enable ) ; if ( hwdef -> cs_base ) { sysbus_create_simple ( "SUNW,CS4231" , hwdef -> cs_base , slavio_irq [ 5 ] ) ; } if ( hwdef -> dbri_base ) { empty_slot_init ( hwdef -> dbri_base + 0x1000 , 0x30 ) ; empty_slot_init ( hwdef -> dbri_base + 0x10000 , 0x100 ) ; } if ( hwdef -> bpp_base ) { empty_slot_init ( hwdef -> bpp_base , 0x20 ) ; } kernel_size = sun4m_load_kernel ( kernel_filename , initrd_filename , RAM_size ) ; nvram_init ( nvram , ( uint8_t * ) & nd_table [ 0 ] . macaddr , kernel_cmdline , boot_device , RAM_size , kernel_size , graphic_width , graphic_height , graphic_depth , hwdef -> nvram_machine_id , "Sun4m" ) ; if ( hwdef -> ecc_base ) ecc_init ( hwdef -> ecc_base , slavio_irq [ 28 ] , hwdef -> ecc_version ) ; fw_cfg = fw_cfg_init ( 0 , 0 , CFG_ADDR , CFG_ADDR + 2 ) ; fw_cfg_add_i16 ( fw_cfg , FW_CFG_MAX_CPUS , ( uint16_t ) max_cpus ) ; fw_cfg_add_i32 ( fw_cfg , FW_CFG_ID , 1 ) ; fw_cfg_add_i64 ( fw_cfg , FW_CFG_RAM_SIZE , ( uint64_t ) ram_size ) ; fw_cfg_add_i16 ( fw_cfg , FW_CFG_MACHINE_ID , hwdef -> machine_id ) ; fw_cfg_add_i16 ( fw_cfg , FW_CFG_SUN4M_DEPTH , graphic_depth ) ; fw_cfg_add_i32 ( fw_cfg , FW_CFG_KERNEL_ADDR , KERNEL_LOAD_ADDR ) ; fw_cfg_add_i32 ( fw_cfg , FW_CFG_KERNEL_SIZE , kernel_size ) ; if ( kernel_cmdline ) { fw_cfg_add_i32 ( fw_cfg , FW_CFG_KERNEL_CMDLINE , CMDLINE_ADDR ) ; pstrcpy_targphys ( "cmdline" , CMDLINE_ADDR , TARGET_PAGE_SIZE , kernel_cmdline ) ; fw_cfg_add_string ( fw_cfg , FW_CFG_CMDLINE_DATA , kernel_cmdline ) ; fw_cfg_add_i32 ( fw_cfg , FW_CFG_CMDLINE_SIZE , strlen ( kernel_cmdline ) + 1 ) ; } else { fw_cfg_add_i32 ( fw_cfg , FW_CFG_KERNEL_CMDLINE , 0 ) ; fw_cfg_add_i32 ( fw_cfg , FW_CFG_CMDLINE_SIZE , 0 ) ; } fw_cfg_add_i32 ( fw_cfg , FW_CFG_INITRD_ADDR , INITRD_LOAD_ADDR ) ; fw_cfg_add_i32 ( fw_cfg , FW_CFG_INITRD_SIZE , 0 ) ; fw_cfg_add_i16 ( fw_cfg , FW_CFG_BOOT_DEVICE , boot_device [ 0 ] ) ; qemu_register_boot_set ( fw_cfg_boot_set , fw_cfg ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int get_and_cmp_point ( const char * name , const char * mpi_x_string , const char * mpi_y_string , const char * desc , gcry_ctx_t ctx ) { gcry_mpi_point_t point ; gcry_mpi_t x , y , z ; int result = 0 ; point = gcry_mpi_ec_get_point ( name , ctx , 1 ) ; if ( ! point ) { fail ( "error getting point parameter '%s' of curve '%s'\n" , name , desc ) ; return 1 ; } if ( debug ) print_point ( name , point ) ; x = gcry_mpi_new ( 0 ) ; y = gcry_mpi_new ( 0 ) ; z = gcry_mpi_new ( 0 ) ; gcry_mpi_point_snatch_get ( x , y , z , point ) ; if ( cmp_mpihex ( x , mpi_x_string ) ) { fail ( "x coordinate of '%s' of curve '%s' does not match\n" , name , desc ) ; result = 1 ; } if ( cmp_mpihex ( y , mpi_y_string ) ) { fail ( "y coordinate of '%s' of curve '%s' does not match\n" , name , desc ) ; result = 1 ; } if ( cmp_mpihex ( z , "01" ) ) { fail ( "z coordinate of '%s' of curve '%s' is not 1\n" , name , desc ) ; result = 1 ; } gcry_mpi_release ( x ) ; gcry_mpi_release ( y ) ; gcry_mpi_release ( z ) ; return result ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int com_warnings ( String * buffer __attribute__ ( ( unused ) ) , char * line __attribute__ ( ( unused ) ) ) { show_warnings = 1 ; put_info ( "Show warnings enabled." , INFO_INFO ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void ber_add_syntax_name ( gpointer key , gpointer value _U_ , gpointer user_data ) { guint * i = ( guint * ) user_data ; if ( * i < MAX_SYNTAX_NAMES ) { syntax_names [ * i ] . value = * i ; syntax_names [ * i ] . strptr = ( const gchar * ) key ; ( * i ) ++ ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void init_util ( void ) { filegen_register ( statsdir , "peerstats" , & peerstats ) ; filegen_register ( statsdir , "loopstats" , & loopstats ) ; filegen_register ( statsdir , "clockstats" , & clockstats ) ; filegen_register ( statsdir , "rawstats" , & rawstats ) ; filegen_register ( statsdir , "sysstats" , & sysstats ) ; filegen_register ( statsdir , "protostats" , & protostats ) ; # ifdef AUTOKEY filegen_register ( statsdir , "cryptostats" , & cryptostats ) ; # endif # ifdef DEBUG_TIMING filegen_register ( statsdir , "timingstats" , & timingstats ) ; # endif step_callback = & ntpd_time_stepped ; # ifdef DEBUG atexit ( & uninit_util ) ; # endif }
1True
Categorize the following code snippet as vulnerable or not. True or False
time_t TSMimeHdrFieldValueDateGet ( TSMBuffer bufp , TSMLoc hdr , TSMLoc field ) { 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 ) ; int value_len ; const char * value_str = TSMimeFieldValueGet ( bufp , field , - 1 , & value_len ) ; if ( value_str == nullptr ) { return ( time_t ) 0 ; } return mime_parse_date ( value_str , value_str + value_len ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
ACTION ( STLDeleteElements0 ) { STLDeleteContainerPointers ( arg0 . begin ( ) , arg0 . end ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int gsm_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) { AVFrame * frame = data ; int res ; GetBitContext gb ; const uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; int16_t * samples ; if ( buf_size < avctx -> block_align ) { av_log ( avctx , AV_LOG_ERROR , "Packet is too small\n" ) ; return AVERROR_INVALIDDATA ; } frame -> nb_samples = avctx -> frame_size ; if ( ( res = ff_get_buffer ( avctx , frame ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ; return res ; } samples = ( int16_t * ) frame -> data [ 0 ] ; switch ( avctx -> codec_id ) { case AV_CODEC_ID_GSM : init_get_bits ( & gb , buf , buf_size * 8 ) ; if ( get_bits ( & gb , 4 ) != 0xd ) av_log ( avctx , AV_LOG_WARNING , "Missing GSM magic!\n" ) ; res = gsm_decode_block ( avctx , samples , & gb ) ; if ( res < 0 ) return res ; break ; case AV_CODEC_ID_GSM_MS : res = ff_msgsm_decode_block ( avctx , samples , buf ) ; if ( res < 0 ) return res ; } * got_frame_ptr = 1 ; return avctx -> block_align ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
int ssl_cert_type ( const X509 * x , const EVP_PKEY * pk ) { if ( pk == NULL && ( pk = X509_get0_pubkey ( x ) ) == NULL ) return - 1 ; switch ( EVP_PKEY_id ( pk ) ) { default : return - 1 ; case EVP_PKEY_RSA : return SSL_PKEY_RSA_ENC ; case EVP_PKEY_DSA : return SSL_PKEY_DSA_SIGN ; # ifndef OPENSSL_NO_EC case EVP_PKEY_EC : return SSL_PKEY_ECC ; # endif # ifndef OPENSSL_NO_GOST case NID_id_GostR3410_2001 : return SSL_PKEY_GOST01 ; case NID_id_GostR3410_2012_256 : return SSL_PKEY_GOST12_256 ; case NID_id_GostR3410_2012_512 : return SSL_PKEY_GOST12_512 ; # endif } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void ff_init_block_index ( MpegEncContext * s ) { const int linesize = s -> current_picture . f . linesize [ 0 ] ; / ot s -> linesize as this would be wrong for field pics const int uvlinesize = s -> current_picture . f . linesize [ 1 ] ; const int mb_size = 4 ; s -> block_index [ 0 ] = s -> b8_stride * ( s -> mb_y * 2 ) - 2 + s -> mb_x * 2 ; s -> block_index [ 1 ] = s -> b8_stride * ( s -> mb_y * 2 ) - 1 + s -> mb_x * 2 ; s -> block_index [ 2 ] = s -> b8_stride * ( s -> mb_y * 2 + 1 ) - 2 + s -> mb_x * 2 ; s -> block_index [ 3 ] = s -> b8_stride * ( s -> mb_y * 2 + 1 ) - 1 + s -> mb_x * 2 ; s -> block_index [ 4 ] = s -> mb_stride * ( s -> mb_y + 1 ) + s -> b8_stride * s -> mb_height * 2 + s -> mb_x - 1 ; s -> block_index [ 5 ] = s -> mb_stride * ( s -> mb_y + s -> mb_height + 2 ) + s -> b8_stride * s -> mb_height * 2 + s -> mb_x - 1 ; s -> dest [ 0 ] = s -> current_picture . f . data [ 0 ] + ( ( s -> mb_x - 1 ) << mb_size ) ; s -> dest [ 1 ] = s -> current_picture . f . data [ 1 ] + ( ( s -> mb_x - 1 ) << ( mb_size - s -> chroma_x_shift ) ) ; s -> dest [ 2 ] = s -> current_picture . f . data [ 2 ] + ( ( s -> mb_x - 1 ) << ( mb_size - s -> chroma_x_shift ) ) ; if ( ! ( s -> pict_type == AV_PICTURE_TYPE_B && s -> avctx -> draw_horiz_band && s -> picture_structure == PICT_FRAME ) ) { if ( s -> picture_structure == PICT_FRAME ) { s -> dest [ 0 ] += s -> mb_y * linesize << mb_size ; s -> dest [ 1 ] += s -> mb_y * uvlinesize << ( mb_size - s -> chroma_y_shift ) ; s -> dest [ 2 ] += s -> mb_y * uvlinesize << ( mb_size - s -> chroma_y_shift ) ; } else { s -> dest [ 0 ] += ( s -> mb_y >> 1 ) * linesize << mb_size ; s -> dest [ 1 ] += ( s -> mb_y >> 1 ) * uvlinesize << ( mb_size - s -> chroma_y_shift ) ; s -> dest [ 2 ] += ( s -> mb_y >> 1 ) * uvlinesize << ( mb_size - s -> chroma_y_shift ) ; assert ( ( s -> mb_y & 1 ) == ( s -> picture_structure == PICT_BOTTOM_FIELD ) ) ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_GSMAudioCapability ( 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_GSMAudioCapability , GSMAudioCapability_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void put_cursor ( uint8_t * dst , int stride , VmncContext * c , int dx , int dy ) { int i , j ; int w , h , x , y ; w = c -> cur_w ; if ( c -> width < c -> cur_x + c -> cur_w ) w = c -> width - c -> cur_x ; h = c -> cur_h ; if ( c -> height < c -> cur_y + c -> cur_h ) h = c -> height - c -> cur_y ; x = c -> cur_x ; y = c -> cur_y ; if ( x < 0 ) { w += x ; x = 0 ; } if ( y < 0 ) { h += y ; y = 0 ; } if ( ( w < 1 ) || ( h < 1 ) ) return ; dst += x * c -> bpp2 + y * stride ; if ( c -> bpp2 == 1 ) { uint8_t * cd = c -> curbits , * msk = c -> curmask ; for ( j = 0 ; j < h ; j ++ ) { for ( i = 0 ; i < w ; i ++ ) dst [ i ] = ( dst [ i ] & cd [ i ] ) ^ msk [ i ] ; msk += c -> cur_w ; cd += c -> cur_w ; dst += stride ; } } else if ( c -> bpp2 == 2 ) { uint16_t * cd = ( uint16_t * ) c -> curbits , * msk = ( uint16_t * ) c -> curmask ; uint16_t * dst2 ; for ( j = 0 ; j < h ; j ++ ) { dst2 = ( uint16_t * ) dst ; for ( i = 0 ; i < w ; i ++ ) dst2 [ i ] = ( dst2 [ i ] & cd [ i ] ) ^ msk [ i ] ; msk += c -> cur_w ; cd += c -> cur_w ; dst += stride ; } } else if ( c -> bpp2 == 4 ) { uint32_t * cd = ( uint32_t * ) c -> curbits , * msk = ( uint32_t * ) c -> curmask ; uint32_t * dst2 ; for ( j = 0 ; j < h ; j ++ ) { dst2 = ( uint32_t * ) dst ; for ( i = 0 ; i < w ; i ++ ) dst2 [ i ] = ( dst2 [ i ] & cd [ i ] ) ^ msk [ i ] ; msk += c -> cur_w ; cd += c -> cur_w ; dst += stride ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void do_system ( struct st_command * command ) { DYNAMIC_STRING ds_cmd ; DBUG_ENTER ( "do_system" ) ; if ( strlen ( command -> first_argument ) == 0 ) { report_or_die ( "Missing arguments to system, nothing to do!" ) ; return ; } init_dynamic_string ( & ds_cmd , 0 , command -> query_len + 64 , 256 ) ; do_eval ( & ds_cmd , command -> first_argument , command -> end , ! is_windows ) ; # ifdef __WIN__ # ifndef USE_CYGWIN while ( replace ( & ds_cmd , "/devull" , 9 , "NUL" , 3 ) == 0 ) ; # endif # endif DBUG_PRINT ( "info" , ( "running system command '%s' as '%s'" , command -> first_argument , ds_cmd . str ) ) ; if ( my_system ( & ds_cmd ) ) { if ( command -> abort_on_error ) report_or_die ( "system command '%s' failed" , command -> first_argument ) ; else { dynstr_append ( & ds_res , "system command '" ) ; replace_dynstr_append ( & ds_res , command -> first_argument ) ; dynstr_append ( & ds_res , "' failed\n" ) ; } } command -> last_argument = command -> end ; dynstr_free ( & ds_cmd ) ; DBUG_VOID_RETURN ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
extern int name ( int ) __THROW __exctype ( isalnum ) ; __exctype ( isalpha ) ; __exctype ( iscntrl ) ; __exctype ( isdigit ) ; __exctype ( islower ) ; __exctype ( isgraph ) ; __exctype ( isprint ) ; __exctype ( ispunct ) ; __exctype ( isspace ) ; __exctype ( isupper ) ; __exctype ( isxdigit ) ; extern int tolower ( int __c ) __THROW ; extern int toupper ( int __c ) __THROW ; # ifdef __USE_ISOC99 __exctype ( isblank ) ; # endif # ifdef __USE_GNU extern int isctype ( int __c , int __mask ) __THROW ; # endif # if defined __USE_MISC || defined __USE_XOPEN extern int isascii ( int __c ) __THROW ; extern int toascii ( int __c ) __THROW ; __exctype ( _toupper ) ; __exctype ( _tolower )
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( ProtocolHandlerRegistryTest , MAYBE_AcceptProtocolHandlerHandlesProtocol ) { ASSERT_FALSE ( registry ( ) -> IsHandledProtocol ( "test" ) ) ; registry ( ) -> OnAcceptRegisterProtocolHandler ( test_protocol_handler ( ) ) ; ASSERT_TRUE ( registry ( ) -> IsHandledProtocol ( "test" ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void DefaultFreeFunc ( void * opaque , void * address ) { BROTLI_UNUSED ( opaque ) ; free ( address ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
const char * proto_registrar_get_name ( const int n ) { header_field_info * hfinfo ; PROTO_REGISTRAR_GET_NTH ( n , hfinfo ) ; return hfinfo -> name ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_T_t38FaxUdpEC ( 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_t38FaxUdpEC , T_t38FaxUdpEC_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gint nlm_msg_res_matched_equal ( gconstpointer k1 , gconstpointer k2 ) { guint mk1 = GPOINTER_TO_UINT ( k1 ) ; guint mk2 = GPOINTER_TO_UINT ( k2 ) ; return ( mk1 == mk2 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_CloseLogicalChannel ( 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_CloseLogicalChannel , CloseLogicalChannel_sequence ) ; # line 548 "../../asn1/h245/h245.cnf" if ( h245_pi != NULL ) h245_pi -> msg_type = H245_CloseLogChn ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int rds_recvmsg ( struct socket * sock , struct msghdr * msg , size_t size , int msg_flags ) { struct sock * sk = sock -> sk ; struct rds_sock * rs = rds_sk_to_rs ( sk ) ; long timeo ; int ret = 0 , nonblock = msg_flags & MSG_DONTWAIT ; DECLARE_SOCKADDR ( struct sockaddr_in * , sin , msg -> msg_name ) ; struct rds_incoming * inc = NULL ; timeo = sock_rcvtimeo ( sk , nonblock ) ; rdsdebug ( "size %zu flags 0x%x timeo %ld\n" , size , msg_flags , timeo ) ; if ( msg_flags & MSG_OOB ) goto out ; while ( 1 ) { struct iov_iter save ; if ( ! list_empty ( & rs -> rs_notify_queue ) ) { ret = rds_notify_queue_get ( rs , msg ) ; break ; } if ( rs -> rs_cong_notify ) { ret = rds_notify_cong ( rs , msg ) ; break ; } if ( ! rds_next_incoming ( rs , & inc ) ) { if ( nonblock ) { ret = - EAGAIN ; break ; } timeo = wait_event_interruptible_timeout ( * sk_sleep ( sk ) , ( ! list_empty ( & rs -> rs_notify_queue ) || rs -> rs_cong_notify || rds_next_incoming ( rs , & inc ) ) , timeo ) ; rdsdebug ( "recvmsg woke inc %p timeo %ld\n" , inc , timeo ) ; if ( timeo > 0 || timeo == MAX_SCHEDULE_TIMEOUT ) continue ; ret = timeo ; if ( ret == 0 ) ret = - ETIMEDOUT ; break ; } rdsdebug ( "copying inc %p from %pI4:%u to user\n" , inc , & inc -> i_conn -> c_faddr , ntohs ( inc -> i_hdr . h_sport ) ) ; save = msg -> msg_iter ; ret = inc -> i_conn -> c_trans -> inc_copy_to_user ( inc , & msg -> msg_iter ) ; if ( ret < 0 ) break ; if ( ! rds_still_queued ( rs , inc , ! ( msg_flags & MSG_PEEK ) ) ) { rds_inc_put ( inc ) ; inc = NULL ; rds_stats_inc ( s_recv_deliver_raced ) ; msg -> msg_iter = save ; continue ; } if ( ret < be32_to_cpu ( inc -> i_hdr . h_len ) ) { if ( msg_flags & MSG_TRUNC ) ret = be32_to_cpu ( inc -> i_hdr . h_len ) ; msg -> msg_flags |= MSG_TRUNC ; } if ( rds_cmsg_recv ( inc , msg , rs ) ) { ret = - EFAULT ; goto out ; } rds_stats_inc ( s_recv_delivered ) ; if ( sin ) { sin -> sin_family = AF_INET ; sin -> sin_port = inc -> i_hdr . h_sport ; sin -> sin_addr . s_addr = inc -> i_saddr ; memset ( sin -> sin_zero , 0 , sizeof ( sin -> sin_zero ) ) ; msg -> msg_namelen = sizeof ( * sin ) ; } break ; } if ( inc ) rds_inc_put ( inc ) ; out : return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_RegistrationRejectReason ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 691 "./asn1/h225/h225.cnf" gint32 value ; h225_packet_info * h225_pi ; h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ; offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h225_RegistrationRejectReason , RegistrationRejectReason_choice , & value ) ; if ( h225_pi != NULL ) { h225_pi -> reason = value ; } return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int monitor_key_compare ( gconstpointer a , gconstpointer data ) { const Monitor * monitor ; const Monitor * compare_monitor ; monitor = a ; compare_monitor = data ; if ( monitor -> client < compare_monitor -> client ) { return - 1 ; } if ( monitor -> client > compare_monitor -> client ) { return + 1 ; } if ( monitor -> file < compare_monitor -> file ) { return - 1 ; } if ( monitor -> file > compare_monitor -> file ) { return + 1 ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void * create_directory_config ( apr_pool_t * mp , char * path ) { directory_config * dcfg = ( directory_config * ) apr_pcalloc ( mp , sizeof ( directory_config ) ) ; if ( dcfg == NULL ) return NULL ; # ifdef DEBUG_CONF ap_log_perror ( APLOG_MARK , APLOG_STARTUP | APLOG_NOERRNO , 0 , mp , "Created directory config %pp path %s" , dcfg , path ) ; # endif dcfg -> mp = mp ; dcfg -> is_enabled = NOT_SET ; dcfg -> reqbody_access = NOT_SET ; dcfg -> reqintercept_oe = NOT_SET ; dcfg -> reqbody_buffering = NOT_SET ; dcfg -> reqbody_inmemory_limit = NOT_SET ; dcfg -> reqbody_limit = NOT_SET ; dcfg -> reqbody_no_files_limit = NOT_SET ; dcfg -> resbody_access = NOT_SET ; dcfg -> debuglog_name = NOT_SET_P ; dcfg -> debuglog_level = NOT_SET ; dcfg -> debuglog_fd = NOT_SET_P ; dcfg -> of_limit = NOT_SET ; dcfg -> if_limit_action = NOT_SET ; dcfg -> of_limit_action = NOT_SET ; dcfg -> of_mime_types = NOT_SET_P ; dcfg -> of_mime_types_cleared = NOT_SET ; dcfg -> cookie_format = NOT_SET ; dcfg -> argument_separator = NOT_SET ; dcfg -> cookiev0_separator = NOT_SET_P ; dcfg -> rule_inheritance = NOT_SET ; dcfg -> rule_exceptions = apr_array_make ( mp , 16 , sizeof ( rule_exception * ) ) ; dcfg -> hash_method = apr_array_make ( mp , 16 , sizeof ( hash_method * ) ) ; dcfg -> auditlog_flag = NOT_SET ; dcfg -> auditlog_type = NOT_SET ; dcfg -> max_rule_time = NOT_SET ; dcfg -> auditlog_dirperms = NOT_SET ; dcfg -> auditlog_fileperms = NOT_SET ; dcfg -> auditlog_name = NOT_SET_P ; dcfg -> auditlog2_name = NOT_SET_P ; dcfg -> auditlog_fd = NOT_SET_P ; dcfg -> auditlog2_fd = NOT_SET_P ; dcfg -> auditlog_storage_dir = NOT_SET_P ; dcfg -> auditlog_parts = NOT_SET_P ; dcfg -> auditlog_relevant_regex = NOT_SET_P ; dcfg -> ruleset = NULL ; dcfg -> tmp_dir = NOT_SET_P ; dcfg -> upload_dir = NOT_SET_P ; dcfg -> upload_keep_files = NOT_SET ; dcfg -> upload_validates_files = NOT_SET ; dcfg -> upload_filemode = NOT_SET ; dcfg -> upload_file_limit = NOT_SET ; dcfg -> tmp_chain_starter = NULL ; dcfg -> tmp_default_actionset = NULL ; dcfg -> tmp_rule_placeholders = NULL ; dcfg -> data_dir = NOT_SET_P ; dcfg -> webappid = NOT_SET_P ; dcfg -> sensor_id = NOT_SET_P ; dcfg -> httpBlkey = NOT_SET_P ; dcfg -> content_injection_enabled = NOT_SET ; dcfg -> stream_inbody_inspection = NOT_SET ; dcfg -> stream_outbody_inspection = NOT_SET ; dcfg -> geo = NOT_SET_P ; dcfg -> gsb = NOT_SET_P ; dcfg -> u_map = NOT_SET_P ; dcfg -> cache_trans = NOT_SET ; dcfg -> cache_trans_incremental = NOT_SET ; dcfg -> cache_trans_min = NOT_SET ; dcfg -> cache_trans_max = NOT_SET ; dcfg -> cache_trans_maxitems = NOT_SET ; dcfg -> rule_id_htab = apr_hash_make ( mp ) ; dcfg -> component_signatures = apr_array_make ( mp , 16 , sizeof ( char * ) ) ; dcfg -> request_encoding = NOT_SET_P ; dcfg -> disable_backend_compression = NOT_SET ; dcfg -> col_timeout = NOT_SET ; dcfg -> crypto_key = NOT_SET_P ; dcfg -> crypto_key_len = NOT_SET ; dcfg -> crypto_key_add = NOT_SET ; dcfg -> crypto_param_name = NOT_SET_P ; dcfg -> hash_is_enabled = NOT_SET ; dcfg -> hash_enforcement = NOT_SET ; dcfg -> crypto_hash_href_rx = NOT_SET ; dcfg -> crypto_hash_faction_rx = NOT_SET ; dcfg -> crypto_hash_location_rx = NOT_SET ; dcfg -> crypto_hash_iframesrc_rx = NOT_SET ; dcfg -> crypto_hash_framesrc_rx = NOT_SET ; dcfg -> crypto_hash_href_pm = NOT_SET ; dcfg -> crypto_hash_faction_pm = NOT_SET ; dcfg -> crypto_hash_location_pm = NOT_SET ; dcfg -> crypto_hash_iframesrc_pm = NOT_SET ; dcfg -> crypto_hash_framesrc_pm = NOT_SET ; return dcfg ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static UBool action_setRunsOnly ( UBiDiTransform * pTransform , UErrorCode * pErrorCode ) { ( void ) pErrorCode ; ubidi_setReorderingMode ( pTransform -> pBidi , UBIDI_REORDER_RUNS_ONLY ) ; return FALSE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static vpx_codec_err_t ctrl_set_arnr_max_frames ( vpx_codec_alg_priv_t * ctx , va_list args ) { struct vp9_extracfg extra_cfg = ctx -> extra_cfg ; extra_cfg . arnr_max_frames = CAST ( VP8E_SET_ARNR_MAXFRAMES , args ) ; return update_extra_cfg ( ctx , & extra_cfg ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_usb_video_camera_terminal ( proto_tree * tree , tvbuff_t * tvb , int offset ) { static const int * control_bits [ ] = { & hf_usb_vid_cam_control_D [ 0 ] , & hf_usb_vid_cam_control_D [ 1 ] , & hf_usb_vid_cam_control_D [ 2 ] , & hf_usb_vid_cam_control_D [ 3 ] , & hf_usb_vid_cam_control_D [ 4 ] , & hf_usb_vid_cam_control_D [ 5 ] , & hf_usb_vid_cam_control_D [ 6 ] , & hf_usb_vid_cam_control_D [ 7 ] , & hf_usb_vid_cam_control_D [ 8 ] , & hf_usb_vid_cam_control_D [ 9 ] , & hf_usb_vid_cam_control_D [ 10 ] , & hf_usb_vid_cam_control_D [ 11 ] , & hf_usb_vid_cam_control_D [ 12 ] , & hf_usb_vid_cam_control_D [ 13 ] , & hf_usb_vid_cam_control_D [ 14 ] , & hf_usb_vid_cam_control_D [ 15 ] , & hf_usb_vid_cam_control_D [ 16 ] , & hf_usb_vid_cam_control_D [ 17 ] , & hf_usb_vid_cam_control_D [ 18 ] , & hf_usb_vid_cam_control_D [ 19 ] , & hf_usb_vid_cam_control_D [ 20 ] , & hf_usb_vid_cam_control_D [ 21 ] , NULL } ; DISSECTOR_ASSERT ( array_length ( control_bits ) == ( 1 + array_length ( hf_usb_vid_cam_control_D ) ) ) ; proto_tree_add_item ( tree , hf_usb_vid_cam_objective_focal_len_min , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ; offset += 2 ; proto_tree_add_item ( tree , hf_usb_vid_cam_objective_focal_len_max , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ; offset += 2 ; proto_tree_add_item ( tree , hf_usb_vid_cam_ocular_focal_len , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ; offset += 2 ; offset = dissect_bmControl ( tree , tvb , offset , ett_camera_controls , control_bits ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dtap_cc_call_proceed ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) { guint32 curr_offset ; guint32 consumed ; guint curr_len ; curr_offset = offset ; curr_len = len ; is_uplink = IS_UPLINK_FALSE ; ELEM_OPT_TV_SHORT ( 0xd0 , GSM_A_PDU_TYPE_DTAP , DE_REPEAT_IND , " BC repeat indicator" ) ; ELEM_OPT_TLV ( 0x04 , GSM_A_PDU_TYPE_DTAP , DE_BEARER_CAP , " 1" ) ; ELEM_OPT_TLV ( 0x04 , GSM_A_PDU_TYPE_DTAP , DE_BEARER_CAP , " 2" ) ; ELEM_OPT_TLV ( 0x1c , GSM_A_PDU_TYPE_DTAP , DE_FACILITY , NULL ) ; ELEM_OPT_TLV ( 0x1e , GSM_A_PDU_TYPE_DTAP , DE_PROG_IND , NULL ) ; ELEM_OPT_TV_SHORT ( 0x80 , GSM_A_PDU_TYPE_COMMON , DE_PRIO , NULL ) ; ELEM_OPT_TLV ( 0x2f , GSM_A_PDU_TYPE_DTAP , DE_NET_CC_CAP , NULL ) ; EXTRANEOUS_DATA_CHECK ( curr_len , 0 , pinfo , & ei_gsm_a_dtap_extraneous_data ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void hmac_md5 ( const char * password , char * challenge , unsigned char * response ) { struct Md5Ctx ctx ; unsigned char ipad [ MD5_BLOCK_LEN ] = { 0 } ; unsigned char opad [ MD5_BLOCK_LEN ] = { 0 } ; unsigned char secret [ MD5_BLOCK_LEN + 1 ] ; size_t secret_len ; secret_len = strlen ( password ) ; if ( secret_len > MD5_BLOCK_LEN ) { unsigned char hash_passwd [ MD5_DIGEST_LEN ] ; mutt_md5_bytes ( password , secret_len , hash_passwd ) ; mutt_str_strfcpy ( ( char * ) secret , ( char * ) hash_passwd , MD5_DIGEST_LEN ) ; secret_len = MD5_DIGEST_LEN ; } else mutt_str_strfcpy ( ( char * ) secret , password , sizeof ( secret ) ) ; memcpy ( ipad , secret , secret_len ) ; memcpy ( opad , secret , secret_len ) ; for ( int i = 0 ; i < MD5_BLOCK_LEN ; i ++ ) { ipad [ i ] ^= 0x36 ; opad [ i ] ^= 0x5c ; } mutt_md5_init_ctx ( & ctx ) ; mutt_md5_process_bytes ( ipad , MD5_BLOCK_LEN , & ctx ) ; mutt_md5_process ( challenge , & ctx ) ; mutt_md5_finish_ctx ( & ctx , response ) ; mutt_md5_init_ctx ( & ctx ) ; mutt_md5_process_bytes ( opad , MD5_BLOCK_LEN , & ctx ) ; mutt_md5_process_bytes ( response , MD5_DIGEST_LEN , & ctx ) ; mutt_md5_finish_ctx ( & ctx , response ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_select_version ( ) { MYSQL_STMT * stmt ; int rc ; myheader ( "test_select_version" ) ; stmt = mysql_simple_prepare ( mysql , "SELECT @@version" ) ; check_stmt ( stmt ) ; verify_param_count ( stmt , 0 ) ; rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; my_process_stmt_result ( stmt ) ; mysql_stmt_close ( stmt ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_bug58036 ( ) { MYSQL * conn ; DBUG_ENTER ( "test_bug47485" ) ; myheader ( "test_bug58036" ) ; conn = mysql_client_init ( NULL ) ; mysql_options ( conn , MYSQL_SET_CHARSET_NAME , "ucs2" ) ; if ( mysql_real_connect ( conn , opt_host , opt_user , opt_password , opt_db ? opt_db : "test" , opt_port , opt_unix_socket , 0 ) ) { if ( ! opt_silent ) printf ( "mysql_real_connect() succeeded (failure expected)\n" ) ; mysql_close ( conn ) ; DIE ( "" ) ; } if ( ! opt_silent ) printf ( "Got mysql_real_connect() error (expected): %s (%d)\n" , mysql_error ( conn ) , mysql_errno ( conn ) ) ; DIE_UNLESS ( mysql_errno ( conn ) == ER_WRONG_VALUE_FOR_VAR ) ; mysql_close ( conn ) ; conn = mysql_client_init ( NULL ) ; mysql_options ( conn , MYSQL_SET_CHARSET_NAME , "latin1" ) ; if ( ! mysql_real_connect ( conn , opt_host , opt_user , opt_password , opt_db ? opt_db : "test" , opt_port , opt_unix_socket , 0 ) ) { if ( ! opt_silent ) printf ( "mysql_real_connect() failed: %s (%d)\n" , mysql_error ( conn ) , mysql_errno ( conn ) ) ; mysql_close ( conn ) ; DIE ( "" ) ; } mysql_options ( conn , MYSQL_SET_CHARSET_NAME , "ucs2" ) ; if ( ! mysql_change_user ( conn , opt_user , opt_password , NULL ) ) { if ( ! opt_silent ) printf ( "mysql_change_user() succedded, error expected!" ) ; mysql_close ( conn ) ; DIE ( "" ) ; } if ( ! opt_silent ) printf ( "Got mysql_change_user() error (expected): %s (%d)\n" , mysql_error ( conn ) , mysql_errno ( conn ) ) ; mysql_close ( conn ) ; DBUG_VOID_RETURN ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int zend_is_callable_check_func ( int check_flags , zval * callable , zend_fcall_info_cache * fcc , int strict_class , char * * error TSRMLS_DC ) { zend_class_entry * ce_org = fcc -> calling_scope ; int retval = 0 ; char * mname , * lmname ; const char * colon ; int clen , mlen ; zend_class_entry * last_scope ; HashTable * ftable ; int call_via_handler = 0 ; if ( error ) { * error = NULL ; } fcc -> calling_scope = NULL ; fcc -> function_handler = NULL ; if ( ! ce_org ) { if ( Z_STRVAL_P ( callable ) [ 0 ] == '\\' ) { mlen = Z_STRLEN_P ( callable ) - 1 ; lmname = zend_str_tolower_dup ( Z_STRVAL_P ( callable ) + 1 , mlen ) ; } else { mlen = Z_STRLEN_P ( callable ) ; lmname = zend_str_tolower_dup ( Z_STRVAL_P ( callable ) , mlen ) ; } if ( zend_hash_find ( EG ( function_table ) , lmname , mlen + 1 , ( void * * ) & fcc -> function_handler ) == SUCCESS ) { efree ( lmname ) ; return 1 ; } efree ( lmname ) ; } if ( ( colon = zend_memrchr ( Z_STRVAL_P ( callable ) , ':' , Z_STRLEN_P ( callable ) ) ) != NULL && colon > Z_STRVAL_P ( callable ) && * ( colon - 1 ) == ':' ) { colon -- ; clen = colon - Z_STRVAL_P ( callable ) ; mlen = Z_STRLEN_P ( callable ) - clen - 2 ; if ( colon == Z_STRVAL_P ( callable ) ) { if ( error ) zend_spprintf ( error , 0 , "invalid function name" ) ; return 0 ; } last_scope = EG ( scope ) ; if ( ce_org ) { EG ( scope ) = ce_org ; } if ( ! zend_is_callable_check_class ( Z_STRVAL_P ( callable ) , clen , fcc , & strict_class , error TSRMLS_CC ) ) { EG ( scope ) = last_scope ; return 0 ; } EG ( scope ) = last_scope ; ftable = & fcc -> calling_scope -> function_table ; if ( ce_org && ! instanceof_function ( ce_org , fcc -> calling_scope TSRMLS_CC ) ) { if ( error ) zend_spprintf ( error , 0 , "class '%s' is not a subclass of '%s'" , ce_org -> name , fcc -> calling_scope -> name ) ; return 0 ; } mname = Z_STRVAL_P ( callable ) + clen + 2 ; } else if ( ce_org ) { mlen = Z_STRLEN_P ( callable ) ; mname = Z_STRVAL_P ( callable ) ; ftable = & ce_org -> function_table ; fcc -> calling_scope = ce_org ; } else { if ( error && ! ( check_flags & IS_CALLABLE_CHECK_SILENT ) ) { zend_spprintf ( error , 0 , "function '%s' not found or invalid function name" , Z_STRVAL_P ( callable ) ) ; } return 0 ; } lmname = zend_str_tolower_dup ( mname , mlen ) ; if ( strict_class && fcc -> calling_scope && mlen == sizeof ( ZEND_CONSTRUCTOR_FUNC_NAME ) - 1 && ! memcmp ( lmname , ZEND_CONSTRUCTOR_FUNC_NAME , sizeof ( ZEND_CONSTRUCTOR_FUNC_NAME ) - 1 ) ) { fcc -> function_handler = fcc -> calling_scope -> constructor ; if ( fcc -> function_handler ) { retval = 1 ; } } else if ( zend_hash_find ( ftable , lmname , mlen + 1 , ( void * * ) & fcc -> function_handler ) == SUCCESS ) { retval = 1 ; if ( ( fcc -> function_handler -> op_array . fn_flags & ZEND_ACC_CHANGED ) && ! strict_class && EG ( scope ) && instanceof_function ( fcc -> function_handler -> common . scope , EG ( scope ) TSRMLS_CC ) ) { zend_function * priv_fbc ; if ( zend_hash_find ( & EG ( scope ) -> function_table , lmname , mlen + 1 , ( void * * ) & priv_fbc ) == SUCCESS && priv_fbc -> common . fn_flags & ZEND_ACC_PRIVATE && priv_fbc -> common . scope == EG ( scope ) ) { fcc -> function_handler = priv_fbc ; } } if ( ( check_flags & IS_CALLABLE_CHECK_NO_ACCESS ) == 0 && ( fcc -> calling_scope && ( ( fcc -> object_ptr && fcc -> calling_scope -> __call ) || ( ! fcc -> object_ptr && fcc -> calling_scope -> __callstatic ) ) ) ) { if ( fcc -> function_handler -> op_array . fn_flags & ZEND_ACC_PRIVATE ) { if ( ! zend_check_private ( fcc -> function_handler , fcc -> object_ptr ? Z_OBJCE_P ( fcc -> object_ptr ) : EG ( scope ) , lmname , mlen TSRMLS_CC ) ) { retval = 0 ; fcc -> function_handler = NULL ; goto get_function_via_handler ; } } else if ( fcc -> function_handler -> common . fn_flags & ZEND_ACC_PROTECTED ) { if ( ! zend_check_protected ( fcc -> function_handler -> common . scope , EG ( scope ) ) ) { retval = 0 ; fcc -> function_handler = NULL ; goto get_function_via_handler ; } } } } else { get_function_via_handler : if ( fcc -> object_ptr && fcc -> calling_scope == ce_org ) { if ( strict_class && ce_org -> __call ) { fcc -> function_handler = emalloc ( sizeof ( zend_internal_function ) ) ; fcc -> function_handler -> internal_function . type = ZEND_INTERNAL_FUNCTION ; fcc -> function_handler -> internal_function . module = ( ce_org -> type == ZEND_INTERNAL_CLASS ) ? ce_org -> info . internal . module : NULL ; fcc -> function_handler -> internal_function . handler = zend_std_call_user_call ; fcc -> function_handler -> internal_function . arg_info = NULL ; fcc -> function_handler -> internal_function . num_args = 0 ; fcc -> function_handler -> internal_function . scope = ce_org ; fcc -> function_handler -> internal_function . fn_flags = ZEND_ACC_CALL_VIA_HANDLER ; fcc -> function_handler -> internal_function . function_name = estrndup ( mname , mlen ) ; call_via_handler = 1 ; retval = 1 ; } else if ( Z_OBJ_HT_P ( fcc -> object_ptr ) -> get_method ) { fcc -> function_handler = Z_OBJ_HT_P ( fcc -> object_ptr ) -> get_method ( & fcc -> object_ptr , mname , mlen , NULL TSRMLS_CC ) ; if ( fcc -> function_handler ) { if ( strict_class && ( ! fcc -> function_handler -> common . scope || ! instanceof_function ( ce_org , fcc -> function_handler -> common . scope TSRMLS_CC ) ) ) { if ( ( fcc -> function_handler -> common . fn_flags & ZEND_ACC_CALL_VIA_HANDLER ) != 0 ) { if ( fcc -> function_handler -> type != ZEND_OVERLOADED_FUNCTION ) { efree ( ( char * ) fcc -> function_handler -> common . function_name ) ; } efree ( fcc -> function_handler ) ; } } else { retval = 1 ; call_via_handler = ( fcc -> function_handler -> common . fn_flags & ZEND_ACC_CALL_VIA_HANDLER ) != 0 ; } } } } else if ( fcc -> calling_scope ) { if ( fcc -> calling_scope -> get_static_method ) { fcc -> function_handler = fcc -> calling_scope -> get_static_method ( fcc -> calling_scope , mname , mlen TSRMLS_CC ) ; } else { fcc -> function_handler = zend_std_get_static_method ( fcc -> calling_scope , mname , mlen , NULL TSRMLS_CC ) ; } if ( fcc -> function_handler ) { retval = 1 ; call_via_handler = ( fcc -> function_handler -> common . fn_flags & ZEND_ACC_CALL_VIA_HANDLER ) != 0 ; if ( call_via_handler && ! fcc -> object_ptr && EG ( This ) && Z_OBJ_HT_P ( EG ( This ) ) -> get_class_entry && instanceof_function ( Z_OBJCE_P ( EG ( This ) ) , fcc -> calling_scope TSRMLS_CC ) ) { fcc -> object_ptr = EG ( This ) ; } } } } if ( retval ) { if ( fcc -> calling_scope && ! call_via_handler ) { if ( ! fcc -> object_ptr && ( fcc -> function_handler -> common . fn_flags & ZEND_ACC_ABSTRACT ) ) { if ( error ) { zend_spprintf ( error , 0 , "cannot call abstract method %s::%s()" , fcc -> calling_scope -> name , fcc -> function_handler -> common . function_name ) ; retval = 0 ; } else { zend_error ( E_ERROR , "Cannot call abstract method %s::%s()" , fcc -> calling_scope -> name , fcc -> function_handler -> common . function_name ) ; } } else if ( ! fcc -> object_ptr && ! ( fcc -> function_handler -> common . fn_flags & ZEND_ACC_STATIC ) ) { int severity ; char * verb ; if ( fcc -> function_handler -> common . fn_flags & ZEND_ACC_ALLOW_STATIC ) { severity = E_STRICT ; verb = "should not" ; } else { severity = E_ERROR ; verb = "cannot" ; } if ( ( check_flags & IS_CALLABLE_CHECK_IS_STATIC ) != 0 ) { retval = 0 ; } if ( EG ( This ) && instanceof_function ( Z_OBJCE_P ( EG ( This ) ) , fcc -> calling_scope TSRMLS_CC ) ) { fcc -> object_ptr = EG ( This ) ; if ( error ) { zend_spprintf ( error , 0 , "non-static method %s::%s() %s be called statically, assuming $this from compatible context %s" , fcc -> calling_scope -> name , fcc -> function_handler -> common . function_name , verb , Z_OBJCE_P ( EG ( This ) ) -> name ) ; if ( severity == E_ERROR ) { retval = 0 ; } } else if ( retval ) { zend_error ( severity , "Non-static method %s::%s() %s be called statically, assuming $this from compatible context %s" , fcc -> calling_scope -> name , fcc -> function_handler -> common . function_name , verb , Z_OBJCE_P ( EG ( This ) ) -> name ) ; } } else { if ( error ) { zend_spprintf ( error , 0 , "non-static method %s::%s() %s be called statically" , fcc -> calling_scope -> name , fcc -> function_handler -> common . function_name , verb ) ; if ( severity == E_ERROR ) { retval = 0 ; } } else if ( retval ) { zend_error ( severity , "Non-static method %s::%s() %s be called statically" , fcc -> calling_scope -> name , fcc -> function_handler -> common . function_name , verb ) ; } } } if ( retval && ( check_flags & IS_CALLABLE_CHECK_NO_ACCESS ) == 0 ) { if ( fcc -> function_handler -> op_array . fn_flags & ZEND_ACC_PRIVATE ) { if ( ! zend_check_private ( fcc -> function_handler , fcc -> object_ptr ? Z_OBJCE_P ( fcc -> object_ptr ) : EG ( scope ) , lmname , mlen TSRMLS_CC ) ) { if ( error ) { if ( * error ) { efree ( * error ) ; } zend_spprintf ( error , 0 , "cannot access private method %s::%s()" , fcc -> calling_scope -> name , fcc -> function_handler -> common . function_name ) ; } retval = 0 ; } } else if ( ( fcc -> function_handler -> common . fn_flags & ZEND_ACC_PROTECTED ) ) { if ( ! zend_check_protected ( fcc -> function_handler -> common . scope , EG ( scope ) ) ) { if ( error ) { if ( * error ) { efree ( * error ) ; } zend_spprintf ( error , 0 , "cannot access protected method %s::%s()" , fcc -> calling_scope -> name , fcc -> function_handler -> common . function_name ) ; } retval = 0 ; } } } } } else if ( error && ! ( check_flags & IS_CALLABLE_CHECK_SILENT ) ) { if ( fcc -> calling_scope ) { if ( error ) zend_spprintf ( error , 0 , "class '%s' does not have a method '%s'" , fcc -> calling_scope -> name , mname ) ; } else { if ( error ) zend_spprintf ( error , 0 , "function '%s' does not exist" , mname ) ; } } efree ( lmname ) ; if ( fcc -> object_ptr ) { fcc -> called_scope = Z_OBJCE_P ( fcc -> object_ptr ) ; } if ( retval ) { fcc -> initialized = 1 ; } return retval ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void handle_chap ( netdissect_options * ndo , const u_char * p , int length ) { u_int code , len ; int val_size , name_size , msg_size ; const u_char * p0 ; int i ; p0 = p ; if ( length < 1 ) { ND_PRINT ( ( ndo , "[|chap]" ) ) ; return ; } else if ( length < 4 ) { ND_TCHECK ( * p ) ; ND_PRINT ( ( ndo , "[|chap 0x%02x]" , * p ) ) ; return ; } ND_TCHECK ( * p ) ; code = * p ; ND_PRINT ( ( ndo , "CHAP, %s (0x%02x)" , tok2str ( chapcode_values , "unknown" , code ) , code ) ) ; p ++ ; ND_TCHECK ( * p ) ; ND_PRINT ( ( ndo , ", id %u" , * p ) ) ; p ++ ; ND_TCHECK2 ( * p , 2 ) ; len = EXTRACT_16BITS ( p ) ; p += 2 ; switch ( code ) { case CHAP_CHAL : case CHAP_RESP : if ( length - ( p - p0 ) < 1 ) return ; ND_TCHECK ( * p ) ; val_size = * p ; p ++ ; if ( length - ( p - p0 ) < val_size ) return ; ND_PRINT ( ( ndo , ", Value " ) ) ; for ( i = 0 ; i < val_size ; i ++ ) { ND_TCHECK ( * p ) ; ND_PRINT ( ( ndo , "%02x" , * p ++ ) ) ; } name_size = len - ( p - p0 ) ; ND_PRINT ( ( ndo , ", Name " ) ) ; for ( i = 0 ; i < name_size ; i ++ ) { ND_TCHECK ( * p ) ; safeputchar ( ndo , * p ++ ) ; } break ; case CHAP_SUCC : case CHAP_FAIL : msg_size = len - ( p - p0 ) ; ND_PRINT ( ( ndo , ", Msg " ) ) ; for ( i = 0 ; i < msg_size ; i ++ ) { ND_TCHECK ( * p ) ; safeputchar ( ndo , * p ++ ) ; } break ; } return ; trunc : ND_PRINT ( ( ndo , "[|chap]" ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void vmsvga_update_rect_delayed ( struct vmsvga_state_s * s , int x , int y , int w , int h ) { struct vmsvga_rect_s * rect = & s -> redraw_fifo [ s -> redraw_fifo_last ++ ] ; s -> redraw_fifo_last &= REDRAW_FIFO_LEN - 1 ; rect -> x = x ; rect -> y = y ; rect -> w = w ; rect -> h = h ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int TS_X509_ALGOR_print_bio ( BIO * bio , const X509_ALGOR * alg ) { int i = OBJ_obj2nid ( alg -> algorithm ) ; return BIO_printf ( bio , "Hash Algorithm: %s\n" , ( i == NID_undef ) ? "UNKNOWN" : OBJ_nid2ln ( i ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void nautilus_file_invalidate_count_and_mime_list ( NautilusFile * file ) { NautilusFileAttributes attributes ; attributes = NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_COUNT | NAUTILUS_FILE_ATTRIBUTE_DIRECTORY_ITEM_MIME_TYPES ; nautilus_file_invalidate_attributes ( file , attributes ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_CPMFetchValue ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * parent_tree , gboolean in , void * data _U_ ) { gint offset = 16 ; proto_item * item ; proto_tree * tree , * pad_tree ; col_append_str ( pinfo -> cinfo , COL_INFO , "FetchValue" ) ; item = proto_tree_add_item ( parent_tree , hf_mswsp_msg , tvb , offset , - 1 , ENC_NA ) ; tree = proto_tree_add_subtree_format ( parent_tree , tvb , offset , 0 , ett_mswsp_msg , & item , "FetchValue%s" , in ? "In" : "Out" ) ; pad_tree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_mswsp_pad , NULL , "Padding" ) ; if ( in ) { struct CFullPropSpec prop ; proto_tree_add_item ( tree , hf_mswsp_msg_cpmfetchvalue_wid , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ; offset += 4 ; proto_tree_add_item ( tree , hf_mswsp_msg_cpmfetchvalue_cbsofar , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ; offset += 4 ; proto_tree_add_item ( tree , hf_mswsp_msg_cpmfetchvalue_cbpropspec , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ; offset += 4 ; proto_tree_add_item ( tree , hf_mswsp_msg_cpmfetchvalue_cbchunk , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ; offset += 4 ; offset = parse_CFullPropSpec ( tvb , offset , tree , pad_tree , & prop , "PropSpec" ) ; parse_padding ( tvb , offset , 4 , pad_tree , "_padding" ) ; } else { guint32 cbValue = tvb_get_letohl ( tvb , offset ) ; proto_tree_add_item ( tree , hf_mswsp_msg_cpmfetchvalue_cbvalue , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ; offset += 4 ; proto_tree_add_item ( tree , hf_mswsp_msg_cpmfetchvalue_fmoreexists , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ; offset += 4 ; proto_tree_add_item ( tree , hf_mswsp_msg_cpmfetchvalue_fvalueexists , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ; offset += 4 ; proto_tree_add_item ( tree , hf_mswsp_msg_cpmfetchvalue_vvalue , tvb , offset , cbValue , ENC_NA ) ; } return tvb_reported_length ( tvb ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
float clamp_float ( float a ) { if ( a > 1. ) return 1. ; else if ( a >= 0 ) return a ; else return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int dissect_ber_tagged_type ( gboolean implicit_tag , asn1_ctx_t * actx , proto_tree * tree , tvbuff_t * tvb , int offset , gint hf_id , gint8 tag_cls , gint32 tag_tag , gboolean tag_impl , ber_type_fn type ) { gint8 tmp_cls ; gint32 tmp_tag ; guint32 tmp_len ; tvbuff_t * next_tvb = tvb ; proto_item * cause ; # ifdef DEBUG_BER { const char * name ; header_field_info * hfinfo ; if ( hf_id >= 0 ) { hfinfo = proto_registrar_get_nth ( hf_id ) ; name = hfinfo -> name ; } else { name = "unnamed" ; } if ( tvb_reported_length_remaining ( tvb , offset ) > 3 ) { printf ( "dissect_ber_tagged_type(%s) entered implicit_tag:%d offset:%d len:%d %02x:%02x:%02x\n" , name , implicit_tag , offset , tvb_reported_length_remaining ( tvb , offset ) , tvb_get_guint8 ( tvb , offset ) , tvb_get_guint8 ( tvb , offset + 1 ) , tvb_get_guint8 ( tvb , offset + 2 ) ) ; } else { printf ( "dissect_ber_tagged_type(%s) entered\n" , name ) ; } } # endif if ( implicit_tag ) { offset = type ( tag_impl , tvb , offset , actx , tree , hf_id ) ; return offset ; } offset = dissect_ber_identifier ( actx -> pinfo , tree , tvb , offset , & tmp_cls , NULL , & tmp_tag ) ; offset = dissect_ber_length ( actx -> pinfo , tree , tvb , offset , & tmp_len , NULL ) ; if ( ( tmp_cls != tag_cls ) || ( tmp_tag != tag_tag ) ) { cause = proto_tree_add_string_format_value ( tree , hf_ber_error , tvb , offset , tmp_len , "wrong_tag" , "Wrong tag in tagged type - expected class:%s(%d) tag:%d (%s) but found class:%s(%d) tag:%d" , val_to_str_const ( tag_cls , ber_class_codes , "Unknown" ) , tag_cls , tag_tag , val_to_str_ext_const ( tag_tag , & ber_uni_tag_codes_ext , "Unknown" ) , val_to_str_const ( tmp_cls , ber_class_codes , "Unknown" ) , tmp_cls , tmp_tag ) ; expert_add_info ( actx -> pinfo , cause , & ei_ber_wrong_tag_in_tagged_type ) ; } if ( tag_impl ) { next_tvb = ber_tvb_new_subset_length ( tvb , offset , tmp_len ) ; type ( tag_impl , next_tvb , 0 , actx , tree , hf_id ) ; offset += tmp_len ; } else { offset = type ( tag_impl , tvb , offset , actx , tree , hf_id ) ; } return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void PNGAPI png_set_PLTE ( png_structp png_ptr , png_infop info_ptr , png_colorp palette , int num_palette ) { png_uint_32 max_palette_length ; png_debug1 ( 1 , "in %s storage function" , "PLTE" ) ; if ( png_ptr == NULL || info_ptr == NULL ) return ; max_palette_length = ( info_ptr -> color_type == PNG_COLOR_TYPE_PALETTE ) ? ( 1 << info_ptr -> bit_depth ) : PNG_MAX_PALETTE_LENGTH ; if ( num_palette < 0 || num_palette > ( int ) max_palette_length ) { if ( info_ptr -> color_type == PNG_COLOR_TYPE_PALETTE ) png_error ( png_ptr , "Invalid palette length" ) ; else { png_warning ( png_ptr , "Invalid palette length" ) ; return ; } } # ifdef PNG_FREE_ME_SUPPORTED png_free_data ( png_ptr , info_ptr , PNG_FREE_PLTE , 0 ) ; # endif png_ptr -> palette = ( png_colorp ) png_calloc ( png_ptr , PNG_MAX_PALETTE_LENGTH * png_sizeof ( png_color ) ) ; png_memcpy ( png_ptr -> palette , palette , num_palette * png_sizeof ( png_color ) ) ; info_ptr -> palette = png_ptr -> palette ; info_ptr -> num_palette = png_ptr -> num_palette = ( png_uint_16 ) num_palette ; # ifdef PNG_FREE_ME_SUPPORTED info_ptr -> free_me |= PNG_FREE_PLTE ; # else png_ptr -> flags |= PNG_FLAG_FREE_PLTE ; # endif info_ptr -> valid |= PNG_INFO_PLTE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void rfbSetServerVersionIdentity ( rfbScreenInfoPtr screen , char * fmt , ... ) { char buffer [ 256 ] ; va_list ap ; va_start ( ap , fmt ) ; vsnprintf ( buffer , sizeof ( buffer ) - 1 , fmt , ap ) ; va_end ( ap ) ; if ( screen -> versionString != NULL ) free ( screen -> versionString ) ; screen -> versionString = strdup ( buffer ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
SPL_METHOD ( SplFileObject , getCsvControl ) { spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; char delimiter [ 2 ] , enclosure [ 2 ] ; array_init ( return_value ) ; delimiter [ 0 ] = intern -> u . file . delimiter ; delimiter [ 1 ] = '\0' ; enclosure [ 0 ] = intern -> u . file . enclosure ; enclosure [ 1 ] = '\0' ; add_next_index_string ( return_value , delimiter , 1 ) ; add_next_index_string ( return_value , enclosure , 1 ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( FastUnloadTest , DISABLED_WindowCloseFinishesUnload ) { NavigateToPage ( "no_listeners" ) ; EXPECT_EQ ( "unloaded=ohyeah" , GetCookies ( "no_listeners" ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int receive_header ( VirtIONet * n , struct iovec * iov , int iovcnt , const void * buf , size_t size , size_t hdr_len ) { struct virtio_net_hdr * hdr = ( struct virtio_net_hdr * ) iov [ 0 ] . iov_base ; int offset = 0 ; hdr -> flags = 0 ; hdr -> gso_type = VIRTIO_NET_HDR_GSO_NONE ; if ( n -> has_vnet_hdr ) { memcpy ( hdr , buf , sizeof ( * hdr ) ) ; offset = sizeof ( * hdr ) ; work_around_broken_dhclient ( hdr , buf + offset , size - offset ) ; } iov [ 0 ] . iov_base += hdr_len ; iov [ 0 ] . iov_len -= hdr_len ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int get_func_nargs ( Oid funcid ) { HeapTuple tp ; int result ; tp = SearchSysCache1 ( PROCOID , ObjectIdGetDatum ( funcid ) ) ; if ( ! HeapTupleIsValid ( tp ) ) elog ( ERROR , "cache lookup failed for function %u" , funcid ) ; result = ( ( Form_pg_proc ) GETSTRUCT ( tp ) ) -> pronargs ; ReleaseSysCache ( tp ) ; return result ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void openpic_cpu_write ( void * opaque , hwaddr addr , uint64_t val , unsigned len ) { openpic_cpu_write_internal ( opaque , addr , val , ( addr & 0x1f000 ) >> 12 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int jas_image_sampcmpt ( jas_image_t * image , int cmptno , int newcmptno , jas_image_coord_t ho , jas_image_coord_t vo , jas_image_coord_t hs , jas_image_coord_t vs , int sgnd , int prec ) { jas_image_cmpt_t * oldcmpt ; jas_image_cmpt_t * newcmpt ; int width ; int height ; jas_image_coord_t tlx ; jas_image_coord_t tly ; jas_image_coord_t brx ; jas_image_coord_t bry ; int i ; int j ; jas_image_cmptparm_t cmptparm ; jas_image_coord_t ax ; jas_image_coord_t ay ; jas_image_coord_t bx ; jas_image_coord_t by ; jas_image_coord_t d0 ; jas_image_coord_t d1 ; jas_image_coord_t d2 ; jas_image_coord_t d3 ; jas_image_coord_t oldx ; jas_image_coord_t oldy ; jas_image_coord_t x ; jas_image_coord_t y ; long v ; jas_image_coord_t cmptbrx ; jas_image_coord_t cmptbry ; assert ( cmptno >= 0 && cmptno < image -> numcmpts_ ) ; oldcmpt = image -> cmpts_ [ cmptno ] ; assert ( oldcmpt -> tlx_ == 0 && oldcmpt -> tly_ == 0 ) ; jas_image_calcbbox2 ( image , & tlx , & tly , & brx , & bry ) ; width = FLOORDIV ( brx - ho + hs , hs ) ; height = FLOORDIV ( bry - vo + vs , vs ) ; cmptparm . tlx = ho ; cmptparm . tly = vo ; cmptparm . hstep = hs ; cmptparm . vstep = vs ; cmptparm . width = width ; cmptparm . height = height ; cmptparm . prec = prec ; cmptparm . sgnd = sgnd ; if ( jas_image_addcmpt ( image , newcmptno , & cmptparm ) ) goto error ; cmptbrx = oldcmpt -> tlx_ + ( oldcmpt -> width_ - 1 ) * oldcmpt -> hstep_ ; cmptbry = oldcmpt -> tly_ + ( oldcmpt -> height_ - 1 ) * oldcmpt -> vstep_ ; newcmpt = image -> cmpts_ [ newcmptno ] ; jas_stream_rewind ( newcmpt -> stream_ ) ; for ( i = 0 ; i < height ; ++ i ) { y = newcmpt -> tly_ + newcmpt -> vstep_ * i ; for ( j = 0 ; j < width ; ++ j ) { x = newcmpt -> tlx_ + newcmpt -> hstep_ * j ; ax = downtomult ( x - oldcmpt -> tlx_ , oldcmpt -> hstep_ ) + oldcmpt -> tlx_ ; ay = downtomult ( y - oldcmpt -> tly_ , oldcmpt -> vstep_ ) + oldcmpt -> tly_ ; bx = uptomult ( x - oldcmpt -> tlx_ , oldcmpt -> hstep_ ) + oldcmpt -> tlx_ ; if ( bx > cmptbrx ) bx = cmptbrx ; by = uptomult ( y - oldcmpt -> tly_ , oldcmpt -> vstep_ ) + oldcmpt -> tly_ ; if ( by > cmptbry ) by = cmptbry ; d0 = ( ax - x ) * ( ax - x ) + ( ay - y ) * ( ay - y ) ; d1 = ( bx - x ) * ( bx - x ) + ( ay - y ) * ( ay - y ) ; d2 = ( bx - x ) * ( bx - x ) + ( by - y ) * ( by - y ) ; d3 = ( ax - x ) * ( ax - x ) + ( by - y ) * ( by - y ) ; if ( d0 <= d1 && d0 <= d2 && d0 <= d3 ) { oldx = ( ax - oldcmpt -> tlx_ ) / oldcmpt -> hstep_ ; oldy = ( ay - oldcmpt -> tly_ ) / oldcmpt -> vstep_ ; } else if ( d1 <= d0 && d1 <= d2 && d1 <= d3 ) { oldx = ( bx - oldcmpt -> tlx_ ) / oldcmpt -> hstep_ ; oldy = ( ay - oldcmpt -> tly_ ) / oldcmpt -> vstep_ ; } else if ( d2 <= d0 && d2 <= d1 && d1 <= d3 ) { oldx = ( bx - oldcmpt -> tlx_ ) / oldcmpt -> hstep_ ; oldy = ( by - oldcmpt -> tly_ ) / oldcmpt -> vstep_ ; } else { oldx = ( ax - oldcmpt -> tlx_ ) / oldcmpt -> hstep_ ; oldy = ( by - oldcmpt -> tly_ ) / oldcmpt -> vstep_ ; } assert ( oldx >= 0 && oldx < oldcmpt -> width_ && oldy >= 0 && oldy < oldcmpt -> height_ ) ; if ( jas_stream_seek ( oldcmpt -> stream_ , oldcmpt -> cps_ * ( oldy * oldcmpt -> width_ + oldx ) , SEEK_SET ) < 0 ) goto error ; if ( getint ( oldcmpt -> stream_ , oldcmpt -> sgnd_ , oldcmpt -> prec_ , & v ) ) goto error ; if ( newcmpt -> prec_ != oldcmpt -> prec_ || newcmpt -> sgnd_ != oldcmpt -> sgnd_ ) { v = convert ( v , oldcmpt -> sgnd_ , oldcmpt -> prec_ , newcmpt -> sgnd_ , newcmpt -> prec_ ) ; } if ( putint ( newcmpt -> stream_ , newcmpt -> sgnd_ , newcmpt -> prec_ , v ) ) goto error ; } } return 0 ; error : return - 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void cwd_globals_dtor ( virtual_cwd_globals * cwd_g TSRMLS_DC ) { CWD_STATE_FREE ( & cwd_g -> cwd ) ; realpath_cache_clean ( TSRMLS_C ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static Datum ExecEvalCoerceToDomain ( CoerceToDomainState * cstate , ExprContext * econtext , bool * isNull , ExprDoneCond * isDone ) { CoerceToDomain * ctest = ( CoerceToDomain * ) cstate -> xprstate . expr ; Datum result ; ListCell * l ; result = ExecEvalExpr ( cstate -> arg , econtext , isNull , isDone ) ; if ( isDone && * isDone == ExprEndResult ) return result ; UpdateDomainConstraintRef ( cstate -> constraint_ref ) ; foreach ( l , cstate -> constraint_ref -> constraints ) { DomainConstraintState * con = ( DomainConstraintState * ) lfirst ( l ) ; switch ( con -> constrainttype ) { case DOM_CONSTRAINT_NOTNULL : if ( * isNull ) ereport ( ERROR , ( errcode ( ERRCODE_NOT_NULL_VIOLATION ) , errmsg ( "domain %s does not allow null values" , format_type_be ( ctest -> resulttype ) ) , errdatatype ( ctest -> resulttype ) ) ) ; break ; case DOM_CONSTRAINT_CHECK : { Datum conResult ; bool conIsNull ; Datum save_datum ; bool save_isNull ; save_datum = econtext -> domainValue_datum ; save_isNull = econtext -> domainValue_isNull ; econtext -> domainValue_datum = result ; econtext -> domainValue_isNull = * isNull ; conResult = ExecEvalExpr ( con -> check_expr , econtext , & conIsNull , NULL ) ; if ( ! conIsNull && ! DatumGetBool ( conResult ) ) ereport ( ERROR , ( errcode ( ERRCODE_CHECK_VIOLATION ) , errmsg ( "value for domain %s violates check constraint \"%s\"" , format_type_be ( ctest -> resulttype ) , con -> name ) , errdomainconstraint ( ctest -> resulttype , con -> name ) ) ) ; econtext -> domainValue_datum = save_datum ; econtext -> domainValue_isNull = save_isNull ; break ; } default : elog ( ERROR , "unrecognized constraint type: %d" , ( int ) con -> constrainttype ) ; break ; } } return result ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int zsethalftone5 ( i_ctx_t * i_ctx_p ) { os_ptr op = osp ; uint count ; gs_halftone_component * phtc = 0 ; gs_halftone_component * pc ; int code = 0 ; int j ; bool have_default ; gs_halftone * pht = 0 ; gx_device_halftone * pdht = 0 ; ref sprocs [ GS_CLIENT_COLOR_MAX_COMPONENTS + 1 ] ; ref tprocs [ GS_CLIENT_COLOR_MAX_COMPONENTS + 1 ] ; gs_memory_t * mem ; uint edepth = ref_stack_count ( & e_stack ) ; int npop = 2 ; int dict_enum ; ref rvalue [ 2 ] ; int cname , colorant_number ; byte * pname ; uint name_size ; int halftonetype , type = 0 ; gs_gstate * pgs = igs ; int space_index ; if ( ref_stack_count ( & o_stack ) < 2 ) return_error ( gs_error_stackunderflow ) ; check_type ( * op , t_dictionary ) ; check_type ( * ( op - 1 ) , t_dictionary ) ; dict_enum = dict_first ( op ) ; space_index = r_space_index ( op - 1 ) ; mem = ( gs_memory_t * ) idmemory -> spaces_indexed [ space_index ] ; check_type ( * op , t_dictionary ) ; check_dict_read ( * op ) ; check_type ( op [ - 1 ] , t_dictionary ) ; check_dict_read ( op [ - 1 ] ) ; code = dict_int_param ( op - 1 , "HalftoneType" , 1 , 100 , 0 , & type ) ; if ( code < 0 ) return code ; halftonetype = ( type == 2 || type == 4 ) ? ht_type_multiple_colorscreen : ht_type_multiple ; have_default = false ; for ( count = 0 ; ; ) { if ( ( dict_enum = dict_next ( op , dict_enum , rvalue ) ) == - 1 ) break ; if ( ! r_has_type ( & rvalue [ 0 ] , t_name ) ) continue ; if ( ! r_has_type ( & rvalue [ 1 ] , t_dictionary ) ) continue ; cname = name_index ( mem , & rvalue [ 0 ] ) ; code = gs_get_colorname_string ( mem , cname , & pname , & name_size ) ; if ( code < 0 ) break ; colorant_number = gs_cname_to_colorant_number ( pgs , pname , name_size , halftonetype ) ; if ( colorant_number < 0 ) continue ; else if ( colorant_number == GX_DEVICE_COLOR_MAX_COMPONENTS ) { if ( have_default ) return_error ( gs_error_rangecheck ) ; have_default = true ; } count ++ ; if ( count > GS_CLIENT_COLOR_MAX_COMPONENTS + 1 ) { code = gs_note_error ( gs_error_rangecheck ) ; break ; } } if ( count == 0 || ( halftonetype == ht_type_multiple && ! have_default ) ) code = gs_note_error ( gs_error_rangecheck ) ; if ( code >= 0 ) { check_estack ( 5 ) ; refset_null ( sprocs , count ) ; refset_null ( tprocs , count ) ; rc_alloc_struct_0 ( pht , gs_halftone , & st_halftone , imemory , pht = 0 , ".sethalftone5" ) ; phtc = gs_alloc_struct_array ( mem , count , gs_halftone_component , & st_ht_component_element , ".sethalftone5" ) ; rc_alloc_struct_0 ( pdht , gx_device_halftone , & st_device_halftone , imemory , pdht = 0 , ".sethalftone5" ) ; if ( pht == 0 || phtc == 0 || pdht == 0 ) { j = 0 ; code = gs_note_error ( gs_error_VMerror ) ; } } if ( code >= 0 ) { dict_enum = dict_first ( op ) ; for ( j = 0 , pc = phtc ; ; ) { int type ; if ( ( dict_enum = dict_next ( op , dict_enum , rvalue ) ) == - 1 ) break ; if ( ! r_has_type ( & rvalue [ 0 ] , t_name ) ) continue ; if ( ! r_has_type ( & rvalue [ 1 ] , t_dictionary ) ) continue ; cname = name_index ( mem , & rvalue [ 0 ] ) ; code = gs_get_colorname_string ( mem , cname , & pname , & name_size ) ; if ( code < 0 ) break ; colorant_number = gs_cname_to_colorant_number ( pgs , pname , name_size , halftonetype ) ; if ( colorant_number < 0 ) continue ; pc -> cname = cname ; pc -> comp_number = colorant_number ; check_dict_read ( rvalue [ 1 ] ) ; if ( dict_int_param ( & rvalue [ 1 ] , "HalftoneType" , 1 , 7 , 0 , & type ) < 0 ) { code = gs_note_error ( gs_error_typecheck ) ; break ; } switch ( type ) { default : code = gs_note_error ( gs_error_rangecheck ) ; break ; case 1 : code = dict_spot_params ( & rvalue [ 1 ] , & pc -> params . spot , sprocs + j , tprocs + j , mem ) ; pc -> params . spot . screen . spot_function = spot1_dummy ; pc -> type = ht_type_spot ; break ; case 3 : code = dict_threshold_params ( & rvalue [ 1 ] , & pc -> params . threshold , tprocs + j ) ; pc -> type = ht_type_threshold ; break ; case 7 : code = dict_threshold2_params ( & rvalue [ 1 ] , & pc -> params . threshold2 , tprocs + j , imemory ) ; pc -> type = ht_type_threshold2 ; break ; } if ( code < 0 ) break ; pc ++ ; j ++ ; } } if ( code >= 0 ) { pht -> type = halftonetype ; pht -> params . multiple . components = phtc ; pht -> params . multiple . num_comp = j ; pht -> params . multiple . get_colorname_string = gs_get_colorname_string ; code = gs_sethalftone_prepare ( igs , pht , pdht ) ; } if ( code >= 0 ) { dict_enum = dict_first ( op ) ; for ( pc = phtc ; ; ) { if ( ( dict_enum = dict_next ( op , dict_enum , rvalue ) ) == - 1 ) break ; if ( ! r_has_type ( & rvalue [ 0 ] , t_name ) ) continue ; if ( ! r_has_type ( & rvalue [ 1 ] , t_dictionary ) ) continue ; cname = name_index ( mem , & rvalue [ 0 ] ) ; code = gs_get_colorname_string ( mem , cname , & pname , & name_size ) ; if ( code < 0 ) break ; colorant_number = gs_cname_to_colorant_number ( pgs , pname , name_size , halftonetype ) ; if ( colorant_number < 0 ) continue ; if ( pc -> type == ht_type_spot ) { code = dict_spot_results ( i_ctx_p , & rvalue [ 1 ] , & pc -> params . spot ) ; if ( code < 0 ) break ; } pc ++ ; } } if ( code >= 0 ) { uint odepth = ref_stack_count ( & o_stack ) ; ref odict , odict5 ; odict = op [ - 1 ] ; odict5 = * op ; pop ( 2 ) ; op = osp ; esp += 5 ; make_mark_estack ( esp - 4 , es_other , sethalftone_cleanup ) ; esp [ - 3 ] = odict ; make_istruct ( esp - 2 , 0 , pht ) ; make_istruct ( esp - 1 , 0 , pdht ) ; make_op_estack ( esp , sethalftone_finish ) ; for ( j = 0 ; j < count ; j ++ ) { gx_ht_order * porder = NULL ; if ( pdht -> components == 0 ) porder = & pdht -> order ; else { int k ; int comp_number = phtc [ j ] . comp_number ; for ( k = 0 ; k < count ; k ++ ) { if ( pdht -> components [ k ] . comp_number == comp_number ) { porder = & pdht -> components [ k ] . corder ; break ; } } } switch ( phtc [ j ] . type ) { case ht_type_spot : code = zscreen_enum_init ( i_ctx_p , porder , & phtc [ j ] . params . spot . screen , & sprocs [ j ] , 0 , 0 , space_index ) ; if ( code < 0 ) break ; case ht_type_threshold : if ( ! r_has_type ( tprocs + j , t__invalid ) ) { check_ostack ( zcolor_remap_one_ostack ) ; check_estack ( zcolor_remap_one_estack ) ; code = zcolor_remap_one ( i_ctx_p , tprocs + j , porder -> transfer , igs , zcolor_remap_one_finish ) ; op = osp ; } break ; default : ; } if ( code < 0 ) { ref_stack_pop_to ( & o_stack , odepth ) ; ref_stack_pop_to ( & e_stack , edepth ) ; op = osp ; op [ - 1 ] = odict ; * op = odict5 ; break ; } npop = 0 ; } } if ( code < 0 ) { gs_free_object ( mem , pdht , ".sethalftone5" ) ; gs_free_object ( mem , phtc , ".sethalftone5" ) ; gs_free_object ( mem , pht , ".sethalftone5" ) ; return code ; } pop ( npop ) ; return ( ref_stack_count ( & e_stack ) > edepth ? o_push_estack : 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void purple_chat_invite ( struct groupchat * gc , char * who , char * message ) { PurpleConversation * pc = gc -> data ; PurpleConvChat * pcc = PURPLE_CONV_CHAT ( pc ) ; struct purple_data * pd = gc -> ic -> proto_data ; serv_chat_invite ( purple_account_get_connection ( pd -> account ) , purple_conv_chat_get_id ( pcc ) , message && * message ? message : "Please join my chat" , who ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static bool compare_hostname ( const acl_host_and_ip * host , const char * hostname , const char * ip ) { long tmp ; if ( host -> ip_mask && ip && calc_ip ( ip , & tmp , '\0' ) ) { return ( tmp & host -> ip_mask ) == host -> ip ; } return ( ! host -> hostname || ( hostname && ! wild_case_compare ( system_charset_info , hostname , host -> hostname ) ) || ( ip && ! wild_compare ( ip , host -> hostname , 0 ) ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _UTF16LEOpen ( UConverter * cnv , UConverterLoadArgs * pArgs , UErrorCode * pErrorCode ) { if ( UCNV_GET_VERSION ( cnv ) <= 1 ) { _UTF16LEReset ( cnv , UCNV_RESET_BOTH ) ; } else { * pErrorCode = U_ILLEGAL_ARGUMENT_ERROR ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static UBool _isExtensionSingleton ( const char * s , int32_t len ) { if ( len < 0 ) { len = ( int32_t ) uprv_strlen ( s ) ; } if ( len == 1 && ISALPHA ( * s ) && ( uprv_tolower ( * s ) != PRIVATEUSE ) ) { return TRUE ; } return FALSE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
char * ksba_oid_to_str ( const char * buffer , size_t length ) { const unsigned char * buf = buffer ; char * string , * p ; int n = 0 ; unsigned long val , valmask ; valmask = ( unsigned long ) 0xfe << ( 8 * ( sizeof ( valmask ) - 1 ) ) ; string = p = xtrymalloc ( length * ( 1 + 3 ) + 2 + 1 ) ; if ( ! string ) return NULL ; if ( ! length ) { * p = 0 ; return string ; } if ( buf [ 0 ] < 40 ) p += sprintf ( p , "0.%d" , buf [ n ] ) ; else if ( buf [ 0 ] < 80 ) p += sprintf ( p , "1.%d" , buf [ n ] - 40 ) ; else { val = buf [ n ] & 0x7f ; while ( ( buf [ n ] & 0x80 ) && ++ n < length ) { if ( ( val & valmask ) ) goto badoid ; val <<= 7 ; val |= buf [ n ] & 0x7f ; } val -= 80 ; sprintf ( p , "2.%lu" , val ) ; p += strlen ( p ) ; } for ( n ++ ; n < length ; n ++ ) { val = buf [ n ] & 0x7f ; while ( ( buf [ n ] & 0x80 ) && ++ n < length ) { if ( ( val & valmask ) ) goto badoid ; val <<= 7 ; val |= buf [ n ] & 0x7f ; } sprintf ( p , ".%lu" , val ) ; p += strlen ( p ) ; } * p = 0 ; return string ; badoid : xfree ( string ) ; return xtrystrdup ( "1.3.6.1.4.1.11591.2.12242973" ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
void vp8_alloc_compressor_data ( VP8_COMP * cpi ) { VP8_COMMON * cm = & cpi -> common ; int width = cm -> Width ; int height = cm -> Height ; if ( vp8_alloc_frame_buffers ( cm , width , height ) ) vpx_internal_error ( & cpi -> common . error , VPX_CODEC_MEM_ERROR , "Failed to allocate frame buffers" ) ; if ( vp8_alloc_partition_data ( cpi ) ) vpx_internal_error ( & cpi -> common . error , VPX_CODEC_MEM_ERROR , "Failed to allocate partition data" ) ; if ( ( width & 0xf ) != 0 ) width += 16 - ( width & 0xf ) ; if ( ( height & 0xf ) != 0 ) height += 16 - ( height & 0xf ) ; if ( vp8_yv12_alloc_frame_buffer ( & cpi -> pick_lf_lvl_frame , width , height , VP8BORDERINPIXELS ) ) vpx_internal_error ( & cpi -> common . error , VPX_CODEC_MEM_ERROR , "Failed to allocate last frame buffer" ) ; if ( vp8_yv12_alloc_frame_buffer ( & cpi -> scaled_source , width , height , VP8BORDERINPIXELS ) ) vpx_internal_error ( & cpi -> common . error , VPX_CODEC_MEM_ERROR , "Failed to allocate scaled source buffer" ) ; vpx_free ( cpi -> tok ) ; { # if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING unsigned int tokens = 8 * 24 * 16 ; # else unsigned int tokens = cm -> mb_rows * cm -> mb_cols * 24 * 16 ; # endif CHECK_MEM_ERROR ( cpi -> tok , vpx_calloc ( tokens , sizeof ( * cpi -> tok ) ) ) ; } cpi -> zeromv_count = 0 ; vpx_free ( cpi -> gf_active_flags ) ; CHECK_MEM_ERROR ( cpi -> gf_active_flags , vpx_calloc ( sizeof ( * cpi -> gf_active_flags ) , cm -> mb_rows * cm -> mb_cols ) ) ; cpi -> gf_active_count = cm -> mb_rows * cm -> mb_cols ; vpx_free ( cpi -> mb_activity_map ) ; CHECK_MEM_ERROR ( cpi -> mb_activity_map , vpx_calloc ( sizeof ( * cpi -> mb_activity_map ) , cm -> mb_rows * cm -> mb_cols ) ) ; vpx_free ( cpi -> lfmv ) ; CHECK_MEM_ERROR ( cpi -> lfmv , vpx_calloc ( ( cm -> mb_rows + 2 ) * ( cm -> mb_cols + 2 ) , sizeof ( * cpi -> lfmv ) ) ) ; vpx_free ( cpi -> lf_ref_frame_sign_bias ) ; CHECK_MEM_ERROR ( cpi -> lf_ref_frame_sign_bias , vpx_calloc ( ( cm -> mb_rows + 2 ) * ( cm -> mb_cols + 2 ) , sizeof ( * cpi -> lf_ref_frame_sign_bias ) ) ) ; vpx_free ( cpi -> lf_ref_frame ) ; CHECK_MEM_ERROR ( cpi -> lf_ref_frame , vpx_calloc ( ( cm -> mb_rows + 2 ) * ( cm -> mb_cols + 2 ) , sizeof ( * cpi -> lf_ref_frame ) ) ) ; vpx_free ( cpi -> segmentation_map ) ; CHECK_MEM_ERROR ( cpi -> segmentation_map , vpx_calloc ( cm -> mb_rows * cm -> mb_cols , sizeof ( * cpi -> segmentation_map ) ) ) ; cpi -> cyclic_refresh_mode_index = 0 ; vpx_free ( cpi -> active_map ) ; CHECK_MEM_ERROR ( cpi -> active_map , vpx_calloc ( cm -> mb_rows * cm -> mb_cols , sizeof ( * cpi -> active_map ) ) ) ; vpx_memset ( cpi -> active_map , 1 , ( cm -> mb_rows * cm -> mb_cols ) ) ; # if CONFIG_MULTITHREAD if ( width < 640 ) cpi -> mt_sync_range = 1 ; else if ( width <= 1280 ) cpi -> mt_sync_range = 4 ; else if ( width <= 2560 ) cpi -> mt_sync_range = 8 ; else cpi -> mt_sync_range = 16 ; if ( cpi -> oxcf . multi_threaded > 1 ) { vpx_free ( cpi -> mt_current_mb_col ) ; CHECK_MEM_ERROR ( cpi -> mt_current_mb_col , vpx_malloc ( sizeof ( * cpi -> mt_current_mb_col ) * cm -> mb_rows ) ) ; } # endif vpx_free ( cpi -> tplist ) ; CHECK_MEM_ERROR ( cpi -> tplist , vpx_malloc ( sizeof ( TOKENLIST ) * cm -> mb_rows ) ) ; # if CONFIG_TEMPORAL_DENOISING if ( cpi -> oxcf . noise_sensitivity > 0 ) { vp8_denoiser_free ( & cpi -> denoiser ) ; vp8_denoiser_allocate ( & cpi -> denoiser , width , height , cm -> mb_rows , cm -> mb_cols , cpi -> oxcf . noise_sensitivity ) ; } # endif }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int spl_filesystem_file_open ( spl_filesystem_object * intern , int use_include_path , int silent TSRMLS_DC ) { zval tmp ; intern -> type = SPL_FS_FILE ; php_stat ( intern -> file_name , intern -> file_name_len , FS_IS_DIR , & tmp TSRMLS_CC ) ; if ( Z_LVAL ( tmp ) ) { intern -> u . file . open_mode = NULL ; intern -> file_name = NULL ; zend_throw_exception_ex ( spl_ce_LogicException , 0 TSRMLS_CC , "Cannot use SplFileObject with directories" ) ; return FAILURE ; } intern -> u . file . context = php_stream_context_from_zval ( intern -> u . file . zcontext , 0 ) ; intern -> u . file . stream = php_stream_open_wrapper_ex ( intern -> file_name , intern -> u . file . open_mode , ( use_include_path ? USE_PATH : 0 ) | REPORT_ERRORS , NULL , intern -> u . file . context ) ; if ( ! intern -> file_name_len || ! intern -> u . file . stream ) { if ( ! EG ( exception ) ) { zend_throw_exception_ex ( spl_ce_RuntimeException , 0 TSRMLS_CC , "Cannot open file '%s'" , intern -> file_name_len ? intern -> file_name : "" ) ; } intern -> file_name = NULL ; intern -> u . file . open_mode = NULL ; return FAILURE ; } if ( intern -> u . file . zcontext ) { zend_list_addref ( Z_RESVAL_P ( intern -> u . file . zcontext ) ) ; } if ( intern -> file_name_len > 1 && IS_SLASH_AT ( intern -> file_name , intern -> file_name_len - 1 ) ) { intern -> file_name_len -- ; } intern -> orig_path = estrndup ( intern -> u . file . stream -> orig_path , strlen ( intern -> u . file . stream -> orig_path ) ) ; intern -> file_name = estrndup ( intern -> file_name , intern -> file_name_len ) ; intern -> u . file . open_mode = estrndup ( intern -> u . file . open_mode , intern -> u . file . open_mode_len ) ; ZVAL_RESOURCE ( & intern -> u . file . zresource , php_stream_get_resource_id ( intern -> u . file . stream ) ) ; Z_SET_REFCOUNT ( intern -> u . file . zresource , 1 ) ; intern -> u . file . delimiter = ',' ; intern -> u . file . enclosure = '"' ; intern -> u . file . escape = '\\' ; zend_hash_find ( & intern -> std . ce -> function_table , "getcurrentline" , sizeof ( "getcurrentline" ) , ( void * * ) & intern -> u . file . func_getCurr ) ; return SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static tmsize_t _tiffReadProc ( thandle_t fd , void * buf , tmsize_t size ) { uint8 * ma ; uint64 mb ; DWORD n ; DWORD o ; tmsize_t p ; ma = ( uint8 * ) buf ; mb = size ; p = 0 ; while ( mb > 0 ) { n = 0x80000000UL ; if ( ( uint64 ) n > mb ) n = ( DWORD ) mb ; if ( ! ReadFile ( fd , ( LPVOID ) ma , n , & o , NULL ) ) return ( 0 ) ; ma += o ; mb -= o ; p += o ; if ( o != n ) break ; } return ( p ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int ossl_statem_server_read_transition ( SSL * s , int mt ) { OSSL_STATEM * st = & s -> statem ; switch ( st -> hand_state ) { case TLS_ST_BEFORE : case DTLS_ST_SW_HELLO_VERIFY_REQUEST : if ( mt == SSL3_MT_CLIENT_HELLO ) { st -> hand_state = TLS_ST_SR_CLNT_HELLO ; return 1 ; } break ; case TLS_ST_SW_SRVR_DONE : if ( mt == SSL3_MT_CLIENT_KEY_EXCHANGE ) { if ( s -> s3 -> tmp . cert_request ) { if ( s -> version == SSL3_VERSION ) { if ( ( s -> verify_mode & SSL_VERIFY_PEER ) && ( s -> verify_mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT ) ) { ssl3_send_alert ( s , SSL3_AL_FATAL , SSL3_AD_HANDSHAKE_FAILURE ) ; SSLerr ( SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION , SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE ) ; return 0 ; } st -> hand_state = TLS_ST_SR_KEY_EXCH ; return 1 ; } } else { st -> hand_state = TLS_ST_SR_KEY_EXCH ; return 1 ; } } else if ( s -> s3 -> tmp . cert_request ) { if ( mt == SSL3_MT_CERTIFICATE ) { st -> hand_state = TLS_ST_SR_CERT ; return 1 ; } } break ; case TLS_ST_SR_CERT : if ( mt == SSL3_MT_CLIENT_KEY_EXCHANGE ) { st -> hand_state = TLS_ST_SR_KEY_EXCH ; return 1 ; } break ; case TLS_ST_SR_KEY_EXCH : if ( s -> session -> peer == NULL || st -> no_cert_verify ) { if ( mt == SSL3_MT_CHANGE_CIPHER_SPEC ) { st -> hand_state = TLS_ST_SR_CHANGE ; return 1 ; } } else { if ( mt == SSL3_MT_CERTIFICATE_VERIFY ) { st -> hand_state = TLS_ST_SR_CERT_VRFY ; return 1 ; } } break ; case TLS_ST_SR_CERT_VRFY : if ( mt == SSL3_MT_CHANGE_CIPHER_SPEC ) { st -> hand_state = TLS_ST_SR_CHANGE ; return 1 ; } break ; case TLS_ST_SR_CHANGE : # ifndef OPENSSL_NO_NEXTPROTONEG if ( s -> s3 -> next_proto_neg_seen ) { if ( mt == SSL3_MT_NEXT_PROTO ) { st -> hand_state = TLS_ST_SR_NEXT_PROTO ; return 1 ; } } else { # endif if ( mt == SSL3_MT_FINISHED ) { st -> hand_state = TLS_ST_SR_FINISHED ; return 1 ; } # ifndef OPENSSL_NO_NEXTPROTONEG } # endif break ; # ifndef OPENSSL_NO_NEXTPROTONEG case TLS_ST_SR_NEXT_PROTO : if ( mt == SSL3_MT_FINISHED ) { st -> hand_state = TLS_ST_SR_FINISHED ; return 1 ; } break ; # endif case TLS_ST_SW_FINISHED : if ( mt == SSL3_MT_CHANGE_CIPHER_SPEC ) { st -> hand_state = TLS_ST_SR_CHANGE ; return 1 ; } break ; default : break ; } ssl3_send_alert ( s , SSL3_AL_FATAL , SSL3_AD_UNEXPECTED_MESSAGE ) ; SSLerr ( SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION , SSL_R_UNEXPECTED_MESSAGE ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int remoteDispatchClientCall ( struct qemud_server * server , struct qemud_client * client , struct qemud_client_message * msg , bool qemu_protocol ) { XDR xdr ; remote_error rerr ; dispatch_args args ; dispatch_ret ret ; const dispatch_data * data = NULL ; int rv = - 1 ; unsigned int len ; virConnectPtr conn = NULL ; memset ( & args , 0 , sizeof args ) ; memset ( & ret , 0 , sizeof ret ) ; memset ( & rerr , 0 , sizeof rerr ) ; if ( msg -> hdr . status != REMOTE_OK ) { remoteDispatchFormatError ( & rerr , _ ( "status (%d) != REMOTE_OK" ) , ( int ) msg -> hdr . status ) ; goto rpc_error ; } if ( client -> auth ) { if ( msg -> hdr . proc != REMOTE_PROC_AUTH_LIST && msg -> hdr . proc != REMOTE_PROC_AUTH_SASL_INIT && msg -> hdr . proc != REMOTE_PROC_AUTH_SASL_START && msg -> hdr . proc != REMOTE_PROC_AUTH_SASL_STEP && msg -> hdr . proc != REMOTE_PROC_AUTH_POLKIT ) { remoteDispatchFormatError ( & rerr , "%s" , _ ( "authentication required" ) ) ; goto rpc_error ; } } if ( qemu_protocol ) data = qemuGetDispatchData ( msg -> hdr . proc ) ; else data = remoteGetDispatchData ( msg -> hdr . proc ) ; if ( ! data ) { remoteDispatchFormatError ( & rerr , _ ( "unknown procedure: %d" ) , msg -> hdr . proc ) ; goto rpc_error ; } xdrmem_create ( & xdr , msg -> buffer + msg -> bufferOffset , msg -> bufferLength - msg -> bufferOffset , XDR_DECODE ) ; if ( ! ( ( data -> args_filter ) ( & xdr , & args ) ) ) { xdr_destroy ( & xdr ) ; remoteDispatchFormatError ( & rerr , "%s" , _ ( "parse args failed" ) ) ; goto rpc_error ; } xdr_destroy ( & xdr ) ; conn = client -> conn ; virMutexUnlock ( & client -> lock ) ; rv = ( data -> fn ) ( server , client , conn , & msg -> hdr , & rerr , & args , & ret ) ; virMutexLock ( & server -> lock ) ; virMutexLock ( & client -> lock ) ; virMutexUnlock ( & server -> lock ) ; xdr_free ( data -> args_filter , ( char * ) & args ) ; if ( rv < 0 ) goto rpc_error ; msg -> hdr . type = REMOTE_REPLY ; msg -> hdr . status = REMOTE_OK ; if ( remoteEncodeClientMessageHeader ( msg ) < 0 ) { xdr_free ( data -> ret_filter , ( char * ) & ret ) ; remoteDispatchFormatError ( & rerr , "%s" , _ ( "failed to serialize reply header" ) ) ; goto xdr_hdr_error ; } xdrmem_create ( & xdr , msg -> buffer , msg -> bufferLength , XDR_ENCODE ) ; if ( xdr_setpos ( & xdr , msg -> bufferOffset ) == 0 ) { remoteDispatchFormatError ( & rerr , "%s" , _ ( "failed to change XDR reply offset" ) ) ; goto xdr_error ; } if ( ! ( ( data -> ret_filter ) ( & xdr , & ret ) ) ) { remoteDispatchFormatError ( & rerr , "%s" , _ ( "failed to serialize reply payload (probable message size limit)" ) ) ; goto xdr_error ; } msg -> bufferOffset += xdr_getpos ( & xdr ) ; len = msg -> bufferOffset ; if ( xdr_setpos ( & xdr , 0 ) == 0 ) { remoteDispatchFormatError ( & rerr , "%s" , _ ( "failed to change XDR reply offset" ) ) ; goto xdr_error ; } if ( ! xdr_u_int ( & xdr , & len ) ) { remoteDispatchFormatError ( & rerr , "%s" , _ ( "failed to update reply length header" ) ) ; goto xdr_error ; } xdr_destroy ( & xdr ) ; xdr_free ( data -> ret_filter , ( char * ) & ret ) ; msg -> bufferLength = len ; msg -> bufferOffset = 0 ; qemudClientMessageQueuePush ( & client -> tx , msg ) ; qemudUpdateClientEvent ( client ) ; return 0 ; xdr_error : xdr_free ( data -> ret_filter , ( char * ) & ret ) ; xdr_destroy ( & xdr ) ; xdr_hdr_error : VIR_WARN ( "Failed to serialize reply for program '%d' proc '%d' as XDR" , msg -> hdr . prog , msg -> hdr . proc ) ; rpc_error : rv = remoteSerializeReplyError ( client , & rerr , & msg -> hdr ) ; if ( rv >= 0 ) VIR_FREE ( msg ) ; return rv ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_UserInputCapability ( 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_UserInputCapability , UserInputCapability_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void hmp_hostfwd_remove ( Monitor * mon , const QDict * qdict ) { struct in_addr host_addr = { . s_addr = INADDR_ANY } ; int host_port ; char buf [ 256 ] ; const char * src_str , * p ; SlirpState * s ; int is_udp = 0 ; int err ; const char * arg1 = qdict_get_str ( qdict , "arg1" ) ; const char * arg2 = qdict_get_try_str ( qdict , "arg2" ) ; const char * arg3 = qdict_get_try_str ( qdict , "arg3" ) ; if ( arg2 ) { s = slirp_lookup ( mon , arg1 , arg2 ) ; src_str = arg3 ; } else { s = slirp_lookup ( mon , NULL , NULL ) ; src_str = arg1 ; } if ( ! s ) { return ; } p = src_str ; if ( ! p || get_str_sep ( buf , sizeof ( buf ) , & p , ':' ) < 0 ) { goto fail_syntax ; } if ( ! strcmp ( buf , "tcp" ) || buf [ 0 ] == '\0' ) { is_udp = 0 ; } else if ( ! strcmp ( buf , "udp" ) ) { is_udp = 1 ; } else { goto fail_syntax ; } if ( get_str_sep ( buf , sizeof ( buf ) , & p , ':' ) < 0 ) { goto fail_syntax ; } if ( buf [ 0 ] != '\0' && ! inet_aton ( buf , & host_addr ) ) { goto fail_syntax ; } host_port = atoi ( p ) ; err = slirp_remove_hostfwd ( s -> slirp , is_udp , host_addr , host_port ) ; monitor_printf ( mon , "host forwarding rule for %s %s\n" , src_str , err ? "not found" : "removed" ) ; return ; fail_syntax : monitor_printf ( mon , "invalid format\n" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( MdDownloadsDOMHandlerTest , HandleGetDownloads ) { TestMdDownloadsDOMHandler handler ( manager ( ) , web_ui ( ) ) ; handler . set_web_ui ( web_ui ( ) ) ; base : : ListValue empty_search_terms ; handler . HandleGetDownloads ( & empty_search_terms ) ; EXPECT_EQ ( 1U , web_ui ( ) -> call_data ( ) . size ( ) ) ; EXPECT_EQ ( "downloads.Manager.insertItems" , web_ui ( ) -> call_data ( ) [ 0 ] -> function_name ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void voip_calls_reset ( voip_calls_tapinfo_t * tapinfo ) { voip_calls_info_t * callsinfo ; voip_rtp_tapinfo_t * rtp_tapinfo = & the_tapinfo_rtp_struct ; voip_rtp_stream_info_t * strinfo ; seq_analysis_item_t * graph_item ; GList * list ; # ifdef HAVE_LIBPORTAUDIO reset_rtp_player ( ) ; # endif list = g_list_first ( tapinfo -> callsinfo_list ) ; while ( list ) { callsinfo = ( voip_calls_info_t * ) list -> data ; g_free ( callsinfo -> call_id ) ; g_free ( callsinfo -> from_identity ) ; g_free ( callsinfo -> to_identity ) ; g_free ( ( void * ) ( callsinfo -> initial_speaker . data ) ) ; g_free ( callsinfo -> protocol_name ) ; g_free ( callsinfo -> call_comment ) ; if ( callsinfo -> free_prot_info && callsinfo -> prot_info ) callsinfo -> free_prot_info ( callsinfo -> prot_info ) ; g_free ( list -> data ) ; list = g_list_next ( list ) ; } g_list_free ( tapinfo -> callsinfo_list ) ; if ( NULL != tapinfo -> callsinfo_hashtable [ SIP_HASH ] ) g_hash_table_remove_all ( tapinfo -> callsinfo_hashtable [ SIP_HASH ] ) ; tapinfo -> callsinfo_list = NULL ; tapinfo -> ncalls = 0 ; tapinfo -> npackets = 0 ; tapinfo -> start_packets = 0 ; tapinfo -> completed_calls = 0 ; tapinfo -> rejected_calls = 0 ; tapinfo -> reversed = 0 ; if ( NULL != tapinfo -> graph_analysis -> ht ) g_hash_table_remove_all ( tapinfo -> graph_analysis -> ht ) ; list = g_list_first ( tapinfo -> graph_analysis -> list ) ; while ( list ) { graph_item = ( seq_analysis_item_t * ) list -> data ; g_free ( graph_item -> frame_label ) ; g_free ( graph_item -> comment ) ; g_free ( ( void * ) graph_item -> src_addr . data ) ; g_free ( ( void * ) graph_item -> dst_addr . data ) ; g_free ( graph_item -> time_str ) ; g_free ( list -> data ) ; list = g_list_next ( list ) ; } g_list_free ( tapinfo -> graph_analysis -> list ) ; tapinfo -> graph_analysis -> nconv = 0 ; tapinfo -> graph_analysis -> list = NULL ; ++ ( tapinfo -> launch_count ) ; list = g_list_first ( rtp_tapinfo -> list ) ; while ( list ) { strinfo = ( voip_rtp_stream_info_t * ) list -> data ; g_free ( strinfo -> pt_str ) ; list = g_list_next ( list ) ; } g_list_free ( rtp_tapinfo -> list ) ; rtp_tapinfo -> list = NULL ; return ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
hb_blob_t * hb_blob_create_sub_blob ( hb_blob_t * parent , unsigned int offset , unsigned int length ) { hb_blob_t * blob ; if ( ! length || offset >= parent -> length ) return hb_blob_get_empty ( ) ; hb_blob_make_immutable ( parent ) ; blob = hb_blob_create ( parent -> data + offset , MIN ( length , parent -> length - offset ) , HB_MEMORY_MODE_READONLY , hb_blob_reference ( parent ) , ( hb_destroy_func_t ) hb_blob_destroy ) ; return blob ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void pdf_run_Ts ( fz_context * ctx , pdf_processor * proc , float rise ) { pdf_run_processor * pr = ( pdf_run_processor * ) proc ; pdf_gstate * gstate = pr -> gstate + pr -> gtop ; gstate -> text . rise = rise ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vp8_mbpost_proc_down_c ( unsigned char * dst , int pitch , int rows , int cols , int flimit ) { int r , c , i ; const short * rv3 = & vp8_rv [ 63 & rand ( ) ] ; for ( c = 0 ; c < cols ; c ++ ) { unsigned char * s = & dst [ c ] ; int sumsq = 0 ; int sum = 0 ; unsigned char d [ 16 ] ; const short * rv2 = rv3 + ( ( c * 17 ) & 127 ) ; for ( i = - 8 ; i < 0 ; i ++ ) s [ i * pitch ] = s [ 0 ] ; for ( i = 0 ; i < 17 ; i ++ ) s [ ( i + rows ) * pitch ] = s [ ( rows - 1 ) * pitch ] ; for ( i = - 8 ; i <= 6 ; i ++ ) { sumsq += s [ i * pitch ] * s [ i * pitch ] ; sum += s [ i * pitch ] ; } for ( r = 0 ; r < rows + 8 ; r ++ ) { sumsq += s [ 7 * pitch ] * s [ 7 * pitch ] - s [ - 8 * pitch ] * s [ - 8 * pitch ] ; sum += s [ 7 * pitch ] - s [ - 8 * pitch ] ; d [ r & 15 ] = s [ 0 ] ; if ( sumsq * 15 - sum * sum < flimit ) { d [ r & 15 ] = ( rv2 [ r & 127 ] + sum + s [ 0 ] ) >> 4 ; } if ( r >= 8 ) s [ - 8 * pitch ] = d [ ( r - 8 ) & 15 ] ; s += pitch ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void internal_clear_bit ( REP_SET * set , uint bit ) { set -> bits [ bit / WORD_BIT ] &= ~ ( 1 << ( bit % WORD_BIT ) ) ; return ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void TSError ( const char * fmt , ... ) { va_list args ; if ( is_action_tag_set ( "deft" ) || is_action_tag_set ( "sdk_vbos_errors" ) ) { va_start ( args , fmt ) ; ErrorV ( fmt , args ) ; va_end ( args ) ; } va_start ( args , fmt ) ; Log : : va_error ( ( char * ) fmt , args ) ; va_end ( args ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int selinux_file_lock ( struct file * file , unsigned int cmd ) { const struct cred * cred = current_cred ( ) ; return file_has_perm ( cred , file , FILE__LOCK ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int jas_image_strtofmt ( char * name ) { jas_image_fmtinfo_t * fmtinfo ; if ( ! ( fmtinfo = jas_image_lookupfmtbyname ( name ) ) ) { return - 1 ; } return fmtinfo -> id ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( AutocompleteResultTest , SortAndCullWithMatchDups ) { TemplateURLData url_data ; url_data . SetShortName ( base : : ASCIIToUTF16 ( "unittest" ) ) ; url_data . SetKeyword ( base : : ASCIIToUTF16 ( "foo" ) ) ; url_data . SetURL ( "http://www.foo.com/s?q={ searchTerms} " ) ; template_url_service_ . get ( ) -> Add ( new TemplateURL ( url_data ) ) ; AutocompleteMatch dup_match ; dup_match . destination_url = GURL ( "http://www.foo.com/s?q=foo&oq=dup" ) ; std : : vector < AutocompleteMatch > dups ; dups . push_back ( dup_match ) ; TestData data [ ] = { { 0 , 1 , 1300 , true , dups } , { 1 , 1 , 1200 , true } , { 2 , 1 , 1100 , true } , { 3 , 1 , 1000 , true , dups } , { 4 , 2 , 900 , true } , { 5 , 1 , 800 , true } , } ; ACMatches matches ; PopulateAutocompleteMatches ( data , arraysize ( data ) , & matches ) ; matches [ 0 ] . destination_url = GURL ( "http://www.foo.com/s?q=foo" ) ; matches [ 1 ] . destination_url = GURL ( "http://www.foo.com/s?q=foo2" ) ; matches [ 2 ] . destination_url = GURL ( "http://www.foo.com/s?q=foo&oq=f" ) ; matches [ 3 ] . destination_url = GURL ( "http://www.foo.com/s?q=foo&aqs=0" ) ; matches [ 4 ] . destination_url = GURL ( "http://www.foo.com/" ) ; matches [ 5 ] . destination_url = GURL ( "http://www.foo.com/s?q=foo2&oq=f" ) ; AutocompleteInput input ( base : : string16 ( ) , base : : string16 : : npos , std : : string ( ) , GURL ( ) , OmniboxEventProto : : INVALID_SPEC , false , false , false , true , false , TestSchemeClassifier ( ) ) ; AutocompleteResult result ; result . AppendMatches ( input , matches ) ; result . SortAndCull ( input , std : : string ( ) , template_url_service_ . get ( ) ) ; ASSERT_EQ ( 3U , result . size ( ) ) ; ASSERT_EQ ( 4U , result . match_at ( 0 ) -> duplicate_matches . size ( ) ) ; const AutocompleteMatch * first_match = result . match_at ( 0 ) ; EXPECT_EQ ( matches [ 2 ] . destination_url , first_match -> duplicate_matches . at ( 1 ) . destination_url ) ; EXPECT_EQ ( dup_match . destination_url , first_match -> duplicate_matches . at ( 2 ) . destination_url ) ; EXPECT_EQ ( matches [ 3 ] . destination_url , first_match -> duplicate_matches . at ( 3 ) . destination_url ) ; ASSERT_EQ ( 1U , result . match_at ( 1 ) -> duplicate_matches . size ( ) ) ; EXPECT_EQ ( matches [ 5 ] . destination_url , result . match_at ( 1 ) -> duplicate_matches . at ( 0 ) . destination_url ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static PyObject * string_decode ( PyStringObject * self , PyObject * args , PyObject * kwargs ) { static char * kwlist [ ] = { "encoding" , "errors" , 0 } ; char * encoding = NULL ; char * errors = NULL ; PyObject * v ; if ( ! PyArg_ParseTupleAndKeywords ( args , kwargs , "|ss:decode" , kwlist , & encoding , & errors ) ) return NULL ; v = PyString_AsDecodedObject ( ( PyObject * ) self , encoding , errors ) ; if ( v == NULL ) goto onError ; if ( ! PyString_Check ( v ) && ! PyUnicode_Check ( v ) ) { PyErr_Format ( PyExc_TypeError , "decoder did not return a string/unicode object " "(type=%.400s)" , Py_TYPE ( v ) -> tp_name ) ; Py_DECREF ( v ) ; return NULL ; } return v ; onError : return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void config_trap ( config_tree * ptree ) { addr_opts_node * curr_trap ; attr_val * curr_opt ; sockaddr_u addr_sock ; sockaddr_u peeraddr ; struct interface * localaddr ; struct addrinfo hints ; char port_text [ 8 ] ; settrap_parms * pstp ; u_short port ; int err_flag ; int rc ; AF ( & addr_sock ) = AF_UNSPEC ; curr_trap = HEAD_PFIFO ( ptree -> trap ) ; for ( ; curr_trap != NULL ; curr_trap = curr_trap -> link ) { err_flag = 0 ; port = 0 ; localaddr = NULL ; curr_opt = HEAD_PFIFO ( curr_trap -> options ) ; for ( ; curr_opt != NULL ; curr_opt = curr_opt -> link ) { if ( T_Port == curr_opt -> attr ) { if ( curr_opt -> value . i < 1 || curr_opt -> value . i > USHRT_MAX ) { msyslog ( LOG_ERR , "invalid port number " "%d, trap ignored" , curr_opt -> value . i ) ; err_flag = 1 ; } port = ( u_short ) curr_opt -> value . i ; } else if ( T_Interface == curr_opt -> attr ) { ZERO_SOCK ( & addr_sock ) ; if ( getnetnum ( curr_opt -> value . s , & addr_sock , 1 , t_UNK ) != 1 ) { err_flag = 1 ; break ; } localaddr = findinterface ( & addr_sock ) ; if ( NULL == localaddr ) { msyslog ( LOG_ERR , "can't find interface with address %s" , stoa ( & addr_sock ) ) ; err_flag = 1 ; } } } if ( ! err_flag ) { if ( ! port ) port = TRAPPORT ; ZERO_SOCK ( & peeraddr ) ; rc = getnetnum ( curr_trap -> addr -> address , & peeraddr , 1 , t_UNK ) ; if ( 1 != rc ) { # ifndef WORKER msyslog ( LOG_ERR , "trap: unable to use IP address %s." , curr_trap -> addr -> address ) ; # else memset ( & hints , 0 , sizeof ( hints ) ) ; hints . ai_protocol = IPPROTO_UDP ; hints . ai_socktype = SOCK_DGRAM ; snprintf ( port_text , sizeof ( port_text ) , "%u" , port ) ; hints . ai_flags = Z_AI_NUMERICSERV ; pstp = emalloc_zero ( sizeof ( * pstp ) ) ; if ( localaddr != NULL ) { hints . ai_family = localaddr -> family ; pstp -> ifaddr_nonnull = 1 ; memcpy ( & pstp -> ifaddr , & localaddr -> sin , sizeof ( pstp -> ifaddr ) ) ; } rc = getaddrinfo_sometime ( curr_trap -> addr -> address , port_text , & hints , INITIAL_DNS_RETRY , & trap_name_resolved , pstp ) ; if ( ! rc ) msyslog ( LOG_ERR , "config_trap: getaddrinfo_sometime(%s,%s): %m" , curr_trap -> addr -> address , port_text ) ; # endif continue ; } SET_PORT ( & peeraddr , port ) ; if ( NULL == localaddr ) localaddr = ANY_INTERFACE_CHOOSE ( & peeraddr ) ; else AF ( & peeraddr ) = AF ( & addr_sock ) ; if ( ! ctlsettrap ( & peeraddr , localaddr , 0 , NTP_VERSION ) ) msyslog ( LOG_ERR , "set trap %s -> %s failed." , latoa ( localaddr ) , stoa ( & peeraddr ) ) ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( AppApiTest , OpenWebPopupFromWebIframe ) { extensions : : ProcessMap * process_map = extensions : : ProcessMap : : Get ( browser ( ) -> profile ( ) ) ; GURL base_url = GetTestBaseURL ( "app_process" ) ; const Extension * app = LoadExtension ( test_data_dir_ . AppendASCII ( "app_process" ) ) ; ASSERT_TRUE ( app ) ; ui_test_utils : : NavigateToURL ( browser ( ) , base_url . Resolve ( "path1/container.html" ) ) ; content : : RenderProcessHost * process = browser ( ) -> tab_strip_model ( ) -> GetWebContentsAt ( 0 ) -> GetRenderProcessHost ( ) ; EXPECT_TRUE ( process_map -> Contains ( process -> GetID ( ) ) ) ; const BrowserList * active_browser_list = BrowserList : : GetInstance ( ) ; EXPECT_EQ ( 2U , active_browser_list -> size ( ) ) ; content : : WebContents * popup_contents = active_browser_list -> get ( 1 ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) ; content : : WaitForLoadStop ( popup_contents ) ; bool should_be_in_same_process = ! content : : AreAllSitesIsolatedForTesting ( ) ; content : : RenderProcessHost * popup_process = popup_contents -> GetRenderProcessHost ( ) ; EXPECT_EQ ( should_be_in_same_process , process == popup_process ) ; EXPECT_EQ ( should_be_in_same_process , process_map -> Contains ( popup_process -> GetID ( ) ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dtap_cc_modify ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) { guint32 curr_offset ; guint32 consumed ; guint curr_len ; curr_offset = offset ; curr_len = len ; is_uplink = IS_UPLINK_TRUE ; ELEM_MAND_LV ( GSM_A_PDU_TYPE_DTAP , DE_BEARER_CAP , NULL ) ; ELEM_OPT_TLV ( 0x7c , GSM_A_PDU_TYPE_DTAP , DE_LLC , NULL ) ; ELEM_OPT_TLV ( 0x7d , GSM_A_PDU_TYPE_DTAP , DE_HLC , NULL ) ; ELEM_OPT_T ( 0xa3 , GSM_A_PDU_TYPE_DTAP , DE_REV_CALL_SETUP_DIR , NULL ) ; ELEM_OPT_T ( 0xa4 , GSM_A_PDU_TYPE_DTAP , DE_NET_INIT_SERV_UPG , NULL ) ; EXTRANEOUS_DATA_CHECK ( curr_len , 0 , pinfo , & ei_gsm_a_dtap_extraneous_data ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
size_t check_mul_overflow ( size_t a , size_t b , size_t * res ) { size_t tmp = a * b ; if ( a != 0 && tmp / a != b ) return 1 ; * res = tmp ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int sha1write_ewah_helper ( void * f , const void * buf , size_t len ) { sha1write ( f , buf , len ) ; return len ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _CompoundTextClose ( UConverter * converter ) { UConverterDataCompoundText * myConverterData = ( UConverterDataCompoundText * ) ( converter -> extraInfo ) ; int32_t i ; if ( converter -> extraInfo != NULL ) { for ( i = 0 ; i < NUM_OF_CONVERTERS ; i ++ ) { if ( myConverterData -> myConverterArray [ i ] != NULL ) { ucnv_unloadSharedDataIfReady ( myConverterData -> myConverterArray [ i ] ) ; } } uprv_free ( converter -> extraInfo ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static VALUE ossl_asn1_ ## klass ( int argc , VALUE * argv , VALUE self ) \ { return rb_funcall3 ( cASN1 ## klass , rb_intern ( "new" ) , argc , argv ) ; } OSSL_ASN1_IMPL_FACTORY_METHOD ( Boolean ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Integer ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Enumerated ) OSSL_ASN1_IMPL_FACTORY_METHOD ( BitString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( OctetString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( UTF8String ) OSSL_ASN1_IMPL_FACTORY_METHOD ( NumericString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( PrintableString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( T61String ) OSSL_ASN1_IMPL_FACTORY_METHOD ( VideotexString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( IA5String ) OSSL_ASN1_IMPL_FACTORY_METHOD ( GraphicString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( ISO64String )
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void vc1_pred_b_mv_intfi ( VC1Context * v , int n , int * dmv_x , int * dmv_y , int mv1 , int * pred_flag ) { int dir = ( v -> bmvtype == BMV_TYPE_BACKWARD ) ? 1 : 0 ; MpegEncContext * s = & v -> s ; int mb_pos = s -> mb_x + s -> mb_y * s -> mb_stride ; if ( v -> bmvtype == BMV_TYPE_DIRECT ) { int total_opp , k , f ; if ( s -> next_picture . f . mb_type [ mb_pos + v -> mb_off ] != MB_TYPE_INTRA ) { s -> mv [ 0 ] [ 0 ] [ 0 ] = scale_mv ( s -> next_picture . f . motion_val [ 1 ] [ s -> block_index [ 0 ] + v -> blocks_off ] [ 0 ] , v -> bfraction , 0 , s -> quarter_sample ) ; s -> mv [ 0 ] [ 0 ] [ 1 ] = scale_mv ( s -> next_picture . f . motion_val [ 1 ] [ s -> block_index [ 0 ] + v -> blocks_off ] [ 1 ] , v -> bfraction , 0 , s -> quarter_sample ) ; s -> mv [ 1 ] [ 0 ] [ 0 ] = scale_mv ( s -> next_picture . f . motion_val [ 1 ] [ s -> block_index [ 0 ] + v -> blocks_off ] [ 0 ] , v -> bfraction , 1 , s -> quarter_sample ) ; s -> mv [ 1 ] [ 0 ] [ 1 ] = scale_mv ( s -> next_picture . f . motion_val [ 1 ] [ s -> block_index [ 0 ] + v -> blocks_off ] [ 1 ] , v -> bfraction , 1 , s -> quarter_sample ) ; total_opp = v -> mv_f_next [ 0 ] [ s -> block_index [ 0 ] + v -> blocks_off ] + v -> mv_f_next [ 0 ] [ s -> block_index [ 1 ] + v -> blocks_off ] + v -> mv_f_next [ 0 ] [ s -> block_index [ 2 ] + v -> blocks_off ] + v -> mv_f_next [ 0 ] [ s -> block_index [ 3 ] + v -> blocks_off ] ; f = ( total_opp > 2 ) ? 1 : 0 ; } else { s -> mv [ 0 ] [ 0 ] [ 0 ] = s -> mv [ 0 ] [ 0 ] [ 1 ] = 0 ; s -> mv [ 1 ] [ 0 ] [ 0 ] = s -> mv [ 1 ] [ 0 ] [ 1 ] = 0 ; f = 0 ; } v -> ref_field_type [ 0 ] = v -> ref_field_type [ 1 ] = v -> cur_field_type ^ f ; for ( k = 0 ; k < 4 ; k ++ ) { s -> current_picture . f . motion_val [ 0 ] [ s -> block_index [ k ] + v -> blocks_off ] [ 0 ] = s -> mv [ 0 ] [ 0 ] [ 0 ] ; s -> current_picture . f . motion_val [ 0 ] [ s -> block_index [ k ] + v -> blocks_off ] [ 1 ] = s -> mv [ 0 ] [ 0 ] [ 1 ] ; s -> current_picture . f . motion_val [ 1 ] [ s -> block_index [ k ] + v -> blocks_off ] [ 0 ] = s -> mv [ 1 ] [ 0 ] [ 0 ] ; s -> current_picture . f . motion_val [ 1 ] [ s -> block_index [ k ] + v -> blocks_off ] [ 1 ] = s -> mv [ 1 ] [ 0 ] [ 1 ] ; v -> mv_f [ 0 ] [ s -> block_index [ k ] + v -> blocks_off ] = f ; v -> mv_f [ 1 ] [ s -> block_index [ k ] + v -> blocks_off ] = f ; } return ; } if ( v -> bmvtype == BMV_TYPE_INTERPOLATED ) { vc1_pred_mv ( v , 0 , dmv_x [ 0 ] , dmv_y [ 0 ] , 1 , v -> range_x , v -> range_y , v -> mb_type [ 0 ] , pred_flag [ 0 ] , 0 ) ; vc1_pred_mv ( v , 0 , dmv_x [ 1 ] , dmv_y [ 1 ] , 1 , v -> range_x , v -> range_y , v -> mb_type [ 0 ] , pred_flag [ 1 ] , 1 ) ; return ; } if ( dir ) { vc1_pred_mv ( v , n , dmv_x [ 1 ] , dmv_y [ 1 ] , mv1 , v -> range_x , v -> range_y , v -> mb_type [ 0 ] , pred_flag [ 1 ] , 1 ) ; if ( n == 3 || mv1 ) { vc1_pred_mv ( v , 0 , dmv_x [ 0 ] , dmv_y [ 0 ] , 1 , v -> range_x , v -> range_y , v -> mb_type [ 0 ] , 0 , 0 ) ; } } else { vc1_pred_mv ( v , n , dmv_x [ 0 ] , dmv_y [ 0 ] , mv1 , v -> range_x , v -> range_y , v -> mb_type [ 0 ] , pred_flag [ 0 ] , 0 ) ; if ( n == 3 || mv1 ) { vc1_pred_mv ( v , 0 , dmv_x [ 1 ] , dmv_y [ 1 ] , 1 , v -> range_x , v -> range_y , v -> mb_type [ 0 ] , 0 , 1 ) ; } } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void indexed_to_alt ( fz_context * ctx , const fz_colorspace * cs , const float * color , float * alt ) { struct indexed * idx = cs -> data ; int i , k ; int n = idx -> base -> n ; i = color [ 0 ] * 255 ; i = fz_clampi ( i , 0 , idx -> high ) ; for ( k = 0 ; k < n ; k ++ ) alt [ k ] = idx -> lookup [ i * n + k ] / 255.0f ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( SoundContentSettingObserverTest , AudioMutingUpdatesWithNavigation ) { EXPECT_FALSE ( web_contents ( ) -> IsAudioMuted ( ) ) ; ChangeSoundContentSettingTo ( CONTENT_SETTING_BLOCK ) ; EXPECT_TRUE ( web_contents ( ) -> IsAudioMuted ( ) ) ; NavigateAndCommit ( GURL ( kURL2 ) ) ; EXPECT_FALSE ( web_contents ( ) -> IsAudioMuted ( ) ) ; NavigateAndCommit ( GURL ( kURL1 ) ) ; EXPECT_TRUE ( web_contents ( ) -> IsAudioMuted ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_IS11172VideoMode ( 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_IS11172VideoMode , IS11172VideoMode_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void vout_unlink_picture ( decoder_t * p_dec , picture_t * p_pic ) { vout_ReleasePicture ( p_dec -> p_owner -> p_vout , p_pic ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const char * html_replace ( char ch , char * buf ) { switch ( ch ) { case '<' : return "&lt; " ; case '>' : return "&gt; " ; case '"' : return "&quot; " ; case '\'' : return "&#039; " ; case '&' : return "&amp; " ; default : break ; } buf [ 0 ] = ch ; buf [ 1 ] = '\0' ; return buf ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int getStrrtokenPos ( char * str , int savedPos ) { int result = - 1 ; int i ; for ( i = savedPos - 1 ; i >= 0 ; i -- ) { if ( isIDSeparator ( * ( str + i ) ) ) { if ( i >= 2 && isIDSeparator ( * ( str + i - 2 ) ) ) { result = i - 2 ; } else { result = i ; } break ; } } if ( result < 1 ) { result = - 1 ; } return result ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void exsltMathLowestFunction ( xmlXPathParserContextPtr ctxt , int nargs ) { xmlNodeSetPtr ns , ret ; void * user = NULL ; if ( nargs != 1 ) { xmlXPathSetArityError ( ctxt ) ; return ; } if ( ( ctxt -> value != NULL ) && ( ctxt -> value -> boolval != 0 ) ) { user = ctxt -> value -> user ; ctxt -> value -> boolval = 0 ; ctxt -> value -> user = NULL ; } ns = xmlXPathPopNodeSet ( ctxt ) ; if ( xmlXPathCheckError ( ctxt ) ) return ; ret = exsltMathLowest ( ns ) ; xmlXPathFreeNodeSet ( ns ) ; if ( user != NULL ) xmlFreeNodeList ( ( xmlNodePtr ) user ) ; xmlXPathReturnNodeSet ( ctxt , ret ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void xhci_oper_write ( void * ptr , hwaddr reg , uint64_t val , unsigned size ) { XHCIState * xhci = ptr ; DeviceState * d = DEVICE ( ptr ) ; trace_usb_xhci_oper_write ( reg , val ) ; switch ( reg ) { case 0x00 : if ( ( val & USBCMD_RS ) && ! ( xhci -> usbcmd & USBCMD_RS ) ) { xhci_run ( xhci ) ; } else if ( ! ( val & USBCMD_RS ) && ( xhci -> usbcmd & USBCMD_RS ) ) { xhci_stop ( xhci ) ; } if ( val & USBCMD_CSS ) { xhci -> usbsts &= ~ USBSTS_SRE ; } if ( val & USBCMD_CRS ) { xhci -> usbsts |= USBSTS_SRE ; } xhci -> usbcmd = val & 0xc0f ; xhci_mfwrap_update ( xhci ) ; if ( val & USBCMD_HCRST ) { xhci_reset ( d ) ; } xhci_intx_update ( xhci ) ; break ; case 0x04 : xhci -> usbsts &= ~ ( val & ( USBSTS_HSE | USBSTS_EINT | USBSTS_PCD | USBSTS_SRE ) ) ; xhci_intx_update ( xhci ) ; break ; case 0x14 : xhci -> dnctrl = val & 0xffff ; break ; case 0x18 : xhci -> crcr_low = ( val & 0xffffffcf ) | ( xhci -> crcr_low & CRCR_CRR ) ; break ; case 0x1c : xhci -> crcr_high = val ; if ( xhci -> crcr_low & ( CRCR_CA | CRCR_CS ) && ( xhci -> crcr_low & CRCR_CRR ) ) { XHCIEvent event = { ER_COMMAND_COMPLETE , CC_COMMAND_RING_STOPPED } ; xhci -> crcr_low &= ~ CRCR_CRR ; xhci_event ( xhci , & event , 0 ) ; DPRINTF ( "xhci: command ring stopped (CRCR=%08x)\n" , xhci -> crcr_low ) ; } else { dma_addr_t base = xhci_addr64 ( xhci -> crcr_low & ~ 0x3f , val ) ; xhci_ring_init ( xhci , & xhci -> cmd_ring , base ) ; } xhci -> crcr_low &= ~ ( CRCR_CA | CRCR_CS ) ; break ; case 0x30 : xhci -> dcbaap_low = val & 0xffffffc0 ; break ; case 0x34 : xhci -> dcbaap_high = val ; break ; case 0x38 : xhci -> config = val & 0xff ; break ; default : trace_usb_xhci_unimplemented ( "oper write" , reg ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void decode_pitch_lag_high ( int * lag_int , int * lag_frac , int pitch_index , uint8_t * base_lag_int , int subframe ) { if ( subframe == 0 || subframe == 2 ) { if ( pitch_index < 376 ) { * lag_int = ( pitch_index + 137 ) >> 2 ; * lag_frac = pitch_index - ( * lag_int << 2 ) + 136 ; } else if ( pitch_index < 440 ) { * lag_int = ( pitch_index + 257 - 376 ) >> 1 ; * lag_frac = ( pitch_index - ( * lag_int << 1 ) + 256 - 376 ) << 1 ; } else { * lag_int = pitch_index - 280 ; * lag_frac = 0 ; } * base_lag_int = av_clip ( * lag_int - 8 - ( * lag_frac < 0 ) , AMRWB_P_DELAY_MIN , AMRWB_P_DELAY_MAX - 15 ) ; } else { * lag_int = ( pitch_index + 1 ) >> 2 ; * lag_frac = pitch_index - ( * lag_int << 2 ) ; * lag_int += * base_lag_int ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( TemplateURLTest , ParseURLNoTemplateEnd ) { TemplateURLData data ; data . SetURL ( "{ " ) ; TemplateURL url ( data ) ; TemplateURLRef : : Replacements replacements ; bool valid = false ; EXPECT_EQ ( std : : string ( ) , url . url_ref ( ) . ParseURL ( "{ " , & replacements , NULL , & valid ) ) ; EXPECT_TRUE ( replacements . empty ( ) ) ; EXPECT_FALSE ( valid ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static __inline__ void TLV_LIST_INIT ( struct tlv_list_desc * list , void * data , __u32 space ) { list -> tlv_ptr = ( struct tlv_desc * ) data ; list -> tlv_space = space ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static enum nss_status internal_getent ( struct STRUCTURE * result , char * buffer , size_t buflen , int * errnop H_ERRNO_PROTO EXTRA_ARGS_DECL ) { char * p ; struct parser_data * data = ( void * ) buffer ; size_t linebuflen = buffer + buflen - data -> linebuffer ; int parse_result ; if ( buflen < sizeof * data + 2 ) { * errnop = ERANGE ; H_ERRNO_SET ( NETDB_INTERNAL ) ; return NSS_STATUS_TRYAGAIN ; } do { get_contents_ret r = get_contents ( data -> linebuffer , linebuflen , stream ) ; if ( r == gcr_error ) { H_ERRNO_SET ( HOST_NOT_FOUND ) ; return NSS_STATUS_NOTFOUND ; } if ( r == gcr_overflow ) { * errnop = ERANGE ; H_ERRNO_SET ( NETDB_INTERNAL ) ; return NSS_STATUS_TRYAGAIN ; } p = data -> linebuffer ; while ( isspace ( * p ) ) ++ p ; } while ( * p == '\0' || * p == '#' || ! ( parse_result = parse_line ( p , result , data , buflen , errnop EXTRA_ARGS ) ) ) ; if ( __glibc_unlikely ( parse_result == - 1 ) ) { H_ERRNO_SET ( NETDB_INTERNAL ) ; return NSS_STATUS_TRYAGAIN ; } return NSS_STATUS_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int encrypt_and_sign_nss_2_3 ( struct crypto_instance * instance , const unsigned char * buf_in , const size_t buf_in_len , unsigned char * buf_out , size_t * buf_out_len ) { if ( encrypt_nss ( instance , buf_in , buf_in_len , buf_out + sizeof ( struct crypto_config_header ) , buf_out_len ) < 0 ) { return - 1 ; } * buf_out_len += sizeof ( struct crypto_config_header ) ; if ( hash_to_nss [ instance -> crypto_hash_type ] ) { if ( calculate_nss_hash ( instance , buf_out , * buf_out_len , buf_out + * buf_out_len ) < 0 ) { return - 1 ; } * buf_out_len += hash_len [ instance -> crypto_hash_type ] ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
bool contain_volatile_functions_not_nextval ( Node * clause ) { return contain_volatile_functions_not_nextval_walker ( clause , NULL ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void purple_logout ( struct im_connection * ic ) { struct purple_data * pd = ic -> proto_data ; if ( ! pd ) { return ; } while ( ic -> groupchats ) { imcb_chat_free ( ic -> groupchats -> data ) ; } purple_account_set_enabled ( pd -> account , "BitlBee" , FALSE ) ; purple_connections = g_slist_remove ( purple_connections , ic ) ; purple_accounts_remove ( pd -> account ) ; imcb_chat_list_free ( ic ) ; g_free ( pd -> chat_list_server ) ; g_hash_table_destroy ( pd -> input_requests ) ; g_free ( pd ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
unsigned int vp9_sad ## m ## x ## n ## _avg_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , const uint8_t * second_pred ) { uint8_t comp_pred [ m * n ] ; vp9_comp_avg_pred ( comp_pred , second_pred , m , n , ref , ref_stride ) ; return sad ( src , src_stride , comp_pred , m , m , n ) ; \ } # define sadMxNxK ( m , n , k ) void vp9_sad ## m ## x ## n ## x ## k ## _c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sads ) { int i ; for ( i = 0 ; i < k ; ++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , & ref [ i ] , ref_stride ) ; \ } # define sadMxNx4D ( m , n ) void vp9_sad ## m ## x ## n ## x4d_c ( const uint8_t * src , int src_stride , const uint8_t * const refs [ ] , int ref_stride , unsigned int * sads ) { int i ; for ( i = 0 ; i < 4 ; ++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , refs [ i ] , ref_stride ) ; \ } sadMxN ( 64 , 64 ) sadMxNxK ( 64 , 64 , 3 ) sadMxNxK ( 64 , 64 , 8 ) sadMxNx4D ( 64 , 64 ) sadMxN ( 64 , 32 ) sadMxNx4D ( 64 , 32 ) sadMxN ( 32 , 64 ) sadMxNx4D ( 32 , 64 ) sadMxN ( 32 , 32 ) sadMxNxK ( 32 , 32 , 3 ) sadMxNxK ( 32 , 32 , 8 ) sadMxNx4D ( 32 , 32 ) sadMxN ( 32 , 16 ) sadMxNx4D ( 32 , 16 ) sadMxN ( 16 , 32 ) sadMxNx4D ( 16 , 32 ) sadMxN ( 16 , 16 ) sadMxNxK ( 16 , 16 , 3 ) sadMxNxK ( 16 , 16 , 8 ) sadMxNx4D ( 16 , 16 ) sadMxN ( 16 , 8 ) sadMxNxK ( 16 , 8 , 3 ) sadMxNxK ( 16 , 8 , 8 ) sadMxNx4D ( 16 , 8 ) sadMxN ( 8 , 16 ) sadMxNxK ( 8 , 16 , 3 ) sadMxNxK ( 8 , 16 , 8 ) sadMxNx4D ( 8 , 16 ) sadMxN ( 8 , 8 )
0False
Categorize the following code snippet as vulnerable or not. True or False
static int userauth_hostbased ( struct ssh * ssh ) { Authctxt * authctxt = ssh -> authctxt ; struct sshbuf * b ; struct sshkey * key = NULL ; char * pkalg , * cuser , * chost ; u_char * pkblob , * sig ; size_t alen , blen , slen ; int r , pktype , authenticated = 0 ; if ( ! authctxt -> valid ) { debug2 ( "%s: disabled because of invalid user" , __func__ ) ; return 0 ; } if ( ( r = sshpkt_get_cstring ( ssh , & pkalg , & alen ) ) != 0 || ( r = sshpkt_get_string ( ssh , & pkblob , & blen ) ) != 0 || ( r = sshpkt_get_cstring ( ssh , & chost , NULL ) ) != 0 || ( r = sshpkt_get_cstring ( ssh , & cuser , NULL ) ) != 0 || ( r = sshpkt_get_string ( ssh , & sig , & slen ) ) != 0 ) fatal ( "%s: packet parsing: %s" , __func__ , ssh_err ( r ) ) ; debug ( "%s: cuser %s chost %s pkalg %s slen %zu" , __func__ , cuser , chost , pkalg , slen ) ; # ifdef DEBUG_PK debug ( "signature:" ) ; sshbuf_dump_data ( sig , siglen , stderr ) ; # endif pktype = sshkey_type_from_name ( pkalg ) ; if ( pktype == KEY_UNSPEC ) { logit ( "%s: unsupported public key algorithm: %s" , __func__ , pkalg ) ; goto done ; } if ( ( r = sshkey_from_blob ( pkblob , blen , & key ) ) != 0 ) { error ( "%s: key_from_blob: %s" , __func__ , ssh_err ( r ) ) ; goto done ; } if ( key == NULL ) { error ( "%s: cannot decode key: %s" , __func__ , pkalg ) ; goto done ; } if ( key -> type != pktype ) { error ( "%s: type mismatch for decoded key " "(received %d, expected %d)" , __func__ , key -> type , pktype ) ; goto done ; } if ( sshkey_type_plain ( key -> type ) == KEY_RSA && ( ssh -> compat & SSH_BUG_RSASIGMD5 ) != 0 ) { error ( "Refusing RSA key because peer uses unsafe " "signature format" ) ; goto done ; } if ( match_pattern_list ( pkalg , options . hostbased_key_types , 0 ) != 1 ) { logit ( "%s: key type %s not in HostbasedAcceptedKeyTypes" , __func__ , sshkey_type ( key ) ) ; goto done ; } if ( ( b = sshbuf_new ( ) ) == NULL ) fatal ( "%s: sshbuf_new failed" , __func__ ) ; if ( ( r = sshbuf_put_string ( b , session_id2 , session_id2_len ) ) != 0 || ( r = sshbuf_put_u8 ( b , SSH2_MSG_USERAUTH_REQUEST ) ) != 0 || ( r = sshbuf_put_cstring ( b , authctxt -> user ) ) != 0 || ( r = sshbuf_put_cstring ( b , authctxt -> service ) ) != 0 || ( r = sshbuf_put_cstring ( b , "hostbased" ) ) != 0 || ( r = sshbuf_put_string ( b , pkalg , alen ) ) != 0 || ( r = sshbuf_put_string ( b , pkblob , blen ) ) != 0 || ( r = sshbuf_put_cstring ( b , chost ) ) != 0 || ( r = sshbuf_put_cstring ( b , cuser ) ) != 0 ) fatal ( "%s: buffer error: %s" , __func__ , ssh_err ( r ) ) ; # ifdef DEBUG_PK sshbuf_dump ( b , stderr ) ; # endif auth2_record_info ( authctxt , "client user \"%.100s\", client host \"%.100s\"" , cuser , chost ) ; authenticated = 0 ; if ( PRIVSEP ( hostbased_key_allowed ( authctxt -> pw , cuser , chost , key ) ) && PRIVSEP ( sshkey_verify ( key , sig , slen , sshbuf_ptr ( b ) , sshbuf_len ( b ) , pkalg , ssh -> compat ) ) == 0 ) authenticated = 1 ; auth2_record_key ( authctxt , authenticated , key ) ; sshbuf_free ( b ) ; done : debug2 ( "%s: authenticated %d" , __func__ , authenticated ) ; sshkey_free ( key ) ; free ( pkalg ) ; free ( pkblob ) ; free ( cuser ) ; free ( chost ) ; free ( sig ) ; return authenticated ; }
1True