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
300
CWE-362
CWE-362 static void clear_evtchn_to_irq_row ( unsigned row ) { unsigned col ; for ( col = 0 ; col < EVTCHN_PER_ROW ; col ++ ) <S2SV_StartBug> evtchn_to_irq [ row ] [ col ] = - 1 ; <S2SV_EndBug> }
<S2SV_ModStart> col ++ ) WRITE_ONCE ( <S2SV_ModStart> [ col ] , - 1 ) <S2SV_ModEnd> ; } <S2SV_null>
torvalds@linux/073d0552ead5bfc7a3a9c01de590e924f11b5dd2
CVE-2020-27675
https://github.com/torvalds/linux/commit/073d0552ead5bfc7a3a9c01de590e924f11b5dd2
2020-10-22T21:15Z
301
CWE-20
CWE-20 bool adapter_enable_disable ( ) { int error ; <S2SV_StartBug> CALL_AND_WAIT ( error = bt_interface -> enable ( ) , adapter_state_changed ) ; <S2SV_EndBug> TASSERT ( error == BT_STATUS_SUCCESS , "Error<S2SV_blank>enabling<S2SV_blank>Bluetooth:<S2SV_blank>%d" , error ) ; TASSERT ( adapter_get_state ( ) == BT_STATE_ON , "Adapter<S2SV_blank>did<S2SV_blank>not<S2SV_blank>turn<S2SV_blank>on." ) ; CALL_AND_WAIT ( error = bt_interface -> disable ( ) , adapter_state_changed ) ; TASSERT ( error == BT_STATUS_SUCCESS , "Error<S2SV_blank>disabling<S2SV_blank>Bluetooth:<S2SV_blank>%d" , error ) ; TASSERT ( adapter_get_state ( ) == BT_STATE_OFF , "Adapter<S2SV_blank>did<S2SV_blank>not<S2SV_blank>turn<S2SV_blank>off." ) ; return true ; }
<S2SV_ModStart> -> enable ( false
system@bt/37c88107679d36c419572732b4af6e18bb2f7dce
CVE-2016-3760
https://android.googlesource.com/platform/system/bt/+/37c88107679d36c419572732b4af6e18bb2f7dce
2016-07-11T02:00Z
302
CWE-125
CWE-125 static inline long object_common1 ( UNSERIALIZE_PARAMETER , zend_class_entry * ce ) { <S2SV_StartBug> long elements ; <S2SV_EndBug> elements = parse_iv2 ( ( * p ) + 2 , p ) ; ( * p ) += 2 ; if ( ce -> serialize == NULL ) { object_init_ex ( * rval , ce ) ; } else { zend_error ( E_WARNING , "Erroneous<S2SV_blank>data<S2SV_blank>format<S2SV_blank>for<S2SV_blank>unserializing<S2SV_blank>\'%s\'" , ce -> name ) ; <S2SV_StartBug> return 0 ; <S2SV_EndBug> } return elements ; }
<S2SV_ModStart> long elements ; if ( * p >= max - 2 ) { zend_error ( E_WARNING , "Bad<S2SV_blank>unserialize<S2SV_blank>data" ) ; return - 1 ; } <S2SV_ModStart> ) ; return - 1 <S2SV_ModEnd> ; } return
php@php-src/16b3003ffc6393e250f069aa28a78dc5a2c064b2
CVE-2016-10161
https://github.com/php/php-src/commit/16b3003ffc6393e250f069aa28a78dc5a2c064b2
2017-01-24T21:59Z
303
CWE-119
CWE-119 <S2SV_StartBug> void usage_exit ( ) { <S2SV_EndBug> <S2SV_StartBug> int i ; <S2SV_EndBug> fprintf ( stderr , "Usage:<S2SV_blank>%s<S2SV_blank><options><S2SV_blank>-o<S2SV_blank>dst_filename<S2SV_blank>src_filename<S2SV_blank>\\n" , exec_name ) ; fprintf ( stderr , "\\nOptions:\\n" ) ; arg_show_usage ( stderr , main_args ) ; fprintf ( stderr , "\\nEncoder<S2SV_blank>Global<S2SV_blank>Options:\\n" ) ; arg_show_usage ( stderr , global_args ) ; fprintf ( stderr , "\\nRate<S2SV_blank>Control<S2SV_blank>Options:\\n" ) ; arg_show_usage ( stderr , rc_args ) ; fprintf ( stderr , "\\nTwopass<S2SV_blank>Rate<S2SV_blank>Control<S2SV_blank>Options:\\n" ) ; arg_show_usage ( stderr , rc_twopass_args ) ; fprintf ( stderr , "\\nKeyframe<S2SV_blank>Placement<S2SV_blank>Options:\\n" ) ; arg_show_usage ( stderr , kf_args ) ; # if CONFIG_VP8_ENCODER fprintf ( stderr , "\\nVP8<S2SV_blank>Specific<S2SV_blank>Options:\\n" ) ; arg_show_usage ( stderr , vp8_args ) ; # endif # if CONFIG_VP9_ENCODER fprintf ( stderr , "\\nVP9<S2SV_blank>Specific<S2SV_blank>Options:\\n" ) ; arg_show_usage ( stderr , vp9_args ) ; # endif <S2SV_StartBug> fprintf ( stderr , "\\nStream<S2SV_blank>timebase<S2SV_blank>(--timebase):\\n" <S2SV_EndBug> "<S2SV_blank><S2SV_blank>The<S2SV_blank>desired<S2SV_blank>precision<S2SV_blank>of<S2SV_blank>timestamps<S2SV_blank>in<S2SV_blank>the<S2SV_blank>output,<S2SV_blank>expressed\\n" "<S2SV_blank><S2SV_blank>in<S2SV_blank>fractional<S2SV_blank>seconds.<S2SV_blank>Default<S2SV_blank>is<S2SV_blank>1/1000.\\n" ) ; fprintf ( stderr , "\\nIncluded<S2SV_blank>encoders:\\n\\n" ) ; <S2SV_StartBug> for ( i = 0 ; i < get_vpx_encoder_count ( ) ; ++ i ) { <S2SV_EndBug> const VpxInterface * const encoder = get_vpx_encoder_by_index ( i ) ; <S2SV_StartBug> fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>%-6s<S2SV_blank>-<S2SV_blank>%s\\n" , <S2SV_EndBug> <S2SV_StartBug> encoder -> name , vpx_codec_iface_name ( encoder -> interface ( ) ) ) ; <S2SV_EndBug> <S2SV_StartBug> } <S2SV_EndBug> exit ( EXIT_FAILURE ) ; }
<S2SV_ModStart> void usage_exit ( void <S2SV_ModStart> { int i ; const int num_encoder = get_vpx_encoder_count ( ) <S2SV_ModStart> ; # endif # if CONFIG_VP10_ENCODER fprintf ( stderr , "\\nVP10<S2SV_blank>Specific<S2SV_blank>Options:\\n" ) ; arg_show_usage ( stderr , vp10_args ) ; # endif <S2SV_ModStart> ; i < num_encoder <S2SV_ModEnd> ; ++ i <S2SV_ModStart> i ) ; const char * defstr = ( i == ( num_encoder - 1 ) ) ? "(default)" : "" ; fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>%-6s<S2SV_blank>-<S2SV_blank>%s<S2SV_blank>%s\\n" <S2SV_ModEnd> , encoder -> <S2SV_ModStart> ( encoder -> codec_interface ( ) ) , defstr <S2SV_ModEnd> ) ; } <S2SV_ModStart> ) ; } fprintf ( stderr , "\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>" ) ; fprintf ( stderr , "Use<S2SV_blank>--codec<S2SV_blank>to<S2SV_blank>switch<S2SV_blank>to<S2SV_blank>a<S2SV_blank>non-default<S2SV_blank>encoder.\\n\\n" ) ;
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
304
CWE-119
CWE-119 static void de_dotdot ( char * file ) { char * cp ; char * cp2 ; int l ; while ( ( cp = strstr ( file , "//" ) ) != ( char * ) 0 ) { for ( cp2 = cp + 2 ; * cp2 == '/' ; ++ cp2 ) continue ; ( void ) strcpy ( cp + 1 , cp2 ) ; } while ( strncmp ( file , "./" , 2 ) == 0 ) ( void ) memmove ( file , file + 2 , strlen ( file ) - 1 ) ; while ( ( cp = strstr ( file , "/./" ) ) != ( char * ) 0 ) <S2SV_StartBug> ( void ) memmove ( cp , cp + 2 , strlen ( file ) - 1 ) ; <S2SV_EndBug> for ( ; ; ) { while ( strncmp ( file , "../" , 3 ) == 0 ) ( void ) memmove ( file , file + 3 , strlen ( file ) - 2 ) ; cp = strstr ( file , "/../" ) ; if ( cp == ( char * ) 0 ) break ; for ( cp2 = cp - 1 ; cp2 >= file && * cp2 != '/' ; -- cp2 ) continue ; ( void ) strcpy ( cp2 + 1 , cp + 4 ) ; } while ( ( l = strlen ( file ) ) > 3 && strcmp ( ( cp = file + l - 3 ) , "/.." ) == 0 ) { for ( cp2 = cp - 1 ; cp2 >= file && * cp2 != '/' ; -- cp2 ) continue ; if ( cp2 < file ) break ; * cp2 = '\\0' ; } }
<S2SV_ModStart> , strlen ( cp <S2SV_ModEnd> ) - 1
blueness@sthttpd/c0dc63a49d8605649f1d8e4a96c9b468b0bff660
CVE-2017-10671
https://github.com/blueness/sthttpd/commit/c0dc63a49d8605649f1d8e4a96c9b468b0bff660
2017-06-29T08:29Z
305
CWE-401
CWE-401 struct clock_source * dce110_clock_source_create ( struct dc_context * ctx , struct dc_bios * bios , enum clock_source_id id , const struct dce110_clk_src_regs * regs , bool dp_clk_src ) { struct dce110_clk_src * clk_src = kzalloc ( sizeof ( struct dce110_clk_src ) , GFP_KERNEL ) ; if ( ! clk_src ) return NULL ; if ( dce110_clk_src_construct ( clk_src , ctx , bios , id , regs , & cs_shift , & cs_mask ) ) { clk_src -> base . dp_clk_src = dp_clk_src ; return & clk_src -> base ; } <S2SV_StartBug> BREAK_TO_DEBUGGER ( ) ; <S2SV_EndBug> return NULL ; }
<S2SV_ModStart> base ; } kfree ( clk_src ) ;
torvalds@linux/055e547478a11a6360c7ce05e2afc3e366968a12
CVE-2019-19083
https://github.com/torvalds/linux/commit/055e547478a11a6360c7ce05e2afc3e366968a12
2019-11-18T06:15Z
306
CWE-908
CWE-908 void * vips_tracked_malloc ( size_t size ) { void * buf ; vips_tracked_init ( ) ; size += 16 ; <S2SV_StartBug> if ( ! ( buf = g_try_malloc ( size ) ) ) { <S2SV_EndBug> # ifdef DEBUG g_assert_not_reached ( ) ; # endif vips_error ( "vips_tracked" , _ ( "out<S2SV_blank>of<S2SV_blank>memory<S2SV_blank>---<S2SV_blank>size<S2SV_blank>==<S2SV_blank>%dMB" ) , ( int ) ( size / ( 1024.0 * 1024.0 ) ) ) ; g_warning ( _ ( "out<S2SV_blank>of<S2SV_blank>memory<S2SV_blank>---<S2SV_blank>size<S2SV_blank>==<S2SV_blank>%dMB" ) , ( int ) ( size / ( 1024.0 * 1024.0 ) ) ) ; return ( NULL ) ; } g_mutex_lock ( vips_tracked_mutex ) ; * ( ( size_t * ) buf ) = size ; buf = ( void * ) ( ( char * ) buf + 16 ) ; vips_tracked_mem += size ; if ( vips_tracked_mem > vips_tracked_mem_highwater ) vips_tracked_mem_highwater = vips_tracked_mem ; vips_tracked_allocs += 1 ; # ifdef DEBUG_VERBOSE printf ( "vips_tracked_malloc:<S2SV_blank>%p,<S2SV_blank>%zd<S2SV_blank>bytes\\n" , buf , size ) ; # endif g_mutex_unlock ( vips_tracked_mutex ) ; VIPS_GATE_MALLOC ( size ) ; return ( buf ) ; }
<S2SV_ModStart> ( buf = g_try_malloc0 <S2SV_ModEnd> ( size )
libvips@libvips/00622428bda8d7521db8d74260b519fa41d69d0a
CVE-2019-6976
https://github.com/libvips/libvips/commit/00622428bda8d7521db8d74260b519fa41d69d0a
2019-01-26T23:29Z
307
CWE-119
CWE-119 WORD32 ih264d_read_mmco_commands ( struct _DecStruct * ps_dec ) { dec_bit_stream_t * ps_bitstrm = ps_dec -> ps_bitstrm ; dpb_commands_t * ps_dpb_cmds = ps_dec -> ps_dpb_cmds ; dec_slice_params_t * ps_slice = ps_dec -> ps_cur_slice ; WORD32 j ; UWORD8 u1_buf_mode ; struct MMCParams * ps_mmc_params ; UWORD32 * pu4_bitstrm_buf = ps_dec -> ps_bitstrm -> pu4_buffer ; UWORD32 * pu4_bitstrm_ofst = & ps_bitstrm -> u4_ofst ; UWORD32 u4_bit_ofst = ps_dec -> ps_bitstrm -> u4_ofst ; ps_slice -> u1_mmco_equalto5 = 0 ; { if ( ps_dec -> u1_nal_unit_type == IDR_SLICE_NAL ) { ps_slice -> u1_no_output_of_prior_pics_flag = ih264d_get_bit_h264 ( ps_bitstrm ) ; COPYTHECONTEXT ( "SH:<S2SV_blank>no_output_of_prior_pics_flag" , ps_slice -> u1_no_output_of_prior_pics_flag ) ; ps_slice -> u1_long_term_reference_flag = ih264d_get_bit_h264 ( ps_bitstrm ) ; COPYTHECONTEXT ( "SH:<S2SV_blank>long_term_reference_flag" , ps_slice -> u1_long_term_reference_flag ) ; ps_dpb_cmds -> u1_idr_pic = 1 ; ps_dpb_cmds -> u1_no_output_of_prior_pics_flag = ps_slice -> u1_no_output_of_prior_pics_flag ; ps_dpb_cmds -> u1_long_term_reference_flag = ps_slice -> u1_long_term_reference_flag ; } else { u1_buf_mode = ih264d_get_bit_h264 ( ps_bitstrm ) ; COPYTHECONTEXT ( "SH:<S2SV_blank>adaptive_ref_pic_buffering_flag" , u1_buf_mode ) ; ps_dpb_cmds -> u1_buf_mode = u1_buf_mode ; j = 0 ; if ( u1_buf_mode == 1 ) { UWORD32 u4_mmco ; UWORD32 u4_diff_pic_num ; UWORD32 u4_lt_idx , u4_max_lt_idx ; u4_mmco = ih264d_uev ( pu4_bitstrm_ofst , pu4_bitstrm_buf ) ; while ( u4_mmco != END_OF_MMCO ) <S2SV_StartBug> { <S2SV_EndBug> ps_mmc_params = & ps_dpb_cmds -> as_mmc_params [ j ] ; ps_mmc_params -> u4_mmco = u4_mmco ; switch ( u4_mmco ) { case MARK_ST_PICNUM_AS_NONREF : u4_diff_pic_num = ih264d_uev ( pu4_bitstrm_ofst , pu4_bitstrm_buf ) ; ps_mmc_params -> u4_diff_pic_num = u4_diff_pic_num ; break ; case MARK_LT_INDEX_AS_NONREF : u4_lt_idx = ih264d_uev ( pu4_bitstrm_ofst , pu4_bitstrm_buf ) ; ps_mmc_params -> u4_lt_idx = u4_lt_idx ; break ; case MARK_ST_PICNUM_AS_LT_INDEX : u4_diff_pic_num = ih264d_uev ( pu4_bitstrm_ofst , pu4_bitstrm_buf ) ; ps_mmc_params -> u4_diff_pic_num = u4_diff_pic_num ; u4_lt_idx = ih264d_uev ( pu4_bitstrm_ofst , pu4_bitstrm_buf ) ; ps_mmc_params -> u4_lt_idx = u4_lt_idx ; break ; case SET_MAX_LT_INDEX : { u4_max_lt_idx = ih264d_uev ( pu4_bitstrm_ofst , pu4_bitstrm_buf ) ; ps_mmc_params -> u4_max_lt_idx_plus1 = u4_max_lt_idx ; break ; } case RESET_REF_PICTURES : { ps_slice -> u1_mmco_equalto5 = 1 ; break ; } case SET_LT_INDEX : u4_lt_idx = ih264d_uev ( pu4_bitstrm_ofst , pu4_bitstrm_buf ) ; ps_mmc_params -> u4_lt_idx = u4_lt_idx ; break ; default : break ; } u4_mmco = ih264d_uev ( pu4_bitstrm_ofst , pu4_bitstrm_buf ) ; j ++ ; } ps_dpb_cmds -> u1_num_of_commands = j ; } } ps_dpb_cmds -> u1_dpb_commands_read = 1 ; ps_dpb_cmds -> u1_dpb_commands_read_slc = 1 ; } u4_bit_ofst = ps_dec -> ps_bitstrm -> u4_ofst - u4_bit_ofst ; return u4_bit_ofst ; }
<S2SV_ModStart> END_OF_MMCO ) { if ( j >= MAX_REF_BUFS ) { ALOGE ( "b/25818142" ) ; android_errorWriteLog ( 0x534e4554 , "25818142" ) ; ps_dpb_cmds -> u1_num_of_commands = 0 ; return - 1 ; }
external@libavc/943323f1d9d3dd5c2634deb26cbe72343ca6b3db
CVE-2016-0842
https://android.googlesource.com/platform/external/libavc/+/943323f1d9d3dd5c2634deb26cbe72343ca6b3db
2016-04-18T00:59Z
308
CWE-400
CWE-400 static void __xen_evtchn_do_upcall ( void ) { struct vcpu_info * vcpu_info = __this_cpu_read ( xen_vcpu ) ; int cpu = smp_processor_id ( ) ; <S2SV_StartBug> read_lock ( & evtchn_rwlock ) ; <S2SV_EndBug> do { vcpu_info -> evtchn_upcall_pending = 0 ; <S2SV_StartBug> xen_evtchn_handle_events ( cpu ) ; <S2SV_EndBug> BUG_ON ( ! irqs_disabled ( ) ) ; virt_rmb ( ) ; } while ( vcpu_info -> evtchn_upcall_pending ) ; read_unlock ( & evtchn_rwlock ) ; <S2SV_StartBug> } <S2SV_EndBug>
<S2SV_ModStart> ( ) ; struct evtchn_loop_ctrl ctrl = { 0 } ; <S2SV_ModStart> xen_evtchn_handle_events ( cpu , & ctrl <S2SV_ModStart> evtchn_rwlock ) ; __this_cpu_inc ( irq_epoch ) ;
torvalds@linux/e99502f76271d6bc4e374fe368c50c67a1fd3070
CVE-2020-27673
https://github.com/torvalds/linux/commit/e99502f76271d6bc4e374fe368c50c67a1fd3070
2020-10-22T21:15Z
309
CWE-362
CWE-362 static int handle_emulation_failure ( struct kvm_vcpu * vcpu ) { int r = EMULATE_DONE ; ++ vcpu -> stat . insn_emulation_fail ; trace_kvm_emulate_insn_failed ( vcpu ) ; <S2SV_StartBug> if ( ! is_guest_mode ( vcpu ) ) { <S2SV_EndBug> vcpu -> run -> exit_reason = KVM_EXIT_INTERNAL_ERROR ; vcpu -> run -> internal . suberror = KVM_INTERNAL_ERROR_EMULATION ; vcpu -> run -> internal . ndata = 0 ; r = EMULATE_FAIL ; } kvm_queue_exception ( vcpu , UD_VECTOR ) ; return r ; }
<S2SV_ModStart> ( vcpu ) && kvm_x86_ops -> get_cpl ( vcpu ) == 0
torvalds@linux/a2b9e6c1a35afcc0973acb72e591c714e78885ff
CVE-2014-7842
https://github.com/torvalds/linux/commit/a2b9e6c1a35afcc0973acb72e591c714e78885ff
2014-11-30T01:59Z
310
CWE-20
CWE-20 void tcpUpdateRetransmitQueue ( Socket * socket ) { size_t length ; TcpQueueItem * prevQueueItem ; TcpQueueItem * queueItem ; TcpHeader * header ; prevQueueItem = NULL ; queueItem = socket -> retransmitQueue ; while ( queueItem != NULL ) { header = ( TcpHeader * ) queueItem -> header ; if ( header -> flags & TCP_FLAG_SYN ) <S2SV_StartBug> length = 1 ; <S2SV_EndBug> <S2SV_StartBug> else if ( header -> flags & TCP_FLAG_FIN ) <S2SV_EndBug> length = queueItem -> length + 1 ; <S2SV_StartBug> else <S2SV_EndBug> length = queueItem -> length ; if ( TCP_CMP_SEQ ( socket -> sndUna , ntohl ( header -> seqNum ) + length ) >= 0 ) { if ( prevQueueItem == NULL ) { socket -> retransmitQueue = queueItem -> next ; memPoolFree ( queueItem ) ; queueItem = socket -> retransmitQueue ; } else { prevQueueItem -> next = queueItem -> next ; memPoolFree ( queueItem ) ; queueItem = prevQueueItem -> next ; } tcpTimerStart ( & socket -> retransmitTimer , socket -> rto ) ; socket -> retransmitCount = 0 ; } else { prevQueueItem = queueItem ; queueItem = queueItem -> next ; } } if ( socket -> retransmitQueue == NULL ) tcpTimerStop ( & socket -> retransmitTimer ) ; }
<S2SV_ModStart> & TCP_FLAG_SYN ) { <S2SV_ModStart> = 1 ; } <S2SV_ModStart> & TCP_FLAG_FIN ) { <S2SV_ModStart> + 1 ; } else { length = queueItem -> length ; } <S2SV_ModEnd> if ( TCP_CMP_SEQ
Oryx-Embedded@CycloneTCP/de5336016edbe1e90327d0ed1cba5c4e49114366
CVE-2021-26788
https://github.com/Oryx-Embedded/CycloneTCP/commit/de5336016edbe1e90327d0ed1cba5c4e49114366
2021-03-08T13:15Z
311
CWE-399
CWE-399 static int inotify_release ( struct inode * ignored , struct file * file ) { struct fsnotify_group * group = file -> private_data ; <S2SV_StartBug> struct user_struct * user = group -> inotify_data . user ; <S2SV_EndBug> pr_debug ( "%s:<S2SV_blank>group=%p\\n" , __func__ , group ) ; fsnotify_clear_marks_by_group ( group ) ; fsnotify_put_group ( group ) ; <S2SV_StartBug> atomic_dec ( & user -> inotify_devs ) ; <S2SV_EndBug> return 0 ; }
<S2SV_ModStart> -> private_data ; <S2SV_ModEnd> pr_debug ( "%s:<S2SV_blank>group=%p\\n" <S2SV_ModStart> group ) ; <S2SV_ModEnd> return 0 ;
torvalds@linux/d0de4dc584ec6aa3b26fffea320a8457827768fc
CVE-2011-1479
https://github.com/torvalds/linux/commit/d0de4dc584ec6aa3b26fffea320a8457827768fc
2012-06-21T23:55Z
312
CWE-362
CWE-362 static struct ucounts * get_ucounts ( struct user_namespace * ns , kuid_t uid ) { struct hlist_head * hashent = ucounts_hashentry ( ns , uid ) ; struct ucounts * ucounts , * new ; spin_lock_irq ( & ucounts_lock ) ; ucounts = find_ucounts ( ns , uid , hashent ) ; if ( ! ucounts ) { spin_unlock_irq ( & ucounts_lock ) ; new = kzalloc ( sizeof ( * new ) , GFP_KERNEL ) ; if ( ! new ) return NULL ; new -> ns = ns ; new -> uid = uid ; <S2SV_StartBug> atomic_set ( & new -> count , 0 ) ; <S2SV_EndBug> spin_lock_irq ( & ucounts_lock ) ; ucounts = find_ucounts ( ns , uid , hashent ) ; if ( ucounts ) { kfree ( new ) ; } else { hlist_add_head ( & new -> node , hashent ) ; ucounts = new ; } } <S2SV_StartBug> if ( ! atomic_add_unless ( & ucounts -> count , 1 , INT_MAX ) ) <S2SV_EndBug> ucounts = NULL ; spin_unlock_irq ( & ucounts_lock ) ; return ucounts ; }
<S2SV_ModStart> = uid ; <S2SV_ModEnd> new -> count <S2SV_ModStart> new -> count = 0 <S2SV_ModEnd> ; spin_lock_irq ( <S2SV_ModStart> } if ( <S2SV_ModEnd> ucounts -> count <S2SV_ModStart> ucounts -> count == INT_MAX ) ucounts = NULL ; else ucounts -> count += 1 <S2SV_ModEnd> ; spin_unlock_irq (
torvalds@linux/040757f738e13caaa9c5078bca79aa97e11dde88
CVE-2017-6874
https://github.com/torvalds/linux/commit/040757f738e13caaa9c5078bca79aa97e11dde88
2017-03-14T09:59Z
313
CWE-20
CWE-20 static void copy_move_file ( CopyMoveJob * copy_job , GFile * src , GFile * dest_dir , gboolean same_fs , gboolean unique_names , char * * dest_fs_type , SourceInfo * source_info , TransferInfo * transfer_info , GHashTable * debuting_files , GdkPoint * position , gboolean overwrite , gboolean * skipped_file , gboolean readonly_source_fs ) { GFile * dest , * new_dest ; g_autofree gchar * dest_uri = NULL ; GError * error ; GFileCopyFlags flags ; char * primary , * secondary , * details ; int response ; ProgressData pdata ; gboolean would_recurse , is_merge ; CommonJob * job ; gboolean res ; int unique_name_nr ; gboolean handled_invalid_filename ; job = ( CommonJob * ) copy_job ; if ( should_skip_file ( job , src ) ) { * skipped_file = TRUE ; return ; } unique_name_nr = 1 ; handled_invalid_filename = * dest_fs_type != NULL ; if ( unique_names ) { dest = get_unique_target_file ( src , dest_dir , same_fs , * dest_fs_type , unique_name_nr ++ ) ; } else if ( copy_job -> target_name != NULL ) { dest = get_target_file_with_custom_name ( src , dest_dir , * dest_fs_type , same_fs , copy_job -> target_name ) ; } else { dest = get_target_file ( src , dest_dir , * dest_fs_type , same_fs ) ; } if ( test_dir_is_parent ( dest_dir , src ) ) { if ( job -> skip_all_error ) { goto out ; } primary = copy_job -> is_move ? g_strdup ( _ ( "You<S2SV_blank>cannot<S2SV_blank>move<S2SV_blank>a<S2SV_blank>folder<S2SV_blank>into<S2SV_blank>itself." ) ) : g_strdup ( _ ( "You<S2SV_blank>cannot<S2SV_blank>copy<S2SV_blank>a<S2SV_blank>folder<S2SV_blank>into<S2SV_blank>itself." ) ) ; secondary = g_strdup ( _ ( "The<S2SV_blank>destination<S2SV_blank>folder<S2SV_blank>is<S2SV_blank>inside<S2SV_blank>the<S2SV_blank>source<S2SV_blank>folder." ) ) ; response = run_cancel_or_skip_warning ( job , primary , secondary , NULL , source_info -> num_files , source_info -> num_files - transfer_info -> num_files ) ; if ( response == 0 || response == GTK_RESPONSE_DELETE_EVENT ) { abort_job ( job ) ; } else if ( response == 1 ) { job -> skip_all_error = TRUE ; } else if ( response == 2 ) { } else { g_assert_not_reached ( ) ; } goto out ; } if ( test_dir_is_parent ( src , dest ) ) { if ( job -> skip_all_error ) { goto out ; } primary = copy_job -> is_move ? g_strdup ( _ ( "You<S2SV_blank>cannot<S2SV_blank>move<S2SV_blank>a<S2SV_blank>file<S2SV_blank>over<S2SV_blank>itself." ) ) : g_strdup ( _ ( "You<S2SV_blank>cannot<S2SV_blank>copy<S2SV_blank>a<S2SV_blank>file<S2SV_blank>over<S2SV_blank>itself." ) ) ; secondary = g_strdup ( _ ( "The<S2SV_blank>source<S2SV_blank>file<S2SV_blank>would<S2SV_blank>be<S2SV_blank>overwritten<S2SV_blank>by<S2SV_blank>the<S2SV_blank>destination." ) ) ; response = run_cancel_or_skip_warning ( job , primary , secondary , NULL , source_info -> num_files , source_info -> num_files - transfer_info -> num_files ) ; if ( response == 0 || response == GTK_RESPONSE_DELETE_EVENT ) { abort_job ( job ) ; } else if ( response == 1 ) { job -> skip_all_error = TRUE ; } else if ( response == 2 ) { } else { g_assert_not_reached ( ) ; } goto out ; } retry : error = NULL ; flags = G_FILE_COPY_NOFOLLOW_SYMLINKS ; if ( overwrite ) { flags |= G_FILE_COPY_OVERWRITE ; } if ( readonly_source_fs ) { flags |= G_FILE_COPY_TARGET_DEFAULT_PERMS ; } pdata . job = copy_job ; pdata . last_size = 0 ; pdata . source_info = source_info ; pdata . transfer_info = transfer_info ; if ( copy_job -> is_move ) { res = g_file_move ( src , dest , flags , job -> cancellable , copy_file_progress_callback , & pdata , & error ) ; } else { res = g_file_copy ( src , dest , flags , job -> cancellable , copy_file_progress_callback , & pdata , & error ) ; } if ( res ) { GFile * real ; real = map_possibly_volatile_file_to_real ( dest , job -> cancellable , & error ) ; if ( real == NULL ) { res = FALSE ; } else { g_object_unref ( dest ) ; dest = real ; } } if ( res ) { transfer_info -> num_files ++ ; report_copy_progress ( copy_job , source_info , transfer_info ) ; if ( debuting_files ) { dest_uri = g_file_get_uri ( dest ) ; if ( position ) { nautilus_file_changes_queue_schedule_position_set ( dest , * position , job -> screen_num ) ; } else if ( eel_uri_is_desktop ( dest_uri ) ) { nautilus_file_changes_queue_schedule_position_remove ( dest ) ; } g_hash_table_replace ( debuting_files , g_object_ref ( dest ) , GINT_TO_POINTER ( TRUE ) ) ; } if ( copy_job -> is_move ) { nautilus_file_changes_queue_file_moved ( src , dest ) ; } else { nautilus_file_changes_queue_file_added ( dest ) ; } if ( copy_job -> desktop_location != NULL && g_file_equal ( copy_job -> desktop_location , dest_dir ) && is_trusted_desktop_file ( src , job -> cancellable ) ) { <S2SV_StartBug> mark_desktop_file_trusted ( job , <S2SV_EndBug> job -> cancellable , dest , FALSE ) ; } if ( job -> undo_info != NULL ) { nautilus_file_undo_info_ext_add_origin_target_pair ( NAUTILUS_FILE_UNDO_INFO_EXT ( job -> undo_info ) , src , dest ) ; } g_object_unref ( dest ) ; return ; } if ( ! handled_invalid_filename && IS_IO_ERROR ( error , INVALID_FILENAME ) ) { handled_invalid_filename = TRUE ; g_assert ( * dest_fs_type == NULL ) ; * dest_fs_type = query_fs_type ( dest_dir , job -> cancellable ) ; if ( unique_names ) { new_dest = get_unique_target_file ( src , dest_dir , same_fs , * dest_fs_type , unique_name_nr ) ; } else { new_dest = get_target_file ( src , dest_dir , * dest_fs_type , same_fs ) ; } if ( ! g_file_equal ( dest , new_dest ) ) { g_object_unref ( dest ) ; dest = new_dest ; g_error_free ( error ) ; goto retry ; } else { g_object_unref ( new_dest ) ; } } if ( ! overwrite && IS_IO_ERROR ( error , EXISTS ) ) { gboolean is_merge ; FileConflictResponse * response ; g_error_free ( error ) ; if ( unique_names ) { g_object_unref ( dest ) ; dest = get_unique_target_file ( src , dest_dir , same_fs , * dest_fs_type , unique_name_nr ++ ) ; goto retry ; } is_merge = FALSE ; if ( is_dir ( dest ) && is_dir ( src ) ) { is_merge = TRUE ; } if ( ( is_merge && job -> merge_all ) || ( ! is_merge && job -> replace_all ) ) { overwrite = TRUE ; goto retry ; } if ( job -> skip_all_conflict ) { goto out ; } response = handle_copy_move_conflict ( job , src , dest , dest_dir ) ; if ( response -> id == GTK_RESPONSE_CANCEL || response -> id == GTK_RESPONSE_DELETE_EVENT ) { file_conflict_response_free ( response ) ; abort_job ( job ) ; } else if ( response -> id == CONFLICT_RESPONSE_SKIP ) { if ( response -> apply_to_all ) { job -> skip_all_conflict = TRUE ; } file_conflict_response_free ( response ) ; } else if ( response -> id == CONFLICT_RESPONSE_REPLACE ) { if ( response -> apply_to_all ) { if ( is_merge ) { job -> merge_all = TRUE ; } else { job -> replace_all = TRUE ; } } overwrite = TRUE ; file_conflict_response_free ( response ) ; goto retry ; } else if ( response -> id == CONFLICT_RESPONSE_RENAME ) { g_object_unref ( dest ) ; dest = get_target_file_for_display_name ( dest_dir , response -> new_name ) ; file_conflict_response_free ( response ) ; goto retry ; } else { g_assert_not_reached ( ) ; } } else if ( overwrite && IS_IO_ERROR ( error , IS_DIRECTORY ) ) { gboolean existing_file_deleted ; DeleteExistingFileData data ; g_error_free ( error ) ; data . job = job ; data . source = src ; existing_file_deleted = delete_file_recursively ( dest , job -> cancellable , existing_file_removed_callback , & data ) ; if ( existing_file_deleted ) { goto retry ; } } else if ( IS_IO_ERROR ( error , WOULD_RECURSE ) || IS_IO_ERROR ( error , WOULD_MERGE ) ) { is_merge = error -> code == G_IO_ERROR_WOULD_MERGE ; would_recurse = error -> code == G_IO_ERROR_WOULD_RECURSE ; g_error_free ( error ) ; if ( overwrite && would_recurse ) { error = NULL ; if ( ! g_file_delete ( dest , job -> cancellable , & error ) && ! IS_IO_ERROR ( error , NOT_FOUND ) ) { if ( job -> skip_all_error ) { g_error_free ( error ) ; goto out ; } if ( copy_job -> is_move ) { primary = f ( _ ( "Error<S2SV_blank>while<S2SV_blank>moving<S2SV_blank>“%B”." ) , src ) ; } else { primary = f ( _ ( "Error<S2SV_blank>while<S2SV_blank>copying<S2SV_blank>“%B”." ) , src ) ; } secondary = f ( _ ( "Could<S2SV_blank>not<S2SV_blank>remove<S2SV_blank>the<S2SV_blank>already<S2SV_blank>existing<S2SV_blank>file<S2SV_blank>with<S2SV_blank>the<S2SV_blank>same<S2SV_blank>name<S2SV_blank>in<S2SV_blank>%F." ) , dest_dir ) ; details = error -> message ; response = run_warning ( job , primary , secondary , details , TRUE , CANCEL , SKIP_ALL , SKIP , NULL ) ; g_error_free ( error ) ; if ( response == 0 || response == GTK_RESPONSE_DELETE_EVENT ) { abort_job ( job ) ; } else if ( response == 1 ) { job -> skip_all_error = TRUE ; } else if ( response == 2 ) { } else { g_assert_not_reached ( ) ; } goto out ; } if ( error ) { g_error_free ( error ) ; error = NULL ; } nautilus_file_changes_queue_file_removed ( dest ) ; } if ( is_merge ) { same_fs = FALSE ; } if ( ! copy_move_directory ( copy_job , src , & dest , same_fs , would_recurse , dest_fs_type , source_info , transfer_info , debuting_files , skipped_file , readonly_source_fs ) ) { g_assert ( * dest_fs_type != NULL ) ; handled_invalid_filename = TRUE ; goto retry ; } g_object_unref ( dest ) ; return ; } else if ( IS_IO_ERROR ( error , CANCELLED ) ) { g_error_free ( error ) ; } else { if ( job -> skip_all_error ) { g_error_free ( error ) ; goto out ; } primary = f ( _ ( "Error<S2SV_blank>while<S2SV_blank>copying<S2SV_blank>“%B”." ) , src ) ; secondary = f ( _ ( "There<S2SV_blank>was<S2SV_blank>an<S2SV_blank>error<S2SV_blank>copying<S2SV_blank>the<S2SV_blank>file<S2SV_blank>into<S2SV_blank>%F." ) , dest_dir ) ; details = error -> message ; response = run_cancel_or_skip_warning ( job , primary , secondary , details , source_info -> num_files , source_info -> num_files - transfer_info -> num_files ) ; g_error_free ( error ) ; if ( response == 0 || response == GTK_RESPONSE_DELETE_EVENT ) { abort_job ( job ) ; } else if ( response == 1 ) { job -> skip_all_error = TRUE ; } else if ( response == 2 ) { } else { g_assert_not_reached ( ) ; } } out : * skipped_file = TRUE ; g_object_unref ( dest ) ; }
<S2SV_ModStart> ) ) { mark_desktop_file_executable <S2SV_ModEnd> ( job ,
GNOME@nautilus/1630f53481f445ada0a455e9979236d31a8d3bb0
CVE-2017-14604
https://github.com/GNOME/nautilus/commit/1630f53481f445ada0a455e9979236d31a8d3bb0
2017-09-20T08:29Z
314
CWE-416
CWE-416 static struct page * follow_pmd_mask ( struct vm_area_struct * vma , unsigned long address , pud_t * pudp , unsigned int flags , struct follow_page_context * ctx ) { pmd_t * pmd , pmdval ; spinlock_t * ptl ; struct page * page ; struct mm_struct * mm = vma -> vm_mm ; pmd = pmd_offset ( pudp , address ) ; pmdval = READ_ONCE ( * pmd ) ; if ( pmd_none ( pmdval ) ) return no_page_table ( vma , flags ) ; if ( pmd_huge ( pmdval ) && vma -> vm_flags & VM_HUGETLB ) { page = follow_huge_pmd ( mm , address , pmd , flags ) ; if ( page ) return page ; return no_page_table ( vma , flags ) ; } if ( is_hugepd ( __hugepd ( pmd_val ( pmdval ) ) ) ) { page = follow_huge_pd ( vma , address , __hugepd ( pmd_val ( pmdval ) ) , flags , PMD_SHIFT ) ; if ( page ) return page ; return no_page_table ( vma , flags ) ; } retry : if ( ! pmd_present ( pmdval ) ) { if ( likely ( ! ( flags & FOLL_MIGRATION ) ) ) return no_page_table ( vma , flags ) ; VM_BUG_ON ( thp_migration_supported ( ) && ! is_pmd_migration_entry ( pmdval ) ) ; if ( is_pmd_migration_entry ( pmdval ) ) pmd_migration_entry_wait ( mm , pmd ) ; pmdval = READ_ONCE ( * pmd ) ; if ( pmd_none ( pmdval ) ) return no_page_table ( vma , flags ) ; goto retry ; } if ( pmd_devmap ( pmdval ) ) { ptl = pmd_lock ( mm , pmd ) ; page = follow_devmap_pmd ( vma , address , pmd , flags , & ctx -> pgmap ) ; spin_unlock ( ptl ) ; if ( page ) return page ; } if ( likely ( ! pmd_trans_huge ( pmdval ) ) ) return follow_page_pte ( vma , address , pmd , flags , & ctx -> pgmap ) ; if ( ( flags & FOLL_NUMA ) && pmd_protnone ( pmdval ) ) return no_page_table ( vma , flags ) ; retry_locked : ptl = pmd_lock ( mm , pmd ) ; if ( unlikely ( pmd_none ( * pmd ) ) ) { spin_unlock ( ptl ) ; return no_page_table ( vma , flags ) ; } if ( unlikely ( ! pmd_present ( * pmd ) ) ) { spin_unlock ( ptl ) ; if ( likely ( ! ( flags & FOLL_MIGRATION ) ) ) return no_page_table ( vma , flags ) ; pmd_migration_entry_wait ( mm , pmd ) ; goto retry_locked ; } if ( unlikely ( ! pmd_trans_huge ( * pmd ) ) ) { spin_unlock ( ptl ) ; return follow_page_pte ( vma , address , pmd , flags , & ctx -> pgmap ) ; } if ( flags & FOLL_SPLIT ) { int ret ; page = pmd_page ( * pmd ) ; if ( is_huge_zero_page ( page ) ) { spin_unlock ( ptl ) ; ret = 0 ; split_huge_pmd ( vma , pmd , address ) ; if ( pmd_trans_unstable ( pmd ) ) ret = - EBUSY ; } else { <S2SV_StartBug> get_page ( page ) ; <S2SV_EndBug> spin_unlock ( ptl ) ; lock_page ( page ) ; ret = split_huge_page ( page ) ; unlock_page ( page ) ; put_page ( page ) ; if ( pmd_none ( * pmd ) ) return no_page_table ( vma , flags ) ; } return ret ? ERR_PTR ( ret ) : follow_page_pte ( vma , address , pmd , flags , & ctx -> pgmap ) ; } page = follow_trans_huge_pmd ( vma , address , pmd , flags ) ; spin_unlock ( ptl ) ; ctx -> page_mask = HPAGE_PMD_NR - 1 ; return page ; }
<S2SV_ModStart> } else { if ( unlikely ( ! try_get_page ( page ) ) ) { spin_unlock ( ptl ) ; return ERR_PTR ( - ENOMEM ) ; } <S2SV_ModEnd> spin_unlock ( ptl
torvalds@linux/8fde12ca79aff9b5ba951fce1a2641901b8d8e64
CVE-2019-11487
https://github.com/torvalds/linux/commit/8fde12ca79aff9b5ba951fce1a2641901b8d8e64
2019-04-23T22:29Z
315
CWE-20
CWE-20 static int zip_read_mac_metadata ( struct archive_read * a , struct archive_entry * entry , struct zip_entry * rsrc ) { struct zip * zip = ( struct zip * ) a -> format -> data ; unsigned char * metadata , * mp ; int64_t offset = archive_filter_bytes ( & a -> archive , 0 ) ; size_t remaining_bytes , metadata_bytes ; ssize_t hsize ; int ret = ARCHIVE_OK , eof ; switch ( rsrc -> compression ) { <S2SV_StartBug> case 0 : <S2SV_EndBug> # ifdef HAVE_ZLIB_H case 8 : # endif break ; default : archive_set_error ( & a -> archive , ARCHIVE_ERRNO_FILE_FORMAT , "Unsupported<S2SV_blank>ZIP<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>(%s)" , compression_name ( rsrc -> compression ) ) ; return ( ARCHIVE_WARN ) ; } if ( rsrc -> uncompressed_size > ( 4 * 1024 * 1024 ) ) { archive_set_error ( & a -> archive , ARCHIVE_ERRNO_FILE_FORMAT , "Mac<S2SV_blank>metadata<S2SV_blank>is<S2SV_blank>too<S2SV_blank>large:<S2SV_blank>%jd<S2SV_blank>><S2SV_blank>4M<S2SV_blank>bytes" , <S2SV_StartBug> ( intmax_t ) rsrc -> uncompressed_size ) ; <S2SV_EndBug> return ( ARCHIVE_WARN ) ; } metadata = malloc ( ( size_t ) rsrc -> uncompressed_size ) ; if ( metadata == NULL ) { archive_set_error ( & a -> archive , ENOMEM , "Can\'t<S2SV_blank>allocate<S2SV_blank>memory<S2SV_blank>for<S2SV_blank>Mac<S2SV_blank>metadata" ) ; return ( ARCHIVE_FATAL ) ; } if ( offset < rsrc -> local_header_offset ) __archive_read_consume ( a , rsrc -> local_header_offset - offset ) ; else if ( offset != rsrc -> local_header_offset ) { __archive_read_seek ( a , rsrc -> local_header_offset , SEEK_SET ) ; } hsize = zip_get_local_file_header_size ( a , 0 ) ; __archive_read_consume ( a , hsize ) ; remaining_bytes = ( size_t ) rsrc -> compressed_size ; metadata_bytes = ( size_t ) rsrc -> uncompressed_size ; mp = metadata ; eof = 0 ; while ( ! eof && remaining_bytes ) { const unsigned char * p ; ssize_t bytes_avail ; size_t bytes_used ; p = __archive_read_ahead ( a , 1 , & bytes_avail ) ; if ( p == NULL ) { archive_set_error ( & a -> archive , ARCHIVE_ERRNO_FILE_FORMAT , "Truncated<S2SV_blank>ZIP<S2SV_blank>file<S2SV_blank>header" ) ; ret = ARCHIVE_WARN ; goto exit_mac_metadata ; } if ( ( size_t ) bytes_avail > remaining_bytes ) bytes_avail = remaining_bytes ; switch ( rsrc -> compression ) { case 0 : <S2SV_StartBug> memcpy ( mp , p , bytes_avail ) ; <S2SV_EndBug> bytes_used = ( size_t ) bytes_avail ; metadata_bytes -= bytes_used ; mp += bytes_used ; if ( metadata_bytes == 0 ) eof = 1 ; break ; # ifdef HAVE_ZLIB_H case 8 : { int r ; ret = zip_deflate_init ( a , zip ) ; if ( ret != ARCHIVE_OK ) goto exit_mac_metadata ; zip -> stream . next_in = ( Bytef * ) ( uintptr_t ) ( const void * ) p ; zip -> stream . avail_in = ( uInt ) bytes_avail ; zip -> stream . total_in = 0 ; zip -> stream . next_out = mp ; zip -> stream . avail_out = ( uInt ) metadata_bytes ; zip -> stream . total_out = 0 ; r = inflate ( & zip -> stream , 0 ) ; switch ( r ) { case Z_OK : break ; case Z_STREAM_END : eof = 1 ; break ; case Z_MEM_ERROR : archive_set_error ( & a -> archive , ENOMEM , "Out<S2SV_blank>of<S2SV_blank>memory<S2SV_blank>for<S2SV_blank>ZIP<S2SV_blank>decompression" ) ; ret = ARCHIVE_FATAL ; goto exit_mac_metadata ; default : archive_set_error ( & a -> archive , ARCHIVE_ERRNO_MISC , "ZIP<S2SV_blank>decompression<S2SV_blank>failed<S2SV_blank>(%d)" , r ) ; ret = ARCHIVE_FATAL ; goto exit_mac_metadata ; } bytes_used = zip -> stream . total_in ; metadata_bytes -= zip -> stream . total_out ; mp += zip -> stream . total_out ; break ; } # endif default : bytes_used = 0 ; break ; } __archive_read_consume ( a , bytes_used ) ; remaining_bytes -= bytes_used ; } archive_entry_copy_mac_metadata ( entry , metadata , ( size_t ) rsrc -> uncompressed_size - metadata_bytes ) ; exit_mac_metadata : __archive_read_seek ( a , offset , SEEK_SET ) ; zip -> decompress_init = 0 ; free ( metadata ) ; return ( ret ) ; }
<S2SV_ModStart> case 0 : if ( rsrc -> uncompressed_size != rsrc -> compressed_size ) { archive_set_error ( & a -> archive , ARCHIVE_ERRNO_FILE_FORMAT , "Malformed<S2SV_blank>OS<S2SV_blank>X<S2SV_blank>metadata<S2SV_blank>entry:<S2SV_blank>inconsistent<S2SV_blank>size" ) ; return ( ARCHIVE_FATAL ) ; } <S2SV_ModStart> rsrc -> uncompressed_size ) ; return ( ARCHIVE_WARN ) ; } if ( rsrc -> compressed_size > ( 4 * 1024 * 1024 ) ) { archive_set_error ( & a -> archive , ARCHIVE_ERRNO_FILE_FORMAT , "Mac<S2SV_blank>metadata<S2SV_blank>is<S2SV_blank>too<S2SV_blank>large:<S2SV_blank>%jd<S2SV_blank>><S2SV_blank>4M<S2SV_blank>bytes" , ( intmax_t ) rsrc -> compressed_size <S2SV_ModStart> case 0 : if ( ( size_t ) bytes_avail > metadata_bytes ) bytes_avail = metadata_bytes ;
libarchive@libarchive/d0331e8e5b05b475f20b1f3101fe1ad772d7e7e7
CVE-2016-1541
https://github.com/libarchive/libarchive/commit/d0331e8e5b05b475f20b1f3101fe1ad772d7e7e7
2016-05-07T10:59Z
316
CWE-476
CWE-476 jas_image_t * jp2_decode ( jas_stream_t * in , const char * optstr ) { jp2_box_t * box ; int found ; jas_image_t * image ; jp2_dec_t * dec ; bool samedtype ; int dtype ; unsigned int i ; jp2_cmap_t * cmapd ; jp2_pclr_t * pclrd ; jp2_cdef_t * cdefd ; unsigned int channo ; int newcmptno ; int_fast32_t * lutents ; # if 0 jp2_cdefchan_t * cdefent ; int cmptno ; # endif jp2_cmapent_t * cmapent ; jas_icchdr_t icchdr ; jas_iccprof_t * iccprof ; dec = 0 ; box = 0 ; image = 0 ; JAS_DBGLOG ( 100 , ( "jp2_decode(%p,<S2SV_blank>\\"%s\\")\\n" , in , optstr ) ) ; if ( ! ( dec = jp2_dec_create ( ) ) ) { goto error ; } if ( ! ( box = jp2_box_get ( in ) ) ) { jas_eprintf ( "error:<S2SV_blank>cannot<S2SV_blank>get<S2SV_blank>box\\n" ) ; goto error ; } if ( box -> type != JP2_BOX_JP ) { jas_eprintf ( "error:<S2SV_blank>expecting<S2SV_blank>signature<S2SV_blank>box\\n" ) ; goto error ; } if ( box -> data . jp . magic != JP2_JP_MAGIC ) { jas_eprintf ( "incorrect<S2SV_blank>magic<S2SV_blank>number\\n" ) ; goto error ; } jp2_box_destroy ( box ) ; box = 0 ; if ( ! ( box = jp2_box_get ( in ) ) ) { goto error ; } if ( box -> type != JP2_BOX_FTYP ) { jas_eprintf ( "expecting<S2SV_blank>file<S2SV_blank>type<S2SV_blank>box\\n" ) ; goto error ; } jp2_box_destroy ( box ) ; box = 0 ; found = 0 ; while ( ( box = jp2_box_get ( in ) ) ) { if ( jas_getdbglevel ( ) >= 1 ) { jas_eprintf ( "got<S2SV_blank>box<S2SV_blank>type<S2SV_blank>%s\\n" , box -> info -> name ) ; } switch ( box -> type ) { case JP2_BOX_JP2C : found = 1 ; break ; case JP2_BOX_IHDR : if ( ! dec -> ihdr ) { dec -> ihdr = box ; box = 0 ; } break ; case JP2_BOX_BPCC : if ( ! dec -> bpcc ) { dec -> bpcc = box ; box = 0 ; } break ; case JP2_BOX_CDEF : if ( ! dec -> cdef ) { dec -> cdef = box ; box = 0 ; } break ; case JP2_BOX_PCLR : if ( ! dec -> pclr ) { dec -> pclr = box ; box = 0 ; } break ; case JP2_BOX_CMAP : if ( ! dec -> cmap ) { dec -> cmap = box ; box = 0 ; } break ; case JP2_BOX_COLR : if ( ! dec -> colr ) { dec -> colr = box ; box = 0 ; } break ; } if ( box ) { jp2_box_destroy ( box ) ; box = 0 ; } if ( found ) { break ; } } if ( ! found ) { jas_eprintf ( "error:<S2SV_blank>no<S2SV_blank>code<S2SV_blank>stream<S2SV_blank>found\\n" ) ; goto error ; } if ( ! ( dec -> image = jpc_decode ( in , optstr ) ) ) { jas_eprintf ( "error:<S2SV_blank>cannot<S2SV_blank>decode<S2SV_blank>code<S2SV_blank>stream\\n" ) ; goto error ; } if ( ! dec -> ihdr ) { jas_eprintf ( "error:<S2SV_blank>missing<S2SV_blank>IHDR<S2SV_blank>box\\n" ) ; goto error ; } if ( dec -> ihdr -> data . ihdr . numcmpts != JAS_CAST ( jas_uint , jas_image_numcmpts ( dec -> image ) ) ) { <S2SV_StartBug> jas_eprintf ( "warning:<S2SV_blank>number<S2SV_blank>of<S2SV_blank>components<S2SV_blank>mismatch\\n" ) ; <S2SV_EndBug> } if ( ! jas_image_numcmpts ( dec -> image ) ) { jas_eprintf ( "error:<S2SV_blank>no<S2SV_blank>components\\n" ) ; goto error ; } samedtype = true ; dtype = jas_image_cmptdtype ( dec -> image , 0 ) ; for ( i = 1 ; i < JAS_CAST ( jas_uint , jas_image_numcmpts ( dec -> image ) ) ; ++ i ) { if ( jas_image_cmptdtype ( dec -> image , i ) != dtype ) { samedtype = false ; break ; } } if ( ( samedtype && dec -> ihdr -> data . ihdr . bpc != JP2_DTYPETOBPC ( dtype ) ) || ( ! samedtype && dec -> ihdr -> data . ihdr . bpc != JP2_IHDR_BPCNULL ) ) { <S2SV_StartBug> jas_eprintf ( "warning:<S2SV_blank>component<S2SV_blank>data<S2SV_blank>type<S2SV_blank>mismatch<S2SV_blank>(IHDR)\\n" ) ; <S2SV_EndBug> } if ( dec -> ihdr -> data . ihdr . comptype != JP2_IHDR_COMPTYPE ) { jas_eprintf ( "error:<S2SV_blank>unsupported<S2SV_blank>compression<S2SV_blank>type\\n" ) ; goto error ; } if ( dec -> bpcc ) { if ( dec -> bpcc -> data . bpcc . numcmpts != JAS_CAST ( jas_uint , jas_image_numcmpts ( <S2SV_StartBug> dec -> image ) ) ) { <S2SV_EndBug> jas_eprintf ( "warning:<S2SV_blank>number<S2SV_blank>of<S2SV_blank>components<S2SV_blank>mismatch\\n" ) ; } if ( ! samedtype ) { for ( i = 0 ; i < JAS_CAST ( jas_uint , jas_image_numcmpts ( dec -> image ) ) ; ++ i ) { if ( jas_image_cmptdtype ( dec -> image , i ) != JP2_BPCTODTYPE ( dec -> bpcc -> data . bpcc . bpcs [ i ] ) ) { <S2SV_StartBug> jas_eprintf ( "warning:<S2SV_blank>component<S2SV_blank>data<S2SV_blank>type<S2SV_blank>mismatch<S2SV_blank>(BPCC)\\n" ) ; <S2SV_EndBug> } } } else { jas_eprintf ( "warning:<S2SV_blank>superfluous<S2SV_blank>BPCC<S2SV_blank>box\\n" ) ; } } if ( ! dec -> colr ) { jas_eprintf ( "error:<S2SV_blank>no<S2SV_blank>COLR<S2SV_blank>box\\n" ) ; goto error ; } switch ( dec -> colr -> data . colr . method ) { case JP2_COLR_ENUM : jas_image_setclrspc ( dec -> image , jp2_getcs ( & dec -> colr -> data . colr ) ) ; break ; case JP2_COLR_ICC : iccprof = jas_iccprof_createfrombuf ( dec -> colr -> data . colr . iccp , dec -> colr -> data . colr . iccplen ) ; if ( ! iccprof ) { jas_eprintf ( "error:<S2SV_blank>failed<S2SV_blank>to<S2SV_blank>parse<S2SV_blank>ICC<S2SV_blank>profile\\n" ) ; goto error ; } jas_iccprof_gethdr ( iccprof , & icchdr ) ; jas_eprintf ( "ICC<S2SV_blank>Profile<S2SV_blank>CS<S2SV_blank>%08x\\n" , icchdr . colorspc ) ; jas_image_setclrspc ( dec -> image , fromiccpcs ( icchdr . colorspc ) ) ; dec -> image -> cmprof_ = jas_cmprof_createfromiccprof ( iccprof ) ; if ( ! dec -> image -> cmprof_ ) { jas_iccprof_destroy ( iccprof ) ; goto error ; } jas_iccprof_destroy ( iccprof ) ; break ; } if ( dec -> cmap && ! dec -> pclr ) { jas_eprintf ( "warning:<S2SV_blank>missing<S2SV_blank>PCLR<S2SV_blank>box<S2SV_blank>or<S2SV_blank>superfluous<S2SV_blank>CMAP<S2SV_blank>box\\n" ) ; jp2_box_destroy ( dec -> cmap ) ; dec -> cmap = 0 ; } if ( ! dec -> cmap && dec -> pclr ) { jas_eprintf ( "warning:<S2SV_blank>missing<S2SV_blank>CMAP<S2SV_blank>box<S2SV_blank>or<S2SV_blank>superfluous<S2SV_blank>PCLR<S2SV_blank>box\\n" ) ; jp2_box_destroy ( dec -> pclr ) ; dec -> pclr = 0 ; } dec -> numchans = dec -> cmap ? dec -> cmap -> data . cmap . numchans : JAS_CAST ( jas_uint , jas_image_numcmpts ( dec -> image ) ) ; if ( dec -> cmap ) { for ( i = 0 ; i < dec -> numchans ; ++ i ) { if ( dec -> cmap -> data . cmap . ents [ i ] . cmptno >= JAS_CAST ( jas_uint , jas_image_numcmpts ( dec -> image ) ) ) { jas_eprintf ( "error:<S2SV_blank>invalid<S2SV_blank>component<S2SV_blank>number<S2SV_blank>in<S2SV_blank>CMAP<S2SV_blank>box\\n" ) ; goto error ; } if ( dec -> cmap -> data . cmap . ents [ i ] . pcol >= dec -> pclr -> data . pclr . numchans ) { jas_eprintf ( "error:<S2SV_blank>invalid<S2SV_blank>CMAP<S2SV_blank>LUT<S2SV_blank>index\\n" ) ; goto error ; } } } if ( ! ( dec -> chantocmptlut = jas_alloc2 ( dec -> numchans , sizeof ( uint_fast16_t ) ) ) ) { jas_eprintf ( "error:<S2SV_blank>no<S2SV_blank>memory\\n" ) ; goto error ; } if ( ! dec -> cmap ) { for ( i = 0 ; i < dec -> numchans ; ++ i ) { dec -> chantocmptlut [ i ] = i ; } } else { cmapd = & dec -> cmap -> data . cmap ; pclrd = & dec -> pclr -> data . pclr ; cdefd = & dec -> cdef -> data . cdef ; for ( channo = 0 ; channo < cmapd -> numchans ; ++ channo ) { cmapent = & cmapd -> ents [ channo ] ; if ( cmapent -> map == JP2_CMAP_DIRECT ) { dec -> chantocmptlut [ channo ] = channo ; } else if ( cmapent -> map == JP2_CMAP_PALETTE ) { if ( ! pclrd -> numlutents ) { goto error ; } lutents = jas_alloc2 ( pclrd -> numlutents , sizeof ( int_fast32_t ) ) ; if ( ! lutents ) { goto error ; } for ( i = 0 ; i < pclrd -> numlutents ; ++ i ) { lutents [ i ] = pclrd -> lutdata [ cmapent -> pcol + i * pclrd -> numchans ] ; } newcmptno = jas_image_numcmpts ( dec -> image ) ; jas_image_depalettize ( dec -> image , cmapent -> cmptno , pclrd -> numlutents , lutents , JP2_BPCTODTYPE ( pclrd -> bpc [ cmapent -> pcol ] ) , newcmptno ) ; dec -> chantocmptlut [ channo ] = newcmptno ; jas_free ( lutents ) ; # if 0 if ( dec -> cdef ) { cdefent = jp2_cdef_lookup ( cdefd , channo ) ; if ( ! cdefent ) { abort ( ) ; } jas_image_setcmpttype ( dec -> image , newcmptno , jp2_getct ( jas_image_clrspc ( dec -> image ) , cdefent -> type , cdefent -> assoc ) ) ; } else { jas_image_setcmpttype ( dec -> image , newcmptno , jp2_getct ( jas_image_clrspc ( dec -> image ) , 0 , channo + 1 ) ) ; } # else ( void ) cdefd ; # endif } else { jas_eprintf ( "error:<S2SV_blank>invalid<S2SV_blank>MTYP<S2SV_blank>in<S2SV_blank>CMAP<S2SV_blank>box\\n" ) ; goto error ; } } } if ( dec -> numchans != jas_image_numcmpts ( dec -> image ) ) { jas_eprintf ( "error:<S2SV_blank>mismatch<S2SV_blank>in<S2SV_blank>number<S2SV_blank>of<S2SV_blank>components<S2SV_blank>(%d<S2SV_blank>!=<S2SV_blank>%d)\\n" , dec -> numchans , jas_image_numcmpts ( dec -> image ) ) ; goto error ; } for ( i = 0 ; i < JAS_CAST ( jas_uint , jas_image_numcmpts ( dec -> image ) ) ; ++ i ) { jas_image_setcmpttype ( dec -> image , i , JAS_IMAGE_CT_UNKNOWN ) ; } if ( dec -> cdef ) { for ( i = 0 ; i < dec -> cdef -> data . cdef . numchans ; ++ i ) { if ( dec -> cdef -> data . cdef . ents [ i ] . channo >= dec -> numchans ) { jas_eprintf ( "error:<S2SV_blank>invalid<S2SV_blank>channel<S2SV_blank>number<S2SV_blank>in<S2SV_blank>CDEF<S2SV_blank>box\\n" ) ; goto error ; } jas_image_setcmpttype ( dec -> image , dec -> chantocmptlut [ dec -> cdef -> data . cdef . ents [ i ] . channo ] , jp2_getct ( jas_image_clrspc ( dec -> image ) , dec -> cdef -> data . cdef . ents [ i ] . type , dec -> cdef -> data . cdef . ents [ i ] . assoc ) ) ; } } else { for ( i = 0 ; i < dec -> numchans ; ++ i ) { jas_image_setcmpttype ( dec -> image , dec -> chantocmptlut [ i ] , jp2_getct ( jas_image_clrspc ( dec -> image ) , 0 , i + 1 ) ) ; } } for ( i = jas_image_numcmpts ( dec -> image ) ; i > 0 ; -- i ) { if ( jas_image_cmpttype ( dec -> image , i - 1 ) == JAS_IMAGE_CT_UNKNOWN ) { jas_image_delcmpt ( dec -> image , i - 1 ) ; } } if ( ! jas_image_numcmpts ( dec -> image ) ) { jas_eprintf ( "error:<S2SV_blank>no<S2SV_blank>components\\n" ) ; goto error ; } # if 0 jas_eprintf ( "no<S2SV_blank>of<S2SV_blank>components<S2SV_blank>is<S2SV_blank>%d\\n" , jas_image_numcmpts ( dec -> image ) ) ; # endif image = dec -> image ; dec -> image = 0 ; jp2_dec_destroy ( dec ) ; return image ; error : if ( box ) { jp2_box_destroy ( box ) ; } if ( dec ) { jp2_dec_destroy ( dec ) ; } return 0 ; }
<S2SV_ModStart> { jas_eprintf ( "error:<S2SV_blank>number<S2SV_blank>of<S2SV_blank>components<S2SV_blank>mismatch<S2SV_blank>(IHDR)\\n" ) ; goto error <S2SV_ModEnd> ; } if <S2SV_ModStart> { jas_eprintf ( "error:<S2SV_blank>component<S2SV_blank>data<S2SV_blank>type<S2SV_blank>mismatch<S2SV_blank>(IHDR)\\n" ) ; goto error <S2SV_ModEnd> ; } if <S2SV_ModStart> , jas_image_numcmpts ( dec -> image ) ) ) { jas_eprintf ( "error:<S2SV_blank>number<S2SV_blank>of<S2SV_blank>components<S2SV_blank>mismatch<S2SV_blank>(BPCC)\\n" ) ; goto error <S2SV_ModEnd> ; } if <S2SV_ModStart> { jas_eprintf ( "error:<S2SV_blank>component<S2SV_blank>data<S2SV_blank>type<S2SV_blank>mismatch<S2SV_blank>(BPCC)\\n" ) ; goto error <S2SV_ModEnd> ; } }
jasper-software@jasper/41f214b121b837fa30d9ca5f2430212110f5cd9b
CVE-2021-26927
https://github.com/jasper-software/jasper/commit/41f214b121b837fa30d9ca5f2430212110f5cd9b
2021-02-23T20:15Z
317
CWE-119
CWE-119 date PGTYPESdate_from_asc ( char * str , char * * endptr ) { date dDate ; fsec_t fsec ; struct tm tt , * tm = & tt ; int dtype ; int nf ; char * field [ MAXDATEFIELDS ] ; int ftype [ MAXDATEFIELDS ] ; <S2SV_StartBug> char lowstr [ MAXDATELEN + 1 ] ; <S2SV_EndBug> char * realptr ; char * * ptr = ( endptr != NULL ) ? endptr : & realptr ; bool EuroDates = FALSE ; errno = 0 ; <S2SV_StartBug> if ( strlen ( str ) >= sizeof ( lowstr ) ) <S2SV_EndBug> { errno = PGTYPES_DATE_BAD_DATE ; return INT_MIN ; } if ( ParseDateTime ( str , lowstr , field , ftype , & nf , ptr ) != 0 || DecodeDateTime ( field , ftype , nf , & dtype , tm , & fsec , EuroDates ) != 0 ) { errno = PGTYPES_DATE_BAD_DATE ; return INT_MIN ; } switch ( dtype ) { case DTK_DATE : break ; case DTK_EPOCH : if ( GetEpochTime ( tm ) < 0 ) { errno = PGTYPES_DATE_BAD_DATE ; return INT_MIN ; } break ; default : errno = PGTYPES_DATE_BAD_DATE ; return INT_MIN ; } dDate = ( date2j ( tm -> tm_year , tm -> tm_mon , tm -> tm_mday ) - date2j ( 2000 , 1 , 1 ) ) ; return dDate ; }
<S2SV_ModStart> [ MAXDATELEN + MAXDATEFIELDS <S2SV_ModEnd> ] ; char <S2SV_ModStart> ( str ) > MAXDATELEN <S2SV_ModEnd> ) { errno
postgres@postgres/4318daecc959886d001a6e79c6ea853e8b1dfb4b
CVE-2014-0063
https://github.com/postgres/postgres/commit/4318daecc959886d001a6e79c6ea853e8b1dfb4b
2014-03-31T14:58Z
318
CWE-674
CWE-674 void js_RegExp_prototype_exec ( js_State * J , js_Regexp * re , const char * text ) { <S2SV_StartBug> int i ; <S2SV_EndBug> int opts ; Resub m ; opts = 0 ; if ( re -> flags & JS_REGEXP_G ) { if ( re -> last > strlen ( text ) ) { re -> last = 0 ; js_pushnull ( J ) ; return ; } if ( re -> last > 0 ) { text += re -> last ; opts |= REG_NOTBOL ; } } <S2SV_StartBug> if ( ! js_regexec ( re -> prog , text , & m , opts ) ) { <S2SV_EndBug> js_newarray ( J ) ; js_pushstring ( J , text ) ; js_setproperty ( J , - 2 , "input" ) ; js_pushnumber ( J , js_utfptrtoidx ( text , m . sub [ 0 ] . sp ) ) ; js_setproperty ( J , - 2 , "index" ) ; for ( i = 0 ; i < m . nsub ; ++ i ) { js_pushlstring ( J , m . sub [ i ] . sp , m . sub [ i ] . ep - m . sub [ i ] . sp ) ; js_setindex ( J , - 2 , i ) ; } if ( re -> flags & JS_REGEXP_G ) re -> last = re -> last + ( m . sub [ 0 ] . ep - text ) ; return ; } if ( re -> flags & JS_REGEXP_G ) re -> last = 0 ; js_pushnull ( J ) ; }
<S2SV_ModStart> ) { int result ; int <S2SV_ModStart> ; } } result = <S2SV_ModEnd> js_regexec ( re <S2SV_ModStart> , opts ) ; if ( result < 0 ) js_error ( J , "regexec<S2SV_blank>failed" ) ; if ( result == 0
ccxvii@mujs/00d4606c3baf813b7b1c176823b2729bf51002a2
CVE-2019-11413
https://github.com/ccxvii/mujs/commit/00d4606c3baf813b7b1c176823b2729bf51002a2
2019-04-22T11:29Z
319
CWE-125
CWE-125 static struct pid * good_sigevent ( sigevent_t * event ) { struct task_struct * rtn = current -> group_leader ; <S2SV_StartBug> if ( ( event -> sigev_notify & SIGEV_THREAD_ID ) && <S2SV_EndBug> <S2SV_StartBug> ( ! ( rtn = find_task_by_vpid ( event -> sigev_notify_thread_id ) ) || <S2SV_EndBug> <S2SV_StartBug> ! same_thread_group ( rtn , current ) || <S2SV_EndBug> ( event -> sigev_notify & ~ SIGEV_THREAD_ID ) != SIGEV_SIGNAL ) ) return NULL ; <S2SV_StartBug> if ( ( ( event -> sigev_notify & ~ SIGEV_THREAD_ID ) != SIGEV_NONE ) && <S2SV_EndBug> <S2SV_StartBug> ( ( event -> sigev_signo <= 0 ) || ( event -> sigev_signo > SIGRTMAX ) ) ) <S2SV_EndBug> <S2SV_StartBug> return NULL ; <S2SV_EndBug> return task_pid ( rtn ) ; <S2SV_StartBug> } <S2SV_EndBug>
<S2SV_ModStart> -> group_leader ; switch <S2SV_ModEnd> ( event -> <S2SV_ModStart> event -> sigev_notify ) { case SIGEV_SIGNAL | SIGEV_THREAD_ID : <S2SV_ModEnd> rtn = find_task_by_vpid <S2SV_ModStart> -> sigev_notify_thread_id ) ; if ( ! rtn <S2SV_ModEnd> || ! same_thread_group <S2SV_ModStart> , current ) <S2SV_ModEnd> ) return NULL <S2SV_ModStart> return NULL ; case SIGEV_SIGNAL : case SIGEV_THREAD : if <S2SV_ModEnd> ( event -> <S2SV_ModStart> sigev_signo <= 0 || <S2SV_ModEnd> event -> sigev_signo <S2SV_ModStart> > SIGRTMAX ) <S2SV_ModEnd> return NULL ; <S2SV_ModStart> return NULL ; case SIGEV_NONE : <S2SV_ModStart> rtn ) ; default : return NULL ; }
torvalds@linux/cef31d9af908243421258f1df35a4a644604efbe
CVE-2017-18344
https://github.com/torvalds/linux/commit/cef31d9af908243421258f1df35a4a644604efbe
2018-07-26T19:29Z
320
CWE-264
CWE-264 int _fep_open_control_socket ( Fep * fep ) { struct sockaddr_un sun ; char * path ; int fd ; ssize_t sun_len ; fd = socket ( AF_UNIX , SOCK_STREAM , 0 ) ; if ( fd < 0 ) { perror ( "socket" ) ; return - 1 ; } path = create_socket_name ( "fep-XXXXXX/control" ) ; if ( strlen ( path ) + 1 >= sizeof ( sun . sun_path ) ) { fep_log ( FEP_LOG_LEVEL_WARNING , "unix<S2SV_blank>domain<S2SV_blank>socket<S2SV_blank>path<S2SV_blank>too<S2SV_blank>long:<S2SV_blank>%d<S2SV_blank>+<S2SV_blank>1<S2SV_blank>>=<S2SV_blank>%d" , strlen ( path ) , sizeof ( sun . sun_path ) ) ; free ( path ) ; return - 1 ; } memset ( & sun , 0 , sizeof ( sun ) ) ; sun . sun_family = AF_UNIX ; <S2SV_StartBug> # ifdef __linux__ <S2SV_EndBug> <S2SV_StartBug> sun . sun_path [ 0 ] = '\\0' ; <S2SV_EndBug> memcpy ( sun . sun_path + 1 , path , strlen ( path ) ) ; <S2SV_StartBug> sun_len = offsetof ( struct sockaddr_un , sun_path ) + strlen ( path ) + 1 ; <S2SV_EndBug> remove_control_socket ( path ) ; # else memcpy ( sun . sun_path , path , strlen ( path ) ) ; sun_len = sizeof ( struct sockaddr_un ) ; # endif if ( bind ( fd , ( const struct sockaddr * ) & sun , sun_len ) < 0 ) { perror ( "bind" ) ; free ( path ) ; close ( fd ) ; return - 1 ; } if ( listen ( fd , 5 ) < 0 ) { perror ( "listen" ) ; free ( path ) ; close ( fd ) ; return - 1 ; } fep -> server = fd ; fep -> control_socket_path = path ; return 0 ; }
<S2SV_ModStart> = AF_UNIX ; memcpy ( <S2SV_ModEnd> sun . sun_path <S2SV_ModStart> sun . sun_path <S2SV_ModEnd> , path , <S2SV_ModStart> ; sun_len = sizeof <S2SV_ModEnd> ( struct sockaddr_un <S2SV_ModStart> ( struct sockaddr_un ) ; <S2SV_ModEnd> if ( bind
ueno@libfep/293d9d3f7565f01a9dc40b53259886832eaa2ace
CVE-2014-3980
https://github.com/ueno/libfep/commit/293d9d3f
2014-06-11T14:55Z
321
CWE-787
CWE-787 int rds_rdma_extra_size ( struct rds_rdma_args * args ) { struct rds_iovec vec ; struct rds_iovec __user * local_vec ; int tot_pages = 0 ; unsigned int nr_pages ; unsigned int i ; <S2SV_StartBug> local_vec = ( struct rds_iovec __user * ) ( unsigned long ) args -> local_vec_addr ; <S2SV_EndBug> for ( i = 0 ; i < args -> nr_local ; i ++ ) { if ( copy_from_user ( & vec , & local_vec [ i ] , sizeof ( struct rds_iovec ) ) ) return - EFAULT ; nr_pages = rds_pages_in_vec ( & vec ) ; if ( nr_pages == 0 ) return - EINVAL ; tot_pages += nr_pages ; if ( tot_pages < 0 ) return - EINVAL ; } return tot_pages * sizeof ( struct scatterlist ) ; }
<S2SV_ModStart> args -> local_vec_addr ; if ( args -> nr_local == 0 ) return - EINVAL
torvalds@linux/c095508770aebf1b9218e77026e48345d719b17c
CVE-2018-5332
https://github.com/torvalds/linux/commit/c095508770aebf1b9218e77026e48345d719b17c
2018-01-11T07:29Z
322
CWE-119
CWE-119 int vp8_yv12_de_alloc_frame_buffer ( YV12_BUFFER_CONFIG * ybf ) { if ( ybf ) { if ( ybf -> buffer_alloc_sz > 0 ) { vpx_free ( ybf -> buffer_alloc ) ; } <S2SV_StartBug> vpx_memset ( ybf , 0 , sizeof ( YV12_BUFFER_CONFIG ) ) ; <S2SV_EndBug> } else { return - 1 ; } return 0 ; }
<S2SV_ModStart> ) ; } memset <S2SV_ModEnd> ( ybf ,
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
323
CWE-345
CWE-345 rpmRC rpmReadPackageFile ( rpmts ts , FD_t fd , const char * fn , Header * hdrp ) { char * msg = NULL ; Header h = NULL ; Header sigh = NULL ; hdrblob blob = NULL ; hdrblob sigblob = NULL ; rpmVSFlags vsflags = rpmtsVSFlags ( ts ) | RPMVSF_NEEDPAYLOAD ; rpmKeyring keyring = rpmtsGetKeyring ( ts , 1 ) ; struct rpmvs_s * vs = rpmvsCreate ( 0 , vsflags , keyring ) ; struct pkgdata_s pkgdata = { . msgfunc = loghdrmsg , . fn = fn ? fn : Fdescr ( fd ) , . msg = NULL , . rc = RPMRC_OK , } ; if ( hdrp ) * hdrp = NULL ; rpmRC rc = rpmpkgRead ( vs , fd , & sigblob , & blob , & msg ) ; if ( rc ) goto exit ; rc = RPMRC_FAIL ; if ( ! rpmvsVerify ( vs , RPMSIG_VERIFIABLE_TYPE , handleHdrVS , & pkgdata ) ) { if ( hdrp ) { if ( hdrblobImport ( sigblob , 0 , & sigh , & msg ) ) goto exit ; if ( hdrblobImport ( blob , 0 , & h , & msg ) ) goto exit ; <S2SV_StartBug> headerMergeLegacySigs ( h , sigh ) ; <S2SV_EndBug> applyRetrofits ( h ) ; * hdrp = headerLink ( h ) ; } rc = RPMRC_OK ; } if ( rc == RPMRC_OK && pkgdata . rc ) rc = pkgdata . rc ; exit : if ( rc && msg ) rpmlog ( RPMLOG_ERR , "%s:<S2SV_blank>%s\\n" , Fdescr ( fd ) , msg ) ; hdrblobFree ( sigblob ) ; hdrblobFree ( blob ) ; headerFree ( sigh ) ; headerFree ( h ) ; rpmKeyringFree ( keyring ) ; rpmvsFree ( vs ) ; free ( msg ) ; return rc ; }
<S2SV_ModStart> goto exit ; if ( <S2SV_ModStart> h , sigh , & msg ) ) goto exit <S2SV_ModEnd> ; applyRetrofits (
rpm-software-management@rpm/d6a86b5e69e46cc283b1e06c92343319beb42e21
CVE-2021-20271
https://github.com/rpm-software-management/rpm/commit/d6a86b5e69e46cc283b1e06c92343319beb42e21
2021-03-26T17:15Z
324
CWE-000
CWE-000 static void ip_expire ( unsigned long arg ) { struct ipq * qp ; struct net * net ; qp = container_of ( ( struct inet_frag_queue * ) arg , struct ipq , q ) ; net = container_of ( qp -> q . net , struct net , ipv4 . frags ) ; spin_lock ( & qp -> q . lock ) ; if ( qp -> q . last_in & INET_FRAG_COMPLETE ) goto out ; ipq_kill ( qp ) ; IP_INC_STATS_BH ( net , IPSTATS_MIB_REASMTIMEOUT ) ; IP_INC_STATS_BH ( net , IPSTATS_MIB_REASMFAILS ) ; if ( ( qp -> q . last_in & INET_FRAG_FIRST_IN ) && qp -> q . fragments != NULL ) { struct sk_buff * head = qp -> q . fragments ; <S2SV_StartBug> rcu_read_lock ( ) ; <S2SV_EndBug> head -> dev = dev_get_by_index_rcu ( net , qp -> iif ) ; <S2SV_StartBug> if ( ! head -> dev ) <S2SV_EndBug> goto out_rcu_unlock ; <S2SV_StartBug> if ( qp -> user == IP_DEFRAG_CONNTRACK_IN && ! skb_dst ( head ) ) { <S2SV_EndBug> const struct iphdr * iph = ip_hdr ( head ) ; int err = ip_route_input ( head , iph -> daddr , iph -> saddr , iph -> tos , head -> dev ) ; if ( unlikely ( err ) ) goto out_rcu_unlock ; if ( skb_rtable ( head ) -> rt_type != RTN_LOCAL ) goto out_rcu_unlock ; <S2SV_StartBug> } <S2SV_EndBug> icmp_send ( head , ICMP_TIME_EXCEEDED , ICMP_EXC_FRAGTIME , 0 ) ; out_rcu_unlock : rcu_read_unlock ( ) ; } out : spin_unlock ( & qp -> q . lock ) ; ipq_put ( qp ) ; }
<S2SV_ModStart> . fragments ; const struct iphdr * iph ; int err ; <S2SV_ModStart> head -> dev ) goto out_rcu_unlock ; skb_dst_drop ( head ) ; iph = ip_hdr ( head ) ; err = ip_route_input_noref ( head , iph -> daddr , iph -> saddr , iph -> tos , head -> dev ) ; if ( err <S2SV_ModStart> == IP_DEFRAG_CONNTRACK_IN && <S2SV_ModEnd> skb_rtable ( head <S2SV_ModStart> goto out_rcu_unlock ; <S2SV_ModEnd> icmp_send ( head
torvalds@linux/64f3b9e203bd06855072e295557dca1485a2ecba
CVE-2011-1927
https://github.com/torvalds/linux/commit/64f3b9e203bd06855072e295557dca1485a2ecba
2012-06-13T10:24Z
325
CWE-125
CWE-125 static int adjust_scalar_min_max_vals ( struct bpf_verifier_env * env , struct bpf_insn * insn , struct bpf_reg_state * dst_reg , struct bpf_reg_state src_reg ) { struct bpf_reg_state * regs = cur_regs ( env ) ; u8 opcode = BPF_OP ( insn -> code ) ; bool src_known , dst_known ; s64 smin_val , smax_val ; u64 umin_val , umax_val ; <S2SV_StartBug> u64 insn_bitness = ( BPF_CLASS ( insn -> code ) == BPF_ALU64 ) ? 64 : 32 ; <S2SV_EndBug> smin_val = src_reg . smin_value ; smax_val = src_reg . smax_value ; umin_val = src_reg . umin_value ; umax_val = src_reg . umax_value ; src_known = tnum_is_const ( src_reg . var_off ) ; dst_known = tnum_is_const ( dst_reg -> var_off ) ; if ( ( src_known && ( smin_val != smax_val || umin_val != umax_val ) ) || smin_val > smax_val || umin_val > umax_val ) { __mark_reg_unknown ( dst_reg ) ; return 0 ; } if ( ! src_known && opcode != BPF_ADD && opcode != BPF_SUB && opcode != BPF_AND ) { __mark_reg_unknown ( dst_reg ) ; return 0 ; } switch ( opcode ) { case BPF_ADD : if ( signed_add_overflows ( dst_reg -> smin_value , smin_val ) || signed_add_overflows ( dst_reg -> smax_value , smax_val ) ) { dst_reg -> smin_value = S64_MIN ; dst_reg -> smax_value = S64_MAX ; } else { dst_reg -> smin_value += smin_val ; dst_reg -> smax_value += smax_val ; } if ( dst_reg -> umin_value + umin_val < umin_val || dst_reg -> umax_value + umax_val < umax_val ) { dst_reg -> umin_value = 0 ; dst_reg -> umax_value = U64_MAX ; } else { dst_reg -> umin_value += umin_val ; dst_reg -> umax_value += umax_val ; } dst_reg -> var_off = tnum_add ( dst_reg -> var_off , src_reg . var_off ) ; break ; case BPF_SUB : if ( signed_sub_overflows ( dst_reg -> smin_value , smax_val ) || signed_sub_overflows ( dst_reg -> smax_value , smin_val ) ) { dst_reg -> smin_value = S64_MIN ; dst_reg -> smax_value = S64_MAX ; } else { dst_reg -> smin_value -= smax_val ; dst_reg -> smax_value -= smin_val ; } if ( dst_reg -> umin_value < umax_val ) { dst_reg -> umin_value = 0 ; dst_reg -> umax_value = U64_MAX ; } else { dst_reg -> umin_value -= umax_val ; dst_reg -> umax_value -= umin_val ; } dst_reg -> var_off = tnum_sub ( dst_reg -> var_off , src_reg . var_off ) ; break ; case BPF_MUL : dst_reg -> var_off = tnum_mul ( dst_reg -> var_off , src_reg . var_off ) ; if ( smin_val < 0 || dst_reg -> smin_value < 0 ) { __mark_reg_unbounded ( dst_reg ) ; __update_reg_bounds ( dst_reg ) ; break ; } if ( umax_val > U32_MAX || dst_reg -> umax_value > U32_MAX ) { __mark_reg_unbounded ( dst_reg ) ; __update_reg_bounds ( dst_reg ) ; break ; } dst_reg -> umin_value *= umin_val ; dst_reg -> umax_value *= umax_val ; if ( dst_reg -> umax_value > S64_MAX ) { dst_reg -> smin_value = S64_MIN ; dst_reg -> smax_value = S64_MAX ; } else { dst_reg -> smin_value = dst_reg -> umin_value ; dst_reg -> smax_value = dst_reg -> umax_value ; } break ; case BPF_AND : if ( src_known && dst_known ) { __mark_reg_known ( dst_reg , dst_reg -> var_off . value & src_reg . var_off . value ) ; break ; } dst_reg -> var_off = tnum_and ( dst_reg -> var_off , src_reg . var_off ) ; dst_reg -> umin_value = dst_reg -> var_off . value ; dst_reg -> umax_value = min ( dst_reg -> umax_value , umax_val ) ; if ( dst_reg -> smin_value < 0 || smin_val < 0 ) { dst_reg -> smin_value = S64_MIN ; dst_reg -> smax_value = S64_MAX ; } else { dst_reg -> smin_value = dst_reg -> umin_value ; dst_reg -> smax_value = dst_reg -> umax_value ; } __update_reg_bounds ( dst_reg ) ; break ; case BPF_OR : if ( src_known && dst_known ) { __mark_reg_known ( dst_reg , dst_reg -> var_off . value | src_reg . var_off . value ) ; break ; } dst_reg -> var_off = tnum_or ( dst_reg -> var_off , src_reg . var_off ) ; dst_reg -> umin_value = max ( dst_reg -> umin_value , umin_val ) ; dst_reg -> umax_value = dst_reg -> var_off . value | dst_reg -> var_off . mask ; if ( dst_reg -> smin_value < 0 || smin_val < 0 ) { dst_reg -> smin_value = S64_MIN ; dst_reg -> smax_value = S64_MAX ; } else { dst_reg -> smin_value = dst_reg -> umin_value ; dst_reg -> smax_value = dst_reg -> umax_value ; } __update_reg_bounds ( dst_reg ) ; break ; case BPF_LSH : if ( umax_val >= insn_bitness ) { mark_reg_unknown ( env , regs , insn -> dst_reg ) ; break ; } dst_reg -> smin_value = S64_MIN ; dst_reg -> smax_value = S64_MAX ; if ( dst_reg -> umax_value > 1ULL << ( 63 - umax_val ) ) { dst_reg -> umin_value = 0 ; dst_reg -> umax_value = U64_MAX ; } else { dst_reg -> umin_value <<= umin_val ; dst_reg -> umax_value <<= umax_val ; } dst_reg -> var_off = tnum_lshift ( dst_reg -> var_off , umin_val ) ; __update_reg_bounds ( dst_reg ) ; break ; case BPF_RSH : if ( umax_val >= insn_bitness ) { mark_reg_unknown ( env , regs , insn -> dst_reg ) ; break ; } dst_reg -> smin_value = S64_MIN ; dst_reg -> smax_value = S64_MAX ; dst_reg -> var_off = tnum_rshift ( dst_reg -> var_off , umin_val ) ; dst_reg -> umin_value >>= umax_val ; dst_reg -> umax_value >>= umin_val ; __update_reg_bounds ( dst_reg ) ; break ; case BPF_ARSH : if ( umax_val >= insn_bitness ) { mark_reg_unknown ( env , regs , insn -> dst_reg ) ; break ; } dst_reg -> smin_value >>= umin_val ; dst_reg -> smax_value >>= umin_val ; dst_reg -> var_off = tnum_arshift ( dst_reg -> var_off , umin_val ) ; dst_reg -> umin_value = 0 ; dst_reg -> umax_value = U64_MAX ; __update_reg_bounds ( dst_reg ) ; break ; default : mark_reg_unknown ( env , regs , insn -> dst_reg ) ; break ; } if ( BPF_CLASS ( insn -> code ) != BPF_ALU64 ) { coerce_reg_to_size ( dst_reg , 4 ) ; <S2SV_StartBug> coerce_reg_to_size ( & src_reg , 4 ) ; <S2SV_EndBug> } __reg_deduce_bounds ( dst_reg ) ; __reg_bound_offset ( dst_reg ) ; return 0 ; }
<S2SV_ModStart> : 32 ; if ( insn_bitness == 32 ) { coerce_reg_to_size ( dst_reg , 4 ) ; coerce_reg_to_size ( & src_reg , 4 ) ; } <S2SV_ModStart> 4 ) ; <S2SV_ModEnd> } __reg_deduce_bounds (
torvalds@linux/b799207e1e1816b09e7a5920fbb2d5fcf6edd681
CVE-2018-18445
https://github.com/torvalds/linux/commit/b799207e1e1816b09e7a5920fbb2d5fcf6edd681
2018-10-17T19:29Z
326
CWE-362
CWE-362 void ieee80211_sta_ps_deliver_wakeup ( struct sta_info * sta ) { struct ieee80211_sub_if_data * sdata = sta -> sdata ; struct ieee80211_local * local = sdata -> local ; struct sk_buff_head pending ; int filtered = 0 , buffered = 0 , ac ; unsigned long flags ; clear_sta_flag ( sta , WLAN_STA_SP ) ; BUILD_BUG_ON ( BITS_TO_LONGS ( IEEE80211_NUM_TIDS ) > 1 ) ; sta -> driver_buffered_tids = 0 ; if ( ! ( local -> hw . flags & IEEE80211_HW_AP_LINK_PS ) ) drv_sta_notify ( local , sdata , STA_NOTIFY_AWAKE , & sta -> sta ) ; skb_queue_head_init ( & pending ) ; <S2SV_StartBug> for ( ac = 0 ; ac < IEEE80211_NUM_ACS ; ac ++ ) { <S2SV_EndBug> int count = skb_queue_len ( & pending ) , tmp ; spin_lock_irqsave ( & sta -> tx_filtered [ ac ] . lock , flags ) ; skb_queue_splice_tail_init ( & sta -> tx_filtered [ ac ] , & pending ) ; spin_unlock_irqrestore ( & sta -> tx_filtered [ ac ] . lock , flags ) ; tmp = skb_queue_len ( & pending ) ; filtered += tmp - count ; count = tmp ; spin_lock_irqsave ( & sta -> ps_tx_buf [ ac ] . lock , flags ) ; skb_queue_splice_tail_init ( & sta -> ps_tx_buf [ ac ] , & pending ) ; spin_unlock_irqrestore ( & sta -> ps_tx_buf [ ac ] . lock , flags ) ; tmp = skb_queue_len ( & pending ) ; buffered += tmp - count ; } <S2SV_StartBug> ieee80211_add_pending_skbs_fn ( local , & pending , clear_sta_ps_flags , sta ) ; <S2SV_EndBug> if ( ! ieee80211_smps_is_restrictive ( sta -> known_smps_mode , sdata -> smps_mode ) && sta -> known_smps_mode != sdata -> bss -> req_smps && sta_info_tx_streams ( sta ) != 1 ) { ht_dbg ( sdata , "%pM<S2SV_blank>just<S2SV_blank>woke<S2SV_blank>up<S2SV_blank>and<S2SV_blank>MIMO<S2SV_blank>capable<S2SV_blank>-<S2SV_blank>update<S2SV_blank>SMPS\\n" , sta -> sta . addr ) ; ieee80211_send_smps_action ( sdata , sdata -> bss -> req_smps , sta -> sta . addr , sdata -> vif . bss_conf . bssid ) ; } local -> total_ps_buffered -= buffered ; sta_info_recalc_tim ( sta ) ; ps_dbg ( sdata , "STA<S2SV_blank>%pM<S2SV_blank>aid<S2SV_blank>%d<S2SV_blank>sending<S2SV_blank>%d<S2SV_blank>filtered/%d<S2SV_blank>PS<S2SV_blank>frames<S2SV_blank>since<S2SV_blank>STA<S2SV_blank>not<S2SV_blank>sleeping<S2SV_blank>anymore\\n" , sta -> sta . addr , sta -> sta . aid , filtered , buffered ) ; }
<S2SV_ModStart> pending ) ; spin_lock ( & sta -> ps_lock ) ; <S2SV_ModStart> clear_sta_ps_flags , sta ) ; spin_unlock ( & sta -> ps_lock
torvalds@linux/1d147bfa64293b2723c4fec50922168658e613ba
CVE-2014-2706
https://github.com/torvalds/linux/commit/1d147bfa64293b2723c4fec50922168658e613ba
2014-04-14T23:55Z
327
CWE-119
CWE-119 void iperf_on_connect ( struct iperf_test * test ) { time_t now_secs ; const char * rfc1123_fmt = "%a,<S2SV_blank>%d<S2SV_blank>%b<S2SV_blank>%Y<S2SV_blank>%H:%M:%S<S2SV_blank>GMT" ; char now_str [ 100 ] ; char ipr [ INET6_ADDRSTRLEN ] ; int port ; struct sockaddr_storage sa ; struct sockaddr_in * sa_inP ; struct sockaddr_in6 * sa_in6P ; socklen_t len ; int opt ; now_secs = time ( ( time_t * ) 0 ) ; ( void ) strftime ( now_str , sizeof ( now_str ) , rfc1123_fmt , gmtime ( & now_secs ) ) ; if ( test -> json_output ) cJSON_AddItemToObject ( test -> json_start , "timestamp" , iperf_json_printf ( "time:<S2SV_blank>%s<S2SV_blank><S2SV_blank>timesecs:<S2SV_blank>%d" , now_str , ( int64_t ) now_secs ) ) ; else if ( test -> verbose ) iprintf ( test , report_time , now_str ) ; if ( test -> role == 'c' ) { if ( test -> json_output ) cJSON_AddItemToObject ( test -> json_start , "connecting_to" , iperf_json_printf ( "host:<S2SV_blank>%s<S2SV_blank><S2SV_blank>port:<S2SV_blank>%d" , test -> server_hostname , ( int64_t ) test -> server_port ) ) ; else { iprintf ( test , report_connecting , test -> server_hostname , test -> server_port ) ; if ( test -> reverse ) iprintf ( test , report_reverse , test -> server_hostname ) ; } } else { len = sizeof ( sa ) ; getpeername ( test -> ctrl_sck , ( struct sockaddr * ) & sa , & len ) ; if ( getsockdomain ( test -> ctrl_sck ) == AF_INET ) { sa_inP = ( struct sockaddr_in * ) & sa ; inet_ntop ( AF_INET , & sa_inP -> sin_addr , ipr , sizeof ( ipr ) ) ; port = ntohs ( sa_inP -> sin_port ) ; } else { sa_in6P = ( struct sockaddr_in6 * ) & sa ; inet_ntop ( AF_INET6 , & sa_in6P -> sin6_addr , ipr , sizeof ( ipr ) ) ; port = ntohs ( sa_in6P -> sin6_port ) ; } mapped_v4_to_regular_v4 ( ipr ) ; if ( test -> json_output ) cJSON_AddItemToObject ( test -> json_start , "accepted_connection" , iperf_json_printf ( "host:<S2SV_blank>%s<S2SV_blank><S2SV_blank>port:<S2SV_blank>%d" , ipr , ( int64_t ) port ) ) ; else iprintf ( test , report_accepted , ipr , port ) ; } if ( test -> json_output ) { cJSON_AddStringToObject ( test -> json_start , "cookie" , test -> cookie ) ; if ( test -> protocol -> id == SOCK_STREAM ) { if ( test -> settings -> mss ) <S2SV_StartBug> cJSON_AddIntToObject ( test -> json_start , "tcp_mss" , test -> settings -> mss ) ; <S2SV_EndBug> else { len = sizeof ( opt ) ; getsockopt ( test -> ctrl_sck , IPPROTO_TCP , TCP_MAXSEG , & opt , & len ) ; <S2SV_StartBug> cJSON_AddIntToObject ( test -> json_start , "tcp_mss_default" , opt ) ; <S2SV_EndBug> } } } else if ( test -> verbose ) { iprintf ( test , report_cookie , test -> cookie ) ; if ( test -> protocol -> id == SOCK_STREAM ) { if ( test -> settings -> mss ) iprintf ( test , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>TCP<S2SV_blank>MSS:<S2SV_blank>%d\\n" , test -> settings -> mss ) ; else { len = sizeof ( opt ) ; getsockopt ( test -> ctrl_sck , IPPROTO_TCP , TCP_MAXSEG , & opt , & len ) ; iprintf ( test , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>TCP<S2SV_blank>MSS:<S2SV_blank>%d<S2SV_blank>(default)\\n" , opt ) ; } } } }
<S2SV_ModStart> -> mss ) cJSON_AddNumberToObject <S2SV_ModEnd> ( test -> <S2SV_ModStart> len ) ; cJSON_AddNumberToObject <S2SV_ModEnd> ( test ->
esnet@iperf/91f2fa59e8ed80dfbf400add0164ee0e508e412a
CVE-2016-4303
https://github.com/esnet/iperf/commit/91f2fa59e8ed80dfbf400add0164ee0e508e412a
2016-09-26T14:59Z
328
CWE-476
CWE-476 sctp_disposition_t sctp_sf_do_5_1D_ce ( struct net * net , const struct sctp_endpoint * ep , const struct sctp_association * asoc , const sctp_subtype_t type , void * arg , sctp_cmd_seq_t * commands ) { struct sctp_chunk * chunk = arg ; struct sctp_association * new_asoc ; sctp_init_chunk_t * peer_init ; struct sctp_chunk * repl ; struct sctp_ulpevent * ev , * ai_ev = NULL ; int error = 0 ; struct sctp_chunk * err_chk_p ; struct sock * sk ; if ( ep == sctp_sk ( net -> sctp . ctl_sock ) -> ep ) { SCTP_INC_STATS ( net , SCTP_MIB_OUTOFBLUES ) ; return sctp_sf_tabort_8_4_8 ( net , ep , asoc , type , arg , commands ) ; } if ( ! sctp_chunk_length_valid ( chunk , sizeof ( sctp_chunkhdr_t ) ) ) return sctp_sf_pdiscard ( net , ep , asoc , type , arg , commands ) ; sk = ep -> base . sk ; if ( ! sctp_sstate ( sk , LISTENING ) || ( sctp_style ( sk , TCP ) && sk_acceptq_is_full ( sk ) ) ) return sctp_sf_tabort_8_4_8 ( net , ep , asoc , type , arg , commands ) ; chunk -> subh . cookie_hdr = ( struct sctp_signed_cookie * ) chunk -> skb -> data ; if ( ! pskb_pull ( chunk -> skb , ntohs ( chunk -> chunk_hdr -> length ) - sizeof ( sctp_chunkhdr_t ) ) ) goto nomem ; new_asoc = sctp_unpack_cookie ( ep , asoc , chunk , GFP_ATOMIC , & error , & err_chk_p ) ; if ( ! new_asoc ) { switch ( error ) { case - SCTP_IERROR_NOMEM : goto nomem ; case - SCTP_IERROR_STALE_COOKIE : sctp_send_stale_cookie_err ( net , ep , asoc , chunk , commands , err_chk_p ) ; return sctp_sf_pdiscard ( net , ep , asoc , type , arg , commands ) ; case - SCTP_IERROR_BAD_SIG : default : return sctp_sf_pdiscard ( net , ep , asoc , type , arg , commands ) ; } } peer_init = & chunk -> subh . cookie_hdr -> c . peer_init [ 0 ] ; if ( ! sctp_process_init ( new_asoc , chunk , & chunk -> subh . cookie_hdr -> c . peer_addr , peer_init , GFP_ATOMIC ) ) goto nomem_init ; error = sctp_auth_asoc_init_active_key ( new_asoc , GFP_ATOMIC ) ; if ( error ) goto nomem_init ; if ( chunk -> auth_chunk ) { struct sctp_chunk auth ; sctp_ierror_t ret ; <S2SV_StartBug> auth . skb = chunk -> auth_chunk ; <S2SV_EndBug> auth . asoc = chunk -> asoc ; auth . sctp_hdr = chunk -> sctp_hdr ; auth . chunk_hdr = ( sctp_chunkhdr_t * ) skb_push ( chunk -> auth_chunk , sizeof ( sctp_chunkhdr_t ) ) ; skb_pull ( chunk -> auth_chunk , sizeof ( sctp_chunkhdr_t ) ) ; auth . transport = chunk -> transport ; ret = sctp_sf_authenticate ( net , ep , new_asoc , type , & auth ) ; kfree_skb ( chunk -> auth_chunk ) ; if ( ret != SCTP_IERROR_NO_ERROR ) { sctp_association_free ( new_asoc ) ; return sctp_sf_pdiscard ( net , ep , asoc , type , arg , commands ) ; } } repl = sctp_make_cookie_ack ( new_asoc , chunk ) ; if ( ! repl ) goto nomem_init ; ev = sctp_ulpevent_make_assoc_change ( new_asoc , 0 , SCTP_COMM_UP , 0 , new_asoc -> c . sinit_num_ostreams , new_asoc -> c . sinit_max_instreams , NULL , GFP_ATOMIC ) ; if ( ! ev ) goto nomem_ev ; if ( new_asoc -> peer . adaptation_ind ) { ai_ev = sctp_ulpevent_make_adaptation_indication ( new_asoc , GFP_ATOMIC ) ; if ( ! ai_ev ) goto nomem_aiev ; } sctp_add_cmd_sf ( commands , SCTP_CMD_NEW_ASOC , SCTP_ASOC ( new_asoc ) ) ; sctp_add_cmd_sf ( commands , SCTP_CMD_NEW_STATE , SCTP_STATE ( SCTP_STATE_ESTABLISHED ) ) ; SCTP_INC_STATS ( net , SCTP_MIB_CURRESTAB ) ; SCTP_INC_STATS ( net , SCTP_MIB_PASSIVEESTABS ) ; sctp_add_cmd_sf ( commands , SCTP_CMD_HB_TIMERS_START , SCTP_NULL ( ) ) ; if ( new_asoc -> timeouts [ SCTP_EVENT_TIMEOUT_AUTOCLOSE ] ) sctp_add_cmd_sf ( commands , SCTP_CMD_TIMER_START , SCTP_TO ( SCTP_EVENT_TIMEOUT_AUTOCLOSE ) ) ; sctp_add_cmd_sf ( commands , SCTP_CMD_REPLY , SCTP_CHUNK ( repl ) ) ; sctp_add_cmd_sf ( commands , SCTP_CMD_EVENT_ULP , SCTP_ULPEVENT ( ev ) ) ; if ( ai_ev ) sctp_add_cmd_sf ( commands , SCTP_CMD_EVENT_ULP , SCTP_ULPEVENT ( ai_ev ) ) ; return SCTP_DISPOSITION_CONSUME ; nomem_aiev : sctp_ulpevent_free ( ev ) ; nomem_ev : sctp_chunk_free ( repl ) ; nomem_init : sctp_association_free ( new_asoc ) ; nomem : return SCTP_DISPOSITION_NOMEM ; }
<S2SV_ModStart> sctp_ierror_t ret ; if ( ! net -> sctp . auth_enable || ! new_asoc -> peer . auth_capable ) { kfree_skb ( chunk -> auth_chunk ) ; sctp_association_free ( new_asoc ) ; return sctp_sf_pdiscard ( net , ep , asoc , type , arg , commands ) ; }
torvalds@linux/ec0223ec48a90cb605244b45f7c62de856403729
CVE-2014-0101
https://github.com/torvalds/linux/commit/ec0223ec48a90cb605244b45f7c62de856403729
2014-03-11T13:01Z
329
CWE-416
CWE-416 int fscrypt_setup_filename ( struct inode * dir , const struct qstr * iname , int lookup , struct fscrypt_name * fname ) { int ret = 0 , bigname = 0 ; memset ( fname , 0 , sizeof ( struct fscrypt_name ) ) ; fname -> usr_fname = iname ; if ( ! dir -> i_sb -> s_cop -> is_encrypted ( dir ) || fscrypt_is_dot_dotdot ( iname ) ) { fname -> disk_name . name = ( unsigned char * ) iname -> name ; fname -> disk_name . len = iname -> len ; return 0 ; } <S2SV_StartBug> ret = fscrypt_get_crypt_info ( dir ) ; <S2SV_EndBug> if ( ret && ret != - EOPNOTSUPP ) return ret ; if ( dir -> i_crypt_info ) { ret = fscrypt_fname_alloc_buffer ( dir , iname -> len , & fname -> crypto_buf ) ; if ( ret ) return ret ; ret = fname_encrypt ( dir , iname , & fname -> crypto_buf ) ; if ( ret ) goto errout ; fname -> disk_name . name = fname -> crypto_buf . name ; fname -> disk_name . len = fname -> crypto_buf . len ; return 0 ; } if ( ! lookup ) return - ENOKEY ; if ( iname -> name [ 0 ] == '_' ) bigname = 1 ; if ( ( bigname && ( iname -> len != 33 ) ) || ( ! bigname && ( iname -> len > 43 ) ) ) return - ENOENT ; fname -> crypto_buf . name = kmalloc ( 32 , GFP_KERNEL ) ; if ( fname -> crypto_buf . name == NULL ) return - ENOMEM ; ret = digest_decode ( iname -> name + bigname , iname -> len - bigname , fname -> crypto_buf . name ) ; if ( ret < 0 ) { ret = - ENOENT ; goto errout ; } fname -> crypto_buf . len = ret ; if ( bigname ) { memcpy ( & fname -> hash , fname -> crypto_buf . name , 4 ) ; memcpy ( & fname -> minor_hash , fname -> crypto_buf . name + 4 , 4 ) ; } else { fname -> disk_name . name = fname -> crypto_buf . name ; fname -> disk_name . len = fname -> crypto_buf . len ; } return 0 ; errout : fscrypt_fname_free_buffer ( & fname -> crypto_buf ) ; return ret ; }
<S2SV_ModStart> } ret = fscrypt_get_encryption_info <S2SV_ModEnd> ( dir )
torvalds@linux/1b53cf9815bb4744958d41f3795d5d5a1d365e2d
CVE-2017-7374
https://github.com/torvalds/linux/commit/1b53cf9815bb4744958d41f3795d5d5a1d365e2d
2017-03-31T20:59Z
330
CWE-787
CWE-787 int tcp_test ( const char * ip_str , const short port ) { int sock , i ; struct sockaddr_in s_in ; int packetsize = 1024 ; unsigned char packet [ packetsize ] ; struct timeval tv , tv2 , tv3 ; int caplen = 0 ; int times [ REQUESTS ] ; int min , avg , max , len ; struct net_hdr nh ; tv3 . tv_sec = 0 ; tv3 . tv_usec = 1 ; s_in . sin_family = PF_INET ; s_in . sin_port = htons ( port ) ; if ( ! inet_aton ( ip_str , & s_in . sin_addr ) ) return - 1 ; if ( ( sock = socket ( s_in . sin_family , SOCK_STREAM , IPPROTO_TCP ) ) == - 1 ) return - 1 ; if ( fcntl ( sock , F_SETFL , O_NONBLOCK ) < 0 ) { perror ( "fcntl(O_NONBLOCK)<S2SV_blank>failed" ) ; return ( 1 ) ; } gettimeofday ( & tv , NULL ) ; while ( 1 ) { if ( connect ( sock , ( struct sockaddr * ) & s_in , sizeof ( s_in ) ) == - 1 ) { if ( errno != EINPROGRESS && errno != EALREADY ) { perror ( "connect" ) ; close ( sock ) ; printf ( "Failed<S2SV_blank>to<S2SV_blank>connect\\n" ) ; return - 1 ; } } else { gettimeofday ( & tv2 , NULL ) ; break ; } gettimeofday ( & tv2 , NULL ) ; if ( ( ( tv2 . tv_sec * 1000000 - tv . tv_sec * 1000000 ) + ( tv2 . tv_usec - tv . tv_usec ) ) > ( 3000 * 1000 ) ) { printf ( "Connection<S2SV_blank>timed<S2SV_blank>out\\n" ) ; close ( sock ) ; return ( - 1 ) ; } usleep ( 10 ) ; } PCT ; printf ( "TCP<S2SV_blank>connection<S2SV_blank>successful\\n" ) ; memset ( & nh , 0 , sizeof ( nh ) ) ; nh . nh_type = 2 ; nh . nh_len = htonl ( 0 ) ; if ( send ( sock , & nh , sizeof ( nh ) , 0 ) != sizeof ( nh ) ) { perror ( "send" ) ; return - 1 ; } gettimeofday ( & tv , NULL ) ; i = 0 ; while ( 1 ) { caplen = read ( sock , & nh , sizeof ( nh ) ) ; if ( caplen == - 1 ) { if ( errno != EAGAIN ) { perror ( "read" ) ; return - 1 ; } } if ( ( unsigned ) caplen == sizeof ( nh ) ) { len = ntohl ( nh . nh_len ) ; <S2SV_StartBug> if ( nh . nh_type == 1 && i == 0 ) <S2SV_EndBug> { i = 1 ; caplen = read ( sock , packet , len ) ; if ( caplen == len ) { i = 2 ; break ; } else { i = 0 ; } } else { caplen = read ( sock , packet , len ) ; } } gettimeofday ( & tv2 , NULL ) ; if ( ( ( tv2 . tv_sec * 1000000 - tv . tv_sec * 1000000 ) + ( tv2 . tv_usec - tv . tv_usec ) ) > ( 1000 * 1000 ) ) { break ; } if ( caplen == - 1 ) usleep ( 10 ) ; } if ( i == 2 ) { PCT ; printf ( "airserv-ng<S2SV_blank>found\\n" ) ; } else { PCT ; printf ( "airserv-ng<S2SV_blank>NOT<S2SV_blank>found\\n" ) ; } close ( sock ) ; for ( i = 0 ; i < REQUESTS ; i ++ ) { if ( ( sock = socket ( s_in . sin_family , SOCK_STREAM , IPPROTO_TCP ) ) == - 1 ) return - 1 ; if ( fcntl ( sock , F_SETFL , O_NONBLOCK ) < 0 ) { perror ( "fcntl(O_NONBLOCK)<S2SV_blank>failed" ) ; return ( 1 ) ; } usleep ( 1000 ) ; gettimeofday ( & tv , NULL ) ; while ( 1 ) { if ( connect ( sock , ( struct sockaddr * ) & s_in , sizeof ( s_in ) ) == - 1 ) { if ( errno != EINPROGRESS && errno != EALREADY ) { perror ( "connect" ) ; close ( sock ) ; printf ( "Failed<S2SV_blank>to<S2SV_blank>connect\\n" ) ; return - 1 ; } } else { gettimeofday ( & tv2 , NULL ) ; break ; } gettimeofday ( & tv2 , NULL ) ; if ( ( ( tv2 . tv_sec * 1000000 - tv . tv_sec * 1000000 ) + ( tv2 . tv_usec - tv . tv_usec ) ) > ( 1000 * 1000 ) ) { break ; } select ( 1 , NULL , NULL , NULL , & tv3 ) ; } times [ i ] = ( ( tv2 . tv_sec * 1000000 - tv . tv_sec * 1000000 ) + ( tv2 . tv_usec - tv . tv_usec ) ) ; printf ( "\\r%d/%d\\r" , i , REQUESTS ) ; fflush ( stdout ) ; close ( sock ) ; } min = INT_MAX ; avg = 0 ; max = 0 ; for ( i = 0 ; i < REQUESTS ; i ++ ) { if ( times [ i ] < min ) min = times [ i ] ; if ( times [ i ] > max ) max = times [ i ] ; avg += times [ i ] ; } avg /= REQUESTS ; PCT ; printf ( "ping<S2SV_blank>%s:%d<S2SV_blank>(min/avg/max):<S2SV_blank>%.3fms/%.3fms/%.3fms\\n" , ip_str , port , min / 1000.0 , avg / 1000.0 , max / 1000.0 ) ; return 0 ; }
<S2SV_ModStart> ; if ( len > 1024 || len < 0 ) continue ; if (
aircrack-ng@aircrack-ng/091b153f294b9b695b0b2831e65936438b550d7b
CVE-2014-8322
https://github.com/aircrack-ng/aircrack-ng/commit/091b153f294b9b695b0b2831e65936438b550d7b
2020-01-31T22:15Z
331
CWE-119
CWE-119 <S2SV_StartBug> static void send ( node_t * node , node_t * child , byte * fout ) { <S2SV_EndBug> if ( node -> parent ) { <S2SV_StartBug> send ( node -> parent , node , fout ) ; <S2SV_EndBug> } <S2SV_StartBug> if ( child ) { <S2SV_EndBug> if ( node -> right == child ) { add_bit ( 1 , fout ) ; } else { add_bit ( 0 , fout ) ; } } }
<S2SV_ModStart> byte * fout , int maxoffset <S2SV_ModStart> node , fout , maxoffset <S2SV_ModStart> child ) { if ( bloc >= maxoffset ) { bloc = maxoffset + 1 ; return ; }
ioquake@ioq3/d2b1d124d4055c2fcbe5126863487c52fd58cca1
CVE-2017-11721
https://github.com/ioquake/ioq3/commit/d2b1d124d4055c2fcbe5126863487c52fd58cca1
2017-08-03T08:29Z
332
CWE-200
CWE-200 static int l2cap_sock_getname ( struct socket * sock , struct sockaddr * addr , int * len , int peer ) { struct sockaddr_l2 * la = ( struct sockaddr_l2 * ) addr ; struct sock * sk = sock -> sk ; struct l2cap_chan * chan = l2cap_pi ( sk ) -> chan ; <S2SV_StartBug> BT_DBG ( "sock<S2SV_blank>%p,<S2SV_blank>sk<S2SV_blank>%p" , sock , sk ) ; <S2SV_EndBug> addr -> sa_family = AF_BLUETOOTH ; * len = sizeof ( struct sockaddr_l2 ) ; if ( peer ) { la -> l2_psm = chan -> psm ; bacpy ( & la -> l2_bdaddr , & bt_sk ( sk ) -> dst ) ; la -> l2_cid = cpu_to_le16 ( chan -> dcid ) ; } else { la -> l2_psm = chan -> sport ; bacpy ( & la -> l2_bdaddr , & bt_sk ( sk ) -> src ) ; la -> l2_cid = cpu_to_le16 ( chan -> scid ) ; } return 0 ; }
<S2SV_ModStart> sock , sk ) ; memset ( la , 0 , sizeof ( struct sockaddr_l2 )
torvalds@linux/792039c73cf176c8e39a6e8beef2c94ff46522ed
CVE-2012-6544
https://github.com/torvalds/linux/commit/792039c73cf176c8e39a6e8beef2c94ff46522ed
2013-03-15T20:55Z
333
CWE-674
CWE-674 static void Sp_split_regexp ( js_State * J ) { js_Regexp * re ; const char * text ; int limit , len , k ; const char * p , * a , * b , * c , * e ; Resub m ; text = checkstring ( J , 0 ) ; re = js_toregexp ( J , 1 ) ; limit = js_isdefined ( J , 2 ) ? js_tointeger ( J , 2 ) : 1 << 30 ; js_newarray ( J ) ; len = 0 ; e = text + strlen ( text ) ; if ( e == text ) { <S2SV_StartBug> if ( js_regexec ( re -> prog , text , & m , 0 ) ) { <S2SV_EndBug> if ( len == limit ) return ; js_pushliteral ( J , "" ) ; js_setindex ( J , - 2 , 0 ) ; } return ; } p = a = text ; while ( a < e ) { <S2SV_StartBug> if ( js_regexec ( re -> prog , a , & m , a > text ? REG_NOTBOL : 0 ) ) <S2SV_EndBug> break ; b = m . sub [ 0 ] . sp ; c = m . sub [ 0 ] . ep ; if ( b == p ) { ++ a ; continue ; } if ( len == limit ) return ; js_pushlstring ( J , p , b - p ) ; js_setindex ( J , - 2 , len ++ ) ; for ( k = 1 ; k < m . nsub ; ++ k ) { if ( len == limit ) return ; js_pushlstring ( J , m . sub [ k ] . sp , m . sub [ k ] . ep - m . sub [ k ] . sp ) ; js_setindex ( J , - 2 , len ++ ) ; } a = p = c ; } if ( len == limit ) return ; js_pushstring ( J , p ) ; js_setindex ( J , - 2 , len ) ; }
<S2SV_ModStart> { if ( js_doregexec ( J , <S2SV_ModEnd> re -> prog <S2SV_ModStart> { if ( js_doregexec ( J , <S2SV_ModEnd> re -> prog
ccxvii@mujs/00d4606c3baf813b7b1c176823b2729bf51002a2
CVE-2019-11413
https://github.com/ccxvii/mujs/commit/00d4606c3baf813b7b1c176823b2729bf51002a2
2019-04-22T11:29Z
334
CWE-552
CWE-552 static ssize_t _epoll_readv ( oe_fd_t * desc , const struct oe_iovec * iov , int iovcnt ) { ssize_t ret = - 1 ; epoll_t * file = _cast_epoll ( desc ) ; void * buf = NULL ; size_t buf_size = 0 ; <S2SV_StartBug> if ( ! file || ( iovcnt && ! iov ) || iovcnt < 0 || iovcnt > OE_IOV_MAX ) <S2SV_EndBug> OE_RAISE_ERRNO ( OE_EINVAL ) ; <S2SV_StartBug> if ( oe_iov_pack ( iov , iovcnt , & buf , & buf_size ) != 0 ) <S2SV_EndBug> <S2SV_StartBug> OE_RAISE_ERRNO ( OE_ENOMEM ) ; <S2SV_EndBug> if ( oe_syscall_readv_ocall ( & ret , file -> host_fd , buf , iovcnt , buf_size ) != OE_OK ) { OE_RAISE_ERRNO ( OE_EINVAL ) ; } <S2SV_StartBug> if ( oe_iov_sync ( iov , iovcnt , buf , buf_size ) != 0 ) <S2SV_EndBug> OE_RAISE_ERRNO ( OE_EINVAL ) ; done : if ( buf ) oe_free ( buf ) ; return ret ; }
<S2SV_ModStart> = 0 ; size_t data_size = 0 ; <S2SV_ModStart> , & buf_size , & data_size <S2SV_ModStart> OE_RAISE_ERRNO ( OE_ENOMEM ) ; if ( data_size > OE_SSIZE_MAX ) OE_RAISE_ERRNO ( OE_EINVAL <S2SV_ModStart> } if ( ret > ( ssize_t ) data_size ) { ret = - 1 ; OE_RAISE_ERRNO ( OE_EINVAL ) ; } if (
openenclave@openenclave/bcac8e7acb514429fee9e0b5d0c7a0308fd4d76b
CVE-2020-15224
https://github.com/openenclave/openenclave/commit/bcac8e7acb514429fee9e0b5d0c7a0308fd4d76b
2020-10-14T19:15Z
335
CWE-264
CWE-264 void eval_js ( WebKitWebView * web_view , gchar * script , GString * result ) { WebKitWebFrame * frame ; JSGlobalContextRef context ; <S2SV_StartBug> JSObjectRef globalobject ; <S2SV_EndBug> JSStringRef var_name ; JSStringRef js_script ; JSValueRef js_result ; JSStringRef js_result_string ; size_t js_result_size ; js_init ( ) ; frame = webkit_web_view_get_main_frame ( WEBKIT_WEB_VIEW ( web_view ) ) ; context = webkit_web_frame_get_global_context ( frame ) ; <S2SV_StartBug> globalobject = JSContextGetGlobalObject ( context ) ; <S2SV_EndBug> var_name = JSStringCreateWithUTF8CString ( "Uzbl" ) ; JSObjectSetProperty ( context , globalobject , var_name , JSObjectMake ( context , uzbl . js . classref , NULL ) , kJSClassAttributeNone , NULL ) ; js_script = JSStringCreateWithUTF8CString ( script ) ; js_result = JSEvaluateScript ( context , js_script , globalobject , NULL , 0 , NULL ) ; if ( js_result && ! JSValueIsUndefined ( context , js_result ) ) { js_result_string = JSValueToStringCopy ( context , js_result , NULL ) ; js_result_size = JSStringGetMaximumUTF8CStringSize ( js_result_string ) ; if ( js_result_size ) { char js_result_utf8 [ js_result_size ] ; JSStringGetUTF8CString ( js_result_string , js_result_utf8 , js_result_size ) ; g_string_assign ( result , js_result_utf8 ) ; } JSStringRelease ( js_result_string ) ; } <S2SV_StartBug> JSObjectDeleteProperty ( context , globalobject , var_name , NULL ) ; <S2SV_EndBug> JSStringRelease ( var_name ) ; JSStringRelease ( js_script ) ; }
<S2SV_ModStart> ; JSObjectRef globalobject <S2SV_ModEnd> ; JSStringRef js_script <S2SV_ModStart> JSContextGetGlobalObject ( context <S2SV_ModEnd> ) ; js_script <S2SV_ModStart> ) ; } <S2SV_ModEnd> JSStringRelease ( js_script
Dieterbe@uzbl/1958b52d41cba96956dc1995660de49525ed1047
CVE-2010-0011
https://github.com/Dieterbe/uzbl/commit/1958b52d41cba96956dc1995660de49525ed1047
2010-02-25T19:30Z
336
CWE-125
CWE-125 static bool r_bin_mdmp_init_directory ( struct r_bin_mdmp_obj * obj ) { int i ; <S2SV_StartBug> ut8 * directory_base ; <S2SV_EndBug> struct minidump_directory * entry ; directory_base = obj -> b -> buf + obj -> hdr -> stream_directory_rva ; sdb_num_set ( obj -> kv , "mdmp_directory.offset" , obj -> hdr -> stream_directory_rva , 0 ) ; sdb_set ( obj -> kv , "mdmp_directory.format" , "[4]E?<S2SV_blank>" "(mdmp_stream_type)StreamType<S2SV_blank>" "(mdmp_location_descriptor)Location" , 0 ) ; <S2SV_StartBug> for ( i = 0 ; i < ( int ) obj -> hdr -> number_of_streams ; i ++ ) { <S2SV_EndBug> <S2SV_StartBug> entry = ( struct minidump_directory * ) ( directory_base + ( i * sizeof ( struct minidump_directory ) ) ) ; <S2SV_EndBug> <S2SV_StartBug> r_bin_mdmp_init_directory_entry ( obj , entry ) ; <S2SV_EndBug> } return true ; }
<S2SV_ModStart> int i ; struct minidump_directory entry <S2SV_ModEnd> ; sdb_num_set ( <S2SV_ModStart> 0 ) ; ut64 rvadir = obj -> hdr -> stream_directory_rva ; <S2SV_ModStart> ++ ) { ut32 delta = <S2SV_ModEnd> i * sizeof <S2SV_ModStart> struct minidump_directory ) ; int r = r_buf_read_at ( obj -> b , rvadir + delta , ( ut8 * ) & entry , sizeof ( struct minidump_directory <S2SV_ModStart> ) ) ; if ( r ) { <S2SV_ModStart> ( obj , & <S2SV_ModStart> entry ) ; }
radare@radare2/40b021ba29c8f90ccf7c879fde2580bc73a17e8e
CVE-2018-14016
https://github.com/radare/radare2/commit/40b021ba29c8f90ccf7c879fde2580bc73a17e8e
2018-07-12T20:29Z
337
CWE-119
CWE-119 int vp8_encode_intra ( VP8_COMP * cpi , MACROBLOCK * x , int use_dc_pred ) { int i ; int intra_pred_var = 0 ; ( void ) cpi ; if ( use_dc_pred ) { x -> e_mbd . mode_info_context -> mbmi . mode = DC_PRED ; x -> e_mbd . mode_info_context -> mbmi . uv_mode = DC_PRED ; x -> e_mbd . mode_info_context -> mbmi . ref_frame = INTRA_FRAME ; vp8_encode_intra16x16mby ( x ) ; vp8_inverse_transform_mby ( & x -> e_mbd ) ; } else { for ( i = 0 ; i < 16 ; i ++ ) { x -> e_mbd . block [ i ] . bmi . as_mode = B_DC_PRED ; vp8_encode_intra4x4block ( x , i ) ; } } <S2SV_StartBug> intra_pred_var = vp8_get_mb_ss ( x -> src_diff ) ; <S2SV_EndBug> return intra_pred_var ; }
<S2SV_ModStart> } intra_pred_var = vpx_get_mb_ss <S2SV_ModEnd> ( x ->
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
338
CWE-20
CWE-20 void ih264d_init_decoder ( void * ps_dec_params ) { dec_struct_t * ps_dec = ( dec_struct_t * ) ps_dec_params ; dec_slice_params_t * ps_cur_slice ; pocstruct_t * ps_prev_poc , * ps_cur_poc ; WORD32 size ; size = sizeof ( pred_info_t ) * 2 * 32 ; memset ( ps_dec -> ps_pred , 0 , size ) ; size = sizeof ( disp_mgr_t ) ; memset ( ps_dec -> pv_disp_buf_mgr , 0 , size ) ; size = sizeof ( buf_mgr_t ) + ithread_get_mutex_lock_size ( ) ; memset ( ps_dec -> pv_pic_buf_mgr , 0 , size ) ; size = sizeof ( dec_err_status_t ) ; memset ( ps_dec -> ps_dec_err_status , 0 , size ) ; size = sizeof ( sei ) ; memset ( ps_dec -> ps_sei , 0 , size ) ; size = sizeof ( dpb_commands_t ) ; memset ( ps_dec -> ps_dpb_cmds , 0 , size ) ; size = sizeof ( dec_bit_stream_t ) ; memset ( ps_dec -> ps_bitstrm , 0 , size ) ; size = sizeof ( dec_slice_params_t ) ; memset ( ps_dec -> ps_cur_slice , 0 , size ) ; size = MAX ( sizeof ( dec_seq_params_t ) , sizeof ( dec_pic_params_t ) ) ; memset ( ps_dec -> pv_scratch_sps_pps , 0 , size ) ; size = sizeof ( ctxt_inc_mb_info_t ) ; memset ( ps_dec -> ps_left_mb_ctxt_info , 0 , size ) ; size = ( sizeof ( neighbouradd_t ) << 2 ) ; memset ( ps_dec -> ps_left_mvpred_addr , 0 , size ) ; size = sizeof ( buf_mgr_t ) + ithread_get_mutex_lock_size ( ) ; memset ( ps_dec -> pv_mv_buf_mgr , 0 , size ) ; ih264d_free_dynamic_bufs ( ps_dec ) ; ps_cur_slice = ps_dec -> ps_cur_slice ; ps_dec -> init_done = 0 ; ps_dec -> u4_num_cores = 1 ; ps_dec -> u2_pic_ht = ps_dec -> u2_pic_wd = 0 ; ps_dec -> u1_separate_parse = DEFAULT_SEPARATE_PARSE ; ps_dec -> u4_app_disable_deblk_frm = 0 ; ps_dec -> i4_degrade_type = 0 ; ps_dec -> i4_degrade_pics = 0 ; ps_dec -> i4_app_skip_mode = IVD_SKIP_NONE ; ps_dec -> i4_dec_skip_mode = IVD_SKIP_NONE ; memset ( ps_dec -> ps_pps , 0 , ( ( sizeof ( dec_pic_params_t ) ) * MAX_NUM_PIC_PARAMS ) ) ; memset ( ps_dec -> ps_sps , 0 , ( ( sizeof ( dec_seq_params_t ) ) * MAX_NUM_SEQ_PARAMS ) ) ; ps_dec -> p_DeblockPicture [ 0 ] = ih264d_deblock_picture_non_mbaff ; ps_dec -> p_DeblockPicture [ 1 ] = ih264d_deblock_picture_mbaff ; ps_dec -> s_cab_dec_env . pv_codec_handle = ps_dec ; ps_dec -> u4_num_fld_in_frm = 0 ; ps_dec -> ps_dpb_mgr -> pv_codec_handle = ps_dec ; ps_dec -> ps_sei -> u1_is_valid = 0 ; ps_dec -> ps_cur_pps = NULL ; ps_dec -> ps_cur_sps = NULL ; ps_dec -> u1_init_dec_flag = 0 ; ps_dec -> u1_first_slice_in_stream = 1 ; ps_dec -> u1_first_pb_nal_in_pic = 1 ; ps_dec -> u1_last_pic_not_decoded = 0 ; ps_dec -> u4_app_disp_width = 0 ; ps_dec -> i4_header_decoded = 0 ; ps_dec -> u4_total_frames_decoded = 0 ; ps_dec -> i4_error_code = 0 ; ps_dec -> i4_content_type = - 1 ; ps_dec -> ps_cur_slice -> u1_mbaff_frame_flag = 0 ; ps_dec -> ps_dec_err_status -> u1_err_flag = ACCEPT_ALL_PICS ; ps_dec -> ps_dec_err_status -> u1_cur_pic_type = PIC_TYPE_UNKNOWN ; ps_dec -> ps_dec_err_status -> u4_frm_sei_sync = SYNC_FRM_DEFAULT ; ps_dec -> ps_dec_err_status -> u4_cur_frm = INIT_FRAME ; ps_dec -> ps_dec_err_status -> u1_pic_aud_i = PIC_TYPE_UNKNOWN ; ps_dec -> u1_pr_sl_type = 0xFF ; ps_dec -> u2_mbx = 0xffff ; ps_dec -> u2_mby = 0 ; ps_dec -> u2_total_mbs_coded = 0 ; ps_prev_poc = & ps_dec -> s_prev_pic_poc ; ps_cur_poc = & ps_dec -> s_cur_pic_poc ; ps_prev_poc -> i4_pic_order_cnt_lsb = ps_cur_poc -> i4_pic_order_cnt_lsb = 0 ; ps_prev_poc -> i4_pic_order_cnt_msb = ps_cur_poc -> i4_pic_order_cnt_msb = 0 ; ps_prev_poc -> i4_delta_pic_order_cnt_bottom = ps_cur_poc -> i4_delta_pic_order_cnt_bottom = 0 ; ps_prev_poc -> i4_delta_pic_order_cnt [ 0 ] = ps_cur_poc -> i4_delta_pic_order_cnt [ 0 ] = 0 ; ps_prev_poc -> i4_delta_pic_order_cnt [ 1 ] = ps_cur_poc -> i4_delta_pic_order_cnt [ 1 ] = 0 ; ps_prev_poc -> u1_mmco_equalto5 = ps_cur_poc -> u1_mmco_equalto5 = 0 ; ps_prev_poc -> i4_top_field_order_count = ps_cur_poc -> i4_top_field_order_count = 0 ; ps_prev_poc -> i4_bottom_field_order_count = ps_cur_poc -> i4_bottom_field_order_count = 0 ; ps_prev_poc -> u1_bot_field = ps_cur_poc -> u1_bot_field = 0 ; ps_prev_poc -> u1_mmco_equalto5 = ps_cur_poc -> u1_mmco_equalto5 = 0 ; ps_prev_poc -> i4_prev_frame_num_ofst = ps_cur_poc -> i4_prev_frame_num_ofst = 0 ; ps_cur_slice -> u1_mmco_equalto5 = 0 ; ps_cur_slice -> u2_frame_num = 0 ; ps_dec -> i4_max_poc = 0 ; ps_dec -> i4_prev_max_display_seq = 0 ; ps_dec -> u1_recon_mb_grp = 4 ; ps_dec -> u1_second_field = 0 ; ps_dec -> s_prev_seq_params . u1_eoseq_pending = 0 ; ps_dec -> u2_crop_offset_y = 0 ; ps_dec -> u2_crop_offset_uv = 0 ; ps_dec -> i4_vui_frame_rate = - 1 ; ps_dec -> i4_pic_type = - 1 ; ps_dec -> i4_frametype = - 1 ; ps_dec -> i4_content_type = - 1 ; ps_dec -> u1_res_changed = 0 ; ps_dec -> u1_frame_decoded_flag = 0 ; ps_dec -> u4_skip_frm_mask = SKIP_NONE ; ps_dec -> pf_cavlc_4x4res_block [ 0 ] = ih264d_cavlc_4x4res_block_totalcoeff_1 ; ps_dec -> pf_cavlc_4x4res_block [ 1 ] = ih264d_cavlc_4x4res_block_totalcoeff_2to10 ; ps_dec -> pf_cavlc_4x4res_block [ 2 ] = ih264d_cavlc_4x4res_block_totalcoeff_11to16 ; ps_dec -> pf_cavlc_parse4x4coeff [ 0 ] = ih264d_cavlc_parse4x4coeff_n0to7 ; ps_dec -> pf_cavlc_parse4x4coeff [ 1 ] = ih264d_cavlc_parse4x4coeff_n8 ; ps_dec -> pf_cavlc_parse_8x8block [ 0 ] = ih264d_cavlc_parse_8x8block_none_available ; ps_dec -> pf_cavlc_parse_8x8block [ 1 ] = ih264d_cavlc_parse_8x8block_left_available ; ps_dec -> pf_cavlc_parse_8x8block [ 2 ] = ih264d_cavlc_parse_8x8block_top_available ; ps_dec -> pf_cavlc_parse_8x8block [ 3 ] = ih264d_cavlc_parse_8x8block_both_available ; ps_dec -> pf_fill_bs1 [ 0 ] [ 0 ] = ih264d_fill_bs1_16x16mb_pslice ; ps_dec -> pf_fill_bs1 [ 0 ] [ 1 ] = ih264d_fill_bs1_non16x16mb_pslice ; ps_dec -> pf_fill_bs1 [ 1 ] [ 0 ] = ih264d_fill_bs1_16x16mb_bslice ; ps_dec -> pf_fill_bs1 [ 1 ] [ 1 ] = ih264d_fill_bs1_non16x16mb_bslice ; ps_dec -> pf_fill_bs_xtra_left_edge [ 0 ] = ih264d_fill_bs_xtra_left_edge_cur_frm ; ps_dec -> pf_fill_bs_xtra_left_edge [ 1 ] = ih264d_fill_bs_xtra_left_edge_cur_fld ; ih264d_init_ref_bufs ( ps_dec -> ps_dpb_mgr ) ; ps_dec -> u2_prv_frame_num = 0 ; ps_dec -> u1_top_bottom_decoded = 0 ; ps_dec -> u1_dangling_field = 0 ; ps_dec -> s_cab_dec_env . cabac_table = gau4_ih264d_cabac_table ; ps_dec -> pu1_left_mv_ctxt_inc = ps_dec -> u1_left_mv_ctxt_inc_arr [ 0 ] ; ps_dec -> pi1_left_ref_idx_ctxt_inc = & ps_dec -> i1_left_ref_idx_ctx_inc_arr [ 0 ] [ 0 ] ; ps_dec -> pu1_left_yuv_dc_csbp = & ps_dec -> u1_yuv_dc_csbp_topmb ; ps_dec -> u1_flushfrm = 0 ; { ps_dec -> s_cab_dec_env . pv_codec_handle = ( void * ) ps_dec ; ps_dec -> ps_bitstrm -> pv_codec_handle = ( void * ) ps_dec ; ps_dec -> ps_cur_slice -> pv_codec_handle = ( void * ) ps_dec ; ps_dec -> ps_dpb_mgr -> pv_codec_handle = ( void * ) ps_dec ; } memset ( ps_dec -> disp_bufs , 0 , ( MAX_DISP_BUFS_NEW ) * sizeof ( disp_buf_t ) ) ; memset ( ps_dec -> u4_disp_buf_mapping , 0 , ( MAX_DISP_BUFS_NEW ) * sizeof ( UWORD32 ) ) ; memset ( ps_dec -> u4_disp_buf_to_be_freed , 0 , ( MAX_DISP_BUFS_NEW ) * sizeof ( UWORD32 ) ) ; <S2SV_StartBug> ih264d_init_arch ( ps_dec ) ; <S2SV_EndBug> ih264d_init_function_ptr ( ps_dec ) ; ps_dec -> e_frm_out_mode = IVD_DISPLAY_FRAME_OUT ; ps_dec -> init_done = 1 ; }
<S2SV_ModStart> ) ) ; memset ( ps_dec -> ps_cur_slice , 0 , sizeof ( dec_slice_params_t ) ) ;
external@libavc/cc676ebd95247646e67907ccab150fb77a847335
CVE-2016-3741
https://android.googlesource.com/platform/external/libavc/+/cc676ebd95247646e67907ccab150fb77a847335
2016-07-11T01:59Z
339
CWE-119
CWE-119 bt_status_t btif_dm_pin_reply ( const bt_bdaddr_t * bd_addr , uint8_t accept , uint8_t pin_len , bt_pin_code_t * pin_code ) { BTIF_TRACE_EVENT ( "%s:<S2SV_blank>accept=%d" , __FUNCTION__ , accept ) ; <S2SV_StartBug> if ( pin_code == NULL ) <S2SV_EndBug> return BT_STATUS_FAIL ; # if ( defined ( BLE_INCLUDED ) && ( BLE_INCLUDED == TRUE ) ) if ( pairing_cb . is_le_only ) { int i ; UINT32 passkey = 0 ; int multi [ ] = { 100000 , 10000 , 1000 , 100 , 10 , 1 } ; BD_ADDR remote_bd_addr ; bdcpy ( remote_bd_addr , bd_addr -> address ) ; for ( i = 0 ; i < 6 ; i ++ ) { passkey += ( multi [ i ] * ( pin_code -> pin [ i ] - '0' ) ) ; } BTIF_TRACE_DEBUG ( "btif_dm_pin_reply:<S2SV_blank>passkey:<S2SV_blank>%d" , passkey ) ; BTA_DmBlePasskeyReply ( remote_bd_addr , accept , passkey ) ; } else { BTA_DmPinReply ( ( UINT8 * ) bd_addr -> address , accept , pin_len , pin_code -> pin ) ; if ( accept ) pairing_cb . pin_code_len = pin_len ; } # else BTA_DmPinReply ( ( UINT8 * ) bd_addr -> address , accept , pin_len , pin_code -> pin ) ; if ( accept ) pairing_cb . pin_code_len = pin_len ; # endif return BT_STATUS_SUCCESS ; }
<S2SV_ModStart> pin_code == NULL || pin_len > PIN_CODE_LEN
system@bt/9b534de2aca5d790c2a1c4d76b545f16137d95dd
CVE-2016-2439
https://android.googlesource.com/platform/system/bt/+/9b534de2aca5d790c2a1c4d76b545f16137d95dd
2016-05-09T10:59Z
340
CWE-264
CWE-264 static ssize_t get_node_path_locked ( struct node * node , char * buf , size_t bufsize ) { const char * name ; size_t namelen ; if ( node -> graft_path ) { name = node -> graft_path ; namelen = node -> graft_pathlen ; } else if ( node -> actual_name ) { name = node -> actual_name ; namelen = node -> namelen ; } else { name = node -> name ; namelen = node -> namelen ; } if ( bufsize < namelen + 1 ) { return - 1 ; } ssize_t pathlen = 0 ; if ( node -> parent && node -> graft_path == NULL ) { <S2SV_StartBug> pathlen = get_node_path_locked ( node -> parent , buf , bufsize - namelen - 2 ) ; <S2SV_EndBug> if ( pathlen < 0 ) { return - 1 ; } buf [ pathlen ++ ] = '/' ; } memcpy ( buf + pathlen , name , namelen + 1 ) ; return pathlen + namelen ; }
<S2SV_ModStart> - namelen - 1 <S2SV_ModEnd> ) ; if
system@core/864e2e22fcd0cba3f5e67680ccabd0302dfda45d
CVE-2016-2494
https://android.googlesource.com/platform/system/core/+/864e2e22fcd0cba3f5e67680ccabd0302dfda45d
2016-06-13T01:59Z
341
CWE-125
CWE-125 int ParseRiffHeaderConfig ( FILE * infile , char * infilename , char * fourcc , WavpackContext * wpc , WavpackConfig * config ) { int is_rf64 = ! strncmp ( fourcc , "RF64" , 4 ) , got_ds64 = 0 ; int64_t total_samples = 0 , infilesize ; RiffChunkHeader riff_chunk_header ; ChunkHeader chunk_header ; WaveHeader WaveHeader ; DS64Chunk ds64_chunk ; uint32_t bcount ; CLEAR ( WaveHeader ) ; CLEAR ( ds64_chunk ) ; infilesize = DoGetFileSize ( infile ) ; if ( ! is_rf64 && infilesize >= 4294967296LL && ! ( config -> qmode & QMODE_IGNORE_LENGTH ) ) { error_line ( "can\'t<S2SV_blank>handle<S2SV_blank>.WAV<S2SV_blank>files<S2SV_blank>larger<S2SV_blank>than<S2SV_blank>4<S2SV_blank>GB<S2SV_blank>(non-standard)!" ) ; return WAVPACK_SOFT_ERROR ; } memcpy ( & riff_chunk_header , fourcc , 4 ) ; if ( ( ! DoReadFile ( infile , ( ( char * ) & riff_chunk_header ) + 4 , sizeof ( RiffChunkHeader ) - 4 , & bcount ) || bcount != sizeof ( RiffChunkHeader ) - 4 || strncmp ( riff_chunk_header . formType , "WAVE" , 4 ) ) ) { error_line ( "%s<S2SV_blank>is<S2SV_blank>not<S2SV_blank>a<S2SV_blank>valid<S2SV_blank>.WAV<S2SV_blank>file!" , infilename ) ; return WAVPACK_SOFT_ERROR ; } else if ( ! ( config -> qmode & QMODE_NO_STORE_WRAPPER ) && ! WavpackAddWrapper ( wpc , & riff_chunk_header , sizeof ( RiffChunkHeader ) ) ) { error_line ( "%s" , WavpackGetErrorMessage ( wpc ) ) ; return WAVPACK_SOFT_ERROR ; } while ( 1 ) { if ( ! DoReadFile ( infile , & chunk_header , sizeof ( ChunkHeader ) , & bcount ) || bcount != sizeof ( ChunkHeader ) ) { error_line ( "%s<S2SV_blank>is<S2SV_blank>not<S2SV_blank>a<S2SV_blank>valid<S2SV_blank>.WAV<S2SV_blank>file!" , infilename ) ; return WAVPACK_SOFT_ERROR ; } else if ( ! ( config -> qmode & QMODE_NO_STORE_WRAPPER ) && ! WavpackAddWrapper ( wpc , & chunk_header , sizeof ( ChunkHeader ) ) ) { error_line ( "%s" , WavpackGetErrorMessage ( wpc ) ) ; return WAVPACK_SOFT_ERROR ; } WavpackLittleEndianToNative ( & chunk_header , ChunkHeaderFormat ) ; if ( ! strncmp ( chunk_header . ckID , "ds64" , 4 ) ) { if ( chunk_header . ckSize < sizeof ( DS64Chunk ) || <S2SV_StartBug> ! DoReadFile ( infile , & ds64_chunk , chunk_header . ckSize , & bcount ) || <S2SV_EndBug> <S2SV_StartBug> bcount != chunk_header . ckSize ) { <S2SV_EndBug> error_line ( "%s<S2SV_blank>is<S2SV_blank>not<S2SV_blank>a<S2SV_blank>valid<S2SV_blank>.WAV<S2SV_blank>file!" , infilename ) ; return WAVPACK_SOFT_ERROR ; } else if ( ! ( config -> qmode & QMODE_NO_STORE_WRAPPER ) && <S2SV_StartBug> ! WavpackAddWrapper ( wpc , & ds64_chunk , chunk_header . ckSize ) ) { <S2SV_EndBug> error_line ( "%s" , WavpackGetErrorMessage ( wpc ) ) ; return WAVPACK_SOFT_ERROR ; } got_ds64 = 1 ; WavpackLittleEndianToNative ( & ds64_chunk , DS64ChunkFormat ) ; if ( debug_logging_mode ) error_line ( "DS64:<S2SV_blank>riffSize<S2SV_blank>=<S2SV_blank>%lld,<S2SV_blank>dataSize<S2SV_blank>=<S2SV_blank>%lld,<S2SV_blank>sampleCount<S2SV_blank>=<S2SV_blank>%lld,<S2SV_blank>table_length<S2SV_blank>=<S2SV_blank>%d" , ( long long ) ds64_chunk . riffSize64 , ( long long ) ds64_chunk . dataSize64 , ( long long ) ds64_chunk . sampleCount64 , ds64_chunk . tableLength ) ; if ( ds64_chunk . tableLength * sizeof ( CS64Chunk ) != chunk_header . ckSize - sizeof ( DS64Chunk ) ) { error_line ( "%s<S2SV_blank>is<S2SV_blank>not<S2SV_blank>a<S2SV_blank>valid<S2SV_blank>.WAV<S2SV_blank>file!" , infilename ) ; return WAVPACK_SOFT_ERROR ; } while ( ds64_chunk . tableLength -- ) { CS64Chunk cs64_chunk ; if ( ! DoReadFile ( infile , & cs64_chunk , sizeof ( CS64Chunk ) , & bcount ) || bcount != sizeof ( CS64Chunk ) || ( ! ( config -> qmode & QMODE_NO_STORE_WRAPPER ) && ! WavpackAddWrapper ( wpc , & cs64_chunk , sizeof ( CS64Chunk ) ) ) ) { error_line ( "%s" , WavpackGetErrorMessage ( wpc ) ) ; return WAVPACK_SOFT_ERROR ; } } } else if ( ! strncmp ( chunk_header . ckID , "fmt<S2SV_blank>" , 4 ) ) { int supported = TRUE , format ; if ( chunk_header . ckSize < 16 || chunk_header . ckSize > sizeof ( WaveHeader ) || ! DoReadFile ( infile , & WaveHeader , chunk_header . ckSize , & bcount ) || bcount != chunk_header . ckSize ) { error_line ( "%s<S2SV_blank>is<S2SV_blank>not<S2SV_blank>a<S2SV_blank>valid<S2SV_blank>.WAV<S2SV_blank>file!" , infilename ) ; return WAVPACK_SOFT_ERROR ; } else if ( ! ( config -> qmode & QMODE_NO_STORE_WRAPPER ) && ! WavpackAddWrapper ( wpc , & WaveHeader , chunk_header . ckSize ) ) { error_line ( "%s" , WavpackGetErrorMessage ( wpc ) ) ; return WAVPACK_SOFT_ERROR ; } WavpackLittleEndianToNative ( & WaveHeader , WaveHeaderFormat ) ; if ( debug_logging_mode ) { error_line ( "format<S2SV_blank>tag<S2SV_blank>size<S2SV_blank>=<S2SV_blank>%d" , chunk_header . ckSize ) ; error_line ( "FormatTag<S2SV_blank>=<S2SV_blank>%x,<S2SV_blank>NumChannels<S2SV_blank>=<S2SV_blank>%d,<S2SV_blank>BitsPerSample<S2SV_blank>=<S2SV_blank>%d" , WaveHeader . FormatTag , WaveHeader . NumChannels , WaveHeader . BitsPerSample ) ; error_line ( "BlockAlign<S2SV_blank>=<S2SV_blank>%d,<S2SV_blank>SampleRate<S2SV_blank>=<S2SV_blank>%d,<S2SV_blank>BytesPerSecond<S2SV_blank>=<S2SV_blank>%d" , WaveHeader . BlockAlign , WaveHeader . SampleRate , WaveHeader . BytesPerSecond ) ; if ( chunk_header . ckSize > 16 ) error_line ( "cbSize<S2SV_blank>=<S2SV_blank>%d,<S2SV_blank>ValidBitsPerSample<S2SV_blank>=<S2SV_blank>%d" , WaveHeader . cbSize , WaveHeader . ValidBitsPerSample ) ; if ( chunk_header . ckSize > 20 ) error_line ( "ChannelMask<S2SV_blank>=<S2SV_blank>%x,<S2SV_blank>SubFormat<S2SV_blank>=<S2SV_blank>%d" , WaveHeader . ChannelMask , WaveHeader . SubFormat ) ; } if ( chunk_header . ckSize > 16 && WaveHeader . cbSize == 2 ) config -> qmode |= QMODE_ADOBE_MODE ; format = ( WaveHeader . FormatTag == 0xfffe && chunk_header . ckSize == 40 ) ? WaveHeader . SubFormat : WaveHeader . FormatTag ; config -> bits_per_sample = ( chunk_header . ckSize == 40 && WaveHeader . ValidBitsPerSample ) ? WaveHeader . ValidBitsPerSample : WaveHeader . BitsPerSample ; if ( format != 1 && format != 3 ) supported = FALSE ; if ( format == 3 && config -> bits_per_sample != 32 ) supported = FALSE ; if ( ! WaveHeader . NumChannels || WaveHeader . NumChannels > 256 || WaveHeader . BlockAlign / WaveHeader . NumChannels < ( config -> bits_per_sample + 7 ) / 8 || WaveHeader . BlockAlign / WaveHeader . NumChannels > 4 || WaveHeader . BlockAlign % WaveHeader . NumChannels ) supported = FALSE ; if ( config -> bits_per_sample < 1 || config -> bits_per_sample > 32 ) supported = FALSE ; if ( ! supported ) { error_line ( "%s<S2SV_blank>is<S2SV_blank>an<S2SV_blank>unsupported<S2SV_blank>.WAV<S2SV_blank>format!" , infilename ) ; return WAVPACK_SOFT_ERROR ; } if ( chunk_header . ckSize < 40 ) { if ( ! config -> channel_mask && ! ( config -> qmode & QMODE_CHANS_UNASSIGNED ) ) { if ( WaveHeader . NumChannels <= 2 ) config -> channel_mask = 0x5 - WaveHeader . NumChannels ; else if ( WaveHeader . NumChannels <= 18 ) config -> channel_mask = ( 1 << WaveHeader . NumChannels ) - 1 ; else config -> channel_mask = 0x3ffff ; } } else if ( WaveHeader . ChannelMask && ( config -> channel_mask || ( config -> qmode & QMODE_CHANS_UNASSIGNED ) ) ) { error_line ( "this<S2SV_blank>WAV<S2SV_blank>file<S2SV_blank>already<S2SV_blank>has<S2SV_blank>channel<S2SV_blank>order<S2SV_blank>information!" ) ; return WAVPACK_SOFT_ERROR ; } else if ( WaveHeader . ChannelMask ) config -> channel_mask = WaveHeader . ChannelMask ; if ( format == 3 ) config -> float_norm_exp = 127 ; else if ( ( config -> qmode & QMODE_ADOBE_MODE ) && WaveHeader . BlockAlign / WaveHeader . NumChannels == 4 ) { if ( WaveHeader . BitsPerSample == 24 ) config -> float_norm_exp = 127 + 23 ; else if ( WaveHeader . BitsPerSample == 32 ) config -> float_norm_exp = 127 + 15 ; } if ( debug_logging_mode ) { if ( config -> float_norm_exp == 127 ) error_line ( "data<S2SV_blank>format:<S2SV_blank>normalized<S2SV_blank>32-bit<S2SV_blank>floating<S2SV_blank>point" ) ; else if ( config -> float_norm_exp ) error_line ( "data<S2SV_blank>format:<S2SV_blank>32-bit<S2SV_blank>floating<S2SV_blank>point<S2SV_blank>(Audition<S2SV_blank>%d:%d<S2SV_blank>float<S2SV_blank>type<S2SV_blank>1)" , config -> float_norm_exp - 126 , 150 - config -> float_norm_exp ) ; else error_line ( "data<S2SV_blank>format:<S2SV_blank>%d-bit<S2SV_blank>integers<S2SV_blank>stored<S2SV_blank>in<S2SV_blank>%d<S2SV_blank>byte(s)" , config -> bits_per_sample , WaveHeader . BlockAlign / WaveHeader . NumChannels ) ; } } else if ( ! strncmp ( chunk_header . ckID , "data" , 4 ) ) { int64_t data_chunk_size = ( got_ds64 && chunk_header . ckSize == ( uint32_t ) - 1 ) ? ds64_chunk . dataSize64 : chunk_header . ckSize ; if ( ! WaveHeader . NumChannels || ( is_rf64 && ! got_ds64 ) ) { error_line ( "%s<S2SV_blank>is<S2SV_blank>not<S2SV_blank>a<S2SV_blank>valid<S2SV_blank>.WAV<S2SV_blank>file!" , infilename ) ; return WAVPACK_SOFT_ERROR ; } if ( infilesize && ! ( config -> qmode & QMODE_IGNORE_LENGTH ) && infilesize - data_chunk_size > 16777216 ) { error_line ( "this<S2SV_blank>.WAV<S2SV_blank>file<S2SV_blank>has<S2SV_blank>over<S2SV_blank>16<S2SV_blank>MB<S2SV_blank>of<S2SV_blank>extra<S2SV_blank>RIFF<S2SV_blank>data,<S2SV_blank>probably<S2SV_blank>is<S2SV_blank>corrupt!" ) ; return WAVPACK_SOFT_ERROR ; } if ( config -> qmode & QMODE_IGNORE_LENGTH ) { if ( infilesize && DoGetFilePosition ( infile ) != - 1 ) total_samples = ( infilesize - DoGetFilePosition ( infile ) ) / WaveHeader . BlockAlign ; else total_samples = - 1 ; } else { total_samples = data_chunk_size / WaveHeader . BlockAlign ; if ( got_ds64 && total_samples != ds64_chunk . sampleCount64 ) { error_line ( "%s<S2SV_blank>is<S2SV_blank>not<S2SV_blank>a<S2SV_blank>valid<S2SV_blank>.WAV<S2SV_blank>file!" , infilename ) ; return WAVPACK_SOFT_ERROR ; } if ( ! total_samples ) { error_line ( "this<S2SV_blank>.WAV<S2SV_blank>file<S2SV_blank>has<S2SV_blank>no<S2SV_blank>audio<S2SV_blank>samples,<S2SV_blank>probably<S2SV_blank>is<S2SV_blank>corrupt!" ) ; return WAVPACK_SOFT_ERROR ; } if ( total_samples > MAX_WAVPACK_SAMPLES ) { error_line ( "%s<S2SV_blank>has<S2SV_blank>too<S2SV_blank>many<S2SV_blank>samples<S2SV_blank>for<S2SV_blank>WavPack!" , infilename ) ; return WAVPACK_SOFT_ERROR ; } } config -> bytes_per_sample = WaveHeader . BlockAlign / WaveHeader . NumChannels ; config -> num_channels = WaveHeader . NumChannels ; config -> sample_rate = WaveHeader . SampleRate ; break ; } else { int bytes_to_copy = ( chunk_header . ckSize + 1 ) & ~ 1L ; char * buff = malloc ( bytes_to_copy ) ; if ( debug_logging_mode ) error_line ( "extra<S2SV_blank>unknown<S2SV_blank>chunk<S2SV_blank>\\"%c%c%c%c\\"<S2SV_blank>of<S2SV_blank>%d<S2SV_blank>bytes" , chunk_header . ckID [ 0 ] , chunk_header . ckID [ 1 ] , chunk_header . ckID [ 2 ] , chunk_header . ckID [ 3 ] , chunk_header . ckSize ) ; if ( ! DoReadFile ( infile , buff , bytes_to_copy , & bcount ) || bcount != bytes_to_copy || ( ! ( config -> qmode & QMODE_NO_STORE_WRAPPER ) && ! WavpackAddWrapper ( wpc , buff , bytes_to_copy ) ) ) { error_line ( "%s" , WavpackGetErrorMessage ( wpc ) ) ; free ( buff ) ; return WAVPACK_SOFT_ERROR ; } free ( buff ) ; } } if ( ! WavpackSetConfiguration64 ( wpc , config , total_samples , NULL ) ) { error_line ( "%s:<S2SV_blank>%s" , infilename , WavpackGetErrorMessage ( wpc ) ) ; return WAVPACK_SOFT_ERROR ; } return WAVPACK_NO_ERROR ; }
<S2SV_ModStart> & ds64_chunk , sizeof ( DS64Chunk ) <S2SV_ModEnd> , & bcount <S2SV_ModStart> || bcount != sizeof ( DS64Chunk ) <S2SV_ModEnd> ) { error_line <S2SV_ModStart> & ds64_chunk , sizeof ( DS64Chunk ) <S2SV_ModEnd> ) ) {
dbry@WavPack/d5bf76b5a88d044a1be1d5656698e3ba737167e5
CVE-2018-6767
https://github.com/dbry/WavPack/commit/d5bf76b5a88d044a1be1d5656698e3ba737167e5
2018-02-06T22:29Z
342
CWE-119
CWE-119 TEE_Result syscall_obj_generate_key ( unsigned long obj , unsigned long key_size , const struct utee_attribute * usr_params , unsigned long param_count ) { TEE_Result res ; struct tee_ta_session * sess ; const struct tee_cryp_obj_type_props * type_props ; struct tee_obj * o ; struct tee_cryp_obj_secret * key ; size_t byte_size ; TEE_Attribute * params = NULL ; res = tee_ta_get_current_session ( & sess ) ; if ( res != TEE_SUCCESS ) return res ; res = tee_obj_get ( to_user_ta_ctx ( sess -> ctx ) , tee_svc_uref_to_vaddr ( obj ) , & o ) ; if ( res != TEE_SUCCESS ) return res ; if ( ( o -> info . handleFlags & TEE_HANDLE_FLAG_PERSISTENT ) != 0 ) return TEE_ERROR_BAD_STATE ; if ( ( o -> info . handleFlags & TEE_HANDLE_FLAG_INITIALIZED ) != 0 ) return TEE_ERROR_BAD_STATE ; type_props = tee_svc_find_type_props ( o -> info . objectType ) ; if ( ! type_props ) return TEE_ERROR_NOT_SUPPORTED ; if ( key_size % type_props -> quanta != 0 ) return TEE_ERROR_NOT_SUPPORTED ; if ( key_size < type_props -> min_size ) return TEE_ERROR_NOT_SUPPORTED ; if ( key_size > type_props -> max_size ) return TEE_ERROR_NOT_SUPPORTED ; <S2SV_StartBug> params = malloc ( sizeof ( TEE_Attribute ) * param_count ) ; <S2SV_EndBug> if ( ! params ) return TEE_ERROR_OUT_OF_MEMORY ; res = copy_in_attrs ( to_user_ta_ctx ( sess -> ctx ) , usr_params , param_count , params ) ; if ( res != TEE_SUCCESS ) goto out ; res = tee_svc_cryp_check_attr ( ATTR_USAGE_GENERATE_KEY , type_props , params , param_count ) ; if ( res != TEE_SUCCESS ) goto out ; switch ( o -> info . objectType ) { case TEE_TYPE_AES : case TEE_TYPE_DES : case TEE_TYPE_DES3 : case TEE_TYPE_HMAC_MD5 : case TEE_TYPE_HMAC_SHA1 : case TEE_TYPE_HMAC_SHA224 : case TEE_TYPE_HMAC_SHA256 : case TEE_TYPE_HMAC_SHA384 : case TEE_TYPE_HMAC_SHA512 : case TEE_TYPE_GENERIC_SECRET : byte_size = key_size / 8 ; if ( o -> info . objectType == TEE_TYPE_DES || o -> info . objectType == TEE_TYPE_DES3 ) { byte_size = ( key_size + key_size / 7 ) / 8 ; } key = ( struct tee_cryp_obj_secret * ) o -> attr ; if ( byte_size > key -> alloc_size ) { res = TEE_ERROR_EXCESS_DATA ; goto out ; } res = crypto_rng_read ( ( void * ) ( key + 1 ) , byte_size ) ; if ( res != TEE_SUCCESS ) goto out ; key -> key_size = byte_size ; o -> have_attrs = ( 1 << type_props -> num_type_attrs ) - 1 ; break ; case TEE_TYPE_RSA_KEYPAIR : res = tee_svc_obj_generate_key_rsa ( o , type_props , key_size , params , param_count ) ; if ( res != TEE_SUCCESS ) goto out ; break ; case TEE_TYPE_DSA_KEYPAIR : res = tee_svc_obj_generate_key_dsa ( o , type_props , key_size ) ; if ( res != TEE_SUCCESS ) goto out ; break ; case TEE_TYPE_DH_KEYPAIR : res = tee_svc_obj_generate_key_dh ( o , type_props , key_size , params , param_count ) ; if ( res != TEE_SUCCESS ) goto out ; break ; case TEE_TYPE_ECDSA_KEYPAIR : case TEE_TYPE_ECDH_KEYPAIR : res = tee_svc_obj_generate_key_ecc ( o , type_props , key_size , params , param_count ) ; if ( res != TEE_SUCCESS ) goto out ; break ; default : res = TEE_ERROR_BAD_FORMAT ; } out : free ( params ) ; if ( res == TEE_SUCCESS ) { o -> info . keySize = key_size ; o -> info . handleFlags |= TEE_HANDLE_FLAG_INITIALIZED ; } return res ; }
<S2SV_ModStart> return TEE_ERROR_NOT_SUPPORTED ; size_t alloc_size = 0 ; if ( MUL_OVERFLOW ( sizeof ( TEE_Attribute ) , param_count , & alloc_size ) ) return TEE_ERROR_OVERFLOW ; <S2SV_ModStart> = malloc ( alloc_size <S2SV_ModEnd> ) ; if
OP-TEE@optee_os/a637243270fc1faae16de059091795c32d86e65e
CVE-2019-1010297
https://github.com/OP-TEE/optee_os/commit/a637243270fc1faae16de059091795c32d86e65e
2019-07-15T18:15Z
343
CWE-119
CWE-119 static vpx_codec_err_t vp8e_mr_alloc_mem ( const vpx_codec_enc_cfg_t * cfg , void * * mem_loc ) { vpx_codec_err_t res = 0 ; # if CONFIG_MULTI_RES_ENCODING LOWER_RES_FRAME_INFO * shared_mem_loc ; int mb_rows = ( ( cfg -> g_w + 15 ) >> 4 ) ; int mb_cols = ( ( cfg -> g_h + 15 ) >> 4 ) ; shared_mem_loc = calloc ( 1 , sizeof ( LOWER_RES_FRAME_INFO ) ) ; if ( ! shared_mem_loc ) { res = VPX_CODEC_MEM_ERROR ; } shared_mem_loc -> mb_info = calloc ( mb_rows * mb_cols , sizeof ( LOWER_RES_MB_INFO ) ) ; if ( ! ( shared_mem_loc -> mb_info ) ) { res = VPX_CODEC_MEM_ERROR ; } else { * mem_loc = ( void * ) shared_mem_loc ; res = VPX_CODEC_OK ; } <S2SV_StartBug> # endif <S2SV_EndBug> return res ; }
<S2SV_ModStart> ; } # else ( void ) cfg ; ( void ) mem_loc ; #
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
344
CWE-120
CWE-120 void test_base64_lengths ( void ) { const char * in = "FuseMuse" ; char out1 [ 32 ] ; char out2 [ 32 ] ; size_t enclen ; int declen ; enclen = mutt_b64_encode ( out1 , in , 0 , 32 ) ; if ( ! TEST_CHECK ( enclen == 0 ) ) { TEST_MSG ( "Expected:<S2SV_blank>%zu" , 0 ) ; TEST_MSG ( "Actual<S2SV_blank><S2SV_blank>:<S2SV_blank>%zu" , enclen ) ; } out1 [ 0 ] = '\\0' ; <S2SV_StartBug> declen = mutt_b64_decode ( out2 , out1 ) ; <S2SV_EndBug> if ( ! TEST_CHECK ( declen == - 1 ) ) { TEST_MSG ( "Expected:<S2SV_blank>%zu" , - 1 ) ; TEST_MSG ( "Actual<S2SV_blank><S2SV_blank>:<S2SV_blank>%zu" , declen ) ; } for ( size_t i = 1 ; i <= 8 ; ++ i ) { enclen = mutt_b64_encode ( out1 , in , i , 32 ) ; size_t exp = ( ( i + 2 ) / 3 ) << 2 ; if ( ! TEST_CHECK ( enclen == exp ) ) { TEST_MSG ( "Expected:<S2SV_blank>%zu" , exp ) ; TEST_MSG ( "Actual<S2SV_blank><S2SV_blank>:<S2SV_blank>%zu" , enclen ) ; } <S2SV_StartBug> declen = mutt_b64_decode ( out2 , out1 ) ; <S2SV_EndBug> if ( ! TEST_CHECK ( declen == i ) ) { TEST_MSG ( "Expected:<S2SV_blank>%zu" , i ) ; TEST_MSG ( "Actual<S2SV_blank><S2SV_blank>:<S2SV_blank>%zu" , declen ) ; } out2 [ declen ] = '\\0' ; if ( ! TEST_CHECK ( strncmp ( out2 , in , i ) == 0 ) ) { TEST_MSG ( "Expected:<S2SV_blank>%s" , in ) ; TEST_MSG ( "Actual<S2SV_blank><S2SV_blank>:<S2SV_blank>%s" , out2 ) ; } } }
<S2SV_ModStart> out2 , out1 , sizeof ( out2 ) <S2SV_ModStart> out2 , out1 , sizeof ( out2 )
neomutt@neomutt/6f163e07ae68654d7ac5268cbb7565f6df79ad85
CVE-2018-14359
https://github.com/neomutt/neomutt/commit/6f163e07ae68654d7ac5268cbb7565f6df79ad85
2018-07-17T17:29Z
345
CWE-20
CWE-20 static int keyring_search_iterator ( const void * object , void * iterator_data ) { struct keyring_search_context * ctx = iterator_data ; const struct key * key = keyring_ptr_to_key ( object ) ; <S2SV_StartBug> unsigned long kflags = key -> flags ; <S2SV_EndBug> kenter ( "{%d}" , key -> serial ) ; if ( key -> type != ctx -> index_key . type ) { kleave ( "<S2SV_blank>=<S2SV_blank>0<S2SV_blank>[!type]" ) ; return 0 ; } if ( ctx -> flags & KEYRING_SEARCH_DO_STATE_CHECK ) { if ( kflags & ( ( 1 << KEY_FLAG_INVALIDATED ) | ( 1 << KEY_FLAG_REVOKED ) ) ) { ctx -> result = ERR_PTR ( - EKEYREVOKED ) ; kleave ( "<S2SV_blank>=<S2SV_blank>%d<S2SV_blank>[invrev]" , ctx -> skipped_ret ) ; goto skipped ; } if ( key -> expiry && ctx -> now . tv_sec >= key -> expiry ) { if ( ! ( ctx -> flags & KEYRING_SEARCH_SKIP_EXPIRED ) ) ctx -> result = ERR_PTR ( - EKEYEXPIRED ) ; kleave ( "<S2SV_blank>=<S2SV_blank>%d<S2SV_blank>[expire]" , ctx -> skipped_ret ) ; goto skipped ; } } if ( ! ctx -> match_data . cmp ( key , & ctx -> match_data ) ) { kleave ( "<S2SV_blank>=<S2SV_blank>0<S2SV_blank>[!match]" ) ; return 0 ; } if ( ! ( ctx -> flags & KEYRING_SEARCH_NO_CHECK_PERM ) && key_task_permission ( make_key_ref ( key , ctx -> possessed ) , ctx -> cred , KEY_NEED_SEARCH ) < 0 ) { ctx -> result = ERR_PTR ( - EACCES ) ; kleave ( "<S2SV_blank>=<S2SV_blank>%d<S2SV_blank>[!perm]" , ctx -> skipped_ret ) ; goto skipped ; } if ( ctx -> flags & KEYRING_SEARCH_DO_STATE_CHECK ) { <S2SV_StartBug> if ( kflags & ( 1 << KEY_FLAG_NEGATIVE ) ) { <S2SV_EndBug> smp_rmb ( ) ; <S2SV_StartBug> ctx -> result = ERR_PTR ( key -> reject_error ) ; <S2SV_EndBug> kleave ( "<S2SV_blank>=<S2SV_blank>%d<S2SV_blank>[neg]" , ctx -> skipped_ret ) ; goto skipped ; } } ctx -> result = make_key_ref ( key , ctx -> possessed ) ; kleave ( "<S2SV_blank>=<S2SV_blank>1<S2SV_blank>[found]" ) ; return 1 ; skipped : return ctx -> skipped_ret ; }
<S2SV_ModStart> long kflags = READ_ONCE ( key -> flags ) ; short state = READ_ONCE ( key -> state ) <S2SV_ModEnd> ; kenter ( <S2SV_ModStart> { if ( state < 0 ) { <S2SV_ModEnd> ctx -> result <S2SV_ModStart> = ERR_PTR ( state <S2SV_ModEnd> ) ; kleave
torvalds@linux/363b02dab09b3226f3bd1420dad9c72b79a42a76
CVE-2017-15951
https://github.com/torvalds/linux/commit/363b02dab09b3226f3bd1420dad9c72b79a42a76
2017-10-28T02:29Z
346
CWE-119
CWE-119 static vpx_codec_err_t validate_config ( vpx_codec_alg_priv_t * ctx , const vpx_codec_enc_cfg_t * cfg , const struct vp8_extracfg * vp8_cfg , int finalize ) { RANGE_CHECK ( cfg , g_w , 1 , 16383 ) ; RANGE_CHECK ( cfg , g_h , 1 , 16383 ) ; RANGE_CHECK ( cfg , g_timebase . den , 1 , 1000000000 ) ; <S2SV_StartBug> RANGE_CHECK ( cfg , g_timebase . num , 1 , cfg -> g_timebase . den ) ; <S2SV_EndBug> RANGE_CHECK_HI ( cfg , g_profile , 3 ) ; RANGE_CHECK_HI ( cfg , rc_max_quantizer , 63 ) ; RANGE_CHECK_HI ( cfg , rc_min_quantizer , cfg -> rc_max_quantizer ) ; RANGE_CHECK_HI ( cfg , g_threads , 64 ) ; # if CONFIG_REALTIME_ONLY RANGE_CHECK_HI ( cfg , g_lag_in_frames , 0 ) ; # elif CONFIG_MULTI_RES_ENCODING if ( ctx -> base . enc . total_encoders > 1 ) RANGE_CHECK_HI ( cfg , g_lag_in_frames , 0 ) ; # else RANGE_CHECK_HI ( cfg , g_lag_in_frames , 25 ) ; # endif RANGE_CHECK ( cfg , rc_end_usage , VPX_VBR , VPX_Q ) ; RANGE_CHECK_HI ( cfg , rc_undershoot_pct , 1000 ) ; RANGE_CHECK_HI ( cfg , rc_overshoot_pct , 1000 ) ; RANGE_CHECK_HI ( cfg , rc_2pass_vbr_bias_pct , 100 ) ; RANGE_CHECK ( cfg , kf_mode , VPX_KF_DISABLED , VPX_KF_AUTO ) ; # if CONFIG_MULTI_RES_ENCODING if ( ctx -> base . enc . total_encoders > 1 ) RANGE_CHECK_HI ( cfg , rc_resize_allowed , 0 ) ; # else RANGE_CHECK_BOOL ( cfg , rc_resize_allowed ) ; # endif RANGE_CHECK_HI ( cfg , rc_dropframe_thresh , 100 ) ; RANGE_CHECK_HI ( cfg , rc_resize_up_thresh , 100 ) ; RANGE_CHECK_HI ( cfg , rc_resize_down_thresh , 100 ) ; # if CONFIG_REALTIME_ONLY RANGE_CHECK ( cfg , g_pass , VPX_RC_ONE_PASS , VPX_RC_ONE_PASS ) ; # elif CONFIG_MULTI_RES_ENCODING if ( ctx -> base . enc . total_encoders > 1 ) RANGE_CHECK ( cfg , g_pass , VPX_RC_ONE_PASS , VPX_RC_ONE_PASS ) ; # else RANGE_CHECK ( cfg , g_pass , VPX_RC_ONE_PASS , VPX_RC_LAST_PASS ) ; # endif if ( cfg -> kf_mode != VPX_KF_DISABLED && cfg -> kf_min_dist != cfg -> kf_max_dist && cfg -> kf_min_dist > 0 ) ERROR ( "kf_min_dist<S2SV_blank>not<S2SV_blank>supported<S2SV_blank>in<S2SV_blank>auto<S2SV_blank>mode,<S2SV_blank>use<S2SV_blank>0<S2SV_blank>" "or<S2SV_blank>kf_max_dist<S2SV_blank>instead." ) ; RANGE_CHECK_BOOL ( vp8_cfg , enable_auto_alt_ref ) ; RANGE_CHECK ( vp8_cfg , cpu_used , - 16 , 16 ) ; # if CONFIG_REALTIME_ONLY && ! CONFIG_TEMPORAL_DENOISING RANGE_CHECK ( vp8_cfg , noise_sensitivity , 0 , 0 ) ; # else RANGE_CHECK_HI ( vp8_cfg , noise_sensitivity , 6 ) ; # endif RANGE_CHECK ( vp8_cfg , token_partitions , VP8_ONE_TOKENPARTITION , VP8_EIGHT_TOKENPARTITION ) ; RANGE_CHECK_HI ( vp8_cfg , Sharpness , 7 ) ; RANGE_CHECK ( vp8_cfg , arnr_max_frames , 0 , 15 ) ; RANGE_CHECK_HI ( vp8_cfg , arnr_strength , 6 ) ; RANGE_CHECK ( vp8_cfg , arnr_type , 1 , 3 ) ; <S2SV_StartBug> RANGE_CHECK ( vp8_cfg , cq_level , 0 , 63 ) ; <S2SV_EndBug> if ( finalize && ( cfg -> rc_end_usage == VPX_CQ || cfg -> rc_end_usage == VPX_Q ) ) RANGE_CHECK ( vp8_cfg , cq_level , cfg -> rc_min_quantizer , cfg -> rc_max_quantizer ) ; # if ! ( CONFIG_REALTIME_ONLY ) if ( cfg -> g_pass == VPX_RC_LAST_PASS ) { size_t packet_sz = sizeof ( FIRSTPASS_STATS ) ; int n_packets = ( int ) ( cfg -> rc_twopass_stats_in . sz / packet_sz ) ; FIRSTPASS_STATS * stats ; if ( ! cfg -> rc_twopass_stats_in . buf ) ERROR ( "rc_twopass_stats_in.buf<S2SV_blank>not<S2SV_blank>set." ) ; if ( cfg -> rc_twopass_stats_in . sz % packet_sz ) ERROR ( "rc_twopass_stats_in.sz<S2SV_blank>indicates<S2SV_blank>truncated<S2SV_blank>packet." ) ; if ( cfg -> rc_twopass_stats_in . sz < 2 * packet_sz ) ERROR ( "rc_twopass_stats_in<S2SV_blank>requires<S2SV_blank>at<S2SV_blank>least<S2SV_blank>two<S2SV_blank>packets." ) ; stats = ( void * ) ( ( char * ) cfg -> rc_twopass_stats_in . buf + ( n_packets - 1 ) * packet_sz ) ; if ( ( int ) ( stats -> count + 0.5 ) != n_packets - 1 ) ERROR ( "rc_twopass_stats_in<S2SV_blank>missing<S2SV_blank>EOS<S2SV_blank>stats<S2SV_blank>packet" ) ; } # endif RANGE_CHECK ( cfg , ts_number_layers , 1 , 5 ) ; if ( cfg -> ts_number_layers > 1 ) { unsigned int i ; RANGE_CHECK_HI ( cfg , ts_periodicity , 16 ) ; for ( i = 1 ; i < cfg -> ts_number_layers ; i ++ ) <S2SV_StartBug> if ( cfg -> ts_target_bitrate [ i ] <= cfg -> ts_target_bitrate [ i - 1 ] ) <S2SV_EndBug> ERROR ( "ts_target_bitrate<S2SV_blank>entries<S2SV_blank>are<S2SV_blank>not<S2SV_blank>strictly<S2SV_blank>increasing" ) ; RANGE_CHECK ( cfg , ts_rate_decimator [ cfg -> ts_number_layers - 1 ] , 1 , 1 ) ; for ( i = cfg -> ts_number_layers - 2 ; i > 0 ; i -- ) if ( cfg -> ts_rate_decimator [ i - 1 ] != 2 * cfg -> ts_rate_decimator [ i ] ) ERROR ( "ts_rate_decimator<S2SV_blank>factors<S2SV_blank>are<S2SV_blank>not<S2SV_blank>powers<S2SV_blank>of<S2SV_blank>2" ) ; RANGE_CHECK_HI ( cfg , ts_layer_id [ i ] , cfg -> ts_number_layers - 1 ) ; } # if ( CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING ) if ( cfg -> g_threads > ( 1 << vp8_cfg -> token_partitions ) ) ERROR ( "g_threads<S2SV_blank>cannot<S2SV_blank>be<S2SV_blank>bigger<S2SV_blank>than<S2SV_blank>number<S2SV_blank>of<S2SV_blank>token<S2SV_blank>partitions" ) ; # endif return VPX_CODEC_OK ; }
<S2SV_ModStart> , 1 , 1000000000 <S2SV_ModEnd> ) ; RANGE_CHECK_HI <S2SV_ModStart> 0 , 63 ) ; RANGE_CHECK_HI ( vp8_cfg , screen_content_mode , 2 <S2SV_ModStart> - 1 ] && cfg -> rc_target_bitrate > 0
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
347
CWE-119
CWE-119 int rtp_packetize_xiph_config ( sout_stream_id_sys_t * id , const char * fmtp , int64_t i_pts ) { if ( fmtp == NULL ) return VLC_EGENERIC ; char * start = strstr ( fmtp , "configuration=" ) ; assert ( start != NULL ) ; start += sizeof ( "configuration=" ) - 1 ; char * end = strchr ( start , ';' ) ; assert ( end != NULL ) ; size_t len = end - start ; <S2SV_StartBug> char b64 [ len + 1 ] ; <S2SV_EndBug> memcpy ( b64 , start , len ) ; b64 [ len ] = '\\0' ; int i_max = rtp_mtu ( id ) - 6 ; uint8_t * p_orig , * p_data ; int i_data ; <S2SV_StartBug> i_data = vlc_b64_decode_binary ( & p_orig , b64 ) ; <S2SV_EndBug> if ( i_data <= 9 ) { free ( p_orig ) ; return VLC_EGENERIC ; } p_data = p_orig + 9 ; i_data -= 9 ; int i_count = ( i_data + i_max - 1 ) / i_max ; for ( int i = 0 ; i < i_count ; i ++ ) { int i_payload = __MIN ( i_max , i_data ) ; block_t * out = block_Alloc ( 18 + i_payload ) ; unsigned fragtype , numpkts ; if ( i_count == 1 ) { fragtype = 0 ; numpkts = 1 ; } else { numpkts = 0 ; if ( i == 0 ) fragtype = 1 ; else if ( i == i_count - 1 ) fragtype = 3 ; else fragtype = 2 ; } uint32_t header = ( ( XIPH_IDENT & 0xffffff ) << 8 ) | ( fragtype << 6 ) | ( 1 << 4 ) | numpkts ; rtp_packetize_common ( id , out , 0 , i_pts ) ; SetDWBE ( out -> p_buffer + 12 , header ) ; SetWBE ( out -> p_buffer + 16 , i_payload ) ; memcpy ( & out -> p_buffer [ 18 ] , p_data , i_payload ) ; out -> i_dts = i_pts ; rtp_packetize_send ( id , out ) ; p_data += i_payload ; i_data -= i_payload ; } free ( p_orig ) ; return VLC_SUCCESS ; }
<S2SV_ModStart> start ; char * b64 = malloc ( <S2SV_ModEnd> len + 1 <S2SV_ModStart> len + 1 ) ; if ( ! b64 ) return VLC_EGENERIC <S2SV_ModEnd> ; memcpy ( <S2SV_ModStart> & p_orig , b64 ) ; free (
videolan@vlc/204291467724867b79735c0ee3aeb0dbc2200f97
CVE-2014-9630
https://github.com/videolan/vlc/commit/204291467724867b79735c0ee3aeb0dbc2200f97
2020-01-24T22:15Z
348
CWE-125
CWE-125 u_int fr_print ( netdissect_options * ndo , register const u_char * p , u_int length ) { int ret ; uint16_t extracted_ethertype ; u_int dlci ; u_int addr_len ; uint16_t nlpid ; u_int hdr_len ; uint8_t flags [ 4 ] ; ret = parse_q922_addr ( ndo , p , & dlci , & addr_len , flags , length ) ; if ( ret == - 1 ) goto trunc ; if ( ret == 0 ) { ND_PRINT ( ( ndo , "Q.922,<S2SV_blank>invalid<S2SV_blank>address" ) ) ; return 0 ; } ND_TCHECK ( p [ addr_len ] ) ; if ( length < addr_len + 1 ) goto trunc ; if ( p [ addr_len ] != LLC_UI && dlci != 0 ) { if ( ! ND_TTEST2 ( p [ addr_len ] , 2 ) || length < addr_len + 2 ) { ND_PRINT ( ( ndo , "UI<S2SV_blank>%02x!<S2SV_blank>" , p [ addr_len ] ) ) ; } else { extracted_ethertype = EXTRACT_16BITS ( p + addr_len ) ; if ( ndo -> ndo_eflag ) fr_hdr_print ( ndo , length , addr_len , dlci , flags , extracted_ethertype ) ; if ( ethertype_print ( ndo , extracted_ethertype , p + addr_len + ETHERTYPE_LEN , length - addr_len - ETHERTYPE_LEN , ndo -> ndo_snapend - p - addr_len - ETHERTYPE_LEN , NULL , NULL ) == 0 ) ND_PRINT ( ( ndo , "UI<S2SV_blank>%02x!<S2SV_blank>" , p [ addr_len ] ) ) ; else return addr_len + 2 ; } } ND_TCHECK ( p [ addr_len + 1 ] ) ; if ( length < addr_len + 2 ) goto trunc ; if ( p [ addr_len + 1 ] == 0 ) { if ( addr_len != 3 ) ND_PRINT ( ( ndo , "Pad!<S2SV_blank>" ) ) ; hdr_len = addr_len + 1 + 1 + 1 ; } else { if ( addr_len == 3 ) ND_PRINT ( ( ndo , "No<S2SV_blank>pad!<S2SV_blank>" ) ) ; hdr_len = addr_len + 1 + 1 ; } ND_TCHECK ( p [ hdr_len - 1 ] ) ; if ( length < hdr_len ) goto trunc ; nlpid = p [ hdr_len - 1 ] ; if ( ndo -> ndo_eflag ) fr_hdr_print ( ndo , length , addr_len , dlci , flags , nlpid ) ; p += hdr_len ; length -= hdr_len ; switch ( nlpid ) { case NLPID_IP : ip_print ( ndo , p , length ) ; break ; case NLPID_IP6 : ip6_print ( ndo , p , length ) ; break ; case NLPID_CLNP : case NLPID_ESIS : case NLPID_ISIS : <S2SV_StartBug> isoclns_print ( ndo , p - 1 , length + 1 , ndo -> ndo_snapend - p + 1 ) ; <S2SV_EndBug> break ; case NLPID_SNAP : if ( snap_print ( ndo , p , length , ndo -> ndo_snapend - p , NULL , NULL , 0 ) == 0 ) { if ( ! ndo -> ndo_eflag ) fr_hdr_print ( ndo , length + hdr_len , hdr_len , dlci , flags , nlpid ) ; if ( ! ndo -> ndo_suppress_default_print ) ND_DEFAULTPRINT ( p - hdr_len , length + hdr_len ) ; } break ; case NLPID_Q933 : q933_print ( ndo , p , length ) ; break ; case NLPID_MFR : frf15_print ( ndo , p , length ) ; break ; case NLPID_PPP : ppp_print ( ndo , p , length ) ; break ; default : if ( ! ndo -> ndo_eflag ) fr_hdr_print ( ndo , length + hdr_len , addr_len , dlci , flags , nlpid ) ; if ( ! ndo -> ndo_xflag ) ND_DEFAULTPRINT ( p , length ) ; } return hdr_len ; trunc : ND_PRINT ( ( ndo , "[|fr]" ) ) ; return 0 ; }
<S2SV_ModStart> length + 1 ) ; break ; case NLPID_SNAP : if ( snap_print ( ndo , p , length <S2SV_ModStart> ndo_snapend - p <S2SV_ModEnd> , NULL ,
the-tcpdump-group@tcpdump/1dcd10aceabbc03bf571ea32b892c522cbe923de
CVE-2017-12897
https://github.com/the-tcpdump-group/tcpdump/commit/1dcd10aceabbc03bf571ea32b892c522cbe923de
2017-09-14T06:29Z
349
CWE-20
CWE-20 long keyctl_chown_key ( key_serial_t id , uid_t user , gid_t group ) { struct key_user * newowner , * zapowner = NULL ; struct key * key ; key_ref_t key_ref ; long ret ; kuid_t uid ; kgid_t gid ; uid = make_kuid ( current_user_ns ( ) , user ) ; gid = make_kgid ( current_user_ns ( ) , group ) ; ret = - EINVAL ; if ( ( user != ( uid_t ) - 1 ) && ! uid_valid ( uid ) ) goto error ; if ( ( group != ( gid_t ) - 1 ) && ! gid_valid ( gid ) ) goto error ; ret = 0 ; if ( user == ( uid_t ) - 1 && group == ( gid_t ) - 1 ) goto error ; key_ref = lookup_user_key ( id , KEY_LOOKUP_CREATE | KEY_LOOKUP_PARTIAL , KEY_NEED_SETATTR ) ; if ( IS_ERR ( key_ref ) ) { ret = PTR_ERR ( key_ref ) ; goto error ; } key = key_ref_to_ptr ( key_ref ) ; ret = - EACCES ; down_write ( & key -> sem ) ; if ( ! capable ( CAP_SYS_ADMIN ) ) { if ( user != ( uid_t ) - 1 && ! uid_eq ( key -> uid , uid ) ) goto error_put ; if ( group != ( gid_t ) - 1 && ! gid_eq ( gid , key -> gid ) && ! in_group_p ( gid ) ) goto error_put ; } if ( user != ( uid_t ) - 1 && ! uid_eq ( uid , key -> uid ) ) { ret = - ENOMEM ; newowner = key_user_lookup ( uid ) ; if ( ! newowner ) goto error_put ; if ( test_bit ( KEY_FLAG_IN_QUOTA , & key -> flags ) ) { unsigned maxkeys = uid_eq ( uid , GLOBAL_ROOT_UID ) ? key_quota_root_maxkeys : key_quota_maxkeys ; unsigned maxbytes = uid_eq ( uid , GLOBAL_ROOT_UID ) ? key_quota_root_maxbytes : key_quota_maxbytes ; spin_lock ( & newowner -> lock ) ; if ( newowner -> qnkeys + 1 >= maxkeys || newowner -> qnbytes + key -> quotalen >= maxbytes || newowner -> qnbytes + key -> quotalen < newowner -> qnbytes ) goto quota_overrun ; newowner -> qnkeys ++ ; newowner -> qnbytes += key -> quotalen ; spin_unlock ( & newowner -> lock ) ; spin_lock ( & key -> user -> lock ) ; key -> user -> qnkeys -- ; key -> user -> qnbytes -= key -> quotalen ; spin_unlock ( & key -> user -> lock ) ; } atomic_dec ( & key -> user -> nkeys ) ; atomic_inc ( & newowner -> nkeys ) ; <S2SV_StartBug> if ( test_bit ( KEY_FLAG_INSTANTIATED , & key -> flags ) ) { <S2SV_EndBug> atomic_dec ( & key -> user -> nikeys ) ; atomic_inc ( & newowner -> nikeys ) ; } zapowner = key -> user ; key -> user = newowner ; key -> uid = uid ; } if ( group != ( gid_t ) - 1 ) key -> gid = gid ; ret = 0 ; error_put : up_write ( & key -> sem ) ; key_put ( key ) ; if ( zapowner ) key_user_put ( zapowner ) ; error : return ret ; quota_overrun : spin_unlock ( & newowner -> lock ) ; zapowner = newowner ; ret = - EDQUOT ; goto error_put ; }
<S2SV_ModStart> ; if ( key -> state != KEY_IS_UNINSTANTIATED <S2SV_ModEnd> ) { atomic_dec
torvalds@linux/363b02dab09b3226f3bd1420dad9c72b79a42a76
CVE-2017-15951
https://github.com/torvalds/linux/commit/363b02dab09b3226f3bd1420dad9c72b79a42a76
2017-10-28T02:29Z
350
CWE-189
CWE-189 int do_adjtimex ( struct timex * txc ) { <S2SV_StartBug> long mtemp , save_adjust , rem ; <S2SV_EndBug> s64 freq_adj ; int result ; if ( txc -> modes && ! capable ( CAP_SYS_TIME ) ) return - EPERM ; if ( ( txc -> modes & ADJ_OFFSET_SINGLESHOT ) == ADJ_OFFSET_SINGLESHOT ) { if ( txc -> modes != ADJ_OFFSET_SINGLESHOT && txc -> modes != ADJ_OFFSET_SS_READ ) return - EINVAL ; } if ( txc -> modes != ADJ_OFFSET_SINGLESHOT && ( txc -> modes & ADJ_OFFSET ) ) if ( txc -> offset <= - MAXPHASE || txc -> offset >= MAXPHASE ) return - EINVAL ; if ( txc -> modes & ADJ_TICK ) if ( txc -> tick < 900000 / USER_HZ || txc -> tick > 1100000 / USER_HZ ) return - EINVAL ; write_seqlock_irq ( & xtime_lock ) ; result = time_state ; save_adjust = time_adjust ; # if 0 time_status &= ~ STA_CLOCKERR ; # endif if ( txc -> modes ) { if ( txc -> modes & ADJ_STATUS ) time_status = ( txc -> status & ~ STA_RONLY ) | ( time_status & STA_RONLY ) ; if ( txc -> modes & ADJ_FREQUENCY ) { if ( txc -> freq > MAXFREQ || txc -> freq < - MAXFREQ ) { result = - EINVAL ; goto leave ; } time_freq = ( ( s64 ) txc -> freq * NSEC_PER_USEC ) >> ( SHIFT_USEC - SHIFT_NSEC ) ; } if ( txc -> modes & ADJ_MAXERROR ) { if ( txc -> maxerror < 0 || txc -> maxerror >= NTP_PHASE_LIMIT ) { result = - EINVAL ; goto leave ; } time_maxerror = txc -> maxerror ; } if ( txc -> modes & ADJ_ESTERROR ) { if ( txc -> esterror < 0 || txc -> esterror >= NTP_PHASE_LIMIT ) { result = - EINVAL ; goto leave ; } time_esterror = txc -> esterror ; } if ( txc -> modes & ADJ_TIMECONST ) { if ( txc -> constant < 0 ) { result = - EINVAL ; goto leave ; } time_constant = min ( txc -> constant + 4 , ( long ) MAXTC ) ; } if ( txc -> modes & ADJ_OFFSET ) { if ( txc -> modes == ADJ_OFFSET_SINGLESHOT ) { time_adjust = txc -> offset ; } else if ( time_status & STA_PLL ) { time_offset = txc -> offset * NSEC_PER_USEC ; time_offset = min ( time_offset , ( s64 ) MAXPHASE * NSEC_PER_USEC ) ; time_offset = max ( time_offset , ( s64 ) - MAXPHASE * NSEC_PER_USEC ) ; if ( time_status & STA_FREQHOLD || time_reftime == 0 ) time_reftime = xtime . tv_sec ; mtemp = xtime . tv_sec - time_reftime ; time_reftime = xtime . tv_sec ; freq_adj = time_offset * mtemp ; freq_adj = shift_right ( freq_adj , time_constant * 2 + ( SHIFT_PLL + 2 ) * 2 - SHIFT_NSEC ) ; if ( mtemp >= MINSEC && ( time_status & STA_FLL || mtemp > MAXSEC ) ) freq_adj += div_s64 ( time_offset << ( SHIFT_NSEC - SHIFT_FLL ) , mtemp ) ; freq_adj += time_freq ; freq_adj = min ( freq_adj , ( s64 ) MAXFREQ_NSEC ) ; time_freq = max ( freq_adj , ( s64 ) - MAXFREQ_NSEC ) ; <S2SV_StartBug> time_offset = div_long_long_rem_signed ( time_offset , <S2SV_EndBug> <S2SV_StartBug> NTP_INTERVAL_FREQ , <S2SV_EndBug> & rem ) ; time_offset <<= SHIFT_UPDATE ; } } if ( txc -> modes & ADJ_TICK ) tick_usec = txc -> tick ; if ( txc -> modes & ( ADJ_TICK | ADJ_FREQUENCY | ADJ_OFFSET ) ) ntp_update_frequency ( ) ; } leave : if ( ( time_status & ( STA_UNSYNC | STA_CLOCKERR ) ) != 0 ) result = TIME_ERROR ; if ( ( txc -> modes == ADJ_OFFSET_SINGLESHOT ) || ( txc -> modes == ADJ_OFFSET_SS_READ ) ) txc -> offset = save_adjust ; else txc -> offset = ( ( long ) shift_right ( time_offset , SHIFT_UPDATE ) ) * NTP_INTERVAL_FREQ / 1000 ; txc -> freq = ( time_freq / NSEC_PER_USEC ) << ( SHIFT_USEC - SHIFT_NSEC ) ; txc -> maxerror = time_maxerror ; txc -> esterror = time_esterror ; txc -> status = time_status ; txc -> constant = time_constant ; txc -> precision = 1 ; txc -> tolerance = MAXFREQ ; txc -> tick = tick_usec ; txc -> ppsfreq = 0 ; txc -> jitter = 0 ; txc -> shift = 0 ; txc -> stabil = 0 ; txc -> jitcnt = 0 ; txc -> calcnt = 0 ; txc -> errcnt = 0 ; txc -> stbcnt = 0 ; write_sequnlock_irq ( & xtime_lock ) ; do_gettimeofday ( & txc -> time ) ; notify_cmos_timer ( ) ; return ( result ) ; }
<S2SV_ModStart> mtemp , save_adjust <S2SV_ModEnd> ; s64 freq_adj <S2SV_ModStart> ; time_offset = div_s64 <S2SV_ModEnd> ( time_offset , <S2SV_ModStart> time_offset , NTP_INTERVAL_FREQ <S2SV_ModEnd> ) ; time_offset
torvalds@linux/f8bd2258e2d520dff28c855658bd24bdafb5102d
CVE-2011-3209
https://github.com/torvalds/linux/commit/f8bd2258e2d520dff28c855658bd24bdafb5102d
2012-10-03T11:02Z
351
CWE-119
CWE-119 void SWFShape_setLeftFillStyle ( SWFShape shape , SWFFillStyle fill ) { ShapeRecord record ; int idx ; if ( shape -> isEnded || shape -> isMorph ) return ; if ( fill == NOFILL ) { record = addStyleRecord ( shape ) ; record . record . stateChange -> leftFill = 0 ; record . record . stateChange -> flags |= SWF_SHAPE_FILLSTYLE0FLAG ; return ; } idx = getFillIdx ( shape , fill ) ; if ( idx == 0 ) { SWFFillStyle_addDependency ( fill , ( SWFCharacter ) shape ) ; if ( addFillStyle ( shape , fill ) < 0 ) return ; idx = getFillIdx ( shape , fill ) ; } <S2SV_StartBug> record = addStyleRecord ( shape ) ; <S2SV_EndBug> record . record . stateChange -> leftFill = idx ; record . record . stateChange -> flags |= SWF_SHAPE_FILLSTYLE0FLAG ; }
<S2SV_ModStart> ) ; } else if ( idx >= 255 && shape -> useVersion == SWF_SHAPE1 ) { SWF_error ( "Too<S2SV_blank>many<S2SV_blank>fills<S2SV_blank>for<S2SV_blank>SWFShape<S2SV_blank>V1.\\n" "Use<S2SV_blank>a<S2SV_blank>higher<S2SV_blank>SWFShape<S2SV_blank>version\\n" ) ; }
libming@libming/6e76e8c71cb51c8ba0aa9737a636b9ac3029887f
CVE-2019-12981
https://github.com/libming/libming/commit/6e76e8c71cb51c8ba0aa9737a636b9ac3029887f
2019-06-26T18:15Z
352
CWE-20
CWE-20 static int atalk_recvmsg ( struct kiocb * iocb , struct socket * sock , struct msghdr * msg , size_t size , int flags ) { <S2SV_StartBug> struct sock * sk = sock -> sk ; <S2SV_EndBug> struct sockaddr_at * sat = ( struct sockaddr_at * ) msg -> msg_name ; struct ddpehdr * ddp ; int copied = 0 ; int offset = 0 ; int err = 0 ; struct sk_buff * skb ; skb = skb_recv_datagram ( sk , flags & ~ MSG_DONTWAIT , flags & MSG_DONTWAIT , & err ) ; lock_sock ( sk ) ; if ( ! skb ) goto out ; ddp = ddp_hdr ( skb ) ; copied = ntohs ( ddp -> deh_len_hops ) & 1023 ; if ( sk -> sk_type != SOCK_RAW ) { offset = sizeof ( * ddp ) ; copied -= offset ; } if ( copied > size ) { copied = size ; msg -> msg_flags |= MSG_TRUNC ; } err = skb_copy_datagram_iovec ( skb , offset , msg -> msg_iov , copied ) ; <S2SV_StartBug> if ( ! err ) { <S2SV_EndBug> if ( sat ) { sat -> sat_family = AF_APPLETALK ; sat -> sat_port = ddp -> deh_sport ; sat -> sat_addr . s_node = ddp -> deh_snode ; sat -> sat_addr . s_net = ddp -> deh_snet ; <S2SV_StartBug> } <S2SV_EndBug> msg -> msg_namelen = sizeof ( * sat ) ; } skb_free_datagram ( sk , skb ) ; out : release_sock ( sk ) ; return err ? : copied ; }
<S2SV_ModStart> sock -> sk <S2SV_ModEnd> ; struct ddpehdr <S2SV_ModStart> ( ! err && msg -> msg_name ) { struct sockaddr_at * sat = msg -> msg_name ; <S2SV_ModEnd> sat -> sat_family <S2SV_ModStart> -> deh_snet ; <S2SV_ModEnd> msg -> msg_namelen
torvalds@linux/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
CVE-2013-7271
https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
2014-01-06T16:55Z
353
CWE-284
CWE-284 void __detach_mounts ( struct dentry * dentry ) { struct mountpoint * mp ; struct mount * mnt ; namespace_lock ( ) ; mp = lookup_mountpoint ( dentry ) ; if ( ! mp ) goto out_unlock ; lock_mount_hash ( ) ; while ( ! hlist_empty ( & mp -> m_list ) ) { mnt = hlist_entry ( mp -> m_list . first , struct mount , mnt_mp_list ) ; <S2SV_StartBug> umount_tree ( mnt , 0 ) ; <S2SV_EndBug> } unlock_mount_hash ( ) ; put_mountpoint ( mp ) ; out_unlock : namespace_unlock ( ) ; }
<S2SV_ModStart> mnt_mp_list ) ; if ( mnt -> mnt . mnt_flags & MNT_UMOUNT ) { struct mount * p , * tmp ; list_for_each_entry_safe ( p , tmp , & mnt -> mnt_mounts , mnt_child ) { hlist_add_head ( & p -> mnt_umount . s_list , & unmounted ) ; umount_mnt ( p ) ; } } else
torvalds@linux/ce07d891a0891d3c0d0c2d73d577490486b809e1
CVE-2014-9717
https://github.com/torvalds/linux/commit/ce07d891a0891d3c0d0c2d73d577490486b809e1
2016-05-02T10:59Z
354
CWE-119
CWE-119 int vp8_get_preview_raw_frame ( VP8_COMP * cpi , YV12_BUFFER_CONFIG * dest , vp8_ppflags_t * flags ) { if ( cpi -> common . refresh_alt_ref_frame ) return - 1 ; else { int ret ; # if CONFIG_MULTITHREAD if ( cpi -> b_lpf_running ) { sem_wait ( & cpi -> h_event_end_lpf ) ; cpi -> b_lpf_running = 0 ; } # endif # if CONFIG_POSTPROC cpi -> common . show_frame_mi = cpi -> common . mi ; ret = vp8_post_proc_frame ( & cpi -> common , dest , flags ) ; # else <S2SV_StartBug> if ( cpi -> common . frame_to_show ) <S2SV_EndBug> { * dest = * cpi -> common . frame_to_show ; dest -> y_width = cpi -> common . Width ; dest -> y_height = cpi -> common . Height ; dest -> uv_height = cpi -> 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
355
CWE-264
CWE-264 static void bt_for_each ( struct blk_mq_hw_ctx * hctx , struct blk_mq_bitmap_tags * bt , unsigned int off , busy_iter_fn * fn , void * data , bool reserved ) { struct request * rq ; int bit , i ; for ( i = 0 ; i < bt -> map_nr ; i ++ ) { struct blk_align_bitmap * bm = & bt -> map [ i ] ; for ( bit = find_first_bit ( & bm -> word , bm -> depth ) ; bit < bm -> depth ; bit = find_next_bit ( & bm -> word , bm -> depth , bit + 1 ) ) { <S2SV_StartBug> rq = blk_mq_tag_to_rq ( hctx -> tags , off + bit ) ; <S2SV_EndBug> if ( rq -> q == hctx -> queue ) fn ( hctx , rq , data , reserved ) ; } off += ( 1 << bt -> bits_per_word ) ; } }
<S2SV_ModStart> { rq = <S2SV_ModEnd> hctx -> tags <S2SV_ModStart> hctx -> tags -> rqs [ <S2SV_ModEnd> off + bit <S2SV_ModStart> off + bit ] <S2SV_ModEnd> ; if (
torvalds@linux/0048b4837affd153897ed1222283492070027aa9
CVE-2015-9016
https://github.com/torvalds/linux/commit/0048b4837affd153897ed1222283492070027aa9
2018-04-05T18:29Z
356
CWE-119
CWE-119 static void pick_quickcompress_mode ( vpx_codec_alg_priv_t * ctx , unsigned long duration , unsigned long deadline ) { <S2SV_StartBug> MODE new_qc = MODE_BESTQUALITY ; <S2SV_EndBug> <S2SV_StartBug> if ( deadline ) { <S2SV_EndBug> const uint64_t duration_us = ( uint64_t ) duration * 1000000 * <S2SV_StartBug> ( uint64_t ) ctx -> cfg . g_timebase . num / <S2SV_EndBug> <S2SV_StartBug> ( uint64_t ) ctx -> cfg . g_timebase . den ; <S2SV_EndBug> <S2SV_StartBug> new_qc = ( deadline > duration_us ) ? MODE_GOODQUALITY : MODE_REALTIME ; <S2SV_EndBug> } if ( ctx -> cfg . g_pass == VPX_RC_FIRST_PASS ) new_qc = MODE_FIRSTPASS ; else if ( ctx -> cfg . g_pass == VPX_RC_LAST_PASS ) new_qc = ( new_qc == MODE_BESTQUALITY ) ? MODE_SECONDPASS_BEST : MODE_SECONDPASS ; <S2SV_StartBug> if ( ctx -> oxcf . mode != new_qc ) { <S2SV_EndBug> <S2SV_StartBug> ctx -> oxcf . mode = new_qc ; <S2SV_EndBug> vp9_change_config ( ctx -> cpi , & ctx -> oxcf ) ; } }
<S2SV_ModStart> ) { MODE new_mode = BEST ; switch ( ctx -> cfg . g_pass ) { case VPX_RC_ONE_PASS : <S2SV_ModEnd> if ( deadline <S2SV_ModStart> if ( deadline > 0 ) { const vpx_codec_enc_cfg_t * const cfg = & ctx -> cfg ; <S2SV_ModEnd> const uint64_t duration_us <S2SV_ModStart> ( uint64_t ) cfg -> <S2SV_ModEnd> g_timebase . num <S2SV_ModStart> ( uint64_t ) cfg -> <S2SV_ModEnd> g_timebase . den <S2SV_ModStart> . den ; new_mode <S2SV_ModEnd> = ( deadline <S2SV_ModStart> duration_us ) ? GOOD : REALTIME ; } else { new_mode = BEST ; } break ; case VPX_RC_FIRST_PASS : break ; case VPX_RC_LAST_PASS : new_mode = deadline > 0 ? GOOD : BEST ; break ; } <S2SV_ModEnd> if ( ctx <S2SV_ModStart> . mode != new_mode <S2SV_ModEnd> ) { ctx <S2SV_ModStart> . mode = new_mode <S2SV_ModEnd> ; vp9_change_config (
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
357
CWE-119
CWE-119 <S2SV_StartBug> static int get_minq_index ( double maxq , double x3 , double x2 , double x1 ) { <S2SV_EndBug> int i ; const double minqtarget = MIN ( ( ( x3 * maxq + x2 ) * maxq + x1 ) * maxq , maxq ) ; if ( minqtarget <= 2.0 ) return 0 ; <S2SV_StartBug> for ( i = 0 ; i < QINDEX_RANGE ; i ++ ) <S2SV_EndBug> <S2SV_StartBug> if ( minqtarget <= vp9_convert_qindex_to_q ( i ) ) <S2SV_EndBug> <S2SV_StartBug> return i ; <S2SV_EndBug> return QINDEX_RANGE - 1 ; }
<S2SV_ModStart> , double x1 , vpx_bit_depth_t bit_depth <S2SV_ModStart> i ++ ) { <S2SV_ModStart> vp9_convert_qindex_to_q ( i , bit_depth <S2SV_ModStart> return i ; }
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
358
CWE-770
CWE-770 static Image * ReadBMPImage ( const ImageInfo * image_info , ExceptionInfo * exception ) { BMPInfo bmp_info ; Image * image ; MagickBooleanType status ; MagickOffsetType offset , start_position ; MemoryInfo * pixel_info ; Quantum index ; register Quantum * q ; register ssize_t i , x ; register unsigned char * p ; size_t bit , bytes_per_line , length ; ssize_t count , y ; unsigned char magick [ 12 ] , * pixels ; unsigned int blue , green , offset_bits , red ; 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 ) ; } ( void ) memset ( & bmp_info , 0 , sizeof ( bmp_info ) ) ; bmp_info . ba_offset = 0 ; start_position = 0 ; offset_bits = 0 ; count = ReadBlob ( image , 2 , magick ) ; if ( count != 2 ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; do { PixelInfo quantum_bits ; PixelPacket shift ; if ( bmp_info . ba_offset == 0 ) start_position = TellBlob ( image ) - 2 ; bmp_info . ba_offset = 0 ; while ( LocaleNCompare ( ( char * ) magick , "BA" , 2 ) == 0 ) { bmp_info . file_size = ReadBlobLSBLong ( image ) ; bmp_info . ba_offset = ReadBlobLSBLong ( image ) ; bmp_info . offset_bits = ReadBlobLSBLong ( image ) ; count = ReadBlob ( image , 2 , magick ) ; if ( count != 2 ) break ; } if ( image -> debug != MagickFalse ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Magick:<S2SV_blank>%c%c" , magick [ 0 ] , magick [ 1 ] ) ; if ( ( count != 2 ) || ( ( LocaleNCompare ( ( char * ) magick , "BM" , 2 ) != 0 ) && ( LocaleNCompare ( ( char * ) magick , "CI" , 2 ) != 0 ) ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; bmp_info . file_size = ReadBlobLSBLong ( image ) ; ( void ) ReadBlobLSBLong ( image ) ; bmp_info . offset_bits = ReadBlobLSBLong ( image ) ; bmp_info . size = ReadBlobLSBLong ( image ) ; if ( image -> debug != MagickFalse ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>BMP<S2SV_blank>size:<S2SV_blank>%u" , bmp_info . size ) ; if ( bmp_info . size == 12 ) { ( void ) CopyMagickString ( image -> magick , "BMP2" , MagickPathExtent ) ; bmp_info . width = ( ssize_t ) ( ( short ) ReadBlobLSBShort ( image ) ) ; bmp_info . height = ( ssize_t ) ( ( short ) ReadBlobLSBShort ( image ) ) ; bmp_info . planes = ReadBlobLSBShort ( image ) ; bmp_info . bits_per_pixel = ReadBlobLSBShort ( image ) ; bmp_info . x_pixels = 0 ; bmp_info . y_pixels = 0 ; bmp_info . number_colors = 0 ; bmp_info . compression = BI_RGB ; bmp_info . image_size = 0 ; bmp_info . alpha_mask = 0 ; if ( image -> debug != MagickFalse ) { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Format:<S2SV_blank>OS/2<S2SV_blank>Bitmap" ) ; ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Geometry:<S2SV_blank>%.20gx%.20g" , ( double ) bmp_info . width , ( double ) bmp_info . height ) ; } } else { if ( bmp_info . size < 40 ) ThrowReaderException ( CorruptImageError , "NonOS2HeaderSizeError" ) ; bmp_info . width = ( ssize_t ) ReadBlobLSBSignedLong ( image ) ; bmp_info . height = ( ssize_t ) ReadBlobLSBSignedLong ( image ) ; bmp_info . planes = ReadBlobLSBShort ( image ) ; bmp_info . bits_per_pixel = ReadBlobLSBShort ( image ) ; bmp_info . compression = ReadBlobLSBLong ( image ) ; bmp_info . image_size = ReadBlobLSBLong ( image ) ; bmp_info . x_pixels = ReadBlobLSBLong ( image ) ; bmp_info . y_pixels = ReadBlobLSBLong ( image ) ; <S2SV_StartBug> bmp_info . number_colors = ReadBlobLSBLong ( image ) ; <S2SV_EndBug> bmp_info . colors_important = ReadBlobLSBLong ( image ) ; if ( image -> debug != MagickFalse ) { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Format:<S2SV_blank>MS<S2SV_blank>Windows<S2SV_blank>bitmap" ) ; ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Geometry:<S2SV_blank>%.20gx%.20g" , ( double ) bmp_info . width , ( double ) bmp_info . height ) ; ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Bits<S2SV_blank>per<S2SV_blank>pixel:<S2SV_blank>%.20g" , ( double ) bmp_info . bits_per_pixel ) ; switch ( bmp_info . compression ) { case BI_RGB : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>BI_RGB" ) ; break ; } case BI_RLE4 : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>BI_RLE4" ) ; break ; } case BI_RLE8 : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>BI_RLE8" ) ; break ; } case BI_BITFIELDS : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>BI_BITFIELDS" ) ; break ; } case BI_PNG : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>BI_PNG" ) ; break ; } case BI_JPEG : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>BI_JPEG" ) ; break ; } default : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>UNKNOWN<S2SV_blank>(%u)" , bmp_info . compression ) ; } } ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Number<S2SV_blank>of<S2SV_blank>colors:<S2SV_blank>%u" , bmp_info . number_colors ) ; } bmp_info . red_mask = ReadBlobLSBLong ( image ) ; bmp_info . green_mask = ReadBlobLSBLong ( image ) ; bmp_info . blue_mask = ReadBlobLSBLong ( image ) ; if ( bmp_info . size > 40 ) { double gamma ; bmp_info . alpha_mask = ReadBlobLSBLong ( image ) ; bmp_info . colorspace = ReadBlobLSBSignedLong ( image ) ; # define BMP_DENOM ( ( double ) 0x40000000 ) bmp_info . red_primary . x = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . red_primary . y = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . red_primary . z = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . green_primary . x = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . green_primary . y = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . green_primary . z = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . blue_primary . x = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . blue_primary . y = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . blue_primary . z = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; gamma = bmp_info . red_primary . x + bmp_info . red_primary . y + bmp_info . red_primary . z ; gamma = PerceptibleReciprocal ( gamma ) ; bmp_info . red_primary . x *= gamma ; bmp_info . red_primary . y *= gamma ; image -> chromaticity . red_primary . x = bmp_info . red_primary . x ; image -> chromaticity . red_primary . y = bmp_info . red_primary . y ; gamma = bmp_info . green_primary . x + bmp_info . green_primary . y + bmp_info . green_primary . z ; gamma = PerceptibleReciprocal ( gamma ) ; bmp_info . green_primary . x *= gamma ; bmp_info . green_primary . y *= gamma ; image -> chromaticity . green_primary . x = bmp_info . green_primary . x ; image -> chromaticity . green_primary . y = bmp_info . green_primary . y ; gamma = bmp_info . blue_primary . x + bmp_info . blue_primary . y + bmp_info . blue_primary . z ; gamma = PerceptibleReciprocal ( gamma ) ; bmp_info . blue_primary . x *= gamma ; bmp_info . blue_primary . y *= gamma ; image -> chromaticity . blue_primary . x = bmp_info . blue_primary . x ; image -> chromaticity . blue_primary . y = bmp_info . blue_primary . y ; bmp_info . gamma_scale . x = ( double ) ReadBlobLSBLong ( image ) / 0x10000 ; bmp_info . gamma_scale . y = ( double ) ReadBlobLSBLong ( image ) / 0x10000 ; bmp_info . gamma_scale . z = ( double ) ReadBlobLSBLong ( image ) / 0x10000 ; image -> gamma = ( bmp_info . gamma_scale . x + bmp_info . gamma_scale . y + bmp_info . gamma_scale . z ) / 3.0 ; } else ( void ) CopyMagickString ( image -> magick , "BMP3" , MagickPathExtent ) ; if ( bmp_info . size > 108 ) { size_t intent ; intent = ReadBlobLSBLong ( image ) ; switch ( ( int ) intent ) { case LCS_GM_BUSINESS : { image -> rendering_intent = SaturationIntent ; break ; } case LCS_GM_GRAPHICS : { image -> rendering_intent = RelativeIntent ; break ; } case LCS_GM_IMAGES : { image -> rendering_intent = PerceptualIntent ; break ; } case LCS_GM_ABS_COLORIMETRIC : { image -> rendering_intent = AbsoluteIntent ; break ; } } ( void ) ReadBlobLSBLong ( image ) ; ( void ) ReadBlobLSBLong ( image ) ; ( void ) ReadBlobLSBLong ( image ) ; } } if ( ( MagickSizeType ) bmp_info . file_size > GetBlobSize ( image ) ) ( void ) ThrowMagickException ( exception , GetMagickModule ( ) , CorruptImageError , "LengthAndFilesizeDoNotMatch" , "`%s\'" , image -> filename ) ; else if ( ( MagickSizeType ) bmp_info . file_size < GetBlobSize ( image ) ) ( void ) ThrowMagickException ( exception , GetMagickModule ( ) , CorruptImageWarning , "LengthAndFilesizeDoNotMatch" , "`%s\'" , image -> filename ) ; if ( bmp_info . width <= 0 ) ThrowReaderException ( CorruptImageError , "NegativeOrZeroImageSize" ) ; if ( bmp_info . height == 0 ) ThrowReaderException ( CorruptImageError , "NegativeOrZeroImageSize" ) ; if ( bmp_info . planes != 1 ) ThrowReaderException ( CorruptImageError , "StaticPlanesValueNotEqualToOne" ) ; if ( ( bmp_info . bits_per_pixel != 1 ) && ( bmp_info . bits_per_pixel != 4 ) && ( bmp_info . bits_per_pixel != 8 ) && ( bmp_info . bits_per_pixel != 16 ) && ( bmp_info . bits_per_pixel != 24 ) && ( bmp_info . bits_per_pixel != 32 ) ) ThrowReaderException ( CorruptImageError , "UnrecognizedBitsPerPixel" ) ; if ( bmp_info . bits_per_pixel < 16 && bmp_info . number_colors > ( 1U << bmp_info . bits_per_pixel ) ) ThrowReaderException ( CorruptImageError , "UnrecognizedNumberOfColors" ) ; if ( ( bmp_info . compression == 1 ) && ( bmp_info . bits_per_pixel != 8 ) ) ThrowReaderException ( CorruptImageError , "UnrecognizedBitsPerPixel" ) ; if ( ( bmp_info . compression == 2 ) && ( bmp_info . bits_per_pixel != 4 ) ) ThrowReaderException ( CorruptImageError , "UnrecognizedBitsPerPixel" ) ; if ( ( bmp_info . compression == 3 ) && ( bmp_info . bits_per_pixel < 16 ) ) ThrowReaderException ( CorruptImageError , "UnrecognizedBitsPerPixel" ) ; switch ( bmp_info . compression ) { case BI_RGB : image -> compression = NoCompression ; break ; case BI_RLE8 : case BI_RLE4 : image -> compression = RLECompression ; break ; case BI_BITFIELDS : break ; case BI_JPEG : ThrowReaderException ( CoderError , "JPEGCompressNotSupported" ) ; case BI_PNG : ThrowReaderException ( CoderError , "PNGCompressNotSupported" ) ; default : ThrowReaderException ( CorruptImageError , "UnrecognizedImageCompression" ) ; } image -> columns = ( size_t ) MagickAbsoluteValue ( bmp_info . width ) ; image -> rows = ( size_t ) MagickAbsoluteValue ( bmp_info . height ) ; image -> depth = bmp_info . bits_per_pixel <= 8 ? bmp_info . bits_per_pixel : 8 ; image -> alpha_trait = ( ( bmp_info . alpha_mask != 0 ) && ( bmp_info . compression == BI_BITFIELDS ) ) ? BlendPixelTrait : UndefinedPixelTrait ; if ( bmp_info . bits_per_pixel < 16 ) { size_t one ; image -> storage_class = PseudoClass ; image -> colors = bmp_info . number_colors ; one = 1 ; if ( image -> colors == 0 ) image -> colors = one << bmp_info . bits_per_pixel ; } image -> resolution . x = ( double ) bmp_info . x_pixels / 100.0 ; image -> resolution . y = ( double ) bmp_info . y_pixels / 100.0 ; image -> units = PixelsPerCentimeterResolution ; 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 ) ) ; if ( image -> storage_class == PseudoClass ) { unsigned char * bmp_colormap ; size_t packet_size ; if ( image -> debug != MagickFalse ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Reading<S2SV_blank>colormap<S2SV_blank>of<S2SV_blank>%.20g<S2SV_blank>colors" , ( double ) image -> colors ) ; if ( AcquireImageColormap ( image , image -> colors , exception ) == MagickFalse ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; bmp_colormap = ( unsigned char * ) AcquireQuantumMemory ( ( size_t ) image -> colors , 4 * sizeof ( * bmp_colormap ) ) ; if ( bmp_colormap == ( unsigned char * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; if ( ( bmp_info . size == 12 ) || ( bmp_info . size == 64 ) ) packet_size = 3 ; else packet_size = 4 ; offset = SeekBlob ( image , start_position + 14 + bmp_info . size , SEEK_SET ) ; if ( offset < 0 ) { bmp_colormap = ( unsigned char * ) RelinquishMagickMemory ( bmp_colormap ) ; ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; } count = ReadBlob ( image , packet_size * image -> colors , bmp_colormap ) ; if ( count != ( ssize_t ) ( packet_size * image -> colors ) ) { bmp_colormap = ( unsigned char * ) RelinquishMagickMemory ( bmp_colormap ) ; ThrowReaderException ( CorruptImageError , "InsufficientImageDataInFile" ) ; } p = bmp_colormap ; for ( i = 0 ; i < ( ssize_t ) image -> colors ; i ++ ) { image -> colormap [ i ] . blue = ( MagickRealType ) ScaleCharToQuantum ( * p ++ ) ; image -> colormap [ i ] . green = ( MagickRealType ) ScaleCharToQuantum ( * p ++ ) ; image -> colormap [ i ] . red = ( MagickRealType ) ScaleCharToQuantum ( * p ++ ) ; if ( packet_size == 4 ) p ++ ; } bmp_colormap = ( unsigned char * ) RelinquishMagickMemory ( bmp_colormap ) ; } if ( bmp_info . offset_bits == offset_bits ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; offset_bits = bmp_info . offset_bits ; offset = SeekBlob ( image , start_position + bmp_info . offset_bits , SEEK_SET ) ; if ( offset < 0 ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; if ( bmp_info . compression == BI_RLE4 ) bmp_info . bits_per_pixel <<= 1 ; bytes_per_line = 4 * ( ( image -> columns * bmp_info . bits_per_pixel + 31 ) / 32 ) ; length = ( size_t ) bytes_per_line * image -> rows ; if ( ( ( MagickSizeType ) length / 8 ) > GetBlobSize ( image ) ) ThrowReaderException ( CorruptImageError , "InsufficientImageDataInFile" ) ; if ( ( bmp_info . compression == BI_RGB ) || ( bmp_info . compression == BI_BITFIELDS ) ) { pixel_info = AcquireVirtualMemory ( image -> rows , MagickMax ( bytes_per_line , image -> columns + 256UL ) * sizeof ( * pixels ) ) ; if ( pixel_info == ( MemoryInfo * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; pixels = ( unsigned char * ) GetVirtualMemoryBlob ( pixel_info ) ; if ( image -> debug != MagickFalse ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Reading<S2SV_blank>pixels<S2SV_blank>(%.20g<S2SV_blank>bytes)" , ( double ) length ) ; count = ReadBlob ( image , length , pixels ) ; if ( count != ( ssize_t ) length ) { pixel_info = RelinquishVirtualMemory ( pixel_info ) ; ThrowReaderException ( CorruptImageError , "InsufficientImageDataInFile" ) ; } } else { pixel_info = AcquireVirtualMemory ( image -> rows , MagickMax ( bytes_per_line , image -> columns + 256UL ) * sizeof ( * pixels ) ) ; if ( pixel_info == ( MemoryInfo * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; pixels = ( unsigned char * ) GetVirtualMemoryBlob ( pixel_info ) ; status = DecodeImage ( image , bmp_info . compression , pixels , image -> columns * image -> rows ) ; if ( status == MagickFalse ) { pixel_info = RelinquishVirtualMemory ( pixel_info ) ; ThrowReaderException ( CorruptImageError , "UnableToRunlengthDecodeImage" ) ; } } if ( bmp_info . compression == BI_RGB ) { if ( ( image -> alpha_trait == UndefinedPixelTrait ) && ( bmp_info . size == 40 ) && ( bmp_info . bits_per_pixel == 32 ) ) { bytes_per_line = 4 * ( image -> columns ) ; for ( y = ( ssize_t ) image -> rows - 1 ; y >= 0 ; y -- ) { p = pixels + ( image -> rows - y - 1 ) * bytes_per_line ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) { if ( * ( p + 3 ) != 0 ) { image -> alpha_trait = BlendPixelTrait ; y = - 1 ; break ; } p += 4 ; } } } bmp_info . alpha_mask = image -> alpha_trait != UndefinedPixelTrait ? 0xff000000U : 0U ; bmp_info . red_mask = 0x00ff0000U ; bmp_info . green_mask = 0x0000ff00U ; bmp_info . blue_mask = 0x000000ffU ; if ( bmp_info . bits_per_pixel == 16 ) { bmp_info . red_mask = 0x00007c00U ; bmp_info . green_mask = 0x000003e0U ; bmp_info . blue_mask = 0x0000001fU ; } } ( void ) memset ( & shift , 0 , sizeof ( shift ) ) ; ( void ) memset ( & quantum_bits , 0 , sizeof ( quantum_bits ) ) ; if ( ( bmp_info . bits_per_pixel == 16 ) || ( bmp_info . bits_per_pixel == 32 ) ) { register unsigned int sample ; if ( bmp_info . red_mask != 0 ) while ( ( ( bmp_info . red_mask << shift . red ) & 0x80000000UL ) == 0 ) { shift . red ++ ; if ( shift . red >= 32U ) break ; } if ( bmp_info . green_mask != 0 ) while ( ( ( bmp_info . green_mask << shift . green ) & 0x80000000UL ) == 0 ) { shift . green ++ ; if ( shift . green >= 32U ) break ; } if ( bmp_info . blue_mask != 0 ) while ( ( ( bmp_info . blue_mask << shift . blue ) & 0x80000000UL ) == 0 ) { shift . blue ++ ; if ( shift . blue >= 32U ) break ; } if ( bmp_info . alpha_mask != 0 ) while ( ( ( bmp_info . alpha_mask << shift . alpha ) & 0x80000000UL ) == 0 ) { shift . alpha ++ ; if ( shift . alpha >= 32U ) break ; } sample = shift . red ; while ( ( ( bmp_info . red_mask << sample ) & 0x80000000UL ) != 0 ) { sample ++ ; if ( sample >= 32U ) break ; } quantum_bits . red = ( MagickRealType ) ( sample - shift . red ) ; sample = shift . green ; while ( ( ( bmp_info . green_mask << sample ) & 0x80000000UL ) != 0 ) { sample ++ ; if ( sample >= 32U ) break ; } quantum_bits . green = ( MagickRealType ) ( sample - shift . green ) ; sample = shift . blue ; while ( ( ( bmp_info . blue_mask << sample ) & 0x80000000UL ) != 0 ) { sample ++ ; if ( sample >= 32U ) break ; } quantum_bits . blue = ( MagickRealType ) ( sample - shift . blue ) ; sample = shift . alpha ; while ( ( ( bmp_info . alpha_mask << sample ) & 0x80000000UL ) != 0 ) { sample ++ ; if ( sample >= 32U ) break ; } quantum_bits . alpha = ( MagickRealType ) ( sample - shift . alpha ) ; } switch ( bmp_info . bits_per_pixel ) { case 1 : { for ( y = ( ssize_t ) image -> rows - 1 ; y >= 0 ; y -- ) { p = pixels + ( image -> rows - y - 1 ) * bytes_per_line ; 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 ++ ) { index = ( Quantum ) ( ( ( * p ) & ( 0x80 >> bit ) ) != 0 ? 0x01 : 0x00 ) ; SetPixelIndex ( image , index , q ) ; q += GetPixelChannels ( image ) ; } p ++ ; } if ( ( image -> columns % 8 ) != 0 ) { for ( bit = 0 ; bit < ( image -> columns % 8 ) ; bit ++ ) { index = ( Quantum ) ( ( ( * p ) & ( 0x80 >> bit ) ) != 0 ? 0x01 : 0x00 ) ; SetPixelIndex ( image , index , q ) ; q += GetPixelChannels ( image ) ; } p ++ ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) ( image -> rows - y ) , image -> rows ) ; if ( status == MagickFalse ) break ; } } ( void ) SyncImage ( image , exception ) ; break ; } case 4 : { for ( y = ( ssize_t ) image -> rows - 1 ; y >= 0 ; y -- ) { p = pixels + ( image -> rows - y - 1 ) * bytes_per_line ; q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( Quantum * ) NULL ) break ; for ( x = 0 ; x < ( ( ssize_t ) image -> columns - 1 ) ; x += 2 ) { ValidateColormapValue ( image , ( ssize_t ) ( ( * p >> 4 ) & 0x0f ) , & index , exception ) ; SetPixelIndex ( image , index , q ) ; q += GetPixelChannels ( image ) ; ValidateColormapValue ( image , ( ssize_t ) ( * p & 0x0f ) , & index , exception ) ; SetPixelIndex ( image , index , q ) ; q += GetPixelChannels ( image ) ; p ++ ; } if ( ( image -> columns % 2 ) != 0 ) { ValidateColormapValue ( image , ( ssize_t ) ( ( * p >> 4 ) & 0xf ) , & index , exception ) ; SetPixelIndex ( image , index , q ) ; q += GetPixelChannels ( image ) ; p ++ ; x ++ ; } if ( x < ( ssize_t ) image -> columns ) break ; if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) ( image -> rows - y ) , image -> rows ) ; if ( status == MagickFalse ) break ; } } ( void ) SyncImage ( image , exception ) ; break ; } case 8 : { if ( ( bmp_info . compression == BI_RLE8 ) || ( bmp_info . compression == BI_RLE4 ) ) bytes_per_line = image -> columns ; for ( y = ( ssize_t ) image -> rows - 1 ; y >= 0 ; y -- ) { p = pixels + ( image -> rows - y - 1 ) * bytes_per_line ; q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( Quantum * ) NULL ) break ; for ( x = ( ssize_t ) image -> columns ; x != 0 ; -- x ) { ValidateColormapValue ( image , ( ssize_t ) * p ++ , & index , exception ) ; SetPixelIndex ( image , index , q ) ; q += GetPixelChannels ( image ) ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; offset = ( MagickOffsetType ) ( image -> rows - y - 1 ) ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) ( image -> rows - y ) , image -> rows ) ; if ( status == MagickFalse ) break ; } } ( void ) SyncImage ( image , exception ) ; break ; } case 16 : { unsigned int alpha , pixel ; if ( ( bmp_info . compression != BI_RGB ) && ( bmp_info . compression != BI_BITFIELDS ) ) { pixel_info = RelinquishVirtualMemory ( pixel_info ) ; ThrowReaderException ( CorruptImageError , "UnrecognizedImageCompression" ) ; } bytes_per_line = 2 * ( image -> columns + image -> columns % 2 ) ; image -> storage_class = DirectClass ; for ( y = ( ssize_t ) image -> rows - 1 ; y >= 0 ; y -- ) { p = pixels + ( image -> rows - y - 1 ) * bytes_per_line ; q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( Quantum * ) NULL ) break ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) { pixel = ( unsigned int ) ( * p ++ ) ; pixel |= ( * p ++ ) << 8 ; red = ( ( pixel & bmp_info . red_mask ) << shift . red ) >> 16 ; if ( quantum_bits . red == 5 ) red |= ( ( red & 0xe000 ) >> 5 ) ; if ( quantum_bits . red <= 8 ) red |= ( ( red & 0xff00 ) >> 8 ) ; green = ( ( pixel & bmp_info . green_mask ) << shift . green ) >> 16 ; if ( quantum_bits . green == 5 ) green |= ( ( green & 0xe000 ) >> 5 ) ; if ( quantum_bits . green == 6 ) green |= ( ( green & 0xc000 ) >> 6 ) ; if ( quantum_bits . green <= 8 ) green |= ( ( green & 0xff00 ) >> 8 ) ; blue = ( ( pixel & bmp_info . blue_mask ) << shift . blue ) >> 16 ; if ( quantum_bits . blue == 5 ) blue |= ( ( blue & 0xe000 ) >> 5 ) ; if ( quantum_bits . blue <= 8 ) blue |= ( ( blue & 0xff00 ) >> 8 ) ; SetPixelRed ( image , ScaleShortToQuantum ( ( unsigned short ) red ) , q ) ; SetPixelGreen ( image , ScaleShortToQuantum ( ( unsigned short ) green ) , q ) ; SetPixelBlue ( image , ScaleShortToQuantum ( ( unsigned short ) blue ) , q ) ; SetPixelAlpha ( image , OpaqueAlpha , q ) ; if ( image -> alpha_trait != UndefinedPixelTrait ) { alpha = ( ( pixel & bmp_info . alpha_mask ) << shift . alpha ) >> 16 ; if ( quantum_bits . alpha <= 8 ) alpha |= ( ( alpha & 0xff00 ) >> 8 ) ; SetPixelAlpha ( image , ScaleShortToQuantum ( ( unsigned short ) alpha ) , q ) ; } q += GetPixelChannels ( image ) ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; offset = ( MagickOffsetType ) ( image -> rows - y - 1 ) ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) ( image -> rows - y ) , image -> rows ) ; if ( status == MagickFalse ) break ; } } break ; } case 24 : { bytes_per_line = 4 * ( ( image -> columns * 24 + 31 ) / 32 ) ; for ( y = ( ssize_t ) image -> rows - 1 ; y >= 0 ; y -- ) { p = pixels + ( image -> rows - y - 1 ) * bytes_per_line ; q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( Quantum * ) NULL ) break ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) { SetPixelBlue ( image , ScaleCharToQuantum ( * p ++ ) , q ) ; SetPixelGreen ( image , ScaleCharToQuantum ( * p ++ ) , q ) ; SetPixelRed ( image , ScaleCharToQuantum ( * p ++ ) , q ) ; SetPixelAlpha ( image , OpaqueAlpha , q ) ; q += GetPixelChannels ( image ) ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; offset = ( MagickOffsetType ) ( image -> rows - y - 1 ) ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) ( image -> rows - y ) , image -> rows ) ; if ( status == MagickFalse ) break ; } } break ; } case 32 : { if ( ( bmp_info . compression != BI_RGB ) && ( bmp_info . compression != BI_BITFIELDS ) ) { pixel_info = RelinquishVirtualMemory ( pixel_info ) ; ThrowReaderException ( CorruptImageError , "UnrecognizedImageCompression" ) ; } bytes_per_line = 4 * ( image -> columns ) ; for ( y = ( ssize_t ) image -> rows - 1 ; y >= 0 ; y -- ) { unsigned int alpha , pixel ; p = pixels + ( image -> rows - y - 1 ) * bytes_per_line ; q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( Quantum * ) NULL ) break ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) { pixel = ( unsigned int ) ( * p ++ ) ; pixel |= ( ( unsigned int ) * p ++ << 8 ) ; pixel |= ( ( unsigned int ) * p ++ << 16 ) ; pixel |= ( ( unsigned int ) * p ++ << 24 ) ; red = ( ( pixel & bmp_info . red_mask ) << shift . red ) >> 16 ; if ( quantum_bits . red == 8 ) red |= ( red >> 8 ) ; green = ( ( pixel & bmp_info . green_mask ) << shift . green ) >> 16 ; if ( quantum_bits . green == 8 ) green |= ( green >> 8 ) ; blue = ( ( pixel & bmp_info . blue_mask ) << shift . blue ) >> 16 ; if ( quantum_bits . blue == 8 ) blue |= ( blue >> 8 ) ; SetPixelRed ( image , ScaleShortToQuantum ( ( unsigned short ) red ) , q ) ; SetPixelGreen ( image , ScaleShortToQuantum ( ( unsigned short ) green ) , q ) ; SetPixelBlue ( image , ScaleShortToQuantum ( ( unsigned short ) blue ) , q ) ; SetPixelAlpha ( image , OpaqueAlpha , q ) ; if ( image -> alpha_trait != UndefinedPixelTrait ) { alpha = ( ( pixel & bmp_info . alpha_mask ) << shift . alpha ) >> 16 ; if ( quantum_bits . alpha == 8 ) alpha |= ( alpha >> 8 ) ; SetPixelAlpha ( image , ScaleShortToQuantum ( ( unsigned short ) alpha ) , q ) ; } q += GetPixelChannels ( image ) ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; offset = ( MagickOffsetType ) ( image -> rows - y - 1 ) ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) ( image -> rows - y ) , image -> rows ) ; if ( status == MagickFalse ) break ; } } break ; } default : { pixel_info = RelinquishVirtualMemory ( pixel_info ) ; ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; } } pixel_info = RelinquishVirtualMemory ( pixel_info ) ; if ( y > 0 ) break ; if ( EOFBlob ( image ) != MagickFalse ) { ThrowFileException ( exception , CorruptImageError , "UnexpectedEndOfFile" , image -> filename ) ; break ; } if ( bmp_info . height < 0 ) { Image * flipped_image ; flipped_image = FlipImage ( image , exception ) ; if ( flipped_image != ( Image * ) NULL ) { DuplicateBlob ( flipped_image , image ) ; ReplaceImageInList ( & image , flipped_image ) ; image = flipped_image ; } } if ( image_info -> number_scenes != 0 ) if ( image -> scene >= ( image_info -> scene + image_info -> number_scenes - 1 ) ) break ; * magick = '\\0' ; if ( bmp_info . ba_offset != 0 ) { offset = SeekBlob ( image , ( MagickOffsetType ) bmp_info . ba_offset , SEEK_SET ) ; if ( offset < 0 ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; } count = ReadBlob ( image , 2 , magick ) ; if ( ( count == 2 ) && ( IsBMP ( magick , 2 ) != MagickFalse ) ) { AcquireNextImage ( image_info , image , exception ) ; if ( GetNextImageInList ( image ) == ( Image * ) NULL ) { status = MagickFalse ; return ( ( Image * ) NULL ) ; } image = SyncNextImageInList ( image ) ; status = SetImageProgress ( image , LoadImagesTag , TellBlob ( image ) , GetBlobSize ( image ) ) ; if ( status == MagickFalse ) break ; } } while ( IsBMP ( magick , 2 ) != MagickFalse ) ; ( void ) CloseBlob ( image ) ; if ( status == MagickFalse ) return ( DestroyImageList ( image ) ) ; return ( GetFirstImageInList ( image ) ) ; }
<S2SV_ModStart> ReadBlobLSBLong ( image ) ; if ( bmp_info . number_colors > GetBlobSize ( image ) ) ThrowReaderException ( CorruptImageError , "InsufficientImageDataInFile"
ImageMagick@ImageMagick/ecb31dbad39ccdc65868d5d2a37f0f0521250832
CVE-2018-16645
https://github.com/ImageMagick/ImageMagick/commit/ecb31dbad39ccdc65868d5d2a37f0f0521250832
2018-09-06T22:29Z
359
CWE-119
CWE-119 static void show_object ( struct object * obj , <S2SV_StartBug> struct strbuf * path , const char * component , <S2SV_EndBug> void * cb_data ) { struct rev_list_info * info = cb_data ; <S2SV_StartBug> finish_object ( obj , path , component , cb_data ) ; <S2SV_EndBug> if ( info -> flags & REV_LIST_QUIET ) return ; <S2SV_StartBug> show_object_with_name ( stdout , obj , path , component ) ; <S2SV_EndBug> }
<S2SV_ModStart> * obj , <S2SV_ModEnd> const char * <S2SV_ModStart> const char * name <S2SV_ModEnd> , void * <S2SV_ModStart> ( obj , name <S2SV_ModEnd> , cb_data ) <S2SV_ModStart> , obj , name <S2SV_ModEnd> ) ; }
git@git/de1e67d0703894cb6ea782e36abb63976ab07e60
CVE-2016-2324
https://github.com/git/git/commit/de1e67d0703894cb6ea782e36abb63976ab07e60
2016-04-08T14:59Z
360
CWE-416
CWE-416 static struct sock * dccp_v6_request_recv_sock ( const struct sock * sk , struct sk_buff * skb , struct request_sock * req , struct dst_entry * dst , struct request_sock * req_unhash , bool * own_req ) { struct inet_request_sock * ireq = inet_rsk ( req ) ; struct ipv6_pinfo * newnp ; <S2SV_StartBug> const struct ipv6_pinfo * np = inet6_sk ( sk ) ; <S2SV_EndBug> struct inet_sock * newinet ; struct dccp6_sock * newdp6 ; struct sock * newsk ; if ( skb -> protocol == htons ( ETH_P_IP ) ) { newsk = dccp_v4_request_recv_sock ( sk , skb , req , dst , req_unhash , own_req ) ; if ( newsk == NULL ) return NULL ; newdp6 = ( struct dccp6_sock * ) newsk ; newinet = inet_sk ( newsk ) ; newinet -> pinet6 = & newdp6 -> inet6 ; newnp = inet6_sk ( newsk ) ; memcpy ( newnp , np , sizeof ( struct ipv6_pinfo ) ) ; newnp -> saddr = newsk -> sk_v6_rcv_saddr ; inet_csk ( newsk ) -> icsk_af_ops = & dccp_ipv6_mapped ; newsk -> sk_backlog_rcv = dccp_v4_do_rcv ; newnp -> pktoptions = NULL ; newnp -> opt = NULL ; newnp -> mcast_oif = inet6_iif ( skb ) ; newnp -> mcast_hops = ipv6_hdr ( skb ) -> hop_limit ; dccp_sync_mss ( newsk , inet_csk ( newsk ) -> icsk_pmtu_cookie ) ; return newsk ; } if ( sk_acceptq_is_full ( sk ) ) goto out_overflow ; if ( ! dst ) { struct flowi6 fl6 ; dst = inet6_csk_route_req ( sk , & fl6 , req , IPPROTO_DCCP ) ; if ( ! dst ) goto out ; } newsk = dccp_create_openreq_child ( sk , req , skb ) ; if ( newsk == NULL ) goto out_nonewsk ; __ip6_dst_store ( newsk , dst , NULL , NULL ) ; newsk -> sk_route_caps = dst -> dev -> features & ~ ( NETIF_F_IP_CSUM | NETIF_F_TSO ) ; newdp6 = ( struct dccp6_sock * ) newsk ; newinet = inet_sk ( newsk ) ; newinet -> pinet6 = & newdp6 -> inet6 ; newnp = inet6_sk ( newsk ) ; memcpy ( newnp , np , sizeof ( struct ipv6_pinfo ) ) ; newsk -> sk_v6_daddr = ireq -> ir_v6_rmt_addr ; newnp -> saddr = ireq -> ir_v6_loc_addr ; newsk -> sk_v6_rcv_saddr = ireq -> ir_v6_loc_addr ; newsk -> sk_bound_dev_if = ireq -> ir_iif ; newinet -> inet_opt = NULL ; newnp -> rxopt . all = np -> rxopt . all ; newnp -> pktoptions = NULL ; newnp -> opt = NULL ; newnp -> mcast_oif = inet6_iif ( skb ) ; newnp -> mcast_hops = ipv6_hdr ( skb ) -> hop_limit ; <S2SV_StartBug> if ( np -> opt != NULL ) <S2SV_EndBug> <S2SV_StartBug> newnp -> opt = ipv6_dup_options ( newsk , np -> opt ) ; <S2SV_EndBug> inet_csk ( newsk ) -> icsk_ext_hdr_len = 0 ; <S2SV_StartBug> if ( newnp -> opt != NULL ) <S2SV_EndBug> <S2SV_StartBug> inet_csk ( newsk ) -> icsk_ext_hdr_len = ( newnp -> opt -> opt_nflen + <S2SV_EndBug> <S2SV_StartBug> newnp -> opt -> opt_flen ) ; <S2SV_EndBug> dccp_sync_mss ( newsk , dst_mtu ( dst ) ) ; newinet -> inet_daddr = newinet -> inet_saddr = LOOPBACK4_IPV6 ; newinet -> inet_rcv_saddr = LOOPBACK4_IPV6 ; if ( __inet_inherit_port ( sk , newsk ) < 0 ) { inet_csk_prepare_forced_close ( newsk ) ; dccp_done ( newsk ) ; goto out ; } * own_req = inet_ehash_nolisten ( newsk , req_to_sk ( req_unhash ) ) ; if ( * own_req && ireq -> pktopts ) { newnp -> pktoptions = skb_clone ( ireq -> pktopts , GFP_ATOMIC ) ; consume_skb ( ireq -> pktopts ) ; ireq -> pktopts = NULL ; if ( newnp -> pktoptions ) skb_set_owner_r ( newnp -> pktoptions , newsk ) ; } return newsk ; out_overflow : NET_INC_STATS_BH ( sock_net ( sk ) , LINUX_MIB_LISTENOVERFLOWS ) ; out_nonewsk : dst_release ( dst ) ; out : NET_INC_STATS_BH ( sock_net ( sk ) , LINUX_MIB_LISTENDROPS ) ; return NULL ; }
<S2SV_ModStart> ( sk ) ; struct ipv6_txoptions * opt <S2SV_ModStart> -> hop_limit ; opt = rcu_dereference <S2SV_ModEnd> ( np -> <S2SV_ModStart> np -> opt ) ; if ( opt ) { <S2SV_ModEnd> opt = ipv6_dup_options <S2SV_ModStart> ( newsk , opt ) ; RCU_INIT_POINTER ( newnp -> opt , opt ) ; } <S2SV_ModEnd> inet_csk ( newsk <S2SV_ModStart> ; if ( opt <S2SV_ModEnd> ) inet_csk ( <S2SV_ModStart> -> icsk_ext_hdr_len = <S2SV_ModEnd> opt -> opt_nflen <S2SV_ModStart> -> opt_nflen + <S2SV_ModEnd> opt -> opt_flen <S2SV_ModStart> opt -> opt_flen <S2SV_ModEnd> ; dccp_sync_mss (
torvalds@linux/45f6fad84cc305103b28d73482b344d7f5b76f39
CVE-2016-3841
https://github.com/torvalds/linux/commit/45f6fad84cc305103b28d73482b344d7f5b76f39
2016-08-06T20:59Z
361
CWE-125
CWE-125 sctp_disposition_t sctp_sf_ootb ( struct net * net , const struct sctp_endpoint * ep , const struct sctp_association * asoc , const sctp_subtype_t type , void * arg , sctp_cmd_seq_t * commands ) { struct sctp_chunk * chunk = arg ; struct sk_buff * skb = chunk -> skb ; sctp_chunkhdr_t * ch ; sctp_errhdr_t * err ; __u8 * ch_end ; int ootb_shut_ack = 0 ; int ootb_cookie_ack = 0 ; SCTP_INC_STATS ( net , SCTP_MIB_OUTOFBLUES ) ; ch = ( sctp_chunkhdr_t * ) chunk -> chunk_hdr ; do { if ( ntohs ( ch -> length ) < sizeof ( sctp_chunkhdr_t ) ) return sctp_sf_violation_chunklen ( net , ep , asoc , type , arg , commands ) ; <S2SV_StartBug> if ( SCTP_CID_SHUTDOWN_ACK == ch -> type ) <S2SV_EndBug> ootb_shut_ack = 1 ; if ( SCTP_CID_ABORT == ch -> type ) return sctp_sf_pdiscard ( net , ep , asoc , type , arg , commands ) ; if ( SCTP_CID_COOKIE_ACK == ch -> type ) ootb_cookie_ack = 1 ; if ( SCTP_CID_ERROR == ch -> type ) { sctp_walk_errors ( err , ch ) { if ( SCTP_ERROR_STALE_COOKIE == err -> cause ) { ootb_cookie_ack = 1 ; break ; } } } ch_end = ( ( __u8 * ) ch ) + SCTP_PAD4 ( ntohs ( ch -> length ) ) ; if ( ch_end > skb_tail_pointer ( skb ) ) return sctp_sf_violation_chunklen ( net , ep , asoc , type , arg , commands ) ; <S2SV_StartBug> ch = ( sctp_chunkhdr_t * ) ch_end ; <S2SV_EndBug> } while ( ch_end < skb_tail_pointer ( skb ) ) ; if ( ootb_shut_ack ) return sctp_sf_shut_8_4_5 ( net , ep , asoc , type , arg , commands ) ; else if ( ootb_cookie_ack ) return sctp_sf_pdiscard ( net , ep , asoc , type , arg , commands ) ; else return sctp_sf_tabort_8_4_8 ( net , ep , asoc , type , arg , commands ) ; }
<S2SV_ModStart> commands ) ; <S2SV_ModEnd> ch_end = ( <S2SV_ModStart> commands ) ; if ( SCTP_CID_SHUTDOWN_ACK == ch -> type ) ootb_shut_ack = 1 ; if ( SCTP_CID_ABORT == ch -> type ) return sctp_sf_pdiscard ( net , ep , asoc , type , arg , commands ) ; if ( SCTP_CID_COOKIE_ACK == ch -> type ) ootb_cookie_ack = 1 ; if ( SCTP_CID_ERROR == ch -> type ) { sctp_walk_errors ( err , ch ) { if ( SCTP_ERROR_STALE_COOKIE == err -> cause ) { ootb_cookie_ack = 1 ; break ; } } }
torvalds@linux/bf911e985d6bbaa328c20c3e05f4eb03de11fdd6
CVE-2016-9555
https://github.com/torvalds/linux/commit/bf911e985d6bbaa328c20c3e05f4eb03de11fdd6
2016-11-28T03:59Z
362
CWE-416
CWE-416 static int snd_ctl_tlv_ioctl ( struct snd_ctl_file * file , struct snd_ctl_tlv __user * _tlv , int op_flag ) { struct snd_card * card = file -> card ; struct snd_ctl_tlv tlv ; struct snd_kcontrol * kctl ; struct snd_kcontrol_volatile * vd ; unsigned int len ; int err = 0 ; if ( copy_from_user ( & tlv , _tlv , sizeof ( tlv ) ) ) return - EFAULT ; if ( tlv . length < sizeof ( unsigned int ) * 2 ) return - EINVAL ; down_read ( & card -> controls_rwsem ) ; kctl = snd_ctl_find_numid ( card , tlv . numid ) ; if ( kctl == NULL ) { err = - ENOENT ; goto __kctl_end ; } if ( kctl -> tlv . p == NULL ) { err = - ENXIO ; goto __kctl_end ; } vd = & kctl -> vd [ tlv . numid - kctl -> id . numid ] ; if ( ( op_flag == 0 && ( vd -> access & SNDRV_CTL_ELEM_ACCESS_TLV_READ ) == 0 ) || ( op_flag > 0 && ( vd -> access & SNDRV_CTL_ELEM_ACCESS_TLV_WRITE ) == 0 ) || ( op_flag < 0 && ( vd -> access & SNDRV_CTL_ELEM_ACCESS_TLV_COMMAND ) == 0 ) ) { err = - ENXIO ; goto __kctl_end ; } if ( vd -> access & SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK ) { if ( vd -> owner != NULL && vd -> owner != file ) { err = - EPERM ; goto __kctl_end ; } err = kctl -> tlv . c ( kctl , op_flag , tlv . length , _tlv -> tlv ) ; if ( err > 0 ) { <S2SV_StartBug> up_read ( & card -> controls_rwsem ) ; <S2SV_EndBug> <S2SV_StartBug> snd_ctl_notify ( card , SNDRV_CTL_EVENT_MASK_TLV , & kctl -> id ) ; <S2SV_EndBug> return 0 ; } } else { if ( op_flag ) { err = - ENXIO ; goto __kctl_end ; } len = kctl -> tlv . p [ 1 ] + 2 * sizeof ( unsigned int ) ; if ( tlv . length < len ) { err = - ENOMEM ; goto __kctl_end ; } if ( copy_to_user ( _tlv -> tlv , kctl -> tlv . p , len ) ) err = - EFAULT ; } __kctl_end : up_read ( & card -> controls_rwsem ) ; return err ; }
<S2SV_ModStart> 0 ) { struct snd_ctl_elem_id id = kctl -> id ; <S2SV_ModStart> SNDRV_CTL_EVENT_MASK_TLV , & <S2SV_ModEnd> id ) ;
torvalds@linux/fd9f26e4eca5d08a27d12c0933fceef76ed9663d
CVE-2014-4653
https://github.com/torvalds/linux/commit/fd9f26e4eca5d08a27d12c0933fceef76ed9663d
2014-07-03T04:22Z
363
CWE-125
CWE-125 static void ubik_print ( netdissect_options * ndo , register const u_char * bp ) { int ubik_op ; int32_t temp ; ubik_op = EXTRACT_32BITS ( bp + sizeof ( struct rx_header ) ) ; ND_PRINT ( ( ndo , "<S2SV_blank>ubik<S2SV_blank>call<S2SV_blank>%s" , tok2str ( ubik_req , "op#%d" , ubik_op ) ) ) ; bp += sizeof ( struct rx_header ) + 4 ; switch ( ubik_op ) { case 10000 : ND_TCHECK2 ( bp [ 0 ] , 4 ) ; temp = EXTRACT_32BITS ( bp ) ; bp += sizeof ( int32_t ) ; ND_PRINT ( ( ndo , "<S2SV_blank>syncsite<S2SV_blank>%s" , temp ? "yes" : "no" ) ) ; ND_PRINT ( ( ndo , "<S2SV_blank>votestart" ) ) ; DATEOUT ( ) ; ND_PRINT ( ( ndo , "<S2SV_blank>dbversion" ) ) ; UBIK_VERSIONOUT ( ) ; ND_PRINT ( ( ndo , "<S2SV_blank>tid" ) ) ; UBIK_VERSIONOUT ( ) ; break ; case 10003 : ND_PRINT ( ( ndo , "<S2SV_blank>site" ) ) ; UINTOUT ( ) ; break ; case 20000 : case 20001 : case 20007 : case 20008 : case 20010 : ND_PRINT ( ( ndo , "<S2SV_blank>tid" ) ) ; UBIK_VERSIONOUT ( ) ; break ; case 20002 : ND_PRINT ( ( ndo , "<S2SV_blank>tid" ) ) ; UBIK_VERSIONOUT ( ) ; ND_PRINT ( ( ndo , "<S2SV_blank>file" ) ) ; INTOUT ( ) ; ND_PRINT ( ( ndo , "<S2SV_blank>pos" ) ) ; INTOUT ( ) ; ND_PRINT ( ( ndo , "<S2SV_blank>length" ) ) ; INTOUT ( ) ; <S2SV_StartBug> temp = EXTRACT_32BITS ( bp ) ; <S2SV_EndBug> bp += sizeof ( int32_t ) ; tok2str ( ubik_lock_types , "type<S2SV_blank>%d" , temp ) ; break ; case 20003 : ND_PRINT ( ( ndo , "<S2SV_blank>tid" ) ) ; UBIK_VERSIONOUT ( ) ; ND_PRINT ( ( ndo , "<S2SV_blank>file" ) ) ; INTOUT ( ) ; ND_PRINT ( ( ndo , "<S2SV_blank>pos" ) ) ; INTOUT ( ) ; break ; case 20005 : ND_PRINT ( ( ndo , "<S2SV_blank>file" ) ) ; INTOUT ( ) ; break ; case 20006 : ND_PRINT ( ( ndo , "<S2SV_blank>file" ) ) ; INTOUT ( ) ; ND_PRINT ( ( ndo , "<S2SV_blank>length" ) ) ; INTOUT ( ) ; ND_PRINT ( ( ndo , "<S2SV_blank>dbversion" ) ) ; UBIK_VERSIONOUT ( ) ; break ; case 20009 : ND_PRINT ( ( ndo , "<S2SV_blank>tid" ) ) ; UBIK_VERSIONOUT ( ) ; ND_PRINT ( ( ndo , "<S2SV_blank>file" ) ) ; INTOUT ( ) ; ND_PRINT ( ( ndo , "<S2SV_blank>length" ) ) ; INTOUT ( ) ; break ; case 20012 : ND_PRINT ( ( ndo , "<S2SV_blank>tid" ) ) ; UBIK_VERSIONOUT ( ) ; ND_PRINT ( ( ndo , "<S2SV_blank>oldversion" ) ) ; UBIK_VERSIONOUT ( ) ; ND_PRINT ( ( ndo , "<S2SV_blank>newversion" ) ) ; UBIK_VERSIONOUT ( ) ; break ; default : ; } return ; trunc : ND_PRINT ( ( ndo , "<S2SV_blank>[|ubik]" ) ) ; }
<S2SV_ModStart> ( ) ; ND_TCHECK_32BITS ( bp ) ;
the-tcpdump-group@tcpdump/aa0858100096a3490edf93034a80e66a4d61aad5
CVE-2017-13049
https://github.com/the-tcpdump-group/tcpdump/commit/aa0858100096a3490edf93034a80e66a4d61aad5
2017-09-14T06:29Z
364
CWE-119
CWE-119 static void dump_boot ( DOS_FS * fs , struct boot_sector * b , unsigned lss ) { unsigned short sectors ; printf ( "Boot<S2SV_blank>sector<S2SV_blank>contents:\\n" ) ; if ( ! atari_format ) { char id [ 9 ] ; strncpy ( id , ( const char * ) b -> system_id , 8 ) ; id [ 8 ] = 0 ; printf ( "System<S2SV_blank>ID<S2SV_blank>\\"%s\\"\\n" , id ) ; } else { printf ( "Serial<S2SV_blank>number<S2SV_blank>0x%x\\n" , b -> system_id [ 5 ] | ( b -> system_id [ 6 ] << 8 ) | ( b -> system_id [ 7 ] << 16 ) ) ; } printf ( "Media<S2SV_blank>byte<S2SV_blank>0x%02x<S2SV_blank>(%s)\\n" , b -> media , get_media_descr ( b -> media ) ) ; printf ( "%10d<S2SV_blank>bytes<S2SV_blank>per<S2SV_blank>logical<S2SV_blank>sector\\n" , GET_UNALIGNED_W ( b -> sector_size ) ) ; printf ( "%10d<S2SV_blank>bytes<S2SV_blank>per<S2SV_blank>cluster\\n" , fs -> cluster_size ) ; printf ( "%10d<S2SV_blank>reserved<S2SV_blank>sector%s\\n" , le16toh ( b -> reserved ) , le16toh ( b -> reserved ) == 1 ? "" : "s" ) ; printf ( "First<S2SV_blank>FAT<S2SV_blank>starts<S2SV_blank>at<S2SV_blank>byte<S2SV_blank>%llu<S2SV_blank>(sector<S2SV_blank>%llu)\\n" , ( unsigned long long ) fs -> fat_start , ( unsigned long long ) fs -> fat_start / lss ) ; printf ( "%10d<S2SV_blank>FATs,<S2SV_blank>%d<S2SV_blank>bit<S2SV_blank>entries\\n" , b -> fats , fs -> fat_bits ) ; <S2SV_StartBug> printf ( "%10d<S2SV_blank>bytes<S2SV_blank>per<S2SV_blank>FAT<S2SV_blank>(=<S2SV_blank>%u<S2SV_blank>sectors)\\n" , fs -> fat_size , <S2SV_EndBug> <S2SV_StartBug> fs -> fat_size / lss ) ; <S2SV_EndBug> if ( ! fs -> root_cluster ) { printf ( "Root<S2SV_blank>directory<S2SV_blank>starts<S2SV_blank>at<S2SV_blank>byte<S2SV_blank>%llu<S2SV_blank>(sector<S2SV_blank>%llu)\\n" , ( unsigned long long ) fs -> root_start , ( unsigned long long ) fs -> root_start / lss ) ; printf ( "%10d<S2SV_blank>root<S2SV_blank>directory<S2SV_blank>entries\\n" , fs -> root_entries ) ; } else { printf ( "Root<S2SV_blank>directory<S2SV_blank>start<S2SV_blank>at<S2SV_blank>cluster<S2SV_blank>%lu<S2SV_blank>(arbitrary<S2SV_blank>size)\\n" , ( unsigned long ) fs -> root_cluster ) ; } printf ( "Data<S2SV_blank>area<S2SV_blank>starts<S2SV_blank>at<S2SV_blank>byte<S2SV_blank>%llu<S2SV_blank>(sector<S2SV_blank>%llu)\\n" , ( unsigned long long ) fs -> data_start , ( unsigned long long ) fs -> data_start / lss ) ; printf ( "%10lu<S2SV_blank>data<S2SV_blank>clusters<S2SV_blank>(%llu<S2SV_blank>bytes)\\n" , ( unsigned long ) fs -> data_clusters , ( unsigned long long ) fs -> data_clusters * fs -> cluster_size ) ; printf ( "%u<S2SV_blank>sectors/track,<S2SV_blank>%u<S2SV_blank>heads\\n" , le16toh ( b -> secs_track ) , le16toh ( b -> heads ) ) ; printf ( "%10u<S2SV_blank>hidden<S2SV_blank>sectors\\n" , atari_format ? ( ( ( unsigned char * ) & b -> hidden ) [ 0 ] | ( ( unsigned char * ) & b -> hidden ) [ 1 ] << 8 ) : le32toh ( b -> hidden ) ) ; sectors = GET_UNALIGNED_W ( b -> sectors ) ; printf ( "%10u<S2SV_blank>sectors<S2SV_blank>total\\n" , sectors ? sectors : le32toh ( b -> total_sect ) ) ; }
<S2SV_ModStart> ; printf ( "%10lld<S2SV_blank>bytes<S2SV_blank>per<S2SV_blank>FAT<S2SV_blank>(=<S2SV_blank>%llu<S2SV_blank>sectors)\\n" , ( long long ) <S2SV_ModEnd> fs -> fat_size <S2SV_ModStart> -> fat_size , ( long long )
dosfstools@dosfstools/e8eff147e9da1185f9afd5b25948153a3b97cf52
CVE-2016-4804
https://github.com/dosfstools/dosfstools/commit/e8eff147e9da1185f9afd5b25948153a3b97cf52
2016-06-03T14:59Z
365
CWE-119
CWE-119 CURLcode Curl_urldecode ( struct SessionHandle * data , const char * string , size_t length , char * * ostring , size_t * olen , bool reject_ctrl ) { size_t alloc = ( length ? length : strlen ( string ) ) + 1 ; char * ns = malloc ( alloc ) ; unsigned char in ; size_t strindex = 0 ; unsigned long hex ; CURLcode res ; if ( ! ns ) return CURLE_OUT_OF_MEMORY ; while ( -- alloc > 0 ) { in = * string ; <S2SV_StartBug> if ( ( '%' == in ) && ISXDIGIT ( string [ 1 ] ) && ISXDIGIT ( string [ 2 ] ) ) { <S2SV_EndBug> char hexstr [ 3 ] ; char * ptr ; hexstr [ 0 ] = string [ 1 ] ; hexstr [ 1 ] = string [ 2 ] ; hexstr [ 2 ] = 0 ; hex = strtoul ( hexstr , & ptr , 16 ) ; in = curlx_ultouc ( hex ) ; res = Curl_convert_from_network ( data , & in , 1 ) ; if ( res ) { free ( ns ) ; return res ; } string += 2 ; alloc -= 2 ; } if ( reject_ctrl && ( in < 0x20 ) ) { free ( ns ) ; return CURLE_URL_MALFORMAT ; } ns [ strindex ++ ] = in ; string ++ ; } ns [ strindex ] = 0 ; if ( olen ) * olen = strindex ; if ( ostring ) * ostring = ns ; return CURLE_OK ; }
<S2SV_ModStart> in ) && ( alloc > 2 ) &&
bagder@curl/192c4f788d48f82c03e9cef40013f34370e90737
CVE-2013-2174
https://github.com/bagder/curl/commit/192c4f788d48f82c03e9cef40013f34370e90737
2013-07-31T13:20Z
366
CWE-200
CWE-200 static long media_device_enum_entities ( struct media_device * mdev , struct media_entity_desc __user * uent ) { struct media_entity * ent ; struct media_entity_desc u_ent ; <S2SV_StartBug> if ( copy_from_user ( & u_ent . id , & uent -> id , sizeof ( u_ent . id ) ) ) <S2SV_EndBug> return - EFAULT ; ent = find_entity ( mdev , u_ent . id ) ; if ( ent == NULL ) return - EINVAL ; u_ent . id = ent -> id ; if ( ent -> name ) { strncpy ( u_ent . name , ent -> name , sizeof ( u_ent . name ) ) ; u_ent . name [ sizeof ( u_ent . name ) - 1 ] = '\\0' ; } else { memset ( u_ent . name , 0 , sizeof ( u_ent . name ) ) ; } u_ent . type = ent -> type ; u_ent . revision = ent -> revision ; u_ent . flags = ent -> flags ; u_ent . group_id = ent -> group_id ; u_ent . pads = ent -> num_pads ; u_ent . links = ent -> num_links - ent -> num_backlinks ; memcpy ( & u_ent . raw , & ent -> info , sizeof ( ent -> info ) ) ; if ( copy_to_user ( uent , & u_ent , sizeof ( u_ent ) ) ) return - EFAULT ; return 0 ; }
<S2SV_ModStart> media_entity_desc u_ent ; memset ( & u_ent , 0 , sizeof ( u_ent ) ) ;
torvalds@linux/e6a623460e5fc960ac3ee9f946d3106233fd28d8
CVE-2014-1739
https://github.com/torvalds/linux/commit/e6a623460e5fc960ac3ee9f946d3106233fd28d8
2014-06-23T11:21Z
367
CWE-125
CWE-125 static void sycc444_to_rgb ( opj_image_t * img ) { int * d0 , * d1 , * d2 , * r , * g , * b ; const int * y , * cb , * cr ; <S2SV_StartBug> unsigned int maxw , maxh , max , i ; <S2SV_EndBug> int offset , upb ; upb = ( int ) img -> comps [ 0 ] . prec ; offset = 1 << ( upb - 1 ) ; upb = ( 1 << upb ) - 1 ; <S2SV_StartBug> maxw = ( unsigned int ) img -> comps [ 0 ] . w ; maxh = ( unsigned int ) img -> comps [ 0 ] . h ; <S2SV_EndBug> max = maxw * maxh ; y = img -> comps [ 0 ] . data ; cb = img -> comps [ 1 ] . data ; cr = img -> comps [ 2 ] . data ; <S2SV_StartBug> d0 = r = ( int * ) malloc ( sizeof ( int ) * ( size_t ) max ) ; <S2SV_EndBug> <S2SV_StartBug> d1 = g = ( int * ) malloc ( sizeof ( int ) * ( size_t ) max ) ; <S2SV_EndBug> <S2SV_StartBug> d2 = b = ( int * ) malloc ( sizeof ( int ) * ( size_t ) max ) ; <S2SV_EndBug> if ( r == NULL || g == NULL || b == NULL ) goto fails ; for ( i = 0U ; i < max ; ++ i ) { sycc_to_rgb ( offset , upb , * y , * cb , * cr , r , g , b ) ; ++ y ; ++ cb ; ++ cr ; ++ r ; ++ g ; ++ b ; } free ( img -> comps [ 0 ] . data ) ; img -> comps [ 0 ] . data = d0 ; free ( img -> comps [ 1 ] . data ) ; img -> comps [ 1 ] . data = d1 ; free ( img -> comps [ 2 ] . data ) ; img -> comps [ 2 ] . data = d2 ; <S2SV_StartBug> return ; <S2SV_EndBug> fails : <S2SV_StartBug> if ( r ) free ( r ) ; <S2SV_EndBug> if ( g ) free ( g ) ; if ( b ) free ( b ) ; }
<S2SV_ModStart> * cr ; size_t <S2SV_ModEnd> maxw , maxh <S2SV_ModStart> maxw = ( size_t <S2SV_ModEnd> ) img -> <S2SV_ModStart> maxh = ( size_t <S2SV_ModEnd> ) img -> <S2SV_ModStart> int ) * <S2SV_ModEnd> max ) ; <S2SV_ModStart> int ) * <S2SV_ModEnd> max ) ; <S2SV_ModStart> int ) * <S2SV_ModEnd> max ) ; <S2SV_ModStart> = d2 ; img -> color_space = OPJ_CLRSPC_SRGB ; <S2SV_ModStart> ; fails : free ( r ) ; free ( g ) ; <S2SV_ModEnd> free ( b
uclouvain@openjpeg/15f081c89650dccee4aa4ae66f614c3fdb268767
CVE-2016-3183
https://github.com/uclouvain/openjpeg/commit/15f081c89650dccee4aa4ae66f614c3fdb268767
2017-02-03T16:59Z
368
CWE-399
CWE-399 static int fst_get_iface ( struct fst_card_info * card , struct fst_port_info * port , struct ifreq * ifr ) { sync_serial_settings sync ; int i ; switch ( port -> hwif ) { case E1 : ifr -> ifr_settings . type = IF_IFACE_E1 ; break ; case T1 : ifr -> ifr_settings . type = IF_IFACE_T1 ; break ; case V35 : ifr -> ifr_settings . type = IF_IFACE_V35 ; break ; case V24 : ifr -> ifr_settings . type = IF_IFACE_V24 ; break ; case X21D : ifr -> ifr_settings . type = IF_IFACE_X21D ; break ; case X21 : default : ifr -> ifr_settings . type = IF_IFACE_X21 ; break ; } if ( ifr -> ifr_settings . size == 0 ) { return 0 ; } if ( ifr -> ifr_settings . size < sizeof ( sync ) ) { return - ENOMEM ; } i = port -> index ; <S2SV_StartBug> sync . clock_rate = FST_RDL ( card , portConfig [ i ] . lineSpeed ) ; <S2SV_EndBug> sync . clock_type = FST_RDB ( card , portConfig [ i ] . internalClock ) == INTCLK ? CLOCK_INT : CLOCK_EXT ; sync . loopback = 0 ; if ( copy_to_user ( ifr -> ifr_settings . ifs_ifsu . sync , & sync , sizeof ( sync ) ) ) { return - EFAULT ; } ifr -> ifr_settings . size = sizeof ( sync ) ; return 0 ; }
<S2SV_ModStart> -> index ; memset ( & sync , 0 , sizeof ( sync ) ) ;
torvalds@linux/96b340406724d87e4621284ebac5e059d67b2194
CVE-2014-1444
https://github.com/torvalds/linux/commit/96b340406724d87e4621284ebac5e059d67b2194
2014-01-18T22:55Z
369
CWE-119
CWE-119 static int read_header ( FFV1Context * f ) { uint8_t state [ CONTEXT_SIZE ] ; int i , j , context_count = - 1 ; RangeCoder * const c = & f -> slice_context [ 0 ] -> c ; memset ( state , 128 , sizeof ( state ) ) ; if ( f -> version < 2 ) { <S2SV_StartBug> int chroma_planes , chroma_h_shift , chroma_v_shift , transparency ; <S2SV_EndBug> unsigned v = get_symbol ( c , state , 0 ) ; if ( v >= 2 ) { av_log ( f -> avctx , AV_LOG_ERROR , "invalid<S2SV_blank>version<S2SV_blank>%d<S2SV_blank>in<S2SV_blank>ver01<S2SV_blank>header\\n" , v ) ; return AVERROR_INVALIDDATA ; } f -> version = v ; f -> ac = f -> avctx -> coder_type = get_symbol ( c , state , 0 ) ; if ( f -> ac > 1 ) { for ( i = 1 ; i < 256 ; i ++ ) f -> state_transition [ i ] = get_symbol ( c , state , 1 ) + c -> one_state [ i ] ; } <S2SV_StartBug> f -> colorspace = get_symbol ( c , state , 0 ) ; <S2SV_EndBug> <S2SV_StartBug> if ( f -> version > 0 ) <S2SV_EndBug> <S2SV_StartBug> f -> avctx -> bits_per_raw_sample = get_symbol ( c , state , 0 ) ; <S2SV_EndBug> <S2SV_StartBug> chroma_planes = get_rac ( c , state ) ; <S2SV_EndBug> <S2SV_StartBug> chroma_h_shift = get_symbol ( c , state , 0 ) ; <S2SV_EndBug> chroma_v_shift = get_symbol ( c , state , 0 ) ; transparency = get_rac ( c , state ) ; if ( f -> plane_count ) { <S2SV_StartBug> if ( chroma_planes != f -> chroma_planes <S2SV_EndBug> || chroma_h_shift != f -> chroma_h_shift || chroma_v_shift != f -> chroma_v_shift || transparency != f -> transparency ) { av_log ( f -> avctx , AV_LOG_ERROR , "Invalid<S2SV_blank>change<S2SV_blank>of<S2SV_blank>global<S2SV_blank>parameters\\n" ) ; return AVERROR_INVALIDDATA ; } <S2SV_StartBug> } <S2SV_EndBug> f -> chroma_planes = chroma_planes ; f -> chroma_h_shift = chroma_h_shift ; f -> chroma_v_shift = chroma_v_shift ; f -> transparency = transparency ; f -> plane_count = 2 + f -> transparency ; } if ( f -> colorspace == 0 ) { if ( ! f -> transparency && ! f -> chroma_planes ) { if ( f -> avctx -> bits_per_raw_sample <= 8 ) f -> avctx -> pix_fmt = AV_PIX_FMT_GRAY8 ; else f -> avctx -> pix_fmt = AV_PIX_FMT_GRAY16 ; } else if ( f -> avctx -> bits_per_raw_sample <= 8 && ! f -> transparency ) { switch ( 16 * f -> chroma_h_shift + f -> chroma_v_shift ) { case 0x00 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV444P ; break ; case 0x01 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV440P ; break ; case 0x10 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV422P ; break ; case 0x11 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV420P ; break ; case 0x20 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV411P ; break ; case 0x22 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV410P ; break ; default : av_log ( f -> avctx , AV_LOG_ERROR , "format<S2SV_blank>not<S2SV_blank>supported\\n" ) ; return AVERROR ( ENOSYS ) ; } } else if ( f -> avctx -> bits_per_raw_sample <= 8 && f -> transparency ) { switch ( 16 * f -> chroma_h_shift + f -> chroma_v_shift ) { case 0x00 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUVA444P ; break ; case 0x10 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUVA422P ; break ; case 0x11 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUVA420P ; break ; default : av_log ( f -> avctx , AV_LOG_ERROR , "format<S2SV_blank>not<S2SV_blank>supported\\n" ) ; return AVERROR ( ENOSYS ) ; } } else if ( f -> avctx -> bits_per_raw_sample == 9 ) { f -> packed_at_lsb = 1 ; switch ( 16 * f -> chroma_h_shift + f -> chroma_v_shift ) { case 0x00 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV444P9 ; break ; case 0x10 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV422P9 ; break ; case 0x11 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV420P9 ; break ; default : av_log ( f -> avctx , AV_LOG_ERROR , "format<S2SV_blank>not<S2SV_blank>supported\\n" ) ; return AVERROR ( ENOSYS ) ; } } else if ( f -> avctx -> bits_per_raw_sample == 10 ) { f -> packed_at_lsb = 1 ; switch ( 16 * f -> chroma_h_shift + f -> chroma_v_shift ) { case 0x00 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV444P10 ; break ; case 0x10 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV422P10 ; break ; case 0x11 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV420P10 ; break ; default : av_log ( f -> avctx , AV_LOG_ERROR , "format<S2SV_blank>not<S2SV_blank>supported\\n" ) ; return AVERROR ( ENOSYS ) ; } } else { switch ( 16 * f -> chroma_h_shift + f -> chroma_v_shift ) { case 0x00 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV444P16 ; break ; case 0x10 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV422P16 ; break ; case 0x11 : f -> avctx -> pix_fmt = AV_PIX_FMT_YUV420P16 ; break ; default : av_log ( f -> avctx , AV_LOG_ERROR , "format<S2SV_blank>not<S2SV_blank>supported\\n" ) ; return AVERROR ( ENOSYS ) ; } } } else if ( f -> colorspace == 1 ) { if ( f -> chroma_h_shift || f -> chroma_v_shift ) { av_log ( f -> avctx , AV_LOG_ERROR , "chroma<S2SV_blank>subsampling<S2SV_blank>not<S2SV_blank>supported<S2SV_blank>in<S2SV_blank>this<S2SV_blank>colorspace\\n" ) ; return AVERROR ( ENOSYS ) ; } if ( f -> avctx -> bits_per_raw_sample == 9 ) f -> avctx -> pix_fmt = AV_PIX_FMT_GBRP9 ; else if ( f -> avctx -> bits_per_raw_sample == 10 ) f -> avctx -> pix_fmt = AV_PIX_FMT_GBRP10 ; else if ( f -> avctx -> bits_per_raw_sample == 12 ) f -> avctx -> pix_fmt = AV_PIX_FMT_GBRP12 ; else if ( f -> avctx -> bits_per_raw_sample == 14 ) f -> avctx -> pix_fmt = AV_PIX_FMT_GBRP14 ; else if ( f -> transparency ) f -> avctx -> pix_fmt = AV_PIX_FMT_RGB32 ; else f -> avctx -> pix_fmt = AV_PIX_FMT_0RGB32 ; } else { av_log ( f -> avctx , AV_LOG_ERROR , "colorspace<S2SV_blank>not<S2SV_blank>supported\\n" ) ; return AVERROR ( ENOSYS ) ; } av_dlog ( f -> avctx , "%d<S2SV_blank>%d<S2SV_blank>%d\\n" , f -> chroma_h_shift , f -> chroma_v_shift , f -> avctx -> pix_fmt ) ; if ( f -> version < 2 ) { context_count = read_quant_tables ( c , f -> quant_table ) ; if ( context_count < 0 ) { av_log ( f -> avctx , AV_LOG_ERROR , "read_quant_table<S2SV_blank>error\\n" ) ; return AVERROR_INVALIDDATA ; } } else if ( f -> version < 3 ) { f -> slice_count = get_symbol ( c , state , 0 ) ; } else { const uint8_t * p = c -> bytestream_end ; for ( f -> slice_count = 0 ; f -> slice_count < MAX_SLICES && 3 < p - c -> bytestream_start ; f -> slice_count ++ ) { int trailer = 3 + 5 * ! ! f -> ec ; int size = AV_RB24 ( p - trailer ) ; if ( size + trailer > p - c -> bytestream_start ) break ; p -= size + trailer ; } } if ( f -> slice_count > ( unsigned ) MAX_SLICES || f -> slice_count <= 0 ) { av_log ( f -> avctx , AV_LOG_ERROR , "slice<S2SV_blank>count<S2SV_blank>%d<S2SV_blank>is<S2SV_blank>invalid\\n" , f -> slice_count ) ; return AVERROR_INVALIDDATA ; } for ( j = 0 ; j < f -> slice_count ; j ++ ) { FFV1Context * fs = f -> slice_context [ j ] ; fs -> ac = f -> ac ; fs -> packed_at_lsb = f -> packed_at_lsb ; fs -> slice_damaged = 0 ; if ( f -> version == 2 ) { fs -> slice_x = get_symbol ( c , state , 0 ) * f -> width ; fs -> slice_y = get_symbol ( c , state , 0 ) * f -> height ; fs -> slice_width = ( get_symbol ( c , state , 0 ) + 1 ) * f -> width + fs -> slice_x ; fs -> slice_height = ( get_symbol ( c , state , 0 ) + 1 ) * f -> height + fs -> slice_y ; fs -> slice_x /= f -> num_h_slices ; fs -> slice_y /= f -> num_v_slices ; fs -> slice_width = fs -> slice_width / f -> num_h_slices - fs -> slice_x ; fs -> slice_height = fs -> slice_height / f -> num_v_slices - fs -> slice_y ; if ( ( unsigned ) fs -> slice_width > f -> width || ( unsigned ) fs -> slice_height > f -> height ) return AVERROR_INVALIDDATA ; if ( ( unsigned ) fs -> slice_x + ( uint64_t ) fs -> slice_width > f -> width || ( unsigned ) fs -> slice_y + ( uint64_t ) fs -> slice_height > f -> height ) return AVERROR_INVALIDDATA ; } for ( i = 0 ; i < f -> plane_count ; i ++ ) { PlaneContext * const p = & fs -> plane [ i ] ; if ( f -> version == 2 ) { int idx = get_symbol ( c , state , 0 ) ; if ( idx > ( unsigned ) f -> quant_table_count ) { av_log ( f -> avctx , AV_LOG_ERROR , "quant_table_index<S2SV_blank>out<S2SV_blank>of<S2SV_blank>range\\n" ) ; return AVERROR_INVALIDDATA ; } p -> quant_table_index = idx ; memcpy ( p -> quant_table , f -> quant_tables [ idx ] , sizeof ( p -> quant_table ) ) ; context_count = f -> context_count [ idx ] ; } else { memcpy ( p -> quant_table , f -> quant_table , sizeof ( p -> quant_table ) ) ; } if ( f -> version <= 2 ) { av_assert0 ( context_count >= 0 ) ; if ( p -> context_count < context_count ) { av_freep ( & p -> state ) ; av_freep ( & p -> vlc_state ) ; } p -> context_count = context_count ; } } } return 0 ; }
<S2SV_ModStart> chroma_v_shift , transparency , colorspace , bits_per_raw_sample <S2SV_ModStart> ] ; } <S2SV_ModEnd> colorspace = get_symbol <S2SV_ModStart> 0 ) ; bits_per_raw_sample = <S2SV_ModEnd> f -> version <S2SV_ModStart> version > 0 ? get_symbol ( c , state , 0 ) : <S2SV_ModEnd> f -> avctx <S2SV_ModStart> avctx -> bits_per_raw_sample ; chroma_planes = get_rac ( c , state ) ; chroma_h_shift <S2SV_ModStart> 0 ) ; chroma_v_shift = get_symbol ( c , state , 0 ) ; transparency <S2SV_ModEnd> = get_rac ( <S2SV_ModStart> state ) ; <S2SV_ModEnd> if ( f <S2SV_ModStart> { if ( colorspace != f -> colorspace || bits_per_raw_sample != f -> avctx -> bits_per_raw_sample || <S2SV_ModStart> ; } } f -> colorspace = colorspace ; f -> avctx -> bits_per_raw_sample = bits_per_raw_sample ;
FFmpeg@FFmpeg/b05cd1ea7e45a836f7f6071a716c38bb30326e0f
CVE-2013-7020
https://github.com/FFmpeg/FFmpeg/commit/b05cd1ea7e45a836f7f6071a716c38bb30326e0f
2013-12-09T16:36Z
370
CWE-416
CWE-416 int fscrypt_get_encryption_info ( struct inode * inode ) { <S2SV_StartBug> struct fscrypt_info * ci = inode -> i_crypt_info ; <S2SV_EndBug> <S2SV_StartBug> if ( ! ci || <S2SV_EndBug> ( ci -> ci_keyring_key && ( ci -> ci_keyring_key -> flags & ( ( 1 << KEY_FLAG_INVALIDATED ) | ( 1 << KEY_FLAG_REVOKED ) | ( 1 << KEY_FLAG_DEAD ) ) ) ) ) return fscrypt_get_crypt_info ( inode ) ; return 0 ; }
<S2SV_ModStart> struct fscrypt_info * crypt_info ; struct fscrypt_context ctx ; struct crypto_skcipher * ctfm ; const char * cipher_str ; int keysize ; u8 * raw_key = NULL ; int res ; if ( <S2SV_ModEnd> inode -> i_crypt_info <S2SV_ModStart> inode -> i_crypt_info ) return 0 ; res = fscrypt_initialize ( inode -> i_sb -> s_cop -> flags ) ; if ( res ) return res <S2SV_ModStart> if ( ! inode -> i_sb -> s_cop -> get_context ) return - EOPNOTSUPP ; res = inode -> i_sb -> s_cop -> get_context ( inode , & ctx , sizeof ( ctx ) ) ; if ( res < 0 ) { if ( ! fscrypt_dummy_context_enabled ( inode ) || inode -> i_sb -> s_cop -> is_encrypted ( inode ) ) return res ; memset ( & ctx , 0 , sizeof ( ctx ) ) ; ctx . format = FS_ENCRYPTION_CONTEXT_FORMAT_V1 ; ctx . contents_encryption_mode = FS_ENCRYPTION_MODE_AES_256_XTS ; ctx . filenames_encryption_mode = FS_ENCRYPTION_MODE_AES_256_CTS ; memset ( ctx . master_key_descriptor , 0x42 , FS_KEY_DESCRIPTOR_SIZE ) ; } else if ( res != sizeof ( ctx ) ) { return - EINVAL ; } if ( ctx . format != FS_ENCRYPTION_CONTEXT_FORMAT_V1 ) return - EINVAL ; if ( ctx . flags & ~ FS_POLICY_FLAGS_VALID ) return - EINVAL ; crypt_info = kmem_cache_alloc ( fscrypt_info_cachep , GFP_NOFS ) ; if ( ! crypt_info ) return - ENOMEM ; crypt_info -> ci_flags = ctx . flags ; crypt_info -> ci_data_mode = ctx . contents_encryption_mode ; crypt_info -> ci_filename_mode = ctx . filenames_encryption_mode ; crypt_info -> ci_ctfm = NULL ; memcpy ( crypt_info -> ci_master_key , ctx . master_key_descriptor , sizeof ( crypt_info -> ci_master_key ) ) ; res = determine_cipher_type ( crypt_info , inode , & cipher_str , & keysize ) ; if ( res ) goto out ; res = - ENOMEM ; raw_key = kmalloc ( FS_MAX_KEY_SIZE , GFP_NOFS ) ; if ( ! raw_key ) goto out ; res = validate_user_key ( crypt_info , & ctx , raw_key , FS_KEY_DESC_PREFIX ) ; if ( res && inode -> i_sb -> s_cop -> key_prefix ) { int res2 = validate_user_key ( crypt_info , & ctx , raw_key , inode -> i_sb -> s_cop -> key_prefix ) ; if ( res2 ) { if ( res2 == - ENOKEY ) res = - ENOKEY ; goto out ; } } else if ( res ) { goto out ; } ctfm = crypto_alloc_skcipher ( cipher_str , 0 , 0 ) ; if ( ! ctfm || IS_ERR ( ctfm ) ) { res = ctfm ? PTR_ERR ( ctfm ) : - ENOMEM ; printk ( KERN_DEBUG "%s:<S2SV_blank>error<S2SV_blank>%d<S2SV_blank>(inode<S2SV_blank>%u)<S2SV_blank>allocating<S2SV_blank>crypto<S2SV_blank>tfm\\n" , __func__ , res , ( unsigned ) inode -> i_ino ) ; goto out ; } crypt_info -> ci_ctfm = ctfm ; crypto_skcipher_clear_flags ( ctfm , ~ 0 ) ; crypto_skcipher_set_flags ( ctfm , CRYPTO_TFM_REQ_WEAK_KEY ) ; res = crypto_skcipher_setkey ( ctfm , raw_key , keysize ) ; if ( res ) goto out ; if ( cmpxchg ( & inode -> i_crypt_info , NULL , crypt_info ) == NULL ) crypt_info = NULL ; out : if ( res == - ENOKEY ) res = 0 ; put_crypt_info ( crypt_info ) ; kzfree ( raw_key ) ; return res <S2SV_ModEnd> ; } <S2SV_null>
torvalds@linux/1b53cf9815bb4744958d41f3795d5d5a1d365e2d
CVE-2017-7374
https://github.com/torvalds/linux/commit/1b53cf9815bb4744958d41f3795d5d5a1d365e2d
2017-03-31T20:59Z
371
CWE-119
CWE-119 <S2SV_StartBug> static void update_skip_probs ( VP9_COMMON * cm , vp9_writer * w ) { <S2SV_EndBug> int k ; for ( k = 0 ; k < SKIP_CONTEXTS ; ++ k ) <S2SV_StartBug> vp9_cond_prob_diff_update ( w , & cm -> fc . skip_probs [ k ] , cm -> counts . skip [ k ] ) ; <S2SV_EndBug> }
<S2SV_ModStart> * cm , vpx_writer * w , FRAME_COUNTS * counts <S2SV_ModEnd> ) { int <S2SV_ModStart> cm -> fc -> <S2SV_ModEnd> skip_probs [ k <S2SV_ModStart> k ] , counts -> <S2SV_ModEnd> skip [ k
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
372
CWE-400
CWE-400 asmlinkage void kernel_unaligned_trap ( struct pt_regs * regs , unsigned int insn ) { enum direction dir = decode_direction ( insn ) ; int size = decode_access_size ( regs , insn ) ; int orig_asi , asi ; current_thread_info ( ) -> kern_una_regs = regs ; current_thread_info ( ) -> kern_una_insn = insn ; orig_asi = asi = decode_asi ( insn , regs ) ; if ( asi == ASI_AIUS ) { kernel_mna_trap_fault ( 0 ) ; return ; } log_unaligned ( regs ) ; if ( ! ok_for_kernel ( insn ) || dir == both ) { printk ( "Unsupported<S2SV_blank>unaligned<S2SV_blank>load/store<S2SV_blank>trap<S2SV_blank>for<S2SV_blank>kernel<S2SV_blank>" "at<S2SV_blank><%016lx>.\\n" , regs -> tpc ) ; unaligned_panic ( "Kernel<S2SV_blank>does<S2SV_blank>fpu/atomic<S2SV_blank>" "unaligned<S2SV_blank>load/store." , regs ) ; kernel_mna_trap_fault ( 0 ) ; } else { unsigned long addr , * reg_addr ; int err ; addr = compute_effective_address ( regs , insn , ( ( insn >> 25 ) & 0x1f ) ) ; <S2SV_StartBug> perf_sw_event ( PERF_COUNT_SW_ALIGNMENT_FAULTS , 1 , 0 , regs , addr ) ; <S2SV_EndBug> switch ( asi ) { case ASI_NL : case ASI_AIUPL : case ASI_AIUSL : case ASI_PL : case ASI_SL : case ASI_PNFL : case ASI_SNFL : asi &= ~ 0x08 ; break ; } switch ( dir ) { case load : reg_addr = fetch_reg_addr ( ( ( insn >> 25 ) & 0x1f ) , regs ) ; err = do_int_load ( reg_addr , size , ( unsigned long * ) addr , decode_signedness ( insn ) , asi ) ; if ( likely ( ! err ) && unlikely ( asi != orig_asi ) ) { unsigned long val_in = * reg_addr ; switch ( size ) { case 2 : val_in = swab16 ( val_in ) ; break ; case 4 : val_in = swab32 ( val_in ) ; break ; case 8 : val_in = swab64 ( val_in ) ; break ; case 16 : default : BUG ( ) ; break ; } * reg_addr = val_in ; } break ; case store : err = do_int_store ( ( ( insn >> 25 ) & 0x1f ) , size , ( unsigned long * ) addr , regs , asi , orig_asi ) ; break ; default : panic ( "Impossible<S2SV_blank>kernel<S2SV_blank>unaligned<S2SV_blank>trap." ) ; } if ( unlikely ( err ) ) kernel_mna_trap_fault ( 1 ) ; else advance ( regs ) ; } }
<S2SV_ModStart> , 1 , <S2SV_ModEnd> regs , addr
torvalds@linux/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
CVE-2011-2918
https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
2012-05-24T23:55Z
373
CWE-000
CWE-000 static void * bpf_obj_do_get ( const struct filename * pathname , enum bpf_type * type ) { struct inode * inode ; struct path path ; void * raw ; int ret ; ret = kern_path ( pathname -> name , LOOKUP_FOLLOW , & path ) ; if ( ret ) return ERR_PTR ( ret ) ; inode = d_backing_inode ( path . dentry ) ; ret = inode_permission ( inode , MAY_WRITE ) ; if ( ret ) goto out ; ret = bpf_inode_type ( inode , type ) ; if ( ret ) goto out ; raw = bpf_any_get ( inode -> i_private , * type ) ; <S2SV_StartBug> touch_atime ( & path ) ; <S2SV_EndBug> path_put ( & path ) ; return raw ; out : path_put ( & path ) ; return ERR_PTR ( ret ) ; }
<S2SV_ModStart> type ) ; if ( ! IS_ERR ( raw ) )
torvalds@linux/92117d8443bc5afacc8d5ba82e541946310f106e
CVE-2016-4558
https://github.com/torvalds/linux/commit/92117d8443bc5afacc8d5ba82e541946310f106e
2016-05-23T10:59Z
374
CWE-476
CWE-476 static VTermScreen * screen_new ( VTerm * vt ) { VTermState * state = vterm_obtain_state ( vt ) ; VTermScreen * screen ; int rows , cols ; <S2SV_StartBug> if ( ! state ) <S2SV_EndBug> return NULL ; <S2SV_StartBug> screen = vterm_allocator_malloc ( vt , sizeof ( VTermScreen ) ) ; <S2SV_EndBug> vterm_get_size ( vt , & rows , & cols ) ; screen -> vt = vt ; screen -> state = state ; screen -> damage_merge = VTERM_DAMAGE_CELL ; screen -> damaged . start_row = - 1 ; screen -> pending_scrollrect . start_row = - 1 ; screen -> rows = rows ; screen -> cols = cols ; screen -> callbacks = NULL ; screen -> cbdata = NULL ; screen -> buffers [ 0 ] = realloc_buffer ( screen , NULL , rows , cols ) ; screen -> buffer = screen -> buffers [ 0 ] ; screen -> sb_buffer = vterm_allocator_malloc ( screen -> vt , sizeof ( VTermScreenCell ) * cols ) ; <S2SV_StartBug> vterm_state_set_callbacks ( screen -> state , & state_cbs , screen ) ; <S2SV_EndBug> return screen ; }
<S2SV_ModStart> ; if ( state == NULL <S2SV_ModEnd> ) return NULL <S2SV_ModStart> VTermScreen ) ) ; if ( screen == NULL ) return NULL <S2SV_ModStart> cols ) ; if ( screen -> buffer == NULL || screen -> sb_buffer == NULL ) { vterm_screen_free ( screen ) ; return NULL ; }
vim@vim/cd929f7ba8cc5b6d6dcf35c8b34124e969fed6b8
CVE-2018-20786
https://github.com/vim/vim/commit/cd929f7ba8cc5b6d6dcf35c8b34124e969fed6b8
2019-02-24T14:29Z
375
CWE-400
CWE-400 static struct mnt_namespace * create_mnt_ns ( struct vfsmount * m ) { struct mnt_namespace * new_ns = alloc_mnt_ns ( & init_user_ns ) ; if ( ! IS_ERR ( new_ns ) ) { struct mount * mnt = real_mount ( m ) ; mnt -> mnt_ns = new_ns ; new_ns -> root = mnt ; <S2SV_StartBug> list_add ( & mnt -> mnt_list , & new_ns -> list ) ; <S2SV_EndBug> } else { mntput ( m ) ; } return new_ns ; }
<S2SV_ModStart> = mnt ; new_ns -> mounts ++ ;
torvalds@linux/d29216842a85c7970c536108e093963f02714498
CVE-2016-6213
https://github.com/torvalds/linux/commit/d29216842a85c7970c536108e093963f02714498
2016-12-28T07:59Z
376
CWE-20
CWE-20 TcpOption * tcpGetOption ( TcpHeader * segment , uint8_t kind ) { <S2SV_StartBug> size_t length ; <S2SV_EndBug> uint_t i ; TcpOption * option ; <S2SV_StartBug> if ( segment -> dataOffset < 5 ) <S2SV_EndBug> return NULL ; <S2SV_StartBug> length = segment -> dataOffset * 4 - sizeof ( TcpHeader ) ; <S2SV_EndBug> i = 0 ; while ( i < length ) { option = ( TcpOption * ) ( segment -> options + i ) ; <S2SV_StartBug> if ( option -> kind == TCP_OPTION_NOP ) <S2SV_EndBug> { i ++ ; <S2SV_StartBug> continue ; <S2SV_EndBug> } if ( option -> kind == TCP_OPTION_END ) break ; <S2SV_StartBug> if ( ( i + 1 ) >= length || ( i + option -> length ) > length ) <S2SV_EndBug> break ; if ( option -> kind == kind ) return option ; i += option -> length ; } <S2SV_StartBug> return NULL ; <S2SV_EndBug> }
<S2SV_ModStart> ) { size_t i ; size_t length <S2SV_ModEnd> ; TcpOption * <S2SV_ModStart> segment -> dataOffset >= ( sizeof ( TcpHeader ) / 4 ) ) { length = ( <S2SV_ModEnd> segment -> dataOffset <S2SV_ModStart> dataOffset * 4 ) <S2SV_ModStart> -> kind == TCP_OPTION_END ) { break ; } else if ( option -> kind == <S2SV_ModStart> i ++ ; } else { <S2SV_ModEnd> if ( ( <S2SV_ModStart> ) >= length ) break ; if ( option -> length < sizeof ( TcpOption ) <S2SV_ModStart> length ; } } }
Oryx-Embedded@CycloneTCP/de5336016edbe1e90327d0ed1cba5c4e49114366
CVE-2021-26788
https://github.com/Oryx-Embedded/CycloneTCP/commit/de5336016edbe1e90327d0ed1cba5c4e49114366
2021-03-08T13:15Z
377
CWE-119
CWE-119 int encode_msg ( struct sip_msg * msg , char * payload , int len ) { int i , j , k , u , request ; unsigned short int h ; struct hdr_field * hf ; struct msg_start * ms ; struct sip_uri miuri ; char * myerror = NULL ; ptrdiff_t diff ; if ( len < MAX_ENCODED_MSG + MAX_MESSAGE_LEN ) return - 1 ; if ( parse_headers ( msg , HDR_EOH_F , 0 ) < 0 ) { myerror = "in<S2SV_blank>parse_headers" ; goto error ; } memset ( payload , 0 , len ) ; ms = & msg -> first_line ; if ( ms -> type == SIP_REQUEST ) request = 1 ; else if ( ms -> type == SIP_REPLY ) request = 0 ; else { myerror = "message<S2SV_blank>is<S2SV_blank>neither<S2SV_blank>request<S2SV_blank>nor<S2SV_blank>response" ; goto error ; } if ( request ) { for ( h = 0 ; h < 32 ; j = ( 0x01 << h ) , h ++ ) if ( j & ms -> u . request . method_value ) break ; } else { h = ( unsigned short ) ( ms -> u . reply . statuscode ) ; } if ( h == 32 ) { myerror = "unknown<S2SV_blank>message<S2SV_blank>type\\n" ; goto error ; } h = htons ( h ) ; memcpy ( payload , & h , 2 ) ; h = htons ( ( unsigned short int ) msg -> len ) ; memcpy ( & payload [ MSG_LEN_IDX ] , & h , 2 ) ; if ( 0 > ( diff = ( get_body ( msg ) - ( msg -> buf ) ) ) ) { myerror = "body<S2SV_blank>starts<S2SV_blank>before<S2SV_blank>the<S2SV_blank>message<S2SV_blank>(uh<S2SV_blank>?)" ; goto error ; } else h = htons ( ( unsigned short int ) diff ) ; memcpy ( payload + CONTENT_IDX , & h , 2 ) ; payload [ METHOD_CODE_IDX ] = ( unsigned char ) ( request ? ( ms -> u . request . method . s - msg -> buf ) : ( ms -> u . reply . status . s - msg -> buf ) ) ; payload [ METHOD_CODE_IDX + 1 ] = ( unsigned char ) ( request ? ( ms -> u . request . method . len ) : ( ms -> u . reply . status . len ) ) ; payload [ URI_REASON_IDX ] = ( unsigned char ) ( request ? ( ms -> u . request . uri . s - msg -> buf ) : ( ms -> u . reply . reason . s - msg -> buf ) ) ; payload [ URI_REASON_IDX + 1 ] = ( unsigned char ) ( request ? ( ms -> u . request . uri . len ) : ( ms -> u . reply . reason . len ) ) ; payload [ VERSION_IDX ] = ( unsigned char ) ( request ? ( ms -> u . request . version . s - msg -> buf ) : ( ms -> u . reply . version . s - msg -> buf ) ) ; if ( request ) { if ( parse_uri ( ms -> u . request . uri . s , ms -> u . request . uri . len , & miuri ) < 0 ) { LM_ERR ( "<%.*s>\\n" , ms -> u . request . uri . len , ms -> u . request . uri . s ) ; myerror = "while<S2SV_blank>parsing<S2SV_blank>the<S2SV_blank>R-URI" ; goto error ; } if ( 0 > ( j = encode_uri2 ( msg -> buf , ms -> u . request . method . s - msg -> buf + ms -> len , ms -> u . request . uri , & miuri , ( unsigned char * ) & payload [ REQUEST_URI_IDX + 1 ] ) ) ) { myerror = "ENCODE_MSG:<S2SV_blank>ERROR<S2SV_blank>while<S2SV_blank>encoding<S2SV_blank>the<S2SV_blank>R-URI" ; goto error ; } payload [ REQUEST_URI_IDX ] = ( unsigned char ) j ; k = REQUEST_URI_IDX + 1 + j ; } else k = REQUEST_URI_IDX ; u = k ; k ++ ; for ( i = 0 , hf = msg -> headers ; hf ; hf = hf -> next , i ++ ) ; i ++ ; j = k + 3 * i ; for ( i = 0 , hf = msg -> headers ; hf ; hf = hf -> next , k += 3 ) { payload [ k ] = ( unsigned char ) ( hf -> type & 0xFF ) ; h = htons ( j ) ; memcpy ( & payload [ k + 1 ] , & h , 2 ) ; if ( 0 > ( i = encode_header ( msg , hf , ( unsigned char * ) ( payload + j ) , MAX_ENCODED_MSG + MAX_MESSAGE_LEN - j ) ) ) { LM_ERR ( "encoding<S2SV_blank>header<S2SV_blank>%.*s\\n" , hf -> name . len , hf -> name . s ) ; goto error ; k -= 3 ; continue ; } j += ( unsigned short int ) i ; } payload [ u ] = ( unsigned char ) ( ( k - u - 1 ) / 3 ) ; j = htons ( j ) ; memcpy ( & payload [ k + 1 ] , & j , 2 ) ; k += 3 ; j = ntohs ( j ) ; <S2SV_StartBug> memcpy ( & payload [ j ] , msg -> buf , msg -> len ) ; <S2SV_EndBug> LM_DBG ( "msglen<S2SV_blank>=<S2SV_blank>%d,msg<S2SV_blank>starts<S2SV_blank>at<S2SV_blank>%d\\n" , msg -> len , j ) ; j = htons ( j ) ; memcpy ( & payload [ MSG_START_IDX ] , & j , 2 ) ; return GET_PAY_SIZE ( payload ) ; error : LM_ERR ( "%s\\n" , myerror ) ; return - 1 ; }
<S2SV_ModStart> j ) ; if ( len < j + msg -> len + 1 ) { LM_ERR ( "not<S2SV_blank>enough<S2SV_blank>space<S2SV_blank>to<S2SV_blank>encode<S2SV_blank>sip<S2SV_blank>message\\n" ) ; return - 1 ; }
kamailio@kamailio/f50c9c853e7809810099c970780c30b0765b0643
CVE-2016-2385
https://github.com/kamailio/kamailio/commit/f50c9c853e7809810099c970780c30b0765b0643
2016-04-11T15:59Z
378
CWE-20
CWE-20 static int ipx_recvmsg ( struct kiocb * iocb , struct socket * sock , struct msghdr * msg , size_t size , int flags ) { struct sock * sk = sock -> sk ; struct ipx_sock * ipxs = ipx_sk ( sk ) ; struct sockaddr_ipx * sipx = ( struct sockaddr_ipx * ) msg -> msg_name ; struct ipxhdr * ipx = NULL ; struct sk_buff * skb ; int copied , rc ; lock_sock ( sk ) ; if ( ! ipxs -> port ) { struct sockaddr_ipx uaddr ; uaddr . sipx_port = 0 ; uaddr . sipx_network = 0 ; # ifdef CONFIG_IPX_INTERN rc = - ENETDOWN ; if ( ! ipxs -> intrfc ) goto out ; memcpy ( uaddr . sipx_node , ipxs -> intrfc -> if_node , IPX_NODE_LEN ) ; # endif rc = __ipx_bind ( sock , ( struct sockaddr * ) & uaddr , sizeof ( struct sockaddr_ipx ) ) ; if ( rc ) goto out ; } rc = - ENOTCONN ; if ( sock_flag ( sk , SOCK_ZAPPED ) ) goto out ; skb = skb_recv_datagram ( sk , flags & ~ MSG_DONTWAIT , flags & MSG_DONTWAIT , & rc ) ; if ( ! skb ) goto out ; ipx = ipx_hdr ( skb ) ; copied = ntohs ( ipx -> ipx_pktsize ) - sizeof ( struct ipxhdr ) ; if ( copied > size ) { copied = size ; msg -> msg_flags |= MSG_TRUNC ; } rc = skb_copy_datagram_iovec ( skb , sizeof ( struct ipxhdr ) , msg -> msg_iov , copied ) ; if ( rc ) goto out_free ; if ( skb -> tstamp . tv64 ) sk -> sk_stamp = skb -> tstamp ; <S2SV_StartBug> msg -> msg_namelen = sizeof ( * sipx ) ; <S2SV_EndBug> if ( sipx ) { sipx -> sipx_family = AF_IPX ; sipx -> sipx_port = ipx -> ipx_source . sock ; memcpy ( sipx -> sipx_node , ipx -> ipx_source . node , IPX_NODE_LEN ) ; sipx -> sipx_network = IPX_SKB_CB ( skb ) -> ipx_source_net ; sipx -> sipx_type = ipx -> ipx_type ; sipx -> sipx_zero = 0 ; } rc = copied ; out_free : skb_free_datagram ( sk , skb ) ; out : release_sock ( sk ) ; return rc ; }
<S2SV_ModStart> -> tstamp ; if ( sipx ) { sipx -> sipx_family = AF_IPX ; sipx -> sipx_port = ipx -> ipx_source . sock ; memcpy ( sipx -> sipx_node , ipx -> ipx_source . node , IPX_NODE_LEN ) ; sipx -> sipx_network = IPX_SKB_CB ( skb ) -> ipx_source_net ; sipx -> sipx_type = ipx -> ipx_type ; sipx -> sipx_zero = 0 ; <S2SV_ModStart> * sipx ) <S2SV_ModEnd> ; } rc
torvalds@linux/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
CVE-2013-7271
https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
2014-01-06T16:55Z
379
CWE-399
CWE-399 static long vhost_net_set_backend ( struct vhost_net * n , unsigned index , int fd ) { struct socket * sock , * oldsock ; struct vhost_virtqueue * vq ; struct vhost_net_virtqueue * nvq ; struct vhost_net_ubuf_ref * ubufs , * oldubufs = NULL ; int r ; mutex_lock ( & n -> dev . mutex ) ; r = vhost_dev_check_owner ( & n -> dev ) ; if ( r ) goto err ; if ( index >= VHOST_NET_VQ_MAX ) { r = - ENOBUFS ; goto err ; } vq = & n -> vqs [ index ] . vq ; nvq = & n -> vqs [ index ] ; mutex_lock ( & vq -> mutex ) ; if ( ! vhost_vq_access_ok ( vq ) ) { r = - EFAULT ; goto err_vq ; } sock = get_socket ( fd ) ; if ( IS_ERR ( sock ) ) { r = PTR_ERR ( sock ) ; goto err_vq ; } oldsock = rcu_dereference_protected ( vq -> private_data , lockdep_is_held ( & vq -> mutex ) ) ; if ( sock != oldsock ) { ubufs = vhost_net_ubuf_alloc ( vq , sock && vhost_sock_zcopy ( sock ) ) ; if ( IS_ERR ( ubufs ) ) { r = PTR_ERR ( ubufs ) ; goto err_ubufs ; } vhost_net_disable_vq ( n , vq ) ; rcu_assign_pointer ( vq -> private_data , sock ) ; r = vhost_init_used ( vq ) ; if ( r ) goto err_used ; r = vhost_net_enable_vq ( n , vq ) ; if ( r ) goto err_used ; oldubufs = nvq -> ubufs ; nvq -> ubufs = ubufs ; n -> tx_packets = 0 ; n -> tx_zcopy_err = 0 ; n -> tx_flush = false ; } mutex_unlock ( & vq -> mutex ) ; if ( oldubufs ) { <S2SV_StartBug> vhost_net_ubuf_put_and_wait ( oldubufs ) ; <S2SV_EndBug> mutex_lock ( & vq -> mutex ) ; vhost_zerocopy_signal_used ( n , vq ) ; mutex_unlock ( & vq -> mutex ) ; } if ( oldsock ) { vhost_net_flush_vq ( n , index ) ; fput ( oldsock -> file ) ; } mutex_unlock ( & n -> dev . mutex ) ; return 0 ; err_used : rcu_assign_pointer ( vq -> private_data , oldsock ) ; vhost_net_enable_vq ( n , vq ) ; if ( ubufs ) <S2SV_StartBug> vhost_net_ubuf_put_and_wait ( ubufs ) ; <S2SV_EndBug> err_ubufs : fput ( sock -> file ) ; err_vq : mutex_unlock ( & vq -> mutex ) ; err : mutex_unlock ( & n -> dev . mutex ) ; return r ; }
<S2SV_ModStart> oldubufs ) { vhost_net_ubuf_put_wait_and_free <S2SV_ModEnd> ( oldubufs ) <S2SV_ModStart> ( ubufs ) vhost_net_ubuf_put_wait_and_free <S2SV_ModEnd> ( ubufs )
torvalds@linux/dd7633ecd553a5e304d349aa6f8eb8a0417098c5
CVE-2013-4127
https://github.com/torvalds/linux/commit/dd7633ecd553a5e304d349aa6f8eb8a0417098c5
2013-07-29T13:59Z
380
CWE-552
CWE-552 static ssize_t _consolefs_readv ( oe_fd_t * desc , const struct oe_iovec * iov , int iovcnt ) { ssize_t ret = - 1 ; file_t * file = _cast_file ( desc ) ; void * buf = NULL ; <S2SV_StartBug> size_t buf_size = 0 ; <S2SV_EndBug> if ( ! file || ! iov || iovcnt < 0 || iovcnt > OE_IOV_MAX ) OE_RAISE_ERRNO ( OE_EINVAL ) ; <S2SV_StartBug> if ( oe_iov_pack ( iov , iovcnt , & buf , & buf_size ) != 0 ) <S2SV_EndBug> <S2SV_StartBug> OE_RAISE_ERRNO ( OE_ENOMEM ) ; <S2SV_EndBug> if ( oe_syscall_readv_ocall ( & ret , file -> host_fd , buf , iovcnt , buf_size ) != OE_OK ) { OE_RAISE_ERRNO ( OE_EINVAL ) ; } <S2SV_StartBug> if ( oe_iov_sync ( iov , iovcnt , buf , buf_size ) != 0 ) <S2SV_EndBug> OE_RAISE_ERRNO ( OE_EINVAL ) ; done : if ( buf ) oe_free ( buf ) ; return ret ; }
<S2SV_ModStart> ; size_t buf_size = 0 ; size_t data_size <S2SV_ModStart> , & buf_size , & data_size <S2SV_ModStart> OE_RAISE_ERRNO ( OE_ENOMEM ) ; if ( data_size > OE_SSIZE_MAX ) OE_RAISE_ERRNO ( OE_EINVAL <S2SV_ModStart> } if ( ret > ( ssize_t ) data_size ) { ret = - 1 ; OE_RAISE_ERRNO ( OE_EINVAL ) ; } if (
openenclave@openenclave/bcac8e7acb514429fee9e0b5d0c7a0308fd4d76b
CVE-2020-15224
https://github.com/openenclave/openenclave/commit/bcac8e7acb514429fee9e0b5d0c7a0308fd4d76b
2020-10-14T19:15Z
381
CWE-119
CWE-119 <S2SV_StartBug> double vp9_convert_qindex_to_q ( int qindex ) { <S2SV_EndBug> <S2SV_StartBug> return vp9_ac_quant ( qindex , 0 ) / 4.0 ; <S2SV_EndBug> <S2SV_StartBug> } <S2SV_EndBug>
<S2SV_ModStart> ( int qindex , vpx_bit_depth_t bit_depth ) { # if CONFIG_VP9_HIGHBITDEPTH switch ( bit_depth ) { case VPX_BITS_8 : <S2SV_ModEnd> return vp9_ac_quant ( <S2SV_ModStart> qindex , 0 , bit_depth <S2SV_ModStart> / 4.0 ; case VPX_BITS_10 : return vp9_ac_quant ( qindex , 0 , bit_depth ) / 16.0 ; case VPX_BITS_12 : return vp9_ac_quant ( qindex , 0 , bit_depth ) / 64.0 ; default : assert ( 0 && "bit_depth<S2SV_blank>should<S2SV_blank>be<S2SV_blank>VPX_BITS_8,<S2SV_blank>VPX_BITS_10<S2SV_blank>or<S2SV_blank>VPX_BITS_12" ) ; return - 1.0 ; } # else return vp9_ac_quant ( qindex , 0 , bit_depth ) / 4.0 ; # endif
external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426
CVE-2016-1621
https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426
2016-03-12T21:59Z
382
CWE-295
CWE-295 NOEXPORT char * base64 ( int encode , const char * in , int len ) { BIO * bio , * b64 ; char * out ; int n ; b64 = BIO_new ( BIO_f_base64 ( ) ) ; if ( ! b64 ) return NULL ; BIO_set_flags ( b64 , BIO_FLAGS_BASE64_NO_NL ) ; bio = BIO_new ( BIO_s_mem ( ) ) ; if ( ! bio ) { <S2SV_StartBug> str_free ( b64 ) ; <S2SV_EndBug> return NULL ; } if ( encode ) bio = BIO_push ( b64 , bio ) ; BIO_write ( bio , in , len ) ; ( void ) BIO_flush ( bio ) ; if ( encode ) { bio = BIO_pop ( bio ) ; BIO_free ( b64 ) ; } else { bio = BIO_push ( b64 , bio ) ; } n = BIO_pending ( bio ) ; out = str_alloc ( n < 32 ? 32 : ( size_t ) n + 1 ) ; n = BIO_read ( bio , out , n ) ; if ( n < 0 ) { BIO_free_all ( bio ) ; str_free ( out ) ; return NULL ; } BIO_free_all ( bio ) ; return out ; }
<S2SV_ModStart> bio ) { BIO_free <S2SV_ModEnd> ( b64 )
mtrojnar@stunnel/ebad9ddc4efb2635f37174c9d800d06206f1edf9
CVE-2021-20230
https://github.com/mtrojnar/stunnel/commit/ebad9ddc4efb2635f37174c9d800d06206f1edf9
2021-02-23T17:15Z
383
CWE-190
CWE-190 void * jas_malloc ( size_t size ) { void * result ; <S2SV_StartBug> JAS_DBGLOG ( 101 , ( "jas_malloc<S2SV_blank>called<S2SV_blank>with<S2SV_blank>%zu\\n" , size ) ) ; <S2SV_EndBug> result = malloc ( size ) ; JAS_DBGLOG ( 100 , ( "jas_malloc(%zu)<S2SV_blank>-><S2SV_blank>%p\\n" , size , result ) ) ; return result ; }
<S2SV_ModStart> 101 , ( "jas_malloc(%zu)\\n" <S2SV_ModEnd> , size )
mdadams@jasper/988f8365f7d8ad8073b6786e433d34c553ecf568
CVE-2016-10249
https://github.com/mdadams/jasper/commit/988f8365f7d8ad8073b6786e433d34c553ecf568
2017-03-15T14:59Z
384
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
385
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
386
CWE-20
CWE-20 static int sco_sock_recvmsg ( struct kiocb * iocb , struct socket * sock , struct msghdr * msg , size_t len , int flags ) { struct sock * sk = sock -> sk ; struct sco_pinfo * pi = sco_pi ( sk ) ; lock_sock ( sk ) ; if ( sk -> sk_state == BT_CONNECT2 && test_bit ( BT_SK_DEFER_SETUP , & bt_sk ( sk ) -> flags ) ) { sco_conn_defer_accept ( pi -> conn -> hcon , pi -> setting ) ; sk -> sk_state = BT_CONFIG ; <S2SV_StartBug> msg -> msg_namelen = 0 ; <S2SV_EndBug> release_sock ( sk ) ; return 0 ; } release_sock ( sk ) ; return bt_sock_recvmsg ( iocb , sock , msg , len , flags ) ; }
<S2SV_ModStart> = BT_CONFIG ; <S2SV_ModEnd> release_sock ( sk
torvalds@linux/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
CVE-2013-7271
https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
2014-01-06T16:55Z
387
CWE-444
CWE-444 bool agoo_ws_create_req ( agooCon c , long mlen ) { uint8_t op = 0x0F & * c -> buf ; if ( NULL == ( c -> req = agoo_req_create ( mlen ) ) ) { agoo_log_cat ( & agoo_error_cat , "Out<S2SV_blank>of<S2SV_blank>memory<S2SV_blank>attempting<S2SV_blank>to<S2SV_blank>allocate<S2SV_blank>request." ) ; return true ; } if ( NULL == c -> up || agoo_server . ctx_nil_value == c -> up -> ctx ) { return true ; } memset ( c -> req , 0 , sizeof ( struct _agooReq ) ) ; if ( ( long ) c -> bcnt <= mlen ) { memcpy ( c -> req -> msg , c -> buf , c -> bcnt ) ; if ( ( long ) c -> bcnt < mlen ) { memset ( c -> req -> msg + c -> bcnt , 0 , mlen - c -> bcnt ) ; } } else { memcpy ( c -> req -> msg , c -> buf , mlen ) ; } c -> req -> msg [ mlen ] = '\\0' ; c -> req -> mlen = mlen ; c -> req -> method = ( AGOO_WS_OP_BIN == op ) ? AGOO_ON_BIN : AGOO_ON_MSG ; c -> req -> upgrade = AGOO_UP_NONE ; c -> req -> up = c -> up ; <S2SV_StartBug> c -> req -> res = NULL ; <S2SV_EndBug> if ( c -> up -> on_msg ) { c -> req -> hook = agoo_hook_create ( AGOO_NONE , NULL , c -> up -> ctx , PUSH_HOOK , & agoo_server . eval_queue ) ; } return false ; }
<S2SV_ModStart> -> up ; memcpy ( c -> req -> remote , c -> remote , sizeof ( c -> remote ) ) ;
ohler55@agoo/23d03535cf7b50d679a60a953a0cae9519a4a130
CVE-2020-7670
https://github.com/ohler55/agoo/commit/23d03535cf7b50d679a60a953a0cae9519a4a130
2020-06-10T16:15Z
388
CWE-172
CWE-172 WORD32 ih264d_end_of_pic ( dec_struct_t * ps_dec , UWORD8 u1_is_idr_slice , UWORD16 u2_frame_num ) { dec_slice_params_t * ps_cur_slice = ps_dec -> ps_cur_slice ; <S2SV_StartBug> WORD32 ret ; <S2SV_EndBug> ps_dec -> u1_first_pb_nal_in_pic = 1 ; ps_dec -> u2_mbx = 0xffff ; ps_dec -> u2_mby = 0 ; { dec_err_status_t * ps_err = ps_dec -> ps_dec_err_status ; if ( ps_err -> u1_err_flag & REJECT_CUR_PIC ) { ih264d_err_pic_dispbuf_mgr ( ps_dec ) ; return ERROR_NEW_FRAME_EXPECTED ; } } H264_MUTEX_LOCK ( & ps_dec -> process_disp_mutex ) ; ret = ih264d_end_of_pic_processing ( ps_dec ) ; if ( ret != OK ) return ret ; ps_dec -> u2_total_mbs_coded = 0 ; { pocstruct_t * ps_prev_poc = & ps_dec -> s_prev_pic_poc ; pocstruct_t * ps_cur_poc = & ps_dec -> s_cur_pic_poc ; if ( ( 0 == u1_is_idr_slice ) && ps_cur_slice -> u1_nal_ref_idc ) ps_dec -> u2_prev_ref_frame_num = ps_cur_slice -> u2_frame_num ; if ( u1_is_idr_slice || ps_cur_slice -> u1_mmco_equalto5 ) ps_dec -> u2_prev_ref_frame_num = 0 ; if ( ps_dec -> ps_cur_sps -> u1_gaps_in_frame_num_value_allowed_flag ) { ret = ih264d_decode_gaps_in_frame_num ( ps_dec , u2_frame_num ) ; if ( ret != OK ) return ret ; } ps_prev_poc -> i4_prev_frame_num_ofst = ps_cur_poc -> i4_prev_frame_num_ofst ; ps_prev_poc -> u2_frame_num = ps_cur_poc -> u2_frame_num ; ps_prev_poc -> u1_mmco_equalto5 = ps_cur_slice -> u1_mmco_equalto5 ; if ( ps_cur_slice -> u1_nal_ref_idc ) { ps_prev_poc -> i4_pic_order_cnt_lsb = ps_cur_poc -> i4_pic_order_cnt_lsb ; ps_prev_poc -> i4_pic_order_cnt_msb = ps_cur_poc -> i4_pic_order_cnt_msb ; ps_prev_poc -> i4_delta_pic_order_cnt_bottom = ps_cur_poc -> i4_delta_pic_order_cnt_bottom ; ps_prev_poc -> i4_delta_pic_order_cnt [ 0 ] = ps_cur_poc -> i4_delta_pic_order_cnt [ 0 ] ; ps_prev_poc -> i4_delta_pic_order_cnt [ 1 ] = ps_cur_poc -> i4_delta_pic_order_cnt [ 1 ] ; ps_prev_poc -> u1_bot_field = ps_cur_poc -> u1_bot_field ; } } H264_MUTEX_UNLOCK ( & ps_dec -> process_disp_mutex ) ; return OK ; }
<S2SV_ModStart> ; WORD32 ret <S2SV_ModEnd> ; ps_dec ->
external@libavc/326fe991a4b7971e8aeaf4ac775491dd8abd85bb
CVE-2016-3829
https://android.googlesource.com/platform/external/libavc/+/326fe991a4b7971e8aeaf4ac775491dd8abd85bb
2016-08-05T20:59Z
389
CWE-20
CWE-20 static apr_status_t parse_chunk_size ( http_ctx_t * ctx , const char * buffer , apr_size_t len , int linelimit ) { apr_size_t i = 0 ; while ( i < len ) { char c = buffer [ i ] ; ap_xlate_proto_from_ascii ( & c , 1 ) ; <S2SV_StartBug> if ( ctx -> state == BODY_CHUNK_END ) { <S2SV_EndBug> if ( c == LF ) { <S2SV_StartBug> ctx -> state = BODY_CHUNK ; <S2SV_EndBug> } i ++ ; continue ; } if ( ctx -> state == BODY_CHUNK ) { if ( ! apr_isxdigit ( c ) ) { <S2SV_StartBug> return APR_EGENERAL ; <S2SV_EndBug> } else { ctx -> state = BODY_CHUNK_PART ; } ctx -> remaining = 0 ; <S2SV_StartBug> ctx -> chunkbits = sizeof ( long ) * 8 ; <S2SV_EndBug> ctx -> chunk_used = 0 ; } <S2SV_StartBug> if ( c == ';' || c == CR ) { <S2SV_EndBug> ctx -> state = BODY_CHUNK_EXT ; } <S2SV_StartBug> else if ( c == LF ) { <S2SV_EndBug> if ( ctx -> remaining ) { ctx -> state = BODY_CHUNK_DATA ; } else { ctx -> state = BODY_CHUNK_TRAILER ; } } else if ( ctx -> state != BODY_CHUNK_EXT ) { <S2SV_StartBug> int xvalue = 0 ; <S2SV_EndBug> if ( ! ctx -> remaining && c == '0' ) { i ++ ; <S2SV_StartBug> continue ; <S2SV_EndBug> } if ( c >= '0' && c <= '9' ) { xvalue = c - '0' ; } else if ( c >= 'A' && c <= 'F' ) { xvalue = c - 'A' + 0xa ; } else if ( c >= 'a' && c <= 'f' ) { xvalue = c - 'a' + 0xa ; } else { <S2SV_StartBug> return APR_EGENERAL ; <S2SV_EndBug> } ctx -> remaining = ( ctx -> remaining << 4 ) | xvalue ; <S2SV_StartBug> ctx -> chunkbits -= 4 ; <S2SV_EndBug> if ( ctx -> chunkbits <= 0 || ctx -> remaining < 0 ) { return APR_ENOSPC ; <S2SV_StartBug> } <S2SV_EndBug> } i ++ ; } ctx -> chunk_used += len ; if ( ctx -> chunk_used < 0 || ctx -> chunk_used > linelimit ) { return APR_ENOSPC ; } return APR_SUCCESS ; }
<S2SV_ModStart> state == BODY_CHUNK_END || ctx -> state == BODY_CHUNK_END_LF <S2SV_ModStart> state = BODY_CHUNK ; } else if ( c == CR && ctx -> state == BODY_CHUNK_END ) { ctx -> state = BODY_CHUNK_END_LF ; } else { return APR_EINVAL <S2SV_ModStart> ) { return APR_EINVAL <S2SV_ModEnd> ; } else <S2SV_ModStart> = sizeof ( apr_off_t <S2SV_ModEnd> ) * 8 <S2SV_ModStart> ( c == LF ) { if ( ctx -> remaining ) { ctx -> state = BODY_CHUNK_DATA ; } else { ctx -> state = BODY_CHUNK_TRAILER ; } } else if ( ctx -> state == BODY_CHUNK_LF ) { return APR_EINVAL ; } else if ( c == CR ) { ctx -> state = BODY_CHUNK_LF ; } else if ( c == ';' <S2SV_ModEnd> ) { ctx <S2SV_ModStart> else if ( ctx -> state == BODY_CHUNK_EXT ) { if ( c != '\\t' && apr_iscntrl ( c ) ) { return APR_EINVAL ; } } else if ( ctx -> state == BODY_CHUNK_PART <S2SV_ModEnd> ) { int <S2SV_ModStart> { int xvalue <S2SV_ModEnd> ; if ( <S2SV_ModStart> ++ ; continue ; } ctx -> chunkbits -= 4 ; if ( ctx -> chunkbits < 0 ) { return APR_ENOSPC <S2SV_ModStart> else { return APR_EINVAL <S2SV_ModEnd> ; } ctx <S2SV_ModStart> | xvalue ; if ( <S2SV_ModEnd> ctx -> remaining <S2SV_ModStart> APR_ENOSPC ; } } else { return APR_EGENERAL ;
apache@httpd/e427c41257957b57036d5a549b260b6185d1dd73
CVE-2015-3183
https://github.com/apache/httpd/commit/e427c41257957b57036d5a549b260b6185d1dd73
2015-07-20T23:59Z
390
CWE-399
CWE-399 void serveloop ( GArray * servers ) { struct sockaddr_storage addrin ; socklen_t addrinlen = sizeof ( addrin ) ; int i ; int max ; fd_set mset ; fd_set rset ; max = 0 ; FD_ZERO ( & mset ) ; for ( i = 0 ; i < servers -> len ; i ++ ) { int sock ; if ( ( sock = ( g_array_index ( servers , SERVER , i ) ) . socket ) >= 0 ) { FD_SET ( sock , & mset ) ; max = sock > max ? sock : max ; } } for ( i = 0 ; i < modernsocks -> len ; i ++ ) { int sock = g_array_index ( modernsocks , int , i ) ; FD_SET ( sock , & mset ) ; max = sock > max ? sock : max ; } for ( ; ; ) { if ( is_sighup_caught ) { int n ; GError * gerror = NULL ; msg ( LOG_INFO , "reconfiguration<S2SV_blank>request<S2SV_blank>received" ) ; is_sighup_caught = 0 ; n = append_new_servers ( servers , & gerror ) ; if ( n == - 1 ) msg ( LOG_ERR , "failed<S2SV_blank>to<S2SV_blank>append<S2SV_blank>new<S2SV_blank>servers:<S2SV_blank>%s" , gerror -> message ) ; for ( i = servers -> len - n ; i < servers -> len ; ++ i ) { const SERVER server = g_array_index ( servers , SERVER , i ) ; if ( server . socket >= 0 ) { FD_SET ( server . socket , & mset ) ; max = server . socket > max ? server . socket : max ; } msg ( LOG_INFO , "reconfigured<S2SV_blank>new<S2SV_blank>server:<S2SV_blank>%s" , server . servename ) ; } } memcpy ( & rset , & mset , sizeof ( fd_set ) ) ; if ( select ( max + 1 , & rset , NULL , NULL , NULL ) > 0 ) { <S2SV_StartBug> int net ; <S2SV_EndBug> DEBUG ( "accept,<S2SV_blank>" ) ; for ( i = 0 ; i < modernsocks -> len ; i ++ ) { int sock = g_array_index ( modernsocks , int , i ) ; if ( ! FD_ISSET ( sock , & rset ) ) { continue ; } <S2SV_StartBug> CLIENT * client ; <S2SV_EndBug> <S2SV_StartBug> if ( ( net = accept ( sock , ( struct sockaddr * ) & addrin , & addrinlen ) ) < 0 ) { <S2SV_EndBug> err_nonfatal ( "accept:<S2SV_blank>%m" ) ; continue ; } <S2SV_StartBug> client = negotiate ( net , NULL , servers , NEG_INIT | NEG_MODERN ) ; <S2SV_EndBug> if ( ! client ) { close ( net ) ; continue ; } handle_connection ( servers , net , client -> server , client ) ; } for ( i = 0 ; i < servers -> len ; i ++ ) { SERVER * serve ; serve = & ( g_array_index ( servers , SERVER , i ) ) ; if ( serve -> socket < 0 ) { continue ; } if ( FD_ISSET ( serve -> socket , & rset ) ) { if ( ( net = accept ( serve -> socket , ( struct sockaddr * ) & addrin , & addrinlen ) ) < 0 ) { err_nonfatal ( "accept:<S2SV_blank>%m" ) ; continue ; } handle_connection ( servers , net , serve , NULL ) ; } } } } }
<S2SV_ModStart> 0 ) { <S2SV_ModEnd> DEBUG ( "accept,<S2SV_blank>" <S2SV_ModStart> continue ; } handle_modern_connection ( servers , sock ) ; } for ( i = 0 ; i < servers -> len ; i ++ ) { int net ; SERVER * serve ; serve = & ( g_array_index ( servers , SERVER , i ) ) ; if ( serve -> socket < 0 ) { continue ; } if ( FD_ISSET ( serve -> socket , & rset ) ) { <S2SV_ModEnd> if ( ( <S2SV_ModStart> = accept ( serve -> socket <S2SV_ModEnd> , ( struct <S2SV_ModStart> continue ; } handle_connection ( servers , net , serve , NULL <S2SV_ModEnd> ) ; }
yoe@nbd/741495cb08503fd32a9d22648e63b64390c601f4
CVE-2013-7441
https://github.com/yoe/nbd/commit/741495cb08503fd32a9d22648e63b64390c601f4
2015-05-29T15:59Z
391
CWE-400
CWE-400 int main ( ) { CU_pSuite pSuite = NULL ; unsigned int num_tests_failed ; nghttp2_enable_strict_preface = 0 ; if ( CUE_SUCCESS != CU_initialize_registry ( ) ) return ( int ) CU_get_error ( ) ; pSuite = CU_add_suite ( "libnghttp2_TestSuite" , init_suite1 , clean_suite1 ) ; if ( NULL == pSuite ) { CU_cleanup_registry ( ) ; return ( int ) CU_get_error ( ) ; } if ( ! CU_add_test ( pSuite , "pq" , test_nghttp2_pq ) || ! CU_add_test ( pSuite , "pq_update" , test_nghttp2_pq_update ) || ! CU_add_test ( pSuite , "pq_remove" , test_nghttp2_pq_remove ) || ! CU_add_test ( pSuite , "map" , test_nghttp2_map ) || ! CU_add_test ( pSuite , "map_functional" , test_nghttp2_map_functional ) || ! CU_add_test ( pSuite , "map_each_free" , test_nghttp2_map_each_free ) || ! CU_add_test ( pSuite , "queue" , test_nghttp2_queue ) || ! CU_add_test ( pSuite , "npn" , test_nghttp2_npn ) || ! CU_add_test ( pSuite , "session_recv" , test_nghttp2_session_recv ) || ! CU_add_test ( pSuite , "session_recv_invalid_stream_id" , test_nghttp2_session_recv_invalid_stream_id ) || ! CU_add_test ( pSuite , "session_recv_invalid_frame" , test_nghttp2_session_recv_invalid_frame ) || ! CU_add_test ( pSuite , "session_recv_eof" , test_nghttp2_session_recv_eof ) || ! CU_add_test ( pSuite , "session_recv_data" , test_nghttp2_session_recv_data ) || ! CU_add_test ( pSuite , "session_recv_data_no_auto_flow_control" , test_nghttp2_session_recv_data_no_auto_flow_control ) || ! CU_add_test ( pSuite , "session_recv_continuation" , test_nghttp2_session_recv_continuation ) || ! CU_add_test ( pSuite , "session_recv_headers_with_priority" , test_nghttp2_session_recv_headers_with_priority ) || ! CU_add_test ( pSuite , "session_recv_headers_with_padding" , test_nghttp2_session_recv_headers_with_padding ) || ! CU_add_test ( pSuite , "session_recv_headers_early_response" , test_nghttp2_session_recv_headers_early_response ) || ! CU_add_test ( pSuite , "session_recv_headers_for_closed_stream" , test_nghttp2_session_recv_headers_for_closed_stream ) || ! CU_add_test ( pSuite , "session_server_recv_push_response" , test_nghttp2_session_server_recv_push_response ) || ! CU_add_test ( pSuite , "session_recv_premature_headers" , test_nghttp2_session_recv_premature_headers ) || ! CU_add_test ( pSuite , "session_recv_unknown_frame" , test_nghttp2_session_recv_unknown_frame ) || ! CU_add_test ( pSuite , "session_recv_unexpected_continuation" , test_nghttp2_session_recv_unexpected_continuation ) || ! CU_add_test ( pSuite , "session_recv_settings_header_table_size" , test_nghttp2_session_recv_settings_header_table_size ) || ! CU_add_test ( pSuite , "session_recv_too_large_frame_length" , test_nghttp2_session_recv_too_large_frame_length ) || ! CU_add_test ( pSuite , "session_recv_extension" , test_nghttp2_session_recv_extension ) || ! CU_add_test ( pSuite , "session_recv_altsvc" , test_nghttp2_session_recv_altsvc ) || ! CU_add_test ( pSuite , "session_recv_origin" , test_nghttp2_session_recv_origin ) || ! CU_add_test ( pSuite , "session_continue" , test_nghttp2_session_continue ) || ! CU_add_test ( pSuite , "session_add_frame" , test_nghttp2_session_add_frame ) || ! CU_add_test ( pSuite , "session_on_request_headers_received" , test_nghttp2_session_on_request_headers_received ) || ! CU_add_test ( pSuite , "session_on_response_headers_received" , test_nghttp2_session_on_response_headers_received ) || ! CU_add_test ( pSuite , "session_on_headers_received" , test_nghttp2_session_on_headers_received ) || ! CU_add_test ( pSuite , "session_on_push_response_headers_received" , test_nghttp2_session_on_push_response_headers_received ) || ! CU_add_test ( pSuite , "session_on_priority_received" , test_nghttp2_session_on_priority_received ) || ! CU_add_test ( pSuite , "session_on_rst_stream_received" , test_nghttp2_session_on_rst_stream_received ) || ! CU_add_test ( pSuite , "session_on_settings_received" , test_nghttp2_session_on_settings_received ) || ! CU_add_test ( pSuite , "session_on_push_promise_received" , test_nghttp2_session_on_push_promise_received ) || ! CU_add_test ( pSuite , "session_on_ping_received" , test_nghttp2_session_on_ping_received ) || ! CU_add_test ( pSuite , "session_on_goaway_received" , test_nghttp2_session_on_goaway_received ) || ! CU_add_test ( pSuite , "session_on_window_update_received" , test_nghttp2_session_on_window_update_received ) || ! CU_add_test ( pSuite , "session_on_data_received" , test_nghttp2_session_on_data_received ) || ! CU_add_test ( pSuite , "session_on_data_received_fail_fast" , test_nghttp2_session_on_data_received_fail_fast ) || ! CU_add_test ( pSuite , "session_on_altsvc_received" , test_nghttp2_session_on_altsvc_received ) || ! CU_add_test ( pSuite , "session_send_headers_start_stream" , test_nghttp2_session_send_headers_start_stream ) || ! CU_add_test ( pSuite , "session_send_headers_reply" , test_nghttp2_session_send_headers_reply ) || ! CU_add_test ( pSuite , "session_send_headers_frame_size_error" , test_nghttp2_session_send_headers_frame_size_error ) || ! CU_add_test ( pSuite , "session_send_headers_push_reply" , test_nghttp2_session_send_headers_push_reply ) || ! CU_add_test ( pSuite , "session_send_rst_stream" , test_nghttp2_session_send_rst_stream ) || ! CU_add_test ( pSuite , "session_send_push_promise" , test_nghttp2_session_send_push_promise ) || ! CU_add_test ( pSuite , "session_is_my_stream_id" , test_nghttp2_session_is_my_stream_id ) || ! CU_add_test ( pSuite , "session_upgrade2" , test_nghttp2_session_upgrade2 ) || ! CU_add_test ( pSuite , "session_reprioritize_stream" , test_nghttp2_session_reprioritize_stream ) || ! CU_add_test ( pSuite , "session_reprioritize_stream_with_idle_stream_dep" , test_nghttp2_session_reprioritize_stream_with_idle_stream_dep ) || ! CU_add_test ( pSuite , "submit_data" , test_nghttp2_submit_data ) || ! CU_add_test ( pSuite , "submit_data_read_length_too_large" , test_nghttp2_submit_data_read_length_too_large ) || ! CU_add_test ( pSuite , "submit_data_read_length_smallest" , test_nghttp2_submit_data_read_length_smallest ) || ! CU_add_test ( pSuite , "submit_data_twice" , test_nghttp2_submit_data_twice ) || ! CU_add_test ( pSuite , "submit_request_with_data" , test_nghttp2_submit_request_with_data ) || ! CU_add_test ( pSuite , "submit_request_without_data" , test_nghttp2_submit_request_without_data ) || ! CU_add_test ( pSuite , "submit_response_with_data" , test_nghttp2_submit_response_with_data ) || ! CU_add_test ( pSuite , "submit_response_without_data" , test_nghttp2_submit_response_without_data ) || ! CU_add_test ( pSuite , "Submit_response_push_response" , test_nghttp2_submit_response_push_response ) || ! CU_add_test ( pSuite , "submit_trailer" , test_nghttp2_submit_trailer ) || ! CU_add_test ( pSuite , "submit_headers_start_stream" , test_nghttp2_submit_headers_start_stream ) || ! CU_add_test ( pSuite , "submit_headers_reply" , test_nghttp2_submit_headers_reply ) || ! CU_add_test ( pSuite , "submit_headers_push_reply" , test_nghttp2_submit_headers_push_reply ) || ! CU_add_test ( pSuite , "submit_headers" , test_nghttp2_submit_headers ) || ! CU_add_test ( pSuite , "submit_headers_continuation" , test_nghttp2_submit_headers_continuation ) || ! CU_add_test ( pSuite , "submit_headers_continuation_extra_large" , test_nghttp2_submit_headers_continuation_extra_large ) || ! CU_add_test ( pSuite , "submit_priority" , test_nghttp2_submit_priority ) || ! CU_add_test ( pSuite , "session_submit_settings" , test_nghttp2_submit_settings ) || ! CU_add_test ( pSuite , "session_submit_settings_update_local_window_size" , test_nghttp2_submit_settings_update_local_window_size ) || ! CU_add_test ( pSuite , "session_submit_settings_multiple_times" , test_nghttp2_submit_settings_multiple_times ) || ! CU_add_test ( pSuite , "session_submit_push_promise" , test_nghttp2_submit_push_promise ) || ! CU_add_test ( pSuite , "submit_window_update" , test_nghttp2_submit_window_update ) || ! CU_add_test ( pSuite , "submit_window_update_local_window_size" , test_nghttp2_submit_window_update_local_window_size ) || ! CU_add_test ( pSuite , "submit_shutdown_notice" , test_nghttp2_submit_shutdown_notice ) || ! CU_add_test ( pSuite , "submit_invalid_nv" , test_nghttp2_submit_invalid_nv ) || ! CU_add_test ( pSuite , "submit_extension" , test_nghttp2_submit_extension ) || ! CU_add_test ( pSuite , "submit_altsvc" , test_nghttp2_submit_altsvc ) || ! CU_add_test ( pSuite , "submit_origin" , test_nghttp2_submit_origin ) || ! CU_add_test ( pSuite , "session_open_stream" , test_nghttp2_session_open_stream ) || ! CU_add_test ( pSuite , "session_open_stream_with_idle_stream_dep" , test_nghttp2_session_open_stream_with_idle_stream_dep ) || ! CU_add_test ( pSuite , "session_get_next_ob_item" , test_nghttp2_session_get_next_ob_item ) || ! CU_add_test ( pSuite , "session_pop_next_ob_item" , test_nghttp2_session_pop_next_ob_item ) || ! CU_add_test ( pSuite , "session_reply_fail" , test_nghttp2_session_reply_fail ) || ! CU_add_test ( pSuite , "session_max_concurrent_streams" , test_nghttp2_session_max_concurrent_streams ) || ! CU_add_test ( pSuite , "session_stop_data_with_rst_stream" , test_nghttp2_session_stop_data_with_rst_stream ) || ! CU_add_test ( pSuite , "session_defer_data" , test_nghttp2_session_defer_data ) || ! CU_add_test ( pSuite , "session_flow_control" , test_nghttp2_session_flow_control ) || ! CU_add_test ( pSuite , "session_flow_control_data_recv" , test_nghttp2_session_flow_control_data_recv ) || ! CU_add_test ( pSuite , "session_flow_control_data_with_padding_recv" , test_nghttp2_session_flow_control_data_with_padding_recv ) || ! CU_add_test ( pSuite , "session_data_read_temporal_failure" , test_nghttp2_session_data_read_temporal_failure ) || ! CU_add_test ( pSuite , "session_on_stream_close" , test_nghttp2_session_on_stream_close ) || ! CU_add_test ( pSuite , "session_on_ctrl_not_send" , test_nghttp2_session_on_ctrl_not_send ) || ! CU_add_test ( pSuite , "session_get_outbound_queue_size" , test_nghttp2_session_get_outbound_queue_size ) || ! CU_add_test ( pSuite , "session_get_effective_local_window_size" , test_nghttp2_session_get_effective_local_window_size ) || ! CU_add_test ( pSuite , "session_set_option" , test_nghttp2_session_set_option ) || ! CU_add_test ( pSuite , "session_data_backoff_by_high_pri_frame" , test_nghttp2_session_data_backoff_by_high_pri_frame ) || ! CU_add_test ( pSuite , "session_pack_data_with_padding" , test_nghttp2_session_pack_data_with_padding ) || ! CU_add_test ( pSuite , "session_pack_headers_with_padding" , test_nghttp2_session_pack_headers_with_padding ) || ! CU_add_test ( pSuite , "pack_settings_payload" , test_nghttp2_pack_settings_payload ) || ! CU_add_test ( pSuite , "session_stream_dep_add" , test_nghttp2_session_stream_dep_add ) || ! CU_add_test ( pSuite , "session_stream_dep_remove" , test_nghttp2_session_stream_dep_remove ) || ! CU_add_test ( pSuite , "session_stream_dep_add_subtree" , test_nghttp2_session_stream_dep_add_subtree ) || ! CU_add_test ( pSuite , "session_stream_dep_remove_subtree" , test_nghttp2_session_stream_dep_remove_subtree ) || ! CU_add_test ( pSuite , "session_stream_dep_all_your_stream_are_belong_to_us" , test_nghttp2_session_stream_dep_all_your_stream_are_belong_to_us ) || ! CU_add_test ( pSuite , "session_stream_attach_item" , test_nghttp2_session_stream_attach_item ) || ! CU_add_test ( pSuite , "session_stream_attach_item_subtree" , test_nghttp2_session_stream_attach_item_subtree ) || ! CU_add_test ( pSuite , "session_stream_get_state" , test_nghttp2_session_stream_get_state ) || ! CU_add_test ( pSuite , "session_stream_get_something" , test_nghttp2_session_stream_get_something ) || ! CU_add_test ( pSuite , "session_find_stream" , test_nghttp2_session_find_stream ) || ! CU_add_test ( pSuite , "session_keep_closed_stream" , test_nghttp2_session_keep_closed_stream ) || ! CU_add_test ( pSuite , "session_keep_idle_stream" , test_nghttp2_session_keep_idle_stream ) || ! CU_add_test ( pSuite , "session_detach_idle_stream" , test_nghttp2_session_detach_idle_stream ) || ! CU_add_test ( pSuite , "session_large_dep_tree" , test_nghttp2_session_large_dep_tree ) || ! CU_add_test ( pSuite , "session_graceful_shutdown" , test_nghttp2_session_graceful_shutdown ) || ! CU_add_test ( pSuite , "session_on_header_temporal_failure" , test_nghttp2_session_on_header_temporal_failure ) || ! CU_add_test ( pSuite , "session_recv_client_magic" , test_nghttp2_session_recv_client_magic ) || ! CU_add_test ( pSuite , "session_delete_data_item" , test_nghttp2_session_delete_data_item ) || ! CU_add_test ( pSuite , "session_open_idle_stream" , test_nghttp2_session_open_idle_stream ) || ! CU_add_test ( pSuite , "session_cancel_reserved_remote" , test_nghttp2_session_cancel_reserved_remote ) || ! CU_add_test ( pSuite , "session_reset_pending_headers" , test_nghttp2_session_reset_pending_headers ) || ! CU_add_test ( pSuite , "session_send_data_callback" , test_nghttp2_session_send_data_callback ) || ! CU_add_test ( pSuite , "session_on_begin_headers_temporal_failure" , test_nghttp2_session_on_begin_headers_temporal_failure ) || ! CU_add_test ( pSuite , "session_defer_then_close" , test_nghttp2_session_defer_then_close ) || ! CU_add_test ( pSuite , "session_detach_item_from_closed_stream" , test_nghttp2_session_detach_item_from_closed_stream ) || ! CU_add_test ( pSuite , "session_flooding" , test_nghttp2_session_flooding ) || ! CU_add_test ( pSuite , "session_change_stream_priority" , test_nghttp2_session_change_stream_priority ) || ! CU_add_test ( pSuite , "session_create_idle_stream" , test_nghttp2_session_create_idle_stream ) || ! CU_add_test ( pSuite , "session_repeated_priority_change" , test_nghttp2_session_repeated_priority_change ) || ! CU_add_test ( pSuite , "session_repeated_priority_submission" , test_nghttp2_session_repeated_priority_submission ) || ! CU_add_test ( pSuite , "session_set_local_window_size" , test_nghttp2_session_set_local_window_size ) || ! CU_add_test ( pSuite , "session_cancel_from_before_frame_send" , test_nghttp2_session_cancel_from_before_frame_send ) || <S2SV_StartBug> ! CU_add_test ( pSuite , "session_removed_closed_stream" , <S2SV_EndBug> test_nghttp2_session_removed_closed_stream ) || ! CU_add_test ( pSuite , "session_pause_data" , test_nghttp2_session_pause_data ) || ! CU_add_test ( pSuite , "session_no_closed_streams" , test_nghttp2_session_no_closed_streams ) || ! CU_add_test ( pSuite , "session_set_stream_user_data" , test_nghttp2_session_set_stream_user_data ) || ! CU_add_test ( pSuite , "http_mandatory_headers" , test_nghttp2_http_mandatory_headers ) || ! CU_add_test ( pSuite , "http_content_length" , test_nghttp2_http_content_length ) || ! CU_add_test ( pSuite , "http_content_length_mismatch" , test_nghttp2_http_content_length_mismatch ) || ! CU_add_test ( pSuite , "http_non_final_response" , test_nghttp2_http_non_final_response ) || ! CU_add_test ( pSuite , "http_trailer_headers" , test_nghttp2_http_trailer_headers ) || ! CU_add_test ( pSuite , "http_ignore_regular_header" , test_nghttp2_http_ignore_regular_header ) || ! CU_add_test ( pSuite , "http_ignore_content_length" , test_nghttp2_http_ignore_content_length ) || ! CU_add_test ( pSuite , "http_record_request_method" , test_nghttp2_http_record_request_method ) || ! CU_add_test ( pSuite , "http_push_promise" , test_nghttp2_http_push_promise ) || ! CU_add_test ( pSuite , "http_head_method_upgrade_workaround" , test_nghttp2_http_head_method_upgrade_workaround ) || ! CU_add_test ( pSuite , "frame_pack_headers" , test_nghttp2_frame_pack_headers ) || ! CU_add_test ( pSuite , "frame_pack_headers_frame_too_large" , test_nghttp2_frame_pack_headers_frame_too_large ) || ! CU_add_test ( pSuite , "frame_pack_priority" , test_nghttp2_frame_pack_priority ) || ! CU_add_test ( pSuite , "frame_pack_rst_stream" , test_nghttp2_frame_pack_rst_stream ) || ! CU_add_test ( pSuite , "frame_pack_settings" , test_nghttp2_frame_pack_settings ) || ! CU_add_test ( pSuite , "frame_pack_push_promise" , test_nghttp2_frame_pack_push_promise ) || ! CU_add_test ( pSuite , "frame_pack_ping" , test_nghttp2_frame_pack_ping ) || ! CU_add_test ( pSuite , "frame_pack_goaway" , test_nghttp2_frame_pack_goaway ) || ! CU_add_test ( pSuite , "frame_pack_window_update" , test_nghttp2_frame_pack_window_update ) || ! CU_add_test ( pSuite , "frame_pack_altsvc" , test_nghttp2_frame_pack_altsvc ) || ! CU_add_test ( pSuite , "frame_pack_origin" , test_nghttp2_frame_pack_origin ) || ! CU_add_test ( pSuite , "nv_array_copy" , test_nghttp2_nv_array_copy ) || ! CU_add_test ( pSuite , "iv_check" , test_nghttp2_iv_check ) || ! CU_add_test ( pSuite , "hd_deflate" , test_nghttp2_hd_deflate ) || ! CU_add_test ( pSuite , "hd_deflate_same_indexed_repr" , test_nghttp2_hd_deflate_same_indexed_repr ) || ! CU_add_test ( pSuite , "hd_inflate_indexed" , test_nghttp2_hd_inflate_indexed ) || ! CU_add_test ( pSuite , "hd_inflate_indname_noinc" , test_nghttp2_hd_inflate_indname_noinc ) || ! CU_add_test ( pSuite , "hd_inflate_indname_inc" , test_nghttp2_hd_inflate_indname_inc ) || ! CU_add_test ( pSuite , "hd_inflate_indname_inc_eviction" , test_nghttp2_hd_inflate_indname_inc_eviction ) || ! CU_add_test ( pSuite , "hd_inflate_newname_noinc" , test_nghttp2_hd_inflate_newname_noinc ) || ! CU_add_test ( pSuite , "hd_inflate_newname_inc" , test_nghttp2_hd_inflate_newname_inc ) || ! CU_add_test ( pSuite , "hd_inflate_clearall_inc" , test_nghttp2_hd_inflate_clearall_inc ) || ! CU_add_test ( pSuite , "hd_inflate_zero_length_huffman" , test_nghttp2_hd_inflate_zero_length_huffman ) || ! CU_add_test ( pSuite , "hd_inflate_expect_table_size_update" , test_nghttp2_hd_inflate_expect_table_size_update ) || ! CU_add_test ( pSuite , "hd_inflate_unexpected_table_size_update" , test_nghttp2_hd_inflate_unexpected_table_size_update ) || ! CU_add_test ( pSuite , "hd_ringbuf_reserve" , test_nghttp2_hd_ringbuf_reserve ) || ! CU_add_test ( pSuite , "hd_change_table_size" , test_nghttp2_hd_change_table_size ) || ! CU_add_test ( pSuite , "hd_deflate_inflate" , test_nghttp2_hd_deflate_inflate ) || ! CU_add_test ( pSuite , "hd_no_index" , test_nghttp2_hd_no_index ) || ! CU_add_test ( pSuite , "hd_deflate_bound" , test_nghttp2_hd_deflate_bound ) || ! CU_add_test ( pSuite , "hd_public_api" , test_nghttp2_hd_public_api ) || ! CU_add_test ( pSuite , "hd_deflate_hd_vec" , test_nghttp2_hd_deflate_hd_vec ) || ! CU_add_test ( pSuite , "hd_decode_length" , test_nghttp2_hd_decode_length ) || ! CU_add_test ( pSuite , "hd_huff_encode" , test_nghttp2_hd_huff_encode ) || ! CU_add_test ( pSuite , "hd_huff_decode" , test_nghttp2_hd_huff_decode ) || ! CU_add_test ( pSuite , "adjust_local_window_size" , test_nghttp2_adjust_local_window_size ) || ! CU_add_test ( pSuite , "check_header_name" , test_nghttp2_check_header_name ) || ! CU_add_test ( pSuite , "check_header_value" , test_nghttp2_check_header_value ) || ! CU_add_test ( pSuite , "bufs_add" , test_nghttp2_bufs_add ) || ! CU_add_test ( pSuite , "bufs_add_stack_buffer_overflow_bug" , test_nghttp2_bufs_add_stack_buffer_overflow_bug ) || ! CU_add_test ( pSuite , "bufs_addb" , test_nghttp2_bufs_addb ) || ! CU_add_test ( pSuite , "bufs_orb" , test_nghttp2_bufs_orb ) || ! CU_add_test ( pSuite , "bufs_remove" , test_nghttp2_bufs_remove ) || ! CU_add_test ( pSuite , "bufs_reset" , test_nghttp2_bufs_reset ) || ! CU_add_test ( pSuite , "bufs_advance" , test_nghttp2_bufs_advance ) || ! CU_add_test ( pSuite , "bufs_next_present" , test_nghttp2_bufs_next_present ) || ! CU_add_test ( pSuite , "bufs_realloc" , test_nghttp2_bufs_realloc ) ) { CU_cleanup_registry ( ) ; return ( int ) CU_get_error ( ) ; } CU_basic_set_mode ( CU_BRM_VERBOSE ) ; CU_basic_run_tests ( ) ; num_tests_failed = CU_get_number_of_tests_failed ( ) ; CU_cleanup_registry ( ) ; if ( CU_get_error ( ) == CUE_SUCCESS ) { return ( int ) num_tests_failed ; } else { printf ( "CUnit<S2SV_blank>Error:<S2SV_blank>%s\\n" , CU_get_error_msg ( ) ) ; return ( int ) CU_get_error ( ) ; } }
<S2SV_ModStart> ( pSuite , "session_too_many_settings" , test_nghttp2_session_too_many_settings ) || ! CU_add_test ( pSuite ,
nghttp2@nghttp2/336a98feb0d56b9ac54e12736b18785c27f75090
CVE-2020-11080
https://github.com/nghttp2/nghttp2/commit/336a98feb0d56b9ac54e12736b18785c27f75090
2020-06-03T23:15Z
392
CWE-200
CWE-200 IHEVCD_ERROR_T ihevcd_parse_slice_header ( codec_t * ps_codec , nal_header_t * ps_nal ) { IHEVCD_ERROR_T ret = ( IHEVCD_ERROR_T ) IHEVCD_SUCCESS ; WORD32 value ; WORD32 i , j ; WORD32 sps_id ; pps_t * ps_pps ; sps_t * ps_sps ; slice_header_t * ps_slice_hdr ; WORD32 disable_deblocking_filter_flag ; bitstrm_t * ps_bitstrm = & ps_codec -> s_parse . s_bitstrm ; WORD32 idr_pic_flag ; WORD32 pps_id ; WORD32 first_slice_in_pic_flag ; WORD32 no_output_of_prior_pics_flag = 0 ; WORD8 i1_nal_unit_type = ps_nal -> i1_nal_unit_type ; WORD32 num_poc_total_curr = 0 ; <S2SV_StartBug> WORD32 slice_address ; <S2SV_EndBug> if ( ps_codec -> i4_slice_error == 1 ) return ret ; idr_pic_flag = ( NAL_IDR_W_LP == i1_nal_unit_type ) || ( NAL_IDR_N_LP == i1_nal_unit_type ) ; BITS_PARSE ( "first_slice_in_pic_flag" , first_slice_in_pic_flag , ps_bitstrm , 1 ) ; if ( ( NAL_BLA_W_LP <= i1_nal_unit_type ) && ( NAL_RSV_RAP_VCL23 >= i1_nal_unit_type ) ) { BITS_PARSE ( "no_output_of_prior_pics_flag" , no_output_of_prior_pics_flag , ps_bitstrm , 1 ) ; } UEV_PARSE ( "pic_parameter_set_id" , pps_id , ps_bitstrm ) ; pps_id = CLIP3 ( pps_id , 0 , MAX_PPS_CNT - 2 ) ; ps_pps = ps_codec -> s_parse . ps_pps_base + pps_id ; if ( 0 == ps_pps -> i1_pps_valid ) { pps_t * ps_pps_ref = ps_codec -> ps_pps_base ; while ( 0 == ps_pps_ref -> i1_pps_valid ) { ps_pps_ref ++ ; if ( ( ps_pps_ref - ps_codec -> ps_pps_base >= MAX_PPS_CNT - 1 ) ) return IHEVCD_INVALID_HEADER ; } ihevcd_copy_pps ( ps_codec , pps_id , ps_pps_ref -> i1_pps_id ) ; } sps_id = ps_pps -> i1_sps_id ; ps_sps = ps_codec -> s_parse . ps_sps_base + sps_id ; if ( ( 0 != ps_codec -> u4_pic_cnt || ps_codec -> i4_pic_present ) && first_slice_in_pic_flag ) { if ( ps_codec -> i4_pic_present ) { slice_header_t * ps_slice_hdr_next ; ps_codec -> i4_slice_error = 1 ; ps_codec -> s_parse . i4_cur_slice_idx -- ; if ( ps_codec -> s_parse . i4_cur_slice_idx < 0 ) ps_codec -> s_parse . i4_cur_slice_idx = 0 ; ps_slice_hdr_next = ps_codec -> s_parse . ps_slice_hdr_base + ( ( ps_codec -> s_parse . i4_cur_slice_idx + 1 ) & ( MAX_SLICE_HDR_CNT - 1 ) ) ; ps_slice_hdr_next -> i2_ctb_x = 0 ; ps_slice_hdr_next -> i2_ctb_y = ps_codec -> s_parse . ps_sps -> i2_pic_ht_in_ctb ; return ret ; } else { ps_codec -> i4_slice_error = 0 ; } } if ( first_slice_in_pic_flag ) { ps_codec -> s_parse . i4_cur_slice_idx = 0 ; } else { if ( 0 == ps_codec -> i4_pic_present ) ps_codec -> s_parse . i4_cur_slice_idx = 1 ; } ps_slice_hdr = ps_codec -> s_parse . ps_slice_hdr_base + ( ps_codec -> s_parse . i4_cur_slice_idx & ( MAX_SLICE_HDR_CNT - 1 ) ) ; if ( ( ps_pps -> i1_dependent_slice_enabled_flag ) && ( ! first_slice_in_pic_flag ) ) { BITS_PARSE ( "dependent_slice_flag" , value , ps_bitstrm , 1 ) ; if ( value && ( ps_codec -> s_parse . i4_cur_slice_idx > 0 ) ) { ihevcd_copy_slice_hdr ( ps_codec , ( ps_codec -> s_parse . i4_cur_slice_idx & ( MAX_SLICE_HDR_CNT - 1 ) ) , ( ( ps_codec -> s_parse . i4_cur_slice_idx - 1 ) & ( MAX_SLICE_HDR_CNT - 1 ) ) ) ; } ps_slice_hdr -> i1_dependent_slice_flag = value ; } else { ps_slice_hdr -> i1_dependent_slice_flag = 0 ; } ps_slice_hdr -> i1_nal_unit_type = i1_nal_unit_type ; ps_slice_hdr -> i1_pps_id = pps_id ; ps_slice_hdr -> i1_first_slice_in_pic_flag = first_slice_in_pic_flag ; ps_slice_hdr -> i1_no_output_of_prior_pics_flag = 1 ; if ( ( NAL_BLA_W_LP <= i1_nal_unit_type ) && ( NAL_RSV_RAP_VCL23 >= i1_nal_unit_type ) ) { ps_slice_hdr -> i1_no_output_of_prior_pics_flag = no_output_of_prior_pics_flag ; } ps_slice_hdr -> i1_pps_id = pps_id ; if ( ! ps_slice_hdr -> i1_first_slice_in_pic_flag ) { WORD32 num_bits ; num_bits = 32 - CLZ ( ps_sps -> i4_pic_size_in_ctb - 1 ) ; BITS_PARSE ( "slice_address" , value , ps_bitstrm , num_bits ) ; slice_address = value ; if ( value >= ps_sps -> i4_pic_size_in_ctb ) return IHEVCD_IGNORE_SLICE ; } else { slice_address = 0 ; } if ( ! ps_slice_hdr -> i1_dependent_slice_flag ) { ps_slice_hdr -> i1_pic_output_flag = 1 ; ps_slice_hdr -> i4_pic_order_cnt_lsb = 0 ; ps_slice_hdr -> i1_num_long_term_sps = 0 ; ps_slice_hdr -> i1_num_long_term_pics = 0 ; for ( i = 0 ; i < ps_pps -> i1_num_extra_slice_header_bits ; i ++ ) { BITS_PARSE ( "slice_reserved_undetermined_flag[<S2SV_blank>i<S2SV_blank>]" , value , ps_bitstrm , 1 ) ; } UEV_PARSE ( "slice_type" , value , ps_bitstrm ) ; ps_slice_hdr -> i1_slice_type = value ; if ( ( ps_slice_hdr -> i1_nal_unit_type >= NAL_BLA_W_LP ) && ( ps_slice_hdr -> i1_nal_unit_type <= NAL_RSV_RAP_VCL23 ) ) ps_slice_hdr -> i1_slice_type = ISLICE ; if ( ( ps_slice_hdr -> i1_slice_type < 0 ) || ( ps_slice_hdr -> i1_slice_type > 2 ) ) return IHEVCD_IGNORE_SLICE ; if ( ps_pps -> i1_output_flag_present_flag ) { BITS_PARSE ( "pic_output_flag" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> i1_pic_output_flag = value ; } ps_slice_hdr -> i1_colour_plane_id = 0 ; if ( 1 == ps_sps -> i1_separate_colour_plane_flag ) { BITS_PARSE ( "colour_plane_id" , value , ps_bitstrm , 2 ) ; ps_slice_hdr -> i1_colour_plane_id = value ; } ps_slice_hdr -> i1_slice_temporal_mvp_enable_flag = 0 ; if ( ! idr_pic_flag ) { WORD32 st_rps_idx ; WORD32 num_neg_pics ; WORD32 num_pos_pics ; WORD8 * pi1_used ; BITS_PARSE ( "pic_order_cnt_lsb" , value , ps_bitstrm , ps_sps -> i1_log2_max_pic_order_cnt_lsb ) ; ps_slice_hdr -> i4_pic_order_cnt_lsb = value ; BITS_PARSE ( "short_term_ref_pic_set_sps_flag" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> i1_short_term_ref_pic_set_sps_flag = value ; if ( 1 == ps_slice_hdr -> i1_short_term_ref_pic_set_sps_flag ) { WORD32 numbits ; ps_slice_hdr -> i1_short_term_ref_pic_set_idx = 0 ; if ( ps_sps -> i1_num_short_term_ref_pic_sets > 1 ) { numbits = 32 - CLZ ( ps_sps -> i1_num_short_term_ref_pic_sets - 1 ) ; BITS_PARSE ( "short_term_ref_pic_set_idx" , value , ps_bitstrm , numbits ) ; ps_slice_hdr -> i1_short_term_ref_pic_set_idx = value ; } st_rps_idx = ps_slice_hdr -> i1_short_term_ref_pic_set_idx ; num_neg_pics = ps_sps -> as_stref_picset [ st_rps_idx ] . i1_num_neg_pics ; num_pos_pics = ps_sps -> as_stref_picset [ st_rps_idx ] . i1_num_pos_pics ; pi1_used = ps_sps -> as_stref_picset [ st_rps_idx ] . ai1_used ; } else { ihevcd_short_term_ref_pic_set ( ps_bitstrm , & ps_sps -> as_stref_picset [ 0 ] , ps_sps -> i1_num_short_term_ref_pic_sets , ps_sps -> i1_num_short_term_ref_pic_sets , & ps_slice_hdr -> s_stref_picset ) ; st_rps_idx = ps_sps -> i1_num_short_term_ref_pic_sets ; num_neg_pics = ps_slice_hdr -> s_stref_picset . i1_num_neg_pics ; num_pos_pics = ps_slice_hdr -> s_stref_picset . i1_num_pos_pics ; pi1_used = ps_slice_hdr -> s_stref_picset . ai1_used ; } if ( ps_sps -> i1_long_term_ref_pics_present_flag ) { if ( ps_sps -> i1_num_long_term_ref_pics_sps > 0 ) { UEV_PARSE ( "num_long_term_sps" , value , ps_bitstrm ) ; ps_slice_hdr -> i1_num_long_term_sps = value ; ps_slice_hdr -> i1_num_long_term_sps = CLIP3 ( ps_slice_hdr -> i1_num_long_term_sps , 0 , MAX_DPB_SIZE - num_neg_pics - num_pos_pics ) ; } UEV_PARSE ( "num_long_term_pics" , value , ps_bitstrm ) ; ps_slice_hdr -> i1_num_long_term_pics = value ; ps_slice_hdr -> i1_num_long_term_pics = CLIP3 ( ps_slice_hdr -> i1_num_long_term_pics , 0 , MAX_DPB_SIZE - num_neg_pics - num_pos_pics - ps_slice_hdr -> i1_num_long_term_sps ) ; for ( i = 0 ; i < ( ps_slice_hdr -> i1_num_long_term_sps + ps_slice_hdr -> i1_num_long_term_pics ) ; i ++ ) { if ( i < ps_slice_hdr -> i1_num_long_term_sps ) { if ( ps_sps -> i1_num_long_term_ref_pics_sps > 1 ) { WORD32 num_bits = 32 - CLZ ( ps_sps -> i1_num_long_term_ref_pics_sps - 1 ) ; BITS_PARSE ( "lt_idx_sps[<S2SV_blank>i<S2SV_blank>]" , value , ps_bitstrm , num_bits ) ; } else { value = 0 ; } ps_slice_hdr -> ai4_poc_lsb_lt [ i ] = ps_sps -> au2_lt_ref_pic_poc_lsb_sps [ value ] ; ps_slice_hdr -> ai1_used_by_curr_pic_lt_flag [ i ] = ps_sps -> ai1_used_by_curr_pic_lt_sps_flag [ value ] ; } else { BITS_PARSE ( "poc_lsb_lt[<S2SV_blank>i<S2SV_blank>]" , value , ps_bitstrm , ps_sps -> i1_log2_max_pic_order_cnt_lsb ) ; ps_slice_hdr -> ai4_poc_lsb_lt [ i ] = value ; BITS_PARSE ( "used_by_curr_pic_lt_flag[<S2SV_blank>i<S2SV_blank>]" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> ai1_used_by_curr_pic_lt_flag [ i ] = value ; } BITS_PARSE ( "delta_poc_msb_present_flag[<S2SV_blank>i<S2SV_blank>]" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> ai1_delta_poc_msb_present_flag [ i ] = value ; ps_slice_hdr -> ai1_delta_poc_msb_cycle_lt [ i ] = 0 ; if ( ps_slice_hdr -> ai1_delta_poc_msb_present_flag [ i ] ) { UEV_PARSE ( "delata_poc_msb_cycle_lt[<S2SV_blank>i<S2SV_blank>]" , value , ps_bitstrm ) ; ps_slice_hdr -> ai1_delta_poc_msb_cycle_lt [ i ] = value ; } if ( ( i != 0 ) && ( i != ps_slice_hdr -> i1_num_long_term_sps ) ) { ps_slice_hdr -> ai1_delta_poc_msb_cycle_lt [ i ] += ps_slice_hdr -> ai1_delta_poc_msb_cycle_lt [ i - 1 ] ; } } } for ( i = 0 ; i < num_neg_pics + num_pos_pics ; i ++ ) { if ( pi1_used [ i ] ) { num_poc_total_curr ++ ; } } for ( i = 0 ; i < ps_slice_hdr -> i1_num_long_term_sps + ps_slice_hdr -> i1_num_long_term_pics ; i ++ ) { if ( ps_slice_hdr -> ai1_used_by_curr_pic_lt_flag [ i ] ) { num_poc_total_curr ++ ; } } if ( ps_sps -> i1_sps_temporal_mvp_enable_flag ) { BITS_PARSE ( "enable_temporal_mvp_flag" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> i1_slice_temporal_mvp_enable_flag = value ; } } ps_slice_hdr -> i1_slice_sao_luma_flag = 0 ; ps_slice_hdr -> i1_slice_sao_chroma_flag = 0 ; if ( ps_sps -> i1_sample_adaptive_offset_enabled_flag ) { BITS_PARSE ( "slice_sao_luma_flag" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> i1_slice_sao_luma_flag = value ; BITS_PARSE ( "slice_sao_chroma_flag" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> i1_slice_sao_chroma_flag = value ; } ps_slice_hdr -> i1_max_num_merge_cand = 1 ; ps_slice_hdr -> i1_cabac_init_flag = 0 ; ps_slice_hdr -> i1_num_ref_idx_l0_active = 0 ; ps_slice_hdr -> i1_num_ref_idx_l1_active = 0 ; ps_slice_hdr -> i1_slice_cb_qp_offset = 0 ; ps_slice_hdr -> i1_slice_cr_qp_offset = 0 ; if ( ( PSLICE == ps_slice_hdr -> i1_slice_type ) || ( BSLICE == ps_slice_hdr -> i1_slice_type ) ) { BITS_PARSE ( "num_ref_idx_active_override_flag" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> i1_num_ref_idx_active_override_flag = value ; if ( ps_slice_hdr -> i1_num_ref_idx_active_override_flag ) { UEV_PARSE ( "num_ref_idx_l0_active_minus1" , value , ps_bitstrm ) ; ps_slice_hdr -> i1_num_ref_idx_l0_active = value + 1 ; if ( BSLICE == ps_slice_hdr -> i1_slice_type ) { UEV_PARSE ( "num_ref_idx_l1_active_minus1" , value , ps_bitstrm ) ; ps_slice_hdr -> i1_num_ref_idx_l1_active = value + 1 ; } } else { ps_slice_hdr -> i1_num_ref_idx_l0_active = ps_pps -> i1_num_ref_idx_l0_default_active ; if ( BSLICE == ps_slice_hdr -> i1_slice_type ) { ps_slice_hdr -> i1_num_ref_idx_l1_active = ps_pps -> i1_num_ref_idx_l1_default_active ; } } ps_slice_hdr -> i1_num_ref_idx_l0_active = CLIP3 ( ps_slice_hdr -> i1_num_ref_idx_l0_active , 0 , MAX_DPB_SIZE - 1 ) ; ps_slice_hdr -> i1_num_ref_idx_l1_active = CLIP3 ( ps_slice_hdr -> i1_num_ref_idx_l1_active , 0 , MAX_DPB_SIZE - 1 ) ; if ( 0 == num_poc_total_curr ) return IHEVCD_IGNORE_SLICE ; if ( ( ps_pps -> i1_lists_modification_present_flag ) && ( num_poc_total_curr > 1 ) ) { ihevcd_ref_pic_list_modification ( ps_bitstrm , ps_slice_hdr , num_poc_total_curr ) ; } else { ps_slice_hdr -> s_rplm . i1_ref_pic_list_modification_flag_l0 = 0 ; ps_slice_hdr -> s_rplm . i1_ref_pic_list_modification_flag_l1 = 0 ; } if ( BSLICE == ps_slice_hdr -> i1_slice_type ) { BITS_PARSE ( "mvd_l1_zero_flag" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> i1_mvd_l1_zero_flag = value ; } ps_slice_hdr -> i1_cabac_init_flag = 0 ; if ( ps_pps -> i1_cabac_init_present_flag ) { BITS_PARSE ( "cabac_init_flag" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> i1_cabac_init_flag = value ; } ps_slice_hdr -> i1_collocated_from_l0_flag = 1 ; ps_slice_hdr -> i1_collocated_ref_idx = 0 ; if ( ps_slice_hdr -> i1_slice_temporal_mvp_enable_flag ) { if ( BSLICE == ps_slice_hdr -> i1_slice_type ) { BITS_PARSE ( "collocated_from_l0_flag" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> i1_collocated_from_l0_flag = value ; } if ( ( ps_slice_hdr -> i1_collocated_from_l0_flag && ( ps_slice_hdr -> i1_num_ref_idx_l0_active > 1 ) ) || ( ! ps_slice_hdr -> i1_collocated_from_l0_flag && ( ps_slice_hdr -> i1_num_ref_idx_l1_active > 1 ) ) ) { UEV_PARSE ( "collocated_ref_idx" , value , ps_bitstrm ) ; ps_slice_hdr -> i1_collocated_ref_idx = value ; } } ps_slice_hdr -> i1_collocated_ref_idx = CLIP3 ( ps_slice_hdr -> i1_collocated_ref_idx , 0 , MAX_DPB_SIZE - 1 ) ; if ( ( ps_pps -> i1_weighted_pred_flag && ( PSLICE == ps_slice_hdr -> i1_slice_type ) ) || ( ps_pps -> i1_weighted_bipred_flag && ( BSLICE == ps_slice_hdr -> i1_slice_type ) ) ) { ihevcd_parse_pred_wt_ofst ( ps_bitstrm , ps_sps , ps_pps , ps_slice_hdr ) ; } UEV_PARSE ( "five_minus_max_num_merge_cand" , value , ps_bitstrm ) ; ps_slice_hdr -> i1_max_num_merge_cand = 5 - value ; } ps_slice_hdr -> i1_max_num_merge_cand = CLIP3 ( ps_slice_hdr -> i1_max_num_merge_cand , 1 , 5 ) ; SEV_PARSE ( "slice_qp_delta" , value , ps_bitstrm ) ; ps_slice_hdr -> i1_slice_qp_delta = value ; if ( ps_pps -> i1_pic_slice_level_chroma_qp_offsets_present_flag ) { SEV_PARSE ( "slice_cb_qp_offset" , value , ps_bitstrm ) ; ps_slice_hdr -> i1_slice_cb_qp_offset = value ; SEV_PARSE ( "slice_cr_qp_offset" , value , ps_bitstrm ) ; ps_slice_hdr -> i1_slice_cr_qp_offset = value ; } ps_slice_hdr -> i1_deblocking_filter_override_flag = 0 ; ps_slice_hdr -> i1_slice_disable_deblocking_filter_flag = ps_pps -> i1_pic_disable_deblocking_filter_flag ; ps_slice_hdr -> i1_beta_offset_div2 = ps_pps -> i1_beta_offset_div2 ; ps_slice_hdr -> i1_tc_offset_div2 = ps_pps -> i1_tc_offset_div2 ; disable_deblocking_filter_flag = ps_pps -> i1_pic_disable_deblocking_filter_flag ; if ( ps_pps -> i1_deblocking_filter_control_present_flag ) { if ( ps_pps -> i1_deblocking_filter_override_enabled_flag ) { BITS_PARSE ( "deblocking_filter_override_flag" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> i1_deblocking_filter_override_flag = value ; } if ( ps_slice_hdr -> i1_deblocking_filter_override_flag ) { BITS_PARSE ( "slice_disable_deblocking_filter_flag" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> i1_slice_disable_deblocking_filter_flag = value ; disable_deblocking_filter_flag = ps_slice_hdr -> i1_slice_disable_deblocking_filter_flag ; if ( ! ps_slice_hdr -> i1_slice_disable_deblocking_filter_flag ) { SEV_PARSE ( "beta_offset_div2" , value , ps_bitstrm ) ; ps_slice_hdr -> i1_beta_offset_div2 = value ; SEV_PARSE ( "tc_offset_div2" , value , ps_bitstrm ) ; ps_slice_hdr -> i1_tc_offset_div2 = value ; } } } ps_slice_hdr -> i1_slice_loop_filter_across_slices_enabled_flag = ps_pps -> i1_loop_filter_across_slices_enabled_flag ; if ( ps_pps -> i1_loop_filter_across_slices_enabled_flag && ( ps_slice_hdr -> i1_slice_sao_luma_flag || ps_slice_hdr -> i1_slice_sao_chroma_flag || ! disable_deblocking_filter_flag ) ) { BITS_PARSE ( "slice_loop_filter_across_slices_enabled_flag" , value , ps_bitstrm , 1 ) ; ps_slice_hdr -> i1_slice_loop_filter_across_slices_enabled_flag = value ; } } if ( ( ! first_slice_in_pic_flag ) && ( ps_codec -> i4_pic_present ) ) { slice_header_t * ps_slice_hdr_base = ps_codec -> ps_slice_hdr_base ; if ( ( ps_slice_hdr_base -> i1_pps_id != ps_slice_hdr -> i1_pps_id ) || ( ps_slice_hdr_base -> i4_pic_order_cnt_lsb != ps_slice_hdr -> i4_pic_order_cnt_lsb ) ) { return IHEVCD_IGNORE_SLICE ; } } if ( 0 == ps_codec -> i4_pic_present ) { ps_slice_hdr -> i4_abs_pic_order_cnt = ihevcd_calc_poc ( ps_codec , ps_nal , ps_sps -> i1_log2_max_pic_order_cnt_lsb , ps_slice_hdr -> i4_pic_order_cnt_lsb ) ; } else { ps_slice_hdr -> i4_abs_pic_order_cnt = ps_codec -> s_parse . i4_abs_pic_order_cnt ; } if ( ! first_slice_in_pic_flag ) { if ( ps_codec -> s_parse . i4_abs_pic_order_cnt == ps_slice_hdr -> i4_abs_pic_order_cnt ) { if ( slice_address > ps_codec -> s_parse . i4_next_ctb_indx ) { if ( ps_codec -> i4_pic_present ) { <S2SV_StartBug> slice_header_t * ps_slice_hdr_next ; <S2SV_EndBug> ps_codec -> i4_slice_error = 1 ; ps_codec -> s_parse . i4_cur_slice_idx -- ; if ( ps_codec -> s_parse . i4_cur_slice_idx < 0 ) ps_codec -> s_parse . i4_cur_slice_idx = 0 ; ps_slice_hdr_next = ps_codec -> s_parse . ps_slice_hdr_base + ( ( ps_codec -> s_parse . i4_cur_slice_idx + 1 ) & ( MAX_SLICE_HDR_CNT - 1 ) ) ; ps_slice_hdr_next -> i2_ctb_x = slice_address % ps_sps -> i2_pic_wd_in_ctb ; ps_slice_hdr_next -> i2_ctb_y = slice_address / ps_sps -> i2_pic_wd_in_ctb ; return ret ; } else { return IHEVCD_IGNORE_SLICE ; } } else if ( slice_address < ps_codec -> s_parse . i4_next_ctb_indx ) { return IHEVCD_IGNORE_SLICE ; } else { ps_codec -> i4_slice_error = 0 ; } } else { if ( ps_codec -> i4_pic_present ) { slice_header_t * ps_slice_hdr_next ; ps_codec -> i4_slice_error = 1 ; ps_codec -> s_parse . i4_cur_slice_idx -- ; if ( ps_codec -> s_parse . i4_cur_slice_idx < 0 ) ps_codec -> s_parse . i4_cur_slice_idx = 0 ; ps_slice_hdr_next = ps_codec -> s_parse . ps_slice_hdr_base + ( ( ps_codec -> s_parse . i4_cur_slice_idx + 1 ) & ( MAX_SLICE_HDR_CNT - 1 ) ) ; ps_slice_hdr_next -> i2_ctb_x = 0 ; ps_slice_hdr_next -> i2_ctb_y = ps_codec -> s_parse . ps_sps -> i2_pic_ht_in_ctb ; return ret ; } else { if ( ps_slice_hdr -> i1_dependent_slice_flag ) return IHEVCD_IGNORE_SLICE ; ps_codec -> s_parse . i4_abs_pic_order_cnt = ps_slice_hdr -> i4_abs_pic_order_cnt ; } } } else { if ( ps_codec -> s_parse . i4_abs_pic_order_cnt == ps_slice_hdr -> i4_abs_pic_order_cnt ) return IHEVCD_IGNORE_SLICE ; ps_codec -> s_parse . i4_abs_pic_order_cnt = ps_slice_hdr -> i4_abs_pic_order_cnt ; } ps_slice_hdr -> i4_num_entry_point_offsets = 0 ; if ( ( ps_pps -> i1_tiles_enabled_flag ) || ( ps_pps -> i1_entropy_coding_sync_enabled_flag ) ) { UEV_PARSE ( "num_entry_point_offsets" , value , ps_bitstrm ) ; ps_slice_hdr -> i4_num_entry_point_offsets = value ; { WORD32 max_num_entry_point_offsets ; if ( ( ps_pps -> i1_tiles_enabled_flag ) && ( ps_pps -> i1_entropy_coding_sync_enabled_flag ) ) { max_num_entry_point_offsets = ps_pps -> i1_num_tile_columns * ( ps_sps -> i2_pic_ht_in_ctb - 1 ) ; } else if ( ps_pps -> i1_tiles_enabled_flag ) { max_num_entry_point_offsets = ps_pps -> i1_num_tile_columns * ps_pps -> i1_num_tile_rows ; } else { max_num_entry_point_offsets = ( ps_sps -> i2_pic_ht_in_ctb - 1 ) ; } ps_slice_hdr -> i4_num_entry_point_offsets = CLIP3 ( ps_slice_hdr -> i4_num_entry_point_offsets , 0 , max_num_entry_point_offsets ) ; } if ( ps_slice_hdr -> i4_num_entry_point_offsets > 0 ) { UEV_PARSE ( "offset_len_minus1" , value , ps_bitstrm ) ; ps_slice_hdr -> i1_offset_len = value + 1 ; for ( i = 0 ; i < ps_slice_hdr -> i4_num_entry_point_offsets ; i ++ ) { BITS_PARSE ( "entry_point_offset" , value , ps_bitstrm , ps_slice_hdr -> i1_offset_len ) ; } } } if ( ps_pps -> i1_slice_header_extension_present_flag ) { UEV_PARSE ( "slice_header_extension_length" , value , ps_bitstrm ) ; ps_slice_hdr -> i2_slice_header_extension_length = value ; for ( i = 0 ; i < ps_slice_hdr -> i2_slice_header_extension_length ; i ++ ) { BITS_PARSE ( "slice_header_extension_data_byte" , value , ps_bitstrm , 8 ) ; } } ihevcd_bits_flush_to_byte_boundary ( ps_bitstrm ) ; if ( ( UWORD8 * ) ps_bitstrm -> pu4_buf > ps_bitstrm -> pu1_buf_max ) return IHEVCD_INVALID_PARAMETER ; { dpb_mgr_t * ps_dpb_mgr = ( dpb_mgr_t * ) ps_codec -> pv_dpb_mgr ; WORD32 r_idx ; if ( ( NAL_IDR_W_LP == ps_slice_hdr -> i1_nal_unit_type ) || ( NAL_IDR_N_LP == ps_slice_hdr -> i1_nal_unit_type ) || ( NAL_BLA_N_LP == ps_slice_hdr -> i1_nal_unit_type ) || ( NAL_BLA_W_DLP == ps_slice_hdr -> i1_nal_unit_type ) || ( NAL_BLA_W_LP == ps_slice_hdr -> i1_nal_unit_type ) || ( 0 == ps_codec -> u4_pic_cnt ) ) { for ( i = 0 ; i < MAX_DPB_BUFS ; i ++ ) { if ( ps_dpb_mgr -> as_dpb_info [ i ] . ps_pic_buf ) { pic_buf_t * ps_pic_buf = ps_dpb_mgr -> as_dpb_info [ i ] . ps_pic_buf ; mv_buf_t * ps_mv_buf ; ihevc_dpb_mgr_del_ref ( ( dpb_mgr_t * ) ps_codec -> pv_dpb_mgr , ( buf_mgr_t * ) ps_codec -> pv_pic_buf_mgr , ps_pic_buf -> i4_abs_poc ) ; ps_mv_buf = ( mv_buf_t * ) ps_codec -> ps_mv_buf ; for ( j = 0 ; j < ps_codec -> i4_max_dpb_size ; j ++ ) { if ( ps_mv_buf && ps_mv_buf -> i4_abs_poc == ps_pic_buf -> i4_abs_poc ) { ihevc_buf_mgr_release ( ( buf_mgr_t * ) ps_codec -> pv_mv_buf_mgr , j , BUF_MGR_REF ) ; break ; } ps_mv_buf ++ ; } } } for ( r_idx = 0 ; r_idx < MAX_DPB_SIZE ; r_idx ++ ) { ps_slice_hdr -> as_ref_pic_list0 [ r_idx ] . pv_pic_buf = NULL ; ps_slice_hdr -> as_ref_pic_list0 [ r_idx ] . pv_mv_buf = NULL ; ps_slice_hdr -> as_ref_pic_list1 [ r_idx ] . pv_pic_buf = NULL ; ps_slice_hdr -> as_ref_pic_list1 [ r_idx ] . pv_mv_buf = NULL ; } } else { ret = ihevcd_ref_list ( ps_codec , ps_pps , ps_sps , ps_slice_hdr ) ; if ( ( WORD32 ) IHEVCD_SUCCESS != ret ) { return ret ; } } } if ( ps_codec -> i4_pic_present ) { pic_buf_t * ps_pic_buf_ref ; mv_buf_t * ps_mv_buf_ref ; WORD32 r_idx ; dpb_mgr_t * ps_dpb_mgr = ( dpb_mgr_t * ) ps_codec -> pv_dpb_mgr ; buf_mgr_t * ps_mv_buf_mgr = ( buf_mgr_t * ) ps_codec -> pv_mv_buf_mgr ; ps_pic_buf_ref = ihevc_dpb_mgr_get_ref_by_nearest_poc ( ps_dpb_mgr , ps_slice_hdr -> i4_abs_pic_order_cnt ) ; if ( NULL == ps_pic_buf_ref ) { ps_pic_buf_ref = ps_codec -> as_process [ 0 ] . ps_cur_pic ; ps_mv_buf_ref = ps_codec -> s_parse . ps_cur_mv_buf ; } else { ps_mv_buf_ref = ihevcd_mv_mgr_get_poc ( ps_mv_buf_mgr , ps_pic_buf_ref -> i4_abs_poc ) ; } for ( r_idx = 0 ; r_idx < ps_slice_hdr -> i1_num_ref_idx_l0_active ; r_idx ++ ) { if ( NULL == ps_slice_hdr -> as_ref_pic_list0 [ r_idx ] . pv_pic_buf ) { ps_slice_hdr -> as_ref_pic_list0 [ r_idx ] . pv_pic_buf = ( void * ) ps_pic_buf_ref ; ps_slice_hdr -> as_ref_pic_list0 [ r_idx ] . pv_mv_buf = ( void * ) ps_mv_buf_ref ; } } for ( r_idx = ps_slice_hdr -> i1_num_ref_idx_l0_active ; r_idx < MAX_DPB_SIZE ; r_idx ++ ) { ps_slice_hdr -> as_ref_pic_list0 [ r_idx ] . pv_pic_buf = ( void * ) ps_pic_buf_ref ; ps_slice_hdr -> as_ref_pic_list0 [ r_idx ] . pv_mv_buf = ( void * ) ps_mv_buf_ref ; } for ( r_idx = 0 ; r_idx < ps_slice_hdr -> i1_num_ref_idx_l1_active ; r_idx ++ ) { if ( NULL == ps_slice_hdr -> as_ref_pic_list1 [ r_idx ] . pv_pic_buf ) { ps_slice_hdr -> as_ref_pic_list1 [ r_idx ] . pv_pic_buf = ( void * ) ps_pic_buf_ref ; ps_slice_hdr -> as_ref_pic_list1 [ r_idx ] . pv_mv_buf = ( void * ) ps_mv_buf_ref ; } } for ( r_idx = ps_slice_hdr -> i1_num_ref_idx_l1_active ; r_idx < MAX_DPB_SIZE ; r_idx ++ ) { ps_slice_hdr -> as_ref_pic_list1 [ r_idx ] . pv_pic_buf = ( void * ) ps_pic_buf_ref ; ps_slice_hdr -> as_ref_pic_list1 [ r_idx ] . pv_mv_buf = ( void * ) ps_mv_buf_ref ; } } if ( ! ps_slice_hdr -> i1_first_slice_in_pic_flag ) { ps_slice_hdr -> i2_ctb_x = slice_address % ps_sps -> i2_pic_wd_in_ctb ; ps_slice_hdr -> i2_ctb_y = slice_address / ps_sps -> i2_pic_wd_in_ctb ; if ( ! ps_slice_hdr -> i1_dependent_slice_flag ) { ps_slice_hdr -> i2_independent_ctb_x = ps_slice_hdr -> i2_ctb_x ; ps_slice_hdr -> i2_independent_ctb_y = ps_slice_hdr -> i2_ctb_y ; } } else { ps_slice_hdr -> i2_ctb_x = 0 ; ps_slice_hdr -> i2_ctb_y = 0 ; ps_slice_hdr -> i2_independent_ctb_x = 0 ; ps_slice_hdr -> i2_independent_ctb_y = 0 ; } if ( ( ! first_slice_in_pic_flag ) && ( 0 == ps_codec -> i4_pic_present ) ) { slice_header_t * ps_slice_hdr_prev = ps_codec -> s_parse . ps_slice_hdr_base ; ihevcd_copy_slice_hdr ( ps_codec , 0 , ( ps_codec -> s_parse . i4_cur_slice_idx & ( MAX_SLICE_HDR_CNT - 1 ) ) ) ; <S2SV_StartBug> ps_codec -> i4_slice_error = 1 ; <S2SV_EndBug> ps_slice_hdr_prev -> i2_ctb_x = 0 ; ps_slice_hdr_prev -> i2_ctb_y = 0 ; ps_codec -> s_parse . i4_ctb_x = 0 ; ps_codec -> s_parse . i4_ctb_y = 0 ; ps_codec -> s_parse . i4_cur_slice_idx = 0 ; if ( ( ps_slice_hdr -> i2_ctb_x == 0 ) && ( ps_slice_hdr -> i2_ctb_y == 0 ) ) { ps_slice_hdr -> i2_ctb_x ++ ; } } { if ( ( i1_nal_unit_type < NAL_BLA_W_LP ) && ( i1_nal_unit_type % 2 == 0 ) ) { if ( IVD_SKIP_B == ps_codec -> e_pic_skip_mode ) return IHEVCD_IGNORE_SLICE ; } if ( ( IVD_SKIP_PB == ps_codec -> e_pic_skip_mode ) && ( ISLICE != ps_slice_hdr -> i1_slice_type ) ) { return IHEVCD_IGNORE_SLICE ; } } <S2SV_StartBug> return ret ; <S2SV_EndBug> }
<S2SV_ModStart> ; WORD32 slice_address ; WORD32 prev_slice_incomplete_flag = 0 <S2SV_ModStart> i4_pic_present ) { prev_slice_incomplete_flag = 1 <S2SV_ModEnd> ; } else <S2SV_ModStart> ) ) ; prev_slice_incomplete_flag = 1 ; ASSERT ( ps_codec -> s_parse . i4_cur_slice_idx == 1 ) <S2SV_ModEnd> ; ps_slice_hdr_prev -> <S2SV_ModStart> ; } } if ( prev_slice_incomplete_flag ) { ps_codec -> i4_slice_error = 1 ; ps_codec -> s_parse . i4_cur_slice_idx -- ; if ( ps_codec -> s_parse . i4_cur_slice_idx < 0 ) ps_codec -> s_parse . i4_cur_slice_idx = 0 ; }
external@libhevc/7c9be319a279654e55a6d757265f88c61a16a4d5
CVE-2017-13187
https://android.googlesource.com/platform/external/libhevc/+/7c9be319a279654e55a6d757265f88c61a16a4d5
2018-01-12T23:29Z
393
CWE-125
CWE-125 void bit_write_MC ( Bit_Chain * dat , BITCODE_MC val ) { int i , j ; int negative = 0 ; unsigned char byte [ 5 ] ; BITCODE_UMC mask = 0x0000007f ; BITCODE_UMC value = ( BITCODE_UMC ) val ; if ( val < 0 ) { negative = 1 ; value = ( BITCODE_UMC ) - val ; } for ( i = 4 , j = 0 ; i >= 0 ; i -- , j += 7 ) { byte [ i ] = ( unsigned char ) ( ( value & mask ) >> j ) ; byte [ i ] |= 0x80 ; mask = mask << 7 ; } for ( i = 0 ; i < 4 ; i ++ ) if ( byte [ i ] & 0x7f ) break ; <S2SV_StartBug> if ( byte [ i ] & 0x40 ) <S2SV_EndBug> i -- ; byte [ i ] &= 0x7f ; if ( negative ) byte [ i ] |= 0x40 ; for ( j = 4 ; j >= i ; j -- ) bit_write_RC ( dat , byte [ j ] ) ; }
<S2SV_ModStart> ] & 0x40 && i > 0
LibreDWG@libredwg/95cc9300430d35feb05b06a9badf678419463dbe
CVE-2019-20915
https://github.com/LibreDWG/libredwg/commit/95cc9300430d35feb05b06a9badf678419463dbe
2020-07-16T18:15Z
394
CWE-399
CWE-399 static int filter_frame ( AVFilterLink * inlink , AVFrame * buf ) { AVFilterContext * ctx = inlink -> dst ; FPSContext * s = ctx -> priv ; AVFilterLink * outlink = ctx -> outputs [ 0 ] ; int64_t delta ; int i , ret ; s -> frames_in ++ ; if ( s -> pts == AV_NOPTS_VALUE ) { if ( buf -> pts != AV_NOPTS_VALUE ) { ret = write_to_fifo ( s -> fifo , buf ) ; if ( ret < 0 ) return ret ; if ( s -> start_time != DBL_MAX && s -> start_time != AV_NOPTS_VALUE ) { double first_pts = s -> start_time * AV_TIME_BASE ; first_pts = FFMIN ( FFMAX ( first_pts , INT64_MIN ) , INT64_MAX ) ; s -> first_pts = s -> pts = av_rescale_q ( first_pts , AV_TIME_BASE_Q , inlink -> time_base ) ; av_log ( ctx , AV_LOG_VERBOSE , "Set<S2SV_blank>first<S2SV_blank>pts<S2SV_blank>to<S2SV_blank>(in:%" PRId64 "<S2SV_blank>out:%" PRId64 ")\\n" , s -> first_pts , av_rescale_q ( first_pts , AV_TIME_BASE_Q , outlink -> time_base ) ) ; } else { s -> first_pts = s -> pts = buf -> pts ; } } else { av_log ( ctx , AV_LOG_WARNING , "Discarding<S2SV_blank>initial<S2SV_blank>frame(s)<S2SV_blank>with<S2SV_blank>no<S2SV_blank>" "timestamp.\\n" ) ; av_frame_free ( & buf ) ; s -> drop ++ ; } return 0 ; } <S2SV_StartBug> if ( buf -> pts == AV_NOPTS_VALUE ) { <S2SV_EndBug> return write_to_fifo ( s -> fifo , buf ) ; } delta = av_rescale_q_rnd ( buf -> pts - s -> pts , inlink -> time_base , outlink -> time_base , s -> rounding ) ; if ( delta < 1 ) { AVFrame * tmp ; int drop = av_fifo_size ( s -> fifo ) / sizeof ( AVFrame * ) ; av_log ( ctx , AV_LOG_DEBUG , "Dropping<S2SV_blank>%d<S2SV_blank>frame(s).\\n" , drop ) ; s -> drop += drop ; av_fifo_generic_read ( s -> fifo , & tmp , sizeof ( tmp ) , NULL ) ; flush_fifo ( s -> fifo ) ; ret = write_to_fifo ( s -> fifo , tmp ) ; av_frame_free ( & buf ) ; return ret ; } for ( i = 0 ; i < delta ; i ++ ) { AVFrame * buf_out ; av_fifo_generic_read ( s -> fifo , & buf_out , sizeof ( buf_out ) , NULL ) ; if ( ! av_fifo_size ( s -> fifo ) && i < delta - 1 ) { AVFrame * dup = av_frame_clone ( buf_out ) ; av_log ( ctx , AV_LOG_DEBUG , "Duplicating<S2SV_blank>frame.\\n" ) ; if ( dup ) ret = write_to_fifo ( s -> fifo , dup ) ; else ret = AVERROR ( ENOMEM ) ; if ( ret < 0 ) { av_frame_free ( & buf_out ) ; av_frame_free ( & buf ) ; return ret ; } s -> dup ++ ; } buf_out -> pts = av_rescale_q ( s -> first_pts , inlink -> time_base , outlink -> time_base ) + s -> frames_out ; if ( ( ret = ff_filter_frame ( outlink , buf_out ) ) < 0 ) { av_frame_free ( & buf ) ; return ret ; } s -> frames_out ++ ; } flush_fifo ( s -> fifo ) ; ret = write_to_fifo ( s -> fifo , buf ) ; s -> pts = s -> first_pts + av_rescale_q ( s -> frames_out , outlink -> time_base , inlink -> time_base ) ; return ret ; }
<S2SV_ModStart> pts == AV_NOPTS_VALUE || av_fifo_size ( s -> fifo ) <= 0
FFmpeg@FFmpeg/cdd5df8189ff1537f7abe8defe971f80602cc2d2
CVE-2013-7021
https://github.com/FFmpeg/FFmpeg/commit/cdd5df8189ff1537f7abe8defe971f80602cc2d2
2013-12-09T16:36Z
395
CWE-78
CWE-78 int r_bin_pdb_download ( RCore * core , int isradjson , int * actions_done , SPDBOptions * options ) { int ret ; SPDBDownloaderOpt opt ; SPDBDownloader pdb_downloader ; RBinInfo * info = r_bin_get_info ( core -> bin ) ; if ( ! info || ! info -> debug_file_name ) { <S2SV_StartBug> eprintf ( "Can\'t<S2SV_blank>find<S2SV_blank>debug<S2SV_blank>filename\\n" ) ; <S2SV_EndBug> return 1 ; } if ( ! options || ! options -> symbol_server || ! options -> user_agent ) { eprintf ( "Can\'t<S2SV_blank>retrieve<S2SV_blank>pdb<S2SV_blank>configurations\\n" ) ; return 1 ; } opt . dbg_file = ( char * ) r_file_basename ( info -> debug_file_name ) ; opt . guid = info -> guid ; opt . symbol_server = options -> symbol_server ; opt . user_agent = options -> user_agent ; opt . symbol_store_path = options -> symbol_store_path ; opt . extract = options -> extract ; init_pdb_downloader ( & opt , & pdb_downloader ) ; ret = pdb_downloader . download ? pdb_downloader . download ( & pdb_downloader ) : 0 ; if ( isradjson && actions_done ) { printf ( "%s\\"pdb\\":{\\"file\\":\\"%s\\",\\"download\\":%s}" , * actions_done ? "," : "" , opt . dbg_file , ret ? "true" : "false" ) ; } else { printf ( "PDB<S2SV_blank>\\"%s\\"<S2SV_blank>download<S2SV_blank>%s\\n" , opt . dbg_file , ret ? "success" : "failed" ) ; } if ( actions_done ) { ( * actions_done ) ++ ; } deinit_pdb_downloader ( & pdb_downloader ) ; return 0 ; }
<S2SV_ModStart> eprintf ( "Can\'t<S2SV_blank>find<S2SV_blank>debug<S2SV_blank>filename\\n" ) ; return 1 ; } if ( ! is_valid_guid ( info -> guid ) ) { eprintf ( "Invalid<S2SV_blank>GUID<S2SV_blank>for<S2SV_blank>file\\n"
radareorg@radare2/04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9
CVE-2020-15121
https://github.com/radareorg/radare2/commit/04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9
2020-07-20T18:15Z
396
CWE-20
CWE-20 int rxrpc_recvmsg ( struct kiocb * iocb , struct socket * sock , struct msghdr * msg , size_t len , int flags ) { struct rxrpc_skb_priv * sp ; struct rxrpc_call * call = NULL , * continue_call = NULL ; struct rxrpc_sock * rx = rxrpc_sk ( sock -> sk ) ; struct sk_buff * skb ; long timeo ; int copy , ret , ullen , offset , copied = 0 ; u32 abort_code ; DEFINE_WAIT ( wait ) ; _enter ( ",,,%zu,%d" , len , flags ) ; if ( flags & ( MSG_OOB | MSG_TRUNC ) ) return - EOPNOTSUPP ; ullen = msg -> msg_flags & MSG_CMSG_COMPAT ? 4 : sizeof ( unsigned long ) ; timeo = sock_rcvtimeo ( & rx -> sk , flags & MSG_DONTWAIT ) ; msg -> msg_flags |= MSG_MORE ; lock_sock ( & rx -> sk ) ; for ( ; ; ) { if ( RB_EMPTY_ROOT ( & rx -> calls ) ) { if ( copied ) goto out ; if ( rx -> sk . sk_state != RXRPC_SERVER_LISTENING ) { release_sock ( & rx -> sk ) ; if ( continue_call ) rxrpc_put_call ( continue_call ) ; return - ENODATA ; } } skb = skb_peek ( & rx -> sk . sk_receive_queue ) ; if ( ! skb ) { if ( copied && ( msg -> msg_flags & MSG_PEEK || timeo == 0 ) ) goto out ; release_sock ( & rx -> sk ) ; prepare_to_wait_exclusive ( sk_sleep ( & rx -> sk ) , & wait , TASK_INTERRUPTIBLE ) ; ret = sock_error ( & rx -> sk ) ; if ( ret ) goto wait_error ; if ( skb_queue_empty ( & rx -> sk . sk_receive_queue ) ) { if ( signal_pending ( current ) ) goto wait_interrupted ; timeo = schedule_timeout ( timeo ) ; } finish_wait ( sk_sleep ( & rx -> sk ) , & wait ) ; lock_sock ( & rx -> sk ) ; continue ; } peek_next_packet : sp = rxrpc_skb ( skb ) ; call = sp -> call ; ASSERT ( call != NULL ) ; _debug ( "next<S2SV_blank>pkt<S2SV_blank>%s" , rxrpc_pkts [ sp -> hdr . type ] ) ; spin_lock_bh ( & call -> lock ) ; spin_unlock_bh ( & call -> lock ) ; if ( test_bit ( RXRPC_CALL_RELEASED , & call -> flags ) ) { _debug ( "packet<S2SV_blank>from<S2SV_blank>released<S2SV_blank>call" ) ; if ( skb_dequeue ( & rx -> sk . sk_receive_queue ) != skb ) BUG ( ) ; rxrpc_free_skb ( skb ) ; continue ; } if ( continue_call ) { _debug ( "maybe<S2SV_blank>cont" ) ; if ( call != continue_call || skb -> mark != RXRPC_SKB_MARK_DATA ) { release_sock ( & rx -> sk ) ; rxrpc_put_call ( continue_call ) ; _leave ( "<S2SV_blank>=<S2SV_blank>%d<S2SV_blank>[noncont]" , copied ) ; return copied ; } } rxrpc_get_call ( call ) ; if ( ! continue_call ) { <S2SV_StartBug> if ( msg -> msg_name && msg -> msg_namelen > 0 ) <S2SV_EndBug> memcpy ( msg -> msg_name , & call -> conn -> trans -> peer -> srx , sizeof ( call -> conn -> trans -> peer -> srx ) ) ; sock_recv_ts_and_drops ( msg , & rx -> sk , skb ) ; } if ( skb -> mark != RXRPC_SKB_MARK_DATA ) goto receive_non_data_message ; _debug ( "recvmsg<S2SV_blank>DATA<S2SV_blank>#%u<S2SV_blank>{<S2SV_blank>%d,<S2SV_blank>%d<S2SV_blank>}" , ntohl ( sp -> hdr . seq ) , skb -> len , sp -> offset ) ; if ( ! continue_call ) { ret = put_cmsg ( msg , SOL_RXRPC , RXRPC_USER_CALL_ID , ullen , & call -> user_call_ID ) ; if ( ret < 0 ) goto copy_error ; ASSERT ( test_bit ( RXRPC_CALL_HAS_USERID , & call -> flags ) ) ; } ASSERTCMP ( ntohl ( sp -> hdr . seq ) , >= , call -> rx_data_recv ) ; ASSERTCMP ( ntohl ( sp -> hdr . seq ) , <= , call -> rx_data_recv + 1 ) ; call -> rx_data_recv = ntohl ( sp -> hdr . seq ) ; ASSERTCMP ( ntohl ( sp -> hdr . seq ) , > , call -> rx_data_eaten ) ; offset = sp -> offset ; copy = skb -> len - offset ; if ( copy > len - copied ) copy = len - copied ; if ( skb -> ip_summed == CHECKSUM_UNNECESSARY ) { ret = skb_copy_datagram_iovec ( skb , offset , msg -> msg_iov , copy ) ; } else { ret = skb_copy_and_csum_datagram_iovec ( skb , offset , msg -> msg_iov ) ; if ( ret == - EINVAL ) goto csum_copy_error ; } if ( ret < 0 ) goto copy_error ; _debug ( "copied<S2SV_blank>%d+%d" , copy , copied ) ; offset += copy ; copied += copy ; if ( ! ( flags & MSG_PEEK ) ) sp -> offset = offset ; if ( sp -> offset < skb -> len ) { _debug ( "buffer<S2SV_blank>full" ) ; ASSERTCMP ( copied , == , len ) ; break ; } if ( sp -> hdr . flags & RXRPC_LAST_PACKET ) { _debug ( "last" ) ; if ( call -> conn -> out_clientflag ) { ret = copied ; goto terminal_message ; } if ( ! ( flags & MSG_PEEK ) ) { _debug ( "eat<S2SV_blank>packet" ) ; if ( skb_dequeue ( & rx -> sk . sk_receive_queue ) != skb ) BUG ( ) ; rxrpc_free_skb ( skb ) ; } msg -> msg_flags &= ~ MSG_MORE ; break ; } _debug ( "next" ) ; if ( ! continue_call ) continue_call = sp -> call ; else rxrpc_put_call ( call ) ; call = NULL ; if ( flags & MSG_PEEK ) { _debug ( "peek<S2SV_blank>next" ) ; skb = skb -> next ; if ( skb == ( struct sk_buff * ) & rx -> sk . sk_receive_queue ) break ; goto peek_next_packet ; } _debug ( "eat<S2SV_blank>packet" ) ; if ( skb_dequeue ( & rx -> sk . sk_receive_queue ) != skb ) BUG ( ) ; rxrpc_free_skb ( skb ) ; } _debug ( "end<S2SV_blank>rcv<S2SV_blank>data" ) ; out : release_sock ( & rx -> sk ) ; if ( call ) rxrpc_put_call ( call ) ; if ( continue_call ) rxrpc_put_call ( continue_call ) ; _leave ( "<S2SV_blank>=<S2SV_blank>%d<S2SV_blank>[data]" , copied ) ; return copied ; receive_non_data_message : _debug ( "non-data" ) ; if ( skb -> mark == RXRPC_SKB_MARK_NEW_CALL ) { _debug ( "RECV<S2SV_blank>NEW<S2SV_blank>CALL" ) ; ret = put_cmsg ( msg , SOL_RXRPC , RXRPC_NEW_CALL , 0 , & abort_code ) ; if ( ret < 0 ) goto copy_error ; if ( ! ( flags & MSG_PEEK ) ) { if ( skb_dequeue ( & rx -> sk . sk_receive_queue ) != skb ) BUG ( ) ; rxrpc_free_skb ( skb ) ; } goto out ; } ret = put_cmsg ( msg , SOL_RXRPC , RXRPC_USER_CALL_ID , ullen , & call -> user_call_ID ) ; if ( ret < 0 ) goto copy_error ; ASSERT ( test_bit ( RXRPC_CALL_HAS_USERID , & call -> flags ) ) ; switch ( skb -> mark ) { case RXRPC_SKB_MARK_DATA : BUG ( ) ; case RXRPC_SKB_MARK_FINAL_ACK : ret = put_cmsg ( msg , SOL_RXRPC , RXRPC_ACK , 0 , & abort_code ) ; break ; case RXRPC_SKB_MARK_BUSY : ret = put_cmsg ( msg , SOL_RXRPC , RXRPC_BUSY , 0 , & abort_code ) ; break ; case RXRPC_SKB_MARK_REMOTE_ABORT : abort_code = call -> abort_code ; ret = put_cmsg ( msg , SOL_RXRPC , RXRPC_ABORT , 4 , & abort_code ) ; break ; case RXRPC_SKB_MARK_NET_ERROR : _debug ( "RECV<S2SV_blank>NET<S2SV_blank>ERROR<S2SV_blank>%d" , sp -> error ) ; abort_code = sp -> error ; ret = put_cmsg ( msg , SOL_RXRPC , RXRPC_NET_ERROR , 4 , & abort_code ) ; break ; case RXRPC_SKB_MARK_LOCAL_ERROR : _debug ( "RECV<S2SV_blank>LOCAL<S2SV_blank>ERROR<S2SV_blank>%d" , sp -> error ) ; abort_code = sp -> error ; ret = put_cmsg ( msg , SOL_RXRPC , RXRPC_LOCAL_ERROR , 4 , & abort_code ) ; break ; default : BUG ( ) ; break ; } if ( ret < 0 ) goto copy_error ; terminal_message : _debug ( "terminal" ) ; msg -> msg_flags &= ~ MSG_MORE ; msg -> msg_flags |= MSG_EOR ; if ( ! ( flags & MSG_PEEK ) ) { _net ( "free<S2SV_blank>terminal<S2SV_blank>skb<S2SV_blank>%p" , skb ) ; if ( skb_dequeue ( & rx -> sk . sk_receive_queue ) != skb ) BUG ( ) ; rxrpc_free_skb ( skb ) ; rxrpc_remove_user_ID ( rx , call ) ; } release_sock ( & rx -> sk ) ; rxrpc_put_call ( call ) ; if ( continue_call ) rxrpc_put_call ( continue_call ) ; _leave ( "<S2SV_blank>=<S2SV_blank>%d" , ret ) ; return ret ; copy_error : _debug ( "copy<S2SV_blank>error" ) ; release_sock ( & rx -> sk ) ; rxrpc_put_call ( call ) ; if ( continue_call ) rxrpc_put_call ( continue_call ) ; _leave ( "<S2SV_blank>=<S2SV_blank>%d" , ret ) ; return ret ; csum_copy_error : _debug ( "csum<S2SV_blank>error" ) ; release_sock ( & rx -> sk ) ; if ( continue_call ) rxrpc_put_call ( continue_call ) ; rxrpc_kill_skb ( skb ) ; skb_kill_datagram ( & rx -> sk , skb , flags ) ; rxrpc_put_call ( call ) ; return - EAGAIN ; wait_interrupted : ret = sock_intr_errno ( timeo ) ; wait_error : finish_wait ( sk_sleep ( & rx -> sk ) , & wait ) ; if ( continue_call ) rxrpc_put_call ( continue_call ) ; if ( copied ) copied = ret ; _leave ( "<S2SV_blank>=<S2SV_blank>%d<S2SV_blank>[waitfail<S2SV_blank>%d]" , copied , ret ) ; return copied ; }
<S2SV_ModStart> msg -> msg_name ) { size_t len = sizeof ( call -> conn -> trans -> peer -> srx ) ; memcpy ( msg -> msg_name , & call -> conn -> trans -> peer -> srx , len ) ; <S2SV_ModEnd> msg -> msg_namelen <S2SV_ModStart> msg -> msg_namelen = len ; } <S2SV_ModEnd> sock_recv_ts_and_drops ( msg
torvalds@linux/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
CVE-2013-7271
https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
2014-01-06T16:55Z
397
CWE-254
CWE-254 int virDomainGetTime ( virDomainPtr dom , long long * seconds , unsigned int * nseconds , unsigned int flags ) { VIR_DOMAIN_DEBUG ( dom , "seconds=%p,<S2SV_blank>nseconds=%p,<S2SV_blank>flags=%x" , seconds , nseconds , flags ) ; virResetLastError ( ) ; <S2SV_StartBug> virCheckDomainReturn ( dom , - 1 ) ; <S2SV_EndBug> if ( dom -> conn -> driver -> domainGetTime ) { int ret = dom -> conn -> driver -> domainGetTime ( dom , seconds , nseconds , flags ) ; if ( ret < 0 ) goto error ; return ret ; } virReportUnsupportedError ( ) ; error : virDispatchError ( dom -> conn ) ; return - 1 ; }
<S2SV_ModStart> , - 1 ) ; virCheckReadOnlyGoto ( dom -> conn -> flags , error
libvirt@libvirt/506e9d6c2d4baaf580d489fff0690c0ff2ff588f
CVE-2016-10746
https://github.com/libvirt/libvirt/commit/506e9d6c2d4baaf580d489fff0690c0ff2ff588f
2019-04-18T16:29Z
398
CWE-000
CWE-000 static int propagate_one ( struct mount * m ) { struct mount * child ; int type ; if ( IS_MNT_NEW ( m ) ) return 0 ; if ( ! is_subdir ( mp -> m_dentry , m -> mnt . mnt_root ) ) return 0 ; if ( peers ( m , last_dest ) ) { type = CL_MAKE_SHARED ; } else { <S2SV_StartBug> struct mount * n , * p ; <S2SV_EndBug> for ( n = m ; ; n = p ) { p = n -> mnt_master ; <S2SV_StartBug> if ( p == dest_master || IS_MNT_MARKED ( p ) ) { <S2SV_EndBug> while ( last_dest -> mnt_master != p ) { last_source = last_source -> mnt_master ; last_dest = last_source -> mnt_parent ; } if ( ! peers ( n , last_dest ) ) { last_source = last_source -> mnt_master ; last_dest = last_source -> mnt_parent ; } break ; } } type = CL_SLAVE ; if ( IS_MNT_SHARED ( m ) ) type |= CL_MAKE_SHARED ; } if ( m -> mnt_ns -> user_ns != user_ns ) type |= CL_UNPRIVILEGED ; child = copy_tree ( last_source , last_source -> mnt . mnt_root , type ) ; if ( IS_ERR ( child ) ) return PTR_ERR ( child ) ; child -> mnt . mnt_flags &= ~ MNT_LOCKED ; mnt_set_mountpoint ( m , mp , child ) ; last_dest = m ; last_source = child ; if ( m -> mnt_master != dest_master ) { read_seqlock_excl ( & mount_lock ) ; SET_MNT_MARK ( m -> mnt_master ) ; read_sequnlock_excl ( & mount_lock ) ; } hlist_add_head ( & child -> mnt_hash , list ) ; return 0 ; }
<S2SV_ModStart> , * p ; bool done <S2SV_ModStart> p ) ) break ; } do { struct mount * parent = last_source -> mnt_parent ; if ( last_source == first_source ) break ; done = parent -> mnt_master == p ; if ( done && peers ( n , parent ) ) break ; last_source = last_source -> mnt_master ; } while ( ! done ) ; <S2SV_ModEnd> type = CL_SLAVE
torvalds@linux/5ec0811d30378ae104f250bfc9b3640242d81e3f
CVE-2016-4581
https://github.com/torvalds/linux/commit/5ec0811d30378ae104f250bfc9b3640242d81e3f
2016-05-23T10:59Z
399
CWE-200
CWE-200 static void umount_tree ( struct mount * mnt , enum umount_tree_flags how ) { LIST_HEAD ( tmp_list ) ; struct mount * p ; if ( how & UMOUNT_PROPAGATE ) propagate_mount_unlock ( mnt ) ; for ( p = mnt ; p ; p = next_mnt ( p , mnt ) ) { p -> mnt . mnt_flags |= MNT_UMOUNT ; list_move ( & p -> mnt_list , & tmp_list ) ; } list_for_each_entry ( p , & tmp_list , mnt_list ) { list_del_init ( & p -> mnt_child ) ; } if ( how & UMOUNT_PROPAGATE ) propagate_umount ( & tmp_list ) ; while ( ! list_empty ( & tmp_list ) ) { bool disconnect ; p = list_first_entry ( & tmp_list , struct mount , mnt_list ) ; list_del_init ( & p -> mnt_expire ) ; list_del_init ( & p -> mnt_list ) ; __touch_mnt_namespace ( p -> mnt_ns ) ; p -> mnt_ns = NULL ; if ( how & UMOUNT_SYNC ) p -> mnt . mnt_flags |= MNT_SYNC_UMOUNT ; <S2SV_StartBug> disconnect = ! IS_MNT_LOCKED_AND_LAZY ( p ) ; <S2SV_EndBug> pin_insert_group ( & p -> mnt_umount , & p -> mnt_parent -> mnt , disconnect ? & unmounted : NULL ) ; if ( mnt_has_parent ( p ) ) { mnt_add_count ( p -> mnt_parent , - 1 ) ; if ( ! disconnect ) { list_add_tail ( & p -> mnt_child , & p -> mnt_parent -> mnt_mounts ) ; } else { umount_mnt ( p ) ; } } change_mnt_propagation ( p , MS_PRIVATE ) ; } }
<S2SV_ModStart> disconnect = ! ( ( ( how & UMOUNT_CONNECTED ) && mnt_has_parent ( p ) && ( p -> mnt_parent -> mnt . mnt_flags & MNT_UMOUNT ) ) || <S2SV_ModStart> IS_MNT_LOCKED_AND_LAZY ( p )
torvalds@linux/e0c9c0afd2fc958ffa34b697972721d81df8a56f
CVE-2015-4176
https://github.com/torvalds/linux/commit/e0c9c0afd2fc958ffa34b697972721d81df8a56f
2016-05-02T10:59Z