Unnamed: 0
int64
0
6.78k
cwe_id
stringlengths
6
8
source
stringlengths
86
89.9k
target
stringlengths
1
30.7k
project_and_commit_id
stringlengths
48
79
cve_id
stringlengths
13
16
original_address
stringlengths
46
134
time
stringlengths
1
17
100
CWE-362
CWE-362 void __kvm_migrate_pit_timer ( struct kvm_vcpu * vcpu ) { struct kvm_pit * pit = vcpu -> kvm -> arch . vpit ; struct hrtimer * timer ; if ( ! kvm_vcpu_is_bsp ( vcpu ) || ! pit ) return ; timer = & pit -> pit_state . timer ; <S2SV_StartBug> if ( hrtimer_cancel ( timer ) ) <S2SV_EndBug> hrtimer_start_expires ( timer , HRTIMER_MODE_ABS ) ; <S2SV_StartBug> } <S2SV_EndBug>
<S2SV_ModStart> . timer ; mutex_lock ( & pit -> pit_state . lock ) ; <S2SV_ModStart> HRTIMER_MODE_ABS ) ; mutex_unlock ( & pit -> pit_state . lock ) ;
torvalds@linux/2febc839133280d5a5e8e1179c94ea674489dae2
CVE-2014-3611
https://github.com/torvalds/linux/commit/2febc839133280d5a5e8e1179c94ea674489dae2
2014-11-10T11:55Z
101
CWE-000
CWE-000 static int em_loop ( struct x86_emulate_ctxt * ctxt ) <S2SV_StartBug> { <S2SV_EndBug> register_address_increment ( ctxt , reg_rmw ( ctxt , VCPU_REGS_RCX ) , - 1 ) ; if ( ( address_mask ( ctxt , reg_read ( ctxt , VCPU_REGS_RCX ) ) != 0 ) && ( ctxt -> b == 0xe2 || test_cc ( ctxt -> b ^ 0x5 , ctxt -> eflags ) ) ) <S2SV_StartBug> jmp_rel ( ctxt , ctxt -> src . val ) ; <S2SV_EndBug> <S2SV_StartBug> return X86EMUL_CONTINUE ; <S2SV_EndBug> }
<S2SV_ModStart> ctxt ) { int rc = X86EMUL_CONTINUE ; <S2SV_ModStart> ) ) ) rc = <S2SV_ModStart> ) ; return rc <S2SV_ModEnd> ; } <S2SV_null>
torvalds@linux/234f3ce485d54017f15cf5e0699cff4100121601
CVE-2014-3647
https://github.com/torvalds/linux/commit/234f3ce485d54017f15cf5e0699cff4100121601
2014-11-10T11:55Z
102
CWE-119
CWE-119 static ssize_t k90_show_macro_mode ( struct device * dev , struct device_attribute * attr , char * buf ) { int ret ; struct usb_interface * usbif = to_usb_interface ( dev -> parent ) ; struct usb_device * usbdev = interface_to_usbdev ( usbif ) ; const char * macro_mode ; <S2SV_StartBug> char data [ 8 ] ; <S2SV_EndBug> ret = usb_control_msg ( usbdev , usb_rcvctrlpipe ( usbdev , 0 ) , K90_REQUEST_GET_MODE , USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE , 0 , 0 , data , 2 , USB_CTRL_SET_TIMEOUT ) ; if ( ret < 0 ) { dev_warn ( dev , "Failed<S2SV_blank>to<S2SV_blank>get<S2SV_blank>K90<S2SV_blank>initial<S2SV_blank>mode<S2SV_blank>(error<S2SV_blank>%d).\\n" , ret ) ; <S2SV_StartBug> return - EIO ; <S2SV_EndBug> <S2SV_StartBug> } <S2SV_EndBug> switch ( data [ 0 ] ) { case K90_MACRO_MODE_HW : macro_mode = "HW" ; break ; case K90_MACRO_MODE_SW : macro_mode = "SW" ; break ; default : dev_warn ( dev , "K90<S2SV_blank>in<S2SV_blank>unknown<S2SV_blank>mode:<S2SV_blank>%02hhx.\\n" , data [ 0 ] ) ; <S2SV_StartBug> return - EIO ; <S2SV_EndBug> <S2SV_StartBug> } <S2SV_EndBug> return snprintf ( buf , PAGE_SIZE , "%s\\n" , macro_mode ) ; }
<S2SV_ModStart> macro_mode ; char * data ; data = kmalloc ( 2 , GFP_KERNEL ) ; if ( ! data ) return - ENOMEM <S2SV_ModEnd> ; ret = <S2SV_ModStart> ret ) ; ret = <S2SV_ModEnd> - EIO ; <S2SV_ModStart> - EIO ; goto out ; <S2SV_ModStart> ] ) ; ret = <S2SV_ModEnd> - EIO ; <S2SV_ModStart> - EIO ; goto out ; } ret = snprintf ( buf , PAGE_SIZE , "%s\\n" , macro_mode ) ; out : kfree ( data ) ; return ret <S2SV_ModEnd> ; } <S2SV_null>
torvalds@linux/6d104af38b570d37aa32a5803b04c354f8ed513d
CVE-2017-5547
https://github.com/torvalds/linux/commit/6d104af38b570d37aa32a5803b04c354f8ed513d
2017-02-06T06:59Z
103
CWE-189
CWE-189 TSQuery QTN2QT ( QTNode * in ) { TSQuery out ; int len ; int sumlen = 0 , nnode = 0 ; QTN2QTState state ; <S2SV_StartBug> cntsize ( in , & sumlen , & nnode ) ; <S2SV_EndBug> len = COMPUTESIZE ( nnode , sumlen ) ; out = ( TSQuery ) palloc0 ( len ) ; SET_VARSIZE ( out , len ) ; out -> size = nnode ; state . curitem = GETQUERY ( out ) ; state . operand = state . curoperand = GETOPERAND ( out ) ; fillQT ( & state , in ) ; return out ; }
<S2SV_ModStart> , & nnode ) ; if ( TSQUERY_TOO_BIG ( nnode , sumlen ) ) ereport ( ERROR , ( errcode ( ERRCODE_PROGRAM_LIMIT_EXCEEDED ) , errmsg ( "tsquery<S2SV_blank>is<S2SV_blank>too<S2SV_blank>large" ) )
postgres@postgres/31400a673325147e1205326008e32135a78b4d8a
CVE-2014-2669
https://github.com/postgres/postgres/commit/31400a673325147e1205326008e32135a78b4d8a
2014-03-31T14:58Z
104
CWE-119
CWE-119 static void set_roi_map ( const vpx_codec_enc_cfg_t * cfg , vpx_codec_ctx_t * codec ) { unsigned int i ; <S2SV_StartBug> vpx_roi_map_t roi = { 0 } ; <S2SV_EndBug> roi . rows = ( cfg -> g_h + 15 ) / 16 ; roi . cols = ( cfg -> g_w + 15 ) / 16 ; roi . delta_q [ 0 ] = 0 ; roi . delta_q [ 1 ] = - 2 ; roi . delta_q [ 2 ] = - 4 ; roi . delta_q [ 3 ] = - 6 ; roi . delta_lf [ 0 ] = 0 ; roi . delta_lf [ 1 ] = 1 ; roi . delta_lf [ 2 ] = 2 ; roi . delta_lf [ 3 ] = 3 ; roi . static_threshold [ 0 ] = 1500 ; roi . static_threshold [ 1 ] = 1000 ; roi . static_threshold [ 2 ] = 500 ; roi . static_threshold [ 3 ] = 0 ; roi . roi_map = ( uint8_t * ) malloc ( roi . rows * roi . cols ) ; for ( i = 0 ; i < roi . rows * roi . cols ; ++ i ) roi . roi_map [ i ] = i % 4 ; if ( vpx_codec_control ( codec , VP8E_SET_ROI_MAP , & roi ) ) die_codec ( codec , "Failed<S2SV_blank>to<S2SV_blank>set<S2SV_blank>ROI<S2SV_blank>map" ) ; free ( roi . roi_map ) ; }
<S2SV_ModStart> ; vpx_roi_map_t roi ; memset ( & roi , 0 , sizeof ( roi ) ) <S2SV_ModEnd> ; roi .
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
105
CWE-119
CWE-119 static int jpeg2000_decode_tile ( Jpeg2000DecoderContext * s , Jpeg2000Tile * tile , AVFrame * picture ) { int compno , reslevelno , bandno ; int x , y ; uint8_t * line ; Jpeg2000T1Context t1 ; for ( compno = 0 ; compno < s -> ncomponents ; compno ++ ) { Jpeg2000Component * comp = tile -> comp + compno ; Jpeg2000CodingStyle * codsty = tile -> codsty + compno ; for ( reslevelno = 0 ; reslevelno < codsty -> nreslevels2decode ; reslevelno ++ ) { Jpeg2000ResLevel * rlevel = comp -> reslevel + reslevelno ; for ( bandno = 0 ; bandno < rlevel -> nbands ; bandno ++ ) { int nb_precincts , precno ; Jpeg2000Band * band = rlevel -> band + bandno ; int cblkno = 0 , bandpos ; bandpos = bandno + ( reslevelno > 0 ) ; if ( band -> coord [ 0 ] [ 0 ] == band -> coord [ 0 ] [ 1 ] || band -> coord [ 1 ] [ 0 ] == band -> coord [ 1 ] [ 1 ] ) continue ; nb_precincts = rlevel -> num_precincts_x * rlevel -> num_precincts_y ; for ( precno = 0 ; precno < nb_precincts ; precno ++ ) { Jpeg2000Prec * prec = band -> prec + precno ; for ( cblkno = 0 ; cblkno < prec -> nb_codeblocks_width * prec -> nb_codeblocks_height ; cblkno ++ ) { int x , y ; Jpeg2000Cblk * cblk = prec -> cblk + cblkno ; decode_cblk ( s , codsty , & t1 , cblk , cblk -> coord [ 0 ] [ 1 ] - cblk -> coord [ 0 ] [ 0 ] , cblk -> coord [ 1 ] [ 1 ] - cblk -> coord [ 1 ] [ 0 ] , bandpos ) ; x = cblk -> coord [ 0 ] [ 0 ] ; y = cblk -> coord [ 1 ] [ 0 ] ; if ( codsty -> transform == FF_DWT97 ) dequantization_float ( x , y , cblk , comp , & t1 , band ) ; else dequantization_int ( x , y , cblk , comp , & t1 , band ) ; } } } } ff_dwt_decode ( & comp -> dwt , codsty -> transform == FF_DWT97 ? ( void * ) comp -> f_data : ( void * ) comp -> i_data ) ; } if ( tile -> codsty [ 0 ] . mct ) mct_decode ( s , tile ) ; if ( s -> cdef [ 0 ] < 0 ) { for ( x = 0 ; x < s -> ncomponents ; x ++ ) s -> cdef [ x ] = x + 1 ; if ( ( s -> ncomponents & 1 ) == 0 ) s -> cdef [ s -> ncomponents - 1 ] = 0 ; } if ( s -> precision <= 8 ) { for ( compno = 0 ; compno < s -> ncomponents ; compno ++ ) { Jpeg2000Component * comp = tile -> comp + compno ; Jpeg2000CodingStyle * codsty = tile -> codsty + compno ; float * datap = comp -> f_data ; int32_t * i_datap = comp -> i_data ; int cbps = s -> cbps [ compno ] ; int w = tile -> comp [ compno ] . coord [ 0 ] [ 1 ] - s -> image_offset_x ; int planar = ! ! picture -> data [ 2 ] ; int pixelsize = planar ? 1 : s -> ncomponents ; int plane = 0 ; if ( planar ) plane = s -> cdef [ compno ] ? s -> cdef [ compno ] - 1 : ( s -> ncomponents - 1 ) ; y = tile -> comp [ compno ] . coord [ 1 ] [ 0 ] - s -> image_offset_y ; <S2SV_StartBug> line = picture -> data [ plane ] + y * picture -> linesize [ plane ] ; <S2SV_EndBug> for ( ; y < tile -> comp [ compno ] . coord [ 1 ] [ 1 ] - s -> image_offset_y ; y += s -> cdy [ compno ] ) { uint8_t * dst ; x = tile -> comp [ compno ] . coord [ 0 ] [ 0 ] - s -> image_offset_x ; <S2SV_StartBug> dst = line + x * pixelsize + compno * ! planar ; <S2SV_EndBug> if ( codsty -> transform == FF_DWT97 ) { for ( ; x < w ; x += s -> cdx [ compno ] ) { int val = lrintf ( * datap ) + ( 1 << ( cbps - 1 ) ) ; val = av_clip ( val , 0 , ( 1 << cbps ) - 1 ) ; * dst = val << ( 8 - cbps ) ; datap ++ ; dst += pixelsize ; } } else { for ( ; x < w ; x += s -> cdx [ compno ] ) { int val = * i_datap + ( 1 << ( cbps - 1 ) ) ; val = av_clip ( val , 0 , ( 1 << cbps ) - 1 ) ; * dst = val << ( 8 - cbps ) ; i_datap ++ ; dst += pixelsize ; } } line += picture -> linesize [ plane ] ; } } } else { for ( compno = 0 ; compno < s -> ncomponents ; compno ++ ) { Jpeg2000Component * comp = tile -> comp + compno ; Jpeg2000CodingStyle * codsty = tile -> codsty + compno ; float * datap = comp -> f_data ; int32_t * i_datap = comp -> i_data ; uint16_t * linel ; int cbps = s -> cbps [ compno ] ; int w = tile -> comp [ compno ] . coord [ 0 ] [ 1 ] - s -> image_offset_x ; int planar = ! ! picture -> data [ 2 ] ; int pixelsize = planar ? 1 : s -> ncomponents ; int plane = 0 ; if ( planar ) plane = s -> cdef [ compno ] ? s -> cdef [ compno ] - 1 : ( s -> ncomponents - 1 ) ; y = tile -> comp [ compno ] . coord [ 1 ] [ 0 ] - s -> image_offset_y ; <S2SV_StartBug> linel = ( uint16_t * ) picture -> data [ plane ] + y * ( picture -> linesize [ plane ] >> 1 ) ; <S2SV_EndBug> for ( ; y < tile -> comp [ compno ] . coord [ 1 ] [ 1 ] - s -> image_offset_y ; y += s -> cdy [ compno ] ) { uint16_t * dst ; x = tile -> comp [ compno ] . coord [ 0 ] [ 0 ] - s -> image_offset_x ; <S2SV_StartBug> dst = linel + ( x * pixelsize + compno * ! planar ) ; <S2SV_EndBug> if ( codsty -> transform == FF_DWT97 ) { for ( ; x < w ; x += s -> cdx [ compno ] ) { int val = lrintf ( * datap ) + ( 1 << ( cbps - 1 ) ) ; val = av_clip ( val , 0 , ( 1 << cbps ) - 1 ) ; * dst = val << ( 16 - cbps ) ; datap ++ ; dst += pixelsize ; } } else { for ( ; x < w ; x += s -> cdx [ compno ] ) { int val = * i_datap + ( 1 << ( cbps - 1 ) ) ; val = av_clip ( val , 0 , ( 1 << cbps ) - 1 ) ; * dst = val << ( 16 - cbps ) ; i_datap ++ ; dst += pixelsize ; } } linel += picture -> linesize [ plane ] >> 1 ; } } } return 0 ; }
<S2SV_ModStart> ] + y / s -> cdy [ compno ] <S2SV_ModStart> line + x / s -> cdx [ compno ] <S2SV_ModStart> ] + y / s -> cdy [ compno ] <S2SV_ModStart> + ( x / s -> cdx [ compno ]
FFmpeg@FFmpeg/fe448cd28d674c3eff3072552eae366d0b659ce9
CVE-2013-7024
https://github.com/FFmpeg/FFmpeg/commit/fe448cd28d674c3eff3072552eae366d0b659ce9
2013-12-09T16:36Z
106
CWE-189
CWE-189 <S2SV_StartBug> void oz_hcd_get_desc_cnf ( void * hport , u8 req_id , int status , const u8 * desc , <S2SV_EndBug> <S2SV_StartBug> int length , int offset , int total_size ) <S2SV_EndBug> { struct oz_port * port = hport ; struct urb * urb ; int err = 0 ; oz_dbg ( ON , "oz_hcd_get_desc_cnf<S2SV_blank>length<S2SV_blank>=<S2SV_blank>%d<S2SV_blank>offs<S2SV_blank>=<S2SV_blank>%d<S2SV_blank>tot_size<S2SV_blank>=<S2SV_blank>%d\\n" , length , offset , total_size ) ; urb = oz_find_urb_by_id ( port , 0 , req_id ) ; if ( ! urb ) return ; if ( status == 0 ) { <S2SV_StartBug> int copy_len ; <S2SV_EndBug> <S2SV_StartBug> int required_size = urb -> transfer_buffer_length ; <S2SV_EndBug> if ( required_size > total_size ) required_size = total_size ; copy_len = required_size - offset ; if ( length <= copy_len ) copy_len = length ; memcpy ( urb -> transfer_buffer + offset , desc , copy_len ) ; offset += copy_len ; if ( offset < required_size ) { struct usb_ctrlrequest * setup = ( struct usb_ctrlrequest * ) urb -> setup_packet ; unsigned wvalue = le16_to_cpu ( setup -> wValue ) ; if ( oz_enqueue_ep_urb ( port , 0 , 0 , urb , req_id ) ) err = - ENOMEM ; else if ( oz_usb_get_desc_req ( port -> hpd , req_id , setup -> bRequestType , ( u8 ) ( wvalue >> 8 ) , ( u8 ) wvalue , setup -> wIndex , offset , required_size - offset ) ) { oz_dequeue_ep_urb ( port , 0 , 0 , urb ) ; err = - ENOMEM ; } if ( err == 0 ) return ; } } urb -> actual_length = total_size ; oz_complete_urb ( port -> ozhcd -> hcd , urb , 0 ) ; }
<S2SV_ModStart> u8 req_id , u8 <S2SV_ModEnd> status , const <S2SV_ModStart> * desc , u8 length , u16 offset , u16 <S2SV_ModEnd> total_size ) { <S2SV_ModStart> 0 ) { unsigned <S2SV_ModStart> int copy_len ; unsigned
torvalds@linux/b1bb5b49373b61bf9d2c73a4d30058ba6f069e4c
CVE-2015-4001
https://github.com/torvalds/linux/commit/b1bb5b49373b61bf9d2c73a4d30058ba6f069e4c
2015-06-07T23:59Z
107
CWE-125
CWE-125 int TS_OBJ_print_bio ( BIO * bio , const ASN1_OBJECT * obj ) { char obj_txt [ 128 ] ; <S2SV_StartBug> int len = OBJ_obj2txt ( obj_txt , sizeof ( obj_txt ) , obj , 0 ) ; <S2SV_EndBug> <S2SV_StartBug> BIO_write ( bio , obj_txt , len ) ; <S2SV_EndBug> BIO_write ( bio , "\\n" , 1 ) ; return 1 ; }
<S2SV_ModStart> 128 ] ; <S2SV_ModEnd> OBJ_obj2txt ( obj_txt <S2SV_ModStart> 0 ) ; BIO_printf <S2SV_ModEnd> ( bio , <S2SV_ModStart> ( bio , "%s\\n" , obj_txt <S2SV_ModEnd> ) ; return
openssl@openssl/0ed26acce328ec16a3aa635f1ca37365e8c7403a
CVE-2016-2180
https://github.com/openssl/openssl/commit/0ed26acce328ec16a3aa635f1ca37365e8c7403a
2016-08-01T02:59Z
108
CWE-772
CWE-772 static int hwsim_new_radio_nl ( struct sk_buff * msg , struct genl_info * info ) { struct hwsim_new_radio_params param = { 0 } ; const char * hwname = NULL ; int ret ; param . reg_strict = info -> attrs [ HWSIM_ATTR_REG_STRICT_REG ] ; param . p2p_device = info -> attrs [ HWSIM_ATTR_SUPPORT_P2P_DEVICE ] ; param . channels = channels ; param . destroy_on_close = info -> attrs [ HWSIM_ATTR_DESTROY_RADIO_ON_CLOSE ] ; if ( info -> attrs [ HWSIM_ATTR_CHANNELS ] ) param . channels = nla_get_u32 ( info -> attrs [ HWSIM_ATTR_CHANNELS ] ) ; if ( info -> attrs [ HWSIM_ATTR_NO_VIF ] ) param . no_vif = true ; if ( info -> attrs [ HWSIM_ATTR_RADIO_NAME ] ) { hwname = kasprintf ( GFP_KERNEL , "%.*s" , nla_len ( info -> attrs [ HWSIM_ATTR_RADIO_NAME ] ) , ( char * ) nla_data ( info -> attrs [ HWSIM_ATTR_RADIO_NAME ] ) ) ; if ( ! hwname ) return - ENOMEM ; param . hwname = hwname ; } if ( info -> attrs [ HWSIM_ATTR_USE_CHANCTX ] ) param . use_chanctx = true ; else param . use_chanctx = ( param . channels > 1 ) ; if ( info -> attrs [ HWSIM_ATTR_REG_HINT_ALPHA2 ] ) param . reg_alpha2 = nla_data ( info -> attrs [ HWSIM_ATTR_REG_HINT_ALPHA2 ] ) ; if ( info -> attrs [ HWSIM_ATTR_REG_CUSTOM_REG ] ) { u32 idx = nla_get_u32 ( info -> attrs [ HWSIM_ATTR_REG_CUSTOM_REG ] ) ; <S2SV_StartBug> if ( idx >= ARRAY_SIZE ( hwsim_world_regdom_custom ) ) <S2SV_EndBug> return - EINVAL ; <S2SV_StartBug> param . regd = hwsim_world_regdom_custom [ idx ] ; <S2SV_EndBug> } ret = mac80211_hwsim_new_radio ( info , & param ) ; kfree ( hwname ) ; return ret ; }
<S2SV_ModStart> hwsim_world_regdom_custom ) ) { kfree ( hwname ) ; <S2SV_ModStart> - EINVAL ; }
torvalds@linux/0ddcff49b672239dda94d70d0fcf50317a9f4b51
CVE-2018-8087
https://github.com/torvalds/linux/commit/0ddcff49b672239dda94d70d0fcf50317a9f4b51
2018-03-13T06:29Z
109
CWE-119
CWE-119 static int candidate_refresh_aq ( const CYCLIC_REFRESH * cr , const MB_MODE_INFO * mbmi , <S2SV_StartBug> BLOCK_SIZE bsize , int use_rd ) { <S2SV_EndBug> if ( use_rd ) { if ( cr -> projected_rate_sb < cr -> thresh_rate_sb ) return 1 ; else if ( bsize < cr -> min_block_size || <S2SV_StartBug> ( mbmi -> mv [ 0 ] . as_int != 0 && <S2SV_EndBug> <S2SV_StartBug> cr -> projected_dist_sb > cr -> thresh_dist_sb ) || <S2SV_EndBug> <S2SV_StartBug> ! is_inter_block ( mbmi ) ) <S2SV_EndBug> return 0 ; else return 1 ; } else { <S2SV_StartBug> if ( bsize < cr -> min_block_size || <S2SV_EndBug> <S2SV_StartBug> mbmi -> mv [ 0 ] . as_int != 0 || <S2SV_EndBug> ! is_inter_block ( mbmi ) ) return 0 ; else <S2SV_StartBug> return 1 ; <S2SV_EndBug> } }
<S2SV_ModStart> * mbmi , int64_t rate , int64_t dist , int bsize ) { MV mv = <S2SV_ModEnd> mbmi -> mv <S2SV_ModStart> 0 ] . as_mv ; if ( dist <S2SV_ModEnd> > cr -> <S2SV_ModStart> cr -> thresh_dist_sb && ( mv . row > cr -> motion_thresh || mv . row < - cr -> motion_thresh || mv . col > cr -> motion_thresh || mv . col < - cr -> motion_thresh <S2SV_ModEnd> || ! is_inter_block <S2SV_ModStart> mbmi ) ) ) return CR_SEGMENT_ID_BASE ; else <S2SV_ModEnd> if ( bsize <S2SV_ModStart> if ( bsize >= BLOCK_16X16 && rate <S2SV_ModStart> < cr -> thresh_rate_sb && is_inter_block ( mbmi ) && <S2SV_ModEnd> mbmi -> mv <S2SV_ModStart> ] . as_int == 0 && cr -> rate_boost_fac > 10 ) return CR_SEGMENT_ID_BOOST2 <S2SV_ModEnd> ; else return <S2SV_ModStart> ; else return CR_SEGMENT_ID_BOOST1 ; } <S2SV_ModEnd> <S2SV_null> <S2SV_null> <S2SV_null>
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
110
CWE-125
CWE-125 <S2SV_StartBug> int ntlm_read_message_fields ( wStream * s , NTLM_MESSAGE_FIELDS * fields ) <S2SV_EndBug> { if ( Stream_GetRemainingLength ( s ) < 8 ) return - 1 ; Stream_Read_UINT16 ( s , fields -> Len ) ; Stream_Read_UINT16 ( s , fields -> MaxLen ) ; Stream_Read_UINT32 ( s , fields -> BufferOffset ) ; return 1 ; }
<S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> static
FreeRDP@FreeRDP/2ee663f39dc8dac3d9988e847db19b2d7e3ac8c6
CVE-2018-8789
https://github.com/FreeRDP/FreeRDP/commit/2ee663f39dc8dac3d9988e847db19b2d7e3ac8c6
2018-11-29T18:29Z
111
CWE-189
CWE-189 int midi_synth_load_patch ( int dev , int format , const char __user * addr , <S2SV_StartBug> int offs , int count , int pmgr_flag ) <S2SV_EndBug> { int orig_dev = synth_devs [ dev ] -> midi_dev ; struct sysex_info sysex ; int i ; unsigned long left , src_offs , eox_seen = 0 ; int first_byte = 1 ; int hdr_size = ( unsigned long ) & sysex . data [ 0 ] - ( unsigned long ) & sysex ; leave_sysex ( dev ) ; if ( ! prefix_cmd ( orig_dev , 0xf0 ) ) return 0 ; if ( format != SYSEX_PATCH ) <S2SV_StartBug> { <S2SV_EndBug> return - EINVAL ; <S2SV_StartBug> } <S2SV_EndBug> if ( count < hdr_size ) <S2SV_StartBug> { <S2SV_EndBug> return - EINVAL ; <S2SV_StartBug> } <S2SV_EndBug> count -= hdr_size ; <S2SV_StartBug> if ( copy_from_user ( & ( ( char * ) & sysex ) [ offs ] , & ( addr ) [ offs ] , hdr_size - offs ) ) <S2SV_EndBug> return - EFAULT ; <S2SV_StartBug> if ( count < sysex . len ) <S2SV_EndBug> <S2SV_StartBug> { <S2SV_EndBug> sysex . len = count ; <S2SV_StartBug> } <S2SV_EndBug> left = sysex . len ; src_offs = 0 ; for ( i = 0 ; i < left && ! signal_pending ( current ) ; i ++ ) { unsigned char data ; if ( get_user ( data , ( unsigned char __user * ) ( addr + hdr_size + i ) ) ) return - EFAULT ; eox_seen = ( i > 0 && data & 0x80 ) ; if ( eox_seen && data != 0xf7 ) data = 0xf7 ; if ( i == 0 ) { if ( data != 0xf0 ) { printk ( KERN_WARNING "midi_synth:<S2SV_blank>Sysex<S2SV_blank>start<S2SV_blank>missing\\n" ) ; return - EINVAL ; } } while ( ! midi_devs [ orig_dev ] -> outputc ( orig_dev , ( unsigned char ) ( data & 0xff ) ) && ! signal_pending ( current ) ) schedule ( ) ; if ( ! first_byte && data & 0x80 ) return 0 ; first_byte = 0 ; } if ( ! eox_seen ) midi_outc ( orig_dev , 0xf7 ) ; return 0 ; }
<S2SV_ModStart> * addr , <S2SV_ModEnd> int count , <S2SV_ModStart> != SYSEX_PATCH ) <S2SV_ModEnd> return - EINVAL <S2SV_ModStart> - EINVAL ; <S2SV_ModEnd> if ( count <S2SV_ModStart> < hdr_size ) <S2SV_ModEnd> return - EINVAL <S2SV_ModStart> - EINVAL ; <S2SV_ModEnd> count -= hdr_size <S2SV_ModStart> copy_from_user ( & sysex , addr , hdr_size <S2SV_ModEnd> ) ) return <S2SV_ModStart> ; if ( ( unsigned ) count < ( unsigned ) <S2SV_ModEnd> sysex . len <S2SV_ModStart> . len ) <S2SV_ModEnd> sysex . len <S2SV_ModStart> = count ; <S2SV_ModEnd> left = sysex
torvalds@linux/b769f49463711205d57286e64cf535ed4daf59e9
CVE-2011-1476
https://github.com/torvalds/linux/commit/b769f49463711205d57286e64cf535ed4daf59e9
2012-06-21T23:55Z
112
CWE-416
CWE-416 static ssize_t userfaultfd_ctx_read ( struct userfaultfd_ctx * ctx , int no_wait , struct uffd_msg * msg ) { ssize_t ret ; DECLARE_WAITQUEUE ( wait , current ) ; struct userfaultfd_wait_queue * uwq ; LIST_HEAD ( fork_event ) ; struct userfaultfd_ctx * fork_nctx = NULL ; spin_lock ( & ctx -> fd_wqh . lock ) ; __add_wait_queue ( & ctx -> fd_wqh , & wait ) ; for ( ; ; ) { set_current_state ( TASK_INTERRUPTIBLE ) ; spin_lock ( & ctx -> fault_pending_wqh . lock ) ; uwq = find_userfault ( ctx ) ; if ( uwq ) { write_seqcount_begin ( & ctx -> refile_seq ) ; list_del ( & uwq -> wq . entry ) ; __add_wait_queue ( & ctx -> fault_wqh , & uwq -> wq ) ; write_seqcount_end ( & ctx -> refile_seq ) ; * msg = uwq -> msg ; spin_unlock ( & ctx -> fault_pending_wqh . lock ) ; ret = 0 ; break ; } spin_unlock ( & ctx -> fault_pending_wqh . lock ) ; spin_lock ( & ctx -> event_wqh . lock ) ; uwq = find_userfault_evt ( ctx ) ; if ( uwq ) { * msg = uwq -> msg ; if ( uwq -> msg . event == UFFD_EVENT_FORK ) { fork_nctx = ( struct userfaultfd_ctx * ) ( unsigned long ) uwq -> msg . arg . reserved . reserved1 ; list_move ( & uwq -> wq . entry , & fork_event ) ; <S2SV_StartBug> spin_unlock ( & ctx -> event_wqh . lock ) ; <S2SV_EndBug> ret = 0 ; break ; } userfaultfd_event_complete ( ctx , uwq ) ; spin_unlock ( & ctx -> event_wqh . lock ) ; ret = 0 ; break ; } spin_unlock ( & ctx -> event_wqh . lock ) ; if ( signal_pending ( current ) ) { ret = - ERESTARTSYS ; break ; } if ( no_wait ) { ret = - EAGAIN ; break ; } spin_unlock ( & ctx -> fd_wqh . lock ) ; schedule ( ) ; spin_lock ( & ctx -> fd_wqh . lock ) ; } __remove_wait_queue ( & ctx -> fd_wqh , & wait ) ; __set_current_state ( TASK_RUNNING ) ; spin_unlock ( & ctx -> fd_wqh . lock ) ; if ( ! ret && msg -> event == UFFD_EVENT_FORK ) { ret = resolve_userfault_fork ( ctx , fork_nctx , msg ) ; <S2SV_StartBug> if ( ! ret ) { <S2SV_EndBug> spin_lock ( & ctx -> event_wqh . lock ) ; if ( ! list_empty ( & fork_event ) ) { <S2SV_StartBug> uwq = list_first_entry ( & fork_event , <S2SV_EndBug> typeof ( * uwq ) , wq . entry ) ; list_del ( & uwq -> wq . entry ) ; __add_wait_queue ( & ctx -> event_wqh , & uwq -> wq ) ; <S2SV_StartBug> userfaultfd_event_complete ( ctx , uwq ) ; <S2SV_EndBug> } <S2SV_StartBug> spin_unlock ( & ctx -> event_wqh . lock ) ; <S2SV_EndBug> } } return ret ; }
<S2SV_ModStart> fork_event ) ; userfaultfd_ctx_get ( fork_nctx ) ; <S2SV_ModStart> msg ) ; <S2SV_ModEnd> spin_lock ( & <S2SV_ModStart> ) ) { userfaultfd_ctx_put ( fork_nctx ) ; <S2SV_ModStart> wq ) ; if ( likely ( ! ret ) ) <S2SV_ModStart> ) ; } else { if ( ret ) userfaultfd_ctx_put ( fork_nctx ) ; } spin_unlock ( & ctx -> event_wqh . lock ) ; <S2SV_ModEnd> } return ret
torvalds@linux/384632e67e0829deb8015ee6ad916b180049d252
CVE-2017-15126
https://github.com/torvalds/linux/commit/384632e67e0829deb8015ee6ad916b180049d252
2018-01-14T06:29Z
113
CWE-119
CWE-119 <S2SV_StartBug> static int decode_coefs ( VP9_COMMON * cm , const MACROBLOCKD * xd , PLANE_TYPE type , <S2SV_EndBug> <S2SV_StartBug> int16_t * dqcoeff , TX_SIZE tx_size , const int16_t * dq , <S2SV_EndBug> int ctx , const int16_t * scan , const int16_t * nb , <S2SV_StartBug> vp9_reader * r ) { <S2SV_EndBug> const int max_eob = 16 << ( tx_size << 1 ) ; <S2SV_StartBug> const FRAME_CONTEXT * const fc = & cm -> fc ; <S2SV_EndBug> FRAME_COUNTS * const counts = & cm -> counts ; const int ref = is_inter_block ( & xd -> mi [ 0 ] -> mbmi ) ; int band , c = 0 ; <S2SV_StartBug> const vp9_prob ( * coef_probs ) [ COEFF_CONTEXTS ] [ UNCONSTRAINED_NODES ] = <S2SV_EndBug> fc -> coef_probs [ tx_size ] [ type ] [ ref ] ; <S2SV_StartBug> const vp9_prob * prob ; <S2SV_EndBug> <S2SV_StartBug> unsigned int ( * coef_counts ) [ COEFF_CONTEXTS ] [ UNCONSTRAINED_NODES + 1 ] = <S2SV_EndBug> counts -> coef [ tx_size ] [ type ] [ ref ] ; <S2SV_StartBug> unsigned int ( * eob_branch_count ) [ COEFF_CONTEXTS ] = <S2SV_EndBug> counts -> eob_branch [ tx_size ] [ type ] [ ref ] ; <S2SV_StartBug> uint8_t token_cache [ 32 * 32 ] ; <S2SV_EndBug> const uint8_t * cat6 ; const uint8_t * band_translate = get_band_translate ( tx_size ) ; const int dq_shift = ( tx_size == TX_32X32 ) ; int v ; int16_t dqv = dq [ 0 ] ; while ( c < max_eob ) { <S2SV_StartBug> int val ; <S2SV_EndBug> band = * band_translate ++ ; prob = coef_probs [ band ] [ ctx ] ; <S2SV_StartBug> if ( ! cm -> frame_parallel_decoding_mode ) <S2SV_EndBug> ++ eob_branch_count [ band ] [ ctx ] ; <S2SV_StartBug> if ( ! vp9_read ( r , prob [ EOB_CONTEXT_NODE ] ) ) { <S2SV_EndBug> INCREMENT_COUNT ( EOB_MODEL_TOKEN ) ; break ; } <S2SV_StartBug> while ( ! vp9_read ( r , prob [ ZERO_CONTEXT_NODE ] ) ) { <S2SV_EndBug> INCREMENT_COUNT ( ZERO_TOKEN ) ; dqv = dq [ 1 ] ; token_cache [ scan [ c ] ] = 0 ; ++ c ; if ( c >= max_eob ) return c ; ctx = get_coef_context ( nb , token_cache , c ) ; band = * band_translate ++ ; prob = coef_probs [ band ] [ ctx ] ; } <S2SV_StartBug> if ( ! vp9_read ( r , prob [ ONE_CONTEXT_NODE ] ) ) { <S2SV_EndBug> INCREMENT_COUNT ( ONE_TOKEN ) ; <S2SV_StartBug> WRITE_COEF_CONTINUE ( 1 , ONE_TOKEN ) ; <S2SV_EndBug> } INCREMENT_COUNT ( TWO_TOKEN ) ; <S2SV_StartBug> prob = vp9_pareto8_full [ prob [ PIVOT_NODE ] - 1 ] ; <S2SV_EndBug> if ( ! vp9_read ( r , prob [ LOW_VAL_CONTEXT_NODE ] ) ) { if ( ! vp9_read ( r , prob [ TWO_CONTEXT_NODE ] ) ) { WRITE_COEF_CONTINUE ( 2 , TWO_TOKEN ) ; } if ( ! vp9_read ( r , prob [ THREE_CONTEXT_NODE ] ) ) { WRITE_COEF_CONTINUE ( 3 , THREE_TOKEN ) ; } WRITE_COEF_CONTINUE ( 4 , FOUR_TOKEN ) ; } if ( ! vp9_read ( r , prob [ HIGH_LOW_CONTEXT_NODE ] ) ) { if ( ! vp9_read ( r , prob [ CAT_ONE_CONTEXT_NODE ] ) ) { val = CAT1_MIN_VAL ; ADJUST_COEF ( CAT1_PROB0 , 0 ) ; WRITE_COEF_CONTINUE ( val , CATEGORY1_TOKEN ) ; } val = CAT2_MIN_VAL ; ADJUST_COEF ( CAT2_PROB1 , 1 ) ; ADJUST_COEF ( CAT2_PROB0 , 0 ) ; WRITE_COEF_CONTINUE ( val , CATEGORY2_TOKEN ) ; } if ( ! vp9_read ( r , prob [ CAT_THREEFOUR_CONTEXT_NODE ] ) ) { if ( ! vp9_read ( r , prob [ CAT_THREE_CONTEXT_NODE ] ) ) { val = CAT3_MIN_VAL ; ADJUST_COEF ( CAT3_PROB2 , 2 ) ; ADJUST_COEF ( CAT3_PROB1 , 1 ) ; ADJUST_COEF ( CAT3_PROB0 , 0 ) ; WRITE_COEF_CONTINUE ( val , CATEGORY3_TOKEN ) ; } val = CAT4_MIN_VAL ; ADJUST_COEF ( CAT4_PROB3 , 3 ) ; ADJUST_COEF ( CAT4_PROB2 , 2 ) ; ADJUST_COEF ( CAT4_PROB1 , 1 ) ; ADJUST_COEF ( CAT4_PROB0 , 0 ) ; WRITE_COEF_CONTINUE ( val , CATEGORY4_TOKEN ) ; } if ( ! vp9_read ( r , prob [ CAT_FIVE_CONTEXT_NODE ] ) ) { val = CAT5_MIN_VAL ; ADJUST_COEF ( CAT5_PROB4 , 4 ) ; ADJUST_COEF ( CAT5_PROB3 , 3 ) ; ADJUST_COEF ( CAT5_PROB2 , 2 ) ; ADJUST_COEF ( CAT5_PROB1 , 1 ) ; ADJUST_COEF ( CAT5_PROB0 , 0 ) ; WRITE_COEF_CONTINUE ( val , CATEGORY5_TOKEN ) ; } val = 0 ; cat6 = cat6_prob ; while ( * cat6 ) val = ( val << 1 ) | vp9_read ( r , * cat6 ++ ) ; val += CAT6_MIN_VAL ; WRITE_COEF_CONTINUE ( val , CATEGORY6_TOKEN ) ; } return c ; }
<S2SV_ModStart> int decode_coefs ( <S2SV_ModEnd> const MACROBLOCKD * <S2SV_ModStart> PLANE_TYPE type , tran_low_t <S2SV_ModEnd> * dqcoeff , <S2SV_ModStart> * nb , vpx_reader * r ) { FRAME_COUNTS * counts = xd -> counts ; <S2SV_ModEnd> const int max_eob <S2SV_ModStart> const fc = xd -> fc <S2SV_ModEnd> ; const int <S2SV_ModStart> 0 ; const vpx_prob <S2SV_ModEnd> ( * coef_probs <S2SV_ModStart> ] ; const vpx_prob <S2SV_ModEnd> * prob ; <S2SV_ModStart> + 1 ] ; unsigned int ( * eob_branch_count ) [ COEFF_CONTEXTS ] ; uint8_t token_cache [ 32 * 32 ] ; const uint8_t * band_translate = get_band_translate ( tx_size ) ; const int dq_shift = ( tx_size == TX_32X32 ) ; int v , token ; int16_t dqv = dq [ 0 ] ; const uint8_t * cat1_prob ; const uint8_t * cat2_prob ; const uint8_t * cat3_prob ; const uint8_t * cat4_prob ; const uint8_t * cat5_prob ; const uint8_t * cat6_prob ; if ( counts ) { coef_counts = <S2SV_ModEnd> counts -> coef <S2SV_ModStart> ref ] ; eob_branch_count = <S2SV_ModEnd> counts -> eob_branch <S2SV_ModStart> ref ] ; } # if CONFIG_VP9_HIGHBITDEPTH if ( xd -> bd > VPX_BITS_8 ) { if ( xd -> bd == VPX_BITS_10 ) { cat1_prob = vp9_cat1_prob_high10 ; cat2_prob = vp9_cat2_prob_high10 ; cat3_prob = vp9_cat3_prob_high10 ; cat4_prob = vp9_cat4_prob_high10 ; cat5_prob = vp9_cat5_prob_high10 ; cat6_prob = vp9_cat6_prob_high10 ; } else { cat1_prob = vp9_cat1_prob_high12 ; cat2_prob = vp9_cat2_prob_high12 ; cat3_prob = vp9_cat3_prob_high12 ; cat4_prob = vp9_cat4_prob_high12 ; cat5_prob = vp9_cat5_prob_high12 ; cat6_prob = vp9_cat6_prob_high12 ; } } else { cat1_prob = vp9_cat1_prob ; cat2_prob = vp9_cat2_prob ; cat3_prob = vp9_cat3_prob ; cat4_prob = vp9_cat4_prob ; cat5_prob = vp9_cat5_prob ; cat6_prob = vp9_cat6_prob ; } # else cat1_prob = vp9_cat1_prob ; cat2_prob = vp9_cat2_prob ; cat3_prob = vp9_cat3_prob ; cat4_prob = vp9_cat4_prob ; cat5_prob = vp9_cat5_prob ; cat6_prob = vp9_cat6_prob ; # endif <S2SV_ModEnd> while ( c <S2SV_ModStart> { int val = - 1 <S2SV_ModStart> ; if ( counts <S2SV_ModEnd> ) ++ eob_branch_count <S2SV_ModStart> if ( ! vpx_read <S2SV_ModEnd> ( r , <S2SV_ModStart> while ( ! vpx_read <S2SV_ModEnd> ( r , <S2SV_ModStart> if ( ! vpx_read <S2SV_ModEnd> ( r , <S2SV_ModStart> ONE_TOKEN ) ; token = ONE_TOKEN ; val = 1 ; } else { <S2SV_ModEnd> INCREMENT_COUNT ( TWO_TOKEN <S2SV_ModStart> TWO_TOKEN ) ; token = vpx_read_tree ( r , vp9_coef_con_tree , <S2SV_ModEnd> vp9_pareto8_full [ prob <S2SV_ModStart> - 1 ] ) ; switch ( token ) { case TWO_TOKEN : case THREE_TOKEN : case FOUR_TOKEN : val = token ; break ; case CATEGORY1_TOKEN : val = CAT1_MIN_VAL + read_coeff ( cat1_prob , 1 , r ) ; break ; case CATEGORY2_TOKEN : val = CAT2_MIN_VAL + read_coeff ( cat2_prob , 2 , r ) ; break ; case CATEGORY3_TOKEN : val = CAT3_MIN_VAL + read_coeff ( cat3_prob , 3 , r ) ; break ; case CATEGORY4_TOKEN : val = CAT4_MIN_VAL + read_coeff ( cat4_prob , 4 , r ) ; break ; case CATEGORY5_TOKEN : val = CAT5_MIN_VAL + read_coeff ( cat5_prob , 5 , r ) ; break ; case CATEGORY6_TOKEN : # if CONFIG_VP9_HIGHBITDEPTH switch ( xd -> bd ) { case VPX_BITS_8 : val = CAT6_MIN_VAL + read_coeff ( cat6_prob , 14 , r ) ; break ; case VPX_BITS_10 : val = CAT6_MIN_VAL + read_coeff ( cat6_prob , 16 , r ) ; break ; case VPX_BITS_12 : val = CAT6_MIN_VAL + read_coeff ( cat6_prob , 18 , r ) ; break ; default : assert ( 0 ) ; return - 1 ; } # else val = CAT6_MIN_VAL + read_coeff ( cat6_prob , 14 , r ) ; # endif break ; } } v = ( val * dqv ) >> dq_shift ; # if CONFIG_COEFFICIENT_RANGE_CHECKING # if CONFIG_VP9_HIGHBITDEPTH dqcoeff [ scan [ c ] ] = highbd_check_range ( ( vpx_read_bit ( r ) ? - v : v ) , xd -> bd ) ; # else dqcoeff [ scan [ c ] ] = check_range ( vpx_read_bit ( r ) ? - v : v ) ; # endif # else dqcoeff [ scan [ c ] ] = vpx_read_bit ( r ) ? - v : v ; # endif token_cache [ scan [ c ] ] = vp9_pt_energy_class [ token ] ; ++ c ; ctx = get_coef_context ( nb , token_cache , c ) ; dqv = dq [ 1 ] <S2SV_ModEnd> ; } return
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
114
CWE-416
CWE-416 static void host_callback ( void * arg , int status , int timeouts , unsigned char * abuf , int alen ) { struct host_query * hquery = ( struct host_query * ) arg ; int addinfostatus = ARES_SUCCESS ; hquery -> timeouts += timeouts ; hquery -> remaining -- ; if ( status == ARES_SUCCESS ) { addinfostatus = ares__parse_into_addrinfo ( abuf , alen , hquery -> ai ) ; } else if ( status == ARES_EDESTRUCTION ) { end_hquery ( hquery , status ) ; <S2SV_StartBug> } <S2SV_EndBug> if ( ! hquery -> remaining ) { if ( addinfostatus != ARES_SUCCESS ) { end_hquery ( hquery , addinfostatus ) ; } else if ( hquery -> ai -> nodes ) { end_hquery ( hquery , ARES_SUCCESS ) ; } else if ( status == ARES_ENOTFOUND ) { next_lookup ( hquery , status ) ; } else { end_hquery ( hquery , status ) ; } } }
<S2SV_ModStart> status ) ; return ;
c-ares@c-ares/1cc7e83c3bdfaafbc5919c95025592d8de3a170e
CVE-2020-14354
https://github.com/c-ares/c-ares/commit/1cc7e83c3bdfaafbc5919c95025592d8de3a170e
2021-05-13T14:15Z
115
CWE-119
CWE-119 <S2SV_StartBug> void vp9_fht4x4_sse2 ( const int16_t * input , int16_t * output , <S2SV_EndBug> int stride , int tx_type ) { __m128i in [ 4 ] ; switch ( tx_type ) { case DCT_DCT : <S2SV_StartBug> vp9_fdct4x4_sse2 ( input , output , stride ) ; <S2SV_EndBug> break ; case ADST_DCT : load_buffer_4x4 ( input , in , stride ) ; fadst4_sse2 ( in ) ; fdct4_sse2 ( in ) ; write_buffer_4x4 ( output , in ) ; break ; case DCT_ADST : load_buffer_4x4 ( input , in , stride ) ; fdct4_sse2 ( in ) ; fadst4_sse2 ( in ) ; write_buffer_4x4 ( output , in ) ; break ; case ADST_ADST : load_buffer_4x4 ( input , in , stride ) ; fadst4_sse2 ( in ) ; fadst4_sse2 ( in ) ; write_buffer_4x4 ( output , in ) ; break ; default : assert ( 0 ) ; break ; } }
<S2SV_ModStart> * input , tran_low_t <S2SV_ModEnd> * output , <S2SV_ModStart> case DCT_DCT : vpx_fdct4x4_sse2 <S2SV_ModEnd> ( input ,
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
116
CWE-20
CWE-20 <S2SV_StartBug> error_t mqttSnClientDisconnect ( MqttSnClientContext * context ) <S2SV_EndBug> { error_t error ; systime_t time ; if ( context == NULL ) return ERROR_INVALID_PARAMETER ; error = NO_ERROR ; while ( ! error ) { time = osGetSystemTime ( ) ; if ( context -> state == MQTT_SN_CLIENT_STATE_ACTIVE ) { context -> startTime = time ; <S2SV_StartBug> error = mqttSnClientSendDisconnect ( context , 0 ) ; <S2SV_EndBug> } else if ( context -> state == MQTT_SN_CLIENT_STATE_SENDING_REQ ) { if ( timeCompare ( time , context -> startTime + context -> timeout ) >= 0 ) { mqttSnClientShutdownConnection ( context ) ; error = ERROR_TIMEOUT ; } else if ( timeCompare ( time , context -> retransmitStartTime + MQTT_SN_CLIENT_RETRY_TIMEOUT ) >= 0 ) { <S2SV_StartBug> error = mqttSnClientSendDisconnect ( context , 0 ) ; <S2SV_EndBug> } else { error = mqttSnClientProcessEvents ( context , MQTT_SN_CLIENT_TICK_INTERVAL ) ; } } else if ( context -> state == MQTT_SN_CLIENT_STATE_DISCONNECTING ) { error = mqttSnClientShutdownConnection ( context ) ; mqttSnClientCloseConnection ( context ) ; context -> state = MQTT_SN_CLIENT_STATE_DISCONNECTED ; } else if ( context -> state == MQTT_SN_CLIENT_STATE_DISCONNECTED ) { break ; } else { error = ERROR_WRONG_STATE ; } } if ( error != NO_ERROR && error != ERROR_WOULD_BLOCK ) { mqttSnClientCloseConnection ( context ) ; context -> state = MQTT_SN_CLIENT_STATE_DISCONNECTED ; } return error ; }
<S2SV_ModStart> MqttSnClientContext * context , systime_t duration <S2SV_ModStart> ( context , duration / 1000 <S2SV_ModEnd> ) ; } <S2SV_ModStart> ( context , duration / 1000 <S2SV_ModEnd> ) ; }
Oryx-Embedded@CycloneTCP/de5336016edbe1e90327d0ed1cba5c4e49114366
CVE-2021-26788
https://github.com/Oryx-Embedded/CycloneTCP/commit/de5336016edbe1e90327d0ed1cba5c4e49114366
2021-03-08T13:15Z
117
CWE-119
CWE-119 <S2SV_StartBug> static const char * parse_object ( cJSON * item , const char * value ) <S2SV_EndBug> { cJSON * child ; if ( * value != '{' ) { <S2SV_StartBug> ep = value ; <S2SV_EndBug> return 0 ; } item -> type = cJSON_Object ; value = skip ( value + 1 ) ; if ( * value == '}' ) <S2SV_StartBug> return value + 1 ; <S2SV_EndBug> <S2SV_StartBug> if ( ! ( item -> child = child = cJSON_New_Item ( ) ) ) <S2SV_EndBug> return 0 ; <S2SV_StartBug> if ( ! ( value = skip ( parse_string ( child , skip ( value ) ) ) ) ) <S2SV_EndBug> return 0 ; child -> string = child -> valuestring ; child -> valuestring = 0 ; if ( * value != ':' ) { <S2SV_StartBug> ep = value ; <S2SV_EndBug> return 0 ; } <S2SV_StartBug> if ( ! ( value = skip ( parse_value ( child , skip ( value + 1 ) ) ) ) ) <S2SV_EndBug> return 0 ; while ( * value == ',' ) { cJSON * new_item ; if ( ! ( new_item = cJSON_New_Item ( ) ) ) return 0 ; child -> next = new_item ; new_item -> prev = child ; <S2SV_StartBug> child = new_item ; <S2SV_EndBug> <S2SV_StartBug> if ( ! ( value = skip ( parse_string ( child , skip ( value + 1 ) ) ) ) ) <S2SV_EndBug> return 0 ; child -> string = child -> valuestring ; child -> valuestring = 0 ; if ( * value != ':' ) { <S2SV_StartBug> ep = value ; <S2SV_EndBug> return 0 ; } <S2SV_StartBug> if ( ! ( value = skip ( parse_value ( child , skip ( value + 1 ) ) ) ) ) <S2SV_EndBug> return 0 ; } if ( * value == '}' ) <S2SV_StartBug> return value + 1 ; <S2SV_EndBug> ep = value ; return 0 ; }
<S2SV_ModStart> char * value , const char * * ep <S2SV_ModStart> '{' ) { * ep = value ; return 0 ; <S2SV_ModEnd> } item -> <S2SV_ModStart> == '}' ) return value + 1 ; <S2SV_ModEnd> item -> child <S2SV_ModStart> cJSON_New_Item ( ) ; if ( ! item -> child ) return 0 ; <S2SV_ModEnd> value = skip <S2SV_ModStart> ( value ) , ep ) ) ; if ( ! value ) <S2SV_ModEnd> return 0 ; <S2SV_ModStart> ':' ) { * ep = value ; return 0 ; } <S2SV_ModEnd> value = skip <S2SV_ModStart> + 1 ) , ep ) ) ; if ( ! value ) <S2SV_ModEnd> return 0 ; <S2SV_ModStart> = child ; child = new_item ; <S2SV_ModEnd> value = skip <S2SV_ModStart> + 1 ) , ep ) ) ; if ( ! value ) <S2SV_ModEnd> return 0 ; <S2SV_ModStart> ':' ) { * ep = value ; return 0 ; } <S2SV_ModEnd> value = skip <S2SV_ModStart> + 1 ) , ep ) ) ; if ( ! value ) <S2SV_ModEnd> return 0 ; <S2SV_ModStart> == '}' ) return value + 1 ; * ep = value ; <S2SV_ModEnd> return 0 ;
esnet@iperf/91f2fa59e8ed80dfbf400add0164ee0e508e412a
CVE-2016-4303
https://github.com/esnet/iperf/commit/91f2fa59e8ed80dfbf400add0164ee0e508e412a
2016-09-26T14:59Z
118
CWE-264
CWE-264 static int hfsplus_readdir ( struct file * filp , void * dirent , filldir_t filldir ) { struct inode * inode = filp -> f_path . dentry -> d_inode ; struct super_block * sb = inode -> i_sb ; int len , err ; char strbuf [ HFSPLUS_MAX_STRLEN + 1 ] ; hfsplus_cat_entry entry ; struct hfs_find_data fd ; struct hfsplus_readdir_data * rd ; u16 type ; if ( filp -> f_pos >= inode -> i_size ) return 0 ; err = hfs_find_init ( HFSPLUS_SB ( sb ) -> cat_tree , & fd ) ; if ( err ) return err ; hfsplus_cat_build_key ( sb , fd . search_key , inode -> i_ino , NULL ) ; err = hfs_brec_find ( & fd ) ; if ( err ) goto out ; switch ( ( u32 ) filp -> f_pos ) { case 0 : if ( filldir ( dirent , "." , 1 , 0 , inode -> i_ino , DT_DIR ) ) goto out ; filp -> f_pos ++ ; case 1 : <S2SV_StartBug> hfs_bnode_read ( fd . bnode , & entry , fd . entryoffset , <S2SV_EndBug> fd . entrylength ) ; if ( be16_to_cpu ( entry . type ) != HFSPLUS_FOLDER_THREAD ) { printk ( KERN_ERR "hfs:<S2SV_blank>bad<S2SV_blank>catalog<S2SV_blank>folder<S2SV_blank>thread\\n" ) ; err = - EIO ; goto out ; } if ( fd . entrylength < HFSPLUS_MIN_THREAD_SZ ) { printk ( KERN_ERR "hfs:<S2SV_blank>truncated<S2SV_blank>catalog<S2SV_blank>thread\\n" ) ; err = - EIO ; goto out ; } if ( filldir ( dirent , ".." , 2 , 1 , be32_to_cpu ( entry . thread . parentID ) , DT_DIR ) ) goto out ; filp -> f_pos ++ ; default : if ( filp -> f_pos >= inode -> i_size ) goto out ; err = hfs_brec_goto ( & fd , filp -> f_pos - 1 ) ; if ( err ) goto out ; } for ( ; ; ) { if ( be32_to_cpu ( fd . key -> cat . parent ) != inode -> i_ino ) { printk ( KERN_ERR "hfs:<S2SV_blank>walked<S2SV_blank>past<S2SV_blank>end<S2SV_blank>of<S2SV_blank>dir\\n" ) ; err = - EIO ; goto out ; } <S2SV_StartBug> hfs_bnode_read ( fd . bnode , & entry , fd . entryoffset , <S2SV_EndBug> fd . entrylength ) ; type = be16_to_cpu ( entry . type ) ; len = HFSPLUS_MAX_STRLEN ; err = hfsplus_uni2asc ( sb , & fd . key -> cat . name , strbuf , & len ) ; if ( err ) goto out ; if ( type == HFSPLUS_FOLDER ) { if ( fd . entrylength < sizeof ( struct hfsplus_cat_folder ) ) { printk ( KERN_ERR "hfs:<S2SV_blank>small<S2SV_blank>dir<S2SV_blank>entry\\n" ) ; err = - EIO ; goto out ; } if ( HFSPLUS_SB ( sb ) -> hidden_dir && HFSPLUS_SB ( sb ) -> hidden_dir -> i_ino == be32_to_cpu ( entry . folder . id ) ) goto next ; if ( filldir ( dirent , strbuf , len , filp -> f_pos , be32_to_cpu ( entry . folder . id ) , DT_DIR ) ) break ; } else if ( type == HFSPLUS_FILE ) { if ( fd . entrylength < sizeof ( struct hfsplus_cat_file ) ) { printk ( KERN_ERR "hfs:<S2SV_blank>small<S2SV_blank>file<S2SV_blank>entry\\n" ) ; err = - EIO ; goto out ; } if ( filldir ( dirent , strbuf , len , filp -> f_pos , be32_to_cpu ( entry . file . id ) , DT_REG ) ) break ; } else { printk ( KERN_ERR "hfs:<S2SV_blank>bad<S2SV_blank>catalog<S2SV_blank>entry<S2SV_blank>type\\n" ) ; err = - EIO ; goto out ; } next : filp -> f_pos ++ ; if ( filp -> f_pos >= inode -> i_size ) goto out ; err = hfs_brec_goto ( & fd , 1 ) ; if ( err ) goto out ; } rd = filp -> private_data ; if ( ! rd ) { rd = kmalloc ( sizeof ( struct hfsplus_readdir_data ) , GFP_KERNEL ) ; if ( ! rd ) { err = - ENOMEM ; goto out ; } filp -> private_data = rd ; rd -> file = filp ; list_add ( & rd -> list , & HFSPLUS_I ( inode ) -> open_dir_list ) ; } memcpy ( & rd -> key , fd . key , sizeof ( struct hfsplus_cat_key ) ) ; out : hfs_find_exit ( & fd ) ; return err ; }
<S2SV_ModStart> case 1 : if ( fd . entrylength > sizeof ( entry ) || fd . entrylength < 0 ) { err = - EIO ; goto out ; } <S2SV_ModStart> out ; } if ( fd . entrylength > sizeof ( entry ) || fd . entrylength < 0 ) { err = - EIO ; goto out ; }
torvalds@linux/6f24f892871acc47b40dd594c63606a17c714f77
CVE-2012-2319
https://github.com/torvalds/linux/commit/6f24f892871acc47b40dd594c63606a17c714f77
2012-05-17T11:00Z
119
CWE-264
CWE-264 static struct net_device * _init_airo_card ( unsigned short irq , int port , int is_pcmcia , struct pci_dev * pci , struct device * dmdev ) { struct net_device * dev ; struct airo_info * ai ; int i , rc ; CapabilityRid cap_rid ; dev = alloc_netdev ( sizeof ( * ai ) , "" , ether_setup ) ; if ( ! dev ) { airo_print_err ( "" , "Couldn\'t<S2SV_blank>alloc_etherdev" ) ; return NULL ; } ai = dev -> ml_priv = netdev_priv ( dev ) ; ai -> wifidev = NULL ; ai -> flags = 1 << FLAG_RADIO_DOWN ; ai -> jobs = 0 ; ai -> dev = dev ; if ( pci && ( pci -> device == 0x5000 || pci -> device == 0xa504 ) ) { airo_print_dbg ( "" , "Found<S2SV_blank>an<S2SV_blank>MPI350<S2SV_blank>card" ) ; set_bit ( FLAG_MPI , & ai -> flags ) ; } spin_lock_init ( & ai -> aux_lock ) ; sema_init ( & ai -> sem , 1 ) ; ai -> config . len = 0 ; ai -> pci = pci ; init_waitqueue_head ( & ai -> thr_wait ) ; ai -> tfm = NULL ; add_airo_dev ( ai ) ; if ( airo_networks_allocate ( ai ) ) goto err_out_free ; airo_networks_initialize ( ai ) ; skb_queue_head_init ( & ai -> txq ) ; if ( test_bit ( FLAG_MPI , & ai -> flags ) ) dev -> netdev_ops = & mpi_netdev_ops ; else dev -> netdev_ops = & airo_netdev_ops ; dev -> wireless_handlers = & airo_handler_def ; ai -> wireless_data . spy_data = & ai -> spy_data ; dev -> wireless_data = & ai -> wireless_data ; dev -> irq = irq ; dev -> base_addr = port ; <S2SV_StartBug> SET_NETDEV_DEV ( dev , dmdev ) ; <S2SV_EndBug> reset_card ( dev , 1 ) ; msleep ( 400 ) ; if ( ! is_pcmcia ) { if ( ! request_region ( dev -> base_addr , 64 , DRV_NAME ) ) { rc = - EBUSY ; airo_print_err ( dev -> name , "Couldn\'t<S2SV_blank>request<S2SV_blank>region" ) ; goto err_out_nets ; } } if ( test_bit ( FLAG_MPI , & ai -> flags ) ) { if ( mpi_map_card ( ai , pci ) ) { airo_print_err ( "" , "Could<S2SV_blank>not<S2SV_blank>map<S2SV_blank>memory" ) ; goto err_out_res ; } } if ( probe ) { if ( setup_card ( ai , dev -> dev_addr , 1 ) != SUCCESS ) { airo_print_err ( dev -> name , "MAC<S2SV_blank>could<S2SV_blank>not<S2SV_blank>be<S2SV_blank>enabled" ) ; rc = - EIO ; goto err_out_map ; } } else if ( ! test_bit ( FLAG_MPI , & ai -> flags ) ) { ai -> bap_read = fast_bap_read ; set_bit ( FLAG_FLASHING , & ai -> flags ) ; } strcpy ( dev -> name , "eth%d" ) ; rc = register_netdev ( dev ) ; if ( rc ) { airo_print_err ( dev -> name , "Couldn\'t<S2SV_blank>register_netdev" ) ; goto err_out_map ; } ai -> wifidev = init_wifidev ( ai , dev ) ; if ( ! ai -> wifidev ) goto err_out_reg ; rc = readCapabilityRid ( ai , & cap_rid , 1 ) ; if ( rc != SUCCESS ) { rc = - EIO ; goto err_out_wifi ; } ai -> wep_capable = ( cap_rid . softCap & cpu_to_le16 ( 0x02 ) ) ? 1 : 0 ; ai -> max_wep_idx = ( cap_rid . softCap & cpu_to_le16 ( 0x80 ) ) ? 3 : 0 ; airo_print_info ( dev -> name , "Firmware<S2SV_blank>version<S2SV_blank>%x.%x.%02d" , ( ( le16_to_cpu ( cap_rid . softVer ) >> 8 ) & 0xF ) , ( le16_to_cpu ( cap_rid . softVer ) & 0xFF ) , le16_to_cpu ( cap_rid . softSubVer ) ) ; if ( le16_to_cpu ( cap_rid . softVer ) > 0x530 || ( le16_to_cpu ( cap_rid . softVer ) == 0x530 && le16_to_cpu ( cap_rid . softSubVer ) >= 17 ) ) { airo_print_info ( ai -> dev -> name , "WPA<S2SV_blank>supported." ) ; set_bit ( FLAG_WPA_CAPABLE , & ai -> flags ) ; ai -> bssListFirst = RID_WPA_BSSLISTFIRST ; ai -> bssListNext = RID_WPA_BSSLISTNEXT ; ai -> bssListRidLen = sizeof ( BSSListRid ) ; } else { airo_print_info ( ai -> dev -> name , "WPA<S2SV_blank>unsupported<S2SV_blank>with<S2SV_blank>firmware<S2SV_blank>" "versions<S2SV_blank>older<S2SV_blank>than<S2SV_blank>5.30.17." ) ; ai -> bssListFirst = RID_BSSLISTFIRST ; ai -> bssListNext = RID_BSSLISTNEXT ; ai -> bssListRidLen = sizeof ( BSSListRid ) - sizeof ( BSSListRidExtra ) ; } set_bit ( FLAG_REGISTERED , & ai -> flags ) ; airo_print_info ( dev -> name , "MAC<S2SV_blank>enabled<S2SV_blank>%pM" , dev -> dev_addr ) ; if ( probe && ! test_bit ( FLAG_MPI , & ai -> flags ) ) for ( i = 0 ; i < MAX_FIDS ; i ++ ) ai -> fids [ i ] = transmit_allocate ( ai , AIRO_DEF_MTU , i >= MAX_FIDS / 2 ) ; if ( setup_proc_entry ( dev , dev -> ml_priv ) < 0 ) goto err_out_wifi ; return dev ; err_out_wifi : unregister_netdev ( ai -> wifidev ) ; free_netdev ( ai -> wifidev ) ; err_out_reg : unregister_netdev ( dev ) ; err_out_map : if ( test_bit ( FLAG_MPI , & ai -> flags ) && pci ) { pci_free_consistent ( pci , PCI_SHARED_LEN , ai -> shared , ai -> shared_dma ) ; iounmap ( ai -> pciaux ) ; iounmap ( ai -> pcimem ) ; mpi_unmap_card ( ai -> pci ) ; } err_out_res : if ( ! is_pcmcia ) release_region ( dev -> base_addr , 64 ) ; err_out_nets : airo_networks_free ( ai ) ; err_out_free : del_airo_dev ( ai ) ; free_netdev ( dev ) ; return NULL ; }
<S2SV_ModStart> = port ; dev -> priv_flags &= ~ IFF_TX_SKB_SHARING ;
torvalds@linux/550fd08c2cebad61c548def135f67aba284c6162
CVE-2011-4112
https://github.com/torvalds/linux/commit/550fd08c2cebad61c548def135f67aba284c6162
2012-05-17T11:00Z
120
CWE-119
CWE-119 static int get_siz ( Jpeg2000DecoderContext * s ) { int i ; int ncomponents ; uint32_t log2_chroma_wh = 0 ; const enum AVPixelFormat * possible_fmts = NULL ; int possible_fmts_nb = 0 ; if ( bytestream2_get_bytes_left ( & s -> g ) < 36 ) return AVERROR_INVALIDDATA ; s -> avctx -> profile = bytestream2_get_be16u ( & s -> g ) ; s -> width = bytestream2_get_be32u ( & s -> g ) ; s -> height = bytestream2_get_be32u ( & s -> g ) ; s -> image_offset_x = bytestream2_get_be32u ( & s -> g ) ; s -> image_offset_y = bytestream2_get_be32u ( & s -> g ) ; s -> tile_width = bytestream2_get_be32u ( & s -> g ) ; s -> tile_height = bytestream2_get_be32u ( & s -> g ) ; s -> tile_offset_x = bytestream2_get_be32u ( & s -> g ) ; s -> tile_offset_y = bytestream2_get_be32u ( & s -> g ) ; <S2SV_StartBug> ncomponents = bytestream2_get_be16u ( & s -> g ) ; <S2SV_EndBug> if ( ncomponents <= 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "Invalid<S2SV_blank>number<S2SV_blank>of<S2SV_blank>components:<S2SV_blank>%d\\n" , s -> ncomponents ) ; return AVERROR_INVALIDDATA ; } if ( ncomponents > 4 ) { avpriv_request_sample ( s -> avctx , "Support<S2SV_blank>for<S2SV_blank>%d<S2SV_blank>components" , s -> ncomponents ) ; return AVERROR_PATCHWELCOME ; } s -> ncomponents = ncomponents ; if ( s -> tile_width <= 0 || s -> tile_height <= 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "Invalid<S2SV_blank>tile<S2SV_blank>dimension<S2SV_blank>%dx%d.\\n" , s -> tile_width , s -> tile_height ) ; return AVERROR_INVALIDDATA ; } if ( bytestream2_get_bytes_left ( & s -> g ) < 3 * s -> ncomponents ) return AVERROR_INVALIDDATA ; for ( i = 0 ; i < s -> ncomponents ; i ++ ) { uint8_t x = bytestream2_get_byteu ( & s -> g ) ; s -> cbps [ i ] = ( x & 0x7f ) + 1 ; s -> precision = FFMAX ( s -> cbps [ i ] , s -> precision ) ; s -> sgnd [ i ] = ! ! ( x & 0x80 ) ; s -> cdx [ i ] = bytestream2_get_byteu ( & s -> g ) ; s -> cdy [ i ] = bytestream2_get_byteu ( & s -> g ) ; if ( ! s -> cdx [ i ] || s -> cdx [ i ] == 3 || s -> cdx [ i ] > 4 || ! s -> cdy [ i ] || s -> cdy [ i ] == 3 || s -> cdy [ i ] > 4 ) { av_log ( s -> avctx , AV_LOG_ERROR , "Invalid<S2SV_blank>sample<S2SV_blank>separation<S2SV_blank>%d/%d\\n" , s -> cdx [ i ] , s -> cdy [ i ] ) ; return AVERROR_INVALIDDATA ; } log2_chroma_wh |= s -> cdy [ i ] >> 1 << i * 4 | s -> cdx [ i ] >> 1 << i * 4 + 2 ; } s -> numXtiles = ff_jpeg2000_ceildiv ( s -> width - s -> tile_offset_x , s -> tile_width ) ; s -> numYtiles = ff_jpeg2000_ceildiv ( s -> height - s -> tile_offset_y , s -> tile_height ) ; if ( s -> numXtiles * ( uint64_t ) s -> numYtiles > INT_MAX / sizeof ( * s -> tile ) ) { s -> numXtiles = s -> numYtiles = 0 ; return AVERROR ( EINVAL ) ; } s -> tile = av_mallocz_array ( s -> numXtiles * s -> numYtiles , sizeof ( * s -> tile ) ) ; if ( ! s -> tile ) { s -> numXtiles = s -> numYtiles = 0 ; return AVERROR ( ENOMEM ) ; } for ( i = 0 ; i < s -> numXtiles * s -> numYtiles ; i ++ ) { Jpeg2000Tile * tile = s -> tile + i ; tile -> comp = av_mallocz ( s -> ncomponents * sizeof ( * tile -> comp ) ) ; if ( ! tile -> comp ) return AVERROR ( ENOMEM ) ; } s -> avctx -> width = ff_jpeg2000_ceildivpow2 ( s -> width - s -> image_offset_x , s -> reduction_factor ) ; s -> avctx -> height = ff_jpeg2000_ceildivpow2 ( s -> height - s -> image_offset_y , s -> reduction_factor ) ; if ( s -> avctx -> profile == FF_PROFILE_JPEG2000_DCINEMA_2K || s -> avctx -> profile == FF_PROFILE_JPEG2000_DCINEMA_4K ) { possible_fmts = xyz_pix_fmts ; possible_fmts_nb = FF_ARRAY_ELEMS ( xyz_pix_fmts ) ; } else { switch ( s -> colour_space ) { case 16 : possible_fmts = rgb_pix_fmts ; possible_fmts_nb = FF_ARRAY_ELEMS ( rgb_pix_fmts ) ; break ; case 17 : possible_fmts = gray_pix_fmts ; possible_fmts_nb = FF_ARRAY_ELEMS ( gray_pix_fmts ) ; break ; case 18 : possible_fmts = yuv_pix_fmts ; possible_fmts_nb = FF_ARRAY_ELEMS ( yuv_pix_fmts ) ; break ; default : possible_fmts = all_pix_fmts ; possible_fmts_nb = FF_ARRAY_ELEMS ( all_pix_fmts ) ; break ; } } for ( i = 0 ; i < possible_fmts_nb ; ++ i ) { if ( pix_fmt_match ( possible_fmts [ i ] , ncomponents , s -> precision , log2_chroma_wh , s -> pal8 ) ) { s -> avctx -> pix_fmt = possible_fmts [ i ] ; break ; } } if ( s -> avctx -> pix_fmt == AV_PIX_FMT_NONE ) { av_log ( s -> avctx , AV_LOG_ERROR , "Unknown<S2SV_blank>pix_fmt,<S2SV_blank>profile:<S2SV_blank>%d,<S2SV_blank>colour_space:<S2SV_blank>%d,<S2SV_blank>" "components:<S2SV_blank>%d,<S2SV_blank>precision:<S2SV_blank>%d,<S2SV_blank>" "cdx[1]:<S2SV_blank>%d,<S2SV_blank>cdy[1]:<S2SV_blank>%d,<S2SV_blank>cdx[2]:<S2SV_blank>%d,<S2SV_blank>cdy[2]:<S2SV_blank>%d\\n" , s -> avctx -> profile , s -> colour_space , ncomponents , s -> precision , ncomponents > 2 ? s -> cdx [ 1 ] : 0 , ncomponents > 2 ? s -> cdy [ 1 ] : 0 , ncomponents > 2 ? s -> cdx [ 2 ] : 0 , ncomponents > 2 ? s -> cdy [ 2 ] : 0 ) ; } s -> avctx -> bits_per_raw_sample = s -> precision ; return 0 ; }
<S2SV_ModStart> g ) ; if ( s -> image_offset_x || s -> image_offset_y ) { avpriv_request_sample ( s -> avctx , "Support<S2SV_blank>for<S2SV_blank>image<S2SV_blank>offsets" ) ; return AVERROR_PATCHWELCOME ; }
FFmpeg@FFmpeg/780669ef7c23c00836a24921fcc6b03be2b8ca4a
CVE-2013-7012
https://github.com/FFmpeg/FFmpeg/commit/780669ef7c23c00836a24921fcc6b03be2b8ca4a
2013-12-09T16:36Z
121
CWE-190
CWE-190 static void addArgumentToVtab ( Parse * pParse ) { if ( pParse -> sArg . z && pParse -> pNewTable ) { const char * z = ( const char * ) pParse -> sArg . z ; int n = pParse -> sArg . n ; sqlite3 * db = pParse -> db ; <S2SV_StartBug> addModuleArgument ( db , pParse -> pNewTable , sqlite3DbStrNDup ( db , z , n ) ) ; <S2SV_EndBug> } }
<S2SV_ModStart> ; addModuleArgument ( pParse <S2SV_ModEnd> , pParse ->
chromium@chromium/517ac71c9ee27f856f9becde8abea7d1604af9d4
CVE-2019-5827
https://github.com/chromium/chromium/commit/517ac71c9ee27f856f9becde8abea7d1604af9d4
2019-06-27T17:15Z
122
CWE-476
CWE-476 static void ov511_mode_init_regs ( struct sd * sd ) { struct gspca_dev * gspca_dev = ( struct gspca_dev * ) sd ; int hsegs , vsegs , packet_size , fps , needed ; int interlaced = 0 ; struct usb_host_interface * alt ; struct usb_interface * intf ; intf = usb_ifnum_to_if ( sd -> gspca_dev . dev , sd -> gspca_dev . iface ) ; alt = usb_altnum_to_altsetting ( intf , sd -> gspca_dev . alt ) ; if ( ! alt ) { gspca_err ( gspca_dev , "Couldn\'t<S2SV_blank>get<S2SV_blank>altsetting\\n" ) ; <S2SV_StartBug> sd -> gspca_dev . usb_err = - EIO ; <S2SV_EndBug> return ; } packet_size = le16_to_cpu ( alt -> endpoint [ 0 ] . desc . wMaxPacketSize ) ; reg_w ( sd , R51x_FIFO_PSIZE , packet_size >> 5 ) ; reg_w ( sd , R511_CAM_UV_EN , 0x01 ) ; reg_w ( sd , R511_SNAP_UV_EN , 0x01 ) ; reg_w ( sd , R511_SNAP_OPTS , 0x03 ) ; hsegs = ( sd -> gspca_dev . pixfmt . width >> 3 ) - 1 ; vsegs = ( sd -> gspca_dev . pixfmt . height >> 3 ) - 1 ; reg_w ( sd , R511_CAM_PXCNT , hsegs ) ; reg_w ( sd , R511_CAM_LNCNT , vsegs ) ; reg_w ( sd , R511_CAM_PXDIV , 0x00 ) ; reg_w ( sd , R511_CAM_LNDIV , 0x00 ) ; reg_w ( sd , R511_CAM_OPTS , 0x03 ) ; reg_w ( sd , R511_SNAP_PXCNT , hsegs ) ; reg_w ( sd , R511_SNAP_LNCNT , vsegs ) ; reg_w ( sd , R511_SNAP_PXDIV , 0x00 ) ; reg_w ( sd , R511_SNAP_LNDIV , 0x00 ) ; if ( frame_rate > 0 ) sd -> frame_rate = frame_rate ; switch ( sd -> sensor ) { case SEN_OV6620 : sd -> clockdiv = 3 ; break ; case SEN_OV7620 : case SEN_OV7620AE : case SEN_OV7640 : case SEN_OV7648 : case SEN_OV76BE : if ( sd -> gspca_dev . pixfmt . width == 320 ) interlaced = 1 ; case SEN_OV6630 : case SEN_OV7610 : case SEN_OV7670 : switch ( sd -> frame_rate ) { case 30 : case 25 : if ( sd -> gspca_dev . pixfmt . width != 640 ) { sd -> clockdiv = 0 ; break ; } default : sd -> clockdiv = 1 ; break ; case 10 : sd -> clockdiv = 2 ; break ; case 5 : sd -> clockdiv = 5 ; break ; } if ( interlaced ) { sd -> clockdiv = ( sd -> clockdiv + 1 ) * 2 - 1 ; if ( sd -> clockdiv > 10 ) sd -> clockdiv = 10 ; } break ; case SEN_OV8610 : sd -> clockdiv = 0 ; break ; } fps = ( interlaced ? 60 : 30 ) / ( sd -> clockdiv + 1 ) + 1 ; needed = fps * sd -> gspca_dev . pixfmt . width * sd -> gspca_dev . pixfmt . height * 3 / 2 ; if ( needed > 1000 * packet_size ) { reg_w ( sd , R511_COMP_EN , 0x07 ) ; reg_w ( sd , R511_COMP_LUT_EN , 0x03 ) ; } else { reg_w ( sd , R511_COMP_EN , 0x06 ) ; reg_w ( sd , R511_COMP_LUT_EN , 0x00 ) ; } reg_w ( sd , R51x_SYS_RESET , OV511_RESET_OMNICE ) ; reg_w ( sd , R51x_SYS_RESET , 0 ) ; }
<S2SV_ModStart> = - EIO ; return ; } if ( alt -> desc . bNumEndpoints < 1 ) { sd -> gspca_dev . usb_err = - ENODEV
torvalds@linux/998912346c0da53a6dbb71fab3a138586b596b30
CVE-2020-11608
https://github.com/torvalds/linux/commit/998912346c0da53a6dbb71fab3a138586b596b30
2020-04-07T14:15Z
123
CWE-362
CWE-362 struct snd_seq_client_port * snd_seq_create_port ( struct snd_seq_client * client , int port ) { unsigned long flags ; struct snd_seq_client_port * new_port , * p ; int num = - 1 ; if ( snd_BUG_ON ( ! client ) ) return NULL ; if ( client -> num_ports >= SNDRV_SEQ_MAX_PORTS ) { pr_warn ( "ALSA:<S2SV_blank>seq:<S2SV_blank>too<S2SV_blank>many<S2SV_blank>ports<S2SV_blank>for<S2SV_blank>client<S2SV_blank>%d\\n" , client -> number ) ; return NULL ; } new_port = kzalloc ( sizeof ( * new_port ) , GFP_KERNEL ) ; if ( ! new_port ) return NULL ; new_port -> addr . client = client -> number ; new_port -> addr . port = - 1 ; new_port -> owner = THIS_MODULE ; sprintf ( new_port -> name , "port-%d" , num ) ; snd_use_lock_init ( & new_port -> use_lock ) ; port_subs_info_init ( & new_port -> c_src ) ; port_subs_info_init ( & new_port -> c_dest ) ; <S2SV_StartBug> num = port >= 0 ? port : 0 ; <S2SV_EndBug> mutex_lock ( & client -> ports_mutex ) ; write_lock_irqsave ( & client -> ports_lock , flags ) ; list_for_each_entry ( p , & client -> ports_list_head , list ) { if ( p -> addr . port > num ) break ; if ( port < 0 ) num = p -> addr . port + 1 ; } list_add_tail ( & new_port -> list , & p -> list ) ; client -> num_ports ++ ; new_port -> addr . port = num ; <S2SV_StartBug> write_unlock_irqrestore ( & client -> ports_lock , flags ) ; <S2SV_EndBug> <S2SV_StartBug> mutex_unlock ( & client -> ports_mutex ) ; <S2SV_EndBug> sprintf ( new_port -> name , "port-%d" , num ) ; return new_port ; }
<S2SV_ModStart> c_dest ) ; snd_use_lock_use ( & new_port -> use_lock ) ; <S2SV_ModStart> = num ; sprintf ( new_port -> name , "port-%d" , num ) ; <S2SV_ModStart> client -> ports_mutex <S2SV_ModEnd> ) ; return
torvalds@linux/71105998845fb012937332fe2e806d443c09e026
CVE-2017-15265
https://github.com/torvalds/linux/commit/71105998845fb012937332fe2e806d443c09e026
2017-10-16T18:29Z
124
CWE-200
CWE-200 static int skcipher_recvmsg ( struct kiocb * unused , struct socket * sock , struct msghdr * msg , size_t ignored , int flags ) { struct sock * sk = sock -> sk ; struct alg_sock * ask = alg_sk ( sk ) ; struct skcipher_ctx * ctx = ask -> private ; unsigned bs = crypto_ablkcipher_blocksize ( crypto_ablkcipher_reqtfm ( & ctx -> req ) ) ; struct skcipher_sg_list * sgl ; struct scatterlist * sg ; unsigned long iovlen ; struct iovec * iov ; int err = - EAGAIN ; int used ; long copied = 0 ; <S2SV_StartBug> lock_sock ( sk ) ; <S2SV_EndBug> for ( iov = msg -> msg_iov , iovlen = msg -> msg_iovlen ; iovlen > 0 ; iovlen -- , iov ++ ) { unsigned long seglen = iov -> iov_len ; char __user * from = iov -> iov_base ; while ( seglen ) { sgl = list_first_entry ( & ctx -> tsgl , struct skcipher_sg_list , list ) ; sg = sgl -> sg ; while ( ! sg -> length ) sg ++ ; used = ctx -> used ; if ( ! used ) { err = skcipher_wait_for_data ( sk , flags ) ; if ( err ) goto unlock ; } used = min_t ( unsigned long , used , seglen ) ; used = af_alg_make_sg ( & ctx -> rsgl , from , used , 1 ) ; err = used ; if ( err < 0 ) goto unlock ; if ( ctx -> more || used < ctx -> used ) used -= used % bs ; err = - EINVAL ; if ( ! used ) goto free ; ablkcipher_request_set_crypt ( & ctx -> req , sg , ctx -> rsgl . sg , used , ctx -> iv ) ; err = af_alg_wait_for_completion ( ctx -> enc ? crypto_ablkcipher_encrypt ( & ctx -> req ) : crypto_ablkcipher_decrypt ( & ctx -> req ) , & ctx -> completion ) ; free : af_alg_free_sg ( & ctx -> rsgl ) ; if ( err ) goto unlock ; copied += used ; from += used ; seglen -= used ; skcipher_pull_sgl ( sk , used ) ; } } err = 0 ; unlock : skcipher_wmem_wakeup ( sk ) ; release_sock ( sk ) ; return copied ? : err ; }
<S2SV_ModStart> ( sk ) ; msg -> msg_namelen = 0
torvalds@linux/72a763d805a48ac8c0bf48fdb510e84c12de51fe
CVE-2013-3076
https://github.com/torvalds/linux/commit/72a763d805a48ac8c0bf48fdb510e84c12de51fe
2013-04-22T11:40Z
125
CWE-476
CWE-476 static long btrfs_ioctl_dev_info ( struct btrfs_fs_info * fs_info , void __user * arg ) { struct btrfs_ioctl_dev_info_args * di_args ; struct btrfs_device * dev ; int ret = 0 ; char * s_uuid = NULL ; di_args = memdup_user ( arg , sizeof ( * di_args ) ) ; if ( IS_ERR ( di_args ) ) return PTR_ERR ( di_args ) ; if ( ! btrfs_is_empty_uuid ( di_args -> uuid ) ) s_uuid = di_args -> uuid ; rcu_read_lock ( ) ; dev = btrfs_find_device ( fs_info -> fs_devices , di_args -> devid , s_uuid , <S2SV_StartBug> NULL ) ; <S2SV_EndBug> if ( ! dev ) { ret = - ENODEV ; goto out ; } di_args -> devid = dev -> devid ; di_args -> bytes_used = btrfs_device_get_bytes_used ( dev ) ; di_args -> total_bytes = btrfs_device_get_total_bytes ( dev ) ; memcpy ( di_args -> uuid , dev -> uuid , sizeof ( di_args -> uuid ) ) ; if ( dev -> name ) { strncpy ( di_args -> path , rcu_str_deref ( dev -> name ) , sizeof ( di_args -> path ) - 1 ) ; di_args -> path [ sizeof ( di_args -> path ) - 1 ] = 0 ; } else { di_args -> path [ 0 ] = '\\0' ; } out : rcu_read_unlock ( ) ; if ( ret == 0 && copy_to_user ( arg , di_args , sizeof ( * di_args ) ) ) ret = - EFAULT ; kfree ( di_args ) ; return ret ; }
<S2SV_ModStart> s_uuid , NULL , true
torvalds@linux/09ba3bc9dd150457c506e4661380a6183af651c1
CVE-2019-18885
https://github.com/torvalds/linux/commit/09ba3bc9dd150457c506e4661380a6183af651c1
2019-11-14T14:15Z
126
CWE-285
CWE-285 int ocfs2_set_acl ( handle_t * handle , struct inode * inode , struct buffer_head * di_bh , int type , struct posix_acl * acl , struct ocfs2_alloc_context * meta_ac , struct ocfs2_alloc_context * data_ac ) { int name_index ; void * value = NULL ; size_t size = 0 ; int ret ; if ( S_ISLNK ( inode -> i_mode ) ) return - EOPNOTSUPP ; switch ( type ) { case ACL_TYPE_ACCESS : name_index = OCFS2_XATTR_INDEX_POSIX_ACL_ACCESS ; if ( acl ) { <S2SV_StartBug> umode_t mode = inode -> i_mode ; <S2SV_EndBug> <S2SV_StartBug> ret = posix_acl_equiv_mode ( acl , & mode ) ; <S2SV_EndBug> if ( ret < 0 ) return ret ; if ( ret == 0 ) acl = NULL ; ret = ocfs2_acl_set_mode ( inode , di_bh , handle , mode ) ; if ( ret ) return ret ; } break ; case ACL_TYPE_DEFAULT : name_index = OCFS2_XATTR_INDEX_POSIX_ACL_DEFAULT ; if ( ! S_ISDIR ( inode -> i_mode ) ) return acl ? - EACCES : 0 ; break ; default : return - EINVAL ; } if ( acl ) { value = ocfs2_acl_to_xattr ( acl , & size ) ; if ( IS_ERR ( value ) ) return ( int ) PTR_ERR ( value ) ; } if ( handle ) ret = ocfs2_xattr_set_handle ( handle , inode , di_bh , name_index , "" , value , size , 0 , meta_ac , data_ac ) ; else ret = ocfs2_xattr_set ( inode , name_index , "" , value , size , 0 ) ; kfree ( value ) ; return ret ; }
<S2SV_ModStart> { umode_t mode ; ret = posix_acl_update_mode ( inode <S2SV_ModEnd> , & mode <S2SV_ModStart> , & mode , & acl ) ; if ( ret ) return ret <S2SV_ModEnd> ; ret =
torvalds@linux/073931017b49d9458aa351605b43a7e34598caef
CVE-2016-7097
https://github.com/torvalds/linux/commit/073931017b49d9458aa351605b43a7e34598caef
2016-10-16T21:59Z
127
CWE-125
CWE-125 void decnet_print ( netdissect_options * ndo , register const u_char * ap , register u_int length , register u_int caplen ) { register const union routehdr * rhp ; register int mflags ; int dst , src , hops ; u_int nsplen , pktlen ; const u_char * nspp ; if ( length < sizeof ( struct shorthdr ) ) { ND_PRINT ( ( ndo , "%s" , tstr ) ) ; return ; } ND_TCHECK2 ( * ap , sizeof ( short ) ) ; pktlen = EXTRACT_LE_16BITS ( ap ) ; if ( pktlen < sizeof ( struct shorthdr ) ) { ND_PRINT ( ( ndo , "%s" , tstr ) ) ; return ; } if ( pktlen > length ) { ND_PRINT ( ( ndo , "%s" , tstr ) ) ; return ; } length = pktlen ; rhp = ( const union routehdr * ) & ( ap [ sizeof ( short ) ] ) ; ND_TCHECK ( rhp -> rh_short . sh_flags ) ; mflags = EXTRACT_LE_8BITS ( rhp -> rh_short . sh_flags ) ; if ( mflags & RMF_PAD ) { u_int padlen = mflags & RMF_PADMASK ; if ( ndo -> ndo_vflag ) ND_PRINT ( ( ndo , "[pad:%d]<S2SV_blank>" , padlen ) ) ; if ( length < padlen + 2 ) { ND_PRINT ( ( ndo , "%s" , tstr ) ) ; return ; } ND_TCHECK2 ( ap [ sizeof ( short ) ] , padlen ) ; ap += padlen ; length -= padlen ; caplen -= padlen ; rhp = ( const union routehdr * ) & ( ap [ sizeof ( short ) ] ) ; <S2SV_StartBug> mflags = EXTRACT_LE_8BITS ( rhp -> rh_short . sh_flags ) ; <S2SV_EndBug> } if ( mflags & RMF_FVER ) { ND_PRINT ( ( ndo , "future-version-decnet" ) ) ; ND_DEFAULTPRINT ( ap , min ( length , caplen ) ) ; return ; } if ( mflags & RMF_CTLMSG ) { if ( ! print_decnet_ctlmsg ( ndo , rhp , length , caplen ) ) goto trunc ; return ; } switch ( mflags & RMF_MASK ) { case RMF_LONG : if ( length < sizeof ( struct longhdr ) ) { ND_PRINT ( ( ndo , "%s" , tstr ) ) ; return ; } ND_TCHECK ( rhp -> rh_long ) ; dst = EXTRACT_LE_16BITS ( rhp -> rh_long . lg_dst . dne_remote . dne_nodeaddr ) ; src = EXTRACT_LE_16BITS ( rhp -> rh_long . lg_src . dne_remote . dne_nodeaddr ) ; hops = EXTRACT_LE_8BITS ( rhp -> rh_long . lg_visits ) ; nspp = & ( ap [ sizeof ( short ) + sizeof ( struct longhdr ) ] ) ; nsplen = length - sizeof ( struct longhdr ) ; break ; case RMF_SHORT : ND_TCHECK ( rhp -> rh_short ) ; dst = EXTRACT_LE_16BITS ( rhp -> rh_short . sh_dst ) ; src = EXTRACT_LE_16BITS ( rhp -> rh_short . sh_src ) ; hops = ( EXTRACT_LE_8BITS ( rhp -> rh_short . sh_visits ) & VIS_MASK ) + 1 ; nspp = & ( ap [ sizeof ( short ) + sizeof ( struct shorthdr ) ] ) ; nsplen = length - sizeof ( struct shorthdr ) ; break ; default : ND_PRINT ( ( ndo , "unknown<S2SV_blank>message<S2SV_blank>flags<S2SV_blank>under<S2SV_blank>mask" ) ) ; ND_DEFAULTPRINT ( ( const u_char * ) ap , min ( length , caplen ) ) ; return ; } ND_PRINT ( ( ndo , "%s<S2SV_blank>><S2SV_blank>%s<S2SV_blank>%d<S2SV_blank>" , dnaddr_string ( ndo , src ) , dnaddr_string ( ndo , dst ) , pktlen ) ) ; if ( ndo -> ndo_vflag ) { if ( mflags & RMF_RQR ) ND_PRINT ( ( ndo , "RQR<S2SV_blank>" ) ) ; if ( mflags & RMF_RTS ) ND_PRINT ( ( ndo , "RTS<S2SV_blank>" ) ) ; if ( mflags & RMF_IE ) ND_PRINT ( ( ndo , "IE<S2SV_blank>" ) ) ; ND_PRINT ( ( ndo , "%d<S2SV_blank>hops<S2SV_blank>" , hops ) ) ; } if ( ! print_nsp ( ndo , nspp , nsplen ) ) goto trunc ; return ; trunc : ND_PRINT ( ( ndo , "%s" , tstr ) ) ; return ; }
<S2SV_ModStart> ] ) ; ND_TCHECK ( rhp -> rh_short . sh_flags ) ;
the-tcpdump-group@tcpdump/c6e0531b5def26ecf912e8de6ade86cbdaed3751
CVE-2017-12899
https://github.com/the-tcpdump-group/tcpdump/commit/c6e0531b5def26ecf912e8de6ade86cbdaed3751
2017-09-14T06:29Z
128
CWE-000
CWE-000 int main ( int argc , char * argv [ ] ) { int result ; int infoOnly = 0 ; int writeToStdio = 0 ; int readFromStdin = 0 ; int object_type = LC ; int def_srate = 0 ; int downMatrix = 0 ; int format = 1 ; int outputFormat = FAAD_FMT_16BIT ; int outfile_set = 0 ; int adts_out = 0 ; int old_format = 0 ; int showHelp = 0 ; int mp4file = 0 ; int noGapless = 0 ; char * fnp ; <S2SV_StartBug> char aacFileName [ 255 ] ; <S2SV_EndBug> char audioFileName [ 255 ] ; char adtsFileName [ 255 ] ; unsigned char header [ 8 ] ; float length = 0 ; FILE * hMP4File ; # ifdef _WIN32 long begin ; # else clock_t begin ; # endif unsigned long cap = NeAACDecGetCapabilities ( ) ; progName = argv [ 0 ] ; while ( 1 ) { int c = - 1 ; int option_index = 0 ; static struct option long_options [ ] = { { "quiet" , 0 , 0 , 'q' } , { "outfile" , 0 , 0 , 'o' } , { "adtsout" , 0 , 0 , 'a' } , { "oldformat" , 0 , 0 , 't' } , { "format" , 0 , 0 , 'f' } , { "bits" , 0 , 0 , 'b' } , { "samplerate" , 0 , 0 , 's' } , { "objecttype" , 0 , 0 , 'l' } , { "downmix" , 0 , 0 , 'd' } , { "info" , 0 , 0 , 'i' } , { "stdio" , 0 , 0 , 'w' } , { "stdio" , 0 , 0 , 'g' } , { "help" , 0 , 0 , 'h' } , { 0 , 0 , 0 , 0 } } ; c = getopt_long ( argc , argv , "o:a:s:f:b:l:wgdhitq" , long_options , & option_index ) ; if ( c == - 1 ) break ; switch ( c ) { case 'o' : if ( optarg ) { outfile_set = 1 ; <S2SV_StartBug> strcpy ( audioFileName , optarg ) ; <S2SV_EndBug> } break ; case 'a' : if ( optarg ) { adts_out = 1 ; <S2SV_StartBug> strcpy ( adtsFileName , optarg ) ; <S2SV_EndBug> } break ; case 's' : if ( optarg ) { char dr [ 10 ] ; if ( sscanf ( optarg , "%s" , dr ) < 1 ) { def_srate = 0 ; } else { def_srate = atoi ( dr ) ; } } break ; case 'f' : if ( optarg ) { char dr [ 10 ] ; if ( sscanf ( optarg , "%s" , dr ) < 1 ) { format = 1 ; } else { format = atoi ( dr ) ; if ( ( format < 1 ) || ( format > 2 ) ) showHelp = 1 ; } } break ; case 'b' : if ( optarg ) { char dr [ 10 ] ; if ( sscanf ( optarg , "%s" , dr ) < 1 ) { outputFormat = FAAD_FMT_16BIT ; } else { outputFormat = atoi ( dr ) ; if ( ( outputFormat < 1 ) || ( outputFormat > 5 ) ) showHelp = 1 ; } } break ; case 'l' : if ( optarg ) { char dr [ 10 ] ; if ( sscanf ( optarg , "%s" , dr ) < 1 ) { object_type = LC ; } else { object_type = atoi ( dr ) ; if ( ( object_type != LC ) && ( object_type != MAIN ) && ( object_type != LTP ) && ( object_type != LD ) ) { showHelp = 1 ; } } } break ; case 't' : old_format = 1 ; break ; case 'd' : downMatrix = 1 ; break ; case 'w' : writeToStdio = 1 ; break ; case 'g' : noGapless = 1 ; break ; case 'i' : infoOnly = 1 ; break ; case 'h' : showHelp = 1 ; break ; case 'q' : quiet = 1 ; break ; default : break ; } } faad_fprintf ( stderr , "<S2SV_blank>***********<S2SV_blank>Ahead<S2SV_blank>Software<S2SV_blank>MPEG-4<S2SV_blank>AAC<S2SV_blank>Decoder<S2SV_blank>V%s<S2SV_blank>******************\\n\\n" , FAAD2_VERSION ) ; faad_fprintf ( stderr , "<S2SV_blank>Build:<S2SV_blank>%s\\n" , __DATE__ ) ; faad_fprintf ( stderr , "<S2SV_blank>Copyright<S2SV_blank>2002-2004:<S2SV_blank>Ahead<S2SV_blank>Software<S2SV_blank>AG\\n" ) ; faad_fprintf ( stderr , "<S2SV_blank>http://www.audiocoding.com\\n" ) ; if ( cap & FIXED_POINT_CAP ) faad_fprintf ( stderr , "<S2SV_blank>Fixed<S2SV_blank>point<S2SV_blank>version\\n" ) ; else faad_fprintf ( stderr , "<S2SV_blank>Floating<S2SV_blank>point<S2SV_blank>version\\n" ) ; faad_fprintf ( stderr , "\\n" ) ; faad_fprintf ( stderr , "<S2SV_blank>This<S2SV_blank>program<S2SV_blank>is<S2SV_blank>free<S2SV_blank>software;<S2SV_blank>you<S2SV_blank>can<S2SV_blank>redistribute<S2SV_blank>it<S2SV_blank>and/or<S2SV_blank>modify\\n" ) ; faad_fprintf ( stderr , "<S2SV_blank>it<S2SV_blank>under<S2SV_blank>the<S2SV_blank>terms<S2SV_blank>of<S2SV_blank>the<S2SV_blank>GNU<S2SV_blank>General<S2SV_blank>Public<S2SV_blank>License.\\n" ) ; faad_fprintf ( stderr , "\\n" ) ; faad_fprintf ( stderr , "<S2SV_blank>**************************************************************************\\n\\n" ) ; if ( ( ( argc - optind ) < 1 ) || showHelp ) { usage ( ) ; return 1 ; } # if 0 if ( writeToStdio == 1 ) { format = 2 ; } <S2SV_StartBug> # endif <S2SV_EndBug> strcpy ( aacFileName , argv [ optind ] ) ; # ifdef _WIN32 begin = GetTickCount ( ) ; # else begin = clock ( ) ; # endif if ( ! writeToStdio && ! outfile_set ) { <S2SV_StartBug> strcpy ( audioFileName , aacFileName ) ; <S2SV_EndBug> fnp = ( char * ) strrchr ( audioFileName , '.' ) ; if ( fnp ) fnp [ 0 ] = '\\0' ; strcat ( audioFileName , file_ext [ format ] ) ; } if ( 0 == strcmp ( aacFileName , "-" ) ) { faad_fprintf ( stderr , "Reading<S2SV_blank>from<S2SV_blank>stdin:<S2SV_blank>%s\\n" , aacFileName ) ; readFromStdin = 1 ; hMP4File = stdin ; # ifdef _WIN32 setmode ( fileno ( stdin ) , O_BINARY ) ; # endif } else { mp4file = 0 ; hMP4File = fopen ( aacFileName , "rb" ) ; if ( ! hMP4File ) { faad_fprintf ( stderr , "Error<S2SV_blank>opening<S2SV_blank>file:<S2SV_blank>%s\\n" , aacFileName ) ; return 1 ; } } fread ( header , 1 , 8 , hMP4File ) ; if ( ! readFromStdin ) fclose ( hMP4File ) ; if ( header [ 4 ] == 'f' && header [ 5 ] == 't' && header [ 6 ] == 'y' && header [ 7 ] == 'p' ) mp4file = 1 ; if ( mp4file ) { result = decodeMP4file ( aacFileName , audioFileName , adtsFileName , writeToStdio , outputFormat , format , downMatrix , noGapless , infoOnly , adts_out , & length ) ; } else { if ( readFromStdin == 1 ) { ungetc ( header [ 7 ] , hMP4File ) ; ungetc ( header [ 6 ] , hMP4File ) ; ungetc ( header [ 5 ] , hMP4File ) ; ungetc ( header [ 4 ] , hMP4File ) ; ungetc ( header [ 3 ] , hMP4File ) ; ungetc ( header [ 2 ] , hMP4File ) ; ungetc ( header [ 1 ] , hMP4File ) ; ungetc ( header [ 0 ] , hMP4File ) ; } result = decodeAACfile ( aacFileName , audioFileName , adtsFileName , writeToStdio , def_srate , object_type , outputFormat , format , downMatrix , infoOnly , adts_out , old_format , & length ) ; <S2SV_StartBug> } <S2SV_EndBug> if ( ! result && ! infoOnly ) { # ifdef _WIN32 float dec_length = ( float ) ( GetTickCount ( ) - begin ) / 1000.0 ; SetConsoleTitle ( "FAAD" ) ; # else float dec_length = ( float ) ( clock ( ) - begin ) / ( float ) CLOCKS_PER_SEC ; # endif faad_fprintf ( stderr , "Decoding<S2SV_blank>%s<S2SV_blank>took:<S2SV_blank>%5.2f<S2SV_blank>sec.<S2SV_blank>%5.2fx<S2SV_blank>real-time.\\n" , aacFileName , dec_length , length / dec_length ) ; } <S2SV_StartBug> return 0 ; <S2SV_EndBug> }
<S2SV_ModStart> fnp ; char * aacFileName = NULL ; char * audioFileName = NULL ; char * adtsFileName = NULL <S2SV_ModEnd> ; unsigned char <S2SV_ModStart> = 1 ; audioFileName = ( char * ) malloc ( sizeof ( char ) * ( strlen ( optarg ) + 1 ) ) ; if ( audioFileName == NULL ) { faad_fprintf ( stderr , "Error<S2SV_blank>allocating<S2SV_blank>memory<S2SV_blank>for<S2SV_blank>audioFileName.\\n" ) ; return 1 ; } <S2SV_ModStart> = 1 ; adtsFileName = ( char * ) malloc ( sizeof ( char ) * ( strlen ( optarg ) + 1 ) ) ; if ( adtsFileName == NULL ) { faad_fprintf ( stderr , "Error<S2SV_blank>allocating<S2SV_blank>memory<S2SV_blank>for<S2SV_blank>adtsFileName.\\n" ) ; return 1 ; } <S2SV_ModStart> } # endif aacFileName = ( char * ) malloc ( sizeof ( char ) * ( strlen ( argv [ optind ] ) + 1 ) ) ; if ( aacFileName == NULL ) { faad_fprintf ( stderr , "Error<S2SV_blank>allocating<S2SV_blank>memory<S2SV_blank>for<S2SV_blank>aacFileName.\\n" ) ; return 1 ; } <S2SV_ModStart> outfile_set ) { audioFileName = ( char * ) malloc ( sizeof ( char ) * ( strlen ( aacFileName ) + strlen ( file_ext [ format ] ) + 1 ) ) ; if ( audioFileName == NULL ) { faad_fprintf ( stderr , "Error<S2SV_blank>allocating<S2SV_blank>memory<S2SV_blank>for<S2SV_blank>audioFileName.\\n" ) ; return 1 ; } <S2SV_ModStart> ) ; } if ( audioFileName != NULL ) free ( audioFileName ) ; if ( adtsFileName != NULL ) free ( adtsFileName ) ; <S2SV_ModStart> ) ; } if ( aacFileName != NULL ) free ( aacFileName ) ;
knik0@faad2/720f7004d6c4aabee19aad16e7c456ed76a3ebfa
CVE-2021-26567
https://github.com/knik0/faad2/commit/720f7004d6c4aabee19aad16e7c456ed76a3ebfa
2021-02-26T22:15Z
129
CWE-476
CWE-476 static void put_crypt_info ( struct fscrypt_info * ci ) { if ( ! ci ) return ; <S2SV_StartBug> key_put ( ci -> ci_keyring_key ) ; <S2SV_EndBug> crypto_free_skcipher ( ci -> ci_ctfm ) ; kmem_cache_free ( fscrypt_info_cachep , ci ) ; }
<S2SV_ModStart> ) return ; <S2SV_ModEnd> crypto_free_skcipher ( ci
torvalds@linux/1b53cf9815bb4744958d41f3795d5d5a1d365e2d
CVE-2017-7374
https://github.com/torvalds/linux/commit/1b53cf9815bb4744958d41f3795d5d5a1d365e2d
2017-03-31T20:59Z
130
CWE-134
CWE-134 static rsRetVal createSocket ( instanceConf_t * info , void * * sock ) { int rv ; sublist * sub ; * sock = zsocket_new ( s_context , info -> type ) ; if ( ! sock ) { errmsg . LogError ( 0 , RS_RET_INVALID_PARAMS , "zsocket_new<S2SV_blank>failed:<S2SV_blank>%s,<S2SV_blank>for<S2SV_blank>type<S2SV_blank>%d" , zmq_strerror ( errno ) , info -> type ) ; return RS_RET_INVALID_PARAMS ; } DBGPRINTF ( "imzmq3:<S2SV_blank>socket<S2SV_blank>of<S2SV_blank>type<S2SV_blank>%d<S2SV_blank>created<S2SV_blank>successfully\\n" , info -> type ) if ( info -> identity ) zsocket_set_identity ( * sock , info -> identity ) ; if ( info -> sndBuf > - 1 ) zsocket_set_sndbuf ( * sock , info -> sndBuf ) ; if ( info -> rcvBuf > - 1 ) zsocket_set_rcvbuf ( * sock , info -> rcvBuf ) ; if ( info -> linger > - 1 ) zsocket_set_linger ( * sock , info -> linger ) ; if ( info -> backlog > - 1 ) zsocket_set_backlog ( * sock , info -> backlog ) ; if ( info -> sndTimeout > - 1 ) zsocket_set_sndtimeo ( * sock , info -> sndTimeout ) ; if ( info -> rcvTimeout > - 1 ) zsocket_set_rcvtimeo ( * sock , info -> rcvTimeout ) ; if ( info -> maxMsgSize > - 1 ) zsocket_set_maxmsgsize ( * sock , info -> maxMsgSize ) ; if ( info -> rate > - 1 ) zsocket_set_rate ( * sock , info -> rate ) ; if ( info -> recoveryIVL > - 1 ) zsocket_set_recovery_ivl ( * sock , info -> recoveryIVL ) ; if ( info -> multicastHops > - 1 ) zsocket_set_multicast_hops ( * sock , info -> multicastHops ) ; if ( info -> reconnectIVL > - 1 ) zsocket_set_reconnect_ivl ( * sock , info -> reconnectIVL ) ; if ( info -> reconnectIVLMax > - 1 ) zsocket_set_reconnect_ivl_max ( * sock , info -> reconnectIVLMax ) ; if ( info -> ipv4Only > - 1 ) zsocket_set_ipv4only ( * sock , info -> ipv4Only ) ; if ( info -> affinity > - 1 ) zsocket_set_affinity ( * sock , info -> affinity ) ; if ( info -> sndHWM > - 1 ) zsocket_set_sndhwm ( * sock , info -> sndHWM ) ; if ( info -> rcvHWM > - 1 ) zsocket_set_rcvhwm ( * sock , info -> rcvHWM ) ; if ( info -> type == ZMQ_SUB ) { for ( sub = info -> subscriptions ; sub != NULL ; sub = sub -> next ) { zsocket_set_subscribe ( * sock , sub -> subscribe ) ; } } if ( info -> action == ACTION_CONNECT ) { <S2SV_StartBug> rv = zsocket_connect ( * sock , info -> description ) ; <S2SV_EndBug> if ( rv == - 1 ) { errmsg . LogError ( 0 , RS_RET_INVALID_PARAMS , "zmq_connect<S2SV_blank>using<S2SV_blank>%s<S2SV_blank>failed:<S2SV_blank>%s" , info -> description , zmq_strerror ( errno ) ) ; return RS_RET_INVALID_PARAMS ; } DBGPRINTF ( "imzmq3:<S2SV_blank>connect<S2SV_blank>for<S2SV_blank>%s<S2SV_blank>successful\\n" , info -> description ) ; } else { <S2SV_StartBug> rv = zsocket_bind ( * sock , info -> description ) ; <S2SV_EndBug> if ( rv == - 1 ) { errmsg . LogError ( 0 , RS_RET_INVALID_PARAMS , "zmq_bind<S2SV_blank>using<S2SV_blank>%s<S2SV_blank>failed:<S2SV_blank>%s" , info -> description , zmq_strerror ( errno ) ) ; return RS_RET_INVALID_PARAMS ; } DBGPRINTF ( "imzmq3:<S2SV_blank>bind<S2SV_blank>for<S2SV_blank>%s<S2SV_blank>successful\\n" , info -> description ) ; } return RS_RET_OK ; }
<S2SV_ModStart> * sock , "%s" , <S2SV_ModStart> * sock , "%s" ,
rsyslog@rsyslog/062d0c671a29f7c6f7dff4a2f1f35df375bbb30b
CVE-2017-12588
https://github.com/rsyslog/rsyslog/commit/062d0c671a29f7c6f7dff4a2f1f35df375bbb30b
2017-08-06T14:29Z
131
CWE-125
CWE-125 static struct sk_buff * ipv6_gso_segment ( struct sk_buff * skb , netdev_features_t features ) { struct sk_buff * segs = ERR_PTR ( - EINVAL ) ; struct ipv6hdr * ipv6h ; const struct net_offload * ops ; int proto ; struct frag_hdr * fptr ; unsigned int unfrag_ip6hlen ; unsigned int payload_len ; u8 * prevhdr ; int offset = 0 ; bool encap , udpfrag ; int nhoff ; bool gso_partial ; skb_reset_network_header ( skb ) ; nhoff = skb_network_header ( skb ) - skb_mac_header ( skb ) ; if ( unlikely ( ! pskb_may_pull ( skb , sizeof ( * ipv6h ) ) ) ) goto out ; encap = SKB_GSO_CB ( skb ) -> encap_level > 0 ; if ( encap ) features &= skb -> dev -> hw_enc_features ; SKB_GSO_CB ( skb ) -> encap_level += sizeof ( * ipv6h ) ; ipv6h = ipv6_hdr ( skb ) ; __skb_pull ( skb , sizeof ( * ipv6h ) ) ; segs = ERR_PTR ( - EPROTONOSUPPORT ) ; proto = ipv6_gso_pull_exthdrs ( skb , ipv6h -> nexthdr ) ; if ( skb -> encapsulation && skb_shinfo ( skb ) -> gso_type & ( SKB_GSO_IPXIP4 | SKB_GSO_IPXIP6 ) ) udpfrag = proto == IPPROTO_UDP && encap ; else udpfrag = proto == IPPROTO_UDP && ! skb -> encapsulation ; ops = rcu_dereference ( inet6_offloads [ proto ] ) ; if ( likely ( ops && ops -> callbacks . gso_segment ) ) { skb_reset_transport_header ( skb ) ; segs = ops -> callbacks . gso_segment ( skb , features ) ; } if ( IS_ERR_OR_NULL ( segs ) ) goto out ; gso_partial = ! ! ( skb_shinfo ( segs ) -> gso_type & SKB_GSO_PARTIAL ) ; for ( skb = segs ; skb ; skb = skb -> next ) { ipv6h = ( struct ipv6hdr * ) ( skb_mac_header ( skb ) + nhoff ) ; if ( gso_partial ) payload_len = skb_shinfo ( skb ) -> gso_size + SKB_GSO_CB ( skb ) -> data_offset + skb -> head - ( unsigned char * ) ( ipv6h + 1 ) ; else payload_len = skb -> len - nhoff - sizeof ( * ipv6h ) ; ipv6h -> payload_len = htons ( payload_len ) ; skb -> network_header = ( u8 * ) ipv6h - skb -> head ; if ( udpfrag ) { unfrag_ip6hlen = ip6_find_1stfragopt ( skb , & prevhdr ) ; <S2SV_StartBug> fptr = ( struct frag_hdr * ) ( ( u8 * ) ipv6h + unfrag_ip6hlen ) ; <S2SV_EndBug> fptr -> frag_off = htons ( offset ) ; if ( skb -> next ) fptr -> frag_off |= htons ( IP6_MF ) ; offset += ( ntohs ( ipv6h -> payload_len ) - sizeof ( struct frag_hdr ) ) ; } if ( encap ) skb_reset_inner_headers ( skb ) ; } out : return segs ; }
<S2SV_ModStart> prevhdr ) ; if ( unfrag_ip6hlen < 0 ) return ERR_PTR ( unfrag_ip6hlen ) ;
torvalds@linux/2423496af35d94a87156b063ea5cedffc10a70a1
CVE-2017-9074
https://github.com/torvalds/linux/commit/2423496af35d94a87156b063ea5cedffc10a70a1
2017-05-19T07:29Z
132
CWE-000
CWE-000 struct sk_buff * nf_ct_frag6_gather ( struct sk_buff * skb , u32 user ) { struct sk_buff * clone ; struct net_device * dev = skb -> dev ; struct frag_hdr * fhdr ; struct nf_ct_frag6_queue * fq ; struct ipv6hdr * hdr ; int fhoff , nhoff ; u8 prevhdr ; struct sk_buff * ret_skb = NULL ; if ( ipv6_hdr ( skb ) -> payload_len == 0 ) { pr_debug ( "payload<S2SV_blank>len<S2SV_blank>=<S2SV_blank>0\\n" ) ; return skb ; } if ( find_prev_fhdr ( skb , & prevhdr , & nhoff , & fhoff ) < 0 ) return skb ; clone = skb_clone ( skb , GFP_ATOMIC ) ; if ( clone == NULL ) { pr_debug ( "Can\'t<S2SV_blank>clone<S2SV_blank>skb\\n" ) ; return skb ; } NFCT_FRAG6_CB ( clone ) -> orig = skb ; if ( ! pskb_may_pull ( clone , fhoff + sizeof ( * fhdr ) ) ) { pr_debug ( "message<S2SV_blank>is<S2SV_blank>too<S2SV_blank>short.\\n" ) ; goto ret_orig ; } skb_set_transport_header ( clone , fhoff ) ; hdr = ipv6_hdr ( clone ) ; fhdr = ( struct frag_hdr * ) skb_transport_header ( clone ) ; <S2SV_StartBug> if ( ! ( fhdr -> frag_off & htons ( 0xFFF9 ) ) ) { <S2SV_EndBug> pr_debug ( "Invalid<S2SV_blank>fragment<S2SV_blank>offset\\n" ) ; goto ret_orig ; } if ( atomic_read ( & nf_init_frags . mem ) > nf_init_frags . high_thresh ) nf_ct_frag6_evictor ( ) ; fq = fq_find ( fhdr -> identification , user , & hdr -> saddr , & hdr -> daddr ) ; if ( fq == NULL ) { pr_debug ( "Can\'t<S2SV_blank>find<S2SV_blank>and<S2SV_blank>can\'t<S2SV_blank>create<S2SV_blank>new<S2SV_blank>queue\\n" ) ; goto ret_orig ; } spin_lock_bh ( & fq -> q . lock ) ; if ( nf_ct_frag6_queue ( fq , clone , fhdr , nhoff ) < 0 ) { spin_unlock_bh ( & fq -> q . lock ) ; pr_debug ( "Can\'t<S2SV_blank>insert<S2SV_blank>skb<S2SV_blank>to<S2SV_blank>queue\\n" ) ; fq_put ( fq ) ; goto ret_orig ; } if ( fq -> q . last_in == ( INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN ) && fq -> q . meat == fq -> q . len ) { ret_skb = nf_ct_frag6_reasm ( fq , dev ) ; if ( ret_skb == NULL ) pr_debug ( "Can\'t<S2SV_blank>reassemble<S2SV_blank>fragmented<S2SV_blank>packets\\n" ) ; } spin_unlock_bh ( & fq -> q . lock ) ; fq_put ( fq ) ; return ret_skb ; ret_orig : kfree_skb ( clone ) ; return skb ; }
<S2SV_ModStart> ; if ( <S2SV_ModEnd> atomic_read ( &
torvalds@linux/9e2dcf72023d1447f09c47d77c99b0c49659e5ce
CVE-2012-2744
https://github.com/torvalds/linux/commit/9e2dcf72023d1447f09c47d77c99b0c49659e5ce
2012-08-09T10:29Z
133
CWE-119
CWE-119 static av_cold int xpm_decode_close ( AVCodecContext * avctx ) { XPMDecContext * x = avctx -> priv_data ; av_freep ( & x -> pixels ) ; <S2SV_StartBug> return 0 ; <S2SV_EndBug> }
<S2SV_ModStart> pixels ) ; av_freep ( & x -> buf ) ; x -> buf_size = 0 ;
FFmpeg@FFmpeg/cb243972b121b1ae6b60a78ff55a0506c69f3879
CVE-2017-9990
https://github.com/FFmpeg/FFmpeg/commit/cb243972b121b1ae6b60a78ff55a0506c69f3879
2017-06-28T06:29Z
134
CWE-436
CWE-436 static void flatpak_proxy_client_init ( FlatpakProxyClient * client ) { init_side ( client , & client -> client_side ) ; init_side ( client , & client -> bus_side ) ; <S2SV_StartBug> client -> auth_end_offset = AUTH_END_INIT_OFFSET ; <S2SV_EndBug> client -> rewrite_reply = g_hash_table_new_full ( g_direct_hash , g_direct_equal , NULL , g_object_unref ) ; client -> get_owner_reply = g_hash_table_new_full ( g_direct_hash , g_direct_equal , NULL , g_free ) ; client -> unique_id_policy = g_hash_table_new_full ( g_str_hash , g_str_equal , g_free , NULL ) ; }
<S2SV_ModStart> ; client -> auth_buffer = g_byte_array_new ( ) <S2SV_ModEnd> ; client ->
flatpak@flatpak/52346bf187b5a7f1c0fe9075b328b7ad6abe78f6
CVE-2018-6560
https://github.com/flatpak/flatpak/commit/52346bf187b5a7f1c0fe9075b328b7ad6abe78f6
2018-02-02T14:29Z
135
CWE-787
CWE-787 static void write_version ( FILE * fp , const char * fname , const char * dirname , xref_t * xref ) { long start ; char * c , * new_fname , data ; FILE * new_fp ; start = ftell ( fp ) ; if ( ( c = strstr ( fname , ".pdf" ) ) ) * c = '\\0' ; <S2SV_StartBug> new_fname = malloc ( strlen ( fname ) + strlen ( dirname ) + 16 ) ; <S2SV_EndBug> snprintf ( new_fname , strlen ( fname ) + strlen ( dirname ) + 16 , "%s/%s-version-%d.pdf" , dirname , fname , xref -> version ) ; if ( ! ( new_fp = fopen ( new_fname , "w" ) ) ) { ERR ( "Could<S2SV_blank>not<S2SV_blank>create<S2SV_blank>file<S2SV_blank>\'%s\'\\n" , new_fname ) ; fseek ( fp , start , SEEK_SET ) ; free ( new_fname ) ; return ; } fseek ( fp , 0 , SEEK_SET ) ; while ( fread ( & data , 1 , 1 , fp ) ) fwrite ( & data , 1 , 1 , new_fp ) ; fprintf ( new_fp , "\\r\\nstartxref\\r\\n%ld\\r\\n%%%%EOF" , xref -> start ) ; fclose ( new_fp ) ; free ( new_fname ) ; fseek ( fp , start , SEEK_SET ) ; }
<S2SV_ModStart> ; new_fname = safe_calloc <S2SV_ModEnd> ( strlen (
enferex@pdfresurrect/0c4120fffa3dffe97b95c486a120eded82afe8a6
CVE-2019-14934
https://github.com/enferex/pdfresurrect/commit/0c4120fffa3dffe97b95c486a120eded82afe8a6
2019-08-11T22:15Z
136
CWE-264
CWE-264 int generic_permission ( struct inode * inode , int mask ) { int ret ; ret = acl_permission_check ( inode , mask ) ; if ( ret != - EACCES ) return ret ; if ( S_ISDIR ( inode -> i_mode ) ) { <S2SV_StartBug> if ( inode_capable ( inode , CAP_DAC_OVERRIDE ) ) <S2SV_EndBug> return 0 ; if ( ! ( mask & MAY_WRITE ) ) <S2SV_StartBug> if ( inode_capable ( inode , CAP_DAC_READ_SEARCH ) ) <S2SV_EndBug> return 0 ; return - EACCES ; } if ( ! ( mask & MAY_EXEC ) || ( inode -> i_mode & S_IXUGO ) ) <S2SV_StartBug> if ( inode_capable ( inode , CAP_DAC_OVERRIDE ) ) <S2SV_EndBug> return 0 ; mask &= MAY_READ | MAY_WRITE | MAY_EXEC ; if ( mask == MAY_READ ) <S2SV_StartBug> if ( inode_capable ( inode , CAP_DAC_READ_SEARCH ) ) <S2SV_EndBug> return 0 ; return - EACCES ; }
<S2SV_ModStart> { if ( capable_wrt_inode_uidgid <S2SV_ModEnd> ( inode , <S2SV_ModStart> ) if ( capable_wrt_inode_uidgid <S2SV_ModEnd> ( inode , <S2SV_ModStart> ) if ( capable_wrt_inode_uidgid <S2SV_ModEnd> ( inode , <S2SV_ModStart> ) if ( capable_wrt_inode_uidgid <S2SV_ModEnd> ( inode ,
torvalds@linux/23adbe12ef7d3d4195e80800ab36b37bee28cd03
CVE-2014-4014
https://github.com/torvalds/linux/commit/23adbe12ef7d3d4195e80800ab36b37bee28cd03
2014-06-23T11:21Z
137
CWE-189
CWE-189 Pairs * hstoreArrayToPairs ( ArrayType * a , int * npairs ) { Datum * key_datums ; bool * key_nulls ; int key_count ; Pairs * key_pairs ; int bufsiz ; int i , j ; deconstruct_array ( a , TEXTOID , - 1 , false , 'i' , & key_datums , & key_nulls , & key_count ) ; if ( key_count == 0 ) { * npairs = 0 ; return NULL ; } <S2SV_StartBug> key_pairs = palloc ( sizeof ( Pairs ) * key_count ) ; <S2SV_EndBug> for ( i = 0 , j = 0 ; i < key_count ; i ++ ) { if ( ! key_nulls [ i ] ) { key_pairs [ j ] . key = VARDATA ( key_datums [ i ] ) ; key_pairs [ j ] . keylen = VARSIZE ( key_datums [ i ] ) - VARHDRSZ ; key_pairs [ j ] . val = NULL ; key_pairs [ j ] . vallen = 0 ; key_pairs [ j ] . needfree = 0 ; key_pairs [ j ] . isnull = 1 ; j ++ ; } } * npairs = hstoreUniquePairs ( key_pairs , j , & bufsiz ) ; return key_pairs ; }
<S2SV_ModStart> NULL ; } if ( key_count > MaxAllocSize / sizeof ( Pairs ) ) ereport ( ERROR , ( errcode ( ERRCODE_PROGRAM_LIMIT_EXCEEDED ) , errmsg ( "number<S2SV_blank>of<S2SV_blank>pairs<S2SV_blank>(%d)<S2SV_blank>exceeds<S2SV_blank>the<S2SV_blank>maximum<S2SV_blank>allowed<S2SV_blank>(%d)" , key_count , ( int ) ( MaxAllocSize / sizeof ( Pairs ) ) ) ) ) ;
postgres@postgres/31400a673325147e1205326008e32135a78b4d8a
CVE-2014-2669
https://github.com/postgres/postgres/commit/31400a673325147e1205326008e32135a78b4d8a
2014-03-31T14:58Z
138
CWE-362
CWE-362 static int do_ip_setsockopt ( struct sock * sk , int level , int optname , char __user * optval , unsigned int optlen ) { struct inet_sock * inet = inet_sk ( sk ) ; int val = 0 , err ; if ( ( ( 1 << optname ) & ( ( 1 << IP_PKTINFO ) | ( 1 << IP_RECVTTL ) | ( 1 << IP_RECVOPTS ) | ( 1 << IP_RECVTOS ) | ( 1 << IP_RETOPTS ) | ( 1 << IP_TOS ) | ( 1 << IP_TTL ) | ( 1 << IP_HDRINCL ) | ( 1 << IP_MTU_DISCOVER ) | ( 1 << IP_RECVERR ) | ( 1 << IP_ROUTER_ALERT ) | ( 1 << IP_FREEBIND ) | ( 1 << IP_PASSSEC ) | ( 1 << IP_TRANSPARENT ) | ( 1 << IP_MINTTL ) | ( 1 << IP_NODEFRAG ) ) ) || optname == IP_MULTICAST_TTL || optname == IP_MULTICAST_ALL || optname == IP_MULTICAST_LOOP || optname == IP_RECVORIGDSTADDR ) { if ( optlen >= sizeof ( int ) ) { if ( get_user ( val , ( int __user * ) optval ) ) return - EFAULT ; } else if ( optlen >= sizeof ( char ) ) { unsigned char ucval ; if ( get_user ( ucval , ( unsigned char __user * ) optval ) ) return - EFAULT ; val = ( int ) ucval ; } } if ( ip_mroute_opt ( optname ) ) return ip_mroute_setsockopt ( sk , optname , optval , optlen ) ; err = 0 ; lock_sock ( sk ) ; switch ( optname ) { case IP_OPTIONS : { <S2SV_StartBug> struct ip_options * opt = NULL ; <S2SV_EndBug> if ( optlen > 40 ) goto e_inval ; err = ip_options_get_from_user ( sock_net ( sk ) , & opt , optval , optlen ) ; if ( err ) <S2SV_StartBug> break ; <S2SV_EndBug> if ( inet -> is_icsk ) { struct inet_connection_sock * icsk = inet_csk ( sk ) ; # if defined ( CONFIG_IPV6 ) || defined ( CONFIG_IPV6_MODULE ) if ( sk -> sk_family == PF_INET || ( ! ( ( 1 << sk -> sk_state ) & ( TCPF_LISTEN | TCPF_CLOSE ) ) && inet -> inet_daddr != LOOPBACK4_IPV6 ) ) { # endif <S2SV_StartBug> if ( inet -> opt ) <S2SV_EndBug> <S2SV_StartBug> icsk -> icsk_ext_hdr_len -= inet -> opt -> optlen ; <S2SV_EndBug> if ( opt ) <S2SV_StartBug> icsk -> icsk_ext_hdr_len += opt -> optlen ; <S2SV_EndBug> icsk -> icsk_sync_mss ( sk , icsk -> icsk_pmtu_cookie ) ; # if defined ( CONFIG_IPV6 ) || defined ( CONFIG_IPV6_MODULE ) } # endif } <S2SV_StartBug> opt = xchg ( & inet -> opt , opt ) ; <S2SV_EndBug> kfree ( opt ) ; break ; } case IP_PKTINFO : if ( val ) inet -> cmsg_flags |= IP_CMSG_PKTINFO ; else inet -> cmsg_flags &= ~ IP_CMSG_PKTINFO ; break ; case IP_RECVTTL : if ( val ) inet -> cmsg_flags |= IP_CMSG_TTL ; else inet -> cmsg_flags &= ~ IP_CMSG_TTL ; break ; case IP_RECVTOS : if ( val ) inet -> cmsg_flags |= IP_CMSG_TOS ; else inet -> cmsg_flags &= ~ IP_CMSG_TOS ; break ; case IP_RECVOPTS : if ( val ) inet -> cmsg_flags |= IP_CMSG_RECVOPTS ; else inet -> cmsg_flags &= ~ IP_CMSG_RECVOPTS ; break ; case IP_RETOPTS : if ( val ) inet -> cmsg_flags |= IP_CMSG_RETOPTS ; else inet -> cmsg_flags &= ~ IP_CMSG_RETOPTS ; break ; case IP_PASSSEC : if ( val ) inet -> cmsg_flags |= IP_CMSG_PASSSEC ; else inet -> cmsg_flags &= ~ IP_CMSG_PASSSEC ; break ; case IP_RECVORIGDSTADDR : if ( val ) inet -> cmsg_flags |= IP_CMSG_ORIGDSTADDR ; else inet -> cmsg_flags &= ~ IP_CMSG_ORIGDSTADDR ; break ; case IP_TOS : if ( sk -> sk_type == SOCK_STREAM ) { val &= ~ 3 ; val |= inet -> tos & 3 ; } if ( inet -> tos != val ) { inet -> tos = val ; sk -> sk_priority = rt_tos2priority ( val ) ; sk_dst_reset ( sk ) ; } break ; case IP_TTL : if ( optlen < 1 ) goto e_inval ; if ( val != - 1 && ( val < 0 || val > 255 ) ) goto e_inval ; inet -> uc_ttl = val ; break ; case IP_HDRINCL : if ( sk -> sk_type != SOCK_RAW ) { err = - ENOPROTOOPT ; break ; } inet -> hdrincl = val ? 1 : 0 ; break ; case IP_NODEFRAG : if ( sk -> sk_type != SOCK_RAW ) { err = - ENOPROTOOPT ; break ; } inet -> nodefrag = val ? 1 : 0 ; break ; case IP_MTU_DISCOVER : if ( val < IP_PMTUDISC_DONT || val > IP_PMTUDISC_PROBE ) goto e_inval ; inet -> pmtudisc = val ; break ; case IP_RECVERR : inet -> recverr = ! ! val ; if ( ! val ) skb_queue_purge ( & sk -> sk_error_queue ) ; break ; case IP_MULTICAST_TTL : if ( sk -> sk_type == SOCK_STREAM ) goto e_inval ; if ( optlen < 1 ) goto e_inval ; if ( val == - 1 ) val = 1 ; if ( val < 0 || val > 255 ) goto e_inval ; inet -> mc_ttl = val ; break ; case IP_MULTICAST_LOOP : if ( optlen < 1 ) goto e_inval ; inet -> mc_loop = ! ! val ; break ; case IP_MULTICAST_IF : { struct ip_mreqn mreq ; struct net_device * dev = NULL ; if ( sk -> sk_type == SOCK_STREAM ) goto e_inval ; if ( optlen < sizeof ( struct in_addr ) ) goto e_inval ; err = - EFAULT ; if ( optlen >= sizeof ( struct ip_mreqn ) ) { if ( copy_from_user ( & mreq , optval , sizeof ( mreq ) ) ) break ; } else { memset ( & mreq , 0 , sizeof ( mreq ) ) ; if ( optlen >= sizeof ( struct in_addr ) && copy_from_user ( & mreq . imr_address , optval , sizeof ( struct in_addr ) ) ) break ; } if ( ! mreq . imr_ifindex ) { if ( mreq . imr_address . s_addr == htonl ( INADDR_ANY ) ) { inet -> mc_index = 0 ; inet -> mc_addr = 0 ; err = 0 ; break ; } dev = ip_dev_find ( sock_net ( sk ) , mreq . imr_address . s_addr ) ; if ( dev ) mreq . imr_ifindex = dev -> ifindex ; } else dev = dev_get_by_index ( sock_net ( sk ) , mreq . imr_ifindex ) ; err = - EADDRNOTAVAIL ; if ( ! dev ) break ; dev_put ( dev ) ; err = - EINVAL ; if ( sk -> sk_bound_dev_if && mreq . imr_ifindex != sk -> sk_bound_dev_if ) break ; inet -> mc_index = mreq . imr_ifindex ; inet -> mc_addr = mreq . imr_address . s_addr ; err = 0 ; break ; } case IP_ADD_MEMBERSHIP : case IP_DROP_MEMBERSHIP : { struct ip_mreqn mreq ; err = - EPROTO ; if ( inet_sk ( sk ) -> is_icsk ) break ; if ( optlen < sizeof ( struct ip_mreq ) ) goto e_inval ; err = - EFAULT ; if ( optlen >= sizeof ( struct ip_mreqn ) ) { if ( copy_from_user ( & mreq , optval , sizeof ( mreq ) ) ) break ; } else { memset ( & mreq , 0 , sizeof ( mreq ) ) ; if ( copy_from_user ( & mreq , optval , sizeof ( struct ip_mreq ) ) ) break ; } if ( optname == IP_ADD_MEMBERSHIP ) err = ip_mc_join_group ( sk , & mreq ) ; else err = ip_mc_leave_group ( sk , & mreq ) ; break ; } case IP_MSFILTER : { struct ip_msfilter * msf ; if ( optlen < IP_MSFILTER_SIZE ( 0 ) ) goto e_inval ; if ( optlen > sysctl_optmem_max ) { err = - ENOBUFS ; break ; } msf = kmalloc ( optlen , GFP_KERNEL ) ; if ( ! msf ) { err = - ENOBUFS ; break ; } err = - EFAULT ; if ( copy_from_user ( msf , optval , optlen ) ) { kfree ( msf ) ; break ; } if ( msf -> imsf_numsrc >= 0x3ffffffcU || msf -> imsf_numsrc > sysctl_igmp_max_msf ) { kfree ( msf ) ; err = - ENOBUFS ; break ; } if ( IP_MSFILTER_SIZE ( msf -> imsf_numsrc ) > optlen ) { kfree ( msf ) ; err = - EINVAL ; break ; } err = ip_mc_msfilter ( sk , msf , 0 ) ; kfree ( msf ) ; break ; } case IP_BLOCK_SOURCE : case IP_UNBLOCK_SOURCE : case IP_ADD_SOURCE_MEMBERSHIP : case IP_DROP_SOURCE_MEMBERSHIP : { struct ip_mreq_source mreqs ; int omode , add ; if ( optlen != sizeof ( struct ip_mreq_source ) ) goto e_inval ; if ( copy_from_user ( & mreqs , optval , sizeof ( mreqs ) ) ) { err = - EFAULT ; break ; } if ( optname == IP_BLOCK_SOURCE ) { omode = MCAST_EXCLUDE ; add = 1 ; } else if ( optname == IP_UNBLOCK_SOURCE ) { omode = MCAST_EXCLUDE ; add = 0 ; } else if ( optname == IP_ADD_SOURCE_MEMBERSHIP ) { struct ip_mreqn mreq ; mreq . imr_multiaddr . s_addr = mreqs . imr_multiaddr ; mreq . imr_address . s_addr = mreqs . imr_interface ; mreq . imr_ifindex = 0 ; err = ip_mc_join_group ( sk , & mreq ) ; if ( err && err != - EADDRINUSE ) break ; omode = MCAST_INCLUDE ; add = 1 ; } else { omode = MCAST_INCLUDE ; add = 0 ; } err = ip_mc_source ( add , omode , sk , & mreqs , 0 ) ; break ; } case MCAST_JOIN_GROUP : case MCAST_LEAVE_GROUP : { struct group_req greq ; struct sockaddr_in * psin ; struct ip_mreqn mreq ; if ( optlen < sizeof ( struct group_req ) ) goto e_inval ; err = - EFAULT ; if ( copy_from_user ( & greq , optval , sizeof ( greq ) ) ) break ; psin = ( struct sockaddr_in * ) & greq . gr_group ; if ( psin -> sin_family != AF_INET ) goto e_inval ; memset ( & mreq , 0 , sizeof ( mreq ) ) ; mreq . imr_multiaddr = psin -> sin_addr ; mreq . imr_ifindex = greq . gr_interface ; if ( optname == MCAST_JOIN_GROUP ) err = ip_mc_join_group ( sk , & mreq ) ; else err = ip_mc_leave_group ( sk , & mreq ) ; break ; } case MCAST_JOIN_SOURCE_GROUP : case MCAST_LEAVE_SOURCE_GROUP : case MCAST_BLOCK_SOURCE : case MCAST_UNBLOCK_SOURCE : { struct group_source_req greqs ; struct ip_mreq_source mreqs ; struct sockaddr_in * psin ; int omode , add ; if ( optlen != sizeof ( struct group_source_req ) ) goto e_inval ; if ( copy_from_user ( & greqs , optval , sizeof ( greqs ) ) ) { err = - EFAULT ; break ; } if ( greqs . gsr_group . ss_family != AF_INET || greqs . gsr_source . ss_family != AF_INET ) { err = - EADDRNOTAVAIL ; break ; } psin = ( struct sockaddr_in * ) & greqs . gsr_group ; mreqs . imr_multiaddr = psin -> sin_addr . s_addr ; psin = ( struct sockaddr_in * ) & greqs . gsr_source ; mreqs . imr_sourceaddr = psin -> sin_addr . s_addr ; mreqs . imr_interface = 0 ; if ( optname == MCAST_BLOCK_SOURCE ) { omode = MCAST_EXCLUDE ; add = 1 ; } else if ( optname == MCAST_UNBLOCK_SOURCE ) { omode = MCAST_EXCLUDE ; add = 0 ; } else if ( optname == MCAST_JOIN_SOURCE_GROUP ) { struct ip_mreqn mreq ; psin = ( struct sockaddr_in * ) & greqs . gsr_group ; mreq . imr_multiaddr = psin -> sin_addr ; mreq . imr_address . s_addr = 0 ; mreq . imr_ifindex = greqs . gsr_interface ; err = ip_mc_join_group ( sk , & mreq ) ; if ( err && err != - EADDRINUSE ) break ; greqs . gsr_interface = mreq . imr_ifindex ; omode = MCAST_INCLUDE ; add = 1 ; } else { omode = MCAST_INCLUDE ; add = 0 ; } err = ip_mc_source ( add , omode , sk , & mreqs , greqs . gsr_interface ) ; break ; } case MCAST_MSFILTER : { struct sockaddr_in * psin ; struct ip_msfilter * msf = NULL ; struct group_filter * gsf = NULL ; int msize , i , ifindex ; if ( optlen < GROUP_FILTER_SIZE ( 0 ) ) goto e_inval ; if ( optlen > sysctl_optmem_max ) { err = - ENOBUFS ; break ; } gsf = kmalloc ( optlen , GFP_KERNEL ) ; if ( ! gsf ) { err = - ENOBUFS ; break ; } err = - EFAULT ; if ( copy_from_user ( gsf , optval , optlen ) ) goto mc_msf_out ; if ( gsf -> gf_numsrc >= 0x1ffffff || gsf -> gf_numsrc > sysctl_igmp_max_msf ) { err = - ENOBUFS ; goto mc_msf_out ; } if ( GROUP_FILTER_SIZE ( gsf -> gf_numsrc ) > optlen ) { err = - EINVAL ; goto mc_msf_out ; } msize = IP_MSFILTER_SIZE ( gsf -> gf_numsrc ) ; msf = kmalloc ( msize , GFP_KERNEL ) ; if ( ! msf ) { err = - ENOBUFS ; goto mc_msf_out ; } ifindex = gsf -> gf_interface ; psin = ( struct sockaddr_in * ) & gsf -> gf_group ; if ( psin -> sin_family != AF_INET ) { err = - EADDRNOTAVAIL ; goto mc_msf_out ; } msf -> imsf_multiaddr = psin -> sin_addr . s_addr ; msf -> imsf_interface = 0 ; msf -> imsf_fmode = gsf -> gf_fmode ; msf -> imsf_numsrc = gsf -> gf_numsrc ; err = - EADDRNOTAVAIL ; for ( i = 0 ; i < gsf -> gf_numsrc ; ++ i ) { psin = ( struct sockaddr_in * ) & gsf -> gf_slist [ i ] ; if ( psin -> sin_family != AF_INET ) goto mc_msf_out ; msf -> imsf_slist [ i ] = psin -> sin_addr . s_addr ; } kfree ( gsf ) ; gsf = NULL ; err = ip_mc_msfilter ( sk , msf , ifindex ) ; mc_msf_out : kfree ( msf ) ; kfree ( gsf ) ; break ; } case IP_MULTICAST_ALL : if ( optlen < 1 ) goto e_inval ; if ( val != 0 && val != 1 ) goto e_inval ; inet -> mc_all = val ; break ; case IP_ROUTER_ALERT : err = ip_ra_control ( sk , val ? 1 : 0 , NULL ) ; break ; case IP_FREEBIND : if ( optlen < 1 ) goto e_inval ; inet -> freebind = ! ! val ; break ; case IP_IPSEC_POLICY : case IP_XFRM_POLICY : err = - EPERM ; if ( ! capable ( CAP_NET_ADMIN ) ) break ; err = xfrm_user_policy ( sk , optname , optval , optlen ) ; break ; case IP_TRANSPARENT : if ( ! capable ( CAP_NET_ADMIN ) ) { err = - EPERM ; break ; } if ( optlen < 1 ) goto e_inval ; inet -> transparent = ! ! val ; break ; case IP_MINTTL : if ( optlen < 1 ) goto e_inval ; if ( val < 0 || val > 255 ) goto e_inval ; inet -> min_ttl = val ; break ; default : err = - ENOPROTOOPT ; break ; } release_sock ( sk ) ; return err ; e_inval : release_sock ( sk ) ; return - EINVAL ; }
<S2SV_ModStart> : { struct ip_options_rcu * old , <S2SV_ModEnd> * opt = <S2SV_ModStart> err ) break ; old = rcu_dereference_protected ( inet -> inet_opt , sock_owned_by_user ( sk ) ) <S2SV_ModStart> endif if ( old <S2SV_ModEnd> ) icsk -> <S2SV_ModStart> -> icsk_ext_hdr_len -= old -> opt . <S2SV_ModEnd> optlen ; if <S2SV_ModStart> += opt -> opt . <S2SV_ModStart> # endif } rcu_assign_pointer ( inet -> inet_opt , opt ) ; if ( old ) call_rcu ( & old -> rcu , opt_kfree_rcu <S2SV_ModEnd> ) ; break
torvalds@linux/f6d8bd051c391c1c0458a30b2a7abcd939329259
CVE-2012-3552
https://github.com/torvalds/linux/commit/f6d8bd051c391c1c0458a30b2a7abcd939329259
2012-10-03T11:02Z
139
CWE-125
CWE-125 static void <S2SV_StartBug> l2tp_framing_cap_print ( netdissect_options * ndo , const u_char * dat ) <S2SV_EndBug> { <S2SV_StartBug> const uint32_t * ptr = ( const uint32_t * ) dat ; <S2SV_EndBug> if ( EXTRACT_32BITS ( ptr ) & L2TP_FRAMING_CAP_ASYNC_MASK ) { ND_PRINT ( ( ndo , "A" ) ) ; } if ( EXTRACT_32BITS ( ptr ) & L2TP_FRAMING_CAP_SYNC_MASK ) { ND_PRINT ( ( ndo , "S" ) ) ; } }
<S2SV_ModStart> u_char * dat , u_int length <S2SV_ModStart> ) dat ; if ( length < 4 ) { ND_PRINT ( ( ndo , "AVP<S2SV_blank>too<S2SV_blank>short" ) ) ; return ; }
the-tcpdump-group@tcpdump/cc4a7391c616be7a64ed65742ef9ed3f106eb165
CVE-2017-13006
https://github.com/the-tcpdump-group/tcpdump/commit/cc4a7391c616be7a64ed65742ef9ed3f106eb165
2017-09-14T06:29Z
140
CWE-119
CWE-119 static int process_line ( URLContext * h , char * line , int line_count , int * new_location ) { HTTPContext * s = h -> priv_data ; const char * auto_method = h -> flags & AVIO_FLAG_READ ? "POST" : "GET" ; char * tag , * p , * end , * method , * resource , * version ; int ret ; if ( line [ 0 ] == '\\0' ) { s -> end_header = 1 ; return 0 ; } p = line ; if ( line_count == 0 ) { if ( s -> is_connected_server ) { method = p ; while ( * p && ! av_isspace ( * p ) ) p ++ ; * ( p ++ ) = '\\0' ; av_log ( h , AV_LOG_TRACE , "Received<S2SV_blank>method:<S2SV_blank>%s\\n" , method ) ; if ( s -> method ) { if ( av_strcasecmp ( s -> method , method ) ) { av_log ( h , AV_LOG_ERROR , "Received<S2SV_blank>and<S2SV_blank>expected<S2SV_blank>HTTP<S2SV_blank>method<S2SV_blank>do<S2SV_blank>not<S2SV_blank>match.<S2SV_blank>(%s<S2SV_blank>expected,<S2SV_blank>%s<S2SV_blank>received)\\n" , s -> method , method ) ; return ff_http_averror ( 400 , AVERROR ( EIO ) ) ; } } else { av_log ( h , AV_LOG_TRACE , "Autodetected<S2SV_blank>%s<S2SV_blank>HTTP<S2SV_blank>method\\n" , auto_method ) ; if ( av_strcasecmp ( auto_method , method ) ) { av_log ( h , AV_LOG_ERROR , "Received<S2SV_blank>and<S2SV_blank>autodetected<S2SV_blank>HTTP<S2SV_blank>method<S2SV_blank>did<S2SV_blank>not<S2SV_blank>match<S2SV_blank>" "(%s<S2SV_blank>autodetected<S2SV_blank>%s<S2SV_blank>received)\\n" , auto_method , method ) ; return ff_http_averror ( 400 , AVERROR ( EIO ) ) ; } if ( ! ( s -> method = av_strdup ( method ) ) ) return AVERROR ( ENOMEM ) ; } while ( av_isspace ( * p ) ) p ++ ; resource = p ; while ( ! av_isspace ( * p ) ) p ++ ; * ( p ++ ) = '\\0' ; av_log ( h , AV_LOG_TRACE , "Requested<S2SV_blank>resource:<S2SV_blank>%s\\n" , resource ) ; if ( ! ( s -> resource = av_strdup ( resource ) ) ) return AVERROR ( ENOMEM ) ; while ( av_isspace ( * p ) ) p ++ ; version = p ; while ( * p && ! av_isspace ( * p ) ) p ++ ; * p = '\\0' ; if ( av_strncasecmp ( version , "HTTP/" , 5 ) ) { av_log ( h , AV_LOG_ERROR , "Malformed<S2SV_blank>HTTP<S2SV_blank>version<S2SV_blank>string.\\n" ) ; return ff_http_averror ( 400 , AVERROR ( EIO ) ) ; } av_log ( h , AV_LOG_TRACE , "HTTP<S2SV_blank>version<S2SV_blank>string:<S2SV_blank>%s\\n" , version ) ; } else { while ( ! av_isspace ( * p ) && * p != '\\0' ) p ++ ; while ( av_isspace ( * p ) ) p ++ ; s -> http_code = strtol ( p , & end , 10 ) ; av_log ( h , AV_LOG_TRACE , "http_code=%d\\n" , s -> http_code ) ; if ( ( ret = check_http_code ( h , s -> http_code , end ) ) < 0 ) return ret ; } } else { while ( * p != '\\0' && * p != ':' ) p ++ ; if ( * p != ':' ) return 1 ; * p = '\\0' ; tag = line ; p ++ ; while ( av_isspace ( * p ) ) p ++ ; if ( ! av_strcasecmp ( tag , "Location" ) ) { if ( ( ret = parse_location ( s , p ) ) < 0 ) return ret ; * new_location = 1 ; <S2SV_StartBug> } else if ( ! av_strcasecmp ( tag , "Content-Length" ) && s -> filesize == - 1 ) { <S2SV_EndBug> <S2SV_StartBug> s -> filesize = strtoll ( p , NULL , 10 ) ; <S2SV_EndBug> } else if ( ! av_strcasecmp ( tag , "Content-Range" ) ) { parse_content_range ( h , p ) ; } else if ( ! av_strcasecmp ( tag , "Accept-Ranges" ) && ! strncmp ( p , "bytes" , 5 ) && s -> seekable == - 1 ) { h -> is_streamed = 0 ; } else if ( ! av_strcasecmp ( tag , "Transfer-Encoding" ) && ! av_strncasecmp ( p , "chunked" , 7 ) ) { <S2SV_StartBug> s -> filesize = - 1 ; <S2SV_EndBug> s -> chunksize = 0 ; } else if ( ! av_strcasecmp ( tag , "WWW-Authenticate" ) ) { <S2SV_StartBug> ff_http_auth_handle_header ( & s -> auth_state , tag , p ) ; <S2SV_EndBug> } else if ( ! av_strcasecmp ( tag , "Authentication-Info" ) ) { ff_http_auth_handle_header ( & s -> auth_state , tag , p ) ; } else if ( ! av_strcasecmp ( tag , "Proxy-Authenticate" ) ) { ff_http_auth_handle_header ( & s -> proxy_auth_state , tag , p ) ; } else if ( ! av_strcasecmp ( tag , "Connection" ) ) { if ( ! strcmp ( p , "close" ) ) s -> willclose = 1 ; } else if ( ! av_strcasecmp ( tag , "Server" ) ) { if ( ! av_strcasecmp ( p , "AkamaiGHost" ) ) { s -> is_akamai = 1 ; } else if ( ! av_strncasecmp ( p , "MediaGateway" , 12 ) ) { s -> is_mediagateway = 1 ; } } else if ( ! av_strcasecmp ( tag , "Content-Type" ) ) { av_free ( s -> mime_type ) ; s -> mime_type = av_strdup ( p ) ; } else if ( ! av_strcasecmp ( tag , "Set-Cookie" ) ) { if ( parse_cookie ( s , p , & s -> cookie_dict ) ) av_log ( h , AV_LOG_WARNING , "Unable<S2SV_blank>to<S2SV_blank>parse<S2SV_blank>\'%s\'\\n" , p ) ; } else if ( ! av_strcasecmp ( tag , "Icy-MetaInt" ) ) { <S2SV_StartBug> s -> icy_metaint = strtoll ( p , NULL , 10 ) ; <S2SV_EndBug> } else if ( ! av_strncasecmp ( tag , "Icy-" , 4 ) ) { if ( ( ret = parse_icy ( s , tag , p ) ) < 0 ) return ret ; } else if ( ! av_strcasecmp ( tag , "Content-Encoding" ) ) { if ( ( ret = parse_content_encoding ( h , p ) ) < 0 ) return ret ; } } return 1 ; }
<S2SV_ModStart> -> filesize == UINT64_MAX <S2SV_ModEnd> ) { s <S2SV_ModStart> -> filesize = strtoull <S2SV_ModEnd> ( p , <S2SV_ModStart> -> filesize = UINT64_MAX ; s -> chunksize = 0 ; } else if ( ! av_strcasecmp ( tag , "WWW-Authenticate" ) ) { ff_http_auth_handle_header ( & s -> auth_state , tag , p ) ; } else if ( ! av_strcasecmp ( tag , "Authentication-Info" ) ) { ff_http_auth_handle_header ( & s -> auth_state , tag , p ) ; } else if ( ! av_strcasecmp ( tag , "Proxy-Authenticate" ) ) { ff_http_auth_handle_header ( & s -> proxy_auth_state , tag , p ) ; } else if ( ! av_strcasecmp ( tag , "Connection" ) ) { if ( ! strcmp ( p , "close" ) ) s -> willclose = 1 ; } else if ( ! av_strcasecmp ( tag , "Server" ) ) { if ( ! av_strcasecmp ( p , "AkamaiGHost" ) ) { s -> is_akamai = 1 ; } else if ( ! av_strncasecmp ( p , "MediaGateway" , 12 ) ) { s -> is_mediagateway = 1 ; } } else if ( ! av_strcasecmp ( tag , "Content-Type" ) ) { av_free ( s -> mime_type ) ; s -> mime_type = av_strdup ( p ) ; } else if ( ! av_strcasecmp ( tag , "Set-Cookie" ) ) { if ( parse_cookie ( s , p , <S2SV_ModEnd> & s -> <S2SV_ModStart> & s -> <S2SV_ModEnd> cookie_dict ) ) <S2SV_ModStart> -> icy_metaint = strtoull <S2SV_ModEnd> ( p ,
FFmpeg@FFmpeg/2a05c8f813de6f2278827734bf8102291e7484aa
CVE-2016-10190
https://github.com/FFmpeg/FFmpeg/commit/2a05c8f813de6f2278827734bf8102291e7484aa
2017-02-09T15:59Z
141
CWE-119
CWE-119 MagickExport void * AcquireQuantumMemory ( const size_t count , const size_t quantum ) { size_t extent ; <S2SV_StartBug> if ( CheckMemoryOverflow ( count , quantum ) != MagickFalse ) <S2SV_EndBug> return ( ( void * ) NULL ) ; extent = count * quantum ; return ( AcquireMagickMemory ( extent ) ) ; }
<S2SV_ModStart> ; if ( HeapOverflowSanityCheck <S2SV_ModEnd> ( count ,
ImageMagick@ImageMagick/0474237508f39c4f783208123431815f1ededb76
CVE-2016-10067
https://github.com/ImageMagick/ImageMagick/commit/0474237508f39c4f783208123431815f1ededb76
2017-03-02T21:59Z
142
CWE-400
CWE-400 int xfs_setattr_nonsize ( struct xfs_inode * ip , struct iattr * iattr , int flags ) { xfs_mount_t * mp = ip -> i_mount ; struct inode * inode = VFS_I ( ip ) ; int mask = iattr -> ia_valid ; xfs_trans_t * tp ; int error ; kuid_t uid = GLOBAL_ROOT_UID , iuid = GLOBAL_ROOT_UID ; kgid_t gid = GLOBAL_ROOT_GID , igid = GLOBAL_ROOT_GID ; struct xfs_dquot * udqp = NULL , * gdqp = NULL ; struct xfs_dquot * olddquot1 = NULL , * olddquot2 = NULL ; ASSERT ( ( mask & ATTR_SIZE ) == 0 ) ; if ( XFS_IS_QUOTA_ON ( mp ) && ( mask & ( ATTR_UID | ATTR_GID ) ) ) { uint qflags = 0 ; if ( ( mask & ATTR_UID ) && XFS_IS_UQUOTA_ON ( mp ) ) { uid = iattr -> ia_uid ; qflags |= XFS_QMOPT_UQUOTA ; } else { uid = inode -> i_uid ; } if ( ( mask & ATTR_GID ) && XFS_IS_GQUOTA_ON ( mp ) ) { gid = iattr -> ia_gid ; qflags |= XFS_QMOPT_GQUOTA ; } else { gid = inode -> i_gid ; } ASSERT ( udqp == NULL ) ; ASSERT ( gdqp == NULL ) ; error = xfs_qm_vop_dqalloc ( ip , xfs_kuid_to_uid ( uid ) , xfs_kgid_to_gid ( gid ) , xfs_get_projid ( ip ) , qflags , & udqp , & gdqp , NULL ) ; if ( error ) return error ; } error = xfs_trans_alloc ( mp , & M_RES ( mp ) -> tr_ichange , 0 , 0 , 0 , & tp ) ; if ( error ) goto out_dqrele ; xfs_ilock ( ip , XFS_ILOCK_EXCL ) ; xfs_trans_ijoin ( tp , ip , 0 ) ; if ( mask & ( ATTR_UID | ATTR_GID ) ) { iuid = inode -> i_uid ; igid = inode -> i_gid ; gid = ( mask & ATTR_GID ) ? iattr -> ia_gid : igid ; uid = ( mask & ATTR_UID ) ? iattr -> ia_uid : iuid ; if ( XFS_IS_QUOTA_RUNNING ( mp ) && ( ( XFS_IS_UQUOTA_ON ( mp ) && ! uid_eq ( iuid , uid ) ) || ( XFS_IS_GQUOTA_ON ( mp ) && ! gid_eq ( igid , gid ) ) ) ) { ASSERT ( tp ) ; error = xfs_qm_vop_chown_reserve ( tp , ip , udqp , gdqp , NULL , capable ( CAP_FOWNER ) ? XFS_QMOPT_FORCE_RES : 0 ) ; if ( error ) goto out_cancel ; } } if ( mask & ( ATTR_UID | ATTR_GID ) ) { if ( ( inode -> i_mode & ( S_ISUID | S_ISGID ) ) && ! capable ( CAP_FSETID ) ) inode -> i_mode &= ~ ( S_ISUID | S_ISGID ) ; if ( ! uid_eq ( iuid , uid ) ) { if ( XFS_IS_QUOTA_RUNNING ( mp ) && XFS_IS_UQUOTA_ON ( mp ) ) { ASSERT ( mask & ATTR_UID ) ; ASSERT ( udqp ) ; olddquot1 = xfs_qm_vop_chown ( tp , ip , & ip -> i_udquot , udqp ) ; } ip -> i_d . di_uid = xfs_kuid_to_uid ( uid ) ; inode -> i_uid = uid ; } if ( ! gid_eq ( igid , gid ) ) { if ( XFS_IS_QUOTA_RUNNING ( mp ) && XFS_IS_GQUOTA_ON ( mp ) ) { ASSERT ( xfs_sb_version_has_pquotino ( & mp -> m_sb ) || ! XFS_IS_PQUOTA_ON ( mp ) ) ; ASSERT ( mask & ATTR_GID ) ; ASSERT ( gdqp ) ; olddquot2 = xfs_qm_vop_chown ( tp , ip , & ip -> i_gdquot , gdqp ) ; } ip -> i_d . di_gid = xfs_kgid_to_gid ( gid ) ; inode -> i_gid = gid ; } } if ( mask & ATTR_MODE ) xfs_setattr_mode ( ip , iattr ) ; if ( mask & ( ATTR_ATIME | ATTR_CTIME | ATTR_MTIME ) ) xfs_setattr_time ( ip , iattr ) ; xfs_trans_log_inode ( tp , ip , XFS_ILOG_CORE ) ; XFS_STATS_INC ( mp , xs_ig_attrchg ) ; if ( mp -> m_flags & XFS_MOUNT_WSYNC ) xfs_trans_set_sync ( tp ) ; error = xfs_trans_commit ( tp ) ; xfs_iunlock ( ip , XFS_ILOCK_EXCL ) ; xfs_qm_dqrele ( olddquot1 ) ; xfs_qm_dqrele ( olddquot2 ) ; xfs_qm_dqrele ( udqp ) ; xfs_qm_dqrele ( gdqp ) ; if ( error ) return error ; if ( ( mask & ATTR_MODE ) && ! ( flags & XFS_ATTR_NOACL ) ) { error = posix_acl_chmod ( inode , inode -> i_mode ) ; if ( error ) return error ; } return 0 ; out_cancel : xfs_trans_cancel ( tp ) ; <S2SV_StartBug> out_dqrele : <S2SV_EndBug> xfs_qm_dqrele ( udqp ) ; xfs_qm_dqrele ( gdqp ) ; return error ; }
<S2SV_ModStart> tp ) ; xfs_iunlock ( ip , XFS_ILOCK_EXCL ) ;
torvalds@linux/1fb254aa983bf190cfd685d40c64a480a9bafaee
CVE-2019-15538
https://github.com/torvalds/linux/commit/1fb254aa983bf190cfd685d40c64a480a9bafaee
2019-08-25T16:15Z
143
CWE-190
CWE-190 static size_t optsize ( lua_State * L , char opt , const char * * fmt ) { switch ( opt ) { case 'B' : case 'b' : return sizeof ( char ) ; case 'H' : case 'h' : return sizeof ( short ) ; case 'L' : case 'l' : return sizeof ( long ) ; case 'T' : return sizeof ( size_t ) ; case 'f' : return sizeof ( float ) ; case 'd' : return sizeof ( double ) ; case 'x' : return 1 ; <S2SV_StartBug> case 'c' : return getnum ( fmt , 1 ) ; <S2SV_EndBug> case 'i' : case 'I' : { <S2SV_StartBug> int sz = getnum ( fmt , sizeof ( int ) ) ; <S2SV_EndBug> if ( sz > MAXINTSIZE ) luaL_error ( L , "integral<S2SV_blank>size<S2SV_blank>%d<S2SV_blank>is<S2SV_blank>larger<S2SV_blank>than<S2SV_blank>limit<S2SV_blank>of<S2SV_blank>%d" , sz , MAXINTSIZE ) ; return sz ; } default : return 0 ; } }
<S2SV_ModStart> return getnum ( L , <S2SV_ModStart> = getnum ( L ,
antirez@redis/ef764dde1cca2f25d00686673d1bc89448819571
CVE-2020-14147
https://github.com/antirez/redis/commit/ef764dde1cca2f25d00686673d1bc89448819571
2020-06-15T18:15Z
144
CWE-119
CWE-119 static void mt_decode_macroblock ( VP8D_COMP * pbi , MACROBLOCKD * xd , unsigned int mb_idx ) { MB_PREDICTION_MODE mode ; int i ; # if CONFIG_ERROR_CONCEALMENT int corruption_detected = 0 ; <S2SV_StartBug> # endif <S2SV_EndBug> if ( xd -> mode_info_context -> mbmi . mb_skip_coeff ) { vp8_reset_mb_tokens_context ( xd ) ; } else if ( ! vp8dx_bool_error ( xd -> current_bc ) ) { int eobtotal ; eobtotal = vp8_decode_mb_tokens ( pbi , xd ) ; xd -> mode_info_context -> mbmi . mb_skip_coeff = ( eobtotal == 0 ) ; } mode = xd -> mode_info_context -> mbmi . mode ; if ( xd -> segmentation_enabled ) vp8_mb_init_dequantizer ( pbi , xd ) ; # if CONFIG_ERROR_CONCEALMENT if ( pbi -> ec_active ) { int throw_residual ; throw_residual = ( ! pbi -> independent_partitions && pbi -> frame_corrupt_residual ) ; throw_residual = ( throw_residual || vp8dx_bool_error ( xd -> current_bc ) ) ; if ( ( mb_idx >= pbi -> mvs_corrupt_from_mb || throw_residual ) ) { pbi -> frame_corrupt_residual = 1 ; <S2SV_StartBug> vpx_memset ( xd -> qcoeff , 0 , sizeof ( xd -> qcoeff ) ) ; <S2SV_EndBug> vp8_conceal_corrupt_mb ( xd ) ; corruption_detected = 1 ; <S2SV_StartBug> vpx_memset ( xd -> eobs , 0 , 25 ) ; <S2SV_EndBug> } } # endif if ( xd -> mode_info_context -> mbmi . ref_frame == INTRA_FRAME ) { vp8_build_intra_predictors_mbuv_s ( xd , xd -> recon_above [ 1 ] , xd -> recon_above [ 2 ] , xd -> recon_left [ 1 ] , xd -> recon_left [ 2 ] , xd -> recon_left_stride [ 1 ] , xd -> dst . u_buffer , xd -> dst . v_buffer , xd -> dst . uv_stride ) ; if ( mode != B_PRED ) { vp8_build_intra_predictors_mby_s ( xd , xd -> recon_above [ 0 ] , xd -> recon_left [ 0 ] , xd -> recon_left_stride [ 0 ] , xd -> dst . y_buffer , xd -> dst . y_stride ) ; } else { short * DQC = xd -> dequant_y1 ; int dst_stride = xd -> dst . y_stride ; if ( xd -> mode_info_context -> mbmi . mb_skip_coeff ) <S2SV_StartBug> vpx_memset ( xd -> eobs , 0 , 25 ) ; <S2SV_EndBug> intra_prediction_down_copy ( xd , xd -> recon_above [ 0 ] + 16 ) ; for ( i = 0 ; i < 16 ; i ++ ) { BLOCKD * b = & xd -> block [ i ] ; unsigned char * dst = xd -> dst . y_buffer + b -> offset ; B_PREDICTION_MODE b_mode = xd -> mode_info_context -> bmi [ i ] . as_mode ; unsigned char * Above ; unsigned char * yleft ; int left_stride ; unsigned char top_left ; if ( i < 4 && pbi -> common . filter_level ) Above = xd -> recon_above [ 0 ] + b -> offset ; else Above = dst - dst_stride ; if ( i % 4 == 0 && pbi -> common . filter_level ) { yleft = xd -> recon_left [ 0 ] + i ; left_stride = 1 ; } else { yleft = dst - 1 ; left_stride = dst_stride ; } if ( ( i == 4 || i == 8 || i == 12 ) && pbi -> common . filter_level ) top_left = * ( xd -> recon_left [ 0 ] + i - 1 ) ; else top_left = Above [ - 1 ] ; vp8_intra4x4_predict ( Above , yleft , left_stride , b_mode , dst , dst_stride , top_left ) ; if ( xd -> eobs [ i ] ) { if ( xd -> eobs [ i ] > 1 ) { vp8_dequant_idct_add ( b -> qcoeff , DQC , dst , dst_stride ) ; } else { vp8_dc_only_idct_add ( b -> qcoeff [ 0 ] * DQC [ 0 ] , dst , dst_stride , dst , dst_stride ) ; <S2SV_StartBug> vpx_memset ( b -> qcoeff , 0 , 2 * sizeof ( b -> qcoeff [ 0 ] ) ) ; <S2SV_EndBug> } } } } } else { vp8_build_inter_predictors_mb ( xd ) ; } # if CONFIG_ERROR_CONCEALMENT if ( corruption_detected ) { return ; } # endif if ( ! xd -> mode_info_context -> mbmi . mb_skip_coeff ) { if ( mode != B_PRED ) { short * DQC = xd -> dequant_y1 ; if ( mode != SPLITMV ) { BLOCKD * b = & xd -> block [ 24 ] ; if ( xd -> eobs [ 24 ] > 1 ) { vp8_dequantize_b ( b , xd -> dequant_y2 ) ; vp8_short_inv_walsh4x4 ( & b -> dqcoeff [ 0 ] , xd -> qcoeff ) ; <S2SV_StartBug> vpx_memset ( b -> qcoeff , 0 , 16 * sizeof ( b -> qcoeff [ 0 ] ) ) ; <S2SV_EndBug> } else { b -> dqcoeff [ 0 ] = b -> qcoeff [ 0 ] * xd -> dequant_y2 [ 0 ] ; vp8_short_inv_walsh4x4_1 ( & b -> dqcoeff [ 0 ] , xd -> qcoeff ) ; <S2SV_StartBug> vpx_memset ( b -> qcoeff , 0 , 2 * sizeof ( b -> qcoeff [ 0 ] ) ) ; <S2SV_EndBug> } DQC = xd -> dequant_y1_dc ; } vp8_dequant_idct_add_y_block ( xd -> qcoeff , DQC , xd -> dst . y_buffer , xd -> dst . y_stride , xd -> eobs ) ; } vp8_dequant_idct_add_uv_block ( xd -> qcoeff + 16 * 16 , xd -> dequant_uv , xd -> dst . u_buffer , xd -> dst . v_buffer , xd -> dst . uv_stride , xd -> eobs + 16 ) ; } }
<S2SV_ModStart> 0 ; # else ( void ) mb_idx ; # <S2SV_ModStart> = 1 ; memset <S2SV_ModEnd> ( xd -> <S2SV_ModStart> = 1 ; memset <S2SV_ModEnd> ( xd -> <S2SV_ModStart> . mb_skip_coeff ) memset <S2SV_ModEnd> ( xd -> <S2SV_ModStart> dst_stride ) ; memset <S2SV_ModEnd> ( b -> <S2SV_ModStart> qcoeff ) ; memset <S2SV_ModEnd> ( b -> <S2SV_ModStart> qcoeff ) ; memset <S2SV_ModEnd> ( b ->
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
145
CWE-125
CWE-125 void vtp_print ( netdissect_options * ndo , const u_char * pptr , u_int length ) { int type , len , tlv_len , tlv_value , mgmtd_len ; const u_char * tptr ; const struct vtp_vlan_ * vtp_vlan ; if ( length < VTP_HEADER_LEN ) goto trunc ; tptr = pptr ; ND_TCHECK2 ( * tptr , VTP_HEADER_LEN ) ; type = * ( tptr + 1 ) ; ND_PRINT ( ( ndo , "VTPv%u,<S2SV_blank>Message<S2SV_blank>%s<S2SV_blank>(0x%02x),<S2SV_blank>length<S2SV_blank>%u" , * tptr , tok2str ( vtp_message_type_values , "Unknown<S2SV_blank>message<S2SV_blank>type" , type ) , type , length ) ) ; if ( ndo -> ndo_vflag < 1 ) { return ; } ND_PRINT ( ( ndo , "\\n\\tDomain<S2SV_blank>name:<S2SV_blank>" ) ) ; mgmtd_len = * ( tptr + 3 ) ; if ( mgmtd_len < 1 || mgmtd_len > 32 ) { ND_PRINT ( ( ndo , "<S2SV_blank>[invalid<S2SV_blank>MgmtD<S2SV_blank>Len<S2SV_blank>%d]" , mgmtd_len ) ) ; return ; } fn_printzp ( ndo , tptr + 4 , mgmtd_len , NULL ) ; ND_PRINT ( ( ndo , ",<S2SV_blank>%s:<S2SV_blank>%u" , tok2str ( vtp_header_values , "Unknown" , type ) , * ( tptr + 2 ) ) ) ; tptr += VTP_HEADER_LEN ; switch ( type ) { case VTP_SUMMARY_ADV : ND_TCHECK2 ( * tptr , 8 ) ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Config<S2SV_blank>Rev<S2SV_blank>%x,<S2SV_blank>Updater<S2SV_blank>%s" , EXTRACT_32BITS ( tptr ) , ipaddr_string ( ndo , tptr + 4 ) ) ) ; tptr += 8 ; ND_TCHECK2 ( * tptr , VTP_UPDATE_TIMESTAMP_LEN ) ; ND_PRINT ( ( ndo , ",<S2SV_blank>Timestamp<S2SV_blank>0x%08x<S2SV_blank>0x%08x<S2SV_blank>0x%08x" , EXTRACT_32BITS ( tptr ) , EXTRACT_32BITS ( tptr + 4 ) , EXTRACT_32BITS ( tptr + 8 ) ) ) ; tptr += VTP_UPDATE_TIMESTAMP_LEN ; ND_TCHECK2 ( * tptr , VTP_MD5_DIGEST_LEN ) ; ND_PRINT ( ( ndo , ",<S2SV_blank>MD5<S2SV_blank>digest:<S2SV_blank>%08x%08x%08x%08x" , EXTRACT_32BITS ( tptr ) , EXTRACT_32BITS ( tptr + 4 ) , EXTRACT_32BITS ( tptr + 8 ) , EXTRACT_32BITS ( tptr + 12 ) ) ) ; tptr += VTP_MD5_DIGEST_LEN ; break ; case VTP_SUBSET_ADV : <S2SV_StartBug> ND_PRINT ( ( ndo , ",<S2SV_blank>Config<S2SV_blank>Rev<S2SV_blank>%x" , EXTRACT_32BITS ( tptr ) ) ) ; <S2SV_EndBug> tptr += 4 ; <S2SV_StartBug> while ( tptr < ( pptr + length ) ) { <S2SV_EndBug> len = * tptr ; if ( len == 0 ) break ; ND_TCHECK2 ( * tptr , len ) ; vtp_vlan = ( const struct vtp_vlan_ * ) tptr ; ND_TCHECK ( * vtp_vlan ) ; ND_PRINT ( ( ndo , "\\n\\tVLAN<S2SV_blank>info<S2SV_blank>status<S2SV_blank>%s,<S2SV_blank>type<S2SV_blank>%s,<S2SV_blank>VLAN-id<S2SV_blank>%u,<S2SV_blank>MTU<S2SV_blank>%u,<S2SV_blank>SAID<S2SV_blank>0x%08x,<S2SV_blank>Name<S2SV_blank>" , tok2str ( vtp_vlan_status , "Unknown" , vtp_vlan -> status ) , tok2str ( vtp_vlan_type_values , "Unknown" , vtp_vlan -> type ) , EXTRACT_16BITS ( & vtp_vlan -> vlanid ) , EXTRACT_16BITS ( & vtp_vlan -> mtu ) , EXTRACT_32BITS ( & vtp_vlan -> index ) ) ) ; fn_printzp ( ndo , tptr + VTP_VLAN_INFO_OFFSET , vtp_vlan -> name_len , NULL ) ; len -= VTP_VLAN_INFO_OFFSET + 4 * ( ( vtp_vlan -> name_len + 3 ) / 4 ) ; tptr += VTP_VLAN_INFO_OFFSET + 4 * ( ( vtp_vlan -> name_len + 3 ) / 4 ) ; while ( len > 0 ) { type = * tptr ; tlv_len = * ( tptr + 1 ) ; ND_PRINT ( ( ndo , "\\n\\t\\t%s<S2SV_blank>(0x%04x)<S2SV_blank>TLV" , tok2str ( vtp_vlan_tlv_values , "Unknown" , type ) , type ) ) ; if ( type == 0 || tlv_len == 0 ) { return ; } ND_TCHECK2 ( * tptr , tlv_len * 2 + 2 ) ; tlv_value = EXTRACT_16BITS ( tptr + 2 ) ; switch ( type ) { case VTP_VLAN_STE_HOP_COUNT : ND_PRINT ( ( ndo , ",<S2SV_blank>%u" , tlv_value ) ) ; break ; case VTP_VLAN_PRUNING : ND_PRINT ( ( ndo , ",<S2SV_blank>%s<S2SV_blank>(%u)" , tlv_value == 1 ? "Enabled" : "Disabled" , tlv_value ) ) ; break ; case VTP_VLAN_STP_TYPE : ND_PRINT ( ( ndo , ",<S2SV_blank>%s<S2SV_blank>(%u)" , tok2str ( vtp_stp_type_values , "Unknown" , tlv_value ) , tlv_value ) ) ; break ; case VTP_VLAN_BRIDGE_TYPE : ND_PRINT ( ( ndo , ",<S2SV_blank>%s<S2SV_blank>(%u)" , tlv_value == 1 ? "SRB" : "SRT" , tlv_value ) ) ; break ; case VTP_VLAN_BACKUP_CRF_MODE : ND_PRINT ( ( ndo , ",<S2SV_blank>%s<S2SV_blank>(%u)" , tlv_value == 1 ? "Backup" : "Not<S2SV_blank>backup" , tlv_value ) ) ; break ; case VTP_VLAN_SOURCE_ROUTING_RING_NUMBER : case VTP_VLAN_SOURCE_ROUTING_BRIDGE_NUMBER : case VTP_VLAN_PARENT_VLAN : case VTP_VLAN_TRANS_BRIDGED_VLAN : case VTP_VLAN_ARP_HOP_COUNT : default : print_unknown_data ( ndo , tptr , "\\n\\t\\t<S2SV_blank><S2SV_blank>" , 2 + tlv_len * 2 ) ; break ; } len -= 2 + tlv_len * 2 ; tptr += 2 + tlv_len * 2 ; } } break ; case VTP_ADV_REQUEST : ND_TCHECK2 ( * tptr , 4 ) ; ND_PRINT ( ( ndo , "\\n\\tStart<S2SV_blank>value:<S2SV_blank>%u" , EXTRACT_32BITS ( tptr ) ) ) ; break ; case VTP_JOIN_MESSAGE : break ; default : break ; } return ; trunc : ND_PRINT ( ( ndo , "[|vtp]" ) ) ; }
<S2SV_ModStart> case VTP_SUBSET_ADV : ND_TCHECK_32BITS ( tptr ) ; <S2SV_ModStart> ) ) { ND_TCHECK_8BITS ( tptr ) ;
the-tcpdump-group@tcpdump/c5dd7bef5e54da5996dc4713284aa6266ae75b75
CVE-2017-13020
https://github.com/the-tcpdump-group/tcpdump/commit/c5dd7bef5e54da5996dc4713284aa6266ae75b75
2017-09-14T06:29Z
146
CWE-369
CWE-369 sf_count_t psf_fwrite ( const void * ptr , sf_count_t bytes , sf_count_t items , SF_PRIVATE * psf ) { sf_count_t total = 0 ; <S2SV_StartBug> ssize_t count ; <S2SV_EndBug> if ( psf -> virtual_io ) return psf -> vio . write ( ptr , bytes * items , psf -> vio_user_data ) / bytes ; items *= bytes ; if ( items <= 0 ) return 0 ; while ( items > 0 ) { count = ( items > SENSIBLE_SIZE ) ? SENSIBLE_SIZE : items ; count = write ( psf -> file . filedes , ( ( const char * ) ptr ) + total , count ) ; if ( count == - 1 ) { if ( errno == EINTR ) continue ; psf_log_syserr ( psf , errno ) ; break ; } ; if ( count == 0 ) break ; total += count ; items -= count ; } ; if ( psf -> is_pipe ) psf -> pipeoffset += total ; return total / bytes ; }
<S2SV_ModStart> ; ssize_t count ; if ( bytes == 0 || items == 0 ) return 0
erikd@libsndfile/725c7dbb95bfaf8b4bb7b04820e3a00cceea9ce6
CVE-2014-9756
https://github.com/erikd/libsndfile/commit/725c7dbb95bfaf8b4bb7b04820e3a00cceea9ce6
2015-11-19T20:59Z
147
CWE-125
CWE-125 static void handle_mlppp ( netdissect_options * ndo , const u_char * p , int length ) { if ( ! ndo -> ndo_eflag ) ND_PRINT ( ( ndo , "MLPPP,<S2SV_blank>" ) ) ; <S2SV_StartBug> ND_PRINT ( ( ndo , "seq<S2SV_blank>0x%03x,<S2SV_blank>Flags<S2SV_blank>[%s],<S2SV_blank>length<S2SV_blank>%u" , <S2SV_EndBug> ( EXTRACT_16BITS ( p ) ) & 0x0fff , bittok2str ( ppp_ml_flag_values , "none" , * p & 0xc0 ) , length ) ) ; }
<S2SV_ModStart> ) ) ; if ( length < 2 ) { ND_PRINT ( ( ndo , "[|mlppp]" ) ) ; return ; } if ( ! ND_TTEST_16BITS ( p ) ) { ND_PRINT ( ( ndo , "[|mlppp]" ) ) ; return ; }
the-tcpdump-group@tcpdump/7335163a6ef82d46ff18f3e6099a157747241629
CVE-2017-13038
https://github.com/the-tcpdump-group/tcpdump/commit/7335163a6ef82d46ff18f3e6099a157747241629
2017-09-14T06:29Z
148
CWE-119
CWE-119 static int parse_codes ( struct archive_read * a ) { int i , j , val , n , r ; unsigned char bitlengths [ MAX_SYMBOLS ] , zerocount , ppmd_flags ; unsigned int maxorder ; struct huffman_code precode ; struct rar * rar = ( struct rar * ) ( a -> format -> data ) ; struct rar_br * br = & ( rar -> br ) ; free_codes ( a ) ; rar_br_consume_unalined_bits ( br ) ; if ( ! rar_br_read_ahead ( a , br , 1 ) ) goto truncated_data ; if ( ( rar -> is_ppmd_block = rar_br_bits ( br , 1 ) ) != 0 ) { rar_br_consume ( br , 1 ) ; if ( ! rar_br_read_ahead ( a , br , 7 ) ) goto truncated_data ; ppmd_flags = rar_br_bits ( br , 7 ) ; rar_br_consume ( br , 7 ) ; if ( ppmd_flags & 0x20 ) { if ( ! rar_br_read_ahead ( a , br , 8 ) ) goto truncated_data ; rar -> dictionary_size = ( rar_br_bits ( br , 8 ) + 1 ) << 20 ; rar_br_consume ( br , 8 ) ; } if ( ppmd_flags & 0x40 ) { if ( ! rar_br_read_ahead ( a , br , 8 ) ) goto truncated_data ; rar -> ppmd_escape = rar -> ppmd7_context . InitEsc = rar_br_bits ( br , 8 ) ; rar_br_consume ( br , 8 ) ; } else rar -> ppmd_escape = 2 ; if ( ppmd_flags & 0x20 ) { maxorder = ( ppmd_flags & 0x1F ) + 1 ; if ( maxorder > 16 ) maxorder = 16 + ( maxorder - 16 ) * 3 ; if ( maxorder == 1 ) { archive_set_error ( & a -> archive , ARCHIVE_ERRNO_FILE_FORMAT , "Truncated<S2SV_blank>RAR<S2SV_blank>file<S2SV_blank>data" ) ; return ( ARCHIVE_FATAL ) ; } __archive_ppmd7_functions . Ppmd7_Free ( & rar -> ppmd7_context , & g_szalloc ) ; rar -> bytein . a = a ; rar -> bytein . Read = & ppmd_read ; __archive_ppmd7_functions . PpmdRAR_RangeDec_CreateVTable ( & rar -> range_dec ) ; rar -> range_dec . Stream = & rar -> bytein ; __archive_ppmd7_functions . Ppmd7_Construct ( & rar -> ppmd7_context ) ; <S2SV_StartBug> if ( ! __archive_ppmd7_functions . Ppmd7_Alloc ( & rar -> ppmd7_context , <S2SV_EndBug> rar -> dictionary_size , & g_szalloc ) ) { archive_set_error ( & a -> archive , ENOMEM , "Out<S2SV_blank>of<S2SV_blank>memory" ) ; return ( ARCHIVE_FATAL ) ; } if ( ! __archive_ppmd7_functions . PpmdRAR_RangeDec_Init ( & rar -> range_dec ) ) { archive_set_error ( & a -> archive , ARCHIVE_ERRNO_FILE_FORMAT , "Unable<S2SV_blank>to<S2SV_blank>initialize<S2SV_blank>PPMd<S2SV_blank>range<S2SV_blank>decoder" ) ; return ( ARCHIVE_FATAL ) ; } __archive_ppmd7_functions . Ppmd7_Init ( & rar -> ppmd7_context , maxorder ) ; rar -> ppmd_valid = 1 ; } else { if ( ! rar -> ppmd_valid ) { archive_set_error ( & a -> archive , ARCHIVE_ERRNO_FILE_FORMAT , "Invalid<S2SV_blank>PPMd<S2SV_blank>sequence" ) ; return ( ARCHIVE_FATAL ) ; } if ( ! __archive_ppmd7_functions . PpmdRAR_RangeDec_Init ( & rar -> range_dec ) ) { archive_set_error ( & a -> archive , ARCHIVE_ERRNO_FILE_FORMAT , "Unable<S2SV_blank>to<S2SV_blank>initialize<S2SV_blank>PPMd<S2SV_blank>range<S2SV_blank>decoder" ) ; return ( ARCHIVE_FATAL ) ; } } } else { rar_br_consume ( br , 1 ) ; if ( ! rar_br_read_ahead ( a , br , 1 ) ) goto truncated_data ; if ( ! rar_br_bits ( br , 1 ) ) memset ( rar -> lengthtable , 0 , sizeof ( rar -> lengthtable ) ) ; rar_br_consume ( br , 1 ) ; memset ( & bitlengths , 0 , sizeof ( bitlengths ) ) ; for ( i = 0 ; i < MAX_SYMBOLS ; ) { if ( ! rar_br_read_ahead ( a , br , 4 ) ) goto truncated_data ; bitlengths [ i ++ ] = rar_br_bits ( br , 4 ) ; rar_br_consume ( br , 4 ) ; if ( bitlengths [ i - 1 ] == 0xF ) { if ( ! rar_br_read_ahead ( a , br , 4 ) ) goto truncated_data ; zerocount = rar_br_bits ( br , 4 ) ; rar_br_consume ( br , 4 ) ; if ( zerocount ) { i -- ; for ( j = 0 ; j < zerocount + 2 && i < MAX_SYMBOLS ; j ++ ) bitlengths [ i ++ ] = 0 ; } } } memset ( & precode , 0 , sizeof ( precode ) ) ; r = create_code ( a , & precode , bitlengths , MAX_SYMBOLS , MAX_SYMBOL_LENGTH ) ; if ( r != ARCHIVE_OK ) { free ( precode . tree ) ; free ( precode . table ) ; return ( r ) ; } for ( i = 0 ; i < HUFFMAN_TABLE_SIZE ; ) { if ( ( val = read_next_symbol ( a , & precode ) ) < 0 ) { free ( precode . tree ) ; free ( precode . table ) ; return ( ARCHIVE_FATAL ) ; } if ( val < 16 ) { rar -> lengthtable [ i ] = ( rar -> lengthtable [ i ] + val ) & 0xF ; i ++ ; } else if ( val < 18 ) { if ( i == 0 ) { free ( precode . tree ) ; free ( precode . table ) ; archive_set_error ( & a -> archive , ARCHIVE_ERRNO_FILE_FORMAT , "Internal<S2SV_blank>error<S2SV_blank>extracting<S2SV_blank>RAR<S2SV_blank>file." ) ; return ( ARCHIVE_FATAL ) ; } if ( val == 16 ) { if ( ! rar_br_read_ahead ( a , br , 3 ) ) { free ( precode . tree ) ; free ( precode . table ) ; goto truncated_data ; } n = rar_br_bits ( br , 3 ) + 3 ; rar_br_consume ( br , 3 ) ; } else { if ( ! rar_br_read_ahead ( a , br , 7 ) ) { free ( precode . tree ) ; free ( precode . table ) ; goto truncated_data ; } n = rar_br_bits ( br , 7 ) + 11 ; rar_br_consume ( br , 7 ) ; } for ( j = 0 ; j < n && i < HUFFMAN_TABLE_SIZE ; j ++ ) { rar -> lengthtable [ i ] = rar -> lengthtable [ i - 1 ] ; i ++ ; } } else { if ( val == 18 ) { if ( ! rar_br_read_ahead ( a , br , 3 ) ) { free ( precode . tree ) ; free ( precode . table ) ; goto truncated_data ; } n = rar_br_bits ( br , 3 ) + 3 ; rar_br_consume ( br , 3 ) ; } else { if ( ! rar_br_read_ahead ( a , br , 7 ) ) { free ( precode . tree ) ; free ( precode . table ) ; goto truncated_data ; } n = rar_br_bits ( br , 7 ) + 11 ; rar_br_consume ( br , 7 ) ; } for ( j = 0 ; j < n && i < HUFFMAN_TABLE_SIZE ; j ++ ) rar -> lengthtable [ i ++ ] = 0 ; } } free ( precode . tree ) ; free ( precode . table ) ; r = create_code ( a , & rar -> maincode , & rar -> lengthtable [ 0 ] , MAINCODE_SIZE , MAX_SYMBOL_LENGTH ) ; if ( r != ARCHIVE_OK ) return ( r ) ; r = create_code ( a , & rar -> offsetcode , & rar -> lengthtable [ MAINCODE_SIZE ] , OFFSETCODE_SIZE , MAX_SYMBOL_LENGTH ) ; if ( r != ARCHIVE_OK ) return ( r ) ; r = create_code ( a , & rar -> lowoffsetcode , & rar -> lengthtable [ MAINCODE_SIZE + OFFSETCODE_SIZE ] , LOWOFFSETCODE_SIZE , MAX_SYMBOL_LENGTH ) ; if ( r != ARCHIVE_OK ) return ( r ) ; r = create_code ( a , & rar -> lengthcode , & rar -> lengthtable [ MAINCODE_SIZE + OFFSETCODE_SIZE + LOWOFFSETCODE_SIZE ] , LENGTHCODE_SIZE , MAX_SYMBOL_LENGTH ) ; if ( r != ARCHIVE_OK ) return ( r ) ; } if ( ! rar -> dictionary_size || ! rar -> lzss . window ) { void * new_window ; unsigned int new_size ; if ( rar -> unp_size >= DICTIONARY_MAX_SIZE ) new_size = DICTIONARY_MAX_SIZE ; else new_size = rar_fls ( ( unsigned int ) rar -> unp_size ) << 1 ; new_window = realloc ( rar -> lzss . window , new_size ) ; if ( new_window == NULL ) { archive_set_error ( & a -> archive , ENOMEM , "Unable<S2SV_blank>to<S2SV_blank>allocate<S2SV_blank>memory<S2SV_blank>for<S2SV_blank>uncompressed<S2SV_blank>data." ) ; return ( ARCHIVE_FATAL ) ; } rar -> lzss . window = ( unsigned char * ) new_window ; rar -> dictionary_size = new_size ; memset ( rar -> lzss . window , 0 , rar -> dictionary_size ) ; rar -> lzss . mask = rar -> dictionary_size - 1 ; } rar -> start_new_table = 0 ; return ( ARCHIVE_OK ) ; truncated_data : archive_set_error ( & a -> archive , ARCHIVE_ERRNO_FILE_FORMAT , "Truncated<S2SV_blank>RAR<S2SV_blank>file<S2SV_blank>data" ) ; rar -> valid = 0 ; return ( ARCHIVE_FATAL ) ; }
<S2SV_ModStart> ; if ( rar -> dictionary_size == 0 ) { archive_set_error ( & a -> archive , ARCHIVE_ERRNO_FILE_FORMAT , "Invalid<S2SV_blank>zero<S2SV_blank>dictionary<S2SV_blank>size" ) ; return ( ARCHIVE_FATAL ) ; } if (
libarchive@libarchive/05caadc7eedbef471ac9610809ba683f0c698700
CVE-2016-4302
https://github.com/libarchive/libarchive/commit/05caadc7eedbef471ac9610809ba683f0c698700
2016-09-21T14:25Z
149
CWE-189
CWE-189 static int opl3_load_patch ( int dev , int format , const char __user * addr , <S2SV_StartBug> int offs , int count , int pmgr_flag ) <S2SV_EndBug> { struct sbi_instrument ins ; if ( count < sizeof ( ins ) ) { printk ( KERN_WARNING "FM<S2SV_blank>Error:<S2SV_blank>Patch<S2SV_blank>record<S2SV_blank>too<S2SV_blank>short\\n" ) ; return - EINVAL ; } <S2SV_StartBug> if ( copy_from_user ( & ( ( char * ) & ins ) [ offs ] , addr + offs , sizeof ( ins ) - offs ) ) <S2SV_EndBug> return - EFAULT ; if ( ins . channel < 0 || ins . channel >= SBFM_MAXINSTR ) { printk ( KERN_WARNING "FM<S2SV_blank>Error:<S2SV_blank>Invalid<S2SV_blank>instrument<S2SV_blank>number<S2SV_blank>%d\\n" , ins . channel ) ; return - EINVAL ; } ins . key = format ; return store_instr ( ins . channel , & ins ) ; }
<S2SV_ModStart> * addr , <S2SV_ModEnd> int count , <S2SV_ModStart> copy_from_user ( & ins , addr <S2SV_ModEnd> , sizeof ( <S2SV_ModStart> ( ins ) <S2SV_ModEnd> ) ) return
torvalds@linux/b769f49463711205d57286e64cf535ed4daf59e9
CVE-2011-1476
https://github.com/torvalds/linux/commit/b769f49463711205d57286e64cf535ed4daf59e9
2012-06-21T23:55Z
150
CWE-476
CWE-476 static int ghash_update ( struct shash_desc * desc , const u8 * src , unsigned int srclen ) { struct ghash_desc_ctx * dctx = shash_desc_ctx ( desc ) ; struct ghash_ctx * ctx = crypto_shash_ctx ( desc -> tfm ) ; u8 * dst = dctx -> buffer ; <S2SV_StartBug> if ( dctx -> bytes ) { <S2SV_EndBug> int n = min ( srclen , dctx -> bytes ) ; u8 * pos = dst + ( GHASH_BLOCK_SIZE - dctx -> bytes ) ; dctx -> bytes -= n ; srclen -= n ; while ( n -- ) * pos ++ ^= * src ++ ; if ( ! dctx -> bytes ) gf128mul_4k_lle ( ( be128 * ) dst , ctx -> gf128 ) ; } while ( srclen >= GHASH_BLOCK_SIZE ) { crypto_xor ( dst , src , GHASH_BLOCK_SIZE ) ; gf128mul_4k_lle ( ( be128 * ) dst , ctx -> gf128 ) ; src += GHASH_BLOCK_SIZE ; srclen -= GHASH_BLOCK_SIZE ; } if ( srclen ) { dctx -> bytes = GHASH_BLOCK_SIZE - srclen ; while ( srclen -- ) * dst ++ ^= * src ++ ; } return 0 ; }
<S2SV_ModStart> ; if ( ! ctx -> gf128 ) return - ENOKEY ; if (
torvalds@linux/7ed47b7d142ec99ad6880bbbec51e9f12b3af74c
CVE-2011-4081
https://github.com/torvalds/linux/commit/7ed47b7d142ec99ad6880bbbec51e9f12b3af74c
2012-05-24T23:55Z
151
CWE-264
CWE-264 static int cg_opendir ( const char * path , struct fuse_file_info * fi ) { struct fuse_context * fc = fuse_get_context ( ) ; const char * cgroup ; struct file_info * dir_info ; char * controller = NULL ; if ( ! fc ) return - EIO ; if ( strcmp ( path , "/cgroup" ) == 0 ) { cgroup = NULL ; controller = NULL ; } else { controller = pick_controller_from_path ( fc , path ) ; if ( ! controller ) return - EIO ; cgroup = find_cgroup_in_path ( path ) ; if ( ! cgroup ) { cgroup = "/" ; } } <S2SV_StartBug> if ( cgroup && ! fc_may_access ( fc , controller , cgroup , NULL , O_RDONLY ) ) { <S2SV_EndBug> return - EACCES ; } dir_info = malloc ( sizeof ( * dir_info ) ) ; if ( ! dir_info ) return - ENOMEM ; dir_info -> controller = must_copy_string ( controller ) ; dir_info -> cgroup = must_copy_string ( cgroup ) ; dir_info -> type = LXC_TYPE_CGDIR ; dir_info -> buf = NULL ; dir_info -> file = NULL ; dir_info -> buflen = 0 ; fi -> fh = ( unsigned long ) dir_info ; return 0 ; }
<S2SV_ModStart> if ( cgroup ) { if ( ! caller_may_see_dir ( fc -> pid , controller , cgroup ) ) return - ENOENT ; if ( <S2SV_ModEnd> ! fc_may_access ( <S2SV_ModStart> O_RDONLY ) ) <S2SV_ModEnd> return - EACCES
lxc@lxcfs/a8b6c3e0537e90fba3c55910fd1b7229d54a60a7
CVE-2015-1342
https://github.com/lxc/lxcfs/commit/a8b6c3e0537e90fba3c55910fd1b7229d54a60a7
2015-12-07T20:59Z
152
CWE-264
CWE-264 SYSCALL_DEFINE6 ( sendto , int , fd , void __user * , buff , size_t , len , unsigned int , flags , struct sockaddr __user * , addr , int , addr_len ) { struct socket * sock ; struct sockaddr_storage address ; int err ; struct msghdr msg ; struct iovec iov ; int fput_needed ; if ( len > INT_MAX ) <S2SV_StartBug> len = INT_MAX ; <S2SV_EndBug> sock = sockfd_lookup_light ( fd , & err , & fput_needed ) ; if ( ! sock ) goto out ; iov . iov_base = buff ; iov . iov_len = len ; msg . msg_name = NULL ; iov_iter_init ( & msg . msg_iter , WRITE , & iov , 1 , len ) ; msg . msg_control = NULL ; msg . msg_controllen = 0 ; msg . msg_namelen = 0 ; if ( addr ) { err = move_addr_to_kernel ( addr , addr_len , & address ) ; if ( err < 0 ) goto out_put ; msg . msg_name = ( struct sockaddr * ) & address ; msg . msg_namelen = addr_len ; } if ( sock -> file -> f_flags & O_NONBLOCK ) flags |= MSG_DONTWAIT ; msg . msg_flags = flags ; err = sock_sendmsg ( sock , & msg , len ) ; out_put : fput_light ( sock -> file , fput_needed ) ; out : return err ; }
<S2SV_ModStart> len = INT_MAX ; if ( unlikely ( ! access_ok ( VERIFY_READ , buff , len ) ) ) return - EFAULT
torvalds@linux/4de930efc23b92ddf88ce91c405ee645fe6e27ea
CVE-2015-2686
https://github.com/torvalds/linux/commit/4de930efc23b92ddf88ce91c405ee645fe6e27ea
2016-05-02T10:59Z
153
CWE-254
CWE-254 static int follow_dotdot_rcu ( struct nameidata * nd ) { struct inode * inode = nd -> inode ; if ( ! nd -> root . mnt ) set_root_rcu ( nd ) ; while ( 1 ) { if ( path_equal ( & nd -> path , & nd -> root ) ) break ; if ( nd -> path . dentry != nd -> path . mnt -> mnt_root ) { struct dentry * old = nd -> path . dentry ; struct dentry * parent = old -> d_parent ; unsigned seq ; inode = parent -> d_inode ; seq = read_seqcount_begin ( & parent -> d_seq ) ; if ( unlikely ( read_seqcount_retry ( & old -> d_seq , nd -> seq ) ) ) return - ECHILD ; nd -> path . dentry = parent ; nd -> seq = seq ; <S2SV_StartBug> break ; <S2SV_EndBug> } else { struct mount * mnt = real_mount ( nd -> path . mnt ) ; struct mount * mparent = mnt -> mnt_parent ; struct dentry * mountpoint = mnt -> mnt_mountpoint ; struct inode * inode2 = mountpoint -> d_inode ; unsigned seq = read_seqcount_begin ( & mountpoint -> d_seq ) ; if ( unlikely ( read_seqretry ( & mount_lock , nd -> m_seq ) ) ) return - ECHILD ; if ( & mparent -> mnt == nd -> path . mnt ) break ; nd -> path . dentry = mountpoint ; nd -> path . mnt = & mparent -> mnt ; inode = inode2 ; nd -> seq = seq ; } } while ( unlikely ( d_mountpoint ( nd -> path . dentry ) ) ) { struct mount * mounted ; mounted = __lookup_mnt ( nd -> path . mnt , nd -> path . dentry ) ; if ( unlikely ( read_seqretry ( & mount_lock , nd -> m_seq ) ) ) return - ECHILD ; if ( ! mounted ) break ; nd -> path . mnt = & mounted -> mnt ; nd -> path . dentry = mounted -> mnt . mnt_root ; inode = nd -> path . dentry -> d_inode ; nd -> seq = read_seqcount_begin ( & nd -> path . dentry -> d_seq ) ; } nd -> inode = inode ; return 0 ; }
<S2SV_ModStart> = seq ; if ( unlikely ( ! path_connected ( & nd -> path ) ) ) return - ENOENT ;
torvalds@linux/397d425dc26da728396e66d392d5dcb8dac30c37
CVE-2015-2925
https://github.com/torvalds/linux/commit/397d425dc26da728396e66d392d5dcb8dac30c37
2015-11-16T11:59Z
154
CWE-400
CWE-400 static void perf_log_throttle ( struct perf_event * event , int enable ) { struct perf_output_handle handle ; struct perf_sample_data sample ; int ret ; struct { struct perf_event_header header ; u64 time ; u64 id ; u64 stream_id ; } throttle_event = { . header = { . type = PERF_RECORD_THROTTLE , . misc = 0 , . size = sizeof ( throttle_event ) , } , . time = perf_clock ( ) , . id = primary_event_id ( event ) , . stream_id = event -> id , } ; if ( enable ) throttle_event . header . type = PERF_RECORD_UNTHROTTLE ; perf_event_header__init_id ( & throttle_event . header , & sample , event ) ; ret = perf_output_begin ( & handle , event , <S2SV_StartBug> throttle_event . header . size , 1 , 0 ) ; <S2SV_EndBug> if ( ret ) return ; perf_output_put ( & handle , throttle_event ) ; perf_event__output_id_sample ( event , & handle , & sample ) ; perf_output_end ( & handle ) ; }
<S2SV_ModStart> . size , <S2SV_ModEnd> 0 ) ;
torvalds@linux/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
CVE-2011-2918
https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
2012-05-24T23:55Z
155
CWE-264
CWE-264 static int wrmsr_interception ( struct vcpu_svm * svm ) { struct msr_data msr ; u32 ecx = svm -> vcpu . arch . regs [ VCPU_REGS_RCX ] ; u64 data = ( svm -> vcpu . arch . regs [ VCPU_REGS_RAX ] & - 1u ) | ( ( u64 ) ( svm -> vcpu . arch . regs [ VCPU_REGS_RDX ] & - 1u ) << 32 ) ; msr . data = data ; msr . index = ecx ; msr . host_initiated = false ; svm -> next_rip = kvm_rip_read ( & svm -> vcpu ) + 2 ; <S2SV_StartBug> if ( svm_set_msr ( & svm -> vcpu , & msr ) ) { <S2SV_EndBug> trace_kvm_msr_write_ex ( ecx , data ) ; kvm_inject_gp ( & svm -> vcpu , 0 ) ; } else { trace_kvm_msr_write ( ecx , data ) ; skip_emulated_instruction ( & svm -> vcpu ) ; } return 1 ; }
<S2SV_ModStart> ; if ( kvm_set_msr <S2SV_ModEnd> ( & svm
torvalds@linux/854e8bb1aa06c578c2c9145fa6bfe3680ef63b23
CVE-2014-3610
https://github.com/torvalds/linux/commit/854e8bb1aa06c578c2c9145fa6bfe3680ef63b23
2014-11-10T11:55Z
156
CWE-125
CWE-125 BOOL license_read_new_or_upgrade_license_packet ( rdpLicense * license , wStream * s ) { UINT32 os_major ; UINT32 os_minor ; UINT32 cbScope , cbCompanyName , cbProductId , cbLicenseInfo ; wStream * licenseStream = NULL ; BOOL ret = FALSE ; BYTE computedMac [ 16 ] ; LICENSE_BLOB * calBlob ; DEBUG_LICENSE ( "Receiving<S2SV_blank>Server<S2SV_blank>New/Upgrade<S2SV_blank>License<S2SV_blank>Packet" ) ; calBlob = license_new_binary_blob ( BB_DATA_BLOB ) ; if ( ! calBlob ) return FALSE ; if ( ! license_read_encrypted_blob ( license , s , calBlob ) ) goto out_free_blob ; if ( Stream_GetRemainingLength ( s ) < 16 ) goto out_free_blob ; if ( ! security_mac_data ( license -> MacSaltKey , calBlob -> data , calBlob -> length , computedMac ) ) goto out_free_blob ; if ( memcmp ( computedMac , Stream_Pointer ( s ) , sizeof ( computedMac ) ) != 0 ) { WLog_ERR ( TAG , "new<S2SV_blank>or<S2SV_blank>upgrade<S2SV_blank>license<S2SV_blank>MAC<S2SV_blank>mismatch" ) ; goto out_free_blob ; } if ( ! Stream_SafeSeek ( s , 16 ) ) goto out_free_blob ; licenseStream = Stream_New ( calBlob -> data , calBlob -> length ) ; if ( ! licenseStream ) goto out_free_blob ; <S2SV_StartBug> Stream_Read_UINT16 ( licenseStream , os_minor ) ; <S2SV_EndBug> Stream_Read_UINT16 ( licenseStream , os_major ) ; Stream_Read_UINT32 ( licenseStream , cbScope ) ; if ( Stream_GetRemainingLength ( licenseStream ) < cbScope ) goto out_free_stream ; # ifdef WITH_DEBUG_LICENSE WLog_DBG ( TAG , "Scope:" ) ; winpr_HexDump ( TAG , WLOG_DEBUG , Stream_Pointer ( licenseStream ) , cbScope ) ; # endif Stream_Seek ( licenseStream , cbScope ) ; <S2SV_StartBug> Stream_Read_UINT32 ( licenseStream , cbCompanyName ) ; <S2SV_EndBug> if ( Stream_GetRemainingLength ( licenseStream ) < cbCompanyName ) goto out_free_stream ; # ifdef WITH_DEBUG_LICENSE WLog_DBG ( TAG , "Company<S2SV_blank>name:" ) ; winpr_HexDump ( TAG , WLOG_DEBUG , Stream_Pointer ( licenseStream ) , cbCompanyName ) ; # endif Stream_Seek ( licenseStream , cbCompanyName ) ; <S2SV_StartBug> Stream_Read_UINT32 ( licenseStream , cbProductId ) ; <S2SV_EndBug> if ( Stream_GetRemainingLength ( licenseStream ) < cbProductId ) goto out_free_stream ; # ifdef WITH_DEBUG_LICENSE WLog_DBG ( TAG , "Product<S2SV_blank>id:" ) ; winpr_HexDump ( TAG , WLOG_DEBUG , Stream_Pointer ( licenseStream ) , cbProductId ) ; # endif Stream_Seek ( licenseStream , cbProductId ) ; <S2SV_StartBug> Stream_Read_UINT32 ( licenseStream , cbLicenseInfo ) ; <S2SV_EndBug> if ( Stream_GetRemainingLength ( licenseStream ) < cbLicenseInfo ) goto out_free_stream ; license -> state = LICENSE_STATE_COMPLETED ; ret = TRUE ; if ( ! license -> rdp -> settings -> OldLicenseBehaviour ) ret = saveCal ( license -> rdp -> settings , Stream_Pointer ( licenseStream ) , cbLicenseInfo , license -> rdp -> settings -> ClientHostname ) ; out_free_stream : Stream_Free ( licenseStream , FALSE ) ; out_free_blob : license_free_binary_blob ( calBlob ) ; return ret ; }
<S2SV_ModStart> goto out_free_blob ; if ( Stream_GetRemainingLength ( licenseStream ) < 8 ) goto out_free_stream ; <S2SV_ModStart> cbScope ) ; if ( Stream_GetRemainingLength ( licenseStream ) < 4 ) goto out_free_stream ; <S2SV_ModStart> cbCompanyName ) ; if ( Stream_GetRemainingLength ( licenseStream ) < 4 ) goto out_free_stream ; <S2SV_ModStart> cbProductId ) ; if ( Stream_GetRemainingLength ( licenseStream ) < 4 ) goto out_free_stream ;
FreeRDP@FreeRDP/6ade7b4cbfd71c54b3d724e8f2d6ac76a58e879a
CVE-2020-11099
https://github.com/FreeRDP/FreeRDP/commit/6ade7b4cbfd71c54b3d724e8f2d6ac76a58e879a
2020-06-22T22:15Z
157
CWE-285
CWE-285 int orangefs_set_acl ( struct inode * inode , struct posix_acl * acl , int type ) { struct orangefs_inode_s * orangefs_inode = ORANGEFS_I ( inode ) ; int error = 0 ; void * value = NULL ; size_t size = 0 ; const char * name = NULL ; switch ( type ) { case ACL_TYPE_ACCESS : name = XATTR_NAME_POSIX_ACL_ACCESS ; if ( acl ) { <S2SV_StartBug> umode_t mode = inode -> i_mode ; <S2SV_EndBug> <S2SV_StartBug> error = posix_acl_equiv_mode ( acl , & mode ) ; <S2SV_EndBug> if ( error < 0 ) { <S2SV_StartBug> gossip_err ( "%s:<S2SV_blank>posix_acl_equiv_mode<S2SV_blank>err:<S2SV_blank>%d\\n" , <S2SV_EndBug> __func__ , error ) ; return error ; } if ( inode -> i_mode != mode ) SetModeFlag ( orangefs_inode ) ; inode -> i_mode = mode ; mark_inode_dirty_sync ( inode ) ; <S2SV_StartBug> if ( error == 0 ) <S2SV_EndBug> acl = NULL ; } break ; case ACL_TYPE_DEFAULT : name = XATTR_NAME_POSIX_ACL_DEFAULT ; break ; default : gossip_err ( "%s:<S2SV_blank>invalid<S2SV_blank>type<S2SV_blank>%d!\\n" , __func__ , type ) ; return - EINVAL ; } gossip_debug ( GOSSIP_ACL_DEBUG , "%s:<S2SV_blank>inode<S2SV_blank>%pU,<S2SV_blank>key<S2SV_blank>%s<S2SV_blank>type<S2SV_blank>%d\\n" , __func__ , get_khandle_from_ino ( inode ) , name , type ) ; if ( acl ) { size = posix_acl_xattr_size ( acl -> a_count ) ; value = kmalloc ( size , GFP_KERNEL ) ; if ( ! value ) return - ENOMEM ; error = posix_acl_to_xattr ( & init_user_ns , acl , value , size ) ; if ( error < 0 ) goto out ; } gossip_debug ( GOSSIP_ACL_DEBUG , "%s:<S2SV_blank>name<S2SV_blank>%s,<S2SV_blank>value<S2SV_blank>%p,<S2SV_blank>size<S2SV_blank>%zd,<S2SV_blank>acl<S2SV_blank>%p\\n" , __func__ , name , value , size , acl ) ; error = orangefs_inode_setxattr ( inode , name , value , size , 0 ) ; out : kfree ( value ) ; if ( ! error ) set_cached_acl ( inode , type , acl ) ; return error ; }
<S2SV_ModStart> { umode_t mode ; error = posix_acl_update_mode ( inode <S2SV_ModEnd> , & mode <S2SV_ModStart> , & mode , & acl ) ; if ( error <S2SV_ModEnd> ) { gossip_err <S2SV_ModStart> { gossip_err ( "%s:<S2SV_blank>posix_acl_update_mode<S2SV_blank>err:<S2SV_blank>%d\\n" <S2SV_ModEnd> , __func__ , <S2SV_ModStart> inode ) ; <S2SV_ModEnd> } break ;
torvalds@linux/073931017b49d9458aa351605b43a7e34598caef
CVE-2016-7097
https://github.com/torvalds/linux/commit/073931017b49d9458aa351605b43a7e34598caef
2016-10-16T21:59Z
158
CWE-120
CWE-120 SecureElementStatus_t SecureElementProcessJoinAccept ( JoinReqIdentifier_t joinReqType , uint8_t * joinEui , uint16_t devNonce , uint8_t * encJoinAccept , uint8_t encJoinAcceptSize , uint8_t * decJoinAccept , uint8_t * versionMinor ) { SecureElementStatus_t status = SECURE_ELEMENT_ERROR ; if ( ( encJoinAccept == NULL ) || ( decJoinAccept == NULL ) || ( versionMinor == NULL ) ) { <S2SV_StartBug> return SECURE_ELEMENT_ERROR_NPE ; <S2SV_EndBug> } KeyIdentifier_t encKeyID = NWK_KEY ; if ( joinReqType != JOIN_REQ ) { encKeyID = J_S_ENC_KEY ; } uint8_t micHeader10 [ 1 ] = { 0x20 } ; lr1110_crypto_process_join_accept ( & LR1110 , ( lr1110_crypto_status_t * ) & status , convert_key_id_from_se_to_lr1110 ( encKeyID ) , convert_key_id_from_se_to_lr1110 ( NWK_KEY ) , ( lr1110_crypto_lorawan_version_t ) 0 , micHeader10 , encJoinAccept + 1 , encJoinAcceptSize - 1 , decJoinAccept + 1 ) ; if ( status == SECURE_ELEMENT_SUCCESS ) { * versionMinor = ( ( decJoinAccept [ 11 ] & 0x80 ) == 0x80 ) ? 1 : 0 ; if ( * versionMinor == 0 ) { return SECURE_ELEMENT_SUCCESS ; } } # if ( USE_LRWAN_1_1_X_CRYPTO == 1 ) uint8_t micHeader11 [ JOIN_ACCEPT_MIC_COMPUTATION_OFFSET ] = { 0 } ; uint16_t bufItr = 0 ; micHeader11 [ bufItr ++ ] = ( uint8_t ) joinReqType ; memcpyr ( micHeader11 + bufItr , joinEui , LORAMAC_JOIN_EUI_FIELD_SIZE ) ; bufItr += LORAMAC_JOIN_EUI_FIELD_SIZE ; micHeader11 [ bufItr ++ ] = devNonce & 0xFF ; micHeader11 [ bufItr ++ ] = ( devNonce >> 8 ) & 0xFF ; micHeader11 [ bufItr ++ ] = 0x20 ; lr1110_crypto_process_join_accept ( & LR1110 , ( lr1110_crypto_status_t * ) & status , convert_key_id_from_se_to_lr1110 ( encKeyID ) , convert_key_id_from_se_to_lr1110 ( J_S_INT_KEY ) , ( lr1110_crypto_lorawan_version_t ) 1 , micHeader11 , encJoinAccept + 1 , encJoinAcceptSize - 1 , decJoinAccept + 1 ) ; if ( status == SECURE_ELEMENT_SUCCESS ) { * versionMinor = ( ( decJoinAccept [ 11 ] & 0x80 ) == 0x80 ) ? 1 : 0 ; if ( * versionMinor == 1 ) { return SECURE_ELEMENT_SUCCESS ; } } # endif return status ; }
<S2SV_ModStart> { return SECURE_ELEMENT_ERROR_NPE ; } if ( encJoinAcceptSize > LORAMAC_JOIN_ACCEPT_FRAME_MAX_SIZE ) { return SECURE_ELEMENT_ERROR_BUF_SIZE
Lora-net@LoRaMac-node/e3063a91daa7ad8a687223efa63079f0c24568e4
CVE-2020-11068
https://github.com/Lora-net/LoRaMac-node/commit/e3063a91daa7ad8a687223efa63079f0c24568e4
2020-06-23T17:15Z
159
CWE-125
CWE-125 void __sock_recv_timestamp ( struct msghdr * msg , struct sock * sk , struct sk_buff * skb ) { int need_software_tstamp = sock_flag ( sk , SOCK_RCVTSTAMP ) ; struct scm_timestamping tss ; int empty = 1 ; struct skb_shared_hwtstamps * shhwtstamps = skb_hwtstamps ( skb ) ; if ( need_software_tstamp && skb -> tstamp == 0 ) __net_timestamp ( skb ) ; if ( need_software_tstamp ) { if ( ! sock_flag ( sk , SOCK_RCVTSTAMPNS ) ) { struct timeval tv ; skb_get_timestamp ( skb , & tv ) ; put_cmsg ( msg , SOL_SOCKET , SCM_TIMESTAMP , sizeof ( tv ) , & tv ) ; } else { struct timespec ts ; skb_get_timestampns ( skb , & ts ) ; put_cmsg ( msg , SOL_SOCKET , SCM_TIMESTAMPNS , sizeof ( ts ) , & ts ) ; } } memset ( & tss , 0 , sizeof ( tss ) ) ; if ( ( sk -> sk_tsflags & SOF_TIMESTAMPING_SOFTWARE ) && ktime_to_timespec_cond ( skb -> tstamp , tss . ts + 0 ) ) empty = 0 ; if ( shhwtstamps && ( sk -> sk_tsflags & SOF_TIMESTAMPING_RAW_HARDWARE ) && ktime_to_timespec_cond ( shhwtstamps -> hwtstamp , tss . ts + 2 ) ) empty = 0 ; if ( ! empty ) { put_cmsg ( msg , SOL_SOCKET , SCM_TIMESTAMPING , sizeof ( tss ) , & tss ) ; <S2SV_StartBug> if ( skb -> len && ( sk -> sk_tsflags & SOF_TIMESTAMPING_OPT_STATS ) ) <S2SV_EndBug> put_cmsg ( msg , SOL_SOCKET , SCM_TIMESTAMPING_OPT_STATS , skb -> len , skb -> data ) ; } }
<S2SV_ModStart> ; if ( skb_is_err_queue ( skb ) &&
torvalds@linux/8605330aac5a5785630aec8f64378a54891937cc
CVE-2017-7277
https://github.com/torvalds/linux/commit/8605330aac5a5785630aec8f64378a54891937cc
2017-03-28T06:59Z
160
CWE-399
CWE-399 static void do_free_upto ( BIO * f , BIO * upto ) { if ( upto ) { BIO * tbio ; do { tbio = BIO_pop ( f ) ; BIO_free ( f ) ; f = tbio ; } <S2SV_StartBug> while ( f != upto ) ; <S2SV_EndBug> } else BIO_free_all ( f ) ; }
<S2SV_ModStart> while ( f && f
openssl@openssl/cd30f03ac5bf2962f44bd02ae8d88245dff2f12c
CVE-2015-1792
https://github.com/openssl/openssl/commit/cd30f03ac5bf2962f44bd02ae8d88245dff2f12c
2015-06-12T19:59Z
161
CWE-20
CWE-20 int main ( void ) { int fd , len , sock_opt ; int error ; struct cn_msg * message ; struct pollfd pfd ; struct nlmsghdr * incoming_msg ; struct cn_msg * incoming_cn_msg ; struct hv_kvp_msg * hv_msg ; char * p ; char * key_value ; char * key_name ; daemon ( 1 , 0 ) ; openlog ( "KVP" , 0 , LOG_USER ) ; syslog ( LOG_INFO , "KVP<S2SV_blank>starting;<S2SV_blank>pid<S2SV_blank>is:%d" , getpid ( ) ) ; kvp_get_os_info ( ) ; if ( kvp_file_init ( ) ) { syslog ( LOG_ERR , "Failed<S2SV_blank>to<S2SV_blank>initialize<S2SV_blank>the<S2SV_blank>pools" ) ; exit ( - 1 ) ; } fd = socket ( AF_NETLINK , SOCK_DGRAM , NETLINK_CONNECTOR ) ; if ( fd < 0 ) { syslog ( LOG_ERR , "netlink<S2SV_blank>socket<S2SV_blank>creation<S2SV_blank>failed;<S2SV_blank>error:%d" , fd ) ; exit ( - 1 ) ; } addr . nl_family = AF_NETLINK ; addr . nl_pad = 0 ; addr . nl_pid = 0 ; addr . nl_groups = CN_KVP_IDX ; error = bind ( fd , ( struct sockaddr * ) & addr , sizeof ( addr ) ) ; if ( error < 0 ) { syslog ( LOG_ERR , "bind<S2SV_blank>failed;<S2SV_blank>error:%d" , error ) ; close ( fd ) ; exit ( - 1 ) ; } sock_opt = addr . nl_groups ; setsockopt ( fd , 270 , 1 , & sock_opt , sizeof ( sock_opt ) ) ; message = ( struct cn_msg * ) kvp_send_buffer ; message -> id . idx = CN_KVP_IDX ; message -> id . val = CN_KVP_VAL ; hv_msg = ( struct hv_kvp_msg * ) message -> data ; hv_msg -> kvp_hdr . operation = KVP_OP_REGISTER ; message -> ack = 0 ; message -> len = sizeof ( struct hv_kvp_msg ) ; len = netlink_send ( fd , message ) ; if ( len < 0 ) { syslog ( LOG_ERR , "netlink_send<S2SV_blank>failed;<S2SV_blank>error:%d" , len ) ; close ( fd ) ; exit ( - 1 ) ; } pfd . fd = fd ; while ( 1 ) { <S2SV_StartBug> pfd . events = POLLIN ; <S2SV_EndBug> pfd . revents = 0 ; poll ( & pfd , 1 , - 1 ) ; <S2SV_StartBug> len = recv ( fd , kvp_recv_buffer , sizeof ( kvp_recv_buffer ) , 0 ) ; <S2SV_EndBug> <S2SV_StartBug> if ( len < 0 ) { <S2SV_EndBug> <S2SV_StartBug> syslog ( LOG_ERR , "recv<S2SV_blank>failed;<S2SV_blank>error:%d" , len ) ; <S2SV_EndBug> close ( fd ) ; return - 1 ; } incoming_msg = ( struct nlmsghdr * ) kvp_recv_buffer ; incoming_cn_msg = ( struct cn_msg * ) NLMSG_DATA ( incoming_msg ) ; hv_msg = ( struct hv_kvp_msg * ) incoming_cn_msg -> data ; switch ( hv_msg -> kvp_hdr . operation ) { case KVP_OP_REGISTER : p = ( char * ) hv_msg -> body . kvp_register . version ; lic_version = malloc ( strlen ( p ) + 1 ) ; if ( lic_version ) { strcpy ( lic_version , p ) ; syslog ( LOG_INFO , "KVP<S2SV_blank>LIC<S2SV_blank>Version:<S2SV_blank>%s" , lic_version ) ; } else { syslog ( LOG_ERR , "malloc<S2SV_blank>failed" ) ; } continue ; case KVP_OP_SET : if ( kvp_key_add_or_modify ( hv_msg -> kvp_hdr . pool , hv_msg -> body . kvp_set . data . key , hv_msg -> body . kvp_set . data . key_size , hv_msg -> body . kvp_set . data . value , hv_msg -> body . kvp_set . data . value_size ) ) strcpy ( hv_msg -> body . kvp_set . data . key , "" ) ; break ; case KVP_OP_GET : if ( kvp_get_value ( hv_msg -> kvp_hdr . pool , hv_msg -> body . kvp_set . data . key , hv_msg -> body . kvp_set . data . key_size , hv_msg -> body . kvp_set . data . value , hv_msg -> body . kvp_set . data . value_size ) ) strcpy ( hv_msg -> body . kvp_set . data . key , "" ) ; break ; case KVP_OP_DELETE : if ( kvp_key_delete ( hv_msg -> kvp_hdr . pool , hv_msg -> body . kvp_delete . key , hv_msg -> body . kvp_delete . key_size ) ) strcpy ( hv_msg -> body . kvp_delete . key , "" ) ; break ; default : break ; } if ( hv_msg -> kvp_hdr . operation != KVP_OP_ENUMERATE ) goto kvp_done ; if ( hv_msg -> kvp_hdr . pool != KVP_POOL_AUTO ) { kvp_pool_enumerate ( hv_msg -> kvp_hdr . pool , hv_msg -> body . kvp_enum_data . index , hv_msg -> body . kvp_enum_data . data . key , HV_KVP_EXCHANGE_MAX_KEY_SIZE , hv_msg -> body . kvp_enum_data . data . value , HV_KVP_EXCHANGE_MAX_VALUE_SIZE ) ; goto kvp_done ; } hv_msg = ( struct hv_kvp_msg * ) incoming_cn_msg -> data ; key_name = ( char * ) hv_msg -> body . kvp_enum_data . data . key ; key_value = ( char * ) hv_msg -> body . kvp_enum_data . data . value ; switch ( hv_msg -> body . kvp_enum_data . index ) { case FullyQualifiedDomainName : kvp_get_domain_name ( key_value , HV_KVP_EXCHANGE_MAX_VALUE_SIZE ) ; strcpy ( key_name , "FullyQualifiedDomainName" ) ; break ; case IntegrationServicesVersion : strcpy ( key_name , "IntegrationServicesVersion" ) ; strcpy ( key_value , lic_version ) ; break ; case NetworkAddressIPv4 : kvp_get_ip_address ( AF_INET , key_value , HV_KVP_EXCHANGE_MAX_VALUE_SIZE ) ; strcpy ( key_name , "NetworkAddressIPv4" ) ; break ; case NetworkAddressIPv6 : kvp_get_ip_address ( AF_INET6 , key_value , HV_KVP_EXCHANGE_MAX_VALUE_SIZE ) ; strcpy ( key_name , "NetworkAddressIPv6" ) ; break ; case OSBuildNumber : strcpy ( key_value , os_build ) ; strcpy ( key_name , "OSBuildNumber" ) ; break ; case OSName : strcpy ( key_value , os_name ) ; strcpy ( key_name , "OSName" ) ; break ; case OSMajorVersion : strcpy ( key_value , os_major ) ; strcpy ( key_name , "OSMajorVersion" ) ; break ; case OSMinorVersion : strcpy ( key_value , os_minor ) ; strcpy ( key_name , "OSMinorVersion" ) ; break ; case OSVersion : strcpy ( key_value , os_build ) ; strcpy ( key_name , "OSVersion" ) ; break ; case ProcessorArchitecture : strcpy ( key_value , processor_arch ) ; strcpy ( key_name , "ProcessorArchitecture" ) ; break ; default : strcpy ( key_value , "Unknown<S2SV_blank>Key" ) ; strcpy ( key_name , "" ) ; break ; } kvp_done : incoming_cn_msg -> id . idx = CN_KVP_IDX ; incoming_cn_msg -> id . val = CN_KVP_VAL ; incoming_cn_msg -> ack = 0 ; incoming_cn_msg -> len = sizeof ( struct hv_kvp_msg ) ; len = netlink_send ( fd , incoming_cn_msg ) ; if ( len < 0 ) { syslog ( LOG_ERR , "net_link<S2SV_blank>send<S2SV_blank>failed;<S2SV_blank>error:%d" , len ) ; exit ( - 1 ) ; } } }
<S2SV_ModStart> 1 ) { struct sockaddr * addr_p = ( struct sockaddr * ) & addr ; socklen_t addr_l = sizeof ( addr ) ; <S2SV_ModStart> ; len = recvfrom <S2SV_ModEnd> ( fd , <S2SV_ModStart> ) , 0 , addr_p , & addr_l <S2SV_ModStart> len < 0 || addr . nl_pid <S2SV_ModStart> ( LOG_ERR , "recvfrom<S2SV_blank>failed;<S2SV_blank>pid:%u<S2SV_blank>error:%d<S2SV_blank>%s" , addr . nl_pid , errno , strerror ( errno ) <S2SV_ModEnd> ) ; close
torvalds@linux/bcc2c9c3fff859e0eb019fe6fec26f9b8eba795c
CVE-2012-2669
https://github.com/torvalds/linux/commit/bcc2c9c3fff859e0eb019fe6fec26f9b8eba795c
2012-12-27T11:47Z
162
CWE-362
CWE-362 static void init_once ( void * foo ) { struct ext4_inode_info * ei = ( struct ext4_inode_info * ) foo ; INIT_LIST_HEAD ( & ei -> i_orphan ) ; init_rwsem ( & ei -> xattr_sem ) ; init_rwsem ( & ei -> i_data_sem ) ; <S2SV_StartBug> inode_init_once ( & ei -> vfs_inode ) ; <S2SV_EndBug> }
<S2SV_ModStart> i_data_sem ) ; init_rwsem ( & ei -> i_mmap_sem ) ;
torvalds@linux/ea3d7209ca01da209cda6f0dea8be9cc4b7a933b
CVE-2015-8839
https://github.com/torvalds/linux/commit/ea3d7209ca01da209cda6f0dea8be9cc4b7a933b
2016-05-02T10:59Z
163
CWE-119
CWE-119 int vp8dx_get_raw_frame ( VP8D_COMP * pbi , YV12_BUFFER_CONFIG * sd , int64_t * time_stamp , int64_t * time_end_stamp , vp8_ppflags_t * flags ) { int ret = - 1 ; if ( pbi -> ready_for_new_data == 1 ) return ret ; if ( pbi -> common . show_frame == 0 ) return ret ; pbi -> ready_for_new_data = 1 ; * time_stamp = pbi -> last_time_stamp ; * time_end_stamp = 0 ; # if CONFIG_POSTPROC ret = vp8_post_proc_frame ( & pbi -> common , sd , flags ) ; # else <S2SV_StartBug> if ( pbi -> common . frame_to_show ) <S2SV_EndBug> { * sd = * pbi -> common . frame_to_show ; sd -> y_width = pbi -> common . Width ; sd -> y_height = pbi -> common . Height ; sd -> uv_height = pbi -> common . Height / 2 ; ret = 0 ; } else { ret = - 1 ; } # endif vp8_clear_system_state ( ) ; return ret ; }
<S2SV_ModStart> ; # else ( void ) flags ;
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
164
CWE-125
CWE-125 static Image * ReadVIFFImage ( const ImageInfo * image_info , ExceptionInfo * exception ) { # define VFF_CM_genericRGB 15 # define VFF_CM_ntscRGB 1 # define VFF_CM_NONE 0 # define VFF_DEP_DECORDER 0x4 # define VFF_DEP_NSORDER 0x8 # define VFF_DES_RAW 0 # define VFF_LOC_IMPLICIT 1 # define VFF_MAPTYP_NONE 0 # define VFF_MAPTYP_1_BYTE 1 # define VFF_MAPTYP_2_BYTE 2 # define VFF_MAPTYP_4_BYTE 4 # define VFF_MAPTYP_FLOAT 5 # define VFF_MAPTYP_DOUBLE 7 # define VFF_MS_NONE 0 # define VFF_MS_ONEPERBAND 1 # define VFF_MS_SHARED 3 # define VFF_TYP_BIT 0 # define VFF_TYP_1_BYTE 1 # define VFF_TYP_2_BYTE 2 # define VFF_TYP_4_BYTE 4 # define VFF_TYP_FLOAT 5 # define VFF_TYP_DOUBLE 9 typedef struct _ViffInfo { unsigned char identifier , file_type , release , version , machine_dependency , reserve [ 3 ] ; char comment [ 512 ] ; unsigned int rows , columns , subrows ; int x_offset , y_offset ; float x_bits_per_pixel , y_bits_per_pixel ; unsigned int location_type , location_dimension , number_of_images , number_data_bands , data_storage_type , data_encode_scheme , map_scheme , map_storage_type , map_rows , map_columns , map_subrows , map_enable , maps_per_cycle , color_space_model ; } ViffInfo ; double min_value , scale_factor , value ; Image * image ; int bit ; MagickBooleanType status ; MagickSizeType number_pixels ; register ssize_t x ; register Quantum * q ; register ssize_t i ; register unsigned char * p ; size_t bytes_per_pixel , max_packets , quantum ; ssize_t count , y ; unsigned char * pixels ; unsigned long lsb_first ; ViffInfo viff_info ; assert ( image_info != ( const ImageInfo * ) NULL ) ; assert ( image_info -> signature == MagickCoreSignature ) ; if ( image_info -> debug != MagickFalse ) ( void ) LogMagickEvent ( TraceEvent , GetMagickModule ( ) , "%s" , image_info -> filename ) ; assert ( exception != ( ExceptionInfo * ) NULL ) ; assert ( exception -> signature == MagickCoreSignature ) ; image = AcquireImage ( image_info , exception ) ; status = OpenBlob ( image_info , image , ReadBinaryBlobMode , exception ) ; if ( status == MagickFalse ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } count = ReadBlob ( image , 1 , & viff_info . identifier ) ; do { if ( ( count != 1 ) || ( ( unsigned char ) viff_info . identifier != 0xab ) ) ThrowReaderException ( CorruptImageError , "NotAVIFFImage" ) ; ( void ) ReadBlob ( image , sizeof ( viff_info . file_type ) , & viff_info . file_type ) ; ( void ) ReadBlob ( image , sizeof ( viff_info . release ) , & viff_info . release ) ; ( void ) ReadBlob ( image , sizeof ( viff_info . version ) , & viff_info . version ) ; ( void ) ReadBlob ( image , sizeof ( viff_info . machine_dependency ) , & viff_info . machine_dependency ) ; ( void ) ReadBlob ( image , sizeof ( viff_info . reserve ) , viff_info . reserve ) ; count = ReadBlob ( image , 512 , ( unsigned char * ) viff_info . comment ) ; viff_info . comment [ 511 ] = '\\0' ; if ( strlen ( viff_info . comment ) > 4 ) ( void ) SetImageProperty ( image , "comment" , viff_info . comment , exception ) ; if ( ( viff_info . machine_dependency == VFF_DEP_DECORDER ) || ( viff_info . machine_dependency == VFF_DEP_NSORDER ) ) image -> endian = LSBEndian ; else image -> endian = MSBEndian ; viff_info . rows = ReadBlobLong ( image ) ; viff_info . columns = ReadBlobLong ( image ) ; viff_info . subrows = ReadBlobLong ( image ) ; viff_info . x_offset = ( int ) ReadBlobLong ( image ) ; viff_info . y_offset = ( int ) ReadBlobLong ( image ) ; viff_info . x_bits_per_pixel = ( float ) ReadBlobLong ( image ) ; viff_info . y_bits_per_pixel = ( float ) ReadBlobLong ( image ) ; viff_info . location_type = ReadBlobLong ( image ) ; viff_info . location_dimension = ReadBlobLong ( image ) ; viff_info . number_of_images = ReadBlobLong ( image ) ; viff_info . number_data_bands = ReadBlobLong ( image ) ; viff_info . data_storage_type = ReadBlobLong ( image ) ; viff_info . data_encode_scheme = ReadBlobLong ( image ) ; viff_info . map_scheme = ReadBlobLong ( image ) ; viff_info . map_storage_type = ReadBlobLong ( image ) ; viff_info . map_rows = ReadBlobLong ( image ) ; viff_info . map_columns = ReadBlobLong ( image ) ; viff_info . map_subrows = ReadBlobLong ( image ) ; viff_info . map_enable = ReadBlobLong ( image ) ; viff_info . maps_per_cycle = ReadBlobLong ( image ) ; viff_info . color_space_model = ReadBlobLong ( image ) ; for ( i = 0 ; i < 420 ; i ++ ) ( void ) ReadBlobByte ( image ) ; if ( EOFBlob ( image ) != MagickFalse ) ThrowReaderException ( CorruptImageError , "UnexpectedEndOfFile" ) ; image -> columns = viff_info . rows ; image -> rows = viff_info . columns ; image -> depth = viff_info . x_bits_per_pixel <= 8 ? 8UL : MAGICKCORE_QUANTUM_DEPTH ; number_pixels = ( MagickSizeType ) viff_info . columns * viff_info . rows ; if ( number_pixels != ( size_t ) number_pixels ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; if ( number_pixels == 0 ) ThrowReaderException ( CoderError , "ImageColumnOrRowSizeIsNotSupported" ) ; if ( ( viff_info . number_data_bands < 1 ) || ( viff_info . number_data_bands > 4 ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; if ( ( viff_info . data_storage_type != VFF_TYP_BIT ) && ( viff_info . data_storage_type != VFF_TYP_1_BYTE ) && ( viff_info . data_storage_type != VFF_TYP_2_BYTE ) && ( viff_info . data_storage_type != VFF_TYP_4_BYTE ) && ( viff_info . data_storage_type != VFF_TYP_FLOAT ) && ( viff_info . data_storage_type != VFF_TYP_DOUBLE ) ) ThrowReaderException ( CoderError , "DataStorageTypeIsNotSupported" ) ; if ( viff_info . data_encode_scheme != VFF_DES_RAW ) ThrowReaderException ( CoderError , "DataEncodingSchemeIsNotSupported" ) ; if ( ( viff_info . map_storage_type != VFF_MAPTYP_NONE ) && ( viff_info . map_storage_type != VFF_MAPTYP_1_BYTE ) && ( viff_info . map_storage_type != VFF_MAPTYP_2_BYTE ) && ( viff_info . map_storage_type != VFF_MAPTYP_4_BYTE ) && ( viff_info . map_storage_type != VFF_MAPTYP_FLOAT ) && ( viff_info . map_storage_type != VFF_MAPTYP_DOUBLE ) ) ThrowReaderException ( CoderError , "MapStorageTypeIsNotSupported" ) ; if ( ( viff_info . color_space_model != VFF_CM_NONE ) && ( viff_info . color_space_model != VFF_CM_ntscRGB ) && ( viff_info . color_space_model != VFF_CM_genericRGB ) ) ThrowReaderException ( CoderError , "ColorspaceModelIsNotSupported" ) ; if ( viff_info . location_type != VFF_LOC_IMPLICIT ) ThrowReaderException ( CoderError , "LocationTypeIsNotSupported" ) ; if ( viff_info . number_of_images != 1 ) ThrowReaderException ( CoderError , "NumberOfImagesIsNotSupported" ) ; if ( viff_info . map_rows == 0 ) viff_info . map_scheme = VFF_MS_NONE ; switch ( ( int ) viff_info . map_scheme ) { case VFF_MS_NONE : { if ( viff_info . number_data_bands < 3 ) { if ( viff_info . data_storage_type == VFF_TYP_BIT ) image -> colors = 2 ; else if ( viff_info . data_storage_type == VFF_MAPTYP_1_BYTE ) image -> colors = 256UL ; else image -> colors = image -> depth <= 8 ? 256UL : 65536UL ; status = AcquireImageColormap ( image , image -> colors , exception ) ; if ( status == MagickFalse ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; } break ; } case VFF_MS_ONEPERBAND : case VFF_MS_SHARED : { unsigned char * viff_colormap ; switch ( ( int ) viff_info . map_storage_type ) { case VFF_MAPTYP_1_BYTE : bytes_per_pixel = 1 ; break ; case VFF_MAPTYP_2_BYTE : bytes_per_pixel = 2 ; break ; case VFF_MAPTYP_4_BYTE : bytes_per_pixel = 4 ; break ; case VFF_MAPTYP_FLOAT : bytes_per_pixel = 4 ; break ; case VFF_MAPTYP_DOUBLE : bytes_per_pixel = 8 ; break ; default : bytes_per_pixel = 1 ; break ; } image -> colors = viff_info . map_columns ; if ( AcquireImageColormap ( image , image -> colors , exception ) == MagickFalse ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; if ( viff_info . map_rows > ( viff_info . map_rows * bytes_per_pixel * sizeof ( * viff_colormap ) ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; viff_colormap = ( unsigned char * ) AcquireQuantumMemory ( image -> colors , viff_info . map_rows * bytes_per_pixel * sizeof ( * viff_colormap ) ) ; if ( viff_colormap == ( unsigned char * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; count = ReadBlob ( image , bytes_per_pixel * image -> colors * viff_info . map_rows , viff_colormap ) ; lsb_first = 1 ; if ( * ( char * ) & lsb_first && ( ( viff_info . machine_dependency != VFF_DEP_DECORDER ) && ( viff_info . machine_dependency != VFF_DEP_NSORDER ) ) ) switch ( ( int ) viff_info . map_storage_type ) { case VFF_MAPTYP_2_BYTE : { MSBOrderShort ( viff_colormap , ( bytes_per_pixel * image -> colors * viff_info . map_rows ) ) ; break ; } case VFF_MAPTYP_4_BYTE : case VFF_MAPTYP_FLOAT : { MSBOrderLong ( viff_colormap , ( bytes_per_pixel * image -> colors * viff_info . map_rows ) ) ; break ; } default : break ; } for ( i = 0 ; i < ( ssize_t ) ( viff_info . map_rows * image -> colors ) ; i ++ ) { switch ( ( int ) viff_info . map_storage_type ) { case VFF_MAPTYP_2_BYTE : value = 1.0 * ( ( short * ) viff_colormap ) [ i ] ; break ; case VFF_MAPTYP_4_BYTE : value = 1.0 * ( ( int * ) viff_colormap ) [ i ] ; break ; case VFF_MAPTYP_FLOAT : value = ( ( float * ) viff_colormap ) [ i ] ; break ; case VFF_MAPTYP_DOUBLE : value = ( ( double * ) viff_colormap ) [ i ] ; break ; default : value = 1.0 * viff_colormap [ i ] ; break ; } if ( i < ( ssize_t ) image -> colors ) { image -> colormap [ i ] . red = ScaleCharToQuantum ( ( unsigned char ) value ) ; image -> colormap [ i ] . green = ScaleCharToQuantum ( ( unsigned char ) value ) ; image -> colormap [ i ] . blue = ScaleCharToQuantum ( ( unsigned char ) value ) ; } else if ( i < ( ssize_t ) ( 2 * image -> colors ) ) image -> colormap [ i % image -> colors ] . green = ScaleCharToQuantum ( ( unsigned char ) value ) ; else if ( i < ( ssize_t ) ( 3 * image -> colors ) ) image -> colormap [ i % image -> colors ] . blue = ScaleCharToQuantum ( ( unsigned char ) value ) ; } viff_colormap = ( unsigned char * ) RelinquishMagickMemory ( viff_colormap ) ; break ; } default : ThrowReaderException ( CoderError , "ColormapTypeNotSupported" ) ; } image -> alpha_trait = viff_info . number_data_bands == 4 ? BlendPixelTrait : UndefinedPixelTrait ; image -> storage_class = ( viff_info . number_data_bands < 3 ? PseudoClass : DirectClass ) ; image -> columns = viff_info . rows ; image -> rows = viff_info . columns ; if ( ( image_info -> ping != MagickFalse ) && ( image_info -> number_scenes != 0 ) ) if ( image -> scene >= ( image_info -> scene + image_info -> number_scenes - 1 ) ) break ; status = SetImageExtent ( image , image -> columns , image -> rows , exception ) ; if ( status == MagickFalse ) return ( DestroyImageList ( image ) ) ; switch ( ( int ) viff_info . data_storage_type ) { case VFF_TYP_2_BYTE : bytes_per_pixel = 2 ; break ; case VFF_TYP_4_BYTE : bytes_per_pixel = 4 ; break ; case VFF_TYP_FLOAT : bytes_per_pixel = 4 ; break ; case VFF_TYP_DOUBLE : bytes_per_pixel = 8 ; break ; default : bytes_per_pixel = 1 ; break ; } if ( viff_info . data_storage_type == VFF_TYP_BIT ) max_packets = ( ( image -> columns + 7UL ) >> 3UL ) * image -> rows ; else max_packets = ( size_t ) ( number_pixels * viff_info . number_data_bands ) ; <S2SV_StartBug> pixels = ( unsigned char * ) AcquireQuantumMemory ( max_packets , <S2SV_EndBug> bytes_per_pixel * sizeof ( * pixels ) ) ; if ( pixels == ( unsigned char * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; count = ReadBlob ( image , bytes_per_pixel * max_packets , pixels ) ; lsb_first = 1 ; if ( * ( char * ) & lsb_first && ( ( viff_info . machine_dependency != VFF_DEP_DECORDER ) && ( viff_info . machine_dependency != VFF_DEP_NSORDER ) ) ) switch ( ( int ) viff_info . data_storage_type ) { case VFF_TYP_2_BYTE : { MSBOrderShort ( pixels , bytes_per_pixel * max_packets ) ; break ; } case VFF_TYP_4_BYTE : case VFF_TYP_FLOAT : { MSBOrderLong ( pixels , bytes_per_pixel * max_packets ) ; break ; } default : break ; } min_value = 0.0 ; scale_factor = 1.0 ; if ( ( viff_info . data_storage_type != VFF_TYP_1_BYTE ) && ( viff_info . map_scheme == VFF_MS_NONE ) ) { double max_value ; switch ( ( int ) viff_info . data_storage_type ) { case VFF_TYP_2_BYTE : value = 1.0 * ( ( short * ) pixels ) [ 0 ] ; break ; case VFF_TYP_4_BYTE : value = 1.0 * ( ( int * ) pixels ) [ 0 ] ; break ; case VFF_TYP_FLOAT : value = ( ( float * ) pixels ) [ 0 ] ; break ; case VFF_TYP_DOUBLE : value = ( ( double * ) pixels ) [ 0 ] ; break ; default : value = 1.0 * pixels [ 0 ] ; break ; } max_value = value ; min_value = value ; for ( i = 0 ; i < ( ssize_t ) max_packets ; i ++ ) { switch ( ( int ) viff_info . data_storage_type ) { case VFF_TYP_2_BYTE : value = 1.0 * ( ( short * ) pixels ) [ i ] ; break ; case VFF_TYP_4_BYTE : value = 1.0 * ( ( int * ) pixels ) [ i ] ; break ; case VFF_TYP_FLOAT : value = ( ( float * ) pixels ) [ i ] ; break ; case VFF_TYP_DOUBLE : value = ( ( double * ) pixels ) [ i ] ; break ; default : value = 1.0 * pixels [ i ] ; break ; } if ( value > max_value ) max_value = value ; else if ( value < min_value ) min_value = value ; } if ( ( min_value == 0 ) && ( max_value == 0 ) ) scale_factor = 0 ; else if ( min_value == max_value ) { scale_factor = ( double ) QuantumRange / min_value ; min_value = 0 ; } else scale_factor = ( double ) QuantumRange / ( max_value - min_value ) ; } p = ( unsigned char * ) pixels ; for ( i = 0 ; i < ( ssize_t ) max_packets ; i ++ ) { switch ( ( int ) viff_info . data_storage_type ) { case VFF_TYP_2_BYTE : value = 1.0 * ( ( short * ) pixels ) [ i ] ; break ; case VFF_TYP_4_BYTE : value = 1.0 * ( ( int * ) pixels ) [ i ] ; break ; case VFF_TYP_FLOAT : value = ( ( float * ) pixels ) [ i ] ; break ; case VFF_TYP_DOUBLE : value = ( ( double * ) pixels ) [ i ] ; break ; default : value = 1.0 * pixels [ i ] ; break ; } if ( viff_info . map_scheme == VFF_MS_NONE ) { value = ( value - min_value ) * scale_factor ; if ( value > QuantumRange ) value = QuantumRange ; else if ( value < 0 ) value = 0 ; } * p = ( unsigned char ) ( ( Quantum ) value ) ; p ++ ; } p = ( unsigned char * ) pixels ; if ( viff_info . data_storage_type == VFF_TYP_BIT ) { for ( y = 0 ; y < ( ssize_t ) image -> rows ; y ++ ) { q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( Quantum * ) NULL ) break ; for ( x = 0 ; x < ( ssize_t ) ( image -> columns - 7 ) ; x += 8 ) { for ( bit = 0 ; bit < 8 ; bit ++ ) { quantum = ( size_t ) ( ( * p ) & ( 0x01 << bit ) ? 0 : 1 ) ; SetPixelRed ( image , quantum == 0 ? 0 : QuantumRange , q ) ; SetPixelGreen ( image , quantum == 0 ? 0 : QuantumRange , q ) ; SetPixelBlue ( image , quantum == 0 ? 0 : QuantumRange , q ) ; if ( image -> storage_class == PseudoClass ) SetPixelIndex ( image , ( Quantum ) quantum , q ) ; q += GetPixelChannels ( image ) ; } p ++ ; } if ( ( image -> columns % 8 ) != 0 ) { for ( bit = 0 ; bit < ( int ) ( image -> columns % 8 ) ; bit ++ ) { quantum = ( size_t ) ( ( * p ) & ( 0x01 << bit ) ? 0 : 1 ) ; SetPixelRed ( image , quantum == 0 ? 0 : QuantumRange , q ) ; SetPixelGreen ( image , quantum == 0 ? 0 : QuantumRange , q ) ; SetPixelBlue ( image , quantum == 0 ? 0 : QuantumRange , q ) ; if ( image -> storage_class == PseudoClass ) SetPixelIndex ( image , ( Quantum ) quantum , q ) ; q += GetPixelChannels ( image ) ; } p ++ ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) y , image -> rows ) ; if ( status == MagickFalse ) break ; } } } else if ( image -> storage_class == PseudoClass ) for ( y = 0 ; y < ( ssize_t ) image -> rows ; y ++ ) { q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( Quantum * ) NULL ) break ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) { SetPixelIndex ( image , * p ++ , q ) ; q += GetPixelChannels ( image ) ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) y , image -> rows ) ; if ( status == MagickFalse ) break ; } } else { number_pixels = ( MagickSizeType ) image -> columns * image -> rows ; for ( y = 0 ; y < ( ssize_t ) image -> rows ; y ++ ) { q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( Quantum * ) NULL ) break ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) { SetPixelRed ( image , ScaleCharToQuantum ( * p ) , q ) ; SetPixelGreen ( image , ScaleCharToQuantum ( * ( p + number_pixels ) ) , q ) ; SetPixelBlue ( image , ScaleCharToQuantum ( * ( p + 2 * number_pixels ) ) , q ) ; if ( image -> colors != 0 ) { ssize_t index ; index = ( ssize_t ) GetPixelRed ( image , q ) ; SetPixelRed ( image , image -> colormap [ ConstrainColormapIndex ( image , index , exception ) ] . red , q ) ; index = ( ssize_t ) GetPixelGreen ( image , q ) ; SetPixelGreen ( image , image -> colormap [ ConstrainColormapIndex ( image , index , exception ) ] . green , q ) ; index = ( ssize_t ) GetPixelBlue ( image , q ) ; SetPixelBlue ( image , image -> colormap [ ConstrainColormapIndex ( image , index , exception ) ] . blue , q ) ; } SetPixelAlpha ( image , image -> alpha_trait != UndefinedPixelTrait ? ScaleCharToQuantum ( * ( p + number_pixels * 3 ) ) : OpaqueAlpha , q ) ; p ++ ; q += GetPixelChannels ( image ) ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) y , image -> rows ) ; if ( status == MagickFalse ) break ; } } } pixels = ( unsigned char * ) RelinquishMagickMemory ( pixels ) ; if ( image -> storage_class == PseudoClass ) ( void ) SyncImage ( image , exception ) ; if ( EOFBlob ( image ) != MagickFalse ) { ThrowFileException ( exception , CorruptImageError , "UnexpectedEndOfFile" , image -> filename ) ; break ; } if ( image_info -> number_scenes != 0 ) if ( image -> scene >= ( image_info -> scene + image_info -> number_scenes - 1 ) ) break ; count = ReadBlob ( image , 1 , & viff_info . identifier ) ; if ( ( count != 0 ) && ( viff_info . identifier == 0xab ) ) { AcquireNextImage ( image_info , image , exception ) ; if ( GetNextImageInList ( image ) == ( Image * ) NULL ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } image = SyncNextImageInList ( image ) ; status = SetImageProgress ( image , LoadImagesTag , TellBlob ( image ) , GetBlobSize ( image ) ) ; if ( status == MagickFalse ) break ; } } while ( ( count != 0 ) && ( viff_info . identifier == 0xab ) ) ; ( void ) CloseBlob ( image ) ; return ( GetFirstImageInList ( image ) ) ; }
<S2SV_ModStart> ) AcquireQuantumMemory ( MagickMax ( number_pixels , max_packets ) , <S2SV_ModEnd> bytes_per_pixel * sizeof
ImageMagick@ImageMagick/7be16a280014f895a951db4948df316a23dabc09
CVE-2016-7528
https://github.com/ImageMagick/ImageMagick/commit/7be16a280014f895a951db4948df316a23dabc09
2017-04-19T14:59Z
165
CWE-400
CWE-400 int do_mathemu ( struct pt_regs * regs , struct fpustate * f ) { unsigned long pc = regs -> tpc ; unsigned long tstate = regs -> tstate ; u32 insn = 0 ; int type = 0 ; # define TYPE ( ftt , r , ru , b , bu , a , au ) type = ( au << 2 ) | ( a << 0 ) | ( bu << 5 ) | ( b << 3 ) | ( ru << 8 ) | ( r << 6 ) | ( ftt << 9 ) int freg ; static u64 zero [ 2 ] = { 0L , 0L } ; int flags ; FP_DECL_EX ; FP_DECL_S ( SA ) ; FP_DECL_S ( SB ) ; FP_DECL_S ( SR ) ; FP_DECL_D ( DA ) ; FP_DECL_D ( DB ) ; FP_DECL_D ( DR ) ; FP_DECL_Q ( QA ) ; FP_DECL_Q ( QB ) ; FP_DECL_Q ( QR ) ; int IR ; long XR , xfsr ; if ( tstate & TSTATE_PRIV ) die_if_kernel ( "unfinished/unimplemented<S2SV_blank>FPop<S2SV_blank>from<S2SV_blank>kernel" , regs ) ; <S2SV_StartBug> perf_sw_event ( PERF_COUNT_SW_EMULATION_FAULTS , 1 , 0 , regs , 0 ) ; <S2SV_EndBug> if ( test_thread_flag ( TIF_32BIT ) ) pc = ( u32 ) pc ; if ( get_user ( insn , ( u32 __user * ) pc ) != - EFAULT ) { if ( ( insn & 0xc1f80000 ) == 0x81a00000 ) { switch ( ( insn >> 5 ) & 0x1ff ) { case FMOVQ : case FNEGQ : case FABSQ : TYPE ( 3 , 3 , 0 , 3 , 0 , 0 , 0 ) ; break ; case FSQRTQ : TYPE ( 3 , 3 , 1 , 3 , 1 , 0 , 0 ) ; break ; case FADDQ : case FSUBQ : case FMULQ : case FDIVQ : TYPE ( 3 , 3 , 1 , 3 , 1 , 3 , 1 ) ; break ; case FDMULQ : TYPE ( 3 , 3 , 1 , 2 , 1 , 2 , 1 ) ; break ; case FQTOX : TYPE ( 3 , 2 , 0 , 3 , 1 , 0 , 0 ) ; break ; case FXTOQ : TYPE ( 3 , 3 , 1 , 2 , 0 , 0 , 0 ) ; break ; case FQTOS : TYPE ( 3 , 1 , 1 , 3 , 1 , 0 , 0 ) ; break ; case FQTOD : TYPE ( 3 , 2 , 1 , 3 , 1 , 0 , 0 ) ; break ; case FITOQ : TYPE ( 3 , 3 , 1 , 1 , 0 , 0 , 0 ) ; break ; case FSTOQ : TYPE ( 3 , 3 , 1 , 1 , 1 , 0 , 0 ) ; break ; case FDTOQ : TYPE ( 3 , 3 , 1 , 2 , 1 , 0 , 0 ) ; break ; case FQTOI : TYPE ( 3 , 1 , 0 , 3 , 1 , 0 , 0 ) ; break ; case FSQRTS : { unsigned long x = current_thread_info ( ) -> xfsr [ 0 ] ; x = ( x >> 14 ) & 0xf ; TYPE ( x , 1 , 1 , 1 , 1 , 0 , 0 ) ; break ; } case FSQRTD : { unsigned long x = current_thread_info ( ) -> xfsr [ 0 ] ; x = ( x >> 14 ) & 0xf ; TYPE ( x , 2 , 1 , 2 , 1 , 0 , 0 ) ; break ; } case FADDD : case FSUBD : case FMULD : case FDIVD : TYPE ( 2 , 2 , 1 , 2 , 1 , 2 , 1 ) ; break ; case FADDS : case FSUBS : case FMULS : case FDIVS : TYPE ( 2 , 1 , 1 , 1 , 1 , 1 , 1 ) ; break ; case FSMULD : TYPE ( 2 , 2 , 1 , 1 , 1 , 1 , 1 ) ; break ; case FSTOX : TYPE ( 2 , 2 , 0 , 1 , 1 , 0 , 0 ) ; break ; case FDTOX : TYPE ( 2 , 2 , 0 , 2 , 1 , 0 , 0 ) ; break ; case FDTOS : TYPE ( 2 , 1 , 1 , 2 , 1 , 0 , 0 ) ; break ; case FSTOD : TYPE ( 2 , 2 , 1 , 1 , 1 , 0 , 0 ) ; break ; case FSTOI : TYPE ( 2 , 1 , 0 , 1 , 1 , 0 , 0 ) ; break ; case FDTOI : TYPE ( 2 , 1 , 0 , 2 , 1 , 0 , 0 ) ; break ; case FXTOS : TYPE ( 2 , 1 , 1 , 2 , 0 , 0 , 0 ) ; break ; case FXTOD : TYPE ( 2 , 2 , 1 , 2 , 0 , 0 , 0 ) ; break ; # if 0 case FITOS : TYPE ( 2 , 1 , 1 , 1 , 0 , 0 , 0 ) ; break ; # endif case FITOD : TYPE ( 2 , 2 , 1 , 1 , 0 , 0 , 0 ) ; break ; } } else if ( ( insn & 0xc1f80000 ) == 0x81a80000 ) { IR = 2 ; switch ( ( insn >> 5 ) & 0x1ff ) { case FCMPQ : TYPE ( 3 , 0 , 0 , 3 , 1 , 3 , 1 ) ; break ; case FCMPEQ : TYPE ( 3 , 0 , 0 , 3 , 1 , 3 , 1 ) ; break ; case FMOVQ0 : case FMOVQ1 : case FMOVQ2 : case FMOVQ3 : if ( ! ( ( insn >> 11 ) & 3 ) ) XR = current_thread_info ( ) -> xfsr [ 0 ] >> 10 ; else XR = current_thread_info ( ) -> xfsr [ 0 ] >> ( 30 + ( ( insn >> 10 ) & 0x6 ) ) ; XR &= 3 ; IR = 0 ; switch ( ( insn >> 14 ) & 0x7 ) { case 1 : if ( XR ) IR = 1 ; break ; case 2 : if ( XR == 1 || XR == 2 ) IR = 1 ; break ; case 3 : if ( XR & 1 ) IR = 1 ; break ; case 4 : if ( XR == 1 ) IR = 1 ; break ; case 5 : if ( XR & 2 ) IR = 1 ; break ; case 6 : if ( XR == 2 ) IR = 1 ; break ; case 7 : if ( XR == 3 ) IR = 1 ; break ; } if ( ( insn >> 14 ) & 8 ) IR ^= 1 ; break ; case FMOVQI : case FMOVQX : XR = regs -> tstate >> 32 ; if ( ( insn >> 5 ) & 0x80 ) XR >>= 4 ; XR &= 0xf ; IR = 0 ; freg = ( ( XR >> 2 ) ^ XR ) & 2 ; switch ( ( insn >> 14 ) & 0x7 ) { case 1 : if ( XR & 4 ) IR = 1 ; break ; case 2 : if ( ( XR & 4 ) || freg ) IR = 1 ; break ; case 3 : if ( freg ) IR = 1 ; break ; case 4 : if ( XR & 5 ) IR = 1 ; break ; case 5 : if ( XR & 1 ) IR = 1 ; break ; case 6 : if ( XR & 8 ) IR = 1 ; break ; case 7 : if ( XR & 2 ) IR = 1 ; break ; } if ( ( insn >> 14 ) & 8 ) IR ^= 1 ; break ; case FMOVQZ : case FMOVQLE : case FMOVQLZ : case FMOVQNZ : case FMOVQGZ : case FMOVQGE : freg = ( insn >> 14 ) & 0x1f ; if ( ! freg ) XR = 0 ; else if ( freg < 16 ) XR = regs -> u_regs [ freg ] ; else if ( test_thread_flag ( TIF_32BIT ) ) { struct reg_window32 __user * win32 ; flushw_user ( ) ; win32 = ( struct reg_window32 __user * ) ( ( unsigned long ) ( ( u32 ) regs -> u_regs [ UREG_FP ] ) ) ; get_user ( XR , & win32 -> locals [ freg - 16 ] ) ; } else { struct reg_window __user * win ; flushw_user ( ) ; win = ( struct reg_window __user * ) ( regs -> u_regs [ UREG_FP ] + STACK_BIAS ) ; get_user ( XR , & win -> locals [ freg - 16 ] ) ; } IR = 0 ; switch ( ( insn >> 10 ) & 3 ) { case 1 : if ( ! XR ) IR = 1 ; break ; case 2 : if ( XR <= 0 ) IR = 1 ; break ; case 3 : if ( XR < 0 ) IR = 1 ; break ; } if ( ( insn >> 10 ) & 4 ) IR ^= 1 ; break ; } if ( IR == 0 ) { current_thread_info ( ) -> xfsr [ 0 ] &= ~ ( FSR_CEXC_MASK ) ; regs -> tpc = regs -> tnpc ; regs -> tnpc += 4 ; return 1 ; } else if ( IR == 1 ) { insn = ( insn & 0x3e00001f ) | 0x81a00060 ; TYPE ( 3 , 3 , 0 , 3 , 0 , 0 , 0 ) ; } } } if ( type ) { argp rs1 = NULL , rs2 = NULL , rd = NULL ; freg = ( current_thread_info ( ) -> xfsr [ 0 ] >> 14 ) & 0xf ; if ( freg != ( type >> 9 ) ) goto err ; current_thread_info ( ) -> xfsr [ 0 ] &= ~ 0x1c000 ; freg = ( ( insn >> 14 ) & 0x1f ) ; switch ( type & 0x3 ) { case 3 : if ( freg & 2 ) { current_thread_info ( ) -> xfsr [ 0 ] |= ( 6 << 14 ) ; goto err ; } case 2 : freg = ( ( freg & 1 ) << 5 ) | ( freg & 0x1e ) ; case 1 : rs1 = ( argp ) & f -> regs [ freg ] ; flags = ( freg < 32 ) ? FPRS_DL : FPRS_DU ; if ( ! ( current_thread_info ( ) -> fpsaved [ 0 ] & flags ) ) rs1 = ( argp ) & zero ; break ; } switch ( type & 0x7 ) { case 7 : FP_UNPACK_QP ( QA , rs1 ) ; break ; case 6 : FP_UNPACK_DP ( DA , rs1 ) ; break ; case 5 : FP_UNPACK_SP ( SA , rs1 ) ; break ; } freg = ( insn & 0x1f ) ; switch ( ( type >> 3 ) & 0x3 ) { case 3 : if ( freg & 2 ) { current_thread_info ( ) -> xfsr [ 0 ] |= ( 6 << 14 ) ; goto err ; } case 2 : freg = ( ( freg & 1 ) << 5 ) | ( freg & 0x1e ) ; case 1 : rs2 = ( argp ) & f -> regs [ freg ] ; flags = ( freg < 32 ) ? FPRS_DL : FPRS_DU ; if ( ! ( current_thread_info ( ) -> fpsaved [ 0 ] & flags ) ) rs2 = ( argp ) & zero ; break ; } switch ( ( type >> 3 ) & 0x7 ) { case 7 : FP_UNPACK_QP ( QB , rs2 ) ; break ; case 6 : FP_UNPACK_DP ( DB , rs2 ) ; break ; case 5 : FP_UNPACK_SP ( SB , rs2 ) ; break ; } freg = ( ( insn >> 25 ) & 0x1f ) ; switch ( ( type >> 6 ) & 0x3 ) { case 3 : if ( freg & 2 ) { current_thread_info ( ) -> xfsr [ 0 ] |= ( 6 << 14 ) ; goto err ; } case 2 : freg = ( ( freg & 1 ) << 5 ) | ( freg & 0x1e ) ; case 1 : rd = ( argp ) & f -> regs [ freg ] ; flags = ( freg < 32 ) ? FPRS_DL : FPRS_DU ; if ( ! ( current_thread_info ( ) -> fpsaved [ 0 ] & FPRS_FEF ) ) { current_thread_info ( ) -> fpsaved [ 0 ] = FPRS_FEF ; current_thread_info ( ) -> gsr [ 0 ] = 0 ; } if ( ! ( current_thread_info ( ) -> fpsaved [ 0 ] & flags ) ) { if ( freg < 32 ) memset ( f -> regs , 0 , 32 * sizeof ( u32 ) ) ; else memset ( f -> regs + 32 , 0 , 32 * sizeof ( u32 ) ) ; } current_thread_info ( ) -> fpsaved [ 0 ] |= flags ; break ; } switch ( ( insn >> 5 ) & 0x1ff ) { case FADDS : FP_ADD_S ( SR , SA , SB ) ; break ; case FADDD : FP_ADD_D ( DR , DA , DB ) ; break ; case FADDQ : FP_ADD_Q ( QR , QA , QB ) ; break ; case FSUBS : FP_SUB_S ( SR , SA , SB ) ; break ; case FSUBD : FP_SUB_D ( DR , DA , DB ) ; break ; case FSUBQ : FP_SUB_Q ( QR , QA , QB ) ; break ; case FMULS : FP_MUL_S ( SR , SA , SB ) ; break ; case FSMULD : FP_CONV ( D , S , 1 , 1 , DA , SA ) ; FP_CONV ( D , S , 1 , 1 , DB , SB ) ; case FMULD : FP_MUL_D ( DR , DA , DB ) ; break ; case FDMULQ : FP_CONV ( Q , D , 2 , 1 , QA , DA ) ; FP_CONV ( Q , D , 2 , 1 , QB , DB ) ; case FMULQ : FP_MUL_Q ( QR , QA , QB ) ; break ; case FDIVS : FP_DIV_S ( SR , SA , SB ) ; break ; case FDIVD : FP_DIV_D ( DR , DA , DB ) ; break ; case FDIVQ : FP_DIV_Q ( QR , QA , QB ) ; break ; case FSQRTS : FP_SQRT_S ( SR , SB ) ; break ; case FSQRTD : FP_SQRT_D ( DR , DB ) ; break ; case FSQRTQ : FP_SQRT_Q ( QR , QB ) ; break ; case FMOVQ : rd -> q [ 0 ] = rs2 -> q [ 0 ] ; rd -> q [ 1 ] = rs2 -> q [ 1 ] ; break ; case FABSQ : rd -> q [ 0 ] = rs2 -> q [ 0 ] & 0x7fffffffffffffffUL ; rd -> q [ 1 ] = rs2 -> q [ 1 ] ; break ; case FNEGQ : rd -> q [ 0 ] = rs2 -> q [ 0 ] ^ 0x8000000000000000UL ; rd -> q [ 1 ] = rs2 -> q [ 1 ] ; break ; case FSTOI : FP_TO_INT_S ( IR , SB , 32 , 1 ) ; break ; case FDTOI : FP_TO_INT_D ( IR , DB , 32 , 1 ) ; break ; case FQTOI : FP_TO_INT_Q ( IR , QB , 32 , 1 ) ; break ; case FSTOX : FP_TO_INT_S ( XR , SB , 64 , 1 ) ; break ; case FDTOX : FP_TO_INT_D ( XR , DB , 64 , 1 ) ; break ; case FQTOX : FP_TO_INT_Q ( XR , QB , 64 , 1 ) ; break ; case FITOQ : IR = rs2 -> s ; FP_FROM_INT_Q ( QR , IR , 32 , int ) ; break ; case FXTOQ : XR = rs2 -> d ; FP_FROM_INT_Q ( QR , XR , 64 , long ) ; break ; case FXTOS : XR = rs2 -> d ; FP_FROM_INT_S ( SR , XR , 64 , long ) ; break ; case FXTOD : XR = rs2 -> d ; FP_FROM_INT_D ( DR , XR , 64 , long ) ; break ; # if 0 case FITOS : IR = rs2 -> s ; FP_FROM_INT_S ( SR , IR , 32 , int ) ; break ; # endif case FITOD : IR = rs2 -> s ; FP_FROM_INT_D ( DR , IR , 32 , int ) ; break ; case FSTOD : FP_CONV ( D , S , 1 , 1 , DR , SB ) ; break ; case FSTOQ : FP_CONV ( Q , S , 2 , 1 , QR , SB ) ; break ; case FDTOQ : FP_CONV ( Q , D , 2 , 1 , QR , DB ) ; break ; case FDTOS : FP_CONV ( S , D , 1 , 1 , SR , DB ) ; break ; case FQTOS : FP_CONV ( S , Q , 1 , 2 , SR , QB ) ; break ; case FQTOD : FP_CONV ( D , Q , 1 , 2 , DR , QB ) ; break ; case FCMPQ : case FCMPEQ : FP_CMP_Q ( XR , QB , QA , 3 ) ; if ( XR == 3 && ( ( ( insn >> 5 ) & 0x1ff ) == FCMPEQ || FP_ISSIGNAN_Q ( QA ) || FP_ISSIGNAN_Q ( QB ) ) ) FP_SET_EXCEPTION ( FP_EX_INVALID ) ; } if ( ! FP_INHIBIT_RESULTS ) { switch ( ( type >> 6 ) & 0x7 ) { case 0 : xfsr = current_thread_info ( ) -> xfsr [ 0 ] ; if ( XR == - 1 ) XR = 2 ; switch ( freg & 3 ) { case 0 : xfsr &= ~ 0xc00 ; xfsr |= ( XR << 10 ) ; break ; case 1 : xfsr &= ~ 0x300000000UL ; xfsr |= ( XR << 32 ) ; break ; case 2 : xfsr &= ~ 0xc00000000UL ; xfsr |= ( XR << 34 ) ; break ; case 3 : xfsr &= ~ 0x3000000000UL ; xfsr |= ( XR << 36 ) ; break ; } current_thread_info ( ) -> xfsr [ 0 ] = xfsr ; break ; case 1 : rd -> s = IR ; break ; case 2 : rd -> d = XR ; break ; case 5 : FP_PACK_SP ( rd , SR ) ; break ; case 6 : FP_PACK_DP ( rd , DR ) ; break ; case 7 : FP_PACK_QP ( rd , QR ) ; break ; } } if ( _fex != 0 ) return record_exception ( regs , _fex ) ; current_thread_info ( ) -> xfsr [ 0 ] &= ~ ( FSR_CEXC_MASK ) ; regs -> tpc = regs -> tnpc ; regs -> tnpc += 4 ; return 1 ; } err : return 0 ; }
<S2SV_ModStart> PERF_COUNT_SW_EMULATION_FAULTS , 1 <S2SV_ModEnd> , regs ,
torvalds@linux/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
CVE-2011-2918
https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
2012-05-24T23:55Z
166
CWE-399
CWE-399 void mono_reflection_create_dynamic_method ( MonoReflectionDynamicMethod * mb ) { <S2SV_StartBug> ReflectionMethodBuilder rmb ; <S2SV_EndBug> MonoMethodSignature * sig ; MonoClass * klass ; GSList * l ; <S2SV_StartBug> int i ; <S2SV_EndBug> sig = dynamic_method_to_signature ( mb ) ; reflection_methodbuilder_from_dynamic_method ( & rmb , mb ) ; rmb . nrefs = mb -> nrefs ; rmb . refs = g_new0 ( gpointer , mb -> nrefs + 1 ) ; for ( i = 0 ; i < mb -> nrefs ; i += 2 ) { MonoClass * handle_class ; gpointer ref ; MonoObject * obj = mono_array_get ( mb -> refs , MonoObject * , i ) ; if ( strcmp ( obj -> vtable -> klass -> name , "DynamicMethod" ) == 0 ) { MonoReflectionDynamicMethod * method = ( MonoReflectionDynamicMethod * ) obj ; if ( method -> mhandle ) { ref = method -> mhandle ; } else { ref = method ; method -> referenced_by = g_slist_append ( method -> referenced_by , mb ) ; } handle_class = mono_defaults . methodhandle_class ; } else { MonoException * ex = NULL ; ref = resolve_object ( mb -> module -> image , obj , & handle_class , NULL ) ; if ( ! ref ) ex = mono_get_exception_type_load ( NULL , NULL ) ; else if ( mono_security_get_mode ( ) == MONO_SECURITY_MODE_CORE_CLR ) ex = mono_security_core_clr_ensure_dynamic_method_resolved_object ( ref , handle_class ) ; if ( ex ) { g_free ( rmb . refs ) ; mono_raise_exception ( ex ) ; return ; } } rmb . refs [ i ] = ref ; rmb . refs [ i + 1 ] = handle_class ; } klass = mb -> owner ? mono_class_from_mono_type ( mono_reflection_type_get_handle ( ( MonoReflectionType * ) mb -> owner ) ) : mono_defaults . object_class ; <S2SV_StartBug> mb -> mhandle = reflection_methodbuilder_to_mono_method ( klass , & rmb , sig ) ; <S2SV_EndBug> for ( l = mb -> referenced_by ; l ; l = l -> next ) { MonoReflectionDynamicMethod * method = ( MonoReflectionDynamicMethod * ) l -> data ; MonoMethodWrapper * wrapper = ( MonoMethodWrapper * ) method -> mhandle ; gpointer * data ; g_assert ( method -> mhandle ) ; data = ( gpointer * ) wrapper -> method_data ; for ( i = 0 ; i < GPOINTER_TO_UINT ( data [ 0 ] ) ; i += 2 ) { if ( ( data [ i + 1 ] == mb ) && ( data [ i + 1 + 1 ] == mono_defaults . methodhandle_class ) ) data [ i + 1 ] = mb -> mhandle ; } } g_slist_free ( mb -> referenced_by ) ; g_free ( rmb . refs ) ; mb -> ilgen = NULL ; }
<S2SV_ModStart> mb ) { MonoReferenceQueue * queue ; MonoMethod * handle ; DynamicMethodReleaseData * release_data ; <S2SV_ModStart> int i ; if ( mono_runtime_is_shutting_down ( ) ) mono_raise_exception ( mono_get_exception_invalid_operation ( "" ) ) ; if ( ! ( queue = dynamic_method_queue ) ) { mono_loader_lock ( ) ; if ( ! ( queue = dynamic_method_queue ) ) queue = dynamic_method_queue = mono_gc_reference_queue_new ( free_dynamic_method ) ; mono_loader_unlock ( ) ; } <S2SV_ModStart> -> mhandle = handle = <S2SV_ModStart> rmb , sig ) ; release_data = g_new ( DynamicMethodReleaseData , 1 ) ; release_data -> handle = handle ; release_data -> domain = mono_object_get_domain ( ( MonoObject * ) mb ) ; if ( ! mono_gc_reference_queue_add ( queue , ( MonoObject * ) mb , release_data ) ) g_free ( release_data
mono@mono/89d1455a80ef13cddee5d79ec00c06055da3085c
CVE-2011-0991
https://github.com/mono/mono/commit/89d1455a80ef13cddee5d79ec00c06055da3085c
2011-04-13T21:55Z
167
CWE-119
CWE-119 int vp9_rc_bits_per_mb ( FRAME_TYPE frame_type , int qindex , <S2SV_StartBug> double correction_factor ) { <S2SV_EndBug> <S2SV_StartBug> const double q = vp9_convert_qindex_to_q ( qindex ) ; <S2SV_EndBug> <S2SV_StartBug> int enumerator = frame_type == KEY_FRAME ? 3300000 : 2250000 ; <S2SV_EndBug> enumerator += ( int ) ( enumerator * q ) >> 12 ; <S2SV_StartBug> return ( int ) ( 0.5 + ( enumerator * correction_factor / q ) ) ; <S2SV_EndBug> }
<S2SV_ModStart> , double correction_factor , vpx_bit_depth_t bit_depth <S2SV_ModStart> vp9_convert_qindex_to_q ( qindex , bit_depth <S2SV_ModStart> == KEY_FRAME ? 2700000 : 1800000 ; assert ( correction_factor <= MAX_BPB_FACTOR && correction_factor >= MIN_BPB_FACTOR ) <S2SV_ModEnd> ; enumerator += <S2SV_ModStart> int ) ( <S2SV_ModEnd> enumerator * correction_factor <S2SV_ModStart> / q ) <S2SV_ModEnd> ; } <S2SV_null>
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
168
CWE-125
CWE-125 static int mobility_opt_print ( netdissect_options * ndo , const u_char * bp , const unsigned len ) { unsigned i , optlen ; for ( i = 0 ; i < len ; i += optlen ) { ND_TCHECK ( bp [ i ] ) ; if ( bp [ i ] == IP6MOPT_PAD1 ) optlen = 1 ; else { if ( i + 1 < len ) { ND_TCHECK ( bp [ i + 1 ] ) ; optlen = bp [ i + 1 ] + 2 ; } else goto trunc ; } if ( i + optlen > len ) goto trunc ; ND_TCHECK ( bp [ i + optlen ] ) ; switch ( bp [ i ] ) { case IP6MOPT_PAD1 : ND_PRINT ( ( ndo , "(pad1)" ) ) ; break ; case IP6MOPT_PADN : if ( len - i < IP6MOPT_MINLEN ) { ND_PRINT ( ( ndo , "(padn:<S2SV_blank>trunc)" ) ) ; goto trunc ; } ND_PRINT ( ( ndo , "(padn)" ) ) ; break ; case IP6MOPT_REFRESH : if ( len - i < IP6MOPT_REFRESH_MINLEN ) { ND_PRINT ( ( ndo , "(refresh:<S2SV_blank>trunc)" ) ) ; goto trunc ; } ND_TCHECK_16BITS ( & bp [ i + 2 ] ) ; ND_PRINT ( ( ndo , "(refresh:<S2SV_blank>%u)" , EXTRACT_16BITS ( & bp [ i + 2 ] ) << 2 ) ) ; break ; case IP6MOPT_ALTCOA : if ( len - i < IP6MOPT_ALTCOA_MINLEN ) { ND_PRINT ( ( ndo , "(altcoa:<S2SV_blank>trunc)" ) ) ; goto trunc ; } ND_PRINT ( ( ndo , "(alt-CoA:<S2SV_blank>%s)" , ip6addr_string ( ndo , & bp [ i + 2 ] ) ) ) ; break ; case IP6MOPT_NONCEID : if ( len - i < IP6MOPT_NONCEID_MINLEN ) { ND_PRINT ( ( ndo , "(ni:<S2SV_blank>trunc)" ) ) ; goto trunc ; } <S2SV_StartBug> ND_PRINT ( ( ndo , "(ni:<S2SV_blank>ho=0x%04x<S2SV_blank>co=0x%04x)" , <S2SV_EndBug> EXTRACT_16BITS ( & bp [ i + 2 ] ) , EXTRACT_16BITS ( & bp [ i + 4 ] ) ) ) ; break ; case IP6MOPT_AUTH : if ( len - i < IP6MOPT_AUTH_MINLEN ) { ND_PRINT ( ( ndo , "(auth:<S2SV_blank>trunc)" ) ) ; goto trunc ; } ND_PRINT ( ( ndo , "(auth)" ) ) ; break ; default : if ( len - i < IP6MOPT_MINLEN ) { ND_PRINT ( ( ndo , "(sopt_type<S2SV_blank>%u:<S2SV_blank>trunc)" , bp [ i ] ) ) ; goto trunc ; } ND_PRINT ( ( ndo , "(type-0x%02x:<S2SV_blank>len=%u)" , bp [ i ] , bp [ i + 1 ] ) ) ; break ; } } return 0 ; trunc : return 1 ; }
<S2SV_ModStart> trunc ; } ND_TCHECK_16BITS ( & bp [ i + 2 ] ) ; ND_TCHECK_16BITS ( & bp [ i + 4 ] ) ;
the-tcpdump-group@tcpdump/7d3aba9f06899d0128ef46e8a2fa143c6fad8f62
CVE-2017-13024
https://github.com/the-tcpdump-group/tcpdump/commit/7d3aba9f06899d0128ef46e8a2fa143c6fad8f62
2017-09-14T06:29Z
169
CWE-200
CWE-200 static int crypto_report_akcipher ( struct sk_buff * skb , struct crypto_alg * alg ) { struct crypto_report_akcipher rakcipher ; <S2SV_StartBug> strlcpy ( rakcipher . type , "akcipher" , sizeof ( rakcipher . type ) ) ; <S2SV_EndBug> if ( nla_put ( skb , CRYPTOCFGA_REPORT_AKCIPHER , sizeof ( struct crypto_report_akcipher ) , & rakcipher ) ) goto nla_put_failure ; return 0 ; nla_put_failure : return - EMSGSIZE ; }
<S2SV_ModStart> crypto_report_akcipher rakcipher ; strncpy <S2SV_ModEnd> ( rakcipher .
torvalds@linux/f43f39958beb206b53292801e216d9b8a660f087
CVE-2018-19854
https://github.com/torvalds/linux/commit/f43f39958beb206b53292801e216d9b8a660f087
2018-12-04T16:29Z
170
CWE-17
CWE-17 int do_remount_sb ( struct super_block * sb , int flags , void * data , int force ) { int retval ; int remount_ro ; if ( sb -> s_writers . frozen != SB_UNFROZEN ) return - EBUSY ; # ifdef CONFIG_BLOCK if ( ! ( flags & MS_RDONLY ) && bdev_read_only ( sb -> s_bdev ) ) return - EACCES ; # endif if ( flags & MS_RDONLY ) acct_auto_close ( sb ) ; shrink_dcache_sb ( sb ) ; sync_filesystem ( sb ) ; remount_ro = ( flags & MS_RDONLY ) && ! ( sb -> s_flags & MS_RDONLY ) ; if ( remount_ro ) { if ( force ) { <S2SV_StartBug> mark_files_ro ( sb ) ; <S2SV_EndBug> } else { retval = sb_prepare_remount_readonly ( sb ) ; if ( retval ) return retval ; } } if ( sb -> s_op -> remount_fs ) { retval = sb -> s_op -> remount_fs ( sb , & flags , data ) ; if ( retval ) { if ( ! force ) goto cancel_readonly ; WARN ( 1 , "forced<S2SV_blank>remount<S2SV_blank>of<S2SV_blank>a<S2SV_blank>%s<S2SV_blank>fs<S2SV_blank>returned<S2SV_blank>%i\\n" , sb -> s_type -> name , retval ) ; } } sb -> s_flags = ( sb -> s_flags & ~ MS_RMT_MASK ) | ( flags & MS_RMT_MASK ) ; smp_wmb ( ) ; sb -> s_readonly_remount = 0 ; if ( remount_ro && sb -> s_bdev ) invalidate_bdev ( sb -> s_bdev ) ; return 0 ; cancel_readonly : sb -> s_readonly_remount = 0 ; return retval ; }
<S2SV_ModStart> force ) { sb -> s_readonly_remount = 1 ; smp_wmb ( <S2SV_ModEnd> ) ; }
torvalds@linux/eee5cc2702929fd41cce28058dc6d6717f723f87
CVE-2014-8172
https://github.com/torvalds/linux/commit/eee5cc2702929fd41cce28058dc6d6717f723f87
2015-03-16T10:59Z
171
CWE-787
CWE-787 STREAM sec_recv ( RD_BOOL * is_fastpath ) { uint8 fastpath_hdr , fastpath_flags ; uint16 sec_flags ; uint16 channel ; STREAM s ; <S2SV_StartBug> while ( ( s = mcs_recv ( & channel , is_fastpath , & fastpath_hdr ) ) != NULL ) <S2SV_EndBug> <S2SV_StartBug> { <S2SV_EndBug> if ( * is_fastpath == True ) { fastpath_flags = ( fastpath_hdr & 0xC0 ) >> 6 ; if ( fastpath_flags & FASTPATH_OUTPUT_ENCRYPTED ) <S2SV_StartBug> { <S2SV_EndBug> in_uint8s ( s , 8 ) ; sec_decrypt ( s -> p , s -> end - s -> p ) ; } return s ; } if ( g_encryption || ( ! g_licence_issued && ! g_licence_error_result ) ) { in_uint16_le ( s , sec_flags ) ; in_uint8s ( s , 2 ) ; if ( g_encryption ) { if ( sec_flags & SEC_ENCRYPT ) { <S2SV_StartBug> in_uint8s ( s , 8 ) ; <S2SV_EndBug> sec_decrypt ( s -> p , s -> end - s -> p ) ; } if ( sec_flags & SEC_LICENSE_PKT ) { licence_process ( s ) ; continue ; } if ( sec_flags & SEC_REDIRECTION_PKT ) { <S2SV_StartBug> uint8 swapbyte ; <S2SV_EndBug> in_uint8s ( s , 8 ) ; sec_decrypt ( s -> p , s -> end - s -> p ) ; if ( s -> p [ 0 ] == 0 && s -> p [ 1 ] == 4 ) { swapbyte = s -> p [ 0 ] ; s -> p [ 0 ] = s -> p [ 2 ] ; s -> p [ 2 ] = swapbyte ; swapbyte = s -> p [ 1 ] ; s -> p [ 1 ] = s -> p [ 3 ] ; s -> p [ 3 ] = swapbyte ; swapbyte = s -> p [ 2 ] ; s -> p [ 2 ] = s -> p [ 3 ] ; s -> p [ 3 ] = swapbyte ; } } } else { if ( sec_flags & SEC_LICENSE_PKT ) { licence_process ( s ) ; continue ; } s -> p -= 4 ; } } if ( channel != MCS_GLOBAL_CHANNEL ) { channel_process ( s , channel ) ; continue ; } return s ; } return NULL ; }
<S2SV_ModStart> STREAM s ; struct stream packet ; <S2SV_ModStart> NULL ) { packet = * s ; <S2SV_ModStart> FASTPATH_OUTPUT_ENCRYPTED ) { if ( ! s_check_rem ( s , 8 ) ) { rdp_protocol_error ( "sec_recv(),<S2SV_blank>consume<S2SV_blank>fastpath<S2SV_blank>signature<S2SV_blank>from<S2SV_blank>stream<S2SV_blank>would<S2SV_blank>overrun" , & packet ) ; } <S2SV_ModStart> SEC_ENCRYPT ) { if ( ! s_check_rem ( s , 8 ) ) { rdp_protocol_error ( "sec_recv(),<S2SV_blank>consume<S2SV_blank>encrypt<S2SV_blank>signature<S2SV_blank>from<S2SV_blank>stream<S2SV_blank>would<S2SV_blank>overrun" , & packet ) ; } <S2SV_ModStart> uint8 swapbyte ; if ( ! s_check_rem ( s , 8 ) ) { rdp_protocol_error ( "sec_recv(),<S2SV_blank>consume<S2SV_blank>redirect<S2SV_blank>signature<S2SV_blank>from<S2SV_blank>stream<S2SV_blank>would<S2SV_blank>overrun" , & packet ) ; }
rdesktop@rdesktop/4dca546d04321a610c1835010b5dad85163b65e1
CVE-2018-8800
https://github.com/rdesktop/rdesktop/commit/4dca546d04321a610c1835010b5dad85163b65e1
2019-02-05T20:29Z
172
CWE-399
CWE-399 <S2SV_StartBug> static void ip6_append_data_mtu ( int * mtu , <S2SV_EndBug> int * maxfraglen , unsigned int fragheaderlen , struct sk_buff * skb , <S2SV_StartBug> struct rt6_info * rt ) <S2SV_EndBug> { if ( ! ( rt -> dst . flags & DST_XFRM_TUNNEL ) ) { if ( skb == NULL ) { * mtu = * mtu - rt -> dst . header_len ; } else { <S2SV_StartBug> * mtu = dst_mtu ( rt -> dst . path ) ; <S2SV_EndBug> } * maxfraglen = ( ( * mtu - fragheaderlen ) & ~ 7 ) + fragheaderlen - sizeof ( struct frag_hdr ) ; } }
<S2SV_ModStart> void ip6_append_data_mtu ( unsigned <S2SV_ModStart> rt6_info * rt , bool pmtuprobe <S2SV_ModStart> * mtu = min ( * mtu , pmtuprobe ? rt -> dst . dev -> mtu : <S2SV_ModStart> dst . path )
torvalds@linux/75a493e60ac4bbe2e977e7129d6d8cbb0dd236be
CVE-2013-4163
https://github.com/torvalds/linux/commit/75a493e60ac4bbe2e977e7129d6d8cbb0dd236be
2013-07-29T13:59Z
173
CWE-119
CWE-119 static void build_y_mask ( const loop_filter_info_n * const lfi_n , const MODE_INFO * mi , const int shift_y , LOOP_FILTER_MASK * lfm ) { const MB_MODE_INFO * mbmi = & mi -> mbmi ; const BLOCK_SIZE block_size = mbmi -> sb_type ; const TX_SIZE tx_size_y = mbmi -> tx_size ; const int filter_level = get_filter_level ( lfi_n , mbmi ) ; uint64_t * const left_y = & lfm -> left_y [ tx_size_y ] ; uint64_t * const above_y = & lfm -> above_y [ tx_size_y ] ; uint64_t * const int_4x4_y = & lfm -> int_4x4_y ; int i ; if ( ! filter_level ) { return ; } else { const int w = num_8x8_blocks_wide_lookup [ block_size ] ; const int h = num_8x8_blocks_high_lookup [ block_size ] ; int index = shift_y ; for ( i = 0 ; i < h ; i ++ ) { <S2SV_StartBug> vpx_memset ( & lfm -> lfl_y [ index ] , filter_level , w ) ; <S2SV_EndBug> index += 8 ; } } * above_y |= above_prediction_mask [ block_size ] << shift_y ; * left_y |= left_prediction_mask [ block_size ] << shift_y ; if ( mbmi -> skip && is_inter_block ( mbmi ) ) return ; * above_y |= ( size_mask [ block_size ] & above_64x64_txform_mask [ tx_size_y ] ) << shift_y ; * left_y |= ( size_mask [ block_size ] & left_64x64_txform_mask [ tx_size_y ] ) << shift_y ; if ( tx_size_y == TX_4X4 ) <S2SV_StartBug> * int_4x4_y |= ( size_mask [ block_size ] & 0xffffffffffffffff ) << shift_y ; <S2SV_EndBug> }
<S2SV_ModStart> ++ ) { memset <S2SV_ModEnd> ( & lfm <S2SV_ModStart> block_size ] & 0xffffffffffffffffULL <S2SV_ModEnd> ) << shift_y
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
174
CWE-77
CWE-77 <S2SV_StartBug> void imap_quote_string ( char * dest , size_t dlen , const char * src ) <S2SV_EndBug> { static const char quote [ ] = "\\"\\\\" ; char * pt = dest ; const char * s = src ; * pt ++ = \'"\' ; dlen -= 2 ; for ( ; * s && dlen ; s ++ ) { if ( strchr ( quote , * s ) ) { dlen -= 2 ; if ( dlen == 0 ) break ; * pt ++ = '\\\\' ; * pt ++ = * s ; } else { * pt ++ = * s ; dlen -- ; } } * pt ++ = \'"\' ; * pt = '\\0' ; }
<S2SV_ModStart> char * src , bool quote_backtick ) { const char * quote = "`\\"\\\\" ; if ( ! quote_backtick ) quote ++ <S2SV_ModEnd> ; char *
neomutt@neomutt/e52393740334443ae0206cab2d7caef381646725
CVE-2018-14357
https://github.com/neomutt/neomutt/commit/e52393740334443ae0206cab2d7caef381646725
2018-07-17T17:29Z
175
CWE-200
CWE-200 static int rfcomm_sock_recvmsg ( struct kiocb * iocb , struct socket * sock , struct msghdr * msg , size_t size , int flags ) { struct sock * sk = sock -> sk ; struct rfcomm_dlc * d = rfcomm_pi ( sk ) -> dlc ; int len ; if ( test_and_clear_bit ( RFCOMM_DEFER_SETUP , & d -> flags ) ) { <S2SV_StartBug> rfcomm_dlc_accept ( d ) ; <S2SV_EndBug> return 0 ; } len = bt_sock_stream_recvmsg ( iocb , sock , msg , size , flags ) ; lock_sock ( sk ) ; if ( ! ( flags & MSG_PEEK ) && len > 0 ) atomic_sub ( len , & sk -> sk_rmem_alloc ) ; if ( atomic_read ( & sk -> sk_rmem_alloc ) <= ( sk -> sk_rcvbuf >> 2 ) ) rfcomm_dlc_unthrottle ( rfcomm_pi ( sk ) -> dlc ) ; release_sock ( sk ) ; return len ; }
<S2SV_ModStart> ( d ) ; msg -> msg_namelen = 0
torvalds@linux/e11e0455c0d7d3d62276a0c55d9dfbc16779d691
CVE-2013-3225
https://github.com/torvalds/linux/commit/e11e0455c0d7d3d62276a0c55d9dfbc16779d691
2013-04-22T11:41Z
176
CWE-000
CWE-000 static int http_rxchunk ( struct http * hp ) { char * q ; int l , i ; l = hp -> prxbuf ; do ( void ) http_rxchar ( hp , 1 , 0 ) ; while ( hp -> rxbuf [ hp -> prxbuf - 1 ] != '\\n' ) ; vtc_dump ( hp -> vl , 4 , "len" , hp -> rxbuf + l , - 1 ) ; i = strtoul ( hp -> rxbuf + l , & q , 16 ) ; bprintf ( hp -> chunklen , "%d" , i ) ; if ( ( q == hp -> rxbuf + l ) || ( * q != '\\0' && ! vct_islws ( * q ) ) ) { vtc_log ( hp -> vl , hp -> fatal , "chunked<S2SV_blank>fail<S2SV_blank>%02x<S2SV_blank>@<S2SV_blank>%d" , * q , q - ( hp -> rxbuf + l ) ) ; } assert ( q != hp -> rxbuf + l ) ; assert ( * q == '\\0' || vct_islws ( * q ) ) ; hp -> prxbuf = l ; if ( i > 0 ) { ( void ) http_rxchar ( hp , i , 0 ) ; vtc_dump ( hp -> vl , 4 , "chunk" , hp -> rxbuf + l , i ) ; } l = hp -> prxbuf ; ( void ) http_rxchar ( hp , 2 , 0 ) ; <S2SV_StartBug> if ( ! vct_iscrlf ( hp -> rxbuf [ l ] ) ) <S2SV_EndBug> vtc_log ( hp -> vl , hp -> fatal , "Wrong<S2SV_blank>chunk<S2SV_blank>tail[0]<S2SV_blank>=<S2SV_blank>%02x" , hp -> rxbuf [ l ] & 0xff ) ; <S2SV_StartBug> if ( ! vct_iscrlf ( hp -> rxbuf [ l + 1 ] ) ) <S2SV_EndBug> vtc_log ( hp -> vl , hp -> fatal , "Wrong<S2SV_blank>chunk<S2SV_blank>tail[1]<S2SV_blank>=<S2SV_blank>%02x" , hp -> rxbuf [ l + 1 ] & 0xff ) ; hp -> prxbuf = l ; hp -> rxbuf [ l ] = '\\0' ; return ( i ) ; }
<S2SV_ModStart> ! vct_iscrlf ( & <S2SV_ModStart> ! vct_iscrlf ( &
varnish@Varnish-Cache/85e8468bec9416bd7e16b0d80cb820ecd2b330c3
CVE-2015-8852
https://github.com/varnish/Varnish-Cache/commit/85e8468bec9416bd7e16b0d80cb820ecd2b330c3
2016-04-25T14:59Z
177
CWE-369
CWE-369 int ff_mov_write_packet ( AVFormatContext * s , AVPacket * pkt ) { MOVMuxContext * mov = s -> priv_data ; AVIOContext * pb = s -> pb ; MOVTrack * trk = & mov -> tracks [ pkt -> stream_index ] ; AVCodecParameters * par = trk -> par ; unsigned int samples_in_chunk = 0 ; int size = pkt -> size , ret = 0 ; uint8_t * reformatted_data = NULL ; ret = check_pkt ( s , pkt ) ; if ( ret < 0 ) return ret ; if ( mov -> flags & FF_MOV_FLAG_FRAGMENT ) { int ret ; if ( mov -> moov_written || mov -> flags & FF_MOV_FLAG_EMPTY_MOOV ) { if ( mov -> frag_interleave && mov -> fragments > 0 ) { if ( trk -> entry - trk -> entries_flushed >= mov -> frag_interleave ) { if ( ( ret = mov_flush_fragment_interleaving ( s , trk ) ) < 0 ) return ret ; } } if ( ! trk -> mdat_buf ) { if ( ( ret = avio_open_dyn_buf ( & trk -> mdat_buf ) ) < 0 ) return ret ; } pb = trk -> mdat_buf ; } else { if ( ! mov -> mdat_buf ) { if ( ( ret = avio_open_dyn_buf ( & mov -> mdat_buf ) ) < 0 ) return ret ; } pb = mov -> mdat_buf ; } } if ( par -> codec_id == AV_CODEC_ID_AMR_NB ) { static const uint16_t packed_size [ 16 ] = { 13 , 14 , 16 , 18 , 20 , 21 , 27 , 32 , 6 , 0 , 0 , 0 , 0 , 0 , 0 , 1 } ; int len = 0 ; while ( len < size && samples_in_chunk < 100 ) { len += packed_size [ ( pkt -> data [ len ] >> 3 ) & 0x0F ] ; samples_in_chunk ++ ; } if ( samples_in_chunk > 1 ) { av_log ( s , AV_LOG_ERROR , "fatal<S2SV_blank>error,<S2SV_blank>input<S2SV_blank>is<S2SV_blank>not<S2SV_blank>a<S2SV_blank>single<S2SV_blank>packet,<S2SV_blank>implement<S2SV_blank>a<S2SV_blank>AVParser<S2SV_blank>for<S2SV_blank>it\\n" ) ; return - 1 ; } } else if ( par -> codec_id == AV_CODEC_ID_ADPCM_MS || par -> codec_id == AV_CODEC_ID_ADPCM_IMA_WAV ) { samples_in_chunk = trk -> par -> frame_size ; } else if ( trk -> sample_size ) samples_in_chunk = size / trk -> sample_size ; else samples_in_chunk = 1 ; <S2SV_StartBug> if ( trk -> vos_len == 0 && par -> extradata_size > 0 && <S2SV_EndBug> ! TAG_IS_AVCI ( trk -> tag ) && ( par -> codec_id != AV_CODEC_ID_DNXHD ) ) { trk -> vos_len = par -> extradata_size ; trk -> vos_data = av_malloc ( trk -> vos_len ) ; if ( ! trk -> vos_data ) { ret = AVERROR ( ENOMEM ) ; goto err ; } memcpy ( trk -> vos_data , par -> extradata , trk -> vos_len ) ; } if ( par -> codec_id == AV_CODEC_ID_AAC && pkt -> size > 2 && ( AV_RB16 ( pkt -> data ) & 0xfff0 ) == 0xfff0 ) { if ( ! s -> streams [ pkt -> stream_index ] -> nb_frames ) { av_log ( s , AV_LOG_ERROR , "Malformed<S2SV_blank>AAC<S2SV_blank>bitstream<S2SV_blank>detected:<S2SV_blank>" "use<S2SV_blank>the<S2SV_blank>audio<S2SV_blank>bitstream<S2SV_blank>filter<S2SV_blank>\'aac_adtstoasc\'<S2SV_blank>to<S2SV_blank>fix<S2SV_blank>it<S2SV_blank>" "(\'-bsf:a<S2SV_blank>aac_adtstoasc\'<S2SV_blank>option<S2SV_blank>with<S2SV_blank>ffmpeg)\\n" ) ; return - 1 ; } av_log ( s , AV_LOG_WARNING , "aac<S2SV_blank>bitstream<S2SV_blank>error\\n" ) ; } if ( par -> codec_id == AV_CODEC_ID_H264 && trk -> vos_len > 0 && * ( uint8_t * ) trk -> vos_data != 1 && ! TAG_IS_AVCI ( trk -> tag ) ) { if ( trk -> hint_track >= 0 && trk -> hint_track < mov -> nb_streams ) { ff_avc_parse_nal_units_buf ( pkt -> data , & reformatted_data , & size ) ; avio_write ( pb , reformatted_data , size ) ; } else { if ( trk -> cenc . aes_ctr ) { size = ff_mov_cenc_avc_parse_nal_units ( & trk -> cenc , pb , pkt -> data , size ) ; if ( size < 0 ) { ret = size ; goto err ; } } else { size = ff_avc_parse_nal_units ( pb , pkt -> data , pkt -> size ) ; } } } else if ( par -> codec_id == AV_CODEC_ID_HEVC && trk -> vos_len > 6 && ( AV_RB24 ( trk -> vos_data ) == 1 || AV_RB32 ( trk -> vos_data ) == 1 ) ) { if ( trk -> hint_track >= 0 && trk -> hint_track < mov -> nb_streams ) { ff_hevc_annexb2mp4_buf ( pkt -> data , & reformatted_data , & size , 0 , NULL ) ; avio_write ( pb , reformatted_data , size ) ; } else { size = ff_hevc_annexb2mp4 ( pb , pkt -> data , pkt -> size , 0 , NULL ) ; } # if CONFIG_AC3_PARSER } else if ( par -> codec_id == AV_CODEC_ID_EAC3 ) { size = handle_eac3 ( mov , pkt , trk ) ; if ( size < 0 ) return size ; else if ( ! size ) goto end ; avio_write ( pb , pkt -> data , size ) ; # endif } else { if ( trk -> cenc . aes_ctr ) { if ( par -> codec_id == AV_CODEC_ID_H264 && par -> extradata_size > 4 ) { int nal_size_length = ( par -> extradata [ 4 ] & 0x3 ) + 1 ; ret = ff_mov_cenc_avc_write_nal_units ( s , & trk -> cenc , nal_size_length , pb , pkt -> data , size ) ; } else { ret = ff_mov_cenc_write_packet ( & trk -> cenc , pb , pkt -> data , size ) ; } if ( ret ) { goto err ; } } else { avio_write ( pb , pkt -> data , size ) ; } } if ( ( par -> codec_id == AV_CODEC_ID_DNXHD || par -> codec_id == AV_CODEC_ID_AC3 ) && ! trk -> vos_len ) { trk -> vos_len = size ; trk -> vos_data = av_malloc ( size ) ; if ( ! trk -> vos_data ) { ret = AVERROR ( ENOMEM ) ; goto err ; } memcpy ( trk -> vos_data , pkt -> data , size ) ; } if ( trk -> entry >= trk -> cluster_capacity ) { unsigned new_capacity = 2 * ( trk -> entry + MOV_INDEX_CLUSTER_SIZE ) ; if ( av_reallocp_array ( & trk -> cluster , new_capacity , sizeof ( * trk -> cluster ) ) ) { ret = AVERROR ( ENOMEM ) ; goto err ; } trk -> cluster_capacity = new_capacity ; } trk -> cluster [ trk -> entry ] . pos = avio_tell ( pb ) - size ; trk -> cluster [ trk -> entry ] . samples_in_chunk = samples_in_chunk ; trk -> cluster [ trk -> entry ] . chunkNum = 0 ; trk -> cluster [ trk -> entry ] . size = size ; trk -> cluster [ trk -> entry ] . entries = samples_in_chunk ; trk -> cluster [ trk -> entry ] . dts = pkt -> dts ; trk -> cluster [ trk -> entry ] . pts = pkt -> pts ; if ( ! trk -> entry && trk -> start_dts != AV_NOPTS_VALUE ) { if ( ! trk -> frag_discont ) { trk -> cluster [ trk -> entry ] . dts = trk -> start_dts + trk -> track_duration ; if ( ( mov -> flags & FF_MOV_FLAG_DASH && ! ( mov -> flags & FF_MOV_FLAG_GLOBAL_SIDX ) ) || mov -> mode == MODE_ISM ) pkt -> pts = pkt -> dts + trk -> end_pts - trk -> cluster [ trk -> entry ] . dts ; } else { trk -> frag_start = pkt -> dts - trk -> start_dts ; trk -> end_pts = AV_NOPTS_VALUE ; trk -> frag_discont = 0 ; } } if ( ! trk -> entry && trk -> start_dts == AV_NOPTS_VALUE && ! mov -> use_editlist && s -> avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO ) { trk -> cluster [ trk -> entry ] . dts = trk -> start_dts = 0 ; } if ( trk -> start_dts == AV_NOPTS_VALUE ) { trk -> start_dts = pkt -> dts ; if ( trk -> frag_discont ) { if ( mov -> use_editlist ) { trk -> frag_start = pkt -> pts ; trk -> start_dts = pkt -> dts - pkt -> pts ; } else { trk -> frag_start = pkt -> dts ; trk -> start_dts = 0 ; } trk -> frag_discont = 0 ; } else if ( pkt -> dts && mov -> moov_written ) av_log ( s , AV_LOG_WARNING , "Track<S2SV_blank>%d<S2SV_blank>starts<S2SV_blank>with<S2SV_blank>a<S2SV_blank>nonzero<S2SV_blank>dts<S2SV_blank>%" PRId64 ",<S2SV_blank>while<S2SV_blank>the<S2SV_blank>moov<S2SV_blank>" "already<S2SV_blank>has<S2SV_blank>been<S2SV_blank>written.<S2SV_blank>Set<S2SV_blank>the<S2SV_blank>delay_moov<S2SV_blank>flag<S2SV_blank>to<S2SV_blank>handle<S2SV_blank>" "this<S2SV_blank>case.\\n" , pkt -> stream_index , pkt -> dts ) ; } trk -> track_duration = pkt -> dts - trk -> start_dts + pkt -> duration ; trk -> last_sample_is_subtitle_end = 0 ; if ( pkt -> pts == AV_NOPTS_VALUE ) { av_log ( s , AV_LOG_WARNING , "pts<S2SV_blank>has<S2SV_blank>no<S2SV_blank>value\\n" ) ; pkt -> pts = pkt -> dts ; } if ( pkt -> dts != pkt -> pts ) trk -> flags |= MOV_TRACK_CTTS ; trk -> cluster [ trk -> entry ] . cts = pkt -> pts - pkt -> dts ; trk -> cluster [ trk -> entry ] . flags = 0 ; if ( trk -> start_cts == AV_NOPTS_VALUE ) trk -> start_cts = pkt -> pts - pkt -> dts ; if ( trk -> end_pts == AV_NOPTS_VALUE ) trk -> end_pts = trk -> cluster [ trk -> entry ] . dts + trk -> cluster [ trk -> entry ] . cts + pkt -> duration ; else trk -> end_pts = FFMAX ( trk -> end_pts , trk -> cluster [ trk -> entry ] . dts + trk -> cluster [ trk -> entry ] . cts + pkt -> duration ) ; if ( par -> codec_id == AV_CODEC_ID_VC1 ) { mov_parse_vc1_frame ( pkt , trk ) ; } else if ( pkt -> flags & AV_PKT_FLAG_KEY ) { if ( mov -> mode == MODE_MOV && par -> codec_id == AV_CODEC_ID_MPEG2VIDEO && trk -> entry > 0 ) { mov_parse_mpeg2_frame ( pkt , & trk -> cluster [ trk -> entry ] . flags ) ; if ( trk -> cluster [ trk -> entry ] . flags & MOV_PARTIAL_SYNC_SAMPLE ) trk -> flags |= MOV_TRACK_STPS ; } else { trk -> cluster [ trk -> entry ] . flags = MOV_SYNC_SAMPLE ; } if ( trk -> cluster [ trk -> entry ] . flags & MOV_SYNC_SAMPLE ) trk -> has_keyframes ++ ; } if ( pkt -> flags & AV_PKT_FLAG_DISPOSABLE ) { trk -> cluster [ trk -> entry ] . flags |= MOV_DISPOSABLE_SAMPLE ; trk -> has_disposable ++ ; } trk -> entry ++ ; trk -> sample_count += samples_in_chunk ; mov -> mdat_size += size ; if ( trk -> hint_track >= 0 && trk -> hint_track < mov -> nb_streams ) ff_mov_add_hinted_packet ( s , pkt , trk -> hint_track , trk -> entry , reformatted_data , size ) ; end : err : av_free ( reformatted_data ) ; return ret ; }
<S2SV_ModStart> ; if ( samples_in_chunk < 1 ) { av_log ( s , AV_LOG_ERROR , "fatal<S2SV_blank>error,<S2SV_blank>input<S2SV_blank>packet<S2SV_blank>contains<S2SV_blank>no<S2SV_blank>samples\\n" ) ; return AVERROR_PATCHWELCOME ; } if (
FFmpeg@FFmpeg/3a2d21bc5f97aa0161db3ae731fc2732be6108b8
CVE-2018-14394
https://github.com/FFmpeg/FFmpeg/commit/3a2d21bc5f97aa0161db3ae731fc2732be6108b8
2018-07-19T05:29Z
178
CWE-119
CWE-119 cJSON * cJSON_CreateBool ( int b ) { cJSON * item = cJSON_New_Item ( ) ; if ( item ) item -> type = b ? cJSON_True : cJSON_False ; return item ; }
esnet@iperf/91f2fa59e8ed80dfbf400add0164ee0e508e412a
CVE-2016-4303
https://github.com/esnet/iperf/commit/91f2fa59e8ed80dfbf400add0164ee0e508e412a
2016-09-26T14:59Z
179
CWE-125
CWE-125 static void print_trans ( netdissect_options * ndo , const u_char * words , const u_char * data1 , const u_char * buf , const u_char * maxbuf ) { u_int bcc ; const char * f1 , * f2 , * f3 , * f4 ; const u_char * data , * param ; const u_char * w = words + 1 ; int datalen , paramlen ; if ( request ) { ND_TCHECK2 ( w [ 12 * 2 ] , 2 ) ; paramlen = EXTRACT_LE_16BITS ( w + 9 * 2 ) ; param = buf + EXTRACT_LE_16BITS ( w + 10 * 2 ) ; datalen = EXTRACT_LE_16BITS ( w + 11 * 2 ) ; data = buf + EXTRACT_LE_16BITS ( w + 12 * 2 ) ; f1 = "TotParamCnt=[d]<S2SV_blank>\\nTotDataCnt=[d]<S2SV_blank>\\nMaxParmCnt=[d]<S2SV_blank>\\nMaxDataCnt=[d]\\nMaxSCnt=[d]<S2SV_blank>\\nTransFlags=[w]<S2SV_blank>\\nRes1=[w]<S2SV_blank>\\nRes2=[w]<S2SV_blank>\\nRes3=[w]\\nParamCnt=[d]<S2SV_blank>\\nParamOff=[d]<S2SV_blank>\\nDataCnt=[d]<S2SV_blank>\\nDataOff=[d]<S2SV_blank>\\nSUCnt=[d]\\n" ; f2 = "|Name=[S]\\n" ; f3 = "|Param<S2SV_blank>" ; f4 = "|Data<S2SV_blank>" ; } else { ND_TCHECK2 ( w [ 7 * 2 ] , 2 ) ; paramlen = EXTRACT_LE_16BITS ( w + 3 * 2 ) ; param = buf + EXTRACT_LE_16BITS ( w + 4 * 2 ) ; datalen = EXTRACT_LE_16BITS ( w + 6 * 2 ) ; data = buf + EXTRACT_LE_16BITS ( w + 7 * 2 ) ; f1 = "TotParamCnt=[d]<S2SV_blank>\\nTotDataCnt=[d]<S2SV_blank>\\nRes1=[d]\\nParamCnt=[d]<S2SV_blank>\\nParamOff=[d]<S2SV_blank>\\nRes2=[d]<S2SV_blank>\\nDataCnt=[d]<S2SV_blank>\\nDataOff=[d]<S2SV_blank>\\nRes3=[d]\\nLsetup=[d]\\n" ; f2 = "|Unknown<S2SV_blank>" ; f3 = "|Param<S2SV_blank>" ; f4 = "|Data<S2SV_blank>" ; } smb_fdata ( ndo , words + 1 , f1 , min ( words + 1 + 2 * words [ 0 ] , maxbuf ) , unicodestr ) ; ND_TCHECK2 ( * data1 , 2 ) ; bcc = EXTRACT_LE_16BITS ( data1 ) ; ND_PRINT ( ( ndo , "smb_bcc=%u\\n" , bcc ) ) ; if ( bcc > 0 ) { smb_fdata ( ndo , data1 + 2 , f2 , maxbuf - ( paramlen + datalen ) , unicodestr ) ; <S2SV_StartBug> if ( strcmp ( ( const char * ) ( data1 + 2 ) , "\\\\MAILSLOT\\\\BROWSE" ) == 0 ) { <S2SV_EndBug> print_browse ( ndo , param , paramlen , data , datalen ) ; return ; } <S2SV_StartBug> if ( strcmp ( ( const char * ) ( data1 + 2 ) , "\\\\PIPE\\\\LANMAN" ) == 0 ) { <S2SV_EndBug> print_ipc ( ndo , param , paramlen , data , datalen ) ; return ; } <S2SV_StartBug> if ( paramlen ) <S2SV_EndBug> smb_fdata ( ndo , param , f3 , min ( param + paramlen , maxbuf ) , unicodestr ) ; if ( datalen ) smb_fdata ( ndo , data , f4 , min ( data + datalen , maxbuf ) , unicodestr ) ; } return ; trunc : ND_PRINT ( ( ndo , "%s" , tstr ) ) ; }
<S2SV_ModStart> unicodestr ) ; # define MAILSLOT_BROWSE_STR "\\\\MAILSLOT\\\\BROWSE" ND_TCHECK2 ( * ( data1 + 2 ) , strlen ( MAILSLOT_BROWSE_STR ) + 1 ) ; <S2SV_ModStart> 2 ) , MAILSLOT_BROWSE_STR <S2SV_ModEnd> ) == 0 <S2SV_ModStart> return ; } # undef MAILSLOT_BROWSE_STR # define PIPE_LANMAN_STR "\\\\PIPE\\\\LANMAN" ND_TCHECK2 ( * ( data1 + 2 ) , strlen ( PIPE_LANMAN_STR ) + 1 ) ; <S2SV_ModStart> 2 ) , PIPE_LANMAN_STR <S2SV_ModEnd> ) == 0 <S2SV_ModStart> return ; } # undef PIPE_LANMAN_STR
the-tcpdump-group@tcpdump/96480ab95308cd9234b4f09b175ebf60e17792c6
CVE-2018-16451
https://github.com/the-tcpdump-group/tcpdump/commit/96480ab95308cd9234b4f09b175ebf60e17792c6
2019-10-03T16:15Z
180
CWE-119
CWE-119 <S2SV_StartBug> void open_input_file ( struct VpxInputContext * input ) { <S2SV_EndBug> input -> file = strcmp ( input -> filename , "-" ) ? fopen ( input -> filename , "rb" ) : set_binary_mode ( stdin ) ; if ( ! input -> file ) fatal ( "Failed<S2SV_blank>to<S2SV_blank>open<S2SV_blank>input<S2SV_blank>file" ) ; if ( ! fseeko ( input -> file , 0 , SEEK_END ) ) { input -> length = ftello ( input -> file ) ; rewind ( input -> file ) ; } <S2SV_StartBug> input -> detect . buf_read = fread ( input -> detect . buf , 1 , 4 , input -> file ) ; <S2SV_EndBug> input -> detect . position = 0 ; if ( input -> detect . buf_read == 4 && file_is_y4m ( input -> detect . buf ) ) { if ( y4m_input_open ( & input -> y4m , input -> file , input -> detect . buf , 4 , input -> only_i420 ) >= 0 ) { input -> file_type = FILE_TYPE_Y4M ; input -> width = input -> y4m . pic_w ; input -> height = input -> y4m . pic_h ; <S2SV_StartBug> input -> framerate . numerator = input -> y4m . fps_n ; <S2SV_EndBug> input -> framerate . denominator = input -> y4m . fps_d ; <S2SV_StartBug> input -> use_i420 = 0 ; <S2SV_EndBug> } else fatal ( "Unsupported<S2SV_blank>Y4M<S2SV_blank>stream." ) ; } else if ( input -> detect . buf_read == 4 && fourcc_is_ivf ( input -> detect . buf ) ) { fatal ( "IVF<S2SV_blank>is<S2SV_blank>not<S2SV_blank>supported<S2SV_blank>as<S2SV_blank>input." ) ; } else { input -> file_type = FILE_TYPE_RAW ; } }
<S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> static <S2SV_ModStart> } input -> pixel_aspect_ratio . numerator = 1 ; input -> pixel_aspect_ratio . denominator = 1 ; input -> <S2SV_ModStart> ; input -> pixel_aspect_ratio . numerator = input -> y4m . par_n ; input -> pixel_aspect_ratio . denominator = input -> y4m . par_d ; input -> <S2SV_ModStart> ; input -> fmt = input -> y4m . vpx_fmt ; input -> bit_depth = input -> y4m . bit_depth <S2SV_ModEnd> ; } else
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
181
CWE-000
CWE-000 bgp_size_t bgp_packet_attribute ( struct bgp * bgp , struct peer * peer , struct stream * s , struct attr * attr , struct bpacket_attr_vec_arr * vecarr , struct prefix * p , afi_t afi , safi_t safi , struct peer * from , struct prefix_rd * prd , mpls_label_t * label , uint32_t num_labels , int addpath_encode , uint32_t addpath_tx_id ) { size_t cp ; size_t aspath_sizep ; struct aspath * aspath ; int send_as4_path = 0 ; int send_as4_aggregator = 0 ; int use32bit = ( CHECK_FLAG ( peer -> cap , PEER_CAP_AS4_RCV ) ) ? 1 : 0 ; if ( ! bgp ) bgp = peer -> bgp ; cp = stream_get_endp ( s ) ; if ( p && ! ( ( afi == AFI_IP && safi == SAFI_UNICAST ) && ! peer_cap_enhe ( peer , afi , safi ) ) ) { size_t mpattrlen_pos = 0 ; mpattrlen_pos = bgp_packet_mpattr_start ( s , peer , afi , safi , vecarr , attr ) ; bgp_packet_mpattr_prefix ( s , afi , safi , p , prd , label , num_labels , addpath_encode , addpath_tx_id , attr ) ; bgp_packet_mpattr_end ( s , mpattrlen_pos ) ; } stream_putc ( s , BGP_ATTR_FLAG_TRANS ) ; stream_putc ( s , BGP_ATTR_ORIGIN ) ; stream_putc ( s , 1 ) ; stream_putc ( s , attr -> origin ) ; if ( peer -> sort == BGP_PEER_EBGP && ( ! CHECK_FLAG ( peer -> af_flags [ afi ] [ safi ] , PEER_FLAG_AS_PATH_UNCHANGED ) || attr -> aspath -> segments == NULL ) && ( ! CHECK_FLAG ( peer -> af_flags [ afi ] [ safi ] , PEER_FLAG_RSERVER_CLIENT ) ) ) { aspath = aspath_dup ( attr -> aspath ) ; aspath = aspath_delete_confed_seq ( aspath ) ; if ( CHECK_FLAG ( bgp -> config , BGP_CONFIG_CONFEDERATION ) ) { aspath = aspath_add_seq ( aspath , bgp -> confed_id ) ; } else { if ( peer -> change_local_as ) { if ( ! CHECK_FLAG ( peer -> flags , PEER_FLAG_LOCAL_AS_REPLACE_AS ) ) { aspath = aspath_add_seq ( aspath , peer -> local_as ) ; } aspath = aspath_add_seq ( aspath , peer -> change_local_as ) ; } else { aspath = aspath_add_seq ( aspath , peer -> local_as ) ; } } } else if ( peer -> sort == BGP_PEER_CONFED ) { aspath = aspath_dup ( attr -> aspath ) ; aspath = aspath_add_confed_seq ( aspath , peer -> local_as ) ; } else aspath = attr -> aspath ; stream_putc ( s , BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_EXTLEN ) ; stream_putc ( s , BGP_ATTR_AS_PATH ) ; aspath_sizep = stream_get_endp ( s ) ; stream_putw ( s , 0 ) ; stream_putw_at ( s , aspath_sizep , aspath_put ( s , aspath , use32bit ) ) ; if ( ! use32bit && aspath_has_as4 ( aspath ) ) send_as4_path = 1 ; if ( afi == AFI_IP && safi == SAFI_UNICAST && ! peer_cap_enhe ( peer , afi , safi ) ) { if ( attr -> flag & ATTR_FLAG_BIT ( BGP_ATTR_NEXT_HOP ) ) { stream_putc ( s , BGP_ATTR_FLAG_TRANS ) ; stream_putc ( s , BGP_ATTR_NEXT_HOP ) ; bpacket_attr_vec_arr_set_vec ( vecarr , BGP_ATTR_VEC_NH , s , attr ) ; stream_putc ( s , 4 ) ; stream_put_ipv4 ( s , attr -> nexthop . s_addr ) ; } else if ( peer_cap_enhe ( from , afi , safi ) ) { stream_putc ( s , BGP_ATTR_FLAG_TRANS ) ; stream_putc ( s , BGP_ATTR_NEXT_HOP ) ; bpacket_attr_vec_arr_set_vec ( vecarr , BGP_ATTR_VEC_NH , s , NULL ) ; stream_putc ( s , 4 ) ; stream_put_ipv4 ( s , 0 ) ; } } if ( attr -> flag & ATTR_FLAG_BIT ( BGP_ATTR_MULTI_EXIT_DISC ) || bgp -> maxmed_active ) { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL ) ; stream_putc ( s , BGP_ATTR_MULTI_EXIT_DISC ) ; stream_putc ( s , 4 ) ; stream_putl ( s , ( bgp -> maxmed_active ? bgp -> maxmed_value : attr -> med ) ) ; } if ( peer -> sort == BGP_PEER_IBGP || peer -> sort == BGP_PEER_CONFED ) { stream_putc ( s , BGP_ATTR_FLAG_TRANS ) ; stream_putc ( s , BGP_ATTR_LOCAL_PREF ) ; stream_putc ( s , 4 ) ; stream_putl ( s , attr -> local_pref ) ; } if ( attr -> flag & ATTR_FLAG_BIT ( BGP_ATTR_ATOMIC_AGGREGATE ) ) { stream_putc ( s , BGP_ATTR_FLAG_TRANS ) ; stream_putc ( s , BGP_ATTR_ATOMIC_AGGREGATE ) ; stream_putc ( s , 0 ) ; } if ( attr -> flag & ATTR_FLAG_BIT ( BGP_ATTR_AGGREGATOR ) ) { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS ) ; stream_putc ( s , BGP_ATTR_AGGREGATOR ) ; if ( use32bit ) { stream_putc ( s , 8 ) ; stream_putl ( s , attr -> aggregator_as ) ; } else { stream_putc ( s , 6 ) ; if ( attr -> aggregator_as > 65535 ) { stream_putw ( s , BGP_AS_TRANS ) ; send_as4_aggregator = 1 ; } else stream_putw ( s , ( uint16_t ) attr -> aggregator_as ) ; } stream_put_ipv4 ( s , attr -> aggregator_addr . s_addr ) ; } if ( CHECK_FLAG ( peer -> af_flags [ afi ] [ safi ] , PEER_FLAG_SEND_COMMUNITY ) && ( attr -> flag & ATTR_FLAG_BIT ( BGP_ATTR_COMMUNITIES ) ) ) { if ( attr -> community -> size * 4 > 255 ) { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_EXTLEN ) ; stream_putc ( s , BGP_ATTR_COMMUNITIES ) ; stream_putw ( s , attr -> community -> size * 4 ) ; } else { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS ) ; stream_putc ( s , BGP_ATTR_COMMUNITIES ) ; stream_putc ( s , attr -> community -> size * 4 ) ; } stream_put ( s , attr -> community -> val , attr -> community -> size * 4 ) ; } if ( CHECK_FLAG ( peer -> af_flags [ afi ] [ safi ] , PEER_FLAG_SEND_LARGE_COMMUNITY ) && ( attr -> flag & ATTR_FLAG_BIT ( BGP_ATTR_LARGE_COMMUNITIES ) ) ) { if ( lcom_length ( attr -> lcommunity ) > 255 ) { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_EXTLEN ) ; stream_putc ( s , BGP_ATTR_LARGE_COMMUNITIES ) ; stream_putw ( s , lcom_length ( attr -> lcommunity ) ) ; } else { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS ) ; stream_putc ( s , BGP_ATTR_LARGE_COMMUNITIES ) ; stream_putc ( s , lcom_length ( attr -> lcommunity ) ) ; } stream_put ( s , attr -> lcommunity -> val , lcom_length ( attr -> lcommunity ) ) ; } if ( peer -> sort == BGP_PEER_IBGP && from && from -> sort == BGP_PEER_IBGP ) { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL ) ; stream_putc ( s , BGP_ATTR_ORIGINATOR_ID ) ; stream_putc ( s , 4 ) ; if ( attr -> flag & ATTR_FLAG_BIT ( BGP_ATTR_ORIGINATOR_ID ) ) stream_put_in_addr ( s , & attr -> originator_id ) ; else stream_put_in_addr ( s , & from -> remote_id ) ; stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL ) ; stream_putc ( s , BGP_ATTR_CLUSTER_LIST ) ; if ( attr -> cluster ) { stream_putc ( s , attr -> cluster -> length + 4 ) ; if ( bgp -> config & BGP_CONFIG_CLUSTER_ID ) stream_put_in_addr ( s , & bgp -> cluster_id ) ; else stream_put_in_addr ( s , & bgp -> router_id ) ; stream_put ( s , attr -> cluster -> list , attr -> cluster -> length ) ; } else { stream_putc ( s , 4 ) ; if ( bgp -> config & BGP_CONFIG_CLUSTER_ID ) stream_put_in_addr ( s , & bgp -> cluster_id ) ; else stream_put_in_addr ( s , & bgp -> router_id ) ; } } if ( CHECK_FLAG ( peer -> af_flags [ afi ] [ safi ] , PEER_FLAG_SEND_EXT_COMMUNITY ) && ( attr -> flag & ATTR_FLAG_BIT ( BGP_ATTR_EXT_COMMUNITIES ) ) ) { if ( peer -> sort == BGP_PEER_IBGP || peer -> sort == BGP_PEER_CONFED ) { if ( attr -> ecommunity -> size * 8 > 255 ) { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_EXTLEN ) ; stream_putc ( s , BGP_ATTR_EXT_COMMUNITIES ) ; stream_putw ( s , attr -> ecommunity -> size * 8 ) ; } else { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS ) ; stream_putc ( s , BGP_ATTR_EXT_COMMUNITIES ) ; stream_putc ( s , attr -> ecommunity -> size * 8 ) ; } stream_put ( s , attr -> ecommunity -> val , attr -> ecommunity -> size * 8 ) ; } else { uint8_t * pnt ; int tbit ; int ecom_tr_size = 0 ; int i ; for ( i = 0 ; i < attr -> ecommunity -> size ; i ++ ) { pnt = attr -> ecommunity -> val + ( i * 8 ) ; tbit = * pnt ; if ( CHECK_FLAG ( tbit , ECOMMUNITY_FLAG_NON_TRANSITIVE ) ) continue ; ecom_tr_size ++ ; } if ( ecom_tr_size ) { if ( ecom_tr_size * 8 > 255 ) { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_EXTLEN ) ; stream_putc ( s , BGP_ATTR_EXT_COMMUNITIES ) ; stream_putw ( s , ecom_tr_size * 8 ) ; } else { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS ) ; stream_putc ( s , BGP_ATTR_EXT_COMMUNITIES ) ; stream_putc ( s , ecom_tr_size * 8 ) ; } for ( i = 0 ; i < attr -> ecommunity -> size ; i ++ ) { pnt = attr -> ecommunity -> val + ( i * 8 ) ; tbit = * pnt ; if ( CHECK_FLAG ( tbit , ECOMMUNITY_FLAG_NON_TRANSITIVE ) ) continue ; stream_put ( s , pnt , 8 ) ; } } } } if ( safi == SAFI_LABELED_UNICAST ) { if ( attr -> flag & ATTR_FLAG_BIT ( BGP_ATTR_PREFIX_SID ) ) { uint32_t label_index ; label_index = attr -> label_index ; if ( label_index != BGP_INVALID_LABEL_INDEX ) { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS ) ; stream_putc ( s , BGP_ATTR_PREFIX_SID ) ; stream_putc ( s , 10 ) ; stream_putc ( s , BGP_PREFIX_SID_LABEL_INDEX ) ; stream_putw ( s , BGP_PREFIX_SID_LABEL_INDEX_LENGTH ) ; stream_putc ( s , 0 ) ; stream_putw ( s , 0 ) ; stream_putl ( s , label_index ) ; } } } if ( send_as4_path ) { aspath = aspath_delete_confed_seq ( aspath ) ; stream_putc ( s , BGP_ATTR_FLAG_TRANS | BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_EXTLEN ) ; stream_putc ( s , BGP_ATTR_AS4_PATH ) ; aspath_sizep = stream_get_endp ( s ) ; stream_putw ( s , 0 ) ; stream_putw_at ( s , aspath_sizep , aspath_put ( s , aspath , 1 ) ) ; } if ( aspath != attr -> aspath ) aspath_free ( aspath ) ; if ( send_as4_aggregator ) { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS ) ; stream_putc ( s , BGP_ATTR_AS4_AGGREGATOR ) ; stream_putc ( s , 8 ) ; stream_putl ( s , attr -> aggregator_as ) ; stream_put_ipv4 ( s , attr -> aggregator_addr . s_addr ) ; } if ( ( ( afi == AFI_IP || afi == AFI_IP6 ) && ( safi == SAFI_ENCAP || safi == SAFI_MPLS_VPN ) ) || ( afi == AFI_L2VPN && safi == SAFI_EVPN ) ) { bgp_packet_mpattr_tea ( bgp , peer , s , attr , BGP_ATTR_ENCAP ) ; <S2SV_StartBug> # if ENABLE_BGP_VNC <S2SV_EndBug> bgp_packet_mpattr_tea ( bgp , peer , s , attr , BGP_ATTR_VNC ) ; # endif } if ( attr -> flag & ATTR_FLAG_BIT ( BGP_ATTR_PMSI_TUNNEL ) ) { stream_putc ( s , BGP_ATTR_FLAG_OPTIONAL | BGP_ATTR_FLAG_TRANS ) ; stream_putc ( s , BGP_ATTR_PMSI_TUNNEL ) ; stream_putc ( s , 9 ) ; stream_putc ( s , 0 ) ; stream_putc ( s , PMSI_TNLTYPE_INGR_REPL ) ; stream_put ( s , & ( attr -> label ) , BGP_LABEL_BYTES ) ; stream_put_ipv4 ( s , attr -> nexthop . s_addr ) ; } if ( attr -> transit ) stream_put ( s , attr -> transit -> val , attr -> transit -> length ) ; return stream_get_endp ( s ) - cp ; }
<S2SV_ModStart> ; # if ENABLE_BGP_VNC_ATTR <S2SV_ModEnd> bgp_packet_mpattr_tea ( bgp
FRRouting@frr/943d595a018e69b550db08cccba1d0778a86705a
CVE-2019-5892
https://github.com/FRRouting/frr/commit/943d595a018e69b550db08cccba1d0778a86705a
2019-01-10T17:29Z
182
CWE-399
CWE-399 static int dcbnl_ieee_fill ( struct sk_buff * skb , struct net_device * netdev ) { struct nlattr * ieee , * app ; struct dcb_app_type * itr ; const struct dcbnl_rtnl_ops * ops = netdev -> dcbnl_ops ; int dcbx ; int err ; if ( nla_put_string ( skb , DCB_ATTR_IFNAME , netdev -> name ) ) return - EMSGSIZE ; ieee = nla_nest_start ( skb , DCB_ATTR_IEEE ) ; if ( ! ieee ) return - EMSGSIZE ; if ( ops -> ieee_getets ) { struct ieee_ets ets ; <S2SV_StartBug> err = ops -> ieee_getets ( netdev , & ets ) ; <S2SV_EndBug> if ( ! err && nla_put ( skb , DCB_ATTR_IEEE_ETS , sizeof ( ets ) , & ets ) ) return - EMSGSIZE ; } if ( ops -> ieee_getmaxrate ) { struct ieee_maxrate maxrate ; <S2SV_StartBug> err = ops -> ieee_getmaxrate ( netdev , & maxrate ) ; <S2SV_EndBug> if ( ! err ) { err = nla_put ( skb , DCB_ATTR_IEEE_MAXRATE , sizeof ( maxrate ) , & maxrate ) ; if ( err ) return - EMSGSIZE ; } } if ( ops -> ieee_getpfc ) { <S2SV_StartBug> struct ieee_pfc pfc ; <S2SV_EndBug> err = ops -> ieee_getpfc ( netdev , & pfc ) ; if ( ! err && nla_put ( skb , DCB_ATTR_IEEE_PFC , sizeof ( pfc ) , & pfc ) ) return - EMSGSIZE ; } app = nla_nest_start ( skb , DCB_ATTR_IEEE_APP_TABLE ) ; if ( ! app ) return - EMSGSIZE ; spin_lock ( & dcb_lock ) ; list_for_each_entry ( itr , & dcb_app_list , list ) { if ( itr -> ifindex == netdev -> ifindex ) { err = nla_put ( skb , DCB_ATTR_IEEE_APP , sizeof ( itr -> app ) , & itr -> app ) ; if ( err ) { spin_unlock ( & dcb_lock ) ; return - EMSGSIZE ; } } } if ( netdev -> dcbnl_ops -> getdcbx ) dcbx = netdev -> dcbnl_ops -> getdcbx ( netdev ) ; else dcbx = - EOPNOTSUPP ; spin_unlock ( & dcb_lock ) ; nla_nest_end ( skb , app ) ; if ( ops -> ieee_peer_getets ) { struct ieee_ets ets ; <S2SV_StartBug> err = ops -> ieee_peer_getets ( netdev , & ets ) ; <S2SV_EndBug> if ( ! err && nla_put ( skb , DCB_ATTR_IEEE_PEER_ETS , sizeof ( ets ) , & ets ) ) return - EMSGSIZE ; } if ( ops -> ieee_peer_getpfc ) { <S2SV_StartBug> struct ieee_pfc pfc ; <S2SV_EndBug> err = ops -> ieee_peer_getpfc ( netdev , & pfc ) ; if ( ! err && nla_put ( skb , DCB_ATTR_IEEE_PEER_PFC , sizeof ( pfc ) , & pfc ) ) return - EMSGSIZE ; } if ( ops -> peer_getappinfo && ops -> peer_getapptable ) { err = dcbnl_build_peer_app ( netdev , skb , DCB_ATTR_IEEE_PEER_APP , DCB_ATTR_IEEE_APP_UNSPEC , DCB_ATTR_IEEE_APP ) ; if ( err ) return - EMSGSIZE ; } nla_nest_end ( skb , ieee ) ; if ( dcbx >= 0 ) { err = nla_put_u8 ( skb , DCB_ATTR_DCBX , dcbx ) ; if ( err ) return - EMSGSIZE ; } return 0 ; }
<S2SV_ModStart> ieee_ets ets ; memset ( & ets , 0 , sizeof ( ets ) ) ; <S2SV_ModStart> ieee_maxrate maxrate ; memset ( & maxrate , 0 , sizeof ( maxrate ) ) ; <S2SV_ModStart> struct ieee_pfc pfc ; memset ( & pfc , 0 , sizeof ( pfc ) ) <S2SV_ModStart> ieee_ets ets ; memset ( & ets , 0 , sizeof ( ets ) ) ; <S2SV_ModStart> struct ieee_pfc pfc ; memset ( & pfc , 0 , sizeof ( pfc ) )
torvalds@linux/29cd8ae0e1a39e239a3a7b67da1986add1199fc0
CVE-2013-2634
https://github.com/torvalds/linux/commit/29cd8ae0e1a39e239a3a7b67da1986add1199fc0
2013-03-22T11:59Z
183
CWE-125
CWE-125 void cfm_print ( netdissect_options * ndo , register const u_char * pptr , register u_int length ) { const struct cfm_common_header_t * cfm_common_header ; const struct cfm_tlv_header_t * cfm_tlv_header ; const uint8_t * tptr , * tlv_ptr ; const uint8_t * namesp ; u_int names_data_remaining ; uint8_t md_nameformat , md_namelength ; const uint8_t * md_name ; uint8_t ma_nameformat , ma_namelength ; const uint8_t * ma_name ; u_int hexdump , tlen , cfm_tlv_len , cfm_tlv_type , ccm_interval ; union { const struct cfm_ccm_t * cfm_ccm ; const struct cfm_lbm_t * cfm_lbm ; const struct cfm_ltm_t * cfm_ltm ; const struct cfm_ltr_t * cfm_ltr ; } msg_ptr ; tptr = pptr ; cfm_common_header = ( const struct cfm_common_header_t * ) pptr ; if ( length < sizeof ( * cfm_common_header ) ) goto tooshort ; ND_TCHECK ( * cfm_common_header ) ; if ( CFM_EXTRACT_VERSION ( cfm_common_header -> mdlevel_version ) != CFM_VERSION ) { ND_PRINT ( ( ndo , "CFMv%u<S2SV_blank>not<S2SV_blank>supported,<S2SV_blank>length<S2SV_blank>%u" , CFM_EXTRACT_VERSION ( cfm_common_header -> mdlevel_version ) , length ) ) ; return ; } ND_PRINT ( ( ndo , "CFMv%u<S2SV_blank>%s,<S2SV_blank>MD<S2SV_blank>Level<S2SV_blank>%u,<S2SV_blank>length<S2SV_blank>%u" , CFM_EXTRACT_VERSION ( cfm_common_header -> mdlevel_version ) , tok2str ( cfm_opcode_values , "unknown<S2SV_blank>(%u)" , cfm_common_header -> opcode ) , CFM_EXTRACT_MD_LEVEL ( cfm_common_header -> mdlevel_version ) , length ) ) ; if ( ndo -> ndo_vflag < 1 ) { return ; } ND_PRINT ( ( ndo , "\\n\\tFirst<S2SV_blank>TLV<S2SV_blank>offset<S2SV_blank>%u" , cfm_common_header -> first_tlv_offset ) ) ; tptr += sizeof ( const struct cfm_common_header_t ) ; tlen = length - sizeof ( struct cfm_common_header_t ) ; if ( cfm_common_header -> first_tlv_offset > tlen ) { ND_PRINT ( ( ndo , "<S2SV_blank>(too<S2SV_blank>large,<S2SV_blank>must<S2SV_blank>be<S2SV_blank><=<S2SV_blank>%u)" , tlen ) ) ; return ; } switch ( cfm_common_header -> opcode ) { case CFM_OPCODE_CCM : msg_ptr . cfm_ccm = ( const struct cfm_ccm_t * ) tptr ; if ( cfm_common_header -> first_tlv_offset < sizeof ( * msg_ptr . cfm_ccm ) ) { ND_PRINT ( ( ndo , "<S2SV_blank>(too<S2SV_blank>small<S2SV_blank>1,<S2SV_blank>must<S2SV_blank>be<S2SV_blank>>=<S2SV_blank>%lu)" , ( unsigned long ) sizeof ( * msg_ptr . cfm_ccm ) ) ) ; return ; } if ( tlen < sizeof ( * msg_ptr . cfm_ccm ) ) goto tooshort ; ND_TCHECK ( * msg_ptr . cfm_ccm ) ; ccm_interval = CFM_EXTRACT_CCM_INTERVAL ( cfm_common_header -> flags ) ; ND_PRINT ( ( ndo , ",<S2SV_blank>Flags<S2SV_blank>[CCM<S2SV_blank>Interval<S2SV_blank>%u%s]" , ccm_interval , cfm_common_header -> flags & CFM_CCM_RDI_FLAG ? ",<S2SV_blank>RDI" : "" ) ) ; if ( ccm_interval ) { ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>CCM<S2SV_blank>Interval<S2SV_blank>%.3fs" ",<S2SV_blank>min<S2SV_blank>CCM<S2SV_blank>Lifetime<S2SV_blank>%.3fs,<S2SV_blank>max<S2SV_blank>CCM<S2SV_blank>Lifetime<S2SV_blank>%.3fs" , ccm_interval_base [ ccm_interval ] , ccm_interval_base [ ccm_interval ] * CCM_INTERVAL_MIN_MULTIPLIER , ccm_interval_base [ ccm_interval ] * CCM_INTERVAL_MAX_MULTIPLIER ) ) ; } ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Sequence<S2SV_blank>Number<S2SV_blank>0x%08x,<S2SV_blank>MA-End-Point-ID<S2SV_blank>0x%04x" , EXTRACT_32BITS ( msg_ptr . cfm_ccm -> sequence ) , EXTRACT_16BITS ( msg_ptr . cfm_ccm -> ma_epi ) ) ) ; namesp = msg_ptr . cfm_ccm -> names ; names_data_remaining = sizeof ( msg_ptr . cfm_ccm -> names ) ; md_nameformat = * namesp ; namesp ++ ; names_data_remaining -- ; if ( md_nameformat != CFM_CCM_MD_FORMAT_NONE ) { md_namelength = * namesp ; namesp ++ ; names_data_remaining -- ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>MD<S2SV_blank>Name<S2SV_blank>Format<S2SV_blank>%s<S2SV_blank>(%u),<S2SV_blank>MD<S2SV_blank>Name<S2SV_blank>length<S2SV_blank>%u" , tok2str ( cfm_md_nameformat_values , "Unknown" , md_nameformat ) , md_nameformat , md_namelength ) ) ; if ( md_namelength > names_data_remaining - 3 ) { ND_PRINT ( ( ndo , "<S2SV_blank>(too<S2SV_blank>large,<S2SV_blank>must<S2SV_blank>be<S2SV_blank><=<S2SV_blank>%u)" , names_data_remaining - 2 ) ) ; return ; } md_name = namesp ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>MD<S2SV_blank>Name:<S2SV_blank>" ) ) ; switch ( md_nameformat ) { case CFM_CCM_MD_FORMAT_DNS : case CFM_CCM_MD_FORMAT_CHAR : safeputs ( ndo , md_name , md_namelength ) ; break ; case CFM_CCM_MD_FORMAT_MAC : if ( md_namelength == 6 ) { ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>MAC<S2SV_blank>%s" , etheraddr_string ( ndo , md_name ) ) ) ; } else { ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>MAC<S2SV_blank>(length<S2SV_blank>invalid)" ) ) ; } break ; case CFM_CCM_MA_FORMAT_8021 : default : print_unknown_data ( ndo , md_name , "\\n\\t<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" , md_namelength ) ; } namesp += md_namelength ; names_data_remaining -= md_namelength ; } else { ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>MD<S2SV_blank>Name<S2SV_blank>Format<S2SV_blank>%s<S2SV_blank>(%u)" , tok2str ( cfm_md_nameformat_values , "Unknown" , md_nameformat ) , md_nameformat ) ) ; } ma_nameformat = * namesp ; namesp ++ ; names_data_remaining -- ; ma_namelength = * namesp ; namesp ++ ; names_data_remaining -- ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>MA<S2SV_blank>Name-Format<S2SV_blank>%s<S2SV_blank>(%u),<S2SV_blank>MA<S2SV_blank>name<S2SV_blank>length<S2SV_blank>%u" , tok2str ( cfm_ma_nameformat_values , "Unknown" , ma_nameformat ) , ma_nameformat , ma_namelength ) ) ; if ( ma_namelength > names_data_remaining ) { ND_PRINT ( ( ndo , "<S2SV_blank>(too<S2SV_blank>large,<S2SV_blank>must<S2SV_blank>be<S2SV_blank><=<S2SV_blank>%u)" , names_data_remaining ) ) ; return ; } ma_name = namesp ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>MA<S2SV_blank>Name:<S2SV_blank>" ) ) ; switch ( ma_nameformat ) { case CFM_CCM_MA_FORMAT_CHAR : safeputs ( ndo , ma_name , ma_namelength ) ; break ; case CFM_CCM_MA_FORMAT_8021 : case CFM_CCM_MA_FORMAT_VID : case CFM_CCM_MA_FORMAT_INT : case CFM_CCM_MA_FORMAT_VPN : default : print_unknown_data ( ndo , ma_name , "\\n\\t<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" , ma_namelength ) ; } break ; case CFM_OPCODE_LTM : msg_ptr . cfm_ltm = ( const struct cfm_ltm_t * ) tptr ; if ( cfm_common_header -> first_tlv_offset < sizeof ( * msg_ptr . cfm_ltm ) ) { ND_PRINT ( ( ndo , "<S2SV_blank>(too<S2SV_blank>small<S2SV_blank>4,<S2SV_blank>must<S2SV_blank>be<S2SV_blank>>=<S2SV_blank>%lu)" , ( unsigned long ) sizeof ( * msg_ptr . cfm_ltm ) ) ) ; return ; } if ( tlen < sizeof ( * msg_ptr . cfm_ltm ) ) goto tooshort ; ND_TCHECK ( * msg_ptr . cfm_ltm ) ; ND_PRINT ( ( ndo , ",<S2SV_blank>Flags<S2SV_blank>[%s]" , bittok2str ( cfm_ltm_flag_values , "none" , cfm_common_header -> flags ) ) ) ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Transaction-ID<S2SV_blank>0x%08x,<S2SV_blank>ttl<S2SV_blank>%u" , EXTRACT_32BITS ( msg_ptr . cfm_ltm -> transaction_id ) , msg_ptr . cfm_ltm -> ttl ) ) ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Original-MAC<S2SV_blank>%s,<S2SV_blank>Target-MAC<S2SV_blank>%s" , etheraddr_string ( ndo , msg_ptr . cfm_ltm -> original_mac ) , etheraddr_string ( ndo , msg_ptr . cfm_ltm -> target_mac ) ) ) ; break ; case CFM_OPCODE_LTR : msg_ptr . cfm_ltr = ( const struct cfm_ltr_t * ) tptr ; if ( cfm_common_header -> first_tlv_offset < sizeof ( * msg_ptr . cfm_ltr ) ) { ND_PRINT ( ( ndo , "<S2SV_blank>(too<S2SV_blank>small<S2SV_blank>5,<S2SV_blank>must<S2SV_blank>be<S2SV_blank>>=<S2SV_blank>%lu)" , ( unsigned long ) sizeof ( * msg_ptr . cfm_ltr ) ) ) ; return ; } if ( tlen < sizeof ( * msg_ptr . cfm_ltr ) ) goto tooshort ; ND_TCHECK ( * msg_ptr . cfm_ltr ) ; ND_PRINT ( ( ndo , ",<S2SV_blank>Flags<S2SV_blank>[%s]" , bittok2str ( cfm_ltr_flag_values , "none" , cfm_common_header -> flags ) ) ) ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Transaction-ID<S2SV_blank>0x%08x,<S2SV_blank>ttl<S2SV_blank>%u" , EXTRACT_32BITS ( msg_ptr . cfm_ltr -> transaction_id ) , msg_ptr . cfm_ltr -> ttl ) ) ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Replay-Action<S2SV_blank>%s<S2SV_blank>(%u)" , tok2str ( cfm_ltr_replay_action_values , "Unknown" , msg_ptr . cfm_ltr -> replay_action ) , msg_ptr . cfm_ltr -> replay_action ) ) ; break ; case CFM_OPCODE_LBR : case CFM_OPCODE_LBM : default : print_unknown_data ( ndo , tptr , "\\n\\t<S2SV_blank><S2SV_blank>" , tlen - cfm_common_header -> first_tlv_offset ) ; break ; } tptr += cfm_common_header -> first_tlv_offset ; tlen -= cfm_common_header -> first_tlv_offset ; while ( tlen > 0 ) { cfm_tlv_header = ( const struct cfm_tlv_header_t * ) tptr ; ND_TCHECK2 ( * tptr , 1 ) ; cfm_tlv_type = cfm_tlv_header -> type ; ND_PRINT ( ( ndo , "\\n\\t%s<S2SV_blank>TLV<S2SV_blank>(0x%02x)" , tok2str ( cfm_tlv_values , "Unknown" , cfm_tlv_type ) , cfm_tlv_type ) ) ; if ( cfm_tlv_type == CFM_TLV_END ) { return ; } if ( tlen < sizeof ( struct cfm_tlv_header_t ) ) goto tooshort ; ND_TCHECK2 ( * tptr , sizeof ( struct cfm_tlv_header_t ) ) ; cfm_tlv_len = EXTRACT_16BITS ( & cfm_tlv_header -> length ) ; ND_PRINT ( ( ndo , ",<S2SV_blank>length<S2SV_blank>%u" , cfm_tlv_len ) ) ; tptr += sizeof ( struct cfm_tlv_header_t ) ; tlen -= sizeof ( struct cfm_tlv_header_t ) ; tlv_ptr = tptr ; if ( tlen < cfm_tlv_len ) goto tooshort ; ND_TCHECK2 ( * tptr , cfm_tlv_len ) ; hexdump = FALSE ; switch ( cfm_tlv_type ) { case CFM_TLV_PORT_STATUS : if ( cfm_tlv_len < 1 ) { ND_PRINT ( ( ndo , "<S2SV_blank>(too<S2SV_blank>short,<S2SV_blank>must<S2SV_blank>be<S2SV_blank>>=<S2SV_blank>1)" ) ) ; return ; } ND_PRINT ( ( ndo , ",<S2SV_blank>Status:<S2SV_blank>%s<S2SV_blank>(%u)" , tok2str ( cfm_tlv_port_status_values , "Unknown" , * tptr ) , * tptr ) ) ; break ; case CFM_TLV_INTERFACE_STATUS : if ( cfm_tlv_len < 1 ) { ND_PRINT ( ( ndo , "<S2SV_blank>(too<S2SV_blank>short,<S2SV_blank>must<S2SV_blank>be<S2SV_blank>>=<S2SV_blank>1)" ) ) ; return ; } ND_PRINT ( ( ndo , ",<S2SV_blank>Status:<S2SV_blank>%s<S2SV_blank>(%u)" , tok2str ( cfm_tlv_interface_status_values , "Unknown" , * tptr ) , * tptr ) ) ; break ; case CFM_TLV_PRIVATE : if ( cfm_tlv_len < 4 ) { ND_PRINT ( ( ndo , "<S2SV_blank>(too<S2SV_blank>short,<S2SV_blank>must<S2SV_blank>be<S2SV_blank>>=<S2SV_blank>4)" ) ) ; return ; } ND_PRINT ( ( ndo , ",<S2SV_blank>Vendor:<S2SV_blank>%s<S2SV_blank>(%u),<S2SV_blank>Sub-Type<S2SV_blank>%u" , tok2str ( oui_values , "Unknown" , EXTRACT_24BITS ( tptr ) ) , EXTRACT_24BITS ( tptr ) , * ( tptr + 3 ) ) ) ; hexdump = TRUE ; break ; case CFM_TLV_SENDER_ID : { u_int chassis_id_type , chassis_id_length ; u_int mgmt_addr_length ; if ( cfm_tlv_len < 1 ) { ND_PRINT ( ( ndo , "<S2SV_blank>(too<S2SV_blank>short,<S2SV_blank>must<S2SV_blank>be<S2SV_blank>>=<S2SV_blank>1)" ) ) ; <S2SV_StartBug> return ; <S2SV_EndBug> } chassis_id_length = * tptr ; tptr ++ ; tlen -- ; cfm_tlv_len -- ; if ( chassis_id_length ) { if ( cfm_tlv_len < 1 ) { ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>(TLV<S2SV_blank>too<S2SV_blank>short)" ) ) ; <S2SV_StartBug> return ; <S2SV_EndBug> } chassis_id_type = * tptr ; cfm_tlv_len -- ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Chassis-ID<S2SV_blank>Type<S2SV_blank>%s<S2SV_blank>(%u),<S2SV_blank>Chassis-ID<S2SV_blank>length<S2SV_blank>%u" , tok2str ( cfm_tlv_senderid_chassisid_values , "Unknown" , chassis_id_type ) , chassis_id_type , chassis_id_length ) ) ; if ( cfm_tlv_len < chassis_id_length ) { ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>(TLV<S2SV_blank>too<S2SV_blank>short)" ) ) ; <S2SV_StartBug> return ; <S2SV_EndBug> } switch ( chassis_id_type ) { <S2SV_StartBug> case CFM_CHASSIS_ID_MAC_ADDRESS : <S2SV_EndBug> ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>MAC<S2SV_blank>%s" , etheraddr_string ( ndo , tptr + 1 ) ) ) ; break ; case CFM_CHASSIS_ID_NETWORK_ADDRESS : <S2SV_StartBug> hexdump |= cfm_network_addr_print ( ndo , tptr ) ; <S2SV_EndBug> break ; case CFM_CHASSIS_ID_INTERFACE_NAME : case CFM_CHASSIS_ID_INTERFACE_ALIAS : case CFM_CHASSIS_ID_LOCAL : case CFM_CHASSIS_ID_CHASSIS_COMPONENT : case CFM_CHASSIS_ID_PORT_COMPONENT : safeputs ( ndo , tptr + 1 , chassis_id_length ) ; break ; default : hexdump = TRUE ; break ; } cfm_tlv_len -= chassis_id_length ; tptr += 1 + chassis_id_length ; tlen -= 1 + chassis_id_length ; } if ( cfm_tlv_len == 0 ) { <S2SV_StartBug> return ; <S2SV_EndBug> } mgmt_addr_length = * tptr ; tptr ++ ; tlen -- ; cfm_tlv_len -- ; <S2SV_StartBug> if ( mgmt_addr_length ) { <S2SV_EndBug> if ( cfm_tlv_len < mgmt_addr_length ) { ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>(TLV<S2SV_blank>too<S2SV_blank>short)" ) ) ; <S2SV_StartBug> return ; <S2SV_EndBug> } <S2SV_StartBug> cfm_tlv_len -= mgmt_addr_length ; <S2SV_EndBug> tptr += mgmt_addr_length ; tlen -= mgmt_addr_length ; if ( cfm_tlv_len < 1 ) { <S2SV_StartBug> ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>(TLV<S2SV_blank>too<S2SV_blank>short)" ) ) ; <S2SV_EndBug> return ; } mgmt_addr_length = * tptr ; tptr ++ ; tlen -- ; cfm_tlv_len -- ; <S2SV_StartBug> if ( mgmt_addr_length ) { <S2SV_EndBug> if ( cfm_tlv_len < mgmt_addr_length ) { ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>(TLV<S2SV_blank>too<S2SV_blank>short)" ) ) ; return ; } <S2SV_StartBug> cfm_tlv_len -= mgmt_addr_length ; <S2SV_EndBug> tptr += mgmt_addr_length ; tlen -= mgmt_addr_length ; } } break ; } case CFM_TLV_DATA : case CFM_TLV_REPLY_INGRESS : case CFM_TLV_REPLY_EGRESS : default : hexdump = TRUE ; break ; } if ( hexdump || ndo -> ndo_vflag > 1 ) print_unknown_data ( ndo , tlv_ptr , "\\n\\t<S2SV_blank><S2SV_blank>" , cfm_tlv_len ) ; <S2SV_StartBug> tptr += cfm_tlv_len ; <S2SV_EndBug> tlen -= cfm_tlv_len ; } return ; tooshort : ND_PRINT ( ( ndo , "\\n\\t\\t<S2SV_blank>packet<S2SV_blank>is<S2SV_blank>too<S2SV_blank>short" ) ) ; return ; trunc : ND_PRINT ( ( ndo , "\\n\\t\\t<S2SV_blank>packet<S2SV_blank>exceeded<S2SV_blank>snapshot" ) ) ; }
<S2SV_ModStart> ) ) ; goto next_tlv <S2SV_ModEnd> ; } chassis_id_length <S2SV_ModStart> ) ) ; goto next_tlv <S2SV_ModEnd> ; } chassis_id_type <S2SV_ModStart> ) ) ; goto next_tlv <S2SV_ModEnd> ; } switch <S2SV_ModStart> case CFM_CHASSIS_ID_MAC_ADDRESS : if ( chassis_id_length != ETHER_ADDR_LEN ) { ND_PRINT ( ( ndo , "<S2SV_blank>(invalid<S2SV_blank>MAC<S2SV_blank>address<S2SV_blank>length)" ) ) ; hexdump = TRUE ; break ; } <S2SV_ModStart> ndo , tptr + 1 , chassis_id_length <S2SV_ModStart> 0 ) { break <S2SV_ModEnd> ; } mgmt_addr_length <S2SV_ModStart> cfm_tlv_len -- ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Management<S2SV_blank>Address<S2SV_blank>Domain<S2SV_blank>Length<S2SV_blank>%u" , mgmt_addr_length ) ) ; <S2SV_ModStart> ) ) ; goto next_tlv <S2SV_ModEnd> ; } cfm_tlv_len <S2SV_ModStart> cfm_tlv_len -= mgmt_addr_length ; hex_print ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Management<S2SV_blank>Address<S2SV_blank>Domain:<S2SV_blank>" , tptr , mgmt_addr_length ) <S2SV_ModStart> ( ndo , "<S2SV_blank>(Management<S2SV_blank>Address<S2SV_blank>Length<S2SV_blank>is<S2SV_blank>missing)" ) ) ; hexdump = TRUE ; break <S2SV_ModEnd> ; } mgmt_addr_length <S2SV_ModStart> cfm_tlv_len -- ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Management<S2SV_blank>Address<S2SV_blank>Length<S2SV_blank>%u" , mgmt_addr_length ) ) ; <S2SV_ModStart> cfm_tlv_len -= mgmt_addr_length ; hex_print ( ndo , "\\n\\t<S2SV_blank><S2SV_blank>Management<S2SV_blank>Address:<S2SV_blank>" , tptr , mgmt_addr_length ) <S2SV_ModStart> cfm_tlv_len ) ; next_tlv :
the-tcpdump-group@tcpdump/5d340a5ca6e420a70297cdbdf777333f18bfdab7
CVE-2017-13052
https://github.com/the-tcpdump-group/tcpdump/commit/5d340a5ca6e420a70297cdbdf777333f18bfdab7
2017-09-14T06:29Z
184
CWE-119
CWE-119 <S2SV_StartBug> void fadst4_sse2 ( __m128i * in ) { <S2SV_EndBug> const __m128i k__sinpi_p01_p02 = pair_set_epi16 ( sinpi_1_9 , sinpi_2_9 ) ; const __m128i k__sinpi_p04_m01 = pair_set_epi16 ( sinpi_4_9 , - sinpi_1_9 ) ; const __m128i k__sinpi_p03_p04 = pair_set_epi16 ( sinpi_3_9 , sinpi_4_9 ) ; const __m128i k__sinpi_m03_p02 = pair_set_epi16 ( - sinpi_3_9 , sinpi_2_9 ) ; <S2SV_StartBug> const __m128i k__sinpi_p03_p03 = _mm_set1_epi16 ( sinpi_3_9 ) ; <S2SV_EndBug> const __m128i kZero = _mm_set1_epi16 ( 0 ) ; const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32 ( DCT_CONST_ROUNDING ) ; __m128i u [ 8 ] , v [ 8 ] ; __m128i in7 = _mm_add_epi16 ( in [ 0 ] , in [ 1 ] ) ; u [ 0 ] = _mm_unpacklo_epi16 ( in [ 0 ] , in [ 1 ] ) ; u [ 1 ] = _mm_unpacklo_epi16 ( in [ 2 ] , in [ 3 ] ) ; u [ 2 ] = _mm_unpacklo_epi16 ( in7 , kZero ) ; u [ 3 ] = _mm_unpacklo_epi16 ( in [ 2 ] , kZero ) ; u [ 4 ] = _mm_unpacklo_epi16 ( in [ 3 ] , kZero ) ; v [ 0 ] = _mm_madd_epi16 ( u [ 0 ] , k__sinpi_p01_p02 ) ; v [ 1 ] = _mm_madd_epi16 ( u [ 1 ] , k__sinpi_p03_p04 ) ; v [ 2 ] = _mm_madd_epi16 ( u [ 2 ] , k__sinpi_p03_p03 ) ; v [ 3 ] = _mm_madd_epi16 ( u [ 0 ] , k__sinpi_p04_m01 ) ; v [ 4 ] = _mm_madd_epi16 ( u [ 1 ] , k__sinpi_m03_p02 ) ; v [ 5 ] = _mm_madd_epi16 ( u [ 3 ] , k__sinpi_p03_p03 ) ; v [ 6 ] = _mm_madd_epi16 ( u [ 4 ] , k__sinpi_p03_p03 ) ; u [ 0 ] = _mm_add_epi32 ( v [ 0 ] , v [ 1 ] ) ; u [ 1 ] = _mm_sub_epi32 ( v [ 2 ] , v [ 6 ] ) ; u [ 2 ] = _mm_add_epi32 ( v [ 3 ] , v [ 4 ] ) ; u [ 3 ] = _mm_sub_epi32 ( u [ 2 ] , u [ 0 ] ) ; u [ 4 ] = _mm_slli_epi32 ( v [ 5 ] , 2 ) ; u [ 5 ] = _mm_sub_epi32 ( u [ 4 ] , v [ 5 ] ) ; u [ 6 ] = _mm_add_epi32 ( u [ 3 ] , u [ 5 ] ) ; v [ 0 ] = _mm_add_epi32 ( u [ 0 ] , k__DCT_CONST_ROUNDING ) ; v [ 1 ] = _mm_add_epi32 ( u [ 1 ] , k__DCT_CONST_ROUNDING ) ; v [ 2 ] = _mm_add_epi32 ( u [ 2 ] , k__DCT_CONST_ROUNDING ) ; v [ 3 ] = _mm_add_epi32 ( u [ 6 ] , k__DCT_CONST_ROUNDING ) ; u [ 0 ] = _mm_srai_epi32 ( v [ 0 ] , DCT_CONST_BITS ) ; u [ 1 ] = _mm_srai_epi32 ( v [ 1 ] , DCT_CONST_BITS ) ; u [ 2 ] = _mm_srai_epi32 ( v [ 2 ] , DCT_CONST_BITS ) ; u [ 3 ] = _mm_srai_epi32 ( v [ 3 ] , DCT_CONST_BITS ) ; in [ 0 ] = _mm_packs_epi32 ( u [ 0 ] , u [ 2 ] ) ; in [ 1 ] = _mm_packs_epi32 ( u [ 1 ] , u [ 3 ] ) ; transpose_4x4 ( in ) ; }
<S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> static <S2SV_ModStart> = _mm_set1_epi16 ( ( int16_t )
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
185
CWE-119
CWE-119 int main ( int argc , char * * argv ) { int frame_cnt = 0 ; FILE * outfile = NULL ; vpx_codec_ctx_t codec ; VpxVideoReader * reader = NULL ; const VpxInterface * decoder = NULL ; const VpxVideoInfo * info = NULL ; exec_name = argv [ 0 ] ; if ( argc != 3 ) die ( "Invalid<S2SV_blank>number<S2SV_blank>of<S2SV_blank>arguments." ) ; reader = vpx_video_reader_open ( argv [ 1 ] ) ; if ( ! reader ) die ( "Failed<S2SV_blank>to<S2SV_blank>open<S2SV_blank>%s<S2SV_blank>for<S2SV_blank>reading." , argv [ 1 ] ) ; if ( ! ( outfile = fopen ( argv [ 2 ] , "wb" ) ) ) die ( "Failed<S2SV_blank>to<S2SV_blank>open<S2SV_blank>%s<S2SV_blank>for<S2SV_blank>writing." , argv [ 2 ] ) ; info = vpx_video_reader_get_info ( reader ) ; decoder = get_vpx_decoder_by_fourcc ( info -> codec_fourcc ) ; if ( ! decoder ) die ( "Unknown<S2SV_blank>input<S2SV_blank>codec." ) ; <S2SV_StartBug> printf ( "Using<S2SV_blank>%s\\n" , vpx_codec_iface_name ( decoder -> interface ( ) ) ) ; <S2SV_EndBug> <S2SV_StartBug> if ( vpx_codec_dec_init ( & codec , decoder -> interface ( ) , NULL , 0 ) ) <S2SV_EndBug> die_codec ( & codec , "Failed<S2SV_blank>to<S2SV_blank>initialize<S2SV_blank>decoder." ) ; while ( vpx_video_reader_read_frame ( reader ) ) { vpx_codec_iter_t iter = NULL ; vpx_image_t * img = NULL ; size_t frame_size = 0 ; const unsigned char * frame = vpx_video_reader_get_frame ( reader , & frame_size ) ; if ( vpx_codec_decode ( & codec , frame , ( unsigned int ) frame_size , NULL , 0 ) ) die_codec ( & codec , "Failed<S2SV_blank>to<S2SV_blank>decode<S2SV_blank>frame." ) ; while ( ( img = vpx_codec_get_frame ( & codec , & iter ) ) != NULL ) { vpx_img_write ( img , outfile ) ; ++ frame_cnt ; } } printf ( "Processed<S2SV_blank>%d<S2SV_blank>frames.\\n" , frame_cnt ) ; if ( vpx_codec_destroy ( & codec ) ) die_codec ( & codec , "Failed<S2SV_blank>to<S2SV_blank>destroy<S2SV_blank>codec" ) ; printf ( "Play:<S2SV_blank>ffplay<S2SV_blank>-f<S2SV_blank>rawvideo<S2SV_blank>-pix_fmt<S2SV_blank>yuv420p<S2SV_blank>-s<S2SV_blank>%dx%d<S2SV_blank>%s\\n" , info -> frame_width , info -> frame_height , argv [ 2 ] ) ; vpx_video_reader_close ( reader ) ; fclose ( outfile ) ; return EXIT_SUCCESS ; }
<S2SV_ModStart> ( decoder -> codec_interface <S2SV_ModEnd> ( ) ) <S2SV_ModStart> , decoder -> codec_interface <S2SV_ModEnd> ( ) ,
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
186
CWE-200
CWE-200 int vcc_recvmsg ( struct kiocb * iocb , struct socket * sock , struct msghdr * msg , size_t size , int flags ) { struct sock * sk = sock -> sk ; struct atm_vcc * vcc ; struct sk_buff * skb ; <S2SV_StartBug> int copied , error = - EINVAL ; <S2SV_EndBug> if ( sock -> state != SS_CONNECTED ) return - ENOTCONN ; if ( flags & ~ ( MSG_DONTWAIT | MSG_PEEK ) ) return - EOPNOTSUPP ; vcc = ATM_SD ( sock ) ; if ( test_bit ( ATM_VF_RELEASED , & vcc -> flags ) || test_bit ( ATM_VF_CLOSE , & vcc -> flags ) || ! test_bit ( ATM_VF_READY , & vcc -> flags ) ) return 0 ; skb = skb_recv_datagram ( sk , flags , flags & MSG_DONTWAIT , & error ) ; if ( ! skb ) return error ; copied = skb -> len ; if ( copied > size ) { copied = size ; msg -> msg_flags |= MSG_TRUNC ; } error = skb_copy_datagram_iovec ( skb , 0 , msg -> msg_iov , copied ) ; if ( error ) return error ; sock_recv_ts_and_drops ( msg , sk , skb ) ; if ( ! ( flags & MSG_PEEK ) ) { pr_debug ( "%d<S2SV_blank>-=<S2SV_blank>%d\\n" , atomic_read ( & sk -> sk_rmem_alloc ) , skb -> truesize ) ; atm_return ( vcc , skb -> truesize ) ; } skb_free_datagram ( sk , skb ) ; return copied ; }
<S2SV_ModStart> = - EINVAL ; msg -> msg_namelen = 0
torvalds@linux/9b3e617f3df53822345a8573b6d358f6b9e5ed87
CVE-2013-3222
https://github.com/torvalds/linux/commit/9b3e617f3df53822345a8573b6d358f6b9e5ed87
2013-04-22T11:41Z
187
CWE-320
CWE-320 int sshkey_load_file ( int fd , struct sshbuf * blob ) { u_char buf [ 1024 ] ; size_t len ; struct stat st ; <S2SV_StartBug> int r ; <S2SV_EndBug> if ( fstat ( fd , & st ) < 0 ) return SSH_ERR_SYSTEM_ERROR ; if ( ( st . st_mode & ( S_IFSOCK | S_IFCHR | S_IFIFO ) ) == 0 && st . st_size > MAX_KEY_FILE_SIZE ) return SSH_ERR_INVALID_FORMAT ; <S2SV_StartBug> for ( ; ; ) { <S2SV_EndBug> if ( ( len = atomicio ( read , fd , buf , sizeof ( buf ) ) ) == 0 ) { if ( errno == EPIPE ) break ; r = SSH_ERR_SYSTEM_ERROR ; goto out ; } if ( ( r = sshbuf_put ( blob , buf , len ) ) != 0 ) goto out ; if ( sshbuf_len ( blob ) > MAX_KEY_FILE_SIZE ) { r = SSH_ERR_INVALID_FORMAT ; goto out ; } } if ( ( st . st_mode & ( S_IFSOCK | S_IFCHR | S_IFIFO ) ) == 0 && st . st_size != ( off_t ) sshbuf_len ( blob ) ) { r = SSH_ERR_FILE_CHANGED ; goto out ; } r = 0 ; out : explicit_bzero ( buf , sizeof ( buf ) ) ; if ( r != 0 ) sshbuf_reset ( blob ) ; return r ; }
<S2SV_ModStart> ; int r , dontmax = 0 <S2SV_ModStart> return SSH_ERR_INVALID_FORMAT ; if ( ( st . st_mode & S_IFREG ) == 0 || st . st_size <= 0 ) { st . st_size = 64 * 1024 ; dontmax = 1 ; } if ( ( r = sshbuf_allocate ( blob , st . st_size ) ) != 0 || ( dontmax && ( r = sshbuf_set_max_size ( blob , st . st_size ) ) != 0 ) ) return r ;
openbsd@src/ac8147a06ed2e2403fb6b9a0c03e618a9333c0e9
CVE-2016-10011
https://github.com/openbsd/src/commit/ac8147a06ed2e2403fb6b9a0c03e618a9333c0e9
2017-01-05T02:59Z
188
CWE-000
CWE-000 static int snd_compress_check_input ( struct snd_compr_params * params ) { if ( params -> buffer . fragment_size == 0 || <S2SV_StartBug> params -> buffer . fragments > SIZE_MAX / params -> buffer . fragment_size ) <S2SV_EndBug> return - EINVAL ; if ( params -> codec . id == 0 || params -> codec . id > SND_AUDIOCODEC_MAX ) return - EINVAL ; if ( params -> codec . ch_in == 0 || params -> codec . ch_out == 0 ) return - EINVAL ; return 0 ; }
<S2SV_ModStart> . fragments > INT_MAX <S2SV_ModEnd> / params ->
torvalds@linux/6217e5ede23285ddfee10d2e4ba0cc2d4c046205
CVE-2014-9904
https://github.com/torvalds/linux/commit/6217e5ede23285ddfee10d2e4ba0cc2d4c046205
2016-06-27T10:59Z
189
CWE-22
CWE-22 static int target_xcopy_parse_target_descriptors ( struct se_cmd * se_cmd , struct xcopy_op * xop , unsigned char * p , unsigned short tdll , sense_reason_t * sense_ret ) { struct se_device * local_dev = se_cmd -> se_dev ; unsigned char * desc = p ; int offset = tdll % XCOPY_TARGET_DESC_LEN , rc ; unsigned short cscd_index = 0 ; unsigned short start = 0 ; * sense_ret = TCM_INVALID_PARAMETER_LIST ; if ( offset != 0 ) { pr_err ( "XCOPY<S2SV_blank>target<S2SV_blank>descriptor<S2SV_blank>list<S2SV_blank>length<S2SV_blank>is<S2SV_blank>not" "<S2SV_blank>multiple<S2SV_blank>of<S2SV_blank>%d\\n" , XCOPY_TARGET_DESC_LEN ) ; * sense_ret = TCM_UNSUPPORTED_TARGET_DESC_TYPE_CODE ; return - EINVAL ; } if ( tdll > RCR_OP_MAX_TARGET_DESC_COUNT * XCOPY_TARGET_DESC_LEN ) { pr_err ( "XCOPY<S2SV_blank>target<S2SV_blank>descriptor<S2SV_blank>supports<S2SV_blank>a<S2SV_blank>maximum" "<S2SV_blank>two<S2SV_blank>src/dest<S2SV_blank>descriptors,<S2SV_blank>tdll:<S2SV_blank>%hu<S2SV_blank>too<S2SV_blank>large..\\n" , tdll ) ; * sense_ret = TCM_TOO_MANY_TARGET_DESCS ; return - EINVAL ; } memset ( & xop -> local_dev_wwn [ 0 ] , 0 , XCOPY_NAA_IEEE_REGEX_LEN ) ; target_xcopy_gen_naa_ieee ( local_dev , & xop -> local_dev_wwn [ 0 ] ) ; while ( start < tdll ) { switch ( desc [ 0 ] ) { case 0xe4 : rc = target_xcopy_parse_tiddesc_e4 ( se_cmd , xop , & desc [ 0 ] , cscd_index ) ; if ( rc != 0 ) goto out ; start += XCOPY_TARGET_DESC_LEN ; desc += XCOPY_TARGET_DESC_LEN ; cscd_index ++ ; break ; default : pr_err ( "XCOPY<S2SV_blank>unsupported<S2SV_blank>descriptor<S2SV_blank>type<S2SV_blank>code:" "<S2SV_blank>0x%02x\\n" , desc [ 0 ] ) ; * sense_ret = TCM_UNSUPPORTED_TARGET_DESC_TYPE_CODE ; goto out ; } } switch ( xop -> op_origin ) { case XCOL_SOURCE_RECV_OP : <S2SV_StartBug> rc = target_xcopy_locate_se_dev_e4 ( xop -> dst_tid_wwn , <S2SV_EndBug> <S2SV_StartBug> & xop -> dst_dev ) ; <S2SV_EndBug> break ; case XCOL_DEST_RECV_OP : <S2SV_StartBug> rc = target_xcopy_locate_se_dev_e4 ( xop -> src_tid_wwn , <S2SV_EndBug> <S2SV_StartBug> & xop -> src_dev ) ; <S2SV_EndBug> break ; default : pr_err ( "XCOPY<S2SV_blank>CSCD<S2SV_blank>descriptor<S2SV_blank>IDs<S2SV_blank>not<S2SV_blank>found<S2SV_blank>in<S2SV_blank>CSCD<S2SV_blank>list<S2SV_blank>-<S2SV_blank>" "stdi:<S2SV_blank>%hu<S2SV_blank>dtdi:<S2SV_blank>%hu\\n" , xop -> stdi , xop -> dtdi ) ; rc = - EINVAL ; break ; } if ( rc < 0 ) { * sense_ret = TCM_COPY_TARGET_DEVICE_NOT_REACHABLE ; goto out ; } pr_debug ( "XCOPY<S2SV_blank>TGT<S2SV_blank>desc:<S2SV_blank>Source<S2SV_blank>dev:<S2SV_blank>%p<S2SV_blank>NAA<S2SV_blank>IEEE<S2SV_blank>WWN:<S2SV_blank>0x%16phN\\n" , xop -> src_dev , & xop -> src_tid_wwn [ 0 ] ) ; pr_debug ( "XCOPY<S2SV_blank>TGT<S2SV_blank>desc:<S2SV_blank>Dest<S2SV_blank>dev:<S2SV_blank>%p<S2SV_blank>NAA<S2SV_blank>IEEE<S2SV_blank>WWN:<S2SV_blank>0x%16phN\\n" , xop -> dst_dev , & xop -> dst_tid_wwn [ 0 ] ) ; return cscd_index ; out : return - EINVAL ; }
<S2SV_ModStart> = target_xcopy_locate_se_dev_e4 ( se_cmd -> se_sess , <S2SV_ModStart> xop -> dst_dev , & xop -> remote_lun_ref <S2SV_ModStart> = target_xcopy_locate_se_dev_e4 ( se_cmd -> se_sess , <S2SV_ModStart> xop -> src_dev , & xop -> remote_lun_ref
torvalds@linux/2896c93811e39d63a4d9b63ccf12a8fbc226e5e4
CVE-2020-28374
https://github.com/torvalds/linux/commit/2896c93811e39d63a4d9b63ccf12a8fbc226e5e4
2021-01-13T04:15Z
190
CWE-189
CWE-189 <S2SV_StartBug> void ipc_rcu_getref ( void * ptr ) <S2SV_EndBug> { <S2SV_StartBug> container_of ( ptr , struct ipc_rcu_hdr , data ) -> refcount ++ ; <S2SV_EndBug> }
<S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> int <S2SV_ModEnd> ipc_rcu_getref ( void <S2SV_ModStart> ptr ) { return atomic_inc_not_zero ( & <S2SV_ModStart> ) -> refcount ) <S2SV_ModEnd> ; } <S2SV_null>
torvalds@linux/6062a8dc0517bce23e3c2f7d2fea5e22411269a3
CVE-2013-4483
https://github.com/torvalds/linux/commit/6062a8dc0517bce23e3c2f7d2fea5e22411269a3
2013-11-04T15:55Z
191
CWE-287
CWE-287 static int netlink_sendmsg ( struct kiocb * kiocb , struct socket * sock , struct msghdr * msg , size_t len ) { struct sock_iocb * siocb = kiocb_to_siocb ( kiocb ) ; struct sock * sk = sock -> sk ; struct netlink_sock * nlk = nlk_sk ( sk ) ; struct sockaddr_nl * addr = msg -> msg_name ; u32 dst_pid ; u32 dst_group ; struct sk_buff * skb ; int err ; struct scm_cookie scm ; if ( msg -> msg_flags & MSG_OOB ) return - EOPNOTSUPP ; if ( NULL == siocb -> scm ) siocb -> scm = & scm ; <S2SV_StartBug> err = scm_send ( sock , msg , siocb -> scm ) ; <S2SV_EndBug> if ( err < 0 ) return err ; if ( msg -> msg_namelen ) { err = - EINVAL ; if ( addr -> nl_family != AF_NETLINK ) goto out ; dst_pid = addr -> nl_pid ; dst_group = ffs ( addr -> nl_groups ) ; err = - EPERM ; if ( dst_group && ! netlink_capable ( sock , NL_NONROOT_SEND ) ) goto out ; } else { dst_pid = nlk -> dst_pid ; dst_group = nlk -> dst_group ; } if ( ! nlk -> pid ) { err = netlink_autobind ( sock ) ; if ( err ) goto out ; } err = - EMSGSIZE ; if ( len > sk -> sk_sndbuf - 32 ) goto out ; err = - ENOBUFS ; skb = alloc_skb ( len , GFP_KERNEL ) ; if ( skb == NULL ) goto out ; NETLINK_CB ( skb ) . pid = nlk -> pid ; NETLINK_CB ( skb ) . dst_group = dst_group ; memcpy ( NETLINK_CREDS ( skb ) , & siocb -> scm -> creds , sizeof ( struct ucred ) ) ; err = - EFAULT ; if ( memcpy_fromiovec ( skb_put ( skb , len ) , msg -> msg_iov , len ) ) { kfree_skb ( skb ) ; goto out ; } err = security_netlink_send ( sk , skb ) ; if ( err ) { kfree_skb ( skb ) ; goto out ; } if ( dst_group ) { atomic_inc ( & skb -> users ) ; netlink_broadcast ( sk , skb , dst_pid , dst_group , GFP_KERNEL ) ; } err = netlink_unicast ( sk , skb , dst_pid , msg -> msg_flags & MSG_DONTWAIT ) ; out : scm_destroy ( siocb -> scm ) ; return err ; }
<S2SV_ModStart> siocb -> scm , true
torvalds@linux/e0e3cea46d31d23dc40df0a49a7a2c04fe8edfea
CVE-2012-3520
https://github.com/torvalds/linux/commit/e0e3cea46d31d23dc40df0a49a7a2c04fe8edfea
2012-10-03T11:02Z
192
CWE-125
CWE-125 static Image * ReadVIFFImage ( const ImageInfo * image_info , ExceptionInfo * exception ) { # define VFF_CM_genericRGB 15 # define VFF_CM_ntscRGB 1 # define VFF_CM_NONE 0 # define VFF_DEP_DECORDER 0x4 # define VFF_DEP_NSORDER 0x8 # define VFF_DES_RAW 0 # define VFF_LOC_IMPLICIT 1 # define VFF_MAPTYP_NONE 0 # define VFF_MAPTYP_1_BYTE 1 # define VFF_MAPTYP_2_BYTE 2 # define VFF_MAPTYP_4_BYTE 4 # define VFF_MAPTYP_FLOAT 5 # define VFF_MAPTYP_DOUBLE 7 # define VFF_MS_NONE 0 # define VFF_MS_ONEPERBAND 1 # define VFF_MS_SHARED 3 # define VFF_TYP_BIT 0 # define VFF_TYP_1_BYTE 1 # define VFF_TYP_2_BYTE 2 # define VFF_TYP_4_BYTE 4 # define VFF_TYP_FLOAT 5 # define VFF_TYP_DOUBLE 9 typedef struct _ViffInfo { unsigned char identifier , file_type , release , version , machine_dependency , reserve [ 3 ] ; char comment [ 512 ] ; unsigned int rows , columns , subrows ; int x_offset , y_offset ; float x_bits_per_pixel , y_bits_per_pixel ; unsigned int location_type , location_dimension , number_of_images , number_data_bands , data_storage_type , data_encode_scheme , map_scheme , map_storage_type , map_rows , map_columns , map_subrows , map_enable , maps_per_cycle , color_space_model ; } ViffInfo ; double min_value , scale_factor , value ; Image * image ; int bit ; MagickBooleanType status ; MagickSizeType number_pixels ; register IndexPacket * indexes ; register ssize_t x ; register PixelPacket * q ; register ssize_t i ; register unsigned char * p ; size_t bytes_per_pixel , max_packets , quantum ; ssize_t count , y ; unsigned char * pixels ; unsigned long lsb_first ; ViffInfo viff_info ; 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 ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } count = ReadBlob ( image , 1 , & viff_info . identifier ) ; do { if ( ( count != 1 ) || ( ( unsigned char ) viff_info . identifier != 0xab ) ) ThrowReaderException ( CorruptImageError , "NotAVIFFImage" ) ; ( void ) ReadBlob ( image , sizeof ( viff_info . file_type ) , & viff_info . file_type ) ; ( void ) ReadBlob ( image , sizeof ( viff_info . release ) , & viff_info . release ) ; ( void ) ReadBlob ( image , sizeof ( viff_info . version ) , & viff_info . version ) ; ( void ) ReadBlob ( image , sizeof ( viff_info . machine_dependency ) , & viff_info . machine_dependency ) ; ( void ) ReadBlob ( image , sizeof ( viff_info . reserve ) , viff_info . reserve ) ; ( void ) ReadBlob ( image , 512 , ( unsigned char * ) viff_info . comment ) ; viff_info . comment [ 511 ] = '\\0' ; if ( strlen ( viff_info . comment ) > 4 ) ( void ) SetImageProperty ( image , "comment" , viff_info . comment ) ; if ( ( viff_info . machine_dependency == VFF_DEP_DECORDER ) || ( viff_info . machine_dependency == VFF_DEP_NSORDER ) ) image -> endian = LSBEndian ; else image -> endian = MSBEndian ; viff_info . rows = ReadBlobLong ( image ) ; viff_info . columns = ReadBlobLong ( image ) ; viff_info . subrows = ReadBlobLong ( image ) ; viff_info . x_offset = ( int ) ReadBlobLong ( image ) ; viff_info . y_offset = ( int ) ReadBlobLong ( image ) ; viff_info . x_bits_per_pixel = ( float ) ReadBlobLong ( image ) ; viff_info . y_bits_per_pixel = ( float ) ReadBlobLong ( image ) ; viff_info . location_type = ReadBlobLong ( image ) ; viff_info . location_dimension = ReadBlobLong ( image ) ; viff_info . number_of_images = ReadBlobLong ( image ) ; viff_info . number_data_bands = ReadBlobLong ( image ) ; viff_info . data_storage_type = ReadBlobLong ( image ) ; viff_info . data_encode_scheme = ReadBlobLong ( image ) ; viff_info . map_scheme = ReadBlobLong ( image ) ; viff_info . map_storage_type = ReadBlobLong ( image ) ; viff_info . map_rows = ReadBlobLong ( image ) ; viff_info . map_columns = ReadBlobLong ( image ) ; viff_info . map_subrows = ReadBlobLong ( image ) ; viff_info . map_enable = ReadBlobLong ( image ) ; viff_info . maps_per_cycle = ReadBlobLong ( image ) ; viff_info . color_space_model = ReadBlobLong ( image ) ; for ( i = 0 ; i < 420 ; i ++ ) ( void ) ReadBlobByte ( image ) ; if ( EOFBlob ( image ) != MagickFalse ) ThrowReaderException ( CorruptImageError , "UnexpectedEndOfFile" ) ; image -> columns = viff_info . rows ; image -> rows = viff_info . columns ; image -> depth = viff_info . x_bits_per_pixel <= 8 ? 8UL : MAGICKCORE_QUANTUM_DEPTH ; number_pixels = ( MagickSizeType ) viff_info . columns * viff_info . rows ; if ( number_pixels != ( size_t ) number_pixels ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; if ( number_pixels == 0 ) ThrowReaderException ( CoderError , "ImageColumnOrRowSizeIsNotSupported" ) ; if ( ( viff_info . number_data_bands < 1 ) || ( viff_info . number_data_bands > 4 ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; if ( ( viff_info . data_storage_type != VFF_TYP_BIT ) && ( viff_info . data_storage_type != VFF_TYP_1_BYTE ) && ( viff_info . data_storage_type != VFF_TYP_2_BYTE ) && ( viff_info . data_storage_type != VFF_TYP_4_BYTE ) && ( viff_info . data_storage_type != VFF_TYP_FLOAT ) && ( viff_info . data_storage_type != VFF_TYP_DOUBLE ) ) ThrowReaderException ( CoderError , "DataStorageTypeIsNotSupported" ) ; if ( viff_info . data_encode_scheme != VFF_DES_RAW ) ThrowReaderException ( CoderError , "DataEncodingSchemeIsNotSupported" ) ; if ( ( viff_info . map_storage_type != VFF_MAPTYP_NONE ) && ( viff_info . map_storage_type != VFF_MAPTYP_1_BYTE ) && ( viff_info . map_storage_type != VFF_MAPTYP_2_BYTE ) && ( viff_info . map_storage_type != VFF_MAPTYP_4_BYTE ) && ( viff_info . map_storage_type != VFF_MAPTYP_FLOAT ) && ( viff_info . map_storage_type != VFF_MAPTYP_DOUBLE ) ) ThrowReaderException ( CoderError , "MapStorageTypeIsNotSupported" ) ; if ( ( viff_info . color_space_model != VFF_CM_NONE ) && ( viff_info . color_space_model != VFF_CM_ntscRGB ) && ( viff_info . color_space_model != VFF_CM_genericRGB ) ) ThrowReaderException ( CoderError , "ColorspaceModelIsNotSupported" ) ; if ( viff_info . location_type != VFF_LOC_IMPLICIT ) ThrowReaderException ( CoderError , "LocationTypeIsNotSupported" ) ; if ( viff_info . number_of_images != 1 ) ThrowReaderException ( CoderError , "NumberOfImagesIsNotSupported" ) ; if ( viff_info . map_rows == 0 ) viff_info . map_scheme = VFF_MS_NONE ; switch ( ( int ) viff_info . map_scheme ) { case VFF_MS_NONE : { if ( viff_info . number_data_bands < 3 ) { if ( viff_info . data_storage_type == VFF_TYP_BIT ) image -> colors = 2 ; else if ( viff_info . data_storage_type == VFF_MAPTYP_1_BYTE ) image -> colors = 256UL ; else image -> colors = image -> depth <= 8 ? 256UL : 65536UL ; if ( AcquireImageColormap ( image , image -> colors ) == MagickFalse ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; } break ; } case VFF_MS_ONEPERBAND : case VFF_MS_SHARED : { unsigned char * viff_colormap ; switch ( ( int ) viff_info . map_storage_type ) { case VFF_MAPTYP_1_BYTE : bytes_per_pixel = 1 ; break ; case VFF_MAPTYP_2_BYTE : bytes_per_pixel = 2 ; break ; case VFF_MAPTYP_4_BYTE : bytes_per_pixel = 4 ; break ; case VFF_MAPTYP_FLOAT : bytes_per_pixel = 4 ; break ; case VFF_MAPTYP_DOUBLE : bytes_per_pixel = 8 ; break ; default : bytes_per_pixel = 1 ; break ; } image -> colors = viff_info . map_columns ; if ( AcquireImageColormap ( image , image -> colors ) == MagickFalse ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; if ( viff_info . map_rows > ( viff_info . map_rows * bytes_per_pixel * sizeof ( * viff_colormap ) ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; viff_colormap = ( unsigned char * ) AcquireQuantumMemory ( image -> colors , viff_info . map_rows * bytes_per_pixel * sizeof ( * viff_colormap ) ) ; if ( viff_colormap == ( unsigned char * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; ( void ) ReadBlob ( image , bytes_per_pixel * image -> colors * viff_info . map_rows , viff_colormap ) ; lsb_first = 1 ; if ( * ( char * ) & lsb_first && ( ( viff_info . machine_dependency != VFF_DEP_DECORDER ) && ( viff_info . machine_dependency != VFF_DEP_NSORDER ) ) ) switch ( ( int ) viff_info . map_storage_type ) { case VFF_MAPTYP_2_BYTE : { MSBOrderShort ( viff_colormap , ( bytes_per_pixel * image -> colors * viff_info . map_rows ) ) ; break ; } case VFF_MAPTYP_4_BYTE : case VFF_MAPTYP_FLOAT : { MSBOrderLong ( viff_colormap , ( bytes_per_pixel * image -> colors * viff_info . map_rows ) ) ; break ; } default : break ; } for ( i = 0 ; i < ( ssize_t ) ( viff_info . map_rows * image -> colors ) ; i ++ ) { switch ( ( int ) viff_info . map_storage_type ) { case VFF_MAPTYP_2_BYTE : value = 1.0 * ( ( short * ) viff_colormap ) [ i ] ; break ; case VFF_MAPTYP_4_BYTE : value = 1.0 * ( ( int * ) viff_colormap ) [ i ] ; break ; case VFF_MAPTYP_FLOAT : value = ( ( float * ) viff_colormap ) [ i ] ; break ; case VFF_MAPTYP_DOUBLE : value = ( ( double * ) viff_colormap ) [ i ] ; break ; default : value = 1.0 * viff_colormap [ i ] ; break ; } if ( i < ( ssize_t ) image -> colors ) { image -> colormap [ i ] . red = ScaleCharToQuantum ( ( unsigned char ) value ) ; image -> colormap [ i ] . green = ScaleCharToQuantum ( ( unsigned char ) value ) ; image -> colormap [ i ] . blue = ScaleCharToQuantum ( ( unsigned char ) value ) ; } else if ( i < ( ssize_t ) ( 2 * image -> colors ) ) image -> colormap [ i % image -> colors ] . green = ScaleCharToQuantum ( ( unsigned char ) value ) ; else if ( i < ( ssize_t ) ( 3 * image -> colors ) ) image -> colormap [ i % image -> colors ] . blue = ScaleCharToQuantum ( ( unsigned char ) value ) ; } viff_colormap = ( unsigned char * ) RelinquishMagickMemory ( viff_colormap ) ; break ; } default : ThrowReaderException ( CoderError , "ColormapTypeNotSupported" ) ; } image -> matte = viff_info . number_data_bands == 4 ? MagickTrue : MagickFalse ; image -> storage_class = ( viff_info . number_data_bands < 3 ? PseudoClass : DirectClass ) ; image -> columns = viff_info . rows ; image -> rows = viff_info . columns ; if ( ( image_info -> ping != MagickFalse ) && ( image_info -> number_scenes != 0 ) ) if ( image -> scene >= ( image_info -> scene + image_info -> number_scenes - 1 ) ) break ; status = SetImageExtent ( image , image -> columns , image -> rows ) ; if ( status == MagickFalse ) { InheritException ( exception , & image -> exception ) ; return ( DestroyImageList ( image ) ) ; } switch ( ( int ) viff_info . data_storage_type ) { case VFF_TYP_2_BYTE : bytes_per_pixel = 2 ; break ; case VFF_TYP_4_BYTE : bytes_per_pixel = 4 ; break ; case VFF_TYP_FLOAT : bytes_per_pixel = 4 ; break ; case VFF_TYP_DOUBLE : bytes_per_pixel = 8 ; break ; default : bytes_per_pixel = 1 ; break ; } if ( viff_info . data_storage_type == VFF_TYP_BIT ) max_packets = ( ( image -> columns + 7UL ) >> 3UL ) * image -> rows ; else max_packets = ( size_t ) ( number_pixels * viff_info . number_data_bands ) ; <S2SV_StartBug> pixels = ( unsigned char * ) AcquireQuantumMemory ( max_packets , <S2SV_EndBug> bytes_per_pixel * sizeof ( * pixels ) ) ; if ( pixels == ( unsigned char * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; ( void ) ReadBlob ( image , bytes_per_pixel * max_packets , pixels ) ; lsb_first = 1 ; if ( * ( char * ) & lsb_first && ( ( viff_info . machine_dependency != VFF_DEP_DECORDER ) && ( viff_info . machine_dependency != VFF_DEP_NSORDER ) ) ) switch ( ( int ) viff_info . data_storage_type ) { case VFF_TYP_2_BYTE : { MSBOrderShort ( pixels , bytes_per_pixel * max_packets ) ; break ; } case VFF_TYP_4_BYTE : case VFF_TYP_FLOAT : { MSBOrderLong ( pixels , bytes_per_pixel * max_packets ) ; break ; } default : break ; } min_value = 0.0 ; scale_factor = 1.0 ; if ( ( viff_info . data_storage_type != VFF_TYP_1_BYTE ) && ( viff_info . map_scheme == VFF_MS_NONE ) ) { double max_value ; switch ( ( int ) viff_info . data_storage_type ) { case VFF_TYP_2_BYTE : value = 1.0 * ( ( short * ) pixels ) [ 0 ] ; break ; case VFF_TYP_4_BYTE : value = 1.0 * ( ( int * ) pixels ) [ 0 ] ; break ; case VFF_TYP_FLOAT : value = ( ( float * ) pixels ) [ 0 ] ; break ; case VFF_TYP_DOUBLE : value = ( ( double * ) pixels ) [ 0 ] ; break ; default : value = 1.0 * pixels [ 0 ] ; break ; } max_value = value ; min_value = value ; for ( i = 0 ; i < ( ssize_t ) max_packets ; i ++ ) { switch ( ( int ) viff_info . data_storage_type ) { case VFF_TYP_2_BYTE : value = 1.0 * ( ( short * ) pixels ) [ i ] ; break ; case VFF_TYP_4_BYTE : value = 1.0 * ( ( int * ) pixels ) [ i ] ; break ; case VFF_TYP_FLOAT : value = ( ( float * ) pixels ) [ i ] ; break ; case VFF_TYP_DOUBLE : value = ( ( double * ) pixels ) [ i ] ; break ; default : value = 1.0 * pixels [ i ] ; break ; } if ( value > max_value ) max_value = value ; else if ( value < min_value ) min_value = value ; } if ( ( min_value == 0 ) && ( max_value == 0 ) ) scale_factor = 0 ; else if ( min_value == max_value ) { scale_factor = ( MagickRealType ) QuantumRange / min_value ; min_value = 0 ; } else scale_factor = ( MagickRealType ) QuantumRange / ( max_value - min_value ) ; } p = ( unsigned char * ) pixels ; for ( i = 0 ; i < ( ssize_t ) max_packets ; i ++ ) { switch ( ( int ) viff_info . data_storage_type ) { case VFF_TYP_2_BYTE : value = 1.0 * ( ( short * ) pixels ) [ i ] ; break ; case VFF_TYP_4_BYTE : value = 1.0 * ( ( int * ) pixels ) [ i ] ; break ; case VFF_TYP_FLOAT : value = ( ( float * ) pixels ) [ i ] ; break ; case VFF_TYP_DOUBLE : value = ( ( double * ) pixels ) [ i ] ; break ; default : value = 1.0 * pixels [ i ] ; break ; } if ( viff_info . map_scheme == VFF_MS_NONE ) { value = ( value - min_value ) * scale_factor ; if ( value > QuantumRange ) value = QuantumRange ; else if ( value < 0 ) value = 0 ; } * p = ( unsigned char ) ( ( Quantum ) value ) ; p ++ ; } p = ( unsigned char * ) pixels ; if ( viff_info . data_storage_type == VFF_TYP_BIT ) { if ( image -> storage_class != PseudoClass ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; for ( y = 0 ; y < ( ssize_t ) image -> rows ; y ++ ) { q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( PixelPacket * ) NULL ) break ; indexes = GetAuthenticIndexQueue ( image ) ; for ( x = 0 ; x < ( ssize_t ) ( image -> columns - 7 ) ; x += 8 ) { for ( bit = 0 ; bit < 8 ; bit ++ ) { quantum = ( size_t ) ( ( * p ) & ( 0x01 << bit ) ? 0 : 1 ) ; SetPixelRed ( q , quantum == 0 ? 0 : QuantumRange ) ; SetPixelGreen ( q , quantum == 0 ? 0 : QuantumRange ) ; SetPixelBlue ( q , quantum == 0 ? 0 : QuantumRange ) ; if ( image -> storage_class == PseudoClass ) SetPixelIndex ( indexes + x + bit , quantum ) ; } p ++ ; } if ( ( image -> columns % 8 ) != 0 ) { for ( bit = 0 ; bit < ( int ) ( image -> columns % 8 ) ; bit ++ ) { quantum = ( size_t ) ( ( * p ) & ( 0x01 << bit ) ? 0 : 1 ) ; SetPixelRed ( q , quantum == 0 ? 0 : QuantumRange ) ; SetPixelGreen ( q , quantum == 0 ? 0 : QuantumRange ) ; SetPixelBlue ( q , quantum == 0 ? 0 : QuantumRange ) ; if ( image -> storage_class == PseudoClass ) SetPixelIndex ( indexes + x + bit , quantum ) ; } p ++ ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) y , image -> rows ) ; if ( status == MagickFalse ) break ; } } } else if ( image -> storage_class == PseudoClass ) for ( y = 0 ; y < ( ssize_t ) image -> rows ; y ++ ) { q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( PixelPacket * ) NULL ) break ; indexes = GetAuthenticIndexQueue ( image ) ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) SetPixelIndex ( indexes + x , * p ++ ) ; if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) y , image -> rows ) ; if ( status == MagickFalse ) break ; } } else { number_pixels = ( MagickSizeType ) image -> columns * image -> rows ; for ( y = 0 ; y < ( ssize_t ) image -> rows ; y ++ ) { q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( PixelPacket * ) NULL ) break ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) { SetPixelRed ( q , ScaleCharToQuantum ( * p ) ) ; SetPixelGreen ( q , ScaleCharToQuantum ( * ( p + number_pixels ) ) ) ; SetPixelBlue ( q , ScaleCharToQuantum ( * ( p + 2 * number_pixels ) ) ) ; if ( image -> colors != 0 ) { ssize_t index ; index = ( ssize_t ) GetPixelRed ( q ) ; SetPixelRed ( q , image -> colormap [ ( ssize_t ) ConstrainColormapIndex ( image , index ) ] . red ) ; index = ( ssize_t ) GetPixelGreen ( q ) ; SetPixelGreen ( q , image -> colormap [ ( ssize_t ) ConstrainColormapIndex ( image , index ) ] . green ) ; index = ( ssize_t ) GetPixelRed ( q ) ; SetPixelBlue ( q , image -> colormap [ ( ssize_t ) ConstrainColormapIndex ( image , index ) ] . blue ) ; } SetPixelOpacity ( q , image -> matte != MagickFalse ? QuantumRange - ScaleCharToQuantum ( * ( p + number_pixels * 3 ) ) : OpaqueOpacity ) ; p ++ ; q ++ ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) y , image -> rows ) ; if ( status == MagickFalse ) break ; } } } pixels = ( unsigned char * ) RelinquishMagickMemory ( pixels ) ; if ( image -> storage_class == PseudoClass ) ( void ) SyncImage ( image ) ; if ( EOFBlob ( image ) != MagickFalse ) { ThrowFileException ( exception , CorruptImageError , "UnexpectedEndOfFile" , image -> filename ) ; break ; } if ( image_info -> number_scenes != 0 ) if ( image -> scene >= ( image_info -> scene + image_info -> number_scenes - 1 ) ) break ; count = ReadBlob ( image , 1 , & viff_info . identifier ) ; if ( ( count != 0 ) && ( viff_info . identifier == 0xab ) ) { AcquireNextImage ( image_info , image ) ; if ( GetNextImageInList ( image ) == ( Image * ) NULL ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } image = SyncNextImageInList ( image ) ; status = SetImageProgress ( image , LoadImagesTag , TellBlob ( image ) , GetBlobSize ( image ) ) ; if ( status == MagickFalse ) break ; } } while ( ( count != 0 ) && ( viff_info . identifier == 0xab ) ) ; ( void ) CloseBlob ( image ) ; return ( GetFirstImageInList ( image ) ) ; }
<S2SV_ModStart> ) AcquireQuantumMemory ( MagickMax ( number_pixels , max_packets ) , <S2SV_ModEnd> bytes_per_pixel * sizeof
ImageMagick@ImageMagick/ca0c886abd6d3ef335eb74150cd23b89ebd17135
CVE-2016-7528
https://github.com/ImageMagick/ImageMagick/commit/ca0c886abd6d3ef335eb74150cd23b89ebd17135
2017-04-19T14:59Z
193
CWE-190
CWE-190 jas_image_t * jpg_decode ( jas_stream_t * in , char * optstr ) { struct jpeg_decompress_struct cinfo ; struct jpeg_error_mgr jerr ; FILE * input_file ; jpg_dest_t dest_mgr_buf ; jpg_dest_t * dest_mgr = & dest_mgr_buf ; JDIMENSION num_scanlines ; jas_image_t * image ; int ret ; jpg_dec_importopts_t opts ; <S2SV_StartBug> size_t size ; <S2SV_EndBug> if ( jpg_dec_parseopts ( optstr , & opts ) ) { goto error ; } memset ( & cinfo , 0 , sizeof ( struct jpeg_decompress_struct ) ) ; memset ( dest_mgr , 0 , sizeof ( jpg_dest_t ) ) ; dest_mgr -> data = 0 ; image = 0 ; input_file = 0 ; if ( ! ( input_file = tmpfile ( ) ) ) { jas_eprintf ( "cannot<S2SV_blank>make<S2SV_blank>temporary<S2SV_blank>file\\n" ) ; goto error ; } if ( jpg_copystreamtofile ( input_file , in ) ) { jas_eprintf ( "cannot<S2SV_blank>copy<S2SV_blank>stream\\n" ) ; goto error ; } rewind ( input_file ) ; JAS_DBGLOG ( 10 , ( "jpeg_std_error(%p)\\n" , & jerr ) ) ; cinfo . err = jpeg_std_error ( & jerr ) ; JAS_DBGLOG ( 10 , ( "jpeg_create_decompress(%p)\\n" , & cinfo ) ) ; jpeg_create_decompress ( & cinfo ) ; JAS_DBGLOG ( 10 , ( "jpeg_stdio_src(%p,<S2SV_blank>%p)\\n" , & cinfo , input_file ) ) ; jpeg_stdio_src ( & cinfo , input_file ) ; JAS_DBGLOG ( 10 , ( "jpeg_read_header(%p,<S2SV_blank>TRUE)\\n" , & cinfo ) ) ; ret = jpeg_read_header ( & cinfo , TRUE ) ; JAS_DBGLOG ( 10 , ( "jpeg_read_header<S2SV_blank>return<S2SV_blank>value<S2SV_blank>%d\\n" , ret ) ) ; if ( ret != JPEG_HEADER_OK ) { jas_eprintf ( "jpeg_read_header<S2SV_blank>did<S2SV_blank>not<S2SV_blank>return<S2SV_blank>JPEG_HEADER_OK\\n" ) ; } JAS_DBGLOG ( 10 , ( "header:<S2SV_blank>image_width<S2SV_blank>%d;<S2SV_blank>image_height<S2SV_blank>%d;<S2SV_blank>num_components<S2SV_blank>%d\\n" , cinfo . image_width , cinfo . image_height , cinfo . num_components ) ) ; <S2SV_StartBug> JAS_DBGLOG ( 10 , ( "jpeg_start_decompress(%p)\\n" , & cinfo ) ) ; <S2SV_EndBug> ret = jpeg_start_decompress ( & cinfo ) ; JAS_DBGLOG ( 10 , ( "jpeg_start_decompress<S2SV_blank>return<S2SV_blank>value<S2SV_blank>%d\\n" , ret ) ) ; JAS_DBGLOG ( 10 , ( "header:<S2SV_blank>output_width<S2SV_blank>%d;<S2SV_blank>output_height<S2SV_blank>%d;<S2SV_blank>output_components<S2SV_blank>%d\\n" , cinfo . output_width , cinfo . output_height , cinfo . output_components ) ) ; <S2SV_StartBug> if ( opts . max_size ) { <S2SV_EndBug> <S2SV_StartBug> if ( ! jas_safe_size_mul ( cinfo . output_width , cinfo . output_height , <S2SV_EndBug> & size ) || ! jas_safe_size_mul ( size , cinfo . output_components , & size ) ) { goto error ; } <S2SV_StartBug> if ( size > opts . max_size ) { <S2SV_EndBug> <S2SV_StartBug> jas_eprintf ( "image<S2SV_blank>is<S2SV_blank>too<S2SV_blank>large\\n" ) ; <S2SV_EndBug> goto error ; } <S2SV_StartBug> } <S2SV_EndBug> if ( ! ( image = jpg_mkimage ( & cinfo ) ) ) { jas_eprintf ( "jpg_mkimage<S2SV_blank>failed\\n" ) ; goto error ; } dest_mgr -> image = image ; if ( ! ( dest_mgr -> data = jas_matrix_create ( 1 , cinfo . output_width ) ) ) { jas_eprintf ( "jas_matrix_create<S2SV_blank>failed\\n" ) ; goto error ; } dest_mgr -> start_output = jpg_start_output ; dest_mgr -> put_pixel_rows = jpg_put_pixel_rows ; dest_mgr -> finish_output = jpg_finish_output ; dest_mgr -> buffer = ( * cinfo . mem -> alloc_sarray ) ( ( j_common_ptr ) & cinfo , JPOOL_IMAGE , cinfo . output_width * cinfo . output_components , ( JDIMENSION ) 1 ) ; dest_mgr -> buffer_height = 1 ; dest_mgr -> error = 0 ; ( * dest_mgr -> start_output ) ( & cinfo , dest_mgr ) ; while ( cinfo . output_scanline < cinfo . output_height ) { JAS_DBGLOG ( 10 , ( "jpeg_read_scanlines(%p,<S2SV_blank>%p,<S2SV_blank>%lu)\\n" , & cinfo , dest_mgr -> buffer , JAS_CAST ( unsigned long , dest_mgr -> buffer_height ) ) ) ; num_scanlines = jpeg_read_scanlines ( & cinfo , dest_mgr -> buffer , dest_mgr -> buffer_height ) ; JAS_DBGLOG ( 10 , ( "jpeg_read_scanlines<S2SV_blank>return<S2SV_blank>value<S2SV_blank>%lu\\n" , JAS_CAST ( unsigned long , num_scanlines ) ) ) ; ( * dest_mgr -> put_pixel_rows ) ( & cinfo , dest_mgr , num_scanlines ) ; } ( * dest_mgr -> finish_output ) ( & cinfo , dest_mgr ) ; JAS_DBGLOG ( 10 , ( "jpeg_finish_decompress(%p)\\n" , & cinfo ) ) ; jpeg_finish_decompress ( & cinfo ) ; JAS_DBGLOG ( 10 , ( "jpeg_destroy_decompress(%p)\\n" , & cinfo ) ) ; jpeg_destroy_decompress ( & cinfo ) ; jas_matrix_destroy ( dest_mgr -> data ) ; JAS_DBGLOG ( 10 , ( "fclose(%p)\\n" , input_file ) ) ; fclose ( input_file ) ; input_file = 0 ; if ( dest_mgr -> error ) { jas_eprintf ( "error<S2SV_blank>during<S2SV_blank>decoding\\n" ) ; goto error ; } return image ; error : if ( dest_mgr -> data ) { jas_matrix_destroy ( dest_mgr -> data ) ; } if ( image ) { jas_image_destroy ( image ) ; } if ( input_file ) { fclose ( input_file ) ; } return 0 ; }
<S2SV_ModStart> opts ; size_t num_samples ; JAS_DBGLOG ( 100 , ( "jpg_decode(%p,<S2SV_blank>\\"%s\\")\\n" , in , optstr ) ) <S2SV_ModEnd> ; if ( <S2SV_ModStart> ) ) ; <S2SV_ModEnd> if ( opts <S2SV_ModStart> ( opts . max_samples > 0 <S2SV_ModEnd> ) { if <S2SV_ModStart> if ( ! jas_safe_size_mul3 ( cinfo . image_width , cinfo . image_height , cinfo . num_components , & num_samples <S2SV_ModEnd> ) ) { <S2SV_ModStart> } if ( num_samples <S2SV_ModEnd> > opts . <S2SV_ModStart> > opts . max_samples <S2SV_ModEnd> ) { jas_eprintf <S2SV_ModStart> { jas_eprintf ( "image<S2SV_blank>is<S2SV_blank>too<S2SV_blank>large<S2SV_blank>(%zu<S2SV_blank>><S2SV_blank>%zu)\\n" , num_samples , opts . max_samples <S2SV_ModEnd> ) ; goto <S2SV_ModStart> ; } } JAS_DBGLOG ( 10 , ( "jpeg_start_decompress(%p)\\n" , & cinfo ) ) ; ret = jpeg_start_decompress ( & cinfo ) ; JAS_DBGLOG ( 10 , ( "jpeg_start_decompress<S2SV_blank>return<S2SV_blank>value<S2SV_blank>%d\\n" , ret ) ) ; JAS_DBGLOG ( 10 , ( "header:<S2SV_blank>output_width<S2SV_blank>%d;<S2SV_blank>output_height<S2SV_blank>%d;<S2SV_blank>output_components<S2SV_blank>%d\\n" , cinfo . output_width , cinfo . output_height , cinfo . output_components ) ) ;
mdadams@jasper/d42b2388f7f8e0332c846675133acea151fc557a
CVE-2016-9557
https://github.com/mdadams/jasper/commit/d42b2388f7f8e0332c846675133acea151fc557a
2017-03-23T18:59Z
194
CWE-362
CWE-362 static int snd_timer_user_tselect ( struct file * file , struct snd_timer_select __user * _tselect ) { struct snd_timer_user * tu ; struct snd_timer_select tselect ; char str [ 32 ] ; int err = 0 ; tu = file -> private_data ; <S2SV_StartBug> mutex_lock ( & tu -> tread_sem ) ; <S2SV_EndBug> if ( tu -> timeri ) { snd_timer_close ( tu -> timeri ) ; tu -> timeri = NULL ; } if ( copy_from_user ( & tselect , _tselect , sizeof ( tselect ) ) ) { err = - EFAULT ; goto __err ; } sprintf ( str , "application<S2SV_blank>%i" , current -> pid ) ; if ( tselect . id . dev_class != SNDRV_TIMER_CLASS_SLAVE ) tselect . id . dev_sclass = SNDRV_TIMER_SCLASS_APPLICATION ; err = snd_timer_open ( & tu -> timeri , str , & tselect . id , current -> pid ) ; if ( err < 0 ) goto __err ; kfree ( tu -> queue ) ; tu -> queue = NULL ; kfree ( tu -> tqueue ) ; tu -> tqueue = NULL ; if ( tu -> tread ) { tu -> tqueue = kmalloc ( tu -> queue_size * sizeof ( struct snd_timer_tread ) , GFP_KERNEL ) ; if ( tu -> tqueue == NULL ) err = - ENOMEM ; } else { tu -> queue = kmalloc ( tu -> queue_size * sizeof ( struct snd_timer_read ) , GFP_KERNEL ) ; if ( tu -> queue == NULL ) err = - ENOMEM ; } if ( err < 0 ) { snd_timer_close ( tu -> timeri ) ; tu -> timeri = NULL ; } else { tu -> timeri -> flags |= SNDRV_TIMER_IFLG_FAST ; tu -> timeri -> callback = tu -> tread ? snd_timer_user_tinterrupt : snd_timer_user_interrupt ; tu -> timeri -> ccallback = snd_timer_user_ccallback ; tu -> timeri -> callback_data = ( void * ) tu ; } __err : <S2SV_StartBug> mutex_unlock ( & tu -> tread_sem ) ; <S2SV_EndBug> return err ; }
<S2SV_ModStart> -> private_data ; <S2SV_ModEnd> if ( tu <S2SV_ModStart> } __err : <S2SV_ModEnd> return err ;
torvalds@linux/af368027a49a751d6ff4ee9e3f9961f35bb4fede
CVE-2016-2546
https://github.com/torvalds/linux/commit/af368027a49a751d6ff4ee9e3f9961f35bb4fede
2016-04-27T17:59Z
195
CWE-476
CWE-476 static int compile_length_bag_node ( BagNode * node , regex_t * reg ) { int len ; int tlen ; if ( node -> type == BAG_OPTION ) return compile_length_option_node ( node , reg ) ; if ( NODE_BAG_BODY ( node ) ) { tlen = compile_length_tree ( NODE_BAG_BODY ( node ) , reg ) ; if ( tlen < 0 ) return tlen ; } else tlen = 0 ; switch ( node -> type ) { case BAG_MEMORY : # ifdef USE_CALL if ( node -> m . regnum == 0 && NODE_IS_CALLED ( node ) ) { len = tlen + SIZE_OP_CALL + SIZE_OP_JUMP + SIZE_OP_RETURN ; return len ; } if ( NODE_IS_CALLED ( node ) ) { len = SIZE_OP_MEMORY_START_PUSH + tlen + SIZE_OP_CALL + SIZE_OP_JUMP + SIZE_OP_RETURN ; if ( MEM_STATUS_AT0 ( reg -> bt_mem_end , node -> m . regnum ) ) len += ( NODE_IS_RECURSION ( node ) ? SIZE_OP_MEMORY_END_PUSH_REC : SIZE_OP_MEMORY_END_PUSH ) ; else len += ( NODE_IS_RECURSION ( node ) ? SIZE_OP_MEMORY_END_REC : SIZE_OP_MEMORY_END ) ; } else if ( NODE_IS_RECURSION ( node ) ) { len = SIZE_OP_MEMORY_START_PUSH ; len += tlen + ( MEM_STATUS_AT0 ( reg -> bt_mem_end , node -> m . regnum ) ? SIZE_OP_MEMORY_END_PUSH_REC : SIZE_OP_MEMORY_END_REC ) ; } else # endif { if ( MEM_STATUS_AT0 ( reg -> bt_mem_start , node -> m . regnum ) ) len = SIZE_OP_MEMORY_START_PUSH ; else len = SIZE_OP_MEMORY_START ; len += tlen + ( MEM_STATUS_AT0 ( reg -> bt_mem_end , node -> m . regnum ) ? SIZE_OP_MEMORY_END_PUSH : SIZE_OP_MEMORY_END ) ; } break ; case BAG_STOP_BACKTRACK : if ( NODE_IS_STOP_BT_SIMPLE_REPEAT ( node ) ) { int v ; QuantNode * qn ; qn = QUANT_ ( NODE_BAG_BODY ( node ) ) ; tlen = compile_length_tree ( NODE_QUANT_BODY ( qn ) , reg ) ; if ( tlen < 0 ) return tlen ; v = onig_positive_int_multiply ( qn -> lower , tlen ) ; if ( v < 0 ) return ONIGERR_TOO_BIG_NUMBER_FOR_REPEAT_RANGE ; len = v + SIZE_OP_PUSH + tlen + SIZE_OP_POP_OUT + SIZE_OP_JUMP ; } else { len = SIZE_OP_ATOMIC_START + tlen + SIZE_OP_ATOMIC_END ; } break ; case BAG_IF_ELSE : { Node * cond = NODE_BAG_BODY ( node ) ; Node * Then = node -> te . Then ; Node * Else = node -> te . Else ; len = compile_length_tree ( cond , reg ) ; if ( len < 0 ) return len ; len += SIZE_OP_PUSH ; len += SIZE_OP_ATOMIC_START + SIZE_OP_ATOMIC_END ; if ( IS_NOT_NULL ( Then ) ) { tlen = compile_length_tree ( Then , reg ) ; if ( tlen < 0 ) return tlen ; len += tlen ; } <S2SV_StartBug> if ( IS_NOT_NULL ( Else ) ) { <S2SV_EndBug> <S2SV_StartBug> len += SIZE_OP_JUMP ; <S2SV_EndBug> tlen = compile_length_tree ( Else , reg ) ; if ( tlen < 0 ) return tlen ; len += tlen ; } } break ; case BAG_OPTION : len = 0 ; break ; } return len ; }
<S2SV_ModStart> tlen ; } len += SIZE_OP_JUMP + SIZE_OP_ATOMIC_END ; <S2SV_ModStart> ) ) { <S2SV_ModEnd> tlen = compile_length_tree
kkos@oniguruma/c509265c5f6ae7264f7b8a8aae1cfa5fc59d108c
CVE-2019-13225
https://github.com/kkos/oniguruma/commit/c509265c5f6ae7264f7b8a8aae1cfa5fc59d108c
2019-07-10T14:15Z
196
CWE-264
CWE-264 void vlan_setup ( struct net_device * dev ) { ether_setup ( dev ) ; dev -> priv_flags |= IFF_802_1Q_VLAN ; <S2SV_StartBug> dev -> priv_flags &= ~ IFF_XMIT_DST_RELEASE ; <S2SV_EndBug> dev -> tx_queue_len = 0 ; dev -> netdev_ops = & vlan_netdev_ops ; dev -> destructor = free_netdev ; dev -> ethtool_ops = & vlan_ethtool_ops ; memset ( dev -> broadcast , 0 , ETH_ALEN ) ; }
<S2SV_ModStart> priv_flags &= ~ ( IFF_XMIT_DST_RELEASE | IFF_TX_SKB_SHARING ) <S2SV_ModEnd> ; dev ->
torvalds@linux/550fd08c2cebad61c548def135f67aba284c6162
CVE-2011-4112
https://github.com/torvalds/linux/commit/550fd08c2cebad61c548def135f67aba284c6162
2012-05-17T11:00Z
197
CWE-125
CWE-125 static int snd_usb_create_streams ( struct snd_usb_audio * chip , int ctrlif ) { struct usb_device * dev = chip -> dev ; struct usb_host_interface * host_iface ; struct usb_interface_descriptor * altsd ; void * control_header ; <S2SV_StartBug> int i , protocol ; <S2SV_EndBug> host_iface = & usb_ifnum_to_if ( dev , ctrlif ) -> altsetting [ 0 ] ; control_header = snd_usb_find_csint_desc ( host_iface -> extra , host_iface -> extralen , NULL , UAC_HEADER ) ; altsd = get_iface_desc ( host_iface ) ; protocol = altsd -> bInterfaceProtocol ; if ( ! control_header ) { dev_err ( & dev -> dev , "cannot<S2SV_blank>find<S2SV_blank>UAC_HEADER\\n" ) ; return - EINVAL ; } <S2SV_StartBug> switch ( protocol ) { <S2SV_EndBug> default : dev_warn ( & dev -> dev , "unknown<S2SV_blank>interface<S2SV_blank>protocol<S2SV_blank>%#02x,<S2SV_blank>assuming<S2SV_blank>v1\\n" , protocol ) ; case UAC_VERSION_1 : { struct uac1_ac_header_descriptor * h1 = control_header ; <S2SV_StartBug> if ( ! h1 -> bInCollection ) { <S2SV_EndBug> <S2SV_StartBug> dev_info ( & dev -> dev , "skipping<S2SV_blank>empty<S2SV_blank>audio<S2SV_blank>interface<S2SV_blank>(v1)\\n" ) ; <S2SV_EndBug> return - EINVAL ; } if ( h1 -> bLength < sizeof ( * h1 ) + h1 -> bInCollection ) { dev_err ( & dev -> dev , "invalid<S2SV_blank>UAC_HEADER<S2SV_blank>(v1)\\n" ) ; return - EINVAL ; } for ( i = 0 ; i < h1 -> bInCollection ; i ++ ) snd_usb_create_stream ( chip , ctrlif , h1 -> baInterfaceNr [ i ] ) ; break ; } case UAC_VERSION_2 : { struct usb_interface_assoc_descriptor * assoc = usb_ifnum_to_if ( dev , ctrlif ) -> intf_assoc ; if ( ! assoc ) { struct usb_interface * iface = usb_ifnum_to_if ( dev , ctrlif + 1 ) ; if ( iface && iface -> intf_assoc && iface -> intf_assoc -> bFunctionClass == USB_CLASS_AUDIO && iface -> intf_assoc -> bFunctionProtocol == UAC_VERSION_2 ) assoc = iface -> intf_assoc ; } if ( ! assoc ) { dev_err ( & dev -> dev , "Audio<S2SV_blank>class<S2SV_blank>v2<S2SV_blank>interfaces<S2SV_blank>need<S2SV_blank>an<S2SV_blank>interface<S2SV_blank>association\\n" ) ; return - EINVAL ; } for ( i = 0 ; i < assoc -> bInterfaceCount ; i ++ ) { int intf = assoc -> bFirstInterface + i ; if ( intf != ctrlif ) snd_usb_create_stream ( chip , ctrlif , intf ) ; } break ; } } return 0 ; }
<S2SV_ModStart> i , protocol ; int rest_bytes <S2SV_ModStart> EINVAL ; } rest_bytes = ( void * ) ( host_iface -> extra + host_iface -> extralen ) - control_header ; if ( rest_bytes <= 0 ) { dev_err ( & dev -> dev , "invalid<S2SV_blank>control<S2SV_blank>header\\n" ) ; return - EINVAL ; } <S2SV_ModStart> ; if ( rest_bytes < sizeof ( * h1 ) ) { dev_err ( & dev -> dev , "too<S2SV_blank>short<S2SV_blank>v1<S2SV_blank>buffer<S2SV_blank>descriptor\\n" ) ; return - EINVAL ; } if ( <S2SV_ModStart> dev , "skipping<S2SV_blank>empty<S2SV_blank>audio<S2SV_blank>interface<S2SV_blank>(v1)\\n" ) ; return - EINVAL ; } if ( rest_bytes < h1 -> bLength ) { dev_err ( & dev -> dev , "invalid<S2SV_blank>buffer<S2SV_blank>length<S2SV_blank>(v1)\\n"
torvalds@linux/bfc81a8bc18e3c4ba0cbaa7666ff76be2f998991
CVE-2017-16529
https://github.com/torvalds/linux/commit/bfc81a8bc18e3c4ba0cbaa7666ff76be2f998991
2017-11-04T01:29Z
198
CWE-125
CWE-125 void qedi_dbg_info ( struct qedi_dbg_ctx * qedi , const char * func , u32 line , u32 level , const char * fmt , ... ) { va_list va ; <S2SV_StartBug> struct va_format vaf ; <S2SV_EndBug> char nfunc [ 32 ] ; memset ( nfunc , 0 , sizeof ( nfunc ) ) ; memcpy ( nfunc , func , sizeof ( nfunc ) - 1 ) ; va_start ( va , fmt ) ; vaf . fmt = fmt ; vaf . va = & va ; if ( ! ( qedi_dbg_log & level ) ) goto ret ; if ( likely ( qedi ) && likely ( qedi -> pdev ) ) pr_info ( "[%s]:[%s:%d]:%d:<S2SV_blank>%pV" , dev_name ( & qedi -> pdev -> dev ) , <S2SV_StartBug> nfunc , line , qedi -> host_no , & vaf ) ; <S2SV_EndBug> else <S2SV_StartBug> pr_info ( "[0000:00:00.0]:[%s:%d]:<S2SV_blank>%pV" , nfunc , line , & vaf ) ; <S2SV_EndBug> ret : va_end ( va ) ; }
<S2SV_ModStart> struct va_format vaf <S2SV_ModEnd> ; va_start ( <S2SV_ModStart> dev ) , func <S2SV_ModEnd> , line , <S2SV_ModStart> ( "[0000:00:00.0]:[%s:%d]:<S2SV_blank>%pV" , func <S2SV_ModEnd> , line ,
torvalds@linux/c09581a52765a85f19fc35340127396d5e3379cc
CVE-2019-15090
https://github.com/torvalds/linux/commit/c09581a52765a85f19fc35340127396d5e3379cc
2019-08-16T00:15Z
199
CWE-362
CWE-362 int sctp_rcv ( struct sk_buff * skb ) { struct sock * sk ; struct sctp_association * asoc ; struct sctp_endpoint * ep = NULL ; struct sctp_ep_common * rcvr ; struct sctp_transport * transport = NULL ; struct sctp_chunk * chunk ; struct sctphdr * sh ; union sctp_addr src ; union sctp_addr dest ; int family ; struct sctp_af * af ; if ( skb -> pkt_type != PACKET_HOST ) goto discard_it ; SCTP_INC_STATS_BH ( SCTP_MIB_INSCTPPACKS ) ; if ( skb_linearize ( skb ) ) goto discard_it ; sh = sctp_hdr ( skb ) ; __skb_pull ( skb , skb_transport_offset ( skb ) ) ; if ( skb -> len < sizeof ( struct sctphdr ) ) goto discard_it ; if ( ! skb_csum_unnecessary ( skb ) && sctp_rcv_checksum ( skb ) < 0 ) goto discard_it ; skb_pull ( skb , sizeof ( struct sctphdr ) ) ; if ( skb -> len < sizeof ( struct sctp_chunkhdr ) ) goto discard_it ; family = ipver2af ( ip_hdr ( skb ) -> version ) ; af = sctp_get_af_specific ( family ) ; if ( unlikely ( ! af ) ) goto discard_it ; af -> from_skb ( & src , skb , 1 ) ; af -> from_skb ( & dest , skb , 0 ) ; if ( ! af -> addr_valid ( & src , NULL , skb ) || ! af -> addr_valid ( & dest , NULL , skb ) ) goto discard_it ; asoc = __sctp_rcv_lookup ( skb , & src , & dest , & transport ) ; if ( ! asoc ) ep = __sctp_rcv_lookup_endpoint ( & dest ) ; rcvr = asoc ? & asoc -> base : & ep -> base ; sk = rcvr -> sk ; if ( sk -> sk_bound_dev_if && ( sk -> sk_bound_dev_if != af -> skb_iif ( skb ) ) ) { if ( asoc ) { sctp_association_put ( asoc ) ; asoc = NULL ; } else { sctp_endpoint_put ( ep ) ; ep = NULL ; } sk = sctp_get_ctl_sock ( ) ; ep = sctp_sk ( sk ) -> ep ; sctp_endpoint_hold ( ep ) ; rcvr = & ep -> base ; } if ( ! asoc ) { if ( sctp_rcv_ootb ( skb ) ) { SCTP_INC_STATS_BH ( SCTP_MIB_OUTOFBLUES ) ; goto discard_release ; } } if ( ! xfrm_policy_check ( sk , XFRM_POLICY_IN , skb , family ) ) goto discard_release ; nf_reset ( skb ) ; if ( sk_filter ( sk , skb ) ) goto discard_release ; chunk = sctp_chunkify ( skb , asoc , sk ) ; if ( ! chunk ) goto discard_release ; SCTP_INPUT_CB ( skb ) -> chunk = chunk ; chunk -> rcvr = rcvr ; chunk -> sctp_hdr = sh ; sctp_init_addrs ( chunk , & src , & dest ) ; chunk -> transport = transport ; sctp_bh_lock_sock ( sk ) ; <S2SV_StartBug> if ( sock_owned_by_user ( sk ) ) { <S2SV_EndBug> SCTP_INC_STATS_BH ( SCTP_MIB_IN_PKT_BACKLOG ) ; sctp_add_backlog ( sk , skb ) ; } else { SCTP_INC_STATS_BH ( SCTP_MIB_IN_PKT_SOFTIRQ ) ; sctp_inq_push ( & chunk -> rcvr -> inqueue , chunk ) ; } sctp_bh_unlock_sock ( sk ) ; if ( asoc ) sctp_association_put ( asoc ) ; else sctp_endpoint_put ( ep ) ; return 0 ; discard_it : SCTP_INC_STATS_BH ( SCTP_MIB_IN_PKT_DISCARDS ) ; kfree_skb ( skb ) ; return 0 ; discard_release : if ( asoc ) sctp_association_put ( asoc ) ; else sctp_endpoint_put ( ep ) ; goto discard_it ; }
<S2SV_ModStart> ; if ( sk != rcvr -> sk ) { sctp_bh_unlock_sock ( sk ) ; sk = rcvr -> sk ; sctp_bh_lock_sock ( sk ) ; } if (
torvalds@linux/ae53b5bd77719fed58086c5be60ce4f22bffe1c6
CVE-2011-4348
https://github.com/torvalds/linux/commit/ae53b5bd77719fed58086c5be60ce4f22bffe1c6
2013-06-08T13:05Z