nus-yam/ex-repair huggingface dataset:
Buggy code:
 int vp9_lookahead_push ( struct lookahead_ctx * ctx, YV12_BUFFER_CONFIG * src, <START_BUG> int64_t ts_start, int64_t ts_end, unsigned int flags ) { <END_BUG> struct lookahead_entry * buf ; # if USE_PARTIAL_COPY int row, col, active_end ; int mb_rows = ( src -> y_height + 15 ) >> 4 ; int mb_cols = ( src -> y_width + 15 ) >> 4 ;  # endif <START_BUG> if ( ctx -> sz + 1 + MAX_PRE_FRAMES > ctx -> max_sz ) return 1 ; ctx -> sz ++ ; buf = pop ( ctx, & ctx -> write_idx ) ; <END_BUG> # if USE_PARTIAL_COPY  <START_BUG> if ( ctx -> max_sz == 1 && active_map &&! flags ) { <END_BUG> for ( row = 0 ; row < mb_rows ; ++ row ) { col = 0 ; while ( 1 ) { for ( ; col < mb_cols ; ++ col ) { if ( active_map [ col ] ) break ; } if ( col == mb_cols ) break ; active_end = col ; for ( ; active_end < mb_cols ; ++ active_end ) { if (! active_map [ active_end ] ) break ; } vp9_copy_and_extend_frame_with_rect ( src, & buf -> img, row << 4, col << 4, 16, ( active_end - col ) << 4 ) ; col = active_end ; } active_map += mb_cols ; } } else {  vp9_copy_and_extend_frame ( src, & buf -> img ) ; <START_BUG> <END_BUG> }  # else vp9_copy_and_extend_frame ( src, & buf -> img ) ; # endif buf -> ts_start = ts_start ; buf -> ts_end = ts_end ; buf -> flags = flags ; return 0 ; }

Fix:
<S2SV_ModStart> int64_t ts_end, # if CONFIG_VP9_HIGHBITDEPTH int use_highbitdepth, # endif <S2SV_ModStart> ; # endif int width = src -> y_crop_width ; int height = src -> y_crop_height ; int uv_width = src -> uv_crop_width ; int uv_height = src -> uv_crop_height ; int subsampling_x = src -> subsampling_x ; int subsampling_y = src -> subsampling_y ; int larger_dimensions, new_dimensions ; <S2SV_ModStart> write_idx ) ; new_dimensions = width!= buf -> img. y_crop_width || height!= buf -> img. y_crop_height || uv_width!= buf -> img. uv_crop_width || uv_height!= buf -> img. uv_crop_height ; larger_dimensions = width > buf -> img. y_width || height > buf -> img. y_height || uv_width > buf -> img. uv_width || uv_height > buf -> img. uv_height ; assert (! larger_dimensions || new_dimensions ) ; <S2SV_ModStart> USE_PARTIAL_COPY if (! new_dimensions && <S2SV_ModStart> } else
Buggy code:
 <START_BUG> static TX_MODE read_tx_mode ( vp9_reader * r ) { <END_BUG>  TX_MODE tx_mode = vp9_read_literal ( r, 2 ) ; <START_BUG> if ( tx_mode == ALLOW_32X32 ) <END_BUG> tx_mode += vp9_read_bit ( r ) ;  return tx_mode ; }

Fix:
<S2SV_ModStart> TX_MODE read_tx_mode ( vpx_reader <S2SV_ModEnd> * r ) <S2SV_ModStart> TX_MODE tx_mode = vpx_read_literal <S2SV_ModEnd> ( r, <S2SV_ModStart> ) tx_mode += vpx_read_bit <S2SV_ModEnd> ( r )
Buggy code:
 static struct svc_serv * nfs_callback_create_svc ( int minorversion ) { struct nfs_callback_data * cb_info = & nfs_callback_info [ minorversion ] ; struct svc_serv * serv ; struct svc_serv_ops * sv_ops ; if ( cb_info -> serv ) { svc_get ( cb_info -> serv ) ; return cb_info -> serv ; } switch ( minorversion ) { case 0 : sv_ops = nfs4_cb_sv_ops [ 0 ] ; break ; default : sv_ops = nfs4_cb_sv_ops [ 1 ] ; } if ( sv_ops == NULL ) return ERR_PTR ( - ENOTSUPP ) ; if ( cb_info -> users ) printk ( KERN_WARNING "nfs_callback_create_svc:   no   kthread,   %d   users??\\n", cb_info -> users ) ; <START_BUG> serv = svc_create ( & nfs4_callback_program, NFS4_CALLBACK_BUFSIZE, sv_ops ) ; <END_BUG> if (! serv ) { printk ( KERN_ERR "nfs_callback_create_svc:   create   service   failed\\n" ) ; return ERR_PTR ( - ENOMEM ) ; } cb_info -> serv = serv ; serv -> sv_maxconn = 1024 ; dprintk ( "nfs_callback_create_svc:   service   created\\n" ) ; return serv ; }

Fix:
<S2SV_ModStart> ; serv = svc_create_pooled <S2SV_ModEnd> ( & nfs4_callback_program
Buggy code:
 <START_BUG> static vp9_variance_fn_t get_block_variance_fn ( BLOCK_SIZE bsize ) { <END_BUG> switch ( bsize ) { case BLOCK_8X8 :  return vp9_mse8x8 ; <START_BUG> case BLOCK_16X8 : <END_BUG> return vp9_mse16x8 ;  case BLOCK_8X16 : <START_BUG> return vp9_mse8x16 ; <END_BUG> default :  return vp9_mse16x16 ; <START_BUG> } }<END_BUG>

Fix:
<S2SV_ModStart> <S2SV_null> <S2SV_null> static vpx_variance_fn_t <S2SV_ModEnd> get_block_variance_fn ( BLOCK_SIZE <S2SV_ModStart> BLOCK_8X8 : return vpx_mse8x8 <S2SV_ModEnd> ; case BLOCK_16X8 <S2SV_ModStart> BLOCK_16X8 : return vpx_mse16x8 <S2SV_ModEnd> ; case BLOCK_8X16 <S2SV_ModStart> BLOCK_8X16 : return vpx_mse8x16 <S2SV_ModEnd> ; default : <S2SV_ModStart> default : return vpx_mse16x16 <S2SV_ModEnd> ; } }
Buggy code:
 MagickBooleanType sixel_decode ( unsigned char * p, unsigned char * * pixels, size_t * pwidth, size_t * pheight, unsigned char * * palette, size_t * ncolors ) { int n, i, r, g, b, sixel_vertical_mask, c ; int posision_x, posision_y ; int max_x, max_y ; int attributed_pan, attributed_pad ; int attributed_ph, attributed_pv ; int repeat_count, color_index, max_color_index = 2, background_color_index ; int param [ 10 ] ; int sixel_palet [ SIXEL_PALETTE_MAX ] ; unsigned char * imbuf, * dmbuf ; int imsx, imsy ; int dmsx, dmsy ; int y ; posision_x = posision_y = 0 ; max_x = max_y = 0 ; attributed_pan = 2 ; attributed_pad = 1 ; attributed_ph = attributed_pv = 0 ; repeat_count = 1 ; color_index = 0 ; background_color_index = 0 ; imsx = 2048 ; imsy = 2048 ; <START_BUG> imbuf = ( unsigned char * ) AcquireQuantumMemory ( imsx * imsy, 1 ) ; <END_BUG> if ( imbuf == NULL ) { return ( MagickFalse ) ; } for ( n = 0 ; n < 16 ; n ++ ) { sixel_palet [ n ] = sixel_default_color_table [ n ] ; } for ( r = 0 ; r < 6 ; r ++ ) { for ( g = 0 ; g < 6 ; g ++ ) { for ( b = 0 ; b < 6 ; b ++ ) { sixel_palet [ n ++ ] = SIXEL_RGB ( r * 51, g * 51, b * 51 ) ; } } } for ( i = 0 ; i < 24 ; i ++ ) { sixel_palet [ n ++ ] = SIXEL_RGB ( i * 11, i * 11, i * 11 ) ; } for ( ; n < SIXEL_PALETTE_MAX ; n ++ ) { sixel_palet [ n ] = SIXEL_RGB ( 255, 255, 255 ) ; }  ( void ) Reset

Fix:
<S2SV_ModStart> AcquireQuantumMemory ( imsx, imsy <S2SV_ModEnd> ) ; if <S2SV_ModStart>, background_color_index, ( size_t ) <S2SV_ModStart> AcquireQuantumMemory ( dmsx, dmsy <S2SV_ModEnd> ) ; if <S2SV_ModStart>, background_color_index, ( size_t ) <S2SV_ModStart>, imbuf + ( size_t ) <S2SV_ModStart> AcquireQuantumMemory ( dmsx, dmsy <S2SV_ModEnd> ) ; if <S2SV_ModStart>, background_color_index, ( size_t ) <S2SV_ModStart>, imbuf + ( size_t ) <S2SV_ModStart> ( imbuf + ( size_t ) <S2SV_ModStart> AcquireQuantumMemory ( dmsx, dmsy <S2SV_ModEnd> ) ) ==
Buggy code:
 <START_BUG> static void <END_BUG> modify_bar_registration ( struct pci_vdev * dev, int idx, int registration ) { int error ; struct inout_port iop ; struct mem_range mr ; if ( is_pci_gvt ( dev ) ) { printf ( "modify_bar_registration:   bypass   for   pci-gvt\\n" ) ;  return ; <START_BUG> } switch ( dev -> bar [ idx ]. type ) { case PCIBAR_IO : bzero ( & iop, sizeof ( struct inout_port ) ) ; iop. name = dev -> name ; iop. port = dev -> bar [ idx ]. addr ; iop. size = dev -> bar [ idx ]. size ; if ( registration ) { iop. flags = IOPORT_F_INOUT ; iop. handler = pci_emul_io_handler ; iop. arg = dev ; error = register_inout ( & iop ) ; } else error = unregister_inout ( & iop ) ; break ; case PCIBAR_MEM32 : case PCIBAR_MEM64 : bzero ( & mr, sizeof ( struct mem_range ) ) ; mr. name = dev -> name ; mr. base = dev -> bar [ idx ]. addr ; mr. size = dev -> bar [ idx ]. size ; if ( registration ) { mr. flags = MEM_F_RW ; mr. handler = pci_emul_mem_handler ; mr. arg1 = dev ; mr. arg2 = idx ; error = register_mem ( & mr ) ; } else error = unregister_mem ( & mr ) ; break ; default : error = EINVAL ; break ; } <END_BUG> assert ( error == 0 ) ;  }

Fix:
<S2SV_ModStart> <S2SV_null> <S2SV_null> static int <S2SV_ModEnd> modify_bar_registration ( struct <S2SV_ModStart> ) ; return 0 <S2SV_ModStart> break ; } return error <S2SV_ModEnd> ; } <S2SV_null>
Buggy code:
 <START_BUG> static void show_psnr ( struct stream_state * stream ) { <END_BUG> int i ; double ovpsnr ; if (! stream -> psnr_count ) return ; fprintf ( stderr, "Stream   %d   PSNR   (Overall//Avg//Y//U//V)", stream -> index ) ;  ovpsnr = sse_to_psnr ( ( double ) stream -> psnr_samples_total, 255.0, <START_BUG> ( double ) stream -> psnr_sse_total ) ; fprintf ( stderr, "   %.3f", ovpsnr ) ; for ( i = 0 ; i < 4 ; i ++ ) { fprintf ( stderr, "   %.3f", stream -> psnr_totals [ i ] // stream -> psnr_count ) ; } fprintf ( stderr, "\\n" ) ; }<END_BUG>

Fix:
<S2SV_ModStart> stream_state * stream, double peak <S2SV_ModStart> -> psnr_samples_total, peak <S2SV_ModEnd>, ( double
Buggy code:
 WORD32 ixheaacd_complex_anal_filt ( ia_esbr_hbe_txposer_struct * ptr_hbe_txposer ) { WORD32 idx ; WORD32 anal_size = 2 * ptr_hbe_txposer -> synth_size ; WORD32 N = ( 10 * anal_size ) ; for ( idx = 0 ; idx < ( ptr_hbe_txposer -> no_bins >> 1 ) ; idx ++ ) { WORD32 i, j, k, l ; FLOAT32 window_output [ 640 ] ; FLOAT32 u [ 128 ], u_in [ 256 ], u_out [ 256 ] ; FLOAT32 accu_r, accu_i ; const FLOAT32 * inp_signal ; FLOAT32 * anal_buf ; FLOAT32 * analy_cos_sin_tab = ptr_hbe_txposer -> analy_cos_sin_tab ; const FLOAT32 * interp_window_coeff = ptr_hbe_txposer -> analy_wind_coeff ; FLOAT32 * x = ptr_hbe_txposer -> analy_buf ; memset ( ptr_hbe_txposer -> qmf_in_buf [ idx + HBE_OPER_WIN_LEN - 1 ], 0, TWICE_QMF_SYNTH_CHANNELS_NUM * sizeof ( FLOAT32 ) ) ; inp_signal = ptr_hbe_txposer -> ptr_input_buf + idx * 2 * ptr_hbe_txposer -> synth_size + 1 ; anal_buf = & ptr_hbe_txposer -> qmf_in_buf [ idx + HBE_OPER_WIN_LEN - 1 ] [ 4 * ptr_hbe_txposer -> k_start ] ; for ( i = N - 1 ; i >= anal_size ; i -- ) { x [ i ] = x [ i - anal_size ] ; } for ( i = anal_size - 1 ; i >= 0 ; i -- ) { x [ i ] = inp_signal [ anal_size - 1 - i ] ; } for ( i = 0 ; i < N ; i ++ ) { window_output [ i ] = x [ i ] * interp_window_coeff [ i ] ; } for ( i = 0 ; i < 2 * an

Fix:
<S2SV_ModStart> } if ( ptr_hbe_txposer -> <S2SV_ModStart> ) ( * ( ptr_hbe_txposer -> ixheaacd_cmplx_anal_fft ) ) <S2SV_ModEnd> ( u_in,
Buggy code:
 <START_BUG> static void nonrd_pick_sb_modes ( VP9_COMP * cpi, const TileInfo * const tile, <END_BUG> int mi_row, int mi_col, int * rate, int64_t * dist, BLOCK_SIZE bsize ) { VP9_COMMON * const cm = & cpi -> common ; MACROBLOCK * const x = & cpi -> mb ; MACROBLOCKD * const xd = & x -> e_mbd ;  set_offsets ( cpi, tile, mi_row, mi_col, bsize ) ; <START_BUG> <END_BUG> xd -> mi [ 0 ] -> mbmi. sb_type = bsize ;  if (! frame_is_intra_only ( cm ) ) { <START_BUG> vp9_pick_inter_mode ( cpi, x, tile, mi_row, mi_col, <END_BUG> rate, dist, bsize ) ; } else { MB_PREDICTION_MODE intramode = DC_PRED ; set_mode_info ( & xd -> mi [ 0 ] -> mbmi, bsize, intramode ) ; } duplicate_mode_info_in_sb ( cm, xd, mi_row, mi_col, bsize ) ; }

Fix:
<S2SV_ModStart> * cpi, TileDataEnc * tile_data, MACROBLOCK * const x, int mi_row, int mi_col, RD_COST * rd_cost, BLOCK_SIZE bsize, PICK_MODE_CONTEXT * ctx ) { VP9_COMMON * const cm = & cpi -> common ; <S2SV_ModEnd> TileInfo * const <S2SV_ModStart> TileInfo * const tile_info = & tile_data -> tile_info <S2SV_ModEnd> ; MACROBLOCKD * <S2SV_ModStart> -> e_mbd ; MB_MODE_INFO * mbmi ; <S2SV_ModStart> ( cpi, tile_info, x, mi_row, mi_col, bsize ) ; mbmi = & <S2SV_ModEnd> xd -> mi <S2SV_ModStart> ] -> mbmi ; mbmi -> sb_type = bsize ; if ( cpi -> oxcf. aq_mode == CYCLIC_REFRESH_AQ && cm -> seg. enabled ) if ( cyclic_refresh_segment_id_boosted ( mbmi -> segment_id ) ) x -> rdmult = vp9_cyclic_refresh_get_rdmult ( cpi -> cyclic_refresh ) ; if ( cm -> frame_type == KEY_FRAME ) hybrid_
Buggy code:
 static int cdxl_decode_frame ( AVCodecContext * avctx, void * data, int * got_frame, AVPacket * pkt ) { CDXLVideoContext * c = avctx -> priv_data ; AVFrame * const p = data ; int ret, w, h, encoding, aligned_width, buf_size = pkt -> size ; const uint8_t * buf = pkt -> data ; if ( buf_size < 32 ) return AVERROR_INVALIDDATA ; encoding = buf [ 1 ] & 7 ; c -> format = buf [ 1 ] & 0xE0 ; w = AV_RB16 ( & buf [ 14 ] ) ; h = AV_RB16 ( & buf [ 16 ] ) ; c -> bpp = buf [ 19 ] ; c -> palette_size = AV_RB16 ( & buf [ 20 ] ) ; c -> palette = buf + 32 ; c -> video = c -> palette + c -> palette_size ; c -> video_size = buf_size - c -> palette_size - 32 ; if ( c -> palette_size > 512 ) return AVERROR_INVALIDDATA ; if ( buf_size < c -> palette_size + 32 ) return AVERROR_INVALIDDATA ; if ( c -> bpp < 1 ) return AVERROR_INVALIDDATA ; if ( c -> format!= BIT_PLANAR && c -> format!= BIT_LINE && c -> format!= CHUNKY ) { avpriv_request_sample ( avctx, "Pixel   format   0x%0x", c -> format ) ; return AVERROR_PATCHWELCOME ; } if ( ( ret = ff_set_dimensions ( avctx, w, h ) ) < 0 ) return ret ; if ( c -> format == CHUNKY ) aligned_width = avctx -> width ; else aligned_width = FFALIGN ( c -> avctx -> width, 16 ) ; c -> padded_bits = aligned_width - c -> avctx -> width ; if ( c -> video_size < aligned_width * avctx -> height * ( int64_t ) c -> bpp // 8 ) return AVERROR_INVALIDDATA ; if (! encoding && c -> palette_size && c -> bpp <= 8 && c -> format!= CHUNKY ) { avctx -> pix_fmt = AV_PIX_FMT_PAL8 ; <START_BUG> }<END_BUG>

Fix:
<S2SV_ModStart> == 8 ) && c -> format!= CHUNKY
Buggy code:
 static int _server_handle_vCont ( libgdbr_t * g, int ( * cmd_cb ) ( void *, const char *, char *, size_t ), void * core_ptr ) { char * action = NULL ; if ( send_ack ( g ) < 0 ) { return - 1 ; } g -> data [ g -> data_len ] = '\\0' ; if ( g -> data [ 5 ] == '?' ) { return send_msg ( g, "vCont;c;s" ) ; } if (! ( action = strtok ( g -> data, ";" ) ) ) { return send_msg ( g, "E01" ) ; } while ( action = strtok ( NULL, ";" ) ) { eprintf ( "action:   %s\\n", action ) ; switch ( action [ 0 ] ) { case's' : if ( cmd_cb ( core_ptr, "ds", NULL, 0 ) < 0 ) { send_msg ( g, "E01" ) ; return - 1 ; } return send_msg ( g, "OK" ) ; case 'c' : if ( cmd_cb ( core_ptr, "dc", NULL, 0 ) < 0 ) { send_msg ( g, "E01" ) ; return - 1 ; } return send_msg ( g, "OK" ) ; default : return send_msg ( g, "E01" ) ; } } <START_BUG> } <END_BUG>

Fix:
<S2SV_ModStart> ; } } return - 1 ;
Buggy code:
 void close_uinput ( void ) { BTIF_TRACE_DEBUG ( "%s", __FUNCTION__ ) ; if ( uinput_fd > 0 ) { <START_BUG> ioctl ( uinput_fd, UI_DEV_DESTROY ) ; <END_BUG> close ( uinput_fd ) ; uinput_fd = - 1 ; } }

Fix:
<S2SV_ModStart> 0 ) { TEMP_FAILURE_RETRY ( <S2SV_ModStart> uinput_fd, UI_DEV_DESTROY )
Buggy code:
 <START_BUG> void unbind_ports ( void ) { <END_BUG> SERVICE_OPTIONS * opt ; s_poll_init ( fds, 1 ) ;  CRYPTO_THREAD_write_lock ( stunnel_locks [ LOCK_SECTIONS ] ) ; <START_BUG> opt = service_options. next ; <END_BUG> service_options. next = NULL ;  service_free ( & service_options ) ; while ( opt ) { unsigned i ; s_log ( LOG_DEBUG, "Unbinding   service   [%s]", opt -> servname ) ; for ( i = 0 ; i < opt -> local_addr. num ; ++ i ) unbind_port ( opt, i ) ; if ( opt -> exec_name && opt -> connect_addr. names ) { opt -> option. retry = 0 ; } <START_BUG> if ( opt -> ctx ) <END_BUG> SSL_CTX_flush_sessions ( opt -> ctx, ( long ) time ( NULL ) + opt -> session_timeout + 1 ) ; s_log ( LOG_DEBUG, "Service   [%s]   closed", opt -> servname ) ;  { <START_BUG> SERVICE_OPTIONS * garbage = opt ; opt = opt -> next ; garbage -> next = NULL ; service_free ( garbage ) ; } } CRYPTO_THREAD_unlock ( stunnel_locks [ LOCK_SECTIONS ] ) ; }<END_BUG>

Fix:
<S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> NOEXPORT <S2SV_ModStart> 1 ) ; for ( <S2SV_ModEnd> opt = service_options <S2SV_ModStart>. next ; opt ; opt = opt -> next <S2SV_ModEnd> ) { unsigned <S2SV_ModStart> 0 ; } <S2SV_ModEnd> s_log ( LOG_DEBUG <S2SV_ModStart> servname ) ; } } <S2SV_ModEnd> <S2SV_null> <S2SV_null> <S2SV_null>
Buggy code:
 static int makeDirDirective ( MaState * state, cchar * key, cchar * value ) { MprPath info ; char * auth, * dirs, * path, * perms, * tok ; cchar * dir, * group, * owner ; int gid, mode, uid ; if (! maTokenize ( state, value, "%S  ?*", & auth, & dirs ) ) { return MPR_ERR_BAD_SYNTAX ; } uid = gid = 0 ; mode = 0750 ; if ( schr ( auth, ':' ) ) { <START_BUG> owner = stok ( auth, ":", & tok ) ; <END_BUG> if ( owner && * owner ) { if ( snumber ( owner ) ) { uid = ( int ) stoi ( owner ) ; } else if ( smatch ( owner, "APPWEB" ) ) { uid = HTTP -> uid ; } else { uid = userToID ( owner ) ; } }  group = stok ( tok, ":", & perms ) ; <START_BUG> if ( group && * group ) { if ( snumber ( group ) ) { gid = ( int ) stoi ( group ) ; } else if ( smatch ( owner, "APPWEB" ) ) { gid = HTTP -> gid ; } else { gid = groupToID ( group ) ; } } if ( perms && snumber ( perms ) ) { mode = ( int ) stoiradix ( perms, - 1, NULL ) ; } else { mode = 0 ; } if ( gid < 0 || uid < 0 ) { return MPR_ERR_BAD_SYNTAX ; } } else { dirs = auth ; auth = 0 ; } tok = dirs ; for ( tok = sclone ( dirs ) ; ( dir = stok ( tok, ",", & tok ) )!= 0 ; ) { path = httpMakePath ( state -> route, state -> configDir, dir ) ; if ( mprGetPathInfo ( path, & info ) == 0 && info. isDir ) { continue ; } if ( mprMakeDir ( path, mode, uid, gid, 1 ) < 0 ) { return MPR_ERR_BAD_SYNTAX ; } } return 0 ; }<END_BUG>

Fix:
<S2SV_ModStart> { owner = ssplit <S2SV_ModEnd> ( auth, <S2SV_ModStart> } group = ssplit <S2SV_ModEnd> ( tok,
Buggy code:
 static void youngcollection ( lua_State * L, global_State * g ) { GCObject * * psurvival ; lua_assert ( g -> gcstate == GCSpropagate ) ; <START_BUG> markold ( g, g -> survival, g -> reallyold ) ; <END_BUG> markold ( g, g -> finobj, g -> finobjrold ) ; atomic ( L ) ; psurvival = sweepgen ( L, g, & g -> allgc, g -> survival ) ; sweepgen ( L, g, psurvival, g -> reallyold ) ; g -> reallyold = g -> old ; g -> old = * psurvival ; g -> survival = g -> allgc ; psurvival = sweepgen ( L, g, & g -> finobj, g -> finobjsur ) ; sweepgen ( L, g, psurvival, g -> finobjrold ) ; g -> finobjrold = g -> finobjold ; g -> finobjold = * psurvival ; g -> finobjsur = g -> finobj ; sweepgen ( L, g, & g -> tobefnz, NULL ) ; finishgencycle ( L, g ) ; }

Fix:
<S2SV_ModStart>, g -> allgc <S2SV_ModEnd>, g ->
Buggy code:
 int imap_open_connection ( struct ImapAccountData * adata ) { if ( mutt_socket_open ( adata -> conn ) < 0 ) return - 1 ; adata -> state = IMAP_CONNECTED ; if ( imap_cmd_step ( adata )!= IMAP_RES_OK ) { imap_close_connection ( adata ) ; return - 1 ; } if ( mutt_istr_startswith ( adata -> buf, "*   OK" ) ) { if (! mutt_istr_startswith ( adata -> buf, "*   OK   [CAPABILITY" ) && check_capabilities ( adata ) ) { goto bail ; } # ifdef USE_SSL if ( ( adata -> conn -> ssf == 0 ) && ( C_SslForceTls || ( adata -> capabilities & IMAP_CAP_STARTTLS ) ) ) { enum QuadOption ans ; if ( C_SslForceTls ) ans = MUTT_YES ; else if ( ( ans = query_quadoption ( C_SslStarttls, _ ( "Secure   connection   with   TLS?" ) ) ) == MUTT_ABORT ) { <START_BUG> goto err_close_conn ; <END_BUG> } if ( ans == MUTT_YES ) { enum ImapExecResult rc = imap_exec ( adata, "STARTTLS", IMAP_CMD_SINGLE ) ; mutt_socket_empty ( adata -> conn ) ; if ( rc == IMAP_EXEC_FATAL ) goto bail ; if ( rc!= IMAP_EXEC_ERROR ) { if ( mutt_ssl_starttls ( adata -> conn ) ) { mutt_error ( _ ( "Could   not   negotiate   TLS   connection" ) ) ;  goto err_close_conn ; <START_BUG> } else { if ( imap_exec ( adata, "CAPABILITY", IMAP_CMD_NO_FLAGS ) ) goto bail ; } } } } if ( C_SslForceTls && ( adata -> conn -> ssf == 0 ) ) { mutt_error ( _ ( "Encrypted   connection   unavailable" ) ) ; <END_BUG> goto err_close_conn ;  } # endif } else if ( mutt_istr_startswith ( adata -> buf, "*   PREAUTH" ) ) { # ifdef USE_SSL if ( ( adata -> conn -> ssf == 0 ) && C_

Fix:
<S2SV_ModStart> ) { goto bail <S2SV_ModEnd> ; } if <S2SV_ModStart> ) ; goto bail <S2SV_ModEnd> ; } else <S2SV_ModStart> ) ; goto bail <S2SV_ModEnd> ; } # <S2SV_ModStart> ) ; goto bail <S2SV_ModEnd> ; } # <S2SV_ModStart> return 0 ; bail <S2SV_ModEnd> : imap_close_connection ( <S2SV_ModStart> adata ) ; <S2SV_ModEnd> FREE ( &
Buggy code:
 char * problem_data_save ( problem_data_t * pd ) { load_abrt_conf ( ) ; <START_BUG> struct dump_dir * dd = create_dump_dir_from_problem_data ( pd, g_settings_dump_location ) ; <END_BUG> char * problem_id = NULL ; if ( dd ) { problem_id = xstrdup ( dd -> dd_dirname ) ; dd_close ( dd ) ; } log_info ( "problem   id:   \'%s\'", problem_id ) ; return problem_id ; }

Fix:
<S2SV_ModStart> struct dump_dir * dd = NULL ; if ( g_settings_privatereports ) dd = create_dump_dir_from_problem_data_ext ( pd, g_settings_dump_location, 0 ) ; else
Buggy code:
 static int usb_enumerate_device_otg ( struct usb_device * udev ) { int err = 0 ; # ifdef CONFIG_USB_OTG if (! udev -> bus -> is_b_host && udev -> config && udev -> parent == udev -> bus -> root_hub ) { struct usb_otg_descriptor * desc = NULL ; struct usb_bus * bus = udev -> bus ; unsigned port1 = udev -> portnum ; err = __usb_get_extra_descriptor ( udev -> rawdescriptors [ 0 ], le16_to_cpu ( udev -> config [ 0 ]. desc. wTotalLength ), <START_BUG> USB_DT_OTG, ( void * * ) & desc ) ; <END_BUG> if ( err ||! ( desc -> bmAttributes & USB_OTG_HNP ) ) return 0 ; dev_info ( & udev -> dev, "Dual-Role   OTG   device   on   %sHNP   port\\n", ( port1 == bus -> otg_port )? "" : "non-" ) ; if ( port1 == bus -> otg_port ) { bus -> b_hnp_enable = 1 ; err = usb_control_msg ( udev, usb_sndctrlpipe ( udev, 0 ), USB_REQ_SET_FEATURE, 0, USB_DEVICE_B_HNP_ENABLE, 0, NULL, 0, USB_CTRL_SET_TIMEOUT ) ; if ( err < 0 ) { dev_err ( & udev -> dev, "can\'t   set   HNP   mode:   %d\\n", err ) ; bus -> b_hnp_enable = 0 ; } } else if ( desc -> bLength == sizeof ( struct usb_otg_descriptor ) ) { err = usb_control_msg ( udev, usb_sndctrlpipe ( udev, 0 ), USB_REQ_SET_FEATURE, 0, USB_DEVICE_A_ALT_HNP_SUPPORT, 0, NULL, 0, USB_CTRL_SET_TIMEOUT ) ; if ( err < 0 ) dev_err ( & udev -> dev, "set   a_alt_hnp_support   failed:   %d\\n", err )

Fix:
<S2SV_ModStart> ) & desc, sizeof ( * desc )
Buggy code:
 void icmp_send ( struct sk_buff * skb_in, int type, int code, __be32 info ) { struct iphdr * iph ; int room ; struct icmp_bxm icmp_param ; struct rtable * rt = skb_rtable ( skb_in ) ; struct ipcm_cookie ipc ; __be32 saddr ; u8 tos ; struct net * net ; struct sock * sk ; if (! rt ) goto out ; net = dev_net ( rt -> dst. dev ) ; iph = ip_hdr ( skb_in ) ; if ( ( u8 * ) iph < skb_in -> head || ( skb_in -> network_header + sizeof ( * iph ) ) > skb_in -> tail ) goto out ; if ( skb_in -> pkt_type!= PACKET_HOST ) goto out ; if ( rt -> rt_flags & ( RTCF_BROADCAST | RTCF_MULTICAST ) ) goto out ; if ( iph -> frag_off & htons ( IP_OFFSET ) ) goto out ; if ( icmp_pointers [ type ]. error ) { if ( iph -> protocol == IPPROTO_ICMP ) { u8 _inner_type, * itp ; itp = skb_header_pointer ( skb_in, skb_network_header ( skb_in ) + ( iph -> ihl << 2 ) + offsetof ( struct icmphdr, type ) - skb_in -> data, sizeof ( _inner_type ), & _inner_type ) ; if ( itp == NULL ) goto out ; if ( * itp > NR_ICMP_TYPES || icmp_pointers [ * itp ]. error ) goto out ; } } sk = icmp_xmit_lock ( net ) ; if ( sk == NULL ) return ; saddr = iph -> daddr ; if (! ( rt -> rt_flags & RTCF_LOCAL ) ) { struct net_device * dev = NULL ; rcu_read_lock ( ) ; if ( rt_is_input_route ( rt ) && net -> ipv4. sysctl_icmp_errors_use_inbound_ifaddr ) dev = dev_get_by_

Fix:
<S2SV_ModStart> icmp_param. replyopts. opt. opt <S2SV_ModStart> icmp_param. replyopts. opt <S2SV_ModStart>. replyopts. opt. opt.
Buggy code:
 void test_checkout_nasty__git_tilde1 ( void ) { <START_BUG> # ifdef GIT_WIN32 <END_BUG> test_checkout_fails ( "refs//heads//git_tilde1", ".git//foobar" ) ;  # endif <START_BUG> }<END_BUG>

Fix:
<S2SV_ModStart> void ) { <S2SV_ModEnd> test_checkout_fails ( "refs//heads//git_tilde1" <S2SV_ModStart> ".git//foobar" ) ; test_checkout_fails ( "refs//heads//git_tilde1", "git~1//foobar" ) ; <S2SV_ModEnd> } <S2SV_null> <S2SV_null>
Buggy code:
 static int calc_pframe_target_size_one_pass_vbr ( const VP9_COMP * const cpi ) { static const int af_ratio = 10 ; const RATE_CONTROL * const rc = & cpi -> rc ; int target ; # if USE_ALTREF_FOR_ONE_PASS target = (! rc -> is_src_frame_alt_ref && ( cpi -> refresh_golden_frame || cpi -> refresh_alt_ref_frame ) )? <START_BUG> ( rc -> av_per_frame_bandwidth * rc -> baseline_gf_interval * af_ratio ) // <END_BUG> ( rc -> baseline_gf_interval + af_ratio - 1 ) :  ( rc -> av_per_frame_bandwidth * rc -> baseline_gf_interval ) // <START_BUG> ( rc -> baseline_gf_interval + af_ratio - 1 ) ; # else <END_BUG> target = rc -> av_per_frame_bandwidth ;  # endif return vp9_rc_clamp_pframe_target_size ( cpi, target ) ; }

Fix:
<S2SV_ModStart> ( rc -> avg_frame_bandwidth <S2SV_ModEnd> * rc -> <S2SV_ModStart> ( rc -> avg_frame_bandwidth <S2SV_ModEnd> * rc -> <S2SV_ModStart> = rc -> avg_frame_bandwidth <S2SV_ModEnd> ; # endif
Buggy code:
 static ssize_t _epoll_write ( oe_fd_t * epoll_, const void * buf, size_t count ) { ssize_t ret = - 1 ; <START_BUG> epoll_t * epoll = _cast_epoll ( epoll_ ) ; <END_BUG> oe_errno = 0 ;  if ( oe_syscall_write_ocall ( & ret, epoll -> host_fd, buf, count )!= OE_OK ) <START_BUG> OE_RAISE_ERRNO ( OE_EINVAL ) ; <END_BUG> done :  return ret ; }

Fix:
<S2SV_ModStart> ; epoll_t * file <S2SV_ModEnd> = _cast_epoll ( <S2SV_ModStart> ; if (! file || count > OE_SSIZE_MAX ) OE_RAISE_ERRNO ( OE_EINVAL ) ; if ( <S2SV_ModStart> & ret, file <S2SV_ModEnd> -> host_fd, <S2SV_ModStart> OE_EINVAL ) ; if ( ret > ( ssize_t ) count ) { ret = - 1 ; OE_RAISE_ERRNO ( OE_EINVAL ) ; }
Buggy code:
 static krb5_error_code <START_BUG> iakerb_alloc_context ( iakerb_ctx_id_t * pctx ) <END_BUG> { iakerb_ctx_id_t ctx ; krb5_error_code code ; * pctx = NULL ; ctx = k5alloc ( sizeof ( * ctx ), & code ) ; if ( ctx == NULL ) goto cleanup ; ctx -> defcred = GSS_C_NO_CREDENTIAL ; ctx -> magic = KG_IAKERB_CONTEXT ; ctx -> state = IAKERB_AS_REQ ; ctx -> count = 0 ;  code = krb5_gss_init_context ( & ctx -> k5c ) ; <START_BUG> if ( code!= 0 ) goto cleanup ; * pctx = ctx ; cleanup : if ( code!= 0 ) iakerb_release_context ( ctx ) ; return code ; }<END_BUG>

Fix:
<S2SV_ModStart> iakerb_ctx_id_t * pctx, int initiate <S2SV_ModStart> = 0 ; ctx -> initiate = initiate ; ctx -> established = 0 ;
Buggy code:
 public int magic_getparam ( struct magic_set * ms, int param, void * val ) { switch ( param ) { case MAGIC_PARAM_INDIR_MAX : * ( size_t * ) val = ms -> indir_max ; return 0 ; case MAGIC_PARAM_NAME_MAX : * ( size_t * ) val = ms -> name_max ; return 0 ; case MAGIC_PARAM_ELF_PHNUM_MAX : * ( size_t * ) val = ms -> elf_phnum_max ; return 0 ; case MAGIC_PARAM_ELF_SHNUM_MAX : * ( size_t * ) val = ms -> elf_shnum_max ; return 0 ; <START_BUG> default : <END_BUG> errno = EINVAL ; return - 1 ; } }

Fix:
<S2SV_ModStart> return 0 ; case MAGIC_PARAM_ELF_NOTES_MAX : * ( size_t * ) val = ms -> elf_notes_max ; return 0 ;
Buggy code:
 <START_BUG> static TX_MODE select_tx_mode ( const VP9_COMP * cpi ) { <END_BUG>  if ( cpi -> oxcf. lossless ) { <START_BUG> return ONLY_4X4 ; <END_BUG> } else if ( cpi -> common. current_video_frame == 0 ) {  return TX_MODE_SELECT ; } else { <START_BUG> if ( cpi -> sf. tx_size_search_method == USE_LARGESTALL ) { <END_BUG> return ALLOW_32X32 ;  } else if ( cpi -> sf. tx_size_search_method == USE_FULL_RD ) { <START_BUG> const MV_REFERENCE_FRAME frame_type = get_frame_type ( cpi ) ; return cpi -> rd_tx_select_threshes [ frame_type ] [ ALLOW_32X32 ] > cpi -> rd_tx_select_threshes [ frame_type ] [ TX_MODE_SELECT ]? ALLOW_32X32 : TX_MODE_SELECT ; } else { unsigned int total = 0 ; int i ; for ( i = 0 ; i < TX_SIZES ; ++ i ) total += cpi -> tx_stepdown_count [ i ] ; if ( total ) { const double fraction = ( double ) cpi -> tx_stepdown_count [ 0 ] // total ; return fraction > 0.90? ALLOW_32X32 : TX_MODE_SELECT ; } else { return cpi -> common. tx_mode ; } <END_BUG> }  } }

Fix:
<S2SV_ModStart> VP9_COMP * cpi, MACROBLOCKD * const xd <S2SV_ModStart> { if ( xd -> lossless ) <S2SV_ModEnd> return ONLY_4X4 ; <S2SV_ModStart> return ONLY_4X4 ; <S2SV_ModEnd> if ( cpi <S2SV_ModStart> -> common. frame_type == KEY_FRAME && cpi -> sf. use_nonrd_pick_mode ) return ALLOW_16X16 ; <S2SV_ModEnd> if ( cpi <S2SV_ModStart> == USE_LARGESTALL ) <S2SV_ModEnd> return ALLOW_32X32 ; <S2SV_ModStart> return ALLOW_32X32 ; <S2SV_ModEnd> else if ( <S2SV_ModStart> tx_size_search_method == USE_FULL_RD || cpi -> sf. tx_size_search_method == USE_TX_8X8 ) return TX_MODE_SELECT ; else <S2SV_ModEnd> return cpi -> <S2SV_ModStart> tx_mode ; } <S2SV_ModEnd> <S2SV_null> <S2SV_null> <S2SV_null>
Buggy code:
 error_t webSocketParseAuthenticateField ( WebSocket * webSocket, char_t * value ) { # if ( WEB_SOCKET_BASIC_AUTH_SUPPORT == ENABLED || WEB_SOCKET_DIGEST_AUTH_SUPPORT == ENABLED ) size_t n ; char_t * p ; char_t * token ; char_t * separator ; char_t * name ; WebSocketAuthContext * authContext ; authContext = & webSocket -> authContext ; token = osStrtok_r ( value, "   \\t", & p ) ; if ( token == NULL ) return ERROR_INVALID_SYNTAX ; if (! osStrcasecmp ( token, "Basic" ) ) { authContext -> requiredAuthMode = WS_AUTH_MODE_BASIC ; } else if (! osStrcasecmp ( token, "Digest" ) ) { authContext -> requiredAuthMode = WS_AUTH_MODE_DIGEST ; } else { return ERROR_INVALID_SYNTAX ; } token = osStrtok_r ( NULL, ",", & p ) ; while ( token!= NULL ) { <START_BUG> separator = strchr ( token, '=' ) ; <END_BUG> if ( separator!= NULL ) { * separator = '\\0' ; name = strTrimWhitespace ( token ) ; value = strTrimWhitespace ( separator + 1 ) ; n = osStrlen ( value ) ; if ( n > 0 && value [ n - 1 ] == \'\\"\' ) value [ n - 1 ] = '\\0' ; if ( value [ 0 ] == \'\\"\' ) value ++ ; if (! osStrcasecmp ( name, "realm" ) ) { strSafeCopy ( authContext -> realm, value, WEB_SOCKET_REALM_MAX_LEN ) ; } # if ( WEB_SOCKET_DIGEST_AUTH_SUPPORT == ENABLED ) else if (! osStrcasecmp ( name, "nonce" ) ) { strSafeCopy ( authContext -> nonce, value, WEB_SOCKET_NONCE_MAX_LEN + 1 ) ; } else if (! osStrcasecmp ( name, "opaque" ) ) { strSafeCopy ( authContext -> opaque, value, WEB_SOCKET_OPAQUE_MAX_LEN + 1 ) ; } else if (! osStrcasecmp ( name, "stale" ) ) { if (! osStrcasecmp ( value, "true" ) ) authContext -> stale = TRUE ;

Fix:
<S2SV_ModStart> { separator = osStrchr <S2SV_ModEnd> ( token,
Buggy code:
 ut32 armass_assemble ( const char * str, ut64 off, int thumb ) { int i, j ; char buf [ 128 ] ; ArmOpcode aop = {. off = off } ; <START_BUG> for ( i = j = 0 ; i < sizeof ( buf ) - 1 && str [ i ] ; i ++, j ++ ) { <END_BUG> if ( str [ j ] == '#' ) { i -- ; continue ; } buf [ i ] = tolower ( ( const ut8 ) str [ j ] ) ; } buf [ i ] = 0 ; arm_opcode_parse ( & aop, buf ) ; aop. off = off ; if ( thumb < 0 || thumb > 1 ) { return - 1 ; } if (! assemble [ thumb ] ( & aop, off, buf ) ) { return - 1 ; } return aop. o ; }

Fix:
<S2SV_ModStart> && str [ j <S2SV_ModEnd> ] ; i
Buggy code:
 static MagickBooleanType ReadDXT1 ( Image * image, DDSInfo * dds_info, ExceptionInfo * exception ) { DDSColors colors ; PixelPacket * q ; register ssize_t i, x ; size_t bits ; ssize_t j, y ; unsigned char code ; unsigned short c0, c1 ; for ( y = 0 ; y < ( ssize_t ) dds_info -> height ; y += 4 ) { for ( x = 0 ; x < ( ssize_t ) dds_info -> width ; x += 4 ) { <START_BUG> q = QueueAuthenticPixels ( image, x, y, Min ( 4, dds_info -> width - x ), <END_BUG>  Min ( 4, dds_info -> height - y ), exception ) ; <START_BUG> if ( q == ( PixelPacket * ) NULL ) return MagickFalse ; c0 = ReadBlobLSBShort ( image ) ; c1 = ReadBlobLSBShort ( image ) ; bits = ReadBlobLSBLong ( image ) ; CalculateColors ( c0, c1, & colors, MagickFalse ) ; for ( j = 0 ; j < 4 ; j ++ ) { for ( i = 0 ; i < 4 ; i ++ ) { if ( ( x + i ) < ( ssize_t ) dds_info -> width && ( y + j ) < ( ssize_t ) dds_info -> height ) { code = ( unsigned char ) ( ( bits >> ( ( j * 4 + i ) * 2 ) ) & 0x3 ) ; SetPixelRed ( q, ScaleCharToQuantum ( colors. r [ code ] ) ) ; SetPixelGreen ( q, ScaleCharToQuantum ( colors. g [ code ] ) ) ; SetPixelBlue ( q, ScaleCharToQuantum ( colors. b [ code ] ) ) ; SetPixelOpacity ( q, ScaleCharToQuantum ( colors. a [ code ] ) ) ; if ( colors. a [ code ] && image -> matte == MagickFalse ) image -> matte = MagickTrue ; q ++ ; } } } if ( SyncAuthenticPixels ( image, exception ) == MagickFalse ) return MagickFalse ; } } <END_BUG> SkipDXTMipmaps ( image, dds_info, 8 ) ;  return MagickTrue ; }

Fix:
<S2SV_ModStart>, y, MagickMin <S2SV_ModEnd> ( 4, <S2SV_ModStart> x ), MagickMin <S2SV_ModEnd> ( 4, <S2SV_ModStart> ; } } return ( <S2SV_ModStart> dds_info, 8, exception ) ) <S2SV_ModEnd> ; } <S2SV_null>
Buggy code:
 static Image * ReadSGIImage ( const ImageInfo * image_info, ExceptionInfo * exception ) { Image * image ; MagickBooleanType status ; MagickSizeType number_pixels ; MemoryInfo * pixel_info ; register Quantum * q ; register ssize_t i, x ; register unsigned char * p ; SGIInfo iris_info ; size_t bytes_per_pixel, quantum ; ssize_t count, y, z ; unsigned char * pixels ; assert ( image_info!= ( const ImageInfo * ) NULL ) ; assert ( image_info -> signature == MagickCoreSignature ) ; if ( image_info -> debug!= MagickFalse ) ( void ) LogMagickEvent ( TraceEvent, GetMagickModule ( ), "%s", image_info -> filename ) ; assert ( exception!= ( ExceptionInfo * ) NULL ) ; assert ( exception -> signature == MagickCoreSignature ) ; image = AcquireImage ( image_info, exception ) ; status = OpenBlob ( image_info, image, ReadBinaryBlobMode, exception ) ; if ( status == MagickFalse ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } iris_info. magic = ReadBlobMSBShort ( image ) ; do { if ( iris_info. magic!= 0x01DA ) ThrowReaderException ( CorruptImageError, "ImproperImageHeader" ) ; iris_info. storage = ( unsigned char ) ReadBlobByte ( image ) ; switch ( iris_info. storage ) { case 0x00 : image -> compression = NoCompression ; break ; case 0x01 : image -> compression = RLECompression ; break ; default : ThrowReaderException ( CorruptImageError, "ImproperImageHeader" ) ; } iris_info. bytes_per_pixel = ( unsigned char ) ReadBlobByte ( image ) ; if ( ( iris_info. bytes_per_pixel == 0 ) || ( iris_info. bytes_per_pixel > 2 ) ) ThrowReaderException ( CorruptImageError, "ImproperImageHeader" ) ; iris_info. dimension = ReadBlobMSBShort ( image ) ; iris_info. columns = ReadBlobMSBShort ( image ) ; iris_info. rows = ReadBlobMSBShort ( image ) ; iris_info.

Fix:
<S2SV_ModStart> } if ( EOFBlob ( image )!= MagickFalse ) ThrowReaderException ( CorruptImageError, "ImproperImageHeader" ) ; if (
Buggy code:
 <START_BUG> static void write_delta_q ( struct vp9_write_bit_buffer * wb, int delta_q ) { <END_BUG> if ( delta_q!= 0 ) {  vp9_wb_write_bit ( wb, 1 ) ; <START_BUG> <END_BUG> vp9_wb_write_literal ( wb, abs ( delta_q ), 4 ) ;  <START_BUG> vp9_wb_write_bit ( wb, delta_q < 0 ) ; <END_BUG> } else {  vp9_wb_write_bit ( wb, 0 ) ; <START_BUG> } }<END_BUG>

Fix:
<S2SV_ModStart> write_delta_q ( struct vpx_write_bit_buffer <S2SV_ModEnd> * wb, <S2SV_ModStart> 0 ) { vpx_wb_write_bit <S2SV_ModEnd> ( wb, <S2SV_ModStart> 1 ) ; vpx_wb_write_literal <S2SV_ModEnd> ( wb, <S2SV_ModStart> 4 ) ; vpx_wb_write_bit <S2SV_ModEnd> ( wb, <S2SV_ModStart> } else { vpx_wb_write_bit <S2SV_ModEnd> ( wb,
Buggy code:
 struct dentry * cifs_lookup ( struct inode * parent_dir_inode, struct dentry * direntry, struct nameidata * nd ) { int xid ; int rc = 0 ; __u32 oplock = enable_oplocks? REQ_OPLOCK : 0 ; __u16 fileHandle = 0 ; bool posix_open = false ; struct cifs_sb_info * cifs_sb ; struct tcon_link * tlink ; struct cifs_tcon * pTcon ; struct cifsFileInfo * cfile ; struct inode * newInode = NULL ; char * full_path = NULL ; struct file * filp ; xid = GetXid ( ) ; cFYI ( 1, "parent   inode   =   0x%p   name   is:   %s   and   dentry   =   0x%p", parent_dir_inode, direntry -> d_name. name, direntry ) ; cifs_sb = CIFS_SB ( parent_dir_inode -> i_sb ) ; tlink = cifs_sb_tlink ( cifs_sb ) ; if ( IS_ERR ( tlink ) ) { FreeXid ( xid ) ; return ( struct dentry * ) tlink ; } pTcon = tlink_tcon ( tlink ) ; if (! ( cifs_sb -> mnt_cifs_flags & CIFS_MOUNT_POSIX_PATHS ) ) { int i ; for ( i = 0 ; i < direntry -> d_name. len ; i ++ ) if ( direntry -> d_name. name [ i ] == '\\\\' ) { cFYI ( 1, "Invalid   file   name" ) ; rc = - EINVAL ; goto lookup_out ; } } if ( nd && ( nd -> flags & LOOKUP_EXCL ) ) { d_instantiate ( direntry, NULL ) ; rc = 0 ; goto lookup_out ; } full_path = build_path_from_dentry ( direntry ) ; if ( full_path == NULL ) { rc = - ENOMEM ; goto lookup_out ; } if ( direntry -> d_inode!= NULL ) { cFYI ( 1, "non-NULL

Fix:
<S2SV_ModStart> xid ) ; switch ( rc ) { case 0 : if ( newInode &&! S_ISREG ( newInode -> i_mode ) ) { CIFSSMBClose ( xid, pTcon, fileHandle ) ; break ; } case - ENOENT : posix_open = true ; case - EOPNOTSUPP : break ; default : pTcon -> broken_posix_open = true ; } } if (! posix_open ) rc = cifs_get_inode_info_unix ( & newInode, full_path, parent_dir_inode -> i_sb, xid ) ; } else rc = cifs_get_inode_info ( & newInode, full_path, NULL, parent_dir_inode -> i_sb, xid, NULL ) ; <S2SV_ModStart> == 0 ) && ( newInode!= NULL ) ) { d_add ( direntry, newInode ) ; if ( posix_open ) { filp = lookup_instantiate_filp ( nd, direntry, generic_file_open ) ; if ( IS_ERR ( filp ) ) { rc = PTR_ERR ( filp ) ; CIFSSMBClose
Buggy code:
 <START_BUG> void * zcalloc ( size_t size ) { <END_BUG> void * ptr = calloc ( 1, size + PREFIX_SIZE ) ; if (! ptr ) zmalloc_oom_handler ( size ) ; # ifdef HAVE_MALLOC_SIZE update_zmalloc_stat_alloc ( zmalloc_size ( ptr ) ) ; return ptr ; # else * ( ( size_t * ) ptr ) = size ; update_zmalloc_stat_alloc ( size + PREFIX_SIZE ) ; return ( char * ) ptr + PREFIX_SIZE ; # endif }

Fix:
<S2SV_ModStart> size ) { ASSERT_NO_SIZE_OVERFLOW ( size ) ;
Buggy code:
 vpx_codec_err_t vpx_codec_enc_config_default ( vpx_codec_iface_t * iface, vpx_codec_enc_cfg_t * cfg, unsigned int usage ) { vpx_codec_err_t res ; <START_BUG> vpx_codec_enc_cfg_map_t * map ; <END_BUG> if (! iface ||! cfg || usage > INT_MAX ) res = VPX_CODEC_INVALID_PARAM ; else if (! ( iface -> caps & VPX_CODEC_CAP_ENCODER ) ) res = VPX_CODEC_INCAPABLE ; else { res = VPX_CODEC_INVALID_PARAM ;  for ( map = iface -> enc. cfg_maps ; map -> usage >= 0 ; map ++ ) { <START_BUG> if ( map -> usage == ( int ) usage ) { * cfg = map -> cfg ; cfg -> g_usage = usage ; res = VPX_CODEC_OK ; break ; } } } return res ; }<END_BUG>

Fix:
<S2SV_ModStart> vpx_codec_enc_cfg_map_t * map ; int i <S2SV_ModStart> ; for ( i = 0 ; i < iface -> enc. cfg_map_count ; ++ i ) { <S2SV_ModStart> enc. cfg_maps + i ; <S2SV_ModEnd> if ( map
Buggy code:
 int processCommand ( redisClient * c ) { struct redisCommand * cmd ; if (! strcasecmp ( c -> argv [ 0 ] -> ptr, "quit" ) ) { addReply ( c, shared. ok ) ; c -> flags |= REDIS_CLOSE_AFTER_REPLY ; return REDIS_ERR ; } cmd = lookupCommand ( c -> argv [ 0 ] -> ptr ) ; if (! cmd ) { addReplyErrorFormat ( c, "unknown   command   \'%s\'", ( char * ) c -> argv [ 0 ] -> ptr ) ; return REDIS_OK ; } else if ( ( cmd -> arity > 0 && cmd -> arity!= c -> argc ) || ( c -> argc < - cmd -> arity ) ) { addReplyErrorFormat ( c, "wrong   number   of   arguments   for   \'%s\'   command", cmd -> name ) ; return REDIS_OK ; } if ( server. requirepass &&! c -> authenticated && cmd -> proc!= authCommand ) { addReplyError ( c, "operation   not   permitted" ) ; return REDIS_OK ; } if ( server. maxmemory ) freeMemoryIfNeeded ( ) ; if ( server. maxmemory && ( cmd -> flags & REDIS_CMD_DENYOOM ) && zmalloc_used_memory ( ) > server. maxmemory ) { addReplyError ( c, "command   not   allowed   when   used   memory   >   \'maxmemory\'" ) ; return REDIS_OK ; } if ( ( dictSize ( c -> pubsub_channels ) > 0 || listLength ( c -> pubsub_patterns ) > 0 ) && cmd -> proc!= subscribeCommand && cmd -> proc!= unsubscribeCommand && cmd -> proc!= psubscribeCommand && cmd -> proc!= punsubscribeCommand ) { addReplyError ( c, "only   (P)SUBSCRIBE   //   (P)UNSUBSCRIBE   //   QUIT   allowed   in   this   context" ) ; return REDIS_OK ; } if ( server. masterhost && server. replstate!= REDIS_REPL_CONNECTED && server. repl_serve_stale_data == 0 && cmd -> proc!= infoCommand && cmd -> proc!= slaveofCommand ) { addReplyError ( c, "link   with   MASTER   is   down   and   slave-serve-

Fix:
<S2SV_ModStart> ( server. ds_enabled && <S2SV_ModEnd> blockClientOnSwappedKeys ( c
Buggy code:
 int vp8_remove_decoder_instances ( struct frame_buffers * fb ) { if (! fb -> use_frame_threads ) { VP8D_COMP * pbi = fb -> pbi [ 0 ] ; if (! pbi ) return VPX_CODEC_ERROR ; # if CONFIG_MULTITHREAD <START_BUG> if ( pbi -> b_multithreaded_rd ) <END_BUG> vp8mt_de_alloc_temp_buffers ( pbi, pbi -> common. mb_rows ) ; vp8_decoder_remove_threads ( pbi ) ; # endif remove_decompressor ( pbi ) ; } else { } return VPX_CODEC_OK ; }

Fix:
<S2SV_ModStart> # if CONFIG_MULTITHREAD <S2SV_ModEnd> vp8_decoder_remove_threads ( pbi
Buggy code:
 static int mongo_cursor_get_more ( mongo_cursor * cursor ) { int res ; if ( cursor -> limit > 0 && cursor -> seen >= cursor -> limit ) { cursor -> err = MONGO_CURSOR_EXHAUSTED ; return MONGO_ERROR ; } else if (! cursor -> reply ) { cursor -> err = MONGO_CURSOR_INVALID ; return MONGO_ERROR ; } else if (! cursor -> reply -> fields. cursorID ) { cursor -> err = MONGO_CURSOR_EXHAUSTED ; return MONGO_ERROR ; } else { char * data ; <START_BUG> int sl = strlen ( cursor -> ns ) + 1 ; <END_BUG> int limit = 0 ; mongo_message * mm ; if ( cursor -> limit > 0 ) limit = cursor -> limit - cursor -> seen ; mm = mongo_message_create ( 16 + 4 + sl + 4 + 8, 0, 0, MONGO_OP_GET_MORE ) ; data = & mm -> data ; data = mongo_data_append32 ( data, & ZERO ) ; data = mongo_data_append ( data, cursor -> ns, sl ) ; data = mongo_data_append32 ( data, & limit ) ; mongo_data_append64 ( data, & cursor -> reply -> fields. cursorID ) ; bson_free ( cursor -> reply ) ; res = mongo_message_send ( cursor -> conn, mm ) ; if ( res!= MONGO_OK ) { mongo_cursor_destroy ( cursor ) ; return MONGO_ERROR ; } res = mongo_read_response ( cursor -> conn, & ( cursor -> reply ) ) ; if ( res!= MONGO_OK ) { mongo_cursor_destroy ( cursor ) ; return MONGO_ERROR ; } cursor -> current. data = NULL ; cursor -> seen += cursor -> reply -> fields. num ; return MONGO_OK ; } }

Fix:
<S2SV_ModStart> * data ; size_t <S2SV_ModEnd> sl = strlen
Buggy code:
 static int myisamchk ( MI_CHECK * param, char * filename ) { int error, lock_type, recreate ; int rep_quick = param -> testflag & ( T_QUICK | T_FORCE_UNIQUENESS ) ; MI_INFO * info ; File datafile ; char llbuff [ 22 ], llbuff2 [ 22 ] ; my_bool state_updated = 0 ; MYISAM_SHARE * share ; DBUG_ENTER ( "myisamchk" ) ; param -> out_flag = error = param -> warning_printed = param -> error_printed = recreate = 0 ; datafile = 0 ; param -> isam_file_name = filename ; if (! ( info = mi_open ( filename, ( param -> testflag & ( T_DESCRIPT | T_READONLY ) )? O_RDONLY : O_RDWR, HA_OPEN_FOR_REPAIR | ( ( param -> testflag & T_WAIT_FOREVER )? HA_OPEN_WAIT_IF_LOCKED : ( param -> testflag & T_DESCRIPT )? HA_OPEN_IGNORE_IF_LOCKED : HA_OPEN_ABORT_IF_LOCKED ) ) ) ) { param -> error_printed = 1 ; switch ( my_errno ) { case HA_ERR_CRASHED : mi_check_print_error ( param, "\'%s\'   doesn\'t   have   a   correct   index   definition.   You   need   to   recreate   it   before   you   can   do   a   repair", filename ) ; break ; case HA_ERR_NOT_A_TABLE : mi_check_print_error ( param, "\'%s\'   is   not   a   MyISAM-table", filename ) ; break ; case HA_ERR_CRASHED_ON_USAGE : mi_check_print_error ( param, "\'%s\'   is   marked   as   crashed", filename ) ; break ; case HA_ERR_CRASHED_ON_REPAIR : mi_check_print_error ( param, "\'%s\'   is   marked   as   crashed   after   last   repair", filename ) ; break ; case HA_ERR_

Fix:
<S2SV_ModStart> filename, rep_quick, FALSE <S2SV_ModStart> filename, rep_quick, FALSE <S2SV_ModStart> filename, rep_quick, FALSE <S2SV_ModStart> filename, 1, FALSE <S2SV_ModStart> info, filename, FALSE
Buggy code:
 static arguments_ty ast_for_arguments ( struct compiling * c, const node * n ) { int i, j, k, nposargs = 0, nkwonlyargs = 0 ; int nposdefaults = 0, found_default = 0 ; asdl_seq * posargs, * posdefaults, * kwonlyargs, * kwdefaults ; arg_ty vararg = NULL, kwarg = NULL ; arg_ty arg = NULL ; node * ch ; if ( TYPE ( n ) == parameters ) { if ( NCH ( n ) == 2 ) return arguments ( NULL, NULL, NULL, NULL, NULL, NULL, c -> c_arena ) ; n = CHILD ( n, 1 ) ; } assert ( TYPE ( n ) == typedargslist || TYPE ( n ) == varargslist ) ; for ( i = 0 ; i < NCH ( n ) ; i ++ ) { ch = CHILD ( n, i ) ; if ( TYPE ( ch ) == STAR ) { i ++ ; if ( i < NCH ( n ) && ( TYPE ( CHILD ( n, i ) ) == tfpdef || TYPE ( CHILD ( n, i ) ) == vfpdef ) ) { i ++ ; } break ; } if ( TYPE ( ch ) == DOUBLESTAR ) break ; if ( TYPE ( ch ) == vfpdef || TYPE ( ch ) == tfpdef ) nposargs ++ ; if ( TYPE ( ch ) == EQUAL ) nposdefaults ++ ; } for ( ; i < NCH ( n ) ; ++ i ) { ch = CHILD ( n, i ) ; if ( TYPE ( ch ) == DOUBLESTAR ) break ; if ( TYPE ( ch ) == tfpdef || TYPE ( ch ) == vfpdef ) nkwonlyargs ++ ; } posargs = ( nposargs? _Py_asdl_seq_new ( nposargs, c -> c_arena ) : NULL ) ; if (! posargs && nposargs ) return NULL ; kwonlyargs = ( nkwonlyargs? _Py_asdl_seq_new ( nkwonlyargs, c -> c_arena ) : NULL ) ; if (! kwonlyargs && nkwonlyargs ) return NULL ; posdefaults = ( nposdefaults? _Py_asdl_seq_new ( nposdefaults, c -> c_arena )

Fix:
<S2SV_ModStart> ; if ( i < NCH ( n ) &&
Buggy code:
 static int update_prepare_order_info ( rdpContext * context, ORDER_INFO * orderInfo, UINT32 orderType ) { int length = 1 ; orderInfo -> fieldFlags = 0 ; orderInfo -> orderType = orderType ; orderInfo -> controlFlags = ORDER_STANDARD ; orderInfo -> controlFlags |= ORDER_TYPE_CHANGE ; length += 1 ; <START_BUG> length += PRIMARY_DRAWING_ORDER_FIELD_BYTES [ orderInfo -> orderType ] ; <END_BUG> length += update_prepare_bounds ( context, orderInfo ) ; return length ; }

Fix:
<S2SV_ModStart> ; length += get_primary_drawing_order_field_bytes ( <S2SV_ModEnd> orderInfo -> orderType <S2SV_ModStart> orderInfo -> orderType, NULL ) <S2SV_ModEnd> ; length +=
Buggy code:
 int main ( int argc, const char * argv [ ] ) { struct group * grent ; const char * cmd ; const char * path ; int i ; struct passwd * pw ; grent = getgrnam ( ABUILD_GROUP ) ; if ( grent == NULL ) errx ( 1, "%s:   Group   not   found", ABUILD_GROUP ) ; char * name = NULL ; pw = getpwuid ( getuid ( ) ) ; if ( pw ) name = pw -> pw_name ; if (! is_in_group ( grent -> gr_gid ) ) { errx ( 1, "User   %s   is   not   a   member   of   group   %s\\n", name? name : "(unknown)", ABUILD_GROUP ) ; } if ( name == NULL ) warnx ( "Could   not   find   username   for   uid   %d\\n", getuid ( ) ) ; setenv ( "USER", name? : "", 1 ) ; cmd = strrchr ( argv [ 0 ], '//' ) ; if ( cmd ) cmd ++ ; else cmd = argv [ 0 ] ; cmd = strchr ( cmd, '-' ) ; if ( cmd == NULL ) errx ( 1, "Calling   command   has   no   \'-\'" ) ; cmd ++ ; path = get_command_path ( cmd ) ; if ( path == NULL ) errx ( 1, "%s:   Not   a   valid   subcommand", cmd ) ; for ( i = 1 ; i < argc ; i ++ ) <START_BUG> if ( strcmp ( argv [ i ], "--allow-untrusted" ) == 0 ) <END_BUG> errx ( 1, "%s:   not   allowed   option", "--allow-untrusted" ) ; argv [ 0 ] = path ; setuid ( 0 ) ; setgid ( 0 ) ; execv ( path, ( char * const * ) argv ) ; perror ( path ) ; return 1 ; }

Fix:
<S2SV_ModStart> i ++ ) check_option ( argv [ i ] <S2SV_ModEnd> ) ; argv
Buggy code:
 static ssize_t exitcode_proc_write ( struct file * file, const char __user * buffer, size_t count, loff_t * pos ) { char * end, buf [ sizeof ( "nnnnn\\0" ) ] ; <START_BUG> int tmp ; <END_BUG>  if ( copy_from_user ( buf, buffer, count ) ) <START_BUG> return - EFAULT ; tmp = simple_strtol ( buf, & end, 0 ) ; if ( ( * end!= '\\0' ) &&! isspace ( * end ) ) return - EINVAL ; uml_exitcode = tmp ; return count ; }<END_BUG>

Fix:
<S2SV_ModStart> ) ] ; size_t size ; int tmp ; size = min ( count, sizeof ( buf ) ) <S2SV_ModEnd> ; if ( <S2SV_ModStart>, buffer, size <S2SV_ModEnd> ) ) return