Unnamed: 0
int64
0
535k
source
stringlengths
50
89.8k
target
stringlengths
23
37.7k
1,800
CWE-000 static int find_sub_ctxt ( struct hfi1_filedata * fd , const struct hfi1_user_info * uinfo ) { int i ; struct hfi1_devdata * dd = fd -> dd ; u16 subctxt ; for ( i = dd -> first_dyn_alloc_ctxt ; i < dd -> num_rcv_contexts ; i ++ ) { struct hfi1_ctxtdata * uctxt = dd -> rcd [ i ] ; if ( ! uctxt || bitmap_empty ( uctxt -> in_use_ctxts , HFI1_MAX_SHARED_CTXTS ) ) continue ; if ( uctxt -> sc && ( uctxt -> sc -> type == SC_KERNEL ) ) continue ; if ( memcmp ( uctxt -> uuid , uinfo -> uuid , sizeof ( uctxt -> uuid ) ) || uctxt -> jkey != generate_jkey ( current_uid ( ) ) || uctxt -> subctxt_id != uinfo -> subctxt_id || uctxt -> subctxt_cnt != uinfo -> subctxt_cnt ) continue ; if ( uctxt -> userversion != uinfo -> userversion ) return - EINVAL ; subctxt = find_first_zero_bit ( uctxt -> in_use_ctxts , HFI1_MAX_SHARED_CTXTS ) ; if ( subctxt >= uctxt -> subctxt_cnt ) return - EBUSY ; fd -> uctxt = uctxt ; fd -> subctxt = subctxt ; <S2SV_StartBug> __set_bit ( fd -> subctxt , uctxt -> in_use_ctxts ) ; <S2SV_EndBug> return 1 ; } return 0 ; }
<S2SV_ModStart> = subctxt ; hfi1_rcd_get ( uctxt ) ;
1,801
CWE-000 uint8_t bsl_getInfo ( HANDLE ptrPort , uint8_t physInterface , uint8_t uartMode , int * flashsize , uint8_t * vers , uint8_t * family , uint8_t verbose ) { int i ; int lenTx , lenRx , len ; char Tx [ 1000 ] , Rx [ 1000 ] ; if ( ( verbose == INFORM ) || ( verbose == CHATTY ) ) printf ( "<S2SV_blank><S2SV_blank>determine<S2SV_blank>device<S2SV_blank>...<S2SV_blank>" ) ; fflush ( stdout ) ; for ( i = 0 ; i < 1000 ; i ++ ) Rx [ i ] = 0 ; if ( ! ptrPort ) Error ( "in<S2SV_blank>\'bsl_getInfo()\':<S2SV_blank>port<S2SV_blank>not<S2SV_blank>open" ) ; flush_port ( ptrPort ) ; SLEEP ( 50 ) ; if ( physInterface == UART ) { set_timeout ( ptrPort , 200 ) ; } if ( bsl_memCheck ( ptrPort , physInterface , uartMode , 0x004000 , SILENT ) ) { * family = STM8S ; # ifdef DEBUG printf ( "family<S2SV_blank>STM8S\\n" ) ; # endif } else if ( bsl_memCheck ( ptrPort , physInterface , uartMode , 0x00100 , SILENT ) ) { * family = STM8L ; # ifdef DEBUG printf ( "family<S2SV_blank>STM8L\\n" ) ; # endif } else Error ( "in<S2SV_blank>\'bsl_getInfo()\':<S2SV_blank>cannot<S2SV_blank>identify<S2SV_blank>family" ) ; if ( bsl_memCheck ( ptrPort , physInterface , uartMode , 0x047FFF , SILENT ) ) * flashsize = 256 ; else if ( bsl_memCheck ( ptrPort , physInterface , uartMode , 0x027FFF , SILENT ) ) * flashsize = 128 ; else if ( bsl_memCheck ( ptrPort , physInterface , uartMode , 0x00FFFF , SILENT ) ) * flashsize = 32 ; else if ( bsl_memCheck ( ptrPort , physInterface , uartMode , 0x009FFF , SILENT ) ) * flashsize = 8 ; else Error ( "in<S2SV_blank>\'bsl_getInfo()\':<S2SV_blank>cannot<S2SV_blank>identify<S2SV_blank>device" ) ; # ifdef DEBUG printf ( "flash<S2SV_blank>size:<S2SV_blank>%d\\n" , ( int ) ( * flashsize ) ) ; # endif if ( physInterface == UART ) { set_timeout ( ptrPort , TIMEOUT ) ; } lenTx = 2 ; Tx [ 0 ] = GET ; Tx [ 1 ] = ( Tx [ 0 ] ^ 0xFF ) ; lenRx = 9 ; if ( physInterface == UART ) len = send_port ( ptrPort , uartMode , lenTx , Tx ) ; else if ( physInterface == SPI_ARDUINO ) len = send_spi_Arduino ( ptrPort , lenTx , Tx ) ; # if defined ( USE_SPIDEV ) else if ( physInterface == SPI_SPIDEV ) len = send_spi_spidev ( ptrPort , lenTx , Tx ) ; # endif if ( len != lenTx ) Error ( "in<S2SV_blank>\'bsl_getInfo()\':<S2SV_blank>sending<S2SV_blank>command<S2SV_blank>failed<S2SV_blank>(expect<S2SV_blank>%d,<S2SV_blank>sent<S2SV_blank>%d)" , lenTx , len ) ; if ( physInterface == UART ) len = receive_port ( ptrPort , uartMode , lenRx , Rx ) ; else if ( physInterface == SPI_ARDUINO ) len = receive_spi_Arduino ( ptrPort , lenRx , Rx ) ; # if defined ( USE_SPIDEV ) else if ( physInterface == SPI_SPIDEV ) len = receive_spi_spidev ( ptrPort , lenRx , Rx ) ; # endif if ( len != lenRx ) Error ( "in<S2SV_blank>\'bsl_getInfo()\':<S2SV_blank>ACK<S2SV_blank>timeout<S2SV_blank>(expect<S2SV_blank>%d,<S2SV_blank>received<S2SV_blank>%d)" , lenRx , len ) ; if ( Rx [ 0 ] != ACK ) Error ( "in<S2SV_blank>\'bsl_getInfo()\':<S2SV_blank>start<S2SV_blank>ACK<S2SV_blank>failure<S2SV_blank>(read<S2SV_blank>0x%2x)" , Rx [ 0 ] ) ; if ( Rx [ 8 ] != ACK ) Error ( "in<S2SV_blank>\'bsl_getInfo()\':<S2SV_blank>end<S2SV_blank>ACK<S2SV_blank>failure<S2SV_blank>(read<S2SV_blank>0x%2x)" , Rx [ 8 ] ) ; if ( Rx [ 3 ] != GET ) Error ( "in<S2SV_blank>\'bsl_getInfo()\':<S2SV_blank>wrong<S2SV_blank>GET<S2SV_blank>code<S2SV_blank>(expect<S2SV_blank>0x%02x,<S2SV_blank>received<S2SV_blank>0x%02x)" , GET , Rx [ 3 ] ) ; if ( Rx [ 4 ] != READ ) Error ( "in<S2SV_blank>\'bsl_getInfo()\':<S2SV_blank>wrong<S2SV_blank>READ<S2SV_blank>code<S2SV_blank>(expect<S2SV_blank>0x%02x,<S2SV_blank>received<S2SV_blank>0x%02x)" , READ , Rx [ 4 ] ) ; if ( Rx [ 5 ] != GO ) Error ( "in<S2SV_blank>\'bsl_getInfo()\':<S2SV_blank>wrong<S2SV_blank>GO<S2SV_blank>code<S2SV_blank>(expect<S2SV_blank>0x%02x,<S2SV_blank>received<S2SV_blank>0x%02x)" , GO , Rx [ 5 ] ) ; if ( Rx [ 6 ] != WRITE ) Error ( "in<S2SV_blank>\'bsl_getInfo()\':<S2SV_blank>wrong<S2SV_blank>WRITE<S2SV_blank>code<S2SV_blank>(expect<S2SV_blank>0x%02x,<S2SV_blank>received<S2SV_blank>0x%02x)" , WRITE , Rx [ 6 ] ) ; if ( Rx [ 7 ] != ERASE ) Error ( "in<S2SV_blank>\'bsl_getInfo()\':<S2SV_blank>wrong<S2SV_blank>ERASE<S2SV_blank>code<S2SV_blank>(expect<S2SV_blank>0x%02x,<S2SV_blank>received<S2SV_blank>0x%02x)" , ERASE , Rx [ 7 ] ) ; # ifdef DEBUG printf ( "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>version<S2SV_blank>0x%02x\\n" , Rx [ 2 ] ) ; printf ( "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>command<S2SV_blank>codes:\\n" ) ; printf ( "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>GET<S2SV_blank><S2SV_blank><S2SV_blank>0x%02x\\n" , Rx [ 3 ] ) ; printf ( "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>READ<S2SV_blank><S2SV_blank>0x%02x\\n" , Rx [ 4 ] ) ; printf ( "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>GO<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>0x%02x\\n" , Rx [ 5 ] ) ; printf ( "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>WRITE<S2SV_blank>0x%02x\\n" , Rx [ 6 ] ) ; printf ( "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>ERASE<S2SV_blank>0x%02x\\n" , Rx [ 7 ] ) ; fflush ( stdout ) ; # endif * vers = Rx [ 2 ] ; if ( ( verbose == INFORM ) || ( verbose == CHATTY ) ) { if ( * family == STM8S ) <S2SV_StartBug> printf ( "ok<S2SV_blank>(STM8S;<S2SV_blank>%dkB<S2SV_blank>flash;<S2SV_blank>BSL<S2SV_blank>v%x.%x)\\n" , * flashsize , ( ( ( * vers ) & 0xF0 ) >> 4 ) , ( ( * vers ) & 0x0F ) ) ; <S2SV_EndBug> else <S2SV_StartBug> printf ( "ok<S2SV_blank>(STM8L;<S2SV_blank>%dkB<S2SV_blank>flash;<S2SV_blank>BSL<S2SV_blank>v%x.%x)\\n" , * flashsize , ( ( ( * vers ) & 0xF0 ) >> 4 ) , ( ( * vers ) & 0x0F ) ) ; <S2SV_EndBug> } fflush ( stdout ) ; return ( 0 ) ; }
<S2SV_ModStart> ) printf ( "done<S2SV_blank>(STM8S;<S2SV_blank>%dkB<S2SV_blank>flash;<S2SV_blank>BSL<S2SV_blank>v%x.%x)\\n" <S2SV_ModEnd> , * flashsize <S2SV_ModStart> else printf ( "done<S2SV_blank>(STM8L;<S2SV_blank>%dkB<S2SV_blank>flash;<S2SV_blank>BSL<S2SV_blank>v%x.%x)\\n" <S2SV_ModEnd> , * flashsize
1,802
CWE-000 <S2SV_StartBug> void main ( int argc , char * argv [ ] ) <S2SV_EndBug> { <S2SV_StartBug> n = atoi ( argv [ 1 ] ) ; <S2SV_EndBug> int arr [ n ] ; <S2SV_StartBug> for ( int i = 0 ; i < n ; i ++ ) arr [ i ] = atoi ( argv [ i + 2 ] ) ; <S2SV_EndBug> for ( int i = 0 ; i < n ; i ++ ) printf ( "%d<S2SV_blank>" , arr [ i ] ) ; printf ( "\\n" ) ; double start = clock ( ) ; quick ( arr , 0 , n - 1 ) ; double end = clock ( ) ; runtime = ( ( double ) ( end - start ) ) / CLOCKS_PER_SEC ; printf ( "\\n" ) ; <S2SV_StartBug> for ( int i = 0 ; i < n ; i ++ ) printf ( "%d\\n" , arr [ i ] ) ; <S2SV_EndBug> <S2SV_StartBug> printf ( "runtime<S2SV_blank>%f\\n" , runtime ) ; <S2SV_EndBug> <S2SV_StartBug> return ; <S2SV_EndBug> }
<S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> int main ( <S2SV_ModEnd> ) { n <S2SV_ModStart> { n = 10000000 <S2SV_ModEnd> ; int arr <S2SV_ModStart> i ] = rand ( ) % 10000000 <S2SV_ModEnd> ; printf ( <S2SV_ModStart> "\\n" ) ; int wrong = 0 ; <S2SV_ModStart> i < n - 1 <S2SV_ModStart> i ++ ) if ( <S2SV_ModEnd> arr [ i <S2SV_ModStart> [ i ] > arr [ i + 1 ] ) wrong ++ <S2SV_ModEnd> ; printf ( <S2SV_ModStart> ; printf ( "wrongs<S2SV_blank>count<S2SV_blank>:<S2SV_blank>%d<S2SV_blank><S2SV_blank>runtime<S2SV_blank>%f\\n" , wrong <S2SV_ModEnd> , runtime ) <S2SV_ModStart> ) ; return 0
1,803
CWE-000 int garble_load ( garble_circuit * gc , FILE * f , bool table_only , bool wires ) { <S2SV_StartBug> size_t p = 0 ; <S2SV_EndBug> if ( table_only ) { if ( ( gc -> table = malloc ( ( gc -> q - gc -> nxors ) * garble_table_size ( gc ) ) ) == NULL ) goto error ; p += fread ( gc -> table , garble_table_size ( gc ) , gc -> q - gc -> nxors , f ) ; p += fread ( & gc -> fixed_label , sizeof ( block ) , 1 , f ) ; p += fread ( & gc -> global_key , sizeof ( block ) , 1 , f ) ; if ( ( gc -> output_perms = malloc ( sizeof ( bool ) * gc -> m ) ) == NULL ) goto error ; p += fread ( gc -> output_perms , sizeof ( bool ) , gc -> m , f ) ; } else { p += fread ( & gc -> n , sizeof gc -> n , 1 , f ) ; p += fread ( & gc -> m , sizeof gc -> m , 1 , f ) ; p += fread ( & gc -> q , sizeof gc -> q , 1 , f ) ; p += fread ( & gc -> r , sizeof gc -> r , 1 , f ) ; p += fread ( & gc -> r , sizeof gc -> nxors , 1 , f ) ; p += fread ( & gc -> type , sizeof gc -> type , 1 , f ) ; if ( ( gc -> gates = malloc ( sizeof ( garble_gate ) * gc -> q ) ) == NULL ) goto error ; p += fread ( gc -> gates , sizeof ( garble_gate ) , gc -> q , f ) ; if ( ( gc -> table = malloc ( ( gc -> q - gc -> nxors ) * garble_table_size ( gc ) ) ) == NULL ) goto error ; p += fread ( gc -> table , garble_table_size ( gc ) , gc -> q - gc -> nxors , f ) ; if ( wires ) { if ( ( gc -> wires = malloc ( sizeof ( block ) * 2 * gc -> r ) ) == NULL ) goto error ; p += fread ( gc -> wires , sizeof ( block ) , 2 * gc -> r , f ) ; } else { gc -> wires = NULL ; } if ( ( gc -> outputs = malloc ( sizeof ( int ) * gc -> m ) ) == NULL ) goto error ; p += fread ( gc -> outputs , sizeof ( int ) , gc -> m , f ) ; if ( ( gc -> output_perms = malloc ( sizeof ( bool ) * gc -> m ) ) == NULL ) goto error ; p += fread ( gc -> output_perms , sizeof ( bool ) , gc -> m , f ) ; p += fread ( & gc -> fixed_label , sizeof ( block ) , 1 , f ) ; p += fread ( & gc -> global_key , sizeof ( block ) , 1 , f ) ; } return GARBLE_OK ; error : garble_delete ( gc ) ; return GARBLE_ERR ; }
<S2SV_ModStart> p = 0 ; memset ( gc , '\\0' , sizeof ( garble_circuit ) )
1,804
CWE-000 int tty_io_wrapper ( uint32_t tty , uint64_t unused , int type , uint8_t payload ) { if ( type == 1 ) { text_putchar ( payload , tty ) ; return 0 ; <S2SV_StartBug> } else if ( type == 0 ) <S2SV_EndBug> return keyboard_fetch_char ( tty ) ; <S2SV_StartBug> } <S2SV_EndBug>
<S2SV_ModStart> == 0 ) { <S2SV_ModStart> ) ; } }
1,805
CWE-000 glui32 agent_get_output ( char * buf , glui32 len ) { char * dest_buf = NULL ; <S2SV_StartBug> ssize_t sent = - 1 ; <S2SV_EndBug> glui32 net_len = htonl ( str_len ) ; sent = send ( sock_fh , & net_len , 4 , 0 ) ; if ( sent < 0 ) { int err = errno ; gli_strict_warning ( "agent.c:<S2SV_blank>send<S2SV_blank>size" ) ; gli_strict_warning ( strerror ( err ) ) ; goto cleanup ; } sent = send ( sock_fh , cur_buf , str_len , 0 ) ; if ( sent < 0 ) { int err = errno ; gli_strict_warning ( "agent.c:<S2SV_blank>send<S2SV_blank>message" ) ; gli_strict_warning ( strerror ( err ) ) ; goto cleanup ; } bool restart = false ; glui32 net_dest_buf_len ; do { restart = 0 ; ssize_t in_len = recv ( sock_fh , & net_dest_buf_len , sizeof ( glui32 ) , MSG_WAITALL ) ; if ( in_len == - 1 ) { int err = errno ; if ( err == EINTR ) { restart = true ; continue ; } gli_strict_warning ( "agent.c:<S2SV_blank>receive<S2SV_blank>size" ) ; gli_strict_warning ( strerror ( err ) ) ; goto cleanup ; } } while ( restart ) ; <S2SV_StartBug> glui32 dest_buf_len = ntohl ( net_dest_buf_len ) ; <S2SV_EndBug> dest_buf = calloc ( dest_buf_len + 1 , 1 ) ; do { restart = false ; ssize_t in_len = recv ( sock_fh , dest_buf , dest_buf_len , MSG_WAITALL ) ; if ( in_len == - 1 ) { int err = errno ; if ( err == EINTR ) { restart = true ; continue ; } gli_strict_warning ( "agent.c:<S2SV_blank>receive<S2SV_blank>message" ) ; gli_strict_warning ( strerror ( err ) ) ; goto cleanup ; } } while ( restart ) ; if ( dest_buf_len > len ) { dest_buf_len = strlen ( dest_buf ) + 1 ; } if ( dest_buf_len > len ) { char errmsg [ 100 ] ; snprintf ( errmsg , 100 , "agent_get_output:<S2SV_blank>string<S2SV_blank>too<S2SV_blank>large<S2SV_blank>for<S2SV_blank>buffer<S2SV_blank>(%d<S2SV_blank>versus<S2SV_blank>%d)" , dest_buf_len , len ) ; gli_strict_warning ( errmsg ) ; goto cleanup ; } memmove ( buf , dest_buf , dest_buf_len ) ; cleanup : if ( dest_buf != NULL ) { free ( dest_buf ) ; dest_buf = NULL ; } memset ( cur_buf , 0 , str_len ) ; str_len = 0 ; return dest_buf_len ; }
<S2SV_ModStart> = NULL ; glui32 dest_buf_len = 0 ; <S2SV_ModStart> restart ) ; <S2SV_ModEnd> dest_buf_len = ntohl
1,806
CWE-000 static M_CODE lm_worker_sort ( worker_t * w ) { int x , epeek ; ulist_t * list , * peek_list = 0 ; crawler_t * cr ; int match , lookup ; int syn ; uehandle_t * ue_h = w -> ue_h ; filetype_t * ft ; url_t * url ; const char * mime ; char * c ; <S2SV_StartBug> int num_urls ; <S2SV_EndBug> if ( ! ( list = lm_utable_top ( & ue_h -> primary ) ) ) return M_FAILED ; cr = w -> crawler ; epeek = ( lm_crawler_flag_isset ( cr , LM_CRFLAG_EPEEK ) && ! ue_h -> is_peeking ) ? 1 : 0 ; syn = w -> io_h -> io -> synchronous ; <S2SV_StartBug> lookup = 0 ; <S2SV_EndBug> num_urls = list -> sz ; for ( x = 0 ; x < list -> sz ; x ++ ) { url = lm_ulist_row ( list , x ) ; match = 0 ; if ( ( ft = lm_ftindex_match_by_url ( & cr -> ftindex , url ) ) ) { if ( ft == LM_FTINDEX_POSSIBLE_MATCH ) { if ( ! syn ) { if ( lm_multipeek_add ( w -> io_h , url , x ) == M_OK ) { match = 1 ; lookup ++ ; } } else { lm_io_head ( w -> io_h , url ) ; char * mime = w -> io_h -> transfer . headers . content_type ; if ( mime ) { if ( ( c = strchr ( mime , ';' ) ) ) * c = '\\0' ; if ( ( ft = lm_ftindex_match_by_mime ( & cr -> ftindex , mime ) ) && lm_worker_bind_url ( w , url , ft , epeek , & peek_list ) == 0 ) match = 1 ; } } } else if ( lm_worker_bind_url ( w , url , ft , epeek , & peek_list ) == 0 ) match = 1 ; } if ( ! match ) { lm_url_nullify ( url ) ; } } if ( ! lookup ) { goto cleanup ; } ioprivate_t * info ; CURL * h ; # ifdef DEBUG if ( ! syn ) fprintf ( stderr , "*<S2SV_blank>worker:(%p)<S2SV_blank>waiting<S2SV_blank>for<S2SV_blank>%d<S2SV_blank>HTTP<S2SV_blank>HEAD<S2SV_blank>requests...\\n" , w , lookup ) ; # endif while ( ( info = lm_multipeek_wait ( w -> io_h ) ) ) { h = info -> handle ; url = lm_ulist_row ( list , info -> identifier ) ; match = 0 ; curl_easy_getinfo ( h , CURLINFO_CONTENT_TYPE , & mime ) ; if ( mime ) { if ( ( c = strchr ( mime , ';' ) ) ) * c = '\\0' ; if ( ( ft = lm_ftindex_match_by_mime ( & cr -> ftindex , mime ) ) && lm_worker_bind_url ( w , url , ft , epeek , & peek_list ) == 0 ) match = 1 ; } curl_easy_cleanup ( h ) ; if ( ! match ) lm_url_nullify ( url ) ; } cleanup : <S2SV_StartBug> if ( w -> ue_h -> depth_limit ) { <S2SV_EndBug> <S2SV_StartBug> if ( w -> ue_h -> depth_counter >= w -> ue_h -> depth_limit ) { <S2SV_EndBug> for ( x = 0 ; x < list -> sz ; x ++ ) { url = lm_ulist_row ( list , x ) ; if ( ! url -> sz ) { continue ; } ft = w -> m -> filetypes [ url -> bind - 1 ] ; if ( ! FT_FLAG_ISSET ( ft , FT_FLAG_IGNORE_DEPTH ) ) { lm_url_nullify ( url ) ; } } } } x = list -> sz - 1 ; while ( x >= 0 && ! ( lm_ulist_row ( list , x ) -> sz ) ) x -- ; list -> sz = x + 1 ; for ( x = 0 ; x < list -> sz ; ) { if ( ! ( lm_ulist_row ( list , x ) -> sz ) ) { lm_url_swap ( lm_ulist_row ( list , x ) , lm_ulist_top ( list ) ) ; lm_ulist_dec ( list ) ; } else x ++ ; } w -> num_discarded_urls += num_urls - list -> sz ; return M_OK ; }
<S2SV_ModStart> ; int num_urls ; int depth_limit , depth_counter <S2SV_ModStart> lookup = 0 ; depth_limit = ue_h -> depth_limit ; depth_counter = ue_h -> depth_counter <S2SV_ModStart> : if ( <S2SV_ModEnd> depth_limit ) { <S2SV_ModStart> { if ( depth_counter >= <S2SV_ModEnd> depth_limit ) {
1,807
CWE-000 void AccumSpacetimeCorr ( ) { real fac ; int j , nb , nr , n ; for ( nb = 0 ; nb < nCBuffer ; nb ++ ) { if ( tBuf [ nb ] . count == nCTime ) { for ( j = 0 ; j < AVDOF * nCSpatial ; j ++ ) { for ( n = 0 ; n < nCTime ; n ++ ) { avF_qq2 [ j ] [ n ] += tBuf [ nb ] . F_qq2 [ j ] [ n ] ; avF_s_qq2 [ j ] [ n ] += tBuf [ nb ] . F_s_qq2 [ j ] [ n ] ; avF_d_qq2 [ j ] [ n ] += tBuf [ nb ] . F_d_qq2 [ j ] [ n ] ; } } for ( j = 0 ; j < nCTime ; j ++ ) { rrMSDAv [ j ] += tBuf [ nb ] . rrMSD [ j ] ; rrMQDAv [ j ] += tBuf [ nb ] . rrMQD [ j ] ; <S2SV_StartBug> real_tensor_add_r2_r2r2 ( & rrMSR2_VR_Av [ j ] , <S2SV_EndBug> <S2SV_StartBug> & rrMSR2_VR_Av [ j ] , & tBuf [ nb ] . rrMSR2_VR [ j ] ) ; <S2SV_EndBug> for ( nr = 0 ; nr < nCSpatial ; nr ++ ) { avDrTable [ nr ] [ j ] += tBuf [ nb ] . DrTable [ nr ] [ j ] ; } } tBuf [ nb ] . count = 0 ; ++ countCorrAv ; if ( countCorrAv == limitCorrAv ) { PrintSpacetimeCorr ( stdout ) ; } } } }
<S2SV_ModStart> j ] ; real_tensor_increase_r2_r2 <S2SV_ModEnd> ( & rrMSR2_VR_Av <S2SV_ModStart> j ] , <S2SV_ModEnd> & tBuf [
1,808
CWE-000 int __hash_page_4K ( unsigned long ea , unsigned long access , unsigned long vsid , pte_t * ptep , unsigned long trap , unsigned long flags , int ssize , int subpg_prot ) { real_pte_t rpte ; unsigned long hpte_group ; unsigned int subpg_index ; unsigned long rflags , pa ; unsigned long old_pte , new_pte , subpg_pte ; unsigned long vpn , hash , slot , gslot ; unsigned long shift = mmu_psize_defs [ MMU_PAGE_4K ] . shift ; do { pte_t pte = READ_ONCE ( * ptep ) ; old_pte = pte_val ( pte ) ; if ( unlikely ( old_pte & H_PAGE_BUSY ) ) return 0 ; if ( unlikely ( ! check_pte_access ( access , old_pte ) ) ) return 1 ; new_pte = old_pte | H_PAGE_BUSY | _PAGE_ACCESSED | H_PAGE_COMBO ; if ( access & _PAGE_WRITE ) new_pte |= _PAGE_DIRTY ; } while ( ! pte_xchg ( ptep , __pte ( old_pte ) , __pte ( new_pte ) ) ) ; subpg_pte = new_pte & ~ subpg_prot ; rflags = htab_convert_pte_flags ( subpg_pte ) ; if ( cpu_has_feature ( CPU_FTR_NOEXECUTE ) && ! cpu_has_feature ( CPU_FTR_COHERENT_ICACHE ) ) { rflags = hash_page_do_lazy_icache ( rflags , __pte ( old_pte ) , trap ) ; } subpg_index = ( ea & ( PAGE_SIZE - 1 ) ) >> shift ; vpn = hpt_vpn ( ea , vsid , ssize ) ; <S2SV_StartBug> rpte = __real_pte ( __pte ( old_pte ) , ptep ) ; <S2SV_EndBug> if ( ! ( old_pte & H_PAGE_HASHPTE ) ) goto htab_insert_hpte ; if ( ! ( old_pte & H_PAGE_COMBO ) ) { flush_hash_page ( vpn , rpte , MMU_PAGE_64K , ssize , flags ) ; old_pte &= ~ H_PAGE_HASHPTE ; new_pte &= ~ H_PAGE_HASHPTE ; goto htab_insert_hpte ; } if ( __rpte_sub_valid ( rpte , subpg_index ) ) { int ret ; gslot = pte_get_hash_gslot ( vpn , shift , ssize , rpte , subpg_index ) ; ret = mmu_hash_ops . hpte_updatepp ( gslot , rflags , vpn , MMU_PAGE_4K , MMU_PAGE_4K , ssize , flags ) ; if ( ret == - 1 ) goto htab_insert_hpte ; * ptep = __pte ( new_pte & ~ H_PAGE_BUSY ) ; return 0 ; } htab_insert_hpte : if ( ! ( old_pte & H_PAGE_COMBO ) ) rpte . hidx = INVALID_RPTE_HIDX ; if ( old_pte & H_PAGE_4K_PFN ) { pa = pte_pfn ( __pte ( old_pte ) ) << HW_PAGE_SHIFT ; } else { pa = pte_pfn ( __pte ( old_pte ) ) << PAGE_SHIFT ; pa += ( subpg_index << shift ) ; } hash = hpt_hash ( vpn , shift , ssize ) ; repeat : hpte_group = ( ( hash & htab_hash_mask ) * HPTES_PER_GROUP ) & ~ 0x7UL ; slot = mmu_hash_ops . hpte_insert ( hpte_group , vpn , pa , rflags , 0 , MMU_PAGE_4K , MMU_PAGE_4K , ssize ) ; if ( unlikely ( slot == - 1 ) ) { bool soft_invalid ; hpte_group = ( ( ~ hash & htab_hash_mask ) * HPTES_PER_GROUP ) & ~ 0x7UL ; slot = mmu_hash_ops . hpte_insert ( hpte_group , vpn , pa , rflags , HPTE_V_SECONDARY , MMU_PAGE_4K , MMU_PAGE_4K , ssize ) ; soft_invalid = hpte_soft_invalid ( slot ) ; if ( unlikely ( soft_invalid ) ) { gslot = slot & _PTEIDX_GROUP_IX ; mmu_hash_ops . hpte_invalidate ( hpte_group + gslot , vpn , MMU_PAGE_4K , MMU_PAGE_4K , ssize , 0 ) ; } if ( unlikely ( slot == - 1 || soft_invalid ) ) { if ( soft_invalid || ( mftb ( ) & 0x1 ) ) hpte_group = ( ( hash & htab_hash_mask ) * HPTES_PER_GROUP ) & ~ 0x7UL ; mmu_hash_ops . hpte_remove ( hpte_group ) ; goto repeat ; } } if ( unlikely ( slot == - 2 ) ) { * ptep = __pte ( old_pte ) ; hash_failure_debug ( ea , access , vsid , trap , ssize , MMU_PAGE_4K , MMU_PAGE_4K , old_pte ) ; return - 1 ; } <S2SV_StartBug> new_pte |= pte_set_hidx ( ptep , rpte , subpg_index , slot ) ; <S2SV_EndBug> new_pte |= H_PAGE_HASHPTE ; * ptep = __pte ( new_pte & ~ H_PAGE_BUSY ) ; return 0 ; }
<S2SV_ModStart> ) , ptep , PTRS_PER_PTE <S2SV_ModStart> subpg_index , slot , PTRS_PER_PTE
1,809
CWE-000 static int ext2_generate ( struct image * image ) { int ret ; const char * extraargs = cfg_getstr ( image -> imagesec , "extraargs" ) ; const char * features = cfg_getstr ( image -> imagesec , "features" ) ; const char * label = cfg_getstr ( image -> imagesec , "label" ) ; const char * fs_timestamp = cfg_getstr ( image -> imagesec , "fs-timestamp" ) ; ret = systemp ( image , "%s<S2SV_blank>-d<S2SV_blank>%s<S2SV_blank>--size-in-blocks=%lld<S2SV_blank>-i<S2SV_blank>16384<S2SV_blank>%s<S2SV_blank>%s" , get_opt ( "genext2fs" ) , mountpath ( image ) , image -> size / 1024 , imageoutfile ( image ) , extraargs ) ; if ( ret ) return ret ; if ( features && features [ 0 ] != '\\0' ) { ret = systemp ( image , "%s<S2SV_blank>-O<S2SV_blank>\\"%s\\"<S2SV_blank>%s" , get_opt ( "tune2fs" ) , features , imageoutfile ( image ) ) ; if ( ret ) return ret ; } if ( label && label [ 0 ] != '\\0' ) { ret = systemp ( image , "%s<S2SV_blank>-L<S2SV_blank>\\"%s\\"<S2SV_blank>%s" , get_opt ( "tune2fs" ) , label , imageoutfile ( image ) ) ; if ( ret ) return ret ; } ret = systemp ( image , "%s<S2SV_blank>-pvfD<S2SV_blank>%s" , get_opt ( "e2fsck" ) , imageoutfile ( image ) ) ; if ( ret > 2 ) return ret ; if ( fs_timestamp ) { ret = systemp ( image , "echo<S2SV_blank>\'" "set_current_time<S2SV_blank>%s\\n" "set_super_value<S2SV_blank>mkfs_time<S2SV_blank>%s\\n" "set_super_value<S2SV_blank>lastcheck<S2SV_blank>%s\\n" <S2SV_StartBug> "set_super_value<S2SV_blank>mtime<S2SV_blank>00000000\'<S2SV_blank>|<S2SV_blank>%s<S2SV_blank>-w<S2SV_blank>\'%s\'<S2SV_blank>><S2SV_blank>/dev/null" , <S2SV_EndBug> fs_timestamp , fs_timestamp , fs_timestamp , get_opt ( "debugfs" ) , imageoutfile ( image ) ) ; if ( ret ) return ret ; } return 0 ; }
<S2SV_ModStart> "set_current_time<S2SV_blank>%s\\n" "set_super_value<S2SV_blank>mkfs_time<S2SV_blank>%s\\n" "set_super_value<S2SV_blank>lastcheck<S2SV_blank>%s\\n" "set_super_value<S2SV_blank>mtime<S2SV_blank>00000000\'<S2SV_blank>|<S2SV_blank>%s<S2SV_blank>-w<S2SV_blank>\'%s\'" <S2SV_ModEnd> , fs_timestamp ,
1,810
CWE-000 int pmbus_read_byte_data ( struct i2c_client * client , int page , u8 reg ) { int rv ; <S2SV_StartBug> if ( page >= 0 ) { <S2SV_EndBug> rv = pmbus_set_page ( client , page ) ; if ( rv < 0 ) return rv ; <S2SV_StartBug> } <S2SV_EndBug> return i2c_smbus_read_byte_data ( client , reg ) ; }
<S2SV_ModStart> int rv ; <S2SV_ModEnd> rv = pmbus_set_page <S2SV_ModStart> return rv ; <S2SV_ModEnd> return i2c_smbus_read_byte_data (
1,811
CWE-000 bool init_cylinder ( int fd , t_obj * objs , t_cam * cam ) { int ret_gnl ; char * line ; t_obj * new_obj ; if ( ( new_obj = make_new_obj ( objs , TYPE_CYLINDER ) ) == NULL ) return ( - 1 ) ; init_default_cylinder_values ( cam , new_obj ) ; while ( ( ret_gnl = get_next_line ( fd , & line ) ) == 1 && strstr ( line , "</cylinder>" ) == NULL ) { if ( check ( line , new_obj , fd ) == true ) <S2SV_StartBug> return ( false ) ; <S2SV_EndBug> free ( line ) ; } free ( line ) ; finish_init_obj ( new_obj , cam ) ; return ( false ) ; }
<S2SV_ModStart> ) return ( true <S2SV_ModEnd> ) ; free
1,812
CWE-000 int main_exec ( t_ast_node * ast_tree , int in_fork , int fd_min ) { char * * cmd ; char * tmp ; pid_t child ; char * builtins [ ] = <S2SV_StartBug> { "cd" , "echo" , "exit" , "setenv" , "unsetenv" , NULL } ; <S2SV_EndBug> if ( ast_tree -> type == PIPE ) launch_pipe ( ast_tree ) ; else if ( ast_tree -> type == GREAT ) run_redir_great ( ast_tree , in_fork ) ; else if ( ast_tree -> type == LESS ) run_redir_less ( ast_tree , in_fork ) ; else if ( ast_tree -> type == SEMICOLON ) run_semicolon ( ast_tree ) ; else if ( ast_tree -> type == DGREAT ) run_redir_dgreat ( ast_tree , in_fork ) ; else if ( ast_tree -> type == DLESS ) run_redir_dless ( ast_tree , in_fork ) ; else if ( ast_tree -> type == GREATAND ) run_greatand ( ast_tree , in_fork , fd_min ) ; else if ( ast_tree -> type == LESSAND ) run_lessand ( ast_tree , in_fork , fd_min ) ; else { <S2SV_StartBug> cmd = ft_strsplit ( ast_tree -> content , '<S2SV_blank>' ) ; <S2SV_EndBug> tmp = ft_strdup ( cmd [ 0 ] ) ; if ( ! ft_strcmp ( cmd [ 0 ] , "wc" ) || ! ft_strcmp ( cmd [ 0 ] , "sort" ) || ! ft_strcmp ( cmd [ 0 ] , "less" ) || ! ft_strcmp ( cmd [ 0 ] , "env" ) ) { free ( cmd [ 0 ] ) ; cmd [ 0 ] = ft_strjoin ( "/usr/bin/" , tmp ) ; } else if ( ! ft_isinarray ( cmd [ 0 ] , builtins ) ) { free ( cmd [ 0 ] ) ; cmd [ 0 ] = ft_strjoin ( "/bin/" , tmp ) ; } if ( in_fork && ! ft_isinarray ( cmd [ 0 ] , builtins ) ) execve ( cmd [ 0 ] , cmd , NULL ) ; else if ( ! ft_isinarray ( cmd [ 0 ] , builtins ) ) { child = fork ( ) ; if ( child == 0 ) execve ( cmd [ 0 ] , cmd , g_env ) ; else wait ( NULL ) ; } else launch_builtin ( cmd ) ; } return ( 0 ) ; }
<S2SV_ModStart> ] = { <S2SV_ModEnd> "setenv" , "unsetenv" <S2SV_ModStart> { cmd = list_to_array <S2SV_ModEnd> ( ast_tree -> <S2SV_ModStart> ast_tree -> content <S2SV_ModEnd> ) ; tmp
1,813
CWE-000 static Rboolean addPDFDevicefont ( type1fontfamily family , PDFDesc * pd , int * fontIndex ) { Rboolean result = FALSE ; type1fontlist fontlist = addDeviceFont ( family , pd -> fonts , fontIndex ) ; if ( fontlist ) { int dontcare ; encodinginfo encoding = findDeviceEncoding ( family -> encoding -> encpath , pd -> encodings , & dontcare ) ; if ( encoding ) { pd -> fonts = fontlist ; result = TRUE ; } else { encoding = findEncoding ( family -> encoding -> encpath , pd -> encodings , TRUE ) ; if ( ! encoding ) { <S2SV_StartBug> warning ( _ ( "corrupt<S2SV_blank>loaded<S2SV_blank>encodings;<S2SV_blank><S2SV_blank>font<S2SV_blank>not<S2SV_blank>added" ) ) ; <S2SV_EndBug> } else { encodinglist enclist = addDeviceEncoding ( encoding , pd -> encodings ) ; if ( enclist ) { pd -> fonts = fontlist ; pd -> encodings = enclist ; result = TRUE ; <S2SV_StartBug> } else <S2SV_EndBug> warning ( _ ( "failed<S2SV_blank>to<S2SV_blank>record<S2SV_blank>device<S2SV_blank>encoding;<S2SV_blank>font<S2SV_blank>not<S2SV_blank>added" ) ) ; } } } <S2SV_StartBug> return result ; <S2SV_EndBug> }
<S2SV_ModStart> encoding ) { freeDeviceFontList ( fontlist ) ; <S2SV_ModStart> ; } else { freeDeviceFontList ( fontlist ) ; <S2SV_ModStart> } } } }
1,814
CWE-000 static void allocator_memfree ( gsize memsize , gpointer mem ) { <S2SV_StartBug> # if HAVE_COMPLIANT_POSIX_MEMALIGN || HAVE_MEMALIGN || HAVE_VALLOC <S2SV_EndBug> free ( mem ) ; # else mem_assert ( memsize <= sys_page_size ) ; G_GNUC_BEGIN_IGNORE_DEPRECATIONS g_trash_stack_push ( & compat_valloc_trash , mem ) ; G_GNUC_END_IGNORE_DEPRECATIONS # endif }
<S2SV_ModStart> { # if HAVE_POSIX_MEMALIGN <S2SV_ModEnd> || HAVE_MEMALIGN ||
1,815
CWE-000 ssize_t do_replace_loop ( const char * needle , bool whole_word_only , const filestruct * real_current , size_t * real_current_x ) { ssize_t numreplaced = - 1 ; size_t match_len ; bool replaceall = FALSE ; # ifndef NANO_TINY bool old_mark_set = openfile -> mark_set ; filestruct * top , * bot ; size_t top_x , bot_x ; bool right_side_up = FALSE ; if ( old_mark_set ) { mark_order ( ( const filestruct * * ) & top , & top_x , ( const filestruct * * ) & bot , & bot_x , & right_side_up ) ; openfile -> mark_set = FALSE ; if ( ! ISSET ( BACKWARDS_SEARCH ) ) { openfile -> current = top ; openfile -> current_x = ( top_x == 0 ? 0 : top_x - 1 ) ; } else { openfile -> current = bot ; openfile -> current_x = bot_x ; } } # endif came_full_circle = FALSE ; while ( TRUE ) { int i = 0 ; int result = findnextstr ( needle , whole_word_only , & match_len , real_current , * real_current_x ) ; if ( result < 1 ) { if ( result < 0 ) numreplaced = - 2 ; break ; } # ifndef NANO_TINY if ( old_mark_set ) { if ( openfile -> current -> lineno > bot -> lineno || openfile -> current -> lineno < top -> lineno || ( openfile -> current == bot && openfile -> current_x > bot_x ) || ( openfile -> current == top && openfile -> current_x < top_x ) ) break ; } # endif if ( numreplaced == - 1 ) numreplaced = 0 ; if ( ! replaceall ) { size_t xpt = xplustabs ( ) ; char * exp_word = display_string ( openfile -> current -> data , xpt , strnlenpt ( openfile -> current -> data , openfile -> current_x + match_len ) - xpt , FALSE ) ; edit_refresh ( ) ; curs_set ( 0 ) ; spotlight ( TRUE , exp_word ) ; i = do_yesno_prompt ( TRUE , _ ( "Replace<S2SV_blank>this<S2SV_blank>instance?" ) ) ; spotlight ( FALSE , exp_word ) ; free ( exp_word ) ; if ( i == - 1 ) break ; else if ( i == 2 ) replaceall = TRUE ; } if ( i == 1 || replaceall ) { char * copy ; size_t length_change ; # ifndef NANO_TINY add_undo ( REPLACE ) ; # endif copy = replace_line ( needle ) ; length_change = strlen ( copy ) - strlen ( openfile -> current -> data ) ; # ifndef NANO_TINY if ( old_mark_set && ! right_side_up ) { if ( openfile -> current == openfile -> mark_begin && openfile -> mark_begin_x > openfile -> current_x ) { if ( openfile -> mark_begin_x < openfile -> current_x + match_len ) openfile -> mark_begin_x = openfile -> current_x ; else openfile -> mark_begin_x += length_change ; bot_x = openfile -> mark_begin_x ; } } if ( ! old_mark_set || right_side_up ) { # endif if ( openfile -> current == real_current && <S2SV_StartBug> openfile -> current_x <= * real_current_x ) { <S2SV_EndBug> if ( * real_current_x < openfile -> current_x + match_len ) * real_current_x = openfile -> current_x + match_len ; * real_current_x += length_change ; # ifndef NANO_TINY bot_x = * real_current_x ; } # endif } # ifdef HAVE_REGEX_H if ( match_len == 0 || ( * needle == '^' && ISSET ( USE_REGEXP ) ) ) match_len ++ ; # endif if ( ! ISSET ( BACKWARDS_SEARCH ) ) openfile -> current_x += match_len + length_change - 1 ; openfile -> totsize += mbstrlen ( copy ) - mbstrlen ( openfile -> current -> data ) ; free ( openfile -> current -> data ) ; openfile -> current -> data = copy ; # ifndef DISABLE_COLOR if ( numreplaced == 0 ) reset_multis ( openfile -> current , TRUE ) ; # endif if ( ! replaceall ) { # ifndef DISABLE_COLOR if ( openfile -> colorstrings != NULL && ! ISSET ( NO_COLOR_SYNTAX ) ) edit_refresh ( ) ; else # endif update_line ( openfile -> current , openfile -> current_x ) ; } set_modified ( ) ; as_an_at = TRUE ; numreplaced ++ ; } } if ( numreplaced == - 1 ) not_found_msg ( needle ) ; # ifndef NANO_TINY if ( old_mark_set ) openfile -> mark_set = TRUE ; # endif if ( ! ISSET ( NO_NEWLINES ) && openfile -> filebot -> data [ 0 ] != '\\0' ) new_magicline ( ) ; return numreplaced ; }
<S2SV_ModStart> openfile -> current_x < <S2SV_ModEnd> * real_current_x )
1,816
CWE-000 void add_entity ( GameState game_state , GUI gui , int32_t xpos , int32_t ypos , char * image_name ) { if ( ! imagelib_load ( image_name , gui -> renderer ) ) { switch ( IMAGE_LIB_ERR ) { case DIRECTORY_NOT_FOUND : fprintf ( stderr , "Could<S2SV_blank>not<S2SV_blank>find<S2SV_blank>directory<S2SV_blank>%s" , ASSET_DIRECTORY ) ; break ; case FILE_NOT_FOUND : <S2SV_StartBug> fprintf ( stderr , "Could<S2SV_blank>not<S2SV_blank>find<S2SV_blank>asset<S2SV_blank>`celes.png`" ) ; <S2SV_EndBug> break ; case FILE_NAME_TOO_LONG : <S2SV_StartBug> fprintf ( stderr , "`celes.png`<S2SV_blank>is<S2SV_blank>too<S2SV_blank>long<S2SV_blank>a<S2SV_blank>file<S2SV_blank>name." ) ; <S2SV_EndBug> break ; case LIBRARY_FULL : fprintf ( stderr , "The<S2SV_blank>image<S2SV_blank>library<S2SV_blank>is<S2SV_blank>full." ) ; break ; default : fprintf ( stderr , "Unknown<S2SV_blank>error<S2SV_blank>%d" , IMAGE_LIB_ERR ) ; break ; } exit ( 20 ) ; } Image * image = imagelib_get ( image_name ) ; Entity player_entity = ( Entity ) { xpos , ypos , image } ; game_state -> entities [ game_state -> num_entities ++ ] = player_entity ; }
<S2SV_ModStart> ( stderr , "Could<S2SV_blank>not<S2SV_blank>find<S2SV_blank>asset<S2SV_blank>`%s`" , image_name <S2SV_ModEnd> ) ; break <S2SV_ModStart> ( stderr , "`%s`<S2SV_blank>is<S2SV_blank>too<S2SV_blank>long<S2SV_blank>a<S2SV_blank>file<S2SV_blank>name." , image_name <S2SV_ModEnd> ) ; break
1,817
CWE-000 NON_EXEC_STATIC void GlobalDeadLockDetectorMain ( int argc , char * argv [ ] ) { sigjmp_buf local_sigjmp_buf ; Port portbuf ; char * fullpath ; char * knownDatabase = "postgres" ; IsUnderPostmaster = true ; am_global_deadlock_detector = true ; MyPMChildSlot = - 1 ; MyProcPid = getpid ( ) ; MyStartTime = time ( NULL ) ; on_exit_reset ( ) ; # ifdef HAVE_SETSID if ( setsid ( ) < 0 ) elog ( FATAL , "setsid()<S2SV_blank>failed:<S2SV_blank>%m" ) ; # endif init_ps_display ( "global<S2SV_blank>deadlock<S2SV_blank>detector<S2SV_blank>process" , "" , "" , "" ) ; SetProcessingMode ( InitProcessing ) ; pqsignal ( SIGHUP , sigHupHandler ) ; pqsignal ( SIGINT , StatementCancelHandler ) ; pqsignal ( SIGTERM , die ) ; pqsignal ( SIGQUIT , quickdie ) ; pqsignal ( SIGALRM , SIG_IGN ) ; pqsignal ( SIGPIPE , SIG_IGN ) ; pqsignal ( SIGUSR1 , procsignal_sigusr1_handler ) ; pqsignal ( SIGUSR2 , RequestShutdown ) ; pqsignal ( SIGFPE , FloatExceptionHandler ) ; pqsignal ( SIGCHLD , SIG_DFL ) ; CurrentResourceOwner = ResourceOwnerCreate ( NULL , "GlobalDeadLockDetector" ) ; BaseInit ( ) ; # ifndef EXEC_BACKEND InitProcess ( ) ; # endif InitBufferPoolBackend ( ) ; InitXLOGAccess ( ) ; SetProcessingMode ( NormalProcessing ) ; gddContext = AllocSetContextCreate ( TopMemoryContext , "GddContext" , ALLOCSET_DEFAULT_MINSIZE , ALLOCSET_DEFAULT_INITSIZE , ALLOCSET_DEFAULT_MAXSIZE ) ; if ( sigsetjmp ( local_sigjmp_buf , 1 ) != 0 ) { HOLD_INTERRUPTS ( ) ; EmitErrorReport ( ) ; AbortCurrentTransaction ( ) ; proc_exit ( 0 ) ; } PG_exception_stack = & local_sigjmp_buf ; PG_SETMASK ( & UnBlockSig ) ; InitProcessPhase2 ( ) ; MyBackendId = InvalidBackendId ; SharedInvalBackendInit ( false ) ; if ( MyBackendId > MaxBackends || MyBackendId <= 0 ) elog ( FATAL , "bad<S2SV_blank>backend<S2SV_blank>id:<S2SV_blank>%d" , MyBackendId ) ; InitBufferPoolBackend ( ) ; RelationCacheInitialize ( ) ; InitCatalogCache ( ) ; RelationCacheInitializePhase2 ( ) ; StartTransactionCommand ( ) ; ( void ) GetTransactionSnapshot ( ) ; if ( ! FindMyDatabase ( knownDatabase , & MyDatabaseId , & MyDatabaseTableSpace ) ) ereport ( FATAL , ( errcode ( ERRCODE_UNDEFINED_DATABASE ) , errmsg ( "database<S2SV_blank>\\"%s\\"<S2SV_blank>does<S2SV_blank>not<S2SV_blank>exit" , knownDatabase ) ) ) ; MyProc -> databaseId = MyDatabaseId ; fullpath = GetDatabasePath ( MyDatabaseId , MyDatabaseTableSpace ) ; SetDatabasePath ( fullpath ) ; RelationCacheInitializePhase3 ( ) ; InitializeSessionUserIdStandalone ( ) ; memset ( & portbuf , 0 , sizeof ( portbuf ) ) ; MyProcPort = & portbuf ; <S2SV_StartBug> MyProcPort -> user_name = GetUserNameFromId ( GetAuthenticatedUserId ( ) ) ; <S2SV_EndBug> MyProcPort -> database_name = knownDatabase ; CommitTransactionCommand ( ) ; extern bool optimizer ; optimizer = false ; GlobalDeadLockDetectorLoop ( ) ; proc_exit ( 0 ) ; }
<S2SV_ModStart> -> user_name = MemoryContextStrdup ( TopMemoryContext , <S2SV_ModStart> ( GetAuthenticatedUserId ( )
1,818
CWE-000 inline static void short_on ( ) { <S2SV_StartBug> GPIOA -> ODR |= GPIO_PIN_5 ; <S2SV_EndBug> }
<S2SV_ModStart> ( ) { SHORT_ON <S2SV_ModEnd> ; } <S2SV_null>
1,819
CWE-000 void ucp_tag_exp_remove ( ucp_tag_match_t * tm , ucp_request_t * req ) { ucs_queue_head_t * queue = ucp_tag_exp_get_req_queue ( tm , req ) ; ucp_context_t * ctx = ucs_container_of ( tm , ucp_context_t , tm ) ; ucs_queue_iter_t iter ; ucp_request_t * qreq ; ucs_queue_for_each_safe ( qreq , iter , queue , recv . queue ) { if ( qreq == req ) { <S2SV_StartBug> if ( req -> flags & UCP_REQUEST_FLAG_OFFLOADED ) { <S2SV_EndBug> ucp_tag_offload_cancel ( ctx , req , 0 ) ; <S2SV_StartBug> } <S2SV_EndBug> ucs_queue_del_iter ( queue , iter ) ; return ; } } ucs_bug ( "expected<S2SV_blank>request<S2SV_blank>not<S2SV_blank>found" ) ; }
<S2SV_ModStart> req ) { ucp_tag_offload_try_cancel <S2SV_ModEnd> ( ctx , <S2SV_ModStart> 0 ) ; <S2SV_ModEnd> ucs_queue_del_iter ( queue
1,820
CWE-000 kpoly_t * new_kpoly_y ( const int j , const int i ) { const size_t deg = i ; if ( deg > K || deg >= G || deg == 0 ) { ERRNO = __LINE__ ; return NULL ; } kpoly_t * new = new_zero_kpoly ( ) ; if ( new == NULL ) { ERRNO = __LINE__ ; } else { new -> mono . deg = deg ; double numer = bN ( j , j + i ) - bN ( j , j + i - 1 ) - bN ( j - 1 , i + j ) + bN ( j - 1 , j + i - 1 ) ; double denom_j = aN ( j ) - aN ( j - 1 ) - gN ( j ) + dN ( j - 1 ) ; new -> mono . coeff = numer / denom_j * pow ( 1.0 - P , deg ) ; <S2SV_StartBug> } <S2SV_EndBug> return new ; }
<S2SV_ModStart> deg ) ; new -> coeff [ deg ] = new -> mono . coeff ;
1,821
CWE-000 static bool wlr_drm_connector_set_cursor ( struct wlr_output * output , const uint8_t * buf , int32_t stride , uint32_t width , uint32_t height , int32_t hotspot_x , int32_t hotspot_y , bool update_pixels ) { struct wlr_drm_connector * conn = ( struct wlr_drm_connector * ) output ; struct wlr_drm_backend * drm = ( struct wlr_drm_backend * ) output -> backend ; struct wlr_drm_renderer * renderer = & drm -> renderer ; struct wlr_drm_crtc * crtc = conn -> crtc ; <S2SV_StartBug> struct wlr_drm_plane * plane = crtc -> cursor ; <S2SV_EndBug> if ( ! buf && update_pixels ) { plane -> cursor_enabled = false ; return drm -> iface -> crtc_set_cursor ( drm , crtc , NULL ) ; } plane -> cursor_enabled = true ; <S2SV_StartBug> if ( ! plane ) { <S2SV_EndBug> plane = calloc ( 1 , sizeof ( * plane ) ) ; if ( ! plane ) { wlr_log_errno ( L_ERROR , "Allocation<S2SV_blank>failed" ) ; return false ; } crtc -> cursor = plane ; } if ( ! plane -> surf . gbm ) { int ret ; uint64_t w , h ; ret = drmGetCap ( drm -> fd , DRM_CAP_CURSOR_WIDTH , & w ) ; w = ret ? 64 : w ; ret = drmGetCap ( drm -> fd , DRM_CAP_CURSOR_HEIGHT , & h ) ; h = ret ? 64 : h ; if ( width > w || height > h ) { wlr_log ( L_INFO , "Cursor<S2SV_blank>too<S2SV_blank>large<S2SV_blank>(max<S2SV_blank>%dx%d)" , ( int ) w , ( int ) h ) ; return false ; } if ( ! wlr_drm_surface_init ( & plane -> surf , renderer , w , h , GBM_FORMAT_ARGB8888 , 0 ) ) { wlr_log ( L_ERROR , "Cannot<S2SV_blank>allocate<S2SV_blank>cursor<S2SV_blank>resources" ) ; return false ; } plane -> cursor_bo = gbm_bo_create ( renderer -> gbm , w , h , GBM_FORMAT_ARGB8888 , GBM_BO_USE_CURSOR | GBM_BO_USE_WRITE ) ; if ( ! plane -> cursor_bo ) { wlr_log_errno ( L_ERROR , "Failed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>cursor<S2SV_blank>bo" ) ; return false ; } wlr_matrix_texture ( plane -> matrix , plane -> surf . width , plane -> surf . height , conn -> output . transform ^ WL_OUTPUT_TRANSFORM_FLIPPED_180 ) ; plane -> wlr_tex = wlr_render_texture_create ( plane -> surf . renderer -> wlr_rend ) ; if ( ! plane -> wlr_tex ) { return false ; } } switch ( output -> transform ) { case WL_OUTPUT_TRANSFORM_90 : output -> cursor . hotspot_x = hotspot_x ; output -> cursor . hotspot_y = - plane -> surf . height + hotspot_y ; break ; case WL_OUTPUT_TRANSFORM_180 : output -> cursor . hotspot_x = plane -> surf . width - hotspot_x ; output -> cursor . hotspot_y = plane -> surf . height - hotspot_y ; break ; case WL_OUTPUT_TRANSFORM_270 : output -> cursor . hotspot_x = - plane -> surf . height + hotspot_x ; output -> cursor . hotspot_y = hotspot_y ; break ; case WL_OUTPUT_TRANSFORM_FLIPPED : output -> cursor . hotspot_x = plane -> surf . width - hotspot_x ; output -> cursor . hotspot_y = hotspot_y ; break ; case WL_OUTPUT_TRANSFORM_FLIPPED_90 : output -> cursor . hotspot_x = hotspot_x ; output -> cursor . hotspot_y = - hotspot_y ; break ; case WL_OUTPUT_TRANSFORM_FLIPPED_180 : output -> cursor . hotspot_x = hotspot_x ; output -> cursor . hotspot_y = plane -> surf . height - hotspot_y ; break ; case WL_OUTPUT_TRANSFORM_FLIPPED_270 : output -> cursor . hotspot_x = - plane -> surf . height + hotspot_x ; output -> cursor . hotspot_y = plane -> surf . width - hotspot_y ; break ; } if ( ! update_pixels ) { return true ; } struct gbm_bo * bo = plane -> cursor_bo ; uint32_t bo_width = gbm_bo_get_width ( bo ) ; uint32_t bo_height = gbm_bo_get_height ( bo ) ; uint32_t bo_stride ; void * bo_data ; if ( ! gbm_bo_map ( bo , 0 , 0 , bo_width , bo_height , GBM_BO_TRANSFER_WRITE , & bo_stride , & bo_data ) ) { wlr_log_errno ( L_ERROR , "Unable<S2SV_blank>to<S2SV_blank>map<S2SV_blank>buffer" ) ; return false ; } wlr_drm_surface_make_current ( & plane -> surf ) ; wlr_texture_upload_pixels ( plane -> wlr_tex , WL_SHM_FORMAT_ARGB8888 , stride , width , height , buf ) ; glViewport ( 0 , 0 , plane -> surf . width , plane -> surf . height ) ; glClearColor ( 0.0 , 0.0 , 0.0 , 0.0 ) ; glClear ( GL_COLOR_BUFFER_BIT ) ; float matrix [ 16 ] ; wlr_texture_get_matrix ( plane -> wlr_tex , & matrix , & plane -> matrix , 0 , 0 ) ; wlr_render_with_matrix ( plane -> surf . renderer -> wlr_rend , plane -> wlr_tex , & matrix ) ; glFinish ( ) ; glPixelStorei ( GL_UNPACK_ROW_LENGTH_EXT , bo_stride ) ; glReadPixels ( 0 , 0 , plane -> surf . width , plane -> surf . height , GL_BGRA_EXT , GL_UNSIGNED_BYTE , bo_data ) ; glPixelStorei ( GL_UNPACK_ROW_LENGTH_EXT , 0 ) ; wlr_drm_surface_swap_buffers ( & plane -> surf ) ; gbm_bo_unmap ( bo , bo_data ) ; return drm -> iface -> crtc_set_cursor ( drm , crtc , bo ) ; }
<S2SV_ModStart> -> cursor ; if ( ! plane ) { plane = calloc ( 1 , sizeof ( * plane ) ) ; if ( ! plane ) { wlr_log_errno ( L_ERROR , "Allocation<S2SV_blank>failed" ) ; return false ; } crtc -> cursor = plane ; } <S2SV_ModStart> = true ; <S2SV_ModEnd> if ( !
1,822
CWE-000 <S2SV_StartBug> jint netty_internal_tcnative_Library_JNI_OnLoad ( JNIEnv * env , const char * packagePrefix ) { <S2SV_EndBug> if ( netty_internal_tcnative_util_register_natives ( env , packagePrefix , "io/netty/internal/tcnative/Library" , method_table , method_table_size ) != 0 ) { return JNI_ERR ; } if ( netty_internal_tcnative_Error_JNI_OnLoad ( env , packagePrefix ) == JNI_ERR ) { return JNI_ERR ; } if ( netty_internal_tcnative_Buffer_JNI_OnLoad ( env , packagePrefix ) == JNI_ERR ) { return JNI_ERR ; } if ( netty_internal_tcnative_NativeStaticallyReferencedJniMethods_JNI_OnLoad ( env , packagePrefix ) == JNI_ERR ) { return JNI_ERR ; } if ( netty_internal_tcnative_SSL_JNI_OnLoad ( env , packagePrefix ) == JNI_ERR ) { return JNI_ERR ; } if ( netty_internal_tcnative_SSLContext_JNI_OnLoad ( env , packagePrefix ) == JNI_ERR ) { return JNI_ERR ; } apr_version_t apv ; int apvn ; apr_version ( & apv ) ; apvn = apv . major * 1000 + apv . minor * 100 + apv . patch ; if ( apvn < 1201 ) { tcn_Throw ( env , "Unsupported<S2SV_blank>APR<S2SV_blank>version<S2SV_blank>(%s)" , apr_version_string ( ) ) ; return JNI_ERR ; } TCN_LOAD_CLASS ( env , jString_class , "java/lang/String" , JNI_ERR ) ; TCN_GET_METHOD ( env , jString_class , jString_init , "<init>" , "([B)V" , JNI_ERR ) ; TCN_GET_METHOD ( env , jString_class , jString_getBytes , "getBytes" , "()[B" , JNI_ERR ) ; TCN_LOAD_CLASS ( env , byteArrayClass , "[B" , JNI_ERR ) ; return TCN_JNI_VERSION ; }
<S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> static
1,823
CWE-000 static int elemental_ai_sub_foreachclient ( struct map_session_data * sd , va_list ap ) { <S2SV_StartBug> int64 tick = va_arg ( ap , unsigned int ) ; <S2SV_EndBug> if ( sd -> status . ele_id && sd -> ed ) elemental_ai_sub_timer ( sd -> ed , sd , tick ) ; return 0 ; }
<S2SV_ModStart> ( ap , int64 <S2SV_ModEnd> ) ; if
1,824
CWE-000 static int cnic_arp_send ( nic_t * nic , nic_interface_t * nic_iface , int fd , __u8 * mac_addr , __u32 ip_addr , char * addr_str ) { struct ether_header * eth ; struct ether_arp * arp ; __u32 dst_ip = ip_addr ; int pkt_size = sizeof ( * eth ) + sizeof ( * arp ) ; int rc ; struct in_addr addr ; static const uint8_t multicast_mac [ ] = { 0xff , 0xff , 0xff , 0xff , 0xff , 0xff } ; LOG_DEBUG ( PFX "%s:<S2SV_blank>host:%d<S2SV_blank>-<S2SV_blank>try<S2SV_blank>getting<S2SV_blank>xmit<S2SV_blank>mutex<S2SV_blank>cnic<S2SV_blank>arp<S2SV_blank>send" , nic -> log_name , nic -> host_no ) ; rc = pthread_mutex_trylock ( & nic -> xmit_mutex ) ; if ( rc != 0 ) { LOG_DEBUG ( PFX "%s:<S2SV_blank>could<S2SV_blank>not<S2SV_blank>get<S2SV_blank>xmit_mutex" , nic -> log_name ) ; return - EAGAIN ; } eth = ( * nic -> ops -> get_tx_pkt ) ( nic ) ; if ( eth == NULL ) { LOG_WARN ( PFX "%s:<S2SV_blank>couldn\'t<S2SV_blank>get<S2SV_blank>tx<S2SV_blank>packet" , nic -> log_name ) ; <S2SV_StartBug> return - EAGAIN ; <S2SV_EndBug> } nic_fill_ethernet_header ( nic_iface , eth , nic -> mac_addr , ( void * ) multicast_mac , & pkt_size , ( void * ) & arp , ETHERTYPE_ARP ) ; arp -> arp_hrd = htons ( ARPHRD_ETHER ) ; arp -> arp_pro = htons ( ETHERTYPE_IP ) ; arp -> arp_hln = ETH_ALEN ; arp -> arp_pln = 4 ; arp -> arp_op = htons ( ARPOP_REQUEST ) ; memcpy ( arp -> arp_sha , nic -> mac_addr , ETH_ALEN ) ; memset ( arp -> arp_tha , 0 , ETH_ALEN ) ; memcpy ( arp -> arp_spa , nic_iface -> ustack . hostaddr , 4 ) ; memcpy ( arp -> arp_tpa , & dst_ip , 4 ) ; ( * nic -> nic_library -> ops -> start_xmit ) ( nic , pkt_size , ( nic_iface -> vlan_priority << 12 ) | nic_iface -> vlan_id ) ; memcpy ( & addr . s_addr , & dst_ip , sizeof ( addr . s_addr ) ) ; LOG_DEBUG ( PFX "%s:<S2SV_blank>Sent<S2SV_blank>cnic<S2SV_blank>arp<S2SV_blank>request<S2SV_blank>for<S2SV_blank>IP:<S2SV_blank>%s" , nic -> log_name , addr_str ) ; pthread_mutex_unlock ( & nic -> xmit_mutex ) ; return 0 ; }
<S2SV_ModStart> log_name ) ; pthread_mutex_unlock ( & nic -> xmit_mutex ) ;
1,825
CWE-000 int getDegree ( int euclid [ ] ) { int i , j ; for ( i = bytes - 1 ; i >= 0 ; i -- ) { if ( euclid [ i ] ) { for ( j = 32 - 1 ; j >= 0 ; j -- ) { if ( TestBit ( & ( euclid [ i ] ) , j ) ) { return j + 32 * ( i ) + 1 ; } } } } <S2SV_StartBug> return - 1 ; <S2SV_EndBug> }
<S2SV_ModStart> } } return 0 <S2SV_ModEnd> ; } <S2SV_null>
1,826
CWE-000 ret_t check_icc ( ctiff_t * ctif ) { tifp_check ( ctif ) ; tif_rules_tag ( TIFFTAG_ICCPROFILE , "is<S2SV_blank>correct" ) ; ifd_entry_t ifd_entry = TIFFGetRawIFDEntry ( ctif , TIFFTAG_ICCPROFILE ) ; uint32 icc_profile_size ; uint32 count ; char * icc_profile = NULL ; switch ( ifd_entry . datatype ) { case TIFF_UNDEFINED : { icc_profile_size = ifd_entry . count ; count = ifd_entry . count ; if ( ifd_entry . value_or_offset == is_offset ) { offset_t offset = read_offsetdata ( ctif , ifd_entry . data32offset , count , ifd_entry . datatype ) ; icc_profile = ( char * ) offset . data32p ; } else { <S2SV_StartBug> perror ( "Should<S2SV_blank>not<S2SV_blank>occure" ) ; <S2SV_EndBug> } break ; } default : { char array [ VALUESTRLEN ] ; snprintf ( array , sizeof ( array ) , "<S2SV_blank>but<S2SV_blank>was<S2SV_blank>datatype:%u" , ifd_entry . datatype ) ; return tif_returns ( TIFFTAG_ICCPROFILE , "of<S2SV_blank>type<S2SV_blank>undefined" , array ) ; break ; } ; } # define ERRSIZE 1024 char * errmessage = malloc ( sizeof ( char ) * ERRSIZE ) ; unsigned long errsize = ERRSIZE ; int ret = parse_icc ( icc_profile_size , icc_profile , errsize , errmessage ) ; if ( 0 != ret ) { return tif_fails_tag ( TIFFTAG_ICCPROFILE , "pointing<S2SV_blank>to<S2SV_blank>valid<S2SV_blank>ICC<S2SV_blank>profile" , errmessage ) ; } free ( errmessage ) ; ret_t res ; res . returnmsg = NULL ; res . returncode = 0 ; return res ; }
<S2SV_ModStart> } else { return tif_fails_tag ( TIFFTAG_ICCPROFILE , "pointing<S2SV_blank>to<S2SV_blank>an<S2SV_blank>offset" , "encoded<S2SV_blank>as<S2SV_blank>value<S2SV_blank>instead<S2SV_blank>as<S2SV_blank>offset,<S2SV_blank>but<S2SV_blank>there<S2SV_blank>is<S2SV_blank>no<S2SV_blank>enough<S2SV_blank>space<S2SV_blank>to<S2SV_blank>hold<S2SV_blank>it" <S2SV_ModEnd> ) ; }
1,827
CWE-000 cplugin_info_t * py_load_info ( void * data __attribute__ ( ( unused ) ) , void * ptr ) { PyObject * dict = ( PyObject * ) ptr ; PyObject * class = NULL , * instance = NULL , * result = NULL ; unsigned int i = 0 , t = 0 ; cplugin_info_t * info = NULL ; struct plugin_internal_function pyinfo [ ] = { { "get_name" , NULL } , { "get_version" , NULL } , { "get_author" , NULL } , { "get_description" , NULL } , { "get_api" , NULL } , { "get_startup" , NULL } , { "get_shutdown" , NULL } } ; class = PyDict_GetItemString ( dict , "CpluginMainEntry" ) ; if ( NULL == class ) return NULL ; if ( ! PyCallable_Check ( class ) ) return NULL ; else instance = PyObject_CallObject ( class , NULL ) ; if ( NULL == instance ) return NULL ; t = sizeof ( pyinfo ) / sizeof ( pyinfo [ 0 ] ) ; for ( i = 0 ; i < t ; i ++ ) { <S2SV_StartBug> result = PyObject_CallMethod ( instance , pyinfo [ i ] . fname , NULL ) ; <S2SV_EndBug> if ( NULL == result ) return NULL ; pyinfo [ i ] . return_value = PyString_AS_STRING ( result ) ; Py_DECREF ( result ) ; } info = info_create_from_data ( pyinfo [ 0 ] . return_value , pyinfo [ 1 ] . return_value , pyinfo [ 2 ] . return_value , pyinfo [ 3 ] . return_value , pyinfo [ 4 ] . return_value ) ; if ( info != NULL ) set_custom_plugin_info ( info , pyinfo [ 5 ] . return_value , pyinfo [ 6 ] . return_value ) ; Py_DECREF ( instance ) ; return info ; }
<S2SV_ModStart> i ] . name <S2SV_ModEnd> , NULL )
1,828
CWE-000 void handle_ruleset_extra ( const struct packet_ruleset_extra * p ) { struct extra_type * pextra = extra_by_number ( p -> id ) ; int i ; bool cbase ; bool croad ; bool cres ; fc_assert_ret_msg ( NULL != pextra , "Bad<S2SV_blank>extra<S2SV_blank>%d." , p -> id ) ; names_set ( & pextra -> name , NULL , p -> name , p -> rule_name ) ; pextra -> category = p -> category ; pextra -> causes = 0 ; for ( i = 0 ; i < EC_COUNT ; i ++ ) { if ( BV_ISSET ( p -> causes , i ) ) { pextra -> causes |= ( 1 << i ) ; } } pextra -> rmcauses = 0 ; for ( i = 0 ; i < ERM_COUNT ; i ++ ) { if ( BV_ISSET ( p -> rmcauses , i ) ) { pextra -> rmcauses |= ( 1 << i ) ; } } extra_to_category_list ( pextra , pextra -> category ) ; if ( pextra -> causes == 0 ) { extra_to_caused_by_list ( pextra , EC_NONE ) ; } else { for ( i = 0 ; i < EC_COUNT ; i ++ ) { if ( is_extra_caused_by ( pextra , i ) ) { extra_to_caused_by_list ( pextra , i ) ; } } } cbase = is_extra_caused_by ( pextra , EC_BASE ) ; croad = is_extra_caused_by ( pextra , EC_ROAD ) ; cres = is_extra_caused_by ( pextra , EC_RESOURCE ) ; if ( cbase ) { base_type_init ( pextra , extra_type_list_size ( extra_type_list_by_cause ( EC_BASE ) ) - 1 ) ; } if ( croad ) { road_type_init ( pextra , extra_type_list_size ( extra_type_list_by_cause ( EC_ROAD ) ) - 1 ) ; } if ( ! cbase && ! croad && ! cres ) { pextra -> data . special_idx = extra_type_list_size ( extra_type_list_by_cause ( EC_SPECIAL ) ) ; extra_to_caused_by_list ( pextra , EC_SPECIAL ) ; } for ( i = 0 ; i < ERM_COUNT ; i ++ ) { if ( is_extra_removed_by ( pextra , i ) ) { extra_to_removed_by_list ( pextra , i ) ; } } sz_strlcpy ( pextra -> activity_gfx , p -> activity_gfx ) ; sz_strlcpy ( pextra -> act_gfx_alt , p -> act_gfx_alt ) ; sz_strlcpy ( pextra -> act_gfx_alt2 , p -> act_gfx_alt2 ) ; sz_strlcpy ( pextra -> rmact_gfx , p -> rmact_gfx ) ; sz_strlcpy ( pextra -> rmact_gfx_alt , p -> rmact_gfx_alt ) ; sz_strlcpy ( pextra -> graphic_str , p -> graphic_str ) ; sz_strlcpy ( pextra -> graphic_alt , p -> graphic_alt ) ; for ( i = 0 ; i < p -> reqs_count ; i ++ ) { requirement_vector_append ( & pextra -> reqs , p -> reqs [ i ] ) ; } fc_assert ( pextra -> reqs . size == p -> reqs_count ) ; for ( i = 0 ; i < p -> rmreqs_count ; i ++ ) { requirement_vector_append ( & pextra -> rmreqs , p -> rmreqs [ i ] ) ; } fc_assert ( pextra -> rmreqs . size == p -> rmreqs_count ) ; pextra -> appearance_chance = p -> appearance_chance ; for ( i = 0 ; i < p -> appearance_reqs_count ; i ++ ) { requirement_vector_append ( & pextra -> appearance_reqs , p -> appearance_reqs [ i ] ) ; } fc_assert ( pextra -> appearance_reqs . size == p -> appearance_reqs_count ) ; pextra -> disappearance_chance = p -> disappearance_chance ; for ( i = 0 ; i < p -> disappearance_reqs_count ; i ++ ) { requirement_vector_append ( & pextra -> disappearance_reqs , p -> disappearance_reqs [ i ] ) ; } fc_assert ( pextra -> disappearance_reqs . size == p -> disappearance_reqs_count ) ; pextra -> visibility_req = p -> visibility_req ; pextra -> buildable = p -> buildable ; <S2SV_StartBug> pextra -> build_time = p -> build_time ; <S2SV_EndBug> pextra -> build_time_factor = p -> build_time_factor ; pextra -> removal_time = p -> removal_time ; pextra -> removal_time_factor = p -> removal_time_factor ; pextra -> defense_bonus = p -> defense_bonus ; if ( pextra -> defense_bonus != 0 ) { if ( extra_has_flag ( pextra , EF_NATURAL_DEFENSE ) ) { extra_to_caused_by_list ( pextra , EC_NATURAL_DEFENSIVE ) ; } else { extra_to_caused_by_list ( pextra , EC_DEFENSIVE ) ; } } pextra -> eus = p -> eus ; if ( pextra -> eus == EUS_HIDDEN ) { extra_type_list_append ( extra_type_list_of_unit_hiders ( ) , pextra ) ; } pextra -> native_to = p -> native_to ; pextra -> flags = p -> flags ; pextra -> hidden_by = p -> hidden_by ; pextra -> bridged_over = p -> bridged_over ; pextra -> conflicts = p -> conflicts ; PACKET_STRVEC_EXTRACT ( pextra -> helptext , p -> helptext ) ; tileset_setup_extra ( tileset , pextra ) ; }
<S2SV_ModStart> ; pextra -> generated = p -> generated ; pextra ->
1,829
CWE-000 bool pwmss_timer_callback ( struct timer * timer , void * data ) { <S2SV_StartBug> int32_t ret ; <S2SV_EndBug> printf ( "my<S2SV_blank>pins<S2SV_blank>togglinn\\n" ) ; ret = gpioPin_togglePin ( ( struct gpio_pin * ) data ) ; CONFIG_ASSERT ( ret >= 0 ) ; return false ; }
<S2SV_ModStart> { int32_t ret <S2SV_ModEnd> ; ret =
1,830
CWE-000 void update_average_power ( void ) { uint16_t idx ; uint32_t sum = 0 ; peak_flag = 0 ; if ( gap_found ) { power_avg = 0 ; peak_threshold = 0 ; } else { if ( end_of_gap ) { peak_flag = 1 ; peak_last = PEAK_SPACING ; ramp_frames = 0 ; power_avg_idx = PEAK_FRAMES - 1 ; } if ( ramp_frames < PEAK_FRAMES ) ramp_frames ++ ; for ( idx = 0 ; idx < COLOR_CHANNELS - 1 ; idx ++ ) { sum += chan_max_left [ idx ] + chan_max_right [ idx ] ; } power_avg_idx ++ ; if ( power_avg_idx == PEAK_FRAMES ) power_avg_idx = 0 ; power_avg_buff [ power_avg_idx ] = sum ; power_avg = 0 ; for ( idx = 0 ; idx < ramp_frames ; idx ++ ) { power_avg += power_avg_buff [ idx ] ; } power_avg /= ramp_frames ; <S2SV_StartBug> peak_threshold = power_avg + ( power_avg >> 2 ) ; <S2SV_EndBug> if ( sum > peak_threshold ) { peak_flag = 1 + rnd ( 1 ) ; } if ( peak_flag ) { if ( peak_last < PEAK_SPACING ) peak_flag = 0 ; else peak_last = 0 ; } peak_last ++ ; } }
<S2SV_ModStart> >> 2 ) + ( power_avg >> 3 ) ; if ( sum >= <S2SV_ModEnd> peak_threshold ) {
1,831
CWE-000 static void deformVerts ( ModifierData * md , const ModifierEvalContext * ctx , Mesh * mesh , float ( * vertexCos ) [ 3 ] , int numVerts ) { CastModifierData * cmd = ( CastModifierData * ) md ; Mesh * mesh_src = NULL ; <S2SV_StartBug> if ( ctx -> object -> type == OB_MESH ) { <S2SV_EndBug> <S2SV_StartBug> mesh_src = MOD_deform_mesh_eval_get ( ctx -> object , NULL , mesh , NULL , numVerts , false , false ) ; <S2SV_EndBug> BLI_assert ( mesh_src -> totvert == numVerts ) ; } if ( cmd -> type == MOD_CAST_TYPE_CUBOID ) { cuboid_do ( cmd , ctx -> object , mesh_src , vertexCos , numVerts ) ; } else { sphere_do ( cmd , ctx -> object , mesh_src , vertexCos , numVerts ) ; } if ( ! ELEM ( mesh_src , NULL , mesh ) ) { BKE_id_free ( NULL , mesh_src ) ; } }
<S2SV_ModStart> type == OB_MESH && cmd -> defgrp_name [ 0 ] != '\\0' <S2SV_ModStart> false , false <S2SV_ModEnd> ) ; }
1,832
CWE-000 static int alt_fpga_bridge_probe ( struct platform_device * pdev ) { struct device * dev = & pdev -> dev ; struct alt_fpga2sdram_data * priv ; u32 enable ; struct regmap * sysmgr ; int ret = 0 ; priv = devm_kzalloc ( dev , sizeof ( * priv ) , GFP_KERNEL ) ; if ( ! priv ) return - ENOMEM ; priv -> dev = dev ; priv -> sdrctl = syscon_regmap_lookup_by_compatible ( "altr,sdr-ctl" ) ; if ( IS_ERR ( priv -> sdrctl ) ) { dev_err ( dev , "regmap<S2SV_blank>for<S2SV_blank>altr,sdr-ctl<S2SV_blank>lookup<S2SV_blank>failed.\\n" ) ; return PTR_ERR ( priv -> sdrctl ) ; } sysmgr = syscon_regmap_lookup_by_compatible ( "altr,sys-mgr" ) ; <S2SV_StartBug> if ( IS_ERR ( priv -> sdrctl ) ) { <S2SV_EndBug> dev_err ( dev , "regmap<S2SV_blank>for<S2SV_blank>altr,sys-mgr<S2SV_blank>lookup<S2SV_blank>failed.\\n" ) ; return PTR_ERR ( sysmgr ) ; } regmap_read ( sysmgr , SYSMGR_ISWGRP_HANDOFF3 , & priv -> mask ) ; ret = fpga_bridge_register ( dev , F2S_BRIDGE_NAME , & altera_fpga2sdram_br_ops , priv ) ; if ( ret ) return ret ; dev_info ( dev , "driver<S2SV_blank>initialized<S2SV_blank>with<S2SV_blank>handoff<S2SV_blank>%08x\\n" , priv -> mask ) ; if ( ! of_property_read_u32 ( dev -> of_node , "bridge-enable" , & enable ) ) { if ( enable > 1 ) { dev_warn ( dev , "invalid<S2SV_blank>bridge-enable<S2SV_blank>%u<S2SV_blank>><S2SV_blank>1\\n" , enable ) ; } else { dev_info ( dev , "%s<S2SV_blank>bridge\\n" , ( enable ? "enabling" : "disabling" ) ) ; ret = _alt_fpga2sdram_enable_set ( priv , enable ) ; if ( ret ) { fpga_bridge_unregister ( & pdev -> dev ) ; return ret ; } } } return ret ; }
<S2SV_ModStart> ( IS_ERR ( sysmgr <S2SV_ModEnd> ) ) {
1,833
CWE-000 conv_resp convert_cdb2cstring ( const void * value , int size , SQLSMALLINT c_data_type , SQLPOINTER target_ptr , SQLLEN target_len , SQLLEN * str_len ) { conv_resp resp = CONV_YEAH ; switch ( c_data_type ) { case SQL_C_CHAR : case SQL_C_DEFAULT : my_strncpy_out ( ( char * ) target_ptr , value , target_len ) ; * str_len = size - 1 ; if ( size > target_len ) resp = CONV_TRUNCATED ; break ; case SQL_C_WCHAR : mbstowcs ( ( wchar_t * ) target_ptr , value , target_len / sizeof ( wchar_t ) - 1 ) ; * str_len = size - 1 ; if ( size > target_len ) resp = CONV_TRUNCATED ; break ; default : return CONV_IMPOSSIBLE ; } <S2SV_StartBug> return CONV_YEAH ; <S2SV_EndBug> }
<S2SV_ModStart> ; } return resp <S2SV_ModEnd> ; } <S2SV_null>
1,834
CWE-000 static int dev_cpu_callback ( struct notifier_block * nfb , unsigned long action , void * ocpu ) { struct sk_buff * * list_skb ; struct sk_buff * skb ; unsigned int cpu , oldcpu = ( unsigned long ) ocpu ; struct softnet_data * sd , * oldsd ; if ( action != CPU_DEAD && action != CPU_DEAD_FROZEN ) return NOTIFY_OK ; local_irq_disable ( ) ; cpu = smp_processor_id ( ) ; sd = & per_cpu ( softnet_data , cpu ) ; oldsd = & per_cpu ( softnet_data , oldcpu ) ; list_skb = & sd -> completion_queue ; while ( * list_skb ) list_skb = & ( * list_skb ) -> next ; * list_skb = oldsd -> completion_queue ; oldsd -> completion_queue = NULL ; if ( oldsd -> output_queue ) { * sd -> output_queue_tailp = oldsd -> output_queue ; sd -> output_queue_tailp = oldsd -> output_queue_tailp ; oldsd -> output_queue = NULL ; oldsd -> output_queue_tailp = & oldsd -> output_queue ; } <S2SV_StartBug> if ( ! list_empty ( & oldsd -> poll_list ) ) { <S2SV_EndBug> <S2SV_StartBug> list_splice_init ( & oldsd -> poll_list , & sd -> poll_list ) ; <S2SV_EndBug> <S2SV_StartBug> raise_softirq_irqoff ( NET_RX_SOFTIRQ ) ; <S2SV_EndBug> } raise_softirq_irqoff ( NET_TX_SOFTIRQ ) ; local_irq_enable ( ) ; while ( ( skb = __skb_dequeue ( & oldsd -> process_queue ) ) ) { netif_rx_internal ( skb ) ; input_queue_head_incr ( oldsd ) ; } <S2SV_StartBug> while ( ( skb = __skb_dequeue ( & oldsd -> input_pkt_queue ) ) ) { <S2SV_EndBug> netif_rx_internal ( skb ) ; input_queue_head_incr ( oldsd ) ; } return NOTIFY_OK ; }
<S2SV_ModStart> output_queue ; } while <S2SV_ModEnd> ( ! list_empty <S2SV_ModStart> ) ) { struct napi_struct * napi = list_first_entry <S2SV_ModEnd> ( & oldsd <S2SV_ModStart> -> poll_list , struct napi_struct , <S2SV_ModEnd> poll_list ) ; <S2SV_ModStart> poll_list ) ; list_del_init ( & napi -> poll_list ) ; if ( napi -> poll == process_backlog ) napi -> state = 0 ; else ____napi_schedule ( sd , napi ) ; } raise_softirq_irqoff ( <S2SV_ModEnd> NET_TX_SOFTIRQ ) ; <S2SV_ModStart> ( skb = skb_dequeue <S2SV_ModEnd> ( & oldsd
1,835
CWE-000 ngx_int_t ngx_rtmp_upstream_get_round_robin_peer ( ngx_peer_connection_t * pc , void * data ) { ngx_rtmp_upstream_rr_peer_data_t * rrp = data ; ngx_int_t rc ; ngx_uint_t i , n ; ngx_rtmp_upstream_rr_peer_t * peer ; ngx_rtmp_upstream_rr_peers_t * peers ; <S2SV_StartBug> ngx_log_debug1 ( NGX_LOG_DEBUG_HTTP , pc -> log , 0 , <S2SV_EndBug> "get<S2SV_blank>rr<S2SV_blank>peer,<S2SV_blank>try:<S2SV_blank>%ui" , pc -> tries ) ; pc -> cached = 0 ; pc -> connection = NULL ; peers = rrp -> peers ; ngx_rtmp_upstream_rr_peers_wlock ( peers ) ; if ( peers -> single ) { peer = peers -> peer ; if ( peer -> down ) { goto failed ; } if ( peer -> max_conns && peer -> conns >= peer -> max_conns ) { goto failed ; } rrp -> current = peer ; } else { peer = ngx_rtmp_upstream_get_peer ( rrp ) ; if ( peer == NULL ) { goto failed ; } <S2SV_StartBug> ngx_log_debug2 ( NGX_LOG_DEBUG_HTTP , pc -> log , 0 , <S2SV_EndBug> "get<S2SV_blank>rr<S2SV_blank>peer,<S2SV_blank>current:<S2SV_blank>%p<S2SV_blank>%i" , peer , peer -> current_weight ) ; } pc -> sockaddr = peer -> sockaddr ; pc -> socklen = peer -> socklen ; pc -> name = & peer -> name ; peer -> conns ++ ; ngx_rtmp_upstream_rr_peers_unlock ( peers ) ; return NGX_OK ; failed : if ( peers -> next ) { <S2SV_StartBug> ngx_log_debug0 ( NGX_LOG_DEBUG_HTTP , pc -> log , 0 , "backup<S2SV_blank>servers" ) ; <S2SV_EndBug> rrp -> peers = peers -> next ; n = ( rrp -> peers -> number + ( 8 * sizeof ( uintptr_t ) - 1 ) ) / ( 8 * sizeof ( uintptr_t ) ) ; for ( i = 0 ; i < n ; i ++ ) { rrp -> tried [ i ] = 0 ; } ngx_rtmp_upstream_rr_peers_unlock ( peers ) ; rc = ngx_rtmp_upstream_get_round_robin_peer ( pc , rrp ) ; if ( rc != NGX_BUSY ) { return rc ; } ngx_rtmp_upstream_rr_peers_wlock ( peers ) ; } ngx_rtmp_upstream_rr_peers_unlock ( peers ) ; pc -> name = peers -> name ; return NGX_BUSY ; }
<S2SV_ModStart> ; ngx_log_debug1 ( NGX_LOG_DEBUG_RTMP <S2SV_ModEnd> , pc -> <S2SV_ModStart> } ngx_log_debug2 ( NGX_LOG_DEBUG_RTMP <S2SV_ModEnd> , pc -> <S2SV_ModStart> { ngx_log_debug0 ( NGX_LOG_DEBUG_RTMP <S2SV_ModEnd> , pc ->
1,836
CWE-000 int main ( ) { <S2SV_StartBug> Byte * compr , * uncompr ; <S2SV_EndBug> uLong comprLen = 10000 * sizeof ( int ) ; uLong uncomprLen = comprLen ; compr = ( Byte * ) calloc ( ( uInt ) comprLen , 1 ) ; uncompr = ( Byte * ) calloc ( ( uInt ) uncomprLen , 1 ) ; volatile int ex ; test_deflate ( compr , comprLen ) ; for ( int len = 1 ; len < 1000 ; len ++ ) { test_inflate ( compr , comprLen , uncompr , uncomprLen , len ) ; } <S2SV_StartBug> } <S2SV_EndBug>
<S2SV_ModStart> ( ) { check ( run_case2 ( ) ) ; check ( run_case3 ( ) ) ; check ( run_case4 ( ) ) ; check ( run_case5 ( ) ) ; check ( run_case6 ( ) ) ; check ( run_case7 ( ) ) ; check ( run_case8 ( ) ) ; check ( run_case9 ( ) <S2SV_ModEnd> ) ; } <S2SV_ModStart> ) ; } <S2SV_ModEnd> <S2SV_null> <S2SV_null> <S2SV_null>
1,837
CWE-000 SYMBOL * detemplate ( SYMBOL * sym , FUNCTIONCALL * args , TYPE * atp ) <S2SV_StartBug> { <S2SV_EndBug> if ( sym -> templateLevel ) { if ( atp || args ) { BOOLEAN linked = FALSE ; if ( sym -> parentNameSpace && ! sym -> parentNameSpace -> value . i ) { LIST * list ; SYMBOL * ns = sym -> parentNameSpace ; linked = TRUE ; ns -> value . i ++ ; list = Alloc ( sizeof ( LIST ) ) ; list -> next = nameSpaceList ; list -> data = ns ; nameSpaceList = list ; ns -> nameSpaceValues -> next = globalNameSpace ; globalNameSpace = ns -> nameSpaceValues ; } if ( args && ! TemplateIntroduceArgs ( sym -> templateParams , args -> templateParams ) ) sym = NULL ; else if ( atp ) sym = TemplateDeduceArgsFromType ( sym , atp ) ; else if ( args -> ascall ) sym = TemplateDeduceArgsFromArgs ( sym , args ) ; else sym = TemplateDeduceWithoutArgs ( sym ) ; if ( linked ) { SYMBOL * sp = ( SYMBOL * ) nameSpaceList -> data ; sp -> value . i -- ; nameSpaceList = nameSpaceList -> next ; globalNameSpace = globalNameSpace -> next ; } } else { sym = NULL ; } } <S2SV_StartBug> return sym ; <S2SV_EndBug> }
<S2SV_ModStart> atp ) { inDeduceArgs ++ ; <S2SV_ModStart> ; } } inDeduceArgs -- ;
1,838
CWE-000 void init_idt ( ) { idt_descriptor . limit = sizeof ( idt ) - 1 ; <S2SV_StartBug> idt_descriptor . base = ( uint32_t ) idt ; <S2SV_EndBug> uint16_t selector = KCODE_SELECTOR ; uint8_t type_attr = 0b10001110 ; uint8_t user_type_attr = 0b11101110 ; for ( int i = 0 ; i < 256 ; i ++ ) { if ( i < 32 ) { idt_set_gate ( i , interrupt_handler_addresses [ i ] , KCODE_SELECTOR , <S2SV_StartBug> 0x10001110 , 0 ) ; <S2SV_EndBug> } else if ( i == INT_SYSCALL ) { idt_set_gate ( i , interrupt_handler_addresses [ INT_SYSCALL ] , KCODE_SELECTOR , <S2SV_StartBug> 0x11101110 , 0 ) ; <S2SV_EndBug> } else { idt_set_gate ( i , interrupt_handler_addresses [ i ] , KCODE_SELECTOR , <S2SV_StartBug> 0x10001110 , 0 ) ; <S2SV_EndBug> } } lidt ( & idt_descriptor ) ; }
<S2SV_ModStart> uint32_t ) idt <S2SV_ModEnd> ; for ( <S2SV_ModStart> , KCODE_SELECTOR , 0x8E <S2SV_ModEnd> , 0 ) <S2SV_ModStart> , KCODE_SELECTOR , 0xEE <S2SV_ModEnd> , 0 ) <S2SV_ModStart> , KCODE_SELECTOR , 0 <S2SV_ModEnd> , 0 )
1,839
CWE-000 main ( int argc , char * argv [ ] ) { if ( argc > 1 ) disk = argv [ 1 ] ; fd = open ( disk , O_RDONLY ) ; if ( fd < 0 ) { printf ( "open<S2SV_blank>%s<S2SV_blank>failed\\n" , disk ) ; exit ( 1 ) ; } inode ( ) ; printf ( "Before<S2SV_blank>get<S2SV_blank>line\\n" ) ; <S2SV_StartBug> getline ( name , 255 , stdin ) ; <S2SV_EndBug> printf ( "after<S2SV_blank>get<S2SV_blank>line" ) ; search ( ip , name ) ; }
<S2SV_ModStart> ; getline ( &
1,840
CWE-000 static int container_parse_envs ( struct hyper_exec * exec , char * json , jsmntok_t * toks ) { int i = 0 , j ; if ( toks [ i ] . type != JSMN_ARRAY ) { fprintf ( stdout , "encs<S2SV_blank>need<S2SV_blank>array\\n" ) ; return - 1 ; } exec -> envs = calloc ( toks [ i ] . size , sizeof ( * exec -> envs ) ) ; if ( exec -> envs == NULL ) { fprintf ( stderr , "allocate<S2SV_blank>memory<S2SV_blank>for<S2SV_blank>env<S2SV_blank>failed\\n" ) ; return - 1 ; } exec -> envs_num = toks [ i ] . size ; fprintf ( stdout , "envs<S2SV_blank>num<S2SV_blank>%d\\n" , exec -> envs_num ) ; i ++ ; for ( j = 0 ; j < exec -> envs_num ; j ++ ) { int i_env , next_env ; if ( toks [ i ] . type != JSMN_OBJECT ) { fprintf ( stdout , "env<S2SV_blank>array<S2SV_blank>need<S2SV_blank>object\\n" ) ; return - 1 ; } next_env = toks [ i ] . size ; i ++ ; for ( i_env = 0 ; i_env < next_env ; i_env ++ , i ++ ) { if ( json_token_streq ( json , & toks [ i ] , "env" ) ) { exec -> envs [ j ] . env = ( json_token_str ( json , & toks [ ++ i ] ) ) ; fprintf ( stdout , "envs<S2SV_blank>%d<S2SV_blank>env<S2SV_blank>%s\\n" , j , exec -> envs [ j ] . env ) ; } else if ( json_token_streq ( json , & toks [ i ] , "value" ) ) { exec -> envs [ j ] . value = ( json_token_str ( json , & toks [ ++ i ] ) ) ; fprintf ( stdout , "envs<S2SV_blank>%d<S2SV_blank>value<S2SV_blank>%s\\n" , j , exec -> envs [ j ] . value ) ; } else { <S2SV_StartBug> fprintf ( stdout , "get<S2SV_blank>unknown<S2SV_blank>section<S2SV_blank>%s<S2SV_blank>in<S2SV_blank>envs\\n" , <S2SV_EndBug> <S2SV_StartBug> json_token_str ( json , & toks [ i ] ) ) ; <S2SV_EndBug> return - 1 ; } } } return i ; }
<S2SV_ModStart> } else { char * buf = json_token_str ( json , & toks [ i ] ) ; <S2SV_ModStart> , "get<S2SV_blank>unknown<S2SV_blank>section<S2SV_blank>%s<S2SV_blank>in<S2SV_blank>envs\\n" , buf ) ; free ( buf <S2SV_ModEnd> ) ; return
1,841
CWE-000 enum ice_status ice_get_link_status ( struct ice_port_info * pi , bool * link_up ) { struct ice_phy_info * phy_info ; enum ice_status status = 0 ; <S2SV_StartBug> if ( ! pi ) <S2SV_EndBug> return ICE_ERR_PARAM ; phy_info = & pi -> phy ; if ( phy_info -> get_link_info ) { status = ice_update_link_info ( pi ) ; if ( status ) ice_debug ( pi -> hw , ICE_DBG_LINK , "get<S2SV_blank>link<S2SV_blank>status<S2SV_blank>error,<S2SV_blank>status<S2SV_blank>=<S2SV_blank>%d\\n" , status ) ; } * link_up = phy_info -> link_info . link_info & ICE_AQ_LINK_UP ; return status ; }
<S2SV_ModStart> ( ! pi || ! link_up
1,842
CWE-000 gboolean <S2SV_StartBug> mono_w32file_read ( gpointer handle , gpointer buffer , guint32 numbytes , guint32 * bytesread ) <S2SV_EndBug> { FileHandle * filehandle ; gboolean ret ; if ( ! mono_fdhandle_lookup_and_ref ( GPOINTER_TO_INT ( handle ) , ( MonoFDHandle * * ) & filehandle ) ) { mono_w32error_set_last ( ERROR_INVALID_HANDLE ) ; return FALSE ; } switch ( ( ( MonoFDHandle * ) filehandle ) -> type ) { case MONO_FDTYPE_FILE : <S2SV_StartBug> ret = file_read ( filehandle , buffer , numbytes , bytesread ) ; <S2SV_EndBug> break ; case MONO_FDTYPE_CONSOLE : ret = console_read ( filehandle , buffer , numbytes , bytesread ) ; break ; case MONO_FDTYPE_PIPE : ret = pipe_read ( filehandle , buffer , numbytes , bytesread ) ; break ; default : mono_w32error_set_last ( ERROR_INVALID_HANDLE ) ; mono_fdhandle_unref ( ( MonoFDHandle * ) filehandle ) ; return FALSE ; } mono_fdhandle_unref ( ( MonoFDHandle * ) filehandle ) ; return ret ; }
<S2SV_ModStart> guint32 * bytesread , gint32 * win32error ) { return mono_w32file_read_or_write ( TRUE , handle <S2SV_ModEnd> , buffer , <S2SV_ModStart> numbytes , bytesread , win32error ) <S2SV_ModEnd> ; } <S2SV_null>
1,843
CWE-000 int inicbufs ( VOID ) { int i , num = AC . cbufList . num ; CBUF * C = cbuf ; for ( i = 0 ; i < num ; i ++ , C ++ ) { if ( C -> Buffer == 0 ) break ; } if ( i >= num ) C = ( CBUF * ) FromList ( & AC . cbufList ) ; else num = i ; C -> BufferSize = 2000 ; <S2SV_StartBug> C -> Buffer = ( WORD * ) Malloc1 ( C -> BufferSize * sizeof ( WORD ) , "compiler<S2SV_blank>buffer" ) ; <S2SV_EndBug> C -> Pointer = C -> Buffer ; C -> Top = C -> Buffer + C -> BufferSize ; C -> maxlhs = 10 ; <S2SV_StartBug> C -> lhs = ( WORD * * ) Malloc1 ( C -> maxlhs * sizeof ( WORD * ) , "compiler<S2SV_blank>buffer" ) ; <S2SV_EndBug> C -> numlhs = 0 ; C -> mnumlhs = 0 ; C -> maxrhs = 25 ; <S2SV_StartBug> C -> rhs = ( WORD * * ) Malloc1 ( C -> maxrhs * ( sizeof ( WORD * ) + 2 * sizeof ( LONG ) + 2 * sizeof ( WORD ) ) , "compiler<S2SV_blank>buffer" ) ; <S2SV_EndBug> C -> CanCommu = ( LONG * ) ( C -> rhs + C -> maxrhs ) ; C -> NumTerms = C -> CanCommu + C -> maxrhs ; C -> numdum = ( WORD * ) ( C -> NumTerms + C -> maxrhs ) ; C -> dimension = C -> numdum + C -> maxrhs ; C -> numrhs = 0 ; C -> mnumrhs = 0 ; C -> rhs [ 0 ] = C -> rhs [ 1 ] = C -> Pointer ; C -> boomlijst = 0 ; RedoTree ( C , C -> maxrhs ) ; ClearTree ( num ) ; return ( num ) ; }
<S2SV_ModStart> WORD ) , "compiler<S2SV_blank>buffer-1" <S2SV_ModEnd> ) ; C <S2SV_ModStart> * ) , "compiler<S2SV_blank>buffer-2" <S2SV_ModEnd> ) ; C <S2SV_ModStart> ) ) , "compiler<S2SV_blank>buffer-3" <S2SV_ModEnd> ) ; C
1,844
CWE-000 VOID CalculateResourceAperture ( IN PCI_RESOURCE_NODE * Bridge ) { UINT64 Aperture [ 2 ] ; LIST_ENTRY * CurrentLink ; PCI_RESOURCE_NODE * Node ; if ( Bridge == NULL ) { return ; } if ( Bridge -> ResType == PciBarTypeIo16 ) { CalculateApertureIo16 ( Bridge ) ; return ; } Aperture [ PciResUsageTypical ] = 0 ; Aperture [ PciResUsagePadding ] = 0 ; for ( CurrentLink = GetFirstNode ( & Bridge -> ChildList ) ; ! IsNull ( & Bridge -> ChildList , CurrentLink ) ; CurrentLink = GetNextNode ( & Bridge -> ChildList , CurrentLink ) ) { Node = RESOURCE_NODE_FROM_LINK ( CurrentLink ) ; ASSERT ( ( Node -> ResourceUsage == PciResUsageTypical ) || ( Node -> ResourceUsage == PciResUsagePadding ) ) ; ASSERT ( Node -> ResourceUsage < ARRAY_SIZE ( Aperture ) ) ; Node -> Offset = ALIGN_VALUE ( Aperture [ Node -> ResourceUsage ] , Node -> Alignment + 1 ) ; Aperture [ Node -> ResourceUsage ] = Node -> Offset + Node -> Length ; } <S2SV_StartBug> CurrentLink = Bridge -> ChildList . ForwardLink ; <S2SV_EndBug> if ( CurrentLink != & Bridge -> ChildList ) { Node = RESOURCE_NODE_FROM_LINK ( CurrentLink ) ; if ( Node -> Alignment > Bridge -> Alignment ) { Bridge -> Alignment = Node -> Alignment ; } } <S2SV_StartBug> Aperture [ PciResUsageTypical ] = ALIGN_VALUE ( Aperture [ PciResUsageTypical ] , Bridge -> Alignment + 1 ) ; <S2SV_EndBug> Aperture [ PciResUsagePadding ] = ALIGN_VALUE ( Aperture [ PciResUsagePadding ] , Bridge -> Alignment + 1 ) ; Bridge -> Length = MAX ( Aperture [ PciResUsageTypical ] , Aperture [ PciResUsagePadding ] ) ; }
<S2SV_ModStart> Length ; } Aperture [ PciResUsageTypical ] = ALIGN_VALUE ( Aperture [ PciResUsageTypical ] , Bridge -> Alignment + 1 ) ; Aperture [ PciResUsagePadding ] = ALIGN_VALUE ( Aperture [ PciResUsagePadding ] , Bridge -> Alignment + 1 ) ; Bridge -> Length = MAX ( Aperture [ PciResUsageTypical ] , Aperture [ PciResUsagePadding ] ) ; <S2SV_ModStart> ; } } <S2SV_ModEnd> } <S2SV_null> <S2SV_null>
1,845
CWE-000 int qta_rmt_enqueue_policy ( struct rmt_ps * ps , struct rmt_n1_port * n1_port , struct pdu * pdu ) { struct qta_queue_set * qset ; struct q_qos * q ; int i ; qos_id_t qos_id ; const struct pci * pci ; struct q_entry * entry ; uint_t mlength ; uint_t mbacklog ; uint_t w ; if ( ! ps || ! n1_port || ! pdu ) { LOG_ERR ( "Wrong<S2SV_blank>input<S2SV_blank>parameters<S2SV_blank>for<S2SV_blank>" "rmt_enqueu_scheduling_policy_tx" ) ; return RMT_PS_ENQ_ERR ; } pci = pdu_pci_get_ro ( pdu ) ; qos_id = pci_qos_id ( pci ) ; qset = n1_port -> rmt_ps_queues ; q = qta_q_qos_find ( qset , qos_id ) ; LOG_DBG ( "Enqueueing<S2SV_blank>for<S2SV_blank>QoS<S2SV_blank>id<S2SV_blank>%u" , qos_id ) ; LOG_DBG ( "First<S2SV_blank>of<S2SV_blank>all,<S2SV_blank>Policer/Shaper" ) ; if ( ! q ) { LOG_ERR ( "No<S2SV_blank>queue<S2SV_blank>for<S2SV_blank>QoS<S2SV_blank>id<S2SV_blank>%u,<S2SV_blank>dropping<S2SV_blank>PDU" , qos_id ) ; pdu_destroy ( pdu ) ; return RMT_PS_ENQ_ERR ; } mlength = q -> ps . config . abs_max_length ; mbacklog = q -> ps . config . max_backlog * q -> ps . config . rate ; q -> ps . length ++ ; if ( mlength && q -> ps . length > mlength ) { LOG_INFO ( "Length<S2SV_blank>exceeded<S2SV_blank>for<S2SV_blank>QoS<S2SV_blank>id<S2SV_blank>%u,<S2SV_blank>dropping<S2SV_blank>PDU" , qos_id ) ; pdu_destroy ( pdu ) ; q -> ps . length -- ; q -> dropped ++ ; return RMT_PS_ENQ_DROP ; } w = ( int ) pdu_len ( pdu ) ; q -> ps . backlog += w ; if ( mbacklog && q -> ps . backlog > mbacklog ) { LOG_INFO ( "Backlog<S2SV_blank>exceeded<S2SV_blank>for<S2SV_blank>QoS<S2SV_blank>id<S2SV_blank>%u,<S2SV_blank>dropping<S2SV_blank>PDU" , qos_id ) ; q -> dropped ++ ; q -> ps . length -- ; q -> ps . backlog -= w ; pdu_destroy ( pdu ) ; return RMT_PS_ENQ_DROP ; } q -> handled ++ ; if ( q -> abs_th < ( qset -> occupation + 1 ) ) { LOG_DBG ( "Dropped<S2SV_blank>PDU:<S2SV_blank>abs_th<S2SV_blank>exceeded<S2SV_blank>%u" , qset -> occupation ) ; q -> dropped ++ ; q -> ps . length -- ; q -> ps . backlog -= w ; pdu_destroy ( pdu ) ; return RMT_PS_ENQ_DROP ; } get_random_bytes ( & i , sizeof ( i ) ) ; i = i % NORM_PROB ; if ( ( q -> th < ( qset -> occupation + 1 ) ) && ( q -> drop_prob > i ) ) { <S2SV_StartBug> LOG_DBG ( "Dropped<S2SV_blank>PDU:<S2SV_blank>th<S2SV_blank>exceeded<S2SV_blank>%u" , occupation ) ; <S2SV_EndBug> q -> dropped ++ ; q -> ps . length -- ; q -> ps . backlog -= w ; pdu_destroy ( pdu ) ; return RMT_PS_ENQ_DROP ; } entry = rkzalloc ( sizeof ( * entry ) , GFP_ATOMIC ) ; if ( ! entry ) { LOG_ERR ( "Failed<S2SV_blank>to<S2SV_blank>enqueue" ) ; q -> dropped ++ ; q -> ps . length -- ; q -> ps . backlog -= w ; pdu_destroy ( pdu ) ; return RMT_PS_ENQ_ERR ; } entry -> data = pdu ; entry -> qqos = q ; entry -> w = w ; INIT_LIST_HEAD ( & entry -> next ) ; list_add ( & entry -> next , & q -> qta_q -> list_q_entry ) ; qset -> occupation ++ ; LOG_DBG ( "PDU<S2SV_blank>enqueued" ) ; return RMT_PS_ENQ_SCHED ; }
<S2SV_ModStart> ( "Dropped<S2SV_blank>PDU:<S2SV_blank>th<S2SV_blank>exceeded<S2SV_blank>%u" , qset ->
1,846
CWE-000 int peer_local_as_unset ( struct peer * peer ) { struct peer_group * group ; struct listnode * node , * nnode ; if ( peer_group_active ( peer ) ) return BGP_ERR_INVALID_FOR_PEER_GROUP_MEMBER ; if ( ! peer -> change_local_as ) return 0 ; peer -> change_local_as = 0 ; UNSET_FLAG ( peer -> flags , PEER_FLAG_LOCAL_AS_NO_PREPEND ) ; UNSET_FLAG ( peer -> flags , PEER_FLAG_LOCAL_AS_REPLACE_AS ) ; if ( ! CHECK_FLAG ( peer -> sflags , PEER_STATUS_GROUP ) ) { <S2SV_StartBug> if ( peer -> status == Established ) <S2SV_EndBug> { peer -> last_reset = PEER_DOWN_LOCAL_AS_CHANGE ; bgp_notify_send ( peer , BGP_NOTIFY_CEASE , BGP_NOTIFY_CEASE_CONFIG_CHANGE ) ; } else BGP_EVENT_ADD ( peer , BGP_Stop ) ; return 0 ; } group = peer -> group ; for ( ALL_LIST_ELEMENTS ( group -> peer , node , nnode , peer ) ) { peer -> change_local_as = 0 ; UNSET_FLAG ( peer -> flags , PEER_FLAG_LOCAL_AS_NO_PREPEND ) ; UNSET_FLAG ( peer -> flags , PEER_FLAG_LOCAL_AS_REPLACE_AS ) ; <S2SV_StartBug> if ( peer -> status == Established ) <S2SV_EndBug> { peer -> last_reset = PEER_DOWN_LOCAL_AS_CHANGE ; bgp_notify_send ( peer , BGP_NOTIFY_CEASE , BGP_NOTIFY_CEASE_CONFIG_CHANGE ) ; } else BGP_EVENT_ADD ( peer , BGP_Stop ) ; } return 0 ; }
<S2SV_ModStart> { if ( BGP_IS_VALID_STATE_FOR_NOTIF ( <S2SV_ModStart> peer -> status ) <S2SV_ModEnd> ) { peer <S2SV_ModStart> ; if ( BGP_IS_VALID_STATE_FOR_NOTIF ( <S2SV_ModStart> peer -> status ) <S2SV_ModEnd> ) { peer
1,847
CWE-000 void SYS_Init ( void ) { SYS_UnlockReg ( ) ; CLK_EnableXtalRC ( CLK_PWRCTL_HXTEN_Msk ) ; CLK_WaitClockReady ( CLK_STATUS_HXTSTB_Msk ) ; CLK_SetHCLK ( CLK_CLKSEL0_HCLKSEL_HXT , CLK_CLKDIV0_HCLK ( 1 ) ) ; CLK -> PLLCTL |= CLK_PLLCTL_PD_Msk ; CLK -> PLLCTL = PLLCON_SETTING ; CLK_WaitClockReady ( CLK_STATUS_PLLSTB_Msk ) ; CLK_SetHCLK ( CLK_CLKSEL0_HCLKSEL_PLL , CLK_CLKDIV0_HCLK ( 1 ) ) ; CLK_EnableModuleClock ( UART0_MODULE ) ; CLK_EnableModuleClock ( ADC_MODULE ) ; CLK_EnableModuleClock ( PDMA_MODULE ) ; CLK_SetModuleClock ( UART0_MODULE , CLK_CLKSEL1_UARTSEL_HXT , CLK_CLKDIV0_UART ( 1 ) ) ; CLK_SetModuleClock ( ADC_MODULE , CLK_CLKSEL1_ADCSEL_PCLK , CLK_CLKDIV0_ADC ( 5 ) ) ; SystemCoreClockUpdate ( ) ; <S2SV_StartBug> SYS -> GPG_MFPL = SYS_GPG_MFPL_PG1MFP_UART0_RXD | SYS_GPG_MFPL_PG2MFP_UART0_TXD ; <S2SV_EndBug> <S2SV_StartBug> SYS -> GPC_MFPL = ( SYS -> GPC_MFPL & ~ SYS_GPC_MFPL_PC5MFP_Msk ) | SYS_GPC_MFPL_PC5MFP_CLK_O ; <S2SV_EndBug> <S2SV_StartBug> SYS -> GPE_MFPL = ( SYS -> GPE_MFPL & ~ SYS_GPE_MFPL_PE0MFP_Msk ) | SYS_GPE_MFPL_PE0MFP_ADC0_0 ; <S2SV_EndBug> PE -> DINOFF = PE -> DINOFF | GPIO_DINOFF_DINOFF0_Msk ; SYS_ResetModule ( ADC_RST ) ; SYS_ResetModule ( PDMA_RST ) ; SYS -> VREFCTL |= SYS_VREFCTL_VREF_AVDD ; SYS_LockReg ( ) ; }
<S2SV_ModStart> SYS -> GPG_MFPL |= <S2SV_ModEnd> SYS_GPG_MFPL_PG1MFP_UART0_RXD | SYS_GPG_MFPL_PG2MFP_UART0_TXD <S2SV_ModStart> SYS -> GPC_MFPL |= <S2SV_ModEnd> ( SYS -> <S2SV_ModStart> SYS -> GPE_MFPL |= <S2SV_ModEnd> ( SYS ->
1,848
CWE-000 static const char * selections_minus ( Vis * vis , const char * keys , const Arg * arg ) { <S2SV_StartBug> Text * txt = vis_text ( vis ) ; <S2SV_EndBug> View * view = vis_view ( vis ) ; enum VisMark mark = vis_mark_used ( vis ) ; Array a = view_selections_get_all ( view ) ; <S2SV_StartBug> Array b = vis_mark_get ( vis , mark ) ; <S2SV_EndBug> Array sel ; array_init_from ( & sel , & a ) ; Array b_complement ; array_init_from ( & b_complement , & b ) ; Filerange universe = text_object_entire ( txt , 0 ) ; complement ( & b_complement , & b , & universe ) ; intersect ( & sel , & a , & b_complement ) ; selections_set ( vis , view , & sel ) ; vis_cancel ( vis ) ; array_release ( & a ) ; array_release ( & b ) ; array_release ( & b_complement ) ; array_release ( & sel ) ; return keys ; }
<S2SV_ModStart> txt = vis_text ( vis ) ; Win * win = vis_window <S2SV_ModStart> = vis_mark_get ( win <S2SV_ModEnd> , mark )
1,849
CWE-000 int main ( int argc , char * * argv ) { if ( argc < 2 ) { exit ( EXIT_FAILURE ) ; } struct sigaction act ; act . sa_flags = SA_SIGINFO ; sigemptyset ( & act . sa_mask ) ; act . sa_sigaction = sigchld_handler ; sigaction ( SIGCHLD , & act , NULL ) ; char * cmd ; char * args [ argc ] ; loginfo_t * loginfo ; int pipes [ 2 ] ; char * buffer = NULL ; ssize_t readb , writtenb ; char * env_buffer ; FILE * proc_infof ; int child_exit_status ; catch_args ( argc , argv , args ) ; cmd = my_malloc ( strlen ( args [ 0 ] ) ) ; strcpy ( cmd , args [ 0 ] ) ; loginfo = malloc ( sizeof ( loginfo_t ) ) ; loginfo_init ( loginfo ) ; pipes [ READ ] = - 1 ; pipes [ WRITE ] = - 1 ; loginfo -> out_pathname = getenv ( EV_STDOUTFILE ) ; loginfo -> err_pathname = getenv ( EV_STDERRFILE ) ; loginfo -> proc_info_pathname = getenv ( EV_PINFO_OUTFILE ) ; loginfo -> pipe_in = atoi ( getenv ( EV_PIPE_IN ) ) ; loginfo -> pipe_out = atoi ( getenv ( EV_PIPE_OUT ) ) ; if ( loginfo -> pipe_in == - 1 ) { loginfo -> pipe_in = STDIN_FILENO ; } if ( loginfo -> pipe_out == - 1 ) { loginfo -> pipe_out = STDOUT_FILENO ; } if ( loginfo -> err_pathname == NULL ) { link_pipe ( STDERR_FILENO , STDOUT_FILENO ) ; } if ( loginfo -> err_pathname != NULL ) { loginfo -> errf = open ( loginfo -> err_pathname , O_WRONLY | O_CREAT , 0755 ) ; link_pipe ( STDERR_FILENO , loginfo -> errf ) ; } if ( loginfo -> out_pathname == NULL ) { link_pipe ( STDOUT_FILENO , loginfo -> pipe_out ) ; } if ( loginfo -> out_pathname != NULL ) { if ( pipe ( pipes ) == - 1 ) { fprintf ( stdout , "cannot<S2SV_blank>create<S2SV_blank>pipe\\n" ) ; free_resources ( cmd , args , argc , buffer , loginfo ) ; exit ( EXIT_FAILURE ) ; } buffer = my_malloc ( CMD_OUT_BUFF_SIZE ) ; if ( buffer == NULL ) { fprintf ( stdout , "cannot<S2SV_blank>allocate<S2SV_blank>output<S2SV_blank>buffer\\n" ) ; free_resources ( cmd , args , argc , buffer , loginfo ) ; exit ( EXIT_FAILURE ) ; } loginfo -> outf = open ( loginfo -> out_pathname , O_WRONLY | O_CREAT , 0755 ) ; if ( loginfo -> outf == - 1 ) { free_resources ( cmd , args , argc , buffer , loginfo ) ; exit ( EXIT_FAILURE ) ; } pid_t pid = fork ( ) ; if ( pid > 0 ) { close ( pipes [ WRITE ] ) ; while ( proc_is_running ) { readb = read ( pipes [ READ ] , buffer , CMD_OUT_BUFF_SIZE ) ; if ( readb > 0 ) { writtenb = write ( loginfo -> outf , buffer , ( size_t ) readb ) ; writtenb = write ( loginfo -> pipe_out , buffer , ( size_t ) readb ) ; } } while ( ( readb = read ( pipes [ READ ] , buffer , CMD_OUT_BUFF_SIZE ) ) > 0 ) { writtenb = write ( loginfo -> outf , buffer , ( size_t ) readb ) ; writtenb = write ( loginfo -> pipe_out , buffer , ( size_t ) readb ) ; } close ( pipes [ READ ] ) ; close ( loginfo -> pipe_in ) ; close ( loginfo -> pipe_out ) ; } else if ( pid == 0 ) { close ( pipes [ READ ] ) ; link_pipe ( STDIN_FILENO , loginfo -> pipe_in ) ; link_pipe ( STDOUT_FILENO , pipes [ WRITE ] ) ; execvp ( cmd , args ) ; <S2SV_StartBug> free_resources ( cmd , args , argc , buffer , loginfo ) ; <S2SV_EndBug> exit ( EXIT_FAILURE ) ; } else { free_resources ( cmd , args , argc , buffer , loginfo ) ; exit ( EXIT_FAILURE ) ; } } if ( loginfo -> proc_info_pathname != NULL ) { proc_infof = fopen ( loginfo -> proc_info_pathname , "w" ) ; if ( proc_infof == NULL ) { free_resources ( cmd , args , argc , buffer , loginfo ) ; exit ( EXIT_FAILURE ) ; } env_buffer = getenv ( EV_PID ) ; if ( env_buffer == NULL ) { fprintf ( proc_infof , "%-15s<S2SV_blank>%i\\n" , FRM_PID , ( int ) pinfo -> si_pid ) ; } env_buffer = getenv ( EV_UID ) ; if ( env_buffer == NULL ) { fprintf ( proc_infof , "%-15s<S2SV_blank>%i\\n" , FRM_UID , ( int ) pinfo -> si_uid ) ; } env_buffer = getenv ( EV_STATUS ) ; if ( env_buffer == NULL ) { fprintf ( proc_infof , "%-15s<S2SV_blank>%i\\n" , FRM_STATUS , pinfo -> si_status ) ; } env_buffer = getenv ( EV_ERRNO ) ; if ( env_buffer == NULL ) { fprintf ( proc_infof , "%-15s<S2SV_blank>%i\\n" , FRM_ERRNO , pinfo -> si_errno ) ; } fflush ( proc_infof ) ; fclose ( proc_infof ) ; child_exit_status = ( int ) pinfo -> si_status ; } if ( pipes [ READ ] != - 1 ) { close ( pipes [ READ ] ) ; } free_resources ( cmd , args , argc , buffer , loginfo ) ; exit ( child_exit_status ) ; }
<S2SV_ModStart> args ) ; fprintf ( stdout , "Error:<S2SV_blank>command<S2SV_blank>not<S2SV_blank>found.\\n" ) ;
1,850
CWE-000 static void BattleAICmd_if_has_move ( void ) { s32 i ; const u16 * movePtr = ( u16 * ) ( gAIScriptPtr + 2 ) ; switch ( gAIScriptPtr [ 1 ] ) { case AI_USER : <S2SV_StartBug> for ( i = 0 ; i < 4 ; i ++ ) <S2SV_EndBug> { if ( gBattleMons [ sBattler_AI ] . moves [ i ] == * movePtr ) break ; } <S2SV_StartBug> if ( i == 4 ) <S2SV_EndBug> gAIScriptPtr += 8 ; else gAIScriptPtr = T1_READ_PTR ( gAIScriptPtr + 4 ) ; break ; case AI_USER_PARTNER : if ( gBattleMons [ sBattler_AI ^ BIT_FLANK ] . hp == 0 ) { gAIScriptPtr += 8 ; break ; } else { <S2SV_StartBug> for ( i = 0 ; i < 4 ; i ++ ) <S2SV_EndBug> { if ( gBattleMons [ sBattler_AI ^ BIT_FLANK ] . moves [ i ] == * movePtr ) break ; } } <S2SV_StartBug> if ( i == 4 ) <S2SV_EndBug> gAIScriptPtr += 8 ; else gAIScriptPtr = T1_READ_PTR ( gAIScriptPtr + 4 ) ; break ; case AI_TARGET : case AI_TARGET_PARTNER : <S2SV_StartBug> for ( i = 0 ; i < 4 ; i ++ ) <S2SV_EndBug> { if ( BATTLE_HISTORY -> usedMoves [ gBattlerTarget ] . moves [ i ] == * movePtr ) break ; } <S2SV_StartBug> if ( i == 4 ) <S2SV_EndBug> gAIScriptPtr += 8 ; else gAIScriptPtr = T1_READ_PTR ( gAIScriptPtr + 4 ) ; break ; } }
<S2SV_ModStart> ; i < MAX_MON_MOVES <S2SV_ModEnd> ; i ++ <S2SV_ModStart> ( i == MAX_MON_MOVES <S2SV_ModEnd> ) gAIScriptPtr += <S2SV_ModStart> ; i < MAX_MON_MOVES <S2SV_ModEnd> ; i ++ <S2SV_ModStart> ( i == MAX_MON_MOVES ) gAIScriptPtr += 8 ; else gAIScriptPtr = T1_READ_PTR ( gAIScriptPtr + 4 ) <S2SV_ModEnd> ; break ; <S2SV_ModStart> ; i < MAX_MON_MOVES <S2SV_ModEnd> ; i ++ <S2SV_ModStart> ( i == MAX_MON_MOVES ) gAIScriptPtr += 8 ; else gAIScriptPtr = T1_READ_PTR ( gAIScriptPtr + 4 ) <S2SV_ModEnd> ; break ;
1,851
CWE-000 void client_send_code ( struct Client * client , int code , const char * message ) { <S2SV_StartBug> char * buffer = client -> server_ptr -> buffer_control ; <S2SV_EndBug> size_t len = sprintf ( buffer , "%d<S2SV_blank>%s\\r\\n" , code , message ) ; if ( send ( client -> socket_control , buffer , len , 0 ) < 0 ) { client_socket_disconnect ( client , client -> socket_control ) ; server_pollfds_remove ( client -> server_ptr , client -> socket_control ) ; server_client_remove ( client -> server_ptr , client -> socket_control ) ; } }
<S2SV_ModStart> buffer = client <S2SV_ModEnd> -> buffer_control ;
1,852
CWE-000 void deleteProcess ( ROW * row , ROW * prevRow ) { if ( E . cx > 0 ) { deletechar ( E . cx + E . coloff , row ) ; } else if ( E . cy > 1 ) { prevRow -> chars = resizeString ( prevRow -> chars , prevRow -> length + row -> length - 1 ) ; memmove ( prevRow -> chars + prevRow -> length - 1 , row -> chars , row -> length ) ; <S2SV_StartBug> int initLength = prevRow -> length ; <S2SV_EndBug> prevRow -> length = prevRow -> length + row -> length - 1 ; row -> chars = realloc ( row -> chars , 1 ) ; <S2SV_StartBug> if ( prevRow -> length > E . screen_cols ) { <S2SV_EndBug> E . coloff = prevRow -> length - E . screen_cols ; E . cx = E . screen_cols - row -> length ; } else { E . cx = initLength - 1 ; } int i ; for ( i = E . row_index ; i < E . numrows - 1 ; i ++ ) { E . row [ i ] . chars = resizeString ( E . row [ i ] . chars , E . row [ i + 1 ] . length ) ; memmove ( E . row [ i ] . chars , E . row [ i + 1 ] . chars , E . row [ i + 1 ] . length ) ; E . row [ i ] . length = E . row [ i + 1 ] . length ; } E . row_index -- ; E . numrows -- ; E . cy -- ; } }
<S2SV_ModStart> length ) ; if ( prevRow -> length - 1 > E . screen_cols ) E . coloff = prevRow -> length - E . screen_cols ; E . cx = prevRow -> length - E . coloff - 1 <S2SV_ModEnd> ; prevRow -> <S2SV_ModStart> 1 ) ; <S2SV_ModEnd> int i ;
1,853
CWE-000 static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { FMVCContext * s = avctx -> priv_data ; GetByteContext * gb = & s -> gb ; PutByteContext * pb = & s -> pb ; AVFrame * frame = data ; int ret , y , x ; if ( ( ret = ff_get_buffer ( avctx , frame , 0 ) ) < 0 ) return ret ; bytestream2_init ( gb , avpkt -> data , avpkt -> size ) ; bytestream2_skip ( gb , 2 ) ; frame -> key_frame = ! ! bytestream2_get_le16 ( gb ) ; frame -> pict_type = frame -> key_frame ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P ; if ( frame -> key_frame ) { const uint8_t * src ; int type , size ; uint8_t * dst ; type = bytestream2_get_le16 ( gb ) ; size = bytestream2_get_le16 ( gb ) ; if ( size > bytestream2_get_bytes_left ( gb ) ) return AVERROR_INVALIDDATA ; bytestream2_init_writer ( pb , s -> buffer , s -> buffer_size ) ; if ( type == 1 ) { decode_type1 ( gb , pb ) ; } else if ( type == 2 ) { decode_type2 ( gb , pb ) ; } else { avpriv_report_missing_feature ( avctx , "compression<S2SV_blank>%d" , type ) ; return AVERROR_PATCHWELCOME ; } src = s -> buffer ; dst = frame -> data [ 0 ] + ( avctx -> height - 1 ) * frame -> linesize [ 0 ] ; for ( y = 0 ; y < avctx -> height ; y ++ ) { memcpy ( dst , src , avctx -> width * s -> bpp ) ; dst -= frame -> linesize [ 0 ] ; src += s -> stride * 4 ; } } else { int block , nb_blocks , type , k , l ; uint8_t * ssrc , * ddst ; const uint32_t * src ; uint32_t * dst ; for ( block = 0 ; block < s -> nb_blocks ; block ++ ) s -> blocks [ block ] . xor = 0 ; nb_blocks = bytestream2_get_le16 ( gb ) ; if ( nb_blocks > s -> nb_blocks ) return AVERROR_INVALIDDATA ; bytestream2_init_writer ( pb , s -> pbuffer , s -> pbuffer_size ) ; type = bytestream2_get_le16 ( gb ) ; for ( block = 0 ; block < nb_blocks ; block ++ ) { int size , offset , start = 0 ; offset = bytestream2_get_le16 ( gb ) ; <S2SV_StartBug> if ( offset > s -> nb_blocks ) <S2SV_EndBug> return AVERROR_INVALIDDATA ; size = bytestream2_get_le16 ( gb ) ; if ( size > bytestream2_get_bytes_left ( gb ) ) return AVERROR_INVALIDDATA ; start = bytestream2_tell_p ( pb ) ; if ( type == 1 ) { decode_type1 ( gb , pb ) ; } else if ( type == 2 ) { decode_type2 ( gb , pb ) ; } else { avpriv_report_missing_feature ( avctx , "compression<S2SV_blank>%d" , type ) ; return AVERROR_PATCHWELCOME ; } if ( s -> blocks [ offset ] . size * 4 != bytestream2_tell_p ( pb ) - start ) return AVERROR_INVALIDDATA ; s -> blocks [ offset ] . xor = 1 ; } src = ( const uint32_t * ) s -> pbuffer ; dst = ( uint32_t * ) s -> buffer ; for ( block = 0 , y = 0 ; y < s -> yb ; y ++ ) { int block_h = s -> blocks [ block ] . h ; uint32_t * rect = dst ; for ( x = 0 ; x < s -> xb ; x ++ ) { int block_w = s -> blocks [ block ] . w ; uint32_t * row = dst ; block_h = s -> blocks [ block ] . h ; if ( s -> blocks [ block ] . xor ) { for ( k = 0 ; k < block_h ; k ++ ) { uint32_t * column = dst ; for ( l = 0 ; l < block_w ; l ++ ) { * dst ++ ^= * src ++ ; } dst = & column [ s -> stride ] ; } } dst = & row [ block_w ] ; ++ block ; } dst = & rect [ block_h * s -> stride ] ; } ssrc = s -> buffer ; ddst = frame -> data [ 0 ] + ( avctx -> height - 1 ) * frame -> linesize [ 0 ] ; for ( y = 0 ; y < avctx -> height ; y ++ ) { memcpy ( ddst , ssrc , avctx -> width * s -> bpp ) ; ddst -= frame -> linesize [ 0 ] ; ssrc += s -> stride * 4 ; } } * got_frame = 1 ; return avpkt -> size ; }
<S2SV_ModStart> if ( offset >= <S2SV_ModEnd> s -> nb_blocks
1,854
CWE-000 static void ad_initialize_port ( struct port * port , int lacp_fast ) { static const struct port_params tmpl = { . system_priority = 0xffff , . key = 1 , . port_number = 1 , . port_priority = 0xff , . port_state = 1 , } ; static const struct lacpdu lacpdu = { . subtype = 0x01 , . version_number = 0x01 , . tlv_type_actor_info = 0x01 , . actor_information_length = 0x14 , . tlv_type_partner_info = 0x02 , . partner_information_length = 0x14 , . tlv_type_collector_info = 0x03 , . collector_information_length = 0x10 , . collector_max_delay = htons ( AD_COLLECTOR_MAX_DELAY ) , } ; if ( port ) { port -> actor_port_number = 1 ; port -> actor_port_priority = 0xff ; <S2SV_StartBug> port -> actor_system = null_mac_addr ; <S2SV_EndBug> port -> actor_system_priority = 0xffff ; port -> actor_port_aggregator_identifier = 0 ; port -> ntt = false ; port -> actor_admin_port_key = 1 ; port -> actor_oper_port_key = 1 ; port -> actor_admin_port_state = AD_STATE_AGGREGATION | AD_STATE_LACP_ACTIVITY ; port -> actor_oper_port_state = AD_STATE_AGGREGATION | AD_STATE_LACP_ACTIVITY ; if ( lacp_fast ) port -> actor_oper_port_state |= AD_STATE_LACP_TIMEOUT ; memcpy ( & port -> partner_admin , & tmpl , sizeof ( tmpl ) ) ; memcpy ( & port -> partner_oper , & tmpl , sizeof ( tmpl ) ) ; port -> is_enabled = true ; port -> sm_vars = 0x3 ; port -> sm_rx_state = 0 ; port -> sm_rx_timer_counter = 0 ; port -> sm_periodic_state = 0 ; port -> sm_periodic_timer_counter = 0 ; port -> sm_mux_state = 0 ; port -> sm_mux_timer_counter = 0 ; port -> sm_tx_state = 0 ; port -> sm_tx_timer_counter = 0 ; port -> slave = NULL ; port -> aggregator = NULL ; port -> next_port_in_aggregator = NULL ; port -> transaction_id = 0 ; memcpy ( & port -> lacpdu , & lacpdu , sizeof ( lacpdu ) ) ; } }
<S2SV_ModStart> = 0xff ; eth_zero_addr ( <S2SV_ModStart> port -> actor_system . mac_addr_value ) <S2SV_ModEnd> ; port ->
1,855
CWE-000 unsigned int random_near_color ( unsigned int color , char dr_max , char db_max , char dg_max ) { unsigned char r = extract_red ( color ) ; unsigned char b = extract_blue ( color ) ; unsigned char g = extract_green ( color ) ; srandom ( ( unsigned int ) time ( NULL ) ) ; char dr = ( char ) ( random ( ) % ( 2 * dr_max ) ) ; if ( dr > dr_max && r < ( 0xFF - ( dr - dr_max ) ) ) { r += ( dr - dr_max ) ; } else if ( dr < dr_max && r > dr ) { r -= dr ; } char db = ( char ) ( random ( ) % ( 2 * db_max ) ) ; if ( db > db_max && b < ( 0xFF - ( db - db_max ) ) ) { b += ( db - db_max ) ; } else if ( db < db_max && b > db ) { b -= db ; } char dg = ( char ) ( random ( ) % ( 2 * dg_max ) ) ; if ( dg > dg_max && g < ( 0xFF - ( dg - dg_max ) ) ) { g += ( dg - dg_max ) ; } else if ( dg < dg_max && g > dg ) { g -= dg ; } <S2SV_StartBug> return color_from_channels ( r , g , b ) ; <S2SV_EndBug> }
<S2SV_ModStart> ( r , b , g <S2SV_ModEnd> ) ; }
1,856
CWE-000 static int __curfile_reserve ( WT_CURSOR * cursor ) { WT_CURSOR_BTREE * cbt ; WT_DECL_RET ; WT_SESSION_IMPL * session ; cbt = ( WT_CURSOR_BTREE * ) cursor ; CURSOR_UPDATE_API_CALL_BTREE ( cursor , session , reserve , cbt -> btree ) ; WT_ERR ( __cursor_checkkey ( cursor ) ) ; WT_ERR ( __wt_txn_context_check ( session , true ) ) ; WT_ERR ( __wt_btcur_reserve ( cbt ) ) ; WT_ASSERT ( session , <S2SV_StartBug> F_MASK ( cursor , WT_CURSTD_KEY_SET ) == WT_CURSTD_KEY_INT ) ; <S2SV_EndBug> WT_ASSERT ( session , F_MASK ( cursor , WT_CURSTD_VALUE_SET ) == 0 ) ; err : CURSOR_UPDATE_API_END ( session , ret ) ; return ( ret == 0 ? cursor -> search ( cursor ) : ret ) ; }
<S2SV_ModStart> ( session , F_ISSET ( cbt , WT_CBT_ACTIVE ) &&
1,857
CWE-000 static void Init ( TestSuite_t * suite ) { suite -> name = suiteName ; AddTestCase ( suite , GetSymTest00 , "GetSym<S2SV_blank>Test01" ) ; AddTestCase ( suite , GetSymTest01 , "GetSym<S2SV_blank>Test02" ) ; AddTestCase ( suite , GetSymTest_term , "only<S2SV_blank>term<S2SV_blank>name" ) ; AddTestCase ( suite , GetSymTest02 , "GetSym<S2SV_blank>Test<S2SV_blank>[invalid<S2SV_blank>token01]" ) ; AddTestCase ( suite , GetSymTest03 , "GetSym<S2SV_blank>Test<S2SV_blank>[numeric<S2SV_blank>variable<S2SV_blank>name]" ) ; AddTestCase ( suite , GetSymTest04 , "GetSym<S2SV_blank>Test<S2SV_blank>[invalid<S2SV_blank>token02]" ) ; AddTestCase ( suite , GetSymTest05 , "GetSym<S2SV_blank>Test<S2SV_blank>[invalid<S2SV_blank>token03]" ) ; AddTestCase ( suite , GetSymTest06 , "GetSym<S2SV_blank>Test<S2SV_blank>[get<S2SV_blank>int<S2SV_blank>value]" ) ; AddTestCase ( suite , GetSymTest07 , "GetSym<S2SV_blank>Test<S2SV_blank>[get<S2SV_blank>str<S2SV_blank>value]" ) ; AddTestCase ( suite , GetSymTest08 , "GetSym<S2SV_blank>Test<S2SV_blank>[invalid<S2SV_blank>token04]" ) ; AddTestCase ( suite , GetSymTest09 , "GetSym<S2SV_blank>Test<S2SV_blank>[id=id+int+id]" ) ; AddTestCase ( suite , GetSymTest10 , "GetSym<S2SV_blank>Test<S2SV_blank>[get<S2SV_blank>int<S2SV_blank>value]" ) ; AddTestCase ( suite , GetSymTest11 , "GetSym<S2SV_blank>Test<S2SV_blank>[mixed<S2SV_blank>space]" ) ; AddTestCase ( suite , GetSymTest12 , "GetSym<S2SV_blank>Test<S2SV_blank>[mixed<S2SV_blank>token]" ) ; AddTestCase ( suite , GetSymTest13 , "GetSym<S2SV_blank>Test<S2SV_blank>[complex<S2SV_blank>token]" ) ; AddTestCase ( suite , GetSymTest14 , "GetSym<S2SV_blank>Test<S2SV_blank>[Dec01]" ) ; AddTestCase ( suite , GetSymTest15 , "GetSym<S2SV_blank>Test<S2SV_blank>[Dec<S2SV_blank>err00]" ) ; AddTestCase ( suite , GetSymTest16 , "GetSym<S2SV_blank>Test<S2SV_blank>[Dec<S2SV_blank>err01]" ) ; AddTestCase ( suite , GetSymTest17 , "GetSym<S2SV_blank>Test<S2SV_blank>[Dec<S2SV_blank>err02]" ) ; AddTestCase ( suite , GetSymTest18 , "GetSym<S2SV_blank>Test<S2SV_blank>[Dec02]" ) ; AddTestCase ( suite , GetSymTest19 , "GetSym<S2SV_blank>Test<S2SV_blank>[Dec03]" ) ; AddTestCase ( suite , GetSymTest20 , "GetSym<S2SV_blank>Test<S2SV_blank>[Dec<S2SV_blank>err03]" ) ; AddTestCase ( suite , GetSymTest21 , "GetSym<S2SV_blank>Test<S2SV_blank>[Dec04]" ) ; AddTestCase ( suite , GetSymTestInvalidId , "GetSym<S2SV_blank>Test<S2SV_blank>[Invalid<S2SV_blank>ID]" ) ; AddTestCase ( suite , GetSymTestInvalidId01 , "GetSym<S2SV_blank>Test<S2SV_blank>[Invalid<S2SV_blank>ID01]" ) ; AddTestCase ( suite , GetSymQuote , "GetSym<S2SV_blank>Test<S2SV_blank>[Quete]" ) ; AddTestCase ( suite , GetSymQuoteName , "GetSym<S2SV_blank>Test<S2SV_blank>[QueteName]" ) ; AddTestCase ( suite , GetSymQuoteErr01 , "GetSym<S2SV_blank>Test<S2SV_blank>[QueteErr01]" ) ; AddTestCase ( suite , GetSymQuoteErr02 , "GetSym<S2SV_blank>Test<S2SV_blank>[QueteErr02]" ) ; <S2SV_StartBug> } <S2SV_EndBug>
<S2SV_ModStart> "GetSym<S2SV_blank>Test<S2SV_blank>[QueteErr02]" ) ; AddTestCase ( suite , GetAssingErr , "GetSym<S2SV_blank>Test<S2SV_blank>[Assign<S2SV_blank>Error]" ) ;
1,858
CWE-000 <S2SV_StartBug> void * fileMemoryMap ( char * tPath ) { <S2SV_EndBug> <S2SV_StartBug> return fs_mmap ( tPath ) ; <S2SV_EndBug> }
<S2SV_ModStart> * fileMemoryMap ( int tHandler <S2SV_ModEnd> ) { return <S2SV_ModStart> return fs_mmap ( tHandler <S2SV_ModEnd> ) ; }
1,859
CWE-000 static PyObject * led ( PyObject * self , PyObject * args ) { const Py_UNICODE * s ; const Py_UNICODE * t ; int ss ; int st ; int match = 1 ; int mismatch = - 1 ; <S2SV_StartBug> int gap = - 1 ; <S2SV_EndBug> int result = 0 ; <S2SV_StartBug> if ( ! PyArg_ParseTuple ( args , "u#u#|iii" , & s , & ss , & t , & st , & match , & mismatch , & gap ) ) { <S2SV_EndBug> PyErr_SetString ( PyExc_TypeError , "Invalid<S2SV_blank>Arguments" ) ; return NULL ; } <S2SV_StartBug> if ( ( match <= mismatch && match >= gap ) || ( match <= gap && match >= mismatch ) ) { <S2SV_EndBug> PyErr_SetString ( ParamError , "Match<S2SV_blank>should<S2SV_blank>be<S2SV_blank>smallest<S2SV_blank>or<S2SV_blank>largest..." ) ; return NULL ; } <S2SV_StartBug> if ( match == 0 || gap == 0 || mismatch == 0 ) { <S2SV_EndBug> PyErr_SetString ( ParamError , "Pls<S2SV_blank>do<S2SV_blank>not<S2SV_blank>use<S2SV_blank>0<S2SV_blank>as<S2SV_blank>parameters<S2SV_blank>since<S2SV_blank>we<S2SV_blank>use<S2SV_blank>it<S2SV_blank>as<S2SV_blank>the<S2SV_blank>pivot" ) ; return NULL ; } <S2SV_StartBug> result = local_edit_distance ( s , ss , t , st , match , mismatch , gap ) ; <S2SV_EndBug> return Py_BuildValue ( "i" , result ) ; }
<S2SV_ModStart> 1 ; int insert = - 1 ; int delete <S2SV_ModEnd> = - 1 <S2SV_ModStart> ( args , "u#u#|iiii" <S2SV_ModEnd> , & s <S2SV_ModStart> mismatch , & insert , & delete <S2SV_ModEnd> ) ) { <S2SV_ModStart> <= mismatch && ( match >= insert || match >= delete ) ) || ( <S2SV_ModEnd> ( match <= <S2SV_ModStart> ( match <= insert || match <= delete ) <S2SV_ModEnd> && match >= <S2SV_ModStart> == 0 || insert == 0 || delete <S2SV_ModEnd> == 0 || <S2SV_ModStart> , mismatch , insert , delete <S2SV_ModEnd> ) ; return
1,860
CWE-000 struct request * blk_mq_alloc_request_hctx ( struct request_queue * q , unsigned int op , blk_mq_req_flags_t flags , unsigned int hctx_idx ) { struct blk_mq_alloc_data alloc_data = { . flags = flags } ; struct request * rq ; unsigned int cpu ; int ret ; if ( WARN_ON_ONCE ( ! ( flags & BLK_MQ_REQ_NOWAIT ) ) ) return ERR_PTR ( - EINVAL ) ; if ( hctx_idx >= q -> nr_hw_queues ) return ERR_PTR ( - EIO ) ; ret = blk_queue_enter ( q , flags ) ; if ( ret ) return ERR_PTR ( ret ) ; alloc_data . hctx = q -> queue_hw_ctx [ hctx_idx ] ; if ( ! blk_mq_hw_queue_mapped ( alloc_data . hctx ) ) { blk_queue_exit ( q ) ; return ERR_PTR ( - EXDEV ) ; } <S2SV_StartBug> cpu = cpumask_first_and ( alloc_data . hctx -> cpumask , cpu_online_mask ) ; <S2SV_EndBug> alloc_data . ctx = __blk_mq_get_ctx ( q , cpu ) ; rq = blk_mq_get_request ( q , NULL , op , & alloc_data ) ; blk_queue_exit ( q ) ; if ( ! rq ) return ERR_PTR ( - EWOULDBLOCK ) ; return rq ; }
<S2SV_ModStart> } cpu = cpumask_first <S2SV_ModEnd> ( alloc_data . <S2SV_ModStart> hctx -> cpumask <S2SV_ModEnd> ) ; alloc_data
1,861
CWE-000 static void draw_running ( ) { { time_t cached_duration = ifinfo . duration ; int seconds = cached_duration % 60 ; int minutes = ( cached_duration / 60 ) % 60 ; int hours = cached_duration / 60 / 60 ; <S2SV_StartBug> printf ( "%d:%02d:%02d\\n" , hours , minutes , seconds ) ; <S2SV_EndBug> } { int i ; <S2SV_StartBug> for ( i = 0 ; i + 1 < window_height - 4 && i < ifinfo . infos_count ; i ++ ) <S2SV_EndBug> { print_player_info ( ifinfo . infos [ i ] ) ; <S2SV_StartBug> putchar ( '\\n' ) ; <S2SV_EndBug> } <S2SV_StartBug> if ( ifinfo . infos_count + 1 < window_height - 3 ) <S2SV_EndBug> { <S2SV_StartBug> for ( i = ifinfo . infos_count ; i + 1 < window_height - 3 ; i ++ ) <S2SV_EndBug> <S2SV_StartBug> putchar ( '\\n' ) ; <S2SV_EndBug> } <S2SV_StartBug> else if ( ifinfo . infos_count + 1 == window_height - 3 ) <S2SV_EndBug> { print_player_info ( ifinfo . infos [ ifinfo . infos_count - 1 ] ) ; <S2SV_StartBug> putchar ( '\\n' ) ; <S2SV_EndBug> } else { <S2SV_StartBug> printf ( "...\\n" ) ; <S2SV_EndBug> } } { struct player_info this_info = { "<ME>" , ifinfo . position } ; print_player_info ( this_info ) ; } if ( ifinfo . position < ifinfo . file_size ) { scroll_print ( ) ; } else { <S2SV_StartBug> printf ( "Finished.\\n" ) ; <S2SV_EndBug> } }
<S2SV_ModStart> / 60 ; printw <S2SV_ModEnd> ( "%d:%02d:%02d\\n" , <S2SV_ModStart> < window_height - 5 <S2SV_ModEnd> && i < <S2SV_ModStart> ] ) ; printw ( "\\n" <S2SV_ModEnd> ) ; } <S2SV_ModStart> < window_height - 4 <S2SV_ModEnd> ) { for <S2SV_ModStart> < window_height - 4 <S2SV_ModEnd> ; i ++ <S2SV_ModStart> i ++ ) printw ( "\\n" <S2SV_ModEnd> ) ; } <S2SV_ModStart> == window_height - 4 <S2SV_ModEnd> ) { print_player_info <S2SV_ModStart> ] ) ; printw ( "\\n" <S2SV_ModEnd> ) ; } <S2SV_ModStart> } else { printw <S2SV_ModEnd> ( "...\\n" ) <S2SV_ModStart> } else { printw <S2SV_ModEnd> ( "Finished.\\n" )
1,862
CWE-000 static void _gsb_data_import_rule_free ( ImportRule * import_rule ) { if ( ! import_rule ) return ; if ( import_rule -> charmap ) g_free ( import_rule -> charmap ) ; if ( import_rule -> last_file_name ) g_free ( import_rule -> last_file_name ) ; if ( import_rule -> rule_name ) g_free ( import_rule -> rule_name ) ; if ( ! g_strcmp0 ( import_rule -> type , "CSV" ) ) { <S2SV_StartBug> if ( import_rule -> csv_separator ) <S2SV_EndBug> g_free ( import_rule -> csv_separator ) ; if ( import_rule -> csv_skipped_lines_str ) g_free ( import_rule -> csv_skipped_lines_str ) ; if ( import_rule -> csv_spec_text_str ) g_free ( import_rule -> csv_spec_text_str ) ; } if ( import_rule -> type ) g_free ( import_rule -> type ) ; if ( import_rule_buffer == import_rule ) import_rule_buffer = NULL ; g_free ( import_rule ) ; }
<S2SV_ModStart> ( import_rule -> csv_fields_str ) g_free ( import_rule -> csv_fields_str ) ; if ( import_rule ->
1,863
CWE-000 int B_echo ( int argc , char * argv [ ] , Shbltin_t * context ) { static char bsd_univ ; struct print prdata ; prdata . options = sh_optecho + 5 ; prdata . raw = prdata . echon = 0 ; prdata . sh = context -> shp ; UNUSED ( argc ) ; if ( ! prdata . sh -> universe ) { char * universe ; universe = astconf ( "UNIVERSE" , 0 , 0 ) ; if ( universe ) bsd_univ = ( strcmp ( universe , "ucb" ) == 0 ) ; prdata . sh -> universe = 1 ; } if ( ! bsd_univ ) return b_print ( 0 , argv , ( Shbltin_t * ) & prdata ) ; prdata . options = sh_optecho ; prdata . raw = 1 ; while ( argv [ 1 ] && * argv [ 1 ] == '-' ) { if ( strcmp ( argv [ 1 ] , "-n" ) == 0 ) prdata . echon = 1 ; <S2SV_StartBug> # if ! SHOPT_ECHOE <S2SV_EndBug> else if ( strcmp ( argv [ 1 ] , "-e" ) == 0 ) { prdata . raw = 0 ; } else if ( strcmp ( argv [ 1 ] , "-ne" ) == 0 || strcmp ( argv [ 1 ] , "-en" ) == 0 ) { prdata . raw = 0 ; prdata . echon = 1 ; } <S2SV_StartBug> # endif <S2SV_EndBug> else { break ; } argv ++ ; } return b_print ( 0 , argv , ( Shbltin_t * ) & prdata ) ; }
<S2SV_ModStart> = 1 ; <S2SV_ModEnd> else if ( <S2SV_ModStart> 1 ; } <S2SV_ModEnd> else { break
1,864
CWE-000 w_root_t * resolve_root_or_err ( struct watchman_client * client , json_t * args , int root_index , bool create ) { w_root_t * root ; const char * root_name ; char * errmsg = NULL ; json_t * ele ; ele = json_array_get ( args , root_index ) ; if ( ! ele ) { send_error_response ( client , "wrong<S2SV_blank>number<S2SV_blank>of<S2SV_blank>arguments" ) ; return NULL ; } root_name = json_string_value ( ele ) ; if ( ! root_name ) { send_error_response ( client , "invalid<S2SV_blank>value<S2SV_blank>for<S2SV_blank>argument<S2SV_blank>%d,<S2SV_blank>expected<S2SV_blank>" "a<S2SV_blank>string<S2SV_blank>naming<S2SV_blank>the<S2SV_blank>root<S2SV_blank>dir" , root_index ) ; return NULL ; } if ( client -> client_mode ) { root = w_root_resolve_for_client_mode ( root_name , & errmsg ) ; } else { <S2SV_StartBug> root = w_root_resolve ( root_name , create , & errmsg ) ; <S2SV_EndBug> } if ( ! root ) { <S2SV_StartBug> send_error_response ( client , "unable<S2SV_blank>to<S2SV_blank>resolve<S2SV_blank>root<S2SV_blank>%s:<S2SV_blank>%s" , root_name , <S2SV_EndBug> errmsg ) ; <S2SV_StartBug> free ( errmsg ) ; <S2SV_EndBug> } else { w_perf_add_root_meta ( & client -> perf_sample , root ) ; } return root ; }
<S2SV_ModStart> } else { if ( ! client -> client_is_owner ) { create = false ; } <S2SV_ModStart> root ) { if ( ! client -> client_is_owner ) { send_error_response ( client , "unable<S2SV_blank>to<S2SV_blank>resolve<S2SV_blank>root<S2SV_blank>%s:<S2SV_blank>%s<S2SV_blank>(this<S2SV_blank>may<S2SV_blank>be<S2SV_blank>" "because<S2SV_blank>you<S2SV_blank>are<S2SV_blank>not<S2SV_blank>the<S2SV_blank>process<S2SV_blank>owner)" , root_name , errmsg ) ; } else { <S2SV_ModStart> errmsg ) ; }
1,865
CWE-000 static int put_v4l2_window32 ( struct v4l2_window __user * kp , struct v4l2_window32 __user * up ) { <S2SV_StartBug> struct v4l2_clip __user * kclips = kp -> clips ; <S2SV_EndBug> struct v4l2_clip32 __user * uclips ; compat_caddr_t p ; u32 clipcount ; if ( copy_in_user ( & up -> w , & kp -> w , sizeof ( kp -> w ) ) || assign_in_user ( & up -> field , & kp -> field ) || assign_in_user ( & up -> chromakey , & kp -> chromakey ) || assign_in_user ( & up -> global_alpha , & kp -> global_alpha ) || get_user ( clipcount , & kp -> clipcount ) || put_user ( clipcount , & up -> clipcount ) ) return - EFAULT ; if ( ! clipcount ) return 0 ; <S2SV_StartBug> if ( get_user ( p , & up -> clips ) ) <S2SV_EndBug> return - EFAULT ; uclips = compat_ptr ( p ) ; while ( clipcount -- ) { if ( copy_in_user ( & uclips -> c , & kclips -> c , sizeof ( uclips -> c ) ) ) return - EFAULT ; uclips ++ ; kclips ++ ; } return 0 ; }
<S2SV_ModStart> __user * kclips <S2SV_ModEnd> ; struct v4l2_clip32 <S2SV_ModStart> ( get_user ( kclips , & kp -> clips ) ) return - EFAULT ; if ( get_user (
1,866
CWE-000 int print_elements_print ( DB * * dbp , DB_ENV * * envp , FILE * fp , FILE * fpcumul ) { int ret , init = 1 , final = 10 , max = 0 ; int dups_len = 50 ; <S2SV_StartBug> unsigned long long int * dups = calloc ( dups_len , sizeof ( unsigned long long int ) ) ; <S2SV_EndBug> memset ( dups , 0 , sizeof ( unsigned long long int ) * dups_len ) ; DBT key , data ; DBC * cursorp ; ( * dbp ) -> cursor ( * dbp , NULL , & cursorp , 0 ) ; memset ( & key , 0 , sizeof ( DBT ) ) ; memset ( & data , 0 , sizeof ( DBT ) ) ; while ( ( ret = cursorp -> get ( cursorp , & key , & data , DB_NEXT ) ) == 0 ) { fprintf ( fp , "%llu<S2SV_blank>%llu\\n" , ( unsigned long long int ) * ( ( uint64_t * ) key . data ) , ( unsigned long long int ) ( ( struct hash_value * ) data . data ) -> cont ) ; if ( ! ( unsigned long long int ) * ( ( uint64_t * ) key . data ) ) { <S2SV_StartBug> fprintf ( fpcumul , "[0]<S2SV_blank>%llu\\n" , ( unsigned long long int ) ( ( struct hash_value * ) data . data ) -> cont ) ; <S2SV_EndBug> } else { unsigned long long int key_data = ( unsigned long long int ) * ( ( uint64_t * ) key . data ) ; unsigned long long int data_data = ( unsigned long long int ) ( ( struct hash_value * ) data . data ) -> cont ; int bucket = find_bucket ( key_data ) ; int power = powr ( 10 , bucket ) ; int arr_pos ; if ( key_data >= power ) { bucket ++ ; power *= 10 ; } if ( key_data >= power / 2 ) { arr_pos = bucket * 2 ; max = bucket * 2 > max ? bucket * 2 : max ; } else { arr_pos = ( bucket * 2 ) - 1 ; max = ( bucket * 2 ) - 1 > max ? ( bucket * 2 ) - 1 : max ; } if ( arr_pos >= dups_len ) { dups = realloc ( dups , sizeof ( unsigned long long int ) * dups_len * 2 ) ; memset ( dups + dups_len , 0 , sizeof ( unsigned long long int ) * dups_len ) ; dups_len *= 2 ; } dups [ arr_pos ] += data_data ; } } int i ; for ( i = max ; i >= 0 && dups [ i ] <= 300 ; i -- ) { dups [ i - 1 ] += dups [ i ] ; dups [ i ] = 0 ; } i = 1 ; while ( i < dups_len ) { if ( dups [ i ] ) fprintf ( fpcumul , "[%d,%d[<S2SV_blank>%llu\\n" , init , final >> 1 , dups [ i ++ ] ) ; else i ++ ; if ( i < dups_len && dups [ i ] ) fprintf ( fpcumul , "[%d,%d[<S2SV_blank>%llu\\n" , final >> 1 , init * 10 , dups [ i ++ ] ) ; else i ++ ; init = final ; final *= 10 ; } if ( ret != DB_NOTFOUND ) { } <S2SV_StartBug> if ( cursorp != NULL ) <S2SV_EndBug> cursorp -> close ( cursorp ) ; return 0 ; }
<S2SV_ModStart> long int ) <S2SV_ModEnd> ) ; DBT <S2SV_ModStart> -> cont ) ; dups [ 0 ] = ( unsigned long long int ) ( ( struct hash_value * ) data . data ) -> cont <S2SV_ModStart> ) { } free ( dups <S2SV_ModEnd> ) ; return
1,867
CWE-000 <S2SV_StartBug> void read_file ( char * filename ) <S2SV_EndBug> { <S2SV_StartBug> char * buffer ; <S2SV_EndBug> char * line ; <S2SV_StartBug> size_t i ; <S2SV_EndBug> stack_t * * stack ; int line_count = 1 ; instruct_func s ; int check ; int read ; FILE * file = fopen ( filename , "r" ) ; if ( file == NULL ) { exit ( - 1 ) ; } while ( ( read = getline ( & buffer , & i , file ) ) != - 1 ) { <S2SV_StartBug> printf ( "%d\\n" , read ) ; <S2SV_EndBug> line = parse_line ( buffer ) ; s = get_op_func ( line ) ; if ( s == NULL ) exit ( - 1 ) ; s ( stack , line_count ) ; line_count ++ ; } check = fclose ( file ) ; if ( check == - 1 ) exit ( - 1 ) ; exit ( 1 ) ; }
<S2SV_ModStart> char * filename , stack_t * * stack <S2SV_ModStart> char * buffer = NULL <S2SV_ModStart> ; size_t i = 0 <S2SV_ModEnd> ; int line_count <S2SV_ModStart> 1 ) { <S2SV_ModEnd> line = parse_line
1,868
CWE-000 static int lpL_tmpdir ( lua_State * L ) { struct stat buf ; const char * prefix = luaL_optstring ( L , 1 , "lua_" ) ; const char * s = "/tmp/" , * dir ; srand ( ( int ) ( ptrdiff_t ) & L ) ; do { int magic = ( ( unsigned ) rand ( ) << 16 | rand ( ) ) % LP_MAX_TMPNUM ; lua_settop ( L , 2 ) ; <S2SV_StartBug> lua_pushfstring ( L , "%s%s%d" , s , prefix , magic ) ; <S2SV_EndBug> } while ( stat ( dir = lua_tostring ( L , - 1 ) , & buf ) == 0 ) ; if ( mkdir ( dir , 0777 ) != 0 ) return - lp_pusherror ( L , "tmpdir" , dir ) ; return 1 ; }
<S2SV_ModStart> ( L , "%s%s%d/" <S2SV_ModEnd> , s ,
1,869
CWE-000 static int connect_un_socket ( int fd , const char * path ) { struct sockaddr_un addr = { . sun_family = AF_UNIX } ; strncpy ( addr . sun_path , path , sizeof ( addr . sun_path ) - 1 ) ; if ( connect ( fd , ( struct sockaddr * ) & addr , sizeof ( addr ) ) == - 1 ) { <S2SV_StartBug> pk_log_anno ( LOG_ERR , "connect<S2SV_blank>error:<S2SV_blank>%s<S2SV_blank>(path:<S2SV_blank>%s)" , strerror ( errno ) , path ) ; <S2SV_EndBug> return - 1 ; } return 0 ; }
<S2SV_ModStart> 1 ) { PK_LOG_ANNO <S2SV_ModEnd> ( LOG_ERR ,
1,870
CWE-000 int func_live ( t_env * env , t_process * current ) { unsigned int id ; int i ; i = 0 ; id = get_data_dir ( env , M ( ( current -> pc + 1 ) ) , 4 ) ; current -> live ++ ; env -> nb_lives += 1 ; while ( i < env -> nb_players ) { if ( env -> player [ i ] . nb == ( int ) id ) { env -> player [ i ] . live ++ ; env -> winner = i ; <S2SV_StartBug> ft_printf ( "Un<S2SV_blank>processus<S2SV_blank>dit<S2SV_blank>que<S2SV_blank>le<S2SV_blank>joueur<S2SV_blank>%d(%s)<S2SV_blank>est<S2SV_blank>en<S2SV_blank>vie\\n" , <S2SV_EndBug> env -> player [ i ] . nb , env -> player [ i ] . header -> prog_name ) ; <S2SV_StartBug> } <S2SV_EndBug> i ++ ; } return ( 1 + 4 ) ; }
<S2SV_ModStart> = i ; if ( ! env -> visu ) { ft_printf ( "Un<S2SV_blank>processus<S2SV_blank>dit<S2SV_blank>que<S2SV_blank>le<S2SV_blank>joueur<S2SV_blank>%d(%s)" <S2SV_ModEnd> , env -> <S2SV_ModStart> prog_name ) ; ft_printf ( "<S2SV_blank>est<S2SV_blank>en<S2SV_blank>vie\\n" ) ; }
1,871
CWE-000 void respawnpid ( pid_t pid ) { if ( disable ) { return ; } struct respawn_node * node ; if ( ( node = get ( pid ) ) != NULL ) { pid_t newpid = runapp ( node ) ; <S2SV_StartBug> if ( unlikely ( newpid <= 0 ) ) { <S2SV_EndBug> ueld_print ( "Respwan<S2SV_blank>process<S2SV_blank>\'%s\'<S2SV_blank>failed,<S2SV_blank>remove<S2SV_blank>it<S2SV_blank>from<S2SV_blank>list...\\n" , node -> cmd ) ; <S2SV_StartBug> delete ( node -> pid ) ; <S2SV_EndBug> } else { noderef ( node ) ; <S2SV_StartBug> delete ( node -> pid ) ; <S2SV_EndBug> node -> pid = newpid ; insert ( newpid , node ) ; nodeunref ( node ) ; } } }
<S2SV_ModStart> unlikely ( newpid == <S2SV_ModEnd> 0 ) ) <S2SV_ModStart> cmd ) ; delete_node_without_index ( node <S2SV_ModEnd> ) ; } <S2SV_ModStart> node ) ; delete_node_without_index ( node <S2SV_ModEnd> ) ; node
1,872
CWE-000 void keyboard_task ( void ) { static matrix_row_t matrix_prev [ MATRIX_ROWS ] ; # ifdef MATRIX_HAS_GHOST # endif static uint8_t led_status = 0 ; matrix_row_t matrix_row = 0 ; matrix_row_t matrix_change = 0 ; # ifdef QMK_KEYS_PER_SCAN uint8_t keys_processed = 0 ; # endif matrix_scan ( ) ; if ( is_keyboard_master ( ) ) { for ( uint8_t r = 0 ; r < MATRIX_ROWS ; r ++ ) { matrix_row = matrix_get_row ( r ) ; matrix_change = matrix_row ^ matrix_prev [ r ] ; if ( matrix_change ) { # ifdef MATRIX_HAS_GHOST if ( has_ghost_in_row ( r , matrix_row ) ) { continue ; } # endif if ( debug_matrix ) matrix_print ( ) ; for ( uint8_t c = 0 ; c < MATRIX_COLS ; c ++ ) { if ( matrix_change & ( ( matrix_row_t ) 1 << c ) ) { action_exec ( ( keyevent_t ) { . key = ( keypos_t ) { . row = r , . col = c } , . pressed = ( matrix_row & ( ( matrix_row_t ) 1 << c ) ) , . time = ( timer_read ( ) | 1 ) } ) ; matrix_prev [ r ] ^= ( ( matrix_row_t ) 1 << c ) ; # ifdef QMK_KEYS_PER_SCAN if ( ++ keys_processed >= QMK_KEYS_PER_SCAN ) # endif goto MATRIX_LOOP_END ; } } } } } # ifdef QMK_KEYS_PER_SCAN if ( ! keys_processed ) # endif action_exec ( TICK ) ; MATRIX_LOOP_END : # ifdef MOUSEKEY_ENABLE mousekey_task ( ) ; # endif # ifdef PS2_MOUSE_ENABLE ps2_mouse_task ( ) ; # endif # ifdef SERIAL_MOUSE_ENABLE serial_mouse_task ( ) ; # endif # ifdef ADB_MOUSE_ENABLE adb_mouse_task ( ) ; # endif # ifdef SERIAL_LINK_ENABLE serial_link_update ( ) ; # endif # ifdef VISUALIZER_ENABLE visualizer_update ( default_layer_state , layer_state , visualizer_get_mods ( ) , host_keyboard_leds ( ) ) ; # endif # ifdef POINTING_DEVICE_ENABLE pointing_device_task ( ) ; # endif <S2SV_StartBug> if ( led_status != host_keyboard_leds ( ) ) { <S2SV_EndBug> led_status = host_keyboard_leds ( ) ; keyboard_set_leds ( led_status ) ; } }
<S2SV_ModStart> ; # endif # ifdef MIDI_ENABLE midi_task ( ) ; # endif
1,873
CWE-000 void final_cost_hashjoin ( PlannerInfo * root , HashPath * path , JoinCostWorkspace * workspace , JoinPathExtraData * extra ) { Path * outer_path = path -> jpath . outerjoinpath ; Path * inner_path = path -> jpath . innerjoinpath ; double outer_path_rows = outer_path -> rows ; double inner_path_rows = inner_path -> rows ; List * hashclauses = path -> path_hashclauses ; Cost startup_cost = workspace -> startup_cost ; Cost run_cost = workspace -> run_cost ; int numbuckets = workspace -> numbuckets ; int numbatches = workspace -> numbatches ; Cost cpu_per_tuple ; QualCost hash_qual_cost ; QualCost qp_qual_cost ; double hashjointuples ; double virtualbuckets ; Selectivity innerbucketsize ; ListCell * hcl ; if ( path -> jpath . path . param_info ) path -> jpath . path . rows = path -> jpath . path . param_info -> ppi_rows ; else path -> jpath . path . rows = path -> jpath . path . parent -> rows ; if ( path -> jpath . path . parallel_workers > 0 ) { double parallel_divisor = get_parallel_divisor ( & path -> jpath . path ) ; path -> jpath . path . rows = clamp_row_est ( path -> jpath . path . rows / parallel_divisor ) ; } if ( ! enable_hashjoin ) startup_cost += disable_cost ; path -> num_batches = numbatches ; virtualbuckets = ( double ) numbuckets * ( double ) numbatches ; if ( IsA ( inner_path , UniquePath ) ) innerbucketsize = 1.0 / virtualbuckets ; else { innerbucketsize = 1.0 ; foreach ( hcl , hashclauses ) { RestrictInfo * restrictinfo = lfirst_node ( RestrictInfo , hcl ) ; Selectivity thisbucketsize ; if ( bms_is_subset ( restrictinfo -> right_relids , inner_path -> parent -> relids ) ) { thisbucketsize = restrictinfo -> right_bucketsize ; if ( thisbucketsize < 0 ) { thisbucketsize = estimate_hash_bucketsize ( root , get_rightop ( restrictinfo -> clause ) , virtualbuckets ) ; restrictinfo -> right_bucketsize = thisbucketsize ; } } else { Assert ( bms_is_subset ( restrictinfo -> left_relids , inner_path -> parent -> relids ) ) ; thisbucketsize = restrictinfo -> left_bucketsize ; if ( thisbucketsize < 0 ) { thisbucketsize = estimate_hash_bucketsize ( root , get_leftop ( restrictinfo -> clause ) , virtualbuckets ) ; restrictinfo -> left_bucketsize = thisbucketsize ; } } if ( innerbucketsize > thisbucketsize ) innerbucketsize = thisbucketsize ; } } cost_qual_eval ( & hash_qual_cost , hashclauses , root ) ; cost_qual_eval ( & qp_qual_cost , path -> jpath . joinrestrictinfo , root ) ; qp_qual_cost . startup -= hash_qual_cost . startup ; qp_qual_cost . per_tuple -= hash_qual_cost . per_tuple ; if ( path -> jpath . jointype == JOIN_SEMI || path -> jpath . jointype == JOIN_ANTI || extra -> inner_unique ) { double outer_matched_rows ; Selectivity inner_scan_frac ; outer_matched_rows = rint ( outer_path_rows * extra -> semifactors . outer_match_frac ) ; inner_scan_frac = 2.0 / ( extra -> semifactors . match_count + 1.0 ) ; startup_cost += hash_qual_cost . startup ; run_cost += hash_qual_cost . per_tuple * outer_matched_rows * clamp_row_est ( inner_path_rows * innerbucketsize * inner_scan_frac ) * 0.5 ; run_cost += hash_qual_cost . per_tuple * ( outer_path_rows - outer_matched_rows ) * clamp_row_est ( inner_path_rows / virtualbuckets ) * 0.05 ; <S2SV_StartBug> if ( path -> jpath . jointype == JOIN_SEMI ) <S2SV_EndBug> hashjointuples = outer_matched_rows ; else hashjointuples = outer_path_rows - outer_matched_rows ; <S2SV_StartBug> } <S2SV_EndBug> else { startup_cost += hash_qual_cost . startup ; run_cost += hash_qual_cost . per_tuple * outer_path_rows * clamp_row_est ( inner_path_rows * innerbucketsize ) * 0.5 ; hashjointuples = approx_tuple_count ( root , & path -> jpath , hashclauses ) ; } startup_cost += qp_qual_cost . startup ; cpu_per_tuple = cpu_tuple_cost + qp_qual_cost . per_tuple ; run_cost += cpu_per_tuple * hashjointuples ; startup_cost += path -> jpath . path . pathtarget -> cost . startup ; run_cost += path -> jpath . path . pathtarget -> cost . per_tuple * path -> jpath . path . rows ; path -> jpath . path . startup_cost = startup_cost ; path -> jpath . path . total_cost = startup_cost + run_cost ; }
<S2SV_ModStart> . jointype == JOIN_ANTI ) <S2SV_ModEnd> hashjointuples = outer_path_rows <S2SV_ModStart> - outer_matched_rows ; else hashjointuples = outer_matched_rows ;
1,874
CWE-000 void net_link_free ( net_link_t link ) { net_schedule_t schedule = link -> m_local -> m_driver -> m_schedule ; assert ( link -> m_local -> m_link == link ) ; link -> m_local -> m_link = NULL ; if ( link -> m_local_is_tie ) { if ( net_endpoint_set_state ( link -> m_local , net_endpoint_state_disable ) != 0 ) { <S2SV_StartBug> net_endpoint_set_state ( link -> m_remote , net_endpoint_state_deleting ) ; <S2SV_EndBug> } link -> m_local = NULL ; } assert ( link -> m_remote -> m_link == link ) ; link -> m_remote -> m_link = NULL ; if ( link -> m_remote_is_tie ) { if ( net_endpoint_set_state ( link -> m_remote , net_endpoint_state_disable ) != 0 ) { net_endpoint_set_state ( link -> m_remote , net_endpoint_state_deleting ) ; } link -> m_remote = NULL ; } link -> m_local = ( net_endpoint_t ) schedule ; TAILQ_INSERT_TAIL ( & schedule -> m_free_links , link , m_next ) ; }
<S2SV_ModStart> ( link -> m_local <S2SV_ModEnd> , net_endpoint_state_deleting )
1,875
CWE-000 int sfs_read ( const char * path , char * buf , size_t size , off_t offset , struct fuse_file_info * fi ) { int retstat = 0 ; log_msg ( "\\nsfs_read(path=\\"%s\\",<S2SV_blank>buf=0x%08x,<S2SV_blank>size=%d,<S2SV_blank>offset=%lld,<S2SV_blank>fi=0x%08x)\\n" , path , buf , size , offset , fi ) ; <S2SV_StartBug> int u = 1 ; <S2SV_EndBug> for ( u ; u < 1000 ; u ++ ) { char buffer [ 512 ] ; block_read ( u , buffer ) ; inode * current = ( inode * ) buffer ; if ( current -> mode == 1 && strcmp ( current -> path , path + 1 ) == 0 ) { int numBlocksToRead = ( ( offset % 512 + size ) - 1 + 512 ) / 512 ; int firstBlock = offset / 512 ; int lastBlock = firstBlock + numBlocksToRead ; int i = firstBlock ; <S2SV_StartBug> int amountRead = 0 ; <S2SV_EndBug> for ( i ; i <= lastBlock ; i ++ ) { if ( i < 100 ) { char buffer3 [ 512 ] ; if ( current -> directMappedPtrs [ i ] == - 1 ) { return amountRead ; } block_read ( current -> directMappedPtrs [ i ] , buffer3 ) ; if ( i == firstBlock ) { memcpy ( buf + amountRead , buffer3 + offset % 512 , 512 - offset % 512 ) ; amountRead += 512 - offset % 512 ; } else if ( i == lastBlock ) { memcpy ( buf + amountRead , buffer3 , size - amountRead ) ; amountRead += size - amountRead ; } else { memcpy ( buf + amountRead , buffer3 , 512 ) ; amountRead += 512 - offset % 512 ; } } else if ( i < 228 ) { int singleIndirectBlockNum = i - 100 ; if ( current -> singleIndirectionPtrs [ 0 ] == - 1 ) { return amountRead ; } char buffer3 [ 512 ] ; block_read ( current -> singleIndirectionPtrs [ 0 ] , buffer3 ) ; pnode * pNode = ( pnode * ) buffer3 ; if ( pNode -> ptrs [ singleIndirectBlockNum ] == - 1 ) { return amountRead ; } char buffer4 [ 512 ] ; block_read ( pNode -> ptrs [ singleIndirectBlockNum ] , buffer4 ) ; if ( i == firstBlock ) { memcpy ( buf + amountRead , buffer4 + offset % 512 , 512 - offset % 512 ) ; amountRead += 512 - offset % 512 ; } else if ( i == lastBlock ) { memcpy ( buf + amountRead , buffer4 , size - amountRead ) ; amountRead += size - amountRead ; } else { memcpy ( buf + amountRead , buffer4 , 512 ) ; amountRead += 512 - offset % 512 ; } } else { int doubleIndirectBlock = ( i - 228 ) / 128 ; int positionInDoubleIndirectBlock = ( i - 228 ) % 128 ; if ( current -> doubleIndirectionPtrs [ 0 ] == - 1 ) { return amountRead ; } char buffer3 [ 512 ] ; block_read ( current -> doubleIndirectionPtrs [ 0 ] , buffer3 ) ; pnode * pNode = ( pnode * ) buffer3 ; if ( pNode -> ptrs [ doubleIndirectBlock ] == - 1 ) { return amountRead ; } char buffer4 [ 512 ] ; block_read ( pNode -> ptrs [ doubleIndirectBlock ] , buffer4 ) ; pnode * pNode2 = ( pnode * ) buffer4 ; if ( pNode2 -> ptrs [ positionInDoubleIndirectBlock ] == - 1 ) { return amountRead ; } char buffer5 [ 512 ] ; block_read ( pNode2 -> ptrs [ positionInDoubleIndirectBlock ] , buffer5 ) ; if ( i == firstBlock ) { memcpy ( buf + amountRead , buffer5 + offset % 512 , 512 - offset % 512 ) ; amountRead += 512 - offset % 512 ; } else if ( i == lastBlock ) { memcpy ( buf + amountRead , buffer5 , size - amountRead ) ; amountRead += size - amountRead ; } else { memcpy ( buf + amountRead , buffer5 , 512 ) ; amountRead += 512 - offset % 512 ; } } } } <S2SV_StartBug> return size ; <S2SV_EndBug> } return retstat ; }
<S2SV_ModStart> u = 1 ; int amountRead = 0 <S2SV_ModStart> = firstBlock ; <S2SV_ModEnd> for ( i <S2SV_ModStart> } } } } return amountRead <S2SV_ModEnd> ; } <S2SV_null>
1,876
CWE-000 static gboolean concat_entries ( FILE * src_stream , FILE * dest_stream , RpmOstreePasswdMigrateKind kind , GHashTable * seen_names , GError * * error ) { gboolean ret = FALSE ; errno = 0 ; while ( TRUE ) { struct passwd * pw = NULL ; struct group * gr = NULL ; int r ; const char * name ; if ( kind == RPM_OSTREE_PASSWD_MIGRATE_PASSWD ) pw = fgetpwent ( src_stream ) ; else gr = fgetgrent ( src_stream ) ; if ( ! ( pw || gr ) ) { if ( errno != 0 && errno != ENOENT ) { <S2SV_StartBug> _rpmostree_set_prefix_error_from_errno ( error , errno , "fgetpwent:<S2SV_blank>" ) ; <S2SV_EndBug> goto out ; } else break ; } if ( pw ) name = pw -> pw_name ; else name = gr -> gr_name ; if ( g_hash_table_lookup ( seen_names , name ) ) continue ; g_hash_table_add ( seen_names , g_strdup ( name ) ) ; if ( pw ) r = putpwent ( pw , dest_stream ) ; else r = putgrent ( gr , dest_stream ) ; if ( r == - 1 ) { <S2SV_StartBug> _rpmostree_set_prefix_error_from_errno ( error , errno , "putpwent:<S2SV_blank>" ) ; <S2SV_EndBug> goto out ; } } ret = TRUE ; out : return ret ; }
<S2SV_ModStart> ENOENT ) { glnx_set_prefix_error_from_errno <S2SV_ModEnd> ( error , <S2SV_ModStart> ( error , "%s" , "fgetpwent" <S2SV_ModEnd> ) ; goto <S2SV_ModStart> 1 ) { glnx_set_prefix_error_from_errno <S2SV_ModEnd> ( error , <S2SV_ModStart> ( error , "%s" , "putpwent" <S2SV_ModEnd> ) ; goto
1,877
CWE-000 void printBoard ( pid_t pid , Board b ) { <S2SV_StartBug> for ( int i = 0 ; i < b . _y ; ++ i ) { <S2SV_EndBug> printf ( "PID<S2SV_blank>%d:<S2SV_blank><S2SV_blank><S2SV_blank>%s\\n" , pid , b . _grid [ i ] ) ; } }
<S2SV_ModStart> < b . _cols <S2SV_ModEnd> ; ++ i
1,878
CWE-000 static int cx25821_dev_setup ( struct cx25821_dev * dev ) { static unsigned int cx25821_devcount ; int i ; mutex_init ( & dev -> lock ) ; dev -> nr = ++ cx25821_devcount ; sprintf ( dev -> name , "cx25821[%d]" , dev -> nr ) ; <S2SV_StartBug> if ( dev -> pci -> device != 0x8210 ) { <S2SV_EndBug> pr_info ( "%s():<S2SV_blank>Exiting.<S2SV_blank>Incorrect<S2SV_blank>Hardware<S2SV_blank>device<S2SV_blank>=<S2SV_blank>0x%02x\\n" , __func__ , dev -> pci -> device ) ; return - ENODEV ; } pr_info ( "Athena<S2SV_blank>Hardware<S2SV_blank>device<S2SV_blank>=<S2SV_blank>0x%02x\\n" , dev -> pci -> device ) ; dev -> clk_freq = 28000000 ; for ( i = 0 ; i < MAX_VID_CHANNEL_NUM ; i ++ ) { dev -> channels [ i ] . dev = dev ; dev -> channels [ i ] . id = i ; dev -> channels [ i ] . sram_channels = & cx25821_sram_channels [ i ] ; } <S2SV_StartBug> if ( dev -> nr > 1 ) <S2SV_EndBug> CX25821_INFO ( "dev->nr<S2SV_blank>><S2SV_blank>1!" ) ; dev -> board = 1 ; dev -> _max_num_decoders = MAX_DECODERS ; dev -> pci_bus = dev -> pci -> bus -> number ; dev -> pci_slot = PCI_SLOT ( dev -> pci -> devfn ) ; dev -> pci_irqmask = 0x001f00 ; dev -> i2c_bus [ 0 ] . nr = 0 ; dev -> i2c_bus [ 0 ] . dev = dev ; dev -> i2c_bus [ 0 ] . reg_stat = I2C1_STAT ; dev -> i2c_bus [ 0 ] . reg_ctrl = I2C1_CTRL ; dev -> i2c_bus [ 0 ] . reg_addr = I2C1_ADDR ; dev -> i2c_bus [ 0 ] . reg_rdata = I2C1_RDATA ; dev -> i2c_bus [ 0 ] . reg_wdata = I2C1_WDATA ; dev -> i2c_bus [ 0 ] . i2c_period = ( 0x07 << 24 ) ; if ( cx25821_get_resources ( dev ) < 0 ) { pr_err ( "%s:<S2SV_blank>No<S2SV_blank>more<S2SV_blank>PCIe<S2SV_blank>resources<S2SV_blank>for<S2SV_blank>subsystem:<S2SV_blank>%04x:%04x\\n" , dev -> name , dev -> pci -> subsystem_vendor , dev -> pci -> subsystem_device ) ; cx25821_devcount -- ; return - EBUSY ; } dev -> base_io_addr = pci_resource_start ( dev -> pci , 0 ) ; if ( ! dev -> base_io_addr ) { CX25821_ERR ( "No<S2SV_blank>PCI<S2SV_blank>Memory<S2SV_blank>resources,<S2SV_blank>exiting!\\n" ) ; return - ENODEV ; } dev -> lmmio = ioremap ( dev -> base_io_addr , pci_resource_len ( dev -> pci , 0 ) ) ; if ( ! dev -> lmmio ) { CX25821_ERR ( "ioremap<S2SV_blank>failed,<S2SV_blank>maybe<S2SV_blank>increasing<S2SV_blank>__VMALLOC_RESERVE<S2SV_blank>in<S2SV_blank>page.h\\n" ) ; cx25821_iounmap ( dev ) ; return - ENOMEM ; } dev -> bmmio = ( u8 __iomem * ) dev -> lmmio ; pr_info ( "%s:<S2SV_blank>subsystem:<S2SV_blank>%04x:%04x,<S2SV_blank>board:<S2SV_blank>%s<S2SV_blank>[card=%d,%s]\\n" , dev -> name , dev -> pci -> subsystem_vendor , dev -> pci -> subsystem_device , cx25821_boards [ dev -> board ] . name , dev -> board , card [ dev -> nr ] == dev -> board ? "insmod<S2SV_blank>option" : "autodetected" ) ; cx25821_initialize ( dev ) ; cx25821_i2c_register ( & dev -> i2c_bus [ 0 ] ) ; if ( medusa_video_init ( dev ) < 0 ) CX25821_ERR ( "%s():<S2SV_blank>Failed<S2SV_blank>to<S2SV_blank>initialize<S2SV_blank>medusa!\\n" , __func__ ) ; cx25821_video_register ( dev ) ; cx25821_dev_checkrevision ( dev ) ; return 0 ; }
<S2SV_ModStart> ( dev -> nr >= ARRAY_SIZE ( card ) ) { CX25821_INFO ( "dev->nr<S2SV_blank>>=<S2SV_blank>%zd" , ARRAY_SIZE ( card ) ) ; return - ENODEV ; } if ( dev -> <S2SV_ModStart> ] ; } <S2SV_ModEnd> dev -> board
1,879
CWE-000 LogicalDecodingContext * CreateInitDecodingContext ( char * plugin , List * output_plugin_options , bool need_full_snapshot , XLogPageReadCB read_page , LogicalOutputPluginWriterPrepareWrite prepare_write , LogicalOutputPluginWriterWrite do_write , LogicalOutputPluginWriterUpdateProgress update_progress ) { TransactionId xmin_horizon = InvalidTransactionId ; ReplicationSlot * slot ; LogicalDecodingContext * ctx ; MemoryContext old_context ; slot = MyReplicationSlot ; if ( slot == NULL ) elog ( ERROR , "cannot<S2SV_blank>perform<S2SV_blank>logical<S2SV_blank>decoding<S2SV_blank>without<S2SV_blank>an<S2SV_blank>acquired<S2SV_blank>slot" ) ; if ( plugin == NULL ) elog ( ERROR , "cannot<S2SV_blank>initialize<S2SV_blank>logical<S2SV_blank>decoding<S2SV_blank>without<S2SV_blank>a<S2SV_blank>specified<S2SV_blank>plugin" ) ; if ( SlotIsPhysical ( slot ) ) ereport ( ERROR , ( errcode ( ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE ) , errmsg ( "cannot<S2SV_blank>use<S2SV_blank>physical<S2SV_blank>replication<S2SV_blank>slot<S2SV_blank>for<S2SV_blank>logical<S2SV_blank>decoding" ) ) ) ; if ( slot -> data . database != MyDatabaseId ) ereport ( ERROR , ( errcode ( ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE ) , errmsg ( "replication<S2SV_blank>slot<S2SV_blank>\\"%s\\"<S2SV_blank>was<S2SV_blank>not<S2SV_blank>created<S2SV_blank>in<S2SV_blank>this<S2SV_blank>database" , NameStr ( slot -> data . name ) ) ) ) ; if ( IsTransactionState ( ) && GetTopTransactionIdIfAny ( ) != InvalidTransactionId ) ereport ( ERROR , ( errcode ( ERRCODE_ACTIVE_SQL_TRANSACTION ) , errmsg ( "cannot<S2SV_blank>create<S2SV_blank>logical<S2SV_blank>replication<S2SV_blank>slot<S2SV_blank>in<S2SV_blank>transaction<S2SV_blank>that<S2SV_blank>has<S2SV_blank>performed<S2SV_blank>writes" ) ) ) ; SpinLockAcquire ( & slot -> mutex ) ; StrNCpy ( NameStr ( slot -> data . plugin ) , plugin , NAMEDATALEN ) ; SpinLockRelease ( & slot -> mutex ) ; ReplicationSlotReserveWal ( ) ; LWLockAcquire ( ProcArrayLock , LW_EXCLUSIVE ) ; xmin_horizon = GetOldestSafeDecodingTransactionId ( ! need_full_snapshot ) ; <S2SV_StartBug> slot -> effective_catalog_xmin = xmin_horizon ; <S2SV_EndBug> slot -> data . catalog_xmin = xmin_horizon ; if ( need_full_snapshot ) <S2SV_StartBug> slot -> effective_xmin = xmin_horizon ; <S2SV_EndBug> ReplicationSlotsComputeRequiredXmin ( true ) ; LWLockRelease ( ProcArrayLock ) ; ReplicationSlotMarkDirty ( ) ; ReplicationSlotSave ( ) ; ctx = StartupDecodingContext ( NIL , InvalidXLogRecPtr , xmin_horizon , need_full_snapshot , true , read_page , prepare_write , do_write , update_progress ) ; old_context = MemoryContextSwitchTo ( ctx -> context ) ; if ( ctx -> callbacks . startup_cb != NULL ) startup_cb_wrapper ( ctx , & ctx -> options , true ) ; MemoryContextSwitchTo ( old_context ) ; ctx -> reorder -> output_rewrites = ctx -> options . receive_rewrites ; return ctx ; }
<S2SV_ModStart> need_full_snapshot ) ; SpinLockAcquire ( & slot -> mutex ) ; <S2SV_ModStart> effective_xmin = xmin_horizon ; SpinLockRelease ( & slot -> mutex )
1,880
CWE-000 int work_pool_shutdown ( struct work_pool * pool ) { <S2SV_StartBug> struct timespec ts = { <S2SV_EndBug> <S2SV_StartBug> . tv_sec = 5 , <S2SV_EndBug> . tv_nsec = 0 , } ; pool -> params . thrd_max = pool -> params . thrd_min = 0 ; <S2SV_StartBug> pthread_mutex_lock ( & pool -> pqh . qmutex ) ; <S2SV_EndBug> <S2SV_StartBug> while ( 0 > pool -> pqh . qcount ) { <S2SV_EndBug> pool -> pqh . qcount ++ ; work_pool_dispatch ( pool , NULL ) ; } pthread_mutex_unlock ( & pool -> pqh . qmutex ) ; <S2SV_StartBug> while ( pool -> n_threads > 0 ) { <S2SV_EndBug> nanosleep ( & ts , NULL ) ; } mem_free ( pool -> name , 0 ) ; poolq_head_destroy ( & pool -> pqh ) ; return ( 0 ) ; }
<S2SV_ModStart> ) { struct work_pool_thread * wpt ; struct <S2SV_ModStart> . tv_sec = 1 <S2SV_ModEnd> , . tv_nsec <S2SV_ModStart> = 0 ; while ( pool -> n_threads > 0 ) { __warnx ( TIRPC_DEBUG_FLAG_WORKER , "%s()<S2SV_blank>%s<S2SV_blank>%" PRIu32 , __func__ , pool -> name , pool -> n_threads ) ; <S2SV_ModStart> qmutex ) ; wpt = TAILQ_FIRST ( & pool -> wptqh ) ; while ( wpt ) { pthread_cond_signal ( & wpt -> pqcond ) ; wpt = TAILQ_NEXT ( wpt , wptq <S2SV_ModEnd> ) ; } <S2SV_ModStart> qmutex ) ; <S2SV_ModEnd> nanosleep ( &
1,881
CWE-000 void symbolic_constant_print ( const struct symbol_table * tbl , const struct expr * expr , bool quotes ) { unsigned int len = div_round_up ( expr -> len , BITS_PER_BYTE ) ; const struct symbolic_constant * s ; uint64_t val = 0 ; assert ( expr -> len / BITS_PER_BYTE <= sizeof ( val ) ) ; mpz_export_data ( constant_data_ptr ( val , expr -> len ) , expr -> value , expr -> byteorder , len ) ; for ( s = tbl -> symbols ; s -> identifier != NULL ; s ++ ) { if ( val == s -> value ) break ; } if ( s -> identifier == NULL ) return expr_basetype ( expr ) -> print ( expr ) ; if ( quotes ) <S2SV_StartBug> printf ( "\\"%s\\"" , s -> identifier ) ; <S2SV_EndBug> else printf ( "%s" , s -> identifier ) ; <S2SV_StartBug> } <S2SV_EndBug>
<S2SV_ModStart> ) printf ( "\\"" ) ; if ( numeric_output > NUMERIC_ALL ) printf ( "%lu" , val <S2SV_ModEnd> ) ; else <S2SV_ModStart> identifier ) ; if ( quotes ) printf ( "\\"" ) ;
1,882
CWE-000 <S2SV_StartBug> unsigned short getPortFromUri ( const char * uri ) { <S2SV_EndBug> <S2SV_StartBug> unsigned short port ; <S2SV_EndBug> <S2SV_StartBug> if ( sscanf ( uri , "http://localhost:%hu" , & port ) != 1 ) { <S2SV_EndBug> <S2SV_StartBug> if ( sscanf ( uri , "http://localhost:%hu/" , & port ) != 1 ) { <S2SV_EndBug> oidc_errno = OIDC_EFMT ; return 0 ; } } return port ; }
<S2SV_ModStart> <S2SV_null> <S2SV_null> unsigned int <S2SV_ModEnd> getPortFromUri ( const <S2SV_ModStart> ) { unsigned int <S2SV_ModEnd> port ; if <S2SV_ModStart> ( uri , "http://localhost:%du" <S2SV_ModEnd> , & port <S2SV_ModStart> ( uri , "http://localhost:%du/" <S2SV_ModEnd> , & port
1,883
CWE-000 <S2SV_StartBug> u64 kallsyms__get_function_start ( const char * kallsyms_filename , <S2SV_EndBug> <S2SV_StartBug> const char * symbol_name ) <S2SV_EndBug> { struct process_symbol_args args = { . name = symbol_name , } ; if ( kallsyms__parse ( kallsyms_filename , & args , find_symbol_cb ) <= 0 ) <S2SV_StartBug> return 0 ; <S2SV_EndBug> return args . start ; <S2SV_StartBug> } <S2SV_EndBug>
<S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> int <S2SV_ModEnd> kallsyms__get_function_start ( const <S2SV_ModStart> char * symbol_name , u64 * addr <S2SV_ModStart> 0 ) return - 1 ; * addr = <S2SV_ModEnd> args . start <S2SV_ModStart> . start ; return 0 ;
1,884
CWE-000 int append_file_content ( int file_uid , char * append ) { int i , j , adresa , delka ; char * ret ; MFT_LIST * mft_itemy ; struct mft_fragment mftf ; FILE * fw ; ret = ( char * ) malloc ( CLUSTER_SIZE ) ; char * soucasny_obsah = get_file_content ( file_uid ) ; printf ( "Soucasny<S2SV_blank>obsah<S2SV_blank>souboru<S2SV_blank>je:<S2SV_blank>%s<S2SV_blank>a<S2SV_blank>ma<S2SV_blank>delku<S2SV_blank>%zd<S2SV_blank>---<S2SV_blank>\\n" , soucasny_obsah , strlen ( soucasny_obsah ) ) ; printf ( "Chci<S2SV_blank>appendnout:<S2SV_blank>%s\\n" , append ) ; fw = fopen ( output_file , "r+b" ) ; if ( fw != NULL ) { adresa = 0 ; if ( mft_seznam [ file_uid ] != NULL ) { mft_itemy = mft_seznam [ file_uid ] ; i = 0 ; while ( mft_itemy != NULL ) { i ++ ; printf ( "--<S2SV_blank>[%d]<S2SV_blank>Nacteny<S2SV_blank>item<S2SV_blank>s<S2SV_blank>UID=%d<S2SV_blank>ma<S2SV_blank>nazev<S2SV_blank>%s\\n" , i , mft_itemy -> item . uid , mft_itemy -> item . item_name ) ; for ( j = 0 ; j < MFT_FRAG_COUNT ; j ++ ) { mftf = mft_itemy -> item . fragments [ j ] ; if ( mftf . fragment_start_address != 0 ) { adresa = mftf . fragment_start_address ; } } mft_itemy = mft_itemy -> dalsi ; } } if ( adresa != 0 ) { strcat ( ret , get_cluster_content ( adresa ) ) ; strcat ( ret , "\\n" ) ; strcat ( ret , append ) ; delka = strlen ( ret ) ; fseek ( fw , adresa , SEEK_SET ) ; fwrite ( ret , 1 , delka , fw ) ; update_filesize ( file_uid , delka ) ; <S2SV_StartBug> printf ( "Dokoncuji<S2SV_blank>editaci<S2SV_blank>clusteru<S2SV_blank>/%s/;<S2SV_blank>strlen=%zd\\n" , ret , delka ) ; <S2SV_EndBug> } else { return - 1 ; } fclose ( fw ) ; } return 1 ; }
<S2SV_ModStart> ; printf ( "Dokoncuji<S2SV_blank>editaci<S2SV_blank>clusteru<S2SV_blank>/%s/;<S2SV_blank>strlen=%d\\n" <S2SV_ModEnd> , ret ,
1,885
CWE-000 GString * process_query_command ( GString * command , gpointer user_data ) { GString * result = g_string_new ( "" ) ; gchar * * cmds = g_strsplit ( command -> str , "<S2SV_blank>" , 3 ) ; g_assert ( g_str_equal ( cmds [ CMD_STR ] , "QUERY" ) ) ; _dispatch_query ( _command_str_to_id ( cmds [ QUERY_CMD_STR ] ) , cmds [ QUERY_FILTER_STR ] , result ) ; g_strfreev ( cmds ) ; <S2SV_StartBug> return result ; <S2SV_EndBug> }
<S2SV_ModStart> cmds ) ; if ( result -> len == 0 ) g_string_assign ( result , "\\n" ) ;
1,886
CWE-000 <S2SV_StartBug> PHP_METHOD ( FastDFS , storage_set_metadata1 ) <S2SV_EndBug> { zval * object = getThis ( ) ; php_fdfs_t * i_obj ; i_obj = ( php_fdfs_t * ) fdfs_get_object ( object ) ; <S2SV_StartBug> php_fdfs_storage_set_metadata_impl ( INTERNAL_FUNCTION_PARAM_PASSTHRU , & ( i_obj -> context ) , true ) ; <S2SV_EndBug> }
<S2SV_ModStart> ( FastDFS , storage_get_metadata <S2SV_ModEnd> ) { zval <S2SV_ModStart> object ) ; php_fdfs_storage_get_metadata_impl <S2SV_ModEnd> ( INTERNAL_FUNCTION_PARAM_PASSTHRU , <S2SV_ModStart> context ) , false <S2SV_ModEnd> ) ; }
1,887
CWE-000 static void loadSingleFace ( int i , MugenDefScript * tScript ) { char name [ 1024 ] ; Face * face = & gData . mFaces [ i ] ; Position basePosition ; sprintf ( name , "p%d.pos" , i + 1 ) ; basePosition = getMugenDefVectorOrDefault ( tScript , "Face" , name , makePosition ( 0 , 0 , 0 ) ) ; <S2SV_StartBug> basePosition . z = 20 ; <S2SV_EndBug> DreamPlayer * p = getRootPlayer ( i ) ; int coordP = COORD_P ; loadSingleUIComponent ( i , tScript , & gData . mFightSprites , & gData . mFightAnimations , basePosition , "Face" , "bg" , 1 , & face -> mBGAnimation , & face -> mOwnsBGAnimation , & face -> mBGAnimationID , & face -> mBGPosition , coordP ) ; loadSingleUIComponent ( i , tScript , & gData . mFightSprites , & gData . mFightAnimations , basePosition , "Face" , "bg0" , 1 , & face -> mBG0Animation , & face -> mOwnsBG0Animation , & face -> mBG0AnimationID , & face -> mBG0Position , coordP ) ; loadSingleUIComponent ( i , tScript , & gData . mFightSprites , & gData . mFightAnimations , basePosition , "Face" , "bg1" , 2 , & face -> mBG1Animation , & face -> mOwnsBG1Animation , & face -> mBG1AnimationID , & face -> mBG1Position , coordP ) ; loadSingleUIComponent ( i , tScript , getPlayerSprites ( p ) , getPlayerAnimations ( p ) , basePosition , "Face" , "face" , 3 , & face -> mFaceAnimation , & face -> mOwnsFaceAnimation , & face -> mFaceAnimationID , & face -> mFacePosition , getPlayerCoordinateP ( p ) ) ; }
<S2SV_ModStart> . z = UI_BASE_Z <S2SV_ModEnd> ; DreamPlayer *
1,888
CWE-000 static void tcg_target_qemu_prologue ( TCGContext * s ) { int i ; # ifdef _CALL_AIX void * * desc = ( void * * ) s -> code_ptr ; desc [ 0 ] = desc + 2 ; desc [ 1 ] = 0 ; s -> code_ptr = ( void * ) ( desc + 2 ) ; # endif tcg_set_frame ( s , TCG_REG_CALL_STACK , REG_SAVE_BOT - CPU_TEMP_BUF_SIZE , CPU_TEMP_BUF_SIZE ) ; tcg_out32 ( s , MFSPR | RT ( TCG_REG_R0 ) | LR ) ; tcg_out32 ( s , ( SZR == 8 ? STDU : STWU ) | SAI ( TCG_REG_R1 , TCG_REG_R1 , - FRAME_SIZE ) ) ; for ( i = 0 ; i < ARRAY_SIZE ( tcg_target_callee_save_regs ) ; ++ i ) { tcg_out_st ( s , TCG_TYPE_REG , tcg_target_callee_save_regs [ i ] , TCG_REG_R1 , REG_SAVE_BOT + i * SZR ) ; } tcg_out_st ( s , TCG_TYPE_PTR , TCG_REG_R0 , TCG_REG_R1 , FRAME_SIZE + LR_OFFSET ) ; # ifdef CONFIG_USE_GUEST_BASE if ( GUEST_BASE ) { tcg_out_movi ( s , TCG_TYPE_PTR , TCG_GUEST_BASE_REG , GUEST_BASE ) ; tcg_regset_set_reg ( s -> reserved_regs , TCG_GUEST_BASE_REG ) ; } # endif tcg_out_mov ( s , TCG_TYPE_PTR , TCG_AREG0 , tcg_target_call_iarg_regs [ 0 ] ) ; tcg_out32 ( s , MTSPR | RS ( tcg_target_call_iarg_regs [ 1 ] ) | CTR ) ; if ( USE_REG_RA ) { # ifdef _CALL_AIX tb_ret_addr = s -> code_ptr + 2 ; desc [ 1 ] = tb_ret_addr ; tcg_out_mov ( s , TCG_TYPE_PTR , TCG_REG_RA , TCG_REG_R2 ) ; tcg_out32 ( s , BCCTR | BO_ALWAYS ) ; # elif defined ( _CALL_ELF ) && _CALL_ELF == 2 tb_ret_addr = s -> code_ptr + 2 ; tcg_out32 ( s , ADDI | TAI ( TCG_REG_RA , TCG_REG_R12 , tcg_ptr_byte_diff ( tb_ret_addr , s -> code_buf ) ) ) ; tcg_out32 ( s , BCCTR | BO_ALWAYS ) ; # else tb_ret_addr = s -> code_ptr + 6 ; tcg_out_movi ( s , TCG_TYPE_PTR , TCG_REG_RA , ( intptr_t ) tb_ret_addr ) ; tcg_out32 ( s , BCCTR | BO_ALWAYS ) ; while ( s -> code_ptr < tb_ret_addr ) { tcg_out32 ( s , NOP ) ; } # endif } else { tcg_out32 ( s , BCCTR | BO_ALWAYS ) ; tb_ret_addr = s -> code_ptr ; } <S2SV_StartBug> assert ( tb_ret_addr == s -> code_ptr ) ; <S2SV_EndBug> tcg_out_ld ( s , TCG_TYPE_PTR , TCG_REG_R0 , TCG_REG_R1 , FRAME_SIZE + LR_OFFSET ) ; for ( i = 0 ; i < ARRAY_SIZE ( tcg_target_callee_save_regs ) ; ++ i ) { tcg_out_ld ( s , TCG_TYPE_REG , tcg_target_callee_save_regs [ i ] , TCG_REG_R1 , REG_SAVE_BOT + i * SZR ) ; } tcg_out32 ( s , MTSPR | RS ( TCG_REG_R0 ) | LR ) ; tcg_out32 ( s , ADDI | TAI ( TCG_REG_R1 , TCG_REG_R1 , FRAME_SIZE ) ) ; tcg_out32 ( s , BCLR | BO_ALWAYS ) ; }
<S2SV_ModStart> code_ptr ; } tcg_debug_assert <S2SV_ModEnd> ( tb_ret_addr ==
1,889
CWE-000 static int osmo_stream_cli_write ( struct osmo_stream_cli * cli ) { # ifdef HAVE_LIBSCTP struct sctp_sndrcvinfo sinfo ; # endif struct msgb * msg ; struct llist_head * lh ; int ret ; LOGP ( DLINP , LOGL_DEBUG , "sending<S2SV_blank>data\\n" ) ; if ( llist_empty ( & cli -> tx_queue ) ) { cli -> ofd . when &= ~ BSC_FD_WRITE ; return 0 ; } lh = cli -> tx_queue . next ; llist_del ( lh ) ; msg = llist_entry ( lh , struct msgb , list ) ; if ( cli -> state == STREAM_CLI_STATE_CONNECTING ) { LOGP ( DLINP , LOGL_ERROR , "not<S2SV_blank>connected,<S2SV_blank>dropping<S2SV_blank>data!\\n" ) ; return 0 ; } switch ( cli -> proto ) { # ifdef HAVE_LIBSCTP case IPPROTO_SCTP : memset ( & sinfo , 0 , sizeof ( sinfo ) ) ; <S2SV_StartBug> sinfo . sinfo_ppid = htons ( msgb_sctp_ppid ( msg ) ) ; <S2SV_EndBug> sinfo . sinfo_stream = msgb_sctp_stream ( msg ) ; ret = sctp_send ( cli -> ofd . fd , msg -> data , msgb_length ( msg ) , & sinfo , MSG_NOSIGNAL ) ; break ; # endif case IPPROTO_TCP : default : ret = send ( cli -> ofd . fd , msg -> data , msg -> len , 0 ) ; break ; } if ( ret < 0 ) { if ( errno == EPIPE || errno == ENOTCONN ) { osmo_stream_cli_reconnect ( cli ) ; } LOGP ( DLINP , LOGL_ERROR , "error<S2SV_blank>to<S2SV_blank>send\\n" ) ; } msgb_free ( msg ) ; return 0 ; }
<S2SV_ModStart> . sinfo_ppid = htonl <S2SV_ModEnd> ( msgb_sctp_ppid (
1,890
CWE-000 static void if_tag_stat_update ( const char * ifname , uid_t uid , const struct sock * sk , enum ifs_tx_rx direction , int proto , int bytes ) { struct tag_stat * tag_stat_entry ; tag_t tag , acct_tag ; tag_t uid_tag ; struct data_counters * uid_tag_counters ; struct sock_tag * sock_tag_entry ; struct iface_stat * iface_entry ; struct tag_stat * new_tag_stat = NULL ; MT_DEBUG ( "qtaguid:<S2SV_blank>if_tag_stat_update(ifname=%s<S2SV_blank>" "uid=%u<S2SV_blank>sk=%p<S2SV_blank>dir=%d<S2SV_blank>proto=%d<S2SV_blank>bytes=%d)\\n" , ifname , uid , sk , direction , proto , bytes ) ; iface_entry = get_iface_entry ( ifname ) ; if ( ! iface_entry ) { <S2SV_StartBug> pr_err_ratelimited ( "qtaguid:<S2SV_blank>iface_stat:<S2SV_blank>stat_update()<S2SV_blank>" <S2SV_EndBug> "%s<S2SV_blank>not<S2SV_blank>found\\n" , ifname ) ; return ; } <S2SV_StartBug> MT_DEBUG ( "qtaguid:<S2SV_blank>iface_stat:<S2SV_blank>stat_update()<S2SV_blank>dev=%s<S2SV_blank>entry=%p\\n" , <S2SV_EndBug> ifname , iface_entry ) ; sock_tag_entry = get_sock_stat ( sk ) ; if ( sock_tag_entry ) { tag = sock_tag_entry -> tag ; acct_tag = get_atag_from_tag ( tag ) ; uid_tag = get_utag_from_tag ( tag ) ; } else { acct_tag = make_atag_from_value ( 0 ) ; tag = combine_atag_with_uid ( acct_tag , uid ) ; uid_tag = make_tag_from_uid ( uid ) ; } <S2SV_StartBug> MT_DEBUG ( "qtaguid:<S2SV_blank>iface_stat:<S2SV_blank>stat_update():<S2SV_blank>" <S2SV_EndBug> "<S2SV_blank>looking<S2SV_blank>for<S2SV_blank>tag=0x%llx<S2SV_blank>(uid=%u)<S2SV_blank>in<S2SV_blank>ife=%p\\n" , tag , get_uid_from_tag ( tag ) , iface_entry ) ; spin_lock_bh ( & iface_entry -> tag_stat_list_lock ) ; tag_stat_entry = tag_stat_tree_search ( & iface_entry -> tag_stat_tree , tag ) ; if ( tag_stat_entry ) { tag_stat_update ( tag_stat_entry , direction , proto , bytes ) ; spin_unlock_bh ( & iface_entry -> tag_stat_list_lock ) ; return ; } tag_stat_entry = tag_stat_tree_search ( & iface_entry -> tag_stat_tree , uid_tag ) ; if ( ! tag_stat_entry ) { new_tag_stat = create_if_tag_stat ( iface_entry , uid_tag ) ; if ( ! new_tag_stat ) goto unlock ; uid_tag_counters = & new_tag_stat -> counters ; } else { uid_tag_counters = & tag_stat_entry -> counters ; } if ( acct_tag ) { new_tag_stat = create_if_tag_stat ( iface_entry , tag ) ; if ( ! new_tag_stat ) goto unlock ; new_tag_stat -> parent_counters = uid_tag_counters ; } else { BUG_ON ( ! new_tag_stat ) ; } tag_stat_update ( new_tag_stat , direction , proto , bytes ) ; unlock : spin_unlock_bh ( & iface_entry -> tag_stat_list_lock ) ; }
<S2SV_ModStart> { pr_err_ratelimited ( "qtaguid:<S2SV_blank>tag_stat:<S2SV_blank>stat_update()<S2SV_blank>" <S2SV_ModEnd> "%s<S2SV_blank>not<S2SV_blank>found\\n" , ifname <S2SV_ModStart> } MT_DEBUG ( "qtaguid:<S2SV_blank>tag_stat:<S2SV_blank>stat_update()<S2SV_blank>dev=%s<S2SV_blank>entry=%p\\n" <S2SV_ModEnd> , ifname , <S2SV_ModStart> } MT_DEBUG ( "qtaguid:<S2SV_blank>tag_stat:<S2SV_blank>stat_update():<S2SV_blank>" <S2SV_ModEnd> "<S2SV_blank>looking<S2SV_blank>for<S2SV_blank>tag=0x%llx<S2SV_blank>(uid=%u)<S2SV_blank>in<S2SV_blank>ife=%p\\n" , tag
1,891
CWE-000 void radeon_crtc_handle_vblank ( struct radeon_device * rdev , int crtc_id ) { struct radeon_crtc * radeon_crtc = rdev -> mode_info . crtcs [ crtc_id ] ; u32 update_pending ; int vpos , hpos ; if ( radeon_crtc == NULL ) return ; if ( ( radeon_use_pflipirq == 2 ) && ASIC_IS_DCE4 ( rdev ) ) return ; lockmgr ( & rdev -> ddev -> event_lock , LK_EXCLUSIVE ) ; if ( radeon_crtc -> flip_status != RADEON_FLIP_SUBMITTED ) { DRM_DEBUG_DRIVER ( "radeon_crtc->flip_status<S2SV_blank>=<S2SV_blank>%d<S2SV_blank>!=<S2SV_blank>" "RADEON_FLIP_SUBMITTED(%d)\\n" , radeon_crtc -> flip_status , RADEON_FLIP_SUBMITTED ) ; lockmgr ( & rdev -> ddev -> event_lock , LK_RELEASE ) ; return ; } update_pending = radeon_page_flip_pending ( rdev , crtc_id ) ; if ( update_pending && <S2SV_StartBug> ( DRM_SCANOUTPOS_VALID & radeon_get_crtc_scanoutpos ( rdev -> ddev , crtc_id , 0 , <S2SV_EndBug> & vpos , & hpos , NULL , NULL , & rdev -> mode_info . crtcs [ crtc_id ] -> base . hwmode ) ) && ( ( vpos >= ( 99 * rdev -> mode_info . crtcs [ crtc_id ] -> base . hwmode . crtc_vdisplay ) / 100 ) || ( vpos < 0 && ! ASIC_IS_AVIVO ( rdev ) ) ) ) { update_pending = 0 ; } lockmgr ( & rdev -> ddev -> event_lock , LK_RELEASE ) ; if ( ! update_pending ) radeon_crtc_handle_flip ( rdev , crtc_id ) ; }
<S2SV_ModStart> -> ddev , crtc_id , USE_REAL_VBLANKSTART <S2SV_ModEnd> , & vpos
1,892
CWE-000 PHP_INI_MH ( OnUpdate_stackdriver_debugger_whitelisted_functions ) { <S2SV_StartBug> if ( new_value ) { <S2SV_EndBug> char * key = NULL , * last = NULL ; HashTable * ht = user_whitelisted_functions ; char * tmp = estrndup ( ZSTR_VAL ( new_value ) , ZSTR_LEN ( new_value ) ) ; if ( user_whitelisted_functions == NULL ) { ALLOC_HASHTABLE ( user_whitelisted_functions ) ; zend_hash_init ( user_whitelisted_functions , 8 , NULL , ZVAL_PTR_DTOR , 1 ) ; } for ( key = php_strtok_r ( tmp , "," , & last ) ; key ; key = php_strtok_r ( NULL , "," , & last ) ) { zend_hash_str_add_empty_element ( user_whitelisted_functions , key , strlen ( key ) ) ; } efree ( tmp ) ; } return SUCCESS ; }
<S2SV_ModStart> OnUpdate_stackdriver_debugger_whitelisted_functions ) { <S2SV_ModEnd> return SUCCESS ;
1,893
CWE-000 PROCESS_THREAD ( app_proc_post , ev , data ) { PROCESS_BEGIN ( ) ; static uint8_t node_info_sent = 0 ; adc_init ( ) ; REFCTL0 &= ~ REFON ; lwb_start ( & app_proc_pre , & app_proc_post ) ; process_start ( & app_proc_pre , NULL ) ; if ( ! nvcfg_load ( ( uint8_t * ) & cfg ) ) { DEBUG_PRINT_MSG_NOW ( "WARNING:<S2SV_blank>failed<S2SV_blank>to<S2SV_blank>load<S2SV_blank>config" ) ; } cfg . rst_cnt ++ ; nvcfg_save ( ( uint8_t * ) & cfg ) ; bolt_set_timereq_callback ( capture_timestamp ) ; while ( 1 ) { APP_TASK_INACTIVE ; PROCESS_YIELD_UNTIL ( ev == PROCESS_EVENT_POLL ) ; APP_TASK_ACTIVE ; dpp_message_t msg ; uint16_t msg_cnt = 0 ; while ( lwb_rcv_pkt ( ( uint8_t * ) & msg , 0 , 0 ) ) { process_message ( & msg , 0 ) ; msg_cnt ++ ; } if ( msg_cnt ) { DEBUG_PRINT_INFO ( "%d<S2SV_blank>msg<S2SV_blank>rcvd<S2SV_blank>from<S2SV_blank>network" , msg_cnt ) ; } # if ( NODE_ID != HOST_ID ) || ! TIMESYNC_HOST_RCV_UTC if ( bolt_captured_trq ) { send_timestamp ( bolt_captured_trq ) ; bolt_captured_trq = 0 ; } <S2SV_StartBug> # else <S2SV_EndBug> update_time ( ) ; # endif if ( ! node_info_sent ) { # if ( NODE_ID != HOST_ID ) if ( lwb_get_time ( 0 ) ) { # else if ( ! TIMESYNC_HOST_RCV_UTC || utc_time ) { # endif send_node_info ( ) ; node_info_sent = 1 ; } } uint16_t div = lwb_get_time ( 0 ) / health_msg_period ; if ( div != last_health_pkt ) { send_node_health ( ) ; last_health_pkt = div ; } uint16_t stack_size = debug_print_get_max_stack_size ( ) ; if ( stack_size > max_stack_size ) { max_stack_size = stack_size ; DEBUG_PRINT_INFO ( "stack<S2SV_blank>size:<S2SV_blank>%uB,<S2SV_blank>max<S2SV_blank>%uB" , ( SRAM_START + SRAM_SIZE ) - ( uint16_t ) & stack_size , stack_size ) ; } debug_print_poll ( ) ; process_poll ( & app_proc_post ) ; APP_TASK_INACTIVE ; PROCESS_YIELD_UNTIL ( ev == PROCESS_EVENT_POLL ) ; APP_TASK_ACTIVE ; BEFORE_DEEPSLEEP ( ) ; } PROCESS_END ( ) ; }
<S2SV_ModStart> ; } # <S2SV_ModEnd> endif if (
1,894
CWE-000 void OTA__init ( void ) { uC__nvsInitStorage ( "otaSwVersion" , & nvsHandle_otaSwVersion ) ; <S2SV_StartBug> if ( uC__nvsReadByte ( "otaSwVersion" , nvsHandle_otaSwVersion , & otaSwVersion_NVS ) == TRUE ) <S2SV_EndBug> { ota_config . current_software_version = otaSwVersion_NVS ; } else { OTA__setCurrentSwVersion ( 0 ) ; } ota_config . server_host_name = OTA_SERVER_HOST_NAME ; ota_config . server_port = "443" ; strncpy ( ota_config . server_metadata_path , OTA_SERVER_METADATA_PATH , sizeof ( ota_config . server_metadata_path ) / sizeof ( char ) ) ; bzero ( ota_config . server_firmware_path , sizeof ( ota_config . server_firmware_path ) / sizeof ( char ) ) ; ota_config . server_root_ca_public_key_pem = server_root_ca_public_key_pem ; ota_config . peer_public_key_pem = peer_public_key_pem ; ota_config . polling_interval_s = OTA_POLLING_INTERVAL_S ; ota_config . auto_reboot = OTA_AUTO_REBOOT ; iap_https_init ( & ota_config ) ; iap_https_check_now ( ) ; }
<S2SV_ModStart> nvsHandle_otaSwVersion ) ; ota_config . current_software_version = <S2SV_ModEnd> uC__nvsReadByte ( "otaSwVersion" <S2SV_ModStart> & otaSwVersion_NVS ) ; <S2SV_ModEnd> ota_config . server_host_name
1,895
CWE-000 RTC_Error_e RTCEnableComparingReg ( NRF_RTC_Type * RTC , uint8_t registerNumber ) { switch ( registerNumber ) { case 0 : { <S2SV_StartBug> RTC -> EVTENSET |= RTC_EVTENSET_COMPARE0_Enabled << RTC_EVTENSET_COMPARE0_Pos ; <S2SV_EndBug> <S2SV_StartBug> RTC -> INTENSET |= RTC_INTENSET_COMPARE0_Enabled << RTC_INTENSET_COMPARE0_Pos ; <S2SV_EndBug> } break ; case 1 : { <S2SV_StartBug> RTC -> EVTENSET |= RTC_EVTENSET_COMPARE1_Enabled << RTC_EVTENSET_COMPARE1_Pos ; <S2SV_EndBug> <S2SV_StartBug> RTC -> INTENSET |= RTC_INTENSET_COMPARE1_Enabled << RTC_INTENSET_COMPARE1_Pos ; <S2SV_EndBug> } break ; case 2 : { <S2SV_StartBug> RTC -> EVTENSET |= RTC_EVTENSET_COMPARE2_Enabled << RTC_EVTENSET_COMPARE2_Pos ; <S2SV_EndBug> <S2SV_StartBug> RTC -> INTENSET |= RTC_INTENSET_COMPARE2_Enabled << RTC_INTENSET_COMPARE2_Pos ; <S2SV_EndBug> } break ; case 3 : { if ( RTC == NRF_RTC0 ) return E_RTC_REG_NOT_EXISTING ; <S2SV_StartBug> RTC -> EVTENSET |= RTC_EVTENSET_COMPARE3_Enabled << RTC_EVTENSET_COMPARE3_Pos ; <S2SV_EndBug> <S2SV_StartBug> RTC -> INTENSET |= RTC_INTENSET_COMPARE3_Enabled << RTC_INTENSET_COMPARE3_Pos ; <S2SV_EndBug> } break ; } return E_RTC_OK ; }
<S2SV_ModStart> RTC -> EVTENSET = <S2SV_ModEnd> RTC_EVTENSET_COMPARE0_Enabled << RTC_EVTENSET_COMPARE0_Pos <S2SV_ModStart> RTC -> INTENSET = <S2SV_ModEnd> RTC_INTENSET_COMPARE0_Enabled << RTC_INTENSET_COMPARE0_Pos <S2SV_ModStart> RTC -> EVTENSET = <S2SV_ModEnd> RTC_EVTENSET_COMPARE1_Enabled << RTC_EVTENSET_COMPARE1_Pos <S2SV_ModStart> RTC -> INTENSET = <S2SV_ModEnd> RTC_INTENSET_COMPARE1_Enabled << RTC_INTENSET_COMPARE1_Pos <S2SV_ModStart> RTC -> EVTENSET = <S2SV_ModEnd> RTC_EVTENSET_COMPARE2_Enabled << RTC_EVTENSET_COMPARE2_Pos <S2SV_ModStart> RTC -> INTENSET = <S2SV_ModEnd> RTC_INTENSET_COMPARE2_Enabled << RTC_INTENSET_COMPARE2_Pos <S2SV_ModStart> RTC -> EVTENSET = <S2SV_ModEnd> RTC_EVTENSET_COMPARE3_Enabled << RTC_EVTENSET_COMPARE3_Pos <S2SV_ModStart> RTC -> INTENSET = <S2SV_ModEnd> RTC_INTENSET_COMPARE3_Enabled << RTC_INTENSET_COMPARE3_Pos
1,896
CWE-000 SQLITE_PRIVATE Btree * sqlite3DbNameToBtree ( sqlite3 * db , const char * zDbName ) { <S2SV_StartBug> int i ; <S2SV_EndBug> for ( i = 0 ; i < db -> nDb ; i ++ ) { <S2SV_StartBug> if ( db -> aDb [ i ] . pBt <S2SV_EndBug> && ( zDbName == 0 || sqlite3StrICmp ( zDbName , db -> aDb [ i ] . zName ) == 0 ) ) { return db -> aDb [ i ] . pBt ; } <S2SV_StartBug> } <S2SV_EndBug> return 0 ; }
<S2SV_ModStart> ) { int iDb = zDbName ? sqlite3FindDbName ( db , zDbName ) : 0 ; return iDb < 0 ? 0 : <S2SV_ModEnd> db -> aDb <S2SV_ModStart> -> aDb [ iDb <S2SV_ModEnd> ] . pBt <S2SV_ModStart> pBt ; } <S2SV_ModEnd> <S2SV_null> <S2SV_null> <S2SV_null>
1,897
CWE-000 static int ath10k_mac_tx ( struct ath10k * ar , struct ieee80211_vif * vif , enum ath10k_hw_txrx_mode txmode , enum ath10k_mac_tx_path txpath , <S2SV_StartBug> struct sk_buff * skb ) <S2SV_EndBug> { struct ieee80211_hw * hw = ar -> hw ; struct ieee80211_tx_info * info = IEEE80211_SKB_CB ( skb ) ; int ret ; if ( info -> flags & IEEE80211_TX_CTL_NO_CCK_RATE ) ath10k_dbg ( ar , ATH10K_DBG_MAC , "IEEE80211_TX_CTL_NO_CCK_RATE\\n" ) ; switch ( txmode ) { case ATH10K_HW_TXRX_MGMT : case ATH10K_HW_TXRX_NATIVE_WIFI : ath10k_tx_h_nwifi ( hw , skb ) ; ath10k_tx_h_add_p2p_noa_ie ( ar , vif , skb ) ; ath10k_tx_h_seq_no ( vif , skb ) ; break ; case ATH10K_HW_TXRX_ETHERNET : ath10k_tx_h_8023 ( skb ) ; break ; case ATH10K_HW_TXRX_RAW : if ( ! ( test_bit ( ATH10K_FLAG_RAW_MODE , & ar -> dev_flags ) || test_bit ( ATH10K_FW_FEATURE_CT_RATEMASK , ar -> running_fw -> fw_file . fw_features ) ) ) { WARN_ON_ONCE ( 1 ) ; ieee80211_free_txskb ( hw , skb ) ; return - ENOTSUPP ; } } <S2SV_StartBug> if ( info -> flags & IEEE80211_TX_CTL_TX_OFFCHAN ) { <S2SV_EndBug> if ( ! ath10k_mac_tx_frm_has_freq ( ar ) ) { <S2SV_StartBug> ath10k_dbg ( ar , ATH10K_DBG_MAC , "queued<S2SV_blank>offchannel<S2SV_blank>skb<S2SV_blank>%pK\\n" , <S2SV_EndBug> skb ) ; skb_queue_tail ( & ar -> offchan_tx_queue , skb ) ; ieee80211_queue_work ( hw , & ar -> offchan_tx_work ) ; return 0 ; } } ret = ath10k_mac_tx_submit ( ar , txmode , txpath , skb ) ; if ( ret ) { ath10k_warn ( ar , "failed<S2SV_blank>to<S2SV_blank>submit<S2SV_blank>frame:<S2SV_blank>%d\\n" , ret ) ; return ret ; } return 0 ; }
<S2SV_ModStart> sk_buff * skb , bool noque_offchan <S2SV_ModStart> } if ( ( ! noque_offchan ) && <S2SV_ModStart> , ATH10K_DBG_MAC , "no-tx-frm-has-freq:<S2SV_blank>queued<S2SV_blank>offchannel<S2SV_blank>skb<S2SV_blank>%pK,<S2SV_blank>len:<S2SV_blank>%d\\n" , skb , skb -> len <S2SV_ModEnd> ) ; skb_queue_tail
1,898
CWE-000 static inline bool check_size_impl ( uint32_t oprsz , uint32_t lnsz ) <S2SV_StartBug> { <S2SV_EndBug> uint32_t lnct = oprsz / lnsz ; return lnct >= 1 && lnct <= MAX_UNROLL ; <S2SV_StartBug> } <S2SV_EndBug>
<S2SV_ModStart> uint32_t lnsz ) { if ( oprsz % lnsz == 0 ) <S2SV_ModStart> MAX_UNROLL ; } return false ; }
1,899
CWE-000 void dns_transaction_process_reply ( DnsTransaction * t , DnsPacket * p ) { usec_t ts ; int r ; assert ( t ) ; assert ( p ) ; assert ( t -> scope ) ; assert ( t -> scope -> manager ) ; if ( t -> state != DNS_TRANSACTION_PENDING ) return ; log_debug ( "Processing<S2SV_blank>incoming<S2SV_blank>packet<S2SV_blank>on<S2SV_blank>transaction<S2SV_blank>%" PRIu16 ".<S2SV_blank>(rcode=%s)" , t -> id , dns_rcode_to_string ( DNS_PACKET_RCODE ( p ) ) ) ; switch ( t -> scope -> protocol ) { case DNS_PROTOCOL_LLMNR : if ( p -> ifindex != dns_scope_ifindex ( t -> scope ) ) return ; if ( p -> family != t -> scope -> family ) return ; if ( DNS_PACKET_LLMNR_T ( p ) ) { dns_transaction_tentative ( t , p ) ; return ; } break ; case DNS_PROTOCOL_MDNS : if ( p -> ifindex != dns_scope_ifindex ( t -> scope ) ) return ; if ( p -> family != t -> scope -> family ) return ; break ; case DNS_PROTOCOL_DNS : break ; default : assert_not_reached ( "Invalid<S2SV_blank>DNS<S2SV_blank>protocol." ) ; } if ( t -> received != p ) { dns_packet_unref ( t -> received ) ; t -> received = dns_packet_ref ( p ) ; } t -> answer_source = DNS_TRANSACTION_NETWORK ; if ( p -> ipproto == IPPROTO_TCP ) { if ( DNS_PACKET_TC ( p ) ) { dns_transaction_complete ( t , DNS_TRANSACTION_INVALID_REPLY ) ; return ; } if ( DNS_PACKET_ID ( p ) != t -> id ) { dns_transaction_complete ( t , DNS_TRANSACTION_INVALID_REPLY ) ; return ; } } assert_se ( sd_event_now ( t -> scope -> manager -> event , clock_boottime_or_monotonic ( ) , & ts ) >= 0 ) ; switch ( t -> scope -> protocol ) { case DNS_PROTOCOL_DNS : assert ( t -> server ) ; if ( IN_SET ( DNS_PACKET_RCODE ( p ) , DNS_RCODE_FORMERR , DNS_RCODE_SERVFAIL , DNS_RCODE_NOTIMP ) ) { if ( t -> current_feature_level <= DNS_SERVER_FEATURE_LEVEL_UDP ) { if ( t -> n_picked_servers < dns_scope_get_n_dns_servers ( t -> scope ) ) { dns_transaction_retry ( t , true ) ; return ; } log_debug ( "Server<S2SV_blank>returned<S2SV_blank>error:<S2SV_blank>%s" , dns_rcode_to_string ( DNS_PACKET_RCODE ( p ) ) ) ; break ; } switch ( t -> current_feature_level ) { case DNS_SERVER_FEATURE_LEVEL_TLS_DO : t -> clamp_feature_level = DNS_SERVER_FEATURE_LEVEL_TLS_PLAIN ; break ; case DNS_SERVER_FEATURE_LEVEL_TLS_PLAIN + 1 : t -> clamp_feature_level = DNS_SERVER_FEATURE_LEVEL_TLS_PLAIN - 1 ; break ; default : t -> clamp_feature_level = t -> current_feature_level - 1 ; } log_debug ( "Server<S2SV_blank>returned<S2SV_blank>error<S2SV_blank>%s,<S2SV_blank>retrying<S2SV_blank>transaction<S2SV_blank>with<S2SV_blank>reduced<S2SV_blank>feature<S2SV_blank>level<S2SV_blank>%s." , dns_rcode_to_string ( DNS_PACKET_RCODE ( p ) ) , dns_server_feature_level_to_string ( t -> clamp_feature_level ) ) ; dns_transaction_retry ( t , false ) ; return ; } if ( DNS_PACKET_RCODE ( p ) == DNS_RCODE_REFUSED ) { log_debug ( "Server<S2SV_blank>returned<S2SV_blank>REFUSED,<S2SV_blank>switching<S2SV_blank>servers,<S2SV_blank>and<S2SV_blank>retrying." ) ; dns_transaction_retry ( t , true ) ; return ; } if ( DNS_PACKET_TC ( p ) ) dns_server_packet_truncated ( t -> server , t -> current_feature_level ) ; break ; case DNS_PROTOCOL_LLMNR : case DNS_PROTOCOL_MDNS : dns_scope_packet_received ( t -> scope , ts - t -> start_usec ) ; break ; default : assert_not_reached ( "Invalid<S2SV_blank>DNS<S2SV_blank>protocol." ) ; } if ( DNS_PACKET_TC ( p ) ) { if ( t -> scope -> protocol == DNS_PROTOCOL_MDNS ) { dns_transaction_complete ( t , DNS_TRANSACTION_INVALID_REPLY ) ; return ; } log_debug ( "Reply<S2SV_blank>truncated,<S2SV_blank>retrying<S2SV_blank>via<S2SV_blank>TCP." ) ; r = dns_transaction_emit_tcp ( t ) ; if ( r == - ESRCH ) { dns_transaction_complete ( t , DNS_TRANSACTION_NO_SERVERS ) ; return ; } if ( r == - EOPNOTSUPP ) { dns_transaction_complete ( t , DNS_TRANSACTION_RR_TYPE_UNSUPPORTED ) ; return ; } if ( r < 0 ) { if ( t -> scope -> protocol != DNS_PROTOCOL_DNS ) goto fail ; dns_transaction_retry ( t , true ) ; } return ; } r = dns_packet_extract ( p ) ; if ( r < 0 ) { dns_transaction_complete ( t , DNS_TRANSACTION_INVALID_REPLY ) ; return ; } if ( t -> server ) { if ( IN_SET ( DNS_PACKET_RCODE ( p ) , DNS_RCODE_SUCCESS , DNS_RCODE_NXDOMAIN ) && t -> clamp_feature_level != _DNS_SERVER_FEATURE_LEVEL_INVALID ) dns_server_packet_rcode_downgrade ( t -> server , t -> clamp_feature_level ) ; if ( ! p -> opt ) dns_server_packet_bad_opt ( t -> server , t -> current_feature_level ) ; <S2SV_StartBug> dns_server_packet_received ( t -> server , p -> ipproto , t -> current_feature_level , ts - t -> start_usec , p -> size ) ; <S2SV_EndBug> } r = dns_transaction_maybe_restart ( t ) ; if ( r < 0 ) goto fail ; if ( r > 0 ) return ; if ( IN_SET ( t -> scope -> protocol , DNS_PROTOCOL_DNS , DNS_PROTOCOL_LLMNR , DNS_PROTOCOL_MDNS ) ) { if ( t -> scope -> protocol != DNS_PROTOCOL_MDNS ) { r = dns_packet_is_reply_for ( p , t -> key ) ; if ( r < 0 ) goto fail ; if ( r == 0 ) { dns_transaction_complete ( t , DNS_TRANSACTION_INVALID_REPLY ) ; return ; } } dns_answer_unref ( t -> answer ) ; t -> answer = dns_answer_ref ( p -> answer ) ; t -> answer_rcode = DNS_PACKET_RCODE ( p ) ; t -> answer_dnssec_result = _DNSSEC_RESULT_INVALID ; t -> answer_authenticated = false ; r = dns_transaction_fix_rcode ( t ) ; if ( r < 0 ) goto fail ; t -> block_gc ++ ; r = dns_transaction_request_dnssec_keys ( t ) ; t -> block_gc -- ; if ( ! dns_transaction_gc ( t ) ) return ; if ( t -> state != DNS_TRANSACTION_PENDING ) return ; if ( r < 0 ) goto fail ; if ( r > 0 ) { t -> state = DNS_TRANSACTION_VALIDATING ; dns_transaction_close_connection ( t ) ; dns_transaction_stop_timeout ( t ) ; return ; } } dns_transaction_process_dnssec ( t ) ; return ; fail : t -> answer_errno = - r ; dns_transaction_complete ( t , DNS_TRANSACTION_ERRNO ) ; }
<S2SV_ModStart> -> current_feature_level , <S2SV_ModEnd> p -> size