Unnamed: 0
int64 0
535k
| source
stringlengths 50
89.8k
| target
stringlengths 23
37.7k
|
---|---|---|
700 | CWE-000 void m2Analysis ( brain * b ) { while ( 1 ) { int score = 0 ; pendulumWorld * world = initRandomPendulumWorld ( ) ; brain * testInstance = forkBrain ( b ) ; while ( world -> weightYPos > 0 ) { score += 1 ; int inputs [ 22 ] ; int outputs [ 9 ] ; inputs [ 0 ] = world -> weightXVel > 0 ; inputs [ 9 ] = world -> weightYVel > 0 ; int normedWeightXVel = abs ( ( int ) ( 255 * world -> weightXVel ) ) ; if ( normedWeightXVel > 255 ) { normedWeightXVel = 255 ; } int normedWeightYVel = abs ( ( int ) ( 63 * world -> weightYVel ) ) ; if ( normedWeightYVel > 255 ) { normedWeightYVel = 255 ; } int normedHeight = ( int ) ( ( world -> weightYPos / PENDULUM_LENGTH ) * 15 ) ; if ( normedHeight > 15 ) { normedHeight = 15 ; } mapIntToUnaryArray ( normedWeightXVel , & ( inputs [ 1 ] ) , 8 ) ; mapIntToUnaryArray ( normedWeightYVel , & ( inputs [ 10 ] ) , 8 ) ; mapIntToUnaryArray ( normedHeight , & ( inputs [ 18 ] ) , 4 ) ; for ( int c = 0 ; c < 5 ; c ++ ) { advanceBrain ( testInstance , & ( inputs [ 0 ] ) , 22 , & ( outputs [ 0 ] ) , 9 ) ; } struct timespec interval ; interval . tv_sec = 0 ; <S2SV_StartBug> interval . tv_nsec = 200000000 ; <S2SV_EndBug> nanosleep ( & interval , NULL ) ; graphicalDisplay ( world ) ; <S2SV_StartBug> printf ( "X<S2SV_blank>VELOCITY:<S2SV_blank>%i,<S2SV_blank>Y<S2SV_blank>VELOCITY:<S2SV_blank>%i,<S2SV_blank>HEIGHT:<S2SV_blank>%i\\n" , normedWeightXVel , normedWeightYVel , normedHeight ) ; <S2SV_EndBug> int brainOutput = mapArrayToInt ( & ( outputs [ 0 ] ) , 8 ) ; if ( outputs [ 8 ] ) { brainOutput *= - 1 ; } advancePendulumWorld ( world , brainOutput / 255.0 ) ; } free ( world ) ; freeBrain ( testInstance ) ; printf ( "\\033[2J" ) ; printf ( "SCORE:<S2SV_blank>%i\\n" , score ) ; struct timespec interval ; interval . tv_sec = 1 ; interval . tv_nsec = 0 ; nanosleep ( & interval , NULL ) ; } } | <S2SV_ModStart> . tv_nsec = 20000000 <S2SV_ModEnd> ; nanosleep ( <S2SV_ModStart> normedWeightYVel , normedHeight ) ; printf ( "X<S2SV_blank>VELOCITY<S2SV_blank>ACTUAL:<S2SV_blank>%f,<S2SV_blank>Y<S2SV_blank>VELOCITY<S2SV_blank>ACTUAL:<S2SV_blank>%f,<S2SV_blank>HEIGHT<S2SV_blank>ACTUAL:<S2SV_blank>%f\\n" , world -> weightXVel , world -> weightYVel , world -> weightYPos |
701 | CWE-000 void btsak_cmd_gatt_read ( FAR struct btsak_s * btsak , int argc , FAR char * argv [ ] ) { struct btreq_s btreq ; int sockfd ; int ret ; if ( argc == 2 && strcmp ( argv [ 1 ] , "-h" ) == 0 ) { btsak_gatt_showusage ( btsak -> progname , argv [ 0 ] , EXIT_SUCCESS ) ; } if ( argc < 4 || argc > 5 ) { fprintf ( stderr , "ERROR:<S2SV_blank><S2SV_blank>Invalid<S2SV_blank>number<S2SV_blank>of<S2SV_blank>arguments.<S2SV_blank><S2SV_blank>Found<S2SV_blank>%d<S2SV_blank>expected<S2SV_blank>3<S2SV_blank>or<S2SV_blank>4\\n" , argc - 1 ) ; btsak_gatt_showusage ( btsak -> progname , argv [ 0 ] , EXIT_FAILURE ) ; } ret = btsak_str2addr ( argv [ 1 ] , btreq . btr_rdpeer . val ) ; if ( ret < 0 ) { fprintf ( stderr , "ERROR:<S2SV_blank><S2SV_blank>Bad<S2SV_blank>value<S2SV_blank>for<S2SV_blank><addr>:<S2SV_blank>%s\\n" , argv [ 1 ] ) ; btsak_gatt_showusage ( btsak -> progname , argv [ 0 ] , EXIT_FAILURE ) ; } ret = btsak_str2addrtype ( argv [ 2 ] , & btreq . btr_rdpeer . type ) ; <S2SV_StartBug> { <S2SV_EndBug> fprintf ( stderr , "ERROR:<S2SV_blank><S2SV_blank>Bad<S2SV_blank>value<S2SV_blank>for<S2SV_blank>address<S2SV_blank>type:<S2SV_blank>%s\\n" , argv [ 2 ] ) ; btsak_gatt_showusage ( btsak -> progname , argv [ 0 ] , EXIT_FAILURE ) ; } btreq . btr_rdhandles [ 0 ] = btsak_str2uint16 ( argv [ 3 ] ) ; btreq . btr_rdnhandles = 1 ; btreq . btr_rdoffset = 0 ; if ( argc > 4 ) { btreq . btr_rdoffset = btsak_str2uint16 ( argv [ 4 ] ) ; } strncpy ( btreq . btr_name , btsak -> ifname , IFNAMSIZ ) ; sockfd = btsak_socket ( btsak ) ; if ( sockfd >= 0 ) { ret = ioctl ( sockfd , SIOCBTGATTRD , ( unsigned long ) ( ( uintptr_t ) & btreq ) ) ; if ( ret < 0 ) { fprintf ( stderr , "ERROR:<S2SV_blank><S2SV_blank>ioctl(SIOCBTGATTRD)<S2SV_blank>failed:<S2SV_blank>%d\\n" , errno ) ; } else { printf ( "Read<S2SV_blank>pending...\\n" ) ; } close ( sockfd ) ; } } | <S2SV_ModStart> type ) ; if ( ret < 0 ) |
702 | CWE-000 static int writeserial ( serial_t * serial , unsigned char * buff , int n , char * msg ) { int ns ; tracet ( 3 , "writeserial:<S2SV_blank>dev=%d<S2SV_blank>n=%d\\n" , serial -> dev , n ) ; if ( ! serial ) return 0 ; # ifdef WIN32 if ( ( ns = writeseribuff ( serial , buff , n ) ) < n ) serial -> error = 1 ; # else <S2SV_StartBug> if ( write ( serial -> dev , buff , n ) < 0 ) { <S2SV_EndBug> serial -> error = 1 ; <S2SV_StartBug> ns = 0 ; <S2SV_EndBug> } # endif tracet ( 5 , "writeserial:<S2SV_blank>exit<S2SV_blank>dev=%d<S2SV_blank>ns=%d\\n" , serial -> dev , ns ) ; return ns ; } | <S2SV_ModStart> else if ( ( ns = <S2SV_ModStart> , n ) ) < n <S2SV_ModEnd> ) { serial <S2SV_ModStart> ; ns = - 1 <S2SV_ModEnd> ; } # |
703 | CWE-000 void PgpCard_Remove ( struct pci_dev * pcidev ) { uint32_t x ; struct DmaDevice * dev = NULL ; pr_info ( "%s:<S2SV_blank>Remove:<S2SV_blank>Remove<S2SV_blank>called.\\n" , MOD_NAME ) ; for ( x = 0 ; x < MAX_DMA_DEVICES ; x ++ ) { if ( gDmaDevices [ x ] . baseAddr == pci_resource_start ( pcidev , 0 ) ) { dev = & gDmaDevices [ x ] ; break ; } } if ( dev == NULL ) { pr_err ( "%s:<S2SV_blank>Remove:<S2SV_blank>Device<S2SV_blank>Not<S2SV_blank>Found.\\n" , MOD_NAME ) ; return ; } gDmaDevCount -- ; <S2SV_StartBug> pci_disable_device ( pcidev ) ; <S2SV_EndBug> Dma_Clean ( dev ) ; pr_info ( "%s:<S2SV_blank>Remove:<S2SV_blank>Driver<S2SV_blank>is<S2SV_blank>unloaded.\\n" , MOD_NAME ) ; } | <S2SV_ModStart> gDmaDevCount -- ; Dma_Clean ( dev ) ; <S2SV_ModStart> pci_disable_device ( pcidev <S2SV_ModEnd> ) ; pr_info |
704 | CWE-000 static drive_t * media_changed ( ) { drive_t * drvp ; static int i = 0 ; for ( i = i >= queuesz ? 0 : i ; i < queuesz ; i ++ ) { if ( has_media ( pollqueue [ i ] -> dev ) ) { if ( ! pollqueue [ i ] -> has_media ) { pollqueue [ i ] -> has_media = true ; return ( pollqueue [ i ++ ] ) ; } } else { if ( errno == ENOENT ) { logprint ( "Lost<S2SV_blank>%s" , pollqueue [ i ] -> dev ) ; ( void ) pthread_mutex_lock ( & drv_mtx ) ; drvp = lookupdrv ( pollqueue [ i ] -> dev ) ; <S2SV_StartBug> if ( drvp != NULL ) <S2SV_EndBug> <S2SV_StartBug> del_drive ( drvp ) ; <S2SV_EndBug> ( void ) pthread_mutex_unlock ( & drv_mtx ) ; i = 0 ; return ( NULL ) ; } if ( pollqueue [ i ] -> has_media ) { pollqueue [ i ] -> has_media = false ; return ( pollqueue [ i ++ ] ) ; } } } return ( NULL ) ; } | <S2SV_ModStart> != NULL ) { ( void ) pthread_mutex_lock ( & drvp -> mtx ) ; <S2SV_ModStart> drvp ) ; } |
705 | CWE-000 static int xive_set_source ( struct kvmppc_xive * xive , long irq , u64 addr ) { struct kvmppc_xive_src_block * sb ; struct kvmppc_xive_irq_state * state ; u64 __user * ubufp = ( u64 __user * ) addr ; u16 idx ; u64 val ; u8 act_prio , guest_prio ; u32 server ; int rc = 0 ; if ( irq < KVMPPC_XICS_FIRST_IRQ || irq >= KVMPPC_XICS_NR_IRQS ) return - ENOENT ; pr_devel ( "set_source(irq=0x%lx)\\n" , irq ) ; sb = kvmppc_xive_find_source ( xive , irq , & idx ) ; if ( ! sb ) { pr_devel ( "No<S2SV_blank>source,<S2SV_blank>creating<S2SV_blank>source<S2SV_blank>block...\\n" ) ; sb = xive_create_src_block ( xive , irq ) ; if ( ! sb ) { pr_devel ( "Failed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>block...\\n" ) ; return - ENOMEM ; } } state = & sb -> irq_state [ idx ] ; if ( get_user ( val , ubufp ) ) { pr_devel ( "fault<S2SV_blank>getting<S2SV_blank>user<S2SV_blank>info<S2SV_blank>!\\n" ) ; return - EFAULT ; } server = val & KVM_XICS_DESTINATION_MASK ; guest_prio = val >> KVM_XICS_PRIORITY_SHIFT ; pr_devel ( "<S2SV_blank><S2SV_blank>val=0x016%llx<S2SV_blank>(server=0x%x,<S2SV_blank>guest_prio=%d)\\n" , val , server , guest_prio ) ; if ( ! state -> ipi_number ) { state -> ipi_number = xive_native_alloc_irq ( ) ; if ( state -> ipi_number == 0 ) { pr_devel ( "Failed<S2SV_blank>to<S2SV_blank>allocate<S2SV_blank>IPI<S2SV_blank>!\\n" ) ; return - ENOMEM ; } xive_native_populate_irq_data ( state -> ipi_number , & state -> ipi_data ) ; pr_devel ( "<S2SV_blank>src_ipi=0x%x\\n" , state -> ipi_number ) ; } state -> guest_priority = 0 ; xive_lock_and_mask ( xive , sb , state ) ; act_prio = xive_prio_from_guest ( guest_prio ) ; state -> act_priority = MASKED ; arch_spin_unlock ( & sb -> lock ) ; if ( act_prio != MASKED ) { mutex_lock ( & xive -> kvm -> lock ) ; rc = xive_check_provisioning ( xive -> kvm , act_prio ) ; mutex_unlock ( & xive -> kvm -> lock ) ; if ( rc == 0 ) rc = xive_target_interrupt ( xive -> kvm , state , server , act_prio ) ; } if ( xive -> delayed_irqs && xive_check_delayed_irq ( xive , irq ) ) { val |= KVM_XICS_PENDING ; pr_devel ( "<S2SV_blank><S2SV_blank>Found<S2SV_blank>delayed<S2SV_blank>!<S2SV_blank>forcing<S2SV_blank>PENDING<S2SV_blank>!\\n" ) ; } state -> old_p = false ; state -> old_q = false ; state -> lsi = false ; state -> asserted = false ; if ( val & KVM_XICS_LEVEL_SENSITIVE ) { state -> lsi = true ; if ( val & KVM_XICS_PENDING ) state -> asserted = true ; pr_devel ( "<S2SV_blank><S2SV_blank>LSI<S2SV_blank>!<S2SV_blank>Asserted=%d\\n" , state -> asserted ) ; } <S2SV_StartBug> if ( val & KVM_XICS_PRESENTED || val & KVM_XICS_PENDING ) <S2SV_EndBug> state -> old_p = true ; if ( val & KVM_XICS_QUEUED || val & KVM_XICS_PENDING ) state -> old_q = true ; pr_devel ( "<S2SV_blank><S2SV_blank>P=%d,<S2SV_blank>Q=%d\\n" , state -> old_p , state -> old_q ) ; if ( val & KVM_XICS_MASKED ) { pr_devel ( "<S2SV_blank><S2SV_blank>masked,<S2SV_blank>saving<S2SV_blank>prio\\n" ) ; state -> guest_priority = MASKED ; state -> saved_priority = guest_prio ; } else { pr_devel ( "<S2SV_blank><S2SV_blank>unmasked,<S2SV_blank>restoring<S2SV_blank>to<S2SV_blank>prio<S2SV_blank>%d\\n" , guest_prio ) ; xive_finish_unmask ( xive , sb , state , guest_prio ) ; state -> saved_priority = guest_prio ; } if ( ! state -> valid ) xive -> src_count ++ ; state -> valid = true ; return 0 ; } | <S2SV_ModStart> val & KVM_XICS_PRESENTED && ! ( <S2SV_ModEnd> val & KVM_XICS_PENDING <S2SV_ModStart> val & KVM_XICS_PENDING ) |
706 | CWE-000 void processInstruction ( Hardware * hardware , InstructionMapping * mapping , int instruction ) { char opSize = mapping -> sizeBytes ; opSize = opSize < 1 ? 1 : opSize ; int nextPCAddressValue = hardware -> registers -> PC + opSize ; int cyclesToWait = 1 ; bool shouldExecute = true ; FlagCondition * flagCondition = mapping -> flagCondition ; if ( flagCondition != NULL ) { shouldExecute = ( ( hardware -> registers -> F & flagCondition -> condition ) == flagCondition -> condition ) ; if ( flagCondition -> negate ) shouldExecute = ! shouldExecute ; } if ( shouldExecute ) { GBValue * operand1 , * operand2 , * destination ; switch ( instruction ) { case OpCode_DAA : decimalAdjustValue ( & hardware -> registers -> A , & hardware -> registers -> F ) ; break ; case OpCode_NOP : break ; case OpCode_PREFIX_CB : hardware -> opCodePrefix = OPCODE_PREFIX_CB ; break ; case OpCode_DI : hardware -> registers -> globalInterruptsEnabled = false ; break ; case OpCode_EI : hardware -> registers -> globalInterruptsEnabled = true ; break ; case OpCode_HALT : nextPCAddressValue = hardware -> registers -> PC ; break ; case OpCode_STOP : THROW_ERROR ( "Unsupported<S2SV_blank>instruction<S2SV_blank>STOP" ) ; break ; default : populateComputedValues ( hardware , nextPCAddressValue ) ; operand1 = mapping -> operand1 ; operand2 = mapping -> operand2 ; int resultValue ; int * result = mapping -> result ; if ( result != NULL ) { populateOperationResults ( hardware -> operationResults , operand1 , operand2 , hardware -> registers -> F ) ; <S2SV_StartBug> resultValue = * result ; <S2SV_EndBug> } else resultValue = GBValueToInt ( operand1 ) ; FlagResult * flagResult = mapping -> flagResult ; <S2SV_StartBug> processFlags ( hardware , operand1 , operand2 , & resultValue , flagResult ) ; <S2SV_EndBug> int * nextPC = mapping -> nextPC ; if ( nextPC != NULL ) nextPCAddressValue = * nextPC ; int * nextSP = mapping -> nextSP ; if ( nextSP != NULL ) hardware -> registers -> SP = * nextSP ; destination = mapping -> destination ; <S2SV_StartBug> processDestination ( hardware , & resultValue , destination ) ; <S2SV_EndBug> if ( instruction == OpCode_LD_A_MEM_HLI || instruction == OpCode_LD_MEM_HLI_A ) { hardware -> computedValues -> HL ++ ; splitBytes ( hardware -> computedValues -> HL , & ( hardware -> registers -> L ) , & ( hardware -> registers -> H ) ) ; } else if ( instruction == OpCode_LD_A_MEM_HLD || instruction == OpCode_LD_MEM_HLD_A ) { hardware -> computedValues -> HL -- ; splitBytes ( hardware -> computedValues -> HL , & ( hardware -> registers -> L ) , & ( hardware -> registers -> H ) ) ; } else if ( instruction == OpCode_RETI ) { hardware -> registers -> globalInterruptsEnabled = true ; } break ; } } hardware -> registers -> PC = nextPCAddressValue ; if ( mapping -> cycleCount != NULL ) { if ( shouldExecute ) cyclesToWait = mapping -> cycleCount -> executeCycles ; else cyclesToWait = mapping -> cycleCount -> dontExecuteCycles ; } hardware -> cpuCyclesToWait = cyclesToWait < 1 ? 1 : cyclesToWait ; } | <S2SV_ModStart> F ) ; } else { resultValue = GBValueToInt ( operand1 ) ; result = & resultValue ; } FlagResult * flagResult = mapping -> flagResult ; processFlags ( hardware , operand1 <S2SV_ModEnd> , operand2 , <S2SV_ModStart> , operand2 , result <S2SV_ModEnd> , flagResult ) <S2SV_ModStart> ( hardware , result <S2SV_ModEnd> , destination ) |
707 | CWE-000 static gboolean do_recheck ( gpointer data ) { Directory * dir = ( Directory * ) data ; g_return_val_if_fail ( dir != NULL , FALSE ) ; g_return_val_if_fail ( dir -> recheck_list != NULL , FALSE ) ; if ( ! g_queue_is_empty ( dir -> recheck_list ) ) { g_mutex_lock ( & dir -> mutex ) ; DirItem * item = g_queue_pop_tail ( dir -> recheck_list ) ; if ( item -> flags & ITEM_FLAG_GONE ) diritem_free ( item ) ; else { item = _insert_item ( dir , item , item -> leafname , FALSE ) ; if ( item && item -> flags & ITEM_FLAG_NEED_EXAMINE && ! ( item -> flags & ITEM_FLAG_IN_EXAMINE ) ) { g_queue_push_head ( dir -> examine_list , item ) ; item -> flags |= ITEM_FLAG_IN_EXAMINE ; } } g_mutex_unlock ( & dir -> mutex ) ; g_thread_yield ( ) ; if ( g_queue_is_empty ( dir -> recheck_list ) ) dir -> req_scan_off = TRUE ; return TRUE ; } if ( ! g_queue_is_empty ( dir -> examine_list ) ) { g_mutex_lock ( & dir -> mutex ) ; DirItem * item = g_queue_pop_tail ( dir -> examine_list ) ; <S2SV_StartBug> if ( item -> flags & ITEM_FLAG_GONE ) <S2SV_EndBug> diritem_free ( item ) ; else if ( item -> flags & ITEM_FLAG_NEED_EXAMINE ) { if ( diritem_examine_dir ( make_path_to_buf ( dir -> strbuf , dir -> pathname , item -> leafname ) , item ) ) { g_mutex_lock ( & dir -> mergem ) ; g_ptr_array_add ( dir -> exa_items , item ) ; g_mutex_unlock ( & dir -> mergem ) ; delayed_notify ( dir , FALSE ) ; } } item -> flags &= ~ ITEM_FLAG_IN_EXAMINE ; <S2SV_StartBug> g_mutex_unlock ( & dir -> mutex ) ; <S2SV_EndBug> if ( ! g_queue_is_empty ( dir -> examine_list ) ) return TRUE ; } return FALSE ; } | <S2SV_ModStart> examine_list ) ; <S2SV_ModEnd> item -> flags <S2SV_ModStart> ~ ITEM_FLAG_IN_EXAMINE ; if ( item -> flags & ITEM_FLAG_GONE ) diritem_free ( item ) ; else if ( item -> flags & ITEM_FLAG_NEED_EXAMINE ) { if ( diritem_examine_dir ( make_path_to_buf ( dir -> strbuf , dir -> pathname , item -> leafname ) , item ) ) { g_mutex_lock ( & dir -> mergem ) ; g_ptr_array_add ( dir -> exa_items , item ) ; g_mutex_unlock ( & dir -> mergem ) ; delayed_notify ( dir , FALSE ) ; } } |
708 | CWE-000 static void _outGather ( StringInfo str , const Gather * node ) { WRITE_NODE_TYPE ( "GATHER" ) ; _outPlanInfo ( str , ( const Plan * ) node ) ; WRITE_INT_FIELD ( num_workers ) ; <S2SV_StartBug> WRITE_BOOL_FIELD ( single_copy ) ; <S2SV_EndBug> WRITE_BOOL_FIELD ( invisible ) ; } | <S2SV_ModStart> num_workers ) ; WRITE_INT_FIELD ( rescan_param ) ; |
709 | CWE-000 static void gst_base_video_decoder_free_frame ( GstVideoFrame * frame ) { g_return_if_fail ( frame != NULL ) ; if ( frame -> sink_buffer ) { gst_buffer_unref ( frame -> sink_buffer ) ; } if ( frame -> src_buffer ) { gst_buffer_unref ( frame -> src_buffer ) ; } <S2SV_StartBug> g_free ( frame ) ; <S2SV_EndBug> } | <S2SV_ModStart> ) ; } g_list_foreach ( frame -> events , ( GFunc ) gst_event_unref , NULL ) ; g_list_free ( frame -> events ) ; |
710 | CWE-000 int deallocate_inode ( file_ext2_t * file_del ) { superblock_ext2_t * sb = file_del -> sb ; uint32_t inode_index = file_del -> inode_index ; uint32_t ext2_blocksize = GET_BLOCKSIZE_EXT2 ( sb ) ; uint32_t inode_index0 = inode_index - 1 ; uint32_t inode_bgrp_index = inode_index0 / sb -> s_inodes_per_group ; uint32_t inode_bgrp_local_index = inode_index0 % sb -> s_inodes_per_group ; bg_desc_ext2_t akt_bgd ; read_bgdesc_ext2 ( file_del -> dev_file , & akt_bgd , inode_bgrp_index ) ; uint32_t blk_num_inode_bitmap = akt_bgd . bg_inode_bitmap ; char * inode_bitmap = ( char * ) malloc ( ext2_blocksize ) ; read_from_dev ( file_del -> dev_file , inode_bitmap , ext2_blocksize , BLKNUM_TO_OFFSET ( blk_num_inode_bitmap , ext2_blocksize ) ) ; uint32_t bit_akt = inode_bgrp_local_index ; <S2SV_StartBug> ASSERT ( test_bit ( bit_akt , inode_bitmap ) ) ; <S2SV_EndBug> <S2SV_StartBug> reset_bit ( bit_akt , inode_bitmap ) ; <S2SV_EndBug> write_to_dev ( file_del -> dev_file , inode_bitmap , ext2_blocksize , BLKNUM_TO_OFFSET ( blk_num_inode_bitmap , ext2_blocksize ) ) ; int is_directory = file_del -> pinode -> i_mode & EXT2_S_IFDIR ; ++ akt_bgd . bg_free_inodes_count ; if ( is_directory ) { -- akt_bgd . bg_used_dirs_count ; } write_bgdesc_ext2 ( file_del -> dev_file , & akt_bgd , inode_bgrp_index ) ; ++ sb -> s_free_inodes_count ; sb -> s_wtime = get_timestamp ( ) ; write_superblock_ext2 ( file_del -> dev_file , sb ) ; free ( inode_bitmap ) ; return 0 ; } | <S2SV_ModStart> ( bit_akt , ( uint8_t * ) <S2SV_ModStart> ( bit_akt , ( uint8_t * ) |
711 | CWE-000 <S2SV_StartBug> static int adreno_ringbuffer_load_pm4_ucode ( struct kgsl_device * device , <S2SV_EndBug> unsigned int start , unsigned int end , unsigned int addr ) { struct adreno_device * adreno_dev = ADRENO_DEVICE ( device ) ; int i ; adreno_writereg ( adreno_dev , ADRENO_REG_CP_ME_RAM_WADDR , addr ) ; for ( i = start ; i < end ; i ++ ) adreno_writereg ( adreno_dev , ADRENO_REG_CP_ME_RAM_DATA , adreno_dev -> pm4_fw [ i ] ) ; return 0 ; } | <S2SV_ModStart> <S2SV_null> <S2SV_null> static inline |
712 | CWE-000 NvmState nvmWrite ( size_t toAddr , const void * fromPtr , size_t sizeBytes ) { uint8_t buf [ 3 ] ; const uint8_t * fromAddr = fromPtr ; size_t retries = 0 ; static volatile uint8_t writeAtom = 0 ; if ( toAddr >= M24M02_SIZE || ( toAddr + sizeBytes ) > M24M02_SIZE ) { # ifdef EEPROM_PROBLEM_DEBUG TraceThreadSafeFromContext ( hmqtt , "Debug:<S2SV_blank>From<S2SV_blank>nvmWrite,<S2SV_blank>bad<S2SV_blank>address<S2SV_blank>or<S2SV_blank>size,<S2SV_blank>address=%lu,<S2SV_blank>size=%lu" , fromAddr , sizeBytes ) ; # endif return NVM_FAIL ; } if ( writeAtom != 0 ) { # ifdef EEPROM_PROBLEM_DEBUG TraceThreadSafeFromContext ( hmqtt , "Debug:<S2SV_blank>From<S2SV_blank>nvmWrite,<S2SV_blank>write<S2SV_blank>atom<S2SV_blank>bad,<S2SV_blank>atom=%i" , ( int ) writeAtom ) ; # endif } writeAtom ++ ; HAL_GPIO_WritePin ( WRITEPROTECTEEPROM_GPIO_Port , WRITEPROTECTEEPROM_Pin , GPIO_PIN_RESET ) ; while ( sizeBytes > 0 ) { buf [ 0 ] = M24M02_I2C_ADDR | ( ( ( toAddr >> 16 ) << 1 ) & 0b0110 ) ; buf [ 1 ] = ( toAddr >> 8 ) & 0x0FF ; buf [ 2 ] = toAddr & 0x0FF ; size_t thisPageBegin = toAddr & 0xFFFFFF00 ; size_t nextPageBegin = thisPageBegin + 0x100 ; size_t bytesToWrite = nextPageBegin - toAddr ; if ( bytesToWrite > sizeBytes ) bytesToWrite = sizeBytes ; retries = 0 ; if ( hi2c1 . Instance != I2C1 ) { hi2c1 . Instance = I2C1 ; <S2SV_StartBug> TraceThreadSafeFromContext ( hmqtt , "Debug:<S2SV_blank>From<S2SV_blank>nvmWrite,<S2SV_blank>I2C<S2SV_blank>instance<S2SV_blank>restored" ) ; <S2SV_EndBug> } while ( HAL_I2C_Mem_Write ( & hi2c1 , buf [ 0 ] , ( toAddr & 0x0FFFF ) , I2C_MEMADD_SIZE_16BIT , ( uint8_t * ) fromAddr , bytesToWrite , 5000 ) != HAL_OK ) { # ifdef EEPROM_PROBLEM_DEBUG TraceThreadSafeFromContext ( hmqtt , "Debug:<S2SV_blank>From<S2SV_blank>nvmWrite,<S2SV_blank>write<S2SV_blank>fails,<S2SV_blank>atom=%i" , ( int ) writeAtom ) ; i2cDump ( ) ; # endif if ( retries ++ >= I2C_RETRIES ) { writeAtom -- ; return NVM_FAIL ; } } HAL_Delay ( 10 ) ; toAddr += bytesToWrite ; fromAddr += bytesToWrite ; sizeBytes -= bytesToWrite ; } writeAtom -- ; return NVM_OK ; } | <S2SV_ModStart> = I2C1 ; # ifdef EEPROM_PROBLEM_DEBUG <S2SV_ModStart> "Debug:<S2SV_blank>From<S2SV_blank>nvmWrite,<S2SV_blank>I2C<S2SV_blank>instance<S2SV_blank>restored" ) ; # endif |
713 | CWE-000 int set_int ( bytebuf_p buf , int size , uint32_t bo , int64_t val ) { <S2SV_StartBug> pdebug ( DEBUG_SPEW , "Starting." ) ; <S2SV_EndBug> if ( ! buf ) { pdebug ( DEBUG_WARN , "Called<S2SV_blank>with<S2SV_blank>null<S2SV_blank>or<S2SV_blank>invalid<S2SV_blank>reference!" ) ; return PLCTAG_ERR_NULL_PTR ; } <S2SV_StartBug> if ( ! bytebuf_set_capacity ( buf , buf -> cursor + size ) == PLCTAG_STATUS_OK ) { <S2SV_EndBug> pdebug ( DEBUG_ERROR , "Unable<S2SV_blank>to<S2SV_blank>expand<S2SV_blank>byte<S2SV_blank>buffer<S2SV_blank>capacity!" ) ; return PLCTAG_ERR_NO_MEM ; } for ( int i = 0 ; i < size ; i ++ ) { int index = buf -> cursor + ( int ) BYTE_ORDER_VAL ( bo , i ) ; buf -> bytes [ index ] = ( uint8_t ) ( ( uint64_t ) val & ( uint64_t ) 0xFF ) ; val = val >> 8 ; } buf -> cursor = buf -> cursor + size ; if ( buf -> cursor > buf -> size ) { buf -> size = buf -> cursor ; } pdebug ( DEBUG_SPEW , "Done." ) ; return PLCTAG_STATUS_OK ; } | <S2SV_ModStart> val ) { int rc = PLCTAG_STATUS_OK ; <S2SV_ModStart> PLCTAG_ERR_NULL_PTR ; } rc = bytebuf_set_capacity ( buf , buf -> cursor + size ) ; if ( rc != <S2SV_ModEnd> PLCTAG_STATUS_OK ) { |
714 | CWE-000 static void __udf_read_inode ( struct inode * inode ) { struct buffer_head * bh = NULL ; struct fileEntry * fe ; uint16_t ident ; <S2SV_StartBug> struct udf_inode_info * iinfo = UDF_I ( inode ) ; <S2SV_EndBug> bh = udf_read_ptagged ( inode -> i_sb , & iinfo -> i_location , 0 , & ident ) ; if ( ! bh ) { udf_err ( inode -> i_sb , "(ino<S2SV_blank>%ld)<S2SV_blank>failed<S2SV_blank>!bh\\n" , inode -> i_ino ) ; make_bad_inode ( inode ) ; return ; } if ( ident != TAG_IDENT_FE && ident != TAG_IDENT_EFE && ident != TAG_IDENT_USE ) { udf_err ( inode -> i_sb , "(ino<S2SV_blank>%ld)<S2SV_blank>failed<S2SV_blank>ident=%d\\n" , inode -> i_ino , ident ) ; brelse ( bh ) ; make_bad_inode ( inode ) ; return ; } fe = ( struct fileEntry * ) bh -> b_data ; if ( fe -> icbTag . strategyType == cpu_to_le16 ( 4096 ) ) { struct buffer_head * ibh ; ibh = udf_read_ptagged ( inode -> i_sb , & iinfo -> i_location , 1 , & ident ) ; if ( ident == TAG_IDENT_IE && ibh ) { <S2SV_StartBug> struct buffer_head * nbh = NULL ; <S2SV_EndBug> struct kernel_lb_addr loc ; struct indirectEntry * ie ; ie = ( struct indirectEntry * ) ibh -> b_data ; loc = lelb_to_cpu ( ie -> indirectICB . extLocation ) ; <S2SV_StartBug> if ( ie -> indirectICB . extLength && <S2SV_EndBug> <S2SV_StartBug> ( nbh = udf_read_ptagged ( inode -> i_sb , & loc , 0 , <S2SV_EndBug> & ident ) ) ) { if ( ident == TAG_IDENT_FE || ident == TAG_IDENT_EFE ) { memcpy ( & iinfo -> i_location , & loc , sizeof ( struct kernel_lb_addr ) ) ; <S2SV_StartBug> brelse ( bh ) ; <S2SV_EndBug> brelse ( ibh ) ; brelse ( nbh ) ; __udf_read_inode ( inode ) ; return ; } <S2SV_StartBug> brelse ( nbh ) ; <S2SV_EndBug> } } brelse ( ibh ) ; } else if ( fe -> icbTag . strategyType != cpu_to_le16 ( 4 ) ) { udf_err ( inode -> i_sb , "unsupported<S2SV_blank>strategy<S2SV_blank>type:<S2SV_blank>%d\\n" , le16_to_cpu ( fe -> icbTag . strategyType ) ) ; brelse ( bh ) ; make_bad_inode ( inode ) ; return ; } udf_fill_inode ( inode , bh ) ; brelse ( bh ) ; } | <S2SV_ModStart> inode ) ; unsigned int indirections = 0 ; reread : <S2SV_ModStart> ) { struct <S2SV_ModEnd> kernel_lb_addr loc ; <S2SV_ModStart> indirectICB . extLength ) { brelse ( bh ) ; brelse ( ibh ) ; memcpy ( & iinfo -> i_location <S2SV_ModEnd> , & loc <S2SV_ModStart> & loc , <S2SV_ModEnd> sizeof ( struct <S2SV_ModStart> ) ) ; if ( ++ indirections > UDF_MAX_ICB_NESTING ) { udf_err ( inode -> i_sb , "too<S2SV_blank>many<S2SV_blank>ICBs<S2SV_blank>in<S2SV_blank>ICB<S2SV_blank>hierarchy" "<S2SV_blank>(max<S2SV_blank>%d<S2SV_blank>supported)\\n" , UDF_MAX_ICB_NESTING ) ; make_bad_inode <S2SV_ModEnd> ( inode ) <S2SV_ModStart> return ; } goto reread <S2SV_ModEnd> ; } } |
715 | CWE-000 void link_elf_ireloc ( caddr_t kmdp ) { struct elf_file eff ; elf_file_t ef ; ef = & eff ; bzero_early ( ef , sizeof ( * ef ) ) ; ef -> modptr = kmdp ; ef -> dynamic = ( Elf_Dyn * ) & _DYNAMIC ; <S2SV_StartBug> parse_dynamic ( ef ) ; <S2SV_EndBug> <S2SV_StartBug> ef -> address = 0 ; <S2SV_EndBug> link_elf_preload_parse_symbols ( ef ) ; relocate_file1 ( ef , elf_lookup_ifunc , elf_reloc , true ) ; } | <S2SV_ModStart> & _DYNAMIC ; # ifdef __powerpc__ ef -> address = ( caddr_t ) ( __startkernel - KERNBASE ) ; # else <S2SV_ModEnd> ef -> address <S2SV_ModStart> address = 0 ; # endif parse_dynamic ( ef ) |
716 | CWE-000 int main ( int argc , char * argv [ ] ) { int pid , opt , ret , running , keepalive ; int baudrate ; bool clean_session ; struct mosquitto * mosq = NULL ; char uart [ MAX_BUFFER ] ; <S2SV_StartBug> char broker [ MAX_BUFFER ] ; <S2SV_EndBug> struct pollfd pfd [ 2 ] ; clean_session = true ; running = 1 ; clean_session = true ; background = 0 ; keepalive = 5 ; baudrate = 9600 ; memset ( topic , 0 , sizeof ( topic ) ) ; memset ( broker , 0 , sizeof ( broker ) ) ; memcpy ( broker , mqtt_broker_host , strlen ( mqtt_broker_host ) ) ; while ( ( opt = getopt ( argc , argv , "b:d:s:t:fh?" ) ) != - 1 ) { switch ( opt ) { case 'd' : strncpy ( uart , optarg , sizeof ( uart ) - 1 ) ; break ; case 's' : baudrate = atoi ( optarg ) ; break ; case 'b' : strncpy ( broker , optarg , sizeof ( broker ) - 1 ) ; break ; case 't' : strncpy ( topic , optarg , sizeof ( topic ) - 1 ) ; break ; case 'f' : background = 1 ; break ; case 'h' : case '?' : print_usage ( basename ( argv [ 0 ] ) ) ; exit ( EXIT_SUCCESS ) ; break ; default : fprintf ( stderr , "Unknown<S2SV_blank>option<S2SV_blank>%c\\n" , opt ) ; print_usage ( basename ( argv [ 0 ] ) ) ; exit ( EXIT_FAILURE ) ; } } mosquitto_lib_init ( ) ; mosq = mosquitto_new ( NULL , clean_session , NULL ) ; if ( ! mosq ) { fprintf ( stderr , "Error:<S2SV_blank>Out<S2SV_blank>of<S2SV_blank>memory.\\n" ) ; return ( EXIT_FAILURE ) ; } if ( background ) { pid = fork ( ) ; if ( pid < 0 ) { exit ( EXIT_FAILURE ) ; } if ( pid > 0 ) { printf ( "Going<S2SV_blank>into<S2SV_blank>background<S2SV_blank>...\\n" ) ; exit ( EXIT_SUCCESS ) ; } } snprintf ( topic_in , MAX_BUFFER - 3 , "%s/in" , topic ) ; pfd [ 1 ] . fd = openDevice ( uart , serial_speed ( baudrate ) ) ; if ( pfd [ 1 ] . fd <= 0 ) exit ( EXIT_FAILURE ) ; printf ( "open<S2SV_blank>serial<S2SV_blank>device<S2SV_blank>fd<S2SV_blank>:<S2SV_blank>%d\\n" , pfd [ 1 ] . fd ) ; mosquitto_connect_callback_set ( mosq , mqtt_cb_connect ) ; mosquitto_message_callback_set ( mosq , mqtt_cb_msg ) ; mosquitto_subscribe_callback_set ( mosq , mqtt_cb_subscribe ) ; mosquitto_disconnect_callback_set ( mosq , mqtt_cb_disconnect ) ; mosquitto_log_callback_set ( mosq , mqtt_cb_log ) ; while ( running ) { if ( mosquitto_connect ( mosq , broker , mqtt_broker_port , keepalive ) ) { printf ( "Unable<S2SV_blank>to<S2SV_blank>connect,<S2SV_blank>host:<S2SV_blank>%s,<S2SV_blank>port:<S2SV_blank>%d\\n" , broker , mqtt_broker_port ) ; sleep ( 2 ) ; continue ; } break ; } pfd [ 1 ] . events = POLLIN ; const int nfds = sizeof ( pfd ) / sizeof ( struct pollfd ) ; while ( running ) { int mosq_fd = mosquitto_socket ( mosq ) ; pfd [ 0 ] . fd = mosq_fd ; pfd [ 0 ] . events = POLLIN ; if ( mosquitto_want_write ( mosq ) ) { printf ( "Set<S2SV_blank>POLLOUT\\n" ) ; pfd [ 0 ] . events |= POLLOUT ; } if ( poll ( pfd , nfds , keepalive / 2 * 1000 ) < 0 ) { printf ( "Poll()<S2SV_blank>failed<S2SV_blank>with<S2SV_blank><%s>,<S2SV_blank>exiting" , strerror ( errno ) ) ; return EXIT_FAILURE ; } if ( pfd [ 0 ] . revents & POLLOUT ) { mosquitto_loop_write ( mosq , 1 ) ; } if ( pfd [ 0 ] . revents & POLLIN ) { ret = mosquitto_loop_read ( mosq , 1 ) ; if ( ret == MOSQ_ERR_CONN_LOST ) { printf ( "reconnect...\\n" ) ; mosquitto_reconnect ( mosq ) ; } } mosquitto_loop_misc ( mosq ) ; if ( pfd [ 1 ] . revents & POLLIN ) { char input [ 64 ] ; memset ( input , 0 , sizeof ( input ) ) ; ret = read ( pfd [ 1 ] . fd , input , 64 ) ; if ( ret < 0 ) { fprintf ( stderr , "%s:<S2SV_blank>read_error\\n" , __func__ ) ; exit ( EXIT_FAILURE ) ; } printf ( "%s:<S2SV_blank>%s" , uart , input ) ; mosquitto_publish ( mosq , NULL , topic_in , strlen ( input ) , input , 0 , false ) ; } } mosquitto_destroy ( mosq ) ; mosquitto_lib_cleanup ( ) ; printf ( "bye\\n" ) ; return EXIT_SUCCESS ; } | <S2SV_ModStart> broker [ MAX_BUFFER <S2SV_ModEnd> ] ; clean_session |
717 | CWE-000 int yr_modules_load ( const char * module_name , YR_SCAN_CONTEXT * context ) { int i , result ; YR_MODULE_IMPORT mi ; YR_OBJECT * module_structure = ( YR_OBJECT * ) yr_hash_table_lookup ( context -> objects_table , module_name , NULL ) ; if ( module_structure != NULL ) return ERROR_SUCCESS ; FAIL_ON_ERROR ( yr_object_create ( OBJECT_TYPE_STRUCTURE , module_name , NULL , & module_structure ) ) ; mi . module_name = module_name ; mi . module_data = NULL ; mi . module_data_size = 0 ; result = context -> callback ( CALLBACK_MSG_IMPORT_MODULE , & mi , context -> user_data ) ; if ( result == CALLBACK_ERROR ) { yr_object_destroy ( module_structure ) ; return ERROR_CALLBACK_ERROR ; } FAIL_ON_ERROR_WITH_CLEANUP ( yr_modules_do_declarations ( module_name , module_structure ) , yr_object_destroy ( module_structure ) ) ; FAIL_ON_ERROR_WITH_CLEANUP ( yr_hash_table_add ( context -> objects_table , module_name , NULL , module_structure ) , yr_object_destroy ( module_structure ) ) ; for ( i = 0 ; i < sizeof ( yr_modules_table ) / sizeof ( YR_MODULE ) ; i ++ ) { if ( strcmp ( yr_modules_table [ i ] . name , module_name ) == 0 ) { result = yr_modules_table [ i ] . load ( context , module_structure , mi . module_data , mi . module_data_size ) ; if ( result != ERROR_SUCCESS ) return result ; } } <S2SV_StartBug> result = context -> callback ( <S2SV_EndBug> CALLBACK_MSG_MODULE_IMPORTED , module_structure , context -> user_data ) ; <S2SV_StartBug> return ERROR_SUCCESS ; <S2SV_EndBug> } | <S2SV_ModStart> ; } } return <S2SV_ModEnd> context -> callback <S2SV_ModStart> user_data ) ; <S2SV_ModEnd> } <S2SV_null> <S2SV_null> |
718 | CWE-000 int package1_read_and_parse_boot0 ( void * * package1loader , size_t * package1loader_size , nx_keyblob_t * keyblobs , uint32_t * revision , FILE * boot0 ) { nvboot_config_table * bct ; nv_bootloader_info * pk1l_info ; size_t fpos , pk1l_offset ; union { nx_keyblob_t keyblob ; uint8_t sector [ 0x200 ] ; } d ; if ( package1loader == NULL || package1loader_size == NULL || keyblobs == NULL || revision == NULL || boot0 == NULL ) { errno = EINVAL ; return - 1 ; } bct = malloc ( sizeof ( nvboot_config_table ) ) ; if ( bct == NULL ) { errno = ENOMEM ; return - 1 ; } pk1l_info = & bct -> bootloader [ 0 ] ; fpos = ftell ( boot0 ) ; if ( fread ( bct , sizeof ( nvboot_config_table ) , 1 , boot0 ) == 0 ) { free ( bct ) ; return - 1 ; } if ( bct -> bootloader_used < 1 || pk1l_info -> version < 1 ) { free ( bct ) ; errno = EILSEQ ; return - 1 ; } * revision = pk1l_info -> version - 1 ; * package1loader_size = pk1l_info -> length ; pk1l_offset = 0x4000 * pk1l_info -> start_blk + 0x200 * pk1l_info -> start_page ; free ( bct ) ; ( * package1loader ) = memalign ( 0x10000 , * package1loader_size ) ; if ( * package1loader == NULL ) { errno = ENOMEM ; return - 1 ; } if ( fseek ( boot0 , fpos + pk1l_offset , SEEK_SET ) != 0 ) { return - 1 ; } if ( fread ( * package1loader , * package1loader_size , 1 , boot0 ) == 0 ) { return - 1 ; } if ( fseek ( boot0 , fpos + pk1l_offset + 2 * PACKAGE1LOADER_SIZE_MAX , SEEK_SET ) != 0 ) { return - 1 ; } for ( size_t i = 0 ; i < 32 ; i ++ ) { <S2SV_StartBug> if ( fread ( d . sector , 0x200 , 1 , boot0 ) == 0 ) { <S2SV_EndBug> return - 1 ; } keyblobs [ i ] = d . keyblob ; } return 0 ; } | <S2SV_ModStart> { if ( ! <S2SV_ModStart> , boot0 ) <S2SV_ModEnd> ) { return |
719 | CWE-000 void tcf_chain_put ( struct tcf_chain * chain ) { <S2SV_StartBug> if ( -- chain -> refcnt == 0 && ! chain -> filter_chain && chain -> index != 0 ) <S2SV_EndBug> tcf_chain_destroy ( chain ) ; } | <S2SV_ModStart> refcnt == 0 <S2SV_ModEnd> ) tcf_chain_destroy ( |
720 | CWE-000 void ficlCallbackDefaultTextOut ( ficlCallback * callback , char * message ) { ficlVm * vm ; ficlFile * outFile ; FILE * out ; <S2SV_StartBug> vm = ( ficlVm * ) callback ; <S2SV_EndBug> outFile = vm ? vm -> outFile : 0 ; out = outFile ? outFile -> f : stdout ; if ( message != NULL ) { fputs ( message , out ) ; fflush ( out ) ; } else fflush ( out ) ; return ; } | <S2SV_ModStart> * ) callback -> vm |
721 | CWE-000 void usage ( int exit_status ) { puts ( "usage:\\n" ) ; <S2SV_StartBug> char * us = cmdline_create_usage ( ) ; <S2SV_EndBug> puts ( us ) ; exit ( exit_status ) ; } | <S2SV_ModStart> "usage:\\n" ) ; const |
722 | CWE-000 int gui_welcome ( const char * msg , int * lvl , int * lgf , int * prt , int min , int npr , int nlg ) { int ret = ( int ) # ifdef AMIGA DoMethod ( Win , MUIM_InstallerGui_Welcome , msg , lvl , lgf , prt , min , npr , nlg ) ; # else <S2SV_StartBug> 1 ; <S2SV_EndBug> printf ( "%s%d%d%d%d%d%d\\n" , msg , * lvl , * lgf , * prt , min , npr , nlg ) ; # endif return ret ; } | <S2SV_ModStart> ; # else <S2SV_ModEnd> printf ( "%s%d%d%d%d%d%d\\n" |
723 | CWE-000 int consumer_stream_write_index ( struct lttng_consumer_stream * stream , struct ctf_packet_index * element ) { int ret ; <S2SV_StartBug> struct consumer_relayd_sock_pair * relayd ; <S2SV_EndBug> <S2SV_StartBug> assert ( stream ) ; <S2SV_EndBug> assert ( element ) ; rcu_read_lock ( ) ; relayd = consumer_find_relayd ( stream -> net_seq_idx ) ; if ( relayd ) { pthread_mutex_lock ( & relayd -> ctrl_sock_mutex ) ; ret = relayd_send_index ( & relayd -> control_sock , element , stream -> relayd_stream_id , stream -> next_net_seq_num - 1 ) ; <S2SV_StartBug> pthread_mutex_unlock ( & relayd -> ctrl_sock_mutex ) ; <S2SV_EndBug> } else { if ( lttng_index_file_write ( stream -> index_file , element ) ) { ret = - 1 ; } else { ret = 0 ; } } if ( ret < 0 ) { goto error ; } error : rcu_read_unlock ( ) ; return ret ; } | <S2SV_ModStart> int ret ; assert ( stream ) ; assert ( element ) ; rcu_read_lock ( ) ; if ( stream -> net_seq_idx != ( uint64_t ) - 1ULL ) { <S2SV_ModStart> * relayd ; <S2SV_ModEnd> relayd = consumer_find_relayd <S2SV_ModStart> ctrl_sock_mutex ) ; } else { ERR ( "Stream<S2SV_blank>%" PRIu64 "<S2SV_blank>relayd<S2SV_blank>ID<S2SV_blank>%" PRIu64 "<S2SV_blank>unknown.<S2SV_blank>Can\'t<S2SV_blank>write<S2SV_blank>index." , stream -> key , stream -> net_seq_idx ) ; ret = - 1 ; } |
724 | CWE-000 void show_command_prompt ( struct Serial * serial ) { <S2SV_StartBug> serial_write_s ( serial , cmdPrompt ) ; <S2SV_EndBug> serial_write_s ( serial , "<S2SV_blank>><S2SV_blank>" ) ; } | <S2SV_ModStart> ( serial , device_name <S2SV_ModEnd> ) ; serial_write_s |
725 | CWE-000 static void fmt_int ( char * buf , enum printf_fl fl , int w , int p , bool s , int b , bool ljust , va_list * ap ) { int val ; char padch ; int npad ; int nchar ; int ndigit ; bool print_plus ; bool sign_align ; char tmpbuf [ 32 ] ; size_t tmpbuflen ; padch = '<S2SV_blank>' ; npad = 0 ; sign_align = ( flag_set ( fl , F_SIGNALIGN ) && b == 10 ) ; print_plus = ( flag_set ( fl , F_PRINTSIGN ) && b == 10 ) ; val = va_arg ( * ap , int ) ; if ( p == 0 && val == 0 ) { * buf = '\\0' ; return ; } if ( val == 0 && flag_set ( fl , F_PREFIX ) ) { fl &= ~ F_PREFIX ; } tmpbuflen = num2str ( val , tmpbuf , b , s ) ; ndigit = tmpbuflen ; nchar = ndigit ; if ( flag_set ( fl , F_ZEROPAD ) && p == P_NONE ) { padch = '0' ; } if ( flag_set ( fl , F_PREFIX ) ) { switch ( b ) { case 8 : nchar += 1 ; break ; case 16 : nchar += 2 ; break ; } } if ( print_plus || sign_align ) { nchar += 1 ; } npad = w - nchar ; if ( p > ndigit ) { npad -= p - ndigit ; } <S2SV_StartBug> if ( ! ljust && w > nchar ) { <S2SV_EndBug> pad ( buf , npad , padch ) ; nchar += npad ; buf += npad ; } if ( flag_set ( fl , F_PREFIX ) ) { switch ( b ) { case 8 : * ( buf ++ ) = '0' ; break ; case 16 : * ( buf ++ ) = '0' ; * ( buf ++ ) = 'X' ; break ; } } else if ( print_plus && val >= 0 ) { * ( buf ++ ) = '+' ; } else if ( sign_align && val >= 0 ) { * ( buf ++ ) = '<S2SV_blank>' ; } <S2SV_StartBug> while ( p > ndigit ) { <S2SV_EndBug> * ( buf ++ ) = '0' ; ndigit ++ ; nchar ++ ; } strncpy ( buf , tmpbuf , sizeof ( tmpbuf ) ) ; if ( ljust && w > nchar ) { buf += tmpbuflen ; pad ( buf , npad , '<S2SV_blank>' ) ; nchar += npad ; buf += npad ; } buf [ nchar ] = '\\0' ; } | <S2SV_ModStart> } if ( <S2SV_ModEnd> flag_set ( fl <S2SV_ModStart> '<S2SV_blank>' ; } if ( ! ljust && w > nchar ) { pad ( buf , npad , padch ) ; nchar += npad ; buf += npad ; } |
726 | CWE-000 int check_and_exec ( char * * command , char * * * env ) { static char * builtins [ ] = { BUILTINS } ; static int ( * function [ ] ) ( char * * , char * * * ) = { FUNCTION } ; int i ; i = 0 ; <S2SV_StartBug> e . ret = 0 ; <S2SV_EndBug> while ( builtins [ i ] ) { if ( ft_strcmp ( * command , builtins [ i ] ) == 0 ) { <S2SV_StartBug> e . ret = function [ i ] ( command , env ) ; <S2SV_EndBug> break ; } i ++ ; } if ( ! builtins [ i ] && * command ) <S2SV_StartBug> e . ret = fork_function ( command , env ) ; <S2SV_EndBug> <S2SV_StartBug> return ( e . ret ) ; <S2SV_EndBug> } | <S2SV_ModStart> = 0 ; data <S2SV_ModEnd> . ret = <S2SV_ModStart> 0 ) { data <S2SV_ModEnd> . ret = <S2SV_ModStart> * command ) data <S2SV_ModEnd> . ret = <S2SV_ModStart> ; return ( data <S2SV_ModEnd> . ret ) |
727 | CWE-000 static int avb_do_tipc ( uint32_t cmd , void * req , uint32_t req_size , void * resp , uint32_t * resp_size_p , bool handle_rpmb ) { int rc ; struct avb_message msg = { . cmd = cmd } ; if ( ! initialized && cmd != AVB_GET_VERSION ) { <S2SV_StartBug> trusty_error ( "%s:<S2SV_blank>AVB<S2SV_blank>TIPC<S2SV_blank>client<S2SV_blank>not<S2SV_blank>initialized\\n" , __func__ ) ; <S2SV_EndBug> return TRUSTY_ERR_GENERIC ; } rc = avb_send_request ( & msg , req , req_size ) ; if ( rc < 0 ) { <S2SV_StartBug> trusty_error ( "%s:<S2SV_blank>failed<S2SV_blank>(%d)<S2SV_blank>to<S2SV_blank>send<S2SV_blank>AVB<S2SV_blank>request\\n" , __func__ , rc ) ; <S2SV_EndBug> return rc ; } if ( handle_rpmb ) { rc = rpmb_storage_proxy_poll ( ) ; if ( rc < 0 ) { <S2SV_StartBug> trusty_error ( "%s:<S2SV_blank>failed<S2SV_blank>(%d)<S2SV_blank>to<S2SV_blank>get<S2SV_blank>RPMB<S2SV_blank>requests\\n" , __func__ , <S2SV_EndBug> rc ) ; return rc ; } } uint32_t resp_size = resp_size_p ? * resp_size_p : 0 ; rc = avb_read_response ( & msg , cmd , resp , resp_size ) ; if ( rc < 0 ) { <S2SV_StartBug> trusty_error ( "%s:<S2SV_blank>failed<S2SV_blank>(%d)<S2SV_blank>to<S2SV_blank>read<S2SV_blank>AVB<S2SV_blank>response\\n" , __func__ , rc ) ; <S2SV_EndBug> return rc ; } if ( resp_size_p && ( uint32_t ) rc != * resp_size_p ) { * resp_size_p = rc ; } if ( msg . result != AVB_ERROR_NONE ) { <S2SV_StartBug> trusty_error ( "%s:<S2SV_blank>AVB<S2SV_blank>service<S2SV_blank>returned<S2SV_blank>error<S2SV_blank>(%d)\\n" , __func__ , <S2SV_EndBug> msg . result ) ; return TRUSTY_ERR_GENERIC ; } return TRUSTY_ERR_NONE ; } | <S2SV_ModStart> { trusty_error ( "%a:<S2SV_blank>AVB<S2SV_blank>TIPC<S2SV_blank>client<S2SV_blank>not<S2SV_blank>initialized\\n" <S2SV_ModEnd> , __func__ ) <S2SV_ModStart> { trusty_error ( "%a:<S2SV_blank>failed<S2SV_blank>(%d)<S2SV_blank>to<S2SV_blank>send<S2SV_blank>AVB<S2SV_blank>request\\n" <S2SV_ModEnd> , __func__ , <S2SV_ModStart> { trusty_error ( "%a:<S2SV_blank>failed<S2SV_blank>(%d)<S2SV_blank>to<S2SV_blank>get<S2SV_blank>RPMB<S2SV_blank>requests\\n" <S2SV_ModEnd> , __func__ , <S2SV_ModStart> { trusty_error ( "%a:<S2SV_blank>failed<S2SV_blank>(%d)<S2SV_blank>to<S2SV_blank>read<S2SV_blank>AVB<S2SV_blank>response\\n" <S2SV_ModEnd> , __func__ , <S2SV_ModStart> { trusty_error ( "%a:<S2SV_blank>AVB<S2SV_blank>service<S2SV_blank>returned<S2SV_blank>error<S2SV_blank>(%d)\\n" <S2SV_ModEnd> , __func__ , |
728 | CWE-000 static void * tpool_worker ( void * arg ) { hts_tpool_worker * w = ( hts_tpool_worker * ) arg ; hts_tpool * p = w -> p ; hts_tpool_job * j ; for ( ; ; ) { pthread_mutex_lock ( & p -> pool_m ) ; assert ( p -> q_head == 0 || ( p -> q_head -> prev && p -> q_head -> next ) ) ; int work_to_do = 0 ; hts_tpool_process * first = p -> q_head , * q = first ; do { if ( p -> shutdown ) break ; if ( q && q -> input_head && q -> qsize - q -> n_output > p -> tsize - p -> nwaiting ) { work_to_do = 1 ; break ; } if ( q ) q = q -> next ; } while ( q && q != first ) ; if ( p -> shutdown ) { shutdown : # ifdef DEBUG fprintf ( stderr , "%d:<S2SV_blank>Shutting<S2SV_blank>down\\n" , worker_id ( p ) ) ; # endif pthread_mutex_unlock ( & p -> pool_m ) ; pthread_exit ( NULL ) ; } if ( ! work_to_do ) { p -> nwaiting ++ ; if ( p -> t_stack_top == - 1 || p -> t_stack_top > w -> idx ) p -> t_stack_top = w -> idx ; p -> t_stack [ w -> idx ] = 1 ; pthread_cond_wait ( & w -> pending_c , & p -> pool_m ) ; p -> t_stack [ w -> idx ] = 0 ; int i ; p -> t_stack_top = - 1 ; for ( i = 0 ; i < p -> tsize ; i ++ ) { if ( p -> t_stack [ i ] ) { p -> t_stack_top = i ; break ; } } p -> nwaiting -- ; pthread_mutex_unlock ( & p -> pool_m ) ; continue ; } q -> ref_count ++ ; while ( q -> input_head && q -> qsize - q -> n_output > q -> n_processing ) { if ( p -> shutdown ) goto shutdown ; j = q -> input_head ; assert ( j -> p == p ) ; if ( ! ( q -> input_head = j -> next ) ) q -> input_tail = NULL ; q -> n_processing ++ ; if ( q -> n_input -- >= q -> qsize ) pthread_cond_broadcast ( & q -> input_not_full_c ) ; if ( q -> n_input == 0 ) pthread_cond_signal ( & q -> input_empty_c ) ; p -> njobs -- ; pthread_mutex_unlock ( & p -> pool_m ) ; DBG_OUT ( stderr , "%d:<S2SV_blank>Processing<S2SV_blank>queue<S2SV_blank>%p,<S2SV_blank>serial<S2SV_blank>%" PRId64 "\\n" , worker_id ( j -> p ) , q , j -> serial ) ; hts_tpool_add_result ( j , j -> func ( j -> arg ) ) ; free ( j ) ; pthread_mutex_lock ( & p -> pool_m ) ; } if ( -- q -> ref_count == 0 ) hts_tpool_process_destroy ( q ) ; else p -> q_head = q -> next ; pthread_mutex_unlock ( & p -> pool_m ) ; } <S2SV_StartBug> return NULL ; <S2SV_EndBug> } | <S2SV_ModStart> ) ; } <S2SV_ModEnd> } <S2SV_null> <S2SV_null> |
729 | CWE-000 <S2SV_StartBug> int <S2SV_EndBug> init ( int state ) { int i ; if ( worker -> id == 0 ) return KORE_RESULT_OK ; <S2SV_StartBug> amqp_rpc_reply_t login_reply ; <S2SV_EndBug> amqp_rpc_reply_t rpc_reply ; lazy_queue_table . num_entries = 1 ; lazy_queue_table . entries = malloc ( lazy_queue_table . num_entries * sizeof ( amqp_table_entry_t ) ) ; if ( ! lazy_queue_table . entries ) exit ( - 1 ) ; entry = & lazy_queue_table . entries [ 0 ] ; entry -> key = amqp_cstring_bytes ( "x-queue-mode" ) ; entry -> value . kind = AMQP_FIELD_KIND_UTF8 ; entry -> value . value . bytes = amqp_cstring_bytes ( "lazy" ) ; int fd = open ( "admin.apikey" , O_RDONLY ) ; if ( fd < 0 ) { fprintf ( stderr , "could<S2SV_blank>not<S2SV_blank>open<S2SV_blank>admin.apikey\\n" ) ; exit ( - 1 ) ; } if ( ! read ( fd , admin_apikey , 32 ) ) { fprintf ( stderr , "could<S2SV_blank>not<S2SV_blank>read<S2SV_blank>from<S2SV_blank>admin.apikey\\n" ) ; exit ( - 1 ) ; } admin_apikey [ 32 ] = '\\0' ; int strlen_admin_apikey = strlen ( admin_apikey ) ; for ( i = 0 ; i < strlen_admin_apikey ; ++ i ) { if ( isspace ( admin_apikey [ i ] ) ) { admin_apikey [ i ] = '\\0' ; break ; } } close ( fd ) ; cached_admin_conn = amqp_new_connection ( ) ; amqp_socket_t * socket = amqp_tcp_socket_new ( cached_admin_conn ) ; if ( socket == NULL ) { fprintf ( stderr , "Could<S2SV_blank>not<S2SV_blank>open<S2SV_blank>a<S2SV_blank>socket<S2SV_blank>" ) ; return KORE_RESULT_ERROR ; } retry : if ( amqp_socket_open ( socket , "broker" , 5672 ) ) { fprintf ( stderr , "Could<S2SV_blank>not<S2SV_blank>connect<S2SV_blank>to<S2SV_blank>broker\\n" ) ; sleep ( 1 ) ; goto retry ; } login_reply = amqp_login # ifdef TEST ( cached_admin_conn , "/" , 0 , 131072 , 0 , AMQP_SASL_METHOD_PLAIN , "guest" , "guest" ) ; <S2SV_StartBug> # else <S2SV_EndBug> ( cached_admin_conn , "/" , 0 , 131072 , 0 , AMQP_SASL_METHOD_PLAIN , "admin" , admin_apikey ) ; # endif if ( login_reply . reply_type != AMQP_RESPONSE_NORMAL ) { fprintf ( stderr , "invalid<S2SV_blank>id<S2SV_blank>or<S2SV_blank>apikey\\n" ) ; return KORE_RESULT_ERROR ; } if ( ! amqp_channel_open ( cached_admin_conn , 1 ) ) { fprintf ( stderr , "could<S2SV_blank>not<S2SV_blank>open<S2SV_blank>an<S2SV_blank>AMQP<S2SV_blank>connection\\n" ) ; return KORE_RESULT_ERROR ; } rpc_reply = amqp_get_rpc_reply ( cached_admin_conn ) ; if ( rpc_reply . reply_type != AMQP_RESPONSE_NORMAL ) { fprintf ( stderr , "did<S2SV_blank>not<S2SV_blank>receive<S2SV_blank>expected<S2SV_blank>response<S2SV_blank>from<S2SV_blank>the<S2SV_blank>broker\\n" ) ; return KORE_RESULT_ERROR ; } if ( ! amqp_queue_declare ( cached_admin_conn , 1 , amqp_cstring_bytes ( "DATABASE" ) , 0 , 1 , 0 , 0 , lazy_queue_table ) ) { fprintf ( stderr , "amqp_queue_declare<S2SV_blank>failed<S2SV_blank>for<S2SV_blank>{DATABASE}\\n" ) ; return KORE_RESULT_ERROR ; } ht_init ( & connection_ht ) ; if ( Q == NULL ) Q = kore_buf_alloc ( 256 ) ; if ( query == NULL ) query = kore_buf_alloc ( 512 ) ; if ( response == NULL ) response = kore_buf_alloc ( 1024 * 1024 ) ; # ifdef TEST kore_pgsql_register ( "db" , "user=postgres<S2SV_blank>password=password" ) ; # else kore_pgsql_register ( "db" , "host=postgres<S2SV_blank>user=postgres<S2SV_blank>password=postgres_pwd" ) ; # endif <S2SV_StartBug> return KORE_RESULT_OK ; <S2SV_EndBug> } | <S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> <S2SV_ModEnd> init ( int <S2SV_ModStart> return KORE_RESULT_OK ; <S2SV_ModEnd> lazy_queue_table . num_entries <S2SV_ModStart> "guest" ) ; printf ( "using<S2SV_blank>guest\\n" ) ; <S2SV_ModStart> ; # endif memset ( & props , 0 , sizeof props ) ; props . _flags = AMQP_BASIC_CONTENT_TYPE_FLAG | AMQP_BASIC_USER_ID_FLAG ; |
730 | CWE-000 static t_stat fnpSetFW ( UNIT * uptr , UNUSED int32 value , const char * cptr , UNUSED void * desc ) { if ( ! cptr ) return SCPE_ARG ; long devnum = FNP_UNIT_IDX ( uptr ) ; if ( devnum < 0 || devnum >= N_FNP_UNITS_MAX ) return SCPE_ARG ; char sn [ strlen ( cptr ) + 1 ] ; memcpy ( sn , cptr , strlen ( cptr ) + 1 ) ; char * saveptr ; char * tok ; tok = strtok_r ( sn , ":" , & saveptr ) ; if ( strcasecmp ( tok , "RESET" ) == 0 ) { n_fw_entries = 0 ; sim_printf ( "FNP<S2SV_blank>firewall<S2SV_blank>table<S2SV_blank>reset\\r\\n" ) ; return SCPE_OK ; } if ( strcasecmp ( tok , "ADD" ) == 0 ) { if ( n_fw_entries >= N_FW_ENTRIES ) { sim_printf ( "FNP<S2SV_blank>firewall<S2SV_blank>table<S2SV_blank>full\\r\\n" ) ; return SCPE_ARG ; } int line_0 , line_1 ; tok = strtok_r ( NULL , ":" , & saveptr ) ; <S2SV_StartBug> char * dash = index ( tok , '-' ) ; <S2SV_EndBug> if ( dash ) { line_0 = parse_line ( tok ) ; if ( line_0 < 0 ) { sim_printf ( "Cannot<S2SV_blank>parse<S2SV_blank>first<S2SV_blank>line<S2SV_blank>number\\r\\n" ) ; return SCPE_ARG ; } line_1 = parse_line ( dash + 1 ) ; if ( line_1 < 0 ) { sim_printf ( "Cannot<S2SV_blank>parse<S2SV_blank>second<S2SV_blank>line<S2SV_blank>number\\r\\n" ) ; return SCPE_ARG ; } if ( line_0 > line_1 ) { sim_printf ( "line_0<S2SV_blank>><S2SV_blank>line_1\\r\\n" ) ; return SCPE_ARG ; } } else { line_0 = line_1 = parse_line ( tok ) ; if ( line_0 < 0 ) { sim_printf ( "Cannot<S2SV_blank>parse<S2SV_blank>line<S2SV_blank>number\\r\\n" ) ; return SCPE_ARG ; } } tok = strtok_r ( NULL , ":" , & saveptr ) ; uint32_t ipaddr ; int rc = parse_ipaddr ( tok , & ipaddr ) ; if ( rc < 0 ) return SCPE_ARG ; tok = strtok_r ( NULL , ":" , & saveptr ) ; char * end ; unsigned long cidr = strtoul ( tok , & end , 10 ) ; if ( tok == end || * end != 0 || cidr > 32 ) return SCPE_OK ; uint32_t cidr_mask = ( ( uint32_t ) - 1 ) << ( 32 - cidr ) & MASK32 ; bool accept = false ; tok = strtok_r ( NULL , ":" , & saveptr ) ; if ( strcmp ( tok , "ACCEPT" ) == 0 ) accept = true ; else if ( strcmp ( tok , "DENY" ) == 0 ) accept = false ; else { sim_printf ( "cannot<S2SV_blank>parse<S2SV_blank>rule<S2SV_blank>ACCEPT/DENY\\r\\n" ) ; return SCPE_ARG ; } fw_entries [ n_fw_entries ] . line_0 = ( uint ) line_0 ; fw_entries [ n_fw_entries ] . line_1 = ( uint ) line_1 ; fw_entries [ n_fw_entries ] . ipaddr = ipaddr ; fw_entries [ n_fw_entries ] . cidr = ( uint ) cidr ; fw_entries [ n_fw_entries ] . cidr_mask = ( uint ) cidr_mask ; fw_entries [ n_fw_entries ] . accept = accept ; n_fw_entries ++ ; return SCPE_OK ; } if ( strcasecmp ( tok , "LIST" ) == 0 ) { for ( uint i = 0 ; i < n_fw_entries ; i ++ ) { struct fw_entry_s * p = fw_entries + i ; if ( p -> line_0 == p -> line_1 ) { sim_printf ( "<S2SV_blank><S2SV_blank>%c.h%03d<S2SV_blank>%d.%d.%d.%d/%d<S2SV_blank>%s\\r\\n" , decodefnp ( p -> line_0 ) + 'a' , decodeline ( p -> line_0 ) , ( p -> ipaddr >> 24 ) & 255 , ( p -> ipaddr >> 16 ) & 255 , ( p -> ipaddr >> 8 ) & 255 , p -> ipaddr & 255 , p -> cidr , p -> accept ? "accept" : "deny" ) ; } else { sim_printf ( "<S2SV_blank><S2SV_blank>%c.h%03d-%c.%03d<S2SV_blank>%d.%d.%d.%d/%d<S2SV_blank>%s\\r\\n" , decodefnp ( p -> line_0 ) + 'a' , decodeline ( p -> line_0 ) , decodefnp ( p -> line_1 ) + 'a' , decodeline ( p -> line_1 ) , ( p -> ipaddr >> 24 ) & 255 , ( p -> ipaddr >> 16 ) & 255 , ( p -> ipaddr >> 8 ) & 255 , p -> ipaddr & 255 , p -> cidr , p -> accept ? "accept" : "deny" ) ; } } return SCPE_OK ; } return SCPE_ARG ; } | <S2SV_ModStart> * dash = strchr <S2SV_ModEnd> ( tok , |
731 | CWE-000 void ls_insert ( List_t * ls , const int64_t index , const YASL_Object value ) { if ( ls -> count >= ls -> size ) ls_resize_up ( ls ) ; <S2SV_StartBug> ls -> items [ index ] = value ; <S2SV_EndBug> ls -> count ++ ; inc_ref ( & value ) ; } | <S2SV_ModStart> ls ) ; dec_ref ( ls -> items + index ) ; |
732 | CWE-000 static int ptls_pem_parse_private_key ( char const * pem_fname , ptls_asn1_pkcs8_private_key_t * pkey , ptls_minicrypto_log_ctx_t * log_ctx ) { size_t nb_keys = 0 ; ptls_iovec_t * list = & pkey -> vec ; <S2SV_StartBug> int ret = ptls_minicrypto_get_pem_objects ( pem_fname , "PRIVATE<S2SV_blank>KEY" , & list , 1 , & nb_keys ) ; <S2SV_EndBug> if ( ret == 0 ) { if ( nb_keys != 1 ) { ret = PTLS_ERROR_PEM_LABEL_NOT_FOUND ; } } if ( ret == 0 && nb_keys == 1 ) { int decode_error = 0 ; if ( log_ctx != NULL ) { log_ctx -> fn ( log_ctx -> ctx , "\\nFound<S2SV_blank>PRIVATE<S2SV_blank>KEY,<S2SV_blank>length<S2SV_blank>=<S2SV_blank>%d<S2SV_blank>bytes\\n" , ( int ) pkey -> vec . len ) ; } ( void ) ptls_minicrypto_asn1_decode_private_key ( pkey , & decode_error , log_ctx ) ; if ( decode_error != 0 ) { ret = decode_error ; } } return ret ; } | <S2SV_ModStart> int ret = ptls_load_pem_objects <S2SV_ModEnd> ( pem_fname , |
733 | CWE-000 int pil_boot ( struct pil_desc * desc ) { int ret ; char fw_name [ 30 ] ; const struct pil_mdt * mdt ; const struct elf32_hdr * ehdr ; struct pil_seg * seg ; const struct firmware * fw ; struct pil_priv * priv = desc -> priv ; bool mem_protect = false ; bool hyp_assign = false ; if ( desc -> shutdown_fail ) pil_err ( desc , "Subsystem<S2SV_blank>shutdown<S2SV_blank>failed<S2SV_blank>previously!\\n" ) ; pil_release_mmap ( desc ) ; down_read ( & pil_pm_rwsem ) ; snprintf ( fw_name , sizeof ( fw_name ) , "%s.mdt" , desc -> fw_name ) ; ret = request_firmware ( & fw , fw_name , desc -> dev ) ; if ( ret ) { pil_err ( desc , "Failed<S2SV_blank>to<S2SV_blank>locate<S2SV_blank>%s\\n" , fw_name ) ; goto out ; } if ( fw -> size < sizeof ( * ehdr ) ) { pil_err ( desc , "Not<S2SV_blank>big<S2SV_blank>enough<S2SV_blank>to<S2SV_blank>be<S2SV_blank>an<S2SV_blank>elf<S2SV_blank>header\\n" ) ; ret = - EIO ; goto release_fw ; } mdt = ( const struct pil_mdt * ) fw -> data ; ehdr = & mdt -> hdr ; if ( memcmp ( ehdr -> e_ident , ELFMAG , SELFMAG ) ) { pil_err ( desc , "Not<S2SV_blank>an<S2SV_blank>elf<S2SV_blank>header\\n" ) ; ret = - EIO ; goto release_fw ; } if ( ehdr -> e_phnum == 0 ) { pil_err ( desc , "No<S2SV_blank>loadable<S2SV_blank>segments\\n" ) ; ret = - EIO ; goto release_fw ; } if ( sizeof ( struct elf32_phdr ) * ehdr -> e_phnum + sizeof ( struct elf32_hdr ) > fw -> size ) { pil_err ( desc , "Program<S2SV_blank>headers<S2SV_blank>not<S2SV_blank>within<S2SV_blank>mdt\\n" ) ; ret = - EIO ; goto release_fw ; } ret = pil_init_mmap ( desc , mdt ) ; if ( ret ) goto release_fw ; desc -> priv -> unvoted_flag = 0 ; ret = pil_proxy_vote ( desc ) ; if ( ret ) { pil_err ( desc , "Failed<S2SV_blank>to<S2SV_blank>proxy<S2SV_blank>vote\\n" ) ; goto release_fw ; } if ( desc -> ops -> init_image ) ret = desc -> ops -> init_image ( desc , fw -> data , fw -> size ) ; if ( ret ) { pil_err ( desc , "Invalid<S2SV_blank>firmware<S2SV_blank>metadata\\n" ) ; goto err_boot ; } if ( desc -> ops -> mem_setup ) ret = desc -> ops -> mem_setup ( desc , priv -> region_start , priv -> region_end - priv -> region_start ) ; if ( ret ) { pil_err ( desc , "Memory<S2SV_blank>setup<S2SV_blank>error\\n" ) ; goto err_deinit_image ; } if ( desc -> subsys_vmid > 0 ) { if ( desc -> modem_ssr ) { ret = pil_assign_mem_to_linux ( desc , priv -> region_start , ( priv -> region_end - priv -> region_start ) ) ; if ( ret ) pil_err ( desc , "Failed<S2SV_blank>to<S2SV_blank>assign<S2SV_blank>to<S2SV_blank>linux,<S2SV_blank>ret-<S2SV_blank>%d\\n" , ret ) ; } ret = pil_assign_mem_to_subsys_and_linux ( desc , priv -> region_start , ( priv -> region_end - priv -> region_start ) ) ; if ( ret ) { pil_err ( desc , "Failed<S2SV_blank>to<S2SV_blank>assign<S2SV_blank>memory,<S2SV_blank>ret<S2SV_blank>-<S2SV_blank>%d\\n" , ret ) ; goto err_deinit_image ; } hyp_assign = true ; } list_for_each_entry ( seg , & desc -> priv -> segs , list ) { ret = pil_load_seg ( desc , seg ) ; if ( ret ) goto err_deinit_image ; } if ( desc -> subsys_vmid > 0 ) { ret = pil_reclaim_mem ( desc , priv -> region_start , ( priv -> region_end - priv -> region_start ) , desc -> subsys_vmid ) ; if ( ret ) { pil_err ( desc , "Failed<S2SV_blank>to<S2SV_blank>assign<S2SV_blank>%s<S2SV_blank>memory,<S2SV_blank>ret<S2SV_blank>-<S2SV_blank>%d\\n" , desc -> name , ret ) ; goto err_deinit_image ; } hyp_assign = false ; } ret = desc -> ops -> auth_and_reset ( desc ) ; if ( ret ) { pil_err ( desc , "Failed<S2SV_blank>to<S2SV_blank>bring<S2SV_blank>out<S2SV_blank>of<S2SV_blank>reset\\n" ) ; goto err_auth_and_reset ; } pil_info ( desc , "Brought<S2SV_blank>out<S2SV_blank>of<S2SV_blank>reset\\n" ) ; desc -> modem_ssr = false ; err_auth_and_reset : if ( ret && desc -> subsys_vmid > 0 ) { pil_assign_mem_to_linux ( desc , priv -> region_start , ( priv -> region_end - priv -> region_start ) ) ; mem_protect = true ; } err_deinit_image : if ( ret && desc -> ops -> deinit_image ) desc -> ops -> deinit_image ( desc ) ; err_boot : if ( ret && desc -> proxy_unvote_irq ) disable_irq ( desc -> proxy_unvote_irq ) ; pil_proxy_unvote ( desc , ret ) ; release_fw : release_firmware ( fw ) ; out : up_read ( & pil_pm_rwsem ) ; if ( ret ) { if ( priv -> region ) { if ( desc -> subsys_vmid > 0 && ! mem_protect && hyp_assign ) { pil_reclaim_mem ( desc , priv -> region_start , ( priv -> region_end - priv -> region_start ) , VMID_HLOS ) ; } <S2SV_StartBug> dma_free_attrs ( desc -> dev , priv -> region_size , <S2SV_EndBug> priv -> region , priv -> region_start , & desc -> attrs ) ; priv -> region = NULL ; } if ( desc -> clear_fw_region && priv -> region_start ) pil_clear_segment ( desc ) ; <S2SV_StartBug> pil_release_mmap ( desc ) ; <S2SV_EndBug> } return ret ; } | <S2SV_ModStart> ) ; } <S2SV_ModEnd> if ( desc <S2SV_ModStart> desc ) ; dma_free_attrs ( desc -> dev , priv -> region_size , priv -> region , priv -> region_start , & desc -> attrs ) ; priv -> region = NULL ; } |
734 | CWE-000 static unsigned char waitForIdle ( unsigned int timeout ) { for ( unsigned long now = ticks ( ) ; ticks ( ) - now < timeout ; ) { <S2SV_StartBug> if ( SPI_byte ( 0xff ) == 0xff ) return 0 ; <S2SV_EndBug> } return 1 ; } | <S2SV_ModStart> ; ) { wdt_reset ( ) ; |
735 | CWE-000 static MYSQL * db_connect ( char * host , char * database , char * user , char * passwd ) { MYSQL * mysql ; if ( verbose ) fprintf ( stdout , "Connecting<S2SV_blank>to<S2SV_blank>%s\\n" , host ? host : "localhost" ) ; <S2SV_StartBug> pthread_mutex_lock ( & init_mutex ) ; <S2SV_EndBug> if ( ! ( mysql = mysql_init ( NULL ) ) ) { pthread_mutex_unlock ( & init_mutex ) ; return 0 ; } <S2SV_StartBug> pthread_mutex_unlock ( & init_mutex ) ; <S2SV_EndBug> if ( opt_compress ) mysql_options ( mysql , MYSQL_OPT_COMPRESS , NullS ) ; if ( opt_local_file ) mysql_options ( mysql , MYSQL_OPT_LOCAL_INFILE , ( char * ) & opt_local_file ) ; # ifdef HAVE_OPENSSL if ( opt_use_ssl ) mysql_ssl_set ( mysql , opt_ssl_key , opt_ssl_cert , opt_ssl_ca , opt_ssl_capath , opt_ssl_cipher ) ; mysql_options ( mysql , MYSQL_OPT_SSL_VERIFY_SERVER_CERT , ( char * ) & opt_ssl_verify_server_cert ) ; # endif if ( opt_protocol ) mysql_options ( mysql , MYSQL_OPT_PROTOCOL , ( char * ) & opt_protocol ) ; # ifdef HAVE_SMEM if ( shared_memory_base_name ) mysql_options ( mysql , MYSQL_SHARED_MEMORY_BASE_NAME , shared_memory_base_name ) ; # endif if ( opt_plugin_dir && * opt_plugin_dir ) mysql_options ( mysql , MYSQL_PLUGIN_DIR , opt_plugin_dir ) ; if ( opt_default_auth && * opt_default_auth ) mysql_options ( mysql , MYSQL_DEFAULT_AUTH , opt_default_auth ) ; if ( using_opt_enable_cleartext_plugin ) mysql_options ( mysql , MYSQL_ENABLE_CLEARTEXT_PLUGIN , ( char * ) & opt_enable_cleartext_plugin ) ; mysql_options ( mysql , MYSQL_SET_CHARSET_NAME , default_charset ) ; if ( ! ( mysql_connect_ssl_check ( mysql , host , user , passwd , database , opt_mysql_port , opt_mysql_unix_port , 0 , opt_ssl_required ) ) ) { ignore_errors = 0 ; db_error ( mysql ) ; } mysql -> reconnect = 0 ; if ( verbose ) fprintf ( stdout , "Selecting<S2SV_blank>database<S2SV_blank>%s\\n" , database ) ; if ( mysql_select_db ( mysql , database ) ) { ignore_errors = 0 ; db_error ( mysql ) ; } return mysql ; } | <S2SV_ModStart> "localhost" ) ; if ( opt_use_threads && ! lock_tables ) { <S2SV_ModStart> & init_mutex ) ; } else if ( ! ( mysql = mysql_init ( NULL ) ) ) return 0 |
736 | CWE-000 int listen ( int socket , int backlog ) { # if defined ( MODULE_SOCK_TCP ) || defined ( MODULE_SOCK_TCP_FREEBSD ) socket_t * s ; socket_sock_t * sock ; int res = 0 ; mutex_lock ( & _socket_pool_mutex ) ; s = _get_socket ( socket ) ; if ( s == NULL ) { errno = ENOTSOCK ; mutex_unlock ( & _socket_pool_mutex ) ; return - 1 ; } if ( s -> sock != NULL ) { # ifdef MODULE_SOCK_TCP if ( s -> queue_array == NULL ) { errno = EINVAL ; res = - 1 ; } # endif mutex_unlock ( & _socket_pool_mutex ) ; return res ; } sock = _get_free_sock ( ) ; mutex_unlock ( & _socket_pool_mutex ) ; if ( sock == NULL ) { errno = ENOMEM ; return - 1 ; } # ifdef MODULE_SOCK_TCP s -> queue_array = _tcp_sock_pool [ _get_sock_idx ( sock ) ] ; s -> queue_array_len = ( backlog < SOCKET_TCP_QUEUE_SIZE ) ? backlog : SOCKET_TCP_QUEUE_SIZE ; # endif switch ( s -> type ) { case SOCK_STREAM : if ( s -> bound ) { # ifdef MODULE_SOCK_TCP res = sock_tcp_listen ( & sock -> tcp . queue , & s -> local , s -> queue_array , s -> queue_array_len , 0 ) ; # endif # ifdef MODULE_SOCK_TCP_FREEBSD <S2SV_StartBug> res = sock_tcp_freebsd_listen ( & sock -> tcp_freebsd , backlog ) ; <S2SV_EndBug> # endif } else { res = - EDESTADDRREQ ; } break ; default : res = - EOPNOTSUPP ; break ; } if ( res == 0 ) { s -> sock = sock ; } else { errno = - res ; res = - 1 ; mutex_lock ( & _socket_pool_mutex ) ; bf_unset ( _sock_pool_used , _get_sock_idx ( sock ) ) ; mutex_unlock ( & _socket_pool_mutex ) ; } return - res ; # else ( void ) socket ; ( void ) backlog ; errno = EOPNOTSUPP ; return - 1 ; # endif } | <S2SV_ModStart> # ifdef MODULE_SOCK_TCP_FREEBSD if ( ( res = sock_tcp_freebsd_create ( & sock -> tcp_freebsd , & s -> local . addr . ipv6 , sizeof ( s -> local . addr . ipv6 ) , s -> domain , s -> local . port ) ) < 0 ) { errno = - res ; return - 1 ; } |
737 | CWE-000 void hvr_vertex_cache_delete ( hvr_vertex_t * vert , hvr_vertex_cache_t * cache ) { hvr_vertex_cache_node_t * node = hvr_vertex_cache_lookup ( vert -> id , cache ) ; assert ( node ) ; hvr_map_val_t to_remove = { . cached_vert = node } ; <S2SV_StartBug> hvr_map_remove ( vert -> id , to_remove , CACHED_VERT_INFO , & cache -> cache_map ) ; <S2SV_EndBug> linked_list_remove_helper ( node , node -> part_prev , node -> part_next , node -> part_prev ? & ( node -> part_prev -> part_next ) : NULL , node -> part_next ? & ( node -> part_next -> part_prev ) : NULL , & ( cache -> partitions [ node -> part ] ) ) ; if ( cache -> pool_head ) { cache -> pool_head -> part_prev = node ; } node -> part_next = cache -> pool_head ; node -> part_prev = NULL ; cache -> pool_head = node ; cache -> n_cached_vertices -- ; } | <S2SV_ModStart> id , to_remove <S2SV_ModEnd> , & cache |
738 | CWE-000 static inline void _printFlags ( struct CLIDebuggerBackend * be , union FlagRegister f ) { <S2SV_StartBug> be -> printf ( be , "[%c%c%c%c]\\n" , <S2SV_EndBug> f . z ? 'Z' : '-' , f . n ? 'N' : '-' , f . h ? 'H' : '-' , f . c ? 'C' : '-' ) ; } | <S2SV_ModStart> ( be , "F:<S2SV_blank>[%c%c%c%c]\\n" <S2SV_ModEnd> , f . |
739 | CWE-000 boolean makeChromIdeoImage ( struct track * * pTrackList , char * psOutput , struct tempName * ideoTn ) { struct track * ideoTrack = NULL ; MgFont * font = tl . font ; char * mapName = "ideoMap" ; struct hvGfx * hvg ; boolean doIdeo = TRUE ; int ideoWidth = round ( .8 * tl . picWidth ) ; int ideoHeight = 0 ; int textWidth = 0 ; struct tempName pngTn ; boolean nukeIdeoFromList = FALSE ; if ( ideoTn == NULL ) ideoTn = & pngTn ; ideoTrack = chromIdeoTrack ( * pTrackList ) ; if ( ideoTrack == NULL ) { doIdeo = FALSE ; } else if ( trackImgOnly && ! ideogramToo ) { doIdeo = FALSE ; } else { removeTrackFromGroup ( ideoTrack ) ; slRemoveEl ( pTrackList , ideoTrack ) ; nukeIdeoFromList = TRUE ; if ( withIdeogram && ideoTrack -> items == NULL ) { ideoTrack -> visibility = tvDense ; ideoTrack -> loadItems ( ideoTrack ) ; } limitVisibility ( ideoTrack ) ; if ( ideoTrack -> limitedVis == tvHide || ! withIdeogram ) doIdeo = FALSE ; } if ( doIdeo ) { <S2SV_StartBug> char startBand [ 16 ] ; <S2SV_EndBug> <S2SV_StartBug> char endBand [ 16 ] ; <S2SV_EndBug> <S2SV_StartBug> char title [ 64 ] ; <S2SV_EndBug> startBand [ 0 ] = endBand [ 0 ] = '\\0' ; fillInStartEndBands ( ideoTrack , startBand , endBand , sizeof ( startBand ) ) ; if ( ! psOutput ) hPrintf ( "<MAP<S2SV_blank>Name=%s>\\n" , mapName ) ; ideoHeight = gfxBorder + ideoTrack -> height ; if ( psOutput ) { trashDirFile ( ideoTn , "hgtIdeo" , "hgtIdeo" , ".ps" ) ; hvg = hvGfxOpenPostScript ( ideoWidth , ideoHeight , ideoTn -> forCgi ) ; } else { trashDirFile ( ideoTn , "hgtIdeo" , "hgtIdeo" , ".png" ) ; hvg = hvGfxOpenPng ( ideoWidth , ideoHeight , ideoTn -> forCgi , FALSE ) ; } hvg -> rc = revCmplDisp ; initColors ( hvg ) ; ideoTrack -> ixColor = hvGfxFindRgb ( hvg , & ideoTrack -> color ) ; ideoTrack -> ixAltColor = hvGfxFindRgb ( hvg , & ideoTrack -> altColor ) ; hvGfxSetClip ( hvg , 0 , gfxBorder , ideoWidth , ideoTrack -> height ) ; if ( virtMode ) { if ( ! sameString ( virtModeShortDescr , "" ) ) safef ( title , sizeof ( title ) , "%s<S2SV_blank>(%s)" , chromName , virtModeShortDescr ) ; else safef ( title , sizeof ( title ) , "%s<S2SV_blank>(%s)" , chromName , virtModeType ) ; } else if ( isEmpty ( startBand ) ) safef ( title , sizeof ( title ) , "%s" , chromName ) ; else if ( sameString ( startBand , endBand ) ) safef ( title , sizeof ( title ) , "%s<S2SV_blank>(%s)" , chromName , startBand ) ; else safef ( title , sizeof ( title ) , "%s<S2SV_blank>(%s-%s)" , chromName , startBand , endBand ) ; textWidth = mgFontStringWidth ( font , title ) ; hvGfxTextCentered ( hvg , 2 , gfxBorder , textWidth , ideoTrack -> height , MG_BLACK , font , title ) ; int saveInsideX = insideX ; int saveInsideWidth = insideWidth ; insideX = textWidth + 4 ; insideWidth = ideoWidth - insideX ; ideoTrack -> drawItems ( ideoTrack , winStart , winEnd , hvg , insideX , gfxBorder , insideWidth , font , ideoTrack -> ixColor , ideoTrack -> limitedVis ) ; insideX = saveInsideX ; insideWidth = saveInsideWidth ; hvGfxUnclip ( hvg ) ; hvGfxClose ( & hvg ) ; if ( ! psOutput ) { hPrintf ( "</MAP>\\n" ) ; jsInline ( "$(\'area.cytoBand\').click(function(){return<S2SV_blank>false;});\\n" ) ; } } if ( ! doIdeo && ! psOutput ) { hPrintf ( "<MAP<S2SV_blank>Name=%s>\\n" , mapName ) ; hPrintf ( "</MAP>\\n" ) ; } hPrintf ( "<TABLE<S2SV_blank>BORDER=0<S2SV_blank>CELLPADDING=0>" ) ; if ( ! psOutput ) { char * srcPath = "" ; char * style = "display:<S2SV_blank>none;" ; if ( doIdeo ) { srcPath = ideoTn -> forHtml ; style = "display:<S2SV_blank>inline;" ; } hPrintf ( "<TR><TD<S2SV_blank>HEIGHT=5></TD></TR>" ) ; hPrintf ( "<TR><TD><IMG<S2SV_blank>SRC<S2SV_blank>=<S2SV_blank>\\"%s\\"<S2SV_blank>BORDER=1<S2SV_blank>WIDTH=%d<S2SV_blank>HEIGHT=%d<S2SV_blank>USEMAP=#%s<S2SV_blank>id=\'chrom\'<S2SV_blank>style=\'%s\'>" , srcPath , ideoWidth , ideoHeight , mapName , style ) ; hPrintf ( "</TD></TR>" ) ; hPrintf ( "<TR><TD<S2SV_blank>HEIGHT=5></TD></TR></TABLE>\\n" ) ; } else hPrintf ( "<TR><TD<S2SV_blank>HEIGHT=10></TD></TR></TABLE>\\n" ) ; if ( ideoTrack != NULL ) { ideoTrack -> limitedVisSet = TRUE ; ideoTrack -> limitedVis = tvHide ; } return nukeIdeoFromList ; } | <S2SV_ModStart> char startBand [ 1024 <S2SV_ModEnd> ] ; char <S2SV_ModStart> char endBand [ 1024 <S2SV_ModEnd> ] ; char <S2SV_ModStart> char title [ 1024 <S2SV_ModEnd> ] ; startBand |
740 | CWE-000 int powercap_get_job_optimal_cpufreq ( uint32_t powercap , int * allowed_freqs ) { uint32_t cur_max_watts = 0 , * tmp_max_watts_dvfs = NULL ; int k = 1 ; bitstr_t * tmp_bitmap = NULL ; if ( ! _powercap_enabled ( ) ) return 0 ; tmp_max_watts_dvfs = xmalloc ( sizeof ( uint32_t ) * ( allowed_freqs [ 0 ] + 1 ) ) ; tmp_bitmap = bit_copy ( idle_node_bitmap ) ; bit_not ( tmp_bitmap ) ; cur_max_watts = powercap_get_node_bitmap_maxwatts_dvfs ( tmp_bitmap , <S2SV_StartBug> idle_node_bitmap , tmp_max_watts_dvfs , allowed_freqs , 0 ) ; <S2SV_EndBug> if ( cur_max_watts > powercap ) { while ( tmp_max_watts_dvfs [ k ] > powercap && k < allowed_freqs [ 0 ] + 1 ) { k ++ ; } if ( k == allowed_freqs [ 0 ] + 1 ) k -- ; <S2SV_StartBug> } else <S2SV_EndBug> <S2SV_StartBug> k = 1 ; <S2SV_EndBug> return k ; } | <S2SV_ModStart> allowed_freqs , 0 ) ; FREE_NULL_BITMAP ( tmp_bitmap <S2SV_ModStart> ; } else { <S2SV_ModStart> k = 1 ; } xfree ( tmp_max_watts_dvfs ) |
741 | CWE-000 void card_smithy ( int currentPlayer , struct gameState * state , int handPos ) { for ( int i = 0 ; i < 3 ; i ++ ) { drawCard ( currentPlayer , state ) ; } <S2SV_StartBug> discardCard ( handPos , currentPlayer , state , 0 ) ; <S2SV_EndBug> } | <S2SV_ModStart> ) ; } <S2SV_ModEnd> } <S2SV_null> <S2SV_null> |
742 | CWE-000 void note_surface_event ( u8 p , u8 v , u8 x , u8 y ) { if ( p == 0 ) { if ( v != 0 ) mode_update ( 254 ) ; } else if ( p == 96 && note_shift && v != 0 ) { mode_update ( 252 ) ; hal_plot_led ( TYPEPAD , p , 63 , 63 , 63 ) ; } else if ( p == 96 && v == 0 ) { note_scale_button ( ) ; } else if ( x == 0 || y == 9 || ( y == 0 && x < 8 ) || ( x == 9 && y > 4 ) ) { <S2SV_StartBug> hal_send_midi ( USBSTANDALONE , 0xB0 , p , v ) ; <S2SV_EndBug> hal_plot_led ( TYPEPAD , p , 0 , ( v == 0 ) ? 0 : 63 , 0 ) ; } else if ( p == 80 ) { <S2SV_StartBug> hal_send_midi ( USBSTANDALONE , 0xB0 , p , v ) ; <S2SV_EndBug> note_shift = v ; note_scale_button ( ) ; } else if ( x == 9 && y < 5 ) { if ( v != 0 ) { switch ( p ) { case 91 : if ( note_octave < 8 ) note_octave ++ ; break ; case 92 : if ( note_octave > - 1 ) note_octave -- ; break ; case 93 : if ( note_transpose > - 12 ) note_transpose -- ; break ; case 94 : if ( note_transpose < 12 ) note_transpose ++ ; break ; } note_draw ( ) ; } } else { s8 n = note_press ( x , y , v ) ; <S2SV_StartBug> if ( n >= 0 ) hal_send_midi ( USBSTANDALONE , ( v == 0 ) ? 0x80 : 0x90 , n , v ) ; <S2SV_EndBug> } } | <S2SV_ModStart> { hal_send_midi ( 2 - mode_default <S2SV_ModEnd> , 0xB0 , <S2SV_ModStart> { hal_send_midi ( 2 - mode_default <S2SV_ModEnd> , 0xB0 , <S2SV_ModStart> ) hal_send_midi ( 2 - mode_default <S2SV_ModEnd> , ( v |
743 | CWE-000 void printSpecificCombHeader ( int comb , FILE * file ) { char * combName = dataSetup . popTree -> popArray [ comb ] . name ; <S2SV_StartBug> fprintf ( file , "%s_%s\\t%s_%s\\t" , <S2SV_EndBug> combName , "coal_stats_total" , combName , "num_coals_total" ) ; } | <S2SV_ModStart> ( file , "%s%s\\t%s%s\\t" , "comb_coal_stats:" , combName , "comb_num_coals:" , combName <S2SV_ModEnd> ) ; } |
744 | CWE-000 void handleFrame ( Byte n ) { packetHandler_t handler = getPacketHandler ( n ) ; sfpFrame * frame = packetHandlers [ n ] . list ; <S2SV_StartBug> if ( handler != 0 && frame != 0 ) { <S2SV_EndBug> if ( handler ( frame -> packet , frame -> length - FRAME_OVERHEAD ) ) PacketProcessed ( ) ; else if ( ( getTime ( ) - frame -> timestamp ) > STALE_RX_FRAME ) UnDelivered ( ) ; else return ; unlinkFrame ( frame -> pid ) ; returnFrame ( frame ) ; } <S2SV_StartBug> } <S2SV_EndBug> | <S2SV_ModStart> frame != 0 ) { if ( validFrame ( frame ) <S2SV_ModStart> ; } } } |
745 | CWE-000 main ( ) { <S2SV_StartBug> char * s = "#include<S2SV_blank><stdio.h>%cmain()<S2SV_blank>{%c%cchar<S2SV_blank>*<S2SV_blank>s<S2SV_blank>=<S2SV_blank>%c%s%c;%c%cchar<S2SV_blank>c1<S2SV_blank>=<S2SV_blank>\'%cn\';%c%cchar<S2SV_blank>c2<S2SV_blank>=<S2SV_blank>\'%ct\';%c%cchar<S2SV_blank>c3<S2SV_blank>=<S2SV_blank>\'%c\';%c%cchar<S2SV_blank>c4<S2SV_blank>=<S2SV_blank>\'%c\';%c%cchar<S2SV_blank>c5<S2SV_blank>=<S2SV_blank>92;%c%cprintf(s,<S2SV_blank>c1,<S2SV_blank>c1,<S2SV_blank>c2,<S2SV_blank>c3,<S2SV_blank>s,<S2SV_blank>c3,<S2SV_blank>c1,<S2SV_blank>c2,<S2SV_blank>c5,<S2SV_blank>c1,<S2SV_blank>c2,<S2SV_blank>c5,<S2SV_blank>c1,<S2SV_blank>c2,<S2SV_blank>c3,<S2SV_blank>c1,<S2SV_blank>c2,<S2SV_blank>c4,<S2SV_blank>c1,<S2SV_blank>c2,<S2SV_blank>c1,<S2SV_blank>c2,<S2SV_blank>c1,<S2SV_blank>c1));%c}%c" ; <S2SV_EndBug> char c1 = '\\n' ; char c2 = '\\t' ; char c3 = \'"\' ; char c4 = '%' ; char c5 = 92 ; <S2SV_StartBug> printf ( s , c1 , c1 , c2 , c3 , s , c3 , c1 , c2 , c5 , c1 , c2 , c5 , c1 , c2 , c3 , c1 , c2 , c4 , c1 , c2 , c1 , c2 , c1 , c1 ) ; <S2SV_EndBug> } | <S2SV_ModStart> * s = "#include<S2SV_blank><stdio.h>%cmain()<S2SV_blank>{%c%cchar<S2SV_blank>*<S2SV_blank>s<S2SV_blank>=<S2SV_blank>%c%s%c;%c%cprintf(s,<S2SV_blank>10,<S2SV_blank>10,<S2SV_blank>9,<S2SV_blank>34,<S2SV_blank>s,<S2SV_blank>34,<S2SV_blank>10,<S2SV_blank>9,<S2SV_blank>10,<S2SV_blank>10);%c}%c" <S2SV_ModEnd> ; printf ( <S2SV_ModStart> ( s , 10 , 10 , 9 , 34 <S2SV_ModEnd> , s , <S2SV_ModStart> , s , 34 , 10 , 9 , 10 , 10 <S2SV_ModEnd> ) ; } |
746 | CWE-000 bool c2_case_split ( C2 * c2 ) { if ( ! c2 -> options -> case_splits || c2 -> restarts < c2 -> magic . num_restarts_before_case_splits || c2 -> conflicts_between_case_splits_countdown > 0 || c2 -> skolem -> decision_lvl != c2 -> restart_base_decision_lvl ) { return false ; } assert ( ! skolem_can_propagate ( c2 -> skolem ) ) ; Lit most_notorious_literal = c2_case_split_pick_literal ( c2 ) ; if ( most_notorious_literal != 0 ) { bool vacuous = c2_case_splits_make_assumption ( c2 , most_notorious_literal ) ; c2_case_splits_reset_countdown ( c2 ) ; return ! vacuous ; } else { <S2SV_StartBug> V1 ( "Case<S2SV_blank>split<S2SV_blank>not<S2SV_blank>successful;<S2SV_blank>no<S2SV_blank>failed<S2SV_blank>literals<S2SV_blank>detected.\\n" ) ; <S2SV_EndBug> return false ; } } | <S2SV_ModStart> { V1 ( "Case<S2SV_blank>split<S2SV_blank>not<S2SV_blank>successful;<S2SV_blank>no<S2SV_blank>literal<S2SV_blank>available<S2SV_blank>for<S2SV_blank>case<S2SV_blank>split.\\n" <S2SV_ModEnd> ) ; return |
747 | CWE-000 int main ( void ) { const struct CMUnitTest tests [ ] = { cmocka_unit_test_setup_teardown ( test_parse , setup_f , teardown_f ) , <S2SV_StartBug> cmocka_unit_test_setup_teardown ( test_parse_autodel , setup_f , teardown_f ) , <S2SV_EndBug> cmocka_unit_test_setup_teardown ( test_insert , setup_f , teardown_f ) , <S2SV_StartBug> cmocka_unit_test_setup_teardown ( test_insert_autodel , setup_f , teardown_f ) , <S2SV_EndBug> cmocka_unit_test_setup_teardown ( test_value_prefix , setup_f , teardown_f ) , cmocka_unit_test_setup_teardown ( test_augment_choice , setup_f , teardown_f ) , } ; return cmocka_run_group_tests ( tests , NULL , NULL ) ; } | <S2SV_ModStart> , cmocka_unit_test_setup_teardown ( test_netconf_autodel , setup_f , teardown_f ) , cmocka_unit_test_setup_teardown ( test_parse_noautodel <S2SV_ModEnd> , setup_f , <S2SV_ModStart> , cmocka_unit_test_setup_teardown ( test_insert_noautodel <S2SV_ModEnd> , setup_f , |
748 | CWE-000 int ArrayTypeSize ( AST * typ ) { int size ; if ( ! typ ) { return 4 ; } switch ( typ -> kind ) { case AST_MODIFIER_CONST : case AST_MODIFIER_VOLATILE : return ArrayTypeSize ( typ -> left ) ; case AST_ARRAYTYPE : size = EvalConstExpr ( typ -> right ) ; return size * ArrayTypeSize ( typ -> left ) ; case AST_INTTYPE : case AST_UNSIGNEDTYPE : case AST_GENERICTYPE : case AST_FLOATTYPE : return EvalConstExpr ( typ -> left ) ; case AST_PTRTYPE : return 4 ; case AST_OBJECT : { Module * P = ( Module * ) typ -> d . ptr ; return P -> varsize ; } <S2SV_StartBug> default : <S2SV_EndBug> ERROR ( typ , "Internal<S2SV_blank>error:<S2SV_blank>unknown<S2SV_blank>type<S2SV_blank>%d<S2SV_blank>passed<S2SV_blank>to<S2SV_blank>ArrayTypeSize" , typ -> kind ) ; return 1 ; } } | <S2SV_ModStart> varsize ; } case AST_TUPLETYPE : { return typ -> d . ival * 4 ; } |
749 | CWE-000 void process_onesided_reg_and_put ( struct fi_cq_tagged_entry * e , OFIRequest * req ) { CmiOfiRdmaReverseOp_t * regAndPutMsg = ( CmiOfiRdmaReverseOp_t * ) ( req -> data . rma_ncpy_ack ) ; struct fid_mr * mr = registerDirectMemory ( regAndPutMsg -> srcAddr , regAndPutMsg -> size ) ; void * ref = CmiGetNcpyAck ( regAndPutMsg -> srcAddr , ( char * ) regAndPutMsg + sizeof ( CmiOfiRdmaReverseOp_t ) + regAndPutMsg -> ackSize , regAndPutMsg -> srcPe , regAndPutMsg -> destAddr , ( char * ) regAndPutMsg + sizeof ( CmiOfiRdmaReverseOp_t ) , regAndPutMsg -> destPe , regAndPutMsg -> ackSize ) ; <S2SV_StartBug> char * rbuf = ( FI_MR_SCALABLE == context . mr_mode ) ? 0 : ( void * ) ( regAndPutMsg -> destAddr ) ; <S2SV_EndBug> CmiOfiRdmaComp_t * rdmaComp = ( CmiOfiRdmaComp_t * ) malloc ( sizeof ( CmiOfiRdmaComp_t ) ) ; rdmaComp -> ack_info = ref ; rdmaComp -> completion_count = 0 ; ofi_post_nocopy_operation ( <S2SV_StartBug> ( void * ) regAndPutMsg -> srcAddr , <S2SV_EndBug> rbuf , CmiNodeOf ( regAndPutMsg -> destPe ) , regAndPutMsg -> rem_key , regAndPutMsg -> size , mr , ofi_onesided_direct_operation_callback , ( void * ) rdmaComp , & ( rdmaComp -> completion_count ) , OFI_WRITE_OP ) ; } | <S2SV_ModStart> ackSize ) ; const <S2SV_ModStart> 0 : ( const char * ) <S2SV_ModEnd> regAndPutMsg -> destAddr <S2SV_ModStart> regAndPutMsg -> destAddr <S2SV_ModEnd> ; CmiOfiRdmaComp_t * <S2SV_ModStart> ofi_post_nocopy_operation ( ( char <S2SV_ModEnd> * ) regAndPutMsg |
750 | CWE-000 static bool are_identical_variables ( gfc_expr * e1 , gfc_expr * e2 ) { gfc_ref * r1 , * r2 ; if ( e1 -> symtree -> n . sym -> attr . dummy && e2 -> symtree -> n . sym -> attr . dummy ) { if ( e1 -> symtree -> n . sym -> name != e2 -> symtree -> n . sym -> name ) return false ; } else { if ( e1 -> symtree -> n . sym != e2 -> symtree -> n . sym ) return false ; } if ( e1 -> symtree -> n . sym -> attr . volatile_ ) return false ; r1 = e1 -> ref ; r2 = e2 -> ref ; while ( r1 != NULL || r2 != NULL ) { if ( r1 == NULL || r2 == NULL ) return false ; if ( r1 -> type != r2 -> type ) return false ; switch ( r1 -> type ) { case REF_ARRAY : if ( ! identical_array_ref ( & r1 -> u . ar , & r2 -> u . ar ) ) return false ; break ; case REF_COMPONENT : if ( r1 -> u . c . component != r2 -> u . c . component ) return false ; break ; case REF_SUBSTRING : if ( gfc_dep_compare_expr ( r1 -> u . ss . start , r2 -> u . ss . start ) != 0 ) return false ; if ( r1 -> u . ss . end == NULL && r2 -> u . ss . end == NULL ) break ; if ( gfc_dep_compare_expr ( r1 -> u . ss . end , r2 -> u . ss . end ) != 0 ) return false ; break ; <S2SV_StartBug> default : <S2SV_EndBug> gfc_internal_error ( "are_identical_variables:<S2SV_blank>Bad<S2SV_blank>type" ) ; } r1 = r1 -> next ; r2 = r2 -> next ; } return true ; } | <S2SV_ModStart> ; break ; case REF_INQUIRY : if ( r1 -> u . i != r2 -> u . i ) return false ; break ; |
751 | CWE-000 static void * row_init_queue ( struct request_queue * q ) { struct row_data * rdata ; int i ; rdata = kmalloc_node ( sizeof ( * rdata ) , GFP_KERNEL | __GFP_ZERO , q -> node ) ; if ( ! rdata ) return NULL ; for ( i = 0 ; i < ROWQ_MAX_PRIO ; i ++ ) { INIT_LIST_HEAD ( & rdata -> row_queues [ i ] . rqueue . fifo ) ; rdata -> row_queues [ i ] . disp_quantum = queue_quantum [ i ] ; rdata -> row_queues [ i ] . rqueue . rdata = rdata ; rdata -> row_queues [ i ] . rqueue . prio = i ; rdata -> row_queues [ i ] . rqueue . idle_data . begin_idling = false ; <S2SV_StartBug> } <S2SV_EndBug> <S2SV_StartBug> rdata -> read_idle . idle_time = ROW_IDLE_TIME ; <S2SV_EndBug> <S2SV_StartBug> rdata -> read_idle . freq = ROW_READ_FREQ ; <S2SV_EndBug> rdata -> read_idle . idle_workqueue = alloc_workqueue ( "row_idle_work" , WQ_MEM_RECLAIM | WQ_HIGHPRI , 0 ) ; if ( ! rdata -> read_idle . idle_workqueue ) panic ( "Failed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>idle<S2SV_blank>workqueue\\n" ) ; INIT_DELAYED_WORK ( & rdata -> read_idle . idle_work , kick_queue ) ; rdata -> curr_queue = ROWQ_PRIO_HIGH_READ ; rdata -> dispatch_queue = q ; rdata -> nr_reqs [ READ ] = rdata -> nr_reqs [ WRITE ] = 0 ; return rdata ; } | <S2SV_ModStart> = false ; rdata -> row_queues [ i ] . rqueue . idle_data . last_insert_time = ktime_set ( 0 , 0 ) ; <S2SV_ModStart> . idle_time = msecs_to_jiffies ( ROW_IDLE_TIME_MSEC ) ; if ( ! rdata -> read_idle . idle_time ) rdata -> read_idle . idle_time = 1 <S2SV_ModEnd> ; rdata -> <S2SV_ModStart> . freq = ROW_READ_FREQ_MSEC <S2SV_ModEnd> ; rdata -> |
752 | CWE-000 int apply_window_settings_x ( int * w , int * h ) { if ( fs ) { ( * w ) = DisplayWidth ( cavaXDisplay , cavaXScreenNumber ) ; ( * h ) = DisplayHeight ( cavaXDisplay , cavaXScreenNumber ) ; } xev . xclient . type = ClientMessage ; xev . xclient . serial = 0 ; xev . xclient . send_event = TRUE ; xev . xclient . window = cavaXWindow ; xev . xclient . message_type = wmState ; xev . xclient . format = 32 ; xev . xclient . data . l [ 0 ] = fs ? _NET_WM_STATE_ADD : _NET_WM_STATE_REMOVE ; xev . xclient . data . l [ 1 ] = fullScreen ; xev . xclient . data . l [ 2 ] = 0 ; XSendEvent ( cavaXDisplay , cavaXRoot , FALSE , SubstructureRedirectMask | SubstructureNotifyMask , & xev ) ; if ( GLXmode ) { <S2SV_StartBug> glViewport ( 0 , 0 , ( double ) * w , ( double ) * h ) ; <S2SV_EndBug> glMatrixMode ( GL_PROJECTION ) ; glLoadIdentity ( ) ; glOrtho ( 0 , ( double ) * w , 0 , ( double ) * h , - 1 , 1 ) ; glMatrixMode ( GL_MODELVIEW ) ; glLoadIdentity ( ) ; <S2SV_StartBug> } else { <S2SV_EndBug> XSetBackground ( cavaXDisplay , cavaXGraphics , xbgcol . pixel ) ; XClearWindow ( cavaXDisplay , cavaXWindow ) ; } return 0 ; } | <S2SV_ModStart> GLXmode ) { # ifdef GLX <S2SV_ModStart> ( ) ; # endif |
753 | CWE-000 ODBC_TEST ( t_bug13542600 ) { SQLINTEGER i ; CHECK_STMT_RC ( Stmt , SQLFreeStmt ( Stmt , SQL_CLOSE ) ) ; OK_SIMPLE_STMT ( Stmt , "select<S2SV_blank>1<S2SV_blank>as<S2SV_blank>i<S2SV_blank>,<S2SV_blank>null<S2SV_blank>as<S2SV_blank>j<S2SV_blank>" ) ; CHECK_STMT_RC ( Stmt , SQLBindCol ( Stmt , 2 , SQL_C_LONG , & i , 0 , NULL ) ) ; <S2SV_StartBug> FAIL_IF ( SQLFetch ( Stmt ) != SQL_ERROR , "error<S2SV_blank>expected" ) ; <S2SV_EndBug> CHECK_SQLSTATE ( Stmt , "22002" ) ; return OK ; } | <S2SV_ModStart> ) ) ; EXPECT_STMT ( Stmt , <S2SV_ModEnd> SQLFetch ( Stmt <S2SV_ModStart> ( Stmt ) , SQL_ERROR <S2SV_ModEnd> ) ; CHECK_SQLSTATE |
754 | CWE-000 int <S2SV_StartBug> RTMPPacket_Alloc ( RTMPPacket * p , int nSize ) <S2SV_EndBug> { <S2SV_StartBug> char * ptr = calloc ( 1 , nSize + RTMP_MAX_HEADER_SIZE ) ; <S2SV_EndBug> if ( ! ptr ) return FALSE ; p -> m_body = ptr + RTMP_MAX_HEADER_SIZE ; p -> m_nBytesRead = 0 ; return TRUE ; } | <S2SV_ModStart> * p , uint32_t <S2SV_ModEnd> nSize ) { <S2SV_ModStart> { char * ptr ; if ( nSize > SIZE_MAX - RTMP_MAX_HEADER_SIZE ) return FALSE ; |
755 | CWE-000 void SAC_PPM_array2ppm ( FILE * fp , SAC_ND_PARAM_in_nodesc ( array_nt , int ) , int shape [ 2 ] , bool binary ) { const int w = shape [ 1 ] ; <S2SV_StartBug> const int h = shape [ 0 ] ; <S2SV_EndBug> if ( binary == false ) { fprintf ( fp , "P3\\n" ) ; fprintf ( fp , "%d<S2SV_blank>%d\\n" , w , h ) ; fprintf ( fp , "255\\n" ) ; <S2SV_StartBug> for ( int i = 0 ; i < h ; i ++ ) { <S2SV_EndBug> <S2SV_StartBug> for ( int j = 0 ; j < w ; j ++ ) { <S2SV_EndBug> fprintf ( fp , "%d<S2SV_blank>%d<S2SV_blank>%d" , SAC_ND_A_FIELD ( array_nt ) [ ( i * w + j ) * 3 ] , SAC_ND_A_FIELD ( array_nt ) [ ( i * w + j ) * 3 + 1 ] , SAC_ND_A_FIELD ( array_nt ) [ ( i * w + j ) * 3 + 2 ] ) ; if ( j != w - 1 ) { fprintf ( fp , "<S2SV_blank>" ) ; } } fprintf ( fp , "\\n" ) ; } } else { fprintf ( fp , "P6\\n" ) ; fprintf ( fp , "%d<S2SV_blank>%d\\n" , w , h ) ; fprintf ( fp , "255\\n" ) ; <S2SV_StartBug> for ( int i = 0 ; i < h * w * 3 ; i ++ ) { <S2SV_EndBug> fprintf ( fp , "%c" , SAC_ND_A_FIELD ( array_nt ) [ i ] ) ; } } } | <S2SV_ModStart> [ 0 ] ; int i , j <S2SV_ModStart> ; for ( <S2SV_ModEnd> i = 0 <S2SV_ModStart> { for ( <S2SV_ModEnd> j = 0 <S2SV_ModStart> ; for ( <S2SV_ModEnd> i = 0 |
756 | CWE-000 mlt_producer producer_pango_init ( const char * filename ) { producer_pango this = calloc ( 1 , sizeof ( struct producer_pango_s ) ) ; if ( this != NULL && mlt_producer_init ( & this -> parent , this ) == 0 ) { mlt_producer producer = & this -> parent ; pthread_mutex_lock ( & pango_mutex ) ; if ( fontmap == NULL ) fontmap = ( PangoFT2FontMap * ) pango_ft2_font_map_new ( ) ; g_type_init ( ) ; pthread_mutex_unlock ( & pango_mutex ) ; producer -> get_frame = producer_get_frame ; producer -> close = ( mlt_destructor ) producer_close ; mlt_properties properties = MLT_PRODUCER_PROPERTIES ( & this -> parent ) ; mlt_events_register ( properties , "fontmap-reload" , NULL ) ; mlt_events_listen ( properties , producer , "fontmap-reload" , ( mlt_listener ) on_fontmap_reload ) ; mlt_properties_set ( properties , "fgcolour" , "0xffffffff" ) ; mlt_properties_set ( properties , "bgcolour" , "0x00000000" ) ; mlt_properties_set ( properties , "olcolour" , "0x00000000" ) ; mlt_properties_set_int ( properties , "align" , pango_align_left ) ; mlt_properties_set_int ( properties , "pad" , 0 ) ; mlt_properties_set_int ( properties , "outline" , 0 ) ; mlt_properties_set ( properties , "text" , "" ) ; mlt_properties_set ( properties , "font" , NULL ) ; mlt_properties_set ( properties , "family" , "Sans" ) ; mlt_properties_set_int ( properties , "size" , 48 ) ; mlt_properties_set ( properties , "style" , "normal" ) ; mlt_properties_set ( properties , "encoding" , "UTF-8" ) ; mlt_properties_set_int ( properties , "weight" , PANGO_WEIGHT_NORMAL ) ; mlt_properties_set_int ( properties , "stretch" , PANGO_STRETCH_NORMAL + 1 ) ; mlt_properties_set_int ( properties , "rotate" , 0 ) ; mlt_properties_set_int ( properties , "seekable" , 1 ) ; if ( filename == NULL || ( filename && ( ! strcmp ( filename , "" ) || strstr ( filename , "<producer>" ) || strstr ( filename , "<producer>" ) ) ) ) { mlt_properties_set ( properties , "markup" , "" ) ; } else if ( filename [ 0 ] == '+' || strstr ( filename , "/+" ) ) { char * copy = strdup ( filename + 1 ) ; char * markup = copy ; if ( strstr ( markup , "/+" ) ) markup = strstr ( markup , "/+" ) + 2 ; if ( strrchr ( markup , '.' ) ) ( * strrchr ( markup , '.' ) ) = '\\0' ; while ( strchr ( markup , '~' ) ) ( * strchr ( markup , '~' ) ) = '\\n' ; mlt_properties_set ( properties , "resource" , filename ) ; mlt_properties_set ( properties , "markup" , markup ) ; free ( copy ) ; } else if ( strstr ( filename , ".mpl" ) ) { int i = 0 ; mlt_position out_point = 0 ; mlt_properties contents = mlt_properties_load ( filename ) ; mlt_geometry key_frames = mlt_geometry_init ( ) ; struct mlt_geometry_item_s item ; mlt_properties_set ( properties , "resource" , filename ) ; mlt_properties_set_data ( properties , "contents" , contents , 0 , ( mlt_destructor ) mlt_properties_close , NULL ) ; mlt_properties_set_data ( properties , "key_frames" , key_frames , 0 , ( mlt_destructor ) mlt_geometry_close , NULL ) ; if ( mlt_properties_get ( contents , "0" ) == NULL ) mlt_properties_set ( contents , "0" , "" ) ; for ( i = 0 ; i < mlt_properties_count ( contents ) ; i ++ ) { char * name = mlt_properties_get_name ( contents , i ) ; char * value = mlt_properties_get_value ( contents , i ) ; while ( value != NULL && strchr ( value , '~' ) ) ( * strchr ( value , '~' ) ) = '\\n' ; item . frame = atoi ( name ) ; mlt_geometry_insert ( key_frames , & item ) ; out_point = MAX ( out_point , item . frame ) ; } mlt_geometry_interpolate ( key_frames ) ; mlt_properties_set_position ( properties , "length" , out_point + 1 ) ; mlt_properties_set_position ( properties , "out" , out_point ) ; } else { mlt_properties_set ( properties , "resource" , filename ) ; <S2SV_StartBug> mlt_properties_from_utf8 ( properties , "resource" , "_resource" ) ; <S2SV_EndBug> filename = mlt_properties_get ( properties , "_resource" ) ; <S2SV_StartBug> FILE * f = fopen ( filename , "r" ) ; <S2SV_EndBug> if ( f != NULL ) { char line [ 81 ] ; char * markup = NULL ; size_t size = 0 ; line [ 80 ] = '\\0' ; while ( fgets ( line , 80 , f ) ) { size += strlen ( line ) + 1 ; if ( markup ) { markup = realloc ( markup , size ) ; if ( markup ) strcat ( markup , line ) ; } else { markup = strdup ( line ) ; } } fclose ( f ) ; if ( markup && markup [ strlen ( markup ) - 1 ] == '\\n' ) markup [ strlen ( markup ) - 1 ] = '\\0' ; if ( markup ) mlt_properties_set ( properties , "markup" , markup ) ; else mlt_properties_set ( properties , "markup" , "" ) ; free ( markup ) ; } else { producer -> close = NULL ; mlt_producer_close ( producer ) ; producer = NULL ; free ( this ) ; } } return producer ; } free ( this ) ; return NULL ; } | <S2SV_ModStart> filename ) ; <S2SV_ModEnd> FILE * f <S2SV_ModStart> * f = mlt_fopen <S2SV_ModEnd> ( filename , |
757 | CWE-000 static int nouveau_gem_pushbuf_reloc_apply ( struct nouveau_cli * cli , struct drm_nouveau_gem_pushbuf * req , struct drm_nouveau_gem_pushbuf_bo * bo ) { struct drm_nouveau_gem_pushbuf_reloc * reloc = NULL ; int ret = 0 ; unsigned i ; reloc = u_memcpya ( req -> relocs , req -> nr_relocs , sizeof ( * reloc ) ) ; if ( IS_ERR ( reloc ) ) return PTR_ERR ( reloc ) ; for ( i = 0 ; i < req -> nr_relocs ; i ++ ) { struct drm_nouveau_gem_pushbuf_reloc * r = & reloc [ i ] ; struct drm_nouveau_gem_pushbuf_bo * b ; struct nouveau_bo * nvbo ; uint32_t data ; <S2SV_StartBug> if ( unlikely ( r -> bo_index > req -> nr_buffers ) ) { <S2SV_EndBug> NV_PRINTK ( err , cli , "reloc<S2SV_blank>bo<S2SV_blank>index<S2SV_blank>invalid\\n" ) ; ret = - EINVAL ; break ; } b = & bo [ r -> bo_index ] ; if ( b -> presumed . valid ) continue ; <S2SV_StartBug> if ( unlikely ( r -> reloc_bo_index > req -> nr_buffers ) ) { <S2SV_EndBug> NV_PRINTK ( err , cli , "reloc<S2SV_blank>container<S2SV_blank>bo<S2SV_blank>index<S2SV_blank>invalid\\n" ) ; ret = - EINVAL ; break ; } nvbo = ( void * ) ( unsigned long ) bo [ r -> reloc_bo_index ] . user_priv ; if ( unlikely ( r -> reloc_bo_offset + 4 > nvbo -> bo . mem . num_pages << PAGE_SHIFT ) ) { NV_PRINTK ( err , cli , "reloc<S2SV_blank>outside<S2SV_blank>of<S2SV_blank>bo\\n" ) ; ret = - EINVAL ; break ; } if ( ! nvbo -> kmap . virtual ) { ret = ttm_bo_kmap ( & nvbo -> bo , 0 , nvbo -> bo . mem . num_pages , & nvbo -> kmap ) ; if ( ret ) { NV_PRINTK ( err , cli , "failed<S2SV_blank>kmap<S2SV_blank>for<S2SV_blank>reloc\\n" ) ; break ; } nvbo -> validate_mapped = true ; } if ( r -> flags & NOUVEAU_GEM_RELOC_LOW ) data = b -> presumed . offset + r -> data ; else if ( r -> flags & NOUVEAU_GEM_RELOC_HIGH ) data = ( b -> presumed . offset + r -> data ) >> 32 ; else data = r -> data ; if ( r -> flags & NOUVEAU_GEM_RELOC_OR ) { if ( b -> presumed . domain == NOUVEAU_GEM_DOMAIN_GART ) data |= r -> tor ; else data |= r -> vor ; } ret = ttm_bo_wait ( & nvbo -> bo , false , false ) ; if ( ret ) { NV_PRINTK ( err , cli , "reloc<S2SV_blank>wait_idle<S2SV_blank>failed:<S2SV_blank>%d\\n" , ret ) ; break ; } nouveau_bo_wr32 ( nvbo , r -> reloc_bo_offset >> 2 , data ) ; } u_free ( reloc ) ; return ret ; } | <S2SV_ModStart> r -> bo_index >= <S2SV_ModEnd> req -> nr_buffers <S2SV_ModStart> r -> reloc_bo_index >= <S2SV_ModEnd> req -> nr_buffers |
758 | CWE-000 int inotify_monitor_unmark_directory ( struct inotify_monitor * im , const char * path ) { void * p ; <S2SV_StartBug> # ifdef RM_GLIB <S2SV_EndBug> p = hash_table_lookup ( im -> path2wd_table , path ) ; # else p = g_hash_table_lookup ( im -> path2wd_table , path ) ; # endif if ( p == NULL ) { a6o_log ( A6O_LOG_MODULE , A6O_LOG_LEVEL_WARNING , MODULE_LOG_NAME ":<S2SV_blank>retrieving<S2SV_blank>inotify<S2SV_blank>watch<S2SV_blank>id<S2SV_blank>for<S2SV_blank>%s<S2SV_blank>failed" , path ) ; <S2SV_StartBug> } else { <S2SV_EndBug> <S2SV_StartBug> int wd = GPOINTER_TO_INT ( p ) ; <S2SV_EndBug> if ( inotify_rm_watch ( im -> inotify_fd , wd ) == - 1 ) { a6o_log ( A6O_LOG_MODULE , A6O_LOG_LEVEL_WARNING , MODULE_LOG_NAME ":<S2SV_blank>removing<S2SV_blank>inotify<S2SV_blank>watch<S2SV_blank>%d<S2SV_blank>for<S2SV_blank>%s<S2SV_blank>failed<S2SV_blank>(%s)" , wd , path , strerror ( errno ) ) ; } # ifdef RM_GLIB <S2SV_StartBug> hash_table_remove ( im -> wd2path_table , H_INT_TO_POINTER ( wd ) ) ; <S2SV_EndBug> # else <S2SV_StartBug> g_hash_table_remove ( im -> wd2path_table , GINT_TO_POINTER ( wd ) ) ; <S2SV_EndBug> # endif } # ifdef RM_GLIB hash_table_remove ( im -> path2wd_table , path ) ; # else g_hash_table_remove ( im -> path2wd_table , path ) ; # endif return 0 ; } | <S2SV_ModStart> * p ; int wd ; <S2SV_ModStart> path ) ; return 1 ; } # ifdef RM_GLIB wd = H_POINTER_TO_INT ( p ) ; # else <S2SV_ModEnd> wd = GPOINTER_TO_INT <S2SV_ModStart> p ) ; # endif <S2SV_ModStart> -> wd2path_table , p ) ; hash_table_remove ( im -> path2wd_table , path <S2SV_ModEnd> ) ; # <S2SV_ModStart> -> wd2path_table , p ) ; <S2SV_ModEnd> g_hash_table_remove ( im |
759 | CWE-000 static const char * get_compile_file_tempdir ( void ) { static char * tempdir_name ; # define TEMPLATE TMP_PREFIX "XXXXXX" char tname [ sizeof ( TEMPLATE ) ] ; if ( tempdir_name != NULL ) return tempdir_name ; strcpy ( tname , TEMPLATE ) ; # undef TEMPLATE <S2SV_StartBug> # ifdef HAVE_MKDTEMP <S2SV_EndBug> tempdir_name = mkdtemp ( tname ) ; <S2SV_StartBug> # else <S2SV_EndBug> error ( _ ( "Command<S2SV_blank>not<S2SV_blank>supported<S2SV_blank>on<S2SV_blank>this<S2SV_blank>host." ) ) ; # endif if ( tempdir_name == NULL ) perror_with_name ( _ ( "Could<S2SV_blank>not<S2SV_blank>make<S2SV_blank>temporary<S2SV_blank>directory" ) ) ; tempdir_name = xstrdup ( tempdir_name ) ; make_final_cleanup ( do_rmdir , tempdir_name ) ; return tempdir_name ; } | <S2SV_ModStart> # undef TEMPLATE <S2SV_ModEnd> tempdir_name = mkdtemp <S2SV_ModStart> tname ) ; <S2SV_ModEnd> if ( tempdir_name |
760 | CWE-000 int main ( ) { cooMat cooMat ; csrMat csrMat ; readDiagMat ( "testmat.dat" , & cooMat ) ; cooMat_to_csrMat ( 0 , & cooMat , & csrMat ) ; const int msteps = 30 ; const int npts = 200 ; const int nvec = 100 ; double intv [ 6 ] = { - 2.448170338612495 , 11.868902203167497 , 0 , 0 , 5 , 8 } ; const int degB = 1 ; const double tau = 1e-4 ; intv [ 2 ] = intv [ 0 ] ; intv [ 3 ] = intv [ 1 ] ; int i , ret ; double neig , neig2 ; double * xHist = ( double * ) calloc ( npts , sizeof ( double ) ) ; double * yHist = ( double * ) calloc ( npts , sizeof ( double ) ) ; double * xdos = ( double * ) calloc ( npts , sizeof ( double ) ) ; double * ydos = ( double * ) calloc ( npts , sizeof ( double ) ) ; double * xdos2 = ( double * ) calloc ( npts , sizeof ( double ) ) ; double * ydos2 = ( double * ) calloc ( npts , sizeof ( double ) ) ; SetStdEig ( ) ; EVSLStart ( ) ; SetAMatrix ( & csrMat ) ; double t0 = cheblan_timer ( ) ; ret = LanDosG ( nvec , msteps , degB , npts , xdos , ydos , & neig , intv , tau ) ; double t1 = cheblan_timer ( ) ; fprintf ( stdout , "<S2SV_blank>LanDos<S2SV_blank>ret<S2SV_blank>%d<S2SV_blank>\\n" , ret ) ; double t2 = cheblan_timer ( ) ; ret = LanDos ( nvec , msteps , npts , xdos2 , ydos2 , & neig2 , intv ) ; double t3 = cheblan_timer ( ) ; fprintf ( stdout , "<S2SV_blank>LanDos<S2SV_blank>ret<S2SV_blank>%d<S2SV_blank>\\n" , ret ) ; printf ( "neig1:<S2SV_blank>%f,<S2SV_blank>neig2:<S2SV_blank>%f<S2SV_blank>\\n" , neig , neig2 ) ; printf ( "1:<S2SV_blank>%f,<S2SV_blank>2:<S2SV_blank>%f<S2SV_blank>\\n" , t1 - t0 , t3 - t2 ) ; ret = exDOS ( cooMat . vv , cooMat . ncols , npts , xHist , yHist , intv ) ; EVSLFinish ( ) ; free_coo ( & cooMat ) ; fprintf ( stdout , "<S2SV_blank>exDOS<S2SV_blank>ret<S2SV_blank>%d<S2SV_blank>\\n" , ret ) ; struct stat st = { 0 } ; if ( stat ( "OUT" , & st ) == - 1 ) { mkdir ( "OUT" , 0700 ) ; } FILE * ofp = fopen ( "OUT/myydos.txt" , "w" ) ; FILE * ofp2 = fopen ( "OUT/myydos2.txt" , "w" ) ; for ( i = 0 ; i < npts ; i ++ ) { fprintf ( ofp , "<S2SV_blank>%10.4f<S2SV_blank><S2SV_blank>%10.4f\\n" , xdos [ i ] , ydos [ i ] ) ; fprintf ( ofp2 , "<S2SV_blank>%10.4f<S2SV_blank><S2SV_blank>%10.4f\\n" , xdos2 [ i ] , ydos2 [ i ] ) ; } fclose ( ofp ) ; fclose ( ofp2 ) ; ofp = fopen ( "OUT/Exydos.txt" , "w" ) ; for ( i = 0 ; i < npts ; i ++ ) fprintf ( ofp , "<S2SV_blank>%10.4f<S2SV_blank><S2SV_blank>%10.4f\\n" , xHist [ i ] , yHist [ i ] ) ; fclose ( ofp ) ; system ( "gnuplot<S2SV_blank><<S2SV_blank>tester.gnuplot" ) ; system ( "gv<S2SV_blank>tester.eps" ) ; free ( xHist ) ; free ( yHist ) ; free ( xdos ) ; free ( ydos ) ; <S2SV_StartBug> free_csr ( & csrMat ) ; <S2SV_EndBug> return 0 ; } | <S2SV_ModStart> ydos ) ; free ( xdos2 ) ; free ( ydos2 ) ; |
761 | CWE-000 static void process_command ( conn * c , char * command ) { token_t tokens [ MAX_TOKENS ] ; size_t ntokens ; int comm ; struct timespec start , end ; assert ( c != NULL ) ; if ( settings . verbose > 1 ) fprintf ( stderr , "<%d<S2SV_blank>%s\\n" , c -> sfd , command ) ; c -> msgcurr = 0 ; c -> msgused = 0 ; c -> iovused = 0 ; if ( add_msghdr ( c ) != 0 ) { out_string ( c , "SERVER_ERROR<S2SV_blank>out<S2SV_blank>of<S2SV_blank>memory<S2SV_blank>preparing<S2SV_blank>response" ) ; return ; } clock_gettime ( CLOCK_MONOTONIC , & start ) ; ntokens = tokenize_command ( command , tokens , MAX_TOKENS ) ; if ( ntokens >= 3 && ( strcmp ( tokens [ COMMAND_TOKEN ] . value , "get" ) == 0 ) ) { process_get_command ( c , tokens , ntokens ) ; } <S2SV_StartBug> else if ( ( ( ntokens == 6 || ntokens == 7 ) && <S2SV_EndBug> <S2SV_StartBug> strcmp ( tokens [ COMMAND_TOKEN ] . value , "set" ) == 0 && ( comm = NREAD_SET ) ) || <S2SV_EndBug> <S2SV_StartBug> ( strcmp ( tokens [ COMMAND_TOKEN ] . value , "append" ) == 0 && ( comm = NREAD_APPEND ) ) ) <S2SV_EndBug> { process_update_command ( c , tokens , ntokens , comm ) ; } else if ( ( ntokens == 4 || ntokens == 5 ) && ( strcmp ( tokens [ COMMAND_TOKEN ] . value , "incr" ) == 0 ) ) { process_arithmetic_command ( c , tokens , ntokens , 1 ) ; } else if ( ntokens >= 3 && ntokens <= 4 && ( strcmp ( tokens [ COMMAND_TOKEN ] . value , "delete" ) == 0 ) ) { process_delete_command ( c , tokens , ntokens ) ; } else if ( ntokens >= 2 && ( strcmp ( tokens [ COMMAND_TOKEN ] . value , "stats" ) == 0 ) ) { process_stat ( c , tokens , ntokens ) ; } else if ( ntokens == 2 && ( strcmp ( tokens [ COMMAND_TOKEN ] . value , "version" ) == 0 ) ) { out_string ( c , "VERSION<S2SV_blank>" VERSION ) ; } else if ( ntokens == 2 && ( strcmp ( tokens [ COMMAND_TOKEN ] . value , "quit" ) == 0 ) ) { conn_set_state ( c , conn_closing ) ; } else if ( ntokens == 3 && ( strcmp ( tokens [ COMMAND_TOKEN ] . value , "verbosity" ) == 0 ) ) { process_verbosity_command ( c , tokens , ntokens ) ; } else if ( ntokens >= 2 && ntokens <= 4 && ( strcmp ( tokens [ COMMAND_TOKEN ] . value , "flush_all" ) == 0 ) ) { set_noreply_maybe ( c , tokens , ntokens ) ; int limit = 10000 ; if ( ntokens == ( c -> noreply ? 4 : 3 ) ) { limit = strtol ( tokens [ 1 ] . value , NULL , 10 ) ; if ( errno == ERANGE ) { out_string ( c , "CLIENT_ERROR<S2SV_blank>bad<S2SV_blank>command<S2SV_blank>line<S2SV_blank>format" ) ; return ; } } hs_optimize ( store , limit ) ; out_string ( c , "OK" ) ; return ; } else if ( stopme && ntokens == 2 && ( strcmp ( tokens [ COMMAND_TOKEN ] . value , "stopme" ) == 0 ) ) { fprintf ( stderr , "quit<S2SV_blank>under<S2SV_blank>request\\n" ) ; daemon_quit = 1 ; } else { out_string ( c , "ERROR" ) ; return ; } clock_gettime ( CLOCK_MONOTONIC , & end ) ; float secs = ( end . tv_sec - start . tv_sec ) + ( end . tv_nsec - start . tv_nsec ) / 1e9 ; if ( secs > settings . slow_cmd_time ) { STATS_LOCK ( ) ; stats . slow_cmds ++ ; STATS_UNLOCK ( ) ; } if ( NULL != access_log && ntokens >= 3 ) { char now [ 255 ] ; time_t t = time ( NULL ) ; strftime ( now , 200 , "%Y-%m-%d<S2SV_blank>%H:%M:%S" , localtime ( & t ) ) ; struct sockaddr_storage addr ; unsigned int addrlen = sizeof ( addr ) ; getpeername ( c -> sfd , ( struct sockaddr * ) & addr , & addrlen ) ; char host [ NI_MAXHOST ] , serv [ NI_MAXSERV ] ; getnameinfo ( ( struct sockaddr * ) & addr , addrlen , host , sizeof ( host ) , serv , sizeof ( serv ) , NI_NUMERICSERV ) ; fprintf ( access_log , "%s<S2SV_blank>%s:%s<S2SV_blank>%s<S2SV_blank>%s<S2SV_blank>%.3f\\n" , now , host , serv , command , tokens [ 1 ] . value , secs * 1000 ) ; } return ; } | <S2SV_ModStart> if ( ( <S2SV_ModEnd> ntokens == 6 <S2SV_ModStart> 7 ) && ( ( <S2SV_ModStart> comm = NREAD_APPEND ) |
762 | CWE-000 void thread_mqtt ( void * arg ) { <S2SV_StartBug> s_config * config = args ; <S2SV_EndBug> int major = 0 , minor = 0 , revision = 0 ; struct mosquitto * mosq = NULL ; char * host = config -> mqtt_server -> hostname ; int port = config -> mqtt_server -> port ; char * cafile = config -> mqtt_server -> cafile ; int keepalive = 60 ; int retval = 0 ; mosquitto_lib_version ( & major , & minor , & revision ) ; debug ( LOG_DEBUG , "Mosquitto<S2SV_blank>library<S2SV_blank>version<S2SV_blank>:<S2SV_blank>%d.%d.%d\\n" , major , minor , revision ) ; mosquitto_lib_init ( ) ; <S2SV_StartBug> mosq = mosquitto_new ( NULL , clean_session , config ) ; <S2SV_EndBug> if ( mosq == NULL ) { switch ( errno ) { case ENOMEM : debug ( LOG_INFO , "Error:<S2SV_blank>Out<S2SV_blank>of<S2SV_blank>memory.\\n" ) ; break ; case EINVAL : debug ( LOG_INFO , "Error:<S2SV_blank>Invalid<S2SV_blank>id<S2SV_blank>and/or<S2SV_blank>clean_session.\\n" ) ; break ; } mosquitto_lib_cleanup ( ) ; <S2SV_StartBug> return EXIT_FAILURE ; <S2SV_EndBug> } if ( mosquitto_tls_set ( mosq , cafile , NULL , NULL , NULL , NULL ) ) { debug ( LOG_INFO , "Error<S2SV_blank>:<S2SV_blank>Problem<S2SV_blank>setting<S2SV_blank>TLS<S2SV_blank>option" ) ; mosquitto_destroy ( mosq ) ; mosquitto_lib_cleanup ( ) ; <S2SV_StartBug> return EXIT_FAILURE ; <S2SV_EndBug> } if ( mosquitto_tls_insecure_set ( mosq , true ) ) { debug ( LOG_INFO , "Error<S2SV_blank>:<S2SV_blank>Problem<S2SV_blank>setting<S2SV_blank>TLS<S2SV_blank>insecure<S2SV_blank>option" ) ; mosquitto_destroy ( mosq ) ; mosquitto_lib_cleanup ( ) ; <S2SV_StartBug> return EXIT_FAILURE ; <S2SV_EndBug> } mosquitto_connect_callback_set ( mosq , mqtt_connect_callback ) ; mosquitto_message_callback_set ( mosq , mqtt_message_callback ) ; switch ( retval = mosquitto_connect ( mosq , host , port , keepalive ) ) { case MOSQ_ERR_INVAL : debug ( LOG_INFO , "Error<S2SV_blank>:<S2SV_blank>%s\\n" , mosquitto_strerror ( retval ) ) ; break ; case MOSQ_ERR_ERRNO : debug ( LOG_INFO , "Error<S2SV_blank>:<S2SV_blank>%s\\n" , strerror ( errno ) ) ; break ; mosquitto_destroy ( mosq ) ; mosquitto_lib_cleanup ( ) ; <S2SV_StartBug> return EXIT_FAILURE ; <S2SV_EndBug> } retval = mosquitto_loop_forever ( mosq , - 1 , 1 ) ; mosquitto_destroy ( mosq ) ; mosquitto_lib_cleanup ( ) ; } | <S2SV_ModStart> * config = arg <S2SV_ModEnd> ; int major <S2SV_ModStart> ( NULL , true <S2SV_ModEnd> , config ) <S2SV_ModStart> ) ; return <S2SV_ModEnd> ; } if <S2SV_ModStart> ) ; return <S2SV_ModEnd> ; } if <S2SV_ModStart> ) ; return <S2SV_ModEnd> ; } mosquitto_connect_callback_set <S2SV_ModStart> ) ; return <S2SV_ModEnd> ; } retval |
763 | CWE-000 static int getNextTrack ( ) { Group * group ; TrackData * trackData = getTrackData ( ) ; <S2SV_StartBug> int groupIndex = 0 ; <S2SV_EndBug> int groupTrackCount = 0 ; int currentTrack = getActiveTrack ( ) ; Track * track = & trackData -> tracks [ currentTrack ] ; <S2SV_StartBug> group = track -> group ; <S2SV_EndBug> groupTrackCount = group -> trackCount ; if ( ! group -> folded ) { if ( track -> groupIndex + 1 < group -> trackCount ) return group -> tracks [ track -> groupIndex + 1 ] -> index ; } groupIndex = group -> groupIndex ; if ( groupIndex >= trackData -> groupCount - 1 ) return currentTrack ; group = & trackData -> groups [ groupIndex + 1 ] ; return group -> tracks [ 0 ] -> index ; } | <S2SV_ModStart> ; int groupIndex <S2SV_ModEnd> = 0 ; <S2SV_ModStart> track -> group <S2SV_ModEnd> ; if ( |
764 | CWE-000 alac_file * alac_create ( int samplesize , int numchannels ) { <S2SV_StartBug> alac_file * newfile = malloc ( sizeof ( alac_file ) ) ; <S2SV_EndBug> memset ( newfile , 0 , sizeof ( alac_file ) ) ; newfile -> samplesize = samplesize ; newfile -> numchannels = numchannels ; newfile -> bytespersample = ( samplesize / 8 ) * numchannels ; <S2SV_StartBug> return newfile ; <S2SV_EndBug> } | <S2SV_ModStart> ) ) ; if ( newfile ) { <S2SV_ModStart> * numchannels ; } else { fprintf ( stderr , "FIXME:<S2SV_blank>can<S2SV_blank>not<S2SV_blank>allocate<S2SV_blank>memory<S2SV_blank>for<S2SV_blank>a<S2SV_blank>new<S2SV_blank>file<S2SV_blank>in<S2SV_blank>alac_cxreate." ) ; } |
765 | CWE-000 static int recovery_upload ( struct mg_connection * conn ) { const char * content_type_header , * boundary_start ; char buf [ BUF_LEN ] , path [ PATH_MAX ] , fname [ 1024 ] , boundary [ 100 ] ; int bl = 0 , n , i , j , headers_len = 0 , boundary_len = 0 , len = 0 , num_uploaded_files = 0 ; int instfd ; int file_length ; int nbytes = 0 ; int XHTTPRequest = 0 ; fname [ 0 ] = '\\0' ; if ( ( content_type_header = mg_get_header ( conn , "Content-Type" ) ) == NULL || ( boundary_start = mg_strcasestr ( content_type_header , "boundary=" ) ) == NULL || ( sscanf ( boundary_start , "boundary=\\"%99[^\\"]\\"" , boundary ) == 0 && sscanf ( boundary_start , "boundary=%99s" , boundary ) == 0 ) || boundary [ 0 ] == '\\0' ) { if ( ( content_type_header = mg_get_header ( conn , "X_FILENAME" ) ) == NULL ) return num_uploaded_files ; strncpy ( fname , content_type_header , sizeof ( fname ) ) ; if ( ( content_type_header = mg_get_header ( conn , "Content-length" ) ) == NULL ) return num_uploaded_files ; file_length = strtoul ( content_type_header , NULL , 10 ) ; printf ( "X_FILENAME:<S2SV_blank>%s<S2SV_blank>length:<S2SV_blank>%d\\n" , fname , file_length ) ; XHTTPRequest = 1 ; } if ( ! XHTTPRequest ) { boundary_len = strlen ( boundary ) ; bl = boundary_len + 4 ; assert ( len >= 0 && len <= ( int ) sizeof ( buf ) ) ; while ( ( n = mg_read ( conn , buf + len , sizeof ( buf ) - len ) ) > 0 ) { len += n ; } if ( ( headers_len = get_request_len ( buf , len ) ) <= 0 ) { return num_uploaded_files ; } fname [ 0 ] = '\\0' ; for ( i = j = 0 ; i < headers_len ; i ++ ) { if ( buf [ i ] == '\\r' && buf [ i + 1 ] == '\\n' ) { buf [ i ] = buf [ i + 1 ] = '\\0' ; sscanf ( & buf [ j ] , "Content-Disposition:<S2SV_blank>%*s<S2SV_blank>%*s<S2SV_blank>filename=\\"%1023[^\\"]" , fname ) ; j = i + 2 ; } } } else { while ( ( n = mg_read ( conn , buf + len , sizeof ( buf ) - len ) ) > 0 ) { len += n ; } } if ( fname [ 0 ] == '\\0' ) { return num_uploaded_files ; } instfd = ipc_inst_start ( ) ; if ( instfd < 0 ) { return num_uploaded_files ; } assert ( len >= headers_len ) ; memmove ( buf , & buf [ headers_len ] , len - headers_len ) ; len -= headers_len ; n = 0 ; nbytes = len ; do { len += n ; nbytes += n ; if ( ! XHTTPRequest ) { for ( i = 0 ; i < len - bl ; i ++ ) { if ( ! memcmp ( & buf [ i ] , "\\r\\n--" , 4 ) && ! memcmp ( & buf [ i + 4 ] , boundary , boundary_len ) ) { ipc_send_data ( instfd , buf , i ) ; num_uploaded_files ++ ; upload_handler ( conn , path ) ; memmove ( buf , & buf [ i + bl ] , len - ( i + bl ) ) ; len -= i + bl ; break ; } } } else { if ( nbytes >= file_length ) { ipc_send_data ( instfd , buf , len ) ; num_uploaded_files ++ ; upload_handler ( conn , path ) ; break ; } } if ( len > bl ) { ipc_send_data ( instfd , buf , len - bl ) ; memmove ( buf , & buf [ len - bl ] , bl ) ; len = bl ; } } while ( ( n = mg_read ( conn , buf + len , sizeof ( buf ) - len ) ) > 0 ) ; ipc_end ( instfd ) ; <S2SV_StartBug> mg_printf ( conn , "%s" , "HTTP/1.0<S2SV_blank>200<S2SV_blank>OK\\r\\n\\r\\n" ) ; <S2SV_EndBug> return num_uploaded_files ; } | <S2SV_ModStart> instfd ) ; <S2SV_ModEnd> return num_uploaded_files ; |
766 | CWE-000 void patchFirm ( firmtype firm_type , boottype boot_type , u16 path [ ] ) { if ( firm_type == NATIVE_FIRM ) { <S2SV_StartBug> u8 * sect_arm9 = ( u8 * ) firm + firm -> section [ 2 ] . offset ; <S2SV_EndBug> u32 size_p9 , addr_p9 ; u8 * offset_p9 = getProcess9Info ( sect_arm9 , firm -> section [ 2 ] . size , & size_p9 , & addr_p9 ) ; u32 size_k9 = ( u32 ) ( offset_p9 - sect_arm9 ) - sizeof ( Cxi ) - 0x200 ; if ( ISSIGHAX && boot_type == SYSNAND ) patchFirmWrite ( firm , firmSize ) ; <S2SV_StartBug> if ( boot_type == EMUNAND ) <S2SV_EndBug> patchEmuCode ( sect_arm9 , size_k9 , offset_p9 , size_p9 , firm -> section [ 2 ] . address ) ; patchSigChecks ( firm , firmSize ) ; <S2SV_StartBug> patchFirmlaunches ( offset_p9 , size_p9 , addr_p9 , path , reboot_bin , reboot_bin_size ) ; <S2SV_EndBug> } if ( firm_type == AGB_FIRM || firm_type == TWL_FIRM ) { int ret = 0 ; u8 * sect_arm9 = ( u8 * ) firm + firm -> section [ 3 ] . offset ; u32 process9Size , process9MemAddr ; u8 * process9Offset = getProcess9Info ( sect_arm9 , firm -> section [ 3 ] . size , & process9Size , & process9MemAddr ) ; ret += patchLgySignatureChecks ( process9Offset , process9Size ) ; if ( firm_type = TWL_FIRM ) { ret += patchTwlInvalidSignatureChecks ( process9Offset , process9Size ) ; ret += patchTwlNintendoLogoChecks ( process9Offset , process9Size ) ; ret += patchTwlWhitelistChecks ( process9Offset , process9Size ) ; ret += patchTwlFlashcartChecks ( process9Offset , process9Size ) ; ret += patchTwlShaHashChecks ( process9Offset , process9Size ) ; } if ( ret != 0 ) { debugWrite ( "/rei/debug.log" , "Failed<S2SV_blank>to<S2SV_blank>patch<S2SV_blank>a<S2SV_blank>Legacy<S2SV_blank>FIRM.<S2SV_blank>" , 31 ) ; shutdown ( ) ; } } } | <S2SV_ModStart> section [ 2 ] . offset ; u8 * sect_arm11 = ( u8 * ) firm + firm -> section [ 1 <S2SV_ModStart> boot_type == EMUNAND && CFG_BOOTENV != 0x7 <S2SV_ModStart> reboot_bin , reboot_bin_size ) ; u32 baseK11VA ; u8 * freeK11Space ; u32 * arm11SvcHandler , * arm11DAbtHandler , * arm11ExceptionsPage , * arm11SvcTable = getKernel11Info ( sect_arm11 , firm -> section [ 1 ] . size , & baseK11VA , & freeK11Space , & arm11SvcHandler , & arm11DAbtHandler , & arm11ExceptionsPage ) ; reimplementSvcBackdoor ( sect_arm11 , arm11SvcTable , baseK11VA , & freeK11Space |
767 | CWE-000 double gps_dm_2_dd ( double dm ) { int d = ( int ) ( dm / 100.0f ) ; <S2SV_StartBug> double m = dm / 100.0f - d ; <S2SV_EndBug> <S2SV_StartBug> return d + m / 60.0f ; <S2SV_EndBug> } | <S2SV_ModStart> m = dm - d * 100 ; <S2SV_ModEnd> ; return d <S2SV_ModStart> + m / 60.0 <S2SV_ModEnd> ; } <S2SV_null> |
768 | CWE-000 void _hash_initbitmap ( Relation rel , HashMetaPage metap , BlockNumber blkno , ForkNumber forkNum ) { Buffer buf ; Page pg ; HashPageOpaque op ; uint32 * freep ; buf = _hash_getnewbuf ( rel , blkno , forkNum ) ; pg = BufferGetPage ( buf ) ; op = ( HashPageOpaque ) PageGetSpecialPointer ( pg ) ; op -> hasho_prevblkno = InvalidBlockNumber ; op -> hasho_nextblkno = InvalidBlockNumber ; op -> hasho_bucket = - 1 ; op -> hasho_flag = LH_BITMAP_PAGE ; op -> hasho_page_id = HASHO_PAGE_ID ; freep = HashPageGetBitmap ( pg ) ; MemSet ( freep , 0xFF , BMPGSZ_BYTE ( metap ) ) ; <S2SV_StartBug> _hash_wrtbuf ( rel , buf ) ; <S2SV_EndBug> if ( metap -> hashm_nmaps >= HASH_MAX_BITMAPS ) ereport ( ERROR , ( errcode ( ERRCODE_PROGRAM_LIMIT_EXCEEDED ) , errmsg ( "out<S2SV_blank>of<S2SV_blank>overflow<S2SV_blank>pages<S2SV_blank>in<S2SV_blank>hash<S2SV_blank>index<S2SV_blank>\\"%s\\"" , RelationGetRelationName ( rel ) ) ) ) ; metap -> hashm_mapp [ metap -> hashm_nmaps ] = blkno ; metap -> hashm_nmaps ++ ; } | <S2SV_ModStart> ) ) ; MarkBufferDirty ( buf ) ; _hash_relbuf <S2SV_ModEnd> ( rel , |
769 | CWE-000 DataType searchType ( char * name ) { if ( name == NULL ) return NON_T ; int i ; for ( i = 0 ; i < typedef_ent_ct ; i ++ ) { <S2SV_StartBug> if ( strcmp ( TypeDefTable [ i ] . newType , name ) == 0 ) <S2SV_EndBug> return TypeDefTable [ i ] . baseType ; } return NON_T ; } | <S2SV_ModStart> { if ( TypeDefTable [ i ] . newType != NULL && |
770 | CWE-000 int all_paths ( int a , int b , Graph * g ) { <S2SV_StartBug> int mass [ b - a + 1 ] ; <S2SV_EndBug> for ( int i = 0 ; i < g -> sity ; i ++ ) { mass [ i ] = 0 ; } <S2SV_StartBug> for ( int i = a - 1 ; i < b ; i ++ ) { <S2SV_EndBug> for ( int j = 0 ; j < g -> sity ; j ++ ) { if ( g -> data [ get_item ( i , j , g ) ] > 0 ) { mass [ j ] ++ ; } } } return mass [ b - 1 ] ; } | <S2SV_ModStart> ) { int index = 0 , mass [ g -> sity ] , z = 0 ; g -> p_path = malloc ( sizeof ( int ) * g -> sity ) ; for ( int i = 0 ; i < g -> sity ; i ++ ) { g -> p_path [ i ] = 0 ; } <S2SV_ModEnd> for ( int <S2SV_ModStart> 0 ; } index = path_in_graph ( index , <S2SV_ModEnd> a - 1 <S2SV_ModStart> a - 1 , b , g , mass , z ) ; return index <S2SV_ModEnd> ; } <S2SV_null> |
771 | CWE-000 void traverse_depth_first ( struct graph * g ) { int * visited , * traverse_arr ; struct stack * s ; int i , j , k ; <S2SV_StartBug> if ( ! g ) <S2SV_EndBug> return ; <S2SV_StartBug> if ( ! g -> adj_matrix ) <S2SV_EndBug> return ; visited = calloc ( g -> size , sizeof ( int ) ) ; if ( ! visited ) <S2SV_StartBug> return ; <S2SV_EndBug> traverse_arr = calloc ( g -> size , sizeof ( int ) ) ; if ( ! traverse_arr ) <S2SV_StartBug> return ; <S2SV_EndBug> s = create_stack ( g -> size ) ; if ( ! s ) <S2SV_StartBug> return ; <S2SV_EndBug> k = 0 ; push ( s , 0 ) ; visited [ 0 ] = 1 ; while ( s -> top > - 1 ) { i = pop ( s ) ; traverse_arr [ k ++ ] = i ; for ( j = 0 ; j < g -> size ; j ++ ) { if ( g -> adj_matrix [ i ] [ j ] ) { if ( s -> top == s -> size ) exit ( EXIT_FAILURE ) ; if ( ! visited [ j ] ) { visited [ j ] = 1 ; push ( s , j ) ; } } } } i = 0 ; while ( i < g -> size ) { printf ( "%d<S2SV_blank>-><S2SV_blank>" , traverse_arr [ i ++ ] ) ; } printf ( "done\\n" ) ; <S2SV_StartBug> } <S2SV_EndBug> | <S2SV_ModStart> ( ! g || ! g -> adj_matrix <S2SV_ModStart> ) return ; <S2SV_ModEnd> visited = calloc <S2SV_ModStart> ! visited ) exit ( EXIT_FAILURE ) <S2SV_ModEnd> ; traverse_arr = <S2SV_ModStart> ! traverse_arr ) exit ( EXIT_FAILURE ) <S2SV_ModEnd> ; s = <S2SV_ModStart> ! s ) exit ( EXIT_FAILURE ) <S2SV_ModEnd> ; k = <S2SV_ModStart> "done\\n" ) ; destroy_stack ( s ) ; free ( visited ) ; free ( traverse_arr ) ; |
772 | CWE-000 void edac_mc_reset_delay_period ( int value ) { struct mem_ctl_info * mci ; <S2SV_StartBug> struct list_head * item ; <S2SV_EndBug> mutex_lock ( & mem_ctls_mutex ) ; list_for_each ( item , & mc_devices ) { mci = list_entry ( item , struct mem_ctl_info , link ) ; if ( mci -> op_state == OP_RUNNING_POLL ) cancel_delayed_work ( & mci -> work ) ; } mutex_unlock ( & mem_ctls_mutex ) ; mutex_lock ( & mem_ctls_mutex ) ; list_for_each ( item , & mc_devices ) { mci = list_entry ( item , struct mem_ctl_info , link ) ; edac_mc_workq_setup ( mci , ( unsigned long ) value ) ; } mutex_unlock ( & mem_ctls_mutex ) ; } | <S2SV_ModStart> list_head * item <S2SV_ModEnd> ; mutex_lock ( |
773 | CWE-000 bool mlx5e_poll_xdpsq_cq ( struct mlx5e_cq * cq ) { struct mlx5e_xdpsq * sq ; struct mlx5_cqe64 * cqe ; struct mlx5e_rq * rq ; u16 sqcc ; int i ; sq = container_of ( cq , struct mlx5e_xdpsq , cq ) ; if ( unlikely ( ! test_bit ( MLX5E_SQ_STATE_ENABLED , & sq -> state ) ) ) return false ; cqe = mlx5_cqwq_get_cqe ( & cq -> wq ) ; if ( ! cqe ) return false ; rq = container_of ( sq , struct mlx5e_rq , xdpsq ) ; sqcc = sq -> cc ; i = 0 ; do { u16 wqe_counter ; bool last_wqe ; mlx5_cqwq_pop ( & cq -> wq ) ; wqe_counter = be16_to_cpu ( cqe -> wqe_counter ) ; do { struct mlx5e_dma_info * di ; u16 ci ; last_wqe = ( sqcc == wqe_counter ) ; ci = mlx5_wq_cyc_ctr2ix ( & sq -> wq , sqcc ) ; di = & sq -> db . di [ ci ] ; sqcc ++ ; mlx5e_page_release ( rq , di , true ) ; } while ( ! last_wqe ) ; } while ( ( ++ i < MLX5E_TX_CQ_POLL_BUDGET ) && ( cqe = mlx5_cqwq_get_cqe ( & cq -> wq ) ) ) ; <S2SV_StartBug> mlx5_cqwq_update_db_record ( & cq -> wq ) ; <S2SV_EndBug> wmb ( ) ; sq -> cc = sqcc ; return ( i == MLX5E_TX_CQ_POLL_BUDGET ) ; } | <S2SV_ModStart> ) ) ; rq -> stats -> xdp_tx_cqe += i ; |
774 | CWE-000 static int macvlan_init ( struct net_device * dev ) { struct macvlan_dev * vlan = netdev_priv ( dev ) ; const struct net_device * lowerdev = vlan -> lowerdev ; struct macvlan_port * port = vlan -> port ; dev -> state = ( dev -> state & ~ MACVLAN_STATE_MASK ) | ( lowerdev -> state & MACVLAN_STATE_MASK ) ; dev -> features = lowerdev -> features & MACVLAN_FEATURES ; dev -> features |= ALWAYS_ON_FEATURES ; dev -> hw_features |= NETIF_F_LRO ; dev -> vlan_features = lowerdev -> vlan_features & MACVLAN_FEATURES ; <S2SV_StartBug> dev -> gso_max_size = lowerdev -> gso_max_size ; <S2SV_EndBug> dev -> gso_max_segs = lowerdev -> gso_max_segs ; dev -> hard_header_len = lowerdev -> hard_header_len ; macvlan_set_lockdep_class ( dev ) ; vlan -> pcpu_stats = netdev_alloc_pcpu_stats ( struct vlan_pcpu_stats ) ; if ( ! vlan -> pcpu_stats ) return - ENOMEM ; port -> count += 1 ; return 0 ; } | <S2SV_ModStart> ; dev -> vlan_features |= ALWAYS_ON_OFFLOADS ; dev -> |
775 | CWE-000 static void _alert_if_need_saving ( void ( * done ) ( void * data ) , Ecrire_Doc * doc ) { <S2SV_StartBug> if ( ( ! _ent_cfg -> menu && ! elm_object_item_disabled_get ( doc -> mm_save ) ) || <S2SV_EndBug> ( ! _ent_cfg -> toolbar && ! elm_object_item_disabled_get ( doc -> save_item ) ) ) ui_alert_need_saving ( doc -> widget , done , doc ) ; else done ( doc ) ; } | <S2SV_ModStart> { if ( doc -> changed <S2SV_ModEnd> ) ui_alert_need_saving ( |
776 | CWE-000 <S2SV_StartBug> void kruskal ( int ancestor [ ] , edge edgelist [ ] , edge spanning_list [ ] ) <S2SV_EndBug> { int i ; <S2SV_StartBug> int ancestor_u , ancestor_v ; <S2SV_EndBug> int spanning_edge_count = 0 ; for ( i = 0 ; i < edge_count ; ++ i ) { if ( ancestor [ edgelist [ i ] . u ] != ancestor [ edgelist [ i ] . v ] ) { <S2SV_StartBug> union_group ( ancestor , edgelist [ i ] . u , edgelist [ i ] . v ) ; <S2SV_EndBug> spanning_list [ spanning_edge_count ++ ] = edgelist [ i ] ; } } } | <S2SV_ModStart> ( int ancestor [ ] , int subset <S2SV_ModStart> ancestor_u , ancestor_v <S2SV_ModEnd> ; for ( <S2SV_ModStart> ] ) { union_sets ( ancestor , spanning_list <S2SV_ModEnd> , edgelist [ <S2SV_ModStart> [ i ] <S2SV_ModEnd> ) ; spanning_list |
777 | CWE-000 int main ( int argc , char * argv [ ] ) { initial_gd = atoi ( argv [ 1 ] ) ; bucket_size = atoi ( argv [ 2 ] ) ; delete_type = atoi ( argv [ 3 ] ) ; dir * d = create_directory ( initial_gd ) ; int val ; char first = fgetc ( stdin ) ; while ( 1 ) { switch ( first ) { case 'i' : scanf ( "nsert<S2SV_blank>%d\\n" , & val ) ; int add = insert ( d , val ) ; printf ( "Inserted<S2SV_blank>%d<S2SV_blank>into<S2SV_blank>bucket<S2SV_blank>%d\\n" , val , add ) ; break ; case 's' : first = getchar ( ) ; if ( first == 'e' ) { scanf ( "arch<S2SV_blank>%d\\n" , & val ) ; int found = search ( d , val ) ; if ( found == - 1 ) printf ( "%d<S2SV_blank>not<S2SV_blank>found<S2SV_blank>.\\n" , val ) ; else printf ( "%d<S2SV_blank>found<S2SV_blank>in<S2SV_blank>bucket<S2SV_blank>%d<S2SV_blank>.\\n" , val , found ) ; } else { scanf ( "atus\\n" ) ; status ( d ) ; } break ; case 'd' : scanf ( "elete<S2SV_blank>%d" , & val ) ; int found = delete ( d , val ) ; if ( found == - 1 ) printf ( "%d<S2SV_blank>not<S2SV_blank>found<S2SV_blank>.\\n" , val ) ; else printf ( "%d<S2SV_blank>deleted<S2SV_blank>from<S2SV_blank>bucket<S2SV_blank>%d<S2SV_blank>.\\n" , val , found ) ; break ; <S2SV_StartBug> case EOF : <S2SV_EndBug> exit ( 0 ) ; } first = fgetc ( stdin ) ; } return 0 ; } | <S2SV_ModStart> break ; case 'm' : scanf ( "apping" ) ; wbptw ( d ) ; break ; case |
778 | CWE-000 int ulfius_set_stream_response ( struct _u_response * response , const uint status , ssize_t ( * stream_callback ) ( void * stream_user_data , uint64_t offset , char * out_buf , size_t max ) , void ( * stream_callback_free ) ( void * stream_user_data ) , <S2SV_StartBug> size_t stream_size , <S2SV_EndBug> unsigned int stream_block_size , void * stream_user_data ) { if ( response != NULL && stream_callback != NULL ) { o_free ( response -> binary_body ) ; response -> binary_body = NULL ; response -> binary_body_length = 0 ; response -> status = status ; response -> stream_callback = stream_callback ; response -> stream_callback_free = stream_callback_free ; response -> stream_size = stream_size ; response -> stream_block_size = stream_block_size ; response -> stream_user_data = stream_user_data ; return U_OK ; } else { return U_ERROR_PARAMS ; } } | <S2SV_ModStart> stream_user_data ) , uint64_t stream_size , size_t <S2SV_ModEnd> stream_block_size , void |
779 | CWE-000 int find_available_port ( Entry * list , L4Key * key ) { Entry * old ; int requested = 1 ; if ( key -> port == 0 ) { requested = 0 ; key -> port = get_next_port ( ) ; } int start_port = key -> port ; while ( 1 ) { HASH_FIND ( hh , list , key , sizeof ( L4Key ) , old ) ; if ( old ) { if ( requested ) { zlog_error ( zc , "requested<S2SV_blank>port<S2SV_blank>number<S2SV_blank>%d<S2SV_blank>not<S2SV_blank>available" , key -> port ) ; return - 1 ; } zlog_debug ( zc , "port<S2SV_blank>%d<S2SV_blank>already<S2SV_blank>taken,<S2SV_blank>find<S2SV_blank>unused<S2SV_blank>port" , key -> port ) ; key -> port = get_next_port ( ) ; if ( key -> port == start_port ) { zlog_error ( zc , "no<S2SV_blank>available<S2SV_blank>ports" ) ; return - 1 ; } } else { <S2SV_StartBug> break ; <S2SV_EndBug> } } return 0 ; } | <S2SV_ModStart> } else { zlog_info ( zc , "assigned<S2SV_blank>port<S2SV_blank>%d" , key -> port ) ; |
780 | CWE-000 static void create_SDP ( sout_stream_t * p_stream , sout_access_out_t * p_access ) { sout_stream_sys_t * p_sys = p_stream -> p_sys ; static const struct addrinfo hints = { . ai_family = AF_UNSPEC , . ai_socktype = SOCK_DGRAM , . ai_protocol = 0 , . ai_flags = AI_NUMERICHOST | AI_NUMERICSERV | AI_IDN , } ; char * shost = var_GetNonEmptyString ( p_access , "src-addr" ) ; char * dhost = var_GetNonEmptyString ( p_access , "dst-addr" ) ; int sport = var_GetInteger ( p_access , "src-port" ) ; int dport = var_GetInteger ( p_access , "dst-port" ) ; struct sockaddr_storage src , dst ; socklen_t srclen = 0 , dstlen = 0 ; struct addrinfo * res ; if ( ! vlc_getaddrinfo ( dhost , dport , & hints , & res ) ) { memcpy ( & dst , res -> ai_addr , dstlen = res -> ai_addrlen ) ; freeaddrinfo ( res ) ; } if ( ! vlc_getaddrinfo ( shost , sport , & hints , & res ) ) { memcpy ( & src , res -> ai_addr , srclen = res -> ai_addrlen ) ; freeaddrinfo ( res ) ; } struct vlc_memstream sdp ; if ( vlc_sdp_Start ( & sdp , VLC_OBJECT ( p_stream ) , SOUT_CFG_PREFIX , ( struct sockaddr * ) & src , srclen , ( struct sockaddr * ) & dst , dstlen ) == 0 ) { vlc_memstream_printf ( & sdp , "m=video<S2SV_blank>%d<S2SV_blank>udp<S2SV_blank>mpeg\\r\\n" , dport ) ; <S2SV_StartBug> if ( vlc_memstream_close ( & sdp ) ) <S2SV_EndBug> { msg_Dbg ( p_stream , "Generated<S2SV_blank>SDP:\\n%s" , sdp . ptr ) ; p_sys -> p_session = sout_AnnounceRegisterSDP ( p_stream , sdp . ptr , dhost ) ; free ( sdp . ptr ) ; } } free ( shost ) ; free ( dhost ) ; } | <S2SV_ModStart> & sdp ) == 0 |
781 | CWE-000 static inline INT tf2boundstates ( const UINT D , COMPLEX const * const q , const UINT deg , COMPLEX * const transfer_matrix , REAL const * const T , const REAL eps_t , UINT * const K_ptr , COMPLEX * const bound_states , fnft_nsev_opts_t * const opts ) { REAL map_coeff ; UINT i , K ; REAL bounding_box [ 4 ] = { NAN } ; COMPLEX * buffer = NULL ; INT ret_code = SUCCESS ; map_coeff = nse_discretization_mapping_coeff ( opts -> discretization ) ; if ( map_coeff == NAN ) return E_INVALID_ARGUMENT ( opts -> discretization ) ; switch ( opts -> bound_state_localization ) { case nsev_bsloc_NEWTON : K = * K_ptr ; buffer = bound_states ; ret_code = refine_roots_newton ( D , q , T , K , buffer , nse_discretization_BO , opts -> niter ) ; CHECK_RETCODE ( ret_code , leave_fun ) ; break ; case nsev_bsloc_FAST_EIGENVALUE : K = deg ; <S2SV_StartBug> if ( * K_ptr <= K ) { <S2SV_EndBug> buffer = bound_states ; } else { buffer = transfer_matrix + ( deg + 1 ) ; } ret_code = poly_roots_fasteigen ( deg , transfer_matrix , buffer ) ; CHECK_RETCODE ( ret_code , leave_fun ) ; for ( i = 0 ; i < K ; i ++ ) buffer [ i ] = CLOG ( buffer [ i ] ) / ( map_coeff * I * eps_t ) ; break ; default : return E_INVALID_ARGUMENT ( opts -> bound_state_localization ) ; } if ( opts -> bound_state_filtering != nsev_bsfilt_NONE ) { bounding_box [ 0 ] = - INFINITY ; bounding_box [ 1 ] = INFINITY ; bounding_box [ 2 ] = 0.0 ; bounding_box [ 3 ] = INFINITY ; ret_code = misc_filter ( & K , buffer , NULL , bounding_box ) ; CHECK_RETCODE ( ret_code , leave_fun ) ; ret_code = misc_merge ( & K , buffer , SQRT ( EPSILON ) ) ; CHECK_RETCODE ( ret_code , leave_fun ) ; } if ( opts -> bound_state_filtering == nsev_bsfilt_FULL ) { bounding_box [ 1 ] = re_bound ( eps_t , map_coeff ) ; bounding_box [ 0 ] = - bounding_box [ 1 ] ; bounding_box [ 3 ] = im_bound ( D , q , T ) ; bounding_box [ 2 ] = 0 ; ret_code = misc_filter ( & K , buffer , NULL , bounding_box ) ; CHECK_RETCODE ( ret_code , leave_fun ) ; } if ( buffer != bound_states ) { if ( * K_ptr < K ) { WARN ( "Found<S2SV_blank>more<S2SV_blank>than<S2SV_blank>*K_ptr<S2SV_blank>bound<S2SV_blank>states.<S2SV_blank>Returning<S2SV_blank>as<S2SV_blank>many<S2SV_blank>as<S2SV_blank>possible." ) ; K = * K_ptr ; } memcpy ( bound_states , buffer , K * sizeof ( COMPLEX ) ) ; } * K_ptr = K ; leave_fun : return ret_code ; } | <S2SV_ModStart> ( * K_ptr >= <S2SV_ModEnd> K ) { |
782 | CWE-000 void apply_precision ( char * * s , t_str p ) { int end ; int len ; char * zeros ; char * tmp ; end = 0 ; len = p . fl . prec - ft_strlen ( * s ) ; <S2SV_StartBug> if ( ! ft_strcmp ( "%" , * s ) ) { <S2SV_EndBug> return ; } if ( len > 0 && ft_strlen ( * s ) > 0 && ( p . ch != 's' && p . ch != 'c' ) ) { zeros = ft_strnew ( len ) ; tmp = zeros ; while ( len -- > 0 ) tmp [ len ] = '0' ; * s = ft_strjoin ( tmp , * s ) ; ft_strdel ( & zeros ) ; } else if ( p . fl . prec > 0 && p . ch == 's' && ft_strlen ( * s ) > 0 ) { end = p . fl . prec > ( int ) ft_strlen ( * s ) ? ft_strlen ( * s ) : p . fl . prec ; * s = ft_strsub ( * s , 0 , end ) ; } <S2SV_StartBug> else if ( p . fl . prec == 0 && ( p . ch == 'x' || p . ch == 'o' || p . ch == 'd' || p . ch == 'i' || p . ch == 'u' ) && p . fl . dot == 1 && ft_strcmp ( "0" , * s ) == 0 ) <S2SV_EndBug> * s = ft_strnew ( 0 ) ; } | <S2SV_ModStart> s ) ) return ; <S2SV_ModEnd> if ( len <S2SV_ModStart> 0 && ( ft_strchr ( "xodiu" , p . ch ) ) && <S2SV_ModEnd> p . fl |
783 | CWE-000 void mod_register ( struct module * mod ) { <S2SV_StartBug> register_mod_fields ( mod , "--swift_swapdir" , swift_usage , swift_swapdir_info , 6 , read_swift_swapdir_stats , set_swift_swapdir_record ) ; <S2SV_EndBug> } | <S2SV_ModStart> , swift_swapdir_info , 12 <S2SV_ModEnd> , read_swift_swapdir_stats , |
784 | CWE-000 int openFile ( Game * game , char * fileName ) { int i , j , m , n ; char data [ 2 ] ; FILE * fp = fopen ( fileName , "r" ) ; if ( fp == NULL ) { printf ( "Error:<S2SV_blank>File<S2SV_blank>doesn\'t<S2SV_blank>exist<S2SV_blank>or<S2SV_blank>cannot<S2SV_blank>be<S2SV_blank>opened\\n" ) ; return 0 ; } fscanf ( fp , "%d" , & m ) ; fscanf ( fp , "%d" , & n ) ; game -> colsInBlock = n ; game -> rowsInBlock = m ; game -> size = m * n ; game -> board = ( Cell * * ) malloc ( game -> size * sizeof ( Cell * ) ) ; if ( game -> board == NULL ) { return memoryError ( ) ; } for ( i = 0 ; i < game -> size ; i ++ ) { game -> board [ i ] = ( Cell * ) malloc ( game -> size * sizeof ( Cell ) ) ; if ( game -> board [ i ] == NULL ) { return memoryError ( ) ; } } game -> solved = ( Cell * * ) malloc ( game -> size * sizeof ( Cell * ) ) ; if ( game -> solved == NULL ) { return memoryError ( ) ; } for ( i = 0 ; i < game -> size ; i ++ ) { game -> solved [ i ] = ( Cell * ) malloc ( game -> size * sizeof ( Cell ) ) ; if ( game -> solved [ i ] == NULL ) { return memoryError ( ) ; } } for ( i = 0 ; i < game -> size ; i ++ ) { for ( j = 0 ; j < game -> size ; j ++ ) { <S2SV_StartBug> fsacnf ( fp , "%s" , data ) ; <S2SV_EndBug> setData ( game , data , i , j ) ; } } if ( fclose ( fp ) == EOF ) { return fileError ( ) ; } return 1 ; } | <S2SV_ModStart> ++ ) { fscanf <S2SV_ModEnd> ( fp , |
785 | CWE-000 pobj_t new_seq_one_element ( pobj_t ob ) { pobj_t obj ; pseq_t s ; pelement_t ele ; ele = ( pelement_t ) malloc ( sizeof ( element_t ) ) ; ele -> p = new_obj ( ob ) ; ele -> prev = NULL ; ele -> next = NULL ; s = ( pseq_t ) malloc ( sizeof ( seq_t ) ) ; s -> length = 1 ; <S2SV_StartBug> s -> position = 0 ; <S2SV_EndBug> s -> first = ele ; s -> last = ele ; <S2SV_StartBug> s -> ptr = NULL ; <S2SV_EndBug> obj = allocate_obj ( s , SEQ ) ; return obj ; } | <S2SV_ModStart> -> position = 1 <S2SV_ModEnd> ; s -> <S2SV_ModStart> -> ptr = ele <S2SV_ModEnd> ; obj = |
786 | CWE-000 void * sim_irk_integrator_assign_memory ( sim_dims * dims , void * args_ , void * raw_memory ) { sim_irk_integrator_args * args = ( sim_irk_integrator_args * ) args_ ; sim_irk_integrator_memory * mem ; char * c_ptr = ( char * ) raw_memory ; mem = ( sim_irk_integrator_memory * ) c_ptr ; c_ptr += sizeof ( sim_irk_integrator_memory ) ; mem -> impl_res_mem = args -> submodules . impl_res -> assign_memory ( & sim_irk_impl_res_dims , args -> impl_res_args , c_ptr ) ; c_ptr += args -> submodules . impl_res -> calculate_memory_size ( & sim_irk_impl_res_dims , args -> impl_res_args ) ; mem -> impl_jac_mem = args -> submodules . impl_jac -> assign_memory ( & sim_irk_impl_jac_dims , args -> impl_jac_args , c_ptr ) ; c_ptr += args -> submodules . impl_jac -> calculate_memory_size ( & sim_irk_impl_jac_dims , args -> impl_jac_args ) ; align_char_to ( 8 , & c_ptr ) ; <S2SV_StartBug> assert ( ( size_t ) c_ptr % 8 == 0 && "memory<S2SV_blank>not<S2SV_blank>8-byte<S2SV_blank>aligned!" ) ; <S2SV_EndBug> assert ( ( char * ) raw_memory + sim_irk_integrator_calculate_memory_size ( dims , args_ ) >= c_ptr ) ; return ( void * ) mem ; } | <S2SV_ModStart> assert ( ( <S2SV_ModEnd> char * ) |
787 | CWE-000 le_result_t le_info_GetRfDeviceStatus ( uint16_t * manufacturedIdPtr , size_t * manufacturedIdNumElementsPtr , uint8_t * productIdPtr , size_t * productIdNumElementsPtr , bool * statusPtr , size_t * statusNumElementsPtr ) { if ( ( manufacturedIdPtr == NULL ) || ( manufacturedIdNumElementsPtr == NULL ) || ( productIdPtr == NULL ) || ( productIdNumElementsPtr == NULL ) || ( statusPtr == NULL ) || ( statusNumElementsPtr == NULL ) ) { <S2SV_StartBug> LE_KILL_CLIENT ( "NULL<S2SV_blank>pointer!" ) ; <S2SV_EndBug> <S2SV_StartBug> return LE_FAULT ; <S2SV_EndBug> } if ( ( * manufacturedIdNumElementsPtr < LE_INFO_RF_DEVICES_STATUS_MAX ) || ( * productIdNumElementsPtr < LE_INFO_RF_DEVICES_STATUS_MAX ) || ( * statusNumElementsPtr < LE_INFO_RF_DEVICES_STATUS_MAX ) ) { LE_ERROR ( "Buffer<S2SV_blank>size<S2SV_blank>overflow<S2SV_blank>!!" ) ; return LE_OVERFLOW ; } return pa_info_GetRfDeviceStatus ( manufacturedIdPtr , manufacturedIdNumElementsPtr , productIdPtr , productIdNumElementsPtr , statusPtr , statusNumElementsPtr ) ; } | <S2SV_ModStart> { LE_KILL_CLIENT ( "NULL<S2SV_blank>pointers!" <S2SV_ModEnd> ) ; return <S2SV_ModStart> ) ; return LE_BAD_PARAMETER <S2SV_ModEnd> ; } if |
788 | CWE-000 void csw_free_headers ( csw_header_t * * headers ) { free ( ( * headers ) -> rbuf ) ; <S2SV_StartBug> free ( * headers ) ; <S2SV_EndBug> * headers = NULL ; } | <S2SV_ModStart> rbuf ) ; ( * headers ) -> rbuf = NULL ; |
789 | CWE-000 int32_t changelog_unlink ( call_frame_t * frame , xlator_t * this , loc_t * loc , int xflags , dict_t * xdata ) { size_t xtra_len = 0 ; changelog_priv_t * priv = NULL ; changelog_opt_t * co = NULL ; call_stub_t * stub = NULL ; struct list_head queue = { 0 , } ; gf_boolean_t barrier_enabled = _gf_false ; dht_changelog_rename_info_t * info = NULL ; int ret = 0 ; <S2SV_StartBug> char old_name [ NAME_MAX ] = { 0 } ; <S2SV_EndBug> char new_name [ NAME_MAX ] = { 0 } ; char * nname = NULL ; INIT_LIST_HEAD ( & queue ) ; priv = this -> private ; CHANGELOG_NOT_ACTIVE_THEN_GOTO ( frame , priv , wind ) ; ret = dict_get_bin ( xdata , DHT_CHANGELOG_RENAME_OP_KEY , ( void * * ) & info ) ; <S2SV_StartBug> if ( ! ret ) { <S2SV_EndBug> CHANGELOG_INIT_NOCHECK ( this , frame -> local , NULL , loc -> inode -> gfid , 3 ) ; co = changelog_get_usable_buffer ( frame -> local ) ; if ( ! co ) goto wind ; CHANGLOG_FILL_FOP_NUMBER ( co , GF_FOP_RENAME , fop_fn , xtra_len ) ; co ++ ; strncpy ( old_name , info -> buffer , info -> oldname_len ) ; CHANGELOG_FILL_ENTRY ( co , info -> old_pargfid , old_name , entry_fn , entry_free_fn , xtra_len , wind ) ; co ++ ; nname = info -> buffer + info -> oldname_len ; strncpy ( new_name , nname , info -> newname_len ) ; CHANGELOG_FILL_ENTRY ( co , info -> new_pargfid , new_name , entry_fn , entry_free_fn , xtra_len , wind ) ; changelog_set_usable_record_and_length ( frame -> local , xtra_len , 3 ) ; } else { CHANGELOG_IF_INTERNAL_FOP_THEN_GOTO ( frame , xdata , wind ) ; CHANGELOG_INIT_NOCHECK ( this , frame -> local , NULL , loc -> inode -> gfid , 2 ) ; co = changelog_get_usable_buffer ( frame -> local ) ; if ( ! co ) goto wind ; CHANGLOG_FILL_FOP_NUMBER ( co , frame -> root -> op , fop_fn , xtra_len ) ; co ++ ; if ( priv -> capture_del_path ) { CHANGELOG_FILL_ENTRY_DIR_PATH ( co , loc -> pargfid , loc -> name , del_entry_fn , del_entry_free_fn , xtra_len , wind , _gf_true ) ; } else { CHANGELOG_FILL_ENTRY_DIR_PATH ( co , loc -> pargfid , loc -> name , del_entry_fn , del_entry_free_fn , xtra_len , wind , _gf_false ) ; } changelog_set_usable_record_and_length ( frame -> local , xtra_len , 2 ) ; } LOCK ( & priv -> lock ) ; { if ( ( barrier_enabled = priv -> barrier_enabled ) ) { stub = fop_unlink_stub ( frame , changelog_unlink_resume , loc , xflags , xdata ) ; if ( ! stub ) __chlog_barrier_disable ( this , & queue ) ; else __chlog_barrier_enqueue ( this , stub ) ; } else { ( ( changelog_local_t * ) frame -> local ) -> color = priv -> current_color ; changelog_inc_fop_cnt ( this , priv , frame -> local ) ; } } UNLOCK ( & priv -> lock ) ; if ( barrier_enabled && stub ) { gf_msg_debug ( this -> name , 0 , "Enqueue<S2SV_blank>unlink" ) ; goto out ; } if ( barrier_enabled && ! stub ) { gf_msg ( this -> name , GF_LOG_ERROR , ENOMEM , CHANGELOG_MSG_NO_MEMORY , "Failed<S2SV_blank>to<S2SV_blank>barrier<S2SV_blank>FOPs,<S2SV_blank>disabling<S2SV_blank>changelog<S2SV_blank>barrier<S2SV_blank>" "FOP:<S2SV_blank>unlink" ) ; chlog_barrier_dequeue_all ( this , & queue ) ; } wind : STACK_WIND ( frame , changelog_unlink_cbk , FIRST_CHILD ( this ) , FIRST_CHILD ( this ) -> fops -> unlink , loc , xflags , xdata ) ; out : return 0 ; } | <S2SV_ModStart> 0 ; char * old_name = NULL ; char * new_name = NULL <S2SV_ModEnd> ; char * <S2SV_ModStart> ret ) { old_name = alloca ( info -> oldname_len ) ; new_name = alloca ( info -> newname_len ) ; |
790 | CWE-000 void * carFrom ( void * info ) { struct Car * thisCar = ( struct Car * ) info ; int direction = thisCar -> direction ; int number = thisCar -> number ; char * dirS ; dirS = NWSE [ direction ] ; pthread_mutex_lock ( & waitQMut [ direction ] ) ; enqueue ( number , waitCarQueue [ direction ] ) ; <S2SV_StartBug> pthread_mutex_unlock ( & waitQMut [ direction ] ) ; <S2SV_EndBug> pthread_mutex_lock ( & waitQMut [ direction ] ) ; while ( front ( waitCarQueue [ direction ] ) != number ) pthread_cond_wait ( & outQueue [ direction ] , & waitQMut [ direction ] ) ; pthread_mutex_lock ( & printLock ) ; printf ( "Car<S2SV_blank>%d<S2SV_blank>from<S2SV_blank>%s<S2SV_blank>arrives<S2SV_blank>at<S2SV_blank>crossing.\\n" , number , dirS ) ; pthread_mutex_unlock ( & printLock ) ; pthread_mutex_unlock ( & waitQMut [ direction ] ) ; pthread_mutex_lock ( & waitQMut [ ( direction + 1 ) % 4 ] ) ; if ( waitCarQueue [ ( direction + 1 ) % 4 ] -> size != 0 ) { pthread_mutex_lock ( & waitingLock [ direction ] ) ; waiting [ direction ] = 1 ; pthread_mutex_unlock ( & waitingLock [ direction ] ) ; pthread_cond_wait ( & first [ direction ] , & waitQMut [ ( direction + 1 ) % 4 ] ) ; pthread_mutex_lock ( & waitingLock [ direction ] ) ; waiting [ direction ] = 0 ; pthread_mutex_unlock ( & waitingLock [ direction ] ) ; } pthread_mutex_unlock ( & waitQMut [ ( direction + 1 ) % 4 ] ) ; pthread_mutex_lock ( & cross ) ; while ( someDudeInCross ) pthread_cond_wait ( & outCross , & cross ) ; someDudeInCross = 1 ; pthread_mutex_lock ( & printLock ) ; printf ( "Car<S2SV_blank>%d<S2SV_blank>from<S2SV_blank>%s<S2SV_blank>leaving<S2SV_blank>crossing.\\n" , number , dirS ) ; pthread_mutex_unlock ( & printLock ) ; pthread_mutex_lock ( & waitQMut [ direction ] ) ; pthread_cond_signal ( & first [ ( direction + 3 ) % 4 ] ) ; pthread_mutex_unlock ( & waitQMut [ direction ] ) ; someDudeInCross = 0 ; pthread_cond_signal ( & outCross ) ; pthread_mutex_unlock ( & cross ) ; pthread_mutex_lock ( & waitQMut [ direction ] ) ; dequeue ( waitCarQueue [ direction ] ) ; <S2SV_StartBug> pthread_cond_signal ( & outQueue [ direction ] ) ; <S2SV_EndBug> pthread_mutex_unlock ( & waitQMut [ direction ] ) ; } | <S2SV_ModStart> ] ) ; <S2SV_ModEnd> while ( front <S2SV_ModStart> ] ) ; pthread_cond_broadcast <S2SV_ModEnd> ( & outQueue |
791 | CWE-000 static uint8_t extract_decimal ( const uint8_t * field , int32_t * whole_result , uint32_t * fractional_result , uint8_t * fractional_digits ) { uint8_t flen ; uint8_t wlen ; uint8_t dlen ; uint8_t decimal_found = 0 ; for ( flen = 0 ; flen < 255 && field [ flen ] != ',' ; flen ++ ) { if ( field [ flen ] == '.' ) { if ( decimal_found ) return 1 ; decimal_found = 1 ; wlen = flen ; } else if ( ! isdigit ( field [ flen ] ) && field [ flen ] != '-' ) { return 2 ; } } if ( flen == 0 ) return 3 ; if ( decimal_found ) { char wbuf [ wlen + 1 ] ; memcpy ( wbuf , field , wlen ) ; wbuf [ wlen ] = '\\0' ; dlen = flen - wlen - 1 ; char dbuf [ dlen + 1 ] ; memcpy ( dbuf , field + wlen + 1 , dlen ) ; dbuf [ dlen ] = '\\0' ; <S2SV_StartBug> * whole_result = atoi ( wbuf ) ; <S2SV_EndBug> <S2SV_StartBug> * fractional_result = atoi ( dbuf ) ; <S2SV_EndBug> * fractional_digits = dlen ; } else { char wbuf [ flen + 1 ] ; memcpy ( wbuf , field , flen ) ; <S2SV_StartBug> * whole_result = atoi ( wbuf ) ; <S2SV_EndBug> * fractional_result = 0 ; * fractional_digits = 0 ; } return 0 ; } | <S2SV_ModStart> * whole_result = atol <S2SV_ModEnd> ( wbuf ) <S2SV_ModStart> * fractional_result = atol <S2SV_ModEnd> ( dbuf ) <S2SV_ModStart> * whole_result = atol <S2SV_ModEnd> ( wbuf ) |
792 | CWE-000 void config_save ( ) { <S2SV_StartBug> config_sets ( "name" , settings . name ) ; <S2SV_EndBug> config_seti ( "xres" , settings . window_width ) ; config_seti ( "yres" , settings . window_height ) ; config_seti ( "windowed" , ! settings . fullscreen ) ; config_seti ( "multisamples" , settings . multisamples ) ; config_seti ( "greedy_meshing" , settings . greedy_meshing ) ; config_seti ( "vsync" , settings . vsync ) ; config_setf ( "mouse_sensitivity" , settings . mouse_sensitivity ) ; config_seti ( "show_news" , settings . show_news ) ; config_seti ( "vol" , settings . volume ) ; <S2SV_StartBug> config_seti ( "show_fps" , settings . show_fps ) ; <S2SV_EndBug> for ( int k = 0 ; k < list_size ( & config_keys ) ; k ++ ) { struct config_key_pair * e = list_get ( & config_keys , k ) ; config_seti ( e -> name , e -> def ) ; } FILE * f = fopen ( "config.ini" , "w" ) ; char last_section [ 32 ] = { 0 } ; for ( int k = 0 ; k < list_size ( & config_file ) ; k ++ ) { struct config_file_entry * e = list_get ( & config_file , k ) ; if ( strcmp ( e -> section , last_section ) != 0 ) { fprintf ( f , "\\r\\n[%s]\\r\\n" , e -> section ) ; strcpy ( last_section , e -> section ) ; } fprintf ( f , "%s" , e -> name ) ; for ( int l = 0 ; l < 31 - strlen ( e -> name ) ; l ++ ) fprintf ( f , "<S2SV_blank>" ) ; fprintf ( f , "=<S2SV_blank>%s\\r\\n" , e -> value ) ; } fclose ( f ) ; } | <S2SV_ModStart> ( ) { kv6_rebuild_complete ( ) ; <S2SV_ModStart> settings . show_fps ) ; config_seti ( "voxlap_models" , settings . voxlap_models |
793 | CWE-000 int main ( int argc , char * * argv ) { <S2SV_StartBug> int sockfd = socket ( AF_INET , SOCK_RAW , IPPROTO_RAW ) ; <S2SV_EndBug> if ( sockfd == - 1 ) { perror ( "[UDP<S2SV_blank>CLIENT]:<S2SV_blank>socket" ) ; goto error ; } <S2SV_StartBug> struct sockaddr_in srv_addr ; <S2SV_EndBug> memset ( & srv_addr , 0 , sizeof ( srv_addr ) ) ; srv_addr . sin_family = AF_INET ; srv_addr . sin_port = htons ( PORT ) ; if ( inet_aton ( SRV_IP , & srv_addr . sin_addr ) == 0 ) { perror ( "[UDP<S2SV_blank>CLIENT]:<S2SV_blank>inet_aton" ) ; goto error ; } char buf [ BUFLEN + sizeof ( struct udphdr ) + sizeof ( struct iphdr ) ] ; memset ( buf , 0 , BUFLEN + sizeof ( struct udphdr ) + sizeof ( struct iphdr ) ) ; struct iphdr ip_header ; memset ( & ip_header , 0 , sizeof ( struct iphdr ) ) ; ip_header . ihl = ( sizeof ( struct iphdr ) / 4 ) ; ip_header . version = 4 ; ip_header . tos = 0 ; ip_header . tot_len = htons ( BUFLEN + sizeof ( struct udphdr ) + sizeof ( struct iphdr ) ) ; ip_header . id = 0 ; ip_header . frag_off = 0 ; ip_header . ttl = 8 ; ip_header . protocol = IPPROTO_UDP ; ip_header . check = 0 ; ip_header . saddr = inet_addr ( "127.0.0.1" ) ; ip_header . daddr = inet_addr ( "127.0.0.1" ) ; memcpy ( buf , & ip_header , sizeof ( struct iphdr ) ) ; struct udphdr udp_header ; memset ( & udp_header , 0 , sizeof ( struct udphdr ) ) ; udp_header . source = htons ( PORT ) ; udp_header . dest = htons ( PORT ) ; udp_header . len = htons ( BUFLEN + sizeof ( struct udphdr ) ) ; udp_header . check = 0 ; memcpy ( buf + sizeof ( struct iphdr ) , & udp_header , sizeof ( struct udphdr ) ) ; sprintf ( buf + sizeof ( struct iphdr ) + sizeof ( struct udphdr ) , "HELLO" ) ; if ( sendto ( sockfd , buf , BUFLEN + sizeof ( struct iphdr ) + sizeof ( struct udphdr ) , 0 , ( struct sockaddr * ) & srv_addr , sizeof ( srv_addr ) ) == - 1 ) { perror ( "[UDP<S2SV_blank>CLIENT]:<S2SV_blank>sendto" ) ; goto error ; } printf ( "[UDP<S2SV_blank>CLIENT]:<S2SV_blank>Sended<S2SV_blank>message<S2SV_blank>\\"%s\\"\\n" , buf + sizeof ( struct iphdr ) + sizeof ( struct udphdr ) ) ; <S2SV_StartBug> exit ( EXIT_SUCCESS ) ; <S2SV_EndBug> socklen_t srv_addr_len = sizeof ( srv_addr ) ; memset ( buf , 0 , BUFLEN + sizeof ( struct udphdr ) + sizeof ( struct iphdr ) ) ; if ( recvfrom ( sockfd , buf , BUFLEN + sizeof ( struct udphdr ) + sizeof ( struct iphdr ) , 0 , ( struct sockaddr * ) & srv_addr , & srv_addr_len ) == - 1 ) { perror ( "[UDP<S2SV_blank>CLIENT]:<S2SV_blank>recvfrom" ) ; goto error ; } printf ( "[UDP<S2SV_blank>CLIENT]:<S2SV_blank>Recieved<S2SV_blank>message<S2SV_blank>\\"%s\\"\\n" , buf + sizeof ( struct udphdr ) + sizeof ( struct iphdr ) ) ; <S2SV_StartBug> exit ( 0 ) ; <S2SV_EndBug> if ( recvfrom ( sockfd , buf , BUFLEN + sizeof ( struct udphdr ) + sizeof ( struct iphdr ) , 0 , ( struct sockaddr * ) & srv_addr , & srv_addr_len ) == - 1 ) { perror ( "[UDP<S2SV_blank>CLIENT]:<S2SV_blank>recvfrom" ) ; goto error ; } printf ( "[UDP<S2SV_blank>CLIENT]:<S2SV_blank>Recieved<S2SV_blank>message<S2SV_blank>\\"%s\\"\\n" , buf + sizeof ( struct udphdr ) + sizeof ( struct iphdr ) ) ; close ( sockfd ) ; exit ( EXIT_SUCCESS ) ; error : close ( sockfd ) ; exit ( EXIT_FAILURE ) ; } | <S2SV_ModStart> , SOCK_RAW , IPPROTO_UDP <S2SV_ModEnd> ) ; if <S2SV_ModStart> error ; } int on = 1 ; setsockopt ( sockfd , IPPROTO_IP , IP_HDRINCL , & on , sizeof ( on ) ) ; <S2SV_ModStart> ) ) ; <S2SV_ModEnd> socklen_t srv_addr_len = <S2SV_ModStart> ) ) ; <S2SV_ModEnd> if ( recvfrom |
794 | CWE-000 int vcpu_queue_exception ( struct vcpu * vcpu , uint32_t vector , uint32_t err_code ) <S2SV_StartBug> { <S2SV_EndBug> if ( vector >= 32U ) { pr_err ( "invalid<S2SV_blank>exception<S2SV_blank>vector<S2SV_blank>%d" , vector ) ; return - EINVAL ; } uint32_t prev_vector = <S2SV_StartBug> vcpu -> arch_vcpu . exception_info . exception ; <S2SV_EndBug> int32_t new_class , prev_class ; prev_class = get_excep_class ( prev_vector ) ; new_class = get_excep_class ( vector ) ; if ( prev_vector == IDT_DF && new_class != EXCEPTION_CLASS_BENIGN ) { vcpu_make_request ( vcpu , ACRN_REQUEST_TRP_FAULT ) ; return 0 ; } else if ( ( prev_class == EXCEPTION_CLASS_CONT && new_class == EXCEPTION_CLASS_CONT ) || ( prev_class == EXCEPTION_CLASS_PF && new_class != EXCEPTION_CLASS_BENIGN ) ) { vector = IDT_DF ; err_code = 0U ; } else { } <S2SV_StartBug> vcpu -> arch_vcpu . exception_info . exception = vector ; <S2SV_EndBug> if ( ( exception_type [ vector ] & EXCEPTION_ERROR_CODE_VALID ) != 0U ) <S2SV_StartBug> vcpu -> arch_vcpu . exception_info . error = err_code ; <S2SV_EndBug> else <S2SV_StartBug> vcpu -> arch_vcpu . exception_info . error = 0 ; <S2SV_EndBug> return 0 ; } | <S2SV_ModStart> err_code ) { struct vcpu_arch * arch_vcpu = & vcpu -> arch_vcpu ; <S2SV_ModStart> uint32_t prev_vector = arch_vcpu -> <S2SV_ModEnd> exception_info . exception <S2SV_ModStart> else { } arch_vcpu -> <S2SV_ModEnd> exception_info . exception <S2SV_ModStart> != 0U ) arch_vcpu -> <S2SV_ModEnd> exception_info . error <S2SV_ModStart> err_code ; else arch_vcpu -> <S2SV_ModEnd> exception_info . error <S2SV_ModStart> . error = 0U <S2SV_ModEnd> ; return 0 |
795 | CWE-000 void wait_for_termination_of_children ( ) { int status ; <S2SV_StartBug> if ( wait ( status ) < 0 ) fail_errno ( "wait" ) ; <S2SV_EndBug> <S2SV_StartBug> if ( ! WIFIEXITED ( & status ) ) fail_errno ( "Process<S2SV_blank>hasn\'t<S2SV_blank>exited<S2SV_blank>normally" ) ; <S2SV_EndBug> fprintf ( stderr , "exit<S2SV_blank>status:<S2SV_blank>%d\\n" , WEXITSTATUS ( status ) ) ; } | <S2SV_ModStart> ( wait ( & <S2SV_ModStart> if ( ! WIFEXITED <S2SV_ModEnd> ( & status |
796 | CWE-000 <S2SV_StartBug> inline void mixHash ( symmetricState * ss , uint8_t * data , size_t data_len ) { <S2SV_EndBug> strobe_operate ( & ( ss -> strobe ) , TYPE_AD , data , data_len , false ) ; } | <S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> static |
797 | CWE-000 float meminfo ( ) { char total [ 10 ] , free [ 10 ] , tmp , t ; FILE * fp = NULL ; int all = 0 , used = 0 , i = 0 ; fp = fopen ( "/proc/meminfo" , "r" ) ; if ( fp == NULL ) <S2SV_StartBug> printf ( "file<S2SV_blank>not<S2SV_blank>exist!" ) ; <S2SV_EndBug> while ( tmp != 10 ) { tmp = fgetc ( fp ) ; if ( tmp >= 48 && tmp <= 57 ) { total [ i ] = tmp ; i ++ ; } } all = atoi ( total ) ; i = ftell ( fp ) ; fseek ( fp , i , 0 ) ; i = 0 ; while ( t != 10 ) { t = fgetc ( fp ) ; if ( ( int ) t >= 48 && ( int ) t <= 57 ) { free [ i ] = t ; i ++ ; } } used = all - atoi ( free ) ; return 100 * used / all ; } | <S2SV_ModStart> ) printf ( "file<S2SV_blank>not<S2SV_blank>exist<S2SV_blank>meminfo!\\n" <S2SV_ModEnd> ) ; while |
798 | CWE-000 uint8 isbc202_get_dn ( void ) { int i ; <S2SV_StartBug> for ( i = 0 ; i <= SBC202_NUM ; i ++ ) <S2SV_EndBug> if ( port >= fdc202 [ i ] . baseport && port <= fdc202 [ i ] . baseport + 7 ) return i ; sim_printf ( "isbc202_get_dn:<S2SV_blank>port<S2SV_blank>%04X<S2SV_blank>not<S2SV_blank>in<S2SV_blank>isbc202<S2SV_blank>device<S2SV_blank>table\\n" , port ) ; return 0xFF ; } | <S2SV_ModStart> 0 ; i < <S2SV_ModEnd> SBC202_NUM ; i |
799 | CWE-000 int __receive_ack ( struct sockaddr_in * server_sockaddr ) { <S2SV_StartBug> log_debug ( "comm" , "Receiving<S2SV_blank>ack" ) ; <S2SV_EndBug> struct comm_packet packet ; if ( __receive_packet ( server_sockaddr , & packet ) != 0 ) { log_error ( "comm" , "Could<S2SV_blank>not<S2SV_blank>receive<S2SV_blank>an<S2SV_blank>ack" ) ; return - 1 ; } if ( packet . type != COMM_PTYPE_ACK ) { log_error ( "comm" , "The<S2SV_blank>received<S2SV_blank>packet<S2SV_blank>is<S2SV_blank>not<S2SV_blank>an<S2SV_blank>ack" ) ; return - 1 ; } return 0 ; } | <S2SV_ModStart> server_sockaddr ) { <S2SV_ModEnd> struct comm_packet packet |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.