nus-yam/ex-repair huggingface dataset:
Buggy code:
 static void fill_mode_info_sb ( VP9_COMMON * cm, MACROBLOCK * x, int mi_row, int mi_col, <START_BUG> BLOCK_SIZE bsize, BLOCK_SIZE subsize ) { <END_BUG> MACROBLOCKD * xd = & x -> e_mbd ;  int bsl = b_width_log2 ( bsize ), hbs = ( 1 << bsl ) // 4 ; <START_BUG> <END_BUG> PARTITION_TYPE partition = partition_lookup [ bsl ] [ subsize ] ;  assert ( bsize >= BLOCK_8X8 ) ; if ( mi_row >= cm -> mi_rows || mi_col >= cm -> mi_cols ) return ; switch ( partition ) { case PARTITION_NONE : <START_BUG> set_modeinfo_offsets ( cm, xd, mi_row, mi_col ) ; <END_BUG>  * ( xd -> mi [ 0 ] ) = get_block_context ( x, subsize ) -> mic ; <START_BUG> duplicate_mode_info_in_sb ( cm, xd, mi_row, mi_col, bsize ) ; break ; case PARTITION_VERT : <END_BUG> * get_sb_index ( x, subsize ) = 0 ;  set_modeinfo_offsets ( cm, xd, mi_row, mi_col ) ; <START_BUG> * ( xd -> mi [ 0 ] ) = get_block_context ( x, subsize ) -> mic ; <END_BUG>  duplicate_mode_info_in_sb ( cm, xd, mi_row, mi_col, bsize ) ; <START_BUG> if ( mi_col + hbs < cm -> mi_cols ) { <END_BUG> * get_sb_index ( x, subsize ) = 1 ;  set_modeinfo_offsets ( cm, xd, mi_row, mi_col + hbs ) ; * ( xd -> mi [ 0 ] ) = get_block_context ( x, subsize ) -> mic ; <START_BUG> duplicate_mode_info_in_sb ( cm, xd, mi_row, mi_col + hbs, bsize ) ; <END_BUG> } break ; case PARTITION_HORZ :  * get_sb_index ( x, subsize ) = 0 ; <START_BUG> set_modeinfo_offsets ( cm, xd, mi_row, mi_col ) ; <END_BUG> * ( xd -> mi [ 0 ] )

Fix:
<S2SV_ModStart> BLOCK_SIZE bsize, PC_TREE * pc_tree <S2SV_ModEnd> ) { MACROBLOCKD <S2SV_ModStart> int bsl = b_width_log2_lookup [ bsize ] <S2SV_ModEnd>, hbs = <S2SV_ModStart> PARTITION_TYPE partition = pc_tree -> partitioning ; BLOCK_SIZE subsize = get_subsize ( bsize, partition ) <S2SV_ModEnd> ; assert ( <S2SV_ModStart> case PARTITION_NONE : set_mode_info_offsets ( cm, x <S2SV_ModEnd>, xd, <S2SV_ModStart> ] ) = pc_tree -> none. mic ; * ( x -> mbmi_ext ) = pc_tree -> none. mbmi_ext <S2SV_ModEnd> ; duplicate_mode_info_in_sb ( <S2SV_ModStart> case PARTITION_VERT : set_mode_info_offsets ( cm, x <S2SV_ModEnd>, xd, <S2SV_ModStart> ] ) = pc_tree -> vertical [ 0 ]. mic ; * ( x -> mbmi_ext ) = pc_tree -> vertical [ 0 ]. mbmi_ext ; <S2SV_ModEnd> duplicate_mode_info_in_sb ( cm <S2SV_ModStart>, mi_col, subsize <S2SV_ModEnd> ) ; if <S2SV_ModStart> mi_cols ) { set_mode_info_offsets ( cm, x, xd, mi_row,
Buggy code:
 static int l2tp_ip6_sendmsg ( struct sock * sk, struct msghdr * msg, size_t len ) { struct ipv6_txoptions opt_space ; DECLARE_SOCKADDR ( struct sockaddr_l2tpip6 *, lsa, msg -> msg_name ) ; struct in6_addr * daddr, * final_p, final ; <START_BUG> struct ipv6_pinfo * np = inet6_sk ( sk ) ; <END_BUG> struct ipv6_txoptions * opt = NULL ; struct ip6_flowlabel * flowlabel = NULL ; struct dst_entry * dst = NULL ; struct flowi6 fl6 ; int addr_len = msg -> msg_namelen ; int hlimit = - 1 ; int tclass = - 1 ; int dontfrag = - 1 ; int transhdrlen = 4 ; int ulen = len + transhdrlen ; int err ; if ( len > INT_MAX ) return - EMSGSIZE ; if ( msg -> msg_flags & MSG_OOB ) return - EOPNOTSUPP ; memset ( & fl6, 0, sizeof ( fl6 ) ) ; fl6. flowi6_mark = sk -> sk_mark ; if ( lsa ) { if ( addr_len < SIN6_LEN_RFC2133 ) return - EINVAL ; if ( lsa -> l2tp_family && lsa -> l2tp_family!= AF_INET6 ) return - EAFNOSUPPORT ; daddr = & lsa -> l2tp_addr ; if ( np -> sndflow ) { fl6. flowlabel = lsa -> l2tp_flowinfo & IPV6_FLOWINFO_MASK ; if ( fl6. flowlabel & IPV6_FLOWLABEL_MASK ) { flowlabel = fl6_sock_lookup ( sk, fl6. flowlabel ) ; if ( flowlabel == NULL ) return - EINVAL ; } } if ( sk -> sk_state == TCP_ESTABLISHED && ipv6_addr_equal ( daddr, & sk -> sk_v6_daddr ) ) daddr = & sk -> sk_v6_daddr ; if ( addr_len >= sizeof ( struct sockaddr_in6 ) && lsa -> l2tp_scope_id && ipv6_addr_type (

Fix:
<S2SV_ModStart> ( sk ) ; struct ipv6_txoptions * opt_to_free = NULL <S2SV_ModStart> } if (! opt ) { opt = txopt_get ( np ) ; opt_to_free = opt ; } <S2SV_ModEnd> if ( flowlabel <S2SV_ModStart> fl6_sock_release ( flowlabel ) ; txopt_put ( opt_to_free
Buggy code:
 int DoOneObject ( char * cinput ) { <START_BUG> int num, i, num1, num2 ; <END_BUG>  char * s, * t, * StartClean ; <START_BUG> <END_BUG> double * argbuf = 0 ;  SetDefaults ( ) ; s = cinput ; while ( * s!= '[' ) s ++ ; s ++ ; t = s ; while ( * t!= ']' ) t ++ ; * t ++ = 0 ; while ( * t ==' '|| * t == '\\t' || * t == '\\n' ) t ++ ; <START_BUG> outpos = outputbuffer ; <END_BUG>  outpos += sprintf ( outpos, "\\\\axo@setObject{%s}%%\\n{%s%c}%%\\n{", s, t, TERMCHAR ) ; <START_BUG> <END_BUG> if ( * s == '0' && s [ 1 ] == ']' ) {  if ( strcmp ( nameobject, "AxodrawWantsPDF" ) == 0 ) { identification = 1 ; <START_BUG> outpos += sprintf ( outpos, "Axohelp   version   %d.%d.   PDF   output.}", VERSION, SUBVERSION ) ; <END_BUG>  fprintf ( outfile, "%s", outputbuffer ) ; <START_BUG> return ( 0 ) ; } else { fprintf ( stderr, "%s:   Illegal   request   in   identification   string   [0]:   %s\\n", axohelp, nameobject ) ; <END_BUG> if ( argbuf ) free ( argbuf ) ;  return ( - 1 ) ; } } StartClean = outpos ; nameobject = t ; while ( * t!=' '&& * t!= '\\t' && * t!= '\\n' && * t ) t ++ ; * t ++ = 0 ; while ( * t ==' '|| * t == '\\t' || * t == '\\n' ) t ++ ; if ( ( strcmp ( nameobject, "Curve" ) == 0 ) || ( strcmp ( nameobject, "Polygon" ) == 0 ) || ( strcmp ( nameobject, "FilledPolygon" ) == 0 ) ) { <START_BUG> if ( ( argbuf = ReadArray ( t, & num1, & num2 ) ) == 0 ) return ( - 1 ) ; <END_BUG> if ( num2 - 1!= 0 ) { fprintf ( stderr, "%s:   Command   %s   should   have   no  

Fix:
<S2SV_ModStart> num1, num2, retcode <S2SV_ModStart>, * t <S2SV_ModEnd> ; double * <S2SV_ModStart> argbuf = 0 ; retcode = - 1 <S2SV_ModStart> t ++ ; fprintf ( outfile, "\\\\axo@setObject{%s}%%\\n{%s%c}%%\\n{", s, t, TERMCHAR ) ; <S2SV_ModStart> = outputbuffer ; nameobject = t ; while ( * t!='<S2SV_blank>'&& * t!= '\\t' && * t!= '\\n' && * t ) t ++ ; * t ++ = 0 ; while ( * t =='<S2SV_blank>'|| * t == '\\t' || * t == '\\n' ) t ++ <S2SV_ModEnd> ; if ( <S2SV_ModStart> 1 ] == 0 <S2SV_ModEnd> ) { if <S2SV_ModStart> = 1 ; fprintf ( outfile, "Axohelp <S2SV_blank> version <S2SV_blank> %d.%d. <S2SV_blank> PDF <S2SV_blank> output." <S2SV_ModEnd>, VERSION, <S2SV_ModStart> SUBVERSION ) ; goto SUCCESS ; } else { fprintf ( <S2SV_ModEnd> stderr, "%s: <S2SV_blank> Illegal <S2SV_blank> request <S2SV_blank> in <S2SV_blank> identification <S2SV_blank> string <S2SV_blank> [0]: <S2SV_blank> %s\\n" <S2SV_ModStart> nameobject ) ; goto EXIT ; } } <S2SV_ModEnd> if ( ( <S2SV_ModStart> == 0 ) goto EXIT <S2SV_ModEnd> ; if ( <S2SV_ModStart> inname ) ; goto EXIT
Buggy code:
 static vpx_codec_err_t vp8e_encode ( vpx_codec_alg_priv_t * ctx, const vpx_image_t * img, vpx_codec_pts_t pts, unsigned long duration, vpx_enc_frame_flags_t flags, unsigned long deadline ) { vpx_codec_err_t res = VPX_CODEC_OK ; if (! ctx -> cfg. rc_target_bitrate ) return res ; if ( img ) res = validate_img ( ctx, img ) ; if (! res ) res = validate_config ( ctx, & ctx -> cfg, & ctx -> vp8_cfg, 1 ) ; pick_quickcompress_mode ( ctx, duration, deadline ) ; vpx_codec_pkt_list_init ( & ctx -> pkt_list ) ; <START_BUG> if ( ( ( flags & VP8_EFLAG_NO_UPD_GF ) && ( flags & VP8_EFLAG_FORCE_GF ) ) <END_BUG> || ( ( flags & VP8_EFLAG_NO_UPD_ARF ) && ( flags & VP8_EFLAG_FORCE_ARF ) ) ) { ctx -> base. err_detail = "Conflicting   flags." ; return VPX_CODEC_INVALID_PARAM ; } if ( flags & ( VP8_EFLAG_NO_REF_LAST | VP8_EFLAG_NO_REF_GF | VP8_EFLAG_NO_REF_ARF ) ) { int ref = 7 ; if ( flags & VP8_EFLAG_NO_REF_LAST ) ref ^= VP8_LAST_FRAME ; if ( flags & VP8_EFLAG_NO_REF_GF ) ref ^= VP8_GOLD_FRAME ; if ( flags & VP8_EFLAG_NO_REF_ARF ) ref ^= VP8_ALTR_FRAME ; vp8_use_as_reference ( ctx -> cpi, ref ) ; } if ( flags & ( VP8_EFLAG_NO_UPD_LAST | VP8_EFLAG_NO_UPD_GF | VP8_EFLAG_NO_UPD_ARF | VP8_EFLAG_FORCE_GF

Fix:
<S2SV_ModStart> ; if (! flags ) { flags = ctx -> control_frame_flags ; } ctx -> control_frame_flags = 0 ; res = set_reference_and_update ( ctx, flags ) ; <S2SV_ModEnd> if ( ctx <S2SV_ModStart> ( vpx_codec_pts_t ) 10000000 <S2SV_ModEnd> * ctx ->
Buggy code:
 static void * sock_poll_thread ( void * arg ) { struct pollfd pfds [ MAX_POLL ] ; memset ( pfds, 0, sizeof ( pfds ) ) ; int h = ( intptr_t ) arg ; for ( ; ; ) { prepare_poll_fds ( h, pfds ) ; <START_BUG> int ret = poll ( pfds, ts [ h ]. poll_count, - 1 ) ; <END_BUG> if ( ret == - 1 ) { APPL_TRACE_ERROR ( "poll   ret   -1,   exit   the   thread,   errno:%d,   err:%s", errno, strerror ( errno ) ) ; break ; } if ( ret!= 0 ) { int need_process_data_fd = TRUE ; if ( pfds [ 0 ]. revents ) { asrt ( pfds [ 0 ]. fd == ts [ h ]. cmd_fdr ) ; if (! process_cmd_sock ( h ) ) { APPL_TRACE_DEBUG ( "h:%d,   process_cmd_sock   return   false,   exit...", h ) ; break ; } if ( ret == 1 ) need_process_data_fd = FALSE ; else ret -- ; } if ( need_process_data_fd ) process_data_sock ( h, pfds, ret ) ; } else { APPL_TRACE_DEBUG ( "no   data,   select   ret:   %d", ret ) } ; } ts [ h ]. thread_id = - 1 ; APPL_TRACE_DEBUG ( "socket   poll   thread   exiting,   h:%d", h ) ; return 0 ; }

Fix:
<S2SV_ModStart> int ret = TEMP_FAILURE_RETRY ( <S2SV_ModStart>, - 1 )
Buggy code:
 static int decode_avp ( struct l2tp_avp_t * avp, const struct l2tp_attr_t * RV, const char * secret, size_t secret_len ) { MD5_CTX md5_ctx ; uint8_t md5 [ MD5_DIGEST_LENGTH ] ; uint8_t p1 [ MD5_DIGEST_LENGTH ] ; uint8_t * prev_block = NULL ; <START_BUG> uint16_t attr_len ; <END_BUG> uint16_t orig_attr_len ; uint16_t bytes_left ; uint16_t blocks_left ; uint16_t last_block_len ;  if ( avp -> length < sizeof ( struct l2tp_avp_t ) + 2 ) { <START_BUG> log_warn ( "l2tp:   incorrect   hidden   avp   received   (type   %hu):" "   length   too   small   (%hu   bytes)\\n", <END_BUG> ntohs ( avp -> type ), avp -> length ) ;  return - 1 ; } <START_BUG> attr_len = avp -> length - sizeof ( struct l2tp_avp_t ) ; <END_BUG> MD5_Init ( & md5_ctx ) ; MD5_Update ( & md5_ctx, & avp -> type, sizeof ( avp -> type ) ) ; MD5_Update ( & md5_ctx, secret, secret_len ) ; MD5_Update ( & md5_ctx, RV -> val. octets, RV -> length ) ; MD5_Final ( p1, & md5_ctx ) ; if ( attr_len <= MD5_DIGEST_LENGTH ) { memxor ( avp -> val, p1, attr_len ) ; return 0 ; } memxor ( p1, avp -> val, MD5_DIGEST_LENGTH ) ; orig_attr_len = ntohs ( * ( uint16_t * ) p1 ) ; if ( orig_attr_len <= MD5_DIGEST_LENGTH - 2 ) { memcpy ( avp -> val, p1, MD5_DIGEST_LENGTH ) ; return 0 ; } if ( orig_attr_len > attr_len - 2 ) { log_warn ( "l2tp:   incorrect

Fix:
<S2SV_ModStart> NULL ; uint16_t avp_len ; uint16_t <S2SV_ModStart> uint16_t last_block_len ; avp_len = avp -> flags & L2TP_AVP_LEN_MASK ; if ( avp_len <S2SV_ModEnd> < sizeof ( <S2SV_ModStart> type ), avp_len <S2SV_ModEnd> ) ; return <S2SV_ModStart> } attr_len = avp_len <S2SV_ModEnd> - sizeof (
Buggy code:
 static void first_pass_motion_search ( VP8_COMP * cpi, MACROBLOCK * x, int_mv * ref_mv, MV * best_mv, YV12_BUFFER_CONFIG * recon_buffer, int * best_motion_err, int recon_yoffset ) { MACROBLOCKD * const xd = & x -> e_mbd ; BLOCK * b = & x -> block [ 0 ] ; BLOCKD * d = & x -> e_mbd. block [ 0 ] ; int num00 ; int_mv tmp_mv ; int_mv ref_mv_full ; int tmp_err ; int step_param = 3 ; int further_steps = ( MAX_MVSEARCH_STEPS - 1 ) - step_param ; int n ; vp8_variance_fn_ptr_t v_fn_ptr = cpi -> fn_ptr [ BLOCK_16X16 ] ; int new_mv_mode_penalty = 256 ; <START_BUG> v_fn_ptr. vf = vp8_mse16x16 ; <END_BUG> xd -> pre. y_buffer = recon_buffer -> y_buffer + recon_yoffset ; tmp_mv. as_int = 0 ; ref_mv_full. as_mv. col = ref_mv -> as_mv. col >> 3 ; ref_mv_full. as_mv. row = ref_mv -> as_mv. row >> 3 ; tmp_err = cpi -> diamond_search_sad ( x, b, d, & ref_mv_full, & tmp_mv, step_param, x -> sadperbit16, & num00, & v_fn_ptr, x -> mvcost, ref_mv ) ; if ( tmp_err < INT_MAX - new_mv_mode_penalty ) tmp_err += new_mv_mode_penalty ; if ( tmp_err < * best_motion_err ) { * best_motion_err = tmp_err ; best_mv -> row = tmp_mv. as_mv. row ; best_mv -> col = tmp_mv. as_mv. col ; } n = num00 ; num00 = 0 ; while ( n < further_steps ) { n ++ ; if ( num00 ) num00 -- ; else { tmp

Fix:
<S2SV_ModStart>. vf = vpx_mse16x16 <S2SV_ModEnd> ; xd ->
Buggy code:
 int dbd_db_login ( SV * dbh, imp_dbh_t * imp_dbh, char * dbname, char * user, char * password ) { # ifdef dTHR dTHR ; # endif dTHX ; D_imp_xxh ( dbh ) ; if ( DBIc_TRACE_LEVEL ( imp_xxh ) >= 2 ) PerlIO_printf ( DBIc_LOGPIO ( imp_xxh ), "imp_dbh->connect:   dsn   =   %s,   uid   =   %s,   pwd   =   %s\\n", dbname? dbname : "NULL", user? user : "NULL", password? password : "NULL" ) ; imp_dbh -> stats. auto_reconnects_ok = 0 ; imp_dbh -> stats. auto_reconnects_failed = 0 ; imp_dbh -> bind_type_guessing = FALSE ; imp_dbh -> bind_comment_placeholders = FALSE ; imp_dbh -> has_transactions = TRUE ; imp_dbh -> auto_reconnect = FALSE ; # if defined ( sv_utf8_decode ) && MYSQL_VERSION_ID >= SERVER_PREPARE_VERSION imp_dbh -> enable_utf8 = FALSE ; # endif if (! my_login ( aTHX_ dbh, imp_dbh ) ) { <START_BUG> do_error ( dbh, mysql_errno ( imp_dbh -> pmysql ), <END_BUG> mysql_error ( imp_dbh -> pmysql ), mysql_sqlstate ( imp_dbh -> pmysql ) ) ; return FALSE ; } DBIc_ACTIVE_on ( imp_dbh ) ; DBIc_on ( imp_dbh, DBIcf_IMPSET ) ; return TRUE ; }

Fix:
<S2SV_ModStart> ) ) { if ( imp_dbh -> pmysql )
Buggy code:
 static int remarkupvals ( global_State * g ) { lua_State * thread ; lua_State * * p = & g -> twups ; int work = 0 ; while ( ( thread = * p )!= NULL ) { work ++ ; lua_assert (! isblack ( thread ) ) ; if ( isgray ( thread ) && thread -> openupval!= NULL ) p = & thread -> twups ; else { UpVal * uv ; <START_BUG> * p = thread -> twups ; <END_BUG> thread -> twups = thread ; for ( uv = thread -> openupval ; uv!= NULL ; uv = uv -> u. open. next ) {  work ++ ; <START_BUG> if (! iswhite ( uv ) ) markvalue ( g, uv -> v ) ; } } } return work ; }<END_BUG>

Fix:
<S2SV_ModStart> * uv ; lua_assert (! isold ( thread ) || thread -> openupval == NULL ) ; <S2SV_ModStart> next ) { lua_assert ( getage ( uv ) <= getage ( thread ) ) ;
Buggy code:
 static int parse_exports_table ( long long * table_start ) { int res ; <START_BUG> int indexes = SQUASHFS_LOOKUP_BLOCKS ( sBlk. s. inodes ) ; <END_BUG>  long long export_index_table [ indexes ] ; <START_BUG> <END_BUG> res = read_fs_bytes ( fd, sBlk. s. lookup_table_start,  SQUASHFS_LOOKUP_BLOCK_BYTES ( sBlk. s. inodes ), export_index_table ) ; if ( res == FALSE ) { ERROR ( "parse_exports_table:   failed   to   read   export   index   table\\n" ) ; return FALSE ; } SQUASHFS_INSWAP_LOOKUP_BLOCKS ( export_index_table, indexes ) ; * table_start = export_index_table [ 0 ] ; return TRUE ; }

Fix:
<S2SV_ModStart> = SQUASHFS_LOOKUP_BLOCKS ( ( long long ) sBlk. s. inodes ) ; int length = SQUASHFS_LOOKUP_BLOCK_BYTES ( ( long long ) <S2SV_ModStart> ; long long * export_index_table ; if ( length!= ( * table_start - sBlk. s. lookup_table_start ) ) { ERROR ( "parse_exports_table: <S2SV_blank> Bad <S2SV_blank> inode <S2SV_blank> count <S2SV_blank> in <S2SV_blank> super <S2SV_blank> block\\n" ) ; return FALSE ; } export_index_table = alloc_index_table ( indexes ) <S2SV_ModEnd> ; res = <S2SV_ModStart>. lookup_table_start, length, <S2SV_ModEnd> export_index_table ) ;
Buggy code:
 jpc_streamlist_t * jpc_ppmstabtostreams ( jpc_ppxstab_t * tab ) { jpc_streamlist_t * streams ; <START_BUG> uchar * dataptr ; <END_BUG> uint_fast32_t datacnt ; uint_fast32_t tpcnt ; jpc_ppxstabent_t * ent ; int entno ; jas_stream_t * stream ; int n ; if (! ( streams = jpc_streamlist_create ( ) ) ) { goto error ; } if (! tab -> numents ) { return streams ; } entno = 0 ; ent = tab -> ents [ entno ] ; dataptr = ent -> data ; datacnt = ent -> len ; for ( ; ; ) { if ( datacnt < 4 ) { goto error ; } if (! ( stream = jas_stream_memopen ( 0, 0 ) ) ) { goto error ; } if ( jpc_streamlist_insert ( streams, jpc_streamlist_numstreams ( streams ), stream ) ) { goto error ; } tpcnt = ( dataptr [ 0 ] << 24 ) | ( dataptr [ 1 ] << 16 ) | ( dataptr [ 2 ] << 8 ) | dataptr [ 3 ] ; datacnt -= 4 ; dataptr += 4 ; while ( tpcnt ) { if (! datacnt ) { if ( ++ entno >= tab -> numents ) { goto error ; } ent = tab -> ents [ entno ] ; dataptr = ent -> data ; datacnt = ent -> len ; } n = JAS_MIN ( tpcnt, datacnt ) ; if ( jas_stream_write ( stream, dataptr, n )!= n ) { goto error ; } tpcnt -= n ; dataptr += n ; datacnt -= n ; } jas_stream_rewind ( stream ) ; if (! datacnt ) { if ( ++ entno >= tab -> numents ) { break ; } ent = tab -> ents [ entno ] ; dataptr = ent -> data ; datacnt = ent -> len ; } } return streams ; error : if ( streams ) { jpc_streamlist_destroy ( streams ) ; } return 0 ; }

Fix:
<S2SV_ModStart> * streams ; jas_uchar <S2SV_ModEnd> * dataptr ;
Buggy code:
 void SetColor ( double c, double m, double y, double k, int par ) { if ( par == STROKING ) { <START_BUG> outpos += sprintf ( outpos, "   %12.3f   %12.3f   %12.3f   %12.3f   K", c, m, y, k ) ; <END_BUG> } else {  outpos += sprintf ( outpos, "   %12.3f   %12.3f   %12.3f   %12.3f   k", c, m, y, k ) ; <START_BUG> } <END_BUG> } 

Fix:
<S2SV_ModStart> STROKING ) { sprintf ( outputbuffer <S2SV_ModEnd>, " <S2SV_blank> %12.3f <S2SV_blank> %12.3f <S2SV_blank> %12.3f <S2SV_blank> %12.3f <S2SV_blank> K", <S2SV_ModStart> } else { sprintf ( outputbuffer <S2SV_ModEnd>, " <S2SV_blank> %12.3f <S2SV_blank> %12.3f <S2SV_blank> %12.3f <S2SV_blank> %12.3f <S2SV_blank> k", <S2SV_ModStart> ) ; } sendClean ( outputbuffer ) ;
Buggy code:
 void vp8_mv_pred ( VP8_COMP * cpi, MACROBLOCKD * xd, const MODE_INFO * here, int_mv * mvp, int refframe, int * ref_frame_sign_bias, int * sr, int near_sadidx [ ] ) { const MODE_INFO * above = here - xd -> mode_info_stride ; const MODE_INFO * left = here - 1 ; const MODE_INFO * aboveleft = above - 1 ; int_mv near_mvs [ 8 ] ; int near_ref [ 8 ] ; int_mv mv ; int vcnt = 0 ; int find = 0 ; int mb_offset ; int mvx [ 8 ] ; int mvy [ 8 ] ; int i ; mv. as_int = 0 ; if ( here -> mbmi. ref_frame!= INTRA_FRAME ) { near_mvs [ 0 ]. as_int = near_mvs [ 1 ]. as_int = near_mvs [ 2 ]. as_int = near_mvs [ 3 ]. as_int = near_mvs [ 4 ]. as_int = near_mvs [ 5 ]. as_int = near_mvs [ 6 ]. as_int = near_mvs [ 7 ]. as_int = 0 ; near_ref [ 0 ] = near_ref [ 1 ] = near_ref [ 2 ] = near_ref [ 3 ] = near_ref [ 4 ] = near_ref [ 5 ] = near_ref [ 6 ] = near_ref [ 7 ] = 0 ; if ( above -> mbmi. ref_frame!= INTRA_FRAME ) { near_mvs [ vcnt ]. as_int = above -> mbmi. mv. as_int ; mv_bias ( ref_frame_sign_bias [ above -> mbmi. ref_frame ], refframe, & near_mvs [ vcnt ], ref_frame_sign_bias ) ; near_ref [ vcnt ] = above -> mbmi. ref_frame ; } vcnt ++ ; if ( left -> mbmi. ref_frame!= INTRA_FRAME ) { near_mvs [ vcnt ]. as_int = left -> mbmi. mv. as_int ; mv_bias ( ref_frame_sign_bias

Fix:
<S2SV_ModStart> 2 ] ; <S2SV_ModEnd> * sr =
Buggy code:
 void psf_asciiheader_printf ( SF_PRIVATE * psf, const char * format,... ) { va_list argptr ; int maxlen ; char * start ; <START_BUG> maxlen = strlen ( ( char * ) psf -> header ) ; <END_BUG>  start = ( ( char * ) psf -> header ) + maxlen ; <START_BUG> <END_BUG> maxlen = sizeof ( psf -> header ) - maxlen ;  va_start ( argptr, format ) ; vsnprintf ( start, maxlen, format, argptr ) ; va_end ( argptr ) ; start [ maxlen - 1 ] = 0 ; <START_BUG> psf -> headindex = strlen ( ( char * ) psf -> header ) ; <END_BUG> return ; }

Fix:
<S2SV_ModStart> psf -> header. ptr <S2SV_ModStart> psf -> header. ptr <S2SV_ModStart> ; maxlen = <S2SV_ModEnd> psf -> header <S2SV_ModStart> psf -> header. len <S2SV_ModEnd> - maxlen ; <S2SV_ModStart> ; psf -> header. indx <S2SV_ModEnd> = strlen ( <S2SV_ModStart> psf -> header. ptr
Buggy code:
 static void encode_mb_row ( VP8_COMP * cpi, VP8_COMMON * cm, int mb_row, MACROBLOCK * x, MACROBLOCKD * xd, TOKENEXTRA * * tp, int * segment_counts, int * totalrate ) { int recon_yoffset, recon_uvoffset ; int mb_col ; int ref_fb_idx = cm -> lst_fb_idx ; int dst_fb_idx = cm -> new_fb_idx ; int recon_y_stride = cm -> yv12_fb [ ref_fb_idx ]. y_stride ; int recon_uv_stride = cm -> yv12_fb [ ref_fb_idx ]. uv_stride ; int map_index = ( mb_row * cpi -> common. mb_cols ) ; # if ( CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING ) const int num_part = ( 1 << cm -> multi_token_partition ) ; TOKENEXTRA * tp_start = cpi -> tok ; vp8_writer * w ; # endif # if CONFIG_MULTITHREAD const int nsync = cpi -> mt_sync_range ; const int rightmost_col = cm -> mb_cols + nsync ; volatile const int * last_row_current_mb_col ; volatile int * current_mb_col = & cpi -> mt_current_mb_col [ mb_row ] ; if ( ( cpi -> b_multi_threaded!= 0 ) && ( mb_row!= 0 ) ) last_row_current_mb_col = & cpi -> mt_current_mb_col [ mb_row - 1 ] ; else last_row_current_mb_col = & rightmost_col ; # endif # if ( CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING ) if ( num_part > 1 ) w = & cpi -> bc [ 1 + ( mb_row % num_part ) ] ; else w = & cpi -> bc [ 1 ] ; # endif xd -> above_context = cm -> above_context ; xd -> up_available = ( mb_row!= 0 ) ; recon_yoffset = ( mb_row * recon_y_stride * 16 ) ; recon_uvoffset = ( mb_row *

Fix:
<S2SV_ModStart> endif if ( <S2SV_ModEnd> cpi -> current_layer <S2SV_ModStart> == 0 ) { if <S2SV_ModEnd> ( xd -> <S2SV_ModStart> mode == ZEROMV && <S2SV_ModEnd> xd -> mode_info_context <S2SV_ModStart> == LAST_FRAME ) { if ( cpi -> consec_zero_last [ map_index + mb_col ] < 255 ) cpi -> consec_zero_last [ map_index + mb_col ] += 1 ; if ( cpi -> consec_zero_last_mvbias [ map_index + mb_col ] < 255 ) cpi -> consec_zero_last_mvbias [ map_index + mb_col ] += 1 ; } else { cpi -> consec_zero_last [ map_index + mb_col ] = 0 ; cpi -> consec_zero_last_mvbias [ map_index + mb_col ] = 0 ; } if ( x -> zero_last_dot_suppress ) cpi -> consec_zero_last_mvbias [ map_index + mb_col ] = 0 ; } if ( ( cpi -> current_layer == 0 ) && ( cpi -> cyclic_refresh_mode_enabled && xd -> segmentation_
Buggy code:
 static void set_good_speed_feature ( VP9_COMP * cpi, VP9_COMMON * cm, SPEED_FEATURES * sf, int speed ) { <START_BUG> sf -> adaptive_rd_thresh = 1 ; <END_BUG> sf -> recode_loop = ( speed < 1 )? ALLOW_RECODE : ALLOW_RECODE_KFMAXBW ; sf -> allow_skip_recode = 1 ; if ( speed >= 1 ) {  sf -> use_square_partition_only =! frame_is_intra_only ( cm ) ; <START_BUG> <END_BUG> sf -> less_rectangular_check = 1 ;  <START_BUG> sf -> tx_size_search_method = vp9_frame_is_boosted ( cpi )? USE_FULL_RD <END_BUG> : USE_LARGESTALL ; if ( MIN ( cm -> width, cm -> height ) >= 720 ) sf -> disable_split_mask = cm -> show_frame? DISABLE_ALL_SPLIT : DISABLE_ALL_INTER_SPLIT ; else sf -> disable_split_mask = DISABLE_COMPOUND_SPLIT ; sf -> use_rd_breakout = 1 ; sf -> adaptive_motion_search = 1 ;  sf -> auto_mv_step_size = 1 ; <START_BUG> sf -> adaptive_rd_thresh = 2 ; <END_BUG> sf -> subpel_iters_per_step = 1 ;  sf -> mode_skip_start = 10 ; sf -> adaptive_pred_interp_filter = 1 ; sf -> recode_loop = ALLOW_RECODE_KFARFGF ; sf -> intra_y_mode_mask [ TX_32X32 ] = INTRA_DC_H_V ; sf -> intra_uv_mode_mask [ TX_32X32 ] = INTRA_DC_H_V ; sf -> intra_y_mode_mask [ TX_16X16 ] = INTRA_DC_H_V ; <START_BUG> sf -> intra_uv_mode_mask [ TX_16X16 ] = INTRA_DC_H_V ; <END_BUG> } if ( speed >= 2 ) {  sf -> tx_size_search_method = vp9_frame_is_boosted ( cpi )? USE_FULL_RD <START_BUG> : USE_LARGESTALL ; <END_BUG>

Fix:
<S2SV_ModStart> speed ) { const int boosted = frame_is_boosted ( cpi ) ; <S2SV_ModStart> adaptive_rd_thresh = 1 <S2SV_ModEnd> ; sf -> <S2SV_ModStart> 1 ) { if ( ( cpi -> twopass. fr_content_type == FC_GRAPHICS_ANIMATION ) || vp9_internal_image_edge ( cpi ) ) { sf -> use_square_partition_only =! frame_is_boosted ( cpi ) ; } else { <S2SV_ModStart> cm ) ; } <S2SV_ModStart> ; sf -> <S2SV_ModEnd> use_rd_breakout = 1 <S2SV_ModStart> ; sf -> mv. <S2SV_ModStart> ; sf -> mv. <S2SV_ModStart> ] = INTRA_DC_H_V ; sf -> tx_size_search_breakout = 1 ; sf -> partition_search_breakout_rate_thr = 80 <S2SV_ModStart> -> tx_size_search_method = frame_is_boosted <S2SV_ModEnd> ( cpi ) <S2SV_ModStart> : USE_LARGESTALL ; sf -> reference_masking = cpi -> oxcf. resize_mode!= RESIZE_DYNAMIC? 1 : 0 ; sf -> mode_search_skip_flags = <S2SV_ModEnd> ( cm -> <S2SV_ModStart> ( cm -> frame_type == KEY
Buggy code:
 static int splice_pipe_to_pipe ( struct pipe_inode_info * ipipe, struct pipe_inode_info * opipe, size_t len, unsigned int flags ) { struct pipe_buffer * ibuf, * obuf ; int ret = 0, nbuf ; bool input_wakeup = false ; retry : ret = ipipe_prep ( ipipe, flags ) ; if ( ret ) return ret ; ret = opipe_prep ( opipe, flags ) ; if ( ret ) return ret ; pipe_double_lock ( ipipe, opipe ) ; do { if (! opipe -> readers ) { send_sig ( SIGPIPE, current, 0 ) ; if (! ret ) ret = - EPIPE ; break ; } if (! ipipe -> nrbufs &&! ipipe -> writers ) break ; if (! ipipe -> nrbufs || opipe -> nrbufs >= opipe -> buffers ) { if ( ret ) break ; if ( flags & SPLICE_F_NONBLOCK ) { ret = - EAGAIN ; break ; } pipe_unlock ( ipipe ) ; pipe_unlock ( opipe ) ; goto retry ; } ibuf = ipipe -> bufs + ipipe -> curbuf ; nbuf = ( opipe -> curbuf + opipe -> nrbufs ) & ( opipe -> buffers - 1 ) ; obuf = opipe -> bufs + nbuf ; if ( len >= ibuf -> len ) { * obuf = * ibuf ; ibuf -> ops = NULL ; opipe -> nrbufs ++ ; ipipe -> curbuf = ( ipipe -> curbuf + 1 ) & ( ipipe -> buffers - 1 ) ; ipipe -> nrbufs -- ; input_wakeup = true ; } else { <START_BUG> pipe_buf_get ( ipipe, ibuf ) ; <END_BUG> * obuf = * ibuf ; obuf -> flags &= ~ PIPE_BUF_FLAG_GIFT ; pipe_buf_mark_unmergeable ( obuf ) ; obuf -> len = len ; opipe -> nrbufs ++ ; ibuf -> offset += obuf -> len ; ibuf -> len -= obuf -> len ; } ret += obuf -> len ; len -= obuf -> len ; } while ( len ) ; pipe_unlock ( ipipe ) ; pipe_unlock

Fix:
<S2SV_ModStart> } else { if (! <S2SV_ModStart>, ibuf ) ) { if ( ret == 0 ) ret = - EFAULT ; break ; } <S2SV_ModEnd> * obuf =
Buggy code:
 static stmt_ty <START_BUG> ast_for_funcdef_impl ( struct compiling * c, const node * n, <END_BUG>  asdl_seq * decorator_seq, int is_async ) <START_BUG> <END_BUG> {  identifier name ; arguments_ty args ; asdl_seq * body ; expr_ty returns = NULL ; int name_i = 1 ; node * tc ; string type_comment = NULL ; if ( is_async && c -> c_feature_version < 5 ) { ast_error ( c, n, "Async   functions   are   only   supported   in   Python   3.5   and   greater" ) ; return NULL ; } REQ ( n, funcdef ) ; name = NEW_IDENTIFIER ( CHILD ( n, name_i ) ) ; if (! name ) return NULL ; if ( forbidden_name ( c, name, CHILD ( n, name_i ), 0 ) ) return NULL ; args = ast_for_arguments ( c, CHILD ( n, name_i + 1 ) ) ; if (! args ) return NULL ; if ( TYPE ( CHILD ( n, name_i + 2 ) ) == RARROW ) { returns = ast_for_expr ( c, CHILD ( n, name_i + 3 ) ) ; if (! returns ) return NULL ; name_i += 2 ; } if ( TYPE ( CHILD ( n, name_i + 3 ) ) == TYPE_COMMENT ) { type_comment = NEW_TYPE_COMMENT ( CHILD ( n, name_i + 3 ) ) ; name_i += 1 ; } body = ast_for_suite ( c, CHILD ( n, name_i + 3 ) ) ; if (! body ) return NULL ; if (! type_comment && NCH ( CHILD ( n, name_i + 3 ) ) > 1 ) { tc = CHILD ( CHILD ( n, name_i + 3 ), 1 ) ; if ( TYPE ( tc ) == TYPE_COMMENT ) type_comment = NEW_TYPE_COMMENT ( tc ) ; } if ( is_async ) return AsyncFunctionDef ( name, args, body, decorator_seq, returns, <START_BUG> type_comment, LINENO ( n ), <END_BUG> n -> n_col_offset, c -> c_arena ) ; else return FunctionDef ( name, args

Fix:
<S2SV_ModStart> const node * n0 <S2SV_ModEnd>, asdl_seq * <S2SV_ModStart> * decorator_seq, bool <S2SV_ModEnd> is_async ) { <S2SV_ModStart> is_async ) { const node * const n = is_async? CHILD ( n0, 1 ) : n0 ; <S2SV_ModStart>, LINENO ( n0 ), n0 <S2SV_ModEnd> -> n_col_offset,
Buggy code:
 int mwifiex_cmd_802_11_ad_hoc_start ( struct mwifiex_private * priv, struct host_cmd_ds_command * cmd, struct cfg80211_ssid * req_ssid ) { int rsn_ie_len = 0 ; struct mwifiex_adapter * adapter = priv -> adapter ; struct host_cmd_ds_802_11_ad_hoc_start * adhoc_start = & cmd -> params. adhoc_start ; struct mwifiex_bssdescriptor * bss_desc ; u32 cmd_append_size = 0 ; u32 i ; u16 tmp_cap ; struct mwifiex_ie_types_chan_list_param_set * chan_tlv ; u8 radio_type ; struct mwifiex_ie_types_htcap * ht_cap ; struct mwifiex_ie_types_htinfo * ht_info ; u8 * pos = ( u8 * ) adhoc_start + sizeof ( struct host_cmd_ds_802_11_ad_hoc_start ) ; if (! adapter ) return - 1 ; cmd -> command = cpu_to_le16 ( HostCmd_CMD_802_11_AD_HOC_START ) ; bss_desc = & priv -> curr_bss_params. bss_descriptor ; priv -> attempted_bss_desc = bss_desc ; <START_BUG> memset ( adhoc_start -> ssid, 0, IEEE80211_MAX_SSID_LEN ) ; <END_BUG> memcpy ( adhoc_start -> ssid, req_ssid -> ssid, req_ssid -> ssid_len ) ; mwifiex_dbg ( adapter, INFO, "info:   ADHOC_S_CMD:   SSID   =   %s\\n", adhoc_start -> ssid ) ; memset ( bss_desc -> ssid. ssid, 0, IEEE80211_MAX_SSID_LEN ) ; memcpy ( bss_desc -> ssid. ssid, req_ssid -> ssid, req_ssid -> ssid_len ) ; bss_desc -> ssid. ssid_len = req_ssid -> ssid_len ;

Fix:
<S2SV_ModStart>, IEEE80211_MAX_SSID_LEN ) ; if ( req_ssid -> ssid_len > IEEE80211_MAX_SSID_LEN ) req_ssid -> ssid_len = IEEE80211_MAX_SSID_LEN
Buggy code:
 int vp9_rc_regulate_q ( const VP9_COMP * cpi, int target_bits_per_frame, int active_best_quality, int active_worst_quality ) { const VP9_COMMON * const cm = & cpi -> common ; int q = active_worst_quality ; int last_error = INT_MAX ; <START_BUG> int i, target_bits_per_mb ; <END_BUG> const double correction_factor = get_rate_correction_factor ( cpi ) ; target_bits_per_mb = ( ( uint64_t ) target_bits_per_frame << BPER_MB_NORMBITS ) // cm -> MBs ; i = active_best_quality ; do {  const int bits_per_mb_at_this_q = ( int ) vp9_rc_bits_per_mb ( cm -> frame_type, i, <START_BUG> <END_BUG> correction_factor ) ;  if ( bits_per_mb_at_this_q <= target_bits_per_mb ) { if ( ( target_bits_per_mb - bits_per_mb_at_this_q ) <= last_error ) q = i ; else q = i - 1 ; break ; } else { last_error = bits_per_mb_at_this_q - target_bits_per_mb ; } } while ( ++ i <= active_worst_quality ) ; <START_BUG> return q ; <END_BUG> }

Fix:
<S2SV_ModStart> i, target_bits_per_mb, bits_per_mb_at_this_q <S2SV_ModStart> ; do { if ( cpi -> oxcf. aq_mode == CYCLIC_REFRESH_AQ && cm -> seg. enabled && cpi -> svc. temporal_layer_id == 0 && cpi -> svc. spatial_layer_id == 0 ) { bits_per_mb_at_this_q = ( int ) vp9_cyclic_refresh_rc_bits_per_mb ( cpi, i, correction_factor ) ; } else { <S2SV_ModEnd> bits_per_mb_at_this_q = ( <S2SV_ModStart> i, correction_factor, cm -> bit_depth ) ; } <S2SV_ModEnd> if ( bits_per_mb_at_this_q <S2SV_ModStart> active_worst_quality ) ; if ( cpi -> oxcf. rc_mode == VPX_CBR && ( cpi -> rc. rc_1_frame * cpi -> rc. rc_2_frame == - 1 ) && cpi -> rc. q_1_frame!= cpi -> rc. q_2_frame ) { q = clamp (
Buggy code:
 static int l2cap_build_conf_req ( struct sock * sk, void * data ) { struct l2cap_pinfo * pi = l2cap_pi ( sk ) ; struct l2cap_conf_req * req = data ; <START_BUG> struct l2cap_conf_rfc rfc = {. mode = L2CAP_MODE_BASIC } ; <END_BUG> void * ptr = req -> data ; BT_DBG ( "sk   %p", sk ) ;  switch ( pi -> mode ) { <START_BUG> case L2CAP_MODE_BASIC : if ( pi -> imtu!= L2CAP_DEFAULT_MTU ) l2cap_add_conf_opt ( & ptr, L2CAP_CONF_MTU, 2, pi -> imtu ) ; break ; case L2CAP_MODE_ERTM : rfc. mode = L2CAP_MODE_ERTM ; <END_BUG> rfc. txwin_size = L2CAP_DEFAULT_RX_WINDOW ;  rfc. max_transmit = L2CAP_DEFAULT_MAX_RECEIVE ; <START_BUG> rfc. retrans_timeout = cpu_to_le16 ( L2CAP_DEFAULT_RETRANS_TO ) ; <END_BUG>  rfc. monitor_timeout = cpu_to_le16 ( L2CAP_DEFAULT_MONITOR_TO ) ; <START_BUG> rfc. max_pdu_size = cpu_to_le16 ( L2CAP_DEFAULT_MAX_RX_APDU ) ; l2cap_add_conf_opt ( & ptr, L2CAP_CONF_RFC, sizeof ( rfc ), ( unsigned long ) & rfc ) ; break ; } req -> dcid = cpu_to_le16 ( pi -> dcid ) ; req -> flags = cpu_to_le16 ( 0 ) ; return ptr - data ; }<END_BUG>

Fix:
<S2SV_ModStart>. mode = L2CAP_MODE_ERTM <S2SV_ModEnd> } ; void <S2SV_ModStart> sk ) ; if ( pi -> num_conf_req || pi -> num_conf_rsp ) goto done ; switch ( pi -> mode ) { case L2CAP_MODE_STREAMING : case L2CAP_MODE_ERTM : pi -> conf_state |= L2CAP_CONF_STATE2_DEVICE ; if (! l2cap_mode_supported ( pi -> mode, pi -> conn -> feat_mask ) ) { struct l2cap_disconn_req req ; req. dcid = cpu_to_le16 ( pi -> dcid ) ; req. scid = cpu_to_le16 ( pi -> scid ) ; l2cap_send_cmd ( pi -> conn, l2cap_get_ident ( pi -> conn ), L2CAP_DISCONN_REQ, sizeof ( req ), & req ) ; } break ; default : pi -> mode = l2cap_select_mode ( rfc. mode, pi -> conn -> feat_mask ) ; break ; } done : <S2SV_ModStart>. txwin_size = L2CAP_DEFAULT_TX_WINDOW <S2SV_ModEnd> ;
Buggy code:
 static void controloptions ( lua_State * L, int opt, const char * * fmt, Header * h ) { switch ( opt ) { case' ': return ; case '>' : h -> endian = BIG ; return ; case '<' : h -> endian = LITTLE ; return ; case '!' : { <START_BUG> int a = getnum ( fmt, MAXALIGN ) ; <END_BUG> if (! isp2 ( a ) ) luaL_error ( L, "alignment   %d   is   not   a   power   of   2", a ) ; h -> align = a ; return ; } default : { const char * msg = lua_pushfstring ( L, "invalid   format   option   \'%c\'", opt ) ; luaL_argerror ( L, 1, msg ) ; } } }

Fix:
<S2SV_ModStart> = getnum ( L,
Buggy code:
 static int sc_pkcs15emu_esteid_init ( sc_pkcs15_card_t * p15card ) { sc_card_t * card = p15card -> card ; unsigned char buff [ 128 ] ; int r, i ; size_t field_length = 0, modulus_length = 0 ; sc_path_t tmppath ; set_string ( & p15card -> tokeninfo -> label, "ID-kaart" ) ; set_string ( & p15card -> tokeninfo -> manufacturer_id, "AS   Sertifitseerimiskeskus" ) ; sc_format_path ( "3f00eeee5044", & tmppath ) ; r = sc_select_file ( card, & tmppath, NULL ) ; SC_TEST_RET ( card -> ctx, SC_LOG_DEBUG_NORMAL, r, "select   esteid   PD   failed" ) ; r = sc_read_record ( card, SC_ESTEID_PD_DOCUMENT_NR, buff, sizeof ( buff ), SC_RECORD_BY_REC_NR ) ; SC_TEST_RET ( card -> ctx, SC_LOG_DEBUG_NORMAL, r, "read   document   number   failed" ) ; <START_BUG> buff [ r ] = '\\0' ; <END_BUG> set_string ( & p15card -> tokeninfo -> serial_number, ( const char * ) buff ) ; p15card -> tokeninfo -> flags = SC_PKCS15_TOKEN_PRN_GENERATION | SC_PKCS15_TOKEN_EID_COMPLIANT | SC_PKCS15_TOKEN_READONLY ; for ( i = 0 ; i < 2 ; i ++ ) { static const char * esteid_cert_names [ 2 ] = { "Isikutuvastus", "Allkirjastamine" } ; static char const * esteid_cert_paths [ 2 ] = { "3f00eeeeaace", "3f00eeeeddce" } ; static int esteid_cert_ids [ 2 ] = { 1, 2 } ; struct sc_pkcs15_cert_info cert_info ; struct sc_pkcs15_object cert_obj ; memset ( & cert_info, 0, sizeof ( cert

Fix:
<S2SV_ModStart> ; buff [ MIN ( ( size_t ) r, ( sizeof buff ) - 1 ) <S2SV_ModEnd> ] = '\\0'
Buggy code:
 __init int intel_pmu_init ( void ) { union cpuid10_edx edx ; union cpuid10_eax eax ; union cpuid10_ebx ebx ; struct event_constraint * c ; unsigned int unused ; int version ; if (! cpu_has ( & boot_cpu_data, X86_FEATURE_ARCH_PERFMON ) ) { switch ( boot_cpu_data. x86 ) { case 0x6 : return p6_pmu_init ( ) ; case 0xb : return knc_pmu_init ( ) ; case 0xf : return p4_pmu_init ( ) ; } return - ENODEV ; } cpuid ( 10, & eax. full, & ebx. full, & unused, & edx. full ) ; if ( eax. split. mask_length < ARCH_PERFMON_EVENTS_COUNT ) return - ENODEV ; version = eax. split. version_id ; if ( version < 2 ) x86_pmu = core_pmu ; else x86_pmu = intel_pmu ; x86_pmu. version = version ; x86_pmu. num_counters = eax. split. num_counters ; x86_pmu. cntval_bits = eax. split. bit_width ; x86_pmu. cntval_mask = ( 1ULL << eax. split. bit_width ) - 1 ; x86_pmu. events_maskl = ebx. full ; x86_pmu. events_mask_len = eax. split. mask_length ; x86_pmu. max_pebs_events = min_t ( unsigned, MAX_PEBS_EVENTS, x86_pmu. num_counters ) ; if ( version > 1 ) x86_pmu. num_counters_fixed = max ( ( int ) edx. split. num_counters_fixed, 3 ) ; if ( version > 1 ) { u64 capabilities ; rdmsrl ( MSR_IA32_PERF_CAPABILITIES, capabilities ) ; x86_pmu. intel_cap. capabilities = capabilities ; } intel_ds_init ( ) ; x86_add_quirk ( intel_arch_events

Fix:
<S2SV_ModStart> = intel_pebs_aliases_snb ; if ( boot_cpu_data. x86_model == 45 ) x86_pmu. extra_regs = intel_snbep_extra_regs ; else <S2SV_ModStart> = intel_pebs_aliases_snb ; if ( boot_cpu_data. x86_model == 62 ) x86_pmu. extra_regs = intel_snbep_extra_regs ; else
Buggy code:
 IMPEG2D_ERROR_CODES_T impeg2d_dec_p_b_slice ( dec_state_t * ps_dec ) { WORD16 * pi2_vld_out ; UWORD32 i ; yuv_buf_t * ps_cur_frm_buf = & ps_dec -> s_cur_frm_buf ; UWORD32 u4_frm_offset = 0 ; const dec_mb_params_t * ps_dec_mb_params ; IMPEG2D_ERROR_CODES_T e_error = ( IMPEG2D_ERROR_CODES_T ) IVD_ERROR_NONE ; pi2_vld_out = ps_dec -> ai2_vld_buf ; memset ( ps_dec -> ai2_pred_mv, 0, sizeof ( ps_dec -> ai2_pred_mv ) ) ; ps_dec -> u2_prev_intra_mb = 0 ; ps_dec -> u2_first_mb = 1 ; ps_dec -> u2_picture_width = ps_dec -> u2_frame_width ; if ( ps_dec -> u2_picture_structure!= FRAME_PICTURE ) { ps_dec -> u2_picture_width <<= 1 ; if ( ps_dec -> u2_picture_structure == BOTTOM_FIELD ) { u4_frm_offset = ps_dec -> u2_frame_width ; } } do { UWORD32 u4_x_offset, u4_y_offset ; <START_BUG> UWORD32 u4_x_dst_offset = 0 ; <END_BUG> UWORD32 u4_y_dst_offset = 0 ; UWORD8 * pu1_out_p ; UWORD8 * pu1_pred ; WORD32 u4_pred_strd ; IMPEG2D_TRACE_MB_START ( ps_dec -> u2_mb_x, ps_dec -> u2_mb_y ) ; if ( ps_dec -> e_pic_type == B_PIC )  impeg2d_dec_pnb_mb_params ( ps_dec ) ; <START_BUG> else <END_BUG> impeg2d_dec_p_mb_params ( ps_dec ) ;  IMPEG2D_TRACE_MB_START ( ps_dec -> u2_

Fix:
<S2SV_ModStart>, u4_y_offset ; WORD32 ret ; <S2SV_ModStart> == B_PIC ) ret = <S2SV_ModStart> ) ; else ret = <S2SV_ModStart> ( ps_dec ) ; if ( ret ) return IMPEG2D_MB_TEX_DECODE_ERR
Buggy code:
 void <START_BUG> nfs4_state_set_mode_locked ( struct nfs4_state * state, mode_t mode ) <END_BUG> {  if ( state -> state == mode ) <START_BUG> return ; <END_BUG> if ( ( mode & FMODE_WRITE )!= ( state -> state & FMODE_WRITE ) ) {  <START_BUG> if ( mode & FMODE_WRITE ) <END_BUG> list_move ( & state -> open_states, & state -> owner -> so_states ) ; else list_move_tail ( & state -> open_states, & state -> owner -> so_states ) ; }  state -> state = mode ; <START_BUG> }<END_BUG>

Fix:
<S2SV_ModStart> * state, fmode_t fmode <S2SV_ModEnd> ) { if <S2SV_ModStart> -> state == fmode <S2SV_ModEnd> ) return ; <S2SV_ModStart> if ( ( fmode <S2SV_ModEnd> & FMODE_WRITE ) <S2SV_ModStart> { if ( fmode <S2SV_ModEnd> & FMODE_WRITE ) <S2SV_ModStart> -> state = fmode <S2SV_ModEnd> ; } <S2SV_null>
Buggy code:
 getprivs_ret * get_privs_2_svc ( krb5_ui_4 * arg, struct svc_req * rqstp ) { static getprivs_ret ret ; <START_BUG> gss_buffer_desc client_name, service_name ; <END_BUG> OM_uint32 minor_stat ; kadm5_server_handle_t handle ; const char * errmsg = NULL ; xdr_free ( xdr_getprivs_ret, & ret ) ; if ( ( ret. code = new_server_handle ( * arg, rqstp, & handle ) ) ) goto exit_func ; if ( ( ret. code = check_handle ( ( void * ) handle ) ) ) goto exit_func ; ret. api_version = handle -> api_version ; if ( setup_gss_names ( rqstp, & client_name, & service_name ) < 0 ) { ret. code = KADM5_FAILURE ; goto exit_func ; } ret. code = kadm5_get_privs ( ( void * ) handle, & ret. privs ) ; if ( ret. code!= 0 ) errmsg = krb5_get_error_message ( handle -> context, ret. code ) ; log_done ( "kadm5_get_privs", client_name. value, errmsg, & client_name, & service_name, rqstp ) ; if ( errmsg!= NULL ) krb5_free_error_message ( handle -> context, errmsg ) ;  gss_release_buffer ( & minor_stat, & client_name ) ; <START_BUG> gss_release_buffer ( & minor_stat, & service_name ) ; <END_BUG> exit_func :  free_server_handle ( handle ) ; return & ret ; }

Fix:
<S2SV_ModStart> ; gss_buffer_desc client_name = GSS_C_EMPTY_BUFFER ; gss_buffer_desc service_name = GSS_C_EMPTY_BUFFER <S2SV_ModEnd> ; OM_uint32 minor_stat <S2SV_ModStart> errmsg ) ; exit_func : <S2SV_ModStart> service_name ) ; <S2SV_ModEnd> free_server_handle ( handle
Buggy code:
 static void <START_BUG> ext4_xattr_cache_insert ( struct mb_cache * ext4_mb_cache, struct buffer_head * bh ) <END_BUG> { __u32 hash = le32_to_cpu ( BHDR ( bh ) -> h_hash ) ;  struct mb_cache_entry * ce ; <START_BUG> int error ; <END_BUG> ce = mb_cache_entry_alloc ( ext4_mb_cache, GFP_NOFS ) ;  if (! ce ) { ea_bdebug ( bh, "out   of   memory" ) ; return ; } <START_BUG> error = mb_cache_entry_insert ( ce, bh -> b_bdev, bh -> b_blocknr, hash ) ; <END_BUG> if ( error ) {  mb_cache_entry_free ( ce ) ; <START_BUG> <END_BUG> if ( error == - EBUSY ) {  ea_bdebug ( bh, "already   in   cache" ) ; <START_BUG> error = 0 ; <END_BUG> } } else { ea_bdebug ( bh, "inserting   [%x]", ( int ) hash ) ;  mb_cache_entry_release ( ce ) ; <START_BUG> } }<END_BUG>

Fix:
<S2SV_ModStart> ext4_xattr_cache_insert ( struct mb2_cache <S2SV_ModEnd> * ext4_mb_cache, <S2SV_ModStart> h_hash ) ; <S2SV_ModEnd> int error ; <S2SV_ModStart> int error ; error = mb2_cache_entry_create <S2SV_ModEnd> ( ext4_mb_cache, <S2SV_ModStart> ext4_mb_cache, GFP_NOFS, hash, <S2SV_ModEnd> bh -> b_blocknr <S2SV_ModStart> bh -> b_blocknr <S2SV_ModEnd> ) ; if <S2SV_ModStart> error ) { <S2SV_ModEnd> if ( error <S2SV_ModStart> - EBUSY ) <S2SV_ModEnd> ea_bdebug ( bh <S2SV_ModStart> "already <S2SV_blank> in <S2SV_blank> cache" ) ; } else <S2SV_ModEnd> ea_bdebug ( bh <S2SV_ModStart> hash ) ; <S2SV_ModEnd> } <S2SV_null> <S2SV_null>
Buggy code:
 static void l2tp_ppp_discon_cc_print ( netdissect_options * ndo, const u_char * dat, u_int length ) { const uint16_t * ptr = ( const uint16_t * ) dat ; <START_BUG> ND_PRINT ( ( ndo, "%04x,   ", EXTRACT_16BITS ( ptr ) ) ) ; ptr ++ ; <END_BUG>  ND_PRINT ( ( ndo, "%04x   ", EXTRACT_16BITS ( ptr ) ) ) ; ptr ++ ; <START_BUG> ND_PRINT ( ( ndo, "%s", tok2str ( l2tp_cc_direction2str, <END_BUG> "Direction-#%u", * ( ( const u_char * ) ptr ++ ) ) ) ) ;  <START_BUG> if ( length > 5 ) { <END_BUG> ND_PRINT ( ( ndo, "   " ) ) ;  print_string ( ndo, ( const u_char * ) ptr, length - 5 ) ; <START_BUG> } }<END_BUG>

Fix:
<S2SV_ModStart> ) dat ; if ( length < 5 ) { ND_PRINT ( ( ndo, "AVP <S2SV_blank> too <S2SV_blank> short" ) ) ; return ; } <S2SV_ModStart>, EXTRACT_16BITS ( dat <S2SV_ModEnd> ) ) ) <S2SV_ModStart> ) ) ; dat += 2 ; length -= 2 <S2SV_ModEnd> ; ND_PRINT ( <S2SV_ModStart>, EXTRACT_16BITS ( dat <S2SV_ModEnd> ) ) ) <S2SV_ModStart> ) ) ; dat += 2 ; length -= 2 <S2SV_ModEnd> ; ND_PRINT ( <S2SV_ModStart>, "Direction-#%u", EXTRACT_8BITS ( ptr <S2SV_ModEnd> ) ) ) <S2SV_ModStart> ) ) ; ptr ++ ; length -- ; <S2SV_ModStart> if ( length!= 0 <S2SV_ModEnd> ) { ND_PRINT <S2SV_ModStart> ptr, length <S2SV_ModEnd> ) ; }
Buggy code:
 <START_BUG> void ftoa_bounded_extra ( JsVarFloat val, char * str, size_t len, int radix, int fractionalDigits ) { <END_BUG> const JsVarFloat stopAtError = 0.0000001 ;  if ( isnan ( val ) ) strncpy ( str, "NaN", len ) ; <START_BUG> else if (! isfinite ( val ) ) { <END_BUG> if ( val < 0 ) strncpy ( str, "-Infinity", len ) ;  <START_BUG> else strncpy ( str, "Infinity", len ) ; <END_BUG> } else { if ( val < 0 ) { if ( -- len <= 0 ) { * str = 0 ; return ; } * ( str ++ ) = '-' ; val = - val ; } if ( ( ( JsVarInt ) ( val + stopAtError ) ) == ( 1 + ( JsVarInt ) val ) ) val = ( JsVarFloat ) ( 1 + ( JsVarInt ) val ) ; JsVarFloat d = 1 ; while ( d * radix <= val ) d *= radix ; while ( d >= 1 ) { int v = ( int ) ( val // d ) ; val -= v * d ; if ( -- len <= 0 ) { * str = 0 ; return ; } * ( str ++ ) = itoch ( v ) ; d //= radix ; } # ifndef USE_NO_FLOATS if ( ( ( fractionalDigits < 0 ) && val > 0 ) || fractionalDigits > 0 ) { bool hasPt = false ; val *= radix ; while ( ( ( fractionalDigits < 0 ) && ( fractionalDigits > - 12 ) && ( val > stopAtError ) ) || ( fractionalDigits > 0 ) ) { int v = ( int ) ( val + ( ( fractionalDigits == 1 )? 0.4 : 0.00000001 ) ) ; val = ( val - v ) * radix ; if ( v == radix ) v = radix - 1 ; if (! hasPt ) { hasPt = true ; if ( -- len <= 0 ) { * str = 0 ; return ; } * ( str ++ ) = '.' ; } if ( -- len <= 0 ) { * str = 0 ; return ; } * ( str ++ ) = itoch ( v ) ; fractionalDigits -- ; } } # endif * ( str ++ ) = 0 ; } }

Fix:
<S2SV_ModStart> fractionalDigits ) { assert ( len > 9 ) ; <S2SV_ModStart> val ) ) strcpy <S2SV_ModEnd> ( str, <S2SV_ModStart> str, "NaN" <S2SV_ModEnd> ) ; else <S2SV_ModStart> < 0 ) strcpy <S2SV_ModEnd> ( str, <S2SV_ModStart> str, "-Infinity" <S2SV_ModEnd> ) ; else <S2SV_ModStart> ) ; else strcpy <S2SV_ModEnd> ( str, <S2SV_ModStart> str, "Infinity" <S2SV_ModEnd> ) ; }
Buggy code:
 int test ( char * URL ) { int errors = 0 ; ( void ) URL ; errors += test_weird_arguments ( ) ; errors += test_unsigned_short_formatting ( ) ; errors += test_signed_short_formatting ( ) ; errors += test_unsigned_int_formatting ( ) ; errors += test_signed_int_formatting ( ) ; errors += test_unsigned_long_formatting ( ) ; errors += test_signed_long_formatting ( ) ; errors += test_curl_off_t_formatting ( ) ; errors += test_string_formatting ( ) ; <START_BUG> if ( errors ) <END_BUG> return TEST_ERR_MAJOR_BAD ; else return 0 ; }

Fix:
<S2SV_ModStart> ( ) ; errors += test_float_formatting ( ) ;
Buggy code:
 void bta_hh_co_open ( UINT8 dev_handle, UINT8 sub_class, tBTA_HH_ATTR_MASK attr_mask, UINT8 app_id ) { UINT32 i ; btif_hh_device_t * p_dev = NULL ; if ( dev_handle == BTA_HH_INVALID_HANDLE ) { APPL_TRACE_WARNING ( "%s:   Oops,   dev_handle   (%d)   is   invalid...", __FUNCTION__, dev_handle ) ; return ; } for ( i = 0 ; i < BTIF_HH_MAX_HID ; i ++ ) { p_dev = & btif_hh_cb. devices [ i ] ; if ( p_dev -> dev_status!= BTHH_CONN_STATE_UNKNOWN && p_dev -> dev_handle == dev_handle ) { APPL_TRACE_WARNING ( "%s:   Found   an   existing   device   with   the   same   handle   " "dev_status   =   %d", __FUNCTION__, p_dev -> dev_status ) ; APPL_TRACE_WARNING ( "%s:           bd_addr   =   [%02X:%02X:%02X:%02X:%02X:]", __FUNCTION__, p_dev -> bd_addr. address [ 0 ], p_dev -> bd_addr. address [ 1 ], p_dev -> bd_addr. address [ 2 ], p_dev -> bd_addr. address [ 3 ], p_dev -> bd_addr. address [ 4 ] ) ; APPL_TRACE_WARNING ( "%s:           attr_mask   =   0x%04x,   sub_class   =   0x%02x,   app_id   =   %d", __FUNCTION__, p_dev -> attr_mask, p_dev -> sub_class, p_dev -> app_id ) ; if ( p_dev -> fd < 0 ) { <START_BUG> p_dev -> fd = open ( dev_path, O_RDWR | O_CLOEXEC ) ; <END_BUG> if ( p_dev -> fd < 0 ) { APPL_TRACE_ERROR ( "%s:   Error:   failed   to   open   uhid,   err:%

Fix:
<S2SV_ModStart> -> fd = TEMP_FAILURE_RETRY ( <S2SV_ModStart> | O_CLOEXEC ) ) <S2SV_ModStart> -> fd = TEMP_FAILURE_RETRY ( <S2SV_ModStart> | O_CLOEXEC ) )
Buggy code:
 static int stellaris_enet_init ( SysBusDevice * sbd ) { DeviceState * dev = DEVICE ( sbd ) ; stellaris_enet_state * s = STELLARIS_ENET ( dev ) ; memory_region_init_io ( & s -> mmio, OBJECT ( s ), & stellaris_enet_ops, s, "stellaris_enet", 0x1000 ) ; sysbus_init_mmio ( sbd, & s -> mmio ) ; sysbus_init_irq ( sbd, & s -> irq ) ; qemu_macaddr_default_if_unset ( & s -> conf. macaddr ) ; s -> nic = qemu_new_nic ( & net_stellaris_enet_info, & s -> conf, object_get_typename ( OBJECT ( dev ) ), dev -> id, s ) ; qemu_format_nic_info_str ( qemu_get_queue ( s -> nic ), s -> conf. macaddr. a ) ; stellaris_enet_reset ( s ) ; <START_BUG> register_savevm ( dev, "stellaris_enet", - 1, 1, <END_BUG> stellaris_enet_save, stellaris_enet_load, s ) ; return 0 ; }

Fix:
<S2SV_ModStart> s ) ; <S2SV_ModEnd> return 0 ;
Buggy code:
 static int parse_user_name ( char * user_input, char * * ret_username ) { register char * ptr ; register int index = 0 ; char username [ PAM_MAX_RESP_SIZE ] ; * ret_username = NULL ; bzero ( ( void * ) username, PAM_MAX_RESP_SIZE ) ; ptr = user_input ; while ( ( * ptr ==' ') || ( * ptr == '\\t' ) ) ptr ++ ; if ( * ptr == '\\0' ) { return ( PAM_BUF_ERR ) ; } while ( * ptr!= '\\0' ) { <START_BUG> if ( ( * ptr ==' ') || ( * ptr == '\\t' ) ) <END_BUG> break ; else { username [ index ] = * ptr ; index ++ ; ptr ++ ; } }  if ( ( * ret_username = malloc ( index + 1 ) ) == NULL ) <START_BUG> return ( PAM_BUF_ERR ) ; <END_BUG> ( void ) strcpy ( * ret_username, username ) ;  return ( PAM_SUCCESS ) ; }

Fix:
<S2SV_ModStart> == '\\t' ) || ( index >= PAM_MAX_RESP_SIZE ) ) { break ; } <S2SV_ModEnd> else { username <S2SV_ModStart> } if ( index >= PAM_MAX_RESP_SIZE || <S2SV_ModStart> * ret_username = strdup ( username <S2SV_ModEnd> ) ) == <S2SV_ModStart> PAM_BUF_ERR ) ; <S2SV_ModEnd> return ( PAM_SUCCESS
Buggy code:
 <START_BUG> void nego_process_negotiation_request ( rdpNego * nego, wStream * s ) <END_BUG> { BYTE flags ;  UINT16 length ; <START_BUG> Stream_Read_UINT8 ( s, flags ) ; Stream_Read_UINT16 ( s, length ) ; Stream_Read_UINT32 ( s, nego -> RequestedProtocols ) ; WLog_DBG ( TAG, "RDP_NEG_REQ:   RequestedProtocol:   0x%08" PRIX32 "", nego -> RequestedProtocols ) ; nego -> state = NEGO_STATE_FINAL ; <END_BUG> } 

Fix:
<S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> BOOL <S2SV_ModEnd> nego_process_negotiation_request ( rdpNego <S2SV_ModStart> ; UINT16 length ; if ( Stream_GetRemainingLength ( s ) < 7 ) return FALSE <S2SV_ModStart> = NEGO_STATE_FINAL ; return TRUE ;