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
|
---|---|---|---|---|---|---|---|
200 | CWE-000 | CWE-000 void Com_WriteConfig_f ( void ) { char filename [ MAX_QPATH ] ; if ( Cmd_Argc ( ) != 2 ) { <S2SV_StartBug> Com_Printf ( "Usage:<S2SV_blank>writeconfig<S2SV_blank><filename>\\n" ) ; <S2SV_EndBug> return ; } Q_strncpyz ( filename , Cmd_Argv ( 1 ) , sizeof ( filename ) ) ; COM_DefaultExtension ( filename , sizeof ( filename ) , ".cfg" ) ; Com_Printf ( "Writing<S2SV_blank>%s.\\n" , filename ) ; Com_WriteConfigToFile ( filename ) ; }
| <S2SV_ModStart> Com_Printf ( "Usage:<S2SV_blank>writeconfig<S2SV_blank><filename>\\n" ) ; return ; } if ( ! COM_CompareExtension ( filename , ".cfg" ) ) { Com_Printf ( "Com_WriteConfig_f:<S2SV_blank>Only<S2SV_blank>the<S2SV_blank>\\".cfg\\"<S2SV_blank>extension<S2SV_blank>is<S2SV_blank>supported<S2SV_blank>by<S2SV_blank>this<S2SV_blank>command!\\n"
| JACoders@OpenJK/b173ac05993f634a42be3d3535e1b158de0c3372 | CVE-2017-6903 | https://github.com/JACoders/OpenJK/commit/b173ac05993f634a42be3d3535e1b158de0c3372 | 2017-03-14T22:59Z |
201 | CWE-119 | CWE-119 <S2SV_StartBug> static void <S2SV_EndBug> horDiff32 ( TIFF * tif , uint8 * cp0 , tmsize_t cc ) { TIFFPredictorState * sp = PredictorState ( tif ) ; tmsize_t stride = sp -> stride ; uint32 * wp = ( uint32 * ) cp0 ; tmsize_t wc = cc / 4 ; <S2SV_StartBug> assert ( ( cc % ( 4 * stride ) ) == 0 ) ; <S2SV_EndBug> if ( wc > stride ) { wc -= stride ; wp += wc - 1 ; do { REPEAT4 ( stride , wp [ stride ] -= wp [ 0 ] ; wp -- ) wc -= stride ; } while ( wc > 0 ) ; } <S2SV_StartBug> } <S2SV_EndBug>
| <S2SV_ModStart> <S2SV_null> <S2SV_null> static int <S2SV_ModEnd> horDiff32 ( TIFF <S2SV_ModStart> / 4 ; if <S2SV_ModEnd> ( ( cc <S2SV_ModStart> stride ) ) != 0 ) { TIFFErrorExt ( tif -> tif_clientdata , "horDiff32" , "%s" , "(cc%(4*stride))!=0" ) ; return 0 ; } <S2SV_ModEnd> if ( wc <S2SV_ModStart> ) ; } return 1 ;
| vadz@libtiff/3ca657a8793dd011bf869695d72ad31c779c3cc1 | CVE-2016-9535 | https://github.com/vadz/libtiff/commit/3ca657a8793dd011bf869695d72ad31c779c3cc1 | 2016-11-22T19:59Z |
202 | CWE-125 | CWE-125 struct r_bin_dyldcache_obj_t * r_bin_dyldcache_from_bytes_new ( const ut8 * buf , ut64 size ) { <S2SV_StartBug> struct r_bin_dyldcache_obj_t * bin ; <S2SV_EndBug> <S2SV_StartBug> if ( ! ( bin = malloc ( sizeof ( struct r_bin_dyldcache_obj_t ) ) ) ) { <S2SV_EndBug> return NULL ; } <S2SV_StartBug> memset ( bin , 0 , sizeof ( struct r_bin_dyldcache_obj_t ) ) ; <S2SV_EndBug> if ( ! buf ) { return r_bin_dyldcache_free ( bin ) ; } bin -> b = r_buf_new ( ) ; <S2SV_StartBug> if ( ! r_buf_set_bytes ( bin -> b , buf , size ) ) { <S2SV_EndBug> return r_bin_dyldcache_free ( bin ) ; } if ( ! r_bin_dyldcache_init ( bin ) ) { return r_bin_dyldcache_free ( bin ) ; } bin -> size = size ; return bin ; }
| <S2SV_ModStart> r_bin_dyldcache_obj_t * bin = R_NEW0 ( struct r_bin_dyldcache_obj_t ) <S2SV_ModStart> if ( ! bin <S2SV_ModEnd> ) { return <S2SV_ModStart> NULL ; } <S2SV_ModEnd> if ( ! <S2SV_ModStart> ; if ( ! bin -> b ||
| radareorg@radare2/30f4c7b52a4e2dc0d0b1bae487d90f5437c69d19 | CVE-2018-20458 | https://github.com/radareorg/radare2/commit/30f4c7b52a4e2dc0d0b1bae487d90f5437c69d19 | 2018-12-25T19:29Z |
203 | CWE-787 | CWE-787 char * enl_ipc_get ( const char * msg_data ) { static char * message = NULL ; <S2SV_StartBug> static unsigned short len = 0 ; <S2SV_EndBug> char buff [ 13 ] , * ret_msg = NULL ; register unsigned char i ; unsigned char blen ; if ( msg_data == IPC_TIMEOUT ) { return ( IPC_TIMEOUT ) ; } for ( i = 0 ; i < 12 ; i ++ ) { buff [ i ] = msg_data [ i ] ; } buff [ 12 ] = 0 ; blen = strlen ( buff ) ; if ( message != NULL ) { len += blen ; message = ( char * ) erealloc ( message , len + 1 ) ; strcat ( message , buff ) ; } else { len = blen ; message = ( char * ) emalloc ( len + 1 ) ; strcpy ( message , buff ) ; } if ( blen < 12 ) { ret_msg = message ; message = NULL ; D ( ( "Received<S2SV_blank>complete<S2SV_blank>reply:<S2SV_blank><S2SV_blank>\\"%s\\"\\n" , ret_msg ) ) ; } return ( ret_msg ) ; }
| <S2SV_ModStart> NULL ; static size_t <S2SV_ModEnd> len = 0
| derf@feh/f7a547b7ef8fc8ebdeaa4c28515c9d72e592fb6d | CVE-2017-7875 | https://github.com/derf/feh/commit/f7a547b7ef8fc8ebdeaa4c28515c9d72e592fb6d | 2017-04-14T18:59Z |
204 | CWE-787 | CWE-787 <S2SV_StartBug> static int shash_no_setkey ( struct crypto_shash * tfm , const u8 * key , <S2SV_EndBug> unsigned int keylen ) { return - ENOSYS ; }
| <S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> <S2SV_ModEnd> int shash_no_setkey (
| torvalds@linux/af3ff8045bbf3e32f1a448542e73abb4c8ceb6f1 | CVE-2017-17806 | https://github.com/torvalds/linux/commit/af3ff8045bbf3e32f1a448542e73abb4c8ceb6f1 | 2017-12-20T23:29Z |
205 | CWE-119 | CWE-119 void vp9_tile_init ( TileInfo * tile , const VP9_COMMON * cm , int row , int col ) { <S2SV_StartBug> tile -> mi_row_start = get_tile_offset ( row , cm -> mi_rows , cm -> log2_tile_rows ) ; <S2SV_EndBug> tile -> mi_row_end = get_tile_offset ( row + 1 , cm -> mi_rows , cm -> log2_tile_rows ) ; tile -> mi_col_start = get_tile_offset ( col , cm -> mi_cols , cm -> log2_tile_cols ) ; tile -> mi_col_end = get_tile_offset ( col + 1 , cm -> mi_cols , cm -> log2_tile_cols ) ; }
| <S2SV_ModStart> col ) { vp9_tile_set_row ( tile , cm , row ) ; vp9_tile_set_col ( tile , cm , col <S2SV_ModEnd> ) ; }
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
206 | CWE-119 | CWE-119 <S2SV_StartBug> static double get_rate_correction_factor ( const VP9_COMP * cpi ) { <S2SV_EndBug> if ( cpi -> common . frame_type == KEY_FRAME ) { <S2SV_StartBug> return cpi -> rc . key_frame_rate_correction_factor ; <S2SV_EndBug> } else { if ( ( cpi -> refresh_alt_ref_frame || cpi -> refresh_golden_frame ) && <S2SV_StartBug> ! cpi -> rc . is_src_frame_alt_ref && <S2SV_EndBug> <S2SV_StartBug> ! ( cpi -> use_svc && cpi -> oxcf . end_usage == USAGE_STREAM_FROM_SERVER ) ) <S2SV_EndBug> return cpi -> rc . gf_rate_correction_factor ; else return cpi -> rc . rate_correction_factor ; } }
| <S2SV_ModStart> cpi ) { const RATE_CONTROL * const rc = & cpi -> rc ; double rcf ; <S2SV_ModStart> KEY_FRAME ) { rcf = rc -> rate_correction_factors [ KF_STD ] ; } else if ( cpi -> oxcf . pass == 2 ) { RATE_FACTOR_LEVEL rf_lvl = cpi -> twopass . gf_group . rf_level [ cpi -> twopass . gf_group . index ] ; rcf = rc -> rate_correction_factors [ rf_lvl ] <S2SV_ModEnd> ; } else <S2SV_ModStart> ) && ! rc -> <S2SV_ModEnd> is_src_frame_alt_ref && ! <S2SV_ModStart> is_src_frame_alt_ref && ! <S2SV_ModEnd> cpi -> use_svc <S2SV_ModStart> -> use_svc && ( <S2SV_ModStart> -> oxcf . rc_mode != VPX_CBR || cpi -> oxcf . gf_cbr_boost_pct > 20 ) ) rcf = rc -> rate_correction_factors [ GF_ARF_STD ] ; else rcf = rc -> rate_correction_factors [ INTER_NORMAL ] ; } rcf *= rcf_mult [ rc -> frame_size_selector ] ; return fclamp ( rcf , MIN_BPB_FACTOR , MAX_BPB_FACTOR ) ; <S2SV_ModEnd> } <S2SV_null> <S2SV_null>
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
207 | CWE-119 | CWE-119 static Image * ReadDCMImage ( const ImageInfo * image_info , ExceptionInfo * exception ) { <S2SV_StartBug> # define ThrowDCMException ( exception , message ) { if ( info . scale != ( Quantum * ) NULL ) info . scale = ( Quantum * ) RelinquishMagickMemory ( info . scale ) ; if ( data != ( unsigned char * ) NULL ) data = ( unsigned char * ) RelinquishMagickMemory ( data ) ; if ( graymap != ( int * ) NULL ) graymap = ( int * ) RelinquishMagickMemory ( graymap ) ; if ( bluemap != ( int * ) NULL ) bluemap = ( int * ) RelinquishMagickMemory ( bluemap ) ; if ( greenmap != ( int * ) NULL ) greenmap = ( int * ) RelinquishMagickMemory ( greenmap ) ; if ( redmap != ( int * ) NULL ) redmap = ( int * ) RelinquishMagickMemory ( redmap ) ; if ( stream_info -> offsets != ( ssize_t * ) NULL ) stream_info -> offsets = ( ssize_t * ) RelinquishMagickMemory ( stream_info -> offsets ) ; if ( stream_info != ( DCMStreamInfo * ) NULL ) stream_info = ( DCMStreamInfo * ) RelinquishMagickMemory ( stream_info ) ; ThrowReaderException ( ( exception ) , ( message ) ) ; } <S2SV_EndBug> char explicit_vr [ MagickPathExtent ] , implicit_vr [ MagickPathExtent ] , magick [ MagickPathExtent ] , photometric [ MagickPathExtent ] ; DCMInfo info ; DCMStreamInfo * stream_info ; Image * image ; int * bluemap , datum , * greenmap , * graymap , * redmap ; MagickBooleanType explicit_file , explicit_retry , use_explicit ; MagickOffsetType offset ; register unsigned char * p ; register ssize_t i ; size_t colors , height , length , number_scenes , quantum , status , width ; ssize_t count , scene ; unsigned char * data ; unsigned short group , element ; 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 ) ; } image -> depth = 8UL ; image -> endian = LSBEndian ; ( void ) memset ( & info , 0 , sizeof ( info ) ) ; data = ( unsigned char * ) NULL ; graymap = ( int * ) NULL ; redmap = ( int * ) NULL ; greenmap = ( int * ) NULL ; bluemap = ( int * ) NULL ; stream_info = ( DCMStreamInfo * ) AcquireMagickMemory ( sizeof ( * stream_info ) ) ; if ( stream_info == ( DCMStreamInfo * ) NULL ) ThrowDCMException ( ResourceLimitError , "MemoryAllocationFailed" ) ; ( void ) memset ( stream_info , 0 , sizeof ( * stream_info ) ) ; count = ReadBlob ( image , 128 , ( unsigned char * ) magick ) ; if ( count != 128 ) ThrowDCMException ( CorruptImageError , "ImproperImageHeader" ) ; count = ReadBlob ( image , 4 , ( unsigned char * ) magick ) ; if ( ( count != 4 ) || ( LocaleNCompare ( magick , "DICM" , 4 ) != 0 ) ) { offset = SeekBlob ( image , 0L , SEEK_SET ) ; if ( offset < 0 ) ThrowDCMException ( CorruptImageError , "ImproperImageHeader" ) ; } ( void ) CopyMagickString ( photometric , "MONOCHROME1<S2SV_blank>" , MagickPathExtent ) ; info . bits_allocated = 8 ; info . bytes_per_pixel = 1 ; info . depth = 8 ; info . mask = 0xffff ; info . max_value = 255UL ; info . samples_per_pixel = 1 ; info . signed_data = ( ~ 0UL ) ; info . rescale_slope = 1.0 ; data = ( unsigned char * ) NULL ; element = 0 ; explicit_vr [ 2 ] = '\\0' ; explicit_file = MagickFalse ; colors = 0 ; redmap = ( int * ) NULL ; greenmap = ( int * ) NULL ; bluemap = ( int * ) NULL ; graymap = ( int * ) NULL ; height = 0 ; number_scenes = 1 ; use_explicit = MagickFalse ; explicit_retry = MagickFalse ; width = 0 ; while ( TellBlob ( image ) < ( MagickOffsetType ) GetBlobSize ( image ) ) { for ( group = 0 ; ( group != 0x7FE0 ) || ( element != 0x0010 ) ; ) { image -> offset = ( ssize_t ) TellBlob ( image ) ; group = ReadBlobLSBShort ( image ) ; element = ReadBlobLSBShort ( image ) ; if ( ( group == 0xfffc ) && ( element == 0xfffc ) ) break ; if ( ( group != 0x0002 ) && ( image -> endian == MSBEndian ) ) { group = ( unsigned short ) ( ( group << 8 ) | ( ( group >> 8 ) & 0xFF ) ) ; element = ( unsigned short ) ( ( element << 8 ) | ( ( element >> 8 ) & 0xFF ) ) ; } quantum = 0 ; for ( i = 0 ; dicom_info [ i ] . group < 0xffff ; i ++ ) if ( ( group == dicom_info [ i ] . group ) && ( element == dicom_info [ i ] . element ) ) break ; ( void ) CopyMagickString ( implicit_vr , dicom_info [ i ] . vr , MagickPathExtent ) ; count = ReadBlob ( image , 2 , ( unsigned char * ) explicit_vr ) ; if ( count != 2 ) ThrowDCMException ( CorruptImageError , "ImproperImageHeader" ) ; if ( ( explicit_file == MagickFalse ) && ( group != 0x0002 ) ) explicit_file = ( isupper ( ( unsigned char ) * explicit_vr ) != MagickFalse ) && ( isupper ( ( unsigned char ) * ( explicit_vr + 1 ) ) != MagickFalse ) ? MagickTrue : MagickFalse ; use_explicit = ( ( group == 0x0002 ) && ( explicit_retry == MagickFalse ) ) || ( explicit_file != MagickFalse ) ? MagickTrue : MagickFalse ; if ( ( use_explicit != MagickFalse ) && ( strncmp ( implicit_vr , "xs" , 2 ) == 0 ) ) ( void ) CopyMagickString ( implicit_vr , explicit_vr , MagickPathExtent ) ; if ( ( use_explicit == MagickFalse ) || ( strncmp ( implicit_vr , "!!" , 2 ) == 0 ) ) { offset = SeekBlob ( image , ( MagickOffsetType ) - 2 , SEEK_CUR ) ; if ( offset < 0 ) ThrowDCMException ( CorruptImageError , "ImproperImageHeader" ) ; quantum = 4 ; } else { quantum = 2 ; if ( ( strncmp ( explicit_vr , "OB" , 2 ) == 0 ) || ( strncmp ( explicit_vr , "UN" , 2 ) == 0 ) || ( strncmp ( explicit_vr , "OW" , 2 ) == 0 ) || ( strncmp ( explicit_vr , "SQ" , 2 ) == 0 ) ) { ( void ) ReadBlobLSBShort ( image ) ; quantum = 4 ; } } datum = 0 ; if ( quantum == 4 ) { if ( group == 0x0002 ) datum = ReadBlobLSBSignedLong ( image ) ; else datum = ReadBlobSignedLong ( image ) ; } else if ( quantum == 2 ) { if ( group == 0x0002 ) datum = ReadBlobLSBSignedShort ( image ) ; else datum = ReadBlobSignedShort ( image ) ; } quantum = 0 ; length = 1 ; if ( datum != 0 ) { if ( ( strncmp ( implicit_vr , "OW" , 2 ) == 0 ) || ( strncmp ( implicit_vr , "SS" , 2 ) == 0 ) || ( strncmp ( implicit_vr , "US" , 2 ) == 0 ) ) quantum = 2 ; else if ( ( strncmp ( implicit_vr , "FL" , 2 ) == 0 ) || ( strncmp ( implicit_vr , "OF" , 2 ) == 0 ) || ( strncmp ( implicit_vr , "SL" , 2 ) == 0 ) || ( strncmp ( implicit_vr , "UL" , 2 ) == 0 ) ) quantum = 4 ; else if ( strncmp ( implicit_vr , "FD" , 2 ) == 0 ) quantum = 8 ; else quantum = 1 ; if ( datum != ~ 0 ) length = ( size_t ) datum / quantum ; else { quantum = 0 ; length = 0 ; } } if ( image_info -> verbose != MagickFalse ) { if ( use_explicit == MagickFalse ) explicit_vr [ 0 ] = '\\0' ; for ( i = 0 ; dicom_info [ i ] . description != ( char * ) NULL ; i ++ ) if ( ( group == dicom_info [ i ] . group ) && ( element == dicom_info [ i ] . element ) ) break ; ( void ) FormatLocaleFile ( stdout , "0x%04lX<S2SV_blank>%4ld<S2SV_blank>%s-%s<S2SV_blank>(0x%04lx,0x%04lx)" , ( unsigned long ) image -> offset , ( long ) length , implicit_vr , explicit_vr , ( unsigned long ) group , ( unsigned long ) element ) ; if ( dicom_info [ i ] . description != ( char * ) NULL ) ( void ) FormatLocaleFile ( stdout , "<S2SV_blank>%s" , dicom_info [ i ] . description ) ; ( void ) FormatLocaleFile ( stdout , ":<S2SV_blank>" ) ; } if ( ( group == 0x7FE0 ) && ( element == 0x0010 ) ) { if ( image_info -> verbose != MagickFalse ) ( void ) FormatLocaleFile ( stdout , "\\n" ) ; break ; } data = ( unsigned char * ) NULL ; if ( ( length == 1 ) && ( quantum == 1 ) ) datum = ReadBlobByte ( image ) ; else if ( ( length == 1 ) && ( quantum == 2 ) ) { if ( group == 0x0002 ) datum = ReadBlobLSBSignedShort ( image ) ; else datum = ReadBlobSignedShort ( image ) ; } else if ( ( length == 1 ) && ( quantum == 4 ) ) { if ( group == 0x0002 ) datum = ReadBlobLSBSignedLong ( image ) ; else datum = ReadBlobSignedLong ( image ) ; } else if ( ( quantum != 0 ) && ( length != 0 ) ) { if ( length > ( size_t ) GetBlobSize ( image ) ) ThrowDCMException ( CorruptImageError , "InsufficientImageDataInFile" ) ; if ( ~ length >= 1 ) data = ( unsigned char * ) AcquireQuantumMemory ( length + 1 , quantum * sizeof ( * data ) ) ; if ( data == ( unsigned char * ) NULL ) ThrowDCMException ( ResourceLimitError , "MemoryAllocationFailed" ) ; count = ReadBlob ( image , ( size_t ) quantum * length , data ) ; if ( count != ( ssize_t ) ( quantum * length ) ) { if ( image_info -> verbose != MagickFalse ) ( void ) FormatLocaleFile ( stdout , "count=%d<S2SV_blank>quantum=%d<S2SV_blank>" "length=%d<S2SV_blank>group=%d\\n" , ( int ) count , ( int ) quantum , ( int ) length , ( int ) group ) ; ThrowDCMException ( CorruptImageError , "InsufficientImageDataInFile" ) ; } data [ length * quantum ] = '\\0' ; } if ( ( ( ( unsigned int ) group << 16 ) | element ) == 0xFFFEE0DD ) { if ( data != ( unsigned char * ) NULL ) data = ( unsigned char * ) RelinquishMagickMemory ( data ) ; continue ; } switch ( group ) { case 0x0002 : { switch ( element ) { case 0x0010 : { char transfer_syntax [ MagickPathExtent ] ; if ( ( datum == 0 ) && ( explicit_retry == MagickFalse ) ) { explicit_retry = MagickTrue ; ( void ) SeekBlob ( image , ( MagickOffsetType ) 0 , SEEK_SET ) ; group = 0 ; element = 0 ; if ( image_info -> verbose != MagickFalse ) ( void ) FormatLocaleFile ( stdout , "Corrupted<S2SV_blank>image<S2SV_blank>-<S2SV_blank>trying<S2SV_blank>explicit<S2SV_blank>format\\n" ) ; break ; } * transfer_syntax = '\\0' ; if ( data != ( unsigned char * ) NULL ) ( void ) CopyMagickString ( transfer_syntax , ( char * ) data , MagickPathExtent ) ; if ( image_info -> verbose != MagickFalse ) ( void ) FormatLocaleFile ( stdout , "transfer_syntax=%s\\n" , ( const char * ) transfer_syntax ) ; if ( strncmp ( transfer_syntax , "1.2.840.10008.1.2" , 17 ) == 0 ) { int subtype , type ; type = 1 ; subtype = 0 ; if ( strlen ( transfer_syntax ) > 17 ) { count = ( ssize_t ) sscanf ( transfer_syntax + 17 , ".%d.%d" , & type , & subtype ) ; if ( count < 1 ) ThrowDCMException ( CorruptImageError , "ImproperImageHeader" ) ; } switch ( type ) { case 1 : { image -> endian = LSBEndian ; break ; } case 2 : { image -> endian = MSBEndian ; break ; } case 4 : { if ( ( subtype >= 80 ) && ( subtype <= 81 ) ) image -> compression = JPEGCompression ; else if ( ( subtype >= 90 ) && ( subtype <= 93 ) ) image -> compression = JPEG2000Compression ; else image -> compression = JPEGCompression ; break ; } case 5 : { image -> compression = RLECompression ; break ; } } } break ; } default : break ; } break ; } case 0x0028 : { switch ( element ) { case 0x0002 : { info . samples_per_pixel = ( size_t ) datum ; if ( ( info . samples_per_pixel == 0 ) || ( info . samples_per_pixel > 4 ) ) ThrowDCMException ( CorruptImageError , "ImproperImageHeader" ) ; break ; } case 0x0004 : { if ( data == ( unsigned char * ) NULL ) break ; for ( i = 0 ; i < ( ssize_t ) MagickMin ( length , MagickPathExtent - 1 ) ; i ++ ) photometric [ i ] = ( char ) data [ i ] ; photometric [ i ] = '\\0' ; info . polarity = LocaleCompare ( photometric , "MONOCHROME1<S2SV_blank>" ) == 0 ? MagickTrue : MagickFalse ; break ; } case 0x0006 : { if ( datum == 1 ) image -> interlace = PlaneInterlace ; break ; } case 0x0008 : { if ( data == ( unsigned char * ) NULL ) break ; number_scenes = StringToUnsignedLong ( ( char * ) data ) ; break ; } case 0x0010 : { height = ( size_t ) datum ; break ; } case 0x0011 : { width = ( size_t ) datum ; break ; } case 0x0100 : { info . bits_allocated = ( size_t ) datum ; info . bytes_per_pixel = 1 ; if ( datum > 8 ) info . bytes_per_pixel = 2 ; info . depth = info . bits_allocated ; if ( ( info . depth == 0 ) || ( info . depth > 32 ) ) ThrowDCMException ( CorruptImageError , "ImproperImageHeader" ) ; info . max_value = ( 1UL << info . bits_allocated ) - 1 ; image -> depth = info . depth ; break ; } case 0x0101 : { info . significant_bits = ( size_t ) datum ; info . bytes_per_pixel = 1 ; if ( info . significant_bits > 8 ) info . bytes_per_pixel = 2 ; info . depth = info . significant_bits ; if ( ( info . depth == 0 ) || ( info . depth > 16 ) ) ThrowDCMException ( CorruptImageError , "ImproperImageHeader" ) ; info . max_value = ( 1UL << info . significant_bits ) - 1 ; info . mask = ( size_t ) GetQuantumRange ( info . significant_bits ) ; image -> depth = info . depth ; break ; } case 0x0102 : { break ; } case 0x0103 : { info . signed_data = ( size_t ) datum ; break ; } case 0x1050 : { if ( data != ( unsigned char * ) NULL ) info . window_center = StringToDouble ( ( char * ) data , ( char * * ) NULL ) ; break ; } case 0x1051 : { if ( data != ( unsigned char * ) NULL ) info . window_width = StringToDouble ( ( char * ) data , ( char * * ) NULL ) ; break ; } case 0x1052 : { if ( data != ( unsigned char * ) NULL ) info . rescale_intercept = StringToDouble ( ( char * ) data , ( char * * ) NULL ) ; break ; } case 0x1053 : { if ( data != ( unsigned char * ) NULL ) info . rescale_slope = StringToDouble ( ( char * ) data , ( char * * ) NULL ) ; break ; } case 0x1200 : case 0x3006 : { if ( data == ( unsigned char * ) NULL ) break ; colors = ( size_t ) ( length / info . bytes_per_pixel ) ; datum = ( int ) colors ; if ( graymap != ( int * ) NULL ) graymap = ( int * ) RelinquishMagickMemory ( graymap ) ; graymap = ( int * ) AcquireQuantumMemory ( MagickMax ( colors , 65536 ) , sizeof ( * graymap ) ) ; if ( graymap == ( int * ) NULL ) ThrowDCMException ( ResourceLimitError , "MemoryAllocationFailed" ) ; ( void ) memset ( graymap , 0 , MagickMax ( colors , 65536 ) * sizeof ( * graymap ) ) ; for ( i = 0 ; i < ( ssize_t ) colors ; i ++ ) if ( info . bytes_per_pixel == 1 ) graymap [ i ] = ( int ) data [ i ] ; else graymap [ i ] = ( int ) ( ( short * ) data ) [ i ] ; break ; } case 0x1201 : { unsigned short index ; if ( data == ( unsigned char * ) NULL ) break ; colors = ( size_t ) ( length / 2 ) ; datum = ( int ) colors ; if ( redmap != ( int * ) NULL ) redmap = ( int * ) RelinquishMagickMemory ( redmap ) ; redmap = ( int * ) AcquireQuantumMemory ( MagickMax ( colors , 65536 ) , sizeof ( * redmap ) ) ; if ( redmap == ( int * ) NULL ) ThrowDCMException ( ResourceLimitError , "MemoryAllocationFailed" ) ; ( void ) memset ( redmap , 0 , MagickMax ( colors , 65536 ) * sizeof ( * redmap ) ) ; p = data ; for ( i = 0 ; i < ( ssize_t ) colors ; i ++ ) { if ( image -> endian == MSBEndian ) index = ( unsigned short ) ( ( * p << 8 ) | * ( p + 1 ) ) ; else index = ( unsigned short ) ( * p | ( * ( p + 1 ) << 8 ) ) ; redmap [ i ] = ( int ) index ; p += 2 ; } break ; } case 0x1202 : { unsigned short index ; if ( data == ( unsigned char * ) NULL ) break ; colors = ( size_t ) ( length / 2 ) ; datum = ( int ) colors ; if ( greenmap != ( int * ) NULL ) greenmap = ( int * ) RelinquishMagickMemory ( greenmap ) ; greenmap = ( int * ) AcquireQuantumMemory ( MagickMax ( colors , 65536 ) , sizeof ( * greenmap ) ) ; if ( greenmap == ( int * ) NULL ) ThrowDCMException ( ResourceLimitError , "MemoryAllocationFailed" ) ; ( void ) memset ( greenmap , 0 , MagickMax ( colors , 65536 ) * sizeof ( * greenmap ) ) ; p = data ; for ( i = 0 ; i < ( ssize_t ) colors ; i ++ ) { if ( image -> endian == MSBEndian ) index = ( unsigned short ) ( ( * p << 8 ) | * ( p + 1 ) ) ; else index = ( unsigned short ) ( * p | ( * ( p + 1 ) << 8 ) ) ; greenmap [ i ] = ( int ) index ; p += 2 ; } break ; } case 0x1203 : { unsigned short index ; if ( data == ( unsigned char * ) NULL ) break ; colors = ( size_t ) ( length / 2 ) ; datum = ( int ) colors ; if ( bluemap != ( int * ) NULL ) bluemap = ( int * ) RelinquishMagickMemory ( bluemap ) ; bluemap = ( int * ) AcquireQuantumMemory ( MagickMax ( colors , 65536 ) , sizeof ( * bluemap ) ) ; if ( bluemap == ( int * ) NULL ) ThrowDCMException ( ResourceLimitError , "MemoryAllocationFailed" ) ; ( void ) memset ( bluemap , 0 , MagickMax ( colors , 65536 ) * sizeof ( * bluemap ) ) ; p = data ; for ( i = 0 ; i < ( ssize_t ) colors ; i ++ ) { if ( image -> endian == MSBEndian ) index = ( unsigned short ) ( ( * p << 8 ) | * ( p + 1 ) ) ; else index = ( unsigned short ) ( * p | ( * ( p + 1 ) << 8 ) ) ; bluemap [ i ] = ( int ) index ; p += 2 ; } break ; } default : break ; } break ; } case 0x2050 : { switch ( element ) { case 0x0020 : { if ( ( data != ( unsigned char * ) NULL ) && ( strncmp ( ( char * ) data , "INVERSE" , 7 ) == 0 ) ) info . polarity = MagickTrue ; break ; } default : break ; } break ; } default : break ; } if ( data != ( unsigned char * ) NULL ) { char * attribute ; for ( i = 0 ; dicom_info [ i ] . description != ( char * ) NULL ; i ++ ) if ( ( group == dicom_info [ i ] . group ) && ( element == dicom_info [ i ] . element ) ) break ; if ( dicom_info [ i ] . description != ( char * ) NULL ) { attribute = AcquireString ( "dcm:" ) ; ( void ) ConcatenateString ( & attribute , dicom_info [ i ] . description ) ; for ( i = 0 ; i < ( ssize_t ) MagickMax ( length , 4 ) ; i ++ ) if ( isprint ( ( int ) data [ i ] ) == MagickFalse ) break ; if ( ( i == ( ssize_t ) length ) || ( length > 4 ) ) { ( void ) SubstituteString ( & attribute , "<S2SV_blank>" , "" ) ; ( void ) SetImageProperty ( image , attribute , ( char * ) data , exception ) ; } attribute = DestroyString ( attribute ) ; } } if ( image_info -> verbose != MagickFalse ) { if ( data == ( unsigned char * ) NULL ) ( void ) FormatLocaleFile ( stdout , "%d\\n" , datum ) ; else { for ( i = 0 ; i < ( ssize_t ) MagickMax ( length , 4 ) ; i ++ ) if ( isprint ( ( int ) data [ i ] ) == MagickFalse ) break ; if ( ( i != ( ssize_t ) length ) && ( length <= 4 ) ) { ssize_t j ; datum = 0 ; for ( j = ( ssize_t ) length - 1 ; j >= 0 ; j -- ) datum = ( 256 * datum + data [ j ] ) ; ( void ) FormatLocaleFile ( stdout , "%d" , datum ) ; } else for ( i = 0 ; i < ( ssize_t ) length ; i ++ ) if ( isprint ( ( int ) data [ i ] ) != MagickFalse ) ( void ) FormatLocaleFile ( stdout , "%c" , data [ i ] ) ; else ( void ) FormatLocaleFile ( stdout , "%c" , '.' ) ; ( void ) FormatLocaleFile ( stdout , "\\n" ) ; } } if ( data != ( unsigned char * ) NULL ) data = ( unsigned char * ) RelinquishMagickMemory ( data ) ; if ( EOFBlob ( image ) != MagickFalse ) { ThrowFileException ( exception , CorruptImageError , "UnexpectedEndOfFile" , image -> filename ) ; break ; } } if ( ( group == 0xfffc ) && ( element == 0xfffc ) ) { Image * last ; last = RemoveLastImageFromList ( & image ) ; if ( last != ( Image * ) NULL ) last = DestroyImage ( last ) ; break ; } if ( ( width == 0 ) || ( height == 0 ) ) ThrowDCMException ( CorruptImageError , "ImproperImageHeader" ) ; image -> columns = ( size_t ) width ; image -> rows = ( size_t ) height ; if ( info . signed_data == 0xffff ) info . signed_data = ( size_t ) ( info . significant_bits == 16 ? 1 : 0 ) ; if ( ( image -> compression == JPEGCompression ) || ( image -> compression == JPEG2000Compression ) ) { Image * images ; ImageInfo * read_info ; int c ; for ( i = 0 ; i < ( ssize_t ) stream_info -> remaining ; i ++ ) if ( ReadBlobByte ( image ) == EOF ) break ; ( void ) ( ( ( ssize_t ) ReadBlobLSBShort ( image ) << 16 ) | ReadBlobLSBShort ( image ) ) ; length = ( size_t ) ReadBlobLSBLong ( image ) ; if ( length > ( size_t ) GetBlobSize ( image ) ) ThrowDCMException ( CorruptImageError , "InsufficientImageDataInFile" ) ; stream_info -> offset_count = length >> 2 ; if ( stream_info -> offset_count != 0 ) { if ( stream_info -> offsets != ( ssize_t * ) NULL ) stream_info -> offsets = ( ssize_t * ) RelinquishMagickMemory ( stream_info -> offsets ) ; stream_info -> offsets = ( ssize_t * ) AcquireQuantumMemory ( stream_info -> offset_count , sizeof ( * stream_info -> offsets ) ) ; if ( stream_info -> offsets == ( ssize_t * ) NULL ) ThrowDCMException ( ResourceLimitError , "MemoryAllocationFailed" ) ; for ( i = 0 ; i < ( ssize_t ) stream_info -> offset_count ; i ++ ) stream_info -> offsets [ i ] = ( ssize_t ) ReadBlobLSBSignedLong ( image ) ; offset = TellBlob ( image ) ; for ( i = 0 ; i < ( ssize_t ) stream_info -> offset_count ; i ++ ) stream_info -> offsets [ i ] += offset ; } read_info = CloneImageInfo ( image_info ) ; SetImageInfoBlob ( read_info , ( void * ) NULL , 0 ) ; images = NewImageList ( ) ; for ( scene = 0 ; scene < ( ssize_t ) number_scenes ; scene ++ ) { char filename [ MagickPathExtent ] ; const char * property ; FILE * file ; Image * jpeg_image ; int unique_file ; unsigned int tag ; tag = ( ( unsigned int ) ReadBlobLSBShort ( image ) << 16 ) | ReadBlobLSBShort ( image ) ; length = ( size_t ) ReadBlobLSBLong ( image ) ; <S2SV_StartBug> if ( tag == 0xFFFEE0DD ) <S2SV_EndBug> break ; if ( tag != 0xFFFEE000 ) { read_info = DestroyImageInfo ( read_info ) ; ThrowDCMException ( CorruptImageError , "ImproperImageHeader" ) ; } file = ( FILE * ) NULL ; unique_file = AcquireUniqueFileResource ( filename ) ; if ( unique_file != - 1 ) file = fdopen ( unique_file , "wb" ) ; if ( file == ( FILE * ) NULL ) { ( void ) RelinquishUniqueFileResource ( filename ) ; ThrowFileException ( exception , FileOpenError , "UnableToCreateTemporaryFile" , filename ) ; break ; } for ( c = EOF ; length != 0 ; length -- ) { c = ReadBlobByte ( image ) ; if ( c == EOF ) { ThrowFileException ( exception , CorruptImageError , "UnexpectedEndOfFile" , image -> filename ) ; break ; } if ( fputc ( c , file ) != c ) break ; } ( void ) fclose ( file ) ; if ( c == EOF ) break ; ( void ) FormatLocaleString ( read_info -> filename , MagickPathExtent , "jpeg:%s" , filename ) ; if ( image -> compression == JPEG2000Compression ) ( void ) FormatLocaleString ( read_info -> filename , MagickPathExtent , "j2k:%s" , filename ) ; jpeg_image = ReadImage ( read_info , exception ) ; if ( jpeg_image != ( Image * ) NULL ) { ResetImagePropertyIterator ( image ) ; property = GetNextImageProperty ( image ) ; while ( property != ( const char * ) NULL ) { ( void ) SetImageProperty ( jpeg_image , property , GetImageProperty ( image , property , exception ) , exception ) ; property = GetNextImageProperty ( image ) ; } AppendImageToList ( & images , jpeg_image ) ; } ( void ) RelinquishUniqueFileResource ( filename ) ; } read_info = DestroyImageInfo ( read_info ) ; if ( stream_info -> offsets != ( ssize_t * ) NULL ) stream_info -> offsets = ( ssize_t * ) RelinquishMagickMemory ( stream_info -> offsets ) ; stream_info = ( DCMStreamInfo * ) RelinquishMagickMemory ( stream_info ) ; if ( info . scale != ( Quantum * ) NULL ) info . scale = ( Quantum * ) RelinquishMagickMemory ( info . scale ) ; if ( graymap != ( int * ) NULL ) graymap = ( int * ) RelinquishMagickMemory ( graymap ) ; if ( bluemap != ( int * ) NULL ) bluemap = ( int * ) RelinquishMagickMemory ( bluemap ) ; if ( greenmap != ( int * ) NULL ) greenmap = ( int * ) RelinquishMagickMemory ( greenmap ) ; if ( redmap != ( int * ) NULL ) redmap = ( int * ) RelinquishMagickMemory ( redmap ) ; image = DestroyImageList ( image ) ; return ( GetFirstImageInList ( images ) ) ; } if ( info . depth != ( 1UL * MAGICKCORE_QUANTUM_DEPTH ) ) { QuantumAny range ; length = ( size_t ) ( GetQuantumRange ( info . depth ) + 1 ) ; if ( length > ( size_t ) GetBlobSize ( image ) ) ThrowDCMException ( CorruptImageError , "InsufficientImageDataInFile" ) ; if ( info . scale != ( Quantum * ) NULL ) info . scale = ( Quantum * ) RelinquishMagickMemory ( info . scale ) ; info . scale = ( Quantum * ) AcquireQuantumMemory ( MagickMax ( length , 256 ) , sizeof ( * info . scale ) ) ; if ( info . scale == ( Quantum * ) NULL ) ThrowDCMException ( ResourceLimitError , "MemoryAllocationFailed" ) ; ( void ) memset ( info . scale , 0 , MagickMax ( length , 256 ) * sizeof ( * info . scale ) ) ; range = GetQuantumRange ( info . depth ) ; for ( i = 0 ; i <= ( ssize_t ) GetQuantumRange ( info . depth ) ; i ++ ) info . scale [ i ] = ScaleAnyToQuantum ( ( size_t ) i , range ) ; } if ( image -> compression == RLECompression ) { unsigned int tag ; for ( i = 0 ; i < ( ssize_t ) stream_info -> remaining ; i ++ ) { int c ; c = ReadBlobByte ( image ) ; if ( c == EOF ) break ; } tag = ( ( unsigned int ) ReadBlobLSBShort ( image ) << 16 ) | ReadBlobLSBShort ( image ) ; ( void ) tag ; length = ( size_t ) ReadBlobLSBLong ( image ) ; if ( length > ( size_t ) GetBlobSize ( image ) ) ThrowDCMException ( CorruptImageError , "InsufficientImageDataInFile" ) ; stream_info -> offset_count = length >> 2 ; if ( stream_info -> offset_count != 0 ) { if ( stream_info -> offsets != ( ssize_t * ) NULL ) stream_info -> offsets = ( ssize_t * ) RelinquishMagickMemory ( stream_info -> offsets ) ; stream_info -> offsets = ( ssize_t * ) AcquireQuantumMemory ( stream_info -> offset_count , sizeof ( * stream_info -> offsets ) ) ; if ( stream_info -> offsets == ( ssize_t * ) NULL ) ThrowDCMException ( ResourceLimitError , "MemoryAllocationFailed" ) ; for ( i = 0 ; i < ( ssize_t ) stream_info -> offset_count ; i ++ ) { stream_info -> offsets [ i ] = ( ssize_t ) ReadBlobLSBSignedLong ( image ) ; if ( EOFBlob ( image ) != MagickFalse ) break ; } offset = TellBlob ( image ) + 8 ; for ( i = 0 ; i < ( ssize_t ) stream_info -> offset_count ; i ++ ) stream_info -> offsets [ i ] += offset ; } } for ( scene = 0 ; scene < ( ssize_t ) number_scenes ; scene ++ ) { image -> columns = ( size_t ) width ; image -> rows = ( size_t ) height ; image -> depth = info . depth ; status = SetImageExtent ( image , image -> columns , image -> rows , exception ) ; if ( status == MagickFalse ) break ; image -> colorspace = RGBColorspace ; ( void ) SetImageBackgroundColor ( image , exception ) ; if ( ( image -> colormap == ( PixelInfo * ) NULL ) && ( info . samples_per_pixel == 1 ) ) { int index ; size_t one ; one = 1 ; if ( colors == 0 ) colors = one << info . depth ; if ( AcquireImageColormap ( image , colors , exception ) == MagickFalse ) ThrowDCMException ( ResourceLimitError , "MemoryAllocationFailed" ) ; if ( redmap != ( int * ) NULL ) for ( i = 0 ; i < ( ssize_t ) colors ; i ++ ) { index = redmap [ i ] ; if ( ( info . scale != ( Quantum * ) NULL ) && ( index >= 0 ) && ( index <= ( int ) info . max_value ) ) index = ( int ) info . scale [ index ] ; image -> colormap [ i ] . red = ( MagickRealType ) index ; } if ( greenmap != ( int * ) NULL ) for ( i = 0 ; i < ( ssize_t ) colors ; i ++ ) { index = greenmap [ i ] ; if ( ( info . scale != ( Quantum * ) NULL ) && ( index >= 0 ) && ( index <= ( int ) info . max_value ) ) index = ( int ) info . scale [ index ] ; image -> colormap [ i ] . green = ( MagickRealType ) index ; } if ( bluemap != ( int * ) NULL ) for ( i = 0 ; i < ( ssize_t ) colors ; i ++ ) { index = bluemap [ i ] ; if ( ( info . scale != ( Quantum * ) NULL ) && ( index >= 0 ) && ( index <= ( int ) info . max_value ) ) index = ( int ) info . scale [ index ] ; image -> colormap [ i ] . blue = ( MagickRealType ) index ; } if ( graymap != ( int * ) NULL ) for ( i = 0 ; i < ( ssize_t ) colors ; i ++ ) { index = graymap [ i ] ; if ( ( info . scale != ( Quantum * ) NULL ) && ( index >= 0 ) && ( index <= ( int ) info . max_value ) ) index = ( int ) info . scale [ index ] ; image -> colormap [ i ] . red = ( MagickRealType ) index ; image -> colormap [ i ] . green = ( MagickRealType ) index ; image -> colormap [ i ] . blue = ( MagickRealType ) index ; } } if ( image -> compression == RLECompression ) { unsigned int tag ; for ( i = 0 ; i < ( ssize_t ) stream_info -> remaining ; i ++ ) { int c ; c = ReadBlobByte ( image ) ; if ( c == EOF ) break ; } tag = ( ( unsigned int ) ReadBlobLSBShort ( image ) << 16 ) | ReadBlobLSBShort ( image ) ; stream_info -> remaining = ( size_t ) ReadBlobLSBLong ( image ) ; if ( ( tag != 0xFFFEE000 ) || ( stream_info -> remaining <= 64 ) || ( EOFBlob ( image ) != MagickFalse ) ) { if ( stream_info -> offsets != ( ssize_t * ) NULL ) stream_info -> offsets = ( ssize_t * ) RelinquishMagickMemory ( stream_info -> offsets ) ; ThrowDCMException ( CorruptImageError , "ImproperImageHeader" ) ; } stream_info -> count = 0 ; stream_info -> segment_count = ReadBlobLSBLong ( image ) ; for ( i = 0 ; i < 15 ; i ++ ) stream_info -> segments [ i ] = ( ssize_t ) ReadBlobLSBSignedLong ( image ) ; stream_info -> remaining -= 64 ; if ( stream_info -> segment_count > 1 ) { info . bytes_per_pixel = 1 ; info . depth = 8 ; if ( stream_info -> offset_count > 0 ) ( void ) SeekBlob ( image , ( MagickOffsetType ) stream_info -> offsets [ 0 ] + stream_info -> segments [ 0 ] , SEEK_SET ) ; } } if ( ( info . samples_per_pixel > 1 ) && ( image -> interlace == PlaneInterlace ) ) { register ssize_t x ; register Quantum * q ; ssize_t y ; for ( i = 0 ; i < ( ssize_t ) info . samples_per_pixel ; i ++ ) { for ( y = 0 ; y < ( ssize_t ) image -> rows ; y ++ ) { q = GetAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( Quantum * ) NULL ) break ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) { switch ( ( int ) i ) { case 0 : { SetPixelRed ( image , ScaleCharToQuantum ( ( unsigned char ) ReadDCMByte ( stream_info , image ) ) , q ) ; break ; } case 1 : { SetPixelGreen ( image , ScaleCharToQuantum ( ( unsigned char ) ReadDCMByte ( stream_info , image ) ) , q ) ; break ; } case 2 : { SetPixelBlue ( image , ScaleCharToQuantum ( ( unsigned char ) ReadDCMByte ( stream_info , image ) ) , q ) ; break ; } case 3 : { SetPixelAlpha ( image , ScaleCharToQuantum ( ( unsigned char ) ReadDCMByte ( stream_info , image ) ) , q ) ; break ; } default : break ; } q += GetPixelChannels ( image ) ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) y , image -> rows ) ; if ( status == MagickFalse ) break ; } } } } else { const char * option ; option = GetImageOption ( image_info , "dcm:display-range" ) ; if ( option != ( const char * ) NULL ) { if ( LocaleCompare ( option , "reset" ) == 0 ) info . window_width = 0 ; } option = GetImageOption ( image_info , "dcm:window" ) ; if ( option != ( char * ) NULL ) { GeometryInfo geometry_info ; MagickStatusType flags ; flags = ParseGeometry ( option , & geometry_info ) ; if ( flags & RhoValue ) info . window_center = geometry_info . rho ; if ( flags & SigmaValue ) info . window_width = geometry_info . sigma ; info . rescale = MagickTrue ; } option = GetImageOption ( image_info , "dcm:rescale" ) ; if ( option != ( char * ) NULL ) info . rescale = IsStringTrue ( option ) ; if ( ( info . window_center != 0 ) && ( info . window_width == 0 ) ) info . window_width = info . window_center ; status = ReadDCMPixels ( image , & info , stream_info , MagickTrue , exception ) ; if ( ( status != MagickFalse ) && ( stream_info -> segment_count > 1 ) ) { if ( stream_info -> offset_count > 0 ) ( void ) SeekBlob ( image , ( MagickOffsetType ) stream_info -> offsets [ 0 ] + stream_info -> segments [ 1 ] , SEEK_SET ) ; ( void ) ReadDCMPixels ( image , & info , stream_info , MagickFalse , exception ) ; } } if ( SetImageGray ( image , exception ) != MagickFalse ) ( void ) SetImageColorspace ( image , GRAYColorspace , exception ) ; if ( EOFBlob ( image ) != MagickFalse ) { ThrowFileException ( exception , CorruptImageError , "UnexpectedEndOfFile" , image -> filename ) ; break ; } if ( image_info -> number_scenes != 0 ) if ( image -> scene >= ( image_info -> scene + image_info -> number_scenes - 1 ) ) break ; if ( scene < ( ssize_t ) ( number_scenes - 1 ) ) { AcquireNextImage ( image_info , image , exception ) ; if ( GetNextImageInList ( image ) == ( Image * ) NULL ) { status = MagickFalse ; break ; } image = SyncNextImageInList ( image ) ; status = SetImageProgress ( image , LoadImagesTag , TellBlob ( image ) , GetBlobSize ( image ) ) ; if ( status == MagickFalse ) break ; } } if ( TellBlob ( image ) < ( MagickOffsetType ) GetBlobSize ( image ) ) { AcquireNextImage ( image_info , image , exception ) ; if ( GetNextImageInList ( image ) == ( Image * ) NULL ) { status = MagickFalse ; break ; } image = SyncNextImageInList ( image ) ; status = SetImageProgress ( image , LoadImagesTag , TellBlob ( image ) , GetBlobSize ( image ) ) ; if ( status == MagickFalse ) break ; } } if ( stream_info -> offsets != ( ssize_t * ) NULL ) stream_info -> offsets = ( ssize_t * ) RelinquishMagickMemory ( stream_info -> offsets ) ; stream_info = ( DCMStreamInfo * ) RelinquishMagickMemory ( stream_info ) ; if ( info . scale != ( Quantum * ) NULL ) info . scale = ( Quantum * ) RelinquishMagickMemory ( info . scale ) ; if ( graymap != ( int * ) NULL ) graymap = ( int * ) RelinquishMagickMemory ( graymap ) ; if ( bluemap != ( int * ) NULL ) bluemap = ( int * ) RelinquishMagickMemory ( bluemap ) ; if ( greenmap != ( int * ) NULL ) greenmap = ( int * ) RelinquishMagickMemory ( greenmap ) ; if ( redmap != ( int * ) NULL ) redmap = ( int * ) RelinquishMagickMemory ( redmap ) ; if ( image == ( Image * ) NULL ) return ( image ) ; ( void ) CloseBlob ( image ) ; if ( status == MagickFalse ) return ( DestroyImageList ( image ) ) ; return ( GetFirstImageInList ( image ) ) ; }
| <S2SV_ModStart> , message ) \\\n{ <S2SV_ModEnd> if ( info <S2SV_ModStart> ) ) ; \\\n} <S2SV_ModEnd> char explicit_vr [ <S2SV_ModStart> ; if ( length > ( size_t ) GetBlobSize ( image ) ) ThrowDCMException ( CorruptImageError , "InsufficientImageDataInFile" ) ; if (
| ImageMagick@ImageMagick/16916c8979c32765c542e216b31cee2671b7afe7 | CVE-2018-16644 | https://github.com/ImageMagick/ImageMagick/commit/16916c8979c32765c542e216b31cee2671b7afe7 | 2018-09-06T22:29Z |
208 | CWE-362 | CWE-362 static int smb_send_rqst ( struct TCP_Server_Info * server , struct smb_rqst * rqst ) { int rc ; struct kvec * iov = rqst -> rq_iov ; int n_vec = rqst -> rq_nvec ; unsigned int smb_buf_length = get_rfc1002_length ( iov [ 0 ] . iov_base ) ; unsigned int i ; size_t total_len = 0 , sent ; struct socket * ssocket = server -> ssocket ; <S2SV_StartBug> int val = 1 ; <S2SV_EndBug> cFYI ( 1 , "Sending<S2SV_blank>smb:<S2SV_blank>smb_len=%u" , smb_buf_length ) ; dump_smb ( iov [ 0 ] . iov_base , iov [ 0 ] . iov_len ) ; kernel_setsockopt ( ssocket , SOL_TCP , TCP_CORK , ( char * ) & val , sizeof ( val ) ) ; rc = smb_send_kvec ( server , iov , n_vec , & sent ) ; if ( rc < 0 ) goto uncork ; total_len += sent ; for ( i = 0 ; i < rqst -> rq_npages ; i ++ ) { struct kvec p_iov ; cifs_rqst_page_to_kvec ( rqst , i , & p_iov ) ; rc = smb_send_kvec ( server , & p_iov , 1 , & sent ) ; kunmap ( rqst -> rq_pages [ i ] ) ; if ( rc < 0 ) break ; total_len += sent ; } uncork : val = 0 ; kernel_setsockopt ( ssocket , SOL_TCP , TCP_CORK , ( char * ) & val , sizeof ( val ) ) ; if ( ( total_len > 0 ) && ( total_len != smb_buf_length + 4 ) ) { cFYI ( 1 , "partial<S2SV_blank>send<S2SV_blank>(wanted=%u<S2SV_blank>sent=%zu):<S2SV_blank>terminating<S2SV_blank>" "session" , smb_buf_length + 4 , total_len ) ; server -> tcpStatus = CifsNeedReconnect ; } if ( rc < 0 && rc != - EINTR ) cERROR ( 1 , "Error<S2SV_blank>%d<S2SV_blank>sending<S2SV_blank>data<S2SV_blank>on<S2SV_blank>socket<S2SV_blank>to<S2SV_blank>server" , rc ) ; else rc = 0 ; return rc ; }
| <S2SV_ModStart> val = 1 ; if ( ssocket == NULL ) return - ENOTSOCK
| torvalds@linux/ea702b80e0bbb2448e201472127288beb82ca2fe | CVE-2013-3302 | https://github.com/torvalds/linux/commit/ea702b80e0bbb2448e201472127288beb82ca2fe | 2013-04-29T14:55Z |
209 | CWE-354 | CWE-354 static void recovery_abort ( void ) { if ( ! dry_run ) { storage_reset ( ) ; <S2SV_StartBug> } <S2SV_EndBug> awaiting_character = false ; memzero ( mnemonic , sizeof ( mnemonic ) ) ; memzero ( cipher , sizeof ( cipher ) ) ; }
| <S2SV_ModStart> ) ; } recovery_started = false ;
| keepkey@keepkey-firmware/769714fcb569e7a4faff9530a2d9ac1f9d6e5680 | CVE-2019-18672 | https://github.com/keepkey/keepkey-firmware/commit/769714fcb569e7a4faff9530a2d9ac1f9d6e5680 | 2019-12-06T18:15Z |
210 | CWE-000 | CWE-000 static int list_tables ( MYSQL * mysql , const char * db , const char * table ) { const char * header ; uint head_length , counter = 0 ; <S2SV_StartBug> char query [ 255 ] , rows [ NAME_LEN ] , fields [ 16 ] ; <S2SV_EndBug> MYSQL_FIELD * field ; MYSQL_RES * result ; MYSQL_ROW row , rrow ; if ( mysql_select_db ( mysql , db ) ) { fprintf ( stderr , "%s:<S2SV_blank>Cannot<S2SV_blank>connect<S2SV_blank>to<S2SV_blank>db<S2SV_blank>%s:<S2SV_blank>%s\\n" , my_progname , db , mysql_error ( mysql ) ) ; return 1 ; } if ( table ) { mysql_real_escape_string ( mysql , rows , table , ( unsigned long ) strlen ( table ) ) ; my_snprintf ( query , sizeof ( query ) , "show%s<S2SV_blank>tables<S2SV_blank>like<S2SV_blank>\'%s\'" , opt_table_type ? "<S2SV_blank>full" : "" , rows ) ; } else my_snprintf ( query , sizeof ( query ) , "show%s<S2SV_blank>tables" , opt_table_type ? "<S2SV_blank>full" : "" ) ; if ( mysql_query ( mysql , query ) || ! ( result = mysql_store_result ( mysql ) ) ) { fprintf ( stderr , "%s:<S2SV_blank>Cannot<S2SV_blank>list<S2SV_blank>tables<S2SV_blank>in<S2SV_blank>%s:<S2SV_blank>%s\\n" , my_progname , db , mysql_error ( mysql ) ) ; exit ( 1 ) ; } printf ( "Database:<S2SV_blank>%s" , db ) ; if ( table ) printf ( "<S2SV_blank><S2SV_blank>Wildcard:<S2SV_blank>%s" , table ) ; putchar ( '\\n' ) ; header = "Tables" ; head_length = ( uint ) strlen ( header ) ; field = mysql_fetch_field ( result ) ; if ( head_length < field -> max_length ) head_length = field -> max_length ; if ( opt_table_type ) { if ( ! opt_verbose ) print_header ( header , head_length , "table_type" , 10 , NullS ) ; else if ( opt_verbose == 1 ) print_header ( header , head_length , "table_type" , 10 , "Columns" , 8 , NullS ) ; else { print_header ( header , head_length , "table_type" , 10 , "Columns" , 8 , "Total<S2SV_blank>Rows" , 10 , NullS ) ; } } else { if ( ! opt_verbose ) print_header ( header , head_length , NullS ) ; else if ( opt_verbose == 1 ) print_header ( header , head_length , "Columns" , 8 , NullS ) ; else print_header ( header , head_length , "Columns" , 8 , "Total<S2SV_blank>Rows" , 10 , NullS ) ; } while ( ( row = mysql_fetch_row ( result ) ) ) { counter ++ ; if ( opt_verbose > 0 ) { if ( ! ( mysql_select_db ( mysql , db ) ) ) { MYSQL_RES * rresult = mysql_list_fields ( mysql , row [ 0 ] , NULL ) ; ulong rowcount = 0L ; if ( ! rresult ) { strmov ( fields , "N/A" ) ; strmov ( rows , "N/A" ) ; } else { sprintf ( fields , "%8u" , ( uint ) mysql_num_fields ( rresult ) ) ; mysql_free_result ( rresult ) ; if ( opt_verbose > 1 ) { <S2SV_StartBug> sprintf ( query , "SELECT<S2SV_blank>COUNT(*)<S2SV_blank>FROM<S2SV_blank>`%s`" , row [ 0 ] ) ; <S2SV_EndBug> if ( ! ( mysql_query ( mysql , query ) ) ) { if ( ( rresult = mysql_store_result ( mysql ) ) ) { rrow = mysql_fetch_row ( rresult ) ; rowcount += ( unsigned long ) strtoull ( rrow [ 0 ] , ( char * * ) 0 , 10 ) ; mysql_free_result ( rresult ) ; } sprintf ( rows , "%10lu" , rowcount ) ; } else sprintf ( rows , "%10d" , 0 ) ; } } } else { strmov ( fields , "N/A" ) ; strmov ( rows , "N/A" ) ; } } if ( opt_table_type ) { if ( ! opt_verbose ) print_row ( row [ 0 ] , head_length , row [ 1 ] , 10 , NullS ) ; else if ( opt_verbose == 1 ) print_row ( row [ 0 ] , head_length , row [ 1 ] , 10 , fields , 8 , NullS ) ; else print_row ( row [ 0 ] , head_length , row [ 1 ] , 10 , fields , 8 , rows , 10 , NullS ) ; } else { if ( ! opt_verbose ) print_row ( row [ 0 ] , head_length , NullS ) ; else if ( opt_verbose == 1 ) print_row ( row [ 0 ] , head_length , fields , 8 , NullS ) ; else print_row ( row [ 0 ] , head_length , fields , 8 , rows , 10 , NullS ) ; } } print_trailer ( head_length , ( opt_table_type ? 10 : opt_verbose > 0 ? 8 : 0 ) , ( opt_table_type ? ( opt_verbose > 0 ? 8 : 0 ) : ( opt_verbose > 1 ? 10 : 0 ) ) , ! opt_table_type ? 0 : opt_verbose > 1 ? 10 : 0 , 0 ) ; if ( counter && opt_verbose ) printf ( "%u<S2SV_blank>row%s<S2SV_blank>in<S2SV_blank>set.\\n\\n" , counter , ( counter > 1 ) ? "s" : "" ) ; mysql_free_result ( result ) ; return 0 ; }
| <S2SV_ModStart> char query [ NAME_LEN + 100 <S2SV_ModEnd> ] , rows <S2SV_ModStart> 1 ) { my_snprintf <S2SV_ModEnd> ( query , <S2SV_ModStart> ( query , sizeof ( query ) ,
| mysql@mysql-server/0dbd5a8797ed4bd18e8b883988fb62177eb0f73f | CVE-2016-0546 | https://github.com/mysql/mysql-server/commit/0dbd5a8797ed4bd18e8b883988fb62177eb0f73f | 2016-01-21T03:01Z |
211 | CWE-264 | CWE-264 static int try_to_unmap_cluster ( unsigned long cursor , unsigned int * mapcount , struct vm_area_struct * vma , struct page * check_page ) { struct mm_struct * mm = vma -> vm_mm ; pmd_t * pmd ; pte_t * pte ; pte_t pteval ; spinlock_t * ptl ; struct page * page ; unsigned long address ; unsigned long mmun_start ; unsigned long mmun_end ; unsigned long end ; int ret = SWAP_AGAIN ; int locked_vma = 0 ; address = ( vma -> vm_start + cursor ) & CLUSTER_MASK ; end = address + CLUSTER_SIZE ; if ( address < vma -> vm_start ) address = vma -> vm_start ; if ( end > vma -> vm_end ) end = vma -> vm_end ; pmd = mm_find_pmd ( mm , address ) ; if ( ! pmd ) return ret ; mmun_start = address ; mmun_end = end ; mmu_notifier_invalidate_range_start ( mm , mmun_start , mmun_end ) ; if ( down_read_trylock ( & vma -> vm_mm -> mmap_sem ) ) { locked_vma = ( vma -> vm_flags & VM_LOCKED ) ; if ( ! locked_vma ) up_read ( & vma -> vm_mm -> mmap_sem ) ; } pte = pte_offset_map_lock ( mm , pmd , address , & ptl ) ; update_hiwater_rss ( mm ) ; for ( ; address < end ; pte ++ , address += PAGE_SIZE ) { if ( ! pte_present ( * pte ) ) continue ; page = vm_normal_page ( vma , address , * pte ) ; BUG_ON ( ! page || PageAnon ( page ) ) ; if ( locked_vma ) { <S2SV_StartBug> mlock_vma_page ( page ) ; <S2SV_EndBug> <S2SV_StartBug> if ( page == check_page ) <S2SV_EndBug> <S2SV_StartBug> ret = SWAP_MLOCK ; <S2SV_EndBug> continue ; } if ( ptep_clear_flush_young_notify ( vma , address , pte ) ) continue ; flush_cache_page ( vma , address , pte_pfn ( * pte ) ) ; pteval = ptep_clear_flush ( vma , address , pte ) ; if ( page -> index != linear_page_index ( vma , address ) ) { pte_t ptfile = pgoff_to_pte ( page -> index ) ; if ( pte_soft_dirty ( pteval ) ) pte_file_mksoft_dirty ( ptfile ) ; set_pte_at ( mm , address , pte , ptfile ) ; } if ( pte_dirty ( pteval ) ) set_page_dirty ( page ) ; page_remove_rmap ( page ) ; page_cache_release ( page ) ; dec_mm_counter ( mm , MM_FILEPAGES ) ; ( * mapcount ) -- ; } pte_unmap_unlock ( pte - 1 , ptl ) ; mmu_notifier_invalidate_range_end ( mm , mmun_start , mmun_end ) ; if ( locked_vma ) up_read ( & vma -> vm_mm -> mmap_sem ) ; return ret ; }
| <S2SV_ModStart> locked_vma ) { <S2SV_ModEnd> if ( page <S2SV_ModStart> == check_page ) { mlock_vma_page ( page ) ; <S2SV_ModStart> = SWAP_MLOCK ; } else if ( trylock_page ( page ) ) { mlock_vma_page ( page ) ; unlock_page ( page ) ; }
| torvalds@linux/57e68e9cd65b4b8eb4045a1e0d0746458502554c | CVE-2014-3122 | https://github.com/torvalds/linux/commit/57e68e9cd65b4b8eb4045a1e0d0746458502554c | 2014-05-11T21:55Z |
212 | CWE-476 | CWE-476 static int __rds_rdma_map ( struct rds_sock * rs , struct rds_get_mr_args * args , u64 * cookie_ret , struct rds_mr * * mr_ret ) { struct rds_mr * mr = NULL , * found ; unsigned int nr_pages ; struct page * * pages = NULL ; struct scatterlist * sg ; void * trans_private ; unsigned long flags ; rds_rdma_cookie_t cookie ; unsigned int nents ; long i ; int ret ; <S2SV_StartBug> if ( rs -> rs_bound_addr == 0 ) { <S2SV_EndBug> ret = - ENOTCONN ; goto out ; } if ( ! rs -> rs_transport -> get_mr ) { ret = - EOPNOTSUPP ; goto out ; } nr_pages = rds_pages_in_vec ( & args -> vec ) ; if ( nr_pages == 0 ) { ret = - EINVAL ; goto out ; } if ( ( nr_pages - 1 ) > ( RDS_MAX_MSG_SIZE >> PAGE_SHIFT ) ) { ret = - EMSGSIZE ; goto out ; } rdsdebug ( "RDS:<S2SV_blank>get_mr<S2SV_blank>addr<S2SV_blank>%llx<S2SV_blank>len<S2SV_blank>%llu<S2SV_blank>nr_pages<S2SV_blank>%u\\n" , args -> vec . addr , args -> vec . bytes , nr_pages ) ; pages = kcalloc ( nr_pages , sizeof ( struct page * ) , GFP_KERNEL ) ; if ( ! pages ) { ret = - ENOMEM ; goto out ; } mr = kzalloc ( sizeof ( struct rds_mr ) , GFP_KERNEL ) ; if ( ! mr ) { ret = - ENOMEM ; goto out ; } refcount_set ( & mr -> r_refcount , 1 ) ; RB_CLEAR_NODE ( & mr -> r_rb_node ) ; mr -> r_trans = rs -> rs_transport ; mr -> r_sock = rs ; if ( args -> flags & RDS_RDMA_USE_ONCE ) mr -> r_use_once = 1 ; if ( args -> flags & RDS_RDMA_INVALIDATE ) mr -> r_invalidate = 1 ; if ( args -> flags & RDS_RDMA_READWRITE ) mr -> r_write = 1 ; ret = rds_pin_pages ( args -> vec . addr , nr_pages , pages , 1 ) ; if ( ret < 0 ) goto out ; nents = ret ; sg = kcalloc ( nents , sizeof ( * sg ) , GFP_KERNEL ) ; if ( ! sg ) { ret = - ENOMEM ; goto out ; } WARN_ON ( ! nents ) ; sg_init_table ( sg , nents ) ; for ( i = 0 ; i < nents ; i ++ ) sg_set_page ( & sg [ i ] , pages [ i ] , PAGE_SIZE , 0 ) ; rdsdebug ( "RDS:<S2SV_blank>trans_private<S2SV_blank>nents<S2SV_blank>is<S2SV_blank>%u\\n" , nents ) ; trans_private = rs -> rs_transport -> get_mr ( sg , nents , rs , & mr -> r_key ) ; if ( IS_ERR ( trans_private ) ) { for ( i = 0 ; i < nents ; i ++ ) put_page ( sg_page ( & sg [ i ] ) ) ; kfree ( sg ) ; ret = PTR_ERR ( trans_private ) ; goto out ; } mr -> r_trans_private = trans_private ; rdsdebug ( "RDS:<S2SV_blank>get_mr<S2SV_blank>put_user<S2SV_blank>key<S2SV_blank>is<S2SV_blank>%x<S2SV_blank>cookie_addr<S2SV_blank>%p\\n" , mr -> r_key , ( void * ) ( unsigned long ) args -> cookie_addr ) ; cookie = rds_rdma_make_cookie ( mr -> r_key , args -> vec . addr & ~ PAGE_MASK ) ; if ( cookie_ret ) * cookie_ret = cookie ; if ( args -> cookie_addr && put_user ( cookie , ( u64 __user * ) ( unsigned long ) args -> cookie_addr ) ) { ret = - EFAULT ; goto out ; } spin_lock_irqsave ( & rs -> rs_rdma_lock , flags ) ; found = rds_mr_tree_walk ( & rs -> rs_rdma_keys , mr -> r_key , mr ) ; spin_unlock_irqrestore ( & rs -> rs_rdma_lock , flags ) ; BUG_ON ( found && found != mr ) ; rdsdebug ( "RDS:<S2SV_blank>get_mr<S2SV_blank>key<S2SV_blank>is<S2SV_blank>%x\\n" , mr -> r_key ) ; if ( mr_ret ) { refcount_inc ( & mr -> r_refcount ) ; * mr_ret = mr ; } ret = 0 ; out : kfree ( pages ) ; if ( mr ) rds_mr_put ( mr ) ; return ret ; }
| <S2SV_ModStart> rs_bound_addr == 0 || ! rs -> rs_transport
| torvalds@linux/f3069c6d33f6ae63a1668737bc78aaaa51bff7ca | CVE-2018-7492 | https://github.com/torvalds/linux/commit/f3069c6d33f6ae63a1668737bc78aaaa51bff7ca | 2018-02-26T20:29Z |
213 | CWE-189 | CWE-189 static void oz_usb_handle_ep_data ( struct oz_usb_ctx * usb_ctx , struct oz_usb_hdr * usb_hdr , int len ) { struct oz_data * data_hdr = ( struct oz_data * ) usb_hdr ; switch ( data_hdr -> format ) { case OZ_DATA_F_MULTIPLE_FIXED : { struct oz_multiple_fixed * body = ( struct oz_multiple_fixed * ) data_hdr ; u8 * data = body -> data ; <S2SV_StartBug> int n = ( len - sizeof ( struct oz_multiple_fixed ) + 1 ) <S2SV_EndBug> / body -> unit_size ; while ( n -- ) { oz_hcd_data_ind ( usb_ctx -> hport , body -> endpoint , data , body -> unit_size ) ; data += body -> unit_size ; } } break ; case OZ_DATA_F_ISOC_FIXED : { struct oz_isoc_fixed * body = ( struct oz_isoc_fixed * ) data_hdr ; int data_len = len - sizeof ( struct oz_isoc_fixed ) + 1 ; int unit_size = body -> unit_size ; u8 * data = body -> data ; int count ; int i ; if ( ! unit_size ) break ; count = data_len / unit_size ; for ( i = 0 ; i < count ; i ++ ) { oz_hcd_data_ind ( usb_ctx -> hport , body -> endpoint , data , unit_size ) ; data += unit_size ; } } break ; } }
| <S2SV_ModStart> ; int n ; if ( ! body -> unit_size ) break ; n
| torvalds@linux/04bf464a5dfd9ade0dda918e44366c2c61fce80b | CVE-2015-4003 | https://github.com/torvalds/linux/commit/04bf464a5dfd9ade0dda918e44366c2c61fce80b | 2015-06-07T23:59Z |
214 | CWE-787 | CWE-787 static char * get_object ( FILE * fp , int obj_id , const xref_t * xref , size_t * size , int * is_stream ) { static const int blk_sz = 256 ; int i , total_sz , read_sz , n_blks , search , stream ; size_t obj_sz ; char * c , * data ; long start ; const xref_entry_t * entry ; if ( size ) * size = 0 ; if ( is_stream ) * is_stream = 0 ; start = ftell ( fp ) ; entry = NULL ; for ( i = 0 ; i < xref -> n_entries ; i ++ ) if ( xref -> entries [ i ] . obj_id == obj_id ) { entry = & xref -> entries [ i ] ; break ; } if ( ! entry ) return NULL ; fseek ( fp , entry -> offset , SEEK_SET ) ; obj_sz = 0 ; total_sz = 0 ; n_blks = 1 ; <S2SV_StartBug> data = malloc ( blk_sz * n_blks ) ; <S2SV_EndBug> memset ( data , 0 , blk_sz * n_blks ) ; stream = 0 ; while ( ( read_sz = fread ( data + total_sz , 1 , blk_sz - 1 , fp ) ) && ! ferror ( fp ) ) { total_sz += read_sz ; * ( data + total_sz ) = '\\0' ; if ( total_sz + blk_sz >= ( blk_sz * n_blks ) ) data = realloc ( data , blk_sz * ( ++ n_blks ) ) ; search = total_sz - read_sz ; if ( search < 0 ) search = 0 ; if ( ( c = strstr ( data + search , "endobj" ) ) ) { * ( c + strlen ( "endobj" ) + 1 ) = '\\0' ; obj_sz = ( void * ) strstr ( data + search , "endobj" ) - ( void * ) data ; obj_sz += strlen ( "endobj" ) + 1 ; break ; } else if ( strstr ( data , "stream" ) ) stream = 1 ; } clearerr ( fp ) ; fseek ( fp , start , SEEK_SET ) ; if ( size ) * size = obj_sz ; if ( is_stream ) * is_stream = stream ; return data ; }
| <S2SV_ModStart> ; data = safe_calloc ( <S2SV_ModEnd> blk_sz * n_blks
| enferex@pdfresurrect/0c4120fffa3dffe97b95c486a120eded82afe8a6 | CVE-2019-14934 | https://github.com/enferex/pdfresurrect/commit/0c4120fffa3dffe97b95c486a120eded82afe8a6 | 2019-08-11T22:15Z |
215 | CWE-119 | CWE-119 <S2SV_StartBug> int vp8_denoiser_filter_sse2 ( YV12_BUFFER_CONFIG * mc_running_avg , <S2SV_EndBug> YV12_BUFFER_CONFIG * running_avg , MACROBLOCK * signal , unsigned int motion_magnitude , int y_offset , int uv_offset ) { <S2SV_StartBug> unsigned char * sig = signal -> thismb ; <S2SV_EndBug> int sig_stride = 16 ; <S2SV_StartBug> unsigned char * mc_running_avg_y = mc_running_avg -> y_buffer + y_offset ; <S2SV_EndBug> int mc_avg_y_stride = mc_running_avg -> y_stride ; <S2SV_StartBug> unsigned char * running_avg_y = running_avg -> y_buffer + y_offset ; <S2SV_EndBug> int avg_y_stride = running_avg -> y_stride ; int r ; <S2SV_StartBug> __m128i acc_diff = _mm_setzero_si128 ( ) ; <S2SV_EndBug> const __m128i k_0 = _mm_setzero_si128 ( ) ; const __m128i k_4 = _mm_set1_epi8 ( 4 ) ; const __m128i k_8 = _mm_set1_epi8 ( 8 ) ; const __m128i k_16 = _mm_set1_epi8 ( 16 ) ; const __m128i l3 = _mm_set1_epi8 ( <S2SV_StartBug> ( motion_magnitude <= MOTION_MAGNITUDE_THRESHOLD ) ? 7 : 6 ) ; <S2SV_EndBug> const __m128i l32 = _mm_set1_epi8 ( 2 ) ; const __m128i l21 = _mm_set1_epi8 ( 1 ) ; for ( r = 0 ; r < 16 ; ++ r ) { const __m128i v_sig = _mm_loadu_si128 ( ( __m128i * ) ( & sig [ 0 ] ) ) ; const __m128i v_mc_running_avg_y = _mm_loadu_si128 ( ( __m128i * ) ( & mc_running_avg_y [ 0 ] ) ) ; __m128i v_running_avg_y ; const __m128i pdiff = _mm_subs_epu8 ( v_mc_running_avg_y , v_sig ) ; const __m128i ndiff = _mm_subs_epu8 ( v_sig , v_mc_running_avg_y ) ; const __m128i diff_sign = _mm_cmpeq_epi8 ( pdiff , k_0 ) ; const __m128i clamped_absdiff = _mm_min_epu8 ( _mm_or_si128 ( pdiff , ndiff ) , k_16 ) ; const __m128i mask2 = _mm_cmpgt_epi8 ( k_16 , clamped_absdiff ) ; const __m128i mask1 = _mm_cmpgt_epi8 ( k_8 , clamped_absdiff ) ; const __m128i mask0 = _mm_cmpgt_epi8 ( k_4 , clamped_absdiff ) ; __m128i adj2 = _mm_and_si128 ( mask2 , l32 ) ; const __m128i adj1 = _mm_and_si128 ( mask1 , l21 ) ; const __m128i adj0 = _mm_and_si128 ( mask0 , clamped_absdiff ) ; __m128i adj , padj , nadj ; adj2 = _mm_add_epi8 ( adj2 , adj1 ) ; adj = _mm_sub_epi8 ( l3 , adj2 ) ; adj = _mm_andnot_si128 ( mask0 , adj ) ; adj = _mm_or_si128 ( adj , adj0 ) ; padj = _mm_andnot_si128 ( diff_sign , adj ) ; nadj = _mm_and_si128 ( diff_sign , adj ) ; v_running_avg_y = _mm_adds_epu8 ( v_sig , padj ) ; v_running_avg_y = _mm_subs_epu8 ( v_running_avg_y , nadj ) ; _mm_storeu_si128 ( ( __m128i * ) running_avg_y , v_running_avg_y ) ; acc_diff = _mm_adds_epi8 ( acc_diff , padj ) ; acc_diff = _mm_subs_epi8 ( acc_diff , nadj ) ; sig += sig_stride ; mc_running_avg_y += mc_avg_y_stride ; running_avg_y += avg_y_stride ; } { <S2SV_StartBug> union sum_union s ; <S2SV_EndBug> int sum_diff = 0 ; <S2SV_StartBug> s . v = acc_diff ; <S2SV_EndBug> <S2SV_StartBug> sum_diff = s . e [ 0 ] + s . e [ 1 ] + s . e [ 2 ] + s . e [ 3 ] + s . e [ 4 ] + s . e [ 5 ] <S2SV_EndBug> + s . e [ 6 ] + s . e [ 7 ] + s . e [ 8 ] + s . e [ 9 ] + s . e [ 10 ] + s . e [ 11 ] + s . e [ 12 ] + s . e [ 13 ] + s . e [ 14 ] + s . e [ 15 ] ; <S2SV_StartBug> if ( abs ( sum_diff ) > SUM_DIFF_THRESHOLD ) <S2SV_EndBug> { return COPY_BLOCK ; } <S2SV_StartBug> } <S2SV_EndBug> vp8_copy_mem16x16 ( running_avg -> y_buffer + y_offset , avg_y_stride , <S2SV_StartBug> signal -> thismb , sig_stride ) ; <S2SV_EndBug> return FILTER_BLOCK ; }
| <S2SV_ModStart> int vp8_denoiser_filter_sse2 ( <S2SV_ModEnd> unsigned char * <S2SV_ModStart> unsigned char * mc_running_avg_y , int mc_avg_y_stride , <S2SV_ModEnd> unsigned char * <S2SV_ModStart> unsigned char * running_avg_y , int avg_y_stride , <S2SV_ModEnd> unsigned char * <S2SV_ModStart> unsigned char * sig , int sig_stride , unsigned int motion_magnitude , int increase_denoising ) { unsigned char * running_avg_y_start = running_avg_y ; unsigned char * sig_start = sig ; unsigned int sum_diff_thresh <S2SV_ModEnd> ; int r <S2SV_ModStart> int r ; int shift_inc = ( increase_denoising && <S2SV_ModEnd> motion_magnitude <= MOTION_MAGNITUDE_THRESHOLD <S2SV_ModStart> MOTION_MAGNITUDE_THRESHOLD ) ? 1 : 0 ; __m128i acc_diff = _mm_setzero_si128 ( ) ; const __m128i k_0 = _mm_setzero_si128 ( ) ; const __m128i k_4 = _mm_set1_epi8 ( 4 + shift_inc ) ; const __m128i k_8 = _mm_set1_epi8 ( 8 ) ; const __m128i k_16 = _mm_set1_epi8 ( 16 ) ; const __m128i l3 = _mm_set1_epi8 ( ( motion_magnitude <= MOTION_MAGNITUDE_THRESHOLD ) ? 7 + shift_inc <S2SV_ModEnd> : 6 ) <S2SV_ModStart> ; } { unsigned int abs_sum_diff = abs_sum_diff_16x1 ( acc_diff ) ; sum_diff_thresh = SUM_DIFF_THRESHOLD ; if ( increase_denoising ) sum_diff_thresh = SUM_DIFF_THRESHOLD_HIGH ; if ( abs_sum_diff > sum_diff_thresh ) { int delta = ( ( abs_sum_diff - sum_diff_thresh ) >> 8 ) + 1 ; if ( delta < 4 ) { const __m128i k_delta = _mm_set1_epi8 ( delta ) ; sig -= sig_stride * 16 ; mc_running_avg_y -= mc_avg_y_stride * 16 ; running_avg_y -= avg_y_stride * 16 ; for ( r <S2SV_ModEnd> = 0 ; <S2SV_ModStart> = 0 ; r < 16 ; ++ r ) { __m128i v_running_avg_y = _mm_loadu_si128 ( ( __m128i * ) ( & running_avg_y <S2SV_ModEnd> [ 0 ] <S2SV_ModStart> [ 0 ] ) ) ; const __m128i v_sig = _mm_loadu_si128 ( ( __m128i * ) ( & sig [ 0 ] ) ) ; const __m128i v_mc_running_avg_y = _mm_loadu_si128 ( ( __m128i * ) ( & mc_running_avg_y [ 0 ] ) ) ; const __m128i pdiff = _mm_subs_epu8 ( v_mc_running_avg_y , v_sig ) ; const __m128i ndiff = _mm_subs_epu8 ( v_sig , v_mc_running_avg_y ) ; const __m128i diff_sign = _mm_cmpeq_epi8 ( pdiff , k_0 ) ; const __m128i adj = _mm_min_epu8 ( _mm_or_si128 ( pdiff , ndiff ) , k_delta ) ; __m128i padj , nadj ; padj = _mm_andnot_si128 ( diff_sign , adj ) ; nadj = _mm_and_si128 ( diff_sign , adj ) ; v_running_avg_y = _mm_subs_epu8 ( v_running_avg_y , padj ) ; v_running_avg_y = _mm_adds_epu8 ( v_running_avg_y , nadj ) ; _mm_storeu_si128 ( ( __m128i * ) running_avg_y , v_running_avg_y ) ; acc_diff = _mm_subs_epi8 ( acc_diff , padj ) ; acc_diff = _mm_adds_epi8 ( acc_diff , nadj ) ; sig += sig_stride ; mc_running_avg_y += mc_avg_y_stride ; running_avg_y += avg_y_stride ; } abs_sum_diff = abs_sum_diff_16x1 ( acc_diff ) <S2SV_ModEnd> ; if ( <S2SV_ModStart> ; if ( abs_sum_diff > sum_diff_thresh ) <S2SV_ModEnd> { return COPY_BLOCK <S2SV_ModStart> ; } } else { return COPY_BLOCK ; } } } vp8_copy_mem16x16 ( running_avg_y_start <S2SV_ModEnd> , avg_y_stride , <S2SV_ModStart> , avg_y_stride , sig_start <S2SV_ModEnd> , sig_stride )
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
216 | CWE-20 | CWE-20 static int __vcpu_run ( struct kvm_vcpu * vcpu ) { int r ; struct kvm * kvm = vcpu -> kvm ; vcpu -> srcu_idx = srcu_read_lock ( & kvm -> srcu ) ; <S2SV_StartBug> r = vapic_enter ( vcpu ) ; <S2SV_EndBug> if ( r ) { srcu_read_unlock ( & kvm -> srcu , vcpu -> srcu_idx ) ; return r ; } r = 1 ; while ( r > 0 ) { if ( vcpu -> arch . mp_state == KVM_MP_STATE_RUNNABLE && ! vcpu -> arch . apf . halted ) r = vcpu_enter_guest ( vcpu ) ; else { srcu_read_unlock ( & kvm -> srcu , vcpu -> srcu_idx ) ; kvm_vcpu_block ( vcpu ) ; vcpu -> srcu_idx = srcu_read_lock ( & kvm -> srcu ) ; if ( kvm_check_request ( KVM_REQ_UNHALT , vcpu ) ) { kvm_apic_accept_events ( vcpu ) ; switch ( vcpu -> arch . mp_state ) { case KVM_MP_STATE_HALTED : vcpu -> arch . pv . pv_unhalted = false ; vcpu -> arch . mp_state = KVM_MP_STATE_RUNNABLE ; case KVM_MP_STATE_RUNNABLE : vcpu -> arch . apf . halted = false ; break ; case KVM_MP_STATE_INIT_RECEIVED : break ; default : r = - EINTR ; break ; } } } if ( r <= 0 ) break ; clear_bit ( KVM_REQ_PENDING_TIMER , & vcpu -> requests ) ; if ( kvm_cpu_has_pending_timer ( vcpu ) ) kvm_inject_pending_timer_irqs ( vcpu ) ; if ( dm_request_for_irq_injection ( vcpu ) ) { r = - EINTR ; vcpu -> run -> exit_reason = KVM_EXIT_INTR ; ++ vcpu -> stat . request_irq_exits ; } kvm_check_async_pf_completion ( vcpu ) ; if ( signal_pending ( current ) ) { r = - EINTR ; vcpu -> run -> exit_reason = KVM_EXIT_INTR ; ++ vcpu -> stat . signal_exits ; } if ( need_resched ( ) ) { srcu_read_unlock ( & kvm -> srcu , vcpu -> srcu_idx ) ; kvm_resched ( vcpu ) ; vcpu -> srcu_idx = srcu_read_lock ( & kvm -> srcu ) ; } } srcu_read_unlock ( & kvm -> srcu , vcpu -> srcu_idx ) ; <S2SV_StartBug> vapic_exit ( vcpu ) ; <S2SV_EndBug> return r ; }
| <S2SV_ModStart> srcu ) ; <S2SV_ModEnd> r = 1 <S2SV_ModStart> srcu_idx ) ; <S2SV_ModEnd> return r ;
| torvalds@linux/fda4e2e85589191b123d31cdc21fd33ee70f50fd | CVE-2013-6368 | https://github.com/torvalds/linux/commit/fda4e2e85589191b123d31cdc21fd33ee70f50fd | 2013-12-14T18:08Z |
217 | CWE-400 | CWE-400 int __usb_get_extra_descriptor ( char * buffer , unsigned size , <S2SV_StartBug> unsigned char type , void * * ptr ) <S2SV_EndBug> { struct usb_descriptor_header * header ; while ( size >= sizeof ( struct usb_descriptor_header ) ) { header = ( struct usb_descriptor_header * ) buffer ; <S2SV_StartBug> if ( header -> bLength < 2 ) { <S2SV_EndBug> printk ( KERN_ERR "%s:<S2SV_blank>bogus<S2SV_blank>descriptor,<S2SV_blank>type<S2SV_blank>%d<S2SV_blank>length<S2SV_blank>%d\\n" , usbcore_name , header -> bDescriptorType , header -> bLength ) ; return - 1 ; } <S2SV_StartBug> if ( header -> bDescriptorType == type ) { <S2SV_EndBug> * ptr = header ; return 0 ; } buffer += header -> bLength ; size -= header -> bLength ; } return - 1 ; }
| <S2SV_ModStart> * * ptr , size_t minsize <S2SV_ModStart> bLength < 2 || header -> bLength > size <S2SV_ModStart> bDescriptorType == type && header -> bLength >= minsize
| torvalds@linux/704620afc70cf47abb9d6a1a57f3825d2bca49cf | CVE-2018-20169 | https://github.com/torvalds/linux/commit/704620afc70cf47abb9d6a1a57f3825d2bca49cf | 2018-12-17T07:29Z |
218 | CWE-119 | CWE-119 static void resize_multistep ( const uint8_t * const input , int length , uint8_t * output , int olength , uint8_t * buf ) { int steps ; if ( length == olength ) { <S2SV_StartBug> memcpy ( output , input , sizeof ( uint8_t ) * length ) ; <S2SV_EndBug> return ; } steps = get_down2_steps ( length , olength ) ; if ( steps > 0 ) { int s ; uint8_t * out = NULL ; uint8_t * tmpbuf = NULL ; uint8_t * otmp , * otmp2 ; int filteredlength = length ; if ( ! tmpbuf ) { tmpbuf = ( uint8_t * ) malloc ( sizeof ( uint8_t ) * length ) ; otmp = tmpbuf ; } else { otmp = buf ; } otmp2 = otmp + get_down2_length ( length , 1 ) ; for ( s = 0 ; s < steps ; ++ s ) { const int proj_filteredlength = get_down2_length ( filteredlength , 1 ) ; const uint8_t * const in = ( s == 0 ? input : out ) ; if ( s == steps - 1 && proj_filteredlength == olength ) out = output ; else out = ( s & 1 ? otmp2 : otmp ) ; if ( filteredlength & 1 ) down2_symodd ( in , filteredlength , out ) ; else down2_symeven ( in , filteredlength , out ) ; filteredlength = proj_filteredlength ; } if ( filteredlength != olength ) { interpolate ( out , filteredlength , output , olength ) ; } if ( tmpbuf ) free ( tmpbuf ) ; } else { interpolate ( input , length , output , olength ) ; } }
| <S2SV_ModStart> , sizeof ( output [ 0 ] <S2SV_ModEnd> ) * length
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
219 | CWE-125 | CWE-125 static void dhcp6opt_print ( netdissect_options * ndo , const u_char * cp , const u_char * ep ) { const struct dhcp6opt * dh6o ; const u_char * tp ; size_t i ; uint16_t opttype ; size_t optlen ; uint8_t auth_proto ; u_int authinfolen , authrealmlen ; int remain_len ; int label_len ; uint16_t subopt_code ; uint16_t subopt_len ; if ( cp == ep ) return ; while ( cp < ep ) { if ( ep < cp + sizeof ( * dh6o ) ) goto trunc ; dh6o = ( const struct dhcp6opt * ) cp ; ND_TCHECK ( * dh6o ) ; optlen = EXTRACT_16BITS ( & dh6o -> dh6opt_len ) ; if ( ep < cp + sizeof ( * dh6o ) + optlen ) goto trunc ; opttype = EXTRACT_16BITS ( & dh6o -> dh6opt_type ) ; ND_PRINT ( ( ndo , "<S2SV_blank>(%s" , tok2str ( dh6opt_str , "opt_%u" , opttype ) ) ) ; ND_TCHECK2 ( * ( cp + sizeof ( * dh6o ) ) , optlen ) ; switch ( opttype ) { case DH6OPT_CLIENTID : case DH6OPT_SERVERID : if ( optlen < 2 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; switch ( EXTRACT_16BITS ( tp ) ) { case 1 : if ( optlen >= 2 + 6 ) { ND_PRINT ( ( ndo , "<S2SV_blank>hwaddr/time<S2SV_blank>type<S2SV_blank>%u<S2SV_blank>time<S2SV_blank>%u<S2SV_blank>" , EXTRACT_16BITS ( & tp [ 2 ] ) , EXTRACT_32BITS ( & tp [ 4 ] ) ) ) ; for ( i = 8 ; i < optlen ; i ++ ) ND_PRINT ( ( ndo , "%02x" , tp [ i ] ) ) ; ND_PRINT ( ( ndo , ")" ) ) ; } else { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; } break ; case 2 : if ( optlen >= 2 + 8 ) { ND_PRINT ( ( ndo , "<S2SV_blank>vid<S2SV_blank>" ) ) ; for ( i = 2 ; i < 2 + 8 ; i ++ ) ND_PRINT ( ( ndo , "%02x" , tp [ i ] ) ) ; ND_PRINT ( ( ndo , ")" ) ) ; } else { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; } break ; case 3 : if ( optlen >= 2 + 2 ) { ND_PRINT ( ( ndo , "<S2SV_blank>hwaddr<S2SV_blank>type<S2SV_blank>%u<S2SV_blank>" , EXTRACT_16BITS ( & tp [ 2 ] ) ) ) ; for ( i = 4 ; i < optlen ; i ++ ) ND_PRINT ( ( ndo , "%02x" , tp [ i ] ) ) ; ND_PRINT ( ( ndo , ")" ) ) ; } else { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; } break ; default : ND_PRINT ( ( ndo , "<S2SV_blank>type<S2SV_blank>%d)" , EXTRACT_16BITS ( tp ) ) ) ; break ; } break ; case DH6OPT_IA_ADDR : if ( optlen < 24 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; ND_PRINT ( ( ndo , "<S2SV_blank>%s" , ip6addr_string ( ndo , & tp [ 0 ] ) ) ) ; ND_PRINT ( ( ndo , "<S2SV_blank>pltime:%u<S2SV_blank>vltime:%u" , EXTRACT_32BITS ( & tp [ 16 ] ) , EXTRACT_32BITS ( & tp [ 20 ] ) ) ) ; if ( optlen > 24 ) { dhcp6opt_print ( ndo , tp + 24 , tp + optlen ) ; } ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_ORO : case DH6OPT_ERO : if ( optlen % 2 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; for ( i = 0 ; i < optlen ; i += 2 ) { ND_PRINT ( ( ndo , "<S2SV_blank>%s" , tok2str ( dh6opt_str , "opt_%u" , EXTRACT_16BITS ( & tp [ i ] ) ) ) ) ; } ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_PREFERENCE : if ( optlen != 1 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; ND_PRINT ( ( ndo , "<S2SV_blank>%d)" , * tp ) ) ; break ; case DH6OPT_ELAPSED_TIME : if ( optlen != 2 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; ND_PRINT ( ( ndo , "<S2SV_blank>%d)" , EXTRACT_16BITS ( tp ) ) ) ; break ; case DH6OPT_RELAY_MSG : ND_PRINT ( ( ndo , "<S2SV_blank>(" ) ) ; tp = ( const u_char * ) ( dh6o + 1 ) ; dhcp6_print ( ndo , tp , optlen ) ; ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_AUTH : if ( optlen < 11 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; auth_proto = * tp ; switch ( auth_proto ) { case DH6OPT_AUTHPROTO_DELAYED : ND_PRINT ( ( ndo , "<S2SV_blank>proto:<S2SV_blank>delayed" ) ) ; break ; case DH6OPT_AUTHPROTO_RECONFIG : ND_PRINT ( ( ndo , "<S2SV_blank>proto:<S2SV_blank>reconfigure" ) ) ; break ; default : ND_PRINT ( ( ndo , "<S2SV_blank>proto:<S2SV_blank>%d" , auth_proto ) ) ; break ; } tp ++ ; switch ( * tp ) { case DH6OPT_AUTHALG_HMACMD5 : ND_PRINT ( ( ndo , ",<S2SV_blank>alg:<S2SV_blank>HMAC-MD5" ) ) ; break ; default : ND_PRINT ( ( ndo , ",<S2SV_blank>alg:<S2SV_blank>%d" , * tp ) ) ; break ; } tp ++ ; switch ( * tp ) { case DH6OPT_AUTHRDM_MONOCOUNTER : ND_PRINT ( ( ndo , ",<S2SV_blank>RDM:<S2SV_blank>mono" ) ) ; break ; default : ND_PRINT ( ( ndo , ",<S2SV_blank>RDM:<S2SV_blank>%d" , * tp ) ) ; break ; } tp ++ ; ND_PRINT ( ( ndo , ",<S2SV_blank>RD:" ) ) ; for ( i = 0 ; i < 4 ; i ++ , tp += 2 ) ND_PRINT ( ( ndo , "<S2SV_blank>%04x" , EXTRACT_16BITS ( tp ) ) ) ; authinfolen = optlen - 11 ; switch ( auth_proto ) { case DH6OPT_AUTHPROTO_DELAYED : if ( authinfolen == 0 ) break ; if ( authinfolen < 20 ) { ND_PRINT ( ( ndo , "<S2SV_blank>??" ) ) ; break ; } authrealmlen = authinfolen - 20 ; if ( authrealmlen > 0 ) { ND_PRINT ( ( ndo , ",<S2SV_blank>realm:<S2SV_blank>" ) ) ; } for ( i = 0 ; i < authrealmlen ; i ++ , tp ++ ) ND_PRINT ( ( ndo , "%02x" , * tp ) ) ; ND_PRINT ( ( ndo , ",<S2SV_blank>key<S2SV_blank>ID:<S2SV_blank>%08x" , EXTRACT_32BITS ( tp ) ) ) ; tp += 4 ; ND_PRINT ( ( ndo , ",<S2SV_blank>HMAC-MD5:" ) ) ; for ( i = 0 ; i < 4 ; i ++ , tp += 4 ) ND_PRINT ( ( ndo , "<S2SV_blank>%08x" , EXTRACT_32BITS ( tp ) ) ) ; break ; case DH6OPT_AUTHPROTO_RECONFIG : if ( authinfolen != 17 ) { ND_PRINT ( ( ndo , "<S2SV_blank>??" ) ) ; break ; } switch ( * tp ++ ) { case DH6OPT_AUTHRECONFIG_KEY : ND_PRINT ( ( ndo , "<S2SV_blank>reconfig-key" ) ) ; break ; case DH6OPT_AUTHRECONFIG_HMACMD5 : ND_PRINT ( ( ndo , "<S2SV_blank>type:<S2SV_blank>HMAC-MD5" ) ) ; break ; default : ND_PRINT ( ( ndo , "<S2SV_blank>type:<S2SV_blank>??" ) ) ; break ; } ND_PRINT ( ( ndo , "<S2SV_blank>value:" ) ) ; for ( i = 0 ; i < 4 ; i ++ , tp += 4 ) ND_PRINT ( ( ndo , "<S2SV_blank>%08x" , EXTRACT_32BITS ( tp ) ) ) ; break ; default : ND_PRINT ( ( ndo , "<S2SV_blank>??" ) ) ; break ; } ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_RAPID_COMMIT : ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_INTERFACE_ID : case DH6OPT_SUBSCRIBER_ID : tp = ( const u_char * ) ( dh6o + 1 ) ; ND_PRINT ( ( ndo , "<S2SV_blank>" ) ) ; for ( i = 0 ; i < optlen && i < 10 ; i ++ ) ND_PRINT ( ( ndo , "%02x" , tp [ i ] ) ) ; ND_PRINT ( ( ndo , "...)" ) ) ; break ; <S2SV_StartBug> case DH6OPT_RECONF_MSG : <S2SV_EndBug> tp = ( const u_char * ) ( dh6o + 1 ) ; switch ( * tp ) { case DH6_RENEW : ND_PRINT ( ( ndo , "<S2SV_blank>for<S2SV_blank>renew)" ) ) ; break ; case DH6_INFORM_REQ : ND_PRINT ( ( ndo , "<S2SV_blank>for<S2SV_blank>inf-req)" ) ) ; break ; default : ND_PRINT ( ( ndo , "<S2SV_blank>for<S2SV_blank>?\\?\\?(%02x))" , * tp ) ) ; break ; } break ; case DH6OPT_RECONF_ACCEPT : ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_SIP_SERVER_A : case DH6OPT_DNS_SERVERS : case DH6OPT_SNTP_SERVERS : case DH6OPT_NIS_SERVERS : case DH6OPT_NISP_SERVERS : case DH6OPT_BCMCS_SERVER_A : case DH6OPT_PANA_AGENT : case DH6OPT_LQ_CLIENT_LINK : if ( optlen % 16 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; for ( i = 0 ; i < optlen ; i += 16 ) ND_PRINT ( ( ndo , "<S2SV_blank>%s" , ip6addr_string ( ndo , & tp [ i ] ) ) ) ; ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_SIP_SERVER_D : case DH6OPT_DOMAIN_LIST : tp = ( const u_char * ) ( dh6o + 1 ) ; while ( tp < cp + sizeof ( * dh6o ) + optlen ) { ND_PRINT ( ( ndo , "<S2SV_blank>" ) ) ; if ( ( tp = ns_nprint ( ndo , tp , cp + sizeof ( * dh6o ) + optlen ) ) == NULL ) goto trunc ; } ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_STATUS_CODE : if ( optlen < 2 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; ND_PRINT ( ( ndo , "<S2SV_blank>%s)" , dhcp6stcode ( EXTRACT_16BITS ( & tp [ 0 ] ) ) ) ) ; break ; case DH6OPT_IA_NA : case DH6OPT_IA_PD : if ( optlen < 12 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; ND_PRINT ( ( ndo , "<S2SV_blank>IAID:%u<S2SV_blank>T1:%u<S2SV_blank>T2:%u" , EXTRACT_32BITS ( & tp [ 0 ] ) , EXTRACT_32BITS ( & tp [ 4 ] ) , EXTRACT_32BITS ( & tp [ 8 ] ) ) ) ; if ( optlen > 12 ) { dhcp6opt_print ( ndo , tp + 12 , tp + optlen ) ; } ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_IA_TA : if ( optlen < 4 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; ND_PRINT ( ( ndo , "<S2SV_blank>IAID:%u" , EXTRACT_32BITS ( tp ) ) ) ; if ( optlen > 4 ) { dhcp6opt_print ( ndo , tp + 4 , tp + optlen ) ; } ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_IA_PD_PREFIX : if ( optlen < 25 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; ND_PRINT ( ( ndo , "<S2SV_blank>%s/%d" , ip6addr_string ( ndo , & tp [ 9 ] ) , tp [ 8 ] ) ) ; ND_PRINT ( ( ndo , "<S2SV_blank>pltime:%u<S2SV_blank>vltime:%u" , EXTRACT_32BITS ( & tp [ 0 ] ) , EXTRACT_32BITS ( & tp [ 4 ] ) ) ) ; if ( optlen > 25 ) { dhcp6opt_print ( ndo , tp + 25 , tp + optlen ) ; } ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_LIFETIME : case DH6OPT_CLT_TIME : if ( optlen != 4 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; ND_PRINT ( ( ndo , "<S2SV_blank>%d)" , EXTRACT_32BITS ( tp ) ) ) ; break ; case DH6OPT_REMOTE_ID : if ( optlen < 4 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; ND_PRINT ( ( ndo , "<S2SV_blank>%d<S2SV_blank>" , EXTRACT_32BITS ( tp ) ) ) ; for ( i = 4 ; i < optlen && i < 14 ; i ++ ) ND_PRINT ( ( ndo , "%02x" , tp [ i ] ) ) ; ND_PRINT ( ( ndo , "...)" ) ) ; break ; case DH6OPT_LQ_QUERY : if ( optlen < 17 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; switch ( * tp ) { case 1 : ND_PRINT ( ( ndo , "<S2SV_blank>by-address" ) ) ; break ; case 2 : ND_PRINT ( ( ndo , "<S2SV_blank>by-clientID" ) ) ; break ; default : ND_PRINT ( ( ndo , "<S2SV_blank>type_%d" , ( int ) * tp ) ) ; break ; } ND_PRINT ( ( ndo , "<S2SV_blank>%s" , ip6addr_string ( ndo , & tp [ 1 ] ) ) ) ; if ( optlen > 17 ) { dhcp6opt_print ( ndo , tp + 17 , tp + optlen ) ; } ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_CLIENT_DATA : tp = ( const u_char * ) ( dh6o + 1 ) ; if ( optlen > 0 ) { dhcp6opt_print ( ndo , tp , tp + optlen ) ; } ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_LQ_RELAY_DATA : if ( optlen < 16 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; ND_PRINT ( ( ndo , "<S2SV_blank>%s<S2SV_blank>" , ip6addr_string ( ndo , & tp [ 0 ] ) ) ) ; for ( i = 16 ; i < optlen && i < 26 ; i ++ ) ND_PRINT ( ( ndo , "%02x" , tp [ i ] ) ) ; ND_PRINT ( ( ndo , "...)" ) ) ; break ; case DH6OPT_NTP_SERVER : if ( optlen < 4 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; while ( tp < cp + sizeof ( * dh6o ) + optlen - 4 ) { subopt_code = EXTRACT_16BITS ( tp ) ; tp += 2 ; subopt_len = EXTRACT_16BITS ( tp ) ; tp += 2 ; if ( tp + subopt_len > cp + sizeof ( * dh6o ) + optlen ) goto trunc ; ND_PRINT ( ( ndo , "<S2SV_blank>subopt:%d" , subopt_code ) ) ; switch ( subopt_code ) { case DH6OPT_NTP_SUBOPTION_SRV_ADDR : case DH6OPT_NTP_SUBOPTION_MC_ADDR : if ( subopt_len != 16 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?" ) ) ; break ; } ND_PRINT ( ( ndo , "<S2SV_blank>%s" , ip6addr_string ( ndo , & tp [ 0 ] ) ) ) ; break ; case DH6OPT_NTP_SUBOPTION_SRV_FQDN : ND_PRINT ( ( ndo , "<S2SV_blank>" ) ) ; if ( ns_nprint ( ndo , tp , tp + subopt_len ) == NULL ) goto trunc ; break ; default : ND_PRINT ( ( ndo , "<S2SV_blank>?" ) ) ; break ; } tp += subopt_len ; } ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_AFTR_NAME : if ( optlen < 3 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; remain_len = optlen ; ND_PRINT ( ( ndo , "<S2SV_blank>" ) ) ; while ( remain_len && * tp ) { label_len = * tp ++ ; if ( label_len < remain_len - 1 ) { ( void ) fn_printn ( ndo , tp , label_len , NULL ) ; tp += label_len ; remain_len -= ( label_len + 1 ) ; if ( * tp ) ND_PRINT ( ( ndo , "." ) ) ; } else { ND_PRINT ( ( ndo , "<S2SV_blank>?" ) ) ; break ; } } ND_PRINT ( ( ndo , ")" ) ) ; break ; case DH6OPT_NEW_POSIX_TIMEZONE : case DH6OPT_NEW_TZDB_TIMEZONE : case DH6OPT_MUDURL : if ( optlen < 5 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; } tp = ( const u_char * ) ( dh6o + 1 ) ; ND_PRINT ( ( ndo , "=" ) ) ; ( void ) fn_printn ( ndo , tp , ( u_int ) optlen , NULL ) ; ND_PRINT ( ( ndo , ")" ) ) ; break ; default : ND_PRINT ( ( ndo , ")" ) ) ; break ; } cp += sizeof ( * dh6o ) + optlen ; } return ; trunc : ND_PRINT ( ( ndo , "[|dhcp6ext]" ) ) ; }
| <S2SV_ModStart> case DH6OPT_RECONF_MSG : if ( optlen != 1 ) { ND_PRINT ( ( ndo , "<S2SV_blank>?)" ) ) ; break ; }
| the-tcpdump-group@tcpdump/11b426ee05eb62ed103218526f1fa616851c43ce | CVE-2017-13017 | https://github.com/the-tcpdump-group/tcpdump/commit/11b426ee05eb62ed103218526f1fa616851c43ce | 2017-09-14T06:29Z |
220 | CWE-416 | CWE-416 static void sunkbd_reinit ( struct work_struct * work ) { struct sunkbd * sunkbd = container_of ( work , struct sunkbd , tq ) ; <S2SV_StartBug> wait_event_interruptible_timeout ( sunkbd -> wait , sunkbd -> reset >= 0 , HZ ) ; <S2SV_EndBug> <S2SV_StartBug> serio_write ( sunkbd -> serio , SUNKBD_CMD_SETLED ) ; <S2SV_EndBug> serio_write ( sunkbd -> serio , ( ! ! test_bit ( LED_CAPSL , sunkbd -> dev -> led ) << 3 ) | ( ! ! test_bit ( LED_SCROLLL , sunkbd -> dev -> led ) << 2 ) | ( ! ! test_bit ( LED_COMPOSE , sunkbd -> dev -> led ) << 1 ) | ! ! test_bit ( LED_NUML , sunkbd -> dev -> led ) ) ; serio_write ( sunkbd -> serio , SUNKBD_CMD_NOCLICK - ! ! test_bit ( SND_CLICK , sunkbd -> dev -> snd ) ) ; serio_write ( sunkbd -> serio , SUNKBD_CMD_BELLOFF - ! ! test_bit ( SND_BELL , sunkbd -> dev -> snd ) ) ; }
| <S2SV_ModStart> reset >= 0 || ! sunkbd -> enabled <S2SV_ModStart> HZ ) ; if <S2SV_ModEnd> ( sunkbd -> <S2SV_ModStart> ( sunkbd -> reset >= 0 && sunkbd -> enabled ) sunkbd_set_leds_beeps ( sunkbd <S2SV_ModEnd> ) ; }
| torvalds@linux/77e70d351db7de07a46ac49b87a6c3c7a60fca7e | CVE-2020-25669 | https://github.com/torvalds/linux/commit/77e70d351db7de07a46ac49b87a6c3c7a60fca7e | 2021-05-26T12:15Z |
221 | CWE-772 | CWE-772 static Image * ReadMATImage ( const ImageInfo * image_info , ExceptionInfo * exception ) { Image * image , * image2 = NULL , * rotated_image ; register Quantum * q ; unsigned int status ; MATHeader MATLAB_HDR ; size_t size ; size_t CellType ; QuantumInfo * quantum_info ; ImageInfo * clone_info ; int i ; ssize_t ldblk ; unsigned char * BImgBuff = NULL ; double MinVal , MaxVal ; unsigned z , z2 ; unsigned Frames ; int logging ; int sample_size ; MagickOffsetType filepos = 0x80 ; BlobInfo * blob ; size_t one ; unsigned int ( * ReadBlobXXXLong ) ( Image * image ) ; unsigned short ( * ReadBlobXXXShort ) ( Image * image ) ; void ( * ReadBlobDoublesXXX ) ( Image * image , size_t len , double * data ) ; void ( * ReadBlobFloatsXXX ) ( Image * image , size_t len , float * data ) ; assert ( image_info != ( const ImageInfo * ) NULL ) ; assert ( image_info -> signature == MagickCoreSignature ) ; assert ( exception != ( ExceptionInfo * ) NULL ) ; assert ( exception -> signature == MagickCoreSignature ) ; logging = LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "enter" ) ; image = AcquireImage ( image_info , exception ) ; status = OpenBlob ( image_info , image , ReadBinaryBlobMode , exception ) ; if ( status == MagickFalse ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } quantum_info = ( QuantumInfo * ) NULL ; clone_info = ( ImageInfo * ) NULL ; if ( ReadBlob ( image , 124 , ( unsigned char * ) & MATLAB_HDR . identific ) != 124 ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; if ( strncmp ( MATLAB_HDR . identific , "MATLAB" , 6 ) != 0 ) { image2 = ReadMATImageV4 ( image_info , image , exception ) ; if ( image2 == NULL ) goto MATLAB_KO ; image = image2 ; goto END_OF_READING ; } MATLAB_HDR . Version = ReadBlobLSBShort ( image ) ; if ( ReadBlob ( image , 2 , ( unsigned char * ) & MATLAB_HDR . EndianIndicator ) != 2 ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; if ( logging ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Endian<S2SV_blank>%c%c" , MATLAB_HDR . EndianIndicator [ 0 ] , MATLAB_HDR . EndianIndicator [ 1 ] ) ; if ( ! strncmp ( MATLAB_HDR . EndianIndicator , "IM" , 2 ) ) { ReadBlobXXXLong = ReadBlobLSBLong ; ReadBlobXXXShort = ReadBlobLSBShort ; ReadBlobDoublesXXX = ReadBlobDoublesLSB ; ReadBlobFloatsXXX = ReadBlobFloatsLSB ; image -> endian = LSBEndian ; } else if ( ! strncmp ( MATLAB_HDR . EndianIndicator , "MI" , 2 ) ) { ReadBlobXXXLong = ReadBlobMSBLong ; ReadBlobXXXShort = ReadBlobMSBShort ; ReadBlobDoublesXXX = ReadBlobDoublesMSB ; ReadBlobFloatsXXX = ReadBlobFloatsMSB ; image -> endian = MSBEndian ; } else goto MATLAB_KO ; if ( strncmp ( MATLAB_HDR . identific , "MATLAB" , 6 ) ) <S2SV_StartBug> MATLAB_KO : ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; <S2SV_EndBug> filepos = TellBlob ( image ) ; while ( ! EOFBlob ( image ) ) { Frames = 1 ; ( void ) SeekBlob ( image , filepos , SEEK_SET ) ; MATLAB_HDR . DataType = ReadBlobXXXLong ( image ) ; if ( EOFBlob ( image ) ) break ; MATLAB_HDR . ObjectSize = ReadBlobXXXLong ( image ) ; if ( EOFBlob ( image ) ) break ; if ( MATLAB_HDR . ObjectSize + filepos > GetBlobSize ( image ) ) goto MATLAB_KO ; filepos += MATLAB_HDR . ObjectSize + 4 + 4 ; clone_info = CloneImageInfo ( image_info ) ; image2 = image ; # if defined ( MAGICKCORE_ZLIB_DELEGATE ) if ( MATLAB_HDR . DataType == miCOMPRESSED ) { image2 = decompress_block ( image , & MATLAB_HDR . ObjectSize , clone_info , exception ) ; if ( image2 == NULL ) continue ; MATLAB_HDR . DataType = ReadBlobXXXLong ( image2 ) ; } # endif if ( MATLAB_HDR . DataType != miMATRIX ) continue ; MATLAB_HDR . unknown1 = ReadBlobXXXLong ( image2 ) ; MATLAB_HDR . unknown2 = ReadBlobXXXLong ( image2 ) ; MATLAB_HDR . unknown5 = ReadBlobXXXLong ( image2 ) ; MATLAB_HDR . StructureClass = MATLAB_HDR . unknown5 & 0xFF ; MATLAB_HDR . StructureFlag = ( MATLAB_HDR . unknown5 >> 8 ) & 0xFF ; MATLAB_HDR . unknown3 = ReadBlobXXXLong ( image2 ) ; if ( image != image2 ) MATLAB_HDR . unknown4 = ReadBlobXXXLong ( image2 ) ; MATLAB_HDR . unknown4 = ReadBlobXXXLong ( image2 ) ; MATLAB_HDR . DimFlag = ReadBlobXXXLong ( image2 ) ; MATLAB_HDR . SizeX = ReadBlobXXXLong ( image2 ) ; MATLAB_HDR . SizeY = ReadBlobXXXLong ( image2 ) ; switch ( MATLAB_HDR . DimFlag ) { case 8 : z2 = z = 1 ; break ; case 12 : z2 = z = ReadBlobXXXLong ( image2 ) ; ( void ) ReadBlobXXXLong ( image2 ) ; if ( z != 3 ) ThrowReaderException ( CoderError , "MultidimensionalMatricesAreNotSupported" ) ; break ; case 16 : z2 = z = ReadBlobXXXLong ( image2 ) ; if ( z != 3 && z != 1 ) ThrowReaderException ( CoderError , "MultidimensionalMatricesAreNotSupported" ) ; Frames = ReadBlobXXXLong ( image2 ) ; if ( Frames == 0 ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; break ; default : ThrowReaderException ( CoderError , "MultidimensionalMatricesAreNotSupported" ) ; } MATLAB_HDR . Flag1 = ReadBlobXXXShort ( image2 ) ; MATLAB_HDR . NameFlag = ReadBlobXXXShort ( image2 ) ; if ( logging ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "MATLAB_HDR.StructureClass<S2SV_blank>%d" , MATLAB_HDR . StructureClass ) ; if ( MATLAB_HDR . StructureClass != mxCHAR_CLASS && MATLAB_HDR . StructureClass != mxSINGLE_CLASS && MATLAB_HDR . StructureClass != mxDOUBLE_CLASS && MATLAB_HDR . StructureClass != mxINT8_CLASS && MATLAB_HDR . StructureClass != mxUINT8_CLASS && MATLAB_HDR . StructureClass != mxINT16_CLASS && MATLAB_HDR . StructureClass != mxUINT16_CLASS && MATLAB_HDR . StructureClass != mxINT32_CLASS && MATLAB_HDR . StructureClass != mxUINT32_CLASS && MATLAB_HDR . StructureClass != mxINT64_CLASS && MATLAB_HDR . StructureClass != mxUINT64_CLASS ) ThrowReaderException ( CoderError , "UnsupportedCellTypeInTheMatrix" ) ; switch ( MATLAB_HDR . NameFlag ) { case 0 : size = ReadBlobXXXLong ( image2 ) ; size = 4 * ( ssize_t ) ( ( size + 3 + 1 ) / 4 ) ; ( void ) SeekBlob ( image2 , size , SEEK_CUR ) ; break ; case 1 : case 2 : case 3 : case 4 : ( void ) ReadBlob ( image2 , 4 , ( unsigned char * ) & size ) ; break ; default : goto MATLAB_KO ; } CellType = ReadBlobXXXLong ( image2 ) ; if ( logging ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "MATLAB_HDR.CellType:<S2SV_blank>%.20g" , ( double ) CellType ) ; ( void ) ReadBlob ( image2 , 4 , ( unsigned char * ) & size ) ; NEXT_FRAME : switch ( CellType ) { case miINT8 : case miUINT8 : sample_size = 8 ; if ( MATLAB_HDR . StructureFlag & FLAG_LOGICAL ) image -> depth = 1 ; else image -> depth = 8 ; ldblk = ( ssize_t ) MATLAB_HDR . SizeX ; break ; case miINT16 : case miUINT16 : sample_size = 16 ; image -> depth = 16 ; ldblk = ( ssize_t ) ( 2 * MATLAB_HDR . SizeX ) ; break ; case miINT32 : case miUINT32 : sample_size = 32 ; image -> depth = 32 ; ldblk = ( ssize_t ) ( 4 * MATLAB_HDR . SizeX ) ; break ; case miINT64 : case miUINT64 : sample_size = 64 ; image -> depth = 64 ; ldblk = ( ssize_t ) ( 8 * MATLAB_HDR . SizeX ) ; break ; case miSINGLE : sample_size = 32 ; image -> depth = 32 ; ( void ) SetImageOption ( clone_info , "quantum:format" , "floating-point" ) ; if ( MATLAB_HDR . StructureFlag & FLAG_COMPLEX ) { } ldblk = ( ssize_t ) ( 4 * MATLAB_HDR . SizeX ) ; break ; case miDOUBLE : sample_size = 64 ; image -> depth = 64 ; ( void ) SetImageOption ( clone_info , "quantum:format" , "floating-point" ) ; DisableMSCWarning ( 4127 ) if ( sizeof ( double ) != 8 ) RestoreMSCWarning ThrowReaderException ( CoderError , "IncompatibleSizeOfDouble" ) ; if ( MATLAB_HDR . StructureFlag & FLAG_COMPLEX ) { } ldblk = ( ssize_t ) ( 8 * MATLAB_HDR . SizeX ) ; break ; default : ThrowReaderException ( CoderError , "UnsupportedCellTypeInTheMatrix" ) ; } ( void ) sample_size ; image -> columns = MATLAB_HDR . SizeX ; image -> rows = MATLAB_HDR . SizeY ; one = 1 ; image -> colors = one << image -> depth ; if ( image -> columns == 0 || image -> rows == 0 ) goto MATLAB_KO ; if ( ( unsigned long ) ldblk * MATLAB_HDR . SizeY > MATLAB_HDR . ObjectSize ) goto MATLAB_KO ; if ( ( MATLAB_HDR . DimFlag == 8 ) && ( ( MATLAB_HDR . StructureFlag & FLAG_COMPLEX ) == 0 ) ) { image -> type = GrayscaleType ; SetImageColorspace ( image , GRAYColorspace , exception ) ; } if ( image_info -> ping ) { size_t temp = image -> columns ; image -> columns = image -> rows ; image -> rows = temp ; goto done_reading ; } status = SetImageExtent ( image , image -> columns , image -> rows , exception ) ; if ( status == MagickFalse ) return ( DestroyImageList ( image ) ) ; quantum_info = AcquireQuantumInfo ( clone_info , image ) ; if ( quantum_info == ( QuantumInfo * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; BImgBuff = ( unsigned char * ) AcquireQuantumMemory ( ( size_t ) ( ldblk ) , sizeof ( double ) ) ; if ( BImgBuff == NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; ( void ) ResetMagickMemory ( BImgBuff , 0 , ldblk * sizeof ( double ) ) ; MinVal = 0 ; MaxVal = 0 ; if ( CellType == miDOUBLE || CellType == miSINGLE ) { CalcMinMax ( image2 , image_info -> endian , MATLAB_HDR . SizeX , MATLAB_HDR . SizeY , CellType , ldblk , BImgBuff , & quantum_info -> minimum , & quantum_info -> maximum ) ; } if ( z == 1 ) z = 0 ; do { for ( i = 0 ; i < ( ssize_t ) MATLAB_HDR . SizeY ; i ++ ) { q = GetAuthenticPixels ( image , 0 , MATLAB_HDR . SizeY - i - 1 , image -> columns , 1 , exception ) ; if ( q == ( Quantum * ) NULL ) { if ( logging ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>MAT<S2SV_blank>set<S2SV_blank>image<S2SV_blank>pixels<S2SV_blank>returns<S2SV_blank>unexpected<S2SV_blank>NULL<S2SV_blank>on<S2SV_blank>a<S2SV_blank>row<S2SV_blank>%u." , ( unsigned ) ( MATLAB_HDR . SizeY - i - 1 ) ) ; goto done_reading ; } if ( ReadBlob ( image2 , ldblk , ( unsigned char * ) BImgBuff ) != ( ssize_t ) ldblk ) { if ( logging ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>MAT<S2SV_blank>cannot<S2SV_blank>read<S2SV_blank>scanrow<S2SV_blank>%u<S2SV_blank>from<S2SV_blank>a<S2SV_blank>file." , ( unsigned ) ( MATLAB_HDR . SizeY - i - 1 ) ) ; goto ExitLoop ; } if ( ( CellType == miINT8 || CellType == miUINT8 ) && ( MATLAB_HDR . StructureFlag & FLAG_LOGICAL ) ) { FixLogical ( ( unsigned char * ) BImgBuff , ldblk ) ; if ( ImportQuantumPixels ( image , ( CacheView * ) NULL , quantum_info , z2qtype [ z ] , BImgBuff , exception ) <= 0 ) { ImportQuantumPixelsFailed : if ( logging ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>MAT<S2SV_blank>failed<S2SV_blank>to<S2SV_blank>ImportQuantumPixels<S2SV_blank>for<S2SV_blank>a<S2SV_blank>row<S2SV_blank>%u" , ( unsigned ) ( MATLAB_HDR . SizeY - i - 1 ) ) ; break ; } } else { if ( ImportQuantumPixels ( image , ( CacheView * ) NULL , quantum_info , z2qtype [ z ] , BImgBuff , exception ) <= 0 ) goto ImportQuantumPixelsFailed ; if ( z <= 1 && ( CellType == miINT8 || CellType == miINT16 || CellType == miINT32 || CellType == miINT64 ) ) FixSignedValues ( image , q , MATLAB_HDR . SizeX ) ; } if ( ! SyncAuthenticPixels ( image , exception ) ) { if ( logging ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>MAT<S2SV_blank>failed<S2SV_blank>to<S2SV_blank>sync<S2SV_blank>image<S2SV_blank>pixels<S2SV_blank>for<S2SV_blank>a<S2SV_blank>row<S2SV_blank>%u" , ( unsigned ) ( MATLAB_HDR . SizeY - i - 1 ) ) ; goto ExitLoop ; } } } while ( z -- >= 2 ) ; ExitLoop : if ( MATLAB_HDR . StructureFlag & FLAG_COMPLEX ) { CellType = ReadBlobXXXLong ( image2 ) ; i = ReadBlobXXXLong ( image2 ) ; if ( CellType == miDOUBLE || CellType == miSINGLE ) { CalcMinMax ( image2 , image_info -> endian , MATLAB_HDR . SizeX , MATLAB_HDR . SizeY , CellType , ldblk , BImgBuff , & MinVal , & MaxVal ) ; } if ( CellType == miDOUBLE ) for ( i = 0 ; i < ( ssize_t ) MATLAB_HDR . SizeY ; i ++ ) { ReadBlobDoublesXXX ( image2 , ldblk , ( double * ) BImgBuff ) ; InsertComplexDoubleRow ( image , ( double * ) BImgBuff , i , MinVal , MaxVal , exception ) ; } if ( CellType == miSINGLE ) for ( i = 0 ; i < ( ssize_t ) MATLAB_HDR . SizeY ; i ++ ) { ReadBlobFloatsXXX ( image2 , ldblk , ( float * ) BImgBuff ) ; InsertComplexFloatRow ( image , ( float * ) BImgBuff , i , MinVal , MaxVal , exception ) ; } } if ( ( MATLAB_HDR . DimFlag == 8 ) && ( ( MATLAB_HDR . StructureFlag & FLAG_COMPLEX ) == 0 ) ) image -> type = GrayscaleType ; if ( image -> depth == 1 ) image -> type = BilevelType ; if ( image2 == image ) image2 = NULL ; rotated_image = RotateImage ( image , 90.0 , exception ) ; if ( rotated_image != ( Image * ) NULL ) { rotated_image -> page . x = 0 ; rotated_image -> page . y = 0 ; blob = rotated_image -> blob ; rotated_image -> blob = image -> blob ; rotated_image -> colors = image -> colors ; image -> blob = blob ; AppendImageToList ( & image , rotated_image ) ; DeleteImageFromList ( & image ) ; } done_reading : if ( image2 != NULL ) if ( image2 != image ) { DeleteImageFromList ( & image2 ) ; if ( clone_info ) { if ( clone_info -> file ) { fclose ( clone_info -> file ) ; clone_info -> file = NULL ; ( void ) remove_utf8 ( clone_info -> filename ) ; } } } AcquireNextImage ( image_info , image , exception ) ; if ( image -> next == ( Image * ) NULL ) break ; image = SyncNextImageInList ( image ) ; image -> columns = image -> rows = 0 ; image -> colors = 0 ; RelinquishMagickMemory ( BImgBuff ) ; BImgBuff = NULL ; if ( -- Frames > 0 ) { z = z2 ; if ( image2 == NULL ) image2 = image ; goto NEXT_FRAME ; } if ( ( image2 != NULL ) && ( image2 != image ) ) { DeleteImageFromList ( & image2 ) ; if ( clone_info ) { if ( clone_info -> file ) { fclose ( clone_info -> file ) ; clone_info -> file = NULL ; ( void ) remove_utf8 ( clone_info -> filename ) ; } } } } RelinquishMagickMemory ( BImgBuff ) ; if ( quantum_info != ( QuantumInfo * ) NULL ) quantum_info = DestroyQuantumInfo ( quantum_info ) ; END_OF_READING : if ( clone_info ) clone_info = DestroyImageInfo ( clone_info ) ; CloseBlob ( image ) ; { Image * p ; ssize_t scene = 0 ; p = image ; image = NULL ; while ( p != ( Image * ) NULL ) { Image * tmp = p ; if ( ( p -> rows == 0 ) || ( p -> columns == 0 ) ) { p = p -> previous ; DeleteImageFromList ( & tmp ) ; } else { image = p ; p = p -> previous ; } } for ( p = image ; p != ( Image * ) NULL ; p = p -> next ) p -> scene = scene ++ ; } if ( clone_info != NULL ) { if ( clone_info -> file ) { fclose ( clone_info -> file ) ; clone_info -> file = NULL ; ( void ) remove_utf8 ( clone_info -> filename ) ; } DestroyImageInfo ( clone_info ) ; clone_info = NULL ; } if ( logging ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "return" ) ; if ( image == NULL ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; return ( image ) ; }
| <S2SV_ModStart> 6 ) ) { MATLAB_KO : clone_info = DestroyImageInfo ( clone_info ) ; <S2SV_ModEnd> ThrowReaderException ( CorruptImageError <S2SV_ModStart> "ImproperImageHeader" ) ; }
| ImageMagick@ImageMagick/bfb7915d4b2e11acb6a819e451c382dc645277db | CVE-2017-12667 | https://github.com/ImageMagick/ImageMagick/commit/bfb7915d4b2e11acb6a819e451c382dc645277db | 2017-08-07T21:29Z |
222 | CWE-22 | CWE-22 PHYSICALPATH_FUNC ( mod_alias_physical_handler ) { plugin_data * p = p_d ; int uri_len , basedir_len ; char * uri_ptr ; size_t k ; if ( buffer_is_empty ( con -> physical . path ) ) return HANDLER_GO_ON ; mod_alias_patch_connection ( srv , con , p ) ; basedir_len = buffer_string_length ( con -> physical . basedir ) ; if ( '/' == con -> physical . basedir -> ptr [ basedir_len - 1 ] ) -- basedir_len ; uri_len = buffer_string_length ( con -> physical . path ) - basedir_len ; uri_ptr = con -> physical . path -> ptr + basedir_len ; for ( k = 0 ; k < p -> conf . alias -> used ; k ++ ) { data_string * ds = ( data_string * ) p -> conf . alias -> data [ k ] ; int alias_len = buffer_string_length ( ds -> key ) ; if ( alias_len > uri_len ) continue ; if ( buffer_is_empty ( ds -> key ) ) continue ; if ( 0 == ( con -> conf . force_lowercase_filenames ? strncasecmp ( uri_ptr , ds -> key -> ptr , alias_len ) : strncmp ( uri_ptr , ds -> key -> ptr , alias_len ) ) ) { <S2SV_StartBug> buffer_copy_buffer ( con -> physical . basedir , ds -> value ) ; <S2SV_EndBug> buffer_copy_buffer ( srv -> tmp_buf , ds -> value ) ; buffer_append_string ( srv -> tmp_buf , uri_ptr + alias_len ) ; buffer_copy_buffer ( con -> physical . path , srv -> tmp_buf ) ; return HANDLER_GO_ON ; } } return HANDLER_GO_ON ; }
| <S2SV_ModStart> ) ) { if ( uri_ptr [ alias_len ] == '.' ) { char * s = uri_ptr + alias_len + 1 ; if ( * s == '.' ) ++ s ; if ( * s == '/' || * s == '\\0' ) { size_t vlen = buffer_string_length ( ds -> value ) ; if ( 0 != alias_len && ds -> key -> ptr [ alias_len - 1 ] != '/' && 0 != vlen && ds -> value -> ptr [ vlen - 1 ] == '/' ) { con -> http_status = 403 ; return HANDLER_FINISHED ; } } }
| [email protected]/2105dae0f9d7a964375ce681e53cb165375f84c1 | CVE-2018-19052 | https://github.com/lighttpd/lighttpd1.4/commit/2105dae0f9d7a964375ce681e53cb165375f84c1 | 2018-11-07T05:29Z |
223 | CWE-119 | CWE-119 int au1100fb_fb_mmap ( struct fb_info * fbi , struct vm_area_struct * vma ) { struct au1100fb_device * fbdev ; <S2SV_StartBug> unsigned int len ; <S2SV_EndBug> unsigned long start = 0 , off ; <S2SV_StartBug> fbdev = to_au1100fb_device ( fbi ) ; <S2SV_EndBug> if ( vma -> vm_pgoff > ( ~ 0UL >> PAGE_SHIFT ) ) { return - EINVAL ; } start = fbdev -> fb_phys & PAGE_MASK ; len = PAGE_ALIGN ( ( start & ~ PAGE_MASK ) + fbdev -> fb_len ) ; off = vma -> vm_pgoff << PAGE_SHIFT ; if ( ( vma -> vm_end - vma -> vm_start + off ) > len ) { return - EINVAL ; } off += start ; vma -> vm_pgoff = off >> PAGE_SHIFT ; vma -> vm_page_prot = pgprot_noncached ( vma -> vm_page_prot ) ; pgprot_val ( vma -> vm_page_prot ) |= ( 6 << 9 ) ; <S2SV_StartBug> if ( io_remap_pfn_range ( vma , vma -> vm_start , off >> PAGE_SHIFT , <S2SV_EndBug> vma -> vm_end - vma -> vm_start , vma -> vm_page_prot ) ) { return - EAGAIN ; } return 0 ; }
| <S2SV_ModStart> * fbdev ; <S2SV_ModEnd> fbdev = to_au1100fb_device <S2SV_ModStart> ( fbi ) <S2SV_ModEnd> ; vma -> <S2SV_ModStart> 9 ) ; return vm_iomap_memory <S2SV_ModEnd> ( vma , <S2SV_ModStart> ( vma , fbdev -> fb_phys , fbdev -> fb_len ) <S2SV_ModEnd> ; } <S2SV_null>
| torvalds@linux/7314e613d5ff9f0934f7a0f74ed7973b903315d1 | CVE-2013-6763 | https://github.com/torvalds/linux/commit/7314e613d5ff9f0934f7a0f74ed7973b903315d1 | 2013-11-12T14:35Z |
224 | CWE-59 | CWE-59 static int mount_autodev ( const char * name , const struct lxc_rootfs * rootfs , const char * lxcpath ) { int ret ; size_t clen ; char * path ; INFO ( "Mounting<S2SV_blank>container<S2SV_blank>/dev" ) ; clen = ( rootfs -> path ? strlen ( rootfs -> mount ) : 0 ) + 9 ; path = alloca ( clen ) ; ret = snprintf ( path , clen , "%s/dev" , rootfs -> path ? rootfs -> mount : "" ) ; if ( ret < 0 || ret >= clen ) return - 1 ; if ( ! dir_exists ( path ) ) { WARN ( "No<S2SV_blank>/dev<S2SV_blank>in<S2SV_blank>container." ) ; WARN ( "Proceeding<S2SV_blank>without<S2SV_blank>autodev<S2SV_blank>setup" ) ; return 0 ; } <S2SV_StartBug> if ( mount ( "none" , path , "tmpfs" , 0 , "size=100000,mode=755" ) ) { <S2SV_EndBug> SYSERROR ( "Failed<S2SV_blank>mounting<S2SV_blank>tmpfs<S2SV_blank>onto<S2SV_blank>%s\\n" , path ) ; return false ; } INFO ( "Mounted<S2SV_blank>tmpfs<S2SV_blank>onto<S2SV_blank>%s" , path ) ; ret = snprintf ( path , clen , "%s/dev/pts" , rootfs -> path ? rootfs -> mount : "" ) ; if ( ret < 0 || ret >= clen ) return - 1 ; if ( ! dir_exists ( path ) ) { ret = mkdir ( path , S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH ) ; if ( ret ) { SYSERROR ( "Failed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>/dev/pts<S2SV_blank>in<S2SV_blank>container" ) ; return - 1 ; } } INFO ( "Mounted<S2SV_blank>container<S2SV_blank>/dev" ) ; return 0 ; }
| <S2SV_ModStart> } if ( safe_mount <S2SV_ModEnd> ( "none" , <S2SV_ModStart> 0 , "size=100000,mode=755" , rootfs -> path ? rootfs -> mount : NULL
| lxc@lxc/592fd47a6245508b79fe6ac819fe6d3b2c1289be | CVE-2015-1335 | https://github.com/lxc/lxc/commit/592fd47a6245508b79fe6ac819fe6d3b2c1289be | 2015-10-01T20:59Z |
225 | CWE-681 | CWE-681 static int lookupName ( Parse * pParse , const char * zDb , const char * zTab , const char * zCol , NameContext * pNC , Expr * pExpr ) { int i , j ; int cnt = 0 ; int cntTab = 0 ; int nSubquery = 0 ; sqlite3 * db = pParse -> db ; struct SrcList_item * pItem ; struct SrcList_item * pMatch = 0 ; NameContext * pTopNC = pNC ; Schema * pSchema = 0 ; int eNewExprOp = TK_COLUMN ; Table * pTab = 0 ; Column * pCol ; assert ( pNC ) ; assert ( zCol ) ; assert ( ! ExprHasProperty ( pExpr , EP_TokenOnly | EP_Reduced ) ) ; pExpr -> iTable = - 1 ; ExprSetVVAProperty ( pExpr , EP_NoReduce ) ; if ( zDb ) { testcase ( pNC -> ncFlags & NC_PartIdx ) ; testcase ( pNC -> ncFlags & NC_IsCheck ) ; if ( ( pNC -> ncFlags & ( NC_PartIdx | NC_IsCheck ) ) != 0 ) { zDb = 0 ; } else { for ( i = 0 ; i < db -> nDb ; i ++ ) { assert ( db -> aDb [ i ] . zDbSName ) ; if ( sqlite3StrICmp ( db -> aDb [ i ] . zDbSName , zDb ) == 0 ) { pSchema = db -> aDb [ i ] . pSchema ; break ; } } } } assert ( pNC && cnt == 0 ) ; do { ExprList * pEList ; SrcList * pSrcList = pNC -> pSrcList ; if ( pSrcList ) { for ( i = 0 , pItem = pSrcList -> a ; i < pSrcList -> nSrc ; i ++ , pItem ++ ) { pTab = pItem -> pTab ; assert ( pTab != 0 && pTab -> zName != 0 ) ; assert ( pTab -> nCol > 0 ) ; if ( pItem -> pSelect && ( pItem -> pSelect -> selFlags & SF_NestedFrom ) != 0 ) { int hit = 0 ; pEList = pItem -> pSelect -> pEList ; for ( j = 0 ; j < pEList -> nExpr ; j ++ ) { if ( sqlite3MatchSpanName ( pEList -> a [ j ] . zSpan , zCol , zTab , zDb ) ) { cnt ++ ; cntTab = 2 ; pMatch = pItem ; pExpr -> iColumn = j ; hit = 1 ; } } if ( hit || zTab == 0 ) continue ; } if ( zDb && pTab -> pSchema != pSchema ) { continue ; } if ( zTab ) { const char * zTabName = pItem -> zAlias ? pItem -> zAlias : pTab -> zName ; assert ( zTabName != 0 ) ; if ( sqlite3StrICmp ( zTabName , zTab ) != 0 ) { continue ; } if ( IN_RENAME_OBJECT && pItem -> zAlias ) { sqlite3RenameTokenRemap ( pParse , 0 , ( void * ) & pExpr -> y . pTab ) ; } } if ( 0 == ( cntTab ++ ) ) { pMatch = pItem ; } for ( j = 0 , pCol = pTab -> aCol ; j < pTab -> nCol ; j ++ , pCol ++ ) { if ( sqlite3StrICmp ( pCol -> zName , zCol ) == 0 ) { if ( cnt == 1 ) { if ( pItem -> fg . jointype & JT_NATURAL ) continue ; if ( nameInUsingClause ( pItem -> pUsing , zCol ) ) continue ; } cnt ++ ; pMatch = pItem ; pExpr -> iColumn = j == pTab -> iPKey ? - 1 : ( i16 ) j ; break ; } } } if ( pMatch ) { pExpr -> iTable = pMatch -> iCursor ; pExpr -> y . pTab = pMatch -> pTab ; assert ( ( pMatch -> fg . jointype & JT_RIGHT ) == 0 ) ; if ( ( pMatch -> fg . jointype & JT_LEFT ) != 0 ) { ExprSetProperty ( pExpr , EP_CanBeNull ) ; } pSchema = pExpr -> y . pTab -> pSchema ; } } # if ! defined ( SQLITE_OMIT_TRIGGER ) || ! defined ( SQLITE_OMIT_UPSERT ) if ( zDb == 0 && zTab != 0 && cntTab == 0 ) { pTab = 0 ; # ifndef SQLITE_OMIT_TRIGGER if ( pParse -> pTriggerTab != 0 ) { int op = pParse -> eTriggerOp ; assert ( op == TK_DELETE || op == TK_UPDATE || op == TK_INSERT ) ; if ( op != TK_DELETE && sqlite3StrICmp ( "new" , zTab ) == 0 ) { pExpr -> iTable = 1 ; pTab = pParse -> pTriggerTab ; } else if ( op != TK_INSERT && sqlite3StrICmp ( "old" , zTab ) == 0 ) { pExpr -> iTable = 0 ; pTab = pParse -> pTriggerTab ; } } # endif # ifndef SQLITE_OMIT_UPSERT if ( ( pNC -> ncFlags & NC_UUpsert ) != 0 ) { Upsert * pUpsert = pNC -> uNC . pUpsert ; if ( pUpsert && sqlite3StrICmp ( "excluded" , zTab ) == 0 ) { pTab = pUpsert -> pUpsertSrc -> a [ 0 ] . pTab ; pExpr -> iTable = 2 ; } } # endif if ( pTab ) { int iCol ; pSchema = pTab -> pSchema ; cntTab ++ ; for ( iCol = 0 , pCol = pTab -> aCol ; iCol < pTab -> nCol ; iCol ++ , pCol ++ ) { if ( sqlite3StrICmp ( pCol -> zName , zCol ) == 0 ) { if ( iCol == pTab -> iPKey ) { iCol = - 1 ; } break ; } } if ( iCol >= pTab -> nCol && sqlite3IsRowid ( zCol ) && VisibleRowid ( pTab ) ) { iCol = - 1 ; } if ( iCol < pTab -> nCol ) { cnt ++ ; # ifndef SQLITE_OMIT_UPSERT if ( pExpr -> iTable == 2 ) { testcase ( iCol == ( - 1 ) ) ; if ( IN_RENAME_OBJECT ) { pExpr -> iColumn = iCol ; pExpr -> y . pTab = pTab ; eNewExprOp = TK_COLUMN ; } else { pExpr -> iTable = pNC -> uNC . pUpsert -> regData + iCol ; eNewExprOp = TK_REGISTER ; ExprSetProperty ( pExpr , EP_Alias ) ; } } else # endif { # ifndef SQLITE_OMIT_TRIGGER if ( iCol < 0 ) { pExpr -> affExpr = SQLITE_AFF_INTEGER ; } else if ( pExpr -> iTable == 0 ) { testcase ( iCol == 31 ) ; testcase ( iCol == 32 ) ; pParse -> oldmask |= ( iCol >= 32 ? 0xffffffff : ( ( ( u32 ) 1 ) << iCol ) ) ; } else { testcase ( iCol == 31 ) ; testcase ( iCol == 32 ) ; pParse -> newmask |= ( iCol >= 32 ? 0xffffffff : ( ( ( u32 ) 1 ) << iCol ) ) ; } pExpr -> y . pTab = pTab ; pExpr -> iColumn = ( i16 ) iCol ; eNewExprOp = TK_TRIGGER ; # endif } } } } # endif if ( cnt == 0 && cntTab == 1 && pMatch && ( pNC -> ncFlags & ( NC_IdxExpr | NC_GenCol ) ) == 0 && sqlite3IsRowid ( zCol ) && VisibleRowid ( pMatch -> pTab ) ) { cnt = 1 ; pExpr -> iColumn = - 1 ; pExpr -> affExpr = SQLITE_AFF_INTEGER ; } if ( ( pNC -> ncFlags & NC_UEList ) != 0 && cnt == 0 && zTab == 0 ) { pEList = pNC -> uNC . pEList ; assert ( pEList != 0 ) ; for ( j = 0 ; j < pEList -> nExpr ; j ++ ) { char * zAs = pEList -> a [ j ] . zName ; if ( zAs != 0 && sqlite3StrICmp ( zAs , zCol ) == 0 ) { Expr * pOrig ; assert ( pExpr -> pLeft == 0 && pExpr -> pRight == 0 ) ; assert ( pExpr -> x . pList == 0 ) ; assert ( pExpr -> x . pSelect == 0 ) ; pOrig = pEList -> a [ j ] . pExpr ; if ( ( pNC -> ncFlags & NC_AllowAgg ) == 0 && ExprHasProperty ( pOrig , EP_Agg ) ) { sqlite3ErrorMsg ( pParse , "misuse<S2SV_blank>of<S2SV_blank>aliased<S2SV_blank>aggregate<S2SV_blank>%s" , zAs ) ; return WRC_Abort ; } if ( ( pNC -> ncFlags & NC_AllowWin ) == 0 && ExprHasProperty ( pOrig , EP_Win ) ) { sqlite3ErrorMsg ( pParse , "misuse<S2SV_blank>of<S2SV_blank>aliased<S2SV_blank>window<S2SV_blank>function<S2SV_blank>%s" , zAs ) ; return WRC_Abort ; } if ( sqlite3ExprVectorSize ( pOrig ) != 1 ) { sqlite3ErrorMsg ( pParse , "row<S2SV_blank>value<S2SV_blank>misused" ) ; return WRC_Abort ; } resolveAlias ( pParse , pEList , j , pExpr , "" , nSubquery ) ; cnt = 1 ; pMatch = 0 ; assert ( zTab == 0 && zDb == 0 ) ; if ( IN_RENAME_OBJECT ) { sqlite3RenameTokenRemap ( pParse , 0 , ( void * ) pExpr ) ; } goto lookupname_end ; } } } if ( cnt ) break ; pNC = pNC -> pNext ; nSubquery ++ ; } while ( pNC ) ; if ( cnt == 0 && zTab == 0 ) { assert ( pExpr -> op == TK_ID ) ; if ( ExprHasProperty ( pExpr , EP_DblQuoted ) && areDoubleQuotedStringsEnabled ( db , pTopNC ) ) { sqlite3_log ( SQLITE_WARNING , "double-quoted<S2SV_blank>string<S2SV_blank>literal:<S2SV_blank>\\"%w\\"" , zCol ) ; # ifdef SQLITE_ENABLE_NORMALIZE sqlite3VdbeAddDblquoteStr ( db , pParse -> pVdbe , zCol ) ; # endif pExpr -> op = TK_STRING ; pExpr -> y . pTab = 0 ; return WRC_Prune ; } if ( sqlite3ExprIdToTrueFalse ( pExpr ) ) { return WRC_Prune ; } } if ( cnt != 1 ) { const char * zErr ; zErr = cnt == 0 ? "no<S2SV_blank>such<S2SV_blank>column" : "ambiguous<S2SV_blank>column<S2SV_blank>name" ; if ( zDb ) { sqlite3ErrorMsg ( pParse , "%s:<S2SV_blank>%s.%s.%s" , zErr , zDb , zTab , zCol ) ; } else if ( zTab ) { sqlite3ErrorMsg ( pParse , "%s:<S2SV_blank>%s.%s" , zErr , zTab , zCol ) ; } else { sqlite3ErrorMsg ( pParse , "%s:<S2SV_blank>%s" , zErr , zCol ) ; } pParse -> checkSchema = 1 ; pTopNC -> nErr ++ ; } if ( pExpr -> iColumn >= 0 && pMatch != 0 ) { int n = pExpr -> iColumn ; testcase ( n == BMS - 1 ) ; if ( n >= BMS ) { n = BMS - 1 ; } <S2SV_StartBug> assert ( pMatch -> iCursor == pExpr -> iTable ) ; <S2SV_EndBug> pMatch -> colUsed |= ( ( Bitmask ) 1 ) << n ; } sqlite3ExprDelete ( db , pExpr -> pLeft ) ; pExpr -> pLeft = 0 ; sqlite3ExprDelete ( db , pExpr -> pRight ) ; pExpr -> pRight = 0 ; pExpr -> op = eNewExprOp ; ExprSetProperty ( pExpr , EP_Leaf ) ; lookupname_end : if ( cnt == 1 ) { assert ( pNC != 0 ) ; if ( ! ExprHasProperty ( pExpr , EP_Alias ) ) { sqlite3AuthRead ( pParse , pExpr , pSchema , pNC -> pSrcList ) ; } for ( ; ; ) { assert ( pTopNC != 0 ) ; pTopNC -> nRef ++ ; if ( pTopNC == pNC ) break ; pTopNC = pTopNC -> pNext ; } return WRC_Prune ; } else { return WRC_Abort ; } }
| <S2SV_ModStart> } assert ( pExpr -> y . pTab != 0 ) ; assert ( <S2SV_ModStart> iTable ) ; if ( pExpr -> y . pTab -> tabFlags & TF_HasGenerated ) { Column * pCol = pExpr -> y . pTab -> aCol + pExpr -> iColumn ; if ( pCol -> colFlags & COLFLAG_GENERATED ) n = BMS - 1 ; }
| sqlite@sqlite/522ebfa7cee96fb325a22ea3a2464a63485886a8 | CVE-2019-19317 | https://github.com/sqlite/sqlite/commit/522ebfa7cee96fb325a22ea3a2464a63485886a8 | 2019-12-05T14:15Z |
226 | CWE-119 | CWE-119 void vp9_tokens_from_tree ( struct vp9_token * tokens , <S2SV_StartBug> const vp9_tree_index * tree ) { <S2SV_EndBug> tree2tok ( tokens , tree , 0 , 0 , 0 ) ; }
| <S2SV_ModStart> tokens , const vpx_tree_index <S2SV_ModEnd> * tree )
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
227 | CWE-200 | CWE-200 static void usage ( const char * prog ) { fprintf ( stderr , "Usage:<S2SV_blank>%s<S2SV_blank>[OPTION...]\\n" , prog ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-f,<S2SV_blank>--use-file=FILE<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Use<S2SV_blank>the<S2SV_blank>specified<S2SV_blank>configuration<S2SV_blank>file\\n" ) ; # if defined _WITH_VRRP_ && defined _WITH_LVS_ fprintf ( stderr , "<S2SV_blank><S2SV_blank>-P,<S2SV_blank>--vrrp<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Only<S2SV_blank>run<S2SV_blank>with<S2SV_blank>VRRP<S2SV_blank>subsystem\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-C,<S2SV_blank>--check<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Only<S2SV_blank>run<S2SV_blank>with<S2SV_blank>Health-checker<S2SV_blank>subsystem\\n" ) ; # endif # ifdef _WITH_BFD_ fprintf ( stderr , "<S2SV_blank><S2SV_blank>-B,<S2SV_blank>--no_bfd<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Don\'t<S2SV_blank>run<S2SV_blank>BFD<S2SV_blank>subsystem\\n" ) ; # endif fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>--all<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Force<S2SV_blank>all<S2SV_blank>child<S2SV_blank>processes<S2SV_blank>to<S2SV_blank>run,<S2SV_blank>even<S2SV_blank>if<S2SV_blank>have<S2SV_blank>no<S2SV_blank>configuration\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-l,<S2SV_blank>--log-console<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Log<S2SV_blank>messages<S2SV_blank>to<S2SV_blank>local<S2SV_blank>console\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-D,<S2SV_blank>--log-detail<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Detailed<S2SV_blank>log<S2SV_blank>messages\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-S,<S2SV_blank>--log-facility=[0-7]<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Set<S2SV_blank>syslog<S2SV_blank>facility<S2SV_blank>to<S2SV_blank>LOG_LOCAL[0-7]\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-g,<S2SV_blank>--log-file=FILE<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Also<S2SV_blank>log<S2SV_blank>to<S2SV_blank>FILE<S2SV_blank>(default<S2SV_blank>/tmp/keepalived.log)\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>--flush-log-file<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Flush<S2SV_blank>log<S2SV_blank>file<S2SV_blank>on<S2SV_blank>write\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-G,<S2SV_blank>--no-syslog<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Don\'t<S2SV_blank>log<S2SV_blank>via<S2SV_blank>syslog\\n" ) ; <S2SV_StartBug> # ifdef _WITH_VRRP_ <S2SV_EndBug> fprintf ( stderr , "<S2SV_blank><S2SV_blank>-X,<S2SV_blank>--release-vips<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Drop<S2SV_blank>VIP<S2SV_blank>on<S2SV_blank>transition<S2SV_blank>from<S2SV_blank>signal.\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-V,<S2SV_blank>--dont-release-vrrp<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Don\'t<S2SV_blank>remove<S2SV_blank>VRRP<S2SV_blank>VIPs<S2SV_blank>and<S2SV_blank>VROUTEs<S2SV_blank>on<S2SV_blank>daemon<S2SV_blank>stop\\n" ) ; # endif # ifdef _WITH_LVS_ fprintf ( stderr , "<S2SV_blank><S2SV_blank>-I,<S2SV_blank>--dont-release-ipvs<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Don\'t<S2SV_blank>remove<S2SV_blank>IPVS<S2SV_blank>topology<S2SV_blank>on<S2SV_blank>daemon<S2SV_blank>stop\\n" ) ; # endif fprintf ( stderr , "<S2SV_blank><S2SV_blank>-R,<S2SV_blank>--dont-respawn<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Don\'t<S2SV_blank>respawn<S2SV_blank>child<S2SV_blank>processes\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-n,<S2SV_blank>--dont-fork<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Don\'t<S2SV_blank>fork<S2SV_blank>the<S2SV_blank>daemon<S2SV_blank>process\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-d,<S2SV_blank>--dump-conf<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Dump<S2SV_blank>the<S2SV_blank>configuration<S2SV_blank>data\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-p,<S2SV_blank>--pid=FILE<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Use<S2SV_blank>specified<S2SV_blank>pidfile<S2SV_blank>for<S2SV_blank>parent<S2SV_blank>process\\n" ) ; # ifdef _WITH_VRRP_ fprintf ( stderr , "<S2SV_blank><S2SV_blank>-r,<S2SV_blank>--vrrp_pid=FILE<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Use<S2SV_blank>specified<S2SV_blank>pidfile<S2SV_blank>for<S2SV_blank>VRRP<S2SV_blank>child<S2SV_blank>process\\n" ) ; # endif # ifdef _WITH_LVS_ fprintf ( stderr , "<S2SV_blank><S2SV_blank>-c,<S2SV_blank>--checkers_pid=FILE<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Use<S2SV_blank>specified<S2SV_blank>pidfile<S2SV_blank>for<S2SV_blank>checkers<S2SV_blank>child<S2SV_blank>process\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-a,<S2SV_blank>--address-monitoring<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Report<S2SV_blank>all<S2SV_blank>address<S2SV_blank>additions/deletions<S2SV_blank>notified<S2SV_blank>via<S2SV_blank>netlink\\n" ) ; # endif # ifdef _WITH_BFD_ fprintf ( stderr , "<S2SV_blank><S2SV_blank>-b,<S2SV_blank>--bfd_pid=FILE<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Use<S2SV_blank>specified<S2SV_blank>pidfile<S2SV_blank>for<S2SV_blank>BFD<S2SV_blank>child<S2SV_blank>process\\n" ) ; # endif # ifdef _WITH_SNMP_ fprintf ( stderr , "<S2SV_blank><S2SV_blank>-x,<S2SV_blank>--snmp<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Enable<S2SV_blank>SNMP<S2SV_blank>subsystem\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-A,<S2SV_blank>--snmp-agent-socket=FILE<S2SV_blank>Use<S2SV_blank>the<S2SV_blank>specified<S2SV_blank>socket<S2SV_blank>for<S2SV_blank>master<S2SV_blank>agent\\n" ) ; # endif # if HAVE_DECL_CLONE_NEWNET fprintf ( stderr , "<S2SV_blank><S2SV_blank>-s,<S2SV_blank>--namespace=NAME<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Run<S2SV_blank>in<S2SV_blank>network<S2SV_blank>namespace<S2SV_blank>NAME<S2SV_blank>(overrides<S2SV_blank>config)\\n" ) ; # endif fprintf ( stderr , "<S2SV_blank><S2SV_blank>-m,<S2SV_blank>--core-dump<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Produce<S2SV_blank>core<S2SV_blank>dump<S2SV_blank>if<S2SV_blank>terminate<S2SV_blank>abnormally\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-M,<S2SV_blank>--core-dump-pattern=PATN<S2SV_blank>Also<S2SV_blank>set<S2SV_blank>/proc/sys/kernel/core_pattern<S2SV_blank>to<S2SV_blank>PATN<S2SV_blank>(default<S2SV_blank>\'core\')\\n" ) ; # ifdef _MEM_CHECK_LOG_ fprintf ( stderr , "<S2SV_blank><S2SV_blank>-L,<S2SV_blank>--mem-check-log<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Log<S2SV_blank>malloc/frees<S2SV_blank>to<S2SV_blank>syslog\\n" ) ; # endif fprintf ( stderr , "<S2SV_blank><S2SV_blank>-i,<S2SV_blank>--config-id<S2SV_blank>id<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Skip<S2SV_blank>any<S2SV_blank>configuration<S2SV_blank>lines<S2SV_blank>beginning<S2SV_blank>\'@\'<S2SV_blank>that<S2SV_blank>don\'t<S2SV_blank>match<S2SV_blank>id\\n" "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>or<S2SV_blank>any<S2SV_blank>lines<S2SV_blank>beginning<S2SV_blank>@^<S2SV_blank>that<S2SV_blank>do<S2SV_blank>match.\\n" "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>The<S2SV_blank>config-id<S2SV_blank>defaults<S2SV_blank>to<S2SV_blank>the<S2SV_blank>node<S2SV_blank>name<S2SV_blank>if<S2SV_blank>option<S2SV_blank>not<S2SV_blank>used\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>--signum=SIGFUNC<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Return<S2SV_blank>signal<S2SV_blank>number<S2SV_blank>for<S2SV_blank>STOP,<S2SV_blank>RELOAD,<S2SV_blank>DATA,<S2SV_blank>STATS" # ifdef _WITH_JSON_ ",<S2SV_blank>JSON" # endif "\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-t,<S2SV_blank>--config-test[=LOG_FILE]<S2SV_blank>Check<S2SV_blank>the<S2SV_blank>configuration<S2SV_blank>for<S2SV_blank>obvious<S2SV_blank>errors,<S2SV_blank>output<S2SV_blank>to\\n" "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>stderr<S2SV_blank>by<S2SV_blank>default\\n" ) ; # ifdef _WITH_PERF_ fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>--perf[=PERF_TYPE]<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Collect<S2SV_blank>perf<S2SV_blank>data,<S2SV_blank>PERF_TYPE=all,<S2SV_blank>run(default)<S2SV_blank>or<S2SV_blank>end\\n" ) ; # endif # ifdef WITH_DEBUG_OPTIONS fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>--debug[=...]<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Enable<S2SV_blank>debug<S2SV_blank>options.<S2SV_blank>p,<S2SV_blank>b,<S2SV_blank>c,<S2SV_blank>v<S2SV_blank>specify<S2SV_blank>parent,<S2SV_blank>bfd,<S2SV_blank>checker<S2SV_blank>and<S2SV_blank>vrrp<S2SV_blank>processes\\n" ) ; # ifdef _TIMER_CHECK_ fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>T<S2SV_blank>-<S2SV_blank>timer<S2SV_blank>debug\\n" ) ; # endif # ifdef _SMTP_ALERT_DEBUG_ fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>M<S2SV_blank>-<S2SV_blank>email<S2SV_blank>alert<S2SV_blank>debug\\n" ) ; # endif # ifdef _EPOLL_DEBUG_ fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>E<S2SV_blank>-<S2SV_blank>epoll<S2SV_blank>debug\\n" ) ; # endif # ifdef _EPOLL_THREAD_DUMP_ fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>D<S2SV_blank>-<S2SV_blank>epoll<S2SV_blank>thread<S2SV_blank>dump<S2SV_blank>debug\\n" ) ; # endif # ifdef _VRRP_FD_DEBUG fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>F<S2SV_blank>-<S2SV_blank>vrrp<S2SV_blank>fd<S2SV_blank>dump<S2SV_blank>debug\\n" ) ; # endif # ifdef _REGEX_DEBUG_ fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>R<S2SV_blank>-<S2SV_blank>regex<S2SV_blank>debug\\n" ) ; # endif # ifdef _WITH_REGEX_TIMERS_ fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>X<S2SV_blank>-<S2SV_blank>regex<S2SV_blank>timers\\n" ) ; # endif # ifdef _TSM_DEBUG_ fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>S<S2SV_blank>-<S2SV_blank>TSM<S2SV_blank>debug\\n" ) ; # endif # ifdef _NETLINK_TIMERS_ fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>N<S2SV_blank>-<S2SV_blank>netlink<S2SV_blank>timer<S2SV_blank>debug\\n" ) ; # endif fprintf ( stderr , "<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Example<S2SV_blank>--debug=TpMEvcp\\n" ) ; # endif fprintf ( stderr , "<S2SV_blank><S2SV_blank>-v,<S2SV_blank>--version<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Display<S2SV_blank>the<S2SV_blank>version<S2SV_blank>number\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-h,<S2SV_blank>--help<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Display<S2SV_blank>this<S2SV_blank>help<S2SV_blank>message\\n" ) ; }
| <S2SV_ModStart> "<S2SV_blank><S2SV_blank>-G,<S2SV_blank>--no-syslog<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>Don\'t<S2SV_blank>log<S2SV_blank>via<S2SV_blank>syslog\\n" ) ; fprintf ( stderr , "<S2SV_blank><S2SV_blank>-u,<S2SV_blank>--umask=MASK<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>umask<S2SV_blank>for<S2SV_blank>file<S2SV_blank>creation<S2SV_blank>(in<S2SV_blank>numeric<S2SV_blank>form)\\n" ) ;
| acassen@keepalived/c6247a9ef2c7b33244ab1d3aa5d629ec49f0a067 | CVE-2018-19045 | https://github.com/acassen/keepalived/commit/c6247a9ef2c7b33244ab1d3aa5d629ec49f0a067 | 2018-11-08T20:29Z |
228 | CWE-310 | CWE-310 int use_conf ( char * test_path ) { int ret ; size_t flags = 0 ; char filename [ 1024 ] , errstr [ 1024 ] ; char * buffer ; FILE * infile , * conffile ; json_t * json ; json_error_t error ; sprintf ( filename , "%s%cinput" , test_path , dir_sep ) ; if ( ! ( infile = fopen ( filename , "rb" ) ) ) { fprintf ( stderr , "Could<S2SV_blank>not<S2SV_blank>open<S2SV_blank>\\"%s\\"\\n" , filename ) ; return 2 ; } sprintf ( filename , "%s%cenv" , test_path , dir_sep ) ; conffile = fopen ( filename , "rb" ) ; if ( conffile ) { read_conf ( conffile ) ; fclose ( conffile ) ; } if ( conf . indent < 0 || conf . indent > 255 ) { fprintf ( stderr , "invalid<S2SV_blank>value<S2SV_blank>for<S2SV_blank>JSON_INDENT:<S2SV_blank>%d\\n" , conf . indent ) ; return 2 ; } if ( conf . indent ) flags |= JSON_INDENT ( conf . indent ) ; if ( conf . compact ) flags |= JSON_COMPACT ; if ( conf . ensure_ascii ) flags |= JSON_ENSURE_ASCII ; if ( conf . preserve_order ) flags |= JSON_PRESERVE_ORDER ; if ( conf . sort_keys ) flags |= JSON_SORT_KEYS ; <S2SV_StartBug> if ( conf . strip ) { <S2SV_EndBug> buffer = loadfile ( infile ) ; json = json_loads ( strip ( buffer ) , 0 , & error ) ; free ( buffer ) ; } else json = json_loadf ( infile , 0 , & error ) ; fclose ( infile ) ; if ( ! json ) { sprintf ( errstr , "%d<S2SV_blank>%d<S2SV_blank>%d\\n%s\\n" , error . line , error . column , error . position , error . text ) ; ret = cmpfile ( errstr , test_path , "error" ) ; return ret ; } buffer = json_dumps ( json , flags ) ; ret = cmpfile ( buffer , test_path , "output" ) ; free ( buffer ) ; json_decref ( json ) ; return ret ; }
| <S2SV_ModStart> ( conf . have_hashseed ) json_object_seed ( conf . hashseed ) ; if ( conf .
| akheron@jansson/8f80c2d83808150724d31793e6ade92749b1faa4 | CVE-2013-6401 | https://github.com/akheron/jansson/commit/8f80c2d83808150724d31793e6ade92749b1faa4 | 2014-03-21T01:04Z |
229 | CWE-476 | CWE-476 static int dnxhd_find_frame_end ( DNXHDParserContext * dctx , const uint8_t * buf , int buf_size ) { ParseContext * pc = & dctx -> pc ; uint64_t state = pc -> state64 ; int pic_found = pc -> frame_start_found ; int i = 0 ; if ( ! pic_found ) { for ( i = 0 ; i < buf_size ; i ++ ) { state = ( state << 8 ) | buf [ i ] ; if ( ff_dnxhd_check_header_prefix ( state & 0xffffffffff00LL ) != 0 ) { i ++ ; pic_found = 1 ; dctx -> cur_byte = 0 ; dctx -> remaining = 0 ; break ; } } } if ( pic_found && ! dctx -> remaining ) { if ( ! buf_size ) return 0 ; for ( ; i < buf_size ; i ++ ) { dctx -> cur_byte ++ ; state = ( state << 8 ) | buf [ i ] ; if ( dctx -> cur_byte == 24 ) { dctx -> h = ( state >> 32 ) & 0xFFFF ; } else if ( dctx -> cur_byte == 26 ) { dctx -> w = ( state >> 32 ) & 0xFFFF ; } else if ( dctx -> cur_byte == 42 ) { int cid = ( state >> 32 ) & 0xFFFFFFFF ; <S2SV_StartBug> if ( cid <= 0 ) <S2SV_EndBug> continue ; <S2SV_StartBug> dctx -> remaining = avpriv_dnxhd_get_frame_size ( cid ) ; <S2SV_EndBug> <S2SV_StartBug> if ( dctx -> remaining <= 0 ) { <S2SV_EndBug> <S2SV_StartBug> dctx -> remaining = ff_dnxhd_get_hr_frame_size ( cid , dctx -> w , dctx -> h ) ; <S2SV_EndBug> <S2SV_StartBug> if ( dctx -> remaining <= 0 ) <S2SV_EndBug> <S2SV_StartBug> return dctx -> remaining ; <S2SV_EndBug> } if ( buf_size - i + 47 >= dctx -> remaining ) { int remaining = dctx -> remaining ; pc -> frame_start_found = 0 ; pc -> state64 = - 1 ; dctx -> cur_byte = 0 ; dctx -> remaining = 0 ; return remaining ; } else { dctx -> remaining -= buf_size ; } } } } else if ( pic_found ) { if ( dctx -> remaining > buf_size ) { dctx -> remaining -= buf_size ; } else { int remaining = dctx -> remaining ; pc -> frame_start_found = 0 ; pc -> state64 = - 1 ; dctx -> cur_byte = 0 ; dctx -> remaining = 0 ; return remaining ; } } pc -> frame_start_found = pic_found ; pc -> state64 = state ; return END_NOT_FOUND ; }
| <S2SV_ModStart> & 0xFFFFFFFF ; int remaining ; <S2SV_ModStart> ) continue ; <S2SV_ModEnd> remaining = avpriv_dnxhd_get_frame_size <S2SV_ModStart> ; if ( <S2SV_ModEnd> remaining <= 0 <S2SV_ModStart> 0 ) { <S2SV_ModEnd> remaining = ff_dnxhd_get_hr_frame_size <S2SV_ModStart> ; if ( <S2SV_ModEnd> remaining <= 0 <S2SV_ModStart> <= 0 ) continue ; } dctx -> remaining = remaining ; <S2SV_ModEnd> if ( buf_size
| FFmpeg@FFmpeg/611b35627488a8d0763e75c25ee0875c5b7987dd | CVE-2017-9608 | https://github.com/FFmpeg/FFmpeg/commit/611b35627488a8d0763e75c25ee0875c5b7987dd | 2017-12-27T19:29Z |
230 | CWE-20 | CWE-20 static void snd_timer_check_master ( struct snd_timer_instance * master ) { struct snd_timer_instance * slave , * tmp ; list_for_each_entry_safe ( slave , tmp , & snd_timer_slave_list , open_list ) { if ( slave -> slave_class == master -> slave_class && slave -> slave_id == master -> slave_id ) { list_move_tail ( & slave -> open_list , & master -> slave_list_head ) ; spin_lock_irq ( & slave_active_lock ) ; <S2SV_StartBug> slave -> master = master ; <S2SV_EndBug> slave -> timer = master -> timer ; if ( slave -> flags & SNDRV_TIMER_IFLG_RUNNING ) list_add_tail ( & slave -> active_list , & master -> slave_active_head ) ; <S2SV_StartBug> spin_unlock_irq ( & slave_active_lock ) ; <S2SV_EndBug> } } }
| <S2SV_ModStart> slave_active_lock ) ; spin_lock ( & master -> timer -> lock ) ; <S2SV_ModStart> slave_active_head ) ; spin_unlock ( & master -> timer -> lock ) ;
| torvalds@linux/b5a663aa426f4884c71cd8580adae73f33570f0d | CVE-2016-2548 | https://github.com/torvalds/linux/commit/b5a663aa426f4884c71cd8580adae73f33570f0d | 2016-04-27T17:59Z |
231 | CWE-189 | CWE-189 static int opl3_load_patch ( int dev , int format , const char __user * addr , <S2SV_StartBug> int offs , int count , int pmgr_flag ) <S2SV_EndBug> { struct sbi_instrument ins ; if ( count < sizeof ( ins ) ) { printk ( KERN_WARNING "FM<S2SV_blank>Error:<S2SV_blank>Patch<S2SV_blank>record<S2SV_blank>too<S2SV_blank>short\\n" ) ; return - EINVAL ; } <S2SV_StartBug> if ( copy_from_user ( & ( ( char * ) & ins ) [ offs ] , addr + offs , sizeof ( ins ) - offs ) ) <S2SV_EndBug> return - EFAULT ; if ( ins . channel < 0 || ins . channel >= SBFM_MAXINSTR ) { printk ( KERN_WARNING "FM<S2SV_blank>Error:<S2SV_blank>Invalid<S2SV_blank>instrument<S2SV_blank>number<S2SV_blank>%d\\n" , ins . channel ) ; return - EINVAL ; } ins . key = format ; return store_instr ( ins . channel , & ins ) ; }
| <S2SV_ModStart> * addr , <S2SV_ModEnd> int count , <S2SV_ModStart> copy_from_user ( & ins , addr <S2SV_ModEnd> , sizeof ( <S2SV_ModStart> ( ins ) <S2SV_ModEnd> ) ) return
| torvalds@linux/b769f49463711205d57286e64cf535ed4daf59e9 | CVE-2011-1476 | https://github.com/torvalds/linux/commit/b769f49463711205d57286e64cf535ed4daf59e9 | 2012-06-21T23:55Z |
232 | CWE-119 | CWE-119 static int filter_frame ( AVFilterLink * inlink , AVFrame * in ) { DelogoContext * s = inlink -> dst -> priv ; AVFilterLink * outlink = inlink -> dst -> outputs [ 0 ] ; const AVPixFmtDescriptor * desc = av_pix_fmt_desc_get ( inlink -> format ) ; AVFrame * out ; int hsub0 = desc -> log2_chroma_w ; int vsub0 = desc -> log2_chroma_h ; int direct = 0 ; int plane ; AVRational sar ; if ( av_frame_is_writable ( in ) ) { direct = 1 ; out = in ; } else { out = ff_get_video_buffer ( outlink , outlink -> w , outlink -> h ) ; if ( ! out ) { av_frame_free ( & in ) ; return AVERROR ( ENOMEM ) ; } av_frame_copy_props ( out , in ) ; } sar = in -> sample_aspect_ratio ; if ( ! sar . num ) sar . num = sar . den = 1 ; <S2SV_StartBug> for ( plane = 0 ; plane < 4 && in -> data [ plane ] ; plane ++ ) { <S2SV_EndBug> int hsub = plane == 1 || plane == 2 ? hsub0 : 0 ; int vsub = plane == 1 || plane == 2 ? vsub0 : 0 ; apply_delogo ( out -> data [ plane ] , out -> linesize [ plane ] , in -> data [ plane ] , in -> linesize [ plane ] , FF_CEIL_RSHIFT ( inlink -> w , hsub ) , FF_CEIL_RSHIFT ( inlink -> h , vsub ) , sar , s -> x >> hsub , s -> y >> vsub , FF_CEIL_RSHIFT ( s -> w + ( s -> x & ( ( 1 << hsub ) - 1 ) ) , hsub ) , FF_CEIL_RSHIFT ( s -> h + ( s -> y & ( ( 1 << vsub ) - 1 ) ) , vsub ) , s -> band >> FFMIN ( hsub , vsub ) , s -> show , direct ) ; } if ( ! direct ) av_frame_free ( & in ) ; return ff_filter_frame ( outlink , out ) ; }
| <S2SV_ModStart> in -> data [ plane ] && in -> linesize
| FFmpeg@FFmpeg/e43a0a232dbf6d3c161823c2e07c52e76227a1bc | CVE-2013-4263 | https://github.com/FFmpeg/FFmpeg/commit/e43a0a232dbf6d3c161823c2e07c52e76227a1bc | 2013-11-23T17:55Z |
233 | CWE-20 | CWE-20 static void mpeg4_encode_gop_header ( MpegEncContext * s ) { <S2SV_StartBug> int hours , minutes , seconds ; <S2SV_EndBug> int64_t time ; put_bits ( & s -> pb , 16 , 0 ) ; put_bits ( & s -> pb , 16 , GOP_STARTCODE ) ; time = s -> current_picture_ptr -> f -> pts ; if ( s -> reordered_input_picture [ 1 ] ) time = FFMIN ( time , s -> reordered_input_picture [ 1 ] -> f -> pts ) ; time = time * s -> avctx -> time_base . num ; s -> last_time_base = FFUDIV ( time , s -> avctx -> time_base . den ) ; seconds = FFUDIV ( time , s -> avctx -> time_base . den ) ; minutes = FFUDIV ( seconds , 60 ) ; seconds = FFUMOD ( seconds , 60 ) ; hours = FFUDIV ( minutes , 60 ) ; minutes = FFUMOD ( minutes , 60 ) ; hours = FFUMOD ( hours , 24 ) ; put_bits ( & s -> pb , 5 , hours ) ; put_bits ( & s -> pb , 6 , minutes ) ; put_bits ( & s -> pb , 1 , 1 ) ; put_bits ( & s -> pb , 6 , seconds ) ; put_bits ( & s -> pb , 1 , ! ! ( s -> avctx -> flags & AV_CODEC_FLAG_CLOSED_GOP ) ) ; put_bits ( & s -> pb , 1 , 0 ) ; ff_mpeg4_stuffing ( & s -> pb ) ; }
| <S2SV_ModStart> s ) { int64_t <S2SV_ModEnd> hours , minutes
| FFmpeg@FFmpeg/e1182fac1afba92a4975917823a5f644bee7e6e8 | CVE-2018-12458 | https://github.com/FFmpeg/FFmpeg/commit/e1182fac1afba92a4975917823a5f644bee7e6e8 | 2018-06-15T15:29Z |
234 | CWE-125 | CWE-125 node * PyParser_ParseFileObject ( FILE * fp , PyObject * filename , const char * enc , grammar * g , int start , const char * ps1 , const char * ps2 , perrdetail * err_ret , int * flags ) { struct tok_state * tok ; if ( initerr ( err_ret , filename ) < 0 ) return NULL ; if ( ( tok = PyTokenizer_FromFile ( fp , enc , ps1 , ps2 ) ) == NULL ) { err_ret -> error = E_NOMEM ; return NULL ; } <S2SV_StartBug> # ifndef PGEN <S2SV_EndBug> Py_INCREF ( err_ret -> filename ) ; tok -> filename = err_ret -> filename ; # endif return parsetok ( tok , g , start , err_ret , flags ) ; }
| <S2SV_ModStart> NULL ; } if ( * flags & PyPARSE_TYPE_COMMENTS ) { tok -> type_comments = 1 ; }
| python@typed_ast/dcfcd146f8e6fc5c2fc16a4c192a0c5f5ca8c53c | CVE-2019-19275 | https://github.com/python/typed_ast/commit/dcfcd146f8e6fc5c2fc16a4c192a0c5f5ca8c53c | 2019-11-26T15:15Z |
235 | CWE-119 | CWE-119 static __u8 * kye_report_fixup ( struct hid_device * hdev , __u8 * rdesc , unsigned int * rsize ) { switch ( hdev -> product ) { case USB_DEVICE_ID_KYE_ERGO_525V : <S2SV_StartBug> if ( * rsize >= 74 && <S2SV_EndBug> <S2SV_StartBug> rdesc [ 61 ] == 0x05 && rdesc [ 62 ] == 0x08 && <S2SV_EndBug> rdesc [ 63 ] == 0x19 && rdesc [ 64 ] == 0x08 && rdesc [ 65 ] == 0x29 && rdesc [ 66 ] == 0x0f && rdesc [ 71 ] == 0x75 && rdesc [ 72 ] == 0x08 && rdesc [ 73 ] == 0x95 && rdesc [ 74 ] == 0x01 ) { hid_info ( hdev , "fixing<S2SV_blank>up<S2SV_blank>Kye/Genius<S2SV_blank>Ergo<S2SV_blank>Mouse<S2SV_blank>" "report<S2SV_blank>descriptor\\n" ) ; rdesc [ 62 ] = 0x09 ; rdesc [ 64 ] = 0x04 ; rdesc [ 66 ] = 0x07 ; rdesc [ 72 ] = 0x01 ; rdesc [ 74 ] = 0x08 ; } break ; case USB_DEVICE_ID_KYE_EASYPEN_I405X : if ( * rsize == EASYPEN_I405X_RDESC_ORIG_SIZE ) { rdesc = easypen_i405x_rdesc_fixed ; * rsize = sizeof ( easypen_i405x_rdesc_fixed ) ; } break ; case USB_DEVICE_ID_KYE_MOUSEPEN_I608X : if ( * rsize == MOUSEPEN_I608X_RDESC_ORIG_SIZE ) { rdesc = mousepen_i608x_rdesc_fixed ; * rsize = sizeof ( mousepen_i608x_rdesc_fixed ) ; } break ; case USB_DEVICE_ID_KYE_EASYPEN_M610X : if ( * rsize == EASYPEN_M610X_RDESC_ORIG_SIZE ) { rdesc = easypen_m610x_rdesc_fixed ; * rsize = sizeof ( easypen_m610x_rdesc_fixed ) ; } break ; case USB_DEVICE_ID_GENIUS_GILA_GAMING_MOUSE : rdesc = kye_consumer_control_fixup ( hdev , rdesc , rsize , 104 , "Genius<S2SV_blank>Gila<S2SV_blank>Gaming<S2SV_blank>Mouse" ) ; break ; case USB_DEVICE_ID_GENIUS_GX_IMPERATOR : rdesc = kye_consumer_control_fixup ( hdev , rdesc , rsize , 83 , "Genius<S2SV_blank>Gx<S2SV_blank>Imperator<S2SV_blank>Keyboard" ) ; break ; case USB_DEVICE_ID_GENIUS_MANTICORE : rdesc = kye_consumer_control_fixup ( hdev , rdesc , rsize , 104 , "Genius<S2SV_blank>Manticore<S2SV_blank>Keyboard" ) ; break ; } return rdesc ; }
| <S2SV_ModStart> * rsize >= 75 && rdesc [ 61 ] == 0x05 && rdesc [ 62 ] == 0x08 && rdesc [ 63 ] == 0x19 && rdesc [ 64 ] == 0x08 && rdesc [ 65 ] == 0x29 && rdesc [ 66 ] == 0x0f && rdesc [ 71 ] == 0x75 && rdesc [ 72 ] == 0x08 && rdesc [ 73 ] == 0x95 && rdesc [ 74 ] == 0x01 ) { hid_info ( hdev , "fixing<S2SV_blank>up<S2SV_blank>Kye/Genius<S2SV_blank>Ergo<S2SV_blank>Mouse<S2SV_blank>" "report<S2SV_blank>descriptor\\n" ) ; <S2SV_ModEnd> rdesc [ 62 <S2SV_ModStart> [ 62 ] = 0x09 ; rdesc [ 64 ] = 0x04 ; rdesc [ 66 ] = 0x07 ; rdesc [ 72 ] = 0x01 ; rdesc [ 74 ] = 0x08 <S2SV_ModEnd> ; } break
| torvalds@linux/4ab25786c87eb20857bbb715c3ae34ec8fd6a214 | CVE-2014-3184 | https://github.com/torvalds/linux/commit/4ab25786c87eb20857bbb715c3ae34ec8fd6a214 | 2014-09-28T10:55Z |
236 | CWE-400 | CWE-400 static zend_bool add_post_var ( zval * arr , post_var_data_t * var , zend_bool eof TSRMLS_DC ) { <S2SV_StartBug> char * ksep , * vsep , * val ; <S2SV_EndBug> size_t klen , vlen ; unsigned int new_vlen ; if ( var -> ptr >= var -> end ) { return 0 ; } <S2SV_StartBug> vsep = memchr ( var -> ptr , '&' , var -> end - var -> ptr ) ; <S2SV_EndBug> if ( ! vsep ) { <S2SV_StartBug> if ( ! eof ) { <S2SV_EndBug> return 0 ; } else { vsep = var -> end ; } } ksep = memchr ( var -> ptr , '=' , vsep - var -> ptr ) ; if ( ksep ) { * ksep = '\\0' ; klen = ksep - var -> ptr ; vlen = vsep - ++ ksep ; } else { ksep = "" ; klen = vsep - var -> ptr ; vlen = 0 ; } php_url_decode ( var -> ptr , klen ) ; val = estrndup ( ksep , vlen ) ; if ( vlen ) { vlen = php_url_decode ( val , vlen ) ; } if ( sapi_module . input_filter ( PARSE_POST , var -> ptr , & val , vlen , & new_vlen TSRMLS_CC ) ) { php_register_variable_safe ( var -> ptr , val , new_vlen , arr TSRMLS_CC ) ; } efree ( val ) ; var -> ptr = vsep + ( vsep != var -> end ) ; <S2SV_StartBug> return 1 ; <S2SV_EndBug> }
| <S2SV_ModStart> { char * start , * <S2SV_ModStart> 0 ; } start = var -> ptr + var -> already_scanned ; <S2SV_ModStart> = memchr ( start <S2SV_ModEnd> , '&' , <S2SV_ModStart> -> end - start <S2SV_ModEnd> ) ; if <S2SV_ModStart> eof ) { var -> already_scanned = var -> end - var -> ptr ; <S2SV_ModStart> end ) ; var -> already_scanned = 0 ;
| php@php-src/0f8cf3b8497dc45c010c44ed9e96518e11e19fc3 | CVE-2017-11142 | https://github.com/php/php-src/commit/0f8cf3b8497dc45c010c44ed9e96518e11e19fc3 | 2017-07-10T14:29Z |
237 | CWE-787 | CWE-787 uint32_t * GetPayload ( size_t handle , uint32_t * lastpayload , uint32_t index ) { mp4object * mp4 = ( mp4object * ) handle ; if ( mp4 == NULL ) return NULL ; uint32_t * MP4buffer = NULL ; if ( index < mp4 -> indexcount && mp4 -> mediafp ) { MP4buffer = ( uint32_t * ) realloc ( ( void * ) lastpayload , mp4 -> metasizes [ index ] ) ; if ( MP4buffer ) { <S2SV_StartBug> LONGSEEK ( mp4 -> mediafp , mp4 -> metaoffsets [ index ] , SEEK_SET ) ; <S2SV_EndBug> fread ( MP4buffer , 1 , mp4 -> metasizes [ index ] , mp4 -> mediafp ) ; <S2SV_StartBug> return MP4buffer ; <S2SV_EndBug> } } return NULL ; }
| <S2SV_ModStart> MP4buffer ) { if ( mp4 -> filesize > mp4 -> metaoffsets [ index ] + mp4 -> metasizes [ index ] ) { <S2SV_ModStart> mediafp ) ; mp4 -> filepos = mp4 -> metaoffsets [ index ] + mp4 -> metasizes [ index ] ; <S2SV_ModStart> return MP4buffer ; }
| gopro@gpmf-parser/341f12cd5b97ab419e53853ca00176457c9f1681 | CVE-2019-15148 | https://github.com/gopro/gpmf-parser/commit/341f12cd5b97ab419e53853ca00176457c9f1681 | 2019-08-18T19:15Z |
238 | CWE-119 | CWE-119 vpx_codec_err_t vp9_set_reference_dec ( VP9_COMMON * cm , VP9_REFFRAME ref_frame_flag , YV12_BUFFER_CONFIG * sd ) { <S2SV_StartBug> RefBuffer * ref_buf = NULL ; <S2SV_EndBug> if ( ref_frame_flag == VP9_LAST_FLAG ) { ref_buf = & cm -> frame_refs [ 0 ] ; } else if ( ref_frame_flag == VP9_GOLD_FLAG ) { ref_buf = & cm -> frame_refs [ 1 ] ; } else if ( ref_frame_flag == VP9_ALT_FLAG ) { ref_buf = & cm -> frame_refs [ 2 ] ; } else { vpx_internal_error ( & cm -> error , VPX_CODEC_ERROR , "Invalid<S2SV_blank>reference<S2SV_blank>frame" ) ; return cm -> error . error_code ; } if ( ! equal_dimensions ( ref_buf -> buf , sd ) ) { vpx_internal_error ( & cm -> error , VPX_CODEC_ERROR , "Incorrect<S2SV_blank>buffer<S2SV_blank>dimensions" ) ; } else { int * ref_fb_ptr = & ref_buf -> idx ; const int free_fb = get_free_fb ( cm ) ; <S2SV_StartBug> cm -> frame_bufs [ free_fb ] . ref_count -- ; <S2SV_EndBug> <S2SV_StartBug> ref_cnt_fb ( cm -> frame_bufs , ref_fb_ptr , free_fb ) ; <S2SV_EndBug> <S2SV_StartBug> ref_buf -> buf = & cm -> frame_bufs [ * ref_fb_ptr ] . buf ; <S2SV_EndBug> vp8_yv12_copy_frame ( sd , ref_buf -> buf ) ; } return cm -> error . error_code ; }
| <S2SV_ModStart> ref_buf = NULL ; RefCntBuffer * const frame_bufs = cm -> buffer_pool -> frame_bufs <S2SV_ModStart> cm ) ; if ( cm -> new_fb_idx == INVALID_IDX ) return VPX_CODEC_MEM_ERROR ; -- <S2SV_ModEnd> frame_bufs [ free_fb <S2SV_ModStart> ] . ref_count <S2SV_ModEnd> ; ref_cnt_fb ( <S2SV_ModStart> ; ref_cnt_fb ( <S2SV_ModEnd> frame_bufs , ref_fb_ptr <S2SV_ModStart> buf = & <S2SV_ModEnd> frame_bufs [ *
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
239 | CWE-000 | CWE-000 WORD32 ih264d_parse_islice_data_cavlc ( dec_struct_t * ps_dec , dec_slice_params_t * ps_slice , UWORD16 u2_first_mb_in_slice ) { UWORD8 uc_more_data_flag ; UWORD8 u1_num_mbs , u1_mb_idx ; dec_mb_info_t * ps_cur_mb_info ; deblk_mb_t * ps_cur_deblk_mb ; dec_bit_stream_t * const ps_bitstrm = ps_dec -> ps_bitstrm ; UWORD32 * pu4_bitstrm_ofst = & ps_bitstrm -> u4_ofst ; UWORD32 * pu4_bitstrm_buf = ps_bitstrm -> pu4_buffer ; UWORD16 i2_pic_wdin_mbs = ps_dec -> u2_frm_wd_in_mbs ; WORD16 i2_cur_mb_addr ; UWORD8 u1_mbaff ; UWORD8 u1_num_mbs_next , u1_end_of_row , u1_tfr_n_mb ; WORD32 ret = OK ; ps_dec -> u1_qp = ps_slice -> u1_slice_qp ; ih264d_update_qp ( ps_dec , 0 ) ; u1_mbaff = ps_slice -> u1_mbaff_frame_flag ; u1_mb_idx = ps_dec -> u1_mb_idx ; u1_num_mbs = u1_mb_idx ; uc_more_data_flag = 1 ; i2_cur_mb_addr = u2_first_mb_in_slice << u1_mbaff ; do { UWORD8 u1_mb_type ; ps_dec -> pv_prev_mb_parse_tu_coeff_data = ps_dec -> pv_parse_tu_coeff_data ; if ( i2_cur_mb_addr > ps_dec -> ps_cur_sps -> u2_max_mb_addr ) { ret = ERROR_MB_ADDRESS_T ; break ; } ps_cur_mb_info = ps_dec -> ps_nmb_info + u1_num_mbs ; ps_dec -> u4_num_mbs_cur_nmb = u1_num_mbs ; ps_dec -> u4_num_pmbair = ( u1_num_mbs >> u1_mbaff ) ; ps_cur_mb_info -> u1_end_of_slice = 0 ; ps_dec -> pf_get_mb_info ( ps_dec , i2_cur_mb_addr , ps_cur_mb_info , 0 ) ; ps_cur_deblk_mb = ps_dec -> ps_deblk_mbn + u1_num_mbs ; if ( ps_dec -> u4_app_disable_deblk_frm == 0 ) ih264d_set_deblocking_parameters ( ps_cur_deblk_mb , ps_slice , ps_dec -> u1_mb_ngbr_availablity , ps_dec -> u1_cur_mb_fld_dec_flag ) ; ps_cur_deblk_mb -> u1_mb_type = ps_cur_deblk_mb -> u1_mb_type | D_INTRA_MB ; { UWORD32 u4_bitstream_offset = * pu4_bitstrm_ofst ; UWORD32 u4_word , u4_ldz , u4_temp ; NEXTBITS_32 ( u4_word , u4_bitstream_offset , pu4_bitstrm_buf ) ; u4_ldz = CLZ ( u4_word ) ; u4_bitstream_offset += ( u4_ldz + 1 ) ; u4_word = 0 ; if ( u4_ldz ) GETBITS ( u4_word , u4_bitstream_offset , pu4_bitstrm_buf , u4_ldz ) ; * pu4_bitstrm_ofst = u4_bitstream_offset ; u4_temp = ( ( 1 << u4_ldz ) + u4_word - 1 ) ; if ( u4_temp > 25 ) return ERROR_MB_TYPE ; u1_mb_type = u4_temp ; } ps_cur_mb_info -> u1_mb_type = u1_mb_type ; COPYTHECONTEXT ( "u1_mb_type" , u1_mb_type ) ; if ( 25 == u1_mb_type ) { ps_cur_mb_info -> ps_curmb -> u1_mb_type = I_PCM_MB ; ret = ih264d_parse_ipcm_mb ( ps_dec , ps_cur_mb_info , u1_num_mbs ) ; if ( ret != OK ) return ret ; ps_cur_deblk_mb -> u1_mb_qp = 0 ; } else { ret = ih264d_parse_imb_cavlc ( ps_dec , ps_cur_mb_info , u1_num_mbs , u1_mb_type ) ; if ( ret != OK ) return ret ; ps_cur_deblk_mb -> u1_mb_qp = ps_dec -> u1_qp ; } if ( u1_mbaff ) { ih264d_update_mbaff_left_nnz ( ps_dec , ps_cur_mb_info ) ; <S2SV_StartBug> } <S2SV_EndBug> i2_cur_mb_addr ++ ; uc_more_data_flag = MORE_RBSP_DATA ( ps_bitstrm ) ; { mv_pred_t * ps_mv_nmb_start = ps_dec -> ps_mv_cur + ( u1_num_mbs << 4 ) ; mv_pred_t s_mvPred = { { 0 , 0 , 0 , 0 } , { - 1 , - 1 } , 0 , 0 } ; ih264d_rep_mv_colz ( ps_dec , & s_mvPred , ps_mv_nmb_start , 0 , ( UWORD8 ) ( ps_dec -> u1_cur_mb_fld_dec_flag << 1 ) , 4 , 4 ) ; } if ( ps_dec -> u4_num_cores < 3 ) { if ( ps_dec -> u4_app_disable_deblk_frm == 0 ) ps_dec -> pf_compute_bs ( ps_dec , ps_cur_mb_info , ( UWORD16 ) ( u1_num_mbs >> u1_mbaff ) ) ; } u1_num_mbs ++ ; u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec -> u2_mbx - 1 ; u1_end_of_row = ( ! u1_num_mbs_next ) && ( ! ( u1_mbaff && ( u1_num_mbs & 0x01 ) ) ) ; u1_tfr_n_mb = ( u1_num_mbs == ps_dec -> u1_recon_mb_grp ) || u1_end_of_row || ( ! uc_more_data_flag ) ; ps_cur_mb_info -> u1_end_of_slice = ( ! uc_more_data_flag ) ; if ( u1_tfr_n_mb || ( ! uc_more_data_flag ) ) { if ( ps_dec -> u1_separate_parse ) { ih264d_parse_tfr_nmb ( ps_dec , u1_mb_idx , u1_num_mbs , u1_num_mbs_next , u1_tfr_n_mb , u1_end_of_row ) ; ps_dec -> ps_nmb_info += u1_num_mbs ; } else { ih264d_decode_recon_tfr_nmb ( ps_dec , u1_mb_idx , u1_num_mbs , u1_num_mbs_next , u1_tfr_n_mb , u1_end_of_row ) ; } ps_dec -> u2_total_mbs_coded += u1_num_mbs ; if ( u1_tfr_n_mb ) u1_num_mbs = 0 ; u1_mb_idx = u1_num_mbs ; ps_dec -> u1_mb_idx = u1_num_mbs ; } } while ( uc_more_data_flag ) ; ps_dec -> u4_num_mbs_cur_nmb = 0 ; ps_dec -> ps_cur_slice -> u4_mbs_in_slice = i2_cur_mb_addr - ( u2_first_mb_in_slice << u1_mbaff ) ; return ret ; }
| <S2SV_ModStart> ps_cur_mb_info ) ; if ( ! uc_more_data_flag && ( 0 == ( i2_cur_mb_addr & 1 ) ) ) { return ERROR_EOB_FLUSHBITS_T ; }
| external@libavc/7950bf47b6944546a0aff11a7184947de9591b51 | CVE-2017-0550 | https://android.googlesource.com/platform/external/libavc/+/7950bf47b6944546a0aff11a7184947de9591b51 | 2017-04-07T22:59Z |
240 | CWE-119 | CWE-119 <S2SV_StartBug> static int write_skip ( const VP9_COMP * cpi , int segment_id , const MODE_INFO * mi , <S2SV_EndBug> <S2SV_StartBug> vp9_writer * w ) { <S2SV_EndBug> <S2SV_StartBug> const MACROBLOCKD * const xd = & cpi -> mb . e_mbd ; <S2SV_EndBug> if ( vp9_segfeature_active ( & cpi -> common . seg , segment_id , SEG_LVL_SKIP ) ) { return 1 ; } else { const int skip = mi -> mbmi . skip ; <S2SV_StartBug> vp9_write ( w , skip , vp9_get_skip_prob ( & cpi -> common , xd ) ) ; <S2SV_EndBug> return skip ; } }
| <S2SV_ModStart> write_skip ( const VP9_COMMON * cm , const MACROBLOCKD * xd , <S2SV_ModEnd> int segment_id , <S2SV_ModStart> * mi , vpx_writer <S2SV_ModEnd> * w ) <S2SV_ModStart> w ) { if ( segfeature_active ( & cm -> <S2SV_ModEnd> seg , segment_id <S2SV_ModStart> . skip ; vpx_write <S2SV_ModEnd> ( w , <S2SV_ModStart> , vp9_get_skip_prob ( cm <S2SV_ModEnd> , xd )
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
241 | CWE-125 | CWE-125 static void ip_optprint ( netdissect_options * ndo , register const u_char * cp , u_int length ) { register u_int option_len ; const char * sep = "" ; for ( ; length > 0 ; cp += option_len , length -= option_len ) { u_int option_code ; ND_PRINT ( ( ndo , "%s" , sep ) ) ; sep = "," ; ND_TCHECK ( * cp ) ; option_code = * cp ; ND_PRINT ( ( ndo , "%s" , tok2str ( ip_option_values , "unknown<S2SV_blank>%u" , option_code ) ) ) ; if ( option_code == IPOPT_NOP || option_code == IPOPT_EOL ) option_len = 1 ; else { ND_TCHECK ( cp [ 1 ] ) ; option_len = cp [ 1 ] ; if ( option_len < 2 ) { ND_PRINT ( ( ndo , "<S2SV_blank>[bad<S2SV_blank>length<S2SV_blank>%u]" , option_len ) ) ; return ; } } if ( option_len > length ) { ND_PRINT ( ( ndo , "<S2SV_blank>[bad<S2SV_blank>length<S2SV_blank>%u]" , option_len ) ) ; return ; } ND_TCHECK2 ( * cp , option_len ) ; switch ( option_code ) { case IPOPT_EOL : return ; case IPOPT_TS : <S2SV_StartBug> ip_printts ( ndo , cp , option_len ) ; <S2SV_EndBug> break ; case IPOPT_RR : case IPOPT_SSRR : case IPOPT_LSRR : if ( ip_printroute ( ndo , cp , option_len ) == - 1 ) goto trunc ; break ; <S2SV_StartBug> case IPOPT_RA : <S2SV_EndBug> if ( option_len < 4 ) { ND_PRINT ( ( ndo , "<S2SV_blank>[bad<S2SV_blank>length<S2SV_blank>%u]" , option_len ) ) ; break ; } ND_TCHECK ( cp [ 3 ] ) ; if ( EXTRACT_16BITS ( & cp [ 2 ] ) != 0 ) ND_PRINT ( ( ndo , "<S2SV_blank>value<S2SV_blank>%u" , EXTRACT_16BITS ( & cp [ 2 ] ) ) ) ; break ; case IPOPT_NOP : case IPOPT_SECURITY : default : break ; } } return ; trunc : ND_PRINT ( ( ndo , "%s" , tstr ) ) ; }
| <S2SV_ModStart> case IPOPT_TS : if ( ip_printts <S2SV_ModEnd> ( ndo , <S2SV_ModStart> break ; case IPOPT_RR : case IPOPT_SSRR : case IPOPT_LSRR : if ( ip_printroute ( ndo , cp , option_len ) == - 1 ) goto trunc ; break ; case
| the-tcpdump-group@tcpdump/2c2cfbd2b771ac888bc5c4a6d922f749d3822538 | CVE-2017-13037 | https://github.com/the-tcpdump-group/tcpdump/commit/2c2cfbd2b771ac888bc5c4a6d922f749d3822538 | 2017-09-14T06:29Z |
242 | CWE-119 | CWE-119 static int check_entry_size_and_hooks ( struct ip6t_entry * e , struct xt_table_info * newinfo , const unsigned char * base , const unsigned char * limit , const unsigned int * hook_entries , const unsigned int * underflows , unsigned int valid_hooks ) { unsigned int h ; int err ; if ( ( unsigned long ) e % __alignof__ ( struct ip6t_entry ) != 0 || ( unsigned char * ) e + sizeof ( struct ip6t_entry ) >= limit || ( unsigned char * ) e + e -> next_offset > limit ) { duprintf ( "Bad<S2SV_blank>offset<S2SV_blank>%p\\n" , e ) ; return - EINVAL ; } if ( e -> next_offset < sizeof ( struct ip6t_entry ) + sizeof ( struct xt_entry_target ) ) { duprintf ( "checking:<S2SV_blank>element<S2SV_blank>%p<S2SV_blank>size<S2SV_blank>%u\\n" , e , e -> next_offset ) ; return - EINVAL ; } err = check_entry ( e ) ; if ( err ) return err ; for ( h = 0 ; h < NF_INET_NUMHOOKS ; h ++ ) { if ( ! ( valid_hooks & ( 1 << h ) ) ) continue ; if ( ( unsigned char * ) e - base == hook_entries [ h ] ) newinfo -> hook_entry [ h ] = hook_entries [ h ] ; if ( ( unsigned char * ) e - base == underflows [ h ] ) { if ( ! check_underflow ( e ) ) { <S2SV_StartBug> pr_err ( "Underflows<S2SV_blank>must<S2SV_blank>be<S2SV_blank>unconditional<S2SV_blank>and<S2SV_blank>" <S2SV_EndBug> "use<S2SV_blank>the<S2SV_blank>STANDARD<S2SV_blank>target<S2SV_blank>with<S2SV_blank>" "ACCEPT/DROP\\n" ) ; return - EINVAL ; } newinfo -> underflow [ h ] = underflows [ h ] ; } } e -> counters = ( ( struct xt_counters ) { 0 , 0 } ) ; e -> comefrom = 0 ; return 0 ; }
| <S2SV_ModStart> ) ) { pr_debug <S2SV_ModEnd> ( "Underflows<S2SV_blank>must<S2SV_blank>be<S2SV_blank>unconditional<S2SV_blank>and<S2SV_blank>" "use<S2SV_blank>the<S2SV_blank>STANDARD<S2SV_blank>target<S2SV_blank>with<S2SV_blank>"
| torvalds@linux/54d83fc74aa9ec72794373cb47432c5f7fb1a309 | CVE-2016-3134 | https://github.com/torvalds/linux/commit/54d83fc74aa9ec72794373cb47432c5f7fb1a309 | 2016-04-27T17:59Z |
243 | CWE-399 | CWE-399 static void kvmclock_reset ( struct kvm_vcpu * vcpu ) { <S2SV_StartBug> if ( vcpu -> arch . time_page ) { <S2SV_EndBug> kvm_release_page_dirty ( vcpu -> arch . time_page ) ; vcpu -> arch . time_page = NULL ; } }
| <S2SV_ModStart> vcpu ) { <S2SV_ModEnd> vcpu -> arch <S2SV_ModStart> -> arch . pv_time_enabled = false ; } <S2SV_ModEnd> <S2SV_null> <S2SV_null> <S2SV_null>
| torvalds@linux/0b79459b482e85cb7426aa7da683a9f2c97aeae1 | CVE-2013-1797 | https://github.com/torvalds/linux/commit/0b79459b482e85cb7426aa7da683a9f2c97aeae1 | 2013-03-22T11:59Z |
244 | CWE-264 | CWE-264 static long ion_ioctl ( struct file * filp , unsigned int cmd , unsigned long arg ) { struct ion_client * client = filp -> private_data ; struct ion_device * dev = client -> dev ; struct ion_handle * cleanup_handle = NULL ; int ret = 0 ; unsigned int dir ; union { struct ion_fd_data fd ; struct ion_allocation_data allocation ; struct ion_handle_data handle ; struct ion_custom_data custom ; } data ; dir = ion_ioctl_dir ( cmd ) ; if ( _IOC_SIZE ( cmd ) > sizeof ( data ) ) return - EINVAL ; if ( dir & _IOC_WRITE ) if ( copy_from_user ( & data , ( void __user * ) arg , _IOC_SIZE ( cmd ) ) ) return - EFAULT ; switch ( cmd ) { case ION_IOC_ALLOC : { struct ion_handle * handle ; handle = ion_alloc ( client , data . allocation . len , data . allocation . align , data . allocation . heap_id_mask , data . allocation . flags ) ; if ( IS_ERR ( handle ) ) return PTR_ERR ( handle ) ; data . allocation . handle = handle -> id ; cleanup_handle = handle ; break ; } case ION_IOC_FREE : { struct ion_handle * handle ; <S2SV_StartBug> handle = ion_handle_get_by_id ( client , data . handle . handle ) ; <S2SV_EndBug> <S2SV_StartBug> if ( IS_ERR ( handle ) ) <S2SV_EndBug> return PTR_ERR ( handle ) ; <S2SV_StartBug> ion_free ( client , handle ) ; <S2SV_EndBug> ion_handle_put ( handle ) ; break ; } case ION_IOC_SHARE : case ION_IOC_MAP : { struct ion_handle * handle ; handle = ion_handle_get_by_id ( client , data . handle . handle ) ; if ( IS_ERR ( handle ) ) return PTR_ERR ( handle ) ; data . fd . fd = ion_share_dma_buf_fd ( client , handle ) ; ion_handle_put ( handle ) ; if ( data . fd . fd < 0 ) ret = data . fd . fd ; break ; } case ION_IOC_IMPORT : { struct ion_handle * handle ; handle = ion_import_dma_buf_fd ( client , data . fd . fd ) ; if ( IS_ERR ( handle ) ) ret = PTR_ERR ( handle ) ; else data . handle . handle = handle -> id ; break ; } case ION_IOC_SYNC : { ret = ion_sync_for_device ( client , data . fd . fd ) ; break ; } case ION_IOC_CUSTOM : { if ( ! dev -> custom_ioctl ) return - ENOTTY ; ret = dev -> custom_ioctl ( client , data . custom . cmd , data . custom . arg ) ; break ; } default : return - ENOTTY ; } if ( dir & _IOC_READ ) { if ( copy_to_user ( ( void __user * ) arg , & data , _IOC_SIZE ( cmd ) ) ) { if ( cleanup_handle ) ion_free ( client , cleanup_handle ) ; return - EFAULT ; } } return ret ; }
| <S2SV_ModStart> * handle ; mutex_lock ( & client -> lock ) ; handle = ion_handle_get_by_id_nolock <S2SV_ModEnd> ( client , <S2SV_ModStart> handle ) ) { mutex_unlock ( & client -> lock ) ; <S2SV_ModStart> handle ) ; } ion_free_nolock ( client , handle ) ; ion_handle_put_nolock ( handle ) ; mutex_unlock ( & client -> lock <S2SV_ModEnd> ) ; break
| torvalds@linux/9590232bb4f4cc824f3425a6e1349afbe6d6d2b7 | CVE-2016-9120 | https://github.com/torvalds/linux/commit/9590232bb4f4cc824f3425a6e1349afbe6d6d2b7 | 2016-12-08T21:59Z |
245 | CWE-476 | CWE-476 long keyctl_update_key ( key_serial_t id , const void __user * _payload , size_t plen ) { key_ref_t key_ref ; void * payload ; long ret ; ret = - EINVAL ; if ( plen > PAGE_SIZE ) goto error ; payload = NULL ; <S2SV_StartBug> if ( _payload ) { <S2SV_EndBug> ret = - ENOMEM ; payload = kmalloc ( plen , GFP_KERNEL ) ; if ( ! payload ) goto error ; ret = - EFAULT ; if ( copy_from_user ( payload , _payload , plen ) != 0 ) goto error2 ; } key_ref = lookup_user_key ( id , 0 , KEY_NEED_WRITE ) ; if ( IS_ERR ( key_ref ) ) { ret = PTR_ERR ( key_ref ) ; goto error2 ; } ret = key_update ( key_ref , payload , plen ) ; key_ref_put ( key_ref ) ; error2 : kfree ( payload ) ; error : return ret ; }
| <S2SV_ModStart> ; if ( plen <S2SV_ModEnd> ) { ret
| torvalds@linux/5649645d725c73df4302428ee4e02c869248b4c5 | CVE-2017-15274 | https://github.com/torvalds/linux/commit/5649645d725c73df4302428ee4e02c869248b4c5 | 2017-10-12T00:29Z |
246 | CWE-19 | CWE-19 int xfs_attr3_leaf_clearflag ( struct xfs_da_args * args ) { struct xfs_attr_leafblock * leaf ; struct xfs_attr_leaf_entry * entry ; struct xfs_attr_leaf_name_remote * name_rmt ; struct xfs_buf * bp ; int error ; # ifdef DEBUG struct xfs_attr3_icleaf_hdr ichdr ; xfs_attr_leaf_name_local_t * name_loc ; int namelen ; char * name ; # endif trace_xfs_attr_leaf_clearflag ( args ) ; error = xfs_attr3_leaf_read ( args -> trans , args -> dp , args -> blkno , - 1 , & bp ) ; if ( error ) return ( error ) ; leaf = bp -> b_addr ; entry = & xfs_attr3_leaf_entryp ( leaf ) [ args -> index ] ; ASSERT ( entry -> flags & XFS_ATTR_INCOMPLETE ) ; # ifdef DEBUG xfs_attr3_leaf_hdr_from_disk ( & ichdr , leaf ) ; ASSERT ( args -> index < ichdr . count ) ; ASSERT ( args -> index >= 0 ) ; if ( entry -> flags & XFS_ATTR_LOCAL ) { name_loc = xfs_attr3_leaf_name_local ( leaf , args -> index ) ; namelen = name_loc -> namelen ; name = ( char * ) name_loc -> nameval ; } else { name_rmt = xfs_attr3_leaf_name_remote ( leaf , args -> index ) ; namelen = name_rmt -> namelen ; name = ( char * ) name_rmt -> name ; } ASSERT ( be32_to_cpu ( entry -> hashval ) == args -> hashval ) ; ASSERT ( namelen == args -> namelen ) ; ASSERT ( memcmp ( name , args -> name , namelen ) == 0 ) ; # endif entry -> flags &= ~ XFS_ATTR_INCOMPLETE ; xfs_trans_log_buf ( args -> trans , bp , XFS_DA_LOGRANGE ( leaf , entry , sizeof ( * entry ) ) ) ; if ( args -> rmtblkno ) { ASSERT ( ( entry -> flags & XFS_ATTR_LOCAL ) == 0 ) ; name_rmt = xfs_attr3_leaf_name_remote ( leaf , args -> index ) ; name_rmt -> valueblk = cpu_to_be32 ( args -> rmtblkno ) ; <S2SV_StartBug> name_rmt -> valuelen = cpu_to_be32 ( args -> valuelen ) ; <S2SV_EndBug> xfs_trans_log_buf ( args -> trans , bp , XFS_DA_LOGRANGE ( leaf , name_rmt , sizeof ( * name_rmt ) ) ) ; } return xfs_trans_roll ( & args -> trans , args -> dp ) ; }
| <S2SV_ModStart> ( args -> rmtvaluelen <S2SV_ModEnd> ) ; xfs_trans_log_buf
| torvalds@linux/8275cdd0e7ac550dcce2b3ef6d2fb3b808c1ae59 | CVE-2015-0274 | https://github.com/torvalds/linux/commit/8275cdd0e7ac550dcce2b3ef6d2fb3b808c1ae59 | 2015-03-16T10:59Z |
247 | CWE-400 | CWE-400 asmlinkage void do_sparc_fault ( struct pt_regs * regs , int text_fault , int write , unsigned long address ) { struct vm_area_struct * vma ; struct task_struct * tsk = current ; struct mm_struct * mm = tsk -> mm ; unsigned int fixup ; unsigned long g2 ; int from_user = ! ( regs -> psr & PSR_PS ) ; int fault , code ; if ( text_fault ) address = regs -> pc ; code = SEGV_MAPERR ; if ( ! ARCH_SUN4C && address >= TASK_SIZE ) goto vmalloc_fault ; if ( in_atomic ( ) || ! mm ) goto no_context ; <S2SV_StartBug> perf_sw_event ( PERF_COUNT_SW_PAGE_FAULTS , 1 , 0 , regs , address ) ; <S2SV_EndBug> down_read ( & mm -> mmap_sem ) ; if ( ! from_user && address >= PAGE_OFFSET ) goto bad_area ; vma = find_vma ( mm , address ) ; if ( ! vma ) goto bad_area ; if ( vma -> vm_start <= address ) goto good_area ; if ( ! ( vma -> vm_flags & VM_GROWSDOWN ) ) goto bad_area ; if ( expand_stack ( vma , address ) ) goto bad_area ; good_area : code = SEGV_ACCERR ; if ( write ) { if ( ! ( vma -> vm_flags & VM_WRITE ) ) goto bad_area ; } else { if ( ! ( vma -> vm_flags & ( VM_READ | VM_EXEC ) ) ) goto bad_area ; } fault = handle_mm_fault ( mm , vma , address , write ? FAULT_FLAG_WRITE : 0 ) ; if ( unlikely ( fault & VM_FAULT_ERROR ) ) { if ( fault & VM_FAULT_OOM ) goto out_of_memory ; else if ( fault & VM_FAULT_SIGBUS ) goto do_sigbus ; BUG ( ) ; } if ( fault & VM_FAULT_MAJOR ) { current -> maj_flt ++ ; <S2SV_StartBug> perf_sw_event ( PERF_COUNT_SW_PAGE_FAULTS_MAJ , 1 , 0 , <S2SV_EndBug> regs , address ) ; } else { current -> min_flt ++ ; <S2SV_StartBug> perf_sw_event ( PERF_COUNT_SW_PAGE_FAULTS_MIN , 1 , 0 , <S2SV_EndBug> regs , address ) ; } up_read ( & mm -> mmap_sem ) ; return ; bad_area : up_read ( & mm -> mmap_sem ) ; bad_area_nosemaphore : if ( from_user ) { do_fault_siginfo ( code , SIGSEGV , regs , text_fault ) ; return ; } no_context : g2 = regs -> u_regs [ UREG_G2 ] ; if ( ! from_user ) { fixup = search_extables_range ( regs -> pc , & g2 ) ; if ( fixup > 10 ) { extern const unsigned __memset_start [ ] ; extern const unsigned __memset_end [ ] ; extern const unsigned __csum_partial_copy_start [ ] ; extern const unsigned __csum_partial_copy_end [ ] ; # ifdef DEBUG_EXCEPTIONS printk ( "Exception:<S2SV_blank>PC<%08lx><S2SV_blank>faddr<%08lx>\\n" , regs -> pc , address ) ; printk ( "EX_TABLE:<S2SV_blank>insn<%08lx><S2SV_blank>fixup<%08x><S2SV_blank>g2<%08lx>\\n" , regs -> pc , fixup , g2 ) ; # endif if ( ( regs -> pc >= ( unsigned long ) __memset_start && regs -> pc < ( unsigned long ) __memset_end ) || ( regs -> pc >= ( unsigned long ) __csum_partial_copy_start && regs -> pc < ( unsigned long ) __csum_partial_copy_end ) ) { regs -> u_regs [ UREG_I4 ] = address ; regs -> u_regs [ UREG_I5 ] = regs -> pc ; } regs -> u_regs [ UREG_G2 ] = g2 ; regs -> pc = fixup ; regs -> npc = regs -> pc + 4 ; return ; } } unhandled_fault ( address , tsk , regs ) ; do_exit ( SIGKILL ) ; out_of_memory : up_read ( & mm -> mmap_sem ) ; if ( from_user ) { pagefault_out_of_memory ( ) ; return ; } goto no_context ; do_sigbus : up_read ( & mm -> mmap_sem ) ; do_fault_siginfo ( BUS_ADRERR , SIGBUS , regs , text_fault ) ; if ( ! from_user ) goto no_context ; vmalloc_fault : { int offset = pgd_index ( address ) ; pgd_t * pgd , * pgd_k ; pmd_t * pmd , * pmd_k ; pgd = tsk -> active_mm -> pgd + offset ; pgd_k = init_mm . pgd + offset ; if ( ! pgd_present ( * pgd ) ) { if ( ! pgd_present ( * pgd_k ) ) goto bad_area_nosemaphore ; pgd_val ( * pgd ) = pgd_val ( * pgd_k ) ; return ; } pmd = pmd_offset ( pgd , address ) ; pmd_k = pmd_offset ( pgd_k , address ) ; if ( pmd_present ( * pmd ) || ! pmd_present ( * pmd_k ) ) goto bad_area_nosemaphore ; * pmd = * pmd_k ; return ; } }
| <S2SV_ModStart> PERF_COUNT_SW_PAGE_FAULTS , 1 <S2SV_ModEnd> , regs , <S2SV_ModStart> , 1 , <S2SV_ModEnd> regs , address <S2SV_ModStart> , 1 , <S2SV_ModEnd> regs , address
| torvalds@linux/a8b0ca17b80e92faab46ee7179ba9e99ccb61233 | CVE-2011-2918 | https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233 | 2012-05-24T23:55Z |
248 | CWE-189 | CWE-189 static int sanitize_ptr_alu ( struct bpf_verifier_env * env , struct bpf_insn * insn , const struct bpf_reg_state * ptr_reg , struct bpf_reg_state * dst_reg , bool off_is_neg ) { struct bpf_verifier_state * vstate = env -> cur_state ; struct bpf_insn_aux_data * aux = cur_aux ( env ) ; bool ptr_is_dst_reg = ptr_reg == dst_reg ; u8 opcode = BPF_OP ( insn -> code ) ; u32 alu_state , alu_limit ; struct bpf_reg_state tmp ; bool ret ; <S2SV_StartBug> if ( env -> allow_ptr_leaks || BPF_SRC ( insn -> code ) == BPF_K ) <S2SV_EndBug> return 0 ; if ( vstate -> speculative ) goto do_sim ; alu_state = off_is_neg ? BPF_ALU_NEG_VALUE : 0 ; alu_state |= ptr_is_dst_reg ? BPF_ALU_SANITIZE_SRC : BPF_ALU_SANITIZE_DST ; if ( retrieve_ptr_limit ( ptr_reg , & alu_limit , opcode , off_is_neg ) ) return 0 ; <S2SV_StartBug> if ( aux -> alu_state && <S2SV_EndBug> ( aux -> alu_state != alu_state || aux -> alu_limit != alu_limit ) ) <S2SV_StartBug> return - EACCES ; <S2SV_EndBug> aux -> alu_state = alu_state ; aux -> alu_limit = alu_limit ; do_sim : if ( ! ptr_is_dst_reg ) { tmp = * dst_reg ; * dst_reg = * ptr_reg ; } ret = push_stack ( env , env -> insn_idx + 1 , env -> insn_idx , true ) ; if ( ! ptr_is_dst_reg ) * dst_reg = tmp ; return ! ret ? - EFAULT : 0 ; }
| <S2SV_ModStart> ; if ( can_skip_alu_sanitation ( env , insn ) <S2SV_ModEnd> ) return 0 <S2SV_ModStart> ; if ( update_alu_sanitation_state ( aux , alu_state , <S2SV_ModEnd> alu_limit ) ) <S2SV_ModStart> return - EACCES <S2SV_ModEnd> ; do_sim :
| torvalds@linux/d3bd7413e0ca40b60cf60d4003246d067cafdeda | CVE-2019-7308 | https://github.com/torvalds/linux/commit/d3bd7413e0ca40b60cf60d4003246d067cafdeda | 2019-02-01T22:29Z |
249 | CWE-125 | CWE-125 int obj2ast_alias ( PyObject * obj , alias_ty * out , PyArena * arena ) { PyObject * tmp = NULL ; identifier name ; identifier asname ; <S2SV_StartBug> if ( _PyObject_HasAttrId ( obj , & PyId_name ) ) { <S2SV_EndBug> int res ; <S2SV_StartBug> tmp = _PyObject_GetAttrId ( obj , & PyId_name ) ; <S2SV_EndBug> if ( tmp == NULL ) goto failed ; <S2SV_StartBug> res = obj2ast_identifier ( tmp , & name , arena ) ; <S2SV_EndBug> if ( res != 0 ) goto failed ; Py_CLEAR ( tmp ) ; <S2SV_StartBug> } else { <S2SV_EndBug> PyErr_SetString ( PyExc_TypeError , "required<S2SV_blank>field<S2SV_blank>\\"name\\"<S2SV_blank>missing<S2SV_blank>from<S2SV_blank>alias" ) ; return 1 ; } if ( exists_not_none ( obj , & PyId_asname ) ) { int res ; tmp = _PyObject_GetAttrId ( obj , & PyId_asname ) ; if ( tmp == NULL ) goto failed ; res = obj2ast_identifier ( tmp , & asname , arena ) ; if ( res != 0 ) goto failed ; Py_CLEAR ( tmp ) ; } else { asname = NULL ; } * out = alias ( name , asname , arena ) ; return 0 ; failed : Py_XDECREF ( tmp ) ; return 1 ; }
| <S2SV_ModStart> ; if ( lookup_attr_id <S2SV_ModEnd> ( obj , <S2SV_ModStart> , & PyId_name , & tmp ) < 0 ) { return 1 ; } if ( tmp == NULL ) { PyErr_SetString ( PyExc_TypeError , "required<S2SV_blank>field<S2SV_blank>\\"name\\"<S2SV_blank>missing<S2SV_blank>from<S2SV_blank>alias" ) ; return 1 ; } else <S2SV_ModEnd> { int res <S2SV_ModStart> int res ; res = obj2ast_identifier ( tmp , & name , arena ) ; if ( res != 0 <S2SV_ModEnd> ) goto failed <S2SV_ModStart> goto failed ; Py_CLEAR ( tmp ) ; } if ( lookup_attr_id ( obj , & PyId_asname , & tmp ) < 0 ) { return 1 ; } if ( tmp == NULL || tmp == Py_None ) { Py_CLEAR ( tmp ) ; asname = NULL ; } else { int res ; <S2SV_ModStart> tmp , & asname <S2SV_ModEnd> , arena ) <S2SV_ModStart> ) ; } <S2SV_ModEnd> * out =
| python@typed_ast/156afcb26c198e162504a57caddfe0acd9ed7dce | CVE-2019-19275 | https://github.com/python/typed_ast/commit/156afcb26c198e162504a57caddfe0acd9ed7dce | 2019-11-26T15:15Z |
250 | CWE-120 | CWE-120 static void mt76_add_fragment ( struct mt76_dev * dev , struct mt76_queue * q , void * data , int len , bool more ) { struct page * page = virt_to_head_page ( data ) ; int offset = data - page_address ( page ) ; struct sk_buff * skb = q -> rx_head ; <S2SV_StartBug> offset += q -> buf_offset ; <S2SV_EndBug> <S2SV_StartBug> skb_add_rx_frag ( skb , skb_shinfo ( skb ) -> nr_frags , page , offset , len , <S2SV_EndBug> <S2SV_StartBug> q -> buf_size ) ; <S2SV_EndBug> if ( more ) return ; q -> rx_head = NULL ; dev -> drv -> rx_skb ( dev , q - dev -> q_rx , skb ) ; }
| <S2SV_ModStart> -> rx_head ; struct skb_shared_info * shinfo = skb_shinfo ( skb ) ; if ( shinfo -> nr_frags < ARRAY_SIZE ( shinfo -> frags ) ) { <S2SV_ModStart> ( skb , shinfo <S2SV_ModEnd> -> nr_frags , <S2SV_ModStart> buf_size ) ; }
| torvalds@linux/b102f0c522cf668c8382c56a4f771b37d011cda2 | CVE-2020-12465 | https://github.com/torvalds/linux/commit/b102f0c522cf668c8382c56a4f771b37d011cda2 | 2020-04-29T19:15Z |
251 | CWE-120 | CWE-120 <S2SV_StartBug> int mutt_b64_decode ( char * out , const char * in ) <S2SV_EndBug> { int len = 0 ; unsigned char digit4 ; do { const unsigned char digit1 = in [ 0 ] ; if ( ( digit1 > 127 ) || ( base64val ( digit1 ) == BAD ) ) return - 1 ; const unsigned char digit2 = in [ 1 ] ; if ( ( digit2 > 127 ) || ( base64val ( digit2 ) == BAD ) ) return - 1 ; const unsigned char digit3 = in [ 2 ] ; if ( ( digit3 > 127 ) || ( ( digit3 != '=' ) && ( base64val ( digit3 ) == BAD ) ) ) return - 1 ; digit4 = in [ 3 ] ; if ( ( digit4 > 127 ) || ( ( digit4 != '=' ) && ( base64val ( digit4 ) == BAD ) ) ) return - 1 ; in += 4 ; <S2SV_StartBug> * out ++ = ( base64val ( digit1 ) << 2 ) | ( base64val ( digit2 ) >> 4 ) ; <S2SV_EndBug> len ++ ; if ( digit3 != '=' ) { <S2SV_StartBug> * out ++ = ( ( base64val ( digit2 ) << 4 ) & 0xf0 ) | ( base64val ( digit3 ) >> 2 ) ; <S2SV_EndBug> len ++ ; if ( digit4 != '=' ) { <S2SV_StartBug> * out ++ = ( ( base64val ( digit3 ) << 6 ) & 0xc0 ) | base64val ( digit4 ) ; <S2SV_EndBug> len ++ ; } } } while ( * in && digit4 != '=' ) ; return len ; }
| <S2SV_ModStart> char * in , size_t olen <S2SV_ModStart> += 4 ; if ( len == olen ) return len ; <S2SV_ModStart> '=' ) { if ( len == olen ) return len ; <S2SV_ModStart> '=' ) { if ( len == olen ) return len ;
| neomutt@neomutt/6f163e07ae68654d7ac5268cbb7565f6df79ad85 | CVE-2018-14359 | https://github.com/neomutt/neomutt/commit/6f163e07ae68654d7ac5268cbb7565f6df79ad85 | 2018-07-17T17:29Z |
252 | CWE-264 | CWE-264 static int do_remount ( struct path * path , int flags , int mnt_flags , void * data ) { int err ; struct super_block * sb = path -> mnt -> mnt_sb ; struct mount * mnt = real_mount ( path -> mnt ) ; if ( ! check_mnt ( mnt ) ) return - EINVAL ; if ( path -> dentry != path -> mnt -> mnt_root ) return - EINVAL ; if ( ( mnt -> mnt . mnt_flags & MNT_LOCK_READONLY ) && ! ( mnt_flags & MNT_READONLY ) ) { return - EPERM ; } <S2SV_StartBug> err = security_sb_remount ( sb , data ) ; <S2SV_EndBug> if ( err ) return err ; down_write ( & sb -> s_umount ) ; if ( flags & MS_BIND ) err = change_mount_flags ( path -> mnt , flags ) ; else if ( ! capable ( CAP_SYS_ADMIN ) ) err = - EPERM ; else err = do_remount_sb ( sb , flags , data , 0 ) ; if ( ! err ) { lock_mount_hash ( ) ; mnt_flags |= mnt -> mnt . mnt_flags & ~ MNT_USER_SETTABLE_MASK ; mnt -> mnt . mnt_flags = mnt_flags ; touch_mnt_namespace ( mnt -> mnt_ns ) ; unlock_mount_hash ( ) ; } up_write ( & sb -> s_umount ) ; return err ; }
| <S2SV_ModStart> EPERM ; } if ( ( mnt -> mnt . mnt_flags & MNT_LOCK_NODEV ) && ! ( mnt_flags & MNT_NODEV ) ) { return - EPERM ; } if ( ( mnt -> mnt . mnt_flags & MNT_LOCK_NOSUID ) && ! ( mnt_flags & MNT_NOSUID ) ) { return - EPERM ; } if ( ( mnt -> mnt . mnt_flags & MNT_LOCK_NOEXEC ) && ! ( mnt_flags & MNT_NOEXEC ) ) { return - EPERM ; } if ( ( mnt -> mnt . mnt_flags & MNT_LOCK_ATIME ) && ( ( mnt -> mnt . mnt_flags & MNT_ATIME_MASK ) != ( mnt_flags & MNT_ATIME_MASK ) ) ) { return - EPERM ; }
| torvalds@linux/9566d6742852c527bf5af38af5cbb878dad75705 | CVE-2014-5207 | https://github.com/torvalds/linux/commit/9566d6742852c527bf5af38af5cbb878dad75705 | 2014-08-18T11:15Z |
253 | CWE-354 | CWE-354 bool recovery_cipher_abort ( void ) <S2SV_StartBug> { <S2SV_EndBug> if ( awaiting_character ) { awaiting_character = false ; return true ; } return false ; }
| <S2SV_ModStart> void ) { recovery_started = false ;
| keepkey@keepkey-firmware/769714fcb569e7a4faff9530a2d9ac1f9d6e5680 | CVE-2019-18672 | https://github.com/keepkey/keepkey-firmware/commit/769714fcb569e7a4faff9530a2d9ac1f9d6e5680 | 2019-12-06T18:15Z |
254 | CWE-476 | CWE-476 static noinline int btrfs_ioctl_resize ( struct file * file , void __user * arg ) { struct inode * inode = file_inode ( file ) ; struct btrfs_fs_info * fs_info = btrfs_sb ( inode -> i_sb ) ; u64 new_size ; u64 old_size ; u64 devid = 1 ; struct btrfs_root * root = BTRFS_I ( inode ) -> root ; struct btrfs_ioctl_vol_args * vol_args ; struct btrfs_trans_handle * trans ; struct btrfs_device * device = NULL ; char * sizestr ; char * retptr ; char * devstr = NULL ; int ret = 0 ; int mod = 0 ; if ( ! capable ( CAP_SYS_ADMIN ) ) return - EPERM ; ret = mnt_want_write_file ( file ) ; if ( ret ) return ret ; if ( test_and_set_bit ( BTRFS_FS_EXCL_OP , & fs_info -> flags ) ) { mnt_drop_write_file ( file ) ; return BTRFS_ERROR_DEV_EXCL_RUN_IN_PROGRESS ; } vol_args = memdup_user ( arg , sizeof ( * vol_args ) ) ; if ( IS_ERR ( vol_args ) ) { ret = PTR_ERR ( vol_args ) ; goto out ; } vol_args -> name [ BTRFS_PATH_NAME_MAX ] = '\\0' ; sizestr = vol_args -> name ; devstr = strchr ( sizestr , ':' ) ; if ( devstr ) { sizestr = devstr + 1 ; * devstr = '\\0' ; devstr = vol_args -> name ; ret = kstrtoull ( devstr , 10 , & devid ) ; if ( ret ) goto out_free ; if ( ! devid ) { ret = - EINVAL ; goto out_free ; } btrfs_info ( fs_info , "resizing<S2SV_blank>devid<S2SV_blank>%llu" , devid ) ; } <S2SV_StartBug> device = btrfs_find_device ( fs_info -> fs_devices , devid , NULL , NULL ) ; <S2SV_EndBug> if ( ! device ) { btrfs_info ( fs_info , "resizer<S2SV_blank>unable<S2SV_blank>to<S2SV_blank>find<S2SV_blank>device<S2SV_blank>%llu" , devid ) ; ret = - ENODEV ; goto out_free ; } if ( ! test_bit ( BTRFS_DEV_STATE_WRITEABLE , & device -> dev_state ) ) { btrfs_info ( fs_info , "resizer<S2SV_blank>unable<S2SV_blank>to<S2SV_blank>apply<S2SV_blank>on<S2SV_blank>readonly<S2SV_blank>device<S2SV_blank>%llu" , devid ) ; ret = - EPERM ; goto out_free ; } if ( ! strcmp ( sizestr , "max" ) ) new_size = device -> bdev -> bd_inode -> i_size ; else { if ( sizestr [ 0 ] == '-' ) { mod = - 1 ; sizestr ++ ; } else if ( sizestr [ 0 ] == '+' ) { mod = 1 ; sizestr ++ ; } new_size = memparse ( sizestr , & retptr ) ; if ( * retptr != '\\0' || new_size == 0 ) { ret = - EINVAL ; goto out_free ; } } if ( test_bit ( BTRFS_DEV_STATE_REPLACE_TGT , & device -> dev_state ) ) { ret = - EPERM ; goto out_free ; } old_size = btrfs_device_get_total_bytes ( device ) ; if ( mod < 0 ) { if ( new_size > old_size ) { ret = - EINVAL ; goto out_free ; } new_size = old_size - new_size ; } else if ( mod > 0 ) { if ( new_size > ULLONG_MAX - old_size ) { ret = - ERANGE ; goto out_free ; } new_size = old_size + new_size ; } if ( new_size < SZ_256M ) { ret = - EINVAL ; goto out_free ; } if ( new_size > device -> bdev -> bd_inode -> i_size ) { ret = - EFBIG ; goto out_free ; } new_size = round_down ( new_size , fs_info -> sectorsize ) ; btrfs_info_in_rcu ( fs_info , "new<S2SV_blank>size<S2SV_blank>for<S2SV_blank>%s<S2SV_blank>is<S2SV_blank>%llu" , rcu_str_deref ( device -> name ) , new_size ) ; if ( new_size > old_size ) { trans = btrfs_start_transaction ( root , 0 ) ; if ( IS_ERR ( trans ) ) { ret = PTR_ERR ( trans ) ; goto out_free ; } ret = btrfs_grow_device ( trans , device , new_size ) ; btrfs_commit_transaction ( trans ) ; } else if ( new_size < old_size ) { ret = btrfs_shrink_device ( device , new_size ) ; } out_free : kfree ( vol_args ) ; out : clear_bit ( BTRFS_FS_EXCL_OP , & fs_info -> flags ) ; mnt_drop_write_file ( file ) ; return ret ; }
| <S2SV_ModStart> NULL , NULL , true
| torvalds@linux/09ba3bc9dd150457c506e4661380a6183af651c1 | CVE-2019-18885 | https://github.com/torvalds/linux/commit/09ba3bc9dd150457c506e4661380a6183af651c1 | 2019-11-14T14:15Z |
255 | CWE-787 | CWE-787 static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { EXRContext * s = avctx -> priv_data ; ThreadFrame frame = { . f = data } ; AVFrame * picture = data ; uint8_t * ptr ; int i , y , ret , ymax ; int planes ; int out_line_size ; int nb_blocks ; uint64_t start_offset_table ; uint64_t start_next_scanline ; PutByteContext offset_table_writer ; bytestream2_init ( & s -> gb , avpkt -> data , avpkt -> size ) ; if ( ( ret = decode_header ( s , picture ) ) < 0 ) return ret ; switch ( s -> pixel_type ) { case EXR_FLOAT : case EXR_HALF : if ( s -> channel_offsets [ 3 ] >= 0 ) { if ( ! s -> is_luma ) { avctx -> pix_fmt = AV_PIX_FMT_GBRAPF32 ; } else { avctx -> pix_fmt = AV_PIX_FMT_GBRAPF32 ; } } else { if ( ! s -> is_luma ) { avctx -> pix_fmt = AV_PIX_FMT_GBRPF32 ; } else { avctx -> pix_fmt = AV_PIX_FMT_GRAYF32 ; } } break ; case EXR_UINT : if ( s -> channel_offsets [ 3 ] >= 0 ) { if ( ! s -> is_luma ) { avctx -> pix_fmt = AV_PIX_FMT_RGBA64 ; } else { avctx -> pix_fmt = AV_PIX_FMT_YA16 ; } } else { if ( ! s -> is_luma ) { avctx -> pix_fmt = AV_PIX_FMT_RGB48 ; } else { avctx -> pix_fmt = AV_PIX_FMT_GRAY16 ; } } break ; default : av_log ( avctx , AV_LOG_ERROR , "Missing<S2SV_blank>channel<S2SV_blank>list.\\n" ) ; return AVERROR_INVALIDDATA ; } if ( s -> apply_trc_type != AVCOL_TRC_UNSPECIFIED ) avctx -> color_trc = s -> apply_trc_type ; switch ( s -> compression ) { case EXR_RAW : case EXR_RLE : case EXR_ZIP1 : s -> scan_lines_per_block = 1 ; break ; case EXR_PXR24 : case EXR_ZIP16 : s -> scan_lines_per_block = 16 ; break ; case EXR_PIZ : case EXR_B44 : case EXR_B44A : s -> scan_lines_per_block = 32 ; break ; default : avpriv_report_missing_feature ( avctx , "Compression<S2SV_blank>%d" , s -> compression ) ; return AVERROR_PATCHWELCOME ; } if ( s -> xmin > s -> xmax || s -> ymin > s -> ymax || s -> ydelta == 0xFFFFFFFF || s -> xdelta == 0xFFFFFFFF ) { av_log ( avctx , AV_LOG_ERROR , "Wrong<S2SV_blank>or<S2SV_blank>missing<S2SV_blank>size<S2SV_blank>information.\\n" ) ; return AVERROR_INVALIDDATA ; } if ( ( ret = ff_set_dimensions ( avctx , s -> w , s -> h ) ) < 0 ) return ret ; s -> desc = av_pix_fmt_desc_get ( avctx -> pix_fmt ) ; if ( ! s -> desc ) return AVERROR_INVALIDDATA ; if ( s -> desc -> flags & AV_PIX_FMT_FLAG_FLOAT ) { planes = s -> desc -> nb_components ; out_line_size = avctx -> width * 4 ; } else { planes = 1 ; out_line_size = avctx -> width * 2 * s -> desc -> nb_components ; } if ( s -> is_tile ) { nb_blocks = ( ( s -> xdelta + s -> tile_attr . xSize - 1 ) / s -> tile_attr . xSize ) * ( ( s -> ydelta + s -> tile_attr . ySize - 1 ) / s -> tile_attr . ySize ) ; } else { nb_blocks = ( s -> ydelta + s -> scan_lines_per_block - 1 ) / s -> scan_lines_per_block ; } if ( ( ret = ff_thread_get_buffer ( avctx , & frame , 0 ) ) < 0 ) return ret ; if ( bytestream2_get_bytes_left ( & s -> gb ) / 8 < nb_blocks ) return AVERROR_INVALIDDATA ; if ( ! s -> is_tile && bytestream2_peek_le64 ( & s -> gb ) == 0 ) { av_log ( s -> avctx , AV_LOG_DEBUG , "recreating<S2SV_blank>invalid<S2SV_blank>scanline<S2SV_blank>offset<S2SV_blank>table\\n" ) ; start_offset_table = bytestream2_tell ( & s -> gb ) ; start_next_scanline = start_offset_table + nb_blocks * 8 ; bytestream2_init_writer ( & offset_table_writer , & avpkt -> data [ start_offset_table ] , nb_blocks * 8 ) ; for ( y = 0 ; y < nb_blocks ; y ++ ) { bytestream2_put_le64 ( & offset_table_writer , start_next_scanline ) ; bytestream2_seek ( & s -> gb , start_next_scanline + 4 , SEEK_SET ) ; start_next_scanline += ( bytestream2_get_le32 ( & s -> gb ) + 8 ) ; } bytestream2_seek ( & s -> gb , start_offset_table , SEEK_SET ) ; } s -> buf = avpkt -> data ; s -> buf_size = avpkt -> size ; for ( i = 0 ; i < planes ; i ++ ) { ptr = picture -> data [ i ] ; for ( y = 0 ; y < FFMIN ( s -> ymin , s -> h ) ; y ++ ) { memset ( ptr , 0 , out_line_size ) ; ptr += picture -> linesize [ i ] ; } } s -> picture = picture ; avctx -> execute2 ( avctx , decode_block , s -> thread_data , NULL , nb_blocks ) ; ymax = FFMAX ( 0 , s -> ymax + 1 ) ; <S2SV_StartBug> for ( i = 0 ; i < planes ; i ++ ) { <S2SV_EndBug> ptr = picture -> data [ i ] + ( ymax * picture -> linesize [ i ] ) ; for ( y = ymax ; y < avctx -> height ; y ++ ) { memset ( ptr , 0 , out_line_size ) ; ptr += picture -> linesize [ i ] ; } } picture -> pict_type = AV_PICTURE_TYPE_I ; * got_frame = 1 ; return avpkt -> size ; }
| <S2SV_ModStart> 1 ) ; if ( ymax < avctx -> height )
| FFmpeg@FFmpeg/b0a8b40294ea212c1938348ff112ef1b9bf16bb3 | CVE-2020-35965 | https://github.com/FFmpeg/FFmpeg/commit/b0a8b40294ea212c1938348ff112ef1b9bf16bb3 | 2021-01-04T02:15Z |
256 | CWE-125 | CWE-125 static MagickBooleanType Get8BIMProperty ( const Image * image , const char * key , ExceptionInfo * exception ) { char * attribute , format [ MagickPathExtent ] , name [ MagickPathExtent ] , * resource ; const StringInfo * profile ; const unsigned char * info ; long start , stop ; MagickBooleanType status ; register ssize_t i ; size_t length ; ssize_t count , id , sub_number ; profile = GetImageProfile ( image , "8bim" ) ; if ( profile == ( StringInfo * ) NULL ) return ( MagickFalse ) ; count = ( ssize_t ) sscanf ( key , "8BIM:%ld,%ld:%1024[^\\n]\\n%1024[^\\n]" , & start , & stop , name , format ) ; if ( ( count != 2 ) && ( count != 3 ) && ( count != 4 ) ) return ( MagickFalse ) ; if ( count < 4 ) ( void ) CopyMagickString ( format , "SVG" , MagickPathExtent ) ; if ( count < 3 ) * name = '\\0' ; sub_number = 1 ; if ( * name == '#' ) sub_number = ( ssize_t ) StringToLong ( & name [ 1 ] ) ; sub_number = MagickMax ( sub_number , 1L ) ; resource = ( char * ) NULL ; status = MagickFalse ; length = GetStringInfoLength ( profile ) ; info = GetStringInfoDatum ( profile ) ; while ( ( length > 0 ) && ( status == MagickFalse ) ) { if ( ReadPropertyByte ( & info , & length ) != ( unsigned char ) '8' ) continue ; if ( ReadPropertyByte ( & info , & length ) != ( unsigned char ) 'B' ) continue ; if ( ReadPropertyByte ( & info , & length ) != ( unsigned char ) 'I' ) continue ; if ( ReadPropertyByte ( & info , & length ) != ( unsigned char ) 'M' ) continue ; id = ( ssize_t ) ReadPropertyMSBShort ( & info , & length ) ; if ( id < ( ssize_t ) start ) continue ; if ( id > ( ssize_t ) stop ) continue ; if ( resource != ( char * ) NULL ) resource = DestroyString ( resource ) ; count = ( ssize_t ) ReadPropertyByte ( & info , & length ) ; if ( ( count != 0 ) && ( ( size_t ) count <= length ) ) { resource = ( char * ) NULL ; if ( ~ ( ( size_t ) count ) >= ( MagickPathExtent - 1 ) ) resource = ( char * ) AcquireQuantumMemory ( ( size_t ) count + MagickPathExtent , sizeof ( * resource ) ) ; if ( resource != ( char * ) NULL ) { for ( i = 0 ; i < ( ssize_t ) count ; i ++ ) resource [ i ] = ( char ) ReadPropertyByte ( & info , & length ) ; resource [ count ] = '\\0' ; } } if ( ( count & 0x01 ) == 0 ) ( void ) ReadPropertyByte ( & info , & length ) ; count = ( ssize_t ) ReadPropertyMSBLong ( & info , & length ) ; <S2SV_StartBug> if ( ( * name != '\\0' ) && ( * name != '#' ) ) <S2SV_EndBug> if ( ( resource == ( char * ) NULL ) || ( LocaleCompare ( name , resource ) != 0 ) ) { info += count ; length -= MagickMin ( count , ( ssize_t ) length ) ; continue ; } if ( ( * name == '#' ) && ( sub_number != 1 ) ) { sub_number -- ; info += count ; length -= MagickMin ( count , ( ssize_t ) length ) ; continue ; } attribute = ( char * ) NULL ; if ( ~ ( ( size_t ) count ) >= ( MagickPathExtent - 1 ) ) attribute = ( char * ) AcquireQuantumMemory ( ( size_t ) count + MagickPathExtent , sizeof ( * attribute ) ) ; if ( attribute != ( char * ) NULL ) { ( void ) CopyMagickMemory ( attribute , ( char * ) info , ( size_t ) count ) ; attribute [ count ] = '\\0' ; info += count ; length -= MagickMin ( count , ( ssize_t ) length ) ; if ( ( id <= 1999 ) || ( id >= 2999 ) ) ( void ) SetImageProperty ( ( Image * ) image , key , ( const char * ) attribute , exception ) ; else { char * path ; if ( LocaleCompare ( format , "svg" ) == 0 ) path = TraceSVGClippath ( ( unsigned char * ) attribute , ( size_t ) count , image -> columns , image -> rows ) ; else path = TracePSClippath ( ( unsigned char * ) attribute , ( size_t ) count ) ; ( void ) SetImageProperty ( ( Image * ) image , key , ( const char * ) path , exception ) ; path = DestroyString ( path ) ; } attribute = DestroyString ( attribute ) ; status = MagickTrue ; } } if ( resource != ( char * ) NULL ) resource = DestroyString ( resource ) ; return ( status ) ; }
| <S2SV_ModStart> if ( ( count < 0 ) || ( ( size_t ) count > length ) ) { length = 0 ; continue ; } if ( (
| ImageMagick@ImageMagick/dd84447b63a71fa8c3f47071b09454efc667767b | CVE-2016-6491 | https://github.com/ImageMagick/ImageMagick/commit/dd84447b63a71fa8c3f47071b09454efc667767b | 2016-12-13T15:59Z |
257 | CWE-476 | CWE-476 static void i8042_stop ( struct serio * serio ) { struct i8042_port * port = serio -> port_data ; <S2SV_StartBug> port -> exists = false ; <S2SV_EndBug> synchronize_irq ( I8042_AUX_IRQ ) ; synchronize_irq ( I8042_KBD_IRQ ) ; <S2SV_StartBug> port -> serio = NULL ; <S2SV_EndBug> }
| <S2SV_ModStart> -> port_data ; spin_lock_irq ( & i8042_lock ) ; <S2SV_ModStart> exists = false ; port -> serio = NULL ; spin_unlock_irq ( & i8042_lock ) <S2SV_ModStart> I8042_KBD_IRQ ) ; <S2SV_ModEnd> } <S2SV_null> <S2SV_null>
| torvalds@linux/340d394a789518018f834ff70f7534fc463d3226 | CVE-2017-18079 | https://github.com/torvalds/linux/commit/340d394a789518018f834ff70f7534fc463d3226 | 2018-01-29T05:29Z |
258 | CWE-000 | CWE-000 static struct file * path_openat ( int dfd , struct filename * pathname , struct nameidata * nd , const struct open_flags * op , int flags ) { struct file * file ; struct path path ; int opened = 0 ; int error ; file = get_empty_filp ( ) ; if ( IS_ERR ( file ) ) return file ; file -> f_flags = op -> open_flag ; if ( unlikely ( file -> f_flags & __O_TMPFILE ) ) { error = do_tmpfile ( dfd , pathname , nd , flags , op , file , & opened ) ; <S2SV_StartBug> goto out ; <S2SV_EndBug> } error = path_init ( dfd , pathname , flags , nd ) ; if ( unlikely ( error ) ) goto out ; error = do_last ( nd , & path , file , op , & opened , pathname ) ; while ( unlikely ( error > 0 ) ) { struct path link = path ; void * cookie ; if ( ! ( nd -> flags & LOOKUP_FOLLOW ) ) { path_put_conditional ( & path , nd ) ; path_put ( & nd -> path ) ; error = - ELOOP ; break ; } error = may_follow_link ( & link , nd ) ; if ( unlikely ( error ) ) break ; nd -> flags |= LOOKUP_PARENT ; nd -> flags &= ~ ( LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_EXCL ) ; error = follow_link ( & link , nd , & cookie ) ; if ( unlikely ( error ) ) break ; error = do_last ( nd , & path , file , op , & opened , pathname ) ; put_link ( nd , & link , cookie ) ; } out : path_cleanup ( nd ) ; <S2SV_StartBug> if ( ! ( opened & FILE_OPENED ) ) { <S2SV_EndBug> BUG_ON ( ! error ) ; put_filp ( file ) ; } if ( unlikely ( error ) ) { if ( error == - EOPENSTALE ) { if ( flags & LOOKUP_RCU ) error = - ECHILD ; else error = - ESTALE ; } file = ERR_PTR ( error ) ; } return file ; }
| <S2SV_ModStart> ) ; goto out2 <S2SV_ModEnd> ; } error <S2SV_ModStart> nd ) ; out2 :
| torvalds@linux/f15133df088ecadd141ea1907f2c96df67c729f0 | CVE-2015-5706 | https://github.com/torvalds/linux/commit/f15133df088ecadd141ea1907f2c96df67c729f0 | 2015-08-31T10:59Z |
259 | CWE-399 | CWE-399 static void emulate_load_store_insn ( struct pt_regs * regs , void __user * addr , unsigned int __user * pc ) { union mips_instruction insn ; unsigned long value ; unsigned int res ; perf_sw_event ( PERF_COUNT_SW_EMULATION_FAULTS , <S2SV_StartBug> 1 , 0 , regs , 0 ) ; <S2SV_EndBug> __get_user ( insn . word , pc ) ; switch ( insn . i_format . opcode ) { case ll_op : case lld_op : case sc_op : case scd_op : case ldl_op : case ldr_op : case lwl_op : case lwr_op : case sdl_op : case sdr_op : case swl_op : case swr_op : case lb_op : case lbu_op : case sb_op : goto sigbus ; case lh_op : if ( ! access_ok ( VERIFY_READ , addr , 2 ) ) goto sigbus ; __asm__ __volatile__ ( ".set\\tnoat\\n" # ifdef __BIG_ENDIAN "1:\\tlb\\t%0,<S2SV_blank>0(%2)\\n" "2:\\tlbu\\t$1,<S2SV_blank>1(%2)\\n\\t" # endif # ifdef __LITTLE_ENDIAN "1:\\tlb\\t%0,<S2SV_blank>1(%2)\\n" "2:\\tlbu\\t$1,<S2SV_blank>0(%2)\\n\\t" # endif "sll\\t%0,<S2SV_blank>0x8\\n\\t" "or\\t%0,<S2SV_blank>$1\\n\\t" "li\\t%1,<S2SV_blank>0\\n" "3:\\t.set\\tat\\n\\t" ".section\\t.fixup,\\"ax\\"\\n\\t" "4:\\tli\\t%1,<S2SV_blank>%3\\n\\t" "j\\t3b\\n\\t" ".previous\\n\\t" ".section\\t__ex_table,\\"a\\"\\n\\t" STR ( PTR ) "\\t1b,<S2SV_blank>4b\\n\\t" STR ( PTR ) "\\t2b,<S2SV_blank>4b\\n\\t" ".previous" : "=&r" ( value ) , "=r" ( res ) : "r" ( addr ) , "i" ( - EFAULT ) ) ; if ( res ) goto fault ; compute_return_epc ( regs ) ; regs -> regs [ insn . i_format . rt ] = value ; break ; case lw_op : if ( ! access_ok ( VERIFY_READ , addr , 4 ) ) goto sigbus ; __asm__ __volatile__ ( # ifdef __BIG_ENDIAN "1:\\tlwl\\t%0,<S2SV_blank>(%2)\\n" "2:\\tlwr\\t%0,<S2SV_blank>3(%2)\\n\\t" # endif # ifdef __LITTLE_ENDIAN "1:\\tlwl\\t%0,<S2SV_blank>3(%2)\\n" "2:\\tlwr\\t%0,<S2SV_blank>(%2)\\n\\t" # endif "li\\t%1,<S2SV_blank>0\\n" "3:\\t.section\\t.fixup,\\"ax\\"\\n\\t" "4:\\tli\\t%1,<S2SV_blank>%3\\n\\t" "j\\t3b\\n\\t" ".previous\\n\\t" ".section\\t__ex_table,\\"a\\"\\n\\t" STR ( PTR ) "\\t1b,<S2SV_blank>4b\\n\\t" STR ( PTR ) "\\t2b,<S2SV_blank>4b\\n\\t" ".previous" : "=&r" ( value ) , "=r" ( res ) : "r" ( addr ) , "i" ( - EFAULT ) ) ; if ( res ) goto fault ; compute_return_epc ( regs ) ; regs -> regs [ insn . i_format . rt ] = value ; break ; case lhu_op : if ( ! access_ok ( VERIFY_READ , addr , 2 ) ) goto sigbus ; __asm__ __volatile__ ( ".set\\tnoat\\n" # ifdef __BIG_ENDIAN "1:\\tlbu\\t%0,<S2SV_blank>0(%2)\\n" "2:\\tlbu\\t$1,<S2SV_blank>1(%2)\\n\\t" # endif # ifdef __LITTLE_ENDIAN "1:\\tlbu\\t%0,<S2SV_blank>1(%2)\\n" "2:\\tlbu\\t$1,<S2SV_blank>0(%2)\\n\\t" # endif "sll\\t%0,<S2SV_blank>0x8\\n\\t" "or\\t%0,<S2SV_blank>$1\\n\\t" "li\\t%1,<S2SV_blank>0\\n" "3:\\t.set\\tat\\n\\t" ".section\\t.fixup,\\"ax\\"\\n\\t" "4:\\tli\\t%1,<S2SV_blank>%3\\n\\t" "j\\t3b\\n\\t" ".previous\\n\\t" ".section\\t__ex_table,\\"a\\"\\n\\t" STR ( PTR ) "\\t1b,<S2SV_blank>4b\\n\\t" STR ( PTR ) "\\t2b,<S2SV_blank>4b\\n\\t" ".previous" : "=&r" ( value ) , "=r" ( res ) : "r" ( addr ) , "i" ( - EFAULT ) ) ; if ( res ) goto fault ; compute_return_epc ( regs ) ; regs -> regs [ insn . i_format . rt ] = value ; break ; case lwu_op : # ifdef CONFIG_64BIT if ( ! access_ok ( VERIFY_READ , addr , 4 ) ) goto sigbus ; __asm__ __volatile__ ( # ifdef __BIG_ENDIAN "1:\\tlwl\\t%0,<S2SV_blank>(%2)\\n" "2:\\tlwr\\t%0,<S2SV_blank>3(%2)\\n\\t" # endif # ifdef __LITTLE_ENDIAN "1:\\tlwl\\t%0,<S2SV_blank>3(%2)\\n" "2:\\tlwr\\t%0,<S2SV_blank>(%2)\\n\\t" # endif "dsll\\t%0,<S2SV_blank>%0,<S2SV_blank>32\\n\\t" "dsrl\\t%0,<S2SV_blank>%0,<S2SV_blank>32\\n\\t" "li\\t%1,<S2SV_blank>0\\n" "3:\\t.section\\t.fixup,\\"ax\\"\\n\\t" "4:\\tli\\t%1,<S2SV_blank>%3\\n\\t" "j\\t3b\\n\\t" ".previous\\n\\t" ".section\\t__ex_table,\\"a\\"\\n\\t" STR ( PTR ) "\\t1b,<S2SV_blank>4b\\n\\t" STR ( PTR ) "\\t2b,<S2SV_blank>4b\\n\\t" ".previous" : "=&r" ( value ) , "=r" ( res ) : "r" ( addr ) , "i" ( - EFAULT ) ) ; if ( res ) goto fault ; compute_return_epc ( regs ) ; regs -> regs [ insn . i_format . rt ] = value ; break ; # endif goto sigill ; case ld_op : # ifdef CONFIG_64BIT if ( ! access_ok ( VERIFY_READ , addr , 8 ) ) goto sigbus ; __asm__ __volatile__ ( # ifdef __BIG_ENDIAN "1:\\tldl\\t%0,<S2SV_blank>(%2)\\n" "2:\\tldr\\t%0,<S2SV_blank>7(%2)\\n\\t" # endif # ifdef __LITTLE_ENDIAN "1:\\tldl\\t%0,<S2SV_blank>7(%2)\\n" "2:\\tldr\\t%0,<S2SV_blank>(%2)\\n\\t" # endif "li\\t%1,<S2SV_blank>0\\n" "3:\\t.section\\t.fixup,\\"ax\\"\\n\\t" "4:\\tli\\t%1,<S2SV_blank>%3\\n\\t" "j\\t3b\\n\\t" ".previous\\n\\t" ".section\\t__ex_table,\\"a\\"\\n\\t" STR ( PTR ) "\\t1b,<S2SV_blank>4b\\n\\t" STR ( PTR ) "\\t2b,<S2SV_blank>4b\\n\\t" ".previous" : "=&r" ( value ) , "=r" ( res ) : "r" ( addr ) , "i" ( - EFAULT ) ) ; if ( res ) goto fault ; compute_return_epc ( regs ) ; regs -> regs [ insn . i_format . rt ] = value ; break ; # endif goto sigill ; case sh_op : if ( ! access_ok ( VERIFY_WRITE , addr , 2 ) ) goto sigbus ; value = regs -> regs [ insn . i_format . rt ] ; __asm__ __volatile__ ( # ifdef __BIG_ENDIAN ".set\\tnoat\\n" "1:\\tsb\\t%1,<S2SV_blank>1(%2)\\n\\t" "srl\\t$1,<S2SV_blank>%1,<S2SV_blank>0x8\\n" "2:\\tsb\\t$1,<S2SV_blank>0(%2)\\n\\t" ".set\\tat\\n\\t" # endif # ifdef __LITTLE_ENDIAN ".set\\tnoat\\n" "1:\\tsb\\t%1,<S2SV_blank>0(%2)\\n\\t" "srl\\t$1,%1,<S2SV_blank>0x8\\n" "2:\\tsb\\t$1,<S2SV_blank>1(%2)\\n\\t" ".set\\tat\\n\\t" # endif "li\\t%0,<S2SV_blank>0\\n" "3:\\n\\t" ".section\\t.fixup,\\"ax\\"\\n\\t" "4:\\tli\\t%0,<S2SV_blank>%3\\n\\t" "j\\t3b\\n\\t" ".previous\\n\\t" ".section\\t__ex_table,\\"a\\"\\n\\t" STR ( PTR ) "\\t1b,<S2SV_blank>4b\\n\\t" STR ( PTR ) "\\t2b,<S2SV_blank>4b\\n\\t" ".previous" : "=r" ( res ) : "r" ( value ) , "r" ( addr ) , "i" ( - EFAULT ) ) ; if ( res ) goto fault ; compute_return_epc ( regs ) ; break ; case sw_op : if ( ! access_ok ( VERIFY_WRITE , addr , 4 ) ) goto sigbus ; value = regs -> regs [ insn . i_format . rt ] ; __asm__ __volatile__ ( # ifdef __BIG_ENDIAN "1:\\tswl\\t%1,(%2)\\n" "2:\\tswr\\t%1,<S2SV_blank>3(%2)\\n\\t" # endif # ifdef __LITTLE_ENDIAN "1:\\tswl\\t%1,<S2SV_blank>3(%2)\\n" "2:\\tswr\\t%1,<S2SV_blank>(%2)\\n\\t" # endif "li\\t%0,<S2SV_blank>0\\n" "3:\\n\\t" ".section\\t.fixup,\\"ax\\"\\n\\t" "4:\\tli\\t%0,<S2SV_blank>%3\\n\\t" "j\\t3b\\n\\t" ".previous\\n\\t" ".section\\t__ex_table,\\"a\\"\\n\\t" STR ( PTR ) "\\t1b,<S2SV_blank>4b\\n\\t" STR ( PTR ) "\\t2b,<S2SV_blank>4b\\n\\t" ".previous" : "=r" ( res ) : "r" ( value ) , "r" ( addr ) , "i" ( - EFAULT ) ) ; if ( res ) goto fault ; compute_return_epc ( regs ) ; break ; case sd_op : # ifdef CONFIG_64BIT if ( ! access_ok ( VERIFY_WRITE , addr , 8 ) ) goto sigbus ; value = regs -> regs [ insn . i_format . rt ] ; __asm__ __volatile__ ( # ifdef __BIG_ENDIAN "1:\\tsdl\\t%1,(%2)\\n" "2:\\tsdr\\t%1,<S2SV_blank>7(%2)\\n\\t" # endif # ifdef __LITTLE_ENDIAN "1:\\tsdl\\t%1,<S2SV_blank>7(%2)\\n" "2:\\tsdr\\t%1,<S2SV_blank>(%2)\\n\\t" # endif "li\\t%0,<S2SV_blank>0\\n" "3:\\n\\t" ".section\\t.fixup,\\"ax\\"\\n\\t" "4:\\tli\\t%0,<S2SV_blank>%3\\n\\t" "j\\t3b\\n\\t" ".previous\\n\\t" ".section\\t__ex_table,\\"a\\"\\n\\t" STR ( PTR ) "\\t1b,<S2SV_blank>4b\\n\\t" STR ( PTR ) "\\t2b,<S2SV_blank>4b\\n\\t" ".previous" : "=r" ( res ) : "r" ( value ) , "r" ( addr ) , "i" ( - EFAULT ) ) ; if ( res ) goto fault ; compute_return_epc ( regs ) ; break ; # endif goto sigill ; case lwc1_op : case ldc1_op : case swc1_op : case sdc1_op : goto sigbus ; case lwc2_op : cu2_notifier_call_chain ( CU2_LWC2_OP , regs ) ; break ; case ldc2_op : cu2_notifier_call_chain ( CU2_LDC2_OP , regs ) ; break ; case swc2_op : cu2_notifier_call_chain ( CU2_SWC2_OP , regs ) ; break ; case sdc2_op : cu2_notifier_call_chain ( CU2_SDC2_OP , regs ) ; break ; default : goto sigill ; } # ifdef CONFIG_DEBUG_FS unaligned_instructions ++ ; # endif return ; fault : if ( fixup_exception ( regs ) ) return ; die_if_kernel ( "Unhandled<S2SV_blank>kernel<S2SV_blank>unaligned<S2SV_blank>access" , regs ) ; force_sig ( SIGSEGV , current ) ; return ; sigbus : die_if_kernel ( "Unhandled<S2SV_blank>kernel<S2SV_blank>unaligned<S2SV_blank>access" , regs ) ; force_sig ( SIGBUS , current ) ; return ; sigill : die_if_kernel ( "Unhandled<S2SV_blank>kernel<S2SV_blank>unaligned<S2SV_blank>access<S2SV_blank>or<S2SV_blank>invalid<S2SV_blank>instruction" , regs ) ; force_sig ( SIGILL , current ) ; }
| <S2SV_ModStart> PERF_COUNT_SW_EMULATION_FAULTS , 1 <S2SV_ModEnd> , regs ,
| torvalds@linux/a8b0ca17b80e92faab46ee7179ba9e99ccb61233 | CVE-2011-2918 | https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233 | 2012-05-24T23:55Z |
260 | CWE-125 | CWE-125 static x86newTokenType getToken ( const char * str , size_t * begin , size_t * end ) { <S2SV_StartBug> while ( begin && isspace ( ( ut8 ) str [ * begin ] ) ) { <S2SV_EndBug> ++ ( * begin ) ; } if ( ! str [ * begin ] ) { * end = * begin ; return TT_EOF ; <S2SV_StartBug> } else if ( isalpha ( ( ut8 ) str [ * begin ] ) ) { <S2SV_EndBug> * end = * begin ; <S2SV_StartBug> while ( end && isalnum ( ( ut8 ) str [ * end ] ) ) { <S2SV_EndBug> ++ ( * end ) ; } return TT_WORD ; <S2SV_StartBug> } else if ( isdigit ( ( ut8 ) str [ * begin ] ) ) { <S2SV_EndBug> * end = * begin ; while ( end && isalnum ( ( ut8 ) str [ * end ] ) ) { ++ ( * end ) ; } return TT_NUMBER ; } else { * end = * begin + 1 ; return TT_SPECIAL ; } }
| <S2SV_ModStart> end ) { if ( * begin > strlen ( str ) ) { return TT_EOF ; } <S2SV_ModStart> ( begin && str [ * begin ] && <S2SV_ModStart> TT_EOF ; } <S2SV_ModEnd> if ( isalpha <S2SV_ModStart> ( end && str [ * end ] && <S2SV_ModStart> TT_WORD ; } <S2SV_ModEnd> if ( isdigit
| radare@radare2/66191f780863ea8c66ace4040d0d04a8842e8432 | CVE-2018-19842 | https://github.com/radare/radare2/commit/66191f780863ea8c66ace4040d0d04a8842e8432 | 2018-12-04T09:29Z |
261 | CWE-119 | CWE-119 void oz_usb_rx ( struct oz_pd * pd , struct oz_elt * elt ) { struct oz_usb_hdr * usb_hdr = ( struct oz_usb_hdr * ) ( elt + 1 ) ; struct oz_usb_ctx * usb_ctx ; spin_lock_bh ( & pd -> app_lock [ OZ_APPID_USB ] ) ; usb_ctx = ( struct oz_usb_ctx * ) pd -> app_ctx [ OZ_APPID_USB ] ; if ( usb_ctx ) oz_usb_get ( usb_ctx ) ; spin_unlock_bh ( & pd -> app_lock [ OZ_APPID_USB ] ) ; if ( usb_ctx == NULL ) return ; if ( usb_ctx -> stopped ) goto done ; if ( usb_hdr -> elt_seq_num != 0 ) { if ( ( ( usb_ctx -> rx_seq_num - usb_hdr -> elt_seq_num ) & 0x80 ) == 0 ) goto done ; } usb_ctx -> rx_seq_num = usb_hdr -> elt_seq_num ; switch ( usb_hdr -> type ) { case OZ_GET_DESC_RSP : { struct oz_get_desc_rsp * body = ( struct oz_get_desc_rsp * ) usb_hdr ; <S2SV_StartBug> int data_len = elt -> length - <S2SV_EndBug> <S2SV_StartBug> sizeof ( struct oz_get_desc_rsp ) + 1 ; <S2SV_EndBug> u16 offs = le16_to_cpu ( get_unaligned ( & body -> offset ) ) ; u16 total_size = le16_to_cpu ( get_unaligned ( & body -> total_size ) ) ; oz_dbg ( ON , "USB_REQ_GET_DESCRIPTOR<S2SV_blank>-<S2SV_blank>cnf\\n" ) ; oz_hcd_get_desc_cnf ( usb_ctx -> hport , body -> req_id , body -> rcode , body -> data , data_len , offs , total_size ) ; } break ; case OZ_SET_CONFIG_RSP : { struct oz_set_config_rsp * body = ( struct oz_set_config_rsp * ) usb_hdr ; oz_hcd_control_cnf ( usb_ctx -> hport , body -> req_id , body -> rcode , NULL , 0 ) ; } break ; case OZ_SET_INTERFACE_RSP : { struct oz_set_interface_rsp * body = ( struct oz_set_interface_rsp * ) usb_hdr ; oz_hcd_control_cnf ( usb_ctx -> hport , body -> req_id , body -> rcode , NULL , 0 ) ; } break ; case OZ_VENDOR_CLASS_RSP : { struct oz_vendor_class_rsp * body = ( struct oz_vendor_class_rsp * ) usb_hdr ; oz_hcd_control_cnf ( usb_ctx -> hport , body -> req_id , body -> rcode , body -> data , elt -> length - sizeof ( struct oz_vendor_class_rsp ) + 1 ) ; } break ; case OZ_USB_ENDPOINT_DATA : oz_usb_handle_ep_data ( usb_ctx , usb_hdr , elt -> length ) ; break ; } done : oz_usb_put ( usb_ctx ) ; }
| <S2SV_ModStart> ) usb_hdr ; u16 offs , total_size ; u8 data_len ; if ( elt -> length < sizeof ( struct oz_get_desc_rsp ) - 1 ) break ; <S2SV_ModEnd> data_len = elt <S2SV_ModStart> -> length - ( <S2SV_ModStart> ( struct oz_get_desc_rsp ) - 1 ) ; offs = le16_to_cpu ( get_unaligned ( & body -> offset ) ) ; total_size = le16_to_cpu ( get_unaligned ( & body -> total_size ) ) ; oz_dbg ( ON , "USB_REQ_GET_DESCRIPTOR<S2SV_blank>-<S2SV_blank>cnf\\n" ) ; oz_hcd_get_desc_cnf ( usb_ctx -> hport , body -> req_id , body -> rcode , body -> data , data_len , offs , total_size ) ; } break ; case OZ_SET_CONFIG_RSP : { struct oz_set_config_rsp * body = ( struct oz_set_config_rsp * ) usb_hdr ; oz_hcd_control_cnf ( usb_ctx -> hport , body -> req_id , body -> rcode , NULL , 0 ) ; } break ; case OZ_SET_INTERFACE_RSP : { struct oz_set_interface_rsp * body = ( struct oz_set_interface_rsp * ) usb_hdr ; oz_hcd_control_cnf ( usb_ctx -> hport , body -> req_id , body -> rcode , NULL , 0 ) ; } break ; case OZ_VENDOR_CLASS_RSP : { struct oz_vendor_class_rsp * body = ( struct oz_vendor_class_rsp * ) usb_hdr ; oz_hcd_control_cnf ( usb_ctx -> hport , body -> req_id , body -> rcode , body -> data , elt -> length - sizeof ( struct oz_vendor_class_rsp <S2SV_ModStart> ) + 1 <S2SV_ModEnd> ) ; }
| torvalds@linux/d114b9fe78c8d6fc6e70808c2092aa307c36dc8e | CVE-2015-4002 | https://github.com/torvalds/linux/commit/d114b9fe78c8d6fc6e70808c2092aa307c36dc8e | 2015-06-07T23:59Z |
262 | CWE-119 | CWE-119 xmlChar * xmlStringLenDecodeEntities ( xmlParserCtxtPtr ctxt , const xmlChar * str , int len , int what , xmlChar end , xmlChar end2 , xmlChar end3 ) { xmlChar * buffer = NULL ; int buffer_size = 0 ; xmlChar * current = NULL ; xmlChar * rep = NULL ; const xmlChar * last ; xmlEntityPtr ent ; int c , l ; int nbchars = 0 ; if ( ( ctxt == NULL ) || ( str == NULL ) || ( len < 0 ) ) return ( NULL ) ; last = str + len ; if ( ( ( ctxt -> depth > 40 ) && ( ( ctxt -> options & XML_PARSE_HUGE ) == 0 ) ) || ( ctxt -> depth > 1024 ) ) { xmlFatalErr ( ctxt , XML_ERR_ENTITY_LOOP , NULL ) ; return ( NULL ) ; } buffer_size = XML_PARSER_BIG_BUFFER_SIZE ; buffer = ( xmlChar * ) xmlMallocAtomic ( buffer_size * sizeof ( xmlChar ) ) ; if ( buffer == NULL ) goto mem_error ; if ( str < last ) c = CUR_SCHAR ( str , l ) ; else c = 0 ; while ( ( c != 0 ) && ( c != end ) && ( c != end2 ) && ( c != end3 ) ) { if ( c == 0 ) break ; if ( ( c == '&' ) && ( str [ 1 ] == '#' ) ) { int val = xmlParseStringCharRef ( ctxt , & str ) ; if ( val != 0 ) { COPY_BUF ( 0 , buffer , nbchars , val ) ; } if ( nbchars > buffer_size - XML_PARSER_BUFFER_SIZE ) { growBuffer ( buffer , XML_PARSER_BUFFER_SIZE ) ; } } else if ( ( c == '&' ) && ( what & XML_SUBSTITUTE_REF ) ) { if ( xmlParserDebugEntities ) xmlGenericError ( xmlGenericErrorContext , "String<S2SV_blank>decoding<S2SV_blank>Entity<S2SV_blank>Reference:<S2SV_blank>%.30s\\n" , str ) ; ent = xmlParseStringEntityRef ( ctxt , & str ) ; if ( ( ctxt -> lastError . code == XML_ERR_ENTITY_LOOP ) || ( ctxt -> lastError . code == XML_ERR_INTERNAL_ERROR ) ) goto int_error ; if ( ent != NULL ) ctxt -> nbentities += ent -> checked ; if ( ( ent != NULL ) && ( ent -> etype == XML_INTERNAL_PREDEFINED_ENTITY ) ) { if ( ent -> content != NULL ) { COPY_BUF ( 0 , buffer , nbchars , ent -> content [ 0 ] ) ; if ( nbchars > buffer_size - XML_PARSER_BUFFER_SIZE ) { growBuffer ( buffer , XML_PARSER_BUFFER_SIZE ) ; } } else { xmlFatalErrMsg ( ctxt , XML_ERR_INTERNAL_ERROR , "predefined<S2SV_blank>entity<S2SV_blank>has<S2SV_blank>no<S2SV_blank>content\\n" ) ; } } else if ( ( ent != NULL ) && ( ent -> content != NULL ) ) { ctxt -> depth ++ ; rep = xmlStringDecodeEntities ( ctxt , ent -> content , what , 0 , 0 , 0 ) ; ctxt -> depth -- ; if ( rep != NULL ) { current = rep ; while ( * current != 0 ) { buffer [ nbchars ++ ] = * current ++ ; if ( nbchars > buffer_size - XML_PARSER_BUFFER_SIZE ) { if ( xmlParserEntityCheck ( ctxt , nbchars , ent ) ) goto int_error ; growBuffer ( buffer , XML_PARSER_BUFFER_SIZE ) ; } } xmlFree ( rep ) ; rep = NULL ; } } else if ( ent != NULL ) { int i = xmlStrlen ( ent -> name ) ; const xmlChar * cur = ent -> name ; buffer [ nbchars ++ ] = '&' ; if ( nbchars > buffer_size - i - XML_PARSER_BUFFER_SIZE ) { <S2SV_StartBug> growBuffer ( buffer , XML_PARSER_BUFFER_SIZE ) ; <S2SV_EndBug> } for ( ; i > 0 ; i -- ) buffer [ nbchars ++ ] = * cur ++ ; buffer [ nbchars ++ ] = ';' ; } } else if ( c == '%' && ( what & XML_SUBSTITUTE_PEREF ) ) { if ( xmlParserDebugEntities ) xmlGenericError ( xmlGenericErrorContext , "String<S2SV_blank>decoding<S2SV_blank>PE<S2SV_blank>Reference:<S2SV_blank>%.30s\\n" , str ) ; ent = xmlParseStringPEReference ( ctxt , & str ) ; if ( ctxt -> lastError . code == XML_ERR_ENTITY_LOOP ) goto int_error ; if ( ent != NULL ) ctxt -> nbentities += ent -> checked ; if ( ent != NULL ) { if ( ent -> content == NULL ) { xmlLoadEntityContent ( ctxt , ent ) ; } ctxt -> depth ++ ; rep = xmlStringDecodeEntities ( ctxt , ent -> content , what , 0 , 0 , 0 ) ; ctxt -> depth -- ; if ( rep != NULL ) { current = rep ; while ( * current != 0 ) { buffer [ nbchars ++ ] = * current ++ ; if ( nbchars > buffer_size - XML_PARSER_BUFFER_SIZE ) { if ( xmlParserEntityCheck ( ctxt , nbchars , ent ) ) goto int_error ; growBuffer ( buffer , XML_PARSER_BUFFER_SIZE ) ; } } xmlFree ( rep ) ; rep = NULL ; } } } else { COPY_BUF ( l , buffer , nbchars , c ) ; str += l ; if ( nbchars > buffer_size - XML_PARSER_BUFFER_SIZE ) { growBuffer ( buffer , XML_PARSER_BUFFER_SIZE ) ; } } if ( str < last ) c = CUR_SCHAR ( str , l ) ; else c = 0 ; } buffer [ nbchars ] = 0 ; return ( buffer ) ; mem_error : xmlErrMemory ( ctxt , NULL ) ; int_error : if ( rep != NULL ) xmlFree ( rep ) ; if ( buffer != NULL ) xmlFree ( buffer ) ; return ( NULL ) ; }
| <S2SV_ModStart> ( buffer , i +
| chromium@chromium/d82b03d21f7e581f9206ef1fec4959ae7b06b8eb | CVE-2011-3919 | https://github.com/chromium/chromium/commit/d82b03d21f7e581f9206ef1fec4959ae7b06b8eb | 2012-01-07T11:55Z |
263 | CWE-200 | CWE-200 unsigned paravirt_patch_jmp ( void * insnbuf , const void * target , unsigned long addr , unsigned len ) { struct branch * b = insnbuf ; unsigned long delta = ( unsigned long ) target - ( addr + 5 ) ; <S2SV_StartBug> if ( len < 5 ) <S2SV_EndBug> <S2SV_StartBug> return len ; <S2SV_EndBug> b -> opcode = 0xe9 ; b -> delta = delta ; return 5 ; }
| <S2SV_ModStart> < 5 ) { # ifdef CONFIG_RETPOLINE WARN_ONCE ( "Failing<S2SV_blank>to<S2SV_blank>patch<S2SV_blank>indirect<S2SV_blank>JMP<S2SV_blank>in<S2SV_blank>%ps\\n" , ( void * ) addr ) ; # endif <S2SV_ModStart> return len ; }
| torvalds@linux/5800dc5c19f34e6e03b5adab1282535cb102fafd | CVE-2018-15594 | https://github.com/torvalds/linux/commit/5800dc5c19f34e6e03b5adab1282535cb102fafd | 2018-08-20T08:29Z |
264 | CWE-787 | CWE-787 void * adminchild ( struct clientparam * param ) { int i , res ; char * buf ; char username [ 256 ] ; char * sb ; char * req = NULL ; struct printparam pp ; <S2SV_StartBug> int contentlen = 0 ; <S2SV_EndBug> int isform = 0 ; pp . inbuf = 0 ; pp . cp = param ; buf = myalloc ( LINESIZE ) ; if ( ! buf ) { RETURN ( 555 ) ; } i = sockgetlinebuf ( param , CLIENT , ( unsigned char * ) buf , LINESIZE - 1 , '\\n' , conf . timeouts [ STRING_S ] ) ; if ( i < 5 || ( ( buf [ 0 ] != 'G' || buf [ 1 ] != 'E' || buf [ 2 ] != 'T' || buf [ 3 ] != '<S2SV_blank>' || buf [ 4 ] != '/' ) && ( buf [ 0 ] != 'P' || buf [ 1 ] != 'O' || buf [ 2 ] != 'S' || buf [ 3 ] != 'T' || buf [ 4 ] != '<S2SV_blank>' || buf [ 5 ] != '/' ) ) ) { RETURN ( 701 ) ; } buf [ i ] = 0 ; sb = strchr ( buf + 5 , '<S2SV_blank>' ) ; if ( ! sb ) { RETURN ( 702 ) ; } * sb = 0 ; req = mystrdup ( buf + ( ( * buf == 'P' ) ? 6 : 5 ) ) ; while ( ( i = sockgetlinebuf ( param , CLIENT , ( unsigned char * ) buf , LINESIZE - 1 , '\\n' , conf . timeouts [ STRING_S ] ) ) > 2 ) { buf [ i ] = 0 ; if ( i > 19 && ( ! strncasecmp ( buf , "authorization" , 13 ) ) ) { sb = strchr ( buf , ':' ) ; if ( ! sb ) continue ; ++ sb ; while ( isspace ( * sb ) ) sb ++ ; if ( ! * sb || strncasecmp ( sb , "basic" , 5 ) ) { continue ; } sb += 5 ; while ( isspace ( * sb ) ) sb ++ ; i = de64 ( ( unsigned char * ) sb , ( unsigned char * ) username , 255 ) ; if ( i <= 0 ) continue ; username [ i ] = 0 ; sb = strchr ( ( char * ) username , ':' ) ; if ( sb ) { * sb = 0 ; if ( param -> password ) myfree ( param -> password ) ; param -> password = ( unsigned char * ) mystrdup ( sb + 1 ) ; } if ( param -> username ) myfree ( param -> username ) ; param -> username = ( unsigned char * ) mystrdup ( username ) ; continue ; } else if ( i > 15 && ( ! strncasecmp ( buf , "content-length:" , 15 ) ) ) { sb = buf + 15 ; while ( isspace ( * sb ) ) sb ++ ; <S2SV_StartBug> contentlen = atoi ( sb ) ; <S2SV_EndBug> } else if ( i > 13 && ( ! strncasecmp ( buf , "content-type:" , 13 ) ) ) { sb = buf + 13 ; while ( isspace ( * sb ) ) sb ++ ; if ( ! strncasecmp ( sb , "x-www-form-urlencoded" , 21 ) ) isform = 1 ; } } param -> operation = ADMIN ; if ( isform && contentlen ) { printstr ( & pp , "HTTP/1.0<S2SV_blank>100<S2SV_blank>Continue\\r\\n\\r\\n" ) ; stdpr ( & pp , NULL , 0 ) ; } res = ( * param -> srv -> authfunc ) ( param ) ; if ( res && res != 10 ) { printstr ( & pp , authreq ) ; RETURN ( res ) ; } if ( param -> srv -> singlepacket || param -> redirected ) { if ( * req == 'C' ) req [ 1 ] = 0 ; else * req = 0 ; } sprintf ( buf , ok , conf . stringtable ? ( char * ) conf . stringtable [ 2 ] : "3proxy" , conf . stringtable ? ( char * ) conf . stringtable [ 2 ] : "3[APA3A]<S2SV_blank>tiny<S2SV_blank>proxy" , conf . stringtable ? ( char * ) conf . stringtable [ 3 ] : "" ) ; if ( * req != 'S' ) printstr ( & pp , buf ) ; switch ( * req ) { case 'C' : printstr ( & pp , counters ) ; { struct trafcount * cp ; int num = 0 ; for ( cp = conf . trafcounter ; cp ; cp = cp -> next , num ++ ) { int inbuf = 0 ; if ( cp -> ace && ( param -> srv -> singlepacket || param -> redirected ) ) { if ( ! ACLmatches ( cp -> ace , param ) ) continue ; } if ( req [ 1 ] == 'S' && atoi ( req + 2 ) == num ) cp -> disabled = 0 ; if ( req [ 1 ] == 'D' && atoi ( req + 2 ) == num ) cp -> disabled = 1 ; inbuf += sprintf ( buf , "<tr>" "<td>%s</td><td><A<S2SV_blank>HREF=\\\'/C%c%d\\\'>%s</A></td><td>" , ( cp -> comment ) ? cp -> comment : " " , ( cp -> disabled ) ? 'S' : 'D' , num , ( cp -> disabled ) ? "NO" : "YES" ) ; if ( ! cp -> ace || ! cp -> ace -> users ) { inbuf += sprintf ( buf + inbuf , "<center>ANY</center>" ) ; } else { inbuf += printuserlist ( buf + inbuf , LINESIZE - 800 , cp -> ace -> users , ",<br<S2SV_blank>/>\\r\\n" ) ; } inbuf += sprintf ( buf + inbuf , "</td><td>" ) ; if ( ! cp -> ace || ! cp -> ace -> src ) { inbuf += sprintf ( buf + inbuf , "<center>ANY</center>" ) ; } else { inbuf += printiplist ( buf + inbuf , LINESIZE - 512 , cp -> ace -> src , ",<br<S2SV_blank>/>\\r\\n" ) ; } inbuf += sprintf ( buf + inbuf , "</td><td>" ) ; if ( ! cp -> ace || ! cp -> ace -> dst ) { inbuf += sprintf ( buf + inbuf , "<center>ANY</center>" ) ; } else { inbuf += printiplist ( buf + inbuf , LINESIZE - 512 , cp -> ace -> dst , ",<br<S2SV_blank>/>\\r\\n" ) ; } inbuf += sprintf ( buf + inbuf , "</td><td>" ) ; if ( ! cp -> ace || ! cp -> ace -> ports ) { inbuf += sprintf ( buf + inbuf , "<center>ANY</center>" ) ; } else { inbuf += printportlist ( buf + inbuf , LINESIZE - 128 , cp -> ace -> ports , ",<br<S2SV_blank>/>\\r\\n" ) ; } if ( cp -> type == NONE ) { inbuf += sprintf ( buf + inbuf , "</td><td<S2SV_blank>colspan=\\\'6\\\'<S2SV_blank>align=\\\'center\\\'>exclude<S2SV_blank>from<S2SV_blank>limitation</td></tr>\\r\\n" ) ; } else { inbuf += sprintf ( buf + inbuf , "</td><td>%" PRINTF_INT64_MODIFIER "u</td>" "<td>MB%s</td>" "<td>%" PRINTF_INT64_MODIFIER "u</td>" "<td>%s</td>" , cp -> traflim64 / ( 1024 * 1024 ) , rotations [ cp -> type ] , cp -> traf64 , cp -> cleared ? ctime ( & cp -> cleared ) : "never" ) ; inbuf += sprintf ( buf + inbuf , "<td>%s</td>" "<td>%i</td>" "</tr>\\r\\n" , cp -> updated ? ctime ( & cp -> updated ) : "never" , cp -> number ) ; } printstr ( & pp , buf ) ; } } printstr ( & pp , counterstail ) ; break ; case 'R' : conf . needreload = 1 ; printstr ( & pp , "<h3>Reload<S2SV_blank>scheduled</h3>" ) ; break ; case 'S' : { if ( req [ 1 ] == 'X' ) { printstr ( & pp , style ) ; break ; } printstr ( & pp , xml ) ; printval ( conf . services , TYPE_SERVER , 0 , & pp ) ; printstr ( & pp , postxml ) ; } break ; case 'F' : { FILE * fp ; char buf [ 256 ] ; fp = confopen ( ) ; if ( ! fp ) { printstr ( & pp , "<h3><font<S2SV_blank>color=\\"red\\">Failed<S2SV_blank>to<S2SV_blank>open<S2SV_blank>config<S2SV_blank>file</font></h3>" ) ; break ; } printstr ( & pp , "<h3>Please<S2SV_blank>be<S2SV_blank>careful<S2SV_blank>editing<S2SV_blank>config<S2SV_blank>file<S2SV_blank>remotely</h3>" ) ; <S2SV_StartBug> printstr ( & pp , "<form<S2SV_blank>method=\\"POST\\"<S2SV_blank>action=\\"/U\\"><textarea<S2SV_blank>cols=\\"80\\"<S2SV_blank>rows=\\"30\\"<S2SV_blank>name=\\"conffile\\">" ) ; <S2SV_EndBug> while ( fgets ( buf , 256 , fp ) ) { printstr ( & pp , buf ) ; } if ( ! writable ) fclose ( fp ) ; printstr ( & pp , "</textarea><br><input<S2SV_blank>type=\\"Submit\\"></form>" ) ; break ; } case 'U' : { <S2SV_StartBug> int l = 0 ; <S2SV_EndBug> int error = 0 ; <S2SV_StartBug> if ( ! writable || fseek ( writable , 0 , 0 ) ) { <S2SV_EndBug> error = 1 ; } <S2SV_StartBug> while ( ( i = sockgetlinebuf ( param , CLIENT , ( unsigned char * ) buf , LINESIZE - 1 , '+' , conf . timeouts [ STRING_S ] ) ) > 0 ) { <S2SV_EndBug> if ( i > ( contentlen - l ) ) i = ( contentlen - l ) ; <S2SV_StartBug> buf [ i ] = 0 ; <S2SV_EndBug> if ( ! l ) { if ( strncasecmp ( buf , "conffile=" , 9 ) ) error = 1 ; } <S2SV_StartBug> if ( ! error ) { <S2SV_EndBug> decodeurl ( ( unsigned char * ) buf , 1 ) ; fprintf ( writable , "%s" , l ? buf : buf + 9 ) ; } <S2SV_StartBug> l += i ; <S2SV_EndBug> if ( l >= contentlen ) break ; } if ( writable && ! error ) { fflush ( writable ) ; # ifndef _WINCE ftruncate ( fileno ( writable ) , ftell ( writable ) ) ; # endif } printstr ( & pp , error ? "<h3><font<S2SV_blank>color=\\"red\\">Config<S2SV_blank>file<S2SV_blank>is<S2SV_blank>not<S2SV_blank>writable</font></h3>Make<S2SV_blank>sure<S2SV_blank>you<S2SV_blank>have<S2SV_blank>\\"writable\\"<S2SV_blank>command<S2SV_blank>in<S2SV_blank>configuration<S2SV_blank>file" : "<h3>Configuration<S2SV_blank>updated</h3>" ) ; } break ; default : printstr ( & pp , ( char * ) conf . stringtable [ WEBBANNERS ] ) ; break ; } if ( * req != 'S' ) printstr ( & pp , tail ) ; CLEANRET : printstr ( & pp , NULL ) ; if ( buf ) myfree ( buf ) ; ( * param -> srv -> logfunc ) ( param , ( unsigned char * ) req ) ; if ( req ) myfree ( req ) ; freeparam ( param ) ; return ( NULL ) ; }
| <S2SV_ModStart> printparam pp ; unsigned <S2SV_ModEnd> contentlen = 0 <S2SV_ModStart> sb ++ ; sscanf ( sb , "%u" , & contentlen ) ; if ( contentlen > LINESIZE * 1024 ) contentlen = 0 <S2SV_ModEnd> ; } else <S2SV_ModStart> & pp , "<form<S2SV_blank>method=\\"POST\\"<S2SV_blank>action=\\"/U\\"<S2SV_blank>enctype=\\"application/x-www-form-urlencoded\\"><textarea<S2SV_blank>cols=\\"80\\"<S2SV_blank>rows=\\"30\\"<S2SV_blank>name=\\"conffile\\">" <S2SV_ModEnd> ) ; while <S2SV_ModStart> 'U' : { unsigned <S2SV_ModEnd> l = 0 <S2SV_ModStart> ! writable || ! contentlen || <S2SV_ModStart> } while ( l < contentlen && <S2SV_ModStart> ) buf , ( contentlen - l ) > <S2SV_ModStart> LINESIZE - 1 ? LINESIZE - 1 : contentlen - l <S2SV_ModStart> l ) ; if ( ! l ) { if ( i < 9 || <S2SV_ModEnd> strncasecmp ( buf <S2SV_ModStart> error ) { buf [ i ] = 0 ; <S2SV_ModStart> l += i <S2SV_ModEnd> ; } if
| z3APA3A@3proxy/3b67dc844789dc0f00e934270c7b349bcb547865 | CVE-2019-14495 | https://github.com/z3APA3A/3proxy/commit/3b67dc844789dc0f00e934270c7b349bcb547865 | 2019-08-01T17:15Z |
265 | CWE-119 | CWE-119 static int create_qp_common ( struct mlx5_ib_dev * dev , struct ib_pd * pd , struct ib_qp_init_attr * init_attr , struct ib_udata * udata , struct mlx5_ib_qp * qp ) { struct mlx5_ib_resources * devr = & dev -> devr ; int inlen = MLX5_ST_SZ_BYTES ( create_qp_in ) ; struct mlx5_core_dev * mdev = dev -> mdev ; <S2SV_StartBug> struct mlx5_ib_create_qp_resp resp ; <S2SV_EndBug> struct mlx5_ib_cq * send_cq ; struct mlx5_ib_cq * recv_cq ; unsigned long flags ; u32 uidx = MLX5_IB_DEFAULT_UIDX ; struct mlx5_ib_create_qp ucmd ; struct mlx5_ib_qp_base * base ; int mlx5_st ; void * qpc ; u32 * in ; int err ; mutex_init ( & qp -> mutex ) ; spin_lock_init ( & qp -> sq . lock ) ; spin_lock_init ( & qp -> rq . lock ) ; mlx5_st = to_mlx5_st ( init_attr -> qp_type ) ; if ( mlx5_st < 0 ) return - EINVAL ; if ( init_attr -> rwq_ind_tbl ) { if ( ! udata ) return - ENOSYS ; err = create_rss_raw_qp_tir ( dev , qp , pd , init_attr , udata ) ; return err ; } if ( init_attr -> create_flags & IB_QP_CREATE_BLOCK_MULTICAST_LOOPBACK ) { if ( ! MLX5_CAP_GEN ( mdev , block_lb_mc ) ) { mlx5_ib_dbg ( dev , "block<S2SV_blank>multicast<S2SV_blank>loopback<S2SV_blank>isn\'t<S2SV_blank>supported\\n" ) ; return - EINVAL ; } else { qp -> flags |= MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK ; } } if ( init_attr -> create_flags & ( IB_QP_CREATE_CROSS_CHANNEL | IB_QP_CREATE_MANAGED_SEND | IB_QP_CREATE_MANAGED_RECV ) ) { if ( ! MLX5_CAP_GEN ( mdev , cd ) ) { mlx5_ib_dbg ( dev , "cross-channel<S2SV_blank>isn\'t<S2SV_blank>supported\\n" ) ; return - EINVAL ; } if ( init_attr -> create_flags & IB_QP_CREATE_CROSS_CHANNEL ) qp -> flags |= MLX5_IB_QP_CROSS_CHANNEL ; if ( init_attr -> create_flags & IB_QP_CREATE_MANAGED_SEND ) qp -> flags |= MLX5_IB_QP_MANAGED_SEND ; if ( init_attr -> create_flags & IB_QP_CREATE_MANAGED_RECV ) qp -> flags |= MLX5_IB_QP_MANAGED_RECV ; } if ( init_attr -> qp_type == IB_QPT_UD && ( init_attr -> create_flags & IB_QP_CREATE_IPOIB_UD_LSO ) ) if ( ! MLX5_CAP_GEN ( mdev , ipoib_basic_offloads ) ) { mlx5_ib_dbg ( dev , "ipoib<S2SV_blank>UD<S2SV_blank>lso<S2SV_blank>qp<S2SV_blank>isn\'t<S2SV_blank>supported\\n" ) ; return - EOPNOTSUPP ; } if ( init_attr -> create_flags & IB_QP_CREATE_SCATTER_FCS ) { if ( init_attr -> qp_type != IB_QPT_RAW_PACKET ) { mlx5_ib_dbg ( dev , "Scatter<S2SV_blank>FCS<S2SV_blank>is<S2SV_blank>supported<S2SV_blank>only<S2SV_blank>for<S2SV_blank>Raw<S2SV_blank>Packet<S2SV_blank>QPs" ) ; return - EOPNOTSUPP ; } if ( ! MLX5_CAP_GEN ( dev -> mdev , eth_net_offloads ) || ! MLX5_CAP_ETH ( dev -> mdev , scatter_fcs ) ) { mlx5_ib_dbg ( dev , "Scatter<S2SV_blank>FCS<S2SV_blank>isn\'t<S2SV_blank>supported\\n" ) ; return - EOPNOTSUPP ; } qp -> flags |= MLX5_IB_QP_CAP_SCATTER_FCS ; } if ( init_attr -> sq_sig_type == IB_SIGNAL_ALL_WR ) qp -> sq_signal_bits = MLX5_WQE_CTRL_CQ_UPDATE ; if ( init_attr -> create_flags & IB_QP_CREATE_CVLAN_STRIPPING ) { if ( ! ( MLX5_CAP_GEN ( dev -> mdev , eth_net_offloads ) && MLX5_CAP_ETH ( dev -> mdev , vlan_cap ) ) || ( init_attr -> qp_type != IB_QPT_RAW_PACKET ) ) return - EOPNOTSUPP ; qp -> flags |= MLX5_IB_QP_CVLAN_STRIPPING ; } if ( pd && pd -> uobject ) { if ( ib_copy_from_udata ( & ucmd , udata , sizeof ( ucmd ) ) ) { mlx5_ib_dbg ( dev , "copy<S2SV_blank>failed\\n" ) ; return - EFAULT ; } err = get_qp_user_index ( to_mucontext ( pd -> uobject -> context ) , & ucmd , udata -> inlen , & uidx ) ; if ( err ) return err ; qp -> wq_sig = ! ! ( ucmd . flags & MLX5_QP_FLAG_SIGNATURE ) ; qp -> scat_cqe = ! ! ( ucmd . flags & MLX5_QP_FLAG_SCATTER_CQE ) ; if ( ucmd . flags & MLX5_QP_FLAG_TUNNEL_OFFLOADS ) { if ( init_attr -> qp_type != IB_QPT_RAW_PACKET || ! tunnel_offload_supported ( mdev ) ) { mlx5_ib_dbg ( dev , "Tunnel<S2SV_blank>offload<S2SV_blank>isn\'t<S2SV_blank>supported\\n" ) ; return - EOPNOTSUPP ; } qp -> tunnel_offload_en = true ; } if ( init_attr -> create_flags & IB_QP_CREATE_SOURCE_QPN ) { if ( init_attr -> qp_type != IB_QPT_UD || ( MLX5_CAP_GEN ( dev -> mdev , port_type ) != MLX5_CAP_PORT_TYPE_IB ) || ! mlx5_get_flow_namespace ( dev -> mdev , MLX5_FLOW_NAMESPACE_BYPASS ) ) { mlx5_ib_dbg ( dev , "Source<S2SV_blank>QP<S2SV_blank>option<S2SV_blank>isn\'t<S2SV_blank>supported\\n" ) ; return - EOPNOTSUPP ; } qp -> flags |= MLX5_IB_QP_UNDERLAY ; qp -> underlay_qpn = init_attr -> source_qpn ; } } else { qp -> wq_sig = ! ! wq_signature ; } base = ( init_attr -> qp_type == IB_QPT_RAW_PACKET || qp -> flags & MLX5_IB_QP_UNDERLAY ) ? & qp -> raw_packet_qp . rq . base : & qp -> trans_qp . base ; qp -> has_rq = qp_has_rq ( init_attr ) ; err = set_rq_size ( dev , & init_attr -> cap , qp -> has_rq , qp , ( pd && pd -> uobject ) ? & ucmd : NULL ) ; if ( err ) { mlx5_ib_dbg ( dev , "err<S2SV_blank>%d\\n" , err ) ; return err ; } if ( pd ) { if ( pd -> uobject ) { __u32 max_wqes = 1 << MLX5_CAP_GEN ( mdev , log_max_qp_sz ) ; mlx5_ib_dbg ( dev , "requested<S2SV_blank>sq_wqe_count<S2SV_blank>(%d)\\n" , ucmd . sq_wqe_count ) ; if ( ucmd . rq_wqe_shift != qp -> rq . wqe_shift || ucmd . rq_wqe_count != qp -> rq . wqe_cnt ) { mlx5_ib_dbg ( dev , "invalid<S2SV_blank>rq<S2SV_blank>params\\n" ) ; return - EINVAL ; } if ( ucmd . sq_wqe_count > max_wqes ) { mlx5_ib_dbg ( dev , "requested<S2SV_blank>sq_wqe_count<S2SV_blank>(%d)<S2SV_blank>><S2SV_blank>max<S2SV_blank>allowed<S2SV_blank>(%d)\\n" , ucmd . sq_wqe_count , max_wqes ) ; return - EINVAL ; } if ( init_attr -> create_flags & mlx5_ib_create_qp_sqpn_qp1 ( ) ) { mlx5_ib_dbg ( dev , "user-space<S2SV_blank>is<S2SV_blank>not<S2SV_blank>allowed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>UD<S2SV_blank>QPs<S2SV_blank>spoofing<S2SV_blank>as<S2SV_blank>QP1\\n" ) ; return - EINVAL ; } err = create_user_qp ( dev , pd , qp , udata , init_attr , & in , & resp , & inlen , base ) ; if ( err ) mlx5_ib_dbg ( dev , "err<S2SV_blank>%d\\n" , err ) ; } else { err = create_kernel_qp ( dev , init_attr , qp , & in , & inlen , base ) ; if ( err ) mlx5_ib_dbg ( dev , "err<S2SV_blank>%d\\n" , err ) ; } if ( err ) return err ; } else { in = kvzalloc ( inlen , GFP_KERNEL ) ; if ( ! in ) return - ENOMEM ; qp -> create_type = MLX5_QP_EMPTY ; } if ( is_sqp ( init_attr -> qp_type ) ) qp -> port = init_attr -> port_num ; qpc = MLX5_ADDR_OF ( create_qp_in , in , qpc ) ; MLX5_SET ( qpc , qpc , st , mlx5_st ) ; MLX5_SET ( qpc , qpc , pm_state , MLX5_QP_PM_MIGRATED ) ; if ( init_attr -> qp_type != MLX5_IB_QPT_REG_UMR ) MLX5_SET ( qpc , qpc , pd , to_mpd ( pd ? pd : devr -> p0 ) -> pdn ) ; else MLX5_SET ( qpc , qpc , latency_sensitive , 1 ) ; if ( qp -> wq_sig ) MLX5_SET ( qpc , qpc , wq_signature , 1 ) ; if ( qp -> flags & MLX5_IB_QP_BLOCK_MULTICAST_LOOPBACK ) MLX5_SET ( qpc , qpc , block_lb_mc , 1 ) ; if ( qp -> flags & MLX5_IB_QP_CROSS_CHANNEL ) MLX5_SET ( qpc , qpc , cd_master , 1 ) ; if ( qp -> flags & MLX5_IB_QP_MANAGED_SEND ) MLX5_SET ( qpc , qpc , cd_slave_send , 1 ) ; if ( qp -> flags & MLX5_IB_QP_MANAGED_RECV ) MLX5_SET ( qpc , qpc , cd_slave_receive , 1 ) ; if ( qp -> scat_cqe && is_connected ( init_attr -> qp_type ) ) { int rcqe_sz ; int scqe_sz ; rcqe_sz = mlx5_ib_get_cqe_size ( dev , init_attr -> recv_cq ) ; scqe_sz = mlx5_ib_get_cqe_size ( dev , init_attr -> send_cq ) ; if ( rcqe_sz == 128 ) MLX5_SET ( qpc , qpc , cs_res , MLX5_RES_SCAT_DATA64_CQE ) ; else MLX5_SET ( qpc , qpc , cs_res , MLX5_RES_SCAT_DATA32_CQE ) ; if ( init_attr -> sq_sig_type == IB_SIGNAL_ALL_WR ) { if ( scqe_sz == 128 ) MLX5_SET ( qpc , qpc , cs_req , MLX5_REQ_SCAT_DATA64_CQE ) ; else MLX5_SET ( qpc , qpc , cs_req , MLX5_REQ_SCAT_DATA32_CQE ) ; } } if ( qp -> rq . wqe_cnt ) { MLX5_SET ( qpc , qpc , log_rq_stride , qp -> rq . wqe_shift - 4 ) ; MLX5_SET ( qpc , qpc , log_rq_size , ilog2 ( qp -> rq . wqe_cnt ) ) ; } MLX5_SET ( qpc , qpc , rq_type , get_rx_type ( qp , init_attr ) ) ; if ( qp -> sq . wqe_cnt ) { MLX5_SET ( qpc , qpc , log_sq_size , ilog2 ( qp -> sq . wqe_cnt ) ) ; } else { MLX5_SET ( qpc , qpc , no_sq , 1 ) ; if ( init_attr -> srq && init_attr -> srq -> srq_type == IB_SRQT_TM ) MLX5_SET ( qpc , qpc , offload_type , MLX5_QPC_OFFLOAD_TYPE_RNDV ) ; } switch ( init_attr -> qp_type ) { case IB_QPT_XRC_TGT : MLX5_SET ( qpc , qpc , cqn_rcv , to_mcq ( devr -> c0 ) -> mcq . cqn ) ; MLX5_SET ( qpc , qpc , cqn_snd , to_mcq ( devr -> c0 ) -> mcq . cqn ) ; MLX5_SET ( qpc , qpc , srqn_rmpn_xrqn , to_msrq ( devr -> s0 ) -> msrq . srqn ) ; MLX5_SET ( qpc , qpc , xrcd , to_mxrcd ( init_attr -> xrcd ) -> xrcdn ) ; break ; case IB_QPT_XRC_INI : MLX5_SET ( qpc , qpc , cqn_rcv , to_mcq ( devr -> c0 ) -> mcq . cqn ) ; MLX5_SET ( qpc , qpc , xrcd , to_mxrcd ( devr -> x1 ) -> xrcdn ) ; MLX5_SET ( qpc , qpc , srqn_rmpn_xrqn , to_msrq ( devr -> s0 ) -> msrq . srqn ) ; break ; default : if ( init_attr -> srq ) { MLX5_SET ( qpc , qpc , xrcd , to_mxrcd ( devr -> x0 ) -> xrcdn ) ; MLX5_SET ( qpc , qpc , srqn_rmpn_xrqn , to_msrq ( init_attr -> srq ) -> msrq . srqn ) ; } else { MLX5_SET ( qpc , qpc , xrcd , to_mxrcd ( devr -> x1 ) -> xrcdn ) ; MLX5_SET ( qpc , qpc , srqn_rmpn_xrqn , to_msrq ( devr -> s1 ) -> msrq . srqn ) ; } } if ( init_attr -> send_cq ) MLX5_SET ( qpc , qpc , cqn_snd , to_mcq ( init_attr -> send_cq ) -> mcq . cqn ) ; if ( init_attr -> recv_cq ) MLX5_SET ( qpc , qpc , cqn_rcv , to_mcq ( init_attr -> recv_cq ) -> mcq . cqn ) ; MLX5_SET64 ( qpc , qpc , dbr_addr , qp -> db . dma ) ; if ( MLX5_CAP_GEN ( mdev , cqe_version ) == MLX5_CQE_VERSION_V1 ) MLX5_SET ( qpc , qpc , user_index , uidx ) ; if ( init_attr -> qp_type == IB_QPT_UD && ( init_attr -> create_flags & IB_QP_CREATE_IPOIB_UD_LSO ) ) { MLX5_SET ( qpc , qpc , ulp_stateless_offload_mode , 1 ) ; qp -> flags |= MLX5_IB_QP_LSO ; } if ( init_attr -> create_flags & IB_QP_CREATE_PCI_WRITE_END_PADDING ) { if ( ! MLX5_CAP_GEN ( dev -> mdev , end_pad ) ) { mlx5_ib_dbg ( dev , "scatter<S2SV_blank>end<S2SV_blank>padding<S2SV_blank>is<S2SV_blank>not<S2SV_blank>supported\\n" ) ; err = - EOPNOTSUPP ; goto err ; } else if ( init_attr -> qp_type != IB_QPT_RAW_PACKET ) { MLX5_SET ( qpc , qpc , end_padding_mode , MLX5_WQ_END_PAD_MODE_ALIGN ) ; } else { qp -> flags |= MLX5_IB_QP_PCI_WRITE_END_PADDING ; } } if ( inlen < 0 ) { err = - EINVAL ; goto err ; } if ( init_attr -> qp_type == IB_QPT_RAW_PACKET || qp -> flags & MLX5_IB_QP_UNDERLAY ) { qp -> raw_packet_qp . sq . ubuffer . buf_addr = ucmd . sq_buf_addr ; raw_packet_qp_copy_info ( qp , & qp -> raw_packet_qp ) ; err = create_raw_packet_qp ( dev , qp , in , inlen , pd ) ; } else { err = mlx5_core_create_qp ( dev -> mdev , & base -> mqp , in , inlen ) ; } if ( err ) { mlx5_ib_dbg ( dev , "create<S2SV_blank>qp<S2SV_blank>failed\\n" ) ; goto err_create ; } kvfree ( in ) ; base -> container_mibqp = qp ; base -> mqp . event = mlx5_ib_qp_event ; get_cqs ( init_attr -> qp_type , init_attr -> send_cq , init_attr -> recv_cq , & send_cq , & recv_cq ) ; spin_lock_irqsave ( & dev -> reset_flow_resource_lock , flags ) ; mlx5_ib_lock_cqs ( send_cq , recv_cq ) ; list_add_tail ( & qp -> qps_list , & dev -> qp_list ) ; if ( send_cq ) list_add_tail ( & qp -> cq_send_list , & send_cq -> list_send_qp ) ; if ( recv_cq ) list_add_tail ( & qp -> cq_recv_list , & recv_cq -> list_recv_qp ) ; mlx5_ib_unlock_cqs ( send_cq , recv_cq ) ; spin_unlock_irqrestore ( & dev -> reset_flow_resource_lock , flags ) ; return 0 ; err_create : if ( qp -> create_type == MLX5_QP_USER ) destroy_qp_user ( dev , pd , qp , base ) ; else if ( qp -> create_type == MLX5_QP_KERNEL ) destroy_qp_kernel ( dev , qp ) ; err : kvfree ( in ) ; return err ; }
| <S2SV_ModStart> struct mlx5_ib_create_qp_resp resp = { }
| torvalds@linux/0625b4ba1a5d4703c7fb01c497bd6c156908af00 | CVE-2018-20855 | https://github.com/torvalds/linux/commit/0625b4ba1a5d4703c7fb01c497bd6c156908af00 | 2019-07-26T05:15Z |
266 | CWE-119 | CWE-119 static void pack_inter_mode_mvs ( VP9_COMP * cpi , const MODE_INFO * mi , <S2SV_StartBug> vp9_writer * w ) { <S2SV_EndBug> VP9_COMMON * const cm = & cpi -> common ; <S2SV_StartBug> const nmv_context * nmvc = & cm -> fc . nmvc ; <S2SV_EndBug> const MACROBLOCK * const x = & cpi -> mb ; const MACROBLOCKD * const xd = & x -> e_mbd ; const struct segmentation * const seg = & cm -> seg ; const MB_MODE_INFO * const mbmi = & mi -> mbmi ; <S2SV_StartBug> const MB_PREDICTION_MODE mode = mbmi -> mode ; <S2SV_EndBug> const int segment_id = mbmi -> segment_id ; const BLOCK_SIZE bsize = mbmi -> sb_type ; const int allow_hp = cm -> allow_high_precision_mv ; const int is_inter = is_inter_block ( mbmi ) ; const int is_compound = has_second_ref ( mbmi ) ; int skip , ref ; if ( seg -> update_map ) { if ( seg -> temporal_update ) { const int pred_flag = mbmi -> seg_id_predicted ; <S2SV_StartBug> vp9_prob pred_prob = vp9_get_pred_prob_seg_id ( seg , xd ) ; <S2SV_EndBug> <S2SV_StartBug> vp9_write ( w , pred_flag , pred_prob ) ; <S2SV_EndBug> if ( ! pred_flag ) write_segment_id ( w , seg , segment_id ) ; } else { write_segment_id ( w , seg , segment_id ) ; } } <S2SV_StartBug> skip = write_skip ( cpi , segment_id , mi , w ) ; <S2SV_EndBug> <S2SV_StartBug> if ( ! vp9_segfeature_active ( seg , segment_id , SEG_LVL_REF_FRAME ) ) <S2SV_EndBug> <S2SV_StartBug> vp9_write ( w , is_inter , vp9_get_intra_inter_prob ( cm , xd ) ) ; <S2SV_EndBug> if ( bsize >= BLOCK_8X8 && cm -> tx_mode == TX_MODE_SELECT && ! ( is_inter && <S2SV_StartBug> ( skip || vp9_segfeature_active ( seg , segment_id , SEG_LVL_SKIP ) ) ) ) { <S2SV_EndBug> <S2SV_StartBug> write_selected_tx_size ( cpi , mbmi -> tx_size , bsize , w ) ; <S2SV_EndBug> } if ( ! is_inter ) { if ( bsize >= BLOCK_8X8 ) { <S2SV_StartBug> write_intra_mode ( w , mode , cm -> fc . y_mode_prob [ size_group_lookup [ bsize ] ] ) ; <S2SV_EndBug> } else { int idx , idy ; const int num_4x4_w = num_4x4_blocks_wide_lookup [ bsize ] ; const int num_4x4_h = num_4x4_blocks_high_lookup [ bsize ] ; for ( idy = 0 ; idy < 2 ; idy += num_4x4_h ) { for ( idx = 0 ; idx < 2 ; idx += num_4x4_w ) { <S2SV_StartBug> const MB_PREDICTION_MODE b_mode = mi -> bmi [ idy * 2 + idx ] . as_mode ; <S2SV_EndBug> <S2SV_StartBug> write_intra_mode ( w , b_mode , cm -> fc . y_mode_prob [ 0 ] ) ; <S2SV_EndBug> } } } <S2SV_StartBug> write_intra_mode ( w , mbmi -> uv_mode , cm -> fc . uv_mode_prob [ mode ] ) ; <S2SV_EndBug> } else { <S2SV_StartBug> const int mode_ctx = mbmi -> mode_context [ mbmi -> ref_frame [ 0 ] ] ; <S2SV_EndBug> <S2SV_StartBug> const vp9_prob * const inter_probs = cm -> fc . inter_mode_probs [ mode_ctx ] ; <S2SV_EndBug> <S2SV_StartBug> write_ref_frames ( cpi , w ) ; <S2SV_EndBug> <S2SV_StartBug> if ( ! vp9_segfeature_active ( seg , segment_id , SEG_LVL_SKIP ) ) { <S2SV_EndBug> if ( bsize >= BLOCK_8X8 ) { write_inter_mode ( w , mode , inter_probs ) ; <S2SV_StartBug> ++ cm -> counts . inter_mode [ mode_ctx ] [ INTER_OFFSET ( mode ) ] ; <S2SV_EndBug> } } if ( cm -> interp_filter == SWITCHABLE ) { const int ctx = vp9_get_pred_context_switchable_interp ( xd ) ; vp9_write_token ( w , vp9_switchable_interp_tree , <S2SV_StartBug> cm -> fc . switchable_interp_prob [ ctx ] , <S2SV_EndBug> <S2SV_StartBug> & switchable_interp_encodings [ mbmi -> interp_filter ] ) ; <S2SV_EndBug> } else { assert ( mbmi -> interp_filter == cm -> interp_filter ) ; } if ( bsize < BLOCK_8X8 ) { const int num_4x4_w = num_4x4_blocks_wide_lookup [ bsize ] ; const int num_4x4_h = num_4x4_blocks_high_lookup [ bsize ] ; int idx , idy ; for ( idy = 0 ; idy < 2 ; idy += num_4x4_h ) { for ( idx = 0 ; idx < 2 ; idx += num_4x4_w ) { const int j = idy * 2 + idx ; <S2SV_StartBug> const MB_PREDICTION_MODE b_mode = mi -> bmi [ j ] . as_mode ; <S2SV_EndBug> <S2SV_StartBug> write_inter_mode ( w , b_mode , inter_probs ) ; <S2SV_EndBug> ++ cm -> counts . inter_mode [ mode_ctx ] [ INTER_OFFSET ( b_mode ) ] ; if ( b_mode == NEWMV ) { for ( ref = 0 ; ref < 1 + is_compound ; ++ ref ) vp9_encode_mv ( cpi , w , & mi -> bmi [ j ] . as_mv [ ref ] . as_mv , <S2SV_StartBug> & mbmi -> ref_mvs [ mbmi -> ref_frame [ ref ] ] [ 0 ] . as_mv , <S2SV_EndBug> nmvc , allow_hp ) ; } } } } else { if ( mode == NEWMV ) { for ( ref = 0 ; ref < 1 + is_compound ; ++ ref ) vp9_encode_mv ( cpi , w , & mbmi -> mv [ ref ] . as_mv , <S2SV_StartBug> & mbmi -> ref_mvs [ mbmi -> ref_frame [ ref ] ] [ 0 ] . as_mv , nmvc , <S2SV_EndBug> allow_hp ) ; } } } }
| <S2SV_ModStart> * mi , vpx_writer <S2SV_ModEnd> * w ) <S2SV_ModStart> cm -> fc -> nmvc ; const MACROBLOCK * const x = & cpi -> td . <S2SV_ModEnd> mb ; const <S2SV_ModStart> mbmi ; const MB_MODE_INFO_EXT * const mbmi_ext = x -> mbmi_ext ; const PREDICTION_MODE <S2SV_ModEnd> mode = mbmi <S2SV_ModStart> -> seg_id_predicted ; vpx_prob <S2SV_ModEnd> pred_prob = vp9_get_pred_prob_seg_id <S2SV_ModStart> xd ) ; vpx_write <S2SV_ModEnd> ( w , <S2SV_ModStart> = write_skip ( cm , xd <S2SV_ModEnd> , segment_id , <S2SV_ModStart> if ( ! segfeature_active <S2SV_ModEnd> ( seg , <S2SV_ModStart> SEG_LVL_REF_FRAME ) ) vpx_write <S2SV_ModEnd> ( w , <S2SV_ModStart> ( is_inter && skip <S2SV_ModEnd> ) ) { <S2SV_ModStart> { write_selected_tx_size ( cm , xd <S2SV_ModEnd> , w ) <S2SV_ModStart> cm -> fc -> <S2SV_ModEnd> y_mode_prob [ size_group_lookup <S2SV_ModStart> ) { const PREDICTION_MODE <S2SV_ModEnd> b_mode = mi <S2SV_ModStart> cm -> fc -> <S2SV_ModEnd> y_mode_prob [ 0 <S2SV_ModStart> cm -> fc -> <S2SV_ModEnd> uv_mode_prob [ mode <S2SV_ModStart> int mode_ctx = mbmi_ext <S2SV_ModEnd> -> mode_context [ <S2SV_ModStart> ] ; const vpx_prob <S2SV_ModEnd> * const inter_probs <S2SV_ModStart> cm -> fc -> <S2SV_ModEnd> inter_mode_probs [ mode_ctx <S2SV_ModStart> ; write_ref_frames ( cm , xd <S2SV_ModEnd> , w ) <S2SV_ModStart> if ( ! segfeature_active <S2SV_ModEnd> ( seg , <S2SV_ModStart> inter_probs ) ; <S2SV_ModEnd> } } if <S2SV_ModStart> cm -> fc -> <S2SV_ModEnd> switchable_interp_prob [ ctx <S2SV_ModStart> interp_filter ] ) ; ++ cpi -> interp_filter_selected [ 0 ] [ mbmi -> interp_filter ] <S2SV_ModStart> idx ; const PREDICTION_MODE <S2SV_ModEnd> b_mode = mi <S2SV_ModStart> , inter_probs ) <S2SV_ModEnd> ; if ( <S2SV_ModStart> as_mv , & mbmi_ext <S2SV_ModEnd> -> ref_mvs [ <S2SV_ModStart> as_mv , & mbmi_ext <S2SV_ModEnd> -> ref_mvs [
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
267 | CWE-476 | CWE-476 static int skcipher_accept_parent ( void * private , struct sock * sk ) { struct skcipher_ctx * ctx ; struct alg_sock * ask = alg_sk ( sk ) ; <S2SV_StartBug> unsigned int len = sizeof ( * ctx ) + crypto_skcipher_reqsize ( private ) ; <S2SV_EndBug> ctx = sock_kmalloc ( sk , len , GFP_KERNEL ) ; if ( ! ctx ) return - ENOMEM ; <S2SV_StartBug> ctx -> iv = sock_kmalloc ( sk , crypto_skcipher_ivsize ( private ) , <S2SV_EndBug> GFP_KERNEL ) ; if ( ! ctx -> iv ) { sock_kfree_s ( sk , ctx , len ) ; return - ENOMEM ; } <S2SV_StartBug> memset ( ctx -> iv , 0 , crypto_skcipher_ivsize ( private ) ) ; <S2SV_EndBug> INIT_LIST_HEAD ( & ctx -> tsgl ) ; ctx -> len = len ; ctx -> used = 0 ; ctx -> more = 0 ; ctx -> merge = 0 ; ctx -> enc = 0 ; atomic_set ( & ctx -> inflight , 0 ) ; af_alg_init_completion ( & ctx -> completion ) ; ask -> private = ctx ; <S2SV_StartBug> skcipher_request_set_tfm ( & ctx -> req , private ) ; <S2SV_EndBug> skcipher_request_set_callback ( & ctx -> req , CRYPTO_TFM_REQ_MAY_BACKLOG , af_alg_complete , & ctx -> completion ) ; sk -> sk_destruct = skcipher_sock_destruct ; return 0 ; }
| <S2SV_ModStart> sk ) ; struct skcipher_tfm * tfm = private ; struct crypto_skcipher * skcipher = tfm -> skcipher ; <S2SV_ModStart> + crypto_skcipher_reqsize ( skcipher ) ; if ( ! tfm -> has_key ) return - ENOKEY <S2SV_ModEnd> ; ctx = <S2SV_ModStart> , crypto_skcipher_ivsize ( skcipher <S2SV_ModEnd> ) , GFP_KERNEL <S2SV_ModStart> , crypto_skcipher_ivsize ( skcipher ) ) ; INIT_LIST_HEAD ( & ctx -> tsgl ) ; ctx -> len = len ; ctx -> used = 0 ; ctx -> more = 0 ; ctx -> merge = 0 ; ctx -> enc = 0 ; atomic_set ( & ctx -> inflight , 0 ) ; af_alg_init_completion ( & ctx -> completion ) ; ask -> private <S2SV_ModEnd> = ctx ; <S2SV_ModStart> -> req , skcipher <S2SV_ModEnd> ) ; skcipher_request_set_callback
| torvalds@linux/dd504589577d8e8e70f51f997ad487a4cb6c026f | CVE-2015-8970 | https://github.com/torvalds/linux/commit/dd504589577d8e8e70f51f997ad487a4cb6c026f | 2016-11-28T03:59Z |
268 | CWE-20 | CWE-20 static Image * ReadHDRImage ( const ImageInfo * image_info , ExceptionInfo * exception ) { char format [ MaxTextExtent ] , keyword [ MaxTextExtent ] , tag [ MaxTextExtent ] , value [ MaxTextExtent ] ; double gamma ; Image * image ; int c ; MagickBooleanType status , value_expected ; register Quantum * q ; register ssize_t i , x ; register unsigned char * p ; ssize_t count , y ; unsigned char * end , pixel [ 4 ] , * pixels ; assert ( image_info != ( const ImageInfo * ) NULL ) ; assert ( image_info -> signature == MagickSignature ) ; if ( image_info -> debug != MagickFalse ) ( void ) LogMagickEvent ( TraceEvent , GetMagickModule ( ) , "%s" , image_info -> filename ) ; assert ( exception != ( ExceptionInfo * ) NULL ) ; assert ( exception -> signature == MagickSignature ) ; image = AcquireImage ( image_info , exception ) ; status = OpenBlob ( image_info , image , ReadBinaryBlobMode , exception ) ; if ( status == MagickFalse ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } image -> columns = 0 ; image -> rows = 0 ; * format = '\\0' ; c = ReadBlobByte ( image ) ; if ( c == EOF ) { image = DestroyImage ( image ) ; return ( ( Image * ) NULL ) ; } while ( isgraph ( c ) && ( image -> columns == 0 ) && ( image -> rows == 0 ) ) { if ( c == ( int ) '#' ) { char * comment ; register char * p ; size_t length ; length = MaxTextExtent ; comment = AcquireString ( ( char * ) NULL ) ; for ( p = comment ; comment != ( char * ) NULL ; p ++ ) { c = ReadBlobByte ( image ) ; if ( ( c == EOF ) || ( c == ( int ) '\\n' ) ) break ; if ( ( size_t ) ( p - comment + 1 ) >= length ) { * p = '\\0' ; length <<= 1 ; comment = ( char * ) ResizeQuantumMemory ( comment , length + MaxTextExtent , sizeof ( * comment ) ) ; if ( comment == ( char * ) NULL ) break ; p = comment + strlen ( comment ) ; } * p = ( char ) c ; } if ( comment == ( char * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; * p = '\\0' ; ( void ) SetImageProperty ( image , "comment" , comment , exception ) ; comment = DestroyString ( comment ) ; c = ReadBlobByte ( image ) ; } else if ( isalnum ( c ) == MagickFalse ) c = ReadBlobByte ( image ) ; else { register char * p ; p = keyword ; do { if ( ( size_t ) ( p - keyword ) < ( MaxTextExtent - 1 ) ) * p ++ = c ; c = ReadBlobByte ( image ) ; } while ( isalnum ( c ) || ( c == '_' ) ) ; * p = '\\0' ; value_expected = MagickFalse ; while ( ( isspace ( ( int ) ( ( unsigned char ) c ) ) != 0 ) || ( c == '=' ) ) { if ( c == '=' ) value_expected = MagickTrue ; c = ReadBlobByte ( image ) ; } if ( LocaleCompare ( keyword , "Y" ) == 0 ) value_expected = MagickTrue ; if ( value_expected == MagickFalse ) continue ; p = value ; <S2SV_StartBug> while ( ( c != '\\n' ) && ( c != '\\0' ) ) <S2SV_EndBug> { if ( ( size_t ) ( p - value ) < ( MaxTextExtent - 1 ) ) * p ++ = c ; c = ReadBlobByte ( image ) ; } * p = '\\0' ; switch ( * keyword ) { case 'F' : case 'f' : { if ( LocaleCompare ( keyword , "format" ) == 0 ) { ( void ) CopyMagickString ( format , value , MaxTextExtent ) ; break ; } ( void ) FormatLocaleString ( tag , MaxTextExtent , "hdr:%s" , keyword ) ; ( void ) SetImageProperty ( image , tag , value , exception ) ; break ; } case 'G' : case 'g' : { if ( LocaleCompare ( keyword , "gamma" ) == 0 ) { image -> gamma = StringToDouble ( value , ( char * * ) NULL ) ; break ; } ( void ) FormatLocaleString ( tag , MaxTextExtent , "hdr:%s" , keyword ) ; ( void ) SetImageProperty ( image , tag , value , exception ) ; break ; } case 'P' : case 'p' : { if ( LocaleCompare ( keyword , "primaries" ) == 0 ) { float chromaticity [ 6 ] , white_point [ 2 ] ; <S2SV_StartBug> ( void ) sscanf ( value , "%g<S2SV_blank>%g<S2SV_blank>%g<S2SV_blank>%g<S2SV_blank>%g<S2SV_blank>%g<S2SV_blank>%g<S2SV_blank>%g" , <S2SV_EndBug> & chromaticity [ 0 ] , & chromaticity [ 1 ] , & chromaticity [ 2 ] , & chromaticity [ 3 ] , & chromaticity [ 4 ] , & chromaticity [ 5 ] , <S2SV_StartBug> & white_point [ 0 ] , & white_point [ 1 ] ) ; <S2SV_EndBug> image -> chromaticity . red_primary . x = chromaticity [ 0 ] ; image -> chromaticity . red_primary . y = chromaticity [ 1 ] ; image -> chromaticity . green_primary . x = chromaticity [ 2 ] ; image -> chromaticity . green_primary . y = chromaticity [ 3 ] ; image -> chromaticity . blue_primary . x = chromaticity [ 4 ] ; image -> chromaticity . blue_primary . y = chromaticity [ 5 ] ; image -> chromaticity . white_point . x = white_point [ 0 ] , image -> chromaticity . white_point . y = white_point [ 1 ] ; <S2SV_StartBug> break ; <S2SV_EndBug> } ( void ) FormatLocaleString ( tag , MaxTextExtent , "hdr:%s" , keyword ) ; ( void ) SetImageProperty ( image , tag , value , exception ) ; break ; } case 'Y' : case 'y' : { char target [ ] = "Y" ; if ( strcmp ( keyword , target ) == 0 ) { int height , width ; <S2SV_StartBug> ( void ) sscanf ( value , "%d<S2SV_blank>+X<S2SV_blank>%d" , & height , & width ) ; <S2SV_EndBug> image -> columns = ( size_t ) width ; <S2SV_StartBug> image -> rows = ( size_t ) height ; <S2SV_EndBug> break ; } ( void ) FormatLocaleString ( tag , MaxTextExtent , "hdr:%s" , keyword ) ; ( void ) SetImageProperty ( image , tag , value , exception ) ; break ; } default : { ( void ) FormatLocaleString ( tag , MaxTextExtent , "hdr:%s" , keyword ) ; ( void ) SetImageProperty ( image , tag , value , exception ) ; break ; } } } if ( ( image -> columns == 0 ) && ( image -> rows == 0 ) ) while ( isspace ( ( int ) ( ( unsigned char ) c ) ) != 0 ) c = ReadBlobByte ( image ) ; } if ( ( LocaleCompare ( format , "32-bit_rle_rgbe" ) != 0 ) && ( LocaleCompare ( format , "32-bit_rle_xyze" ) != 0 ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; if ( ( image -> columns == 0 ) || ( image -> rows == 0 ) ) ThrowReaderException ( CorruptImageError , "NegativeOrZeroImageSize" ) ; ( void ) SetImageColorspace ( image , RGBColorspace , exception ) ; if ( LocaleCompare ( format , "32-bit_rle_xyze" ) == 0 ) ( void ) SetImageColorspace ( image , XYZColorspace , exception ) ; image -> compression = ( image -> columns < 8 ) || ( image -> columns > 0x7ffff ) ? NoCompression : RLECompression ; if ( image_info -> ping != MagickFalse ) { ( void ) CloseBlob ( image ) ; return ( GetFirstImageInList ( image ) ) ; } status = SetImageExtent ( image , image -> columns , image -> rows , exception ) ; if ( status == MagickFalse ) return ( DestroyImageList ( image ) ) ; pixels = ( unsigned char * ) AcquireQuantumMemory ( image -> columns , 4 * sizeof ( * pixels ) ) ; if ( pixels == ( unsigned char * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; for ( y = 0 ; y < ( ssize_t ) image -> rows ; y ++ ) { if ( image -> compression != RLECompression ) { count = ReadBlob ( image , 4 * image -> columns * sizeof ( * pixels ) , pixels ) ; if ( count != ( ssize_t ) ( 4 * image -> columns * sizeof ( * pixels ) ) ) break ; } else { count = ReadBlob ( image , 4 * sizeof ( * pixel ) , pixel ) ; if ( count != 4 ) break ; if ( ( size_t ) ( ( ( ( size_t ) pixel [ 2 ] ) << 8 ) | pixel [ 3 ] ) != image -> columns ) { ( void ) memcpy ( pixels , pixel , 4 * sizeof ( * pixel ) ) ; count = ReadBlob ( image , 4 * ( image -> columns - 1 ) * sizeof ( * pixels ) , pixels + 4 ) ; image -> compression = NoCompression ; } else { p = pixels ; for ( i = 0 ; i < 4 ; i ++ ) { end = & pixels [ ( i + 1 ) * image -> columns ] ; while ( p < end ) { count = ReadBlob ( image , 2 * sizeof ( * pixel ) , pixel ) ; if ( count < 1 ) break ; if ( pixel [ 0 ] > 128 ) { count = ( ssize_t ) pixel [ 0 ] - 128 ; if ( ( count == 0 ) || ( count > ( ssize_t ) ( end - p ) ) ) break ; while ( count -- > 0 ) * p ++ = pixel [ 1 ] ; } else { count = ( ssize_t ) pixel [ 0 ] ; if ( ( count == 0 ) || ( count > ( ssize_t ) ( end - p ) ) ) break ; * p ++ = pixel [ 1 ] ; if ( -- count > 0 ) { count = ReadBlob ( image , ( size_t ) count * sizeof ( * p ) , p ) ; if ( count < 1 ) break ; p += count ; } } } } } } q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( Quantum * ) NULL ) break ; i = 0 ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) { if ( image -> compression == RLECompression ) { pixel [ 0 ] = pixels [ x ] ; pixel [ 1 ] = pixels [ x + image -> columns ] ; pixel [ 2 ] = pixels [ x + 2 * image -> columns ] ; pixel [ 3 ] = pixels [ x + 3 * image -> columns ] ; } else { pixel [ 0 ] = pixels [ i ++ ] ; pixel [ 1 ] = pixels [ i ++ ] ; pixel [ 2 ] = pixels [ i ++ ] ; pixel [ 3 ] = pixels [ i ++ ] ; } SetPixelRed ( image , 0 , q ) ; SetPixelGreen ( image , 0 , q ) ; SetPixelBlue ( image , 0 , q ) ; if ( pixel [ 3 ] != 0 ) { gamma = pow ( 2.0 , pixel [ 3 ] - ( 128.0 + 8.0 ) ) ; SetPixelRed ( image , ClampToQuantum ( QuantumRange * gamma * pixel [ 0 ] ) , q ) ; SetPixelGreen ( image , ClampToQuantum ( QuantumRange * gamma * pixel [ 1 ] ) , q ) ; SetPixelBlue ( image , ClampToQuantum ( QuantumRange * gamma * pixel [ 2 ] ) , q ) ; } q += GetPixelChannels ( image ) ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) y , image -> rows ) ; if ( status == MagickFalse ) break ; } pixels = ( unsigned char * ) RelinquishMagickMemory ( pixels ) ; if ( EOFBlob ( image ) != MagickFalse ) ThrowFileException ( exception , CorruptImageError , "UnexpectedEndOfFile" , image -> filename ) ; ( void ) CloseBlob ( image ) ; return ( GetFirstImageInList ( image ) ) ; }
| <S2SV_ModStart> != '\\0' ) && ( c != EOF ) <S2SV_ModStart> 2 ] ; if ( <S2SV_ModEnd> sscanf ( value <S2SV_ModStart> 1 ] ) == 8 ) { <S2SV_ModEnd> image -> chromaticity <S2SV_ModStart> 1 ] ; } <S2SV_ModStart> , width ; if ( <S2SV_ModEnd> sscanf ( value <S2SV_ModStart> & width ) == 2 ) { <S2SV_ModEnd> image -> columns <S2SV_ModStart> ) height ; }
| ImageMagick@ImageMagick/97aa7d7cfd2027f6ba7ce42caf8b798541b9cdc6 | CVE-2015-8900 | https://github.com/ImageMagick/ImageMagick/commit/97aa7d7cfd2027f6ba7ce42caf8b798541b9cdc6 | 2017-02-27T22:59Z |
269 | CWE-22 | CWE-22 static int msg_cache_check ( const char * id , struct BodyCache * bcache , void * data ) { struct Context * ctx = ( struct Context * ) data ; if ( ! ctx ) return - 1 ; struct PopData * pop_data = ( struct PopData * ) ctx -> data ; if ( ! pop_data ) return - 1 ; # ifdef USE_HCACHE if ( strcmp ( HC_FNAME "." HC_FEXT , id ) == 0 ) return 0 ; # endif for ( int i = 0 ; i < ctx -> msgcount ; i ++ ) { if ( ctx -> hdrs [ i ] -> data && ( mutt_str_strcmp ( ctx -> hdrs [ i ] -> data , id ) == 0 ) ) return 0 ; } <S2SV_StartBug> return mutt_bcache_del ( bcache , id ) ; <S2SV_EndBug> }
| <S2SV_ModStart> ( bcache , cache_id ( id ) <S2SV_ModEnd> ) ; }
| neomutt@neomutt/9bfab35522301794483f8f9ed60820bdec9be59e | CVE-2018-14363 | https://github.com/neomutt/neomutt/commit/9bfab35522301794483f8f9ed60820bdec9be59e | 2018-07-17T17:29Z |
270 | CWE-119 | CWE-119 static int parse_packet ( sockent_t * se , void * buffer , size_t buffer_size , int flags , const char * username ) { int status ; value_list_t vl = VALUE_LIST_INIT ; notification_t n ; # if HAVE_LIBGCRYPT int packet_was_signed = ( flags & PP_SIGNED ) ; int packet_was_encrypted = ( flags & PP_ENCRYPTED ) ; int printed_ignore_warning = 0 ; # endif memset ( & vl , '\\0' , sizeof ( vl ) ) ; memset ( & n , '\\0' , sizeof ( n ) ) ; status = 0 ; while ( ( status == 0 ) && ( 0 < buffer_size ) && ( ( unsigned int ) buffer_size > sizeof ( part_header_t ) ) ) { uint16_t pkg_length ; uint16_t pkg_type ; memcpy ( ( void * ) & pkg_type , ( void * ) buffer , sizeof ( pkg_type ) ) ; memcpy ( ( void * ) & pkg_length , ( void * ) ( buffer + sizeof ( pkg_type ) ) , sizeof ( pkg_length ) ) ; pkg_length = ntohs ( pkg_length ) ; pkg_type = ntohs ( pkg_type ) ; if ( pkg_length > buffer_size ) break ; if ( pkg_length < ( 2 * sizeof ( uint16_t ) ) ) break ; if ( pkg_type == TYPE_ENCR_AES256 ) { status = parse_part_encr_aes256 ( se , & buffer , & buffer_size , flags ) ; if ( status != 0 ) { ERROR ( "network<S2SV_blank>plugin:<S2SV_blank>Decrypting<S2SV_blank>AES256<S2SV_blank>" "part<S2SV_blank>failed<S2SV_blank>" "with<S2SV_blank>status<S2SV_blank>%i." , status ) ; break ; } } # if HAVE_LIBGCRYPT else if ( ( se -> data . server . security_level == SECURITY_LEVEL_ENCRYPT ) && ( packet_was_encrypted == 0 ) ) { if ( printed_ignore_warning == 0 ) { INFO ( "network<S2SV_blank>plugin:<S2SV_blank>Unencrypted<S2SV_blank>packet<S2SV_blank>or<S2SV_blank>" "part<S2SV_blank>has<S2SV_blank>been<S2SV_blank>ignored." ) ; printed_ignore_warning = 1 ; } buffer = ( ( char * ) buffer ) + pkg_length ; <S2SV_StartBug> continue ; <S2SV_EndBug> } # endif else if ( pkg_type == TYPE_SIGN_SHA256 ) { status = parse_part_sign_sha256 ( se , & buffer , & buffer_size , flags ) ; if ( status != 0 ) { ERROR ( "network<S2SV_blank>plugin:<S2SV_blank>Verifying<S2SV_blank>HMAC-SHA-256<S2SV_blank>" "signature<S2SV_blank>failed<S2SV_blank>" "with<S2SV_blank>status<S2SV_blank>%i." , status ) ; break ; } } # if HAVE_LIBGCRYPT else if ( ( se -> data . server . security_level == SECURITY_LEVEL_SIGN ) && ( packet_was_encrypted == 0 ) && ( packet_was_signed == 0 ) ) { if ( printed_ignore_warning == 0 ) { INFO ( "network<S2SV_blank>plugin:<S2SV_blank>Unsigned<S2SV_blank>packet<S2SV_blank>or<S2SV_blank>" "part<S2SV_blank>has<S2SV_blank>been<S2SV_blank>ignored." ) ; printed_ignore_warning = 1 ; } buffer = ( ( char * ) buffer ) + pkg_length ; <S2SV_StartBug> continue ; <S2SV_EndBug> } # endif else if ( pkg_type == TYPE_VALUES ) { status = parse_part_values ( & buffer , & buffer_size , & vl . values , & vl . values_len ) ; if ( status != 0 ) break ; network_dispatch_values ( & vl , username ) ; sfree ( vl . values ) ; } else if ( pkg_type == TYPE_TIME ) { uint64_t tmp = 0 ; status = parse_part_number ( & buffer , & buffer_size , & tmp ) ; if ( status == 0 ) { vl . time = TIME_T_TO_CDTIME_T ( tmp ) ; n . time = TIME_T_TO_CDTIME_T ( tmp ) ; } } else if ( pkg_type == TYPE_TIME_HR ) { uint64_t tmp = 0 ; status = parse_part_number ( & buffer , & buffer_size , & tmp ) ; if ( status == 0 ) { vl . time = ( cdtime_t ) tmp ; n . time = ( cdtime_t ) tmp ; } } else if ( pkg_type == TYPE_INTERVAL ) { uint64_t tmp = 0 ; status = parse_part_number ( & buffer , & buffer_size , & tmp ) ; if ( status == 0 ) vl . interval = TIME_T_TO_CDTIME_T ( tmp ) ; } else if ( pkg_type == TYPE_INTERVAL_HR ) { uint64_t tmp = 0 ; status = parse_part_number ( & buffer , & buffer_size , & tmp ) ; if ( status == 0 ) vl . interval = ( cdtime_t ) tmp ; } else if ( pkg_type == TYPE_HOST ) { status = parse_part_string ( & buffer , & buffer_size , vl . host , sizeof ( vl . host ) ) ; if ( status == 0 ) sstrncpy ( n . host , vl . host , sizeof ( n . host ) ) ; } else if ( pkg_type == TYPE_PLUGIN ) { status = parse_part_string ( & buffer , & buffer_size , vl . plugin , sizeof ( vl . plugin ) ) ; if ( status == 0 ) sstrncpy ( n . plugin , vl . plugin , sizeof ( n . plugin ) ) ; } else if ( pkg_type == TYPE_PLUGIN_INSTANCE ) { status = parse_part_string ( & buffer , & buffer_size , vl . plugin_instance , sizeof ( vl . plugin_instance ) ) ; if ( status == 0 ) sstrncpy ( n . plugin_instance , vl . plugin_instance , sizeof ( n . plugin_instance ) ) ; } else if ( pkg_type == TYPE_TYPE ) { status = parse_part_string ( & buffer , & buffer_size , vl . type , sizeof ( vl . type ) ) ; if ( status == 0 ) sstrncpy ( n . type , vl . type , sizeof ( n . type ) ) ; } else if ( pkg_type == TYPE_TYPE_INSTANCE ) { status = parse_part_string ( & buffer , & buffer_size , vl . type_instance , sizeof ( vl . type_instance ) ) ; if ( status == 0 ) sstrncpy ( n . type_instance , vl . type_instance , sizeof ( n . type_instance ) ) ; } else if ( pkg_type == TYPE_MESSAGE ) { status = parse_part_string ( & buffer , & buffer_size , n . message , sizeof ( n . message ) ) ; if ( status != 0 ) { } else if ( ( n . severity != NOTIF_FAILURE ) && ( n . severity != NOTIF_WARNING ) && ( n . severity != NOTIF_OKAY ) ) { INFO ( "network<S2SV_blank>plugin:<S2SV_blank>" "Ignoring<S2SV_blank>notification<S2SV_blank>with<S2SV_blank>" "unknown<S2SV_blank>severity<S2SV_blank>%i." , n . severity ) ; } else if ( n . time <= 0 ) { INFO ( "network<S2SV_blank>plugin:<S2SV_blank>" "Ignoring<S2SV_blank>notification<S2SV_blank>with<S2SV_blank>" "time<S2SV_blank>==<S2SV_blank>0." ) ; } else if ( strlen ( n . message ) <= 0 ) { INFO ( "network<S2SV_blank>plugin:<S2SV_blank>" "Ignoring<S2SV_blank>notification<S2SV_blank>with<S2SV_blank>" "an<S2SV_blank>empty<S2SV_blank>message." ) ; } else { network_dispatch_notification ( & n ) ; } } else if ( pkg_type == TYPE_SEVERITY ) { uint64_t tmp = 0 ; status = parse_part_number ( & buffer , & buffer_size , & tmp ) ; if ( status == 0 ) n . severity = ( int ) tmp ; } else { DEBUG ( "network<S2SV_blank>plugin:<S2SV_blank>parse_packet:<S2SV_blank>Unknown<S2SV_blank>part" "<S2SV_blank>type:<S2SV_blank>0x%04hx" , pkg_type ) ; buffer = ( ( char * ) buffer ) + pkg_length ; <S2SV_StartBug> } <S2SV_EndBug> } if ( status == 0 && buffer_size > 0 ) WARNING ( "network<S2SV_blank>plugin:<S2SV_blank>parse_packet:<S2SV_blank>Received<S2SV_blank>truncated<S2SV_blank>" "packet,<S2SV_blank>try<S2SV_blank>increasing<S2SV_blank>`MaxPacketSize\'" ) ; return ( status ) ; }
| <S2SV_ModStart> + pkg_length ; buffer_size -= ( size_t ) pkg_length ; <S2SV_ModStart> + pkg_length ; buffer_size -= ( size_t ) pkg_length ; <S2SV_ModStart> + pkg_length ; buffer_size -= ( size_t ) pkg_length ;
| collectd@collectd/b589096f907052b3a4da2b9ccc9b0e2e888dfc18 | CVE-2016-6254 | https://github.com/collectd/collectd/commit/b589096f907052b3a4da2b9ccc9b0e2e888dfc18 | 2016-08-19T21:59Z |
271 | CWE-190 | CWE-190 uint8_t hfs_cat_traverse ( HFS_INFO * hfs , TSK_HFS_BTREE_CB a_cb , void * ptr ) { TSK_FS_INFO * fs = & ( hfs -> fs_info ) ; uint32_t cur_node ; char * node ; uint16_t nodesize ; uint8_t is_done = 0 ; tsk_error_reset ( ) ; nodesize = tsk_getu16 ( fs -> endian , hfs -> catalog_header . nodesize ) ; if ( ( node = ( char * ) tsk_malloc ( nodesize ) ) == NULL ) return 1 ; cur_node = tsk_getu32 ( fs -> endian , hfs -> catalog_header . rootNode ) ; if ( cur_node == 0 ) { if ( tsk_verbose ) tsk_fprintf ( stderr , "hfs_cat_traverse:<S2SV_blank>" "empty<S2SV_blank>extents<S2SV_blank>btree\\n" ) ; free ( node ) ; return 1 ; } if ( tsk_verbose ) tsk_fprintf ( stderr , "hfs_cat_traverse:<S2SV_blank>starting<S2SV_blank>at<S2SV_blank>" "root<S2SV_blank>node<S2SV_blank>%" PRIu32 ";<S2SV_blank>nodesize<S2SV_blank>=<S2SV_blank>%" PRIu16 "\\n" , cur_node , nodesize ) ; is_done = 0 ; while ( is_done == 0 ) { TSK_OFF_T cur_off ; uint16_t num_rec ; ssize_t cnt ; hfs_btree_node * node_desc ; if ( cur_node > tsk_getu32 ( fs -> endian , hfs -> catalog_header . totalNodes ) ) { tsk_error_set_errno ( TSK_ERR_FS_GENFS ) ; tsk_error_set_errstr ( "hfs_cat_traverse:<S2SV_blank>Node<S2SV_blank>%d<S2SV_blank>too<S2SV_blank>large<S2SV_blank>for<S2SV_blank>file" , cur_node ) ; free ( node ) ; return 1 ; } cur_off = cur_node * nodesize ; cnt = tsk_fs_attr_read ( hfs -> catalog_attr , cur_off , node , nodesize , 0 ) ; if ( cnt != nodesize ) { if ( cnt >= 0 ) { tsk_error_reset ( ) ; tsk_error_set_errno ( TSK_ERR_FS_READ ) ; } tsk_error_set_errstr2 ( "hfs_cat_traverse:<S2SV_blank>Error<S2SV_blank>reading<S2SV_blank>node<S2SV_blank>%d<S2SV_blank>at<S2SV_blank>offset<S2SV_blank>%" PRIuOFF , cur_node , cur_off ) ; free ( node ) ; return 1 ; } if ( nodesize < sizeof ( hfs_btree_node ) ) { tsk_error_set_errno ( TSK_ERR_FS_GENFS ) ; tsk_error_set_errstr ( "hfs_cat_traverse:<S2SV_blank>Node<S2SV_blank>size<S2SV_blank>%d<S2SV_blank>is<S2SV_blank>too<S2SV_blank>small<S2SV_blank>to<S2SV_blank>be<S2SV_blank>valid" , nodesize ) ; free ( node ) ; return 1 ; } node_desc = ( hfs_btree_node * ) node ; num_rec = tsk_getu16 ( fs -> endian , node_desc -> num_rec ) ; if ( tsk_verbose ) tsk_fprintf ( stderr , "hfs_cat_traverse:<S2SV_blank>node<S2SV_blank>%" PRIu32 "<S2SV_blank>@<S2SV_blank>%" PRIu64 "<S2SV_blank>has<S2SV_blank>%" PRIu16 "<S2SV_blank>records\\n" , cur_node , cur_off , num_rec ) ; if ( num_rec == 0 ) { tsk_error_set_errno ( TSK_ERR_FS_GENFS ) ; tsk_error_set_errstr ( "hfs_cat_traverse:<S2SV_blank>zero<S2SV_blank>records<S2SV_blank>in<S2SV_blank>node<S2SV_blank>%" PRIu32 , cur_node ) ; free ( node ) ; return 1 ; } if ( node_desc -> type == HFS_BT_NODE_TYPE_IDX ) { uint32_t next_node = 0 ; int rec ; for ( rec = 0 ; rec < num_rec ; ++ rec ) { size_t rec_off ; hfs_btree_key_cat * key ; uint8_t retval ; <S2SV_StartBug> uint16_t keylen ; <S2SV_EndBug> rec_off = tsk_getu16 ( fs -> endian , & node [ nodesize - ( rec + 1 ) * 2 ] ) ; if ( rec_off > nodesize ) { tsk_error_set_errno ( TSK_ERR_FS_GENFS ) ; tsk_error_set_errstr ( "hfs_cat_traverse:<S2SV_blank>offset<S2SV_blank>of<S2SV_blank>record<S2SV_blank>%d<S2SV_blank>in<S2SV_blank>index<S2SV_blank>node<S2SV_blank>%d<S2SV_blank>too<S2SV_blank>large<S2SV_blank>(%d<S2SV_blank>vs<S2SV_blank>%" PRIu16 ")" , rec , cur_node , ( int ) rec_off , nodesize ) ; free ( node ) ; return 1 ; } key = ( hfs_btree_key_cat * ) & node [ rec_off ] ; keylen = 2 + tsk_getu16 ( hfs -> fs_info . endian , key -> key_len ) ; if ( ( keylen ) > nodesize ) { tsk_error_set_errno ( TSK_ERR_FS_GENFS ) ; tsk_error_set_errstr ( "hfs_cat_traverse:<S2SV_blank>length<S2SV_blank>of<S2SV_blank>key<S2SV_blank>%d<S2SV_blank>in<S2SV_blank>index<S2SV_blank>node<S2SV_blank>%d<S2SV_blank>too<S2SV_blank>large<S2SV_blank>(%d<S2SV_blank>vs<S2SV_blank>%" PRIu16 ")" , rec , cur_node , keylen , nodesize ) ; free ( node ) ; return 1 ; } retval = a_cb ( hfs , HFS_BT_NODE_TYPE_IDX , key , cur_off + rec_off , ptr ) ; if ( retval == HFS_BTREE_CB_ERR ) { tsk_error_set_errno ( TSK_ERR_FS_GENFS ) ; tsk_error_set_errstr2 ( "hfs_cat_traverse:<S2SV_blank>Callback<S2SV_blank>returned<S2SV_blank>error" ) ; free ( node ) ; return 1 ; } else if ( ( retval == HFS_BTREE_CB_IDX_LT ) || ( next_node == 0 ) ) { hfs_btree_index_record * idx_rec ; int keylen = 2 + hfs_get_idxkeylen ( hfs , tsk_getu16 ( fs -> endian , key -> key_len ) , & ( hfs -> catalog_header ) ) ; if ( rec_off + keylen > nodesize ) { tsk_error_set_errno ( TSK_ERR_FS_GENFS ) ; tsk_error_set_errstr ( "hfs_cat_traverse:<S2SV_blank>offset<S2SV_blank>of<S2SV_blank>record<S2SV_blank>and<S2SV_blank>keylength<S2SV_blank>%d<S2SV_blank>in<S2SV_blank>index<S2SV_blank>node<S2SV_blank>%d<S2SV_blank>too<S2SV_blank>large<S2SV_blank>(%d<S2SV_blank>vs<S2SV_blank>%" PRIu16 ")" , rec , cur_node , ( int ) rec_off + keylen , nodesize ) ; free ( node ) ; return 1 ; } idx_rec = ( hfs_btree_index_record * ) & node [ rec_off + keylen ] ; next_node = tsk_getu32 ( fs -> endian , idx_rec -> childNode ) ; } if ( retval == HFS_BTREE_CB_IDX_EQGT ) { break ; } } if ( next_node == 0 ) { tsk_error_set_errno ( TSK_ERR_FS_GENFS ) ; tsk_error_set_errstr ( "hfs_cat_traverse:<S2SV_blank>did<S2SV_blank>not<S2SV_blank>find<S2SV_blank>any<S2SV_blank>keys<S2SV_blank>in<S2SV_blank>index<S2SV_blank>node<S2SV_blank>%d" , cur_node ) ; is_done = 1 ; break ; } if ( next_node == cur_node ) { tsk_error_set_errno ( TSK_ERR_FS_GENFS ) ; tsk_error_set_errstr ( "hfs_cat_traverse:<S2SV_blank>node<S2SV_blank>%d<S2SV_blank>references<S2SV_blank>itself<S2SV_blank>as<S2SV_blank>next<S2SV_blank>node" , cur_node ) ; is_done = 1 ; break ; } cur_node = next_node ; } else if ( node_desc -> type == HFS_BT_NODE_TYPE_LEAF ) { int rec ; for ( rec = 0 ; rec < num_rec ; ++ rec ) { size_t rec_off ; hfs_btree_key_cat * key ; uint8_t retval ; <S2SV_StartBug> uint16_t keylen ; <S2SV_EndBug> rec_off = tsk_getu16 ( fs -> endian , & node [ nodesize - ( rec + 1 ) * 2 ] ) ; if ( rec_off > nodesize ) { tsk_error_set_errno ( TSK_ERR_FS_GENFS ) ; tsk_error_set_errstr ( "hfs_cat_traverse:<S2SV_blank>offset<S2SV_blank>of<S2SV_blank>record<S2SV_blank>%d<S2SV_blank>in<S2SV_blank>leaf<S2SV_blank>node<S2SV_blank>%d<S2SV_blank>too<S2SV_blank>large<S2SV_blank>(%d<S2SV_blank>vs<S2SV_blank>%" PRIu16 ")" , rec , cur_node , ( int ) rec_off , nodesize ) ; free ( node ) ; return 1 ; } key = ( hfs_btree_key_cat * ) & node [ rec_off ] ; keylen = 2 + tsk_getu16 ( hfs -> fs_info . endian , key -> key_len ) ; if ( ( keylen ) > nodesize ) { tsk_error_set_errno ( TSK_ERR_FS_GENFS ) ; tsk_error_set_errstr ( "hfs_cat_traverse:<S2SV_blank>length<S2SV_blank>of<S2SV_blank>key<S2SV_blank>%d<S2SV_blank>in<S2SV_blank>leaf<S2SV_blank>node<S2SV_blank>%d<S2SV_blank>too<S2SV_blank>large<S2SV_blank>(%d<S2SV_blank>vs<S2SV_blank>%" PRIu16 ")" , rec , cur_node , keylen , nodesize ) ; free ( node ) ; return 1 ; } retval = a_cb ( hfs , HFS_BT_NODE_TYPE_LEAF , key , cur_off + rec_off , ptr ) ; if ( retval == HFS_BTREE_CB_LEAF_STOP ) { is_done = 1 ; break ; } else if ( retval == HFS_BTREE_CB_ERR ) { tsk_error_set_errno ( TSK_ERR_FS_GENFS ) ; tsk_error_set_errstr2 ( "hfs_cat_traverse:<S2SV_blank>Callback<S2SV_blank>returned<S2SV_blank>error" ) ; free ( node ) ; return 1 ; } } if ( is_done == 0 ) { cur_node = tsk_getu32 ( fs -> endian , node_desc -> flink ) ; if ( cur_node == 0 ) { is_done = 1 ; } if ( tsk_verbose ) tsk_fprintf ( stderr , "hfs_cat_traverse:<S2SV_blank>moving<S2SV_blank>forward<S2SV_blank>to<S2SV_blank>next<S2SV_blank>leaf" ) ; } } else { tsk_error_set_errno ( TSK_ERR_FS_GENFS ) ; tsk_error_set_errstr ( "hfs_cat_traverse:<S2SV_blank>btree<S2SV_blank>node<S2SV_blank>%" PRIu32 "<S2SV_blank>(%" PRIu64 ")<S2SV_blank>is<S2SV_blank>neither<S2SV_blank>index<S2SV_blank>nor<S2SV_blank>leaf<S2SV_blank>(%" PRIu8 ")" , cur_node , cur_off , node_desc -> type ) ; free ( node ) ; return 1 ; } } free ( node ) ; return 0 ; }
| <S2SV_ModStart> uint8_t retval ; int <S2SV_ModEnd> keylen ; rec_off <S2SV_ModStart> uint8_t retval ; int <S2SV_ModEnd> keylen ; rec_off
| sleuthkit@sleuthkit/114cd3d0aac8bd1aeaf4b33840feb0163d342d5b | CVE-2019-1010065 | https://github.com/sleuthkit/sleuthkit/commit/114cd3d0aac8bd1aeaf4b33840feb0163d342d5b | 2019-07-18T17:15Z |
272 | CWE-20 | CWE-20 static Image * ReadCUTImage ( const ImageInfo * image_info , ExceptionInfo * exception ) { <S2SV_StartBug> # define ThrowCUTReaderException ( severity , tag ) { if ( palette != NULL ) palette = DestroyImage ( palette ) ; if ( clone_info != NULL ) clone_info = DestroyImageInfo ( clone_info ) ; ThrowReaderException ( severity , tag ) ; } <S2SV_EndBug> Image * image , * palette ; ImageInfo * clone_info ; MagickBooleanType status ; MagickOffsetType offset ; size_t EncodedByte ; unsigned char RunCount , RunValue , RunCountMasked ; CUTHeader Header ; CUTPalHeader PalHeader ; ssize_t depth ; ssize_t i , j ; ssize_t ldblk ; unsigned char * BImgBuff = NULL , * ptrB ; register Quantum * q ; 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 ) ; } palette = NULL ; clone_info = NULL ; Header . Width = ReadBlobLSBShort ( image ) ; Header . Height = ReadBlobLSBShort ( image ) ; Header . Reserved = ReadBlobLSBShort ( image ) ; if ( Header . Width == 0 || Header . Height == 0 || Header . Reserved != 0 ) CUT_KO : ThrowCUTReaderException ( CorruptImageError , "ImproperImageHeader" ) ; EncodedByte = ReadBlobLSBShort ( image ) ; RunCount = ( unsigned char ) ReadBlobByte ( image ) ; RunCountMasked = RunCount & 0x7F ; ldblk = 0 ; while ( ( int ) RunCountMasked != 0 ) { i = 1 ; if ( ( int ) RunCount < 0x80 ) i = ( ssize_t ) RunCountMasked ; offset = SeekBlob ( image , TellBlob ( image ) + i , SEEK_SET ) ; if ( offset < 0 ) ThrowCUTReaderException ( CorruptImageError , "ImproperImageHeader" ) ; if ( EOFBlob ( image ) != MagickFalse ) goto CUT_KO ; EncodedByte -= i + 1 ; ldblk += ( ssize_t ) RunCountMasked ; RunCount = ( unsigned char ) ReadBlobByte ( image ) ; if ( EOFBlob ( image ) != MagickFalse ) goto CUT_KO ; RunCountMasked = RunCount & 0x7F ; } if ( EncodedByte != 1 ) goto CUT_KO ; i = 0 ; if ( ldblk == ( int ) Header . Width ) i = 8 ; if ( 2 * ldblk == ( int ) Header . Width ) i = 4 ; if ( 8 * ldblk == ( int ) Header . Width ) i = 1 ; if ( i == 0 ) goto CUT_KO ; depth = i ; image -> columns = Header . Width ; image -> rows = Header . Height ; image -> depth = 8 ; image -> colors = ( size_t ) ( GetQuantumRange ( 1UL * i ) + 1 ) ; if ( image_info -> ping != MagickFalse ) goto Finish ; status = SetImageExtent ( image , image -> columns , image -> rows , exception ) ; if ( status == MagickFalse ) return ( DestroyImageList ( image ) ) ; if ( ( clone_info = CloneImageInfo ( image_info ) ) == NULL ) goto NoPalette ; i = ( ssize_t ) strlen ( clone_info -> filename ) ; j = i ; while ( -- i > 0 ) { if ( clone_info -> filename [ i ] == '.' ) { break ; } if ( clone_info -> filename [ i ] == '/' || clone_info -> filename [ i ] == '\\\\' || clone_info -> filename [ i ] == ':' ) { i = j ; break ; } } ( void ) CopyMagickString ( clone_info -> filename + i , ".PAL" , ( size_t ) ( MagickPathExtent - i ) ) ; if ( ( clone_info -> file = fopen_utf8 ( clone_info -> filename , "rb" ) ) == NULL ) { ( void ) CopyMagickString ( clone_info -> filename + i , ".pal" , ( size_t ) ( MagickPathExtent - i ) ) ; if ( ( clone_info -> file = fopen_utf8 ( clone_info -> filename , "rb" ) ) == NULL ) { clone_info -> filename [ i ] = '\\0' ; if ( ( clone_info -> file = fopen_utf8 ( clone_info -> filename , "rb" ) ) == NULL ) { clone_info = DestroyImageInfo ( clone_info ) ; clone_info = NULL ; goto NoPalette ; } } } if ( ( palette = AcquireImage ( clone_info , exception ) ) == NULL ) goto NoPalette ; status = OpenBlob ( clone_info , palette , ReadBinaryBlobMode , exception ) ; if ( status == MagickFalse ) { ErasePalette : palette = DestroyImage ( palette ) ; palette = NULL ; goto NoPalette ; } if ( palette != NULL ) { ( void ) ReadBlob ( palette , 2 , ( unsigned char * ) PalHeader . FileId ) ; if ( strncmp ( PalHeader . FileId , "AH" , 2 ) != 0 ) goto ErasePalette ; PalHeader . Version = ReadBlobLSBShort ( palette ) ; PalHeader . Size = ReadBlobLSBShort ( palette ) ; PalHeader . FileType = ( char ) ReadBlobByte ( palette ) ; PalHeader . SubType = ( char ) ReadBlobByte ( palette ) ; PalHeader . BoardID = ReadBlobLSBShort ( palette ) ; PalHeader . GraphicsMode = ReadBlobLSBShort ( palette ) ; PalHeader . MaxIndex = ReadBlobLSBShort ( palette ) ; PalHeader . MaxRed = ReadBlobLSBShort ( palette ) ; PalHeader . MaxGreen = ReadBlobLSBShort ( palette ) ; PalHeader . MaxBlue = ReadBlobLSBShort ( palette ) ; ( void ) ReadBlob ( palette , 20 , ( unsigned char * ) PalHeader . PaletteId ) ; if ( EOFBlob ( image ) ) ThrowCUTReaderException ( CorruptImageError , "UnexpectedEndOfFile" ) ; if ( PalHeader . MaxIndex < 1 ) goto ErasePalette ; image -> colors = PalHeader . MaxIndex + 1 ; if ( AcquireImageColormap ( image , image -> colors , exception ) == MagickFalse ) goto NoMemory ; if ( PalHeader . MaxRed == 0 ) PalHeader . MaxRed = ( unsigned int ) QuantumRange ; if ( PalHeader . MaxGreen == 0 ) PalHeader . MaxGreen = ( unsigned int ) QuantumRange ; if ( PalHeader . MaxBlue == 0 ) PalHeader . MaxBlue = ( unsigned int ) QuantumRange ; for ( i = 0 ; i <= ( int ) PalHeader . MaxIndex ; i ++ ) { j = ( ssize_t ) TellBlob ( palette ) ; if ( ( j % 512 ) > 512 - 6 ) { j = ( ( j / 512 ) + 1 ) * 512 ; offset = SeekBlob ( palette , j , SEEK_SET ) ; if ( offset < 0 ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; } image -> colormap [ i ] . red = ( Quantum ) ReadBlobLSBShort ( palette ) ; if ( QuantumRange != ( Quantum ) PalHeader . MaxRed ) { image -> colormap [ i ] . red = ClampToQuantum ( ( ( double ) image -> colormap [ i ] . red * QuantumRange + ( PalHeader . MaxRed >> 1 ) ) / PalHeader . MaxRed ) ; } image -> colormap [ i ] . green = ( Quantum ) ReadBlobLSBShort ( palette ) ; if ( QuantumRange != ( Quantum ) PalHeader . MaxGreen ) { image -> colormap [ i ] . green = ClampToQuantum ( ( ( double ) image -> colormap [ i ] . green * QuantumRange + ( PalHeader . MaxGreen >> 1 ) ) / PalHeader . MaxGreen ) ; } image -> colormap [ i ] . blue = ( Quantum ) ReadBlobLSBShort ( palette ) ; if ( QuantumRange != ( Quantum ) PalHeader . MaxBlue ) { image -> colormap [ i ] . blue = ClampToQuantum ( ( ( double ) image -> colormap [ i ] . blue * QuantumRange + ( PalHeader . MaxBlue >> 1 ) ) / PalHeader . MaxBlue ) ; } } if ( EOFBlob ( image ) ) ThrowCUTReaderException ( CorruptImageError , "UnexpectedEndOfFile" ) ; } NoPalette : if ( palette == NULL ) { image -> colors = 256 ; if ( AcquireImageColormap ( image , image -> colors , exception ) == MagickFalse ) { NoMemory : ThrowCUTReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; } for ( i = 0 ; i < ( ssize_t ) image -> colors ; i ++ ) { image -> colormap [ i ] . red = ScaleCharToQuantum ( ( unsigned char ) i ) ; image -> colormap [ i ] . green = ScaleCharToQuantum ( ( unsigned char ) i ) ; image -> colormap [ i ] . blue = ScaleCharToQuantum ( ( unsigned char ) i ) ; } } BImgBuff = ( unsigned char * ) AcquireQuantumMemory ( ( size_t ) ldblk , sizeof ( * BImgBuff ) ) ; if ( BImgBuff == NULL ) goto NoMemory ; <S2SV_StartBug> offset = SeekBlob ( image , 6 , SEEK_SET ) ; <S2SV_EndBug> if ( offset < 0 ) { if ( palette != NULL ) palette = DestroyImage ( palette ) ; if ( clone_info != NULL ) clone_info = DestroyImageInfo ( clone_info ) ; BImgBuff = ( unsigned char * ) RelinquishMagickMemory ( BImgBuff ) ; ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; } for ( i = 0 ; i < ( int ) Header . Height ; i ++ ) { EncodedByte = ReadBlobLSBShort ( image ) ; ptrB = BImgBuff ; j = ldblk ; RunCount = ( unsigned char ) ReadBlobByte ( image ) ; RunCountMasked = RunCount & 0x7F ; while ( ( int ) RunCountMasked != 0 ) { if ( ( ssize_t ) RunCountMasked > j ) { RunCountMasked = ( unsigned char ) j ; if ( j == 0 ) { break ; } } if ( ( int ) RunCount > 0x80 ) { RunValue = ( unsigned char ) ReadBlobByte ( image ) ; ( void ) memset ( ptrB , ( int ) RunValue , ( size_t ) RunCountMasked ) ; } else { ( void ) ReadBlob ( image , ( size_t ) RunCountMasked , ptrB ) ; } ptrB += ( int ) RunCountMasked ; j -= ( int ) RunCountMasked ; if ( EOFBlob ( image ) != MagickFalse ) goto Finish ; RunCount = ( unsigned char ) ReadBlobByte ( image ) ; RunCountMasked = RunCount & 0x7F ; } InsertRow ( image , depth , BImgBuff , i , exception ) ; } ( void ) SyncImage ( image , exception ) ; if ( palette == NULL ) { if ( ( image -> storage_class == PseudoClass ) && ( SetImageGray ( image , exception ) != MagickFalse ) ) { if ( GetCutColors ( image , exception ) == 2 ) { for ( i = 0 ; i < ( ssize_t ) image -> colors ; i ++ ) { register Quantum sample ; sample = ScaleCharToQuantum ( ( unsigned char ) i ) ; if ( image -> colormap [ i ] . red != sample ) goto Finish ; if ( image -> colormap [ i ] . green != sample ) goto Finish ; if ( image -> colormap [ i ] . blue != sample ) goto Finish ; } image -> colormap [ 1 ] . red = image -> colormap [ 1 ] . green = image -> colormap [ 1 ] . blue = QuantumRange ; for ( i = 0 ; i < ( ssize_t ) image -> rows ; i ++ ) { q = QueueAuthenticPixels ( image , 0 , i , image -> columns , 1 , exception ) ; if ( q == ( Quantum * ) NULL ) break ; for ( j = 0 ; j < ( ssize_t ) image -> columns ; j ++ ) { if ( GetPixelRed ( image , q ) == ScaleCharToQuantum ( 1 ) ) { SetPixelRed ( image , QuantumRange , q ) ; SetPixelGreen ( image , QuantumRange , q ) ; SetPixelBlue ( image , QuantumRange , q ) ; } q += GetPixelChannels ( image ) ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) goto Finish ; } } } } Finish : if ( BImgBuff != NULL ) BImgBuff = ( unsigned char * ) RelinquishMagickMemory ( BImgBuff ) ; if ( palette != NULL ) palette = DestroyImage ( palette ) ; if ( clone_info != NULL ) clone_info = DestroyImageInfo ( clone_info ) ; if ( EOFBlob ( image ) != MagickFalse ) ThrowFileException ( exception , CorruptImageError , "UnexpectedEndOfFile" , image -> filename ) ; ( void ) CloseBlob ( image ) ; return ( GetFirstImageInList ( image ) ) ; }
| <S2SV_ModStart> , tag ) \\\n{ <S2SV_ModEnd> if ( palette <S2SV_ModStart> tag ) ; \\\n} <S2SV_ModEnd> Image * image <S2SV_ModStart> goto NoMemory ; ( void ) memset ( BImgBuff , 0 , ( size_t ) ldblk * sizeof ( * BImgBuff ) ) ;
| ImageMagick@ImageMagick/cdb383749ef7b68a38891440af8cc23e0115306d | CVE-2019-13135 | https://github.com/ImageMagick/ImageMagick/commit/cdb383749ef7b68a38891440af8cc23e0115306d | 2019-07-01T20:15Z |
273 | CWE-399 | CWE-399 static int unmap_ref_private ( struct mm_struct * mm , struct vm_area_struct * vma , struct page * page , unsigned long address ) { struct hstate * h = hstate_vma ( vma ) ; struct vm_area_struct * iter_vma ; struct address_space * mapping ; struct prio_tree_iter iter ; pgoff_t pgoff ; address = address & huge_page_mask ( h ) ; pgoff = vma_hugecache_offset ( h , vma , address ) ; <S2SV_StartBug> mapping = ( struct address_space * ) page_private ( page ) ; <S2SV_EndBug> mutex_lock ( & mapping -> i_mmap_mutex ) ; vma_prio_tree_foreach ( iter_vma , & iter , & mapping -> i_mmap , pgoff , pgoff ) { if ( iter_vma == vma ) continue ; if ( ! is_vma_resv_set ( iter_vma , HPAGE_RESV_OWNER ) ) __unmap_hugepage_range ( iter_vma , address , address + huge_page_size ( h ) , page ) ; } mutex_unlock ( & mapping -> i_mmap_mutex ) ; return 1 ; }
| <S2SV_ModStart> ; mapping = vma -> vm_file -> f_dentry -> d_inode -> i_mapping <S2SV_ModEnd> ; mutex_lock (
| torvalds@linux/90481622d75715bfcb68501280a917dbfe516029 | CVE-2012-2133 | https://github.com/torvalds/linux/commit/90481622d75715bfcb68501280a917dbfe516029 | 2012-07-03T16:40Z |
274 | CWE-295 | CWE-295 <S2SV_StartBug> NOEXPORT char * parse_global_option ( CMD cmd , char * opt , char * arg ) { <S2SV_EndBug> void * tmp ; if ( cmd == CMD_PRINT_DEFAULTS || cmd == CMD_PRINT_HELP ) { s_log ( LOG_NOTICE , "<S2SV_blank>" ) ; s_log ( LOG_NOTICE , "Global<S2SV_blank>options:" ) ; } # ifdef HAVE_CHROOT switch ( cmd ) { case CMD_SET_DEFAULTS : <S2SV_StartBug> new_global_options . chroot_dir = NULL ; <S2SV_EndBug> break ; case CMD_SET_COPY : break ; case CMD_FREE : <S2SV_StartBug> tmp = global_options . chroot_dir ; <S2SV_EndBug> global_options . chroot_dir = NULL ; str_free ( tmp ) ; break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "chroot" ) ) break ; <S2SV_StartBug> new_global_options . chroot_dir = str_dup ( arg ) ; <S2SV_EndBug> return NULL ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>directory<S2SV_blank>to<S2SV_blank>chroot<S2SV_blank>stunnel<S2SV_blank>process" , "chroot" ) ; break ; } # endif # ifndef OPENSSL_NO_COMP switch ( cmd ) { case CMD_SET_DEFAULTS : <S2SV_StartBug> new_global_options . compression = COMP_NONE ; <S2SV_EndBug> break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "compression" ) ) break ; # if OPENSSL_VERSION_NUMBER < 0x10100000L if ( OpenSSL_version_num ( ) < 0x00908051L ) return "Compression<S2SV_blank>unsupported<S2SV_blank>due<S2SV_blank>to<S2SV_blank>a<S2SV_blank>memory<S2SV_blank>leak" ; # endif if ( ! strcasecmp ( arg , "deflate" ) ) <S2SV_StartBug> new_global_options . compression = COMP_DEFLATE ; <S2SV_EndBug> else if ( ! strcasecmp ( arg , "zlib" ) ) <S2SV_StartBug> new_global_options . compression = COMP_ZLIB ; <S2SV_EndBug> else return "Specified<S2SV_blank>compression<S2SV_blank>type<S2SV_blank>is<S2SV_blank>not<S2SV_blank>available" ; return NULL ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>compression<S2SV_blank>type" , "compression" ) ; break ; } # endif switch ( cmd ) { case CMD_SET_DEFAULTS : # ifdef EGD_SOCKET <S2SV_StartBug> new_global_options . egd_sock = EGD_SOCKET ; <S2SV_EndBug> # else <S2SV_StartBug> new_global_options . egd_sock = NULL ; <S2SV_EndBug> # endif break ; case CMD_SET_COPY : break ; case CMD_FREE : <S2SV_StartBug> tmp = global_options . egd_sock ; <S2SV_EndBug> global_options . egd_sock = NULL ; str_free ( tmp ) ; break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "EGD" ) ) break ; <S2SV_StartBug> new_global_options . egd_sock = str_dup ( arg ) ; <S2SV_EndBug> return NULL ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : # ifdef EGD_SOCKET s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>%s" , "EGD" , EGD_SOCKET ) ; # endif break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>path<S2SV_blank>to<S2SV_blank>Entropy<S2SV_blank>Gathering<S2SV_blank>Daemon<S2SV_blank>socket" , "EGD" ) ; break ; } # ifndef OPENSSL_NO_ENGINE switch ( cmd ) { case CMD_SET_DEFAULTS : engine_reset_list ( ) ; break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "engine" ) ) break ; if ( ! strcasecmp ( arg , "auto" ) ) return engine_auto ( ) ; else return engine_open ( arg ) ; case CMD_INITIALIZE : engine_init ( ) ; break ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>auto|engine_id" , "engine" ) ; break ; } switch ( cmd ) { case CMD_SET_DEFAULTS : break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "engineCtrl" ) ) break ; { char * tmp_str = strchr ( arg , ':' ) ; if ( tmp_str ) * tmp_str ++ = '\\0' ; return engine_ctrl ( arg , tmp_str ) ; } case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>cmd[:arg]" , "engineCtrl" ) ; break ; } switch ( cmd ) { case CMD_SET_DEFAULTS : break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "engineDefault" ) ) break ; return engine_default ( arg ) ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>TASK_LIST" , "engineDefault" ) ; break ; } # endif switch ( cmd ) { case CMD_SET_DEFAULTS : # ifdef USE_FIPS <S2SV_StartBug> new_global_options . option . fips = 0 ; <S2SV_EndBug> # endif break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "fips" ) ) <S2SV_StartBug> break ; <S2SV_EndBug> # ifdef USE_FIPS <S2SV_StartBug> if ( ! strcasecmp ( arg , "yes" ) ) <S2SV_EndBug> new_global_options . option . fips = 1 ; <S2SV_StartBug> else if ( ! strcasecmp ( arg , "no" ) ) <S2SV_EndBug> <S2SV_StartBug> new_global_options . option . fips = 0 ; <S2SV_EndBug> <S2SV_StartBug> else <S2SV_EndBug> return "The<S2SV_blank>argument<S2SV_blank>needs<S2SV_blank>to<S2SV_blank>be<S2SV_blank>either<S2SV_blank>\'yes\'<S2SV_blank>or<S2SV_blank>\'no\'" ; <S2SV_StartBug> # else <S2SV_EndBug> if ( strcasecmp ( arg , "no" ) ) return "FIPS<S2SV_blank>support<S2SV_blank>is<S2SV_blank>not<S2SV_blank>available" ; # endif return NULL ; case CMD_INITIALIZE : break ; <S2SV_StartBug> case CMD_PRINT_DEFAULTS : <S2SV_EndBug> break ; case CMD_PRINT_HELP : # ifdef USE_FIPS <S2SV_StartBug> s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>yes|no<S2SV_blank>FIPS<S2SV_blank>140-2<S2SV_blank>mode" , <S2SV_EndBug> "fips" ) ; # endif break ; } # ifndef USE_WIN32 switch ( cmd ) { case CMD_SET_DEFAULTS : <S2SV_StartBug> new_global_options . option . foreground = 0 ; <S2SV_EndBug> <S2SV_StartBug> new_global_options . option . log_stderr = 0 ; <S2SV_EndBug> break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "foreground" ) ) break ; if ( ! strcasecmp ( arg , "yes" ) ) { <S2SV_StartBug> new_global_options . option . foreground = 1 ; <S2SV_EndBug> <S2SV_StartBug> new_global_options . option . log_stderr = 1 ; <S2SV_EndBug> } else if ( ! strcasecmp ( arg , "quiet" ) ) { <S2SV_StartBug> new_global_options . option . foreground = 1 ; <S2SV_EndBug> <S2SV_StartBug> new_global_options . option . log_stderr = 0 ; <S2SV_EndBug> } else if ( ! strcasecmp ( arg , "no" ) ) { <S2SV_StartBug> new_global_options . option . foreground = 0 ; <S2SV_EndBug> <S2SV_StartBug> new_global_options . option . log_stderr = 0 ; <S2SV_EndBug> } else return "The<S2SV_blank>argument<S2SV_blank>needs<S2SV_blank>to<S2SV_blank>be<S2SV_blank>either<S2SV_blank>\'yes\',<S2SV_blank>\'quiet\'<S2SV_blank>or<S2SV_blank>\'no\'" ; return NULL ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>yes|quiet|no<S2SV_blank>foreground<S2SV_blank>mode<S2SV_blank>(don\'t<S2SV_blank>fork,<S2SV_blank>log<S2SV_blank>to<S2SV_blank>stderr)" , "foreground" ) ; break ; } # endif # ifdef ICON_IMAGE switch ( cmd ) { case CMD_SET_DEFAULTS : <S2SV_StartBug> new_global_options . icon [ ICON_ACTIVE ] = load_icon_default ( ICON_ACTIVE ) ; <S2SV_EndBug> break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "iconActive" ) ) break ; <S2SV_StartBug> if ( ! ( new_global_options . icon [ ICON_ACTIVE ] = load_icon_file ( arg ) ) ) <S2SV_EndBug> return "Failed<S2SV_blank>to<S2SV_blank>load<S2SV_blank>the<S2SV_blank>specified<S2SV_blank>icon" ; return NULL ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>icon<S2SV_blank>when<S2SV_blank>connections<S2SV_blank>are<S2SV_blank>established" , "iconActive" ) ; break ; } switch ( cmd ) { case CMD_SET_DEFAULTS : <S2SV_StartBug> new_global_options . icon [ ICON_ERROR ] = load_icon_default ( ICON_ERROR ) ; <S2SV_EndBug> break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "iconError" ) ) break ; <S2SV_StartBug> if ( ! ( new_global_options . icon [ ICON_ERROR ] = load_icon_file ( arg ) ) ) <S2SV_EndBug> return "Failed<S2SV_blank>to<S2SV_blank>load<S2SV_blank>the<S2SV_blank>specified<S2SV_blank>icon" ; return NULL ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>icon<S2SV_blank>for<S2SV_blank>invalid<S2SV_blank>configuration<S2SV_blank>file" , "iconError" ) ; break ; } switch ( cmd ) { case CMD_SET_DEFAULTS : <S2SV_StartBug> new_global_options . icon [ ICON_IDLE ] = load_icon_default ( ICON_IDLE ) ; <S2SV_EndBug> break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "iconIdle" ) ) break ; <S2SV_StartBug> if ( ! ( new_global_options . icon [ ICON_IDLE ] = load_icon_file ( arg ) ) ) <S2SV_EndBug> return "Failed<S2SV_blank>to<S2SV_blank>load<S2SV_blank>the<S2SV_blank>specified<S2SV_blank>icon" ; return NULL ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>icon<S2SV_blank>when<S2SV_blank>no<S2SV_blank>connections<S2SV_blank>were<S2SV_blank>established" , "iconIdle" ) ; break ; } # endif switch ( cmd ) { case CMD_SET_DEFAULTS : <S2SV_StartBug> new_global_options . log_file_mode = FILE_MODE_APPEND ; <S2SV_EndBug> break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "log" ) ) break ; if ( ! strcasecmp ( arg , "append" ) ) <S2SV_StartBug> new_global_options . log_file_mode = FILE_MODE_APPEND ; <S2SV_EndBug> else if ( ! strcasecmp ( arg , "overwrite" ) ) <S2SV_StartBug> new_global_options . log_file_mode = FILE_MODE_OVERWRITE ; <S2SV_EndBug> else return "The<S2SV_blank>argument<S2SV_blank>needs<S2SV_blank>to<S2SV_blank>be<S2SV_blank>either<S2SV_blank>\'append\'<S2SV_blank>or<S2SV_blank>\'overwrite\'" ; return NULL ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>append|overwrite<S2SV_blank>log<S2SV_blank>file" , "log" ) ; break ; } switch ( cmd ) { case CMD_SET_DEFAULTS : <S2SV_StartBug> new_global_options . output_file = NULL ; <S2SV_EndBug> break ; case CMD_SET_COPY : break ; case CMD_FREE : <S2SV_StartBug> tmp = global_options . output_file ; <S2SV_EndBug> global_options . output_file = NULL ; str_free ( tmp ) ; break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "output" ) ) break ; <S2SV_StartBug> new_global_options . output_file = str_dup ( arg ) ; <S2SV_EndBug> return NULL ; case CMD_INITIALIZE : # ifndef USE_WIN32 <S2SV_StartBug> if ( ! new_global_options . option . foreground && <S2SV_EndBug> <S2SV_StartBug> new_global_options . output_file && <S2SV_EndBug> new_global_options . output_file [ 0 ] != '/' ) return "Log<S2SV_blank>file<S2SV_blank>must<S2SV_blank>include<S2SV_blank>full<S2SV_blank>path<S2SV_blank>name" ; # endif break ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>file<S2SV_blank>to<S2SV_blank>append<S2SV_blank>log<S2SV_blank>messages" , "output" ) ; break ; } # ifndef USE_WIN32 switch ( cmd ) { case CMD_SET_DEFAULTS : <S2SV_StartBug> new_global_options . pidfile = NULL ; <S2SV_EndBug> break ; case CMD_SET_COPY : break ; case CMD_FREE : <S2SV_StartBug> tmp = global_options . pidfile ; <S2SV_EndBug> global_options . pidfile = NULL ; str_free ( tmp ) ; break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "pid" ) ) break ; if ( arg [ 0 ] ) <S2SV_StartBug> new_global_options . pidfile = str_dup ( arg ) ; <S2SV_EndBug> else <S2SV_StartBug> new_global_options . pidfile = NULL ; <S2SV_EndBug> return NULL ; case CMD_INITIALIZE : <S2SV_StartBug> if ( ! new_global_options . option . foreground && <S2SV_EndBug> <S2SV_StartBug> new_global_options . pidfile && <S2SV_EndBug> new_global_options . pidfile [ 0 ] != '/' ) return "Pid<S2SV_blank>file<S2SV_blank>must<S2SV_blank>include<S2SV_blank>full<S2SV_blank>path<S2SV_blank>name" ; break ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>pid<S2SV_blank>file" , "pid" ) ; break ; } # endif switch ( cmd ) { case CMD_SET_DEFAULTS : <S2SV_StartBug> new_global_options . random_bytes = RANDOM_BYTES ; <S2SV_EndBug> break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "RNDbytes" ) ) break ; { char * tmp_str ; <S2SV_StartBug> new_global_options . random_bytes = ( long ) strtol ( arg , & tmp_str , 10 ) ; <S2SV_EndBug> if ( tmp_str == arg || * tmp_str ) return "Illegal<S2SV_blank>number<S2SV_blank>of<S2SV_blank>bytes<S2SV_blank>to<S2SV_blank>read<S2SV_blank>from<S2SV_blank>random<S2SV_blank>seed<S2SV_blank>files" ; } return NULL ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>%d" , "RNDbytes" , RANDOM_BYTES ) ; break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>bytes<S2SV_blank>to<S2SV_blank>read<S2SV_blank>from<S2SV_blank>random<S2SV_blank>seed<S2SV_blank>files" , "RNDbytes" ) ; break ; } switch ( cmd ) { case CMD_SET_DEFAULTS : # ifdef RANDOM_FILE <S2SV_StartBug> new_global_options . rand_file = str_dup ( RANDOM_FILE ) ; <S2SV_EndBug> # else <S2SV_StartBug> new_global_options . rand_file = NULL ; <S2SV_EndBug> # endif break ; case CMD_SET_COPY : break ; case CMD_FREE : <S2SV_StartBug> tmp = global_options . rand_file ; <S2SV_EndBug> global_options . rand_file = NULL ; str_free ( tmp ) ; break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "RNDfile" ) ) break ; <S2SV_StartBug> new_global_options . rand_file = str_dup ( arg ) ; <S2SV_EndBug> return NULL ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : # ifdef RANDOM_FILE s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>%s" , "RNDfile" , RANDOM_FILE ) ; # endif break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>path<S2SV_blank>to<S2SV_blank>file<S2SV_blank>with<S2SV_blank>random<S2SV_blank>seed<S2SV_blank>data" , "RNDfile" ) ; break ; } switch ( cmd ) { case CMD_SET_DEFAULTS : <S2SV_StartBug> new_global_options . option . rand_write = 1 ; <S2SV_EndBug> break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "RNDoverwrite" ) ) break ; if ( ! strcasecmp ( arg , "yes" ) ) <S2SV_StartBug> new_global_options . option . rand_write = 1 ; <S2SV_EndBug> else if ( ! strcasecmp ( arg , "no" ) ) <S2SV_StartBug> new_global_options . option . rand_write = 0 ; <S2SV_EndBug> else return "The<S2SV_blank>argument<S2SV_blank>needs<S2SV_blank>to<S2SV_blank>be<S2SV_blank>either<S2SV_blank>\'yes\'<S2SV_blank>or<S2SV_blank>\'no\'" ; return NULL ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>yes" , "RNDoverwrite" ) ; break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>yes|no<S2SV_blank>overwrite<S2SV_blank>seed<S2SV_blank>datafiles<S2SV_blank>with<S2SV_blank>new<S2SV_blank>random<S2SV_blank>data" , "RNDoverwrite" ) ; break ; } # ifndef USE_WIN32 switch ( cmd ) { case CMD_SET_DEFAULTS : <S2SV_StartBug> new_global_options . option . log_syslog = 1 ; <S2SV_EndBug> break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "syslog" ) ) break ; if ( ! strcasecmp ( arg , "yes" ) ) <S2SV_StartBug> new_global_options . option . log_syslog = 1 ; <S2SV_EndBug> else if ( ! strcasecmp ( arg , "no" ) ) <S2SV_StartBug> new_global_options . option . log_syslog = 0 ; <S2SV_EndBug> else return "The<S2SV_blank>argument<S2SV_blank>needs<S2SV_blank>to<S2SV_blank>be<S2SV_blank>either<S2SV_blank>\'yes\'<S2SV_blank>or<S2SV_blank>\'no\'" ; return NULL ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>yes|no<S2SV_blank>send<S2SV_blank>logging<S2SV_blank>messages<S2SV_blank>to<S2SV_blank>syslog" , "syslog" ) ; break ; } # endif # ifdef USE_WIN32 switch ( cmd ) { case CMD_SET_DEFAULTS : <S2SV_StartBug> new_global_options . option . taskbar = 1 ; <S2SV_EndBug> break ; case CMD_SET_COPY : break ; case CMD_FREE : break ; case CMD_SET_VALUE : if ( strcasecmp ( opt , "taskbar" ) ) break ; if ( ! strcasecmp ( arg , "yes" ) ) <S2SV_StartBug> new_global_options . option . taskbar = 1 ; <S2SV_EndBug> else if ( ! strcasecmp ( arg , "no" ) ) <S2SV_StartBug> new_global_options . option . taskbar = 0 ; <S2SV_EndBug> else return "The<S2SV_blank>argument<S2SV_blank>needs<S2SV_blank>to<S2SV_blank>be<S2SV_blank>either<S2SV_blank>\'yes\'<S2SV_blank>or<S2SV_blank>\'no\'" ; return NULL ; case CMD_INITIALIZE : break ; case CMD_PRINT_DEFAULTS : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>yes" , "taskbar" ) ; break ; case CMD_PRINT_HELP : s_log ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>yes|no<S2SV_blank>enable<S2SV_blank>the<S2SV_blank>taskbar<S2SV_blank>icon" , "taskbar" ) ; break ; } # endif switch ( cmd ) { case CMD_SET_DEFAULTS : break ; case CMD_SET_COPY : break ; case CMD_FREE : <S2SV_StartBug> break ; <S2SV_EndBug> case CMD_SET_VALUE : return option_not_found ; case CMD_INITIALIZE : <S2SV_StartBug> if ( ssl_configure ( & new_global_options ) ) <S2SV_EndBug> return "Failed<S2SV_blank>to<S2SV_blank>initialize<S2SV_blank>TLS" ; case CMD_PRINT_DEFAULTS : break ; case CMD_PRINT_HELP : break ; } return NULL ; }
| <S2SV_ModStart> ( CMD cmd , GLOBAL_OPTIONS * options <S2SV_ModStart> case CMD_SET_DEFAULTS : options -> <S2SV_ModEnd> chroot_dir = NULL <S2SV_ModStart> : tmp = options -> chroot_dir ; options -> <S2SV_ModEnd> chroot_dir = NULL <S2SV_ModStart> ) break ; options -> <S2SV_ModEnd> chroot_dir = str_dup <S2SV_ModStart> case CMD_SET_DEFAULTS : options -> <S2SV_ModEnd> compression = COMP_NONE <S2SV_ModStart> "deflate" ) ) options -> <S2SV_ModEnd> compression = COMP_DEFLATE <S2SV_ModStart> "zlib" ) ) options -> <S2SV_ModEnd> compression = COMP_ZLIB <S2SV_ModStart> # ifdef EGD_SOCKET options -> <S2SV_ModEnd> egd_sock = EGD_SOCKET <S2SV_ModStart> ; # else options -> <S2SV_ModEnd> egd_sock = NULL <S2SV_ModStart> : tmp = options -> egd_sock ; options -> <S2SV_ModEnd> egd_sock = NULL <S2SV_ModStart> ) break ; options -> <S2SV_ModEnd> egd_sock = str_dup <S2SV_ModStart> # ifdef USE_FIPS options -> <S2SV_ModEnd> option . fips <S2SV_ModStart> . fips = FIPS_mode ( ) ? 1 : <S2SV_ModStart> ) break ; if ( ! strcasecmp ( arg , "yes" ) ) { <S2SV_ModStart> # ifdef USE_FIPS options -> <S2SV_ModEnd> option . fips <S2SV_ModStart> = 1 ; # else return "FIPS<S2SV_blank>support<S2SV_blank>is<S2SV_blank>not<S2SV_blank>available" ; # endif } else <S2SV_ModEnd> if ( ! <S2SV_ModStart> "no" ) ) { # ifdef USE_FIPS if ( FIPS_mode ( ) ) return "Failed<S2SV_blank>to<S2SV_blank>override<S2SV_blank>system-wide<S2SV_blank>FIPS<S2SV_blank>mode" ; options -> <S2SV_ModEnd> option . fips <S2SV_ModStart> = 0 ; # endif } else { <S2SV_ModEnd> return "The<S2SV_blank>argument<S2SV_blank>needs<S2SV_blank>to<S2SV_blank>be<S2SV_blank>either<S2SV_blank>\'yes\'<S2SV_blank>or<S2SV_blank>\'no\'" ; <S2SV_ModStart> return "The<S2SV_blank>argument<S2SV_blank>needs<S2SV_blank>to<S2SV_blank>be<S2SV_blank>either<S2SV_blank>\'yes\'<S2SV_blank>or<S2SV_blank>\'no\'" ; } <S2SV_ModEnd> return NULL ; <S2SV_ModStart> ; case CMD_PRINT_DEFAULTS <S2SV_ModEnd> : # ifdef <S2SV_ModStart> ( LOG_NOTICE , "%-22s<S2SV_blank>=<S2SV_blank>%s" , "fips" , FIPS_mode ( ) ? "yes" : "no" ) ; # endif break ; case CMD_PRINT_HELP : # ifdef USE_FIPS s_log ( LOG_NOTICE , <S2SV_ModStart> case CMD_SET_DEFAULTS : options -> <S2SV_ModEnd> option . foreground <S2SV_ModStart> = 0 ; options -> <S2SV_ModEnd> option . log_stderr <S2SV_ModStart> ) ) { options -> <S2SV_ModEnd> option . foreground <S2SV_ModStart> = 1 ; options -> <S2SV_ModEnd> option . log_stderr <S2SV_ModStart> ) ) { options -> <S2SV_ModEnd> option . foreground <S2SV_ModStart> = 1 ; options -> <S2SV_ModEnd> option . log_stderr <S2SV_ModStart> ) ) { options -> <S2SV_ModEnd> option . foreground <S2SV_ModStart> = 0 ; options -> <S2SV_ModEnd> option . log_stderr <S2SV_ModStart> case CMD_SET_DEFAULTS : options -> <S2SV_ModEnd> icon [ ICON_ACTIVE <S2SV_ModStart> ( ! ( options -> <S2SV_ModEnd> icon [ ICON_ACTIVE <S2SV_ModStart> case CMD_SET_DEFAULTS : options -> <S2SV_ModEnd> icon [ ICON_ERROR <S2SV_ModStart> ( ! ( options -> <S2SV_ModEnd> icon [ ICON_ERROR <S2SV_ModStart> case CMD_SET_DEFAULTS : options -> <S2SV_ModEnd> icon [ ICON_IDLE <S2SV_ModStart> ( ! ( options -> <S2SV_ModEnd> icon [ ICON_IDLE <S2SV_ModStart> case CMD_SET_DEFAULTS : options -> <S2SV_ModEnd> log_file_mode = FILE_MODE_APPEND <S2SV_ModStart> "append" ) ) options -> <S2SV_ModEnd> log_file_mode = FILE_MODE_APPEND <S2SV_ModStart> "overwrite" ) ) options -> <S2SV_ModEnd> log_file_mode = FILE_MODE_OVERWRITE <S2SV_ModStart> case CMD_SET_DEFAULTS : options -> <S2SV_ModEnd> output_file = NULL <S2SV_ModStart> : tmp = options -> output_file ; options -> <S2SV_ModEnd> output_file = NULL <S2SV_ModStart> ) break ; options -> <S2SV_ModEnd> output_file = str_dup <S2SV_ModStart> if ( ! options -> <S2SV_ModEnd> option . foreground <S2SV_ModStart> . foreground && options -> output_file && options -> <S2SV_ModEnd> output_file [ 0 <S2SV_ModStart> case CMD_SET_DEFAULTS : options -> <S2SV_ModEnd> pidfile = NULL <S2SV_ModStart> : tmp = options -> pidfile ; options -> <S2SV_ModEnd> pidfile = NULL <S2SV_ModStart> 0 ] ) options -> <S2SV_ModEnd> pidfile = str_dup <S2SV_ModStart> ) ; else options -> <S2SV_ModEnd> pidfile = NULL <S2SV_ModStart> if ( ! options -> <S2SV_ModEnd> option . foreground <S2SV_ModStart> . foreground && options -> pidfile && options -> <S2SV_ModEnd> pidfile [ 0 <S2SV_ModStart> case CMD_SET_DEFAULTS : options -> <S2SV_ModEnd> random_bytes = RANDOM_BYTES <S2SV_ModStart> * tmp_str ; options -> <S2SV_ModEnd> random_bytes = ( <S2SV_ModStart> # ifdef RANDOM_FILE options -> <S2SV_ModEnd> rand_file = str_dup <S2SV_ModStart> ; # else options -> <S2SV_ModEnd> rand_file = NULL <S2SV_ModStart> : tmp = options -> rand_file ; options -> <S2SV_ModEnd> rand_file = NULL <S2SV_ModStart> ) break ; options -> <S2SV_ModEnd> rand_file = str_dup <S2SV_ModStart> case CMD_SET_DEFAULTS : options -> <S2SV_ModEnd> option . rand_write <S2SV_ModStart> "yes" ) ) options -> <S2SV_ModEnd> option . rand_write <S2SV_ModStart> "no" ) ) options -> <S2SV_ModEnd> option . rand_write <S2SV_ModStart> case CMD_SET_DEFAULTS : options -> <S2SV_ModEnd> option . log_syslog <S2SV_ModStart> "yes" ) ) options -> <S2SV_ModEnd> option . log_syslog <S2SV_ModStart> "no" ) ) options -> <S2SV_ModEnd> option . log_syslog <S2SV_ModStart> case CMD_SET_DEFAULTS : options -> <S2SV_ModEnd> option . taskbar <S2SV_ModStart> "yes" ) ) options -> <S2SV_ModEnd> option . taskbar <S2SV_ModStart> "no" ) ) options -> <S2SV_ModEnd> option . taskbar <S2SV_ModStart> case CMD_FREE : memset ( options , 0 , sizeof ( GLOBAL_OPTIONS ) ) ; <S2SV_ModStart> ( ssl_configure ( options <S2SV_ModEnd> ) ) return
| mtrojnar@stunnel/ebad9ddc4efb2635f37174c9d800d06206f1edf9 | CVE-2021-20230 | https://github.com/mtrojnar/stunnel/commit/ebad9ddc4efb2635f37174c9d800d06206f1edf9 | 2021-02-23T17:15Z |
275 | CWE-59 | CWE-59 static char * lxclock_name ( const char * p , const char * n ) { int ret ; int len ; char * dest ; char * rundir ; <S2SV_StartBug> len = strlen ( "/lock/lxc/" ) + strlen ( n ) + strlen ( p ) + 3 ; <S2SV_EndBug> rundir = get_rundir ( ) ; if ( ! rundir ) return NULL ; len += strlen ( rundir ) ; if ( ( dest = malloc ( len ) ) == NULL ) { free ( rundir ) ; return NULL ; } <S2SV_StartBug> ret = snprintf ( dest , len , "%s/lock/lxc/%s" , rundir , p ) ; <S2SV_EndBug> if ( ret < 0 || ret >= len ) { free ( dest ) ; free ( rundir ) ; return NULL ; } ret = mkdir_p ( dest , 0755 ) ; if ( ret < 0 ) { <S2SV_StartBug> int l2 = 22 + strlen ( n ) + strlen ( p ) ; <S2SV_EndBug> if ( l2 > len ) { char * d ; d = realloc ( dest , l2 ) ; if ( ! d ) { free ( dest ) ; free ( rundir ) ; return NULL ; } len = l2 ; dest = d ; } ret = snprintf ( dest , len , "/tmp/%d/lxc%s" , geteuid ( ) , p ) ; if ( ret < 0 || ret >= len ) { free ( dest ) ; <S2SV_StartBug> free ( rundir ) ; <S2SV_EndBug> return NULL ; } ret = mkdir_p ( dest , 0755 ) ; if ( ret < 0 ) { free ( dest ) ; free ( rundir ) ; return NULL ; } ret = snprintf ( dest , len , "/tmp/%d/lxc%s/.%s" , geteuid ( ) , p , n ) ; } else ret = snprintf ( dest , len , "%s/lock/lxc/%s/.%s" , rundir , p , n ) ; free ( rundir ) ; if ( ret < 0 || ret >= len ) { free ( dest ) ; return NULL ; } return dest ; }
| <S2SV_ModStart> = strlen ( "/lxc/lock/" <S2SV_ModEnd> ) + strlen <S2SV_ModStart> , len , "%s/lxc/lock/%s" <S2SV_ModEnd> , rundir , <S2SV_ModStart> 0 ) { free ( dest ) ; free ( rundir ) ; return NULL ; } ret = snprintf ( dest , len , "%s/lxc/lock/%s/.%s" , rundir , p , n ) ; free ( rundir <S2SV_ModEnd> ) ; if <S2SV_ModStart> dest ) ; <S2SV_ModEnd> return NULL ;
| lxc@lxc/72cf81f6a3404e35028567db2c99a90406e9c6e6 | CVE-2015-1331 | https://github.com/lxc/lxc/commit/72cf81f6a3404e35028567db2c99a90406e9c6e6 | 2015-08-12T14:59Z |
276 | CWE-22 | CWE-22 static int target_xcopy_locate_se_dev_e4_iter ( struct se_device * se_dev , <S2SV_StartBug> void * data ) <S2SV_EndBug> { struct xcopy_dev_search_info * info = data ; unsigned char tmp_dev_wwn [ XCOPY_NAA_IEEE_REGEX_LEN ] ; int rc ; <S2SV_StartBug> if ( ! se_dev -> dev_attrib . emulate_3pc ) <S2SV_EndBug> <S2SV_StartBug> return 0 ; <S2SV_EndBug> memset ( & tmp_dev_wwn [ 0 ] , 0 , XCOPY_NAA_IEEE_REGEX_LEN ) ; target_xcopy_gen_naa_ieee ( se_dev , & tmp_dev_wwn [ 0 ] ) ; <S2SV_StartBug> rc = memcmp ( & tmp_dev_wwn [ 0 ] , info -> dev_wwn , XCOPY_NAA_IEEE_REGEX_LEN ) ; <S2SV_EndBug> <S2SV_StartBug> if ( rc != 0 ) <S2SV_EndBug> return 0 ; <S2SV_StartBug> info -> found_dev = se_dev ; <S2SV_EndBug> pr_debug ( "XCOPY<S2SV_blank>0xe4:<S2SV_blank>located<S2SV_blank>se_dev:<S2SV_blank>%p\\n" , se_dev ) ; <S2SV_StartBug> rc = target_depend_item ( & se_dev -> dev_group . cg_item ) ; <S2SV_EndBug> if ( rc != 0 ) { pr_err ( "configfs_depend_item<S2SV_blank>attempt<S2SV_blank>failed:<S2SV_blank>%d<S2SV_blank>for<S2SV_blank>se_dev:<S2SV_blank>%p\\n" , rc , se_dev ) ; return rc ; } pr_debug ( "Called<S2SV_blank>configfs_depend_item<S2SV_blank>for<S2SV_blank>se_dev:<S2SV_blank>%p<S2SV_blank>se_dev->se_dev_group:<S2SV_blank>%p\\n" , se_dev , & se_dev -> dev_group ) ; return 1 ; }
| <S2SV_ModStart> * se_dev , const unsigned char * dev_wwn ) { <S2SV_ModEnd> unsigned char tmp_dev_wwn <S2SV_ModStart> . emulate_3pc ) { pr_debug ( "XCOPY:<S2SV_blank>emulate_3pc<S2SV_blank>disabled<S2SV_blank>on<S2SV_blank>se_dev<S2SV_blank>%p\\n" , se_dev ) ; <S2SV_ModStart> return 0 ; } <S2SV_ModStart> 0 ] , <S2SV_ModEnd> dev_wwn , XCOPY_NAA_IEEE_REGEX_LEN <S2SV_ModStart> != 0 ) { pr_debug ( "XCOPY:<S2SV_blank>skip<S2SV_blank>non-matching:<S2SV_blank>%*ph\\n" , XCOPY_NAA_IEEE_REGEX_LEN , tmp_dev_wwn ) ; <S2SV_ModStart> return 0 ; } <S2SV_ModEnd> pr_debug ( "XCOPY<S2SV_blank>0xe4:<S2SV_blank>located<S2SV_blank>se_dev:<S2SV_blank>%p\\n" <S2SV_ModStart> se_dev ) ; <S2SV_ModEnd> return 1 ;
| torvalds@linux/2896c93811e39d63a4d9b63ccf12a8fbc226e5e4 | CVE-2020-28374 | https://github.com/torvalds/linux/commit/2896c93811e39d63a4d9b63ccf12a8fbc226e5e4 | 2021-01-13T04:15Z |
277 | CWE-401 | CWE-401 static int acp_hw_init ( void * handle ) { int r , i ; uint64_t acp_base ; u32 val = 0 ; u32 count = 0 ; struct device * dev ; <S2SV_StartBug> struct i2s_platform_data * i2s_pdata ; <S2SV_EndBug> struct amdgpu_device * adev = ( struct amdgpu_device * ) handle ; const struct amdgpu_ip_block * ip_block = amdgpu_device_ip_get_ip_block ( adev , AMD_IP_BLOCK_TYPE_ACP ) ; if ( ! ip_block ) return - EINVAL ; r = amd_acp_hw_init ( adev -> acp . cgs_device , ip_block -> version -> major , ip_block -> version -> minor ) ; if ( r == - ENODEV ) { amdgpu_dpm_set_powergating_by_smu ( adev , AMD_IP_BLOCK_TYPE_ACP , true ) ; return 0 ; } else if ( r ) { return r ; } if ( adev -> rmmio_size == 0 || adev -> rmmio_size < 0x5289 ) return - EINVAL ; acp_base = adev -> rmmio_base ; adev -> acp . acp_genpd = kzalloc ( sizeof ( struct acp_pm_domain ) , GFP_KERNEL ) ; if ( adev -> acp . acp_genpd == NULL ) return - ENOMEM ; adev -> acp . acp_genpd -> gpd . name = "ACP_AUDIO" ; adev -> acp . acp_genpd -> gpd . power_off = acp_poweroff ; adev -> acp . acp_genpd -> gpd . power_on = acp_poweron ; adev -> acp . acp_genpd -> adev = adev ; pm_genpd_init ( & adev -> acp . acp_genpd -> gpd , NULL , false ) ; adev -> acp . acp_cell = kcalloc ( ACP_DEVS , sizeof ( struct mfd_cell ) , GFP_KERNEL ) ; if ( adev -> acp . acp_cell == NULL ) <S2SV_StartBug> return - ENOMEM ; <S2SV_EndBug> <S2SV_StartBug> adev -> acp . acp_res = kcalloc ( 5 , sizeof ( struct resource ) , GFP_KERNEL ) ; <S2SV_EndBug> if ( adev -> acp . acp_res == NULL ) { <S2SV_StartBug> kfree ( adev -> acp . acp_cell ) ; <S2SV_EndBug> return - ENOMEM ; <S2SV_StartBug> } <S2SV_EndBug> i2s_pdata = kcalloc ( 3 , sizeof ( struct i2s_platform_data ) , GFP_KERNEL ) ; if ( i2s_pdata == NULL ) { <S2SV_StartBug> kfree ( adev -> acp . acp_res ) ; <S2SV_EndBug> kfree ( adev -> acp . acp_cell ) ; return - ENOMEM ; } switch ( adev -> asic_type ) { case CHIP_STONEY : i2s_pdata [ 0 ] . quirks = DW_I2S_QUIRK_COMP_REG_OFFSET | DW_I2S_QUIRK_16BIT_IDX_OVERRIDE ; break ; default : i2s_pdata [ 0 ] . quirks = DW_I2S_QUIRK_COMP_REG_OFFSET ; } i2s_pdata [ 0 ] . cap = DWC_I2S_PLAY ; i2s_pdata [ 0 ] . snd_rates = SNDRV_PCM_RATE_8000_96000 ; i2s_pdata [ 0 ] . i2s_reg_comp1 = ACP_I2S_COMP1_PLAY_REG_OFFSET ; i2s_pdata [ 0 ] . i2s_reg_comp2 = ACP_I2S_COMP2_PLAY_REG_OFFSET ; switch ( adev -> asic_type ) { case CHIP_STONEY : i2s_pdata [ 1 ] . quirks = DW_I2S_QUIRK_COMP_REG_OFFSET | DW_I2S_QUIRK_COMP_PARAM1 | DW_I2S_QUIRK_16BIT_IDX_OVERRIDE ; break ; default : i2s_pdata [ 1 ] . quirks = DW_I2S_QUIRK_COMP_REG_OFFSET | DW_I2S_QUIRK_COMP_PARAM1 ; } i2s_pdata [ 1 ] . cap = DWC_I2S_RECORD ; i2s_pdata [ 1 ] . snd_rates = SNDRV_PCM_RATE_8000_96000 ; i2s_pdata [ 1 ] . i2s_reg_comp1 = ACP_I2S_COMP1_CAP_REG_OFFSET ; i2s_pdata [ 1 ] . i2s_reg_comp2 = ACP_I2S_COMP2_CAP_REG_OFFSET ; i2s_pdata [ 2 ] . quirks = DW_I2S_QUIRK_COMP_REG_OFFSET ; switch ( adev -> asic_type ) { case CHIP_STONEY : i2s_pdata [ 2 ] . quirks |= DW_I2S_QUIRK_16BIT_IDX_OVERRIDE ; break ; default : break ; } i2s_pdata [ 2 ] . cap = DWC_I2S_PLAY | DWC_I2S_RECORD ; i2s_pdata [ 2 ] . snd_rates = SNDRV_PCM_RATE_8000_96000 ; i2s_pdata [ 2 ] . i2s_reg_comp1 = ACP_BT_COMP1_REG_OFFSET ; i2s_pdata [ 2 ] . i2s_reg_comp2 = ACP_BT_COMP2_REG_OFFSET ; adev -> acp . acp_res [ 0 ] . name = "acp2x_dma" ; adev -> acp . acp_res [ 0 ] . flags = IORESOURCE_MEM ; adev -> acp . acp_res [ 0 ] . start = acp_base ; adev -> acp . acp_res [ 0 ] . end = acp_base + ACP_DMA_REGS_END ; adev -> acp . acp_res [ 1 ] . name = "acp2x_dw_i2s_play" ; adev -> acp . acp_res [ 1 ] . flags = IORESOURCE_MEM ; adev -> acp . acp_res [ 1 ] . start = acp_base + ACP_I2S_PLAY_REGS_START ; adev -> acp . acp_res [ 1 ] . end = acp_base + ACP_I2S_PLAY_REGS_END ; adev -> acp . acp_res [ 2 ] . name = "acp2x_dw_i2s_cap" ; adev -> acp . acp_res [ 2 ] . flags = IORESOURCE_MEM ; adev -> acp . acp_res [ 2 ] . start = acp_base + ACP_I2S_CAP_REGS_START ; adev -> acp . acp_res [ 2 ] . end = acp_base + ACP_I2S_CAP_REGS_END ; adev -> acp . acp_res [ 3 ] . name = "acp2x_dw_bt_i2s_play_cap" ; adev -> acp . acp_res [ 3 ] . flags = IORESOURCE_MEM ; adev -> acp . acp_res [ 3 ] . start = acp_base + ACP_BT_PLAY_REGS_START ; adev -> acp . acp_res [ 3 ] . end = acp_base + ACP_BT_PLAY_REGS_END ; adev -> acp . acp_res [ 4 ] . name = "acp2x_dma_irq" ; adev -> acp . acp_res [ 4 ] . flags = IORESOURCE_IRQ ; adev -> acp . acp_res [ 4 ] . start = amdgpu_irq_create_mapping ( adev , 162 ) ; adev -> acp . acp_res [ 4 ] . end = adev -> acp . acp_res [ 4 ] . start ; adev -> acp . acp_cell [ 0 ] . name = "acp_audio_dma" ; adev -> acp . acp_cell [ 0 ] . num_resources = 5 ; adev -> acp . acp_cell [ 0 ] . resources = & adev -> acp . acp_res [ 0 ] ; adev -> acp . acp_cell [ 0 ] . platform_data = & adev -> asic_type ; adev -> acp . acp_cell [ 0 ] . pdata_size = sizeof ( adev -> asic_type ) ; adev -> acp . acp_cell [ 1 ] . name = "designware-i2s" ; adev -> acp . acp_cell [ 1 ] . num_resources = 1 ; adev -> acp . acp_cell [ 1 ] . resources = & adev -> acp . acp_res [ 1 ] ; adev -> acp . acp_cell [ 1 ] . platform_data = & i2s_pdata [ 0 ] ; adev -> acp . acp_cell [ 1 ] . pdata_size = sizeof ( struct i2s_platform_data ) ; adev -> acp . acp_cell [ 2 ] . name = "designware-i2s" ; adev -> acp . acp_cell [ 2 ] . num_resources = 1 ; adev -> acp . acp_cell [ 2 ] . resources = & adev -> acp . acp_res [ 2 ] ; adev -> acp . acp_cell [ 2 ] . platform_data = & i2s_pdata [ 1 ] ; adev -> acp . acp_cell [ 2 ] . pdata_size = sizeof ( struct i2s_platform_data ) ; adev -> acp . acp_cell [ 3 ] . name = "designware-i2s" ; adev -> acp . acp_cell [ 3 ] . num_resources = 1 ; adev -> acp . acp_cell [ 3 ] . resources = & adev -> acp . acp_res [ 3 ] ; adev -> acp . acp_cell [ 3 ] . platform_data = & i2s_pdata [ 2 ] ; adev -> acp . acp_cell [ 3 ] . pdata_size = sizeof ( struct i2s_platform_data ) ; r = mfd_add_hotplug_devices ( adev -> acp . parent , adev -> acp . acp_cell , ACP_DEVS ) ; if ( r ) <S2SV_StartBug> return r ; <S2SV_EndBug> for ( i = 0 ; i < ACP_DEVS ; i ++ ) { dev = get_mfd_cell_dev ( adev -> acp . acp_cell [ i ] . name , i ) ; r = pm_genpd_add_device ( & adev -> acp . acp_genpd -> gpd , dev ) ; if ( r ) { dev_err ( dev , "Failed<S2SV_blank>to<S2SV_blank>add<S2SV_blank>dev<S2SV_blank>to<S2SV_blank>genpd\\n" ) ; <S2SV_StartBug> return r ; <S2SV_EndBug> } } val = cgs_read_register ( adev -> acp . cgs_device , mmACP_SOFT_RESET ) ; val |= ACP_SOFT_RESET__SoftResetAud_MASK ; cgs_write_register ( adev -> acp . cgs_device , mmACP_SOFT_RESET , val ) ; count = ACP_SOFT_RESET_DONE_TIME_OUT_VALUE ; while ( true ) { val = cgs_read_register ( adev -> acp . cgs_device , mmACP_SOFT_RESET ) ; if ( ACP_SOFT_RESET__SoftResetAudDone_MASK == ( val & ACP_SOFT_RESET__SoftResetAudDone_MASK ) ) break ; if ( -- count == 0 ) { dev_err ( & adev -> pdev -> dev , "Failed<S2SV_blank>to<S2SV_blank>reset<S2SV_blank>ACP\\n" ) ; <S2SV_StartBug> return - ETIMEDOUT ; <S2SV_EndBug> } udelay ( 100 ) ; } val = cgs_read_register ( adev -> acp . cgs_device , mmACP_CONTROL ) ; val = val | ACP_CONTROL__ClkEn_MASK ; cgs_write_register ( adev -> acp . cgs_device , mmACP_CONTROL , val ) ; count = ACP_CLOCK_EN_TIME_OUT_VALUE ; while ( true ) { val = cgs_read_register ( adev -> acp . cgs_device , mmACP_STATUS ) ; if ( val & ( u32 ) 0x1 ) break ; if ( -- count == 0 ) { dev_err ( & adev -> pdev -> dev , "Failed<S2SV_blank>to<S2SV_blank>reset<S2SV_blank>ACP\\n" ) ; <S2SV_StartBug> return - ETIMEDOUT ; <S2SV_EndBug> } udelay ( 100 ) ; } val = cgs_read_register ( adev -> acp . cgs_device , mmACP_SOFT_RESET ) ; val &= ~ ACP_SOFT_RESET__SoftResetAud_MASK ; cgs_write_register ( adev -> acp . cgs_device , mmACP_SOFT_RESET , val ) ; return 0 ; <S2SV_StartBug> } <S2SV_EndBug>
| <S2SV_ModStart> i2s_platform_data * i2s_pdata = NULL <S2SV_ModStart> == NULL ) { r = <S2SV_ModEnd> - ENOMEM ; <S2SV_ModStart> - ENOMEM ; goto failure ; } <S2SV_ModStart> NULL ) { r = <S2SV_ModEnd> - ENOMEM ; <S2SV_ModStart> - ENOMEM ; goto failure ; <S2SV_ModStart> NULL ) { r = - ENOMEM ; goto failure <S2SV_ModEnd> ; } switch <S2SV_ModStart> ( r ) goto failure <S2SV_ModEnd> ; for ( <S2SV_ModStart> "Failed<S2SV_blank>to<S2SV_blank>add<S2SV_blank>dev<S2SV_blank>to<S2SV_blank>genpd\\n" ) ; goto failure <S2SV_ModEnd> ; } } <S2SV_ModStart> "Failed<S2SV_blank>to<S2SV_blank>reset<S2SV_blank>ACP\\n" ) ; r = - ETIMEDOUT ; goto failure <S2SV_ModEnd> ; } udelay <S2SV_ModStart> "Failed<S2SV_blank>to<S2SV_blank>reset<S2SV_blank>ACP\\n" ) ; r = - ETIMEDOUT ; goto failure <S2SV_ModEnd> ; } udelay <S2SV_ModStart> return 0 ; failure : kfree ( i2s_pdata ) ; kfree ( adev -> acp . acp_res ) ; kfree ( adev -> acp . acp_cell ) ; kfree ( adev -> acp . acp_genpd ) ; return r ;
| torvalds@linux/57be09c6e8747bf48704136d9e3f92bfb93f5725 | CVE-2019-19067 | https://github.com/torvalds/linux/commit/57be09c6e8747bf48704136d9e3f92bfb93f5725 | 2019-11-18T06:15Z |
278 | CWE-190 | CWE-190 static void * zend_mm_realloc_heap ( zend_mm_heap * heap , void * ptr , size_t size , size_t copy_size ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC ) { size_t page_offset ; size_t old_size ; size_t new_size ; void * ret ; # if ZEND_DEBUG size_t real_size ; zend_mm_debug_info * dbg ; # endif page_offset = ZEND_MM_ALIGNED_OFFSET ( ptr , ZEND_MM_CHUNK_SIZE ) ; if ( UNEXPECTED ( page_offset == 0 ) ) { if ( UNEXPECTED ( ptr == NULL ) ) { return zend_mm_alloc_heap ( heap , size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC ) ; } old_size = zend_mm_get_huge_block_size ( heap , ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC ) ; # if ZEND_DEBUG real_size = size ; size = ZEND_MM_ALIGNED_SIZE ( size ) + ZEND_MM_ALIGNED_SIZE ( sizeof ( zend_mm_debug_info ) ) ; # endif if ( size > ZEND_MM_MAX_LARGE_SIZE ) { # if ZEND_DEBUG size = real_size ; # endif # ifdef ZEND_WIN32 new_size = ZEND_MM_ALIGNED_SIZE_EX ( size , MAX ( REAL_PAGE_SIZE , ZEND_MM_CHUNK_SIZE ) ) ; # else new_size = ZEND_MM_ALIGNED_SIZE_EX ( size , REAL_PAGE_SIZE ) ; # endif if ( new_size == old_size ) { # if ZEND_DEBUG zend_mm_change_huge_block_size ( heap , ptr , new_size , real_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC ) ; # else zend_mm_change_huge_block_size ( heap , ptr , new_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC ) ; # endif return ptr ; } else if ( new_size < old_size ) { if ( zend_mm_chunk_truncate ( heap , ptr , old_size , new_size ) ) { # if ZEND_MM_STAT || ZEND_MM_LIMIT heap -> real_size -= old_size - new_size ; # endif # if ZEND_MM_STAT heap -> size -= old_size - new_size ; # endif # if ZEND_DEBUG zend_mm_change_huge_block_size ( heap , ptr , new_size , real_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC ) ; # else zend_mm_change_huge_block_size ( heap , ptr , new_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC ) ; # endif return ptr ; } } else { # if ZEND_MM_LIMIT if ( UNEXPECTED ( heap -> real_size + ( new_size - old_size ) > heap -> limit ) ) { if ( zend_mm_gc ( heap ) && heap -> real_size + ( new_size - old_size ) <= heap -> limit ) { } else if ( heap -> overflow == 0 ) { # if ZEND_DEBUG zend_mm_safe_error ( heap , "Allowed<S2SV_blank>memory<S2SV_blank>size<S2SV_blank>of<S2SV_blank>%zu<S2SV_blank>bytes<S2SV_blank>exhausted<S2SV_blank>at<S2SV_blank>%s:%d<S2SV_blank>(tried<S2SV_blank>to<S2SV_blank>allocate<S2SV_blank>%zu<S2SV_blank>bytes)" , heap -> limit , __zend_filename , __zend_lineno , size ) ; # else zend_mm_safe_error ( heap , "Allowed<S2SV_blank>memory<S2SV_blank>size<S2SV_blank>of<S2SV_blank>%zu<S2SV_blank>bytes<S2SV_blank>exhausted<S2SV_blank>(tried<S2SV_blank>to<S2SV_blank>allocate<S2SV_blank>%zu<S2SV_blank>bytes)" , heap -> limit , size ) ; # endif return NULL ; } } # endif if ( zend_mm_chunk_extend ( heap , ptr , old_size , new_size ) ) { # if ZEND_MM_STAT || ZEND_MM_LIMIT heap -> real_size += new_size - old_size ; # endif # if ZEND_MM_STAT heap -> real_peak = MAX ( heap -> real_peak , heap -> real_size ) ; heap -> size += new_size - old_size ; heap -> peak = MAX ( heap -> peak , heap -> size ) ; # endif # if ZEND_DEBUG zend_mm_change_huge_block_size ( heap , ptr , new_size , real_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC ) ; # else zend_mm_change_huge_block_size ( heap , ptr , new_size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC ) ; # endif return ptr ; } } } } else { zend_mm_chunk * chunk = ( zend_mm_chunk * ) ZEND_MM_ALIGNED_BASE ( ptr , ZEND_MM_CHUNK_SIZE ) ; int page_num = ( int ) ( page_offset / ZEND_MM_PAGE_SIZE ) ; zend_mm_page_info info = chunk -> map [ page_num ] ; # if ZEND_DEBUG size_t real_size = size ; size = ZEND_MM_ALIGNED_SIZE ( size ) + ZEND_MM_ALIGNED_SIZE ( sizeof ( zend_mm_debug_info ) ) ; # endif ZEND_MM_CHECK ( chunk -> heap == heap , "zend_mm_heap<S2SV_blank>corrupted" ) ; if ( info & ZEND_MM_IS_SRUN ) { <S2SV_StartBug> int old_bin_num , bin_num ; <S2SV_EndBug> old_bin_num = ZEND_MM_SRUN_BIN_NUM ( info ) ; old_size = bin_data_size [ old_bin_num ] ; <S2SV_StartBug> bin_num = ZEND_MM_SMALL_SIZE_TO_BIN ( size ) ; <S2SV_EndBug> if ( old_bin_num == bin_num ) { # if ZEND_DEBUG dbg = zend_mm_get_debug_info ( heap , ptr ) ; dbg -> size = real_size ; dbg -> filename = __zend_filename ; dbg -> orig_filename = __zend_orig_filename ; dbg -> lineno = __zend_lineno ; dbg -> orig_lineno = __zend_orig_lineno ; # endif <S2SV_StartBug> return ptr ; <S2SV_EndBug> } } else { ZEND_MM_CHECK ( ZEND_MM_ALIGNED_OFFSET ( page_offset , ZEND_MM_PAGE_SIZE ) == 0 , "zend_mm_heap<S2SV_blank>corrupted" ) ; old_size = ZEND_MM_LRUN_PAGES ( info ) * ZEND_MM_PAGE_SIZE ; if ( size > ZEND_MM_MAX_SMALL_SIZE && size <= ZEND_MM_MAX_LARGE_SIZE ) { new_size = ZEND_MM_ALIGNED_SIZE_EX ( size , ZEND_MM_PAGE_SIZE ) ; if ( new_size == old_size ) { # if ZEND_DEBUG dbg = zend_mm_get_debug_info ( heap , ptr ) ; dbg -> size = real_size ; dbg -> filename = __zend_filename ; dbg -> orig_filename = __zend_orig_filename ; dbg -> lineno = __zend_lineno ; dbg -> orig_lineno = __zend_orig_lineno ; # endif return ptr ; } else if ( new_size < old_size ) { int new_pages_count = ( int ) ( new_size / ZEND_MM_PAGE_SIZE ) ; int rest_pages_count = ( int ) ( ( old_size - new_size ) / ZEND_MM_PAGE_SIZE ) ; # if ZEND_MM_STAT heap -> size -= rest_pages_count * ZEND_MM_PAGE_SIZE ; # endif chunk -> map [ page_num ] = ZEND_MM_LRUN ( new_pages_count ) ; chunk -> free_pages += rest_pages_count ; zend_mm_bitset_reset_range ( chunk -> free_map , page_num + new_pages_count , rest_pages_count ) ; # if ZEND_DEBUG dbg = zend_mm_get_debug_info ( heap , ptr ) ; dbg -> size = real_size ; dbg -> filename = __zend_filename ; dbg -> orig_filename = __zend_orig_filename ; dbg -> lineno = __zend_lineno ; dbg -> orig_lineno = __zend_orig_lineno ; # endif return ptr ; } else { int new_pages_count = ( int ) ( new_size / ZEND_MM_PAGE_SIZE ) ; int old_pages_count = ( int ) ( old_size / ZEND_MM_PAGE_SIZE ) ; if ( page_num + new_pages_count <= ZEND_MM_PAGES && zend_mm_bitset_is_free_range ( chunk -> free_map , page_num + old_pages_count , new_pages_count - old_pages_count ) ) { # if ZEND_MM_STAT do { size_t size = heap -> size + ( new_size - old_size ) ; size_t peak = MAX ( heap -> peak , size ) ; heap -> size = size ; heap -> peak = peak ; } while ( 0 ) ; # endif chunk -> free_pages -= new_pages_count - old_pages_count ; zend_mm_bitset_set_range ( chunk -> free_map , page_num + old_pages_count , new_pages_count - old_pages_count ) ; chunk -> map [ page_num ] = ZEND_MM_LRUN ( new_pages_count ) ; # if ZEND_DEBUG dbg = zend_mm_get_debug_info ( heap , ptr ) ; dbg -> size = real_size ; dbg -> filename = __zend_filename ; dbg -> orig_filename = __zend_orig_filename ; dbg -> lineno = __zend_lineno ; dbg -> orig_lineno = __zend_orig_lineno ; # endif return ptr ; } } } } # if ZEND_DEBUG size = real_size ; # endif } # if ZEND_MM_STAT do { size_t orig_peak = heap -> peak ; size_t orig_real_peak = heap -> real_peak ; # endif ret = zend_mm_alloc_heap ( heap , size ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC ) ; memcpy ( ret , ptr , MIN ( old_size , copy_size ) ) ; zend_mm_free_heap ( heap , ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC ) ; # if ZEND_MM_STAT heap -> peak = MAX ( orig_peak , heap -> size ) ; heap -> real_peak = MAX ( orig_real_peak , heap -> real_size ) ; } while ( 0 ) ; # endif return ret ; }
| <S2SV_ModStart> { int old_bin_num <S2SV_ModEnd> = ZEND_MM_SRUN_BIN_NUM ( <S2SV_ModStart> old_bin_num ] ; if ( size <= ZEND_MM_MAX_SMALL_SIZE ) { int <S2SV_ModStart> return ptr ; }
| php@php-src/c2a13ced4272f2e65d2773e2ea6ca11c1ce4a911 | CVE-2016-7133 | https://github.com/php/php-src/commit/c2a13ced4272f2e65d2773e2ea6ca11c1ce4a911?w=1 | 2016-09-12T01:59Z |
279 | CWE-119 | CWE-119 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 ; if ( BPF_CLASS ( insn -> code ) != BPF_ALU64 ) { <S2SV_StartBug> coerce_reg_to_32 ( dst_reg ) ; <S2SV_EndBug> <S2SV_StartBug> coerce_reg_to_32 ( & src_reg ) ; <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 ) ; 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 > 63 ) { 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 ; } if ( src_known ) dst_reg -> var_off = tnum_lshift ( dst_reg -> var_off , umin_val ) ; else dst_reg -> var_off = tnum_lshift ( tnum_unknown , umin_val ) ; __update_reg_bounds ( dst_reg ) ; break ; case BPF_RSH : if ( umax_val > 63 ) { mark_reg_unknown ( env , regs , insn -> dst_reg ) ; break ; } dst_reg -> smin_value = S64_MIN ; dst_reg -> smax_value = S64_MAX ; if ( src_known ) dst_reg -> var_off = tnum_rshift ( dst_reg -> var_off , umin_val ) ; else dst_reg -> var_off = tnum_rshift ( tnum_unknown , umin_val ) ; dst_reg -> umin_value >>= umax_val ; dst_reg -> umax_value >>= umin_val ; __update_reg_bounds ( dst_reg ) ; break ; default : mark_reg_unknown ( env , regs , insn -> dst_reg ) ; break ; } __reg_deduce_bounds ( dst_reg ) ; __reg_bound_offset ( dst_reg ) ; return 0 ; }
| <S2SV_ModStart> BPF_ALU64 ) { coerce_reg_to_size ( dst_reg , 4 ) ; coerce_reg_to_size <S2SV_ModEnd> ( & src_reg <S2SV_ModStart> ( & src_reg , 4
| torvalds@linux/0c17d1d2c61936401f4702e1846e2c19b200f958 | CVE-2017-16996 | https://github.com/torvalds/linux/commit/0c17d1d2c61936401f4702e1846e2c19b200f958 | 2017-12-27T17:08Z |
280 | CWE-416 | CWE-416 static int updateDevice ( const struct header * headers , time_t t ) { struct device * * pp = & devlist ; struct device * p = * pp ; while ( p ) { if ( p -> headers [ HEADER_NT ] . l == headers [ HEADER_NT ] . l && ( 0 == memcmp ( p -> headers [ HEADER_NT ] . p , headers [ HEADER_NT ] . p , headers [ HEADER_NT ] . l ) ) && p -> headers [ HEADER_USN ] . l == headers [ HEADER_USN ] . l && ( 0 == memcmp ( p -> headers [ HEADER_USN ] . p , headers [ HEADER_USN ] . p , headers [ HEADER_USN ] . l ) ) ) { syslog ( LOG_DEBUG , "device<S2SV_blank>updated<S2SV_blank>:<S2SV_blank>%.*s" , headers [ HEADER_USN ] . l , headers [ HEADER_USN ] . p ) ; p -> t = t ; if ( headers [ HEADER_LOCATION ] . l > p -> headers [ HEADER_LOCATION ] . l ) { struct device * tmp ; tmp = realloc ( p , sizeof ( struct device ) + headers [ 0 ] . l + headers [ 1 ] . l + headers [ 2 ] . l ) ; if ( ! tmp ) { syslog ( LOG_ERR , "updateDevice()<S2SV_blank>:<S2SV_blank>memory<S2SV_blank>allocation<S2SV_blank>error" ) ; <S2SV_StartBug> free ( p ) ; <S2SV_EndBug> return 0 ; } p = tmp ; * pp = p ; } memcpy ( p -> data + p -> headers [ 0 ] . l + p -> headers [ 1 ] . l , headers [ 2 ] . p , headers [ 2 ] . l ) ; return 0 ; } pp = & p -> next ; p = * pp ; } syslog ( LOG_INFO , "new<S2SV_blank>device<S2SV_blank>discovered<S2SV_blank>:<S2SV_blank>%.*s" , headers [ HEADER_USN ] . l , headers [ HEADER_USN ] . p ) ; { char * pc ; int i ; p = malloc ( sizeof ( struct device ) + headers [ 0 ] . l + headers [ 1 ] . l + headers [ 2 ] . l ) ; if ( ! p ) { syslog ( LOG_ERR , "updateDevice():<S2SV_blank>cannot<S2SV_blank>allocate<S2SV_blank>memory" ) ; return - 1 ; } p -> next = devlist ; p -> t = t ; pc = p -> data ; for ( i = 0 ; i < 3 ; i ++ ) { p -> headers [ i ] . p = pc ; p -> headers [ i ] . l = headers [ i ] . l ; memcpy ( pc , headers [ i ] . p , headers [ i ] . l ) ; pc += headers [ i ] . l ; } devlist = p ; sendNotifications ( NOTIF_NEW , p , NULL ) ; } return 1 ; }
| <S2SV_ModStart> "updateDevice()<S2SV_blank>:<S2SV_blank>memory<S2SV_blank>allocation<S2SV_blank>error" ) ; * pp = p -> next ;
| miniupnp@miniupnp/cd506a67e174a45c6a202eff182a712955ed6d6f | CVE-2019-12106 | https://github.com/miniupnp/miniupnp/commit/cd506a67e174a45c6a202eff182a712955ed6d6f | 2019-05-15T23:29Z |
281 | CWE-264 | CWE-264 asmlinkage long sys_oabi_fcntl64 ( unsigned int fd , unsigned int cmd , unsigned long arg ) { <S2SV_StartBug> struct oabi_flock64 user ; <S2SV_EndBug> struct flock64 kernel ; mm_segment_t fs = USER_DS ; unsigned long local_arg = arg ; int ret ; switch ( cmd ) { case F_OFD_GETLK : case F_OFD_SETLK : case F_OFD_SETLKW : case F_GETLK64 : case F_SETLK64 : case F_SETLKW64 : <S2SV_StartBug> if ( copy_from_user ( & user , ( struct oabi_flock64 __user * ) arg , <S2SV_EndBug> sizeof ( user ) ) ) return - EFAULT ; kernel . l_type = user . l_type ; kernel . l_whence = user . l_whence ; kernel . l_start = user . l_start ; kernel . l_len = user . l_len ; kernel . l_pid = user . l_pid ; local_arg = ( unsigned long ) & kernel ; fs = get_fs ( ) ; set_fs ( KERNEL_DS ) ; } <S2SV_StartBug> ret = sys_fcntl64 ( fd , cmd , local_arg ) ; <S2SV_EndBug> switch ( cmd ) { case F_GETLK64 : if ( ! ret ) { user . l_type = kernel . l_type ; user . l_whence = kernel . l_whence ; user . l_start = kernel . l_start ; user . l_len = kernel . l_len ; user . l_pid = kernel . l_pid ; if ( copy_to_user ( ( struct oabi_flock64 __user * ) arg , & user , sizeof ( user ) ) ) ret = - EFAULT ; } case F_SETLK64 : case F_SETLKW64 : set_fs ( fs ) ; } <S2SV_StartBug> return ret ; <S2SV_EndBug> }
| <S2SV_ModStart> arg ) { <S2SV_ModEnd> switch ( cmd <S2SV_ModStart> case F_SETLKW64 : return do_locks ( fd , cmd , arg ) ; default : return <S2SV_ModEnd> sys_fcntl64 ( fd <S2SV_ModStart> , cmd , arg <S2SV_ModEnd> ) ; } <S2SV_ModStart> ) ; } <S2SV_ModEnd> } <S2SV_null> <S2SV_null>
| torvalds@linux/76cc404bfdc0d419c720de4daaf2584542734f42 | CVE-2015-8966 | https://github.com/torvalds/linux/commit/76cc404bfdc0d419c720de4daaf2584542734f42 | 2016-12-08T21:59Z |
282 | CWE-119 | CWE-119 <S2SV_StartBug> void fdct16_8col ( __m128i * in ) { <S2SV_EndBug> __m128i i [ 8 ] , s [ 8 ] , p [ 8 ] , t [ 8 ] , u [ 16 ] , v [ 16 ] ; <S2SV_StartBug> const __m128i k__cospi_p16_p16 = _mm_set1_epi16 ( cospi_16_64 ) ; <S2SV_EndBug> const __m128i k__cospi_p16_m16 = pair_set_epi16 ( cospi_16_64 , - cospi_16_64 ) ; const __m128i k__cospi_m16_p16 = pair_set_epi16 ( - cospi_16_64 , cospi_16_64 ) ; const __m128i k__cospi_p24_p08 = pair_set_epi16 ( cospi_24_64 , cospi_8_64 ) ; <S2SV_StartBug> const __m128i k__cospi_m24_m08 = pair_set_epi16 ( - cospi_24_64 , - cospi_8_64 ) ; <S2SV_EndBug> const __m128i k__cospi_m08_p24 = pair_set_epi16 ( - cospi_8_64 , cospi_24_64 ) ; const __m128i k__cospi_p28_p04 = pair_set_epi16 ( cospi_28_64 , cospi_4_64 ) ; const __m128i k__cospi_m04_p28 = pair_set_epi16 ( - cospi_4_64 , cospi_28_64 ) ; const __m128i k__cospi_p12_p20 = pair_set_epi16 ( cospi_12_64 , cospi_20_64 ) ; const __m128i k__cospi_m20_p12 = pair_set_epi16 ( - cospi_20_64 , cospi_12_64 ) ; const __m128i k__cospi_p30_p02 = pair_set_epi16 ( cospi_30_64 , cospi_2_64 ) ; const __m128i k__cospi_p14_p18 = pair_set_epi16 ( cospi_14_64 , cospi_18_64 ) ; const __m128i k__cospi_m02_p30 = pair_set_epi16 ( - cospi_2_64 , cospi_30_64 ) ; const __m128i k__cospi_m18_p14 = pair_set_epi16 ( - cospi_18_64 , cospi_14_64 ) ; const __m128i k__cospi_p22_p10 = pair_set_epi16 ( cospi_22_64 , cospi_10_64 ) ; const __m128i k__cospi_p06_p26 = pair_set_epi16 ( cospi_6_64 , cospi_26_64 ) ; const __m128i k__cospi_m10_p22 = pair_set_epi16 ( - cospi_10_64 , cospi_22_64 ) ; const __m128i k__cospi_m26_p06 = pair_set_epi16 ( - cospi_26_64 , cospi_6_64 ) ; const __m128i k__DCT_CONST_ROUNDING = _mm_set1_epi32 ( DCT_CONST_ROUNDING ) ; i [ 0 ] = _mm_add_epi16 ( in [ 0 ] , in [ 15 ] ) ; i [ 1 ] = _mm_add_epi16 ( in [ 1 ] , in [ 14 ] ) ; i [ 2 ] = _mm_add_epi16 ( in [ 2 ] , in [ 13 ] ) ; i [ 3 ] = _mm_add_epi16 ( in [ 3 ] , in [ 12 ] ) ; i [ 4 ] = _mm_add_epi16 ( in [ 4 ] , in [ 11 ] ) ; i [ 5 ] = _mm_add_epi16 ( in [ 5 ] , in [ 10 ] ) ; i [ 6 ] = _mm_add_epi16 ( in [ 6 ] , in [ 9 ] ) ; i [ 7 ] = _mm_add_epi16 ( in [ 7 ] , in [ 8 ] ) ; s [ 0 ] = _mm_sub_epi16 ( in [ 7 ] , in [ 8 ] ) ; s [ 1 ] = _mm_sub_epi16 ( in [ 6 ] , in [ 9 ] ) ; s [ 2 ] = _mm_sub_epi16 ( in [ 5 ] , in [ 10 ] ) ; s [ 3 ] = _mm_sub_epi16 ( in [ 4 ] , in [ 11 ] ) ; s [ 4 ] = _mm_sub_epi16 ( in [ 3 ] , in [ 12 ] ) ; s [ 5 ] = _mm_sub_epi16 ( in [ 2 ] , in [ 13 ] ) ; s [ 6 ] = _mm_sub_epi16 ( in [ 1 ] , in [ 14 ] ) ; s [ 7 ] = _mm_sub_epi16 ( in [ 0 ] , in [ 15 ] ) ; p [ 0 ] = _mm_add_epi16 ( i [ 0 ] , i [ 7 ] ) ; p [ 1 ] = _mm_add_epi16 ( i [ 1 ] , i [ 6 ] ) ; p [ 2 ] = _mm_add_epi16 ( i [ 2 ] , i [ 5 ] ) ; p [ 3 ] = _mm_add_epi16 ( i [ 3 ] , i [ 4 ] ) ; p [ 4 ] = _mm_sub_epi16 ( i [ 3 ] , i [ 4 ] ) ; p [ 5 ] = _mm_sub_epi16 ( i [ 2 ] , i [ 5 ] ) ; p [ 6 ] = _mm_sub_epi16 ( i [ 1 ] , i [ 6 ] ) ; p [ 7 ] = _mm_sub_epi16 ( i [ 0 ] , i [ 7 ] ) ; u [ 0 ] = _mm_add_epi16 ( p [ 0 ] , p [ 3 ] ) ; u [ 1 ] = _mm_add_epi16 ( p [ 1 ] , p [ 2 ] ) ; u [ 2 ] = _mm_sub_epi16 ( p [ 1 ] , p [ 2 ] ) ; u [ 3 ] = _mm_sub_epi16 ( p [ 0 ] , p [ 3 ] ) ; v [ 0 ] = _mm_unpacklo_epi16 ( u [ 0 ] , u [ 1 ] ) ; v [ 1 ] = _mm_unpackhi_epi16 ( u [ 0 ] , u [ 1 ] ) ; v [ 2 ] = _mm_unpacklo_epi16 ( u [ 2 ] , u [ 3 ] ) ; v [ 3 ] = _mm_unpackhi_epi16 ( u [ 2 ] , u [ 3 ] ) ; u [ 0 ] = _mm_madd_epi16 ( v [ 0 ] , k__cospi_p16_p16 ) ; u [ 1 ] = _mm_madd_epi16 ( v [ 1 ] , k__cospi_p16_p16 ) ; u [ 2 ] = _mm_madd_epi16 ( v [ 0 ] , k__cospi_p16_m16 ) ; u [ 3 ] = _mm_madd_epi16 ( v [ 1 ] , k__cospi_p16_m16 ) ; u [ 4 ] = _mm_madd_epi16 ( v [ 2 ] , k__cospi_p24_p08 ) ; u [ 5 ] = _mm_madd_epi16 ( v [ 3 ] , k__cospi_p24_p08 ) ; u [ 6 ] = _mm_madd_epi16 ( v [ 2 ] , k__cospi_m08_p24 ) ; u [ 7 ] = _mm_madd_epi16 ( v [ 3 ] , k__cospi_m08_p24 ) ; v [ 0 ] = _mm_add_epi32 ( u [ 0 ] , k__DCT_CONST_ROUNDING ) ; v [ 1 ] = _mm_add_epi32 ( u [ 1 ] , k__DCT_CONST_ROUNDING ) ; v [ 2 ] = _mm_add_epi32 ( u [ 2 ] , k__DCT_CONST_ROUNDING ) ; v [ 3 ] = _mm_add_epi32 ( u [ 3 ] , k__DCT_CONST_ROUNDING ) ; v [ 4 ] = _mm_add_epi32 ( u [ 4 ] , k__DCT_CONST_ROUNDING ) ; v [ 5 ] = _mm_add_epi32 ( u [ 5 ] , k__DCT_CONST_ROUNDING ) ; v [ 6 ] = _mm_add_epi32 ( u [ 6 ] , k__DCT_CONST_ROUNDING ) ; v [ 7 ] = _mm_add_epi32 ( u [ 7 ] , k__DCT_CONST_ROUNDING ) ; u [ 0 ] = _mm_srai_epi32 ( v [ 0 ] , DCT_CONST_BITS ) ; u [ 1 ] = _mm_srai_epi32 ( v [ 1 ] , DCT_CONST_BITS ) ; u [ 2 ] = _mm_srai_epi32 ( v [ 2 ] , DCT_CONST_BITS ) ; u [ 3 ] = _mm_srai_epi32 ( v [ 3 ] , DCT_CONST_BITS ) ; u [ 4 ] = _mm_srai_epi32 ( v [ 4 ] , DCT_CONST_BITS ) ; u [ 5 ] = _mm_srai_epi32 ( v [ 5 ] , DCT_CONST_BITS ) ; u [ 6 ] = _mm_srai_epi32 ( v [ 6 ] , DCT_CONST_BITS ) ; u [ 7 ] = _mm_srai_epi32 ( v [ 7 ] , DCT_CONST_BITS ) ; in [ 0 ] = _mm_packs_epi32 ( u [ 0 ] , u [ 1 ] ) ; in [ 4 ] = _mm_packs_epi32 ( u [ 4 ] , u [ 5 ] ) ; in [ 8 ] = _mm_packs_epi32 ( u [ 2 ] , u [ 3 ] ) ; in [ 12 ] = _mm_packs_epi32 ( u [ 6 ] , u [ 7 ] ) ; u [ 0 ] = _mm_unpacklo_epi16 ( p [ 5 ] , p [ 6 ] ) ; u [ 1 ] = _mm_unpackhi_epi16 ( p [ 5 ] , p [ 6 ] ) ; v [ 0 ] = _mm_madd_epi16 ( u [ 0 ] , k__cospi_m16_p16 ) ; v [ 1 ] = _mm_madd_epi16 ( u [ 1 ] , k__cospi_m16_p16 ) ; v [ 2 ] = _mm_madd_epi16 ( u [ 0 ] , k__cospi_p16_p16 ) ; v [ 3 ] = _mm_madd_epi16 ( u [ 1 ] , k__cospi_p16_p16 ) ; u [ 0 ] = _mm_add_epi32 ( v [ 0 ] , k__DCT_CONST_ROUNDING ) ; u [ 1 ] = _mm_add_epi32 ( v [ 1 ] , k__DCT_CONST_ROUNDING ) ; u [ 2 ] = _mm_add_epi32 ( v [ 2 ] , k__DCT_CONST_ROUNDING ) ; u [ 3 ] = _mm_add_epi32 ( v [ 3 ] , k__DCT_CONST_ROUNDING ) ; v [ 0 ] = _mm_srai_epi32 ( u [ 0 ] , DCT_CONST_BITS ) ; v [ 1 ] = _mm_srai_epi32 ( u [ 1 ] , DCT_CONST_BITS ) ; v [ 2 ] = _mm_srai_epi32 ( u [ 2 ] , DCT_CONST_BITS ) ; v [ 3 ] = _mm_srai_epi32 ( u [ 3 ] , DCT_CONST_BITS ) ; u [ 0 ] = _mm_packs_epi32 ( v [ 0 ] , v [ 1 ] ) ; u [ 1 ] = _mm_packs_epi32 ( v [ 2 ] , v [ 3 ] ) ; t [ 0 ] = _mm_add_epi16 ( p [ 4 ] , u [ 0 ] ) ; t [ 1 ] = _mm_sub_epi16 ( p [ 4 ] , u [ 0 ] ) ; t [ 2 ] = _mm_sub_epi16 ( p [ 7 ] , u [ 1 ] ) ; t [ 3 ] = _mm_add_epi16 ( p [ 7 ] , u [ 1 ] ) ; u [ 0 ] = _mm_unpacklo_epi16 ( t [ 0 ] , t [ 3 ] ) ; u [ 1 ] = _mm_unpackhi_epi16 ( t [ 0 ] , t [ 3 ] ) ; u [ 2 ] = _mm_unpacklo_epi16 ( t [ 1 ] , t [ 2 ] ) ; u [ 3 ] = _mm_unpackhi_epi16 ( t [ 1 ] , t [ 2 ] ) ; v [ 0 ] = _mm_madd_epi16 ( u [ 0 ] , k__cospi_p28_p04 ) ; v [ 1 ] = _mm_madd_epi16 ( u [ 1 ] , k__cospi_p28_p04 ) ; v [ 2 ] = _mm_madd_epi16 ( u [ 2 ] , k__cospi_p12_p20 ) ; v [ 3 ] = _mm_madd_epi16 ( u [ 3 ] , k__cospi_p12_p20 ) ; v [ 4 ] = _mm_madd_epi16 ( u [ 2 ] , k__cospi_m20_p12 ) ; v [ 5 ] = _mm_madd_epi16 ( u [ 3 ] , k__cospi_m20_p12 ) ; v [ 6 ] = _mm_madd_epi16 ( u [ 0 ] , k__cospi_m04_p28 ) ; v [ 7 ] = _mm_madd_epi16 ( u [ 1 ] , k__cospi_m04_p28 ) ; u [ 0 ] = _mm_add_epi32 ( v [ 0 ] , k__DCT_CONST_ROUNDING ) ; u [ 1 ] = _mm_add_epi32 ( v [ 1 ] , k__DCT_CONST_ROUNDING ) ; u [ 2 ] = _mm_add_epi32 ( v [ 2 ] , k__DCT_CONST_ROUNDING ) ; u [ 3 ] = _mm_add_epi32 ( v [ 3 ] , k__DCT_CONST_ROUNDING ) ; u [ 4 ] = _mm_add_epi32 ( v [ 4 ] , k__DCT_CONST_ROUNDING ) ; u [ 5 ] = _mm_add_epi32 ( v [ 5 ] , k__DCT_CONST_ROUNDING ) ; u [ 6 ] = _mm_add_epi32 ( v [ 6 ] , k__DCT_CONST_ROUNDING ) ; u [ 7 ] = _mm_add_epi32 ( v [ 7 ] , k__DCT_CONST_ROUNDING ) ; v [ 0 ] = _mm_srai_epi32 ( u [ 0 ] , DCT_CONST_BITS ) ; v [ 1 ] = _mm_srai_epi32 ( u [ 1 ] , DCT_CONST_BITS ) ; v [ 2 ] = _mm_srai_epi32 ( u [ 2 ] , DCT_CONST_BITS ) ; v [ 3 ] = _mm_srai_epi32 ( u [ 3 ] , DCT_CONST_BITS ) ; v [ 4 ] = _mm_srai_epi32 ( u [ 4 ] , DCT_CONST_BITS ) ; v [ 5 ] = _mm_srai_epi32 ( u [ 5 ] , DCT_CONST_BITS ) ; v [ 6 ] = _mm_srai_epi32 ( u [ 6 ] , DCT_CONST_BITS ) ; v [ 7 ] = _mm_srai_epi32 ( u [ 7 ] , DCT_CONST_BITS ) ; in [ 2 ] = _mm_packs_epi32 ( v [ 0 ] , v [ 1 ] ) ; in [ 6 ] = _mm_packs_epi32 ( v [ 4 ] , v [ 5 ] ) ; in [ 10 ] = _mm_packs_epi32 ( v [ 2 ] , v [ 3 ] ) ; in [ 14 ] = _mm_packs_epi32 ( v [ 6 ] , v [ 7 ] ) ; u [ 0 ] = _mm_unpacklo_epi16 ( s [ 2 ] , s [ 5 ] ) ; u [ 1 ] = _mm_unpackhi_epi16 ( s [ 2 ] , s [ 5 ] ) ; u [ 2 ] = _mm_unpacklo_epi16 ( s [ 3 ] , s [ 4 ] ) ; u [ 3 ] = _mm_unpackhi_epi16 ( s [ 3 ] , s [ 4 ] ) ; v [ 0 ] = _mm_madd_epi16 ( u [ 0 ] , k__cospi_m16_p16 ) ; v [ 1 ] = _mm_madd_epi16 ( u [ 1 ] , k__cospi_m16_p16 ) ; v [ 2 ] = _mm_madd_epi16 ( u [ 2 ] , k__cospi_m16_p16 ) ; v [ 3 ] = _mm_madd_epi16 ( u [ 3 ] , k__cospi_m16_p16 ) ; v [ 4 ] = _mm_madd_epi16 ( u [ 2 ] , k__cospi_p16_p16 ) ; v [ 5 ] = _mm_madd_epi16 ( u [ 3 ] , k__cospi_p16_p16 ) ; v [ 6 ] = _mm_madd_epi16 ( u [ 0 ] , k__cospi_p16_p16 ) ; v [ 7 ] = _mm_madd_epi16 ( u [ 1 ] , k__cospi_p16_p16 ) ; u [ 0 ] = _mm_add_epi32 ( v [ 0 ] , k__DCT_CONST_ROUNDING ) ; u [ 1 ] = _mm_add_epi32 ( v [ 1 ] , k__DCT_CONST_ROUNDING ) ; u [ 2 ] = _mm_add_epi32 ( v [ 2 ] , k__DCT_CONST_ROUNDING ) ; u [ 3 ] = _mm_add_epi32 ( v [ 3 ] , k__DCT_CONST_ROUNDING ) ; u [ 4 ] = _mm_add_epi32 ( v [ 4 ] , k__DCT_CONST_ROUNDING ) ; u [ 5 ] = _mm_add_epi32 ( v [ 5 ] , k__DCT_CONST_ROUNDING ) ; u [ 6 ] = _mm_add_epi32 ( v [ 6 ] , k__DCT_CONST_ROUNDING ) ; u [ 7 ] = _mm_add_epi32 ( v [ 7 ] , k__DCT_CONST_ROUNDING ) ; v [ 0 ] = _mm_srai_epi32 ( u [ 0 ] , DCT_CONST_BITS ) ; v [ 1 ] = _mm_srai_epi32 ( u [ 1 ] , DCT_CONST_BITS ) ; v [ 2 ] = _mm_srai_epi32 ( u [ 2 ] , DCT_CONST_BITS ) ; v [ 3 ] = _mm_srai_epi32 ( u [ 3 ] , DCT_CONST_BITS ) ; v [ 4 ] = _mm_srai_epi32 ( u [ 4 ] , DCT_CONST_BITS ) ; v [ 5 ] = _mm_srai_epi32 ( u [ 5 ] , DCT_CONST_BITS ) ; v [ 6 ] = _mm_srai_epi32 ( u [ 6 ] , DCT_CONST_BITS ) ; v [ 7 ] = _mm_srai_epi32 ( u [ 7 ] , DCT_CONST_BITS ) ; t [ 2 ] = _mm_packs_epi32 ( v [ 0 ] , v [ 1 ] ) ; t [ 3 ] = _mm_packs_epi32 ( v [ 2 ] , v [ 3 ] ) ; t [ 4 ] = _mm_packs_epi32 ( v [ 4 ] , v [ 5 ] ) ; t [ 5 ] = _mm_packs_epi32 ( v [ 6 ] , v [ 7 ] ) ; p [ 0 ] = _mm_add_epi16 ( s [ 0 ] , t [ 3 ] ) ; p [ 1 ] = _mm_add_epi16 ( s [ 1 ] , t [ 2 ] ) ; p [ 2 ] = _mm_sub_epi16 ( s [ 1 ] , t [ 2 ] ) ; p [ 3 ] = _mm_sub_epi16 ( s [ 0 ] , t [ 3 ] ) ; p [ 4 ] = _mm_sub_epi16 ( s [ 7 ] , t [ 4 ] ) ; p [ 5 ] = _mm_sub_epi16 ( s [ 6 ] , t [ 5 ] ) ; p [ 6 ] = _mm_add_epi16 ( s [ 6 ] , t [ 5 ] ) ; p [ 7 ] = _mm_add_epi16 ( s [ 7 ] , t [ 4 ] ) ; u [ 0 ] = _mm_unpacklo_epi16 ( p [ 1 ] , p [ 6 ] ) ; u [ 1 ] = _mm_unpackhi_epi16 ( p [ 1 ] , p [ 6 ] ) ; u [ 2 ] = _mm_unpacklo_epi16 ( p [ 2 ] , p [ 5 ] ) ; u [ 3 ] = _mm_unpackhi_epi16 ( p [ 2 ] , p [ 5 ] ) ; v [ 0 ] = _mm_madd_epi16 ( u [ 0 ] , k__cospi_m08_p24 ) ; v [ 1 ] = _mm_madd_epi16 ( u [ 1 ] , k__cospi_m08_p24 ) ; <S2SV_StartBug> v [ 2 ] = _mm_madd_epi16 ( u [ 2 ] , k__cospi_m24_m08 ) ; <S2SV_EndBug> v [ 3 ] = _mm_madd_epi16 ( u [ 3 ] , k__cospi_m24_m08 ) ; v [ 4 ] = _mm_madd_epi16 ( u [ 2 ] , k__cospi_m08_p24 ) ; v [ 5 ] = _mm_madd_epi16 ( u [ 3 ] , k__cospi_m08_p24 ) ; v [ 6 ] = _mm_madd_epi16 ( u [ 0 ] , k__cospi_p24_p08 ) ; <S2SV_StartBug> v [ 7 ] = _mm_madd_epi16 ( u [ 1 ] , k__cospi_p24_p08 ) ; <S2SV_EndBug> <S2SV_StartBug> u [ 0 ] = _mm_add_epi32 ( v [ 0 ] , k__DCT_CONST_ROUNDING ) ; <S2SV_EndBug> u [ 1 ] = _mm_add_epi32 ( v [ 1 ] , k__DCT_CONST_ROUNDING ) ; u [ 2 ] = _mm_add_epi32 ( v [ 2 ] , k__DCT_CONST_ROUNDING ) ; u [ 3 ] = _mm_add_epi32 ( v [ 3 ] , k__DCT_CONST_ROUNDING ) ; u [ 4 ] = _mm_add_epi32 ( v [ 4 ] , k__DCT_CONST_ROUNDING ) ; u [ 5 ] = _mm_add_epi32 ( v [ 5 ] , k__DCT_CONST_ROUNDING ) ; u [ 6 ] = _mm_add_epi32 ( v [ 6 ] , k__DCT_CONST_ROUNDING ) ; u [ 7 ] = _mm_add_epi32 ( v [ 7 ] , k__DCT_CONST_ROUNDING ) ; v [ 0 ] = _mm_srai_epi32 ( u [ 0 ] , DCT_CONST_BITS ) ; v [ 1 ] = _mm_srai_epi32 ( u [ 1 ] , DCT_CONST_BITS ) ; v [ 2 ] = _mm_srai_epi32 ( u [ 2 ] , DCT_CONST_BITS ) ; v [ 3 ] = _mm_srai_epi32 ( u [ 3 ] , DCT_CONST_BITS ) ; v [ 4 ] = _mm_srai_epi32 ( u [ 4 ] , DCT_CONST_BITS ) ; v [ 5 ] = _mm_srai_epi32 ( u [ 5 ] , DCT_CONST_BITS ) ; v [ 6 ] = _mm_srai_epi32 ( u [ 6 ] , DCT_CONST_BITS ) ; v [ 7 ] = _mm_srai_epi32 ( u [ 7 ] , DCT_CONST_BITS ) ; t [ 1 ] = _mm_packs_epi32 ( v [ 0 ] , v [ 1 ] ) ; t [ 2 ] = _mm_packs_epi32 ( v [ 2 ] , v [ 3 ] ) ; t [ 5 ] = _mm_packs_epi32 ( v [ 4 ] , v [ 5 ] ) ; t [ 6 ] = _mm_packs_epi32 ( v [ 6 ] , v [ 7 ] ) ; s [ 0 ] = _mm_add_epi16 ( p [ 0 ] , t [ 1 ] ) ; s [ 1 ] = _mm_sub_epi16 ( p [ 0 ] , t [ 1 ] ) ; <S2SV_StartBug> s [ 2 ] = _mm_sub_epi16 ( p [ 3 ] , t [ 2 ] ) ; <S2SV_EndBug> <S2SV_StartBug> s [ 3 ] = _mm_add_epi16 ( p [ 3 ] , t [ 2 ] ) ; <S2SV_EndBug> s [ 4 ] = _mm_add_epi16 ( p [ 4 ] , t [ 5 ] ) ; s [ 5 ] = _mm_sub_epi16 ( p [ 4 ] , t [ 5 ] ) ; s [ 6 ] = _mm_sub_epi16 ( p [ 7 ] , t [ 6 ] ) ; s [ 7 ] = _mm_add_epi16 ( p [ 7 ] , t [ 6 ] ) ; u [ 0 ] = _mm_unpacklo_epi16 ( s [ 0 ] , s [ 7 ] ) ; u [ 1 ] = _mm_unpackhi_epi16 ( s [ 0 ] , s [ 7 ] ) ; u [ 2 ] = _mm_unpacklo_epi16 ( s [ 1 ] , s [ 6 ] ) ; u [ 3 ] = _mm_unpackhi_epi16 ( s [ 1 ] , s [ 6 ] ) ; u [ 4 ] = _mm_unpacklo_epi16 ( s [ 2 ] , s [ 5 ] ) ; u [ 5 ] = _mm_unpackhi_epi16 ( s [ 2 ] , s [ 5 ] ) ; u [ 6 ] = _mm_unpacklo_epi16 ( s [ 3 ] , s [ 4 ] ) ; u [ 7 ] = _mm_unpackhi_epi16 ( s [ 3 ] , s [ 4 ] ) ; v [ 0 ] = _mm_madd_epi16 ( u [ 0 ] , k__cospi_p30_p02 ) ; v [ 1 ] = _mm_madd_epi16 ( u [ 1 ] , k__cospi_p30_p02 ) ; v [ 2 ] = _mm_madd_epi16 ( u [ 2 ] , k__cospi_p14_p18 ) ; v [ 3 ] = _mm_madd_epi16 ( u [ 3 ] , k__cospi_p14_p18 ) ; v [ 4 ] = _mm_madd_epi16 ( u [ 4 ] , k__cospi_p22_p10 ) ; v [ 5 ] = _mm_madd_epi16 ( u [ 5 ] , k__cospi_p22_p10 ) ; v [ 6 ] = _mm_madd_epi16 ( u [ 6 ] , k__cospi_p06_p26 ) ; v [ 7 ] = _mm_madd_epi16 ( u [ 7 ] , k__cospi_p06_p26 ) ; v [ 8 ] = _mm_madd_epi16 ( u [ 6 ] , k__cospi_m26_p06 ) ; v [ 9 ] = _mm_madd_epi16 ( u [ 7 ] , k__cospi_m26_p06 ) ; v [ 10 ] = _mm_madd_epi16 ( u [ 4 ] , k__cospi_m10_p22 ) ; v [ 11 ] = _mm_madd_epi16 ( u [ 5 ] , k__cospi_m10_p22 ) ; v [ 12 ] = _mm_madd_epi16 ( u [ 2 ] , k__cospi_m18_p14 ) ; v [ 13 ] = _mm_madd_epi16 ( u [ 3 ] , k__cospi_m18_p14 ) ; v [ 14 ] = _mm_madd_epi16 ( u [ 0 ] , k__cospi_m02_p30 ) ; v [ 15 ] = _mm_madd_epi16 ( u [ 1 ] , k__cospi_m02_p30 ) ; u [ 0 ] = _mm_add_epi32 ( v [ 0 ] , k__DCT_CONST_ROUNDING ) ; u [ 1 ] = _mm_add_epi32 ( v [ 1 ] , k__DCT_CONST_ROUNDING ) ; u [ 2 ] = _mm_add_epi32 ( v [ 2 ] , k__DCT_CONST_ROUNDING ) ; u [ 3 ] = _mm_add_epi32 ( v [ 3 ] , k__DCT_CONST_ROUNDING ) ; u [ 4 ] = _mm_add_epi32 ( v [ 4 ] , k__DCT_CONST_ROUNDING ) ; u [ 5 ] = _mm_add_epi32 ( v [ 5 ] , k__DCT_CONST_ROUNDING ) ; u [ 6 ] = _mm_add_epi32 ( v [ 6 ] , k__DCT_CONST_ROUNDING ) ; u [ 7 ] = _mm_add_epi32 ( v [ 7 ] , k__DCT_CONST_ROUNDING ) ; u [ 8 ] = _mm_add_epi32 ( v [ 8 ] , k__DCT_CONST_ROUNDING ) ; u [ 9 ] = _mm_add_epi32 ( v [ 9 ] , k__DCT_CONST_ROUNDING ) ; u [ 10 ] = _mm_add_epi32 ( v [ 10 ] , k__DCT_CONST_ROUNDING ) ; u [ 11 ] = _mm_add_epi32 ( v [ 11 ] , k__DCT_CONST_ROUNDING ) ; u [ 12 ] = _mm_add_epi32 ( v [ 12 ] , k__DCT_CONST_ROUNDING ) ; u [ 13 ] = _mm_add_epi32 ( v [ 13 ] , k__DCT_CONST_ROUNDING ) ; u [ 14 ] = _mm_add_epi32 ( v [ 14 ] , k__DCT_CONST_ROUNDING ) ; u [ 15 ] = _mm_add_epi32 ( v [ 15 ] , k__DCT_CONST_ROUNDING ) ; v [ 0 ] = _mm_srai_epi32 ( u [ 0 ] , DCT_CONST_BITS ) ; v [ 1 ] = _mm_srai_epi32 ( u [ 1 ] , DCT_CONST_BITS ) ; v [ 2 ] = _mm_srai_epi32 ( u [ 2 ] , DCT_CONST_BITS ) ; v [ 3 ] = _mm_srai_epi32 ( u [ 3 ] , DCT_CONST_BITS ) ; v [ 4 ] = _mm_srai_epi32 ( u [ 4 ] , DCT_CONST_BITS ) ; v [ 5 ] = _mm_srai_epi32 ( u [ 5 ] , DCT_CONST_BITS ) ; v [ 6 ] = _mm_srai_epi32 ( u [ 6 ] , DCT_CONST_BITS ) ; v [ 7 ] = _mm_srai_epi32 ( u [ 7 ] , DCT_CONST_BITS ) ; v [ 8 ] = _mm_srai_epi32 ( u [ 8 ] , DCT_CONST_BITS ) ; v [ 9 ] = _mm_srai_epi32 ( u [ 9 ] , DCT_CONST_BITS ) ; v [ 10 ] = _mm_srai_epi32 ( u [ 10 ] , DCT_CONST_BITS ) ; v [ 11 ] = _mm_srai_epi32 ( u [ 11 ] , DCT_CONST_BITS ) ; v [ 12 ] = _mm_srai_epi32 ( u [ 12 ] , DCT_CONST_BITS ) ; v [ 13 ] = _mm_srai_epi32 ( u [ 13 ] , DCT_CONST_BITS ) ; v [ 14 ] = _mm_srai_epi32 ( u [ 14 ] , DCT_CONST_BITS ) ; v [ 15 ] = _mm_srai_epi32 ( u [ 15 ] , DCT_CONST_BITS ) ; in [ 1 ] = _mm_packs_epi32 ( v [ 0 ] , v [ 1 ] ) ; in [ 9 ] = _mm_packs_epi32 ( v [ 2 ] , v [ 3 ] ) ; in [ 5 ] = _mm_packs_epi32 ( v [ 4 ] , v [ 5 ] ) ; in [ 13 ] = _mm_packs_epi32 ( v [ 6 ] , v [ 7 ] ) ; in [ 3 ] = _mm_packs_epi32 ( v [ 8 ] , v [ 9 ] ) ; in [ 11 ] = _mm_packs_epi32 ( v [ 10 ] , v [ 11 ] ) ; in [ 7 ] = _mm_packs_epi32 ( v [ 12 ] , v [ 13 ] ) ; in [ 15 ] = _mm_packs_epi32 ( v [ 14 ] , v [ 15 ] ) ; }
| <S2SV_ModStart> <S2SV_null> <S2SV_null> <S2SV_null> static <S2SV_ModStart> = _mm_set1_epi16 ( ( int16_t ) <S2SV_ModStart> ; const __m128i k__cospi_p08_m24 <S2SV_ModEnd> = pair_set_epi16 ( <S2SV_ModStart> = pair_set_epi16 ( cospi_8_64 , - cospi_24_64 <S2SV_ModEnd> ) ; const <S2SV_ModStart> 2 ] , <S2SV_ModEnd> k__cospi_p24_p08 ) ; <S2SV_ModStart> ; v [ 3 ] = _mm_madd_epi16 ( u [ 3 <S2SV_ModEnd> ] , k__cospi_p24_p08 <S2SV_ModStart> k__cospi_p24_p08 ) ; v [ 4 ] = _mm_madd_epi16 ( u [ 2 ] , k__cospi_p08_m24 ) ; v [ 5 ] = _mm_madd_epi16 ( u [ 3 ] , k__cospi_p08_m24 ) ; v [ 6 ] = _mm_madd_epi16 ( u [ 0 ] , k__cospi_p24_p08 ) ; v [ 7 ] = _mm_madd_epi16 ( u [ 1 ] , k__cospi_p24_p08 ) ; <S2SV_ModStart> 2 ] = _mm_add_epi16 ( p [ 3 ] , t [ 2 ] ) ; s [ 3 ] = <S2SV_ModStart> ; s [ 4 ] = _mm_sub_epi16 ( p [ 4 ] , t [ 5 ] ) ; s [ 5 <S2SV_ModEnd> ] = _mm_add_epi16 <S2SV_ModStart> ] = _mm_add_epi16 <S2SV_ModEnd> ( p [
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
283 | CWE-189 | CWE-189 static int do_check ( struct bpf_verifier_env * env ) { struct bpf_verifier_state * state ; struct bpf_insn * insns = env -> prog -> insnsi ; struct bpf_reg_state * regs ; int insn_cnt = env -> prog -> len , i ; int insn_processed = 0 ; bool do_print_state = false ; env -> prev_linfo = NULL ; state = kzalloc ( sizeof ( struct bpf_verifier_state ) , GFP_KERNEL ) ; if ( ! state ) return - ENOMEM ; state -> curframe = 0 ; <S2SV_StartBug> state -> frame [ 0 ] = kzalloc ( sizeof ( struct bpf_func_state ) , GFP_KERNEL ) ; <S2SV_EndBug> if ( ! state -> frame [ 0 ] ) { kfree ( state ) ; return - ENOMEM ; } env -> cur_state = state ; init_func_state ( env , state -> frame [ 0 ] , BPF_MAIN_FUNC , 0 , 0 ) ; for ( ; ; ) { struct bpf_insn * insn ; u8 class ; int err ; if ( env -> insn_idx >= insn_cnt ) { verbose ( env , "invalid<S2SV_blank>insn<S2SV_blank>idx<S2SV_blank>%d<S2SV_blank>insn_cnt<S2SV_blank>%d\\n" , env -> insn_idx , insn_cnt ) ; return - EFAULT ; } insn = & insns [ env -> insn_idx ] ; class = BPF_CLASS ( insn -> code ) ; if ( ++ insn_processed > BPF_COMPLEXITY_LIMIT_INSNS ) { verbose ( env , "BPF<S2SV_blank>program<S2SV_blank>is<S2SV_blank>too<S2SV_blank>large.<S2SV_blank>Processed<S2SV_blank>%d<S2SV_blank>insn\\n" , insn_processed ) ; return - E2BIG ; } err = is_state_visited ( env , env -> insn_idx ) ; if ( err < 0 ) return err ; if ( err == 1 ) { if ( env -> log . level ) { if ( do_print_state ) <S2SV_StartBug> verbose ( env , "\\nfrom<S2SV_blank>%d<S2SV_blank>to<S2SV_blank>%d:<S2SV_blank>safe\\n" , <S2SV_EndBug> <S2SV_StartBug> env -> prev_insn_idx , env -> insn_idx ) ; <S2SV_EndBug> else verbose ( env , "%d:<S2SV_blank>safe\\n" , env -> insn_idx ) ; } goto process_bpf_exit ; } if ( signal_pending ( current ) ) return - EAGAIN ; if ( need_resched ( ) ) cond_resched ( ) ; if ( env -> log . level > 1 || ( env -> log . level && do_print_state ) ) { if ( env -> log . level > 1 ) verbose ( env , "%d:" , env -> insn_idx ) ; else <S2SV_StartBug> verbose ( env , "\\nfrom<S2SV_blank>%d<S2SV_blank>to<S2SV_blank>%d:" , <S2SV_EndBug> <S2SV_StartBug> env -> prev_insn_idx , env -> insn_idx ) ; <S2SV_EndBug> print_verifier_state ( env , state -> frame [ state -> curframe ] ) ; do_print_state = false ; } if ( env -> log . level ) { const struct bpf_insn_cbs cbs = { . cb_print = verbose , . private_data = env , } ; verbose_linfo ( env , env -> insn_idx , ";<S2SV_blank>" ) ; verbose ( env , "%d:<S2SV_blank>" , env -> insn_idx ) ; print_bpf_insn ( & cbs , insn , env -> allow_ptr_leaks ) ; } if ( bpf_prog_is_dev_bound ( env -> prog -> aux ) ) { err = bpf_prog_offload_verify_insn ( env , env -> insn_idx , env -> prev_insn_idx ) ; if ( err ) return err ; } regs = cur_regs ( env ) ; env -> insn_aux_data [ env -> insn_idx ] . seen = true ; if ( class == BPF_ALU || class == BPF_ALU64 ) { err = check_alu_op ( env , insn ) ; if ( err ) return err ; } else if ( class == BPF_LDX ) { enum bpf_reg_type * prev_src_type , src_reg_type ; err = check_reg_arg ( env , insn -> src_reg , SRC_OP ) ; if ( err ) return err ; err = check_reg_arg ( env , insn -> dst_reg , DST_OP_NO_MARK ) ; if ( err ) return err ; src_reg_type = regs [ insn -> src_reg ] . type ; err = check_mem_access ( env , env -> insn_idx , insn -> src_reg , insn -> off , BPF_SIZE ( insn -> code ) , BPF_READ , insn -> dst_reg , false ) ; if ( err ) return err ; prev_src_type = & env -> insn_aux_data [ env -> insn_idx ] . ptr_type ; if ( * prev_src_type == NOT_INIT ) { * prev_src_type = src_reg_type ; } else if ( reg_type_mismatch ( src_reg_type , * prev_src_type ) ) { verbose ( env , "same<S2SV_blank>insn<S2SV_blank>cannot<S2SV_blank>be<S2SV_blank>used<S2SV_blank>with<S2SV_blank>different<S2SV_blank>pointers\\n" ) ; return - EINVAL ; } } else if ( class == BPF_STX ) { enum bpf_reg_type * prev_dst_type , dst_reg_type ; if ( BPF_MODE ( insn -> code ) == BPF_XADD ) { err = check_xadd ( env , env -> insn_idx , insn ) ; if ( err ) return err ; env -> insn_idx ++ ; continue ; } err = check_reg_arg ( env , insn -> src_reg , SRC_OP ) ; if ( err ) return err ; err = check_reg_arg ( env , insn -> dst_reg , SRC_OP ) ; if ( err ) return err ; dst_reg_type = regs [ insn -> dst_reg ] . type ; err = check_mem_access ( env , env -> insn_idx , insn -> dst_reg , insn -> off , BPF_SIZE ( insn -> code ) , BPF_WRITE , insn -> src_reg , false ) ; if ( err ) return err ; prev_dst_type = & env -> insn_aux_data [ env -> insn_idx ] . ptr_type ; if ( * prev_dst_type == NOT_INIT ) { * prev_dst_type = dst_reg_type ; } else if ( reg_type_mismatch ( dst_reg_type , * prev_dst_type ) ) { verbose ( env , "same<S2SV_blank>insn<S2SV_blank>cannot<S2SV_blank>be<S2SV_blank>used<S2SV_blank>with<S2SV_blank>different<S2SV_blank>pointers\\n" ) ; return - EINVAL ; } } else if ( class == BPF_ST ) { if ( BPF_MODE ( insn -> code ) != BPF_MEM || insn -> src_reg != BPF_REG_0 ) { verbose ( env , "BPF_ST<S2SV_blank>uses<S2SV_blank>reserved<S2SV_blank>fields\\n" ) ; return - EINVAL ; } err = check_reg_arg ( env , insn -> dst_reg , SRC_OP ) ; if ( err ) return err ; if ( is_ctx_reg ( env , insn -> dst_reg ) ) { verbose ( env , "BPF_ST<S2SV_blank>stores<S2SV_blank>into<S2SV_blank>R%d<S2SV_blank>%s<S2SV_blank>is<S2SV_blank>not<S2SV_blank>allowed\\n" , insn -> dst_reg , reg_type_str [ reg_state ( env , insn -> dst_reg ) -> type ] ) ; return - EACCES ; } err = check_mem_access ( env , env -> insn_idx , insn -> dst_reg , insn -> off , BPF_SIZE ( insn -> code ) , BPF_WRITE , - 1 , false ) ; if ( err ) return err ; } else if ( class == BPF_JMP ) { u8 opcode = BPF_OP ( insn -> code ) ; if ( opcode == BPF_CALL ) { if ( BPF_SRC ( insn -> code ) != BPF_K || insn -> off != 0 || ( insn -> src_reg != BPF_REG_0 && insn -> src_reg != BPF_PSEUDO_CALL ) || insn -> dst_reg != BPF_REG_0 ) { verbose ( env , "BPF_CALL<S2SV_blank>uses<S2SV_blank>reserved<S2SV_blank>fields\\n" ) ; return - EINVAL ; } if ( insn -> src_reg == BPF_PSEUDO_CALL ) err = check_func_call ( env , insn , & env -> insn_idx ) ; else err = check_helper_call ( env , insn -> imm , env -> insn_idx ) ; if ( err ) return err ; } else if ( opcode == BPF_JA ) { if ( BPF_SRC ( insn -> code ) != BPF_K || insn -> imm != 0 || insn -> src_reg != BPF_REG_0 || insn -> dst_reg != BPF_REG_0 ) { verbose ( env , "BPF_JA<S2SV_blank>uses<S2SV_blank>reserved<S2SV_blank>fields\\n" ) ; return - EINVAL ; } env -> insn_idx += insn -> off + 1 ; continue ; } else if ( opcode == BPF_EXIT ) { if ( BPF_SRC ( insn -> code ) != BPF_K || insn -> imm != 0 || insn -> src_reg != BPF_REG_0 || insn -> dst_reg != BPF_REG_0 ) { verbose ( env , "BPF_EXIT<S2SV_blank>uses<S2SV_blank>reserved<S2SV_blank>fields\\n" ) ; return - EINVAL ; } if ( state -> curframe ) { env -> prev_insn_idx = env -> insn_idx ; err = prepare_func_exit ( env , & env -> insn_idx ) ; if ( err ) return err ; do_print_state = true ; continue ; } err = check_reference_leak ( env ) ; if ( err ) return err ; err = check_reg_arg ( env , BPF_REG_0 , SRC_OP ) ; if ( err ) return err ; if ( is_pointer_value ( env , BPF_REG_0 ) ) { verbose ( env , "R0<S2SV_blank>leaks<S2SV_blank>addr<S2SV_blank>as<S2SV_blank>return<S2SV_blank>value\\n" ) ; return - EACCES ; } err = check_return_code ( env ) ; if ( err ) return err ; process_bpf_exit : err = pop_stack ( env , & env -> prev_insn_idx , & env -> insn_idx ) ; if ( err < 0 ) { if ( err != - ENOENT ) return err ; break ; } else { do_print_state = true ; continue ; } } else { err = check_cond_jmp_op ( env , insn , & env -> insn_idx ) ; if ( err ) return err ; } } else if ( class == BPF_LD ) { u8 mode = BPF_MODE ( insn -> code ) ; if ( mode == BPF_ABS || mode == BPF_IND ) { err = check_ld_abs ( env , insn ) ; if ( err ) return err ; } else if ( mode == BPF_IMM ) { err = check_ld_imm ( env , insn ) ; if ( err ) return err ; env -> insn_idx ++ ; env -> insn_aux_data [ env -> insn_idx ] . seen = true ; } else { verbose ( env , "invalid<S2SV_blank>BPF_LD<S2SV_blank>mode\\n" ) ; return - EINVAL ; } } else { verbose ( env , "unknown<S2SV_blank>insn<S2SV_blank>class<S2SV_blank>%d\\n" , class ) ; return - EINVAL ; } env -> insn_idx ++ ; } verbose ( env , "processed<S2SV_blank>%d<S2SV_blank>insns<S2SV_blank>(limit<S2SV_blank>%d),<S2SV_blank>stack<S2SV_blank>depth<S2SV_blank>" , insn_processed , BPF_COMPLEXITY_LIMIT_INSNS ) ; for ( i = 0 ; i < env -> subprog_cnt ; i ++ ) { u32 depth = env -> subprog_info [ i ] . stack_depth ; verbose ( env , "%d" , depth ) ; if ( i + 1 < env -> subprog_cnt ) verbose ( env , "+" ) ; } verbose ( env , "\\n" ) ; env -> prog -> aux -> stack_depth = env -> subprog_info [ 0 ] . stack_depth ; return 0 ; }
| <S2SV_ModStart> ; state -> speculative = false ; state -> <S2SV_ModStart> ( env , "\\nfrom<S2SV_blank>%d<S2SV_blank>to<S2SV_blank>%d%s:<S2SV_blank>safe\\n" <S2SV_ModEnd> , env -> <S2SV_ModStart> env -> insn_idx , env -> cur_state -> speculative ? "<S2SV_blank>(speculative<S2SV_blank>execution)" : "" <S2SV_ModStart> ( env , "\\nfrom<S2SV_blank>%d<S2SV_blank>to<S2SV_blank>%d%s:" <S2SV_ModEnd> , env -> <S2SV_ModStart> env -> insn_idx , env -> cur_state -> speculative ? "<S2SV_blank>(speculative<S2SV_blank>execution)" : ""
| torvalds@linux/979d63d50c0c0f7bc537bf821e056cc9fe5abd38 | CVE-2019-7308 | https://github.com/torvalds/linux/commit/979d63d50c0c0f7bc537bf821e056cc9fe5abd38 | 2019-02-01T22:29Z |
284 | CWE-611 | CWE-611 void xmlParsePEReference ( xmlParserCtxtPtr ctxt ) { const xmlChar * name ; xmlEntityPtr entity = NULL ; xmlParserInputPtr input ; if ( RAW != '%' ) return ; NEXT ; name = xmlParseName ( ctxt ) ; if ( name == NULL ) { xmlFatalErrMsg ( ctxt , XML_ERR_NAME_REQUIRED , "xmlParsePEReference:<S2SV_blank>no<S2SV_blank>name\\n" ) ; return ; } if ( RAW != ';' ) { xmlFatalErr ( ctxt , XML_ERR_ENTITYREF_SEMICOL_MISSING , NULL ) ; return ; } NEXT ; ctxt -> nbentities ++ ; if ( ( ctxt -> sax != NULL ) && ( ctxt -> sax -> getParameterEntity != NULL ) ) entity = ctxt -> sax -> getParameterEntity ( ctxt -> userData , name ) ; if ( ctxt -> instate == XML_PARSER_EOF ) return ; if ( entity == NULL ) { if ( ( ctxt -> standalone == 1 ) || ( ( ctxt -> hasExternalSubset == 0 ) && ( ctxt -> hasPErefs == 0 ) ) ) { xmlFatalErrMsgStr ( ctxt , XML_ERR_UNDECLARED_ENTITY , "PEReference:<S2SV_blank>%%%s;<S2SV_blank>not<S2SV_blank>found\\n" , name ) ; } else { xmlWarningMsg ( ctxt , XML_WAR_UNDECLARED_ENTITY , "PEReference:<S2SV_blank>%%%s;<S2SV_blank>not<S2SV_blank>found\\n" , name , NULL ) ; ctxt -> valid = 0 ; } xmlParserEntityCheck ( ctxt , 0 , NULL , 0 ) ; } else { if ( ( entity -> etype != XML_INTERNAL_PARAMETER_ENTITY ) && ( entity -> etype != XML_EXTERNAL_PARAMETER_ENTITY ) ) { xmlWarningMsg ( ctxt , XML_WAR_UNDECLARED_ENTITY , "Internal:<S2SV_blank>%%%s;<S2SV_blank>is<S2SV_blank>not<S2SV_blank>a<S2SV_blank>parameter<S2SV_blank>entity\\n" , name , NULL ) ; } else if ( ctxt -> input -> free != deallocblankswrapper ) { input = xmlNewBlanksWrapperInputStream ( ctxt , entity ) ; if ( xmlPushInput ( ctxt , input ) < 0 ) return ; } else { <S2SV_StartBug> input = xmlNewEntityInputStream ( ctxt , entity ) ; <S2SV_EndBug> if ( xmlPushInput ( ctxt , input ) < 0 ) return ; if ( ( entity -> etype == XML_EXTERNAL_PARAMETER_ENTITY ) && ( CMP5 ( CUR_PTR , '<' , '?' , 'x' , 'm' , 'l' ) ) && ( IS_BLANK_CH ( NXT ( 5 ) ) ) ) { xmlParseTextDecl ( ctxt ) ; if ( ctxt -> errNo == XML_ERR_UNSUPPORTED_ENCODING ) { xmlHaltParser ( ctxt ) ; return ; } } } } ctxt -> hasPErefs = 1 ; }
| <S2SV_ModStart> } else { if ( ( entity -> etype == XML_EXTERNAL_PARAMETER_ENTITY ) && ( ( ctxt -> options & XML_PARSE_NOENT ) == 0 ) && ( ( ctxt -> options & XML_PARSE_DTDVALID ) == 0 ) && ( ( ctxt -> options & XML_PARSE_DTDLOAD ) == 0 ) && ( ( ctxt -> options & XML_PARSE_DTDATTR ) == 0 ) && ( ctxt -> replaceEntities == 0 ) && ( ctxt -> validate == 0 ) ) return ;
| external@libxml2/308396a55280f69ad4112d4f9892f4cbeff042aa | CVE-2017-7375 | https://android.googlesource.com/platform/external/libxml2/+/308396a55280f69ad4112d4f9892f4cbeff042aa | 2018-02-19T19:29Z |
285 | CWE-119 | CWE-119 <S2SV_StartBug> static void dist_block ( int plane , int block , TX_SIZE tx_size , <S2SV_EndBug> <S2SV_StartBug> struct rdcost_block_args * args ) { <S2SV_EndBug> <S2SV_StartBug> const int ss_txfrm_size = tx_size << 1 ; <S2SV_EndBug> MACROBLOCK * const x = args -> x ; MACROBLOCKD * const xd = & x -> e_mbd ; const struct macroblock_plane * const p = & x -> plane [ plane ] ; const struct macroblockd_plane * const pd = & xd -> plane [ plane ] ; int64_t this_sse ; int shift = tx_size == TX_32X32 ? 0 : 2 ; <S2SV_StartBug> int16_t * const coeff = BLOCK_OFFSET ( p -> coeff , block ) ; <S2SV_EndBug> <S2SV_StartBug> int16_t * const dqcoeff = BLOCK_OFFSET ( pd -> dqcoeff , block ) ; <S2SV_EndBug> <S2SV_StartBug> args -> dist = vp9_block_error ( coeff , dqcoeff , 16 << ss_txfrm_size , <S2SV_EndBug> <S2SV_StartBug> & this_sse ) >> shift ; <S2SV_EndBug> args -> sse = this_sse >> shift ; if ( x -> skip_encode && ! is_inter_block ( & xd -> mi [ 0 ] -> mbmi ) ) { int64_t p = ( pd -> dequant [ 1 ] * pd -> dequant [ 1 ] * <S2SV_StartBug> ( 1 << ss_txfrm_size ) ) >> ( shift + 2 ) ; <S2SV_EndBug> args -> dist += ( p >> 4 ) ; <S2SV_StartBug> args -> sse += p ; <S2SV_EndBug> } }
| <S2SV_ModStart> void dist_block ( MACROBLOCK * x , <S2SV_ModStart> TX_SIZE tx_size , int64_t * out_dist , int64_t * out_sse <S2SV_ModEnd> ) { const <S2SV_ModStart> tx_size << 1 <S2SV_ModEnd> ; MACROBLOCKD * <S2SV_ModStart> : 2 ; tran_low_t <S2SV_ModEnd> * const coeff <S2SV_ModStart> block ) ; tran_low_t <S2SV_ModEnd> * const dqcoeff <S2SV_ModStart> block ) ; # if CONFIG_VP9_HIGHBITDEPTH const int bd = ( xd -> cur_buf -> flags & YV12_FLAG_HIGHBITDEPTH ) ? xd -> bd : 8 ; * out_dist = vp9_highbd_block_error <S2SV_ModEnd> ( coeff , <S2SV_ModStart> , & this_sse , bd ) >> shift ; # else * out_dist = vp9_block_error ( coeff , dqcoeff , 16 << ss_txfrm_size , & this_sse ) >> shift ; # endif * out_sse <S2SV_ModEnd> = this_sse >> <S2SV_ModStart> ) ) >> # if CONFIG_VP9_HIGHBITDEPTH <S2SV_ModStart> shift + 2 + ( bd - 8 ) * 2 ) ; # else ( shift + 2 ) ; # endif * out_dist <S2SV_ModEnd> += ( p <S2SV_ModStart> 4 ) ; * out_sse <S2SV_ModEnd> += p ;
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
286 | CWE-835 | CWE-835 static int read_part_of_packet ( AVFormatContext * s , int64_t * pts , int * len , int * strid , int read_packet ) { AVIOContext * pb = s -> pb ; PVAContext * pvactx = s -> priv_data ; int syncword , streamid , reserved , flags , length , pts_flag ; int64_t pva_pts = AV_NOPTS_VALUE , startpos ; int ret ; recover : startpos = avio_tell ( pb ) ; syncword = avio_rb16 ( pb ) ; streamid = avio_r8 ( pb ) ; avio_r8 ( pb ) ; reserved = avio_r8 ( pb ) ; flags = avio_r8 ( pb ) ; length = avio_rb16 ( pb ) ; pts_flag = flags & 0x10 ; if ( syncword != PVA_MAGIC ) { pva_log ( s , AV_LOG_ERROR , "invalid<S2SV_blank>syncword\\n" ) ; return AVERROR ( EIO ) ; } if ( streamid != PVA_VIDEO_PAYLOAD && streamid != PVA_AUDIO_PAYLOAD ) { pva_log ( s , AV_LOG_ERROR , "invalid<S2SV_blank>streamid\\n" ) ; return AVERROR ( EIO ) ; } if ( reserved != 0x55 ) { pva_log ( s , AV_LOG_WARNING , "expected<S2SV_blank>reserved<S2SV_blank>byte<S2SV_blank>to<S2SV_blank>be<S2SV_blank>0x55\\n" ) ; } if ( length > PVA_MAX_PAYLOAD_LENGTH ) { pva_log ( s , AV_LOG_ERROR , "invalid<S2SV_blank>payload<S2SV_blank>length<S2SV_blank>%u\\n" , length ) ; return AVERROR ( EIO ) ; } if ( streamid == PVA_VIDEO_PAYLOAD && pts_flag ) { pva_pts = avio_rb32 ( pb ) ; length -= 4 ; } else if ( streamid == PVA_AUDIO_PAYLOAD ) { if ( ! pvactx -> continue_pes ) { int pes_signal , pes_header_data_length , pes_packet_length , pes_flags ; unsigned char pes_header_data [ 256 ] ; pes_signal = avio_rb24 ( pb ) ; avio_r8 ( pb ) ; pes_packet_length = avio_rb16 ( pb ) ; pes_flags = avio_rb16 ( pb ) ; pes_header_data_length = avio_r8 ( pb ) ; <S2SV_StartBug> if ( pes_signal != 1 || pes_header_data_length == 0 ) { <S2SV_EndBug> pva_log ( s , AV_LOG_WARNING , "expected<S2SV_blank>non<S2SV_blank>empty<S2SV_blank>signaled<S2SV_blank>PES<S2SV_blank>packet,<S2SV_blank>" "trying<S2SV_blank>to<S2SV_blank>recover\\n" ) ; avio_skip ( pb , length - 9 ) ; if ( ! read_packet ) return AVERROR ( EIO ) ; goto recover ; } ret = avio_read ( pb , pes_header_data , pes_header_data_length ) ; if ( ret != pes_header_data_length ) return ret < 0 ? ret : AVERROR_INVALIDDATA ; length -= 9 + pes_header_data_length ; pes_packet_length -= 3 + pes_header_data_length ; pvactx -> continue_pes = pes_packet_length ; if ( pes_flags & 0x80 && ( pes_header_data [ 0 ] & 0xf0 ) == 0x20 ) { if ( pes_header_data_length < 5 ) { pva_log ( s , AV_LOG_ERROR , "header<S2SV_blank>too<S2SV_blank>short\\n" ) ; avio_skip ( pb , length ) ; return AVERROR_INVALIDDATA ; } pva_pts = ff_parse_pes_pts ( pes_header_data ) ; } } pvactx -> continue_pes -= length ; if ( pvactx -> continue_pes < 0 ) { pva_log ( s , AV_LOG_WARNING , "audio<S2SV_blank>data<S2SV_blank>corruption\\n" ) ; pvactx -> continue_pes = 0 ; } } if ( pva_pts != AV_NOPTS_VALUE ) av_add_index_entry ( s -> streams [ streamid - 1 ] , startpos , pva_pts , 0 , 0 , AVINDEX_KEYFRAME ) ; * pts = pva_pts ; * len = length ; * strid = streamid ; return 0 ; }
| <S2SV_ModStart> ; if ( avio_feof ( pb ) ) { return AVERROR_EOF ; } if (
| FFmpeg@FFmpeg/9807d3976be0e92e4ece3b4b1701be894cd7c2e1 | CVE-2018-1999012 | https://github.com/FFmpeg/FFmpeg/commit/9807d3976be0e92e4ece3b4b1701be894cd7c2e1 | 2018-07-23T15:29Z |
287 | CWE-20 | CWE-20 int oidc_handle_redirect_uri_request ( request_rec * r , oidc_cfg * c , oidc_session_t * session ) { if ( oidc_proto_is_redirect_authorization_response ( r , c ) ) { return oidc_handle_redirect_authorization_response ( r , c , session ) ; } else if ( oidc_proto_is_post_authorization_response ( r , c ) ) { return oidc_handle_post_authorization_response ( r , c , session ) ; } else if ( oidc_is_discovery_response ( r , c ) ) { return oidc_handle_discovery_response ( r , c ) ; } else if ( oidc_util_request_has_parameter ( r , "logout" ) ) { return oidc_handle_logout ( r , c , session ) ; } else if ( oidc_util_request_has_parameter ( r , "jwks" ) ) { return oidc_handle_jwks ( r , c ) ; } else if ( oidc_util_request_has_parameter ( r , "session" ) ) { return oidc_handle_session_management ( r , c , session ) ; } else if ( oidc_util_request_has_parameter ( r , "refresh" ) ) { return oidc_handle_refresh_token_request ( r , c , session ) ; } else if ( oidc_util_request_has_parameter ( r , "request_uri" ) ) { return oidc_handle_request_uri ( r , c ) ; } else if ( oidc_util_request_has_parameter ( r , "remove_at_cache" ) ) { return oidc_handle_remove_at_cache ( r , c ) ; } else if ( ( r -> args == NULL ) || ( apr_strnatcmp ( r -> args , "" ) == 0 ) ) { return oidc_proto_javascript_implicit ( r , c ) ; } if ( oidc_util_request_has_parameter ( r , "error" ) ) { oidc_handle_redirect_authorization_response ( r , c , session ) ; } return oidc_util_html_send_error ( r , c -> error_template , "Invalid<S2SV_blank>Request" , apr_psprintf ( r -> pool , <S2SV_StartBug> "The<S2SV_blank>OpenID<S2SV_blank>Connect<S2SV_blank>callback<S2SV_blank>URL<S2SV_blank>received<S2SV_blank>an<S2SV_blank>invalid<S2SV_blank>request:<S2SV_blank>%s" , <S2SV_EndBug> r -> args ) , HTTP_INTERNAL_SERVER_ERROR ) ; }
| <S2SV_ModStart> -> pool , "The<S2SV_blank>OpenID<S2SV_blank>Connect<S2SV_blank>callback<S2SV_blank>URL<S2SV_blank>received<S2SV_blank>an<S2SV_blank>invalid<S2SV_blank>request" ) , <S2SV_ModEnd> HTTP_INTERNAL_SERVER_ERROR ) ;
| pingidentity@mod_auth_openidc/612e309bfffd6f9b8ad7cdccda3019fc0865f3b4 | CVE-2017-6059 | https://github.com/pingidentity/mod_auth_openidc/commit/612e309bfffd6f9b8ad7cdccda3019fc0865f3b4 | 2017-04-12T20:59Z |
288 | CWE-119 | CWE-119 WORD32 ih264d_video_decode ( iv_obj_t * dec_hdl , void * pv_api_ip , void * pv_api_op ) { dec_struct_t * ps_dec = ( dec_struct_t * ) ( dec_hdl -> pv_codec_handle ) ; WORD32 i4_err_status = 0 ; UWORD8 * pu1_buf = NULL ; WORD32 buflen ; UWORD32 u4_max_ofst , u4_length_of_start_code = 0 ; UWORD32 bytes_consumed = 0 ; UWORD32 cur_slice_is_nonref = 0 ; UWORD32 u4_next_is_aud ; UWORD32 u4_first_start_code_found = 0 ; WORD32 ret = 0 , api_ret_value = IV_SUCCESS ; WORD32 header_data_left = 0 , frame_data_left = 0 ; UWORD8 * pu1_bitstrm_buf ; ivd_video_decode_ip_t * ps_dec_ip ; ivd_video_decode_op_t * ps_dec_op ; ithread_set_name ( ( void * ) "Parse_thread" ) ; ps_dec_ip = ( ivd_video_decode_ip_t * ) pv_api_ip ; ps_dec_op = ( ivd_video_decode_op_t * ) pv_api_op ; { UWORD32 u4_size ; u4_size = ps_dec_op -> u4_size ; memset ( ps_dec_op , 0 , sizeof ( ivd_video_decode_op_t ) ) ; ps_dec_op -> u4_size = u4_size ; } ps_dec -> pv_dec_out = ps_dec_op ; if ( ps_dec -> init_done != 1 ) { return IV_FAIL ; } DATA_SYNC ( ) ; if ( 0 == ps_dec -> u1_flushfrm ) { if ( ps_dec_ip -> pv_stream_buffer == NULL ) { ps_dec_op -> u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM ; ps_dec_op -> u4_error_code |= IVD_DEC_FRM_BS_BUF_NULL ; return IV_FAIL ; } if ( ps_dec_ip -> u4_num_Bytes <= 0 ) { ps_dec_op -> u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM ; ps_dec_op -> u4_error_code |= IVD_DEC_NUMBYTES_INV ; return IV_FAIL ; } } ps_dec -> u1_pic_decode_done = 0 ; ps_dec_op -> u4_num_bytes_consumed = 0 ; ps_dec -> ps_out_buffer = NULL ; if ( ps_dec_ip -> u4_size >= offsetof ( ivd_video_decode_ip_t , s_out_buffer ) ) ps_dec -> ps_out_buffer = & ps_dec_ip -> s_out_buffer ; ps_dec -> u4_fmt_conv_cur_row = 0 ; ps_dec -> u4_output_present = 0 ; ps_dec -> s_disp_op . u4_error_code = 1 ; ps_dec -> u4_fmt_conv_num_rows = FMT_CONV_NUM_ROWS ; if ( 0 == ps_dec -> u4_share_disp_buf && ps_dec -> i4_decode_header == 0 ) { UWORD32 i ; if ( ps_dec -> ps_out_buffer -> u4_num_bufs == 0 ) { ps_dec_op -> u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM ; ps_dec_op -> u4_error_code |= IVD_DISP_FRM_ZERO_OP_BUFS ; return IV_FAIL ; } for ( i = 0 ; i < ps_dec -> ps_out_buffer -> u4_num_bufs ; i ++ ) { if ( ps_dec -> ps_out_buffer -> pu1_bufs [ i ] == NULL ) { ps_dec_op -> u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM ; ps_dec_op -> u4_error_code |= IVD_DISP_FRM_OP_BUF_NULL ; return IV_FAIL ; } if ( ps_dec -> ps_out_buffer -> u4_min_out_buf_size [ i ] == 0 ) { ps_dec_op -> u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM ; ps_dec_op -> u4_error_code |= IVD_DISP_FRM_ZERO_OP_BUF_SIZE ; return IV_FAIL ; } } } if ( ps_dec -> u4_total_frames_decoded >= NUM_FRAMES_LIMIT ) { ps_dec_op -> u4_error_code = ERROR_FRAME_LIMIT_OVER ; return IV_FAIL ; } ps_dec -> u4_ts = ps_dec_ip -> u4_ts ; ps_dec_op -> u4_error_code = 0 ; ps_dec_op -> e_pic_type = - 1 ; ps_dec_op -> u4_output_present = 0 ; ps_dec_op -> u4_frame_decoded_flag = 0 ; ps_dec -> i4_frametype = - 1 ; ps_dec -> i4_content_type = - 1 ; { if ( ( TOP_FIELD_ONLY | BOT_FIELD_ONLY ) == ps_dec -> u1_top_bottom_decoded ) { ps_dec -> u1_top_bottom_decoded = 0 ; } } ps_dec -> u4_slice_start_code_found = 0 ; if ( ps_dec -> u1_init_dec_flag == 1 && ps_dec -> u4_share_disp_buf == 1 && ps_dec -> u1_flushfrm == 0 ) { UWORD32 i ; WORD32 disp_avail = 0 , free_id ; for ( i = 0 ; i < ps_dec -> u1_pic_bufs ; i ++ ) { if ( 0 == ps_dec -> u4_disp_buf_mapping [ i ] || 1 == ps_dec -> u4_disp_buf_to_be_freed [ i ] ) { disp_avail = 1 ; break ; } } if ( 0 == disp_avail ) { ps_dec_op -> u4_error_code = IVD_DEC_REF_BUF_NULL ; ps_dec_op -> u4_error_code |= ( 1 << IVD_UNSUPPORTEDPARAM ) ; return ( IV_FAIL ) ; } while ( 1 ) { pic_buffer_t * ps_pic_buf ; ps_pic_buf = ( pic_buffer_t * ) ih264_buf_mgr_get_next_free ( ( buf_mgr_t * ) ps_dec -> pv_pic_buf_mgr , & free_id ) ; if ( ps_pic_buf == NULL ) { UWORD32 i , display_queued = 0 ; for ( i = 0 ; i < ( MAX_DISP_BUFS_NEW ) ; i ++ ) { if ( 0 != ps_dec -> u4_disp_buf_mapping [ i ] ) { display_queued = 1 ; break ; } } if ( 1 == display_queued ) { ps_dec_op -> u4_error_code = IVD_DEC_REF_BUF_NULL ; ps_dec_op -> u4_error_code |= ( 1 << IVD_UNSUPPORTEDPARAM ) ; return ( IV_FAIL ) ; } } else { if ( 1 == ps_dec -> u4_disp_buf_mapping [ free_id ] ) { ih264_buf_mgr_set_status ( ( buf_mgr_t * ) ps_dec -> pv_pic_buf_mgr , free_id , BUF_MGR_IO ) ; } else { ih264_buf_mgr_release ( ( buf_mgr_t * ) ps_dec -> pv_pic_buf_mgr , free_id , BUF_MGR_IO ) ; break ; } } } } if ( ps_dec -> u1_flushfrm && ps_dec -> u1_init_dec_flag ) { ih264d_get_next_display_field ( ps_dec , ps_dec -> ps_out_buffer , & ( ps_dec -> s_disp_op ) ) ; if ( 0 == ps_dec -> s_disp_op . u4_error_code ) { ps_dec -> u4_fmt_conv_cur_row = 0 ; ps_dec -> u4_fmt_conv_num_rows = ps_dec -> s_disp_frame_info . u4_y_ht ; ih264d_format_convert ( ps_dec , & ( ps_dec -> s_disp_op ) , ps_dec -> u4_fmt_conv_cur_row , ps_dec -> u4_fmt_conv_num_rows ) ; ps_dec -> u4_fmt_conv_cur_row += ps_dec -> u4_fmt_conv_num_rows ; ps_dec -> u4_output_present = 1 ; } ih264d_release_display_field ( ps_dec , & ( ps_dec -> s_disp_op ) ) ; ps_dec_op -> u4_pic_wd = ( UWORD32 ) ps_dec -> u2_disp_width ; ps_dec_op -> u4_pic_ht = ( UWORD32 ) ps_dec -> u2_disp_height ; ps_dec_op -> u4_new_seq = 0 ; ps_dec_op -> u4_output_present = ps_dec -> u4_output_present ; ps_dec_op -> u4_progressive_frame_flag = ps_dec -> s_disp_op . u4_progressive_frame_flag ; ps_dec_op -> e_output_format = ps_dec -> s_disp_op . e_output_format ; ps_dec_op -> s_disp_frm_buf = ps_dec -> s_disp_op . s_disp_frm_buf ; ps_dec_op -> e4_fld_type = ps_dec -> s_disp_op . e4_fld_type ; ps_dec_op -> u4_ts = ps_dec -> s_disp_op . u4_ts ; ps_dec_op -> u4_disp_buf_id = ps_dec -> s_disp_op . u4_disp_buf_id ; ps_dec_op -> u4_is_ref_flag = - 1 ; ps_dec_op -> e_pic_type = IV_NA_FRAME ; ps_dec_op -> u4_frame_decoded_flag = 0 ; if ( 0 == ps_dec -> s_disp_op . u4_error_code ) { return ( IV_SUCCESS ) ; } else return ( IV_FAIL ) ; } if ( ps_dec -> u1_res_changed == 1 ) { ih264d_init_decoder ( ps_dec ) ; } ps_dec -> u4_prev_nal_skipped = 0 ; ps_dec -> u2_cur_mb_addr = 0 ; ps_dec -> u2_total_mbs_coded = 0 ; ps_dec -> u2_cur_slice_num = 0 ; ps_dec -> cur_dec_mb_num = 0 ; ps_dec -> cur_recon_mb_num = 0 ; ps_dec -> u4_first_slice_in_pic = 2 ; ps_dec -> u1_slice_header_done = 0 ; ps_dec -> u1_dangling_field = 0 ; ps_dec -> u4_dec_thread_created = 0 ; ps_dec -> u4_bs_deblk_thread_created = 0 ; <S2SV_StartBug> ps_dec -> u4_cur_bs_mb_num = 0 ; <S2SV_EndBug> DEBUG_THREADS_PRINTF ( "<S2SV_blank>Starting<S2SV_blank>process<S2SV_blank>call\\n" ) ; ps_dec -> u4_pic_buf_got = 0 ; do { WORD32 buf_size ; pu1_buf = ( UWORD8 * ) ps_dec_ip -> pv_stream_buffer + ps_dec_op -> u4_num_bytes_consumed ; u4_max_ofst = ps_dec_ip -> u4_num_Bytes - ps_dec_op -> u4_num_bytes_consumed ; if ( ( NULL == ps_dec -> pu1_bits_buf_dynamic ) && ( ps_dec -> i4_header_decoded & 1 ) ) { WORD32 size ; void * pv_buf ; void * pv_mem_ctxt = ps_dec -> pv_mem_ctxt ; size = MAX ( 256000 , ps_dec -> u2_pic_wd * ps_dec -> u2_pic_ht * 3 / 2 ) ; pv_buf = ps_dec -> pf_aligned_alloc ( pv_mem_ctxt , 128 , size ) ; RETURN_IF ( ( NULL == pv_buf ) , IV_FAIL ) ; ps_dec -> pu1_bits_buf_dynamic = pv_buf ; ps_dec -> u4_dynamic_bits_buf_size = size ; } if ( ps_dec -> pu1_bits_buf_dynamic ) { pu1_bitstrm_buf = ps_dec -> pu1_bits_buf_dynamic ; buf_size = ps_dec -> u4_dynamic_bits_buf_size ; } else { pu1_bitstrm_buf = ps_dec -> pu1_bits_buf_static ; buf_size = ps_dec -> u4_static_bits_buf_size ; } u4_next_is_aud = 0 ; buflen = ih264d_find_start_code ( pu1_buf , 0 , u4_max_ofst , & u4_length_of_start_code , & u4_next_is_aud ) ; if ( buflen == - 1 ) buflen = 0 ; buflen = MIN ( buflen , buf_size ) ; bytes_consumed = buflen + u4_length_of_start_code ; ps_dec_op -> u4_num_bytes_consumed += bytes_consumed ; { UWORD8 u1_firstbyte , u1_nal_ref_idc ; if ( ps_dec -> i4_app_skip_mode == IVD_SKIP_B ) { u1_firstbyte = * ( pu1_buf + u4_length_of_start_code ) ; u1_nal_ref_idc = ( UWORD8 ) ( NAL_REF_IDC ( u1_firstbyte ) ) ; if ( u1_nal_ref_idc == 0 ) { cur_slice_is_nonref = 1 ; continue ; } else { if ( 1 == cur_slice_is_nonref ) { ps_dec_op -> u4_num_bytes_consumed -= bytes_consumed ; ps_dec_op -> e_pic_type = IV_B_FRAME ; ps_dec_op -> u4_error_code = IVD_DEC_FRM_SKIPPED ; ps_dec_op -> u4_error_code |= ( 1 << IVD_UNSUPPORTEDPARAM ) ; ps_dec_op -> u4_frame_decoded_flag = 0 ; ps_dec_op -> u4_size = sizeof ( ivd_video_decode_op_t ) ; ih264d_signal_decode_thread ( ps_dec ) ; if ( ps_dec -> u4_num_cores == 3 ) { ih264d_signal_bs_deblk_thread ( ps_dec ) ; } return ( IV_FAIL ) ; } } } } if ( buflen ) { memcpy ( pu1_bitstrm_buf , pu1_buf + u4_length_of_start_code , buflen ) ; if ( ( buflen + 8 ) < buf_size ) { memset ( pu1_bitstrm_buf + buflen , 0 , 8 ) ; } u4_first_start_code_found = 1 ; } else { if ( u4_first_start_code_found == 0 ) { ps_dec -> i4_error_code = ERROR_START_CODE_NOT_FOUND ; ps_dec_op -> u4_error_code |= 1 << IVD_INSUFFICIENTDATA ; if ( ps_dec -> u4_pic_buf_got == 0 ) { ih264d_fill_output_struct_from_context ( ps_dec , ps_dec_op ) ; ps_dec_op -> u4_error_code = ps_dec -> i4_error_code ; ps_dec_op -> u4_frame_decoded_flag = 0 ; return ( IV_FAIL ) ; } else { ps_dec -> u1_pic_decode_done = 1 ; continue ; } } else { frame_data_left = 0 ; continue ; } } ps_dec -> u4_return_to_app = 0 ; ret = ih264d_parse_nal_unit ( dec_hdl , ps_dec_op , pu1_bitstrm_buf , buflen ) ; if ( ret != OK ) { UWORD32 error = ih264d_map_error ( ret ) ; ps_dec_op -> u4_error_code = error | ret ; api_ret_value = IV_FAIL ; if ( ( ret == IVD_RES_CHANGED ) || ( ret == IVD_MEM_ALLOC_FAILED ) || ( ret == ERROR_UNAVAIL_PICBUF_T ) || ( ret == ERROR_UNAVAIL_MVBUF_T ) ) { break ; } if ( ( ret == ERROR_INCOMPLETE_FRAME ) || ( ret == ERROR_DANGLING_FIELD_IN_PIC ) ) { ps_dec_op -> u4_num_bytes_consumed -= bytes_consumed ; api_ret_value = IV_FAIL ; break ; } if ( ret == ERROR_IN_LAST_SLICE_OF_PIC ) { api_ret_value = IV_FAIL ; break ; } } if ( ps_dec -> u4_return_to_app ) { ps_dec_op -> u4_num_bytes_consumed -= bytes_consumed ; ps_dec_op -> u4_error_code = IVD_DEC_FRM_SKIPPED ; ps_dec_op -> u4_error_code |= ( 1 << IVD_UNSUPPORTEDPARAM ) ; ps_dec_op -> u4_frame_decoded_flag = 0 ; ps_dec_op -> u4_size = sizeof ( ivd_video_decode_op_t ) ; ih264d_signal_decode_thread ( ps_dec ) ; if ( ps_dec -> u4_num_cores == 3 ) { ih264d_signal_bs_deblk_thread ( ps_dec ) ; } return ( IV_FAIL ) ; } header_data_left = ( ( ps_dec -> i4_decode_header == 1 ) && ( ps_dec -> i4_header_decoded != 3 ) && ( ps_dec_op -> u4_num_bytes_consumed < ps_dec_ip -> u4_num_Bytes ) ) ; frame_data_left = ( ( ( ps_dec -> i4_decode_header == 0 ) && ( ( ps_dec -> u1_pic_decode_done == 0 ) || ( u4_next_is_aud == 1 ) ) ) && ( ps_dec_op -> u4_num_bytes_consumed < ps_dec_ip -> u4_num_Bytes ) ) ; } while ( ( header_data_left == 1 ) || ( frame_data_left == 1 ) ) ; if ( ( ps_dec -> u4_slice_start_code_found == 1 ) && ( ret != IVD_MEM_ALLOC_FAILED ) && ps_dec -> u2_total_mbs_coded < ps_dec -> u2_frm_ht_in_mbs * ps_dec -> u2_frm_wd_in_mbs ) { WORD32 num_mb_skipped ; WORD32 prev_slice_err ; pocstruct_t temp_poc ; WORD32 ret1 ; num_mb_skipped = ( ps_dec -> u2_frm_ht_in_mbs * ps_dec -> u2_frm_wd_in_mbs ) - ps_dec -> u2_total_mbs_coded ; if ( ps_dec -> u4_first_slice_in_pic && ( ps_dec -> u4_pic_buf_got == 0 ) ) prev_slice_err = 1 ; else prev_slice_err = 2 ; ret1 = ih264d_mark_err_slice_skip ( ps_dec , num_mb_skipped , ps_dec -> u1_nal_unit_type == IDR_SLICE_NAL , ps_dec -> ps_cur_slice -> u2_frame_num , & temp_poc , prev_slice_err ) ; if ( ( ret1 == ERROR_UNAVAIL_PICBUF_T ) || ( ret1 == ERROR_UNAVAIL_MVBUF_T ) ) { return IV_FAIL ; } } if ( ( ret == IVD_RES_CHANGED ) || ( ret == IVD_MEM_ALLOC_FAILED ) || ( ret == ERROR_UNAVAIL_PICBUF_T ) || ( ret == ERROR_UNAVAIL_MVBUF_T ) ) { ih264d_signal_decode_thread ( ps_dec ) ; if ( ps_dec -> u4_num_cores == 3 ) { ih264d_signal_bs_deblk_thread ( ps_dec ) ; } if ( ret == IVD_RES_CHANGED ) { ps_dec_op -> u4_num_bytes_consumed -= bytes_consumed ; } return IV_FAIL ; } if ( ps_dec -> u1_separate_parse ) { if ( ps_dec -> u4_num_cores == 2 ) { if ( ( ps_dec -> u4_nmb_deblk == 0 ) && ( ps_dec -> u4_start_recon_deblk == 1 ) && ( ps_dec -> ps_cur_sps -> u1_mb_aff_flag == 0 ) ) { UWORD32 u4_num_mbs , u4_max_addr ; tfr_ctxt_t s_tfr_ctxt ; tfr_ctxt_t * ps_tfr_cxt = & s_tfr_ctxt ; pad_mgr_t * ps_pad_mgr = & ps_dec -> s_pad_mgr ; u4_max_addr = ( ps_dec -> u2_frm_wd_in_mbs * ps_dec -> u2_frm_ht_in_mbs ) - 1 ; ps_dec -> u4_cur_bs_mb_num = u4_max_addr + 1 ; ih264d_init_deblk_tfr_ctxt ( ps_dec , ps_pad_mgr , ps_tfr_cxt , ps_dec -> u2_frm_wd_in_mbs , 0 ) ; u4_num_mbs = u4_max_addr - ps_dec -> u4_cur_deblk_mb_num + 1 ; DEBUG_PERF_PRINTF ( "mbs<S2SV_blank>left<S2SV_blank>for<S2SV_blank>deblocking=<S2SV_blank>%d<S2SV_blank>\\n" , u4_num_mbs ) ; if ( u4_num_mbs != 0 ) ih264d_check_mb_map_deblk ( ps_dec , u4_num_mbs , ps_tfr_cxt , 1 ) ; ps_dec -> u4_start_recon_deblk = 0 ; } } ih264d_signal_decode_thread ( ps_dec ) ; if ( ps_dec -> u4_num_cores == 3 ) { ih264d_signal_bs_deblk_thread ( ps_dec ) ; } } DATA_SYNC ( ) ; if ( ( ps_dec_op -> u4_error_code & 0xff ) != ERROR_DYNAMIC_RESOLUTION_NOT_SUPPORTED ) { ps_dec_op -> u4_pic_wd = ( UWORD32 ) ps_dec -> u2_disp_width ; ps_dec_op -> u4_pic_ht = ( UWORD32 ) ps_dec -> u2_disp_height ; } if ( ps_dec -> i4_header_decoded != 3 ) { ps_dec_op -> u4_error_code |= ( 1 << IVD_INSUFFICIENTDATA ) ; } if ( ps_dec -> i4_decode_header == 1 && ps_dec -> i4_header_decoded != 3 ) { ps_dec_op -> u4_error_code |= ( 1 << IVD_INSUFFICIENTDATA ) ; } if ( ps_dec -> u4_prev_nal_skipped ) { ps_dec_op -> u4_error_code = IVD_DEC_FRM_SKIPPED ; ps_dec_op -> u4_error_code |= ( 1 << IVD_UNSUPPORTEDPARAM ) ; ps_dec_op -> u4_frame_decoded_flag = 0 ; ps_dec_op -> u4_size = sizeof ( ivd_video_decode_op_t ) ; if ( ps_dec -> u4_num_cores == 3 ) { ih264d_signal_bs_deblk_thread ( ps_dec ) ; } return ( IV_FAIL ) ; } if ( ( ps_dec -> u4_slice_start_code_found == 1 ) && ( ERROR_DANGLING_FIELD_IN_PIC != i4_err_status ) ) { if ( ps_dec -> ps_cur_slice -> u1_field_pic_flag ) { if ( 1 == ps_dec -> ps_cur_slice -> u1_bottom_field_flag ) { ps_dec -> u1_top_bottom_decoded |= BOT_FIELD_ONLY ; } else { ps_dec -> u1_top_bottom_decoded |= TOP_FIELD_ONLY ; } } if ( ( ps_dec -> ps_dec_err_status -> u1_err_flag & REJECT_CUR_PIC ) == 0 ) { ret = ih264d_deblock_display ( ps_dec ) ; if ( ret != 0 ) { return IV_FAIL ; } } if ( ps_dec -> i4_header_decoded == 3 ) { ps_dec -> u2_total_mbs_coded = ps_dec -> ps_cur_sps -> u2_max_mb_addr + 1 ; } if ( ps_dec -> ps_cur_slice -> u1_nal_unit_type == IDR_SLICE_NAL ) { ps_dec -> i4_frametype = IV_IDR_FRAME ; } else if ( ps_dec -> i4_pic_type == B_SLICE ) { ps_dec -> i4_frametype = IV_B_FRAME ; } else if ( ps_dec -> i4_pic_type == P_SLICE ) { ps_dec -> i4_frametype = IV_P_FRAME ; } else if ( ps_dec -> i4_pic_type == I_SLICE ) { ps_dec -> i4_frametype = IV_I_FRAME ; } else { H264_DEC_DEBUG_PRINT ( "Shouldn\'t<S2SV_blank>come<S2SV_blank>here\\n" ) ; } ps_dec -> i4_content_type = ps_dec -> ps_cur_slice -> u1_field_pic_flag ; ps_dec -> u4_total_frames_decoded = ps_dec -> u4_total_frames_decoded + 2 ; ps_dec -> u4_total_frames_decoded = ps_dec -> u4_total_frames_decoded - ps_dec -> ps_cur_slice -> u1_field_pic_flag ; } if ( ps_dec -> u4_num_cores == 3 ) { ih264d_signal_bs_deblk_thread ( ps_dec ) ; } { if ( ( IVD_DECODE_FRAME_OUT == ps_dec -> e_frm_out_mode ) && ps_dec -> u1_init_dec_flag ) { ih264d_get_next_display_field ( ps_dec , ps_dec -> ps_out_buffer , & ( ps_dec -> s_disp_op ) ) ; if ( 0 == ps_dec -> s_disp_op . u4_error_code ) { ps_dec -> u4_fmt_conv_cur_row = 0 ; ps_dec -> u4_output_present = 1 ; } } ih264d_fill_output_struct_from_context ( ps_dec , ps_dec_op ) ; if ( ps_dec -> u4_output_present && ( ps_dec -> u4_fmt_conv_cur_row < ps_dec -> s_disp_frame_info . u4_y_ht ) ) { ps_dec -> u4_fmt_conv_num_rows = ps_dec -> s_disp_frame_info . u4_y_ht - ps_dec -> u4_fmt_conv_cur_row ; ih264d_format_convert ( ps_dec , & ( ps_dec -> s_disp_op ) , ps_dec -> u4_fmt_conv_cur_row , ps_dec -> u4_fmt_conv_num_rows ) ; ps_dec -> u4_fmt_conv_cur_row += ps_dec -> u4_fmt_conv_num_rows ; } ih264d_release_display_field ( ps_dec , & ( ps_dec -> s_disp_op ) ) ; } if ( ps_dec -> i4_decode_header == 1 && ( ps_dec -> i4_header_decoded & 1 ) == 1 ) { ps_dec_op -> u4_progressive_frame_flag = 1 ; if ( ( NULL != ps_dec -> ps_cur_sps ) && ( 1 == ( ps_dec -> ps_cur_sps -> u1_is_valid ) ) ) { if ( ( 0 == ps_dec -> ps_sps -> u1_frame_mbs_only_flag ) && ( 0 == ps_dec -> ps_sps -> u1_mb_aff_flag ) ) ps_dec_op -> u4_progressive_frame_flag = 0 ; } } DATA_SYNC ( ) ; H264_DEC_DEBUG_PRINT ( "The<S2SV_blank>num<S2SV_blank>bytes<S2SV_blank>consumed:<S2SV_blank>%d\\n" , ps_dec_op -> u4_num_bytes_consumed ) ; return api_ret_value ; }
| <S2SV_ModStart> ps_dec -> u4_cur_bs_mb_num = 0 ; ps_dec -> u4_start_recon_deblk
| external@libavc/a78887bcffbc2995cf9ed72e0697acf560875e9e | CVE-2016-3820 | https://android.googlesource.com/platform/external/libavc/+/a78887bcffbc2995cf9ed72e0697acf560875e9e | 2016-08-05T20:59Z |
289 | CWE-399 | CWE-399 static int unix_attach_fds ( struct scm_cookie * scm , struct sk_buff * skb ) { int i ; unsigned char max_level = 0 ; int unix_sock_count = 0 ; if ( too_many_unix_fds ( current ) ) return - ETOOMANYREFS ; for ( i = scm -> fp -> count - 1 ; i >= 0 ; i -- ) { struct sock * sk = unix_get_socket ( scm -> fp -> fp [ i ] ) ; if ( sk ) { unix_sock_count ++ ; max_level = max ( max_level , unix_sk ( sk ) -> recursion_level ) ; } } if ( unlikely ( max_level > MAX_RECURSION_LEVEL ) ) return - ETOOMANYREFS ; UNIXCB ( skb ) . fp = scm_fp_dup ( scm -> fp ) ; if ( ! UNIXCB ( skb ) . fp ) return - ENOMEM ; for ( i = scm -> fp -> count - 1 ; i >= 0 ; i -- ) <S2SV_StartBug> unix_inflight ( scm -> fp -> fp [ i ] ) ; <S2SV_EndBug> return max_level ; }
| <S2SV_ModStart> -> fp -> user , scm -> fp ->
| torvalds@linux/415e3d3e90ce9e18727e8843ae343eda5a58fad6 | CVE-2016-2550 | https://github.com/torvalds/linux/commit/415e3d3e90ce9e18727e8843ae343eda5a58fad6 | 2016-04-27T17:59Z |
290 | CWE-362 | CWE-362 <S2SV_StartBug> static int cipso_v4_delopt ( struct ip_options * * opt_ptr ) <S2SV_EndBug> { int hdr_delta = 0 ; <S2SV_StartBug> struct ip_options * opt = * opt_ptr ; <S2SV_EndBug> <S2SV_StartBug> if ( opt -> srr || opt -> rr || opt -> ts || opt -> router_alert ) { <S2SV_EndBug> u8 cipso_len ; u8 cipso_off ; unsigned char * cipso_ptr ; int iter ; int optlen_new ; <S2SV_StartBug> cipso_off = opt -> cipso - sizeof ( struct iphdr ) ; <S2SV_EndBug> <S2SV_StartBug> cipso_ptr = & opt -> __data [ cipso_off ] ; <S2SV_EndBug> cipso_len = cipso_ptr [ 1 ] ; <S2SV_StartBug> if ( opt -> srr > opt -> cipso ) <S2SV_EndBug> opt -> srr -= cipso_len ; <S2SV_StartBug> if ( opt -> rr > opt -> cipso ) <S2SV_EndBug> opt -> rr -= cipso_len ; <S2SV_StartBug> if ( opt -> ts > opt -> cipso ) <S2SV_EndBug> opt -> ts -= cipso_len ; <S2SV_StartBug> if ( opt -> router_alert > opt -> cipso ) <S2SV_EndBug> opt -> router_alert -= cipso_len ; <S2SV_StartBug> opt -> cipso = 0 ; <S2SV_EndBug> memmove ( cipso_ptr , cipso_ptr + cipso_len , <S2SV_StartBug> opt -> optlen - cipso_off - cipso_len ) ; <S2SV_EndBug> iter = 0 ; optlen_new = 0 ; <S2SV_StartBug> while ( iter < opt -> optlen ) <S2SV_EndBug> if ( opt -> __data [ iter ] != IPOPT_NOP ) { <S2SV_StartBug> iter += opt -> __data [ iter + 1 ] ; <S2SV_EndBug> optlen_new = iter ; } else iter ++ ; <S2SV_StartBug> hdr_delta = opt -> optlen ; <S2SV_EndBug> opt -> optlen = ( optlen_new + 3 ) & ~ 3 ; <S2SV_StartBug> hdr_delta -= opt -> optlen ; <S2SV_EndBug> } else { * opt_ptr = NULL ; <S2SV_StartBug> hdr_delta = opt -> optlen ; <S2SV_EndBug> kfree ( opt ) ; } return hdr_delta ; }
| <S2SV_ModStart> cipso_v4_delopt ( struct ip_options_rcu <S2SV_ModEnd> * * opt_ptr <S2SV_ModStart> 0 ; struct ip_options_rcu <S2SV_ModEnd> * opt = <S2SV_ModStart> ( opt -> opt . <S2SV_ModStart> || opt -> opt . <S2SV_ModStart> || opt -> opt . <S2SV_ModStart> || opt -> opt . <S2SV_ModStart> = opt -> opt . <S2SV_ModStart> & opt -> opt . <S2SV_ModStart> ( opt -> opt . <S2SV_ModStart> > opt -> opt . cipso ) opt -> opt . <S2SV_ModEnd> srr -= cipso_len <S2SV_ModStart> ( opt -> opt . <S2SV_ModStart> > opt -> opt . cipso ) opt -> opt . <S2SV_ModEnd> rr -= cipso_len <S2SV_ModStart> ( opt -> opt . <S2SV_ModStart> > opt -> opt . cipso ) opt -> opt . <S2SV_ModEnd> ts -= cipso_len <S2SV_ModStart> ( opt -> opt . <S2SV_ModStart> > opt -> opt . cipso ) opt -> opt . <S2SV_ModEnd> router_alert -= cipso_len <S2SV_ModStart> ; opt -> opt . <S2SV_ModStart> , opt -> opt . <S2SV_ModStart> < opt -> opt . optlen ) if ( opt -> opt . <S2SV_ModEnd> __data [ iter <S2SV_ModStart> += opt -> opt . <S2SV_ModStart> = opt -> opt . optlen ; opt -> opt . <S2SV_ModEnd> optlen = ( <S2SV_ModStart> -= opt -> opt . <S2SV_ModStart> = opt -> opt . optlen ; call_rcu ( & opt -> rcu , opt_kfree_rcu <S2SV_ModEnd> ) ; }
| torvalds@linux/f6d8bd051c391c1c0458a30b2a7abcd939329259 | CVE-2012-3552 | https://github.com/torvalds/linux/commit/f6d8bd051c391c1c0458a30b2a7abcd939329259 | 2012-10-03T11:02Z |
291 | CWE-119 | CWE-119 static int apparmor_setprocattr ( struct task_struct * task , char * name , void * value , size_t size ) { struct common_audit_data sa ; struct apparmor_audit_data aad = { 0 , } ; <S2SV_StartBug> char * command , * args = value ; <S2SV_EndBug> size_t arg_size ; int error ; if ( size == 0 ) <S2SV_StartBug> return - EINVAL ; <S2SV_EndBug> if ( args [ size - 1 ] != '\\0' ) { <S2SV_StartBug> if ( size == PAGE_SIZE ) <S2SV_EndBug> <S2SV_StartBug> return - EINVAL ; <S2SV_EndBug> <S2SV_StartBug> args [ size ] = '\\0' ; <S2SV_EndBug> } if ( current != task ) return - EACCES ; args = value ; args = strim ( args ) ; command = strsep ( & args , "<S2SV_blank>" ) ; if ( ! args ) return - EINVAL ; args = skip_spaces ( args ) ; if ( ! * args ) return - EINVAL ; arg_size = size - ( args - ( char * ) value ) ; <S2SV_StartBug> if ( strcmp ( name , "current" ) == 0 ) { <S2SV_EndBug> if ( strcmp ( command , "changehat" ) == 0 ) { error = aa_setprocattr_changehat ( args , arg_size , ! AA_DO_TEST ) ; <S2SV_StartBug> } else if ( strcmp ( command , "permhat" ) == 0 ) { <S2SV_EndBug> error = aa_setprocattr_changehat ( args , arg_size , AA_DO_TEST ) ; } else if ( strcmp ( command , "changeprofile" ) == 0 ) { error = aa_setprocattr_changeprofile ( args , ! AA_ONEXEC , ! AA_DO_TEST ) ; } else if ( strcmp ( command , "permprofile" ) == 0 ) { error = aa_setprocattr_changeprofile ( args , ! AA_ONEXEC , AA_DO_TEST ) ; } else goto fail ; <S2SV_StartBug> } else if ( strcmp ( name , "exec" ) == 0 ) { <S2SV_EndBug> if ( strcmp ( command , "exec" ) == 0 ) error = aa_setprocattr_changeprofile ( args , AA_ONEXEC , ! AA_DO_TEST ) ; else goto fail ; <S2SV_StartBug> } else <S2SV_EndBug> return - EINVAL ; if ( ! error ) error = size ; return error ; fail : sa . type = LSM_AUDIT_DATA_NONE ; sa . aad = & aad ; aad . profile = aa_current_profile ( ) ; aad . op = OP_SETPROCATTR ; aad . info = name ; <S2SV_StartBug> aad . error = - EINVAL ; <S2SV_EndBug> aa_audit_msg ( AUDIT_APPARMOR_DENIED , & sa , NULL ) ; <S2SV_StartBug> return - EINVAL ; <S2SV_EndBug> }
| <S2SV_ModStart> command , * largs = NULL , * <S2SV_ModStart> return - EINVAL ; if ( current != task ) return - EACCES <S2SV_ModStart> '\\0' ) { largs = args = kmalloc ( size + 1 , GFP_KERNEL ) ; if ( ! args <S2SV_ModEnd> ) return - <S2SV_ModStart> ) return - ENOMEM ; memcpy ( args , value , size ) ; args [ size ] = '\\0' ; } error = - <S2SV_ModStart> EINVAL ; args = strim ( args ) ; command = strsep ( & args , "<S2SV_blank>" ) ; if ( ! args ) goto out ; args = skip_spaces ( args ) ; if ( ! * args ) goto out ; arg_size = size - ( args - ( char * ) value ) ; if ( strcmp ( name , "current" ) == 0 ) { if ( strcmp ( command , "changehat" ) == 0 ) { error = aa_setprocattr_changehat ( args , arg_size , ! AA_DO_TEST ) ; } else if ( strcmp ( command , "permhat" ) == 0 ) { error = aa_setprocattr_changehat ( args , arg_size , AA_DO_TEST ) ; } else if ( strcmp ( command , "changeprofile" ) == 0 ) { error = aa_setprocattr_changeprofile ( args , ! AA_ONEXEC , ! AA_DO_TEST ) ; } else if ( strcmp ( command , "permprofile" ) == 0 ) { error = aa_setprocattr_changeprofile ( args , ! AA_ONEXEC , AA_DO_TEST ) ; } else goto fail ; } else <S2SV_ModEnd> if ( strcmp <S2SV_ModStart> ( name , "exec" ) == 0 ) { if ( strcmp ( command , "exec" ) == 0 ) error = aa_setprocattr_changeprofile ( args , AA_ONEXEC <S2SV_ModEnd> , ! AA_DO_TEST <S2SV_ModStart> AA_DO_TEST ) ; <S2SV_ModEnd> else goto fail <S2SV_ModStart> ; } else <S2SV_ModEnd> goto fail ; <S2SV_ModStart> goto fail ; if ( ! error ) error = size ; out : kfree ( largs ) <S2SV_ModEnd> ; return error <S2SV_ModStart> . error = error = <S2SV_ModStart> NULL ) ; goto out <S2SV_ModEnd> ; } <S2SV_null>
| torvalds@linux/30a46a4647fd1df9cf52e43bf467f0d9265096ca | CVE-2016-6187 | https://github.com/torvalds/linux/commit/30a46a4647fd1df9cf52e43bf467f0d9265096ca | 2016-08-06T20:59Z |
292 | CWE-20 | CWE-20 static int llc_ui_recvmsg ( struct kiocb * iocb , struct socket * sock , struct msghdr * msg , size_t len , int flags ) { struct sockaddr_llc * uaddr = ( struct sockaddr_llc * ) msg -> msg_name ; const int nonblock = flags & MSG_DONTWAIT ; struct sk_buff * skb = NULL ; struct sock * sk = sock -> sk ; struct llc_sock * llc = llc_sk ( sk ) ; unsigned long cpu_flags ; size_t copied = 0 ; u32 peek_seq = 0 ; u32 * seq ; unsigned long used ; int target ; <S2SV_StartBug> long timeo ; <S2SV_EndBug> msg -> msg_namelen = 0 ; lock_sock ( sk ) ; copied = - ENOTCONN ; if ( unlikely ( sk -> sk_type == SOCK_STREAM && sk -> sk_state == TCP_LISTEN ) ) goto out ; timeo = sock_rcvtimeo ( sk , nonblock ) ; seq = & llc -> copied_seq ; if ( flags & MSG_PEEK ) { peek_seq = llc -> copied_seq ; seq = & peek_seq ; } target = sock_rcvlowat ( sk , flags & MSG_WAITALL , len ) ; copied = 0 ; do { u32 offset ; if ( signal_pending ( current ) ) { if ( copied ) break ; copied = timeo ? sock_intr_errno ( timeo ) : - EAGAIN ; break ; } skb = skb_peek ( & sk -> sk_receive_queue ) ; if ( skb ) { offset = * seq ; goto found_ok_skb ; } if ( copied >= target && ! sk -> sk_backlog . tail ) break ; if ( copied ) { if ( sk -> sk_err || sk -> sk_state == TCP_CLOSE || ( sk -> sk_shutdown & RCV_SHUTDOWN ) || ! timeo || ( flags & MSG_PEEK ) ) break ; } else { if ( sock_flag ( sk , SOCK_DONE ) ) break ; if ( sk -> sk_err ) { copied = sock_error ( sk ) ; break ; } if ( sk -> sk_shutdown & RCV_SHUTDOWN ) break ; if ( sk -> sk_type == SOCK_STREAM && sk -> sk_state == TCP_CLOSE ) { if ( ! sock_flag ( sk , SOCK_DONE ) ) { copied = - ENOTCONN ; break ; } break ; } if ( ! timeo ) { copied = - EAGAIN ; break ; } } if ( copied >= target ) { release_sock ( sk ) ; lock_sock ( sk ) ; } else sk_wait_data ( sk , & timeo ) ; if ( ( flags & MSG_PEEK ) && peek_seq != llc -> copied_seq ) { net_dbg_ratelimited ( "LLC(%s:%d):<S2SV_blank>Application<S2SV_blank>bug,<S2SV_blank>race<S2SV_blank>in<S2SV_blank>MSG_PEEK\\n" , current -> comm , task_pid_nr ( current ) ) ; peek_seq = llc -> copied_seq ; } continue ; found_ok_skb : used = skb -> len - offset ; if ( len < used ) used = len ; if ( ! ( flags & MSG_TRUNC ) ) { int rc = skb_copy_datagram_iovec ( skb , offset , msg -> msg_iov , used ) ; if ( rc ) { if ( ! copied ) copied = - EFAULT ; break ; } } * seq += used ; copied += used ; len -= used ; if ( sk -> sk_type != SOCK_STREAM ) goto copy_uaddr ; if ( ! ( flags & MSG_PEEK ) ) { spin_lock_irqsave ( & sk -> sk_receive_queue . lock , cpu_flags ) ; sk_eat_skb ( sk , skb , false ) ; spin_unlock_irqrestore ( & sk -> sk_receive_queue . lock , cpu_flags ) ; * seq = 0 ; } if ( used + offset < skb -> len ) continue ; } while ( len > 0 ) ; out : release_sock ( sk ) ; return copied ; copy_uaddr : if ( uaddr != NULL && skb != NULL ) { memcpy ( uaddr , llc_ui_skb_cb ( skb ) , sizeof ( * uaddr ) ) ; msg -> msg_namelen = sizeof ( * uaddr ) ; } if ( llc_sk ( sk ) -> cmsg_flags ) llc_cmsg_rcv ( msg , skb ) ; if ( ! ( flags & MSG_PEEK ) ) { spin_lock_irqsave ( & sk -> sk_receive_queue . lock , cpu_flags ) ; sk_eat_skb ( sk , skb , false ) ; spin_unlock_irqrestore ( & sk -> sk_receive_queue . lock , cpu_flags ) ; * seq = 0 ; } goto out ; }
| <S2SV_ModStart> ; long timeo <S2SV_ModEnd> ; lock_sock (
| torvalds@linux/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c | CVE-2013-7271 | https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c | 2014-01-06T16:55Z |
293 | CWE-000 | CWE-000 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 ; const struct ipv6_pinfo * np = inet6_sk ( sk ) ; struct ipv6_txoptions * opt ; 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 ; <S2SV_StartBug> newnp -> mcast_oif = inet6_iif ( skb ) ; <S2SV_EndBug> 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 ; <S2SV_StartBug> newnp -> pktoptions = NULL ; <S2SV_EndBug> newnp -> opt = NULL ; newnp -> mcast_oif = inet6_iif ( skb ) ; newnp -> mcast_hops = ipv6_hdr ( skb ) -> hop_limit ; opt = ireq -> ipv6_opt ; if ( ! opt ) opt = rcu_dereference ( np -> opt ) ; if ( opt ) { opt = ipv6_dup_options ( newsk , opt ) ; RCU_INIT_POINTER ( newnp -> opt , opt ) ; } inet_csk ( newsk ) -> icsk_ext_hdr_len = 0 ; if ( opt ) inet_csk ( newsk ) -> icsk_ext_hdr_len = opt -> opt_nflen + opt -> opt_flen ; 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 ( sock_net ( sk ) , LINUX_MIB_LISTENOVERFLOWS ) ; out_nonewsk : dst_release ( dst ) ; out : __NET_INC_STATS ( sock_net ( sk ) , LINUX_MIB_LISTENDROPS ) ; return NULL ; }
| <S2SV_ModStart> ; newnp -> ipv6_mc_list = NULL ; newnp -> ipv6_ac_list = NULL ; newnp -> ipv6_fl_list = NULL ; newnp -> <S2SV_ModStart> ; newnp -> ipv6_mc_list = NULL ; newnp -> ipv6_ac_list = NULL ; newnp -> ipv6_fl_list = NULL ; newnp ->
| torvalds@linux/83eaddab4378db256d00d295bda6ca997cd13a52 | CVE-2017-9077 | https://github.com/torvalds/linux/commit/83eaddab4378db256d00d295bda6ca997cd13a52 | 2017-05-19T14:29Z |
294 | CWE-119 | CWE-119 <S2SV_StartBug> void vp9_write_prob_diff_update ( vp9_writer * w , vp9_prob newp , vp9_prob oldp ) { <S2SV_EndBug> const int delp = remap_prob ( newp , oldp ) ; encode_term_subexp ( w , delp ) ; }
| <S2SV_ModStart> void vp9_write_prob_diff_update ( vpx_writer <S2SV_ModEnd> * w , <S2SV_ModStart> * w , vpx_prob newp , vpx_prob <S2SV_ModEnd> oldp ) {
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
295 | CWE-190 | CWE-190 <S2SV_StartBug> static int getnum ( lua_State * L , const char * * fmt , int df ) { <S2SV_EndBug> if ( ! isdigit ( * * fmt ) ) return df ; else { int a = 0 ; do { <S2SV_StartBug> if ( a > ( INT_MAX / 10 ) || a * 10 > ( INT_MAX - ( * * fmt - '0' ) ) ) <S2SV_EndBug> luaL_error ( L , "integral<S2SV_blank>size<S2SV_blank>overflow" ) ; a = a * 10 + * ( ( * fmt ) ++ ) - '0' ; } while ( isdigit ( * * fmt ) ) ; return a ; } }
| <S2SV_ModStart> int getnum ( <S2SV_ModEnd> const char * <S2SV_ModStart> ; do { <S2SV_ModEnd> a = a
| antirez@redis/1eb08bcd4634ae42ec45e8284923ac048beaa4c3 | CVE-2018-11219 | https://github.com/antirez/redis/commit/1eb08bcd4634ae42ec45e8284923ac048beaa4c3 | 2018-06-17T17:29Z |
296 | CWE-416 | CWE-416 void snd_usb_mixer_disconnect ( struct usb_mixer_interface * mixer ) { <S2SV_StartBug> usb_kill_urb ( mixer -> urb ) ; <S2SV_EndBug> usb_kill_urb ( mixer -> rc_urb ) ; <S2SV_StartBug> } <S2SV_EndBug>
| <S2SV_ModStart> mixer ) { if ( mixer -> disconnected ) return ; if ( mixer -> urb ) <S2SV_ModStart> urb ) ; if ( mixer -> rc_urb ) <S2SV_ModStart> rc_urb ) ; mixer -> disconnected = true ;
| torvalds@linux/124751d5e63c823092060074bd0abaae61aaa9c4 | CVE-2017-16527 | https://github.com/torvalds/linux/commit/124751d5e63c823092060074bd0abaae61aaa9c4 | 2017-11-04T01:29Z |
297 | CWE-125 | CWE-125 void qedi_dbg_err ( struct qedi_dbg_ctx * qedi , const char * func , u32 line , const char * fmt , ... ) { va_list va ; <S2SV_StartBug> struct va_format vaf ; <S2SV_EndBug> char nfunc [ 32 ] ; memset ( nfunc , 0 , sizeof ( nfunc ) ) ; memcpy ( nfunc , func , sizeof ( nfunc ) - 1 ) ; va_start ( va , fmt ) ; vaf . fmt = fmt ; vaf . va = & va ; if ( likely ( qedi ) && likely ( qedi -> pdev ) ) pr_err ( "[%s]:[%s:%d]:%d:<S2SV_blank>%pV" , dev_name ( & qedi -> pdev -> dev ) , <S2SV_StartBug> nfunc , line , qedi -> host_no , & vaf ) ; <S2SV_EndBug> else <S2SV_StartBug> pr_err ( "[0000:00:00.0]:[%s:%d]:<S2SV_blank>%pV" , nfunc , line , & vaf ) ; <S2SV_EndBug> va_end ( va ) ; }
| <S2SV_ModStart> struct va_format vaf <S2SV_ModEnd> ; va_start ( <S2SV_ModStart> dev ) , func <S2SV_ModEnd> , line , <S2SV_ModStart> ( "[0000:00:00.0]:[%s:%d]:<S2SV_blank>%pV" , func <S2SV_ModEnd> , line ,
| torvalds@linux/c09581a52765a85f19fc35340127396d5e3379cc | CVE-2019-15090 | https://github.com/torvalds/linux/commit/c09581a52765a85f19fc35340127396d5e3379cc | 2019-08-16T00:15Z |
298 | CWE-120 | CWE-120 static int mwifiex_update_vs_ie ( const u8 * ies , int ies_len , struct mwifiex_ie * * ie_ptr , u16 mask , unsigned int oui , u8 oui_type ) { struct ieee_types_header * vs_ie ; struct mwifiex_ie * ie = * ie_ptr ; const u8 * vendor_ie ; vendor_ie = cfg80211_find_vendor_ie ( oui , oui_type , ies , ies_len ) ; if ( vendor_ie ) { if ( ! * ie_ptr ) { * ie_ptr = kzalloc ( sizeof ( struct mwifiex_ie ) , GFP_KERNEL ) ; if ( ! * ie_ptr ) return - ENOMEM ; ie = * ie_ptr ; } vs_ie = ( struct ieee_types_header * ) vendor_ie ; <S2SV_StartBug> memcpy ( ie -> ie_buffer + le16_to_cpu ( ie -> ie_length ) , <S2SV_EndBug> vs_ie , vs_ie -> len + 2 ) ; le16_unaligned_add_cpu ( & ie -> ie_length , vs_ie -> len + 2 ) ; ie -> mgmt_subtype_mask = cpu_to_le16 ( mask ) ; ie -> ie_index = cpu_to_le16 ( MWIFIEX_AUTO_IDX_MASK ) ; } * ie_ptr = ie ; return 0 ; }
| <S2SV_ModStart> ) vendor_ie ; if ( le16_to_cpu ( ie -> ie_length ) + vs_ie -> len + 2 > IEEE_MAX_IE_SIZE ) return - EINVAL ;
| torvalds@linux/7caac62ed598a196d6ddf8d9c121e12e082cac3a | CVE-2019-14814 | https://github.com/torvalds/linux/commit/7caac62ed598a196d6ddf8d9c121e12e082cac3a | 2019-09-20T19:15Z |
299 | CWE-284 | CWE-284 static uint16_t transmit_data ( serial_data_type_t type , uint8_t * data , uint16_t length ) { assert ( data != NULL ) ; assert ( length > 0 ) ; if ( type < DATA_TYPE_COMMAND || type > DATA_TYPE_SCO ) { LOG_ERROR ( "%s<S2SV_blank>invalid<S2SV_blank>data<S2SV_blank>type:<S2SV_blank>%d" , __func__ , type ) ; return 0 ; } -- data ; uint8_t previous_byte = * data ; * ( data ) = type ; ++ length ; uint16_t transmitted_length = 0 ; while ( length > 0 ) { <S2SV_StartBug> ssize_t ret = write ( uart_fd , data + transmitted_length , length ) ; <S2SV_EndBug> switch ( ret ) { case - 1 : LOG_ERROR ( "In<S2SV_blank>%s,<S2SV_blank>error<S2SV_blank>writing<S2SV_blank>to<S2SV_blank>the<S2SV_blank>uart<S2SV_blank>serial<S2SV_blank>port:<S2SV_blank>%s" , __func__ , strerror ( errno ) ) ; goto done ; case 0 : goto done ; default : transmitted_length += ret ; length -= ret ; break ; } } done : ; * ( data ) = previous_byte ; if ( transmitted_length > 0 ) -- transmitted_length ; return transmitted_length ; }
| <S2SV_ModStart> ssize_t ret = TEMP_FAILURE_RETRY ( <S2SV_ModStart> transmitted_length , length )
| system@bt/472271b153c5dc53c28beac55480a8d8434b2d5c | CVE-2016-3839 | https://android.googlesource.com/platform/system/bt/+/472271b153c5dc53c28beac55480a8d8434b2d5c | 2016-08-05T20:59Z |