nus-yam/ex-repair huggingface dataset:
Buggy code:
 static int handle_packet ( unsigned char * data, int data_len ) { struct mt_mactelnet_hdr pkthdr ; if ( data_len < MT_HEADER_LEN ) { return - 1 ; } parse_packet ( data, & pkthdr ) ; if ( pkthdr. seskey!= sessionkey ) { return - 1 ; } if ( pkthdr. ptype == MT_PTYPE_DATA ) { struct mt_packet odata ; struct mt_mactelnet_control_hdr cpkt ; int success = 0 ; init_packet ( & odata, MT_PTYPE_ACK, srcmac, dstmac, sessionkey, pkthdr. counter + ( data_len - MT_HEADER_LEN ) ) ; send_udp ( & odata, 0 ) ; if ( pkthdr. counter > incounter || ( incounter - pkthdr. counter ) > 65535 ) { incounter = pkthdr. counter ; } else { return - 1 ; } success = parse_control_packet ( data + MT_HEADER_LEN, data_len - MT_HEADER_LEN, & cpkt ) ; while ( success ) { if ( cpkt. cptype == MT_CPTYPE_PASSSALT ) { <START_BUG> memcpy ( pass_salt, cpkt. data, cpkt. length ) ; <END_BUG> send_auth ( username, password ) ; } else if ( cpkt. cptype == MT_CPTYPE_PLAINDATA ) { fwrite ( ( const void * ) cpkt. data, 1, cpkt. length, stdout ) ; } else if ( cpkt. cptype == MT_CPTYPE_END_AUTH ) { terminal_mode = 1 ; if ( is_a_tty ) { raw_term ( ) ; setvbuf ( stdin, ( char * ) NULL, _IONBF, 0 ) ; signal ( SIGWINCH, sig_winch ) ; } } success = parse_control_packet ( NULL, 0, & cpkt ) ; } } else if ( pkthdr. ptype == MT_PTYPE_ACK ) { } else if ( pkthdr. ptype == MT_PTYPE_END ) { struct mt_packet odata ; init_packet ( & odata, MT_PTYPE_END, srcmac, dstmac, pkthdr. ses

Fix:
<S2SV_ModStart> MT_CPTYPE_PASSSALT ) { if ( cpkt. length!= 16 ) { fprintf ( stderr, _ ( "Invalid <S2SV_blank> salt <S2SV_blank> length: <S2SV_blank> %d <S2SV_blank> (instead <S2SV_blank> of <S2SV_blank> 16) <S2SV_blank> received <S2SV_blank> from <S2SV_blank> server <S2SV_blank> %s\\n" ), cpkt. length, ether_ntoa ( ( struct ether_addr * ) dstmac ) ) ; } <S2SV_ModStart>. data, 16 <S2SV_ModEnd> ) ; send_auth
Buggy code:
 int obj2ast_mod ( PyObject * obj, mod_ty * out, PyArena * arena ) { int isinstance ; PyObject * tmp = NULL ; if ( obj == Py_None ) { * out = NULL ; return 0 ; } isinstance = PyObject_IsInstance ( obj, ( PyObject * ) Module_type ) ; if ( isinstance == - 1 ) { return 1 ; } if ( isinstance ) { asdl_seq * body ; asdl_seq * type_ignores ; <START_BUG> if ( _PyObject_HasAttrId ( obj, & PyId_body ) ) { <END_BUG> int res ; Py_ssize_t len ;  Py_ssize_t i ; <START_BUG> tmp = _PyObject_GetAttrId ( obj, & PyId_body ) ; if ( tmp == NULL ) goto failed ; if (! PyList_Check ( tmp ) ) { PyErr_Format ( PyExc_TypeError, "Module   field   \\"body\\"   must   be   a   list,   not   a   %.200s", tmp -> ob_type -> tp_name ) ; goto failed ; } len = PyList_GET_SIZE ( tmp ) ; body = _Ta3_asdl_seq_new ( len, arena ) ; if ( body == NULL ) goto failed ; for ( i = 0 ; i < len ; i ++ ) { <END_BUG> stmt_ty value ;  <START_BUG> res = obj2ast_stmt ( PyList_GET_ITEM ( tmp, i ), & value, arena ) ; <END_BUG> if ( res!= 0 ) goto failed ; if ( len!= PyList_GET_SIZE ( tmp ) ) { PyErr_SetString ( PyExc_RuntimeError, "Module   field   \\"body\\"   changed   size   during   iteration" ) ; goto failed ; }  asdl_seq_SET ( body, i, value ) ; <START_BUG> } Py_CLEAR ( tmp ) ; <END_BUG> } else {  PyErr_SetString ( PyExc_TypeError, "required   field   \\"body\\"   missing   from   Module" ) ; return 1 ; } if ( _PyObject_HasAttrId ( obj, & PyId_type_ignores ) ) { int res ; Py_ssize_t len ; <START_BUG> Py_ssize_t i ; <END_BUG> tmp = _Py

Fix:
<S2SV_ModStart> ; if ( lookup_attr_id <S2SV_ModEnd> ( obj, <S2SV_ModStart>, & PyId_body, & tmp ) < 0 ) { return 1 ; } if ( tmp == NULL ) { PyErr_SetString ( PyExc_TypeError, "required <S2SV_blank> field <S2SV_blank> \\"body\\" <S2SV_blank> missing <S2SV_blank> from <S2SV_blank> Module" ) ; return 1 ; } else <S2SV_ModEnd> { int res <S2SV_ModStart> ; Py_ssize_t i <S2SV_ModEnd> ; if ( <S2SV_ModStart> ) { stmt_ty val <S2SV_ModEnd> ; res = <S2SV_ModStart> ), & val <S2SV_ModEnd>, arena ) <S2SV_ModStart>, i, val <S2SV_ModEnd> ) ; } <S2SV_ModStart> ) ; } if ( lookup_attr_id ( obj, & PyId_type_ignores, & tmp ) < 0 ) { return 1 ; } if ( tmp == NULL ) { PyErr_SetString ( PyExc_TypeError, "required <S2SV_blank> field <S2SV_blank> \\"type_ignores\\" <S2SV_blank> missing <S2SV_blank> from <S2SV_blank> Module" ) ; return 1 ; } else { <S2SV_ModEnd> int res ; <S2SV_ModStart> ; Py_ssize_t i <S2SV_ModEnd> ; if ( <S2SV_ModStart> ) { type_ignore_ty val <S2SV_ModEnd> ; res = <S2SV_ModStart> ), & val <S2SV_ModEnd>, arena ) <S2SV_ModStart>, i, val <S2SV_ModEnd> ) ; } <S2SV_ModStart> ) ; } * out = Module
Buggy code:
 static Image * ReadRLEImage ( const ImageInfo * image_info, ExceptionInfo * exception ) { # define SkipLinesOp 0x01 # define SetColorOp 0x02 # define SkipPixelsOp 0x03 # define ByteDataOp 0x05 # define RunDataOp 0x06 # define EOFOp 0x07 char magick [ 12 ] ; Image * image ; IndexPacket index ; int opcode, operand, status ; MagickStatusType flags ; MagickSizeType number_pixels ; MemoryInfo * pixel_info ; register IndexPacket * indexes ; register ssize_t x ; register PixelPacket * q ; register ssize_t i ; register unsigned char * p ; size_t bits_per_pixel, map_length, number_colormaps, number_planes, number_planes_filled, one, <START_BUG> offset, <END_BUG> pixel_info_length ; ssize_t count, y ; unsigned char background_color [ 256 ], * colormap, pixel, plane, * pixels ; assert ( image_info!= ( const ImageInfo * ) NULL ) ; assert ( image_info -> signature == MagickSignature ) ; if ( image_info -> debug!= MagickFalse ) ( void ) LogMagickEvent ( TraceEvent, GetMagickModule ( ), "%s", image_info -> filename ) ; assert ( exception!= ( ExceptionInfo * ) NULL ) ; assert ( exception -> signature == MagickSignature ) ; image = AcquireImage ( image_info ) ; status = OpenBlob ( image_info, image, ReadBinaryBlobMode, exception ) ; if ( status == MagickFalse ) return ( DestroyImageList ( image ) ) ; count = ReadBlob ( image, 2, ( unsigned char * ) magick ) ; if ( ( count!= 2 ) || ( memcmp ( magick, "\\122\\314", 2 )!= 0 ) ) ThrowReaderException ( CorruptImageError, "ImproperImageHeader" ) ; do { image -> page. x = ReadBlobLSBShort ( image ) ; image -> page. y = ReadBlobLSBShort ( image ) ; image -> columns = ReadBlobLSBShort ( image ) ; image -> rows = ReadBlobLSBShort ( image ) ; flags = ( MagickStatusType ) ReadBlobByte ( image ) ; image -> matte = flags & 0x04? MagickTrue : Mag

Fix:
<S2SV_ModStart>, one, pixel_info_length ; ssize_t count, offset <S2SV_ModEnd>, y ; <S2SV_ModStart> ; if ( ( offset < 0 ) || ( <S2SV_ModStart> ) > pixel_info_length ) <S2SV_ModStart> + plane ; if ( ( offset < 0 ) || ( offset + ( ( size_t ) operand * number_planes ) > pixel_info_length ) ) { if ( number_colormaps!= 0 ) colormap = ( unsigned char * ) RelinquishMagickMemory ( colormap ) ; pixel_info = RelinquishVirtualMemory ( pixel_info ) ; ThrowReaderException ( CorruptImageError, "UnableToReadImageData" ) ; } <S2SV_ModStart> + offset ; <S2SV_ModEnd> for ( i
Buggy code:
 SNDFILE * sf_open ( const char * path, int mode, SF_INFO * sfinfo ) { SF_PRIVATE * psf ; assert ( sizeof ( sf_count_t ) == 8 ) ; <START_BUG> if ( ( psf = calloc ( 1, sizeof ( SF_PRIVATE ) ) ) == NULL ) <END_BUG> { sf_errno = SFE_MALLOC_FAILED ; return NULL ; } ; psf_init_files ( psf ) ; psf_log_printf ( psf, "File   :   %s\\n", path ) ; if ( copy_filename ( psf, path )!= 0 ) { sf_errno = psf -> error ; return NULL ; } ; psf -> file. mode = mode ; if ( strcmp ( path, "-" ) == 0 ) psf -> error = psf_set_stdio ( psf ) ; else psf -> error = psf_fopen ( psf ) ; return psf_open_file ( psf, sfinfo ) ; }

Fix:
<S2SV_ModStart> ( psf = psf_allocate ( <S2SV_ModEnd> ) ) ==
Buggy code:
 static int parse_stream_params ( struct VpxEncoderConfig * global, struct stream_state * stream, char * * argv ) { char * * argi, * * argj ; struct arg arg ; static const arg_def_t * * ctrl_args = no_args ; static const int * ctrl_args_map = NULL ; struct stream_config * config = & stream -> config ; int eos_mark_found = 0 ; <START_BUG> if ( 0 ) { <END_BUG> # if CONFIG_VP8_ENCODER } else if ( strcmp ( global -> codec -> name, "vp8" ) == 0 ) { ctrl_args = vp8_args ; ctrl_args_map = vp8_arg_ctrl_map ; # endif # if CONFIG_VP9_ENCODER } else if ( strcmp ( global -> codec -> name, "vp9" ) == 0 ) { ctrl_args = vp9_args ; ctrl_args_map = vp9_arg_ctrl_map ; # endif  } <START_BUG> for ( argi = argj = argv ; ( * argj = * argi ) ; argi += arg. argv_step ) { arg. argv_step = 1 ; if ( eos_mark_found ) { argj ++ ; continue ; } else if (! strcmp ( * argj, "--" ) ) { eos_mark_found = 1 ; continue ; } <END_BUG> if ( 0 ) {  } else if ( arg_match ( & arg, & outputfile, argi ) ) { config -> out_fn = arg. val ; } else if ( arg_match ( & arg, & fpf_name, argi ) ) { config -> stats_fn = arg. val ; } else if ( arg_match ( & arg, & use_ivf, argi ) ) { config -> write_webm = 0 ; } else if ( arg_match ( & arg, & threads, argi ) ) { config -> cfg. g_threads = arg_parse_uint ( & arg ) ; } else if ( arg_match ( & arg, & profile, argi ) ) { config -> cfg. g_profile = arg_parse_uint ( & arg ) ; } else if ( arg_match ( & arg, & width, argi ) ) { config -> cfg. g_w = arg_parse_uint

Fix:
<S2SV_ModStart> = 0 ; # if CONFIG_VP9_HIGHBITDEPTH int test_16bit_internal = 0 ; # endif <S2SV_ModStart> ; # endif # if CONFIG_VP10_ENCODER } else if ( strcmp ( global -> codec -> name, "vp10" ) == 0 ) { ctrl_args = vp10_args ; ctrl_args_map = vp10_arg_ctrl_map ; # endif <S2SV_ModStart> } if ( arg_match ( & arg, & outputfile, argi ) ) { config -> out_fn = arg. val ; } else if ( arg_match ( & arg, & fpf_name, argi ) ) { config -> stats_fn = arg. val ; # if CONFIG_FP_MB_STATS } else if ( arg_match ( & arg, & fpmbf_name, argi ) ) { config -> fpmb_stats_fn = arg. val ; # endif } else if ( arg_match ( & arg, & use_webm, argi ) ) { # if CONFIG_WEBM_IO config -> write_webm = 1 ; # else die ( "Error: <S2SV_blank> --webm <S2SV_blank> specified <S2SV_blank> but <S2SV_blank> webm <S2SV_blank>
Buggy code:
 WORD32 ih264d_parse_nal_unit ( iv_obj_t * dec_hdl, ivd_video_decode_op_t * ps_dec_op, UWORD8 * pu1_buf, UWORD32 u4_length ) { dec_bit_stream_t * ps_bitstrm ; dec_struct_t * ps_dec = ( dec_struct_t * ) dec_hdl -> pv_codec_handle ; ivd_video_decode_ip_t * ps_dec_in = ( ivd_video_decode_ip_t * ) ps_dec -> pv_dec_in ; dec_slice_params_t * ps_cur_slice = ps_dec -> ps_cur_slice ; UWORD8 u1_first_byte, u1_nal_ref_idc ; UWORD8 u1_nal_unit_type ; WORD32 i_status = OK ; ps_bitstrm = ps_dec -> ps_bitstrm ; if ( pu1_buf ) { if ( u4_length ) { ps_dec_op -> u4_frame_decoded_flag = 0 ; ih264d_process_nal_unit ( ps_dec -> ps_bitstrm, pu1_buf, u4_length ) ; SWITCHOFFTRACE ; u1_first_byte = ih264d_get_bits_h264 ( ps_bitstrm, 8 ) ; if ( NAL_FORBIDDEN_BIT ( u1_first_byte ) ) { H264_DEC_DEBUG_PRINT ( "\\nForbidden   bit   set   in   Nal   Unit,   Let\'s   try\\n" ) ; } u1_nal_unit_type = NAL_UNIT_TYPE ( u1_first_byte ) ; if ( ( ps_dec -> u4_slice_start_code_found == 1 ) && ( ps_dec -> u1_pic_decode_done!= 1 ) && ( u1_nal_unit_type > IDR_SLICE_NAL ) ) { return ERROR_INCOMPLETE_FRAME ; } ps_dec -> u1_nal_unit_type = u1_nal_unit_type ; u1_nal_ref_idc

Fix:
<S2SV_ModStart> ; if ( <S2SV_ModEnd> i_status!= OK
Buggy code:
 static Image * ReadSUNImage ( const ImageInfo * image_info, ExceptionInfo * exception ) { # define RMT_EQUAL_RGB 1 # define RMT_NONE 0 # define RMT_RAW 2 # define RT_STANDARD 1 # define RT_ENCODED 2 # define RT_FORMAT_RGB 3 typedef struct _SUNInfo { unsigned int magic, width, height, depth, length, type, maptype, maplength ; } SUNInfo ; Image * image ; int bit ; MagickBooleanType status ; MagickSizeType number_pixels ; register Quantum * q ; register ssize_t i, x ; register unsigned char * p ; size_t bytes_per_line, extent, length ; ssize_t count, y ; SUNInfo sun_info ; unsigned char * sun_data, * sun_pixels ; assert ( image_info!= ( const ImageInfo * ) NULL ) ; assert ( image_info -> signature == MagickSignature ) ; if ( image_info -> debug!= MagickFalse ) ( void ) LogMagickEvent ( TraceEvent, GetMagickModule ( ), "%s", image_info -> filename ) ; assert ( exception!= ( ExceptionInfo * ) NULL ) ; assert ( exception -> signature == MagickSignature ) ; image = AcquireImage ( image_info, exception ) ; status = OpenBlob ( image_info, image, ReadBinaryBlobMode, exception ) ; if ( status == MagickFalse ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } ( void ) ResetMagickMemory ( & sun_info, 0, sizeof ( sun_info ) ) ; sun_info. magic = ReadBlobMSBLong ( image ) ; do { if ( sun_info. magic!= 0x59a66a95 ) ThrowReaderException ( CorruptImageError, "ImproperImageHeader" ) ; sun_info. width = ReadBlobMSBLong ( image ) ; sun_info. height = ReadBlobMSBLong ( image ) ; sun_info. depth = ReadBlobMSBLong ( image ) ; sun_info. length = ReadBlobMSBLong ( image ) ; sun_info. type = ReadBlobMSBLong ( image ) ; sun_info. maptype = ReadBlobMSBLong ( image ) ; sun_info. ma

Fix:
<S2SV_ModStart> ; image -> <S2SV_ModEnd> colors = sun_info <S2SV_ModStart> // 3 ; if ( AcquireImageColormap ( image, image -> colors, exception ) == MagickFalse ) ThrowReaderException ( ResourceLimitError, "MemoryAllocationFailed" ) ; <S2SV_ModStart> maptype ) { <S2SV_ModEnd> case RMT_EQUAL_RGB : <S2SV_ModStart> char * sun_colormap <S2SV_ModEnd> ; sun_colormap =
Buggy code:
 <START_BUG> void __perf_sw_event ( u32 event_id, u64 nr, int nmi, <END_BUG> struct pt_regs * regs, u64 addr ) { struct perf_sample_data data ; int rctx ; preempt_disable_notrace ( ) ; rctx = perf_swevent_get_recursion_context ( ) ; if ( rctx < 0 ) return ; perf_sample_data_init ( & data, addr ) ;  do_perf_sw_event ( PERF_TYPE_SOFTWARE, event_id, nr, nmi, & data, regs ) ; <START_BUG> perf_swevent_put_recursion_context ( rctx ) ; preempt_enable_notrace ( ) ; }<END_BUG>

Fix:
<S2SV_ModStart> u64 nr, <S2SV_ModEnd> struct pt_regs * <S2SV_ModStart>, nr, <S2SV_ModEnd> & data,
Buggy code:
 static Image * ReadRLEImage ( const ImageInfo * image_info, ExceptionInfo * exception ) { # define SkipLinesOp 0x01 # define SetColorOp 0x02 # define SkipPixelsOp 0x03 # define ByteDataOp 0x05 # define RunDataOp 0x06 # define EOFOp 0x07 char magick [ 12 ] ; Image * image ; int opcode, operand, status ; MagickStatusType flags ; MagickSizeType number_pixels ; MemoryInfo * pixel_info ; Quantum index ; register ssize_t x ; register Quantum * q ; register ssize_t i ; register unsigned char * p ; size_t bits_per_pixel, map_length, number_colormaps, number_planes, number_planes_filled, one, <START_BUG> offset, <END_BUG> pixel_info_length ; ssize_t count, y ; unsigned char background_color [ 256 ], * colormap, pixel, plane, * 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 ) return ( DestroyImageList ( image ) ) ; count = ReadBlob ( image, 2, ( unsigned char * ) magick ) ; if ( ( count!= 2 ) || ( memcmp ( magick, "\\122\\314", 2 )!= 0 ) ) ThrowReaderException ( CorruptImageError, "ImproperImageHeader" ) ; do { image -> page. x = ReadBlobLSBShort ( image ) ; image -> page. y = ReadBlobLSBShort ( image ) ; image -> columns = ReadBlobLSBShort ( image ) ; image -> rows = ReadBlobLSBShort ( image ) ; flags = ( MagickStatusType ) ReadBlobByte ( image ) ; image -> alpha_trait = flags & 0x04? BlendPixelTrait

Fix:
<S2SV_ModStart>, one, pixel_info_length ; ssize_t count, offset <S2SV_ModEnd>, y ; <S2SV_ModStart> ; if ( ( offset < 0 ) || ( <S2SV_ModStart> ) > pixel_info_length ) <S2SV_ModStart> ; if ( ( offset < 0 ) || ( <S2SV_ModStart> ) > pixel_info_length )
Buggy code:
 static void perf_output_wakeup ( struct perf_output_handle * handle ) { atomic_set ( & handle -> rb -> poll, POLL_IN ) ; <START_BUG> if ( handle -> nmi ) { <END_BUG> handle -> event -> pending_wakeup = 1 ; irq_work_queue ( & handle -> event -> pending ) ;  } else <START_BUG> perf_event_wakeup ( handle -> event ) ; }<END_BUG>

Fix:
<S2SV_ModStart> POLL_IN ) ; <S2SV_ModEnd> handle -> event <S2SV_ModStart> ) ; } <S2SV_ModEnd> <S2SV_null> <S2SV_null> <S2SV_null>
Buggy code:
 static int <START_BUG> _Unpickler_ResizeMemoList ( UnpicklerObject * self, Py_ssize_t new_size ) <END_BUG> {  Py_ssize_t i ; <START_BUG> assert ( new_size > self -> memo_size ) ; PyObject * * memo_new = self -> memo ; PyMem_RESIZE ( memo_new, PyObject *, new_size ) ; if ( memo_new == NULL ) { PyErr_NoMemory ( ) ; return - 1 ; } self -> memo = memo_new ; for ( i = self -> memo_size ; i < new_size ; i ++ ) self -> memo [ i ] = NULL ; self -> memo_size = new_size ; return 0 ; }<END_BUG>

Fix:
<S2SV_ModStart> * self, size_t <S2SV_ModEnd> new_size ) { <S2SV_ModStart> new_size ) { size_t <S2SV_ModEnd> i ; assert
Buggy code:
 PIX * pixFewColorsOctcubeQuantMixed ( PIX * pixs, l_int32 level, l_int32 darkthresh, l_int32 lightthresh, l_int32 diffthresh, l_float32 minfract, l_int32 maxspan ) { l_int32 i, j, w, h, wplc, wplm, wpld, ncolors, index ; l_int32 rval, gval, bval, val, minval, maxval ; l_int32 * lut ; l_uint32 * datac, * datam, * datad, * linec, * linem, * lined ; <START_BUG> PIX * pixc, * pixm, * pixg, * pixd ; <END_BUG> PIXCMAP * cmap, * cmapd ; PROCNAME ( "pixFewColorsOctcubeQuantMixed" ) ; if (! pixs || pixGetDepth ( pixs )!= 32 ) return ( PIX * ) ERROR_PTR ( "pixs   undefined   or   not   32   bpp", procName, NULL ) ; if ( level <= 0 ) level = 3 ; if ( level > 6 ) return ( PIX * ) ERROR_PTR ( "invalid   level", procName, NULL ) ; if ( darkthresh <= 0 ) darkthresh = 20 ; if ( lightthresh <= 0 ) lightthresh = 244 ; if ( diffthresh <= 0 ) diffthresh = 20 ; if ( minfract <= 0.0 ) minfract = 0.05 ; if ( maxspan <= 2 ) maxspan = 15 ;  if ( ( pixc = pixFewColorsOctcubeQuant1 ( pixs, level ) ) == NULL ) <START_BUG> <END_BUG> return ( PIX * ) ERROR_PTR ( "too   many   colors", procName, NULL ) ;  cmap = pixGetColormap ( pixc ) ; ncolors = pixcmapGetCount ( cmap ) ; cmapd = pixcmapCreate ( 8 ) ; lut = ( l_int32 * ) LEPT_CALLOC ( 256, sizeof ( l_int32 ) ) ; for ( i = 0 ; i < 256 ; i ++ ) lut [ i ] = - 1 ; for ( i = 0, index = 0 ; i < ncolors ; i ++ ) { pixcmapGetColor ( cmap, i, & rval,

Fix:
<S2SV_ModStart> lined ; PIX * pix1, <S2SV_ModStart> if ( ( pix1 <S2SV_ModEnd> = pixFewColorsOctcubeQuant1 ( <S2SV_ModStart> procName, NULL ) ; pixc = pixConvertTo8 ( pix1, 1 ) ; pixDestroy ( & pix1
Buggy code:
 static int l2tp_ip_bind ( struct sock * sk, struct sockaddr * uaddr, int addr_len ) { struct inet_sock * inet = inet_sk ( sk ) ; struct sockaddr_l2tpip * addr = ( struct sockaddr_l2tpip * ) uaddr ; struct net * net = sock_net ( sk ) ; int ret ; int chk_addr_ret ; <START_BUG> if (! sock_flag ( sk, SOCK_ZAPPED ) ) <END_BUG> return - EINVAL ;  if ( addr_len < sizeof ( struct sockaddr_l2tpip ) ) <START_BUG> return - EINVAL ; <END_BUG> if ( addr -> l2tp_family!= AF_INET )  return - EINVAL ; ret = - EADDRINUSE ; read_lock_bh ( & l2tp_ip_lock ) ; if ( __l2tp_ip_bind_lookup ( net, addr -> l2tp_addr. s_addr, sk -> sk_bound_dev_if, addr -> l2tp_conn_id ) ) goto out_in_use ; read_unlock_bh ( & l2tp_ip_lock ) ; <START_BUG> lock_sock ( sk ) ; <END_BUG> if ( sk -> sk_state!= TCP_CLOSE || addr_len < sizeof ( struct sockaddr_l2tpip ) ) goto out ; chk_addr_ret = inet_addr_type ( net, addr -> l2tp_addr. s_addr ) ; ret = - EADDRNOTAVAIL ; if ( addr -> l2tp_addr. s_addr && chk_addr_ret!= RTN_LOCAL && chk_addr_ret!= RTN_MULTICAST && chk_addr_ret!= RTN_BROADCAST ) goto out ; if ( addr -> l2tp_addr. s_addr ) inet -> inet_rcv_saddr = inet -> inet_saddr = addr -> l2tp_addr. s_addr ; if ( chk_addr_ret == RTN_MULTICAST || chk_addr_ret == RTN_BROADCAST ) inet -> inet_saddr = 0 ; sk_dst_reset ( sk ) ; l2tp_ip_sk ( sk ) -> conn_id = addr -> l2tp_conn_id ; write

Fix:
<S2SV_ModStart> ; if ( addr_len < sizeof ( struct sockaddr_l2tpip <S2SV_ModEnd> ) ) return <S2SV_ModStart> ; if ( addr -> l2tp_family!= AF_INET <S2SV_ModEnd> ) return - <S2SV_ModStart> - EINVAL ; <S2SV_ModEnd> ret = - <S2SV_ModStart> ( sk ) ; if (! sock_flag ( sk, SOCK_ZAPPED ) ) goto out
Buggy code:
 static Image * ReadPWPImage ( const ImageInfo * image_info, ExceptionInfo * exception ) { FILE * file ; Image * image, * next_image, * pwp_image ; ImageInfo * read_info ; int c, unique_file ; MagickBooleanType status ; register Image * p ; register ssize_t i ; size_t filesize, length ; ssize_t count ; unsigned char magick [ MaxTextExtent ] ; assert ( image_info!= ( const ImageInfo * ) NULL ) ; assert ( image_info -> signature == MagickSignature ) ; if ( image_info -> debug!= MagickFalse ) ( void ) LogMagickEvent ( TraceEvent, GetMagickModule ( ), "%s", image_info -> filename ) ; assert ( exception!= ( ExceptionInfo * ) NULL ) ; assert ( exception -> signature == MagickSignature ) ; pwp_image = AcquireImage ( image_info ) ; image = pwp_image ; status = OpenBlob ( image_info, pwp_image, ReadBinaryBlobMode, exception ) ; if ( status == MagickFalse ) return ( ( Image * ) NULL ) ; count = ReadBlob ( pwp_image, 5, magick ) ; if ( ( count!= 5 ) || ( LocaleNCompare ( ( char * ) magick, "SFW95", 5 )!= 0 ) ) ThrowReaderException ( CorruptImageError, "ImproperImageHeader" ) ; read_info = CloneImageInfo ( image_info ) ; ( void ) SetImageInfoProgressMonitor ( read_info, ( MagickProgressMonitor ) NULL, ( void * ) NULL ) ; SetImageInfoBlob ( read_info, ( void * ) NULL, 0 ) ; unique_file = AcquireUniqueFileResource ( read_info -> filename ) ; for ( ; ; ) { for ( c = ReadBlobByte ( pwp_image ) ; c!= EOF ; c = ReadBlobByte ( pwp_image ) ) { for ( i = 0 ; i < 17 ; i ++ ) magick [ i ] = magick [ i + 1 ] ; magick [ 17 ] = ( unsigned char ) c ; if ( LocaleNCompare ( ( char * ) ( magick + 12 ), "SFW94A", 6 ) == 0 ) break ; } if ( c == EOF ) break ; if (

Fix:
<S2SV_ModStart> read_info ) ; <S2SV_ModEnd> if ( EOFBlob
Buggy code:
 static int mif_process_cmpt ( mif_hdr_t * hdr, char * buf ) { jas_tvparser_t * tvp ; mif_cmpt_t * cmpt ; int id ; cmpt = 0 ; tvp = 0 ; if (! ( cmpt = mif_cmpt_create ( ) ) ) { goto error ; } cmpt -> tlx = 0 ; cmpt -> tly = 0 ; cmpt -> sampperx = 0 ; cmpt -> samppery = 0 ; cmpt -> width = 0 ; cmpt -> height = 0 ; cmpt -> prec = 0 ; cmpt -> sgnd = - 1 ; cmpt -> data = 0 ; if (! ( tvp = jas_tvparser_create ( buf ) ) ) { goto error ; } while (! ( id = jas_tvparser_next ( tvp ) ) ) { switch ( jas_taginfo_nonull ( jas_taginfos_lookup ( mif_tags, jas_tvparser_gettag ( tvp ) ) ) -> id ) { case MIF_TLX : cmpt -> tlx = atoi ( jas_tvparser_getval ( tvp ) ) ; break ; case MIF_TLY : cmpt -> tly = atoi ( jas_tvparser_getval ( tvp ) ) ; break ; case MIF_WIDTH : cmpt -> width = atoi ( jas_tvparser_getval ( tvp ) ) ; break ; case MIF_HEIGHT : cmpt -> height = atoi ( jas_tvparser_getval ( tvp ) ) ; break ; case MIF_HSAMP : cmpt -> sampperx = atoi ( jas_tvparser_getval ( tvp ) ) ; break ; case MIF_VSAMP : cmpt -> samppery = atoi ( jas_tvparser_getval ( tvp ) ) ; break ; case MIF_PREC : cmpt -> prec = atoi ( jas_tvparser_getval ( tvp ) ) ; break ; case MIF_SGND : cmpt -> sgnd = atoi ( jas_tvparser_getval ( tvp ) ) ; break ; case MIF_DATA : if (! ( cm

Fix:
<S2SV_ModStart> ; } } <S2SV_ModEnd> if (! <S2SV_ModStart> error ; } jas_tvparser_destroy ( tvp ) ;
Buggy code:
 static int init_types ( void ) { static int initialized ; if ( initialized ) return 1 ; if ( add_ast_fields ( ) < 0 ) return 0 ; mod_type = make_type ( "mod", & AST_type, NULL, 0 ) ; if (! mod_type ) return 0 ; if (! add_attributes ( mod_type, NULL, 0 ) ) return 0 ; <START_BUG> Module_type = make_type ( "Module", mod_type, Module_fields, 1 ) ; <END_BUG>  if (! Module_type ) return 0 ; <START_BUG> <END_BUG> Interactive_type = make_type ( "Interactive", mod_type, Interactive_fields,  1 ) ; <START_BUG> if (! Interactive_type ) return 0 ; <END_BUG>  Expression_type = make_type ( "Expression", mod_type, Expression_fields, 1 ) ; <START_BUG> if (! Expression_type ) return 0 ; Suite_type = make_type ( "Suite", mod_type, Suite_fields, 1 ) ; if (! Suite_type ) return 0 ; stmt_type = make_type ( "stmt", & AST_type, NULL, 0 ) ; if (! stmt_type ) return 0 ; if (! add_attributes ( stmt_type, stmt_attributes, 4 ) ) return 0 ; FunctionDef_type = make_type ( "FunctionDef", stmt_type, FunctionDef_fields, <END_BUG> 5 ) ;  <START_BUG> if (! FunctionDef_type ) return 0 ; <END_BUG> AsyncFunctionDef_type = make_type ( "AsyncFunctionDef", stmt_type,  AsyncFunctionDef_fields, 5 ) ; <START_BUG> <END_BUG> if (! AsyncFunctionDef_type ) return 0 ;  <START_BUG> ClassDef_type = make_type ( "ClassDef", stmt_type, ClassDef_fields, 5 ) ; <END_BUG>  if (! ClassDef_type ) return 0 ; <START_BUG> <END_BUG> Return_type = make_type ( "Return", stmt_type, Return_fields, 1 ) ;  if (! Return_type ) return 0 ; <START_BUG> Delete_type = make_type ( "Delete", stmt_type, Delete_fields, 1 ) ; <END_BUG> if (! Delete_type ) return 0 ;  Assign_type = make_type ( "Assign", stmt_type, Assign_fields, 2 )

Fix:
<S2SV_ModStart>, Module_fields, 2 ) ; if (! Module_type ) return 0 ; Interactive_type = make_type ( "Interactive", mod_type, Interactive_fields, <S2SV_ModStart> if (! Interactive_type ) return 0 ; Expression_type = make_type ( "Expression" <S2SV_ModEnd>, mod_type, <S2SV_ModStart>, mod_type, Expression_fields, <S2SV_ModEnd> 1 ) ; <S2SV_ModStart> if (! Expression_type ) return 0 ; FunctionType_type = make_type ( "FunctionType" <S2SV_ModEnd>, mod_type, <S2SV_ModStart>, mod_type, FunctionType_fields, 2 ) ; if (! FunctionType_type <S2SV_ModEnd> ) return 0 <S2SV_ModStart>, FunctionDef_fields, 6 ) ; if (! FunctionDef_type ) return 0 ; AsyncFunctionDef_type = make_type ( "AsyncFunctionDef", stmt_type, AsyncFunctionDef_fields, 6 ) ; if (! AsyncFunctionDef_type ) return 0 ; ClassDef_type = make_type ( "ClassDef", stmt_type, ClassDef_fields, <S2SV_ModStart> if (! ClassDef_type ) return 0 ; Return_type = make_type ( "Return" <S2SV_ModEnd>, stmt_type, <S2SV_ModStart>
Buggy code:
 static gboolean _handle_carbons ( xmpp_stanza_t * const stanza ) { xmpp_stanza_t * carbons = xmpp_stanza_get_child_by_ns ( stanza, STANZA_NS_CARBONS ) ; if (! carbons ) { return FALSE ; } const char * name = xmpp_stanza_get_name ( carbons ) ; if (! name ) { log_error ( "Unable   to   retrieve   stanza   name   for   Carbon" ) ; return TRUE ; } if ( g_strcmp0 ( name, "private" ) == 0 ) { log_info ( "Carbon   received   with   private   element." ) ; return FALSE ; } if ( ( g_strcmp0 ( name, "received" )!= 0 ) && ( g_strcmp0 ( name, "sent" )!= 0 ) ) { log_warning ( "Carbon   received   with   unrecognised   stanza   name:   %s", name ) ; return TRUE ; } xmpp_stanza_t * forwarded = xmpp_stanza_get_child_by_ns ( carbons, STANZA_NS_FORWARD ) ; if (! forwarded ) { log_warning ( "Carbon   received   with   no   forwarded   element" ) ; return TRUE ; } xmpp_stanza_t * message = xmpp_stanza_get_child_by_name ( forwarded, STANZA_NAME_MESSAGE ) ; if (! message ) { log_warning ( "Carbon   received   with   no   message   element" ) ; return TRUE ; } char * message_txt = xmpp_message_get_body ( message ) ; if (! message_txt ) { log_warning ( "Carbon   received   with   no   message." ) ; return TRUE ; } <START_BUG> const gchar * to = xmpp_stanza_get_to ( message ) ; <END_BUG> const gchar * from = xmpp_stanza_get_from ( message ) ; if (! to ) to = from ; Jid * jid_from = jid_create ( from ) ;  Jid * jid_to = jid_create ( to ) ; <START_BUG> Jid *<END_BUG>

Fix:
<S2SV_ModStart> TRUE ; } Jid * my_jid = jid_create ( connection_get_fulljid ( ) ) ; const char * const stanza_from = xmpp_stanza_get_from ( stanza ) ; Jid * msg_jid = jid_create ( stanza_from ) ; if ( g_strcmp0 ( my_jid -> barejid, msg_jid -> barejid )!= 0 ) { log_warning ( "Invalid <S2SV_blank> carbon <S2SV_blank> received, <S2SV_blank> from: <S2SV_blank> %s", stanza_from ) ; return TRUE ; } <S2SV_ModStart> jid_create ( to <S2SV_ModEnd> ) ; char
Buggy code:
 static int userfaultfd_register ( struct userfaultfd_ctx * ctx, unsigned long arg ) { struct mm_struct * mm = ctx -> mm ; struct vm_area_struct * vma, * prev, * cur ; int ret ; struct uffdio_register uffdio_register ; struct uffdio_register __user * user_uffdio_register ; unsigned long vm_flags, new_flags ; bool found ; bool basic_ioctls ; unsigned long start, end, vma_end ; user_uffdio_register = ( struct uffdio_register __user * ) arg ; ret = - EFAULT ; if ( copy_from_user ( & uffdio_register, user_uffdio_register, sizeof ( uffdio_register ) - sizeof ( __u64 ) ) ) goto out ; ret = - EINVAL ; if (! uffdio_register. mode ) goto out ; if ( uffdio_register. mode & ~ ( UFFDIO_REGISTER_MODE_MISSING | UFFDIO_REGISTER_MODE_WP ) ) goto out ; vm_flags = 0 ; if ( uffdio_register. mode & UFFDIO_REGISTER_MODE_MISSING ) vm_flags |= VM_UFFD_MISSING ; if ( uffdio_register. mode & UFFDIO_REGISTER_MODE_WP ) { vm_flags |= VM_UFFD_WP ; ret = - EINVAL ; goto out ; } ret = validate_range ( mm, uffdio_register. range. start, uffdio_register. range. len ) ; if ( ret ) goto out ; start = uffdio_register. range. start ; end = start + uffdio_register. range. len ; ret = - ENOMEM ; if (! mmget_not_zero ( mm ) ) goto out ; down_write ( & mm -> mmap_sem ) ; vma = find_vma_prev ( mm, start, & prev ) ; if (! vma ) goto out_unlock ; ret = - EINVAL ; if ( vma -> vm_start >= end ) goto out_unlock ; if ( is_vm_hugetlb_page ( vma ) ) { unsigned

Fix:
<S2SV_ModStart> goto out_unlock ; ret = - EPERM ; if ( unlikely (! ( cur -> vm_flags & VM_MAYWRITE ) ) ) goto out_unlock ; <S2SV_ModStart> ctx!= ctx ) ; WARN_ON (! ( vma -> vm_flags & VM_MAYWRITE )
Buggy code:
 <START_BUG> static MB_PREDICTION_MODE read_intra_mode_uv ( VP9_COMMON * cm, vp9_reader * r, <END_BUG>  MB_PREDICTION_MODE y_mode ) { <START_BUG> <END_BUG> const MB_PREDICTION_MODE uv_mode = read_intra_mode ( r,  <START_BUG> cm -> fc. uv_mode_prob [ y_mode ] ) ; <END_BUG>  if (! cm -> frame_parallel_decoding_mode ) <START_BUG> ++ cm -> counts. uv_mode [ y_mode ] [ uv_mode ] ; return uv_mode ; }<END_BUG>

Fix:
<S2SV_ModStart> <S2SV_null> <S2SV_null> static PREDICTION_MODE <S2SV_ModEnd> read_intra_mode_uv ( VP9_COMMON <S2SV_ModStart> * cm, MACROBLOCKD * xd, vpx_reader <S2SV_ModEnd> * r, <S2SV_ModStart> * r, PREDICTION_MODE <S2SV_ModEnd> y_mode ) { <S2SV_ModStart> ) { const PREDICTION_MODE <S2SV_ModEnd> uv_mode = read_intra_mode <S2SV_ModStart> cm -> fc -> <S2SV_ModEnd> uv_mode_prob [ y_mode <S2SV_ModStart> ] ) ; FRAME_COUNTS * counts = xd -> counts ; if ( counts ) ++ counts -> <S2SV_ModEnd> uv_mode [ y_mode
Buggy code:
 static int misaligned_store ( struct pt_regs * regs, __u32 opcode, int displacement_not_indexed, int width_shift ) { int error ; int srcreg ; __u64 address ; error = generate_and_check_address ( regs, opcode, displacement_not_indexed, width_shift, & address ) ; if ( error < 0 ) { return error ; } <START_BUG> perf_sw_event ( PERF_COUNT_SW_ALIGNMENT_FAULTS, 1, 0, regs, address ) ; <END_BUG> srcreg = ( opcode >> 4 ) & 0x3f ; if ( user_mode ( regs ) ) { __u64 buffer ; if (! access_ok ( VERIFY_WRITE, ( unsigned long ) address, 1UL << width_shift ) ) { return - 1 ; } switch ( width_shift ) { case 1 : * ( __u16 * ) & buffer = ( __u16 ) regs -> regs [ srcreg ] ; break ; case 2 : * ( __u32 * ) & buffer = ( __u32 ) regs -> regs [ srcreg ] ; break ; case 3 : buffer = regs -> regs [ srcreg ] ; break ; default : printk ( "Unexpected   width_shift   %d   in   misaligned_store,   PC=%08lx\\n", width_shift, ( unsigned long ) regs -> pc ) ; break ; } if ( __copy_user ( ( void * ) ( int ) address, & buffer, ( 1 << width_shift ) ) > 0 ) { return - 1 ; } } else { __u64 val = regs -> regs [ srcreg ] ; switch ( width_shift ) { case 1 : misaligned_kernel_word_store ( address, val ) ; break ; case 2 : asm ( "stlo.l   %1,   0,   %0" : : "r" ( val ), "r" ( address ) ) ; asm ( "sthi.l   %1,   3,   %0" : : "r" ( val ), "r" ( address ) ) ; break ; case 3 : asm ( "stlo.q   %1,   0,   %0" : : "r" ( val ), "r" ( address ) ) ; asm ( "sthi.q   %1,  

Fix:
<S2SV_ModStart>, 1, <S2SV_ModEnd> regs, address
Buggy code:
 static int mpage_da_map_blocks ( struct mpage_da_data * mpd ) { int err, blks, get_blocks_flags ; struct buffer_head new ; sector_t next = mpd -> b_blocknr ; unsigned max_blocks = mpd -> b_size >> mpd -> inode -> i_blkbits ; loff_t disksize = EXT4_I ( mpd -> inode ) -> i_disksize ; handle_t * handle = NULL ; if ( ( mpd -> b_state & ( 1 << BH_Mapped ) ) &&! ( mpd -> b_state & ( 1 << BH_Delay ) ) &&! ( mpd -> b_state & ( 1 << BH_Unwritten ) ) ) return 0 ; if (! mpd -> b_size ) return 0 ; handle = ext4_journal_current_handle ( ) ; BUG_ON (! handle ) ; new. b_state = 0 ; <START_BUG> get_blocks_flags = EXT4_GET_BLOCKS_CREATE ; <END_BUG> if ( mpd -> b_state & ( 1 << BH_Delay ) ) get_blocks_flags |= EXT4_GET_BLOCKS_DELALLOC_RESERVE ; blks = ext4_get_blocks ( handle, mpd -> inode, next, max_blocks, & new, get_blocks_flags ) ; if ( blks < 0 ) { err = blks ; if ( err == - EAGAIN ) return 0 ; if ( err == - ENOSPC && ext4_count_free_blocks ( mpd -> inode -> i_sb ) ) { mpd -> retval = err ; return 0 ; } ext4_msg ( mpd -> inode -> i_sb, KERN_CRIT, "delayed   block   allocation   failed   for   inode   %lu   at   " "logical   offset   %llu   with   max   blocks   %zd   with   " "error   %d\\n", mpd -> inode -> i_ino, ( unsigned long long ) next, mpd -> b_size >> mpd -> inode -> i_blkbits, err ) ; printk ( KERN_CRIT "This   should   not   happen!!     " "Data   will

Fix:
<S2SV_ModStart> get_blocks_flags = EXT4_GET_BLOCKS_CREATE ; if ( ext4_should_dioread_nolock ( mpd -> inode ) ) get_blocks_flags |= EXT4_GET_BLOCKS_IO_CREATE_EXT
Buggy code:
 static vpx_codec_err_t parse_options ( SvcContext * svc_ctx, const char * options ) { char * input_string ; char * option_name ; char * option_value ; char * input_ptr ; <START_BUG> int is_keyframe_qaunt_set = 0 ; <END_BUG> vpx_codec_err_t res = VPX_CODEC_OK ; if ( options == NULL ) return VPX_CODEC_OK ; input_string = strdup ( options ) ; option_name = strtok_r ( input_string, "=", & input_ptr ) ; while ( option_name!= NULL ) { option_value = strtok_r ( NULL, "   ", & input_ptr ) ; if ( option_value == NULL ) { svc_log ( svc_ctx, SVC_LOG_ERROR, "option   missing   value:   %s\\n", option_name ) ; res = VPX_CODEC_INVALID_PARAM ; break ; }  if ( strcmp ( "encoding-mode", option_name ) == 0 ) { <START_BUG> res = set_option_encoding_mode ( svc_ctx, option_value ) ; if ( res!= VPX_CODEC_OK ) break ; <END_BUG> } else if ( strcmp ( "layers", option_name ) == 0 ) {  svc_ctx -> spatial_layers = atoi ( option_value ) ; } else if ( strcmp ( "scale-factors", option_name ) == 0 ) { res = parse_scale_factors ( svc_ctx, option_value ) ; if ( res!= VPX_CODEC_OK ) break ; <START_BUG> } else if ( strcmp ( "quantizers", option_name ) == 0 ) { <END_BUG> res = parse_quantizer_values ( svc_ctx, option_value, 0 ) ; if ( res!= VPX_CODEC_OK ) break ;  if (! is_keyframe_qaunt_set ) { <START_BUG> SvcInternal * const si = get_svc_internal ( svc_ctx ) ; memcpy ( get_svc_internal ( svc_ctx ) -> quantizer_keyframe, si -> quantizer, sizeof ( si -> quantizer ) ) ; } } else if ( strcmp ( "quantizers-keyframe", option_name )<END_BUG>

Fix:
<S2SV_ModStart> * input_ptr ; SvcInternal_t * const si = get_svc_internal ( svc_ctx ) ; vpx_codec_err_t res = VPX_CODEC_OK ; int i, alt_ref_enabled = 0 <S2SV_ModEnd> ; if ( <S2SV_ModStart> ( strcmp ( "spatial-layers", option_name ) == 0 ) { svc_ctx -> spatial_layers = atoi ( option_value ) ; } else if ( strcmp ( "temporal-layers", option_name ) == 0 ) { svc_ctx -> temporal_layers = atoi ( option_value ) ; } else if ( strcmp ( "scale-factors", option_name ) == 0 ) { res = parse_layer_options_from_string ( svc_ctx, SCALE_FACTOR, option_value, si -> svc_params. scaling_factor_num, si -> svc_params. scaling_factor_den <S2SV_ModEnd> ) ; if <S2SV_ModStart> ( strcmp ( "max-quantizers", option_name ) == 0 ) { res = parse_layer_options_from_string ( svc_ctx, QUANTIZER, option_value, si -> svc_params. max_
Buggy code:
 void Rectangle ( double x, double y, double w, double h ) { <START_BUG> outpos += sprintf ( outpos, "\\n   %12.3f   %12.3f   %12.3f   %12.3f   re", x, y, w, h ) ; <END_BUG>  } <START_BUG><END_BUG>

Fix:
<S2SV_ModStart> h ) { sprintf ( outputbuffer <S2SV_ModEnd>, "\\n <S2SV_blank> %12.3f <S2SV_blank> %12.3f <S2SV_blank> %12.3f <S2SV_blank> %12.3f <S2SV_blank> re", <S2SV_ModStart> h ) ; sendClean ( outputbuffer ) ;
Buggy code:
 <START_BUG> static int su3000_frontend_attach ( struct dvb_usb_adapter * d ) <END_BUG> { u8 obuf [ 3 ] = { 0xe, 0x80, 0 } ; u8 ibuf [ ] = { 0 } ;  if ( dvb_usb_generic_rw ( d -> dev, obuf, 3, ibuf, 1, 0 ) < 0 ) <START_BUG> err ( "command   0x0e   transfer   failed." ) ; <END_BUG> obuf [ 0 ] = 0xe ;  <START_BUG> obuf [ 1 ] = 0x02 ; <END_BUG>  obuf [ 2 ] = 1 ; <START_BUG> <END_BUG> if ( dvb_usb_generic_rw ( d -> dev, obuf, 3, ibuf, 1, 0 ) < 0 )  err ( "command   0x0e   transfer   failed." ) ; <START_BUG> msleep ( 300 ) ; <END_BUG> obuf [ 0 ] = 0xe ;  obuf [ 1 ] = 0x83 ; <START_BUG> <END_BUG> obuf [ 2 ] = 0 ;  <START_BUG> if ( dvb_usb_generic_rw ( d -> dev, obuf, 3, ibuf, 1, 0 ) < 0 ) <END_BUG> err ( "command   0x0e   transfer   failed." ) ;  obuf [ 0 ] = 0xe ; <START_BUG> obuf [ 1 ] = 0x83 ; obuf [ 2 ] = 1 ; <END_BUG> if ( dvb_usb_generic_rw ( d -> dev, obuf, 3, ibuf, 1, 0 ) < 0 )  <START_BUG> err ( "command   0x0e   transfer   failed." ) ; <END_BUG> obuf [ 0 ] = 0x51 ; if ( dvb_usb_generic_rw ( d -> dev, obuf, 1, ibuf, 1, 0 ) < 0 ) err ( "command   0x51   transfer   failed." ) ;  d -> fe_adap [ 0 ]. fe = dvb_attach ( ds3000_attach, & su3000_ds3000_config, <START_BUG> <END_BUG> & d -> dev -> i2c_adap ) ;  <START_BUG> if ( d -> fe_adap [ 0 ]. fe == NULL ) <END_BUG> return - EIO ;  if ( dvb_attach ( ts2020_attach, d -> fe_adap [ 0 ]. fe, <START_BUG> & dw<END_BUG>

Fix:
<S2SV_ModStart> struct dvb_usb_adapter * adap ) { struct dvb_usb_device * d = adap -> dev ; struct dw2102_state * state = d -> priv ; mutex_lock ( & d -> data_mutex ) ; state -> data [ 0 ] = 0xe ; state -> data [ 1 ] = 0x80 ; state -> data [ 2 ] = 0 ; if ( dvb_usb_generic_rw ( d, state -> data, 3, state -> data, 1, 0 ) < 0 ) err ( "command <S2SV_blank> 0x0e <S2SV_blank> transfer <S2SV_blank> failed." ) ; state -> data [ 0 ] = 0xe ; state -> data [ 1 ] = 0x02 ; state -> data [ 2 ] = 1 <S2SV_ModEnd> ; if ( <S2SV_ModStart> dvb_usb_generic_rw ( d, state -> data <S2SV_ModEnd>, 3, <S2SV_ModStart>, 3, state -> data <S2SV_ModEnd>, 1, <S2SV_ModStart> "command <S2SV_blank> 0x0e <S2SV_blank> transfer <S2SV_blank> failed." ) ; msleep ( 300 ) ; state -> data <S2SV_ModEnd> [ 0 ] <S2SV_ModStart> = 0xe ; state -> data [ 1 ] = 0x83 ; state -> data <S2SV_ModEnd> [ 2 ] <S2SV_ModStart> 2 ] = 0 <S2SV_ModEnd> ; if ( <S2SV_ModStart> dv
Buggy code:
 <START_BUG> static void encode_nonrd_sb_row ( VP9_COMP * cpi, const TileInfo * const tile, <END_BUG> int mi_row, TOKENEXTRA * * tp ) { VP9_COMMON * cm = & cpi -> common ; MACROBLOCKD * xd = & cpi -> mb. e_mbd ; int mi_col ;  vpx_memset ( & xd -> left_context, 0, sizeof ( xd -> left_context ) ) ; <START_BUG> vpx_memset ( xd -> left_seg_context, 0, sizeof ( xd -> left_seg_context ) ) ; <END_BUG> for ( mi_col = tile -> mi_col_start ; mi_col < tile -> mi_col_end ;  mi_col += MI_BLOCK_SIZE ) { <START_BUG> int dummy_rate = 0 ; <END_BUG> int64_t dummy_dist = 0 ; const int idx_str = cm -> mi_stride * mi_row + mi_col ;  MODE_INFO * * mi_8x8 = cm -> mi_grid_visible + idx_str ; <START_BUG> <END_BUG> MODE_INFO * * prev_mi_8x8 = cm -> prev_mi_grid_visible + idx_str ;  <START_BUG> BLOCK_SIZE bsize ; <END_BUG> cpi -> mb. source_variance = UINT_MAX ;  vp9_zero ( cpi -> mb. pred_mv ) ; <START_BUG> <END_BUG> switch ( cpi -> sf. partition_search_type ) {  case VAR_BASED_PARTITION : <START_BUG> choose_partitioning ( cpi, tile, mi_row, mi_col ) ; <END_BUG>  nonrd_use_partition ( cpi, tile, mi_8x8, tp, mi_row, mi_col, BLOCK_64X64, <START_BUG> <END_BUG> 1, & dummy_rate, & dummy_dist ) ;  break ; case SOURCE_VAR_BASED_PARTITION : <START_BUG> set_offsets ( cpi, tile, mi_row, mi_col, BLOCK_64X64 ) ; <END_BUG>  set_source_var_based_partition ( cpi, tile, mi_8x8, mi_row, mi_col ) ; <START_BUG> <END_BUG> nonrd_use_partition ( cpi, tile, mi_8x8, tp, mi_row, mi_col, BLOCK_64X64

Fix:
<S2SV_ModStart> * cpi, ThreadData * td, TileDataEnc * tile_data, int mi_row, TOKENEXTRA * * tp ) { SPEED_FEATURES * const sf = & cpi -> sf ; VP9_COMMON * const cm = & cpi -> common ; <S2SV_ModEnd> TileInfo * const <S2SV_ModStart> TileInfo * const tile_info = & tile_data -> tile_info ; MACROBLOCK * const x = & td -> mb ; MACROBLOCKD * const xd = & x -> e_mbd ; int mi_col ; memset ( & xd -> left_context, 0, sizeof ( <S2SV_ModEnd> xd -> left_context <S2SV_ModStart> xd -> left_context ) ) ; memset ( xd -> left_seg_context <S2SV_ModStart> ( xd -> left_seg_context <S2SV_ModEnd> ) ) ; <S2SV_ModStart> ( mi_col = tile_info <S2SV_ModEnd> -> mi_col_start ; <S2SV_ModStart> ; mi_col < tile_info <S2SV_ModEnd> -> mi_col_end ; <S2SV_ModStart> MI_BLOCK_SIZE ) { const struct segmentation * const seg = & cm -> seg ; RD_COST dummy_rdc <S2SV_ModEnd> ; const int <S2SV_ModStart> MODE_INFO * * mi <S2SV_ModEnd> = cm -> <S2SV_ModStart> + idx_str ; PART
Buggy code:
 int psf_binheader_writef ( SF_PRIVATE * psf, const char * format,... ) { va_list argptr ; sf_count_t countdata ; unsigned long longdata ; unsigned int data ; float floatdata ; double doubledata ; void * bindata ; size_t size ; char c, * strptr ; int count = 0, trunc_8to4 ; trunc_8to4 = SF_FALSE ; va_start ( argptr, format ) ; while ( ( c = * format ++ ) ) <START_BUG> { switch ( c ) <END_BUG> { case' ': break ; case 'e' : psf -> rwf_endian = SF_ENDIAN_LITTLE ; break ; case 'E' : psf -> rwf_endian = SF_ENDIAN_BIG ; break ; case 't' : trunc_8to4 = SF_TRUE ; break ; case 'T' : trunc_8to4 = SF_FALSE ; break ; case'm' : data = va_arg ( argptr, unsigned int ) ; header_put_marker ( psf, data ) ; count += 4 ; break ; case '1' : data = va_arg ( argptr, unsigned int ) ; header_put_byte ( psf, data ) ; count += 1 ; break ; case '2' : data = va_arg ( argptr, unsigned int ) ; if ( psf -> rwf_endian == SF_ENDIAN_BIG ) { header_put_be_short ( psf, data ) ; } else { header_put_le_short ( psf, data ) ; } ; count += 2 ; break ; case '3' : data = va_arg ( argptr, unsigned int ) ; if ( psf -> rwf_endian == SF_ENDIAN_BIG ) { header_put_be_3byte ( psf, data ) ; } else { header_put_le_3byte ( psf, data ) ; } ; count += 3 ; break ; case '4' : data = va_arg ( argptr, unsigned int ) ; if ( psf -> rwf_endian == SF_ENDIAN_BIG ) { header_put_be_int ( psf, data ) ; } else { header_put_le_int ( psf, data ) ; } ; count += 4 ; break ; case '8' : countdata = va_arg ( argptr, sf_count

Fix:
<S2SV_ModStart> ) ) { if ( psf -> header. indx + 16 >= psf -> header. len && psf_bump_header_allocation ( psf, 16 ) ) return count ; <S2SV_ModStart> psf -> header. ptr + psf -> header. indx <S2SV_ModEnd> ) ; else <S2SV_ModStart> psf -> header. ptr + psf -> header. indx ) ; psf -> header. indx <S2SV_ModEnd> += 4 ; <S2SV_ModStart> psf -> header. ptr + psf -> header. indx <S2SV_ModEnd> ) ; else <S2SV_ModStart> psf -> header. ptr + psf -> header. indx ) ; psf -> header. indx <S2SV_ModEnd> += 8 ; <S2SV_ModStart> & 1 ) ; if ( psf -> header. indx + ( sf_count_t ) size >= psf -> header. len && psf_bump_header_allocation ( psf, 16 ) ) return count <S2SV_ModStart> psf -> header. ptr <S2SV_ModStart> [ psf -> header. indx <S2SV_ModEnd> ] ), <S2SV_ModStart> ; psf -> header. indx += size ; psf -> header. ptr <S2SV_ModEnd> [ psf -> <S2SV_ModStart> [ psf -> header. indx <S2SV_ModEnd> - 1 ] <S2SV_ModStart> ( psf -> header. indx + ( sf_count_t ) size > psf -> header. len && psf_bump_header_allocation ( psf, size ) ) return count ; if
Buggy code:
 int pci_emul_add_msicap ( struct pci_vdev * dev, int msgnum ) { struct msicap msicap ; <START_BUG> pci_populate_msicap ( & msicap, msgnum, 0 ) ; <END_BUG> return pci_emul_add_capability ( dev, ( u_char * ) & msicap, sizeof ( msicap ) ) ; }

Fix:
<S2SV_ModStart> msicap msicap ; return <S2SV_ModStart>, 0 ) || <S2SV_ModEnd> pci_emul_add_capability ( dev
Buggy code:
 <START_BUG> static int dev_get_valid_name ( struct net * net, <END_BUG> struct net_device * dev, const char * name ) { BUG_ON (! net ) ; if (! dev_valid_name ( name ) ) return - EINVAL ; if ( strchr ( name, '%' ) ) return dev_alloc_name_ns ( net, dev, name ) ; else if ( __dev_get_by_name ( net, name ) ) return - EEXIST ; else if ( dev -> name!= name ) strlcpy ( dev -> name, name, IFNAMSIZ ) ; return 0 ; }

Fix:
<S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> <S2SV_ModEnd> int dev_get_valid_name (
Buggy code:
 static stmt_ty ast_for_expr_stmt ( struct compiling * c, const node * n ) { REQ ( n, expr_stmt ) ; <START_BUG> if ( NCH ( n ) == 1 ) { <END_BUG> expr_ty e = ast_for_testlist ( c, CHILD ( n, 0 ) ) ; if (! e ) return NULL ; return Expr ( e, LINENO ( n ), n -> n_col_offset, n -> n_end_lineno, n -> n_end_col_offset, c -> c_arena ) ; } else if ( TYPE ( CHILD ( n, 1 ) ) == augassign ) { expr_ty expr1, expr2 ; operator_ty newoperator ; node * ch = CHILD ( n, 0 ) ; expr1 = ast_for_testlist ( c, ch ) ; if (! expr1 ) return NULL ; if (! set_context ( c, expr1, Store, ch ) ) return NULL ; switch ( expr1 -> kind ) { case Name_kind : case Attribute_kind : case Subscript_kind : break ; default : ast_error ( c, ch, "illegal   expression   for   augmented   assignment" ) ; return NULL ; } ch = CHILD ( n, 2 ) ; if ( TYPE ( ch ) == testlist ) expr2 = ast_for_testlist ( c, ch ) ; else expr2 = ast_for_expr ( c, ch ) ; if (! expr2 ) return NULL ; newoperator = ast_for_augassign ( c, CHILD ( n, 1 ) ) ; if (! newoperator ) return NULL ; return AugAssign ( expr1, newoperator, expr2, LINENO ( n ), n -> n_col_offset, n -> n_end_lineno, n -> n_end_col_offset, c -> c_arena ) ; } else if ( TYPE ( CHILD ( n, 1 ) ) == annassign ) { expr_ty expr1, expr2, expr3 ; node * ch = CHILD ( n, 0 ) ; node * deep, * ann = CHILD ( n, 1 ) ; int simple = 1 ; deep = ch ; while ( NCH ( deep ) == 1 ) { deep = CHILD ( deep, 0 ) ; } if (

Fix:
<S2SV_ModStart> expr_stmt ) ; int num = <S2SV_ModEnd> NCH ( n <S2SV_ModStart> ( n ) ; if ( num <S2SV_ModStart> { int i, nch_minus_type, has_type_comment <S2SV_ModStart> expr_ty expression ; string type_comment ; <S2SV_ModStart> EQUAL ) ; has_type_comment = TYPE ( CHILD ( n, num - 1 ) ) == TYPE_COMMENT ; nch_minus_type = num - has_type_comment ; <S2SV_ModStart> = _Py_asdl_seq_new ( nch_minus_type <S2SV_ModEnd> // 2, <S2SV_ModStart> ; i < nch_minus_type <S2SV_ModEnd> - 2 ; <S2SV_ModStart> ( n, nch_minus_type <S2SV_ModEnd> - 1 ) <S2SV_ModStart> return NULL ; if ( has_type_comment ) { type_comment = NEW_TYPE_COMMENT ( CHILD ( n, nch_minus_type ) ) ; if (! type_comment ) return NULL ; } else type_comment = NULL ; <S2SV_ModStart>, expression, type_comment,
Buggy code:
 <START_BUG> static void encode_quantization ( VP9_COMMON * cm, <END_BUG>  struct vp9_write_bit_buffer * wb ) { <START_BUG> <END_BUG> vp9_wb_write_literal ( wb, cm -> base_qindex, QINDEX_BITS ) ;  write_delta_q ( wb, cm -> y_dc_delta_q ) ; write_delta_q ( wb, cm -> uv_dc_delta_q ) ; write_delta_q ( wb, cm -> uv_ac_delta_q ) ; }

Fix:
<S2SV_ModStart> void encode_quantization ( const VP9_COMMON * const <S2SV_ModEnd> cm, struct <S2SV_ModStart> cm, struct vpx_write_bit_buffer <S2SV_ModEnd> * wb ) <S2SV_ModStart> wb ) { vpx_wb_write_literal <S2SV_ModEnd> ( wb,
Buggy code:
 <START_BUG> static int getnum ( const char * * fmt, int df ) { <END_BUG> if (! isdigit ( * * fmt ) ) return df ; else { int a = 0 ;  do { <START_BUG> a = a * 10 + * ( ( * fmt ) ++ ) - '0' ; } while ( isdigit ( * * fmt ) ) ; return a ; } }<END_BUG>

Fix:
<S2SV_ModStart> int getnum ( lua_State * L, <S2SV_ModStart> ; do { if ( a > ( INT_MAX // 10 ) || a * 10 > ( INT_MAX - ( * * fmt - '0' ) ) ) luaL_error ( L, "integral <S2SV_blank> size <S2SV_blank> overflow" ) ;