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
|
---|---|---|---|---|---|---|---|
6,700 | CWE-665 | CWE-665 static struct ib_ucontext * hns_roce_alloc_ucontext ( struct ib_device * ib_dev , struct ib_udata * udata ) { int ret = 0 ; struct hns_roce_ucontext * context ; <S2SV_StartBug> struct hns_roce_ib_alloc_ucontext_resp resp ; <S2SV_EndBug> struct hns_roce_dev * hr_dev = to_hr_dev ( ib_dev ) ; resp . qp_tab_size = hr_dev -> caps . num_qps ; context = kmalloc ( sizeof ( * context ) , GFP_KERNEL ) ; if ( ! context ) return ERR_PTR ( - ENOMEM ) ; ret = hns_roce_uar_alloc ( hr_dev , & context -> uar ) ; if ( ret ) goto error_fail_uar_alloc ; if ( hr_dev -> caps . flags & HNS_ROCE_CAP_FLAG_RECORD_DB ) { INIT_LIST_HEAD ( & context -> page_list ) ; mutex_init ( & context -> page_mutex ) ; } ret = ib_copy_to_udata ( udata , & resp , sizeof ( resp ) ) ; if ( ret ) goto error_fail_copy_to_udata ; return & context -> ibucontext ; error_fail_copy_to_udata : hns_roce_uar_free ( hr_dev , & context -> uar ) ; error_fail_uar_alloc : kfree ( context ) ; return ERR_PTR ( ret ) ; }
| <S2SV_ModStart> struct hns_roce_ib_alloc_ucontext_resp resp = { }
| torvalds@linux/df7e40425813c50cd252e6f5e348a81ef1acae56 | CVE-2019-16921 | https://github.com/torvalds/linux/commit/df7e40425813c50cd252e6f5e348a81ef1acae56 | 2019-09-27T13:15Z |
6,701 | CWE-125 | CWE-125 static int ext4_fill_super ( struct super_block * sb , void * data , int silent ) { char * orig_data = kstrdup ( data , GFP_KERNEL ) ; struct buffer_head * bh ; struct ext4_super_block * es = NULL ; struct ext4_sb_info * sbi = kzalloc ( sizeof ( * sbi ) , GFP_KERNEL ) ; ext4_fsblk_t block ; ext4_fsblk_t sb_block = get_sb_block ( & data ) ; ext4_fsblk_t logical_sb_block ; unsigned long offset = 0 ; unsigned long journal_devnum = 0 ; unsigned long def_mount_opts ; struct inode * root ; const char * descr ; int ret = - ENOMEM ; int blocksize , clustersize ; unsigned int db_count ; unsigned int i ; int needs_recovery , has_huge_files , has_bigalloc ; __u64 blocks_count ; int err = 0 ; unsigned int journal_ioprio = DEFAULT_JOURNAL_IOPRIO ; ext4_group_t first_not_zeroed ; if ( ( data && ! orig_data ) || ! sbi ) goto out_free_base ; sbi -> s_blockgroup_lock = kzalloc ( sizeof ( struct blockgroup_lock ) , GFP_KERNEL ) ; if ( ! sbi -> s_blockgroup_lock ) goto out_free_base ; sb -> s_fs_info = sbi ; sbi -> s_sb = sb ; sbi -> s_inode_readahead_blks = EXT4_DEF_INODE_READAHEAD_BLKS ; sbi -> s_sb_block = sb_block ; if ( sb -> s_bdev -> bd_part ) sbi -> s_sectors_written_start = part_stat_read ( sb -> s_bdev -> bd_part , sectors [ 1 ] ) ; strreplace ( sb -> s_id , '/' , '!' ) ; ret = - EINVAL ; blocksize = sb_min_blocksize ( sb , EXT4_MIN_BLOCK_SIZE ) ; if ( ! blocksize ) { ext4_msg ( sb , KERN_ERR , "unable<S2SV_blank>to<S2SV_blank>set<S2SV_blank>blocksize" ) ; goto out_fail ; } if ( blocksize != EXT4_MIN_BLOCK_SIZE ) { logical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE ; offset = do_div ( logical_sb_block , blocksize ) ; } else { logical_sb_block = sb_block ; } if ( ! ( bh = sb_bread_unmovable ( sb , logical_sb_block ) ) ) { ext4_msg ( sb , KERN_ERR , "unable<S2SV_blank>to<S2SV_blank>read<S2SV_blank>superblock" ) ; goto out_fail ; } es = ( struct ext4_super_block * ) ( bh -> b_data + offset ) ; sbi -> s_es = es ; sb -> s_magic = le16_to_cpu ( es -> s_magic ) ; if ( sb -> s_magic != EXT4_SUPER_MAGIC ) goto cantfind_ext4 ; sbi -> s_kbytes_written = le64_to_cpu ( es -> s_kbytes_written ) ; if ( ext4_has_feature_metadata_csum ( sb ) && ext4_has_feature_gdt_csum ( sb ) ) ext4_warning ( sb , "metadata_csum<S2SV_blank>and<S2SV_blank>uninit_bg<S2SV_blank>are<S2SV_blank>" "redundant<S2SV_blank>flags;<S2SV_blank>please<S2SV_blank>run<S2SV_blank>fsck." ) ; if ( ! ext4_verify_csum_type ( sb , es ) ) { ext4_msg ( sb , KERN_ERR , "VFS:<S2SV_blank>Found<S2SV_blank>ext4<S2SV_blank>filesystem<S2SV_blank>with<S2SV_blank>" "unknown<S2SV_blank>checksum<S2SV_blank>algorithm." ) ; silent = 1 ; goto cantfind_ext4 ; } if ( ext4_has_feature_metadata_csum ( sb ) ) { sbi -> s_chksum_driver = crypto_alloc_shash ( "crc32c" , 0 , 0 ) ; if ( IS_ERR ( sbi -> s_chksum_driver ) ) { ext4_msg ( sb , KERN_ERR , "Cannot<S2SV_blank>load<S2SV_blank>crc32c<S2SV_blank>driver." ) ; ret = PTR_ERR ( sbi -> s_chksum_driver ) ; sbi -> s_chksum_driver = NULL ; goto failed_mount ; } } if ( ! ext4_superblock_csum_verify ( sb , es ) ) { ext4_msg ( sb , KERN_ERR , "VFS:<S2SV_blank>Found<S2SV_blank>ext4<S2SV_blank>filesystem<S2SV_blank>with<S2SV_blank>" "invalid<S2SV_blank>superblock<S2SV_blank>checksum.<S2SV_blank><S2SV_blank>Run<S2SV_blank>e2fsck?" ) ; silent = 1 ; ret = - EFSBADCRC ; goto cantfind_ext4 ; } if ( ext4_has_feature_csum_seed ( sb ) ) sbi -> s_csum_seed = le32_to_cpu ( es -> s_checksum_seed ) ; else if ( ext4_has_metadata_csum ( sb ) ) sbi -> s_csum_seed = ext4_chksum ( sbi , ~ 0 , es -> s_uuid , sizeof ( es -> s_uuid ) ) ; def_mount_opts = le32_to_cpu ( es -> s_default_mount_opts ) ; set_opt ( sb , INIT_INODE_TABLE ) ; if ( def_mount_opts & EXT4_DEFM_DEBUG ) set_opt ( sb , DEBUG ) ; if ( def_mount_opts & EXT4_DEFM_BSDGROUPS ) set_opt ( sb , GRPID ) ; if ( def_mount_opts & EXT4_DEFM_UID16 ) set_opt ( sb , NO_UID32 ) ; set_opt ( sb , XATTR_USER ) ; # ifdef CONFIG_EXT4_FS_POSIX_ACL set_opt ( sb , POSIX_ACL ) ; # endif if ( ext4_has_metadata_csum ( sb ) ) set_opt ( sb , JOURNAL_CHECKSUM ) ; if ( ( def_mount_opts & EXT4_DEFM_JMODE ) == EXT4_DEFM_JMODE_DATA ) set_opt ( sb , JOURNAL_DATA ) ; else if ( ( def_mount_opts & EXT4_DEFM_JMODE ) == EXT4_DEFM_JMODE_ORDERED ) set_opt ( sb , ORDERED_DATA ) ; else if ( ( def_mount_opts & EXT4_DEFM_JMODE ) == EXT4_DEFM_JMODE_WBACK ) set_opt ( sb , WRITEBACK_DATA ) ; if ( le16_to_cpu ( sbi -> s_es -> s_errors ) == EXT4_ERRORS_PANIC ) set_opt ( sb , ERRORS_PANIC ) ; else if ( le16_to_cpu ( sbi -> s_es -> s_errors ) == EXT4_ERRORS_CONTINUE ) set_opt ( sb , ERRORS_CONT ) ; else set_opt ( sb , ERRORS_RO ) ; set_opt ( sb , BLOCK_VALIDITY ) ; if ( def_mount_opts & EXT4_DEFM_DISCARD ) set_opt ( sb , DISCARD ) ; sbi -> s_resuid = make_kuid ( & init_user_ns , le16_to_cpu ( es -> s_def_resuid ) ) ; sbi -> s_resgid = make_kgid ( & init_user_ns , le16_to_cpu ( es -> s_def_resgid ) ) ; sbi -> s_commit_interval = JBD2_DEFAULT_MAX_COMMIT_AGE * HZ ; sbi -> s_min_batch_time = EXT4_DEF_MIN_BATCH_TIME ; sbi -> s_max_batch_time = EXT4_DEF_MAX_BATCH_TIME ; if ( ( def_mount_opts & EXT4_DEFM_NOBARRIER ) == 0 ) set_opt ( sb , BARRIER ) ; if ( ! IS_EXT3_SB ( sb ) && ! IS_EXT2_SB ( sb ) && ( ( def_mount_opts & EXT4_DEFM_NODELALLOC ) == 0 ) ) set_opt ( sb , DELALLOC ) ; sbi -> s_li_wait_mult = EXT4_DEF_LI_WAIT_MULT ; if ( sbi -> s_es -> s_mount_opts [ 0 ] ) { char * s_mount_opts = kstrndup ( sbi -> s_es -> s_mount_opts , sizeof ( sbi -> s_es -> s_mount_opts ) , GFP_KERNEL ) ; if ( ! s_mount_opts ) goto failed_mount ; if ( ! parse_options ( s_mount_opts , sb , & journal_devnum , & journal_ioprio , 0 ) ) { ext4_msg ( sb , KERN_WARNING , "failed<S2SV_blank>to<S2SV_blank>parse<S2SV_blank>options<S2SV_blank>in<S2SV_blank>superblock:<S2SV_blank>%s" , s_mount_opts ) ; } kfree ( s_mount_opts ) ; } sbi -> s_def_mount_opt = sbi -> s_mount_opt ; if ( ! parse_options ( ( char * ) data , sb , & journal_devnum , & journal_ioprio , 0 ) ) goto failed_mount ; if ( test_opt ( sb , DATA_FLAGS ) == EXT4_MOUNT_JOURNAL_DATA ) { printk_once ( KERN_WARNING "EXT4-fs:<S2SV_blank>Warning:<S2SV_blank>mounting<S2SV_blank>" "with<S2SV_blank>data=journal<S2SV_blank>disables<S2SV_blank>delayed<S2SV_blank>" "allocation<S2SV_blank>and<S2SV_blank>O_DIRECT<S2SV_blank>support!\\n" ) ; if ( test_opt2 ( sb , EXPLICIT_DELALLOC ) ) { ext4_msg ( sb , KERN_ERR , "can\'t<S2SV_blank>mount<S2SV_blank>with<S2SV_blank>" "both<S2SV_blank>data=journal<S2SV_blank>and<S2SV_blank>delalloc" ) ; goto failed_mount ; } if ( test_opt ( sb , DIOREAD_NOLOCK ) ) { ext4_msg ( sb , KERN_ERR , "can\'t<S2SV_blank>mount<S2SV_blank>with<S2SV_blank>" "both<S2SV_blank>data=journal<S2SV_blank>and<S2SV_blank>dioread_nolock" ) ; goto failed_mount ; } if ( test_opt ( sb , DAX ) ) { ext4_msg ( sb , KERN_ERR , "can\'t<S2SV_blank>mount<S2SV_blank>with<S2SV_blank>" "both<S2SV_blank>data=journal<S2SV_blank>and<S2SV_blank>dax" ) ; goto failed_mount ; } if ( test_opt ( sb , DELALLOC ) ) clear_opt ( sb , DELALLOC ) ; } else { sb -> s_iflags |= SB_I_CGROUPWB ; } sb -> s_flags = ( sb -> s_flags & ~ MS_POSIXACL ) | ( test_opt ( sb , POSIX_ACL ) ? MS_POSIXACL : 0 ) ; if ( le32_to_cpu ( es -> s_rev_level ) == EXT4_GOOD_OLD_REV && ( ext4_has_compat_features ( sb ) || ext4_has_ro_compat_features ( sb ) || ext4_has_incompat_features ( sb ) ) ) ext4_msg ( sb , KERN_WARNING , "feature<S2SV_blank>flags<S2SV_blank>set<S2SV_blank>on<S2SV_blank>rev<S2SV_blank>0<S2SV_blank>fs,<S2SV_blank>" "running<S2SV_blank>e2fsck<S2SV_blank>is<S2SV_blank>recommended" ) ; if ( es -> s_creator_os == cpu_to_le32 ( EXT4_OS_HURD ) ) { set_opt2 ( sb , HURD_COMPAT ) ; if ( ext4_has_feature_64bit ( sb ) ) { ext4_msg ( sb , KERN_ERR , "The<S2SV_blank>Hurd<S2SV_blank>can\'t<S2SV_blank>support<S2SV_blank>64-bit<S2SV_blank>file<S2SV_blank>systems" ) ; goto failed_mount ; } } if ( IS_EXT2_SB ( sb ) ) { if ( ext2_feature_set_ok ( sb ) ) ext4_msg ( sb , KERN_INFO , "mounting<S2SV_blank>ext2<S2SV_blank>file<S2SV_blank>system<S2SV_blank>" "using<S2SV_blank>the<S2SV_blank>ext4<S2SV_blank>subsystem" ) ; else { ext4_msg ( sb , KERN_ERR , "couldn\'t<S2SV_blank>mount<S2SV_blank>as<S2SV_blank>ext2<S2SV_blank>due<S2SV_blank>" "to<S2SV_blank>feature<S2SV_blank>incompatibilities" ) ; goto failed_mount ; } } if ( IS_EXT3_SB ( sb ) ) { if ( ext3_feature_set_ok ( sb ) ) ext4_msg ( sb , KERN_INFO , "mounting<S2SV_blank>ext3<S2SV_blank>file<S2SV_blank>system<S2SV_blank>" "using<S2SV_blank>the<S2SV_blank>ext4<S2SV_blank>subsystem" ) ; else { ext4_msg ( sb , KERN_ERR , "couldn\'t<S2SV_blank>mount<S2SV_blank>as<S2SV_blank>ext3<S2SV_blank>due<S2SV_blank>" "to<S2SV_blank>feature<S2SV_blank>incompatibilities" ) ; goto failed_mount ; } } if ( ! ext4_feature_set_ok ( sb , ( sb -> s_flags & MS_RDONLY ) ) ) goto failed_mount ; blocksize = BLOCK_SIZE << le32_to_cpu ( es -> s_log_block_size ) ; if ( blocksize < EXT4_MIN_BLOCK_SIZE || blocksize > EXT4_MAX_BLOCK_SIZE ) { ext4_msg ( sb , KERN_ERR , "Unsupported<S2SV_blank>filesystem<S2SV_blank>blocksize<S2SV_blank>%d<S2SV_blank>(%d<S2SV_blank>log_block_size)" , blocksize , le32_to_cpu ( es -> s_log_block_size ) ) ; goto failed_mount ; } if ( le32_to_cpu ( es -> s_log_block_size ) > ( EXT4_MAX_BLOCK_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE ) ) { ext4_msg ( sb , KERN_ERR , "Invalid<S2SV_blank>log<S2SV_blank>block<S2SV_blank>size:<S2SV_blank>%u" , le32_to_cpu ( es -> s_log_block_size ) ) ; goto failed_mount ; } if ( le16_to_cpu ( sbi -> s_es -> s_reserved_gdt_blocks ) > ( blocksize / 4 ) ) { ext4_msg ( sb , KERN_ERR , "Number<S2SV_blank>of<S2SV_blank>reserved<S2SV_blank>GDT<S2SV_blank>blocks<S2SV_blank>insanely<S2SV_blank>large:<S2SV_blank>%d" , le16_to_cpu ( sbi -> s_es -> s_reserved_gdt_blocks ) ) ; goto failed_mount ; } if ( sbi -> s_mount_opt & EXT4_MOUNT_DAX ) { err = bdev_dax_supported ( sb , blocksize ) ; if ( err ) goto failed_mount ; } if ( ext4_has_feature_encrypt ( sb ) && es -> s_encryption_level ) { ext4_msg ( sb , KERN_ERR , "Unsupported<S2SV_blank>encryption<S2SV_blank>level<S2SV_blank>%d" , es -> s_encryption_level ) ; goto failed_mount ; } if ( sb -> s_blocksize != blocksize ) { if ( ! sb_set_blocksize ( sb , blocksize ) ) { ext4_msg ( sb , KERN_ERR , "bad<S2SV_blank>block<S2SV_blank>size<S2SV_blank>%d" , blocksize ) ; goto failed_mount ; } brelse ( bh ) ; logical_sb_block = sb_block * EXT4_MIN_BLOCK_SIZE ; offset = do_div ( logical_sb_block , blocksize ) ; bh = sb_bread_unmovable ( sb , logical_sb_block ) ; if ( ! bh ) { ext4_msg ( sb , KERN_ERR , "Can\'t<S2SV_blank>read<S2SV_blank>superblock<S2SV_blank>on<S2SV_blank>2nd<S2SV_blank>try" ) ; goto failed_mount ; } es = ( struct ext4_super_block * ) ( bh -> b_data + offset ) ; sbi -> s_es = es ; if ( es -> s_magic != cpu_to_le16 ( EXT4_SUPER_MAGIC ) ) { ext4_msg ( sb , KERN_ERR , "Magic<S2SV_blank>mismatch,<S2SV_blank>very<S2SV_blank>weird!" ) ; goto failed_mount ; } } has_huge_files = ext4_has_feature_huge_file ( sb ) ; sbi -> s_bitmap_maxbytes = ext4_max_bitmap_size ( sb -> s_blocksize_bits , has_huge_files ) ; sb -> s_maxbytes = ext4_max_size ( sb -> s_blocksize_bits , has_huge_files ) ; if ( le32_to_cpu ( es -> s_rev_level ) == EXT4_GOOD_OLD_REV ) { sbi -> s_inode_size = EXT4_GOOD_OLD_INODE_SIZE ; sbi -> s_first_ino = EXT4_GOOD_OLD_FIRST_INO ; } else { sbi -> s_inode_size = le16_to_cpu ( es -> s_inode_size ) ; sbi -> s_first_ino = le32_to_cpu ( es -> s_first_ino ) ; if ( ( sbi -> s_inode_size < EXT4_GOOD_OLD_INODE_SIZE ) || ( ! is_power_of_2 ( sbi -> s_inode_size ) ) || ( sbi -> s_inode_size > blocksize ) ) { ext4_msg ( sb , KERN_ERR , "unsupported<S2SV_blank>inode<S2SV_blank>size:<S2SV_blank>%d" , sbi -> s_inode_size ) ; goto failed_mount ; } if ( sbi -> s_inode_size > EXT4_GOOD_OLD_INODE_SIZE ) sb -> s_time_gran = 1 << ( EXT4_EPOCH_BITS - 2 ) ; } sbi -> s_desc_size = le16_to_cpu ( es -> s_desc_size ) ; if ( ext4_has_feature_64bit ( sb ) ) { if ( sbi -> s_desc_size < EXT4_MIN_DESC_SIZE_64BIT || sbi -> s_desc_size > EXT4_MAX_DESC_SIZE || ! is_power_of_2 ( sbi -> s_desc_size ) ) { ext4_msg ( sb , KERN_ERR , "unsupported<S2SV_blank>descriptor<S2SV_blank>size<S2SV_blank>%lu" , sbi -> s_desc_size ) ; goto failed_mount ; } } else sbi -> s_desc_size = EXT4_MIN_DESC_SIZE ; sbi -> s_blocks_per_group = le32_to_cpu ( es -> s_blocks_per_group ) ; sbi -> s_inodes_per_group = le32_to_cpu ( es -> s_inodes_per_group ) ; sbi -> s_inodes_per_block = blocksize / EXT4_INODE_SIZE ( sb ) ; if ( sbi -> s_inodes_per_block == 0 ) goto cantfind_ext4 ; if ( sbi -> s_inodes_per_group < sbi -> s_inodes_per_block || sbi -> s_inodes_per_group > blocksize * 8 ) { ext4_msg ( sb , KERN_ERR , "invalid<S2SV_blank>inodes<S2SV_blank>per<S2SV_blank>group:<S2SV_blank>%lu\\n" , sbi -> s_blocks_per_group ) ; goto failed_mount ; } sbi -> s_itb_per_group = sbi -> s_inodes_per_group / sbi -> s_inodes_per_block ; sbi -> s_desc_per_block = blocksize / EXT4_DESC_SIZE ( sb ) ; sbi -> s_sbh = bh ; sbi -> s_mount_state = le16_to_cpu ( es -> s_state ) ; sbi -> s_addr_per_block_bits = ilog2 ( EXT4_ADDR_PER_BLOCK ( sb ) ) ; sbi -> s_desc_per_block_bits = ilog2 ( EXT4_DESC_PER_BLOCK ( sb ) ) ; for ( i = 0 ; i < 4 ; i ++ ) sbi -> s_hash_seed [ i ] = le32_to_cpu ( es -> s_hash_seed [ i ] ) ; sbi -> s_def_hash_version = es -> s_def_hash_version ; if ( ext4_has_feature_dir_index ( sb ) ) { i = le32_to_cpu ( es -> s_flags ) ; if ( i & EXT2_FLAGS_UNSIGNED_HASH ) sbi -> s_hash_unsigned = 3 ; else if ( ( i & EXT2_FLAGS_SIGNED_HASH ) == 0 ) { # ifdef __CHAR_UNSIGNED__ if ( ! ( sb -> s_flags & MS_RDONLY ) ) es -> s_flags |= cpu_to_le32 ( EXT2_FLAGS_UNSIGNED_HASH ) ; sbi -> s_hash_unsigned = 3 ; # else if ( ! ( sb -> s_flags & MS_RDONLY ) ) es -> s_flags |= cpu_to_le32 ( EXT2_FLAGS_SIGNED_HASH ) ; # endif } } clustersize = BLOCK_SIZE << le32_to_cpu ( es -> s_log_cluster_size ) ; has_bigalloc = ext4_has_feature_bigalloc ( sb ) ; if ( has_bigalloc ) { if ( clustersize < blocksize ) { ext4_msg ( sb , KERN_ERR , "cluster<S2SV_blank>size<S2SV_blank>(%d)<S2SV_blank>smaller<S2SV_blank>than<S2SV_blank>" "block<S2SV_blank>size<S2SV_blank>(%d)" , clustersize , blocksize ) ; goto failed_mount ; } if ( le32_to_cpu ( es -> s_log_cluster_size ) > ( EXT4_MAX_CLUSTER_LOG_SIZE - EXT4_MIN_BLOCK_LOG_SIZE ) ) { ext4_msg ( sb , KERN_ERR , "Invalid<S2SV_blank>log<S2SV_blank>cluster<S2SV_blank>size:<S2SV_blank>%u" , le32_to_cpu ( es -> s_log_cluster_size ) ) ; goto failed_mount ; } sbi -> s_cluster_bits = le32_to_cpu ( es -> s_log_cluster_size ) - le32_to_cpu ( es -> s_log_block_size ) ; sbi -> s_clusters_per_group = le32_to_cpu ( es -> s_clusters_per_group ) ; if ( sbi -> s_clusters_per_group > blocksize * 8 ) { ext4_msg ( sb , KERN_ERR , "#clusters<S2SV_blank>per<S2SV_blank>group<S2SV_blank>too<S2SV_blank>big:<S2SV_blank>%lu" , sbi -> s_clusters_per_group ) ; goto failed_mount ; } if ( sbi -> s_blocks_per_group != ( sbi -> s_clusters_per_group * ( clustersize / blocksize ) ) ) { ext4_msg ( sb , KERN_ERR , "blocks<S2SV_blank>per<S2SV_blank>group<S2SV_blank>(%lu)<S2SV_blank>and<S2SV_blank>" "clusters<S2SV_blank>per<S2SV_blank>group<S2SV_blank>(%lu)<S2SV_blank>inconsistent" , sbi -> s_blocks_per_group , sbi -> s_clusters_per_group ) ; goto failed_mount ; } } else { if ( clustersize != blocksize ) { ext4_warning ( sb , "fragment/cluster<S2SV_blank>size<S2SV_blank>(%d)<S2SV_blank>!=<S2SV_blank>" "block<S2SV_blank>size<S2SV_blank>(%d)" , clustersize , blocksize ) ; clustersize = blocksize ; } if ( sbi -> s_blocks_per_group > blocksize * 8 ) { ext4_msg ( sb , KERN_ERR , "#blocks<S2SV_blank>per<S2SV_blank>group<S2SV_blank>too<S2SV_blank>big:<S2SV_blank>%lu" , sbi -> s_blocks_per_group ) ; goto failed_mount ; } sbi -> s_clusters_per_group = sbi -> s_blocks_per_group ; sbi -> s_cluster_bits = 0 ; } sbi -> s_cluster_ratio = clustersize / blocksize ; if ( sbi -> s_blocks_per_group == clustersize << 3 ) set_opt2 ( sb , STD_GROUP_SIZE ) ; err = generic_check_addressable ( sb -> s_blocksize_bits , ext4_blocks_count ( es ) ) ; if ( err ) { ext4_msg ( sb , KERN_ERR , "filesystem" "<S2SV_blank>too<S2SV_blank>large<S2SV_blank>to<S2SV_blank>mount<S2SV_blank>safely<S2SV_blank>on<S2SV_blank>this<S2SV_blank>system" ) ; if ( sizeof ( sector_t ) < 8 ) ext4_msg ( sb , KERN_WARNING , "CONFIG_LBDAF<S2SV_blank>not<S2SV_blank>enabled" ) ; goto failed_mount ; } if ( EXT4_BLOCKS_PER_GROUP ( sb ) == 0 ) goto cantfind_ext4 ; blocks_count = sb -> s_bdev -> bd_inode -> i_size >> sb -> s_blocksize_bits ; if ( blocks_count && ext4_blocks_count ( es ) > blocks_count ) { ext4_msg ( sb , KERN_WARNING , "bad<S2SV_blank>geometry:<S2SV_blank>block<S2SV_blank>count<S2SV_blank>%llu<S2SV_blank>" "exceeds<S2SV_blank>size<S2SV_blank>of<S2SV_blank>device<S2SV_blank>(%llu<S2SV_blank>blocks)" , ext4_blocks_count ( es ) , blocks_count ) ; goto failed_mount ; } if ( le32_to_cpu ( es -> s_first_data_block ) >= ext4_blocks_count ( es ) ) { ext4_msg ( sb , KERN_WARNING , "bad<S2SV_blank>geometry:<S2SV_blank>first<S2SV_blank>data<S2SV_blank>" "block<S2SV_blank>%u<S2SV_blank>is<S2SV_blank>beyond<S2SV_blank>end<S2SV_blank>of<S2SV_blank>filesystem<S2SV_blank>(%llu)" , le32_to_cpu ( es -> s_first_data_block ) , ext4_blocks_count ( es ) ) ; goto failed_mount ; } blocks_count = ( ext4_blocks_count ( es ) - le32_to_cpu ( es -> s_first_data_block ) + EXT4_BLOCKS_PER_GROUP ( sb ) - 1 ) ; do_div ( blocks_count , EXT4_BLOCKS_PER_GROUP ( sb ) ) ; if ( blocks_count > ( ( uint64_t ) 1 << 32 ) - EXT4_DESC_PER_BLOCK ( sb ) ) { ext4_msg ( sb , KERN_WARNING , "groups<S2SV_blank>count<S2SV_blank>too<S2SV_blank>large:<S2SV_blank>%u<S2SV_blank>" "(block<S2SV_blank>count<S2SV_blank>%llu,<S2SV_blank>first<S2SV_blank>data<S2SV_blank>block<S2SV_blank>%u,<S2SV_blank>" "blocks<S2SV_blank>per<S2SV_blank>group<S2SV_blank>%lu)" , sbi -> s_groups_count , ext4_blocks_count ( es ) , le32_to_cpu ( es -> s_first_data_block ) , EXT4_BLOCKS_PER_GROUP ( sb ) ) ; goto failed_mount ; } sbi -> s_groups_count = blocks_count ; sbi -> s_blockfile_groups = min_t ( ext4_group_t , sbi -> s_groups_count , ( EXT4_MAX_BLOCK_FILE_PHYS / EXT4_BLOCKS_PER_GROUP ( sb ) ) ) ; db_count = ( sbi -> s_groups_count + EXT4_DESC_PER_BLOCK ( sb ) - 1 ) / <S2SV_StartBug> EXT4_DESC_PER_BLOCK ( sb ) ; <S2SV_EndBug> sbi -> s_group_desc = ext4_kvmalloc ( db_count * sizeof ( struct buffer_head * ) , GFP_KERNEL ) ; if ( sbi -> s_group_desc == NULL ) { ext4_msg ( sb , KERN_ERR , "not<S2SV_blank>enough<S2SV_blank>memory" ) ; ret = - ENOMEM ; goto failed_mount ; } bgl_lock_init ( sbi -> s_blockgroup_lock ) ; for ( i = 0 ; i < db_count ; i ++ ) { block = descriptor_loc ( sb , logical_sb_block , i ) ; sbi -> s_group_desc [ i ] = sb_bread_unmovable ( sb , block ) ; if ( ! sbi -> s_group_desc [ i ] ) { ext4_msg ( sb , KERN_ERR , "can\'t<S2SV_blank>read<S2SV_blank>group<S2SV_blank>descriptor<S2SV_blank>%d" , i ) ; db_count = i ; goto failed_mount2 ; } } if ( ! ext4_check_descriptors ( sb , logical_sb_block , & first_not_zeroed ) ) { ext4_msg ( sb , KERN_ERR , "group<S2SV_blank>descriptors<S2SV_blank>corrupted!" ) ; ret = - EFSCORRUPTED ; goto failed_mount2 ; } sbi -> s_gdb_count = db_count ; get_random_bytes ( & sbi -> s_next_generation , sizeof ( u32 ) ) ; spin_lock_init ( & sbi -> s_next_gen_lock ) ; setup_timer ( & sbi -> s_err_report , print_daily_error_info , ( unsigned long ) sb ) ; if ( ext4_es_register_shrinker ( sbi ) ) goto failed_mount3 ; sbi -> s_stripe = ext4_get_stripe_size ( sbi ) ; sbi -> s_extent_max_zeroout_kb = 32 ; sb -> s_op = & ext4_sops ; sb -> s_export_op = & ext4_export_ops ; sb -> s_xattr = ext4_xattr_handlers ; sb -> s_cop = & ext4_cryptops ; # ifdef CONFIG_QUOTA sb -> dq_op = & ext4_quota_operations ; if ( ext4_has_feature_quota ( sb ) ) sb -> s_qcop = & dquot_quotactl_sysfile_ops ; else sb -> s_qcop = & ext4_qctl_operations ; sb -> s_quota_types = QTYPE_MASK_USR | QTYPE_MASK_GRP | QTYPE_MASK_PRJ ; # endif memcpy ( sb -> s_uuid , es -> s_uuid , sizeof ( es -> s_uuid ) ) ; INIT_LIST_HEAD ( & sbi -> s_orphan ) ; mutex_init ( & sbi -> s_orphan_lock ) ; sb -> s_root = NULL ; needs_recovery = ( es -> s_last_orphan != 0 || ext4_has_feature_journal_needs_recovery ( sb ) ) ; if ( ext4_has_feature_mmp ( sb ) && ! ( sb -> s_flags & MS_RDONLY ) ) if ( ext4_multi_mount_protect ( sb , le64_to_cpu ( es -> s_mmp_block ) ) ) goto failed_mount3a ; if ( ! test_opt ( sb , NOLOAD ) && ext4_has_feature_journal ( sb ) ) { if ( ext4_load_journal ( sb , es , journal_devnum ) ) goto failed_mount3a ; } else if ( test_opt ( sb , NOLOAD ) && ! ( sb -> s_flags & MS_RDONLY ) && ext4_has_feature_journal_needs_recovery ( sb ) ) { ext4_msg ( sb , KERN_ERR , "required<S2SV_blank>journal<S2SV_blank>recovery<S2SV_blank>" "suppressed<S2SV_blank>and<S2SV_blank>not<S2SV_blank>mounted<S2SV_blank>read-only" ) ; goto failed_mount_wq ; } else { if ( test_opt2 ( sb , EXPLICIT_JOURNAL_CHECKSUM ) ) { ext4_msg ( sb , KERN_ERR , "can\'t<S2SV_blank>mount<S2SV_blank>with<S2SV_blank>" "journal_checksum,<S2SV_blank>fs<S2SV_blank>mounted<S2SV_blank>w/o<S2SV_blank>journal" ) ; goto failed_mount_wq ; } if ( test_opt ( sb , JOURNAL_ASYNC_COMMIT ) ) { ext4_msg ( sb , KERN_ERR , "can\'t<S2SV_blank>mount<S2SV_blank>with<S2SV_blank>" "journal_async_commit,<S2SV_blank>fs<S2SV_blank>mounted<S2SV_blank>w/o<S2SV_blank>journal" ) ; goto failed_mount_wq ; } if ( sbi -> s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE * HZ ) { ext4_msg ( sb , KERN_ERR , "can\'t<S2SV_blank>mount<S2SV_blank>with<S2SV_blank>" "commit=%lu,<S2SV_blank>fs<S2SV_blank>mounted<S2SV_blank>w/o<S2SV_blank>journal" , sbi -> s_commit_interval / HZ ) ; goto failed_mount_wq ; } if ( EXT4_MOUNT_DATA_FLAGS & ( sbi -> s_mount_opt ^ sbi -> s_def_mount_opt ) ) { ext4_msg ( sb , KERN_ERR , "can\'t<S2SV_blank>mount<S2SV_blank>with<S2SV_blank>" "data=,<S2SV_blank>fs<S2SV_blank>mounted<S2SV_blank>w/o<S2SV_blank>journal" ) ; goto failed_mount_wq ; } sbi -> s_def_mount_opt &= EXT4_MOUNT_JOURNAL_CHECKSUM ; clear_opt ( sb , JOURNAL_CHECKSUM ) ; clear_opt ( sb , DATA_FLAGS ) ; sbi -> s_journal = NULL ; needs_recovery = 0 ; goto no_journal ; } if ( ext4_has_feature_64bit ( sb ) && ! jbd2_journal_set_features ( EXT4_SB ( sb ) -> s_journal , 0 , 0 , JBD2_FEATURE_INCOMPAT_64BIT ) ) { ext4_msg ( sb , KERN_ERR , "Failed<S2SV_blank>to<S2SV_blank>set<S2SV_blank>64-bit<S2SV_blank>journal<S2SV_blank>feature" ) ; goto failed_mount_wq ; } if ( ! set_journal_csum_feature_set ( sb ) ) { ext4_msg ( sb , KERN_ERR , "Failed<S2SV_blank>to<S2SV_blank>set<S2SV_blank>journal<S2SV_blank>checksum<S2SV_blank>" "feature<S2SV_blank>set" ) ; goto failed_mount_wq ; } switch ( test_opt ( sb , DATA_FLAGS ) ) { case 0 : if ( jbd2_journal_check_available_features ( sbi -> s_journal , 0 , 0 , JBD2_FEATURE_INCOMPAT_REVOKE ) ) set_opt ( sb , ORDERED_DATA ) ; else set_opt ( sb , JOURNAL_DATA ) ; break ; case EXT4_MOUNT_ORDERED_DATA : case EXT4_MOUNT_WRITEBACK_DATA : if ( ! jbd2_journal_check_available_features ( sbi -> s_journal , 0 , 0 , JBD2_FEATURE_INCOMPAT_REVOKE ) ) { ext4_msg ( sb , KERN_ERR , "Journal<S2SV_blank>does<S2SV_blank>not<S2SV_blank>support<S2SV_blank>" "requested<S2SV_blank>data<S2SV_blank>journaling<S2SV_blank>mode" ) ; goto failed_mount_wq ; } default : break ; } set_task_ioprio ( sbi -> s_journal -> j_task , journal_ioprio ) ; sbi -> s_journal -> j_commit_callback = ext4_journal_commit_callback ; no_journal : sbi -> s_mb_cache = ext4_xattr_create_cache ( ) ; if ( ! sbi -> s_mb_cache ) { ext4_msg ( sb , KERN_ERR , "Failed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>an<S2SV_blank>mb_cache" ) ; goto failed_mount_wq ; } if ( ( DUMMY_ENCRYPTION_ENABLED ( sbi ) || ext4_has_feature_encrypt ( sb ) ) && ( blocksize != PAGE_SIZE ) ) { ext4_msg ( sb , KERN_ERR , "Unsupported<S2SV_blank>blocksize<S2SV_blank>for<S2SV_blank>fs<S2SV_blank>encryption" ) ; goto failed_mount_wq ; } if ( DUMMY_ENCRYPTION_ENABLED ( sbi ) && ! ( sb -> s_flags & MS_RDONLY ) && ! ext4_has_feature_encrypt ( sb ) ) { ext4_set_feature_encrypt ( sb ) ; ext4_commit_super ( sb , 1 ) ; } if ( es -> s_overhead_clusters ) sbi -> s_overhead = le32_to_cpu ( es -> s_overhead_clusters ) ; else { err = ext4_calculate_overhead ( sb ) ; if ( err ) goto failed_mount_wq ; } EXT4_SB ( sb ) -> rsv_conversion_wq = alloc_workqueue ( "ext4-rsv-conversion" , WQ_MEM_RECLAIM | WQ_UNBOUND , 1 ) ; if ( ! EXT4_SB ( sb ) -> rsv_conversion_wq ) { printk ( KERN_ERR "EXT4-fs:<S2SV_blank>failed<S2SV_blank>to<S2SV_blank>create<S2SV_blank>workqueue\\n" ) ; ret = - ENOMEM ; goto failed_mount4 ; } root = ext4_iget ( sb , EXT4_ROOT_INO ) ; if ( IS_ERR ( root ) ) { ext4_msg ( sb , KERN_ERR , "get<S2SV_blank>root<S2SV_blank>inode<S2SV_blank>failed" ) ; ret = PTR_ERR ( root ) ; root = NULL ; goto failed_mount4 ; } if ( ! S_ISDIR ( root -> i_mode ) || ! root -> i_blocks || ! root -> i_size ) { ext4_msg ( sb , KERN_ERR , "corrupt<S2SV_blank>root<S2SV_blank>inode,<S2SV_blank>run<S2SV_blank>e2fsck" ) ; iput ( root ) ; goto failed_mount4 ; } sb -> s_root = d_make_root ( root ) ; if ( ! sb -> s_root ) { ext4_msg ( sb , KERN_ERR , "get<S2SV_blank>root<S2SV_blank>dentry<S2SV_blank>failed" ) ; ret = - ENOMEM ; goto failed_mount4 ; } if ( ext4_setup_super ( sb , es , sb -> s_flags & MS_RDONLY ) ) sb -> s_flags |= MS_RDONLY ; if ( sbi -> s_inode_size > EXT4_GOOD_OLD_INODE_SIZE ) { sbi -> s_want_extra_isize = sizeof ( struct ext4_inode ) - EXT4_GOOD_OLD_INODE_SIZE ; if ( ext4_has_feature_extra_isize ( sb ) ) { if ( sbi -> s_want_extra_isize < le16_to_cpu ( es -> s_want_extra_isize ) ) sbi -> s_want_extra_isize = le16_to_cpu ( es -> s_want_extra_isize ) ; if ( sbi -> s_want_extra_isize < le16_to_cpu ( es -> s_min_extra_isize ) ) sbi -> s_want_extra_isize = le16_to_cpu ( es -> s_min_extra_isize ) ; } } if ( EXT4_GOOD_OLD_INODE_SIZE + sbi -> s_want_extra_isize > sbi -> s_inode_size ) { sbi -> s_want_extra_isize = sizeof ( struct ext4_inode ) - EXT4_GOOD_OLD_INODE_SIZE ; ext4_msg ( sb , KERN_INFO , "required<S2SV_blank>extra<S2SV_blank>inode<S2SV_blank>space<S2SV_blank>not" "available" ) ; } ext4_set_resv_clusters ( sb ) ; err = ext4_setup_system_zone ( sb ) ; if ( err ) { ext4_msg ( sb , KERN_ERR , "failed<S2SV_blank>to<S2SV_blank>initialize<S2SV_blank>system<S2SV_blank>" "zone<S2SV_blank>(%d)" , err ) ; goto failed_mount4a ; } ext4_ext_init ( sb ) ; err = ext4_mb_init ( sb ) ; if ( err ) { ext4_msg ( sb , KERN_ERR , "failed<S2SV_blank>to<S2SV_blank>initialize<S2SV_blank>mballoc<S2SV_blank>(%d)" , err ) ; goto failed_mount5 ; } block = ext4_count_free_clusters ( sb ) ; ext4_free_blocks_count_set ( sbi -> s_es , EXT4_C2B ( sbi , block ) ) ; err = percpu_counter_init ( & sbi -> s_freeclusters_counter , block , GFP_KERNEL ) ; if ( ! err ) { unsigned long freei = ext4_count_free_inodes ( sb ) ; sbi -> s_es -> s_free_inodes_count = cpu_to_le32 ( freei ) ; err = percpu_counter_init ( & sbi -> s_freeinodes_counter , freei , GFP_KERNEL ) ; } if ( ! err ) err = percpu_counter_init ( & sbi -> s_dirs_counter , ext4_count_dirs ( sb ) , GFP_KERNEL ) ; if ( ! err ) err = percpu_counter_init ( & sbi -> s_dirtyclusters_counter , 0 , GFP_KERNEL ) ; if ( ! err ) err = percpu_init_rwsem ( & sbi -> s_journal_flag_rwsem ) ; if ( err ) { ext4_msg ( sb , KERN_ERR , "insufficient<S2SV_blank>memory" ) ; goto failed_mount6 ; } if ( ext4_has_feature_flex_bg ( sb ) ) if ( ! ext4_fill_flex_info ( sb ) ) { ext4_msg ( sb , KERN_ERR , "unable<S2SV_blank>to<S2SV_blank>initialize<S2SV_blank>" "flex_bg<S2SV_blank>meta<S2SV_blank>info!" ) ; goto failed_mount6 ; } err = ext4_register_li_request ( sb , first_not_zeroed ) ; if ( err ) goto failed_mount6 ; err = ext4_register_sysfs ( sb ) ; if ( err ) goto failed_mount7 ; # ifdef CONFIG_QUOTA if ( ext4_has_feature_quota ( sb ) && ! ( sb -> s_flags & MS_RDONLY ) ) { err = ext4_enable_quotas ( sb ) ; if ( err ) goto failed_mount8 ; } # endif EXT4_SB ( sb ) -> s_mount_state |= EXT4_ORPHAN_FS ; ext4_orphan_cleanup ( sb , es ) ; EXT4_SB ( sb ) -> s_mount_state &= ~ EXT4_ORPHAN_FS ; if ( needs_recovery ) { ext4_msg ( sb , KERN_INFO , "recovery<S2SV_blank>complete" ) ; ext4_mark_recovery_complete ( sb , es ) ; } if ( EXT4_SB ( sb ) -> s_journal ) { if ( test_opt ( sb , DATA_FLAGS ) == EXT4_MOUNT_JOURNAL_DATA ) descr = "<S2SV_blank>journalled<S2SV_blank>data<S2SV_blank>mode" ; else if ( test_opt ( sb , DATA_FLAGS ) == EXT4_MOUNT_ORDERED_DATA ) descr = "<S2SV_blank>ordered<S2SV_blank>data<S2SV_blank>mode" ; else descr = "<S2SV_blank>writeback<S2SV_blank>data<S2SV_blank>mode" ; } else descr = "out<S2SV_blank>journal" ; if ( test_opt ( sb , DISCARD ) ) { struct request_queue * q = bdev_get_queue ( sb -> s_bdev ) ; if ( ! blk_queue_discard ( q ) ) ext4_msg ( sb , KERN_WARNING , "mounting<S2SV_blank>with<S2SV_blank>\\"discard\\"<S2SV_blank>option,<S2SV_blank>but<S2SV_blank>" "the<S2SV_blank>device<S2SV_blank>does<S2SV_blank>not<S2SV_blank>support<S2SV_blank>discard" ) ; } if ( ___ratelimit ( & ext4_mount_msg_ratelimit , "EXT4-fs<S2SV_blank>mount" ) ) ext4_msg ( sb , KERN_INFO , "mounted<S2SV_blank>filesystem<S2SV_blank>with%s.<S2SV_blank>" "Opts:<S2SV_blank>%.*s%s%s" , descr , ( int ) sizeof ( sbi -> s_es -> s_mount_opts ) , sbi -> s_es -> s_mount_opts , * sbi -> s_es -> s_mount_opts ? ";<S2SV_blank>" : "" , orig_data ) ; if ( es -> s_error_count ) mod_timer ( & sbi -> s_err_report , jiffies + 300 * HZ ) ; ratelimit_state_init ( & sbi -> s_err_ratelimit_state , 5 * HZ , 10 ) ; ratelimit_state_init ( & sbi -> s_warning_ratelimit_state , 5 * HZ , 10 ) ; ratelimit_state_init ( & sbi -> s_msg_ratelimit_state , 5 * HZ , 10 ) ; kfree ( orig_data ) ; # ifdef CONFIG_EXT4_FS_ENCRYPTION memcpy ( sbi -> key_prefix , EXT4_KEY_DESC_PREFIX , EXT4_KEY_DESC_PREFIX_SIZE ) ; sbi -> key_prefix_size = EXT4_KEY_DESC_PREFIX_SIZE ; # endif return 0 ; cantfind_ext4 : if ( ! silent ) ext4_msg ( sb , KERN_ERR , "VFS:<S2SV_blank>Can\'t<S2SV_blank>find<S2SV_blank>ext4<S2SV_blank>filesystem" ) ; goto failed_mount ; # ifdef CONFIG_QUOTA failed_mount8 : ext4_unregister_sysfs ( sb ) ; # endif failed_mount7 : ext4_unregister_li_request ( sb ) ; failed_mount6 : ext4_mb_release ( sb ) ; if ( sbi -> s_flex_groups ) kvfree ( sbi -> s_flex_groups ) ; percpu_counter_destroy ( & sbi -> s_freeclusters_counter ) ; percpu_counter_destroy ( & sbi -> s_freeinodes_counter ) ; percpu_counter_destroy ( & sbi -> s_dirs_counter ) ; percpu_counter_destroy ( & sbi -> s_dirtyclusters_counter ) ; failed_mount5 : ext4_ext_release ( sb ) ; ext4_release_system_zone ( sb ) ; failed_mount4a : dput ( sb -> s_root ) ; sb -> s_root = NULL ; failed_mount4 : ext4_msg ( sb , KERN_ERR , "mount<S2SV_blank>failed" ) ; if ( EXT4_SB ( sb ) -> rsv_conversion_wq ) destroy_workqueue ( EXT4_SB ( sb ) -> rsv_conversion_wq ) ; failed_mount_wq : if ( sbi -> s_mb_cache ) { ext4_xattr_destroy_cache ( sbi -> s_mb_cache ) ; sbi -> s_mb_cache = NULL ; } if ( sbi -> s_journal ) { jbd2_journal_destroy ( sbi -> s_journal ) ; sbi -> s_journal = NULL ; } failed_mount3a : ext4_es_unregister_shrinker ( sbi ) ; failed_mount3 : del_timer_sync ( & sbi -> s_err_report ) ; if ( sbi -> s_mmp_tsk ) kthread_stop ( sbi -> s_mmp_tsk ) ; failed_mount2 : for ( i = 0 ; i < db_count ; i ++ ) brelse ( sbi -> s_group_desc [ i ] ) ; kvfree ( sbi -> s_group_desc ) ; failed_mount : if ( sbi -> s_chksum_driver ) crypto_free_shash ( sbi -> s_chksum_driver ) ; # ifdef CONFIG_QUOTA for ( i = 0 ; i < EXT4_MAXQUOTAS ; i ++ ) kfree ( sbi -> s_qf_names [ i ] ) ; # endif ext4_blkdev_remove ( sbi ) ; brelse ( bh ) ; out_fail : sb -> s_fs_info = NULL ; kfree ( sbi -> s_blockgroup_lock ) ; out_free_base : kfree ( sbi ) ; kfree ( orig_data ) ; return err ? err : ret ; }
| <S2SV_ModStart> sb ) ; if ( ext4_has_feature_meta_bg ( sb ) ) { if ( le32_to_cpu ( es -> s_first_meta_bg ) >= db_count ) { ext4_msg ( sb , KERN_WARNING , "first<S2SV_blank>meta<S2SV_blank>block<S2SV_blank>group<S2SV_blank>too<S2SV_blank>large:<S2SV_blank>%u<S2SV_blank>" "(group<S2SV_blank>descriptor<S2SV_blank>block<S2SV_blank>count<S2SV_blank>%u)" , le32_to_cpu ( es -> s_first_meta_bg ) , db_count ) ; goto failed_mount ; } }
| torvalds@linux/3a4b77cd47bb837b8557595ec7425f281f2ca1fe | CVE-2016-10208 | https://github.com/torvalds/linux/commit/3a4b77cd47bb837b8557595ec7425f281f2ca1fe | 2017-02-06T06:59Z |
6,702 | CWE-476 | CWE-476 static void ov518_mode_init_regs ( struct sd * sd ) { struct gspca_dev * gspca_dev = ( struct gspca_dev * ) sd ; int hsegs , vsegs , packet_size ; struct usb_host_interface * alt ; struct usb_interface * intf ; intf = usb_ifnum_to_if ( sd -> gspca_dev . dev , sd -> gspca_dev . iface ) ; alt = usb_altnum_to_altsetting ( intf , sd -> gspca_dev . alt ) ; if ( ! alt ) { gspca_err ( gspca_dev , "Couldn\'t<S2SV_blank>get<S2SV_blank>altsetting\\n" ) ; sd -> gspca_dev . usb_err = - EIO ; return ; } <S2SV_StartBug> packet_size = le16_to_cpu ( alt -> endpoint [ 0 ] . desc . wMaxPacketSize ) ; <S2SV_EndBug> ov518_reg_w32 ( sd , R51x_FIFO_PSIZE , packet_size & ~ 7 , 2 ) ; reg_w ( sd , 0x2b , 0 ) ; reg_w ( sd , 0x2c , 0 ) ; reg_w ( sd , 0x2d , 0 ) ; reg_w ( sd , 0x2e , 0 ) ; reg_w ( sd , 0x3b , 0 ) ; reg_w ( sd , 0x3c , 0 ) ; reg_w ( sd , 0x3d , 0 ) ; reg_w ( sd , 0x3e , 0 ) ; if ( sd -> bridge == BRIDGE_OV518 ) { reg_w_mask ( sd , 0x20 , 0x08 , 0x08 ) ; reg_w_mask ( sd , 0x28 , 0x80 , 0xf0 ) ; reg_w_mask ( sd , 0x38 , 0x80 , 0xf0 ) ; } else { reg_w ( sd , 0x28 , 0x80 ) ; reg_w ( sd , 0x38 , 0x80 ) ; } hsegs = sd -> gspca_dev . pixfmt . width / 16 ; vsegs = sd -> gspca_dev . pixfmt . height / 4 ; reg_w ( sd , 0x29 , hsegs ) ; reg_w ( sd , 0x2a , vsegs ) ; reg_w ( sd , 0x39 , hsegs ) ; reg_w ( sd , 0x3a , vsegs ) ; reg_w ( sd , 0x2f , 0x80 ) ; if ( sd -> bridge == BRIDGE_OV518PLUS && sd -> revision == 0 && sd -> sensor == SEN_OV7620AE ) sd -> clockdiv = 0 ; else sd -> clockdiv = 1 ; reg_w ( sd , 0x51 , 0x04 ) ; reg_w ( sd , 0x22 , 0x18 ) ; reg_w ( sd , 0x23 , 0xff ) ; if ( sd -> bridge == BRIDGE_OV518PLUS ) { switch ( sd -> sensor ) { case SEN_OV7620AE : if ( sd -> revision > 0 && sd -> gspca_dev . pixfmt . width == 640 ) { reg_w ( sd , 0x20 , 0x60 ) ; reg_w ( sd , 0x21 , 0x1f ) ; } else { reg_w ( sd , 0x20 , 0x00 ) ; reg_w ( sd , 0x21 , 0x19 ) ; } break ; case SEN_OV7620 : reg_w ( sd , 0x20 , 0x00 ) ; reg_w ( sd , 0x21 , 0x19 ) ; break ; default : reg_w ( sd , 0x21 , 0x19 ) ; } } else reg_w ( sd , 0x71 , 0x17 ) ; i2c_w ( sd , 0x54 , 0x23 ) ; reg_w ( sd , 0x2f , 0x80 ) ; if ( sd -> bridge == BRIDGE_OV518PLUS ) { reg_w ( sd , 0x24 , 0x94 ) ; reg_w ( sd , 0x25 , 0x90 ) ; ov518_reg_w32 ( sd , 0xc4 , 400 , 2 ) ; ov518_reg_w32 ( sd , 0xc6 , 540 , 2 ) ; ov518_reg_w32 ( sd , 0xc7 , 540 , 2 ) ; ov518_reg_w32 ( sd , 0xc8 , 108 , 2 ) ; ov518_reg_w32 ( sd , 0xca , 131098 , 3 ) ; ov518_reg_w32 ( sd , 0xcb , 532 , 2 ) ; ov518_reg_w32 ( sd , 0xcc , 2400 , 2 ) ; ov518_reg_w32 ( sd , 0xcd , 32 , 2 ) ; ov518_reg_w32 ( sd , 0xce , 608 , 2 ) ; } else { reg_w ( sd , 0x24 , 0x9f ) ; reg_w ( sd , 0x25 , 0x90 ) ; ov518_reg_w32 ( sd , 0xc4 , 400 , 2 ) ; ov518_reg_w32 ( sd , 0xc6 , 381 , 2 ) ; ov518_reg_w32 ( sd , 0xc7 , 381 , 2 ) ; ov518_reg_w32 ( sd , 0xc8 , 128 , 2 ) ; ov518_reg_w32 ( sd , 0xca , 183331 , 3 ) ; ov518_reg_w32 ( sd , 0xcb , 746 , 2 ) ; ov518_reg_w32 ( sd , 0xcc , 1750 , 2 ) ; ov518_reg_w32 ( sd , 0xcd , 45 , 2 ) ; ov518_reg_w32 ( sd , 0xce , 851 , 2 ) ; } reg_w ( sd , 0x2f , 0x80 ) ; }
| <S2SV_ModStart> return ; } if ( alt -> desc . bNumEndpoints < 1 ) { sd -> gspca_dev . usb_err = - ENODEV ; return ; }
| torvalds@linux/998912346c0da53a6dbb71fab3a138586b596b30 | CVE-2020-11608 | https://github.com/torvalds/linux/commit/998912346c0da53a6dbb71fab3a138586b596b30 | 2020-04-07T14:15Z |
6,703 | CWE-264 | CWE-264 int touch_file ( const char * path , bool parents , usec_t stamp , uid_t uid , gid_t gid , mode_t mode ) { _cleanup_close_ int fd ; int r ; assert ( path ) ; if ( parents ) mkdir_parents ( path , 0755 ) ; <S2SV_StartBug> fd = open ( path , O_WRONLY | O_CREAT | O_CLOEXEC | O_NOCTTY , mode > 0 ? mode : 0644 ) ; <S2SV_EndBug> if ( fd < 0 ) return - errno ; if ( mode != MODE_INVALID ) { r = fchmod ( fd , mode ) ; if ( r < 0 ) return - errno ; } if ( uid != UID_INVALID || gid != GID_INVALID ) { r = fchown ( fd , uid , gid ) ; if ( r < 0 ) return - errno ; } if ( stamp != USEC_INFINITY ) { struct timespec ts [ 2 ] ; timespec_store ( & ts [ 0 ] , stamp ) ; ts [ 1 ] = ts [ 0 ] ; r = futimens ( fd , ts ) ; } else r = futimens ( fd , NULL ) ; if ( r < 0 ) return - errno ; return 0 ; }
| <S2SV_ModStart> | O_NOCTTY , ( mode == 0 || mode == MODE_INVALID ) ? 0644 : mode <S2SV_ModEnd> ) ; if
| systemd@systemd/06eeacb6fe029804f296b065b3ce91e796e1cd0e | CVE-2016-10156 | https://github.com/systemd/systemd/commit/06eeacb6fe029804f296b065b3ce91e796e1cd0e | 2017-01-23T07:59Z |
6,704 | CWE-264 | CWE-264 static void _isdn_setup ( struct net_device * dev ) { isdn_net_local * lp = netdev_priv ( dev ) ; ether_setup ( dev ) ; dev -> flags = IFF_NOARP | IFF_POINTOPOINT ; <S2SV_StartBug> dev -> header_ops = NULL ; <S2SV_EndBug> dev -> netdev_ops = & isdn_netdev_ops ; dev -> tx_queue_len = 30 ; lp -> p_encap = ISDN_NET_ENCAP_RAWIP ; lp -> magic = ISDN_NET_MAGIC ; lp -> last = lp ; lp -> next = lp ; lp -> isdn_device = - 1 ; lp -> isdn_channel = - 1 ; lp -> pre_device = - 1 ; lp -> pre_channel = - 1 ; lp -> exclusive = - 1 ; lp -> ppp_slot = - 1 ; lp -> pppbind = - 1 ; skb_queue_head_init ( & lp -> super_tx_queue ) ; lp -> l2_proto = ISDN_PROTO_L2_X75I ; lp -> l3_proto = ISDN_PROTO_L3_TRANS ; lp -> triggercps = 6000 ; lp -> slavedelay = 10 * HZ ; lp -> hupflags = ISDN_INHUP ; lp -> onhtime = 10 ; lp -> dialmax = 1 ; lp -> flags = ISDN_NET_CBHUP | ISDN_NET_DM_MANUAL ; lp -> cbdelay = 25 ; lp -> dialtimeout = - 1 ; lp -> dialwait = 5 * HZ ; lp -> dialstarted = 0 ; lp -> dialwait_timer = 0 ; }
| <S2SV_ModStart> ; dev -> priv_flags &= ~ IFF_TX_SKB_SHARING ; dev ->
| torvalds@linux/550fd08c2cebad61c548def135f67aba284c6162 | CVE-2011-4112 | https://github.com/torvalds/linux/commit/550fd08c2cebad61c548def135f67aba284c6162 | 2012-05-17T11:00Z |
6,705 | CWE-200 | CWE-200 static int raptor_rdfxml_parse_start ( raptor_parser * rdf_parser ) { raptor_uri * uri = rdf_parser -> base_uri ; raptor_rdfxml_parser * rdf_xml_parser ; rdf_xml_parser = ( raptor_rdfxml_parser * ) rdf_parser -> context ; if ( ! uri ) return 1 ; raptor_sax2_set_option ( rdf_xml_parser -> sax2 , RAPTOR_OPTION_NORMALIZE_LANGUAGE , NULL , RAPTOR_OPTIONS_GET_NUMERIC ( rdf_parser , RAPTOR_OPTION_NORMALIZE_LANGUAGE ) ) ; raptor_sax2_set_option ( rdf_xml_parser -> sax2 , RAPTOR_OPTION_NO_NET , NULL , RAPTOR_OPTIONS_GET_NUMERIC ( rdf_parser , RAPTOR_OPTION_NO_NET ) ) ; raptor_sax2_set_option ( rdf_xml_parser -> sax2 , RAPTOR_OPTION_NO_FILE , NULL , RAPTOR_OPTIONS_GET_NUMERIC ( rdf_parser , RAPTOR_OPTION_NO_FILE ) ) ; <S2SV_StartBug> if ( rdf_parser -> uri_filter ) <S2SV_EndBug> raptor_sax2_set_uri_filter ( rdf_xml_parser -> sax2 , rdf_parser -> uri_filter , rdf_parser -> uri_filter_user_data ) ; raptor_sax2_parse_start ( rdf_xml_parser -> sax2 , uri ) ; if ( rdf_xml_parser -> id_set ) { raptor_free_id_set ( rdf_xml_parser -> id_set ) ; rdf_xml_parser -> id_set = NULL ; } if ( RAPTOR_OPTIONS_GET_NUMERIC ( rdf_parser , RAPTOR_OPTION_CHECK_RDF_ID ) ) { rdf_xml_parser -> id_set = raptor_new_id_set ( rdf_parser -> world ) ; if ( ! rdf_xml_parser -> id_set ) return 1 ; } return 0 ; }
| <S2SV_ModStart> ) ) ; raptor_sax2_set_option ( rdf_xml_parser -> sax2 , RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES , NULL , RAPTOR_OPTIONS_GET_NUMERIC ( rdf_parser , RAPTOR_OPTION_LOAD_EXTERNAL_ENTITIES ) ) ;
| dajobe@raptor/a676f235309a59d4aa78eeffd2574ae5d341fcb0 | CVE-2012-0037 | https://github.com/dajobe/raptor/commit/a676f235309a59d4aa78eeffd2574ae5d341fcb0 | 2012-06-17T03:41Z |
6,706 | CWE-190 | CWE-190 int ip6_find_1stfragopt ( struct sk_buff * skb , u8 * * nexthdr ) { <S2SV_StartBug> u16 offset = sizeof ( struct ipv6hdr ) ; <S2SV_EndBug> unsigned int packet_len = skb_tail_pointer ( skb ) - skb_network_header ( skb ) ; int found_rhdr = 0 ; * nexthdr = & ipv6_hdr ( skb ) -> nexthdr ; while ( offset <= packet_len ) { struct ipv6_opt_hdr * exthdr ; <S2SV_StartBug> switch ( * * nexthdr ) { <S2SV_EndBug> case NEXTHDR_HOP : break ; case NEXTHDR_ROUTING : found_rhdr = 1 ; break ; case NEXTHDR_DEST : # if IS_ENABLED ( CONFIG_IPV6_MIP6 ) if ( ipv6_find_tlv ( skb , offset , IPV6_TLV_HAO ) >= 0 ) break ; # endif if ( found_rhdr ) return offset ; break ; default : return offset ; } if ( offset + sizeof ( struct ipv6_opt_hdr ) > packet_len ) return - EINVAL ; exthdr = ( struct ipv6_opt_hdr * ) ( skb_network_header ( skb ) + offset ) ; <S2SV_StartBug> offset += ipv6_optlen ( exthdr ) ; <S2SV_EndBug> * nexthdr = & exthdr -> nexthdr ; } return - EINVAL ; }
| <S2SV_ModStart> nexthdr ) { unsigned int <S2SV_ModEnd> offset = sizeof <S2SV_ModStart> * exthdr ; unsigned int len ; <S2SV_ModStart> offset ) ; len = ipv6_optlen ( exthdr ) ; if ( len + offset >= IPV6_MAXPLEN ) return - EINVAL ; offset += len <S2SV_ModEnd> ; * nexthdr
| torvalds@linux/6399f1fae4ec29fab5ec76070435555e256ca3a6 | CVE-2017-7542 | https://github.com/torvalds/linux/commit/6399f1fae4ec29fab5ec76070435555e256ca3a6 | 2017-07-21T16:29Z |
6,707 | CWE-000 | CWE-000 static Image * handle_add_command ( GraphicsManager * self , const GraphicsCommand * g , const uint8_t * payload , bool * is_dirty , uint32_t iid ) { # define ABRT ( code , ... ) { set_add_response ( # code , __VA_ARGS__ ) ; self -> loading_image = 0 ; if ( img ) img -> data_loaded = false ; return NULL ; } # define MAX_DATA_SZ ( 4u * 100000000u ) has_add_respose = false ; bool existing , init_img = true ; Image * img = NULL ; unsigned char tt = g -> transmission_type ? g -> transmission_type : 'd' ; enum FORMATS { RGB = 24 , RGBA = 32 , PNG = 100 } ; uint32_t fmt = g -> format ? g -> format : RGBA ; if ( tt == 'd' && self -> loading_image ) init_img = false ; if ( init_img ) { self -> last_init_graphics_command = * g ; self -> last_init_graphics_command . id = iid ; self -> loading_image = 0 ; if ( g -> data_width > 10000 || g -> data_height > 10000 ) ABRT ( EINVAL , "Image<S2SV_blank>too<S2SV_blank>large" ) ; remove_images ( self , add_trim_predicate , 0 ) ; img = find_or_create_image ( self , iid , & existing ) ; if ( existing ) { free_load_data ( & img -> load_data ) ; img -> data_loaded = false ; free_refs_data ( img ) ; * is_dirty = true ; self -> layers_dirty = true ; } else { img -> internal_id = internal_id_counter ++ ; img -> client_id = iid ; } img -> atime = monotonic ( ) ; img -> used_storage = 0 ; img -> width = g -> data_width ; img -> height = g -> data_height ; switch ( fmt ) { case PNG : if ( g -> data_sz > MAX_DATA_SZ ) ABRT ( EINVAL , "PNG<S2SV_blank>data<S2SV_blank>size<S2SV_blank>too<S2SV_blank>large" ) ; img -> load_data . is_4byte_aligned = true ; img -> load_data . is_opaque = false ; img -> load_data . data_sz = g -> data_sz ? g -> data_sz : 1024 * 100 ; break ; case RGB : case RGBA : img -> load_data . data_sz = ( size_t ) g -> data_width * g -> data_height * ( fmt / 8 ) ; if ( ! img -> load_data . data_sz ) ABRT ( EINVAL , "Zero<S2SV_blank>width/height<S2SV_blank>not<S2SV_blank>allowed" ) ; img -> load_data . is_4byte_aligned = fmt == RGBA || ( img -> width % 4 == 0 ) ; img -> load_data . is_opaque = fmt == RGB ; break ; default : ABRT ( EINVAL , "Unknown<S2SV_blank>image<S2SV_blank>format:<S2SV_blank>%u" , fmt ) ; } if ( tt == 'd' ) { if ( g -> more ) self -> loading_image = img -> internal_id ; img -> load_data . buf_capacity = img -> load_data . data_sz + ( g -> compressed ? 1024 : 10 ) ; img -> load_data . buf = malloc ( img -> load_data . buf_capacity ) ; img -> load_data . buf_used = 0 ; if ( img -> load_data . buf == NULL ) { ABRT ( ENOMEM , "Out<S2SV_blank>of<S2SV_blank>memory" ) ; img -> load_data . buf_capacity = 0 ; img -> load_data . buf_used = 0 ; } } } else { self -> last_init_graphics_command . more = g -> more ; self -> last_init_graphics_command . payload_sz = g -> payload_sz ; g = & self -> last_init_graphics_command ; tt = g -> transmission_type ? g -> transmission_type : 'd' ; fmt = g -> format ? g -> format : RGBA ; img = img_by_internal_id ( self , self -> loading_image ) ; if ( img == NULL ) { self -> loading_image = 0 ; ABRT ( EILSEQ , "More<S2SV_blank>payload<S2SV_blank>loading<S2SV_blank>refers<S2SV_blank>to<S2SV_blank>non-existent<S2SV_blank>image" ) ; } } int fd ; static char fname [ 2056 ] = { 0 } ; switch ( tt ) { case 'd' : if ( img -> load_data . buf_capacity - img -> load_data . buf_used < g -> payload_sz ) { if ( img -> load_data . buf_used + g -> payload_sz > MAX_DATA_SZ || fmt != PNG ) ABRT ( EFBIG , "Too<S2SV_blank>much<S2SV_blank>data" ) ; img -> load_data . buf_capacity = MIN ( 2 * img -> load_data . buf_capacity , MAX_DATA_SZ ) ; img -> load_data . buf = realloc ( img -> load_data . buf , img -> load_data . buf_capacity ) ; if ( img -> load_data . buf == NULL ) { ABRT ( ENOMEM , "Out<S2SV_blank>of<S2SV_blank>memory" ) ; img -> load_data . buf_capacity = 0 ; img -> load_data . buf_used = 0 ; } } memcpy ( img -> load_data . buf + img -> load_data . buf_used , payload , g -> payload_sz ) ; img -> load_data . buf_used += g -> payload_sz ; if ( ! g -> more ) { img -> data_loaded = true ; self -> loading_image = 0 ; } break ; case 'f' : case 't' : case 's' : if ( g -> payload_sz > 2048 ) ABRT ( EINVAL , "Filename<S2SV_blank>too<S2SV_blank>long" ) ; snprintf ( fname , sizeof ( fname ) / sizeof ( fname [ 0 ] ) , "%.*s" , ( int ) g -> payload_sz , payload ) ; if ( tt == 's' ) fd = shm_open ( fname , O_RDONLY , 0 ) ; else fd = open ( fname , O_CLOEXEC | O_RDONLY ) ; <S2SV_StartBug> if ( fd == - 1 ) ABRT ( EBADF , "Failed<S2SV_blank>to<S2SV_blank>open<S2SV_blank>file<S2SV_blank>%s<S2SV_blank>for<S2SV_blank>graphics<S2SV_blank>transmission<S2SV_blank>with<S2SV_blank>error:<S2SV_blank>[%d]<S2SV_blank>%s" , fname , errno , strerror ( errno ) ) ; <S2SV_EndBug> img -> data_loaded = mmap_img_file ( self , img , fd , g -> data_sz , g -> data_offset ) ; safe_close ( fd , __FILE__ , __LINE__ ) ; if ( tt == 't' ) { if ( global_state . boss ) { call_boss ( safe_delete_temp_file , "s" , fname ) ; } else unlink ( fname ) ; } else if ( tt == 's' ) shm_unlink ( fname ) ; break ; default : ABRT ( EINVAL , "Unknown<S2SV_blank>transmission<S2SV_blank>type:<S2SV_blank>%c" , g -> transmission_type ) ; } if ( ! img -> data_loaded ) return NULL ; self -> loading_image = 0 ; bool needs_processing = g -> compressed || fmt == PNG ; if ( needs_processing ) { uint8_t * buf ; size_t bufsz ; # define IB { if ( img -> load_data . buf ) { buf = img -> load_data . buf ; bufsz = img -> load_data . buf_used ; } else { buf = img -> load_data . mapped_file ; bufsz = img -> load_data . mapped_file_sz ; } } switch ( g -> compressed ) { case 'z' : IB ; if ( ! inflate_zlib ( self , img , buf , bufsz ) ) { img -> data_loaded = false ; return NULL ; } break ; case 0 : break ; default : ABRT ( EINVAL , "Unknown<S2SV_blank>image<S2SV_blank>compression:<S2SV_blank>%c" , g -> compressed ) ; } switch ( fmt ) { case PNG : IB ; if ( ! inflate_png ( self , img , buf , bufsz ) ) { img -> data_loaded = false ; return NULL ; } break ; default : break ; } # undef IB img -> load_data . data = img -> load_data . buf ; if ( img -> load_data . buf_used < img -> load_data . data_sz ) { ABRT ( ENODATA , "Insufficient<S2SV_blank>image<S2SV_blank>data:<S2SV_blank>%zu<S2SV_blank><<S2SV_blank>%zu" , img -> load_data . buf_used , img -> load_data . data_sz ) ; } if ( img -> load_data . mapped_file ) { munmap ( img -> load_data . mapped_file , img -> load_data . mapped_file_sz ) ; img -> load_data . mapped_file = NULL ; img -> load_data . mapped_file_sz = 0 ; } } else { if ( tt == 'd' ) { if ( img -> load_data . buf_used < img -> load_data . data_sz ) { ABRT ( ENODATA , "Insufficient<S2SV_blank>image<S2SV_blank>data:<S2SV_blank>%zu<S2SV_blank><<S2SV_blank>%zu" , img -> load_data . buf_used , img -> load_data . data_sz ) ; } else img -> load_data . data = img -> load_data . buf ; } else { if ( img -> load_data . mapped_file_sz < img -> load_data . data_sz ) { ABRT ( ENODATA , "Insufficient<S2SV_blank>image<S2SV_blank>data:<S2SV_blank>%zu<S2SV_blank><<S2SV_blank>%zu" , img -> load_data . mapped_file_sz , img -> load_data . data_sz ) ; } else img -> load_data . data = img -> load_data . mapped_file ; } } size_t required_sz = ( size_t ) ( img -> load_data . is_opaque ? 3 : 4 ) * img -> width * img -> height ; if ( img -> load_data . data_sz != required_sz ) ABRT ( EINVAL , "Image<S2SV_blank>dimensions:<S2SV_blank>%ux%u<S2SV_blank>do<S2SV_blank>not<S2SV_blank>match<S2SV_blank>data<S2SV_blank>size:<S2SV_blank>%zu,<S2SV_blank>expected<S2SV_blank>size:<S2SV_blank>%zu" , img -> width , img -> height , img -> load_data . data_sz , required_sz ) ; if ( LIKELY ( img -> data_loaded && send_to_gpu ) ) { send_image_to_gpu ( & img -> texture_id , img -> load_data . data , img -> width , img -> height , img -> load_data . is_opaque , img -> load_data . is_4byte_aligned , false , REPEAT_CLAMP ) ; free_load_data ( & img -> load_data ) ; self -> used_storage += required_sz ; img -> used_storage = required_sz ; } return img ; # undef MAX_DATA_SZ # undef ABRT }
| <S2SV_ModStart> ( EBADF , "Failed<S2SV_blank>to<S2SV_blank>open<S2SV_blank>file<S2SV_blank>for<S2SV_blank>graphics<S2SV_blank>transmission<S2SV_blank>with<S2SV_blank>error:<S2SV_blank>[%d]<S2SV_blank>%s" <S2SV_ModEnd> , errno ,
| kovidgoyal@kitty/82c137878c2b99100a3cdc1c0f0efea069313901 | CVE-2020-35605 | https://github.com/kovidgoyal/kitty/commit/82c137878c2b99100a3cdc1c0f0efea069313901 | 2020-12-21T20:15Z |
6,708 | CWE-200 | CWE-200 void rds_inc_info_copy ( struct rds_incoming * inc , struct rds_info_iterator * iter , __be32 saddr , __be32 daddr , int flip ) { struct rds_info_message minfo ; minfo . seq = be64_to_cpu ( inc -> i_hdr . h_sequence ) ; minfo . len = be32_to_cpu ( inc -> i_hdr . h_len ) ; if ( flip ) { minfo . laddr = daddr ; minfo . faddr = saddr ; minfo . lport = inc -> i_hdr . h_dport ; minfo . fport = inc -> i_hdr . h_sport ; } else { minfo . laddr = saddr ; minfo . faddr = daddr ; minfo . lport = inc -> i_hdr . h_sport ; minfo . fport = inc -> i_hdr . h_dport ; } <S2SV_StartBug> rds_info_copy ( iter , & minfo , sizeof ( minfo ) ) ; <S2SV_EndBug> }
| <S2SV_ModStart> h_dport ; } minfo . flags = 0 ;
| torvalds@linux/4116def2337991b39919f3b448326e21c40e0dbb | CVE-2016-5244 | https://github.com/torvalds/linux/commit/4116def2337991b39919f3b448326e21c40e0dbb | 2016-06-27T10:59Z |
6,709 | CWE-362 | CWE-362 static int ip_setup_cork ( struct sock * sk , struct inet_cork * cork , struct ipcm_cookie * ipc , struct rtable * * rtp ) { struct inet_sock * inet = inet_sk ( sk ) ; <S2SV_StartBug> struct ip_options * opt ; <S2SV_EndBug> struct rtable * rt ; opt = ipc -> opt ; if ( opt ) { if ( cork -> opt == NULL ) { cork -> opt = kmalloc ( sizeof ( struct ip_options ) + 40 , sk -> sk_allocation ) ; if ( unlikely ( cork -> opt == NULL ) ) return - ENOBUFS ; } <S2SV_StartBug> memcpy ( cork -> opt , opt , sizeof ( struct ip_options ) + opt -> optlen ) ; <S2SV_EndBug> cork -> flags |= IPCORK_OPT ; cork -> addr = ipc -> addr ; } rt = * rtp ; if ( unlikely ( ! rt ) ) return - EFAULT ; * rtp = NULL ; cork -> fragsize = inet -> pmtudisc == IP_PMTUDISC_PROBE ? rt -> dst . dev -> mtu : dst_mtu ( rt -> dst . path ) ; cork -> dst = & rt -> dst ; cork -> length = 0 ; cork -> tx_flags = ipc -> tx_flags ; cork -> page = NULL ; cork -> off = 0 ; return 0 ; }
| <S2SV_ModStart> ) ; struct ip_options_rcu <S2SV_ModEnd> * opt ; <S2SV_ModStart> -> opt , & opt -> <S2SV_ModStart> + opt -> opt .
| torvalds@linux/f6d8bd051c391c1c0458a30b2a7abcd939329259 | CVE-2012-3552 | https://github.com/torvalds/linux/commit/f6d8bd051c391c1c0458a30b2a7abcd939329259 | 2012-10-03T11:02Z |
6,710 | CWE-22 | CWE-22 int set_interface_var ( const char * iface , const char * var , const char * name , uint32_t val ) { FILE * fp ; char spath [ 64 + IFNAMSIZ ] ; <S2SV_StartBug> if ( snprintf ( spath , sizeof ( spath ) , var , iface ) >= sizeof ( spath ) ) <S2SV_EndBug> return - 1 ; if ( access ( spath , F_OK ) != 0 ) return - 1 ; fp = fopen ( spath , "w" ) ; if ( ! fp ) { if ( name ) flog ( LOG_ERR , "failed<S2SV_blank>to<S2SV_blank>set<S2SV_blank>%s<S2SV_blank>(%u)<S2SV_blank>for<S2SV_blank>%s:<S2SV_blank>%s" , name , val , iface , strerror ( errno ) ) ; return - 1 ; } fprintf ( fp , "%u" , val ) ; fclose ( fp ) ; return 0 ; }
| <S2SV_ModStart> sizeof ( spath ) ) return - 1 ; if ( strstr ( name , ".." ) || strchr ( name , '/'
| reubenhwk@radvd/92e22ca23e52066da2258df8c76a2dca8a428bcc | CVE-2011-3602 | https://github.com/reubenhwk/radvd/commit/92e22ca23e52066da2258df8c76a2dca8a428bcc | 2014-04-27T21:55Z |
6,711 | CWE-200 | CWE-200 static void copy_to_user_policy ( struct xfrm_policy * xp , struct xfrm_userpolicy_info * p , int dir ) <S2SV_StartBug> { <S2SV_EndBug> memcpy ( & p -> sel , & xp -> selector , sizeof ( p -> sel ) ) ; memcpy ( & p -> lft , & xp -> lft , sizeof ( p -> lft ) ) ; memcpy ( & p -> curlft , & xp -> curlft , sizeof ( p -> curlft ) ) ; p -> priority = xp -> priority ; p -> index = xp -> index ; p -> sel . family = xp -> family ; p -> dir = dir ; p -> action = xp -> action ; p -> flags = xp -> flags ; p -> share = XFRM_SHARE_ANY ; }
| <S2SV_ModStart> dir ) { memset ( p , 0 , sizeof ( * p ) ) ;
| torvalds@linux/7b789836f434c87168eab067cfbed1ec4783dffd | CVE-2012-6537 | https://github.com/torvalds/linux/commit/7b789836f434c87168eab067cfbed1ec4783dffd | 2013-03-15T20:55Z |
6,712 | CWE-264 | CWE-264 static void setup_test_dir ( char * tmp_dir , const char * files , ... ) { va_list ap ; assert_se ( mkdtemp ( tmp_dir ) != NULL ) ; va_start ( ap , files ) ; while ( files != NULL ) { _cleanup_free_ char * path = strappend ( tmp_dir , files ) ; <S2SV_StartBug> assert_se ( touch_file ( path , true , USEC_INFINITY , UID_INVALID , GID_INVALID , 0 ) == 0 ) ; <S2SV_EndBug> files = va_arg ( ap , const char * ) ; } va_end ( ap ) ; }
| <S2SV_ModStart> , GID_INVALID , MODE_INVALID <S2SV_ModEnd> ) == 0
| systemd@systemd/ee735086f8670be1591fa9593e80dd60163a7a2f | CVE-2016-10156 | https://github.com/systemd/systemd/commit/ee735086f8670be1591fa9593e80dd60163a7a2f | 2017-01-23T07:59Z |
6,713 | CWE-119 | CWE-119 static INLINE void add_token_no_extra ( TOKENEXTRA * * t , <S2SV_StartBug> const vp9_prob * context_tree , <S2SV_EndBug> uint8_t token , uint8_t skip_eob_node , unsigned int * counts ) { ( * t ) -> token = token ; ( * t ) -> context_tree = context_tree ; ( * t ) -> skip_eob_node = skip_eob_node ; ( * t ) ++ ; ++ counts [ token ] ; }
| <S2SV_ModStart> t , const vpx_prob <S2SV_ModEnd> * context_tree ,
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
6,714 | CWE-000 | CWE-000 static int crypto_report_one ( struct crypto_alg * alg , struct crypto_user_alg * ualg , struct sk_buff * skb ) { <S2SV_StartBug> strlcpy ( ualg -> cru_name , alg -> cra_name , sizeof ( ualg -> cru_name ) ) ; <S2SV_EndBug> <S2SV_StartBug> strlcpy ( ualg -> cru_driver_name , alg -> cra_driver_name , <S2SV_EndBug> sizeof ( ualg -> cru_driver_name ) ) ; <S2SV_StartBug> strlcpy ( ualg -> cru_module_name , module_name ( alg -> cra_module ) , <S2SV_EndBug> sizeof ( ualg -> cru_module_name ) ) ; ualg -> cru_type = 0 ; ualg -> cru_mask = 0 ; ualg -> cru_flags = alg -> cra_flags ; ualg -> cru_refcnt = refcount_read ( & alg -> cra_refcnt ) ; if ( nla_put_u32 ( skb , CRYPTOCFGA_PRIORITY_VAL , alg -> cra_priority ) ) goto nla_put_failure ; if ( alg -> cra_flags & CRYPTO_ALG_LARVAL ) { struct crypto_report_larval rl ; <S2SV_StartBug> strlcpy ( rl . type , "larval" , sizeof ( rl . type ) ) ; <S2SV_EndBug> if ( nla_put ( skb , CRYPTOCFGA_REPORT_LARVAL , sizeof ( struct crypto_report_larval ) , & rl ) ) goto nla_put_failure ; goto out ; } if ( alg -> cra_type && alg -> cra_type -> report ) { if ( alg -> cra_type -> report ( skb , alg ) ) goto nla_put_failure ; goto out ; } switch ( alg -> cra_flags & ( CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_LARVAL ) ) { case CRYPTO_ALG_TYPE_CIPHER : if ( crypto_report_cipher ( skb , alg ) ) goto nla_put_failure ; break ; case CRYPTO_ALG_TYPE_COMPRESS : if ( crypto_report_comp ( skb , alg ) ) goto nla_put_failure ; break ; case CRYPTO_ALG_TYPE_ACOMPRESS : if ( crypto_report_acomp ( skb , alg ) ) goto nla_put_failure ; break ; case CRYPTO_ALG_TYPE_AKCIPHER : if ( crypto_report_akcipher ( skb , alg ) ) goto nla_put_failure ; break ; case CRYPTO_ALG_TYPE_KPP : if ( crypto_report_kpp ( skb , alg ) ) goto nla_put_failure ; break ; } out : return 0 ; nla_put_failure : return - EMSGSIZE ; }
| <S2SV_ModStart> skb ) { strncpy <S2SV_ModEnd> ( ualg -> <S2SV_ModStart> ) ) ; strncpy <S2SV_ModEnd> ( ualg -> <S2SV_ModStart> ) ) ; strncpy <S2SV_ModEnd> ( ualg -> <S2SV_ModStart> crypto_report_larval rl ; strncpy <S2SV_ModEnd> ( rl .
| torvalds@linux/f43f39958beb206b53292801e216d9b8a660f087 | CVE-2018-19854 | https://github.com/torvalds/linux/commit/f43f39958beb206b53292801e216d9b8a660f087 | 2018-12-04T16:29Z |
6,715 | CWE-416 | CWE-416 static int packet_setsockopt ( struct socket * sock , int level , int optname , char __user * optval , unsigned int optlen ) { struct sock * sk = sock -> sk ; struct packet_sock * po = pkt_sk ( sk ) ; int ret ; if ( level != SOL_PACKET ) return - ENOPROTOOPT ; switch ( optname ) { case PACKET_ADD_MEMBERSHIP : case PACKET_DROP_MEMBERSHIP : { struct packet_mreq_max mreq ; int len = optlen ; memset ( & mreq , 0 , sizeof ( mreq ) ) ; if ( len < sizeof ( struct packet_mreq ) ) return - EINVAL ; if ( len > sizeof ( mreq ) ) len = sizeof ( mreq ) ; if ( copy_from_user ( & mreq , optval , len ) ) return - EFAULT ; if ( len < ( mreq . mr_alen + offsetof ( struct packet_mreq , mr_address ) ) ) return - EINVAL ; if ( optname == PACKET_ADD_MEMBERSHIP ) ret = packet_mc_add ( sk , & mreq ) ; else ret = packet_mc_drop ( sk , & mreq ) ; return ret ; } case PACKET_RX_RING : case PACKET_TX_RING : { union tpacket_req_u req_u ; int len ; switch ( po -> tp_version ) { case TPACKET_V1 : case TPACKET_V2 : len = sizeof ( req_u . req ) ; break ; case TPACKET_V3 : default : len = sizeof ( req_u . req3 ) ; break ; } if ( optlen < len ) return - EINVAL ; if ( copy_from_user ( & req_u . req , optval , len ) ) return - EFAULT ; return packet_set_ring ( sk , & req_u , 0 , optname == PACKET_TX_RING ) ; } case PACKET_COPY_THRESH : { int val ; if ( optlen != sizeof ( val ) ) return - EINVAL ; if ( copy_from_user ( & val , optval , sizeof ( val ) ) ) return - EFAULT ; pkt_sk ( sk ) -> copy_thresh = val ; return 0 ; } case PACKET_VERSION : { int val ; if ( optlen != sizeof ( val ) ) return - EINVAL ; <S2SV_StartBug> if ( po -> rx_ring . pg_vec || po -> tx_ring . pg_vec ) <S2SV_EndBug> <S2SV_StartBug> return - EBUSY ; <S2SV_EndBug> <S2SV_StartBug> if ( copy_from_user ( & val , optval , sizeof ( val ) ) ) <S2SV_EndBug> return - EFAULT ; switch ( val ) { case TPACKET_V1 : case TPACKET_V2 : case TPACKET_V3 : po -> tp_version = val ; <S2SV_StartBug> return 0 ; <S2SV_EndBug> default : return - EINVAL ; } } case PACKET_RESERVE : { unsigned int val ; if ( optlen != sizeof ( val ) ) return - EINVAL ; if ( po -> rx_ring . pg_vec || po -> tx_ring . pg_vec ) return - EBUSY ; if ( copy_from_user ( & val , optval , sizeof ( val ) ) ) return - EFAULT ; po -> tp_reserve = val ; return 0 ; } case PACKET_LOSS : { unsigned int val ; if ( optlen != sizeof ( val ) ) return - EINVAL ; if ( po -> rx_ring . pg_vec || po -> tx_ring . pg_vec ) return - EBUSY ; if ( copy_from_user ( & val , optval , sizeof ( val ) ) ) return - EFAULT ; po -> tp_loss = ! ! val ; return 0 ; } case PACKET_AUXDATA : { int val ; if ( optlen < sizeof ( val ) ) return - EINVAL ; if ( copy_from_user ( & val , optval , sizeof ( val ) ) ) return - EFAULT ; po -> auxdata = ! ! val ; return 0 ; } case PACKET_ORIGDEV : { int val ; if ( optlen < sizeof ( val ) ) return - EINVAL ; if ( copy_from_user ( & val , optval , sizeof ( val ) ) ) return - EFAULT ; po -> origdev = ! ! val ; return 0 ; } case PACKET_VNET_HDR : { int val ; if ( sock -> type != SOCK_RAW ) return - EINVAL ; if ( po -> rx_ring . pg_vec || po -> tx_ring . pg_vec ) return - EBUSY ; if ( optlen < sizeof ( val ) ) return - EINVAL ; if ( copy_from_user ( & val , optval , sizeof ( val ) ) ) return - EFAULT ; po -> has_vnet_hdr = ! ! val ; return 0 ; } case PACKET_TIMESTAMP : { int val ; if ( optlen != sizeof ( val ) ) return - EINVAL ; if ( copy_from_user ( & val , optval , sizeof ( val ) ) ) return - EFAULT ; po -> tp_tstamp = val ; return 0 ; } case PACKET_FANOUT : { int val ; if ( optlen != sizeof ( val ) ) return - EINVAL ; if ( copy_from_user ( & val , optval , sizeof ( val ) ) ) return - EFAULT ; return fanout_add ( sk , val & 0xffff , val >> 16 ) ; } case PACKET_FANOUT_DATA : { if ( ! po -> fanout ) return - EINVAL ; return fanout_set_data ( po , optval , optlen ) ; } case PACKET_TX_HAS_OFF : { unsigned int val ; if ( optlen != sizeof ( val ) ) return - EINVAL ; if ( po -> rx_ring . pg_vec || po -> tx_ring . pg_vec ) return - EBUSY ; if ( copy_from_user ( & val , optval , sizeof ( val ) ) ) return - EFAULT ; po -> tp_tx_has_off = ! ! val ; return 0 ; } case PACKET_QDISC_BYPASS : { int val ; if ( optlen != sizeof ( val ) ) return - EINVAL ; if ( copy_from_user ( & val , optval , sizeof ( val ) ) ) return - EFAULT ; po -> xmit = val ? packet_direct_xmit : dev_queue_xmit ; return 0 ; } default : return - ENOPROTOOPT ; } }
| <S2SV_ModStart> ; if ( copy_from_user ( & val , optval , sizeof ( val ) ) ) return - EFAULT ; switch ( val ) { case TPACKET_V1 : case TPACKET_V2 : case TPACKET_V3 : break ; default : return - EINVAL ; } lock_sock ( sk ) ; if ( <S2SV_ModStart> . pg_vec ) { ret = <S2SV_ModEnd> - EBUSY ; <S2SV_ModStart> - EBUSY ; } else { <S2SV_ModEnd> po -> tp_version <S2SV_ModStart> = val ; ret = 0 ; } release_sock ( sk ) ; return ret ; <S2SV_ModEnd> } case PACKET_RESERVE
| torvalds@linux/84ac7260236a49c79eede91617700174c2c19b0c | CVE-2016-8655 | https://github.com/torvalds/linux/commit/84ac7260236a49c79eede91617700174c2c19b0c | 2016-12-08T08:59Z |
6,716 | CWE-476 | CWE-476 static int dissect_u3v ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) { gint offset = 0 ; proto_tree * u3v_tree = NULL , * ccd_tree_flag , * u3v_telegram_tree = NULL , * ccd_tree = NULL ; gint data_length = 0 ; gint req_id = 0 ; gint command_id = - 1 ; gint status = 0 ; guint prefix = 0 ; proto_item * ti = NULL ; proto_item * item = NULL ; const char * command_string ; usb_conv_info_t * usb_conv_info ; gint stream_detected = FALSE ; gint control_detected = FALSE ; u3v_conv_info_t * u3v_conv_info = NULL ; gencp_transaction_t * gencp_trans = NULL ; usb_conv_info = ( usb_conv_info_t * ) data ; u3v_conv_info = ( u3v_conv_info_t * ) usb_conv_info -> class_data ; if ( ! u3v_conv_info ) { u3v_conv_info = wmem_new0 ( wmem_file_scope ( ) , u3v_conv_info_t ) ; <S2SV_StartBug> usb_conv_info -> class_data = u3v_conv_info ; <S2SV_EndBug> } prefix = tvb_get_letohl ( tvb , 0 ) ; if ( ( tvb_reported_length ( tvb ) >= 4 ) && ( ( U3V_CONTROL_PREFIX == prefix ) || ( U3V_EVENT_PREFIX == prefix ) ) ) { control_detected = TRUE ; } if ( ( ( tvb_reported_length ( tvb ) >= 4 ) && ( ( U3V_STREAM_LEADER_PREFIX == prefix ) || ( U3V_STREAM_TRAILER_PREFIX == prefix ) ) ) || ( usb_conv_info -> endpoint == u3v_conv_info -> ep_stream ) ) { stream_detected = TRUE ; } if ( control_detected || stream_detected ) { if ( usb_conv_info -> interfaceClass == IF_CLASS_UNKNOWN && usb_conv_info -> interfaceSubclass == IF_SUBCLASS_UNKNOWN ) { usb_conv_info -> interfaceClass = IF_CLASS_MISCELLANEOUS ; usb_conv_info -> interfaceSubclass = IF_SUBCLASS_MISC_U3V ; } } if ( control_detected ) { col_set_str ( pinfo -> cinfo , COL_PROTOCOL , "U3V" ) ; col_clear ( pinfo -> cinfo , COL_INFO ) ; ti = proto_tree_add_item ( tree , proto_u3v , tvb , offset , - 1 , ENC_NA ) ; u3v_tree = proto_item_add_subtree ( ti , ett_u3v ) ; prefix = tvb_get_letohl ( tvb , offset ) ; command_id = tvb_get_letohs ( tvb , offset + 6 ) ; if ( ( prefix == U3V_CONTROL_PREFIX || prefix == U3V_EVENT_PREFIX ) && ( ( command_id % 2 ) == 0 ) ) { command_string = val_to_str ( command_id , command_names , "Unknown<S2SV_blank>Command<S2SV_blank>(0x%x)" ) ; item = proto_tree_add_item ( u3v_tree , hf_u3v_ccd_cmd , tvb , offset , 8 , ENC_NA ) ; proto_item_append_text ( item , ":<S2SV_blank>%s" , command_string ) ; ccd_tree = proto_item_add_subtree ( item , ett_u3v_cmd ) ; proto_tree_add_item ( ccd_tree , hf_u3v_gencp_prefix , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ; offset += 4 ; item = proto_tree_add_item ( ccd_tree , hf_u3v_flag , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ; ccd_tree_flag = proto_item_add_subtree ( item , ett_u3v_flags ) ; proto_tree_add_item ( ccd_tree_flag , hf_u3v_acknowledge_required_flag , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ; offset += 2 ; col_append_fstr ( pinfo -> cinfo , COL_INFO , "><S2SV_blank>%s<S2SV_blank>" , command_string ) ; } else if ( prefix == U3V_CONTROL_PREFIX && ( ( command_id % 2 ) == 1 ) ) { command_string = val_to_str ( command_id , command_names , "Unknown<S2SV_blank>Acknowledge<S2SV_blank>(0x%x)" ) ; item = proto_tree_add_item ( u3v_tree , hf_u3v_ccd_ack , tvb , offset , 8 , ENC_NA ) ; proto_item_append_text ( item , ":<S2SV_blank>%s" , command_string ) ; ccd_tree = proto_item_add_subtree ( item , ett_u3v_ack ) ; proto_tree_add_item ( ccd_tree , hf_u3v_gencp_prefix , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ; offset += 4 ; proto_tree_add_item ( ccd_tree , hf_u3v_status , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ; status = tvb_get_letohs ( tvb , offset ) ; offset += 2 ; col_append_fstr ( pinfo -> cinfo , COL_INFO , "<<S2SV_blank>%s<S2SV_blank>%s" , command_string , val_to_str ( status , status_names_short , "Unknown<S2SV_blank>status<S2SV_blank>(0x%04X)" ) ) ; } else { return 0 ; } proto_tree_add_item ( ccd_tree , hf_u3v_command_id , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ; offset += 2 ; proto_tree_add_item ( ccd_tree , hf_u3v_length , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ; data_length = tvb_get_letohs ( tvb , offset ) ; offset += 2 ; proto_tree_add_item ( ccd_tree , hf_u3v_request_id , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ; req_id = tvb_get_letohs ( tvb , offset ) ; offset += 2 ; u3v_telegram_tree = proto_item_add_subtree ( u3v_tree , ett_u3v ) ; if ( ! PINFO_FD_VISITED ( pinfo ) ) { if ( ( command_id % 2 ) == 0 ) { gencp_trans = wmem_new ( wmem_file_scope ( ) , gencp_transaction_t ) ; gencp_trans -> cmd_frame = pinfo -> fd -> num ; gencp_trans -> ack_frame = 0 ; gencp_trans -> cmd_time = pinfo -> fd -> abs_ts ; p_add_proto_data ( wmem_file_scope ( ) , pinfo , proto_u3v , req_id , gencp_trans ) ; u3v_conv_info -> trans_info = gencp_trans ; } else { gencp_trans = u3v_conv_info -> trans_info ; if ( gencp_trans ) { gencp_trans -> ack_frame = pinfo -> fd -> num ; p_add_proto_data ( wmem_file_scope ( ) , pinfo , proto_u3v , req_id , gencp_trans ) ; } } } else { gencp_trans = ( gencp_transaction_t * ) p_get_proto_data ( wmem_file_scope ( ) , pinfo , proto_u3v , req_id ) ; } if ( ! gencp_trans ) { gencp_trans = wmem_new ( wmem_packet_scope ( ) , gencp_transaction_t ) ; gencp_trans -> cmd_frame = 0 ; gencp_trans -> ack_frame = 0 ; gencp_trans -> cmd_time = pinfo -> fd -> abs_ts ; } switch ( command_id ) { case U3V_READMEM_CMD : dissect_u3v_read_mem_cmd ( u3v_telegram_tree , tvb , pinfo , offset , data_length , u3v_conv_info , gencp_trans ) ; break ; case U3V_WRITEMEM_CMD : dissect_u3v_write_mem_cmd ( u3v_telegram_tree , tvb , pinfo , offset , data_length , u3v_conv_info , gencp_trans ) ; break ; case U3V_EVENT_CMD : dissect_u3v_event_cmd ( u3v_telegram_tree , tvb , pinfo , offset , data_length ) ; break ; case U3V_READMEM_ACK : if ( U3V_STATUS_GENCP_SUCCESS == status ) { dissect_u3v_read_mem_ack ( u3v_telegram_tree , tvb , pinfo , offset , data_length , u3v_conv_info , gencp_trans ) ; } break ; case U3V_WRITEMEM_ACK : dissect_u3v_write_mem_ack ( u3v_telegram_tree , tvb , pinfo , offset , data_length , u3v_conv_info , gencp_trans ) ; break ; case U3V_PENDING_ACK : dissect_u3v_pending_ack ( u3v_telegram_tree , tvb , pinfo , offset , data_length , u3v_conv_info , gencp_trans ) ; break ; default : proto_tree_add_item ( u3v_telegram_tree , hf_u3v_payloaddata , tvb , offset , data_length , ENC_NA ) ; break ; } return data_length + 12 ; } else if ( stream_detected ) { u3v_conv_info = ( u3v_conv_info_t * ) usb_conv_info -> class_data ; u3v_conv_info -> ep_stream = usb_conv_info -> endpoint ; col_set_str ( pinfo -> cinfo , COL_PROTOCOL , "U3V" ) ; col_clear ( pinfo -> cinfo , COL_INFO ) ; ti = proto_tree_add_item ( tree , proto_u3v , tvb , offset , - 1 , ENC_NA ) ; u3v_tree = proto_item_add_subtree ( ti , ett_u3v ) ; if ( tvb_captured_length ( tvb ) >= 4 ) { prefix = tvb_get_letohl ( tvb , offset ) ; switch ( prefix ) { case U3V_STREAM_LEADER_PREFIX : dissect_u3v_stream_leader ( u3v_tree , tvb , pinfo , usb_conv_info ) ; break ; case U3V_STREAM_TRAILER_PREFIX : dissect_u3v_stream_trailer ( u3v_tree , tvb , pinfo , usb_conv_info ) ; break ; default : dissect_u3v_stream_payload ( u3v_tree , tvb , pinfo , usb_conv_info ) ; break ; } } return tvb_captured_length ( tvb ) ; } return 0 ; }
| <S2SV_ModStart> class_data = u3v_conv_info ; usb_conv_info -> class_data_type = USB_CONV_U3V ; } else if ( usb_conv_info -> class_data_type != USB_CONV_U3V ) { return 0
| wireshark@wireshark/2cb5985bf47bdc8bea78d28483ed224abdd33dc6 | CVE-2016-5354 | https://github.com/wireshark/wireshark/commit/2cb5985bf47bdc8bea78d28483ed224abdd33dc6 | 2016-08-07T16:59Z |
6,717 | CWE-125 | CWE-125 static void voutf ( struct GlobalConfig * config , const char * prefix , const char * fmt , va_list ap ) { size_t width = ( 79 - strlen ( prefix ) ) ; if ( ! config -> mute ) { size_t len ; char * ptr ; char * print_buffer ; print_buffer = curlx_mvaprintf ( fmt , ap ) ; if ( ! print_buffer ) return ; len = strlen ( print_buffer ) ; ptr = print_buffer ; while ( len > 0 ) { fputs ( prefix , config -> errors ) ; if ( len > width ) { size_t cut = width - 1 ; while ( ! ISSPACE ( ptr [ cut ] ) && cut ) { cut -- ; } if ( 0 == cut ) cut = width - 1 ; ( void ) fwrite ( ptr , cut + 1 , 1 , config -> errors ) ; fputs ( "\\n" , config -> errors ) ; ptr += cut + 1 ; <S2SV_StartBug> len -= cut ; <S2SV_EndBug> } else { fputs ( ptr , config -> errors ) ; len = 0 ; } } curl_free ( print_buffer ) ; } }
| <S2SV_ModStart> len -= cut + 1
| curl@curl/d530e92f59ae9bb2d47066c3c460b25d2ffeb211 | CVE-2018-16842 | https://github.com/curl/curl/commit/d530e92f59ae9bb2d47066c3c460b25d2ffeb211 | 2018-10-31T19:29Z |
6,718 | CWE-119 | CWE-119 <S2SV_StartBug> void vp9_iht8x8_64_add_c ( const int16_t * input , uint8_t * dest , int stride , <S2SV_EndBug> int tx_type ) { int i , j ; <S2SV_StartBug> int16_t out [ 8 * 8 ] ; <S2SV_EndBug> <S2SV_StartBug> int16_t * outptr = out ; <S2SV_EndBug> <S2SV_StartBug> int16_t temp_in [ 8 ] , temp_out [ 8 ] ; <S2SV_EndBug> const transform_2d ht = IHT_8 [ tx_type ] ; for ( i = 0 ; i < 8 ; ++ i ) { ht . rows ( input , outptr ) ; input += 8 ; outptr += 8 ; } for ( i = 0 ; i < 8 ; ++ i ) { for ( j = 0 ; j < 8 ; ++ j ) temp_in [ j ] = out [ j * 8 + i ] ; ht . cols ( temp_in , temp_out ) ; <S2SV_StartBug> for ( j = 0 ; j < 8 ; ++ j ) <S2SV_EndBug> <S2SV_StartBug> dest [ j * stride + i ] = clip_pixel ( ROUND_POWER_OF_TWO ( temp_out [ j ] , 5 ) <S2SV_EndBug> <S2SV_StartBug> + dest [ j * stride + i ] ) ; <S2SV_EndBug> } }
| <S2SV_ModStart> vp9_iht8x8_64_add_c ( const tran_low_t <S2SV_ModEnd> * input , <S2SV_ModStart> , j ; tran_low_t <S2SV_ModEnd> out [ 8 <S2SV_ModStart> 8 ] ; tran_low_t <S2SV_ModEnd> * outptr = <S2SV_ModStart> = out ; tran_low_t <S2SV_ModEnd> temp_in [ 8 <S2SV_ModStart> ++ j ) { <S2SV_ModStart> i ] = clip_pixel_add ( <S2SV_ModEnd> dest [ j <S2SV_ModStart> + i ] , ROUND_POWER_OF_TWO ( temp_out [ j ] , 5 ) ) ; } <S2SV_ModEnd> } } <S2SV_null>
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
6,719 | CWE-399 | CWE-399 int sfgets ( void ) { struct pollfd pfd ; int pollret ; ssize_t readnb ; signed char seen_r = 0 ; <S2SV_StartBug> static size_t scanned ; <S2SV_EndBug> static size_t readnbd ; if ( scanned > ( size_t ) 0U ) { readnbd -= scanned ; memmove ( cmd , cmd + scanned , readnbd ) ; scanned = ( size_t ) 0U ; } pfd . fd = clientfd ; # ifdef __APPLE_CC__ pfd . events = POLLIN | POLLERR | POLLHUP ; # else pfd . events = POLLIN | POLLPRI | POLLERR | POLLHUP ; # endif while ( scanned < cmdsize ) { if ( scanned >= readnbd ) { pfd . revents = 0 ; while ( ( pollret = poll ( & pfd , 1U , idletime * 1000UL ) ) < 0 && errno == EINTR ) ; if ( pollret == 0 ) { return - 1 ; } if ( pollret <= 0 || ( pfd . revents & ( POLLERR | POLLHUP | POLLNVAL ) ) != 0 ) { return - 2 ; } if ( ( pfd . revents & ( POLLIN | POLLPRI ) ) == 0 ) { continue ; } if ( readnbd >= cmdsize ) { break ; } # ifdef WITH_TLS if ( tls_cnx != NULL ) { while ( ( readnb = SSL_read ( tls_cnx , cmd + readnbd , cmdsize - readnbd ) ) < ( ssize_t ) 0 && errno == EINTR ) ; } else # endif { while ( ( readnb = read ( clientfd , cmd + readnbd , cmdsize - readnbd ) ) < ( ssize_t ) 0 && errno == EINTR ) ; } if ( readnb <= ( ssize_t ) 0 ) { return - 2 ; } readnbd += readnb ; if ( readnbd > cmdsize ) { return - 2 ; } } # ifdef RFC_CONFORMANT_LINES if ( seen_r != 0 ) { # endif if ( cmd [ scanned ] == '\\n' ) { # ifndef RFC_CONFORMANT_LINES if ( seen_r != 0 ) { # endif cmd [ scanned - 1U ] = 0 ; # ifndef RFC_CONFORMANT_LINES } else { cmd [ scanned ] = 0 ; } # endif if ( ++ scanned >= readnbd ) { scanned = readnbd = ( size_t ) 0U ; } return 0 ; } seen_r = 0 ; # ifdef RFC_CONFORMANT_LINES } # endif if ( ISCTRLCODE ( cmd [ scanned ] ) ) { if ( cmd [ scanned ] == '\\r' ) { seen_r = 1 ; } # ifdef RFC_CONFORMANT_PARSER else if ( cmd [ scanned ] == 0 ) { cmd [ scanned ] = '\\n' ; } # else cmd [ scanned ] = '_' ; # endif } scanned ++ ; } die ( 421 , LOG_WARNING , MSG_LINE_TOO_LONG ) ; return 0 ; }
| <S2SV_ModStart> = 0 ; <S2SV_ModEnd> if ( scanned
| jedisct1@pure-ftpd/65c4d4ad331e94661de763e9b5304d28698999c4 | CVE-2011-1575 | https://github.com/jedisct1/pure-ftpd/commit/65c4d4ad331e94661de763e9b5304d28698999c4 | 2011-05-23T22:55Z |
6,720 | CWE-476 | CWE-476 int build_segment_manager ( struct f2fs_sb_info * sbi ) { struct f2fs_super_block * raw_super = F2FS_RAW_SUPER ( sbi ) ; struct f2fs_checkpoint * ckpt = F2FS_CKPT ( sbi ) ; struct f2fs_sm_info * sm_info ; int err ; sm_info = kzalloc ( sizeof ( struct f2fs_sm_info ) , GFP_KERNEL ) ; if ( ! sm_info ) return - ENOMEM ; sbi -> sm_info = sm_info ; sm_info -> seg0_blkaddr = le32_to_cpu ( raw_super -> segment0_blkaddr ) ; sm_info -> main_blkaddr = le32_to_cpu ( raw_super -> main_blkaddr ) ; sm_info -> segment_count = le32_to_cpu ( raw_super -> segment_count ) ; sm_info -> reserved_segments = le32_to_cpu ( ckpt -> rsvd_segment_count ) ; sm_info -> ovp_segments = le32_to_cpu ( ckpt -> overprov_segment_count ) ; sm_info -> main_segments = le32_to_cpu ( raw_super -> segment_count_main ) ; sm_info -> ssa_blkaddr = le32_to_cpu ( raw_super -> ssa_blkaddr ) ; sm_info -> rec_prefree_segments = sm_info -> main_segments * DEF_RECLAIM_PREFREE_SEGMENTS / 100 ; if ( sm_info -> rec_prefree_segments > DEF_MAX_RECLAIM_PREFREE_SEGMENTS ) sm_info -> rec_prefree_segments = DEF_MAX_RECLAIM_PREFREE_SEGMENTS ; if ( ! test_opt ( sbi , LFS ) ) sm_info -> ipu_policy = 1 << F2FS_IPU_FSYNC ; sm_info -> min_ipu_util = DEF_MIN_IPU_UTIL ; sm_info -> min_fsync_blocks = DEF_MIN_FSYNC_BLOCKS ; sm_info -> min_hot_blocks = DEF_MIN_HOT_BLOCKS ; sm_info -> trim_sections = DEF_BATCHED_TRIM_SECTIONS ; INIT_LIST_HEAD ( & sm_info -> sit_entry_set ) ; <S2SV_StartBug> if ( test_opt ( sbi , FLUSH_MERGE ) && ! f2fs_readonly ( sbi -> sb ) ) { <S2SV_EndBug> err = create_flush_cmd_control ( sbi ) ; if ( err ) return err ; } err = create_discard_cmd_control ( sbi ) ; if ( err ) return err ; err = build_sit_info ( sbi ) ; if ( err ) return err ; err = build_free_segmap ( sbi ) ; if ( err ) return err ; err = build_curseg ( sbi ) ; if ( err ) return err ; build_sit_entries ( sbi ) ; init_free_segmap ( sbi ) ; err = build_dirty_segmap ( sbi ) ; if ( err ) return err ; init_min_max_mtime ( sbi ) ; return 0 ; }
| <S2SV_ModStart> ; if ( <S2SV_ModEnd> ! f2fs_readonly (
| torvalds@linux/d4fdf8ba0e5808ba9ad6b44337783bd9935e0982 | CVE-2017-18241 | https://github.com/torvalds/linux/commit/d4fdf8ba0e5808ba9ad6b44337783bd9935e0982 | 2018-03-21T16:29Z |
6,721 | CWE-119 | CWE-119 static void test_modules ( ) { assert_true_rule ( <S2SV_StartBug> "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.constants.one<S2SV_blank>+<S2SV_blank>1<S2SV_blank>==<S2SV_blank>tests.constants.two<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , <S2SV_EndBug> NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.constants.foo<S2SV_blank>==<S2SV_blank>\\"foo\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.constants.empty<S2SV_blank>==<S2SV_blank>\\"\\"<S2SV_blank><S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.empty()<S2SV_blank>==<S2SV_blank>\\"\\"<S2SV_blank><S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.struct_array[1].i<S2SV_blank>==<S2SV_blank>1<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.struct_array[0].i<S2SV_blank>==<S2SV_blank>1<S2SV_blank>or<S2SV_blank>true<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.integer_array[0]<S2SV_blank>==<S2SV_blank>0<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.integer_array[1]<S2SV_blank>==<S2SV_blank>1<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.string_array[0]<S2SV_blank>==<S2SV_blank>\\"foo\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.string_array[2]<S2SV_blank>==<S2SV_blank>\\"baz\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.string_dict[\\"foo\\"]<S2SV_blank>==<S2SV_blank>\\"foo\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.string_dict[\\"bar\\"]<S2SV_blank>==<S2SV_blank>\\"bar\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.isum(1,2)<S2SV_blank>==<S2SV_blank>3<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.isum(1,2,3)<S2SV_blank>==<S2SV_blank>6<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.fsum(1.0,2.0)<S2SV_blank>==<S2SV_blank>3.0<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.fsum(1.0,2.0,3.0)<S2SV_blank>==<S2SV_blank>6.0<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.foobar(1)<S2SV_blank>==<S2SV_blank>tests.foobar(1)<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.foobar(1)<S2SV_blank>!=<S2SV_blank>tests.foobar(2)<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.length(\\"dummy\\")<S2SV_blank>==<S2SV_blank>5<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_false_rule ( <S2SV_StartBug> "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.struct_array[0].i<S2SV_blank>==<S2SV_blank>1<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , <S2SV_EndBug> NULL ) ; assert_false_rule ( <S2SV_StartBug> "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.isum(1,1)<S2SV_blank>==<S2SV_blank>3<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , <S2SV_EndBug> NULL ) ; assert_false_rule ( <S2SV_StartBug> "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.fsum(1.0,1.0)<S2SV_blank>==<S2SV_blank>3.0<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , <S2SV_EndBug> NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.match(/foo/,\\"foo\\")<S2SV_blank>==<S2SV_blank>3<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.match(/foo/,\\"bar\\")<S2SV_blank>==<S2SV_blank>-1\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.match(/foo.bar/i,\\"FOO\\\\nBAR\\")<S2SV_blank>==<S2SV_blank>-1\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.match(/foo.bar/is,\\"FOO\\\\nBAR\\")<S2SV_blank>==<S2SV_blank>7\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_error ( "import<S2SV_blank>\\"\\\\x00\\"" , ERROR_INVALID_MODULE_NAME ) ; assert_error ( "import<S2SV_blank>\\"\\"" , ERROR_INVALID_MODULE_NAME ) ; }
| <S2SV_ModStart> { assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.constants.one<S2SV_blank>+<S2SV_blank>1<S2SV_blank>==<S2SV_blank>tests.constants.two<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.constants.foo<S2SV_blank>==<S2SV_blank>\\"foo\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.constants.empty<S2SV_blank>==<S2SV_blank>\\"\\"<S2SV_blank><S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.empty()<S2SV_blank>==<S2SV_blank>\\"\\"<S2SV_blank><S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.struct_array[1].i<S2SV_blank>==<S2SV_blank>1<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.struct_array[0].i<S2SV_blank>==<S2SV_blank>1<S2SV_blank>or<S2SV_blank>true<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.integer_array[0]<S2SV_blank>==<S2SV_blank>0<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.integer_array[1]<S2SV_blank>==<S2SV_blank>1<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.integer_array[256]<S2SV_blank>==<S2SV_blank>256<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.string_array[0]<S2SV_blank>==<S2SV_blank>\\"foo\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.string_array[2]<S2SV_blank>==<S2SV_blank>\\"baz\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.string_dict[\\"foo\\"]<S2SV_blank>==<S2SV_blank>\\"foo\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.string_dict[\\"bar\\"]<S2SV_blank>==<S2SV_blank>\\"bar\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.isum(1,2)<S2SV_blank>==<S2SV_blank>3<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.isum(1,2,3)<S2SV_blank>==<S2SV_blank>6<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.fsum(1.0,2.0)<S2SV_blank>==<S2SV_blank>3.0<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.fsum(1.0,2.0,3.0)<S2SV_blank>==<S2SV_blank>6.0<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.foobar(1)<S2SV_blank>==<S2SV_blank>tests.foobar(1)<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.foobar(1)<S2SV_blank>!=<S2SV_blank>tests.foobar(2)<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>condition:<S2SV_blank>tests.length(\\"dummy\\")<S2SV_blank>==<S2SV_blank>5<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" <S2SV_ModEnd> , NULL ) <S2SV_ModStart> ; assert_false_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.struct_array[0].i<S2SV_blank>==<S2SV_blank>1<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" <S2SV_ModEnd> , NULL ) <S2SV_ModStart> ; assert_false_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.isum(1,1)<S2SV_blank>==<S2SV_blank>3<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" <S2SV_ModEnd> , NULL ) <S2SV_ModStart> ; assert_false_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.fsum(1.0,1.0)<S2SV_blank>==<S2SV_blank>3.0<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.match(/foo/,\\"foo\\")<S2SV_blank>==<S2SV_blank>3<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.match(/foo/,\\"bar\\")<S2SV_blank>==<S2SV_blank>-1\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.match(/foo.bar/i,\\"FOO\\\\nBAR\\")<S2SV_blank>==<S2SV_blank>-1\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" , NULL ) ; assert_true_rule ( "import<S2SV_blank>\\"tests\\"<S2SV_blank>\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>rule<S2SV_blank>test<S2SV_blank>{<S2SV_blank>condition:<S2SV_blank>tests.match(/foo.bar/is,\\"FOO\\\\nBAR\\")<S2SV_blank>==<S2SV_blank>7\\\n<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>}" <S2SV_ModEnd> , NULL )
| VirusTotal@yara/4a342f01e5439b9bb901aff1c6c23c536baeeb3f | CVE-2017-11328 | https://github.com/VirusTotal/yara/commit/4a342f01e5439b9bb901aff1c6c23c536baeeb3f | 2017-07-17T13:18Z |
6,722 | CWE-415 | CWE-415 int read_file ( struct sc_card * card , char * str_path , unsigned char * * data , size_t * data_len ) { struct sc_path path ; struct sc_file * file ; unsigned char * p ; int ok = 0 ; int r ; size_t len ; sc_format_path ( str_path , & path ) ; if ( SC_SUCCESS != sc_select_file ( card , & path , & file ) ) { goto err ; } <S2SV_StartBug> len = file ? file -> size : 4096 ; <S2SV_EndBug> p = realloc ( * data , len ) ; if ( ! p ) { goto err ; } * data = p ; * data_len = len ; r = sc_read_binary ( card , 0 , p , len , 0 ) ; if ( r < 0 ) goto err ; * data_len = r ; ok = 1 ; err : sc_file_free ( file ) ; return ok ; }
| <S2SV_ModStart> len = file && file -> size > 0
| OpenSC@OpenSC/360e95d45ac4123255a4c796db96337f332160ad | CVE-2018-16425 | https://github.com/OpenSC/OpenSC/commit/360e95d45ac4123255a4c796db96337f332160ad | 2018-09-04T00:29Z |
6,723 | CWE-200 | CWE-200 static int irda_recvmsg_dgram ( struct kiocb * iocb , struct socket * sock , struct msghdr * msg , size_t size , int flags ) { struct sock * sk = sock -> sk ; struct irda_sock * self = irda_sk ( sk ) ; struct sk_buff * skb ; size_t copied ; int err ; IRDA_DEBUG ( 4 , "%s()\\n" , __func__ ) ; <S2SV_StartBug> skb = skb_recv_datagram ( sk , flags & ~ MSG_DONTWAIT , <S2SV_EndBug> flags & MSG_DONTWAIT , & err ) ; if ( ! skb ) return err ; skb_reset_transport_header ( skb ) ; copied = skb -> len ; if ( copied > size ) { IRDA_DEBUG ( 2 , "%s(),<S2SV_blank>Received<S2SV_blank>truncated<S2SV_blank>frame<S2SV_blank>(%zd<S2SV_blank><<S2SV_blank>%zd)!\\n" , __func__ , copied , size ) ; copied = size ; msg -> msg_flags |= MSG_TRUNC ; } skb_copy_datagram_iovec ( skb , 0 , msg -> msg_iov , copied ) ; skb_free_datagram ( sk , skb ) ; if ( self -> rx_flow == FLOW_STOP ) { if ( ( atomic_read ( & sk -> sk_rmem_alloc ) << 2 ) <= sk -> sk_rcvbuf ) { IRDA_DEBUG ( 2 , "%s(),<S2SV_blank>Starting<S2SV_blank>IrTTP\\n" , __func__ ) ; self -> rx_flow = FLOW_START ; irttp_flow_request ( self -> tsap , FLOW_START ) ; } } return copied ; }
| <S2SV_ModStart> __func__ ) ; msg -> msg_namelen = 0 ;
| torvalds@linux/5ae94c0d2f0bed41d6718be743985d61b7f5c47d | CVE-2013-3228 | https://github.com/torvalds/linux/commit/5ae94c0d2f0bed41d6718be743985d61b7f5c47d | 2013-04-22T11:41Z |
6,724 | CWE-310 | CWE-310 static int crypto_report_one ( struct crypto_alg * alg , struct crypto_user_alg * ualg , struct sk_buff * skb ) { <S2SV_StartBug> memcpy ( & ualg -> cru_name , & alg -> cra_name , sizeof ( ualg -> cru_name ) ) ; <S2SV_EndBug> <S2SV_StartBug> memcpy ( & ualg -> cru_driver_name , & alg -> cra_driver_name , <S2SV_EndBug> sizeof ( ualg -> cru_driver_name ) ) ; <S2SV_StartBug> memcpy ( & ualg -> cru_module_name , module_name ( alg -> cra_module ) , <S2SV_EndBug> <S2SV_StartBug> CRYPTO_MAX_ALG_NAME ) ; <S2SV_EndBug> ualg -> cru_flags = alg -> cra_flags ; ualg -> cru_refcnt = atomic_read ( & alg -> cra_refcnt ) ; if ( nla_put_u32 ( skb , CRYPTOCFGA_PRIORITY_VAL , alg -> cra_priority ) ) goto nla_put_failure ; if ( alg -> cra_flags & CRYPTO_ALG_LARVAL ) { struct crypto_report_larval rl ; <S2SV_StartBug> snprintf ( rl . type , CRYPTO_MAX_ALG_NAME , "%s" , "larval" ) ; <S2SV_EndBug> if ( nla_put ( skb , CRYPTOCFGA_REPORT_LARVAL , sizeof ( struct crypto_report_larval ) , & rl ) ) goto nla_put_failure ; goto out ; } if ( alg -> cra_type && alg -> cra_type -> report ) { if ( alg -> cra_type -> report ( skb , alg ) ) goto nla_put_failure ; goto out ; } switch ( alg -> cra_flags & ( CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_LARVAL ) ) { case CRYPTO_ALG_TYPE_CIPHER : if ( crypto_report_cipher ( skb , alg ) ) goto nla_put_failure ; break ; case CRYPTO_ALG_TYPE_COMPRESS : if ( crypto_report_comp ( skb , alg ) ) goto nla_put_failure ; break ; } out : return 0 ; nla_put_failure : return - EMSGSIZE ; }
| <S2SV_ModStart> skb ) { strncpy ( <S2SV_ModEnd> ualg -> cru_name <S2SV_ModStart> -> cru_name , <S2SV_ModEnd> alg -> cra_name <S2SV_ModStart> ) ) ; strncpy ( <S2SV_ModEnd> ualg -> cru_driver_name <S2SV_ModStart> -> cru_driver_name , <S2SV_ModEnd> alg -> cra_driver_name <S2SV_ModStart> ) ) ; strncpy ( <S2SV_ModEnd> ualg -> cru_module_name <S2SV_ModStart> cra_module ) , sizeof ( ualg -> cru_module_name ) ) ; ualg -> cru_type = 0 ; ualg -> cru_mask = 0 <S2SV_ModEnd> ; ualg -> <S2SV_ModStart> crypto_report_larval rl ; strncpy <S2SV_ModEnd> ( rl . <S2SV_ModStart> . type , "larval" , sizeof ( rl . type ) <S2SV_ModEnd> ) ; if
| torvalds@linux/9a5467bf7b6e9e02ec9c3da4e23747c05faeaac6 | CVE-2013-2548 | https://github.com/torvalds/linux/commit/9a5467bf7b6e9e02ec9c3da4e23747c05faeaac6 | 2013-03-15T20:55Z |
6,725 | CWE-119 | CWE-119 <S2SV_StartBug> static int set_registers ( rtl8150_t * dev , u16 indx , u16 size , void * data ) <S2SV_EndBug> { <S2SV_StartBug> return usb_control_msg ( dev -> udev , usb_sndctrlpipe ( dev -> udev , 0 ) , <S2SV_EndBug> RTL8150_REQ_SET_REGS , RTL8150_REQT_WRITE , <S2SV_StartBug> indx , 0 , data , size , 500 ) ; <S2SV_EndBug> <S2SV_StartBug> } <S2SV_EndBug>
| <S2SV_ModStart> u16 size , const <S2SV_ModStart> data ) { void * buf ; int ret ; buf = kmemdup ( data , size , GFP_NOIO ) ; if ( ! buf ) return - ENOMEM ; ret = <S2SV_ModEnd> usb_control_msg ( dev <S2SV_ModStart> , 0 , buf <S2SV_ModEnd> , size , <S2SV_ModStart> 500 ) ; kfree ( buf ) ; return ret ;
| torvalds@linux/7926aff5c57b577ab0f43364ff0c59d968f6a414 | CVE-2017-8069 | https://github.com/torvalds/linux/commit/7926aff5c57b577ab0f43364ff0c59d968f6a414 | 2017-04-23T05:59Z |
6,726 | CWE-119 | CWE-119 static __u8 * mr_report_fixup ( struct hid_device * hdev , __u8 * rdesc , unsigned int * rsize ) { <S2SV_StartBug> if ( * rsize >= 30 && rdesc [ 29 ] == 0x05 && rdesc [ 30 ] == 0x09 ) { <S2SV_EndBug> hid_info ( hdev , "fixing<S2SV_blank>up<S2SV_blank>button/consumer<S2SV_blank>in<S2SV_blank>HID<S2SV_blank>report<S2SV_blank>descriptor\\n" ) ; rdesc [ 30 ] = 0x0c ; } return rdesc ; }
| <S2SV_ModStart> * rsize >= 31 <S2SV_ModEnd> && rdesc [
| torvalds@linux/4ab25786c87eb20857bbb715c3ae34ec8fd6a214 | CVE-2014-3184 | https://github.com/torvalds/linux/commit/4ab25786c87eb20857bbb715c3ae34ec8fd6a214 | 2014-09-28T10:55Z |
6,727 | CWE-787 | CWE-787 CURLcode Curl_smtp_escape_eob ( struct connectdata * conn , const ssize_t nread ) { ssize_t i ; ssize_t si ; struct Curl_easy * data = conn -> data ; struct SMTP * smtp = data -> req . protop ; char * scratch = data -> state . scratch ; char * newscratch = NULL ; char * oldscratch = NULL ; size_t eob_sent ; if ( ! scratch || data -> set . crlf ) { oldscratch = scratch ; <S2SV_StartBug> scratch = newscratch = malloc ( 2 * data -> set . buffer_size ) ; <S2SV_EndBug> if ( ! newscratch ) { failf ( data , "Failed<S2SV_blank>to<S2SV_blank>alloc<S2SV_blank>scratch<S2SV_blank>buffer!" ) ; return CURLE_OUT_OF_MEMORY ; } <S2SV_StartBug> } <S2SV_EndBug> eob_sent = smtp -> eob ; for ( i = 0 , si = 0 ; i < nread ; i ++ ) { if ( SMTP_EOB [ smtp -> eob ] == data -> req . upload_fromhere [ i ] ) { smtp -> eob ++ ; if ( 2 == smtp -> eob || SMTP_EOB_LEN == smtp -> eob ) smtp -> trailing_crlf = TRUE ; else smtp -> trailing_crlf = FALSE ; } else if ( smtp -> eob ) { memcpy ( & scratch [ si ] , & SMTP_EOB [ eob_sent ] , smtp -> eob - eob_sent ) ; si += smtp -> eob - eob_sent ; if ( SMTP_EOB [ 0 ] == data -> req . upload_fromhere [ i ] ) smtp -> eob = 1 ; else smtp -> eob = 0 ; eob_sent = 0 ; smtp -> trailing_crlf = FALSE ; } if ( SMTP_EOB_FIND_LEN == smtp -> eob ) { memcpy ( & scratch [ si ] , & SMTP_EOB_REPL [ eob_sent ] , SMTP_EOB_REPL_LEN - eob_sent ) ; si += SMTP_EOB_REPL_LEN - eob_sent ; smtp -> eob = 0 ; eob_sent = 0 ; } else if ( ! smtp -> eob ) scratch [ si ++ ] = data -> req . upload_fromhere [ i ] ; } if ( smtp -> eob - eob_sent ) { memcpy ( & scratch [ si ] , & SMTP_EOB [ eob_sent ] , smtp -> eob - eob_sent ) ; si += smtp -> eob - eob_sent ; } if ( si != nread ) { data -> req . upload_fromhere = scratch ; data -> state . scratch = scratch ; free ( oldscratch ) ; data -> req . upload_present = si ; } else free ( newscratch ) ; return CURLE_OK ; }
| <S2SV_ModStart> ( 2 * UPLOAD_BUFSIZE <S2SV_ModEnd> ) ; if <S2SV_ModStart> ; } } DEBUGASSERT ( UPLOAD_BUFSIZE >= nread ) ;
| curl@curl/ba1dbd78e5f1ed67c1b8d37ac89d90e5e330b628 | CVE-2018-0500 | https://github.com/curl/curl/commit/ba1dbd78e5f1ed67c1b8d37ac89d90e5e330b628 | 2018-07-11T13:29Z |
6,728 | CWE-125 | CWE-125 mod_ty PyAST_obj2mod ( PyObject * ast , PyArena * arena , int mode ) { mod_ty res ; PyObject * req_type [ 3 ] ; <S2SV_StartBug> char * req_name [ ] = { "Module" , "Expression" , "Interactive" } ; <S2SV_EndBug> int isinstance ; req_type [ 0 ] = ( PyObject * ) Module_type ; req_type [ 1 ] = ( PyObject * ) Expression_type ; req_type [ 2 ] = ( PyObject * ) Interactive_type ; <S2SV_StartBug> assert ( 0 <= mode && mode <= 2 ) ; <S2SV_EndBug> if ( ! init_types ( ) ) return NULL ; isinstance = PyObject_IsInstance ( ast , req_type [ mode ] ) ; if ( isinstance == - 1 ) return NULL ; if ( ! isinstance ) { PyErr_Format ( PyExc_TypeError , "expected<S2SV_blank>%s<S2SV_blank>node,<S2SV_blank>got<S2SV_blank>%.400s" , req_name [ mode ] , Py_TYPE ( ast ) -> tp_name ) ; return NULL ; } if ( obj2ast_mod ( ast , & res , arena ) != 0 ) return NULL ; else return res ; }
| <S2SV_ModStart> "Expression" , "Interactive" , "FunctionType" <S2SV_ModStart> && mode <= 3 <S2SV_ModEnd> ) ; if
| python@typed_ast/dcfcd146f8e6fc5c2fc16a4c192a0c5f5ca8c53c | CVE-2019-19275 | https://github.com/python/typed_ast/commit/dcfcd146f8e6fc5c2fc16a4c192a0c5f5ca8c53c | 2019-11-26T15:15Z |
6,729 | CWE-20 | CWE-20 int rose_rx_call_request ( struct sk_buff * skb , struct net_device * dev , struct rose_neigh * neigh , unsigned int lci ) { struct sock * sk ; struct sock * make ; struct rose_sock * make_rose ; struct rose_facilities_struct facilities ; <S2SV_StartBug> int n , len ; <S2SV_EndBug> skb -> sk = NULL ; <S2SV_StartBug> memset ( & facilities , 0x00 , sizeof ( struct rose_facilities_struct ) ) ; <S2SV_EndBug> len = ( ( ( skb -> data [ 3 ] >> 4 ) & 0x0F ) + 1 ) >> 1 ; len += ( ( ( skb -> data [ 3 ] >> 0 ) & 0x0F ) + 1 ) >> 1 ; <S2SV_StartBug> if ( ! rose_parse_facilities ( skb -> data + len + 4 , & facilities ) ) { <S2SV_EndBug> rose_transmit_clear_request ( neigh , lci , ROSE_INVALID_FACILITY , 76 ) ; return 0 ; } sk = rose_find_listener ( & facilities . source_addr , & facilities . source_call ) ; if ( sk == NULL || sk_acceptq_is_full ( sk ) || ( make = rose_make_new ( sk ) ) == NULL ) { rose_transmit_clear_request ( neigh , lci , ROSE_NETWORK_CONGESTION , 120 ) ; return 0 ; } skb -> sk = make ; make -> sk_state = TCP_ESTABLISHED ; make_rose = rose_sk ( make ) ; make_rose -> lci = lci ; make_rose -> dest_addr = facilities . dest_addr ; make_rose -> dest_call = facilities . dest_call ; make_rose -> dest_ndigis = facilities . dest_ndigis ; for ( n = 0 ; n < facilities . dest_ndigis ; n ++ ) make_rose -> dest_digis [ n ] = facilities . dest_digis [ n ] ; make_rose -> source_addr = facilities . source_addr ; make_rose -> source_call = facilities . source_call ; make_rose -> source_ndigis = facilities . source_ndigis ; for ( n = 0 ; n < facilities . source_ndigis ; n ++ ) make_rose -> source_digis [ n ] = facilities . source_digis [ n ] ; make_rose -> neighbour = neigh ; make_rose -> device = dev ; make_rose -> facilities = facilities ; make_rose -> neighbour -> use ++ ; if ( rose_sk ( sk ) -> defer ) { make_rose -> state = ROSE_STATE_5 ; } else { rose_write_internal ( make , ROSE_CALL_ACCEPTED ) ; make_rose -> state = ROSE_STATE_3 ; rose_start_idletimer ( make ) ; } make_rose -> condition = 0x00 ; make_rose -> vs = 0 ; make_rose -> va = 0 ; make_rose -> vr = 0 ; make_rose -> vl = 0 ; sk -> sk_ack_backlog ++ ; rose_insert_socket ( make ) ; skb_queue_head ( & sk -> sk_receive_queue , skb ) ; rose_start_heartbeat ( make ) ; if ( ! sock_flag ( sk , SOCK_DEAD ) ) sk -> sk_data_ready ( sk , skb -> len ) ; return 1 ; }
| <S2SV_ModStart> ; int n <S2SV_ModEnd> ; skb -> <S2SV_ModStart> rose_facilities_struct ) ) <S2SV_ModEnd> ; if ( <S2SV_ModStart> -> data + ROSE_CALL_REQ_FACILITIES_OFF , skb -> len - ROSE_CALL_REQ_FACILITIES_OFF , <S2SV_ModEnd> & facilities )
| torvalds@linux/e0bccd315db0c2f919e7fcf9cb60db21d9986f52 | CVE-2011-4914 | https://github.com/torvalds/linux/commit/e0bccd315db0c2f919e7fcf9cb60db21d9986f52 | 2012-06-21T23:55Z |
6,730 | CWE-125 | CWE-125 static void bgp_capabilities_print ( netdissect_options * ndo , const u_char * opt , int caps_len ) { int cap_type , cap_len , tcap_len , cap_offset ; int i = 0 ; while ( i < caps_len ) { ND_TCHECK2 ( opt [ i ] , BGP_CAP_HEADER_SIZE ) ; cap_type = opt [ i ] ; cap_len = opt [ i + 1 ] ; tcap_len = cap_len ; ND_PRINT ( ( ndo , "\\n\\t<S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank><S2SV_blank>%s<S2SV_blank>(%u),<S2SV_blank>length:<S2SV_blank>%u" , tok2str ( bgp_capcode_values , "Unknown" , cap_type ) , cap_type , cap_len ) ) ; ND_TCHECK2 ( opt [ i + 2 ] , cap_len ) ; switch ( cap_type ) { <S2SV_StartBug> case BGP_CAPCODE_MP : <S2SV_EndBug> ND_PRINT ( ( ndo , "\\n\\t\\tAFI<S2SV_blank>%s<S2SV_blank>(%u),<S2SV_blank>SAFI<S2SV_blank>%s<S2SV_blank>(%u)" , tok2str ( af_values , "Unknown" , EXTRACT_16BITS ( opt + i + 2 ) ) , EXTRACT_16BITS ( opt + i + 2 ) , tok2str ( bgp_safi_values , "Unknown" , opt [ i + 5 ] ) , opt [ i + 5 ] ) ) ; break ; case BGP_CAPCODE_RESTART : ND_TCHECK_16BITS ( opt + i + 2 ) ; ND_PRINT ( ( ndo , "\\n\\t\\tRestart<S2SV_blank>Flags:<S2SV_blank>[%s],<S2SV_blank>Restart<S2SV_blank>Time<S2SV_blank>%us" , ( ( opt [ i + 2 ] ) & 0x80 ) ? "R" : "none" , EXTRACT_16BITS ( opt + i + 2 ) & 0xfff ) ) ; tcap_len -= 2 ; cap_offset = 4 ; while ( tcap_len >= 4 ) { ND_PRINT ( ( ndo , "\\n\\t\\t<S2SV_blank><S2SV_blank>AFI<S2SV_blank>%s<S2SV_blank>(%u),<S2SV_blank>SAFI<S2SV_blank>%s<S2SV_blank>(%u),<S2SV_blank>Forwarding<S2SV_blank>state<S2SV_blank>preserved:<S2SV_blank>%s" , tok2str ( af_values , "Unknown" , EXTRACT_16BITS ( opt + i + cap_offset ) ) , EXTRACT_16BITS ( opt + i + cap_offset ) , tok2str ( bgp_safi_values , "Unknown" , opt [ i + cap_offset + 2 ] ) , opt [ i + cap_offset + 2 ] , ( ( opt [ i + cap_offset + 3 ] ) & 0x80 ) ? "yes" : "no" ) ) ; tcap_len -= 4 ; cap_offset += 4 ; } break ; case BGP_CAPCODE_RR : case BGP_CAPCODE_RR_CISCO : break ; case BGP_CAPCODE_AS_NEW : if ( cap_len == 4 ) { ND_PRINT ( ( ndo , "\\n\\t\\t<S2SV_blank>4<S2SV_blank>Byte<S2SV_blank>AS<S2SV_blank>%s" , as_printf ( ndo , astostr , sizeof ( astostr ) , EXTRACT_32BITS ( opt + i + 2 ) ) ) ) ; } break ; case BGP_CAPCODE_ADD_PATH : cap_offset = 2 ; if ( tcap_len == 0 ) { ND_PRINT ( ( ndo , "<S2SV_blank>(bogus)" ) ) ; break ; } while ( tcap_len > 0 ) { if ( tcap_len < 4 ) { ND_PRINT ( ( ndo , "\\n\\t\\t(invalid)" ) ) ; break ; } ND_PRINT ( ( ndo , "\\n\\t\\tAFI<S2SV_blank>%s<S2SV_blank>(%u),<S2SV_blank>SAFI<S2SV_blank>%s<S2SV_blank>(%u),<S2SV_blank>Send/Receive:<S2SV_blank>%s" , tok2str ( af_values , "Unknown" , EXTRACT_16BITS ( opt + i + cap_offset ) ) , EXTRACT_16BITS ( opt + i + cap_offset ) , tok2str ( bgp_safi_values , "Unknown" , opt [ i + cap_offset + 2 ] ) , opt [ i + cap_offset + 2 ] , tok2str ( bgp_add_path_recvsend , "Bogus<S2SV_blank>(0x%02x)" , opt [ i + cap_offset + 3 ] ) ) ) ; tcap_len -= 4 ; cap_offset += 4 ; } break ; default : ND_PRINT ( ( ndo , "\\n\\t\\tno<S2SV_blank>decoder<S2SV_blank>for<S2SV_blank>Capability<S2SV_blank>%u" , cap_type ) ) ; if ( ndo -> ndo_vflag <= 1 ) print_unknown_data ( ndo , & opt [ i + 2 ] , "\\n\\t\\t" , cap_len ) ; break ; } if ( ndo -> ndo_vflag > 1 && cap_len > 0 ) { print_unknown_data ( ndo , & opt [ i + 2 ] , "\\n\\t\\t" , cap_len ) ; } i += BGP_CAP_HEADER_SIZE + cap_len ; } return ; trunc : ND_PRINT ( ( ndo , "[|BGP]" ) ) ; }
| <S2SV_ModStart> case BGP_CAPCODE_MP : ND_TCHECK_8BITS ( opt + i + 5 ) ;
| the-tcpdump-group@tcpdump/e3f3b445e2d20ac5d5b7fcb7559ce6beb55da0c9 | CVE-2018-14467 | https://github.com/the-tcpdump-group/tcpdump/commit/e3f3b445e2d20ac5d5b7fcb7559ce6beb55da0c9 | 2019-10-03T16:15Z |
6,731 | CWE-125 | CWE-125 static void parse_sec_attr_44 ( sc_file_t * file , const u8 * buf , size_t len ) { const int df_idx [ 8 ] = { SC_AC_OP_DELETE , SC_AC_OP_CREATE , SC_AC_OP_CREATE , SC_AC_OP_INVALIDATE , SC_AC_OP_REHABILITATE , SC_AC_OP_LOCK , SC_AC_OP_DELETE , - 1 } ; const int ef_idx [ 8 ] = { SC_AC_OP_READ , SC_AC_OP_UPDATE , SC_AC_OP_WRITE , SC_AC_OP_INVALIDATE , SC_AC_OP_REHABILITATE , - 1 , SC_AC_OP_ERASE , - 1 } ; const int efi_idx [ 8 ] = { SC_AC_OP_READ , SC_AC_OP_ERASE , SC_AC_OP_UPDATE , SC_AC_OP_INVALIDATE , SC_AC_OP_REHABILITATE , - 1 , SC_AC_OP_ERASE , - 1 } ; u8 bValue ; int i ; int iKeyRef = 0 ; int iMethod ; int iPinCount ; int iOffset = 0 ; int iOperation ; const int * p_idx ; while ( len > 1 ) { size_t iACLen = buf [ iOffset ] & 0x0F ; if ( iACLen > len ) break ; iMethod = SC_AC_NONE ; if ( buf [ iOffset ] & 0X80 ) { size_t iParmLen = 1 ; size_t iKeyLen = 0 ; if ( buf [ iOffset ] & 0x20 ) iKeyLen ++ ; if ( buf [ iOffset + 1 ] & 0x40 ) iParmLen ++ ; if ( buf [ iOffset + 1 ] & 0x20 ) iParmLen ++ ; if ( buf [ iOffset + 1 ] & 0x10 ) iParmLen ++ ; if ( buf [ iOffset + 1 ] & 0x08 ) iParmLen ++ ; if ( iKeyLen ) { int iSC ; if ( len < 1 + ( size_t ) iACLen ) break ; iSC = buf [ iOffset + iACLen ] ; switch ( ( iSC >> 5 ) & 0x03 ) { case 0 : iMethod = SC_AC_TERM ; break ; case 1 : iMethod = SC_AC_AUT ; break ; case 2 : case 3 : iMethod = SC_AC_PRO ; break ; } iKeyRef = iSC & 0x1F ; } if ( iACLen > ( 1 + iParmLen + iKeyLen ) ) { if ( len < 1 + 1 + 1 + ( size_t ) iParmLen ) break ; iKeyRef = buf [ iOffset + 1 + 1 + iParmLen ] ; iMethod = SC_AC_CHV ; } if ( len < 1 + 2 ) break ; switch ( buf [ iOffset + 2 ] ) { case 0x2A : iOperation = SC_AC_OP_CRYPTO ; break ; case 0x46 : iOperation = SC_AC_OP_UPDATE ; break ; default : iOperation = SC_AC_OP_SELECT ; break ; } sc_file_add_acl_entry ( file , iOperation , iMethod , iKeyRef ) ; } else { switch ( file -> type ) { case SC_FILE_TYPE_DF : p_idx = df_idx ; break ; case SC_FILE_TYPE_INTERNAL_EF : p_idx = efi_idx ; break ; default : p_idx = ef_idx ; break ; } <S2SV_StartBug> iPinCount = iACLen - 1 ; <S2SV_EndBug> if ( buf [ iOffset ] & 0x20 ) { int iSC ; if ( len < 1 + ( size_t ) iACLen ) break ; iSC = buf [ iOffset + iACLen ] ; switch ( ( iSC >> 5 ) & 0x03 ) { case 0 : iMethod = SC_AC_TERM ; break ; case 1 : iMethod = SC_AC_AUT ; break ; case 2 : case 3 : iMethod = SC_AC_PRO ; break ; } iKeyRef = iSC & 0x1F ; iPinCount -- ; } if ( iPinCount > 0 ) { if ( len < 1 + 2 ) break ; iKeyRef = buf [ iOffset + 2 ] ; iMethod = SC_AC_CHV ; } bValue = buf [ iOffset + 1 ] ; for ( i = 0 ; i < 8 ; i ++ ) { if ( ( bValue & 1 ) && ( p_idx [ i ] >= 0 ) ) sc_file_add_acl_entry ( file , p_idx [ i ] , iMethod , iKeyRef ) ; bValue >>= 1 ; } } iOffset += iACLen + 1 ; len -= iACLen + 1 ; } }
| <S2SV_ModStart> iPinCount = iACLen > 0 ? iACLen - 1 : 0 <S2SV_ModEnd> ; if (
| OpenSC@OpenSC/c3f23b836e5a1766c36617fe1da30d22f7b63de2 | CVE-2019-19479 | https://github.com/OpenSC/OpenSC/commit/c3f23b836e5a1766c36617fe1da30d22f7b63de2 | 2019-12-01T23:15Z |
6,732 | CWE-20 | CWE-20 static apr_status_t parse_chunk_size ( http_ctx_t * ctx , const char * buffer , apr_size_t len , int linelimit ) { apr_size_t i = 0 ; while ( i < len ) { char c = buffer [ i ] ; ap_xlate_proto_from_ascii ( & c , 1 ) ; <S2SV_StartBug> if ( ctx -> state == BODY_CHUNK_END ) { <S2SV_EndBug> if ( c == LF ) { <S2SV_StartBug> ctx -> state = BODY_CHUNK ; <S2SV_EndBug> } i ++ ; continue ; } if ( ctx -> state == BODY_CHUNK ) { if ( ! apr_isxdigit ( c ) ) { <S2SV_StartBug> return APR_EGENERAL ; <S2SV_EndBug> } else { ctx -> state = BODY_CHUNK_PART ; } ctx -> remaining = 0 ; <S2SV_StartBug> ctx -> chunkbits = sizeof ( long ) * 8 ; <S2SV_EndBug> ctx -> chunk_used = 0 ; } <S2SV_StartBug> if ( c == ';' || c == CR ) { <S2SV_EndBug> ctx -> state = BODY_CHUNK_EXT ; } <S2SV_StartBug> else if ( c == LF ) { <S2SV_EndBug> if ( ctx -> remaining ) { ctx -> state = BODY_CHUNK_DATA ; } else { ctx -> state = BODY_CHUNK_TRAILER ; } } else if ( ctx -> state != BODY_CHUNK_EXT ) { <S2SV_StartBug> int xvalue = 0 ; <S2SV_EndBug> if ( ! ctx -> remaining && c == '0' ) { i ++ ; <S2SV_StartBug> continue ; <S2SV_EndBug> } if ( c >= '0' && c <= '9' ) { xvalue = c - '0' ; } else if ( c >= 'A' && c <= 'F' ) { xvalue = c - 'A' + 0xa ; } else if ( c >= 'a' && c <= 'f' ) { xvalue = c - 'a' + 0xa ; } else { <S2SV_StartBug> return APR_EGENERAL ; <S2SV_EndBug> } ctx -> remaining = ( ctx -> remaining << 4 ) | xvalue ; <S2SV_StartBug> ctx -> chunkbits -= 4 ; <S2SV_EndBug> if ( ctx -> chunkbits <= 0 || ctx -> remaining < 0 ) { return APR_ENOSPC ; <S2SV_StartBug> } <S2SV_EndBug> } i ++ ; } ctx -> chunk_used += len ; if ( ctx -> chunk_used < 0 || ctx -> chunk_used > linelimit ) { return APR_ENOSPC ; } return APR_SUCCESS ; }
| <S2SV_ModStart> state == BODY_CHUNK_END || ctx -> state == BODY_CHUNK_END_LF <S2SV_ModStart> state = BODY_CHUNK ; } else if ( c == CR && ctx -> state == BODY_CHUNK_END ) { ctx -> state = BODY_CHUNK_END_LF ; } else { return APR_EINVAL <S2SV_ModStart> ) { return APR_EINVAL <S2SV_ModEnd> ; } else <S2SV_ModStart> = sizeof ( apr_off_t <S2SV_ModEnd> ) * 8 <S2SV_ModStart> ( c == LF ) { if ( ctx -> remaining ) { ctx -> state = BODY_CHUNK_DATA ; } else { ctx -> state = BODY_CHUNK_TRAILER ; } } else if ( ctx -> state == BODY_CHUNK_LF ) { return APR_EINVAL ; } else if ( c == CR ) { ctx -> state = BODY_CHUNK_LF ; } else if ( c == ';' <S2SV_ModEnd> ) { ctx <S2SV_ModStart> else if ( ctx -> state == BODY_CHUNK_EXT ) { if ( c != '\\t' && apr_iscntrl ( c ) ) { return APR_EINVAL ; } } else if ( ctx -> state == BODY_CHUNK_PART <S2SV_ModEnd> ) { int <S2SV_ModStart> { int xvalue <S2SV_ModEnd> ; if ( <S2SV_ModStart> ++ ; continue ; } ctx -> chunkbits -= 4 ; if ( ctx -> chunkbits < 0 ) { return APR_ENOSPC <S2SV_ModStart> else { return APR_EINVAL <S2SV_ModEnd> ; } ctx <S2SV_ModStart> | xvalue ; if ( <S2SV_ModEnd> ctx -> remaining <S2SV_ModStart> APR_ENOSPC ; } } else { return APR_EGENERAL ;
| apache@httpd/a6027e56924bb6227c1fdbf6f91e7e2438338be6 | CVE-2015-3183 | https://github.com/apache/httpd/commit/a6027e56924bb6227c1fdbf6f91e7e2438338be6 | 2015-07-20T23:59Z |
6,733 | CWE-787 | CWE-787 pdf_t * pdf_new ( const char * name ) { const char * n ; pdf_t * pdf ; <S2SV_StartBug> pdf = calloc ( 1 , sizeof ( pdf_t ) ) ; <S2SV_EndBug> if ( name ) { if ( ( n = strrchr ( name , '/' ) ) ) ++ n ; else n = name ; <S2SV_StartBug> pdf -> name = malloc ( strlen ( n ) + 1 ) ; <S2SV_EndBug> strcpy ( pdf -> name , n ) ; } else { <S2SV_StartBug> pdf -> name = malloc ( strlen ( "Unknown" ) + 1 ) ; <S2SV_EndBug> strcpy ( pdf -> name , "Unknown" ) ; } return pdf ; }
| <S2SV_ModStart> ; pdf = safe_calloc ( <S2SV_ModEnd> sizeof ( pdf_t <S2SV_ModStart> -> name = safe_calloc <S2SV_ModEnd> ( strlen ( <S2SV_ModStart> -> name = safe_calloc <S2SV_ModEnd> ( strlen (
| enferex@pdfresurrect/0c4120fffa3dffe97b95c486a120eded82afe8a6 | CVE-2019-14934 | https://github.com/enferex/pdfresurrect/commit/0c4120fffa3dffe97b95c486a120eded82afe8a6 | 2019-08-11T22:15Z |
6,734 | CWE-617 | CWE-617 static int pci_emul_alloc_resource ( uint64_t * baseptr , uint64_t limit , uint64_t size , uint64_t * addr ) { uint64_t base ; <S2SV_StartBug> assert ( ( size & ( size - 1 ) ) == 0 ) ; <S2SV_EndBug> base = roundup2 ( * baseptr , size ) ; if ( base + size <= limit ) { * addr = base ; * baseptr = base + size ; return 0 ; } else return - 1 ; }
| <S2SV_ModStart> uint64_t base ; if <S2SV_ModEnd> ( ( size <S2SV_ModStart> 1 ) ) != 0 ) { pr_err ( "%s:<S2SV_blank>Cannot<S2SV_blank>alloc<S2SV_blank>invalid<S2SV_blank>size<S2SV_blank>%lld<S2SV_blank>resource\\n" , __func__ , size ) ; return - 1 ; } <S2SV_ModEnd> base = roundup2
| projectacrn@acrn-hypervisor/2b3dedfb9ba13f15887f22b935d373f36c9a59fa | CVE-2019-18844 | https://github.com/projectacrn/acrn-hypervisor/commit/2b3dedfb9ba13f15887f22b935d373f36c9a59fa | 2019-11-13T20:15Z |
6,735 | CWE-295 | CWE-295 static krb5_error_code tgs_build_reply ( krb5_context context , krb5_kdc_configuration * config , KDC_REQ * req , KDC_REQ_BODY * b , hdb_entry_ex * krbtgt , krb5_enctype krbtgt_etype , const krb5_keyblock * replykey , int rk_is_subkey , krb5_ticket * ticket , krb5_data * reply , const char * from , const char * * e_text , AuthorizationData * * auth_data , const struct sockaddr * from_addr ) { krb5_error_code ret ; krb5_principal cp = NULL , sp = NULL , rsp = NULL , tp = NULL , dp = NULL ; krb5_principal krbtgt_out_principal = NULL ; char * spn = NULL , * cpn = NULL , * tpn = NULL , * dpn = NULL , * krbtgt_out_n = NULL ; hdb_entry_ex * server = NULL , * client = NULL , * s4u2self_impersonated_client = NULL ; HDB * clientdb , * s4u2self_impersonated_clientdb ; krb5_realm ref_realm = NULL ; EncTicketPart * tgt = & ticket -> ticket ; krb5_principals spp = NULL ; const EncryptionKey * ekey ; krb5_keyblock sessionkey ; krb5_kvno kvno ; <S2SV_StartBug> krb5_data rspac ; <S2SV_EndBug> const char * our_realm = krb5_principal_get_comp_string ( context , krbtgt -> entry . principal , 1 ) ; char * * capath = NULL ; size_t num_capath = 0 ; hdb_entry_ex * krbtgt_out = NULL ; METHOD_DATA enc_pa_data ; PrincipalName * s ; Realm r ; EncTicketPart adtkt ; char opt_str [ 128 ] ; int signedpath = 0 ; Key * tkey_check ; Key * tkey_sign ; int flags = HDB_F_FOR_TGS_REQ ; memset ( & sessionkey , 0 , sizeof ( sessionkey ) ) ; memset ( & adtkt , 0 , sizeof ( adtkt ) ) ; krb5_data_zero ( & rspac ) ; memset ( & enc_pa_data , 0 , sizeof ( enc_pa_data ) ) ; s = b -> sname ; r = b -> realm ; flags |= HDB_F_CANON ; if ( b -> kdc_options . enc_tkt_in_skey ) { Ticket * t ; hdb_entry_ex * uu ; krb5_principal p ; Key * uukey ; krb5uint32 second_kvno = 0 ; krb5uint32 * kvno_ptr = NULL ; if ( b -> additional_tickets == NULL || b -> additional_tickets -> len == 0 ) { ret = KRB5KDC_ERR_BADOPTION ; kdc_log ( context , config , 0 , "No<S2SV_blank>second<S2SV_blank>ticket<S2SV_blank>present<S2SV_blank>in<S2SV_blank>request" ) ; goto out ; } t = & b -> additional_tickets -> val [ 0 ] ; if ( ! get_krbtgt_realm ( & t -> sname ) ) { kdc_log ( context , config , 0 , "Additional<S2SV_blank>ticket<S2SV_blank>is<S2SV_blank>not<S2SV_blank>a<S2SV_blank>ticket-granting<S2SV_blank>ticket" ) ; ret = KRB5KDC_ERR_POLICY ; goto out ; } _krb5_principalname2krb5_principal ( context , & p , t -> sname , t -> realm ) ; if ( t -> enc_part . kvno ) { second_kvno = * t -> enc_part . kvno ; kvno_ptr = & second_kvno ; } ret = _kdc_db_fetch ( context , config , p , HDB_F_GET_KRBTGT , kvno_ptr , NULL , & uu ) ; krb5_free_principal ( context , p ) ; if ( ret ) { if ( ret == HDB_ERR_NOENTRY ) ret = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ; goto out ; } ret = hdb_enctype2key ( context , & uu -> entry , NULL , t -> enc_part . etype , & uukey ) ; if ( ret ) { _kdc_free_ent ( context , uu ) ; ret = KRB5KDC_ERR_ETYPE_NOSUPP ; goto out ; } ret = krb5_decrypt_ticket ( context , t , & uukey -> key , & adtkt , 0 ) ; _kdc_free_ent ( context , uu ) ; if ( ret ) goto out ; ret = verify_flags ( context , config , & adtkt , spn ) ; if ( ret ) goto out ; s = & adtkt . cname ; r = adtkt . crealm ; } _krb5_principalname2krb5_principal ( context , & sp , * s , r ) ; ret = krb5_unparse_name ( context , sp , & spn ) ; if ( ret ) goto out ; _krb5_principalname2krb5_principal ( context , & cp , tgt -> cname , tgt -> crealm ) ; ret = krb5_unparse_name ( context , cp , & cpn ) ; if ( ret ) goto out ; unparse_flags ( KDCOptions2int ( b -> kdc_options ) , asn1_KDCOptions_units ( ) , opt_str , sizeof ( opt_str ) ) ; if ( * opt_str ) kdc_log ( context , config , 0 , "TGS-REQ<S2SV_blank>%s<S2SV_blank>from<S2SV_blank>%s<S2SV_blank>for<S2SV_blank>%s<S2SV_blank>[%s]" , cpn , from , spn , opt_str ) ; else kdc_log ( context , config , 0 , "TGS-REQ<S2SV_blank>%s<S2SV_blank>from<S2SV_blank>%s<S2SV_blank>for<S2SV_blank>%s" , cpn , from , spn ) ; server_lookup : ret = _kdc_db_fetch ( context , config , sp , HDB_F_GET_SERVER | flags , NULL , NULL , & server ) ; if ( ret == HDB_ERR_NOT_FOUND_HERE ) { kdc_log ( context , config , 5 , "target<S2SV_blank>%s<S2SV_blank>does<S2SV_blank>not<S2SV_blank>have<S2SV_blank>secrets<S2SV_blank>at<S2SV_blank>this<S2SV_blank>KDC,<S2SV_blank>need<S2SV_blank>to<S2SV_blank>proxy" , sp ) ; goto out ; } else if ( ret == HDB_ERR_WRONG_REALM ) { free ( ref_realm ) ; ref_realm = strdup ( server -> entry . principal -> realm ) ; if ( ref_realm == NULL ) { ret = krb5_enomem ( context ) ; goto out ; } kdc_log ( context , config , 5 , "Returning<S2SV_blank>a<S2SV_blank>referral<S2SV_blank>to<S2SV_blank>realm<S2SV_blank>%s<S2SV_blank>for<S2SV_blank>" "server<S2SV_blank>%s." , ref_realm , spn ) ; krb5_free_principal ( context , sp ) ; sp = NULL ; ret = krb5_make_principal ( context , & sp , r , KRB5_TGS_NAME , ref_realm , NULL ) ; if ( ret ) goto out ; free ( spn ) ; spn = NULL ; ret = krb5_unparse_name ( context , sp , & spn ) ; if ( ret ) goto out ; goto server_lookup ; } else if ( ret ) { const char * new_rlm , * msg ; Realm req_rlm ; krb5_realm * realms ; if ( ( req_rlm = get_krbtgt_realm ( & sp -> name ) ) != NULL ) { if ( capath == NULL ) { ret = _krb5_find_capath ( context , tgt -> crealm , our_realm , req_rlm , TRUE , & capath , & num_capath ) ; if ( ret ) goto out ; } new_rlm = num_capath > 0 ? capath [ -- num_capath ] : NULL ; if ( new_rlm ) { kdc_log ( context , config , 5 , "krbtgt<S2SV_blank>from<S2SV_blank>%s<S2SV_blank>via<S2SV_blank>%s<S2SV_blank>for<S2SV_blank>" "realm<S2SV_blank>%s<S2SV_blank>not<S2SV_blank>found,<S2SV_blank>trying<S2SV_blank>%s" , tgt -> crealm , our_realm , req_rlm , new_rlm ) ; free ( ref_realm ) ; ref_realm = strdup ( new_rlm ) ; if ( ref_realm == NULL ) { ret = krb5_enomem ( context ) ; goto out ; } krb5_free_principal ( context , sp ) ; sp = NULL ; krb5_make_principal ( context , & sp , r , KRB5_TGS_NAME , ref_realm , NULL ) ; free ( spn ) ; spn = NULL ; ret = krb5_unparse_name ( context , sp , & spn ) ; if ( ret ) goto out ; goto server_lookup ; } } else if ( need_referral ( context , config , & b -> kdc_options , sp , & realms ) ) { if ( strcmp ( realms [ 0 ] , sp -> realm ) != 0 ) { kdc_log ( context , config , 5 , "Returning<S2SV_blank>a<S2SV_blank>referral<S2SV_blank>to<S2SV_blank>realm<S2SV_blank>%s<S2SV_blank>for<S2SV_blank>" "server<S2SV_blank>%s<S2SV_blank>that<S2SV_blank>was<S2SV_blank>not<S2SV_blank>found" , realms [ 0 ] , spn ) ; krb5_free_principal ( context , sp ) ; sp = NULL ; krb5_make_principal ( context , & sp , r , KRB5_TGS_NAME , realms [ 0 ] , NULL ) ; free ( spn ) ; spn = NULL ; ret = krb5_unparse_name ( context , sp , & spn ) ; if ( ret ) { krb5_free_host_realm ( context , realms ) ; goto out ; } free ( ref_realm ) ; ref_realm = strdup ( realms [ 0 ] ) ; krb5_free_host_realm ( context , realms ) ; goto server_lookup ; } krb5_free_host_realm ( context , realms ) ; } msg = krb5_get_error_message ( context , ret ) ; kdc_log ( context , config , 0 , "Server<S2SV_blank>not<S2SV_blank>found<S2SV_blank>in<S2SV_blank>database:<S2SV_blank>%s:<S2SV_blank>%s" , spn , msg ) ; krb5_free_error_message ( context , msg ) ; if ( ret == HDB_ERR_NOENTRY ) ret = KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN ; goto out ; } if ( b -> kdc_options . canonicalize ) rsp = server -> entry . principal ; else rsp = sp ; { krb5_enctype etype ; if ( b -> kdc_options . enc_tkt_in_skey ) { size_t i ; ekey = & adtkt . key ; for ( i = 0 ; i < b -> etype . len ; i ++ ) if ( b -> etype . val [ i ] == adtkt . key . keytype ) break ; if ( i == b -> etype . len ) { kdc_log ( context , config , 0 , "Addition<S2SV_blank>ticket<S2SV_blank>have<S2SV_blank>not<S2SV_blank>matching<S2SV_blank>etypes" ) ; krb5_clear_error_message ( context ) ; ret = KRB5KDC_ERR_ETYPE_NOSUPP ; goto out ; } etype = b -> etype . val [ i ] ; kvno = 0 ; } else { Key * skey ; ret = _kdc_find_etype ( context , krb5_principal_is_krbtgt ( context , sp ) ? config -> tgt_use_strongest_session_key : config -> svc_use_strongest_session_key , FALSE , server , b -> etype . val , b -> etype . len , & etype , NULL ) ; if ( ret ) { kdc_log ( context , config , 0 , "Server<S2SV_blank>(%s)<S2SV_blank>has<S2SV_blank>no<S2SV_blank>support<S2SV_blank>for<S2SV_blank>etypes" , spn ) ; goto out ; } ret = _kdc_get_preferred_key ( context , config , server , spn , NULL , & skey ) ; if ( ret ) { kdc_log ( context , config , 0 , "Server<S2SV_blank>(%s)<S2SV_blank>has<S2SV_blank>no<S2SV_blank>supported<S2SV_blank>etypes" , spn ) ; goto out ; } ekey = & skey -> key ; kvno = server -> entry . kvno ; } ret = krb5_generate_random_keyblock ( context , etype , & sessionkey ) ; if ( ret ) goto out ; } ret = hdb_enctype2key ( context , & krbtgt -> entry , NULL , krbtgt_etype , & tkey_check ) ; if ( ret ) { kdc_log ( context , config , 0 , "Failed<S2SV_blank>to<S2SV_blank>find<S2SV_blank>key<S2SV_blank>for<S2SV_blank>krbtgt<S2SV_blank>PAC<S2SV_blank>check" ) ; goto out ; } ret = krb5_make_principal ( context , & krbtgt_out_principal , our_realm , KRB5_TGS_NAME , our_realm , NULL ) ; if ( ret ) { kdc_log ( context , config , 0 , "Failed<S2SV_blank>to<S2SV_blank>make<S2SV_blank>krbtgt<S2SV_blank>principal<S2SV_blank>name<S2SV_blank>object<S2SV_blank>for<S2SV_blank>" "authz-data<S2SV_blank>signatures" ) ; goto out ; } ret = krb5_unparse_name ( context , krbtgt_out_principal , & krbtgt_out_n ) ; if ( ret ) { kdc_log ( context , config , 0 , "Failed<S2SV_blank>to<S2SV_blank>make<S2SV_blank>krbtgt<S2SV_blank>principal<S2SV_blank>name<S2SV_blank>object<S2SV_blank>for<S2SV_blank>" "authz-data<S2SV_blank>signatures" ) ; goto out ; } ret = _kdc_db_fetch ( context , config , krbtgt_out_principal , HDB_F_GET_KRBTGT , NULL , NULL , & krbtgt_out ) ; if ( ret ) { char * ktpn = NULL ; ret = krb5_unparse_name ( context , krbtgt -> entry . principal , & ktpn ) ; kdc_log ( context , config , 0 , "No<S2SV_blank>such<S2SV_blank>principal<S2SV_blank>%s<S2SV_blank>(needed<S2SV_blank>for<S2SV_blank>authz-data<S2SV_blank>signature<S2SV_blank>keys)<S2SV_blank>" "while<S2SV_blank>processing<S2SV_blank>TGS-REQ<S2SV_blank>for<S2SV_blank>service<S2SV_blank>%s<S2SV_blank>with<S2SV_blank>krbtg<S2SV_blank>%s" , krbtgt_out_n , spn , ( ret == 0 ) ? ktpn : "<unknown>" ) ; free ( ktpn ) ; ret = KRB5KRB_AP_ERR_NOT_US ; goto out ; } if ( strcmp ( krb5_principal_get_realm ( context , server -> entry . principal ) , krb5_principal_get_realm ( context , krbtgt_out -> entry . principal ) ) != 0 ) { char * ktpn ; ret = krb5_unparse_name ( context , krbtgt_out -> entry . principal , & ktpn ) ; kdc_log ( context , config , 0 , "Request<S2SV_blank>with<S2SV_blank>wrong<S2SV_blank>krbtgt:<S2SV_blank>%s" , ( ret == 0 ) ? ktpn : "<unknown>" ) ; if ( ret == 0 ) free ( ktpn ) ; ret = KRB5KRB_AP_ERR_NOT_US ; goto out ; } ret = _kdc_get_preferred_key ( context , config , krbtgt_out , krbtgt_out_n , NULL , & tkey_sign ) ; if ( ret ) { kdc_log ( context , config , 0 , "Failed<S2SV_blank>to<S2SV_blank>find<S2SV_blank>key<S2SV_blank>for<S2SV_blank>krbtgt<S2SV_blank>PAC<S2SV_blank>signature" ) ; goto out ; } ret = hdb_enctype2key ( context , & krbtgt_out -> entry , NULL , tkey_sign -> key . keytype , & tkey_sign ) ; if ( ret ) { kdc_log ( context , config , 0 , "Failed<S2SV_blank>to<S2SV_blank>find<S2SV_blank>key<S2SV_blank>for<S2SV_blank>krbtgt<S2SV_blank>PAC<S2SV_blank>signature" ) ; goto out ; } ret = _kdc_db_fetch ( context , config , cp , HDB_F_GET_CLIENT | flags , NULL , & clientdb , & client ) ; if ( ret == HDB_ERR_NOT_FOUND_HERE ) { } else if ( ret ) { const char * krbtgt_realm , * msg ; krbtgt_realm = krb5_principal_get_realm ( context , krbtgt_out -> entry . principal ) ; if ( strcmp ( krb5_principal_get_realm ( context , cp ) , krbtgt_realm ) == 0 ) { if ( ret == HDB_ERR_NOENTRY ) ret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN ; kdc_log ( context , config , 1 , "Client<S2SV_blank>no<S2SV_blank>longer<S2SV_blank>in<S2SV_blank>database:<S2SV_blank>%s" , cpn ) ; goto out ; } msg = krb5_get_error_message ( context , ret ) ; kdc_log ( context , config , 1 , "Client<S2SV_blank>not<S2SV_blank>found<S2SV_blank>in<S2SV_blank>database:<S2SV_blank>%s" , msg ) ; krb5_free_error_message ( context , msg ) ; } ret = check_PAC ( context , config , cp , NULL , client , server , krbtgt , & tkey_check -> key , ekey , & tkey_sign -> key , tgt , & rspac , & signedpath ) ; if ( ret ) { const char * msg = krb5_get_error_message ( context , ret ) ; kdc_log ( context , config , 0 , "Verify<S2SV_blank>PAC<S2SV_blank>failed<S2SV_blank>for<S2SV_blank>%s<S2SV_blank>(%s)<S2SV_blank>from<S2SV_blank>%s<S2SV_blank>with<S2SV_blank>%s" , spn , cpn , from , msg ) ; krb5_free_error_message ( context , msg ) ; goto out ; } ret = check_KRB5SignedPath ( context , config , krbtgt , cp , tgt , & spp , & signedpath ) ; if ( ret ) { const char * msg = krb5_get_error_message ( context , ret ) ; kdc_log ( context , config , 0 , "KRB5SignedPath<S2SV_blank>check<S2SV_blank>failed<S2SV_blank>for<S2SV_blank>%s<S2SV_blank>(%s)<S2SV_blank>from<S2SV_blank>%s<S2SV_blank>with<S2SV_blank>%s" , spn , cpn , from , msg ) ; krb5_free_error_message ( context , msg ) ; goto out ; } tp = cp ; tpn = cpn ; if ( client ) { const PA_DATA * sdata ; int i = 0 ; sdata = _kdc_find_padata ( req , & i , KRB5_PADATA_FOR_USER ) ; if ( sdata ) { krb5_crypto crypto ; krb5_data datack ; PA_S4U2Self self ; const char * str ; ret = decode_PA_S4U2Self ( sdata -> padata_value . data , sdata -> padata_value . length , & self , NULL ) ; if ( ret ) { kdc_log ( context , config , 0 , "Failed<S2SV_blank>to<S2SV_blank>decode<S2SV_blank>PA-S4U2Self" ) ; goto out ; } ret = _krb5_s4u2self_to_checksumdata ( context , & self , & datack ) ; if ( ret ) goto out ; ret = krb5_crypto_init ( context , & tgt -> key , 0 , & crypto ) ; if ( ret ) { const char * msg = krb5_get_error_message ( context , ret ) ; free_PA_S4U2Self ( & self ) ; krb5_data_free ( & datack ) ; kdc_log ( context , config , 0 , "krb5_crypto_init<S2SV_blank>failed:<S2SV_blank>%s" , msg ) ; krb5_free_error_message ( context , msg ) ; goto out ; } ret = krb5_verify_checksum ( context , crypto , KRB5_KU_OTHER_CKSUM , datack . data , datack . length , & self . cksum ) ; krb5_data_free ( & datack ) ; krb5_crypto_destroy ( context , crypto ) ; if ( ret ) { const char * msg = krb5_get_error_message ( context , ret ) ; free_PA_S4U2Self ( & self ) ; kdc_log ( context , config , 0 , "krb5_verify_checksum<S2SV_blank>failed<S2SV_blank>for<S2SV_blank>S4U2Self:<S2SV_blank>%s" , msg ) ; krb5_free_error_message ( context , msg ) ; goto out ; } ret = _krb5_principalname2krb5_principal ( context , & tp , self . name , self . realm ) ; free_PA_S4U2Self ( & self ) ; if ( ret ) goto out ; ret = krb5_unparse_name ( context , tp , & tpn ) ; if ( ret ) goto out ; if ( rspac . data ) { krb5_pac p = NULL ; krb5_data_free ( & rspac ) ; ret = _kdc_db_fetch ( context , config , tp , HDB_F_GET_CLIENT | flags , NULL , & s4u2self_impersonated_clientdb , & s4u2self_impersonated_client ) ; if ( ret ) { const char * msg ; if ( ret == HDB_ERR_NOENTRY ) ret = KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN ; msg = krb5_get_error_message ( context , ret ) ; kdc_log ( context , config , 1 , "S2U4Self<S2SV_blank>principal<S2SV_blank>to<S2SV_blank>impersonate<S2SV_blank>%s<S2SV_blank>not<S2SV_blank>found<S2SV_blank>in<S2SV_blank>database:<S2SV_blank>%s" , tpn , msg ) ; krb5_free_error_message ( context , msg ) ; goto out ; } ret = _kdc_pac_generate ( context , s4u2self_impersonated_client , & p ) ; if ( ret ) { kdc_log ( context , config , 0 , "PAC<S2SV_blank>generation<S2SV_blank>failed<S2SV_blank>for<S2SV_blank>--<S2SV_blank>%s" , tpn ) ; goto out ; } if ( p != NULL ) { ret = _krb5_pac_sign ( context , p , ticket -> ticket . authtime , s4u2self_impersonated_client -> entry . principal , ekey , & tkey_sign -> key , & rspac ) ; krb5_pac_free ( context , p ) ; if ( ret ) { kdc_log ( context , config , 0 , "PAC<S2SV_blank>signing<S2SV_blank>failed<S2SV_blank>for<S2SV_blank>--<S2SV_blank>%s" , tpn ) ; goto out ; } } } ret = check_s4u2self ( context , config , clientdb , client , sp ) ; if ( ret ) { kdc_log ( context , config , 0 , "S4U2Self:<S2SV_blank>%s<S2SV_blank>is<S2SV_blank>not<S2SV_blank>allowed<S2SV_blank>" "to<S2SV_blank>impersonate<S2SV_blank>to<S2SV_blank>service<S2SV_blank>" "(tried<S2SV_blank>for<S2SV_blank>user<S2SV_blank>%s<S2SV_blank>to<S2SV_blank>service<S2SV_blank>%s)" , cpn , tpn , spn ) ; goto out ; } if ( client -> entry . flags . trusted_for_delegation ) { str = "[forwardable]" ; } else { b -> kdc_options . forwardable = 0 ; str = "" ; } kdc_log ( context , config , 0 , "s4u2self<S2SV_blank>%s<S2SV_blank>impersonating<S2SV_blank>%s<S2SV_blank>to<S2SV_blank>" "service<S2SV_blank>%s<S2SV_blank>%s" , cpn , tpn , spn , str ) ; } } if ( client != NULL && b -> additional_tickets != NULL && b -> additional_tickets -> len != 0 && b -> kdc_options . enc_tkt_in_skey == 0 ) { int ad_signedpath = 0 ; Key * clientkey ; Ticket * t ; if ( ! signedpath ) { ret = KRB5KDC_ERR_BADOPTION ; kdc_log ( context , config , 0 , "Constrained<S2SV_blank>delegation<S2SV_blank>done<S2SV_blank>on<S2SV_blank>service<S2SV_blank>ticket<S2SV_blank>%s/%s" , cpn , spn ) ; goto out ; } t = & b -> additional_tickets -> val [ 0 ] ; ret = hdb_enctype2key ( context , & client -> entry , hdb_kvno2keys ( context , & client -> entry , t -> enc_part . kvno ? * t -> enc_part . kvno : 0 ) , t -> enc_part . etype , & clientkey ) ; if ( ret ) { ret = KRB5KDC_ERR_ETYPE_NOSUPP ; goto out ; } ret = krb5_decrypt_ticket ( context , t , & clientkey -> key , & adtkt , 0 ) ; if ( ret ) { kdc_log ( context , config , 0 , "failed<S2SV_blank>to<S2SV_blank>decrypt<S2SV_blank>ticket<S2SV_blank>for<S2SV_blank>" "constrained<S2SV_blank>delegation<S2SV_blank>from<S2SV_blank>%s<S2SV_blank>to<S2SV_blank>%s<S2SV_blank>" , cpn , spn ) ; goto out ; } ret = _krb5_principalname2krb5_principal ( context , & tp , adtkt . cname , adtkt . crealm ) ; if ( ret ) goto out ; ret = krb5_unparse_name ( context , tp , & tpn ) ; if ( ret ) goto out ; ret = _krb5_principalname2krb5_principal ( context , & dp , t -> sname , t -> realm ) ; if ( ret ) goto out ; ret = krb5_unparse_name ( context , dp , & dpn ) ; if ( ret ) goto out ; if ( adtkt . flags . forwardable == 0 ) { kdc_log ( context , config , 0 , "Missing<S2SV_blank>forwardable<S2SV_blank>flag<S2SV_blank>on<S2SV_blank>ticket<S2SV_blank>for<S2SV_blank>" "constrained<S2SV_blank>delegation<S2SV_blank>from<S2SV_blank>%s<S2SV_blank>(%s)<S2SV_blank>as<S2SV_blank>%s<S2SV_blank>to<S2SV_blank>%s<S2SV_blank>" , cpn , dpn , tpn , spn ) ; ret = KRB5KDC_ERR_BADOPTION ; goto out ; } ret = check_constrained_delegation ( context , config , clientdb , client , server , sp ) ; if ( ret ) { kdc_log ( context , config , 0 , "constrained<S2SV_blank>delegation<S2SV_blank>from<S2SV_blank>%s<S2SV_blank>(%s)<S2SV_blank>as<S2SV_blank>%s<S2SV_blank>to<S2SV_blank>%s<S2SV_blank>not<S2SV_blank>allowed" , cpn , dpn , tpn , spn ) ; goto out ; } ret = verify_flags ( context , config , & adtkt , tpn ) ; if ( ret ) { goto out ; } krb5_data_free ( & rspac ) ; ret = check_PAC ( context , config , tp , dp , client , server , krbtgt , & clientkey -> key , ekey , & tkey_sign -> key , & adtkt , & rspac , & ad_signedpath ) ; if ( ret ) { const char * msg = krb5_get_error_message ( context , ret ) ; kdc_log ( context , config , 0 , "Verify<S2SV_blank>delegated<S2SV_blank>PAC<S2SV_blank>failed<S2SV_blank>to<S2SV_blank>%s<S2SV_blank>for<S2SV_blank>client" "%s<S2SV_blank>(%s)<S2SV_blank>as<S2SV_blank>%s<S2SV_blank>from<S2SV_blank>%s<S2SV_blank>with<S2SV_blank>%s" , spn , cpn , dpn , tpn , from , msg ) ; krb5_free_error_message ( context , msg ) ; goto out ; } ret = check_KRB5SignedPath ( context , config , krbtgt , cp , & adtkt , NULL , & ad_signedpath ) ; if ( ret ) { const char * msg = krb5_get_error_message ( context , ret ) ; kdc_log ( context , config , 0 , "KRB5SignedPath<S2SV_blank>check<S2SV_blank>from<S2SV_blank>service<S2SV_blank>%s<S2SV_blank>failed<S2SV_blank>" "for<S2SV_blank>delegation<S2SV_blank>to<S2SV_blank>%s<S2SV_blank>for<S2SV_blank>client<S2SV_blank>%s<S2SV_blank>(%s)" "from<S2SV_blank>%s<S2SV_blank>failed<S2SV_blank>with<S2SV_blank>%s" , spn , tpn , dpn , cpn , from , msg ) ; krb5_free_error_message ( context , msg ) ; goto out ; } if ( ! ad_signedpath ) { ret = KRB5KDC_ERR_BADOPTION ; kdc_log ( context , config , 0 , "Ticket<S2SV_blank>not<S2SV_blank>signed<S2SV_blank>with<S2SV_blank>PAC<S2SV_blank>nor<S2SV_blank>SignedPath<S2SV_blank>service<S2SV_blank>%s<S2SV_blank>failed<S2SV_blank>" "for<S2SV_blank>delegation<S2SV_blank>to<S2SV_blank>%s<S2SV_blank>for<S2SV_blank>client<S2SV_blank>%s<S2SV_blank>(%s)" "from<S2SV_blank>%s" , spn , tpn , dpn , cpn , from ) ; goto out ; } kdc_log ( context , config , 0 , "constrained<S2SV_blank>delegation<S2SV_blank>for<S2SV_blank>%s<S2SV_blank>" "from<S2SV_blank>%s<S2SV_blank>(%s)<S2SV_blank>to<S2SV_blank>%s" , tpn , cpn , dpn , spn ) ; } ret = kdc_check_flags ( context , config , client , cpn , server , spn , FALSE ) ; if ( ret ) goto out ; if ( ( b -> kdc_options . validate || b -> kdc_options . renew ) && ! krb5_principal_compare ( context , krbtgt -> entry . principal , server -> entry . principal ) ) { kdc_log ( context , config , 0 , "Inconsistent<S2SV_blank>request." ) ; ret = KRB5KDC_ERR_SERVER_NOMATCH ; goto out ; } if ( ! _kdc_check_addresses ( context , config , tgt -> caddr , from_addr ) ) { ret = KRB5KRB_AP_ERR_BADADDR ; kdc_log ( context , config , 0 , "Request<S2SV_blank>from<S2SV_blank>wrong<S2SV_blank>address" ) ; goto out ; } if ( ref_realm ) { PA_DATA pa ; krb5_crypto crypto ; kdc_log ( context , config , 0 , "Adding<S2SV_blank>server<S2SV_blank>referral<S2SV_blank>to<S2SV_blank>%s" , ref_realm ) ; ret = krb5_crypto_init ( context , & sessionkey , 0 , & crypto ) ; if ( ret ) goto out ; ret = build_server_referral ( context , config , crypto , ref_realm , NULL , s , & pa . padata_value ) ; krb5_crypto_destroy ( context , crypto ) ; if ( ret ) { kdc_log ( context , config , 0 , "Failed<S2SV_blank>building<S2SV_blank>server<S2SV_blank>referral" ) ; goto out ; } pa . padata_type = KRB5_PADATA_SERVER_REFERRAL ; ret = add_METHOD_DATA ( & enc_pa_data , & pa ) ; krb5_data_free ( & pa . padata_value ) ; if ( ret ) { kdc_log ( context , config , 0 , "Add<S2SV_blank>server<S2SV_blank>referral<S2SV_blank>METHOD-DATA<S2SV_blank>failed" ) ; goto out ; } } ret = tgs_make_reply ( context , config , b , tp , tgt , replykey , rk_is_subkey , ekey , & sessionkey , kvno , * auth_data , server , rsp , spn , client , cp , <S2SV_StartBug> krbtgt_out , <S2SV_EndBug> tkey_sign -> key . keytype , spp , & rspac , & enc_pa_data , e_text , reply ) ; out : if ( tpn != cpn ) free ( tpn ) ; free ( spn ) ; free ( cpn ) ; free ( dpn ) ; free ( krbtgt_out_n ) ; _krb5_free_capath ( context , capath ) ; krb5_data_free ( & rspac ) ; krb5_free_keyblock_contents ( context , & sessionkey ) ; if ( krbtgt_out ) _kdc_free_ent ( context , krbtgt_out ) ; if ( server ) _kdc_free_ent ( context , server ) ; if ( client ) _kdc_free_ent ( context , client ) ; if ( s4u2self_impersonated_client ) _kdc_free_ent ( context , s4u2self_impersonated_client ) ; if ( tp && tp != cp ) krb5_free_principal ( context , tp ) ; krb5_free_principal ( context , cp ) ; krb5_free_principal ( context , dp ) ; krb5_free_principal ( context , sp ) ; krb5_free_principal ( context , krbtgt_out_principal ) ; free ( ref_realm ) ; free_METHOD_DATA ( & enc_pa_data ) ; free_EncTicketPart ( & adtkt ) ; return ret ; }
| <S2SV_ModStart> ; krb5_data rspac ; const char * tgt_realm = krb5_principal_get_realm ( context , krbtgt -> entry . principal ) <S2SV_ModStart> , cp , tgt_realm ,
| heimdal@heimdal/b1e699103f08d6a0ca46a122193c9da65f6cf837 | CVE-2017-6594 | https://github.com/heimdal/heimdal/commit/b1e699103f08d6a0ca46a122193c9da65f6cf837 | 2017-08-28T19:29Z |
6,736 | CWE-284 | CWE-284 static int http_connect ( http_subtransport * t ) { int error ; if ( t -> connected && http_should_keep_alive ( & t -> parser ) && t -> parse_finished ) return 0 ; if ( t -> io ) { git_stream_close ( t -> io ) ; git_stream_free ( t -> io ) ; t -> io = NULL ; t -> connected = 0 ; } if ( t -> connection_data . use_ssl ) { error = git_tls_stream_new ( & t -> io , t -> connection_data . host , t -> connection_data . port ) ; } else { # ifdef GIT_CURL error = git_curl_stream_new ( & t -> io , t -> connection_data . host , t -> connection_data . port ) ; # else error = git_socket_stream_new ( & t -> io , t -> connection_data . host , t -> connection_data . port ) ; # endif } if ( error < 0 ) return error ; GITERR_CHECK_VERSION ( t -> io , GIT_STREAM_VERSION , "git_stream" ) ; apply_proxy_config ( t ) ; error = git_stream_connect ( t -> io ) ; if ( ( ! error || error == GIT_ECERTIFICATE ) && t -> owner -> certificate_check_cb != NULL && git_stream_is_encrypted ( t -> io ) ) { git_cert * cert ; <S2SV_StartBug> int is_valid ; <S2SV_EndBug> if ( ( error = git_stream_certificate ( & cert , t -> io ) ) < 0 ) return error ; <S2SV_StartBug> giterr_clear ( ) ; <S2SV_EndBug> is_valid = error != GIT_ECERTIFICATE ; error = t -> owner -> certificate_check_cb ( cert , is_valid , t -> connection_data . host , t -> owner -> message_cb_payload ) ; if ( error < 0 ) { if ( ! giterr_last ( ) ) giterr_set ( GITERR_NET , "user<S2SV_blank>cancelled<S2SV_blank>certificate<S2SV_blank>check" ) ; return error ; } } if ( error < 0 ) return error ; t -> connected = 1 ; return 0 ; }
| <S2SV_ModStart> ; int is_valid = ( error == GIT_OK ) <S2SV_ModStart> giterr_clear ( ) <S2SV_ModEnd> ; error =
| libgit2@libgit2/9a64e62f0f20c9cf9b2e1609f037060eb2d8eb22 | CVE-2016-10130 | https://github.com/libgit2/libgit2/commit/9a64e62f0f20c9cf9b2e1609f037060eb2d8eb22 | 2017-03-24T15:59Z |
6,737 | CWE-284 | CWE-284 int bta_co_rfc_data_outgoing_size ( void * user_data , int * size ) { pthread_mutex_lock ( & slot_lock ) ; uint32_t id = ( uintptr_t ) user_data ; int ret = false ; * size = 0 ; rfc_slot_t * slot = find_rfc_slot_by_id ( id ) ; if ( ! slot ) goto out ; <S2SV_StartBug> if ( ioctl ( slot -> fd , FIONREAD , size ) == 0 ) { <S2SV_EndBug> ret = true ; } else { LOG_ERROR ( "%s<S2SV_blank>unable<S2SV_blank>to<S2SV_blank>determine<S2SV_blank>bytes<S2SV_blank>remaining<S2SV_blank>to<S2SV_blank>be<S2SV_blank>read<S2SV_blank>on<S2SV_blank>fd<S2SV_blank>%d:<S2SV_blank>%s" , __func__ , slot -> fd , strerror ( errno ) ) ; cleanup_rfc_slot ( slot ) ; } out : ; pthread_mutex_unlock ( & slot_lock ) ; return ret ; }
| <S2SV_ModStart> ; if ( TEMP_FAILURE_RETRY ( <S2SV_ModStart> FIONREAD , size )
| system@bt/472271b153c5dc53c28beac55480a8d8434b2d5c | CVE-2016-3839 | https://android.googlesource.com/platform/system/bt/+/472271b153c5dc53c28beac55480a8d8434b2d5c | 2016-08-05T20:59Z |
6,738 | CWE-918 | CWE-918 static int daemon_msg_open_req ( uint8 ver , struct daemon_slpars * pars , uint32 plen , char * source , size_t sourcelen ) { char errbuf [ PCAP_ERRBUF_SIZE ] ; char errmsgbuf [ PCAP_ERRBUF_SIZE ] ; pcap_t * fp ; int nread ; char sendbuf [ RPCAP_NETBUF_SIZE ] ; int sendbufidx = 0 ; struct rpcap_openreply * openreply ; if ( plen > sourcelen - 1 ) { pcap_snprintf ( errmsgbuf , PCAP_ERRBUF_SIZE , "Source<S2SV_blank>string<S2SV_blank>too<S2SV_blank>long" ) ; goto error ; } nread = sock_recv ( pars -> sockctrl , source , plen , SOCK_RECEIVEALL_YES | SOCK_EOF_IS_ERROR , errbuf , PCAP_ERRBUF_SIZE ) ; if ( nread == - 1 ) { rpcapd_log ( LOGPRIO_ERROR , "Read<S2SV_blank>from<S2SV_blank>client<S2SV_blank>failed:<S2SV_blank>%s" , errbuf ) ; return - 1 ; } source [ nread ] = '\\0' ; plen -= nread ; <S2SV_StartBug> if ( ( fp = pcap_open_live ( source , <S2SV_EndBug> 1500 , 0 , 1000 , errmsgbuf ) ) == NULL ) goto error ; if ( sock_bufferize ( NULL , sizeof ( struct rpcap_header ) , NULL , & sendbufidx , RPCAP_NETBUF_SIZE , SOCKBUF_CHECKONLY , errmsgbuf , PCAP_ERRBUF_SIZE ) == - 1 ) goto error ; rpcap_createhdr ( ( struct rpcap_header * ) sendbuf , ver , RPCAP_MSG_OPEN_REPLY , 0 , sizeof ( struct rpcap_openreply ) ) ; openreply = ( struct rpcap_openreply * ) & sendbuf [ sendbufidx ] ; if ( sock_bufferize ( NULL , sizeof ( struct rpcap_openreply ) , NULL , & sendbufidx , RPCAP_NETBUF_SIZE , SOCKBUF_CHECKONLY , errmsgbuf , PCAP_ERRBUF_SIZE ) == - 1 ) goto error ; memset ( openreply , 0 , sizeof ( struct rpcap_openreply ) ) ; openreply -> linktype = htonl ( pcap_datalink ( fp ) ) ; openreply -> tzoff = 0 ; pcap_close ( fp ) ; if ( sock_send ( pars -> sockctrl , sendbuf , sendbufidx , errbuf , PCAP_ERRBUF_SIZE ) == - 1 ) { rpcapd_log ( LOGPRIO_ERROR , "Send<S2SV_blank>to<S2SV_blank>client<S2SV_blank>failed:<S2SV_blank>%s" , errbuf ) ; return - 1 ; } return 0 ; error : if ( rpcap_senderror ( pars -> sockctrl , ver , PCAP_ERR_OPEN , errmsgbuf , errbuf ) == - 1 ) { rpcapd_log ( LOGPRIO_ERROR , "Send<S2SV_blank>to<S2SV_blank>client<S2SV_blank>failed:<S2SV_blank>%s" , errbuf ) ; return - 1 ; } if ( rpcapd_discard ( pars -> sockctrl , plen ) == - 1 ) { return - 1 ; } return 0 ; }
| <S2SV_ModStart> ; if ( is_url ( source ) ) { pcap_snprintf ( errmsgbuf , PCAP_ERRBUF_SIZE , "Source<S2SV_blank>string<S2SV_blank>refers<S2SV_blank>to<S2SV_blank>a<S2SV_blank>remote<S2SV_blank>device" ) ; goto error ; } if (
| the-tcpdump-group@libpcap/33834cb2a4d035b52aa2a26742f832a112e90a0a | CVE-2019-15164 | https://github.com/the-tcpdump-group/libpcap/commit/33834cb2a4d035b52aa2a26742f832a112e90a0a | 2019-10-03T19:15Z |
6,739 | CWE-416 | CWE-416 static int archive_read_format_rar_read_data ( struct archive_read * a , const void * * buff , size_t * size , int64_t * offset ) { struct rar * rar = ( struct rar * ) ( a -> format -> data ) ; int ret ; if ( rar -> has_encrypted_entries == ARCHIVE_READ_FORMAT_ENCRYPTION_DONT_KNOW ) { rar -> has_encrypted_entries = 0 ; } if ( rar -> bytes_unconsumed > 0 ) { __archive_read_consume ( a , rar -> bytes_unconsumed ) ; rar -> bytes_unconsumed = 0 ; } * buff = NULL ; if ( rar -> entry_eof || rar -> offset_seek >= rar -> unp_size ) { * size = 0 ; * offset = rar -> offset ; if ( * offset < rar -> unp_size ) * offset = rar -> unp_size ; return ( ARCHIVE_EOF ) ; } switch ( rar -> compression_method ) { case COMPRESS_METHOD_STORE : ret = read_data_stored ( a , buff , size , offset ) ; break ; case COMPRESS_METHOD_FASTEST : case COMPRESS_METHOD_FAST : case COMPRESS_METHOD_NORMAL : case COMPRESS_METHOD_GOOD : case COMPRESS_METHOD_BEST : ret = read_data_compressed ( a , buff , size , offset ) ; <S2SV_StartBug> if ( ret != ARCHIVE_OK && ret != ARCHIVE_WARN ) <S2SV_EndBug> __archive_ppmd7_functions . Ppmd7_Free ( & rar -> ppmd7_context ) ; <S2SV_StartBug> break ; <S2SV_EndBug> default : archive_set_error ( & a -> archive , ARCHIVE_ERRNO_FILE_FORMAT , "Unsupported<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>for<S2SV_blank>RAR<S2SV_blank>file." ) ; ret = ARCHIVE_FATAL ; break ; } return ( ret ) ; }
| <S2SV_ModStart> != ARCHIVE_WARN ) { <S2SV_ModStart> ppmd7_context ) ; rar -> start_new_table = 1 ; }
| libarchive@libarchive/b8592ecba2f9e451e1f5cb7ab6dcee8b8e7b3f60 | CVE-2019-18408 | https://github.com/libarchive/libarchive/commit/b8592ecba2f9e451e1f5cb7ab6dcee8b8e7b3f60 | 2019-10-24T14:15Z |
6,740 | CWE-400 | CWE-400 void handle_stdfmna ( struct pt_regs * regs , unsigned long sfar , unsigned long sfsr ) { unsigned long pc = regs -> tpc ; unsigned long tstate = regs -> tstate ; u32 insn ; u64 value ; u8 freg ; int flag ; struct fpustate * f = FPUSTATE ; if ( tstate & TSTATE_PRIV ) die_if_kernel ( "stdfmna<S2SV_blank>from<S2SV_blank>kernel" , regs ) ; <S2SV_StartBug> perf_sw_event ( PERF_COUNT_SW_ALIGNMENT_FAULTS , 1 , 0 , regs , sfar ) ; <S2SV_EndBug> if ( test_thread_flag ( TIF_32BIT ) ) pc = ( u32 ) pc ; if ( get_user ( insn , ( u32 __user * ) pc ) != - EFAULT ) { int asi = decode_asi ( insn , regs ) ; freg = ( ( insn >> 25 ) & 0x1e ) | ( ( insn >> 20 ) & 0x20 ) ; value = 0 ; flag = ( freg < 32 ) ? FPRS_DL : FPRS_DU ; if ( ( asi > ASI_SNFL ) || ( asi < ASI_P ) ) goto daex ; save_and_clear_fpu ( ) ; if ( current_thread_info ( ) -> fpsaved [ 0 ] & flag ) value = * ( u64 * ) & f -> regs [ freg ] ; switch ( asi ) { case ASI_P : case ASI_S : break ; case ASI_PL : case ASI_SL : value = __swab64p ( & value ) ; break ; default : goto daex ; } if ( put_user ( value >> 32 , ( u32 __user * ) sfar ) || __put_user ( ( u32 ) value , ( u32 __user * ) ( sfar + 4 ) ) ) goto daex ; } else { daex : if ( tlb_type == hypervisor ) sun4v_data_access_exception ( regs , sfar , sfsr ) ; else spitfire_data_access_exception ( regs , sfsr , sfar ) ; return ; } advance ( regs ) ; }
| <S2SV_ModStart> PERF_COUNT_SW_ALIGNMENT_FAULTS , 1 <S2SV_ModEnd> , regs ,
| torvalds@linux/a8b0ca17b80e92faab46ee7179ba9e99ccb61233 | CVE-2011-2918 | https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233 | 2012-05-24T23:55Z |
6,741 | CWE-119 | CWE-119 const vpx_codec_cx_pkt_t * vpx_codec_get_cx_data ( vpx_codec_ctx_t * ctx , vpx_codec_iter_t * iter ) { const vpx_codec_cx_pkt_t * pkt = NULL ; if ( ctx ) { if ( ! iter ) ctx -> err = VPX_CODEC_INVALID_PARAM ; else if ( ! ctx -> iface || ! ctx -> priv ) ctx -> err = VPX_CODEC_ERROR ; else if ( ! ( ctx -> iface -> caps & VPX_CODEC_CAP_ENCODER ) ) ctx -> err = VPX_CODEC_INCAPABLE ; else <S2SV_StartBug> pkt = ctx -> iface -> enc . get_cx_data ( ctx -> priv -> alg_priv , iter ) ; <S2SV_EndBug> } if ( pkt && pkt -> kind == VPX_CODEC_CX_FRAME_PKT ) { vpx_codec_priv_t * const priv = ctx -> priv ; char * const dst_buf = ( char * ) priv -> enc . cx_data_dst_buf . buf ; if ( dst_buf && pkt -> data . raw . buf != dst_buf && pkt -> data . raw . sz + priv -> enc . cx_data_pad_before + priv -> enc . cx_data_pad_after <= priv -> enc . cx_data_dst_buf . sz ) { vpx_codec_cx_pkt_t * modified_pkt = & priv -> enc . cx_data_pkt ; memcpy ( dst_buf + priv -> enc . cx_data_pad_before , pkt -> data . raw . buf , pkt -> data . raw . sz ) ; * modified_pkt = * pkt ; modified_pkt -> data . raw . buf = dst_buf ; modified_pkt -> data . raw . sz += priv -> enc . cx_data_pad_before + priv -> enc . cx_data_pad_after ; pkt = modified_pkt ; } if ( dst_buf == pkt -> data . raw . buf ) { priv -> enc . cx_data_dst_buf . buf = dst_buf + pkt -> data . raw . sz ; priv -> enc . cx_data_dst_buf . sz -= pkt -> data . raw . sz ; } } return pkt ; }
| <S2SV_ModStart> . get_cx_data ( get_alg_priv ( ctx ) <S2SV_ModEnd> , iter )
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
6,742 | CWE-119 | CWE-119 int vp9_get_qindex ( const struct segmentation * seg , int segment_id , int base_qindex ) { <S2SV_StartBug> if ( vp9_segfeature_active ( seg , segment_id , SEG_LVL_ALT_Q ) ) { <S2SV_EndBug> <S2SV_StartBug> const int data = vp9_get_segdata ( seg , segment_id , SEG_LVL_ALT_Q ) ; <S2SV_EndBug> const int seg_qindex = seg -> abs_delta == SEGMENT_ABSDATA ? data : base_qindex + data ; return clamp ( seg_qindex , 0 , MAXQ ) ; } else { return base_qindex ; } }
| <S2SV_ModStart> { if ( segfeature_active <S2SV_ModEnd> ( seg , <S2SV_ModStart> int data = get_segdata <S2SV_ModEnd> ( seg ,
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
6,743 | CWE-77 | CWE-77 void imap_munge_mbox_name ( struct ImapData * idata , char * dest , size_t dlen , const char * src ) { char * buf = mutt_str_strdup ( src ) ; imap_utf_encode ( idata , & buf ) ; <S2SV_StartBug> imap_quote_string ( dest , dlen , buf ) ; <S2SV_EndBug> FREE ( & buf ) ; }
| <S2SV_ModStart> dlen , buf , false
| neomutt@neomutt/e52393740334443ae0206cab2d7caef381646725 | CVE-2018-14357 | https://github.com/neomutt/neomutt/commit/e52393740334443ae0206cab2d7caef381646725 | 2018-07-17T17:29Z |
6,744 | CWE-000 | CWE-000 int config__parse_args ( struct mosquitto_db * db , struct mosquitto__config * config , int argc , char * argv [ ] ) { int i ; int port_tmp ; for ( i = 1 ; i < argc ; i ++ ) { if ( ! strcmp ( argv [ i ] , "-c" ) || ! strcmp ( argv [ i ] , "--config-file" ) ) { if ( i < argc - 1 ) { db -> config_file = argv [ i + 1 ] ; if ( config__read ( db , config , false ) ) { log__printf ( NULL , MOSQ_LOG_ERR , "Error:<S2SV_blank>Unable<S2SV_blank>to<S2SV_blank>open<S2SV_blank>configuration<S2SV_blank>file." ) ; return MOSQ_ERR_INVAL ; } } else { log__printf ( NULL , MOSQ_LOG_ERR , "Error:<S2SV_blank>-c<S2SV_blank>argument<S2SV_blank>given,<S2SV_blank>but<S2SV_blank>no<S2SV_blank>config<S2SV_blank>file<S2SV_blank>specified." ) ; return MOSQ_ERR_INVAL ; } i ++ ; } else if ( ! strcmp ( argv [ i ] , "-d" ) || ! strcmp ( argv [ i ] , "--daemon" ) ) { config -> daemon = true ; } else if ( ! strcmp ( argv [ i ] , "-h" ) || ! strcmp ( argv [ i ] , "--help" ) ) { print_usage ( ) ; return MOSQ_ERR_INVAL ; } else if ( ! strcmp ( argv [ i ] , "-p" ) || ! strcmp ( argv [ i ] , "--port" ) ) { if ( i < argc - 1 ) { port_tmp = atoi ( argv [ i + 1 ] ) ; if ( port_tmp < 1 || port_tmp > 65535 ) { log__printf ( NULL , MOSQ_LOG_ERR , "Error:<S2SV_blank>Invalid<S2SV_blank>port<S2SV_blank>specified<S2SV_blank>(%d)." , port_tmp ) ; return MOSQ_ERR_INVAL ; } else { if ( config -> default_listener . port ) { log__printf ( NULL , MOSQ_LOG_WARNING , "Warning:<S2SV_blank>Default<S2SV_blank>listener<S2SV_blank>port<S2SV_blank>specified<S2SV_blank>multiple<S2SV_blank>times.<S2SV_blank>Only<S2SV_blank>the<S2SV_blank>latest<S2SV_blank>will<S2SV_blank>be<S2SV_blank>used." ) ; } config -> default_listener . port = port_tmp ; } } else { log__printf ( NULL , MOSQ_LOG_ERR , "Error:<S2SV_blank>-p<S2SV_blank>argument<S2SV_blank>given,<S2SV_blank>but<S2SV_blank>no<S2SV_blank>port<S2SV_blank>specified." ) ; return MOSQ_ERR_INVAL ; } i ++ ; } else if ( ! strcmp ( argv [ i ] , "-v" ) || ! strcmp ( argv [ i ] , "--verbose" ) ) { db -> verbose = true ; } else { fprintf ( stderr , "Error:<S2SV_blank>Unknown<S2SV_blank>option<S2SV_blank>\'%s\'.\\n" , argv [ i ] ) ; print_usage ( ) ; return MOSQ_ERR_INVAL ; } } if ( config -> listener_count == 0 # ifdef WITH_TLS || config -> default_listener . cafile || config -> default_listener . capath || config -> default_listener . certfile || config -> default_listener . keyfile || config -> default_listener . ciphers || config -> default_listener . psk_hint || config -> default_listener . require_certificate || config -> default_listener . crlfile || config -> default_listener . use_identity_as_username || config -> default_listener . use_subject_as_username # endif || config -> default_listener . use_username_as_clientid || config -> default_listener . host || config -> default_listener . port || config -> default_listener . max_connections != - 1 || config -> default_listener . mount_point || config -> default_listener . protocol != mp_mqtt || config -> default_listener . socket_domain || config -> default_listener . security_options . password_file || config -> default_listener . security_options . psk_file || config -> default_listener . security_options . auth_plugin_config_count || config -> default_listener . security_options . allow_anonymous != - 1 ) { config -> listener_count ++ ; config -> listeners = mosquitto__realloc ( config -> listeners , sizeof ( struct mosquitto__listener ) * config -> listener_count ) ; if ( ! config -> listeners ) { log__printf ( NULL , MOSQ_LOG_ERR , "Error:<S2SV_blank>Out<S2SV_blank>of<S2SV_blank>memory." ) ; return MOSQ_ERR_NOMEM ; } memset ( & config -> listeners [ config -> listener_count - 1 ] , 0 , sizeof ( struct mosquitto__listener ) ) ; if ( config -> default_listener . port ) { config -> listeners [ config -> listener_count - 1 ] . port = config -> default_listener . port ; } else { config -> listeners [ config -> listener_count - 1 ] . port = 1883 ; } if ( config -> default_listener . host ) { config -> listeners [ config -> listener_count - 1 ] . host = config -> default_listener . host ; } else { config -> listeners [ config -> listener_count - 1 ] . host = NULL ; } if ( config -> default_listener . mount_point ) { config -> listeners [ config -> listener_count - 1 ] . mount_point = config -> default_listener . mount_point ; } else { config -> listeners [ config -> listener_count - 1 ] . mount_point = NULL ; } config -> listeners [ config -> listener_count - 1 ] . max_connections = config -> default_listener . max_connections ; config -> listeners [ config -> listener_count - 1 ] . protocol = config -> default_listener . protocol ; config -> listeners [ config -> listener_count - 1 ] . socket_domain = config -> default_listener . socket_domain ; config -> listeners [ config -> listener_count - 1 ] . client_count = 0 ; config -> listeners [ config -> listener_count - 1 ] . socks = NULL ; config -> listeners [ config -> listener_count - 1 ] . sock_count = 0 ; config -> listeners [ config -> listener_count - 1 ] . client_count = 0 ; config -> listeners [ config -> listener_count - 1 ] . use_username_as_clientid = config -> default_listener . use_username_as_clientid ; # ifdef WITH_TLS config -> listeners [ config -> listener_count - 1 ] . tls_version = config -> default_listener . tls_version ; config -> listeners [ config -> listener_count - 1 ] . cafile = config -> default_listener . cafile ; config -> listeners [ config -> listener_count - 1 ] . capath = config -> default_listener . capath ; config -> listeners [ config -> listener_count - 1 ] . certfile = config -> default_listener . certfile ; config -> listeners [ config -> listener_count - 1 ] . keyfile = config -> default_listener . keyfile ; config -> listeners [ config -> listener_count - 1 ] . ciphers = config -> default_listener . ciphers ; config -> listeners [ config -> listener_count - 1 ] . psk_hint = config -> default_listener . psk_hint ; config -> listeners [ config -> listener_count - 1 ] . require_certificate = config -> default_listener . require_certificate ; config -> listeners [ config -> listener_count - 1 ] . ssl_ctx = NULL ; config -> listeners [ config -> listener_count - 1 ] . crlfile = config -> default_listener . crlfile ; config -> listeners [ config -> listener_count - 1 ] . use_identity_as_username = config -> default_listener . use_identity_as_username ; config -> listeners [ config -> listener_count - 1 ] . use_subject_as_username = config -> default_listener . use_subject_as_username ; # endif <S2SV_StartBug> config -> listeners [ config -> listener_count - 1 ] . security_options . password_file = config -> default_listener . security_options . password_file ; <S2SV_EndBug> config -> listeners [ config -> listener_count - 1 ] . security_options . psk_file = config -> default_listener . security_options . psk_file ; config -> listeners [ config -> listener_count - 1 ] . security_options . auth_plugin_configs = config -> default_listener . security_options . auth_plugin_configs ; config -> listeners [ config -> listener_count - 1 ] . security_options . auth_plugin_config_count = config -> default_listener . security_options . auth_plugin_config_count ; config -> listeners [ config -> listener_count - 1 ] . security_options . allow_anonymous = config -> default_listener . security_options . allow_anonymous ; } if ( ! config -> user ) { config -> user = "mosquitto" ; } if ( db -> verbose ) { config -> log_type = INT_MAX ; } return config__check ( config ) ; }
| <S2SV_ModStart> . security_options . acl_file = config -> default_listener . security_options . acl_file ; config -> listeners [ config -> listener_count - 1 ] . security_options .
| eclipse@mosquitto/9097577b49b7fdcf45d30975976dd93808ccc0c4 | CVE-2018-20145 | https://github.com/eclipse/mosquitto/commit/9097577b49b7fdcf45d30975976dd93808ccc0c4 | 2018-12-13T20:29Z |
6,745 | CWE-119 | CWE-119 static void yv12_extend_frame_bottom_c ( YV12_BUFFER_CONFIG * ybf ) { int i ; unsigned char * src_ptr1 , * src_ptr2 ; unsigned char * dest_ptr2 ; unsigned int Border ; int plane_stride ; int plane_height ; Border = ybf -> border ; plane_stride = ybf -> y_stride ; plane_height = ybf -> y_height ; src_ptr1 = ybf -> y_buffer - Border ; src_ptr2 = src_ptr1 + ( plane_height * plane_stride ) - plane_stride ; dest_ptr2 = src_ptr2 + plane_stride ; for ( i = 0 ; i < ( int ) Border ; i ++ ) { <S2SV_StartBug> vpx_memcpy ( dest_ptr2 , src_ptr2 , plane_stride ) ; <S2SV_EndBug> dest_ptr2 += plane_stride ; } plane_stride = ybf -> uv_stride ; plane_height = ybf -> uv_height ; Border /= 2 ; src_ptr1 = ybf -> u_buffer - Border ; src_ptr2 = src_ptr1 + ( plane_height * plane_stride ) - plane_stride ; dest_ptr2 = src_ptr2 + plane_stride ; for ( i = 0 ; i < ( int ) ( Border ) ; i ++ ) { <S2SV_StartBug> vpx_memcpy ( dest_ptr2 , src_ptr2 , plane_stride ) ; <S2SV_EndBug> dest_ptr2 += plane_stride ; } src_ptr1 = ybf -> v_buffer - Border ; src_ptr2 = src_ptr1 + ( plane_height * plane_stride ) - plane_stride ; dest_ptr2 = src_ptr2 + plane_stride ; for ( i = 0 ; i < ( int ) ( Border ) ; i ++ ) { <S2SV_StartBug> vpx_memcpy ( dest_ptr2 , src_ptr2 , plane_stride ) ; <S2SV_EndBug> dest_ptr2 += plane_stride ; } }
| <S2SV_ModStart> ++ ) { memcpy <S2SV_ModEnd> ( dest_ptr2 , <S2SV_ModStart> ++ ) { memcpy <S2SV_ModEnd> ( dest_ptr2 , <S2SV_ModStart> ++ ) { memcpy <S2SV_ModEnd> ( dest_ptr2 ,
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
6,746 | CWE-119 | CWE-119 <S2SV_StartBug> static void <S2SV_EndBug> swabHorDiff32 ( TIFF * tif , uint8 * cp0 , tmsize_t cc ) { uint32 * wp = ( uint32 * ) cp0 ; tmsize_t wc = cc / 4 ; <S2SV_StartBug> horDiff32 ( tif , cp0 , cc ) ; <S2SV_EndBug> TIFFSwabArrayOfLong ( wp , wc ) ; <S2SV_StartBug> } <S2SV_EndBug>
| <S2SV_ModStart> <S2SV_null> <S2SV_null> static int <S2SV_ModEnd> swabHorDiff32 ( TIFF <S2SV_ModStart> / 4 ; if ( ! <S2SV_ModStart> , cc ) ) return 0 <S2SV_ModStart> wc ) ; return 1 ;
| vadz@libtiff/3ca657a8793dd011bf869695d72ad31c779c3cc1 | CVE-2016-9535 | https://github.com/vadz/libtiff/commit/3ca657a8793dd011bf869695d72ad31c779c3cc1 | 2016-11-22T19:59Z |
6,747 | CWE-119 | CWE-119 IHEVCD_ERROR_T ihevcd_parse_sps ( codec_t * ps_codec ) { IHEVCD_ERROR_T ret = ( IHEVCD_ERROR_T ) IHEVCD_SUCCESS ; WORD32 value ; WORD32 i ; WORD32 vps_id ; WORD32 sps_max_sub_layers ; WORD32 sps_id ; WORD32 sps_temporal_id_nesting_flag ; sps_t * ps_sps ; profile_tier_lvl_info_t s_ptl ; bitstrm_t * ps_bitstrm = & ps_codec -> s_parse . s_bitstrm ; WORD32 ctb_log2_size_y = 0 ; BITS_PARSE ( "video_parameter_set_id" , value , ps_bitstrm , 4 ) ; vps_id = value ; vps_id = CLIP3 ( vps_id , 0 , MAX_VPS_CNT - 1 ) ; BITS_PARSE ( "sps_max_sub_layers_minus1" , value , ps_bitstrm , 3 ) ; sps_max_sub_layers = value + 1 ; sps_max_sub_layers = CLIP3 ( sps_max_sub_layers , 1 , 7 ) ; BITS_PARSE ( "sps_temporal_id_nesting_flag" , value , ps_bitstrm , 1 ) ; sps_temporal_id_nesting_flag = value ; ret = ihevcd_profile_tier_level ( ps_bitstrm , & ( s_ptl ) , 1 , ( sps_max_sub_layers - 1 ) ) ; UEV_PARSE ( "seq_parameter_set_id" , value , ps_bitstrm ) ; sps_id = value ; if ( ( sps_id >= MAX_SPS_CNT ) || ( sps_id < 0 ) ) { if ( ps_codec -> i4_sps_done ) return IHEVCD_UNSUPPORTED_SPS_ID ; else sps_id = 0 ; } ps_sps = ( ps_codec -> s_parse . ps_sps_base + MAX_SPS_CNT - 1 ) ; ps_sps -> i1_sps_id = sps_id ; ps_sps -> i1_vps_id = vps_id ; ps_sps -> i1_sps_max_sub_layers = sps_max_sub_layers ; ps_sps -> i1_sps_temporal_id_nesting_flag = sps_temporal_id_nesting_flag ; ps_codec -> i4_sps_id = sps_id ; memcpy ( & ps_sps -> s_ptl , & s_ptl , sizeof ( profile_tier_lvl_info_t ) ) ; UEV_PARSE ( "chroma_format_idc" , value , ps_bitstrm ) ; ps_sps -> i1_chroma_format_idc = value ; if ( ps_sps -> i1_chroma_format_idc != CHROMA_FMT_IDC_YUV420 ) { ps_codec -> s_parse . i4_error_code = IHEVCD_UNSUPPORTED_CHROMA_FMT_IDC ; return ( IHEVCD_ERROR_T ) IHEVCD_UNSUPPORTED_CHROMA_FMT_IDC ; } if ( CHROMA_FMT_IDC_YUV444_PLANES == ps_sps -> i1_chroma_format_idc ) { BITS_PARSE ( "separate_colour_plane_flag" , value , ps_bitstrm , 1 ) ; ps_sps -> i1_separate_colour_plane_flag = value ; } else { ps_sps -> i1_separate_colour_plane_flag = 0 ; } UEV_PARSE ( "pic_width_in_luma_samples" , value , ps_bitstrm ) ; ps_sps -> i2_pic_width_in_luma_samples = value ; UEV_PARSE ( "pic_height_in_luma_samples" , value , ps_bitstrm ) ; ps_sps -> i2_pic_height_in_luma_samples = value ; if ( ( 0 >= ps_sps -> i2_pic_width_in_luma_samples ) || ( 0 >= ps_sps -> i2_pic_height_in_luma_samples ) ) return IHEVCD_INVALID_PARAMETER ; ps_sps -> i2_pic_width_in_luma_samples = ALIGN8 ( ps_sps -> i2_pic_width_in_luma_samples ) ; ps_sps -> i2_pic_height_in_luma_samples = ALIGN8 ( ps_sps -> i2_pic_height_in_luma_samples ) ; BITS_PARSE ( "pic_cropping_flag" , value , ps_bitstrm , 1 ) ; ps_sps -> i1_pic_cropping_flag = value ; if ( ps_sps -> i1_pic_cropping_flag ) { UEV_PARSE ( "pic_crop_left_offset" , value , ps_bitstrm ) ; ps_sps -> i2_pic_crop_left_offset = value ; UEV_PARSE ( "pic_crop_right_offset" , value , ps_bitstrm ) ; ps_sps -> i2_pic_crop_right_offset = value ; UEV_PARSE ( "pic_crop_top_offset" , value , ps_bitstrm ) ; ps_sps -> i2_pic_crop_top_offset = value ; UEV_PARSE ( "pic_crop_bottom_offset" , value , ps_bitstrm ) ; ps_sps -> i2_pic_crop_bottom_offset = value ; } else { ps_sps -> i2_pic_crop_left_offset = 0 ; ps_sps -> i2_pic_crop_right_offset = 0 ; ps_sps -> i2_pic_crop_top_offset = 0 ; ps_sps -> i2_pic_crop_bottom_offset = 0 ; } UEV_PARSE ( "bit_depth_luma_minus8" , value , ps_bitstrm ) ; if ( 0 != value ) return IHEVCD_UNSUPPORTED_BIT_DEPTH ; UEV_PARSE ( "bit_depth_chroma_minus8" , value , ps_bitstrm ) ; if ( 0 != value ) return IHEVCD_UNSUPPORTED_BIT_DEPTH ; UEV_PARSE ( "log2_max_pic_order_cnt_lsb_minus4" , value , ps_bitstrm ) ; ps_sps -> i1_log2_max_pic_order_cnt_lsb = value + 4 ; BITS_PARSE ( "sps_sub_layer_ordering_info_present_flag" , value , ps_bitstrm , 1 ) ; ps_sps -> i1_sps_sub_layer_ordering_info_present_flag = value ; i = ( ps_sps -> i1_sps_sub_layer_ordering_info_present_flag ? 0 : ( ps_sps -> i1_sps_max_sub_layers - 1 ) ) ; for ( ; i < ps_sps -> i1_sps_max_sub_layers ; i ++ ) { UEV_PARSE ( "max_dec_pic_buffering" , value , ps_bitstrm ) ; ps_sps -> ai1_sps_max_dec_pic_buffering [ i ] = value + 1 ; if ( ps_sps -> ai1_sps_max_dec_pic_buffering [ i ] > MAX_DPB_SIZE ) { return IHEVCD_INVALID_PARAMETER ; } UEV_PARSE ( "num_reorder_pics" , value , ps_bitstrm ) ; ps_sps -> ai1_sps_max_num_reorder_pics [ i ] = value ; if ( ps_sps -> ai1_sps_max_num_reorder_pics [ i ] > ps_sps -> ai1_sps_max_dec_pic_buffering [ i ] ) { return IHEVCD_INVALID_PARAMETER ; } UEV_PARSE ( "max_latency_increase" , value , ps_bitstrm ) ; ps_sps -> ai1_sps_max_latency_increase [ i ] = value ; } UEV_PARSE ( "log2_min_coding_block_size_minus3" , value , ps_bitstrm ) ; ps_sps -> i1_log2_min_coding_block_size = value + 3 ; UEV_PARSE ( "log2_diff_max_min_coding_block_size" , value , ps_bitstrm ) ; ps_sps -> i1_log2_diff_max_min_coding_block_size = value ; ctb_log2_size_y = ps_sps -> i1_log2_min_coding_block_size + ps_sps -> i1_log2_diff_max_min_coding_block_size ; UEV_PARSE ( "log2_min_transform_block_size_minus2" , value , ps_bitstrm ) ; ps_sps -> i1_log2_min_transform_block_size = value + 2 ; UEV_PARSE ( "log2_diff_max_min_transform_block_size" , value , ps_bitstrm ) ; ps_sps -> i1_log2_diff_max_min_transform_block_size = value ; ps_sps -> i1_log2_max_transform_block_size = ps_sps -> i1_log2_min_transform_block_size + ps_sps -> i1_log2_diff_max_min_transform_block_size ; if ( ( ps_sps -> i1_log2_max_transform_block_size < 0 ) || ( ps_sps -> i1_log2_max_transform_block_size > MIN ( ctb_log2_size_y , 5 ) ) ) { return IHEVCD_INVALID_PARAMETER ; } ps_sps -> i1_log2_ctb_size = ps_sps -> i1_log2_min_coding_block_size + ps_sps -> i1_log2_diff_max_min_coding_block_size ; if ( ( ps_sps -> i1_log2_min_coding_block_size < 3 ) || ( ps_sps -> i1_log2_min_transform_block_size < 2 ) || ( ps_sps -> i1_log2_diff_max_min_transform_block_size < 0 ) || ( ps_sps -> i1_log2_max_transform_block_size > ps_sps -> i1_log2_ctb_size ) || ( ps_sps -> i1_log2_ctb_size < 4 ) || ( ps_sps -> i1_log2_ctb_size > 6 ) ) { return IHEVCD_INVALID_PARAMETER ; } ps_sps -> i1_log2_min_pcm_coding_block_size = 0 ; ps_sps -> i1_log2_diff_max_min_pcm_coding_block_size = 0 ; UEV_PARSE ( "max_transform_hierarchy_depth_inter" , value , ps_bitstrm ) ; ps_sps -> i1_max_transform_hierarchy_depth_inter = value ; UEV_PARSE ( "max_transform_hierarchy_depth_intra" , value , ps_bitstrm ) ; ps_sps -> i1_max_transform_hierarchy_depth_intra = value ; BITS_PARSE ( "scaling_list_enabled_flag" , value , ps_bitstrm , 1 ) ; ps_sps -> i1_scaling_list_enable_flag = value ; if ( ps_sps -> i1_scaling_list_enable_flag ) { COPY_DEFAULT_SCALING_LIST ( ps_sps -> pi2_scaling_mat ) ; BITS_PARSE ( "sps_scaling_list_data_present_flag" , value , ps_bitstrm , 1 ) ; ps_sps -> i1_sps_scaling_list_data_present_flag = value ; if ( ps_sps -> i1_sps_scaling_list_data_present_flag ) ihevcd_scaling_list_data ( ps_codec , ps_sps -> pi2_scaling_mat ) ; } else { COPY_FLAT_SCALING_LIST ( ps_sps -> pi2_scaling_mat ) ; } BITS_PARSE ( "asymmetric_motion_partitions_enabled_flag" , value , ps_bitstrm , 1 ) ; ps_sps -> i1_amp_enabled_flag = value ; BITS_PARSE ( "sample_adaptive_offset_enabled_flag" , value , ps_bitstrm , 1 ) ; ps_sps -> i1_sample_adaptive_offset_enabled_flag = value ; BITS_PARSE ( "pcm_enabled_flag" , value , ps_bitstrm , 1 ) ; ps_sps -> i1_pcm_enabled_flag = value ; if ( ps_sps -> i1_pcm_enabled_flag ) { BITS_PARSE ( "pcm_sample_bit_depth_luma" , value , ps_bitstrm , 4 ) ; ps_sps -> i1_pcm_sample_bit_depth_luma = value + 1 ; BITS_PARSE ( "pcm_sample_bit_depth_chroma" , value , ps_bitstrm , 4 ) ; ps_sps -> i1_pcm_sample_bit_depth_chroma = value + 1 ; UEV_PARSE ( "log2_min_pcm_coding_block_size_minus3" , value , ps_bitstrm ) ; ps_sps -> i1_log2_min_pcm_coding_block_size = value + 3 ; UEV_PARSE ( "log2_diff_max_min_pcm_coding_block_size" , value , ps_bitstrm ) ; ps_sps -> i1_log2_diff_max_min_pcm_coding_block_size = value ; BITS_PARSE ( "pcm_loop_filter_disable_flag" , value , ps_bitstrm , 1 ) ; ps_sps -> i1_pcm_loop_filter_disable_flag = value ; } UEV_PARSE ( "num_short_term_ref_pic_sets" , value , ps_bitstrm ) ; ps_sps -> i1_num_short_term_ref_pic_sets = value ; ps_sps -> i1_num_short_term_ref_pic_sets = CLIP3 ( ps_sps -> i1_num_short_term_ref_pic_sets , 0 , MAX_STREF_PICS_SPS ) ; for ( i = 0 ; i < ps_sps -> i1_num_short_term_ref_pic_sets ; i ++ ) ihevcd_short_term_ref_pic_set ( ps_bitstrm , & ps_sps -> as_stref_picset [ 0 ] , ps_sps -> i1_num_short_term_ref_pic_sets , i , & ps_sps -> as_stref_picset [ i ] ) ; BITS_PARSE ( "long_term_ref_pics_present_flag" , value , ps_bitstrm , 1 ) ; ps_sps -> i1_long_term_ref_pics_present_flag = value ; if ( ps_sps -> i1_long_term_ref_pics_present_flag ) { UEV_PARSE ( "num_long_term_ref_pics_sps" , value , ps_bitstrm ) ; ps_sps -> i1_num_long_term_ref_pics_sps = value ; for ( i = 0 ; i < ps_sps -> i1_num_long_term_ref_pics_sps ; i ++ ) { BITS_PARSE ( "lt_ref_pic_poc_lsb_sps[<S2SV_blank>i<S2SV_blank>]" , value , ps_bitstrm , ps_sps -> i1_log2_max_pic_order_cnt_lsb ) ; ps_sps -> ai1_lt_ref_pic_poc_lsb_sps [ i ] = value ; BITS_PARSE ( "used_by_curr_pic_lt_sps_flag[<S2SV_blank>i<S2SV_blank>]" , value , ps_bitstrm , 1 ) ; ps_sps -> ai1_used_by_curr_pic_lt_sps_flag [ i ] = value ; } } BITS_PARSE ( "sps_temporal_mvp_enable_flag" , value , ps_bitstrm , 1 ) ; ps_sps -> i1_sps_temporal_mvp_enable_flag = value ; BITS_PARSE ( "sps_strong_intra_smoothing_enable_flag" , value , ps_bitstrm , 1 ) ; ps_sps -> i1_strong_intra_smoothing_enable_flag = value ; BITS_PARSE ( "vui_parameters_present_flag" , value , ps_bitstrm , 1 ) ; ps_sps -> i1_vui_parameters_present_flag = value ; if ( ps_sps -> i1_vui_parameters_present_flag ) ihevcd_parse_vui_parameters ( ps_bitstrm , & ps_sps -> s_vui_parameters , ps_sps -> i1_sps_max_sub_layers - 1 ) ; BITS_PARSE ( "sps_extension_flag" , value , ps_bitstrm , 1 ) ; <S2SV_StartBug> { <S2SV_EndBug> WORD32 numerator ; WORD32 ceil_offset ; ceil_offset = ( 1 << ps_sps -> i1_log2_ctb_size ) - 1 ; numerator = ps_sps -> i2_pic_width_in_luma_samples ; ps_sps -> i2_pic_wd_in_ctb = ( ( numerator + ceil_offset ) / ( 1 << ps_sps -> i1_log2_ctb_size ) ) ; numerator = ps_sps -> i2_pic_height_in_luma_samples ; ps_sps -> i2_pic_ht_in_ctb = ( ( numerator + ceil_offset ) / ( 1 << ps_sps -> i1_log2_ctb_size ) ) ; ps_sps -> i4_pic_size_in_ctb = ps_sps -> i2_pic_ht_in_ctb * ps_sps -> i2_pic_wd_in_ctb ; if ( 0 == ps_codec -> i4_sps_done ) ps_codec -> s_parse . i4_next_ctb_indx = ps_sps -> i4_pic_size_in_ctb ; numerator = ps_sps -> i2_pic_width_in_luma_samples ; ps_sps -> i2_pic_wd_in_min_cb = numerator / ( 1 << ps_sps -> i1_log2_min_coding_block_size ) ; numerator = ps_sps -> i2_pic_height_in_luma_samples ; ps_sps -> i2_pic_ht_in_min_cb = numerator / ( 1 << ps_sps -> i1_log2_min_coding_block_size ) ; } if ( ( 0 != ps_codec -> i4_first_pic_done ) && ( ( ps_codec -> i4_wd != ps_sps -> i2_pic_width_in_luma_samples ) || ( ps_codec -> i4_ht != ps_sps -> i2_pic_height_in_luma_samples ) ) ) { ps_codec -> i4_reset_flag = 1 ; return ( IHEVCD_ERROR_T ) IVD_RES_CHANGED ; } { WORD32 disp_wd , disp_ht ; WORD32 crop_unit_x , crop_unit_y ; crop_unit_x = 1 ; crop_unit_y = 1 ; if ( CHROMA_FMT_IDC_YUV420 == ps_sps -> i1_chroma_format_idc ) { crop_unit_x = 2 ; crop_unit_y = 2 ; } disp_wd = ps_sps -> i2_pic_width_in_luma_samples ; disp_wd -= ps_sps -> i2_pic_crop_left_offset * crop_unit_x ; disp_wd -= ps_sps -> i2_pic_crop_right_offset * crop_unit_x ; disp_ht = ps_sps -> i2_pic_height_in_luma_samples ; disp_ht -= ps_sps -> i2_pic_crop_top_offset * crop_unit_y ; disp_ht -= ps_sps -> i2_pic_crop_bottom_offset * crop_unit_y ; if ( ( 0 >= disp_wd ) || ( 0 >= disp_ht ) ) return IHEVCD_INVALID_PARAMETER ; ps_codec -> i4_disp_wd = disp_wd ; ps_codec -> i4_disp_ht = disp_ht ; ps_codec -> i4_wd = ps_sps -> i2_pic_width_in_luma_samples ; ps_codec -> i4_ht = ps_sps -> i2_pic_height_in_luma_samples ; { WORD32 ref_strd ; ref_strd = ALIGN32 ( ps_sps -> i2_pic_width_in_luma_samples + PAD_WD ) ; if ( ps_codec -> i4_strd < ref_strd ) { ps_codec -> i4_strd = ref_strd ; } } if ( 0 == ps_codec -> i4_share_disp_buf ) { if ( ps_codec -> i4_disp_strd < ps_codec -> i4_disp_wd ) { ps_codec -> i4_disp_strd = ps_codec -> i4_disp_wd ; } } else { if ( ps_codec -> i4_disp_strd < ps_codec -> i4_strd ) { ps_codec -> i4_disp_strd = ps_codec -> i4_strd ; } } } ps_codec -> i4_sps_done = 1 ; return ret ; }
| <S2SV_ModStart> 1 ) ; if ( ( UWORD8 * ) ps_bitstrm -> pu4_buf > ps_bitstrm -> pu1_buf_max ) { return IHEVCD_INVALID_PARAMETER ; }
| external@libhevc/45c97f878bee15cd97262fe7f57ecea71990fed7 | CVE-2017-0590 | https://android.googlesource.com/platform/external/libhevc/+/45c97f878bee15cd97262fe7f57ecea71990fed7 | 2017-05-12T15:29Z |
6,748 | CWE-264 | CWE-264 static int __load_segment_descriptor ( struct x86_emulate_ctxt * ctxt , <S2SV_StartBug> u16 selector , int seg , u8 cpl , bool in_task_switch ) <S2SV_EndBug> { struct desc_struct seg_desc , old_desc ; u8 dpl , rpl ; unsigned err_vec = GP_VECTOR ; u32 err_code = 0 ; bool null_selector = ! ( selector & ~ 0x3 ) ; ulong desc_addr ; int ret ; u16 dummy ; u32 base3 = 0 ; memset ( & seg_desc , 0 , sizeof seg_desc ) ; if ( ctxt -> mode == X86EMUL_MODE_REAL ) { ctxt -> ops -> get_segment ( ctxt , & dummy , & seg_desc , NULL , seg ) ; set_desc_base ( & seg_desc , selector << 4 ) ; goto load ; } else if ( seg <= VCPU_SREG_GS && ctxt -> mode == X86EMUL_MODE_VM86 ) { set_desc_base ( & seg_desc , selector << 4 ) ; set_desc_limit ( & seg_desc , 0xffff ) ; seg_desc . type = 3 ; seg_desc . p = 1 ; seg_desc . s = 1 ; seg_desc . dpl = 3 ; goto load ; } rpl = selector & 3 ; if ( ( seg == VCPU_SREG_CS || ( seg == VCPU_SREG_SS && ( ctxt -> mode != X86EMUL_MODE_PROT64 || rpl != cpl ) ) || seg == VCPU_SREG_TR ) && null_selector ) goto exception ; if ( seg == VCPU_SREG_TR && ( selector & ( 1 << 2 ) ) ) goto exception ; if ( null_selector ) goto load ; ret = read_segment_descriptor ( ctxt , selector , & seg_desc , & desc_addr ) ; if ( ret != X86EMUL_CONTINUE ) return ret ; err_code = selector & 0xfffc ; err_vec = in_task_switch ? TS_VECTOR : GP_VECTOR ; if ( seg <= VCPU_SREG_GS && ! seg_desc . s ) goto exception ; if ( ! seg_desc . p ) { err_vec = ( seg == VCPU_SREG_SS ) ? SS_VECTOR : NP_VECTOR ; goto exception ; } dpl = seg_desc . dpl ; switch ( seg ) { case VCPU_SREG_SS : if ( rpl != cpl || ( seg_desc . type & 0xa ) != 0x2 || dpl != cpl ) goto exception ; break ; case VCPU_SREG_CS : if ( ! ( seg_desc . type & 8 ) ) goto exception ; if ( seg_desc . type & 4 ) { if ( dpl > cpl ) goto exception ; } else { if ( rpl > cpl || dpl != cpl ) goto exception ; } if ( seg_desc . d && seg_desc . l ) { u64 efer = 0 ; ctxt -> ops -> get_msr ( ctxt , MSR_EFER , & efer ) ; if ( efer & EFER_LMA ) goto exception ; } selector = ( selector & 0xfffc ) | cpl ; break ; case VCPU_SREG_TR : if ( seg_desc . s || ( seg_desc . type != 1 && seg_desc . type != 9 ) ) goto exception ; old_desc = seg_desc ; seg_desc . type |= 2 ; ret = ctxt -> ops -> cmpxchg_emulated ( ctxt , desc_addr , & old_desc , & seg_desc , sizeof ( seg_desc ) , & ctxt -> exception ) ; if ( ret != X86EMUL_CONTINUE ) return ret ; break ; case VCPU_SREG_LDTR : if ( seg_desc . s || seg_desc . type != 2 ) goto exception ; break ; default : if ( ( seg_desc . type & 0xa ) == 0x8 || ( ( ( seg_desc . type & 0xc ) != 0xc ) && ( rpl > dpl && cpl > dpl ) ) ) goto exception ; break ; } if ( seg_desc . s ) { seg_desc . type |= 1 ; ret = write_segment_descriptor ( ctxt , selector , & seg_desc ) ; if ( ret != X86EMUL_CONTINUE ) return ret ; } else if ( ctxt -> mode == X86EMUL_MODE_PROT64 ) { ret = ctxt -> ops -> read_std ( ctxt , desc_addr + 8 , & base3 , sizeof ( base3 ) , & ctxt -> exception ) ; if ( ret != X86EMUL_CONTINUE ) return ret ; } load : ctxt -> ops -> set_segment ( ctxt , selector , & seg_desc , base3 , seg ) ; <S2SV_StartBug> return X86EMUL_CONTINUE ; <S2SV_EndBug> exception : return emulate_exception ( ctxt , err_vec , err_code , true ) ; }
| <S2SV_ModStart> , bool in_task_switch , struct desc_struct * desc <S2SV_ModStart> seg ) ; if ( desc ) * desc = seg_desc ;
| torvalds@linux/d1442d85cc30ea75f7d399474ca738e0bc96f715 | CVE-2014-3647 | https://github.com/torvalds/linux/commit/d1442d85cc30ea75f7d399474ca738e0bc96f715 | 2014-11-10T11:55Z |
6,749 | CWE-119 | CWE-119 <S2SV_StartBug> void vp9_encode_mv ( VP9_COMP * cpi , vp9_writer * w , <S2SV_EndBug> const MV * mv , const MV * ref , const nmv_context * mvctx , int usehp ) { const MV diff = { mv -> row - ref -> row , mv -> col - ref -> col } ; const MV_JOINT_TYPE j = vp9_get_mv_joint ( & diff ) ; usehp = usehp && vp9_use_mv_hp ( ref ) ; vp9_write_token ( w , vp9_mv_joint_tree , mvctx -> joints , & mv_joint_encodings [ j ] ) ; if ( mv_joint_vertical ( j ) ) encode_mv_component ( w , diff . row , & mvctx -> comps [ 0 ] , usehp ) ; if ( mv_joint_horizontal ( j ) ) encode_mv_component ( w , diff . col , & mvctx -> comps [ 1 ] , usehp ) ; <S2SV_StartBug> if ( ! cpi -> dummy_packing && cpi -> sf . auto_mv_step_size ) { <S2SV_EndBug> unsigned int maxv = MAX ( abs ( mv -> row ) , abs ( mv -> col ) ) >> 3 ; cpi -> max_mv_magnitude = MAX ( maxv , cpi -> max_mv_magnitude ) ; } }
| <S2SV_ModStart> * cpi , vpx_writer <S2SV_ModEnd> * w , <S2SV_ModStart> ; if ( <S2SV_ModEnd> cpi -> sf <S2SV_ModStart> cpi -> sf . mv
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
6,750 | CWE-476 | CWE-476 static const char * escape_xml ( const char * text ) { static char * escaped ; static size_t escaped_size ; char * out ; size_t len ; <S2SV_StartBug> for ( out = escaped , len = 0 ; * text ; ++ len , ++ out , ++ text ) { <S2SV_EndBug> if ( ( len + 8 ) > escaped_size ) { char * bigger_escaped ; escaped_size += 128 ; bigger_escaped = realloc ( escaped , escaped_size ) ; if ( ! bigger_escaped ) { free ( escaped ) ; escaped = NULL ; escaped_size = 0 ; return ">>><S2SV_blank>out<S2SV_blank>of<S2SV_blank>memory<S2SV_blank><<<" ; } out = bigger_escaped + len ; escaped = bigger_escaped ; } switch ( * text ) { case '&' : strcpy ( out , "&" ) ; len += strlen ( out ) - 1 ; out = escaped + len ; break ; case '<' : strcpy ( out , "<" ) ; len += strlen ( out ) - 1 ; out = escaped + len ; break ; case '>' : strcpy ( out , ">" ) ; len += strlen ( out ) - 1 ; out = escaped + len ; break ; default : * out = * text ; break ; } } * out = '\\x0' ; return escaped ; }
| <S2SV_ModStart> size_t len ; if ( ! strlen ( text ) ) return "empty<S2SV_blank>string" ;
| libexif@exif/f6334d9d32437ef13dc902f0a88a2be0063d9d1c | CVE-2021-27815 | https://github.com/libexif/exif/commit/f6334d9d32437ef13dc902f0a88a2be0063d9d1c | 2021-04-14T14:15Z |
6,751 | CWE-119 | CWE-119 void vp9_setup_past_independence ( VP9_COMMON * cm ) { struct loopfilter * const lf = & cm -> lf ; int i ; vp9_clearall_segfeatures ( & cm -> seg ) ; cm -> seg . abs_delta = SEGMENT_DELTADATA ; <S2SV_StartBug> if ( cm -> last_frame_seg_map ) <S2SV_EndBug> <S2SV_StartBug> vpx_memset ( cm -> last_frame_seg_map , 0 , ( cm -> mi_rows * cm -> mi_cols ) ) ; <S2SV_EndBug> vp9_zero ( lf -> last_ref_deltas ) ; vp9_zero ( lf -> last_mode_deltas ) ; set_default_lf_deltas ( lf ) ; lf -> last_sharpness_level = - 1 ; vp9_default_coef_probs ( cm ) ; <S2SV_StartBug> vp9_init_mode_probs ( & cm -> fc ) ; <S2SV_EndBug> <S2SV_StartBug> vp9_init_mv_probs ( cm ) ; <S2SV_EndBug> if ( cm -> frame_type == KEY_FRAME || cm -> error_resilient_mode || cm -> reset_frame_context == 3 ) { for ( i = 0 ; i < FRAME_CONTEXTS ; ++ i ) <S2SV_StartBug> cm -> frame_contexts [ i ] = cm -> fc ; <S2SV_EndBug> } else if ( cm -> reset_frame_context == 2 ) { <S2SV_StartBug> cm -> frame_contexts [ cm -> frame_context_idx ] = cm -> fc ; <S2SV_EndBug> } <S2SV_StartBug> if ( frame_is_intra_only ( cm ) ) <S2SV_EndBug> <S2SV_StartBug> vpx_memset ( cm -> prev_mip , 0 , cm -> mi_stride * ( cm -> mi_rows + 1 ) * <S2SV_EndBug> <S2SV_StartBug> sizeof ( * cm -> prev_mip ) ) ; <S2SV_EndBug> vpx_memset ( cm -> mip , 0 , cm -> mi_stride * ( cm -> mi_rows + 1 ) * sizeof ( * cm -> mip ) ) ; vp9_zero ( cm -> ref_frame_sign_bias ) ; cm -> frame_context_idx = 0 ; }
| <S2SV_ModStart> cm -> last_frame_seg_map && ! cm -> frame_parallel_decode ) memset <S2SV_ModEnd> ( cm -> <S2SV_ModStart> cm -> last_frame_seg_map , 0 , ( cm -> mi_rows * cm -> mi_cols ) ) ; if ( cm -> current_frame_seg_map ) memset ( cm -> current_frame_seg_map <S2SV_ModStart> cm ) ; init_mode_probs ( <S2SV_ModEnd> cm -> fc <S2SV_ModStart> ( cm ) ; cm -> fc -> initialized = 1 <S2SV_ModStart> i ] = * <S2SV_ModStart> frame_context_idx ] = * <S2SV_ModStart> ( cm ) && <S2SV_ModEnd> cm -> prev_mip <S2SV_ModStart> cm -> prev_mip && ! cm -> frame_parallel_decode ) memset ( cm -> prev_mip , 0 , <S2SV_ModEnd> cm -> mi_stride <S2SV_ModStart> cm -> prev_mip <S2SV_ModEnd> ) ) ;
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
6,752 | CWE-000 | CWE-000 static void ip_expire ( unsigned long arg ) { struct ipq * qp ; struct net * net ; qp = container_of ( ( struct inet_frag_queue * ) arg , struct ipq , q ) ; net = container_of ( qp -> q . net , struct net , ipv4 . frags ) ; spin_lock ( & qp -> q . lock ) ; if ( qp -> q . last_in & INET_FRAG_COMPLETE ) goto out ; ipq_kill ( qp ) ; IP_INC_STATS_BH ( net , IPSTATS_MIB_REASMTIMEOUT ) ; IP_INC_STATS_BH ( net , IPSTATS_MIB_REASMFAILS ) ; if ( ( qp -> q . last_in & INET_FRAG_FIRST_IN ) && qp -> q . fragments != NULL ) { struct sk_buff * head = qp -> q . fragments ; <S2SV_StartBug> rcu_read_lock ( ) ; <S2SV_EndBug> head -> dev = dev_get_by_index_rcu ( net , qp -> iif ) ; <S2SV_StartBug> if ( ! head -> dev ) <S2SV_EndBug> goto out_rcu_unlock ; <S2SV_StartBug> if ( qp -> user == IP_DEFRAG_CONNTRACK_IN && ! skb_dst ( head ) ) { <S2SV_EndBug> const struct iphdr * iph = ip_hdr ( head ) ; int err = ip_route_input ( head , iph -> daddr , iph -> saddr , iph -> tos , head -> dev ) ; if ( unlikely ( err ) ) goto out_rcu_unlock ; if ( skb_rtable ( head ) -> rt_type != RTN_LOCAL ) goto out_rcu_unlock ; <S2SV_StartBug> } <S2SV_EndBug> icmp_send ( head , ICMP_TIME_EXCEEDED , ICMP_EXC_FRAGTIME , 0 ) ; out_rcu_unlock : rcu_read_unlock ( ) ; } out : spin_unlock ( & qp -> q . lock ) ; ipq_put ( qp ) ; }
| <S2SV_ModStart> . fragments ; const struct iphdr * iph ; int err ; <S2SV_ModStart> head -> dev ) goto out_rcu_unlock ; skb_dst_drop ( head ) ; iph = ip_hdr ( head ) ; err = ip_route_input_noref ( head , iph -> daddr , iph -> saddr , iph -> tos , head -> dev ) ; if ( err <S2SV_ModStart> == IP_DEFRAG_CONNTRACK_IN && <S2SV_ModEnd> skb_rtable ( head <S2SV_ModStart> goto out_rcu_unlock ; <S2SV_ModEnd> icmp_send ( head
| torvalds@linux/64f3b9e203bd06855072e295557dca1485a2ecba | CVE-2011-1927 | https://github.com/torvalds/linux/commit/64f3b9e203bd06855072e295557dca1485a2ecba | 2012-06-13T10:24Z |
6,753 | CWE-369 | CWE-369 static int mov_write_audio_tag ( AVFormatContext * s , AVIOContext * pb , MOVMuxContext * mov , MOVTrack * track ) { int64_t pos = avio_tell ( pb ) ; int version = 0 ; uint32_t tag = track -> tag ; if ( track -> mode == MODE_MOV ) { <S2SV_StartBug> if ( track -> timescale > UINT16_MAX ) { <S2SV_EndBug> if ( mov_get_lpcm_flags ( track -> par -> codec_id ) ) tag = AV_RL32 ( "lpcm" ) ; version = 2 ; } else if ( track -> audio_vbr || mov_pcm_le_gt16 ( track -> par -> codec_id ) || mov_pcm_be_gt16 ( track -> par -> codec_id ) || track -> par -> codec_id == AV_CODEC_ID_ADPCM_MS || track -> par -> codec_id == AV_CODEC_ID_ADPCM_IMA_WAV || track -> par -> codec_id == AV_CODEC_ID_QDM2 ) { version = 1 ; } } avio_wb32 ( pb , 0 ) ; if ( mov -> encryption_scheme != MOV_ENC_NONE ) { ffio_wfourcc ( pb , "enca" ) ; } else { avio_wl32 ( pb , tag ) ; } avio_wb32 ( pb , 0 ) ; avio_wb16 ( pb , 0 ) ; avio_wb16 ( pb , 1 ) ; avio_wb16 ( pb , version ) ; avio_wb16 ( pb , 0 ) ; avio_wb32 ( pb , 0 ) ; if ( version == 2 ) { avio_wb16 ( pb , 3 ) ; avio_wb16 ( pb , 16 ) ; avio_wb16 ( pb , 0xfffe ) ; avio_wb16 ( pb , 0 ) ; avio_wb32 ( pb , 0x00010000 ) ; avio_wb32 ( pb , 72 ) ; avio_wb64 ( pb , av_double2int ( track -> par -> sample_rate ) ) ; avio_wb32 ( pb , track -> par -> channels ) ; avio_wb32 ( pb , 0x7F000000 ) ; avio_wb32 ( pb , av_get_bits_per_sample ( track -> par -> codec_id ) ) ; avio_wb32 ( pb , mov_get_lpcm_flags ( track -> par -> codec_id ) ) ; avio_wb32 ( pb , track -> sample_size ) ; avio_wb32 ( pb , get_samples_per_packet ( track ) ) ; } else { if ( track -> mode == MODE_MOV ) { avio_wb16 ( pb , track -> par -> channels ) ; if ( track -> par -> codec_id == AV_CODEC_ID_PCM_U8 || track -> par -> codec_id == AV_CODEC_ID_PCM_S8 ) avio_wb16 ( pb , 8 ) ; else if ( track -> par -> codec_id == AV_CODEC_ID_ADPCM_G726 ) avio_wb16 ( pb , track -> par -> bits_per_coded_sample ) ; else avio_wb16 ( pb , 16 ) ; avio_wb16 ( pb , track -> audio_vbr ? - 2 : 0 ) ; } else { if ( track -> par -> codec_id == AV_CODEC_ID_FLAC || track -> par -> codec_id == AV_CODEC_ID_OPUS ) { avio_wb16 ( pb , track -> par -> channels ) ; } else { avio_wb16 ( pb , 2 ) ; } if ( track -> par -> codec_id == AV_CODEC_ID_FLAC ) { avio_wb16 ( pb , track -> par -> bits_per_raw_sample ) ; } else { avio_wb16 ( pb , 16 ) ; } avio_wb16 ( pb , 0 ) ; } avio_wb16 ( pb , 0 ) ; if ( track -> par -> codec_id == AV_CODEC_ID_OPUS ) avio_wb16 ( pb , 48000 ) ; else avio_wb16 ( pb , track -> par -> sample_rate <= UINT16_MAX ? track -> par -> sample_rate : 0 ) ; avio_wb16 ( pb , 0 ) ; } if ( version == 1 ) { if ( mov_pcm_le_gt16 ( track -> par -> codec_id ) || mov_pcm_be_gt16 ( track -> par -> codec_id ) ) avio_wb32 ( pb , 1 ) ; else avio_wb32 ( pb , track -> par -> frame_size ) ; avio_wb32 ( pb , track -> sample_size / track -> par -> channels ) ; avio_wb32 ( pb , track -> sample_size ) ; avio_wb32 ( pb , 2 ) ; } if ( track -> mode == MODE_MOV && ( track -> par -> codec_id == AV_CODEC_ID_AAC || track -> par -> codec_id == AV_CODEC_ID_AC3 || track -> par -> codec_id == AV_CODEC_ID_EAC3 || track -> par -> codec_id == AV_CODEC_ID_AMR_NB || track -> par -> codec_id == AV_CODEC_ID_ALAC || track -> par -> codec_id == AV_CODEC_ID_ADPCM_MS || track -> par -> codec_id == AV_CODEC_ID_ADPCM_IMA_WAV || track -> par -> codec_id == AV_CODEC_ID_QDM2 || ( mov_pcm_le_gt16 ( track -> par -> codec_id ) && version == 1 ) || ( mov_pcm_be_gt16 ( track -> par -> codec_id ) && version == 1 ) ) ) mov_write_wave_tag ( s , pb , track ) ; else if ( track -> tag == MKTAG ( 'm' , 'p' , '4' , 'a' ) ) mov_write_esds_tag ( pb , track ) ; else if ( track -> par -> codec_id == AV_CODEC_ID_AMR_NB ) mov_write_amr_tag ( pb , track ) ; else if ( track -> par -> codec_id == AV_CODEC_ID_AC3 ) mov_write_ac3_tag ( pb , track ) ; else if ( track -> par -> codec_id == AV_CODEC_ID_EAC3 ) mov_write_eac3_tag ( pb , track ) ; else if ( track -> par -> codec_id == AV_CODEC_ID_ALAC ) mov_write_extradata_tag ( pb , track ) ; else if ( track -> par -> codec_id == AV_CODEC_ID_WMAPRO ) mov_write_wfex_tag ( s , pb , track ) ; else if ( track -> par -> codec_id == AV_CODEC_ID_FLAC ) mov_write_dfla_tag ( pb , track ) ; else if ( track -> par -> codec_id == AV_CODEC_ID_OPUS ) mov_write_dops_tag ( pb , track ) ; else if ( track -> vos_len > 0 ) mov_write_glbl_tag ( pb , track ) ; if ( track -> mode == MODE_MOV && track -> par -> codec_type == AVMEDIA_TYPE_AUDIO ) mov_write_chan_tag ( s , pb , track ) ; if ( mov -> encryption_scheme != MOV_ENC_NONE ) { ff_mov_cenc_write_sinf_tag ( track , pb , mov -> encryption_kid ) ; } return update_size ( pb , pos ) ; }
| <S2SV_ModStart> timescale > UINT16_MAX || ! track -> par -> channels
| FFmpeg@FFmpeg/fa19fbcf712a6a6cc5a5cfdc3254a97b9bce6582 | CVE-2018-14395 | https://github.com/FFmpeg/FFmpeg/commit/fa19fbcf712a6a6cc5a5cfdc3254a97b9bce6582 | 2018-07-19T05:29Z |
6,754 | CWE-119 | CWE-119 static Image * ReadBMPImage ( const ImageInfo * image_info , ExceptionInfo * exception ) { BMPInfo bmp_info ; Image * image ; IndexPacket index ; MagickBooleanType status ; MagickOffsetType offset , start_position ; MemoryInfo * pixel_info ; register IndexPacket * indexes ; register PixelPacket * q ; register ssize_t i , x ; register unsigned char * p ; size_t bit , blue , bytes_per_line , green , length , red ; ssize_t count , y ; unsigned char magick [ 12 ] , * pixels ; assert ( image_info != ( const ImageInfo * ) NULL ) ; assert ( image_info -> signature == MagickSignature ) ; if ( image_info -> debug != MagickFalse ) ( void ) LogMagickEvent ( TraceEvent , GetMagickModule ( ) , "%s" , image_info -> filename ) ; assert ( exception != ( ExceptionInfo * ) NULL ) ; assert ( exception -> signature == MagickSignature ) ; image = AcquireImage ( image_info ) ; status = OpenBlob ( image_info , image , ReadBinaryBlobMode , exception ) ; if ( status == MagickFalse ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } ( void ) ResetMagickMemory ( & bmp_info , 0 , sizeof ( bmp_info ) ) ; bmp_info . ba_offset = 0 ; start_position = 0 ; count = ReadBlob ( image , 2 , magick ) ; do { LongPixelPacket shift ; PixelPacket quantum_bits ; size_t profile_data , profile_size ; if ( bmp_info . ba_offset == 0 ) start_position = TellBlob ( image ) - 2 ; bmp_info . ba_offset = 0 ; while ( LocaleNCompare ( ( char * ) magick , "BA" , 2 ) == 0 ) { bmp_info . file_size = ReadBlobLSBLong ( image ) ; bmp_info . ba_offset = ReadBlobLSBLong ( image ) ; bmp_info . offset_bits = ReadBlobLSBLong ( image ) ; count = ReadBlob ( image , 2 , magick ) ; if ( count != 2 ) break ; } if ( image -> debug != MagickFalse ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Magick:<S2SV_blank>%c%c" , magick [ 0 ] , magick [ 1 ] ) ; if ( ( count == 0 ) || ( ( LocaleNCompare ( ( char * ) magick , "BM" , 2 ) != 0 ) && ( LocaleNCompare ( ( char * ) magick , "CI" , 2 ) != 0 ) ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; bmp_info . file_size = ReadBlobLSBLong ( image ) ; ( void ) ReadBlobLSBLong ( image ) ; if ( image -> debug != MagickFalse ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>File_size<S2SV_blank>in<S2SV_blank>header:<S2SV_blank><S2SV_blank>%u<S2SV_blank>bytes" , bmp_info . file_size ) ; bmp_info . offset_bits = ReadBlobLSBLong ( image ) ; bmp_info . size = ReadBlobLSBLong ( image ) ; if ( image -> debug != MagickFalse ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>BMP<S2SV_blank>size:<S2SV_blank>%u" , bmp_info . size ) ; if ( bmp_info . size == 12 ) { ( void ) CopyMagickString ( image -> magick , "BMP2" , MaxTextExtent ) ; bmp_info . width = ( ssize_t ) ( ( short ) ReadBlobLSBShort ( image ) ) ; bmp_info . height = ( ssize_t ) ( ( short ) ReadBlobLSBShort ( image ) ) ; bmp_info . planes = ReadBlobLSBShort ( image ) ; bmp_info . bits_per_pixel = ReadBlobLSBShort ( image ) ; bmp_info . x_pixels = 0 ; bmp_info . y_pixels = 0 ; bmp_info . number_colors = 0 ; bmp_info . compression = BI_RGB ; bmp_info . image_size = 0 ; bmp_info . alpha_mask = 0 ; if ( image -> debug != MagickFalse ) { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Format:<S2SV_blank>OS/2<S2SV_blank>Bitmap" ) ; ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Geometry:<S2SV_blank>%.20gx%.20g" , ( double ) bmp_info . width , ( double ) bmp_info . height ) ; } } else { if ( bmp_info . size < 40 ) ThrowReaderException ( CorruptImageError , "NonOS2HeaderSizeError" ) ; bmp_info . width = ( ssize_t ) ( ( int ) ReadBlobLSBLong ( image ) ) ; bmp_info . height = ( ssize_t ) ( ( int ) ReadBlobLSBLong ( image ) ) ; bmp_info . planes = ReadBlobLSBShort ( image ) ; bmp_info . bits_per_pixel = ReadBlobLSBShort ( image ) ; bmp_info . compression = ReadBlobLSBLong ( image ) ; bmp_info . image_size = ReadBlobLSBLong ( image ) ; bmp_info . x_pixels = ReadBlobLSBLong ( image ) ; bmp_info . y_pixels = ReadBlobLSBLong ( image ) ; bmp_info . number_colors = ReadBlobLSBLong ( image ) ; bmp_info . colors_important = ReadBlobLSBLong ( image ) ; profile_data = 0 ; profile_size = 0 ; if ( image -> debug != MagickFalse ) { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Format:<S2SV_blank>MS<S2SV_blank>Windows<S2SV_blank>bitmap" ) ; ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Geometry:<S2SV_blank>%.20gx%.20g" , ( double ) bmp_info . width , ( double ) bmp_info . height ) ; ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Bits<S2SV_blank>per<S2SV_blank>pixel:<S2SV_blank>%.20g" , ( double ) bmp_info . bits_per_pixel ) ; switch ( ( int ) bmp_info . compression ) { case BI_RGB : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>BI_RGB" ) ; break ; } case BI_RLE4 : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>BI_RLE4" ) ; break ; } case BI_RLE8 : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>BI_RLE8" ) ; break ; } case BI_BITFIELDS : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>BI_BITFIELDS" ) ; break ; } case BI_PNG : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>BI_PNG" ) ; break ; } case BI_JPEG : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>BI_JPEG" ) ; break ; } default : { ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Compression:<S2SV_blank>UNKNOWN<S2SV_blank>(%u)" , bmp_info . compression ) ; } } ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Number<S2SV_blank>of<S2SV_blank>colors:<S2SV_blank>%u" , bmp_info . number_colors ) ; } bmp_info . red_mask = ReadBlobLSBLong ( image ) ; bmp_info . green_mask = ReadBlobLSBLong ( image ) ; bmp_info . blue_mask = ReadBlobLSBLong ( image ) ; if ( bmp_info . size > 40 ) { double sum ; bmp_info . alpha_mask = ReadBlobLSBLong ( image ) ; bmp_info . colorspace = ( int ) ReadBlobLSBLong ( image ) ; # define BMP_DENOM ( ( double ) 0x40000000 ) bmp_info . red_primary . x = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . red_primary . y = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . red_primary . z = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . green_primary . x = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . green_primary . y = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . green_primary . z = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . blue_primary . x = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . blue_primary . y = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; bmp_info . blue_primary . z = ( double ) ReadBlobLSBLong ( image ) / BMP_DENOM ; sum = bmp_info . red_primary . x + bmp_info . red_primary . y + bmp_info . red_primary . z ; bmp_info . red_primary . x /= sum ; bmp_info . red_primary . y /= sum ; image -> chromaticity . red_primary . x = bmp_info . red_primary . x ; image -> chromaticity . red_primary . y = bmp_info . red_primary . y ; sum = bmp_info . green_primary . x + bmp_info . green_primary . y + bmp_info . green_primary . z ; bmp_info . green_primary . x /= sum ; bmp_info . green_primary . y /= sum ; image -> chromaticity . green_primary . x = bmp_info . green_primary . x ; image -> chromaticity . green_primary . y = bmp_info . green_primary . y ; sum = bmp_info . blue_primary . x + bmp_info . blue_primary . y + bmp_info . blue_primary . z ; bmp_info . blue_primary . x /= sum ; bmp_info . blue_primary . y /= sum ; image -> chromaticity . blue_primary . x = bmp_info . blue_primary . x ; image -> chromaticity . blue_primary . y = bmp_info . blue_primary . y ; bmp_info . gamma_scale . x = ( double ) ReadBlobLSBLong ( image ) / 0x10000 ; bmp_info . gamma_scale . y = ( double ) ReadBlobLSBLong ( image ) / 0x10000 ; bmp_info . gamma_scale . z = ( double ) ReadBlobLSBLong ( image ) / 0x10000 ; image -> gamma = ( bmp_info . gamma_scale . x + bmp_info . gamma_scale . y + bmp_info . gamma_scale . z ) / 3.0 ; } else ( void ) CopyMagickString ( image -> magick , "BMP3" , MaxTextExtent ) ; if ( bmp_info . size > 108 ) { size_t intent ; intent = ReadBlobLSBLong ( image ) ; switch ( ( int ) intent ) { case LCS_GM_BUSINESS : { image -> rendering_intent = SaturationIntent ; break ; } case LCS_GM_GRAPHICS : { image -> rendering_intent = RelativeIntent ; break ; } case LCS_GM_IMAGES : { image -> rendering_intent = PerceptualIntent ; break ; } case LCS_GM_ABS_COLORIMETRIC : { image -> rendering_intent = AbsoluteIntent ; break ; } } profile_data = ReadBlobLSBLong ( image ) ; profile_size = ReadBlobLSBLong ( image ) ; ( void ) profile_data ; ( void ) profile_size ; ( void ) ReadBlobLSBLong ( image ) ; } } if ( ( MagickSizeType ) bmp_info . file_size > GetBlobSize ( image ) ) ( void ) ThrowMagickException ( exception , GetMagickModule ( ) , CorruptImageError , "LengthAndFilesizeDoNotMatch" , "`%s\'" , image -> filename ) ; else if ( ( MagickSizeType ) bmp_info . file_size < GetBlobSize ( image ) ) ( void ) ThrowMagickException ( exception , GetMagickModule ( ) , CorruptImageWarning , "LengthAndFilesizeDoNotMatch" , "`%s\'" , image -> filename ) ; if ( bmp_info . width <= 0 ) ThrowReaderException ( CorruptImageError , "NegativeOrZeroImageSize" ) ; if ( bmp_info . height == 0 ) ThrowReaderException ( CorruptImageError , "NegativeOrZeroImageSize" ) ; if ( bmp_info . planes != 1 ) ThrowReaderException ( CorruptImageError , "StaticPlanesValueNotEqualToOne" ) ; if ( ( bmp_info . bits_per_pixel != 1 ) && ( bmp_info . bits_per_pixel != 4 ) && ( bmp_info . bits_per_pixel != 8 ) && ( bmp_info . bits_per_pixel != 16 ) && ( bmp_info . bits_per_pixel != 24 ) && ( bmp_info . bits_per_pixel != 32 ) ) ThrowReaderException ( CorruptImageError , "UnrecognizedBitsPerPixel" ) ; if ( bmp_info . bits_per_pixel < 16 && bmp_info . number_colors > ( 1U << bmp_info . bits_per_pixel ) ) { ThrowReaderException ( CorruptImageError , "UnrecognizedNumberOfColors" ) ; } if ( ( bmp_info . compression == 1 ) && ( bmp_info . bits_per_pixel != 8 ) ) ThrowReaderException ( CorruptImageError , "UnrecognizedBitsPerPixel" ) ; if ( ( bmp_info . compression == 2 ) && ( bmp_info . bits_per_pixel != 4 ) ) ThrowReaderException ( CorruptImageError , "UnrecognizedBitsPerPixel" ) ; if ( ( bmp_info . compression == 3 ) && ( bmp_info . bits_per_pixel < 16 ) ) ThrowReaderException ( CorruptImageError , "UnrecognizedBitsPerPixel" ) ; switch ( bmp_info . compression ) { case BI_RGB : case BI_RLE8 : case BI_RLE4 : case BI_BITFIELDS : break ; case BI_JPEG : ThrowReaderException ( CoderError , "JPEGCompressNotSupported" ) ; case BI_PNG : ThrowReaderException ( CoderError , "PNGCompressNotSupported" ) ; default : ThrowReaderException ( CorruptImageError , "UnrecognizedImageCompression" ) ; } image -> columns = ( size_t ) MagickAbsoluteValue ( bmp_info . width ) ; image -> rows = ( size_t ) MagickAbsoluteValue ( bmp_info . height ) ; image -> depth = bmp_info . bits_per_pixel <= 8 ? bmp_info . bits_per_pixel : 8 ; image -> matte = ( ( bmp_info . alpha_mask != 0 ) && ( bmp_info . compression == BI_BITFIELDS ) ) || ( bmp_info . bits_per_pixel == 32 ) ? MagickTrue : MagickFalse ; if ( bmp_info . bits_per_pixel < 16 ) { size_t one ; image -> storage_class = PseudoClass ; image -> colors = bmp_info . number_colors ; one = 1 ; if ( image -> colors == 0 ) image -> colors = one << bmp_info . bits_per_pixel ; } if ( image -> storage_class == PseudoClass ) { unsigned char * bmp_colormap ; size_t packet_size ; if ( image -> debug != MagickFalse ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Reading<S2SV_blank>colormap<S2SV_blank>of<S2SV_blank>%.20g<S2SV_blank>colors" , ( double ) image -> colors ) ; if ( AcquireImageColormap ( image , image -> colors ) == MagickFalse ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; bmp_colormap = ( unsigned char * ) AcquireQuantumMemory ( ( size_t ) image -> colors , 4 * sizeof ( * bmp_colormap ) ) ; if ( bmp_colormap == ( unsigned char * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; if ( ( bmp_info . size == 12 ) || ( bmp_info . size == 64 ) ) packet_size = 3 ; else packet_size = 4 ; offset = SeekBlob ( image , start_position + 14 + bmp_info . size , SEEK_SET ) ; if ( offset < 0 ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; count = ReadBlob ( image , packet_size * image -> colors , bmp_colormap ) ; if ( count != ( ssize_t ) ( packet_size * image -> colors ) ) ThrowReaderException ( CorruptImageError , "InsufficientImageDataInFile" ) ; p = bmp_colormap ; for ( i = 0 ; i < ( ssize_t ) image -> colors ; i ++ ) { image -> colormap [ i ] . blue = ScaleCharToQuantum ( * p ++ ) ; image -> colormap [ i ] . green = ScaleCharToQuantum ( * p ++ ) ; image -> colormap [ i ] . red = ScaleCharToQuantum ( * p ++ ) ; if ( packet_size == 4 ) p ++ ; } bmp_colormap = ( unsigned char * ) RelinquishMagickMemory ( bmp_colormap ) ; } image -> x_resolution = ( double ) bmp_info . x_pixels / 100.0 ; image -> y_resolution = ( double ) bmp_info . y_pixels / 100.0 ; image -> units = PixelsPerCentimeterResolution ; if ( ( image_info -> ping != MagickFalse ) && ( image_info -> number_scenes != 0 ) ) if ( image -> scene >= ( image_info -> scene + image_info -> number_scenes - 1 ) ) <S2SV_StartBug> break ; <S2SV_EndBug> offset = SeekBlob ( image , start_position + bmp_info . offset_bits , SEEK_SET ) ; if ( offset < 0 ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; if ( bmp_info . compression == BI_RLE4 ) bmp_info . bits_per_pixel <<= 1 ; bytes_per_line = 4 * ( ( image -> columns * bmp_info . bits_per_pixel + 31 ) / 32 ) ; length = ( size_t ) bytes_per_line * image -> rows ; pixel_info = AcquireVirtualMemory ( ( size_t ) image -> rows , MagickMax ( bytes_per_line , image -> columns + 256UL ) * sizeof ( * pixels ) ) ; if ( pixel_info == ( MemoryInfo * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; pixels = ( unsigned char * ) GetVirtualMemoryBlob ( pixel_info ) ; if ( ( bmp_info . compression == BI_RGB ) || ( bmp_info . compression == BI_BITFIELDS ) ) { if ( image -> debug != MagickFalse ) ( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , "<S2SV_blank><S2SV_blank>Reading<S2SV_blank>pixels<S2SV_blank>(%.20g<S2SV_blank>bytes)" , ( double ) length ) ; count = ReadBlob ( image , length , pixels ) ; if ( count != ( ssize_t ) length ) { pixel_info = RelinquishVirtualMemory ( pixel_info ) ; ThrowReaderException ( CorruptImageError , "InsufficientImageDataInFile" ) ; } } else { status = DecodeImage ( image , bmp_info . compression , pixels ) ; if ( status == MagickFalse ) { pixel_info = RelinquishVirtualMemory ( pixel_info ) ; ThrowReaderException ( CorruptImageError , "UnableToRunlengthDecodeImage" ) ; } } if ( bmp_info . compression == BI_RGB ) { bmp_info . alpha_mask = image -> matte != MagickFalse ? 0xff000000U : 0U ; bmp_info . red_mask = 0x00ff0000U ; bmp_info . green_mask = 0x0000ff00U ; bmp_info . blue_mask = 0x000000ffU ; if ( bmp_info . bits_per_pixel == 16 ) { bmp_info . red_mask = 0x00007c00U ; bmp_info . green_mask = 0x000003e0U ; bmp_info . blue_mask = 0x0000001fU ; } } if ( ( bmp_info . bits_per_pixel == 16 ) || ( bmp_info . bits_per_pixel == 32 ) ) { register size_t sample ; ( void ) ResetMagickMemory ( & shift , 0 , sizeof ( shift ) ) ; ( void ) ResetMagickMemory ( & quantum_bits , 0 , sizeof ( quantum_bits ) ) ; if ( bmp_info . red_mask != 0 ) while ( ( ( bmp_info . red_mask << shift . red ) & 0x80000000UL ) == 0 ) shift . red ++ ; if ( bmp_info . green_mask != 0 ) while ( ( ( bmp_info . green_mask << shift . green ) & 0x80000000UL ) == 0 ) shift . green ++ ; if ( bmp_info . blue_mask != 0 ) while ( ( ( bmp_info . blue_mask << shift . blue ) & 0x80000000UL ) == 0 ) shift . blue ++ ; if ( bmp_info . alpha_mask != 0 ) while ( ( ( bmp_info . alpha_mask << shift . opacity ) & 0x80000000UL ) == 0 ) shift . opacity ++ ; sample = shift . red ; while ( ( ( bmp_info . red_mask << sample ) & 0x80000000UL ) != 0 ) sample ++ ; quantum_bits . red = ClampToQuantum ( ( MagickRealType ) sample - shift . red ) ; sample = shift . green ; while ( ( ( bmp_info . green_mask << sample ) & 0x80000000UL ) != 0 ) sample ++ ; quantum_bits . green = ClampToQuantum ( ( MagickRealType ) sample - shift . green ) ; sample = shift . blue ; while ( ( ( bmp_info . blue_mask << sample ) & 0x80000000UL ) != 0 ) sample ++ ; quantum_bits . blue = ClampToQuantum ( ( MagickRealType ) sample - shift . blue ) ; sample = shift . opacity ; while ( ( ( bmp_info . alpha_mask << sample ) & 0x80000000UL ) != 0 ) sample ++ ; quantum_bits . opacity = ClampToQuantum ( ( MagickRealType ) sample - shift . opacity ) ; } switch ( bmp_info . bits_per_pixel ) { case 1 : { for ( y = ( ssize_t ) image -> rows - 1 ; y >= 0 ; y -- ) { p = pixels + ( image -> rows - y - 1 ) * bytes_per_line ; q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( PixelPacket * ) NULL ) break ; indexes = GetAuthenticIndexQueue ( image ) ; for ( x = 0 ; x < ( ( ssize_t ) image -> columns - 7 ) ; x += 8 ) { for ( bit = 0 ; bit < 8 ; bit ++ ) { index = ( IndexPacket ) ( ( ( * p ) & ( 0x80 >> bit ) ) != 0 ? 0x01 : 0x00 ) ; SetPixelIndex ( indexes + x + bit , index ) ; q ++ ; } p ++ ; } if ( ( image -> columns % 8 ) != 0 ) { for ( bit = 0 ; bit < ( image -> columns % 8 ) ; bit ++ ) { index = ( IndexPacket ) ( ( ( * p ) & ( 0x80 >> bit ) ) != 0 ? 0x01 : 0x00 ) ; SetPixelIndex ( indexes + x + bit , index ) ; } p ++ ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) ( image -> rows - y ) , image -> rows ) ; if ( status == MagickFalse ) break ; } } ( void ) SyncImage ( image ) ; break ; } case 4 : { for ( y = ( ssize_t ) image -> rows - 1 ; y >= 0 ; y -- ) { p = pixels + ( image -> rows - y - 1 ) * bytes_per_line ; q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( PixelPacket * ) NULL ) break ; indexes = GetAuthenticIndexQueue ( image ) ; for ( x = 0 ; x < ( ( ssize_t ) image -> columns - 1 ) ; x += 2 ) { index = ConstrainColormapIndex ( image , ( * p >> 4 ) & 0x0f ) ; SetPixelIndex ( indexes + x , index ) ; index = ConstrainColormapIndex ( image , * p & 0x0f ) ; SetPixelIndex ( indexes + x + 1 , index ) ; p ++ ; } if ( ( image -> columns % 2 ) != 0 ) { index = ConstrainColormapIndex ( image , ( * p >> 4 ) & 0xf ) ; SetPixelIndex ( indexes + x , index ) ; p ++ ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) ( image -> rows - y ) , image -> rows ) ; if ( status == MagickFalse ) break ; } } ( void ) SyncImage ( image ) ; break ; } case 8 : { if ( ( bmp_info . compression == BI_RLE8 ) || ( bmp_info . compression == BI_RLE4 ) ) bytes_per_line = image -> columns ; for ( y = ( ssize_t ) image -> rows - 1 ; y >= 0 ; y -- ) { p = pixels + ( image -> rows - y - 1 ) * bytes_per_line ; q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( PixelPacket * ) NULL ) break ; indexes = GetAuthenticIndexQueue ( image ) ; for ( x = ( ssize_t ) image -> columns ; x != 0 ; -- x ) { index = ConstrainColormapIndex ( image , * p ) ; SetPixelIndex ( indexes , index ) ; indexes ++ ; p ++ ; q ++ ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; offset = ( MagickOffsetType ) ( image -> rows - y - 1 ) ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) ( image -> rows - y ) , image -> rows ) ; if ( status == MagickFalse ) break ; } } ( void ) SyncImage ( image ) ; break ; } case 16 : { size_t alpha , pixel ; if ( bmp_info . compression != BI_RGB && bmp_info . compression != BI_BITFIELDS ) { pixel_info = RelinquishVirtualMemory ( pixel_info ) ; ThrowReaderException ( CorruptImageError , "UnrecognizedImageCompression" ) ; } bytes_per_line = 2 * ( image -> columns + image -> columns % 2 ) ; image -> storage_class = DirectClass ; for ( y = ( ssize_t ) image -> rows - 1 ; y >= 0 ; y -- ) { p = pixels + ( image -> rows - y - 1 ) * bytes_per_line ; q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( PixelPacket * ) NULL ) break ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) { pixel = ( size_t ) ( * p ++ ) ; pixel |= ( * p ++ ) << 8 ; red = ( ( pixel & bmp_info . red_mask ) << shift . red ) >> 16 ; if ( quantum_bits . red == 5 ) red |= ( ( red & 0xe000 ) >> 5 ) ; if ( quantum_bits . red <= 8 ) red |= ( ( red & 0xff00 ) >> 8 ) ; green = ( ( pixel & bmp_info . green_mask ) << shift . green ) >> 16 ; if ( quantum_bits . green == 5 ) green |= ( ( green & 0xe000 ) >> 5 ) ; if ( quantum_bits . green == 6 ) green |= ( ( green & 0xc000 ) >> 6 ) ; if ( quantum_bits . green <= 8 ) green |= ( ( green & 0xff00 ) >> 8 ) ; blue = ( ( pixel & bmp_info . blue_mask ) << shift . blue ) >> 16 ; if ( quantum_bits . blue == 5 ) blue |= ( ( blue & 0xe000 ) >> 5 ) ; if ( quantum_bits . blue <= 8 ) blue |= ( ( blue & 0xff00 ) >> 8 ) ; alpha = ( ( pixel & bmp_info . alpha_mask ) << shift . opacity ) >> 16 ; if ( quantum_bits . opacity <= 8 ) alpha |= ( ( alpha & 0xff00 ) >> 8 ) ; SetPixelRed ( q , ScaleShortToQuantum ( ( unsigned short ) red ) ) ; SetPixelGreen ( q , ScaleShortToQuantum ( ( unsigned short ) green ) ) ; SetPixelBlue ( q , ScaleShortToQuantum ( ( unsigned short ) blue ) ) ; SetPixelOpacity ( q , OpaqueOpacity ) ; if ( image -> matte != MagickFalse ) SetPixelAlpha ( q , ScaleShortToQuantum ( ( unsigned short ) alpha ) ) ; q ++ ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; offset = ( MagickOffsetType ) ( image -> rows - y - 1 ) ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) ( image -> rows - y ) , image -> rows ) ; if ( status == MagickFalse ) break ; } } break ; } case 24 : { bytes_per_line = 4 * ( ( image -> columns * 24 + 31 ) / 32 ) ; for ( y = ( ssize_t ) image -> rows - 1 ; y >= 0 ; y -- ) { p = pixels + ( image -> rows - y - 1 ) * bytes_per_line ; q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( PixelPacket * ) NULL ) break ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) { SetPixelBlue ( q , ScaleCharToQuantum ( * p ++ ) ) ; SetPixelGreen ( q , ScaleCharToQuantum ( * p ++ ) ) ; SetPixelRed ( q , ScaleCharToQuantum ( * p ++ ) ) ; SetPixelOpacity ( q , OpaqueOpacity ) ; q ++ ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; offset = ( MagickOffsetType ) ( image -> rows - y - 1 ) ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) ( image -> rows - y ) , image -> rows ) ; if ( status == MagickFalse ) break ; } } break ; } case 32 : { if ( ( bmp_info . compression != BI_RGB ) && ( bmp_info . compression != BI_BITFIELDS ) ) { pixel_info = RelinquishVirtualMemory ( pixel_info ) ; ThrowReaderException ( CorruptImageError , "UnrecognizedImageCompression" ) ; } bytes_per_line = 4 * ( image -> columns ) ; for ( y = ( ssize_t ) image -> rows - 1 ; y >= 0 ; y -- ) { size_t alpha , pixel ; p = pixels + ( image -> rows - y - 1 ) * bytes_per_line ; q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( PixelPacket * ) NULL ) break ; for ( x = 0 ; x < ( ssize_t ) image -> columns ; x ++ ) { pixel = ( size_t ) ( * p ++ ) ; pixel |= ( ( size_t ) * p ++ << 8 ) ; pixel |= ( ( size_t ) * p ++ << 16 ) ; pixel |= ( ( size_t ) * p ++ << 24 ) ; red = ( ( pixel & bmp_info . red_mask ) << shift . red ) >> 16 ; if ( quantum_bits . red == 8 ) red |= ( red >> 8 ) ; green = ( ( pixel & bmp_info . green_mask ) << shift . green ) >> 16 ; if ( quantum_bits . green == 8 ) green |= ( green >> 8 ) ; blue = ( ( pixel & bmp_info . blue_mask ) << shift . blue ) >> 16 ; if ( quantum_bits . blue == 8 ) blue |= ( blue >> 8 ) ; alpha = ( ( pixel & bmp_info . alpha_mask ) << shift . opacity ) >> 16 ; if ( quantum_bits . opacity == 8 ) alpha |= ( alpha >> 8 ) ; SetPixelRed ( q , ScaleShortToQuantum ( ( unsigned short ) red ) ) ; SetPixelGreen ( q , ScaleShortToQuantum ( ( unsigned short ) green ) ) ; SetPixelBlue ( q , ScaleShortToQuantum ( ( unsigned short ) blue ) ) ; SetPixelAlpha ( q , OpaqueOpacity ) ; if ( image -> matte != MagickFalse ) SetPixelAlpha ( q , ScaleShortToQuantum ( ( unsigned short ) alpha ) ) ; q ++ ; } if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; offset = ( MagickOffsetType ) ( image -> rows - y - 1 ) ; if ( image -> previous == ( Image * ) NULL ) { status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) ( image -> rows - y ) , image -> rows ) ; if ( status == MagickFalse ) break ; } } break ; } default : { pixel_info = RelinquishVirtualMemory ( pixel_info ) ; ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; } } pixel_info = RelinquishVirtualMemory ( pixel_info ) ; if ( EOFBlob ( image ) != MagickFalse ) { ThrowFileException ( exception , CorruptImageError , "UnexpectedEndOfFile" , image -> filename ) ; break ; } if ( bmp_info . height < 0 ) { Image * flipped_image ; flipped_image = FlipImage ( image , exception ) ; if ( flipped_image != ( Image * ) NULL ) { DuplicateBlob ( flipped_image , image ) ; image = DestroyImage ( image ) ; image = flipped_image ; } } if ( image_info -> number_scenes != 0 ) if ( image -> scene >= ( image_info -> scene + image_info -> number_scenes - 1 ) ) break ; * magick = '\\0' ; if ( bmp_info . ba_offset != 0 ) { offset = SeekBlob ( image , ( MagickOffsetType ) bmp_info . ba_offset , SEEK_SET ) ; if ( offset < 0 ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; } count = ReadBlob ( image , 2 , magick ) ; if ( ( count == 2 ) && ( IsBMP ( magick , 2 ) != MagickFalse ) ) { AcquireNextImage ( image_info , image ) ; if ( GetNextImageInList ( image ) == ( Image * ) NULL ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } image = SyncNextImageInList ( image ) ; status = SetImageProgress ( image , LoadImagesTag , TellBlob ( image ) , GetBlobSize ( image ) ) ; if ( status == MagickFalse ) break ; } } while ( IsBMP ( magick , 2 ) != MagickFalse ) ; ( void ) CloseBlob ( image ) ; return ( GetFirstImageInList ( image ) ) ; }
| <S2SV_ModStart> ) break ; status = SetImageExtent ( image , image -> columns , image -> rows ) ; if ( status == MagickFalse ) { InheritException ( exception , & image -> exception ) ; return ( DestroyImageList ( image ) ) ; }
| ImageMagick@ImageMagick/f6e9d0d9955e85bdd7540b251cd50d598dacc5e6 | CVE-2016-10066 | https://github.com/ImageMagick/ImageMagick/commit/f6e9d0d9955e85bdd7540b251cd50d598dacc5e6 | 2017-03-03T17:59Z |
6,755 | CWE-787 | CWE-787 VOID ixheaacd_shiftrountine_with_rnd_hq ( WORD32 * qmf_real , WORD32 * qmf_imag , WORD32 * filter_states , WORD32 len , WORD32 shift ) { WORD32 * filter_states_rev = filter_states + len ; WORD32 treal , timag ; WORD32 j ; for ( j = ( len - 1 ) ; j >= 0 ; j -= 2 ) { WORD32 r1 , r2 , i1 , i2 ; i2 = qmf_imag [ j ] ; r2 = qmf_real [ j ] ; r1 = * qmf_real ++ ; i1 = * qmf_imag ++ ; <S2SV_StartBug> timag = ixheaacd_add32 ( i1 , r1 ) ; <S2SV_EndBug> timag = ( ixheaacd_shl32_sat ( timag , shift ) ) ; filter_states_rev [ j ] = timag ; <S2SV_StartBug> treal = ixheaacd_sub32 ( i2 , r2 ) ; <S2SV_EndBug> treal = ( ixheaacd_shl32_sat ( treal , shift ) ) ; filter_states [ j ] = treal ; treal = ixheaacd_sub32 ( i1 , r1 ) ; treal = ( ixheaacd_shl32_sat ( treal , shift ) ) ; * filter_states ++ = treal ; timag = ixheaacd_add32 ( i2 , r2 ) ; timag = ( ixheaacd_shl32_sat ( timag , shift ) ) ; * filter_states_rev ++ = timag ; } }
| <S2SV_ModStart> ; timag = ixheaacd_add32_sat <S2SV_ModEnd> ( i1 , <S2SV_ModStart> ; treal = ixheaacd_sub32_sat ( i2 , r2 ) ; treal = ( ixheaacd_shl32_sat ( treal , shift ) ) ; filter_states [ j ] = treal ; treal = ixheaacd_sub32_sat ( i1 , r1 ) ; treal = ( ixheaacd_shl32_sat ( treal , shift ) ) ; * filter_states ++ = treal ; timag = ixheaacd_add32_sat <S2SV_ModEnd> ( i2 ,
| external@libxaac/04e8cd58f075bec5892e369c8deebca9c67e855c | CVE-2018-9496 | https://android.googlesource.com/platform/external/libxaac/+/04e8cd58f075bec5892e369c8deebca9c67e855c | 2018-10-02T19:29Z |
6,756 | CWE-119 | CWE-119 void vp8_yv12_extend_frame_borders_c ( YV12_BUFFER_CONFIG * ybf ) { <S2SV_StartBug> assert ( ybf -> y_height - ybf -> y_crop_height < 16 ) ; <S2SV_EndBug> assert ( ybf -> y_width - ybf -> y_crop_width < 16 ) ; assert ( ybf -> y_height - ybf -> y_crop_height >= 0 ) ; assert ( ybf -> y_width - ybf -> y_crop_width >= 0 ) ; <S2SV_StartBug> extend_plane ( ybf -> y_buffer , ybf -> y_stride , <S2SV_EndBug> ybf -> y_crop_width , ybf -> y_crop_height , ybf -> border , ybf -> border , ybf -> border + ybf -> y_height - ybf -> y_crop_height , ybf -> border + ybf -> y_width - ybf -> y_crop_width ) ; extend_plane ( ybf -> u_buffer , ybf -> uv_stride , <S2SV_StartBug> ( ybf -> y_crop_width + 1 ) / 2 , ( ybf -> y_crop_height + 1 ) / 2 , <S2SV_EndBug> ybf -> border / 2 , ybf -> border / 2 , ( ybf -> border + ybf -> y_height - ybf -> y_crop_height + 1 ) / 2 , ( ybf -> border + ybf -> y_width - ybf -> y_crop_width + 1 ) / 2 ) ; extend_plane ( ybf -> v_buffer , ybf -> uv_stride , <S2SV_StartBug> ( ybf -> y_crop_width + 1 ) / 2 , ( ybf -> y_crop_height + 1 ) / 2 , <S2SV_EndBug> ybf -> border / 2 , ybf -> border / 2 , ( ybf -> border + ybf -> y_height - ybf -> y_crop_height + 1 ) / 2 , ( ybf -> border + ybf -> y_width - ybf -> y_crop_width + 1 ) / 2 ) ; }
| <S2SV_ModStart> ybf ) { const int uv_border = ybf -> border / 2 ; assert ( ybf -> border % 2 == 0 ) ; <S2SV_ModStart> 0 ) ; # if CONFIG_VP9_HIGHBITDEPTH if ( ybf -> flags & YV12_FLAG_HIGHBITDEPTH ) { extend_plane_high ( ybf -> y_buffer , ybf -> y_stride , ybf -> y_crop_width , ybf -> y_crop_height , ybf -> border , ybf -> border , ybf -> border + ybf -> y_height - ybf -> y_crop_height , ybf -> border + ybf -> y_width - ybf -> y_crop_width ) ; extend_plane_high ( ybf -> u_buffer , ybf -> uv_stride , ybf -> uv_crop_width , ybf -> uv_crop_height , uv_border , uv_border , uv_border + ybf -> uv_height - ybf -> uv_crop_height , uv_border + ybf -> uv_width - ybf -> uv_crop_width ) ; extend_plane_high ( ybf -> v_buffer , ybf -> uv_stride , ybf -> uv_crop_width , ybf -> uv_crop_height , uv_border , uv_border , uv_border + ybf -> uv_height - ybf -> uv_crop_height , uv_border + ybf -> uv_width - ybf -> uv_crop_width ) ; return ; } # endif <S2SV_ModStart> -> uv_stride , ybf -> uv_crop_width , ybf -> uv_crop_height , uv_border , uv_border , uv_border + ybf -> uv_height - ybf -> uv_crop_height , uv_border + ybf -> uv_width - ybf -> uv_crop_width <S2SV_ModEnd> ) ; extend_plane <S2SV_ModStart> -> uv_stride , ybf -> uv_crop_width , ybf -> uv_crop_height , uv_border , uv_border , uv_border + ybf -> uv_height - ybf -> uv_crop_height , uv_border + ybf -> uv_width - ybf -> uv_crop_width <S2SV_ModEnd> ) ; }
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
6,757 | CWE-416 | CWE-416 static int usb_console_setup ( struct console * co , char * options ) { struct usbcons_info * info = & usbcons_info ; int baud = 9600 ; int bits = 8 ; int parity = 'n' ; int doflow = 0 ; int cflag = CREAD | HUPCL | CLOCAL ; char * s ; struct usb_serial * serial ; struct usb_serial_port * port ; int retval ; struct tty_struct * tty = NULL ; struct ktermios dummy ; if ( options ) { baud = simple_strtoul ( options , NULL , 10 ) ; s = options ; while ( * s >= '0' && * s <= '9' ) s ++ ; if ( * s ) parity = * s ++ ; if ( * s ) bits = * s ++ - '0' ; if ( * s ) doflow = ( * s ++ == 'r' ) ; } if ( baud == 0 ) baud = 9600 ; switch ( bits ) { case 7 : cflag |= CS7 ; break ; default : case 8 : cflag |= CS8 ; break ; } switch ( parity ) { case 'o' : case 'O' : cflag |= PARODD ; break ; case 'e' : case 'E' : cflag |= PARENB ; break ; } co -> cflag = cflag ; port = usb_serial_port_get_by_minor ( co -> index ) ; if ( port == NULL ) { pr_err ( "No<S2SV_blank>USB<S2SV_blank>device<S2SV_blank>connected<S2SV_blank>to<S2SV_blank>ttyUSB%i\\n" , co -> index ) ; return - ENODEV ; } serial = port -> serial ; retval = usb_autopm_get_interface ( serial -> interface ) ; if ( retval ) goto error_get_interface ; tty_port_tty_set ( & port -> port , NULL ) ; info -> port = port ; ++ port -> port . count ; if ( ! tty_port_initialized ( & port -> port ) ) { if ( serial -> type -> set_termios ) { tty = kzalloc ( sizeof ( * tty ) , GFP_KERNEL ) ; if ( ! tty ) { retval = - ENOMEM ; goto reset_open_count ; } kref_init ( & tty -> kref ) ; tty -> driver = usb_serial_tty_driver ; tty -> index = co -> index ; init_ldsem ( & tty -> ldisc_sem ) ; spin_lock_init ( & tty -> files_lock ) ; INIT_LIST_HEAD ( & tty -> tty_files ) ; kref_get ( & tty -> driver -> kref ) ; __module_get ( tty -> driver -> owner ) ; tty -> ops = & usb_console_fake_tty_ops ; tty_init_termios ( tty ) ; tty_port_tty_set ( & port -> port , tty ) ; } retval = serial -> type -> open ( NULL , port ) ; if ( retval ) { dev_err ( & port -> dev , "could<S2SV_blank>not<S2SV_blank>open<S2SV_blank>USB<S2SV_blank>console<S2SV_blank>port\\n" ) ; goto fail ; } if ( serial -> type -> set_termios ) { tty -> termios . c_cflag = cflag ; tty_termios_encode_baud_rate ( & tty -> termios , baud , baud ) ; memset ( & dummy , 0 , sizeof ( struct ktermios ) ) ; serial -> type -> set_termios ( tty , port , & dummy ) ; tty_port_tty_set ( & port -> port , NULL ) ; tty_kref_put ( tty ) ; } tty_port_set_initialized ( & port -> port , 1 ) ; } -- port -> port . count ; port -> port . console = 1 ; mutex_unlock ( & serial -> disc_mutex ) ; return retval ; fail : tty_port_tty_set ( & port -> port , NULL ) ; tty_kref_put ( tty ) ; reset_open_count : port -> port . count = 0 ; <S2SV_StartBug> usb_autopm_put_interface ( serial -> interface ) ; <S2SV_EndBug> error_get_interface : usb_serial_put ( serial ) ; mutex_unlock ( & serial -> disc_mutex ) ; return retval ; }
| <S2SV_ModStart> = 0 ; info -> port = NULL ;
| torvalds@linux/299d7572e46f98534033a9e65973f13ad1ce9047 | CVE-2017-16525 | https://github.com/torvalds/linux/commit/299d7572e46f98534033a9e65973f13ad1ce9047 | 2017-11-04T01:29Z |
6,758 | CWE-119 | CWE-119 static ALGobject * ALGnew ( PyObject * self , PyObject * args , PyObject * kwdict ) { unsigned char * key , * IV ; ALGobject * new = NULL ; int keylen , IVlen = 0 , mode = MODE_ECB , segment_size = 0 ; PyObject * counter = NULL ; int counter_shortcut = 0 ; # ifdef PCT_ARC2_MODULE int effective_keylen = 1024 ; # endif if ( ! PyArg_ParseTupleAndKeywords ( args , kwdict , "s#|is#Oi" # ifdef PCT_ARC2_MODULE "i" # endif , kwlist , & key , & keylen , & mode , & IV , & IVlen , & counter , & segment_size # ifdef PCT_ARC2_MODULE , & effective_keylen # endif ) ) { return NULL ; } if ( mode < MODE_ECB || mode > MODE_CTR ) { PyErr_Format ( PyExc_ValueError , "Unknown<S2SV_blank>cipher<S2SV_blank>feedback<S2SV_blank>mode<S2SV_blank>%i" , mode ) ; return NULL ; } if ( mode == MODE_PGP ) { PyErr_Format ( PyExc_ValueError , "MODE_PGP<S2SV_blank>is<S2SV_blank>not<S2SV_blank>supported<S2SV_blank>anymore" ) ; return NULL ; } if ( KEY_SIZE != 0 && keylen != KEY_SIZE ) { PyErr_Format ( PyExc_ValueError , "Key<S2SV_blank>must<S2SV_blank>be<S2SV_blank>%i<S2SV_blank>bytes<S2SV_blank>long,<S2SV_blank>not<S2SV_blank>%i" , KEY_SIZE , keylen ) ; return NULL ; } if ( KEY_SIZE == 0 && keylen == 0 ) { PyErr_SetString ( PyExc_ValueError , <S2SV_StartBug> "Key<S2SV_blank>cannot<S2SV_blank>be<S2SV_blank>the<S2SV_blank>null<S2SV_blank>string" ) ; <S2SV_EndBug> return NULL ; } if ( IVlen != BLOCK_SIZE && mode != MODE_ECB && mode != MODE_CTR ) { PyErr_Format ( PyExc_ValueError , "IV<S2SV_blank>must<S2SV_blank>be<S2SV_blank>%i<S2SV_blank>bytes<S2SV_blank>long" , BLOCK_SIZE ) ; return NULL ; } if ( mode == MODE_CFB ) { if ( segment_size == 0 ) segment_size = 8 ; if ( segment_size < 1 || segment_size > BLOCK_SIZE * 8 || ( ( segment_size & 7 ) != 0 ) ) { PyErr_Format ( PyExc_ValueError , "segment_size<S2SV_blank>must<S2SV_blank>be<S2SV_blank>multiple<S2SV_blank>of<S2SV_blank>8<S2SV_blank>(bits)<S2SV_blank>" "between<S2SV_blank>1<S2SV_blank>and<S2SV_blank>%i" , BLOCK_SIZE * 8 ) ; return NULL ; } } if ( mode == MODE_CTR ) { if ( counter == NULL ) { PyErr_SetString ( PyExc_TypeError , "\'counter\'<S2SV_blank>keyword<S2SV_blank>parameter<S2SV_blank>is<S2SV_blank>required<S2SV_blank>with<S2SV_blank>CTR<S2SV_blank>mode" ) ; return NULL ; } else if ( Py_TYPE ( counter ) == PCT_CounterBEType || Py_TYPE ( counter ) == PCT_CounterLEType ) { counter_shortcut = 1 ; } else if ( ! PyCallable_Check ( counter ) ) { PyErr_SetString ( PyExc_ValueError , "\'counter\'<S2SV_blank>parameter<S2SV_blank>must<S2SV_blank>be<S2SV_blank>a<S2SV_blank>callable<S2SV_blank>object" ) ; return NULL ; } } else { if ( counter != NULL ) { PyErr_SetString ( PyExc_ValueError , "\'counter\'<S2SV_blank>parameter<S2SV_blank>only<S2SV_blank>useful<S2SV_blank>with<S2SV_blank>CTR<S2SV_blank>mode" ) ; return NULL ; } } # ifdef PCT_ARC2_MODULE if ( effective_keylen < 0 || effective_keylen > 1024 ) { PyErr_Format ( PyExc_ValueError , "RC2:<S2SV_blank>effective_keylen<S2SV_blank>must<S2SV_blank>be<S2SV_blank>between<S2SV_blank>0<S2SV_blank>and<S2SV_blank>1024,<S2SV_blank>not<S2SV_blank>%i" , effective_keylen ) ; return NULL ; } # endif new = newALGobject ( ) ; new -> segment_size = segment_size ; new -> counter = counter ; Py_XINCREF ( counter ) ; new -> counter_shortcut = counter_shortcut ; # ifdef PCT_ARC2_MODULE new -> st . effective_keylen = effective_keylen ; # endif block_init ( & ( new -> st ) , key , keylen ) ; if ( PyErr_Occurred ( ) ) { Py_DECREF ( new ) ; return NULL ; } memset ( new -> IV , 0 , BLOCK_SIZE ) ; memset ( new -> oldCipher , 0 , BLOCK_SIZE ) ; memcpy ( new -> IV , IV , IVlen ) ; new -> mode = mode ; new -> count = BLOCK_SIZE ; return new ; }
| <S2SV_ModStart> PyExc_ValueError , "Key<S2SV_blank>cannot<S2SV_blank>be<S2SV_blank>the<S2SV_blank>null<S2SV_blank>string" ) ; return NULL ; } if ( IVlen != 0 && mode == MODE_ECB ) { PyErr_Format ( PyExc_ValueError , "ECB<S2SV_blank>mode<S2SV_blank>does<S2SV_blank>not<S2SV_blank>use<S2SV_blank>IV" ) ; return NULL ; } if ( IVlen != 0 && mode == MODE_CTR ) { PyErr_Format ( PyExc_ValueError , "CTR<S2SV_blank>mode<S2SV_blank>needs<S2SV_blank>counter<S2SV_blank>parameter,<S2SV_blank>not<S2SV_blank>IV"
| dlitz@pycrypto/8dbe0dc3eea5c689d4f76b37b93fe216cf1f00d4 | CVE-2013-7459 | https://github.com/dlitz/pycrypto/commit/8dbe0dc3eea5c689d4f76b37b93fe216cf1f00d4 | 2017-02-15T15:59Z |
6,759 | CWE-200 | CWE-200 static void make_response ( struct xen_blkif_ring * ring , u64 id , unsigned short op , int st ) { <S2SV_StartBug> struct blkif_response resp ; <S2SV_EndBug> unsigned long flags ; union blkif_back_rings * blk_rings ; int notify ; <S2SV_StartBug> resp . id = id ; <S2SV_EndBug> resp . operation = op ; resp . status = st ; spin_lock_irqsave ( & ring -> blk_ring_lock , flags ) ; blk_rings = & ring -> blk_rings ; switch ( ring -> blkif -> blk_protocol ) { case BLKIF_PROTOCOL_NATIVE : <S2SV_StartBug> memcpy ( RING_GET_RESPONSE ( & blk_rings -> native , blk_rings -> native . rsp_prod_pvt ) , <S2SV_EndBug> & resp , sizeof ( resp ) ) ; break ; case BLKIF_PROTOCOL_X86_32 : <S2SV_StartBug> memcpy ( RING_GET_RESPONSE ( & blk_rings -> x86_32 , blk_rings -> x86_32 . rsp_prod_pvt ) , <S2SV_EndBug> & resp , sizeof ( resp ) ) ; break ; case BLKIF_PROTOCOL_X86_64 : <S2SV_StartBug> memcpy ( RING_GET_RESPONSE ( & blk_rings -> x86_64 , blk_rings -> x86_64 . rsp_prod_pvt ) , <S2SV_EndBug> & resp , sizeof ( resp ) ) ; break ; default : BUG ( ) ; <S2SV_StartBug> } <S2SV_EndBug> blk_rings -> common . rsp_prod_pvt ++ ; RING_PUSH_RESPONSES_AND_CHECK_NOTIFY ( & blk_rings -> common , notify ) ; spin_unlock_irqrestore ( & ring -> blk_ring_lock , flags ) ; if ( notify ) notify_remote_via_irq ( ring -> irq ) ; }
| <S2SV_ModStart> { struct blkif_response * <S2SV_ModStart> int notify ; <S2SV_ModEnd> spin_lock_irqsave ( & <S2SV_ModStart> case BLKIF_PROTOCOL_NATIVE : resp = <S2SV_ModEnd> RING_GET_RESPONSE ( & <S2SV_ModStart> native . rsp_prod_pvt <S2SV_ModEnd> ) ; break <S2SV_ModStart> case BLKIF_PROTOCOL_X86_32 : resp = <S2SV_ModEnd> RING_GET_RESPONSE ( & <S2SV_ModStart> x86_32 . rsp_prod_pvt <S2SV_ModEnd> ) ; break <S2SV_ModStart> case BLKIF_PROTOCOL_X86_64 : resp = <S2SV_ModEnd> RING_GET_RESPONSE ( & <S2SV_ModStart> . rsp_prod_pvt ) <S2SV_ModEnd> ; break ; <S2SV_ModStart> ) ; } resp -> id = id ; resp -> operation = op ; resp -> status = st ;
| torvalds@linux/089bc0143f489bd3a4578bdff5f4ca68fb26f341 | CVE-2017-10911 | https://github.com/torvalds/linux/commit/089bc0143f489bd3a4578bdff5f4ca68fb26f341 | 2017-07-05T01:29Z |
6,760 | CWE-476 | CWE-476 void dump_isom_sdp ( GF_ISOFile * file , char * inName , Bool is_final_name ) { const char * sdp ; u32 size , i ; FILE * dump ; if ( inName ) { char szBuf [ 1024 ] ; strcpy ( szBuf , inName ) ; if ( ! is_final_name ) { char * ext = strchr ( szBuf , '.' ) ; if ( ext ) ext [ 0 ] = 0 ; strcat ( szBuf , "_sdp.txt" ) ; } dump = gf_fopen ( szBuf , "wt" ) ; if ( ! dump ) { fprintf ( stderr , "Failed<S2SV_blank>to<S2SV_blank>open<S2SV_blank>%s<S2SV_blank>for<S2SV_blank>dumping\\n" , szBuf ) ; return ; } } else { dump = stdout ; fprintf ( dump , "*<S2SV_blank>File<S2SV_blank>SDP<S2SV_blank>content<S2SV_blank>*\\n\\n" ) ; } gf_isom_sdp_get ( file , & sdp , & size ) ; <S2SV_StartBug> fprintf ( dump , "%s" , sdp ) ; <S2SV_EndBug> fprintf ( dump , "\\r\\n" ) ; for ( i = 0 ; i < gf_isom_get_track_count ( file ) ; i ++ ) { if ( gf_isom_get_media_type ( file , i + 1 ) != GF_ISOM_MEDIA_HINT ) continue ; gf_isom_sdp_track_get ( file , i + 1 , & sdp , & size ) ; fprintf ( dump , "%s" , sdp ) ; } fprintf ( dump , "\\n\\n" ) ; if ( inName ) gf_fclose ( dump ) ; }
| <S2SV_ModStart> size ) ; if ( sdp && size )
| gpac@gpac/ce01bd15f711d4575b7424b54b3a395ec64c1784 | CVE-2020-23932 | https://github.com/gpac/gpac/commit/ce01bd15f711d4575b7424b54b3a395ec64c1784 | 2021-04-21T18:15Z |
6,761 | CWE-908 | CWE-908 static int kvaser_usb_leaf_flush_queue ( struct kvaser_usb_net_priv * priv ) { struct kvaser_cmd * cmd ; int rc ; <S2SV_StartBug> cmd = kmalloc ( sizeof ( * cmd ) , GFP_KERNEL ) ; <S2SV_EndBug> if ( ! cmd ) return - ENOMEM ; cmd -> id = CMD_FLUSH_QUEUE ; cmd -> len = CMD_HEADER_LEN + sizeof ( struct kvaser_cmd_flush_queue ) ; cmd -> u . flush_queue . channel = priv -> channel ; cmd -> u . flush_queue . flags = 0x00 ; rc = kvaser_usb_send_cmd ( priv -> dev , cmd , cmd -> len ) ; kfree ( cmd ) ; return rc ; }
| <S2SV_ModStart> ; cmd = kzalloc <S2SV_ModEnd> ( sizeof (
| torvalds@linux/da2311a6385c3b499da2ed5d9be59ce331fa93e9 | CVE-2019-19947 | https://github.com/torvalds/linux/commit/da2311a6385c3b499da2ed5d9be59ce331fa93e9 | 2019-12-24T00:15Z |
6,762 | CWE-617 | CWE-617 static int _lldp_send ( struct lldpd * global , struct lldpd_hardware * hardware , u_int8_t c_id_subtype , char * c_id , int c_id_len , u_int8_t p_id_subtype , char * p_id , int p_id_len , int shutdown ) { struct lldpd_port * port ; struct lldpd_chassis * chassis ; struct lldpd_frame * frame ; int length ; u_int8_t * packet , * pos , * tlv ; struct lldpd_mgmt * mgmt ; int proto ; u_int8_t mcastaddr [ ] = LLDP_MULTICAST_ADDR ; # ifdef ENABLE_DOT1 const u_int8_t dot1 [ ] = LLDP_TLV_ORG_DOT1 ; struct lldpd_vlan * vlan ; struct lldpd_ppvid * ppvid ; struct lldpd_pi * pi ; # endif # ifdef ENABLE_DOT3 const u_int8_t dot3 [ ] = LLDP_TLV_ORG_DOT3 ; # endif # ifdef ENABLE_LLDPMED int i ; const u_int8_t med [ ] = LLDP_TLV_ORG_MED ; # endif # ifdef ENABLE_CUSTOM struct lldpd_custom * custom ; # endif port = & hardware -> h_lport ; chassis = port -> p_chassis ; length = hardware -> h_mtu ; if ( ( packet = ( u_int8_t * ) calloc ( 1 , length ) ) == NULL ) return ENOMEM ; pos = packet ; if ( ! ( POKE_BYTES ( mcastaddr , sizeof ( mcastaddr ) ) && POKE_BYTES ( & hardware -> h_lladdr , ETHER_ADDR_LEN ) && POKE_UINT16 ( ETHERTYPE_LLDP ) ) ) goto toobig ; if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_CHASSIS_ID ) && POKE_UINT8 ( c_id_subtype ) && POKE_BYTES ( c_id , c_id_len ) && POKE_END_LLDP_TLV ) ) goto toobig ; if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_PORT_ID ) && POKE_UINT8 ( p_id_subtype ) && POKE_BYTES ( p_id , p_id_len ) && POKE_END_LLDP_TLV ) ) goto toobig ; if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_TTL ) && POKE_UINT16 ( shutdown ? 0 : chassis -> c_ttl ) && POKE_END_LLDP_TLV ) ) goto toobig ; if ( shutdown ) goto end ; if ( chassis -> c_name && * chassis -> c_name != '\\0' ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_SYSTEM_NAME ) && POKE_BYTES ( chassis -> c_name , strlen ( chassis -> c_name ) ) && POKE_END_LLDP_TLV ) ) goto toobig ; } if ( chassis -> c_descr && * chassis -> c_descr != '\\0' ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_SYSTEM_DESCR ) && POKE_BYTES ( chassis -> c_descr , strlen ( chassis -> c_descr ) ) && POKE_END_LLDP_TLV ) ) goto toobig ; } if ( global -> g_config . c_cap_advertise && chassis -> c_cap_available ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_SYSTEM_CAP ) && POKE_UINT16 ( chassis -> c_cap_available ) && POKE_UINT16 ( chassis -> c_cap_enabled ) && POKE_END_LLDP_TLV ) ) goto toobig ; } TAILQ_FOREACH ( mgmt , & chassis -> c_mgmt , m_entries ) { proto = lldpd_af_to_lldp_proto ( mgmt -> m_family ) ; <S2SV_StartBug> assert ( proto != LLDP_MGMT_ADDR_NONE ) ; <S2SV_EndBug> if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_MGMT_ADDR ) && POKE_UINT8 ( mgmt -> m_addrsize + 1 ) && POKE_UINT8 ( proto ) && POKE_BYTES ( & mgmt -> m_addr , mgmt -> m_addrsize ) ) ) goto toobig ; if ( mgmt -> m_iface == 0 ) { if ( ! ( POKE_UINT8 ( LLDP_MGMT_IFACE_UNKNOWN ) && POKE_UINT32 ( 0 ) ) ) goto toobig ; } else { if ( ! ( POKE_UINT8 ( LLDP_MGMT_IFACE_IFINDEX ) && POKE_UINT32 ( mgmt -> m_iface ) ) ) goto toobig ; } if ( ! ( POKE_UINT8 ( 0 ) && POKE_END_LLDP_TLV ) ) goto toobig ; } if ( port -> p_descr && * port -> p_descr != '\\0' ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_PORT_DESCR ) && POKE_BYTES ( port -> p_descr , strlen ( port -> p_descr ) ) && POKE_END_LLDP_TLV ) ) goto toobig ; } # ifdef ENABLE_DOT1 if ( port -> p_pvid != 0 ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( dot1 , sizeof ( dot1 ) ) && POKE_UINT8 ( LLDP_TLV_DOT1_PVID ) && POKE_UINT16 ( port -> p_pvid ) && POKE_END_LLDP_TLV ) ) { goto toobig ; } } TAILQ_FOREACH ( ppvid , & port -> p_ppvids , p_entries ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( dot1 , sizeof ( dot1 ) ) && POKE_UINT8 ( LLDP_TLV_DOT1_PPVID ) && POKE_UINT8 ( ppvid -> p_cap_status ) && POKE_UINT16 ( ppvid -> p_ppvid ) && POKE_END_LLDP_TLV ) ) { goto toobig ; } } TAILQ_FOREACH ( vlan , & port -> p_vlans , v_entries ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( dot1 , sizeof ( dot1 ) ) && POKE_UINT8 ( LLDP_TLV_DOT1_VLANNAME ) && POKE_UINT16 ( vlan -> v_vid ) && POKE_UINT8 ( strlen ( vlan -> v_name ) ) && POKE_BYTES ( vlan -> v_name , strlen ( vlan -> v_name ) ) && POKE_END_LLDP_TLV ) ) goto toobig ; } TAILQ_FOREACH ( pi , & port -> p_pids , p_entries ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( dot1 , sizeof ( dot1 ) ) && POKE_UINT8 ( LLDP_TLV_DOT1_PI ) && POKE_UINT8 ( pi -> p_pi_len ) && POKE_BYTES ( pi -> p_pi , pi -> p_pi_len ) && POKE_END_LLDP_TLV ) ) goto toobig ; } # endif # ifdef ENABLE_DOT3 if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( dot3 , sizeof ( dot3 ) ) && POKE_UINT8 ( LLDP_TLV_DOT3_LA ) && POKE_UINT8 ( ( port -> p_aggregid ) ? 3 : 1 ) && POKE_UINT32 ( port -> p_aggregid ) && POKE_END_LLDP_TLV ) ) goto toobig ; if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( dot3 , sizeof ( dot3 ) ) && POKE_UINT8 ( LLDP_TLV_DOT3_MAC ) && POKE_UINT8 ( port -> p_macphy . autoneg_support | ( port -> p_macphy . autoneg_enabled << 1 ) ) && POKE_UINT16 ( port -> p_macphy . autoneg_advertised ) && POKE_UINT16 ( port -> p_macphy . mau_type ) && POKE_END_LLDP_TLV ) ) goto toobig ; if ( port -> p_mfs ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( dot3 , sizeof ( dot3 ) ) && POKE_UINT8 ( LLDP_TLV_DOT3_MFS ) && POKE_UINT16 ( port -> p_mfs ) && POKE_END_LLDP_TLV ) ) goto toobig ; } if ( port -> p_power . devicetype ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( dot3 , sizeof ( dot3 ) ) && POKE_UINT8 ( LLDP_TLV_DOT3_POWER ) && POKE_UINT8 ( ( ( ( ( 2 - port -> p_power . devicetype ) % ( 1 << 1 ) ) << 0 ) | ( ( port -> p_power . supported % ( 1 << 1 ) ) << 1 ) | ( ( port -> p_power . enabled % ( 1 << 1 ) ) << 2 ) | ( ( port -> p_power . paircontrol % ( 1 << 1 ) ) << 3 ) ) ) && POKE_UINT8 ( port -> p_power . pairs ) && POKE_UINT8 ( port -> p_power . class ) ) ) goto toobig ; if ( port -> p_power . powertype != LLDP_DOT3_POWER_8023AT_OFF ) { if ( ! ( POKE_UINT8 ( ( ( ( ( port -> p_power . powertype == LLDP_DOT3_POWER_8023AT_TYPE1 ) ? 1 : 0 ) << 7 ) | ( ( ( port -> p_power . devicetype == LLDP_DOT3_POWER_PSE ) ? 0 : 1 ) << 6 ) | ( ( port -> p_power . source % ( 1 << 2 ) ) << 4 ) | ( ( port -> p_power . priority % ( 1 << 2 ) ) << 0 ) ) ) && POKE_UINT16 ( port -> p_power . requested ) && POKE_UINT16 ( port -> p_power . allocated ) ) ) goto toobig ; } if ( ! ( POKE_END_LLDP_TLV ) ) goto toobig ; } # endif # ifdef ENABLE_LLDPMED if ( port -> p_med_cap_enabled ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( med , sizeof ( med ) ) && POKE_UINT8 ( LLDP_TLV_MED_CAP ) && POKE_UINT16 ( chassis -> c_med_cap_available ) && POKE_UINT8 ( chassis -> c_med_type ) && POKE_END_LLDP_TLV ) ) goto toobig ; # define LLDP_INVENTORY ( value , subtype ) if ( value ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( med , sizeof ( med ) ) && POKE_UINT8 ( subtype ) && POKE_BYTES ( value , ( strlen ( value ) > 32 ) ? 32 : strlen ( value ) ) && POKE_END_LLDP_TLV ) ) goto toobig ; } if ( port -> p_med_cap_enabled & LLDP_MED_CAP_IV ) { LLDP_INVENTORY ( chassis -> c_med_hw , LLDP_TLV_MED_IV_HW ) ; LLDP_INVENTORY ( chassis -> c_med_fw , LLDP_TLV_MED_IV_FW ) ; LLDP_INVENTORY ( chassis -> c_med_sw , LLDP_TLV_MED_IV_SW ) ; LLDP_INVENTORY ( chassis -> c_med_sn , LLDP_TLV_MED_IV_SN ) ; LLDP_INVENTORY ( chassis -> c_med_manuf , LLDP_TLV_MED_IV_MANUF ) ; LLDP_INVENTORY ( chassis -> c_med_model , LLDP_TLV_MED_IV_MODEL ) ; LLDP_INVENTORY ( chassis -> c_med_asset , LLDP_TLV_MED_IV_ASSET ) ; } for ( i = 0 ; i < LLDP_MED_LOCFORMAT_LAST ; i ++ ) { if ( port -> p_med_location [ i ] . format == i + 1 ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( med , sizeof ( med ) ) && POKE_UINT8 ( LLDP_TLV_MED_LOCATION ) && POKE_UINT8 ( port -> p_med_location [ i ] . format ) && POKE_BYTES ( port -> p_med_location [ i ] . data , port -> p_med_location [ i ] . data_len ) && POKE_END_LLDP_TLV ) ) goto toobig ; } } for ( i = 0 ; i < LLDP_MED_APPTYPE_LAST ; i ++ ) { if ( port -> p_med_policy [ i ] . type == i + 1 ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( med , sizeof ( med ) ) && POKE_UINT8 ( LLDP_TLV_MED_POLICY ) && POKE_UINT32 ( ( ( ( port -> p_med_policy [ i ] . type % ( 1 << 8 ) ) << 24 ) | ( ( port -> p_med_policy [ i ] . unknown % ( 1 << 1 ) ) << 23 ) | ( ( port -> p_med_policy [ i ] . tagged % ( 1 << 1 ) ) << 22 ) | ( ( port -> p_med_policy [ i ] . vid % ( 1 << 12 ) ) << 9 ) | ( ( port -> p_med_policy [ i ] . priority % ( 1 << 3 ) ) << 6 ) | ( ( port -> p_med_policy [ i ] . dscp % ( 1 << 6 ) ) << 0 ) ) ) && POKE_END_LLDP_TLV ) ) goto toobig ; } } if ( ( port -> p_med_power . devicetype == LLDP_MED_POW_TYPE_PSE ) || ( port -> p_med_power . devicetype == LLDP_MED_POW_TYPE_PD ) ) { int devicetype = 0 , source = 0 ; if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( med , sizeof ( med ) ) && POKE_UINT8 ( LLDP_TLV_MED_MDI ) ) ) goto toobig ; switch ( port -> p_med_power . devicetype ) { case LLDP_MED_POW_TYPE_PSE : devicetype = 0 ; switch ( port -> p_med_power . source ) { case LLDP_MED_POW_SOURCE_PRIMARY : source = 1 ; break ; case LLDP_MED_POW_SOURCE_BACKUP : source = 2 ; break ; case LLDP_MED_POW_SOURCE_RESERVED : source = 3 ; break ; default : source = 0 ; break ; } break ; case LLDP_MED_POW_TYPE_PD : devicetype = 1 ; switch ( port -> p_med_power . source ) { case LLDP_MED_POW_SOURCE_PSE : source = 1 ; break ; case LLDP_MED_POW_SOURCE_LOCAL : source = 2 ; break ; case LLDP_MED_POW_SOURCE_BOTH : source = 3 ; break ; default : source = 0 ; break ; } break ; } if ( ! ( POKE_UINT8 ( ( ( ( devicetype % ( 1 << 2 ) ) << 6 ) | ( ( source % ( 1 << 2 ) ) << 4 ) | ( ( port -> p_med_power . priority % ( 1 << 4 ) ) << 0 ) ) ) && POKE_UINT16 ( port -> p_med_power . val ) && POKE_END_LLDP_TLV ) ) goto toobig ; } } # endif # ifdef ENABLE_CUSTOM TAILQ_FOREACH ( custom , & port -> p_custom_list , next ) { if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_ORG ) && POKE_BYTES ( custom -> oui , sizeof ( custom -> oui ) ) && POKE_UINT8 ( custom -> subtype ) && POKE_BYTES ( custom -> oui_info , custom -> oui_info_len ) && POKE_END_LLDP_TLV ) ) goto toobig ; } # endif end : if ( ! ( POKE_START_LLDP_TLV ( LLDP_TLV_END ) && POKE_END_LLDP_TLV ) ) goto toobig ; if ( interfaces_send_helper ( global , hardware , ( char * ) packet , pos - packet ) == - 1 ) { log_warn ( "lldp" , "unable<S2SV_blank>to<S2SV_blank>send<S2SV_blank>packet<S2SV_blank>on<S2SV_blank>real<S2SV_blank>device<S2SV_blank>for<S2SV_blank>%s" , hardware -> h_ifname ) ; free ( packet ) ; return ENETDOWN ; } hardware -> h_tx_cnt ++ ; if ( ! shutdown && ( frame = ( struct lldpd_frame * ) malloc ( sizeof ( int ) + pos - packet ) ) != NULL ) { frame -> size = pos - packet ; memcpy ( & frame -> frame , packet , frame -> size ) ; if ( ( hardware -> h_lport . p_lastframe == NULL ) || ( hardware -> h_lport . p_lastframe -> size != frame -> size ) || ( memcmp ( hardware -> h_lport . p_lastframe -> frame , frame -> frame , frame -> size ) != 0 ) ) { free ( hardware -> h_lport . p_lastframe ) ; hardware -> h_lport . p_lastframe = frame ; hardware -> h_lport . p_lastchange = time ( NULL ) ; } else free ( frame ) ; } free ( packet ) ; return 0 ; toobig : free ( packet ) ; return E2BIG ; }
| <S2SV_ModStart> m_family ) ; if ( proto == LLDP_MGMT_ADDR_NONE ) continue <S2SV_ModEnd> ; if (
| vincentbernat@lldpd/9221b5c249f9e4843f77c7f888d5705348d179c0 | CVE-2015-8012 | https://github.com/vincentbernat/lldpd/commit/9221b5c249f9e4843f77c7f888d5705348d179c0 | 2020-01-28T19:15Z |
6,763 | CWE-200 | CWE-200 unsigned paravirt_patch_call ( void * insnbuf , const void * target , u16 tgt_clobbers , unsigned long addr , u16 site_clobbers , unsigned len ) { struct branch * b = insnbuf ; unsigned long delta = ( unsigned long ) target - ( addr + 5 ) ; <S2SV_StartBug> if ( tgt_clobbers & ~ site_clobbers ) <S2SV_EndBug> return len ; <S2SV_StartBug> if ( len < 5 ) <S2SV_EndBug> return len ; b -> opcode = 0xe8 ; b -> delta = delta ; BUILD_BUG_ON ( sizeof ( * b ) != 5 ) ; return 5 ; }
| <S2SV_ModStart> ; if ( len < 5 ) { # ifdef CONFIG_RETPOLINE WARN_ONCE ( "Failing<S2SV_blank>to<S2SV_blank>patch<S2SV_blank>indirect<S2SV_blank>CALL<S2SV_blank>in<S2SV_blank>%ps\\n" , ( void * ) addr ) ; # endif <S2SV_ModEnd> return len ; <S2SV_ModStart> return len ; } <S2SV_ModEnd> b -> opcode
| torvalds@linux/5800dc5c19f34e6e03b5adab1282535cb102fafd | CVE-2018-15594 | https://github.com/torvalds/linux/commit/5800dc5c19f34e6e03b5adab1282535cb102fafd | 2018-08-20T08:29Z |
6,764 | CWE-400 | CWE-400 static struct task_struct * copy_process ( unsigned long clone_flags , unsigned long stack_start , struct pt_regs * regs , unsigned long stack_size , int __user * child_tidptr , struct pid * pid , int trace ) { int retval ; struct task_struct * p ; int cgroup_callbacks_done = 0 ; if ( ( clone_flags & ( CLONE_NEWNS | CLONE_FS ) ) == ( CLONE_NEWNS | CLONE_FS ) ) return ERR_PTR ( - EINVAL ) ; if ( ( clone_flags & CLONE_THREAD ) && ! ( clone_flags & CLONE_SIGHAND ) ) return ERR_PTR ( - EINVAL ) ; if ( ( clone_flags & CLONE_SIGHAND ) && ! ( clone_flags & CLONE_VM ) ) return ERR_PTR ( - EINVAL ) ; if ( ( clone_flags & CLONE_PARENT ) && current -> signal -> flags & SIGNAL_UNKILLABLE ) return ERR_PTR ( - EINVAL ) ; retval = security_task_create ( clone_flags ) ; if ( retval ) goto fork_out ; retval = - ENOMEM ; p = dup_task_struct ( current ) ; if ( ! p ) goto fork_out ; ftrace_graph_init_task ( p ) ; rt_mutex_init_task ( p ) ; # ifdef CONFIG_PROVE_LOCKING DEBUG_LOCKS_WARN_ON ( ! p -> hardirqs_enabled ) ; DEBUG_LOCKS_WARN_ON ( ! p -> softirqs_enabled ) ; # endif retval = - EAGAIN ; if ( atomic_read ( & p -> real_cred -> user -> processes ) >= p -> signal -> rlim [ RLIMIT_NPROC ] . rlim_cur ) { if ( ! capable ( CAP_SYS_ADMIN ) && ! capable ( CAP_SYS_RESOURCE ) && p -> real_cred -> user != INIT_USER ) goto bad_fork_free ; } retval = copy_creds ( p , clone_flags ) ; if ( retval < 0 ) goto bad_fork_free ; retval = - EAGAIN ; if ( nr_threads >= max_threads ) goto bad_fork_cleanup_count ; if ( ! try_module_get ( task_thread_info ( p ) -> exec_domain -> module ) ) goto bad_fork_cleanup_count ; p -> did_exec = 0 ; delayacct_tsk_init ( p ) ; copy_flags ( clone_flags , p ) ; INIT_LIST_HEAD ( & p -> children ) ; INIT_LIST_HEAD ( & p -> sibling ) ; rcu_copy_process ( p ) ; p -> vfork_done = NULL ; spin_lock_init ( & p -> alloc_lock ) ; init_sigpending ( & p -> pending ) ; p -> utime = cputime_zero ; p -> stime = cputime_zero ; p -> gtime = cputime_zero ; p -> utimescaled = cputime_zero ; p -> stimescaled = cputime_zero ; p -> prev_utime = cputime_zero ; p -> prev_stime = cputime_zero ; p -> default_timer_slack_ns = current -> timer_slack_ns ; task_io_accounting_init ( & p -> ioac ) ; acct_clear_integrals ( p ) ; posix_cpu_timers_init ( p ) ; p -> lock_depth = - 1 ; do_posix_clock_monotonic_gettime ( & p -> start_time ) ; p -> real_start_time = p -> start_time ; monotonic_to_bootbased ( & p -> real_start_time ) ; p -> io_context = NULL ; p -> audit_context = NULL ; cgroup_fork ( p ) ; # ifdef CONFIG_NUMA p -> mempolicy = mpol_dup ( p -> mempolicy ) ; if ( IS_ERR ( p -> mempolicy ) ) { retval = PTR_ERR ( p -> mempolicy ) ; p -> mempolicy = NULL ; goto bad_fork_cleanup_cgroup ; } mpol_fix_fork_child_flag ( p ) ; # endif # ifdef CONFIG_TRACE_IRQFLAGS p -> irq_events = 0 ; # ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW p -> hardirqs_enabled = 1 ; # else p -> hardirqs_enabled = 0 ; # endif p -> hardirq_enable_ip = 0 ; p -> hardirq_enable_event = 0 ; p -> hardirq_disable_ip = _THIS_IP_ ; p -> hardirq_disable_event = 0 ; p -> softirqs_enabled = 1 ; p -> softirq_enable_ip = _THIS_IP_ ; p -> softirq_enable_event = 0 ; p -> softirq_disable_ip = 0 ; p -> softirq_disable_event = 0 ; p -> hardirq_context = 0 ; p -> softirq_context = 0 ; # endif # ifdef CONFIG_LOCKDEP p -> lockdep_depth = 0 ; p -> curr_chain_key = 0 ; p -> lockdep_recursion = 0 ; # endif # ifdef CONFIG_DEBUG_MUTEXES p -> blocked_on = NULL ; # endif p -> bts = NULL ; p -> stack_start = stack_start ; sched_fork ( p , clone_flags ) ; retval = perf_event_init_task ( p ) ; if ( retval ) goto bad_fork_cleanup_policy ; if ( ( retval = audit_alloc ( p ) ) ) goto bad_fork_cleanup_policy ; if ( ( retval = copy_semundo ( clone_flags , p ) ) ) goto bad_fork_cleanup_audit ; if ( ( retval = copy_files ( clone_flags , p ) ) ) goto bad_fork_cleanup_semundo ; if ( ( retval = copy_fs ( clone_flags , p ) ) ) goto bad_fork_cleanup_files ; if ( ( retval = copy_sighand ( clone_flags , p ) ) ) goto bad_fork_cleanup_fs ; if ( ( retval = copy_signal ( clone_flags , p ) ) ) goto bad_fork_cleanup_sighand ; if ( ( retval = copy_mm ( clone_flags , p ) ) ) goto bad_fork_cleanup_signal ; if ( ( retval = copy_namespaces ( clone_flags , p ) ) ) goto bad_fork_cleanup_mm ; if ( ( retval = copy_io ( clone_flags , p ) ) ) goto bad_fork_cleanup_namespaces ; retval = copy_thread ( clone_flags , stack_start , stack_size , p , regs ) ; if ( retval ) goto bad_fork_cleanup_io ; if ( pid != & init_struct_pid ) { retval = - ENOMEM ; pid = alloc_pid ( p -> nsproxy -> pid_ns ) ; if ( ! pid ) goto bad_fork_cleanup_io ; if ( clone_flags & CLONE_NEWPID ) { retval = pid_ns_prepare_proc ( p -> nsproxy -> pid_ns ) ; if ( retval < 0 ) goto bad_fork_free_pid ; } } p -> pid = pid_nr ( pid ) ; p -> tgid = p -> pid ; if ( clone_flags & CLONE_THREAD ) p -> tgid = current -> tgid ; if ( current -> nsproxy != p -> nsproxy ) { retval = ns_cgroup_clone ( p , pid ) ; if ( retval ) goto bad_fork_free_pid ; } p -> set_child_tid = ( clone_flags & CLONE_CHILD_SETTID ) ? child_tidptr : NULL ; p -> clear_child_tid = ( clone_flags & CLONE_CHILD_CLEARTID ) ? child_tidptr : NULL ; # ifdef CONFIG_FUTEX p -> robust_list = NULL ; # ifdef CONFIG_COMPAT p -> compat_robust_list = NULL ; # endif INIT_LIST_HEAD ( & p -> pi_state_list ) ; p -> pi_state_cache = NULL ; # endif if ( ( clone_flags & ( CLONE_VM | CLONE_VFORK ) ) == CLONE_VM ) p -> sas_ss_sp = p -> sas_ss_size = 0 ; clear_tsk_thread_flag ( p , TIF_SYSCALL_TRACE ) ; # ifdef TIF_SYSCALL_EMU clear_tsk_thread_flag ( p , TIF_SYSCALL_EMU ) ; # endif clear_all_latency_tracing ( p ) ; p -> exit_signal = ( clone_flags & CLONE_THREAD ) ? - 1 : ( clone_flags & CSIGNAL ) ; p -> pdeath_signal = 0 ; p -> exit_state = 0 ; p -> group_leader = p ; INIT_LIST_HEAD ( & p -> thread_group ) ; cgroup_fork_callbacks ( p ) ; cgroup_callbacks_done = 1 ; write_lock_irq ( & tasklist_lock ) ; p -> cpus_allowed = current -> cpus_allowed ; p -> rt . nr_cpus_allowed = current -> rt . nr_cpus_allowed ; if ( unlikely ( ! cpu_isset ( task_cpu ( p ) , p -> cpus_allowed ) || ! cpu_online ( task_cpu ( p ) ) ) ) set_task_cpu ( p , smp_processor_id ( ) ) ; if ( clone_flags & ( CLONE_PARENT | CLONE_THREAD ) ) { p -> real_parent = current -> real_parent ; p -> parent_exec_id = current -> parent_exec_id ; } else { p -> real_parent = current ; p -> parent_exec_id = current -> self_exec_id ; } spin_lock ( & current -> sighand -> siglock ) ; recalc_sigpending ( ) ; if ( signal_pending ( current ) ) { spin_unlock ( & current -> sighand -> siglock ) ; write_unlock_irq ( & tasklist_lock ) ; retval = - ERESTARTNOINTR ; goto bad_fork_free_pid ; } if ( clone_flags & CLONE_THREAD ) { atomic_inc ( & current -> signal -> count ) ; atomic_inc ( & current -> signal -> live ) ; p -> group_leader = current -> group_leader ; list_add_tail_rcu ( & p -> thread_group , & p -> group_leader -> thread_group ) ; } if ( likely ( p -> pid ) ) { list_add_tail ( & p -> sibling , & p -> real_parent -> children ) ; tracehook_finish_clone ( p , clone_flags , trace ) ; if ( thread_group_leader ( p ) ) { if ( clone_flags & CLONE_NEWPID ) p -> nsproxy -> pid_ns -> child_reaper = p ; p -> signal -> leader_pid = pid ; tty_kref_put ( p -> signal -> tty ) ; p -> signal -> tty = tty_kref_get ( current -> signal -> tty ) ; attach_pid ( p , PIDTYPE_PGID , task_pgrp ( current ) ) ; attach_pid ( p , PIDTYPE_SID , task_session ( current ) ) ; list_add_tail_rcu ( & p -> tasks , & init_task . tasks ) ; __get_cpu_var ( process_counts ) ++ ; } attach_pid ( p , PIDTYPE_PID , pid ) ; nr_threads ++ ; } total_forks ++ ; spin_unlock ( & current -> sighand -> siglock ) ; write_unlock_irq ( & tasklist_lock ) ; proc_fork_connector ( p ) ; cgroup_post_fork ( p ) ; perf_event_fork ( p ) ; return p ; bad_fork_free_pid : if ( pid != & init_struct_pid ) free_pid ( pid ) ; bad_fork_cleanup_io : <S2SV_StartBug> put_io_context ( p -> io_context ) ; <S2SV_EndBug> bad_fork_cleanup_namespaces : exit_task_namespaces ( p ) ; bad_fork_cleanup_mm : if ( p -> mm ) mmput ( p -> mm ) ; bad_fork_cleanup_signal : if ( ! ( clone_flags & CLONE_THREAD ) ) __cleanup_signal ( p -> signal ) ; bad_fork_cleanup_sighand : __cleanup_sighand ( p -> sighand ) ; bad_fork_cleanup_fs : exit_fs ( p ) ; bad_fork_cleanup_files : exit_files ( p ) ; bad_fork_cleanup_semundo : exit_sem ( p ) ; bad_fork_cleanup_audit : audit_free ( p ) ; bad_fork_cleanup_policy : perf_event_free_task ( p ) ; # ifdef CONFIG_NUMA mpol_put ( p -> mempolicy ) ; bad_fork_cleanup_cgroup : # endif cgroup_exit ( p , cgroup_callbacks_done ) ; delayacct_tsk_free ( p ) ; module_put ( task_thread_info ( p ) -> exec_domain -> module ) ; bad_fork_cleanup_count : atomic_dec ( & p -> cred -> user -> processes ) ; exit_creds ( p ) ; bad_fork_free : free_task ( p ) ; fork_out : return ERR_PTR ( retval ) ; }
| <S2SV_ModStart> ; bad_fork_cleanup_io : if <S2SV_ModEnd> ( p -> <S2SV_ModStart> p -> io_context ) exit_io_context ( p
| torvalds@linux/b69f2292063d2caf37ca9aec7d63ded203701bf3 | CVE-2012-0879 | https://github.com/torvalds/linux/commit/b69f2292063d2caf37ca9aec7d63ded203701bf3 | 2012-05-17T11:00Z |
6,765 | CWE-119 | CWE-119 static int decode_dds1 ( GetByteContext * gb , uint8_t * frame , int width , int height ) { const uint8_t * frame_start = frame ; const uint8_t * frame_end = frame + width * height ; int mask = 0x10000 , bitbuf = 0 ; int i , v , offset , count , segments ; segments = bytestream2_get_le16 ( gb ) ; while ( segments -- ) { if ( bytestream2_get_bytes_left ( gb ) < 2 ) return AVERROR_INVALIDDATA ; if ( mask == 0x10000 ) { bitbuf = bytestream2_get_le16u ( gb ) ; mask = 1 ; } if ( bitbuf & mask ) { v = bytestream2_get_le16 ( gb ) ; offset = ( v & 0x1FFF ) << 2 ; count = ( ( v >> 13 ) + 2 ) << 1 ; if ( frame - frame_start < offset || frame_end - frame < count * 2 + width ) return AVERROR_INVALIDDATA ; for ( i = 0 ; i < count ; i ++ ) { frame [ 0 ] = frame [ 1 ] = frame [ width ] = frame [ width + 1 ] = frame [ - offset ] ; frame += 2 ; } } else if ( bitbuf & ( mask << 1 ) ) { v = bytestream2_get_le16 ( gb ) * 2 ; if ( frame - frame_end < v ) return AVERROR_INVALIDDATA ; frame += v ; } else { <S2SV_StartBug> if ( frame_end - frame < width + 3 ) <S2SV_EndBug> return AVERROR_INVALIDDATA ; frame [ 0 ] = frame [ 1 ] = frame [ width ] = frame [ width + 1 ] = bytestream2_get_byte ( gb ) ; frame += 2 ; frame [ 0 ] = frame [ 1 ] = frame [ width ] = frame [ width + 1 ] = bytestream2_get_byte ( gb ) ; frame += 2 ; } mask <<= 2 ; } return 0 ; }
| <S2SV_ModStart> < width + 4 <S2SV_ModEnd> ) return AVERROR_INVALIDDATA
| FFmpeg@FFmpeg/f52fbf4f3ed02a7d872d8a102006f29b4421f360 | CVE-2017-9992 | https://github.com/FFmpeg/FFmpeg/commit/f52fbf4f3ed02a7d872d8a102006f29b4421f360 | 2017-06-28T06:29Z |
6,766 | CWE-264 | CWE-264 int _mkp_stage_30 ( struct plugin * p , struct client_session * cs , struct session_request * sr ) { mk_ptr_t referer ; ( void ) p ; ( void ) cs ; PLUGIN_TRACE ( "[FD<S2SV_blank>%i]<S2SV_blank>Mandril<S2SV_blank>validating<S2SV_blank>URL" , cs -> socket ) ; <S2SV_StartBug> if ( mk_security_check_url ( sr -> uri ) < 0 ) { <S2SV_EndBug> PLUGIN_TRACE ( "[FD<S2SV_blank>%i]<S2SV_blank>Close<S2SV_blank>connection,<S2SV_blank>blocked<S2SV_blank>URL" , cs -> socket ) ; mk_api -> header_set_http_status ( sr , MK_CLIENT_FORBIDDEN ) ; return MK_PLUGIN_RET_CLOSE_CONX ; } PLUGIN_TRACE ( "[FD<S2SV_blank>%d]<S2SV_blank>Mandril<S2SV_blank>validating<S2SV_blank>hotlinking" , cs -> socket ) ; referer = mk_api -> header_get ( & sr -> headers_toc , "Referer" , strlen ( "Referer" ) ) ; if ( mk_security_check_hotlink ( sr -> uri_processed , sr -> host , referer ) < 0 ) { PLUGIN_TRACE ( "[FD<S2SV_blank>%i]<S2SV_blank>Close<S2SV_blank>connection,<S2SV_blank>deny<S2SV_blank>hotlinking." , cs -> socket ) ; mk_api -> header_set_http_status ( sr , MK_CLIENT_FORBIDDEN ) ; return MK_PLUGIN_RET_CLOSE_CONX ; } return MK_PLUGIN_RET_NOT_ME ; }
| <S2SV_ModStart> ( sr -> uri_processed <S2SV_ModEnd> ) < 0
| monkey@monkey/15f72c1ee5e0afad20232bdf0fcecab8d62a5d89 | CVE-2013-2182 | https://github.com/monkey/monkey/commit/15f72c1ee5e0afad20232bdf0fcecab8d62a5d89 | 2014-06-13T14:55Z |
6,767 | CWE-369 | CWE-369 void * _TIFFmalloc ( tmsize_t s ) <S2SV_StartBug> { <S2SV_EndBug> return ( malloc ( ( size_t ) s ) ) ; }
| <S2SV_ModStart> s ) { if ( s == 0 ) return ( ( void * ) NULL ) ;
| vadz@libtiff/3c5eb8b1be544e41d2c336191bc4936300ad7543 | CVE-2014-8130 | https://github.com/vadz/libtiff/commit/3c5eb8b1be544e41d2c336191bc4936300ad7543 | 2018-03-12T02:29Z |
6,768 | CWE-125 | CWE-125 <S2SV_StartBug> static void read_quant_matrix_ext ( MpegEncContext * s , GetBitContext * gb ) <S2SV_EndBug> { int i , j , v ; <S2SV_StartBug> if ( get_bits1 ( gb ) ) { <S2SV_EndBug> for ( i = 0 ; i < 64 ; i ++ ) { v = get_bits ( gb , 8 ) ; j = s -> idsp . idct_permutation [ ff_zigzag_direct [ i ] ] ; s -> intra_matrix [ j ] = v ; s -> chroma_intra_matrix [ j ] = v ; } } if ( get_bits1 ( gb ) ) { <S2SV_StartBug> for ( i = 0 ; i < 64 ; i ++ ) { <S2SV_EndBug> get_bits ( gb , 8 ) ; } } <S2SV_StartBug> if ( get_bits1 ( gb ) ) { <S2SV_EndBug> for ( i = 0 ; i < 64 ; i ++ ) { v = get_bits ( gb , 8 ) ; j = s -> idsp . idct_permutation [ ff_zigzag_direct [ i ] ] ; s -> chroma_intra_matrix [ j ] = v ; } } if ( get_bits1 ( gb ) ) { <S2SV_StartBug> for ( i = 0 ; i < 64 ; i ++ ) { <S2SV_EndBug> get_bits ( gb , 8 ) ; } } next_start_code_studio ( gb ) ; <S2SV_StartBug> } <S2SV_EndBug>
| <S2SV_ModStart> <S2SV_null> <S2SV_null> static int <S2SV_ModEnd> read_quant_matrix_ext ( MpegEncContext <S2SV_ModStart> ) ) { if ( get_bits_left ( gb ) < 64 * 8 ) return AVERROR_INVALIDDATA ; <S2SV_ModStart> ) ) { if ( get_bits_left ( gb ) < 64 * 8 ) return AVERROR_INVALIDDATA ; <S2SV_ModStart> ) ) { if ( get_bits_left ( gb ) < 64 * 8 ) return AVERROR_INVALIDDATA ; <S2SV_ModStart> ) ) { if ( get_bits_left ( gb ) < 64 * 8 ) return AVERROR_INVALIDDATA ; <S2SV_ModStart> gb ) ; return 0 ;
| FFmpeg@FFmpeg/5aba5b89d0b1d73164d3b81764828bb8b20ff32a | CVE-2018-1999015 | https://github.com/FFmpeg/FFmpeg/commit/5aba5b89d0b1d73164d3b81764828bb8b20ff32a | 2018-07-23T15:29Z |
6,769 | CWE-200 | CWE-200 static int l2tp_ip6_getname ( struct socket * sock , struct sockaddr * uaddr , int * uaddr_len , int peer ) { struct sockaddr_l2tpip6 * lsa = ( struct sockaddr_l2tpip6 * ) uaddr ; struct sock * sk = sock -> sk ; struct ipv6_pinfo * np = inet6_sk ( sk ) ; struct l2tp_ip6_sock * lsk = l2tp_ip6_sk ( sk ) ; lsa -> l2tp_family = AF_INET6 ; lsa -> l2tp_flowinfo = 0 ; lsa -> l2tp_scope_id = 0 ; <S2SV_StartBug> if ( peer ) { <S2SV_EndBug> if ( ! lsk -> peer_conn_id ) return - ENOTCONN ; lsa -> l2tp_conn_id = lsk -> peer_conn_id ; lsa -> l2tp_addr = np -> daddr ; if ( np -> sndflow ) lsa -> l2tp_flowinfo = np -> flow_label ; } else { if ( ipv6_addr_any ( & np -> rcv_saddr ) ) lsa -> l2tp_addr = np -> saddr ; else lsa -> l2tp_addr = np -> rcv_saddr ; lsa -> l2tp_conn_id = lsk -> conn_id ; } if ( ipv6_addr_type ( & lsa -> l2tp_addr ) & IPV6_ADDR_LINKLOCAL ) lsa -> l2tp_scope_id = sk -> sk_bound_dev_if ; * uaddr_len = sizeof ( * lsa ) ; return 0 ; }
| <S2SV_ModStart> = 0 ; lsa -> l2tp_unused = 0 ;
| torvalds@linux/04d4fbca1017c11381e7d82acea21dd741e748bc | CVE-2012-6543 | https://github.com/torvalds/linux/commit/04d4fbca1017c11381e7d82acea21dd741e748bc | 2013-03-15T20:55Z |
6,770 | CWE-119 | CWE-119 int phar_parse_zipfile ( php_stream * fp , char * fname , int fname_len , char * alias , int alias_len , phar_archive_data * * pphar , char * * error ) { phar_zip_dir_end locator ; char buf [ sizeof ( locator ) + 65536 ] ; zend_long size ; php_uint16 i ; phar_archive_data * mydata = NULL ; phar_entry_info entry = { 0 } ; char * p = buf , * ext , * actual_alias = NULL ; char * metadata = NULL ; size = php_stream_tell ( fp ) ; if ( size > sizeof ( locator ) + 65536 ) { size = sizeof ( locator ) + 65536 ; if ( FAILURE == php_stream_seek ( fp , - size , SEEK_END ) ) { php_stream_close ( fp ) ; if ( error ) { spprintf ( error , 4096 , "phar<S2SV_blank>error:<S2SV_blank>unable<S2SV_blank>to<S2SV_blank>search<S2SV_blank>for<S2SV_blank>end<S2SV_blank>of<S2SV_blank>central<S2SV_blank>directory<S2SV_blank>in<S2SV_blank>zip-based<S2SV_blank>phar<S2SV_blank>\\"%s\\"" , fname ) ; } return FAILURE ; } } else { php_stream_seek ( fp , 0 , SEEK_SET ) ; } if ( ! php_stream_read ( fp , buf , size ) ) { php_stream_close ( fp ) ; if ( error ) { spprintf ( error , 4096 , "phar<S2SV_blank>error:<S2SV_blank>unable<S2SV_blank>to<S2SV_blank>read<S2SV_blank>in<S2SV_blank>data<S2SV_blank>to<S2SV_blank>search<S2SV_blank>for<S2SV_blank>end<S2SV_blank>of<S2SV_blank>central<S2SV_blank>directory<S2SV_blank>in<S2SV_blank>zip-based<S2SV_blank>phar<S2SV_blank>\\"%s\\"" , fname ) ; } return FAILURE ; } while ( ( p = ( char * ) memchr ( p + 1 , 'P' , ( size_t ) ( size - ( p + 1 - buf ) ) ) ) != NULL ) { if ( ( p - buf ) + sizeof ( locator ) <= size && ! memcmp ( p + 1 , "K\\5\\6" , 3 ) ) { memcpy ( ( void * ) & locator , ( void * ) p , sizeof ( locator ) ) ; if ( PHAR_GET_16 ( locator . centraldisk ) != 0 || PHAR_GET_16 ( locator . disknumber ) != 0 ) { php_stream_close ( fp ) ; if ( error ) { spprintf ( error , 4096 , "phar<S2SV_blank>error:<S2SV_blank>split<S2SV_blank>archives<S2SV_blank>spanning<S2SV_blank>multiple<S2SV_blank>zips<S2SV_blank>cannot<S2SV_blank>be<S2SV_blank>processed<S2SV_blank>in<S2SV_blank>zip-based<S2SV_blank>phar<S2SV_blank>\\"%s\\"" , fname ) ; } return FAILURE ; } if ( PHAR_GET_16 ( locator . counthere ) != PHAR_GET_16 ( locator . count ) ) { if ( error ) { spprintf ( error , 4096 , "phar<S2SV_blank>error:<S2SV_blank>corrupt<S2SV_blank>zip<S2SV_blank>archive,<S2SV_blank>conflicting<S2SV_blank>file<S2SV_blank>count<S2SV_blank>in<S2SV_blank>end<S2SV_blank>of<S2SV_blank>central<S2SV_blank>directory<S2SV_blank>record<S2SV_blank>in<S2SV_blank>zip-based<S2SV_blank>phar<S2SV_blank>\\"%s\\"" , fname ) ; } php_stream_close ( fp ) ; return FAILURE ; } mydata = pecalloc ( 1 , sizeof ( phar_archive_data ) , PHAR_G ( persist ) ) ; mydata -> is_persistent = PHAR_G ( persist ) ; if ( PHAR_GET_16 ( locator . comment_len ) ) { metadata = p + sizeof ( locator ) ; if ( PHAR_GET_16 ( locator . comment_len ) != size - ( metadata - buf ) ) { if ( error ) { spprintf ( error , 4096 , "phar<S2SV_blank>error:<S2SV_blank>corrupt<S2SV_blank>zip<S2SV_blank>archive,<S2SV_blank>zip<S2SV_blank>file<S2SV_blank>comment<S2SV_blank>truncated<S2SV_blank>in<S2SV_blank>zip-based<S2SV_blank>phar<S2SV_blank>\\"%s\\"" , fname ) ; } php_stream_close ( fp ) ; pefree ( mydata , mydata -> is_persistent ) ; return FAILURE ; } mydata -> metadata_len = PHAR_GET_16 ( locator . comment_len ) ; if ( phar_parse_metadata ( & metadata , & mydata -> metadata , PHAR_GET_16 ( locator . comment_len ) ) == FAILURE ) { mydata -> metadata_len = 0 ; ZVAL_NEW_STR ( & mydata -> metadata , zend_string_init ( metadata , PHAR_GET_16 ( locator . comment_len ) , mydata -> is_persistent ) ) ; } } else { ZVAL_UNDEF ( & mydata -> metadata ) ; } goto foundit ; } } php_stream_close ( fp ) ; if ( error ) { spprintf ( error , 4096 , "phar<S2SV_blank>error:<S2SV_blank>end<S2SV_blank>of<S2SV_blank>central<S2SV_blank>directory<S2SV_blank>not<S2SV_blank>found<S2SV_blank>in<S2SV_blank>zip-based<S2SV_blank>phar<S2SV_blank>\\"%s\\"" , fname ) ; } return FAILURE ; foundit : mydata -> fname = pestrndup ( fname , fname_len , mydata -> is_persistent ) ; # ifdef PHP_WIN32 phar_unixify_path_separators ( mydata -> fname , fname_len ) ; # endif mydata -> is_zip = 1 ; mydata -> fname_len = fname_len ; ext = strrchr ( mydata -> fname , '/' ) ; if ( ext ) { mydata -> ext = memchr ( ext , '.' , ( mydata -> fname + fname_len ) - ext ) ; if ( mydata -> ext == ext ) { mydata -> ext = memchr ( ext + 1 , '.' , ( mydata -> fname + fname_len ) - ext - 1 ) ; } if ( mydata -> ext ) { mydata -> ext_len = ( mydata -> fname + fname_len ) - mydata -> ext ; } } php_stream_seek ( fp , PHAR_GET_32 ( locator . cdir_offset ) , SEEK_SET ) ; zend_hash_init ( & mydata -> manifest , PHAR_GET_16 ( locator . count ) , zend_get_hash_value , destroy_phar_manifest_entry , ( zend_bool ) mydata -> is_persistent ) ; zend_hash_init ( & mydata -> mounted_dirs , 5 , zend_get_hash_value , NULL , ( zend_bool ) mydata -> is_persistent ) ; zend_hash_init ( & mydata -> virtual_dirs , PHAR_GET_16 ( locator . count ) * 2 , zend_get_hash_value , NULL , ( zend_bool ) mydata -> is_persistent ) ; entry . phar = mydata ; entry . is_zip = 1 ; entry . fp_type = PHAR_FP ; entry . is_persistent = mydata -> is_persistent ; # define PHAR_ZIP_FAIL_FREE ( errmsg , save ) zend_hash_destroy ( & mydata -> manifest ) ; mydata -> manifest . u . flags = 0 ; zend_hash_destroy ( & mydata -> mounted_dirs ) ; mydata -> mounted_dirs . u . flags = 0 ; zend_hash_destroy ( & mydata -> virtual_dirs ) ; mydata -> virtual_dirs . u . flags = 0 ; php_stream_close ( fp ) ; zval_dtor ( & mydata -> metadata ) ; if ( mydata -> signature ) { efree ( mydata -> signature ) ; } if ( error ) { spprintf ( error , 4096 , "phar<S2SV_blank>error:<S2SV_blank>%s<S2SV_blank>in<S2SV_blank>zip-based<S2SV_blank>phar<S2SV_blank>\\"%s\\"" , errmsg , mydata -> fname ) ; } pefree ( mydata -> fname , mydata -> is_persistent ) ; if ( mydata -> alias ) { pefree ( mydata -> alias , mydata -> is_persistent ) ; } pefree ( mydata , mydata -> is_persistent ) ; efree ( save ) ; return FAILURE ; # define PHAR_ZIP_FAIL ( errmsg ) zend_hash_destroy ( & mydata -> manifest ) ; mydata -> manifest . u . flags = 0 ; zend_hash_destroy ( & mydata -> mounted_dirs ) ; mydata -> mounted_dirs . u . flags = 0 ; zend_hash_destroy ( & mydata -> virtual_dirs ) ; mydata -> virtual_dirs . u . flags = 0 ; php_stream_close ( fp ) ; zval_dtor ( & mydata -> metadata ) ; if ( mydata -> signature ) { efree ( mydata -> signature ) ; } if ( error ) { spprintf ( error , 4096 , "phar<S2SV_blank>error:<S2SV_blank>%s<S2SV_blank>in<S2SV_blank>zip-based<S2SV_blank>phar<S2SV_blank>\\"%s\\"" , errmsg , mydata -> fname ) ; } pefree ( mydata -> fname , mydata -> is_persistent ) ; if ( mydata -> alias ) { pefree ( mydata -> alias , mydata -> is_persistent ) ; } pefree ( mydata , mydata -> is_persistent ) ; return FAILURE ; for ( i = 0 ; i < PHAR_GET_16 ( locator . count ) ; ++ i ) { phar_zip_central_dir_file zipentry ; zend_off_t beforeus = php_stream_tell ( fp ) ; if ( sizeof ( zipentry ) != php_stream_read ( fp , ( char * ) & zipentry , sizeof ( zipentry ) ) ) { PHAR_ZIP_FAIL ( "unable<S2SV_blank>to<S2SV_blank>read<S2SV_blank>central<S2SV_blank>directory<S2SV_blank>entry,<S2SV_blank>truncated" ) ; } if ( memcmp ( "PK\\1\\2" , zipentry . signature , 4 ) ) { PHAR_ZIP_FAIL ( "corrupted<S2SV_blank>central<S2SV_blank>directory<S2SV_blank>entry,<S2SV_blank>no<S2SV_blank>magic<S2SV_blank>signature" ) ; } if ( entry . is_persistent ) { entry . manifest_pos = i ; } entry . compressed_filesize = PHAR_GET_32 ( zipentry . compsize ) ; entry . uncompressed_filesize = PHAR_GET_32 ( zipentry . uncompsize ) ; entry . crc32 = PHAR_GET_32 ( zipentry . crc32 ) ; entry . timestamp = phar_zip_d2u_time ( zipentry . timestamp , zipentry . datestamp ) ; entry . flags = PHAR_ENT_PERM_DEF_FILE ; entry . header_offset = PHAR_GET_32 ( zipentry . offset ) ; entry . offset = entry . offset_abs = PHAR_GET_32 ( zipentry . offset ) + sizeof ( phar_zip_file_header ) + PHAR_GET_16 ( zipentry . filename_len ) + PHAR_GET_16 ( zipentry . extra_len ) ; if ( PHAR_GET_16 ( zipentry . flags ) & PHAR_ZIP_FLAG_ENCRYPTED ) { PHAR_ZIP_FAIL ( "Cannot<S2SV_blank>process<S2SV_blank>encrypted<S2SV_blank>zip<S2SV_blank>files" ) ; } if ( ! PHAR_GET_16 ( zipentry . filename_len ) ) { PHAR_ZIP_FAIL ( "Cannot<S2SV_blank>process<S2SV_blank>zips<S2SV_blank>created<S2SV_blank>from<S2SV_blank>stdin<S2SV_blank>(zero-length<S2SV_blank>filename)" ) ; } entry . filename_len = PHAR_GET_16 ( zipentry . filename_len ) ; entry . filename = ( char * ) pemalloc ( entry . filename_len + 1 , entry . is_persistent ) ; if ( entry . filename_len != php_stream_read ( fp , entry . filename , entry . filename_len ) ) { pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unable<S2SV_blank>to<S2SV_blank>read<S2SV_blank>in<S2SV_blank>filename<S2SV_blank>from<S2SV_blank>central<S2SV_blank>directory,<S2SV_blank>truncated" ) ; } entry . filename [ entry . filename_len ] = '\\0' ; if ( entry . filename [ entry . filename_len - 1 ] == '/' ) { entry . is_dir = 1 ; if ( entry . filename_len > 1 ) { entry . filename_len -- ; } entry . flags |= PHAR_ENT_PERM_DEF_DIR ; } else { entry . is_dir = 0 ; } if ( entry . filename_len == sizeof ( ".phar/signature.bin" ) - 1 && ! strncmp ( entry . filename , ".phar/signature.bin" , sizeof ( ".phar/signature.bin" ) - 1 ) ) { size_t read ; php_stream * sigfile ; zend_off_t now ; char * sig ; now = php_stream_tell ( fp ) ; pefree ( entry . filename , entry . is_persistent ) ; sigfile = php_stream_fopen_tmpfile ( ) ; if ( ! sigfile ) { PHAR_ZIP_FAIL ( "couldn\'t<S2SV_blank>open<S2SV_blank>temporary<S2SV_blank>file" ) ; } php_stream_seek ( fp , 0 , SEEK_SET ) ; php_stream_copy_to_stream_ex ( fp , sigfile , entry . header_offset , NULL ) ; php_stream_seek ( fp , PHAR_GET_32 ( locator . cdir_offset ) , SEEK_SET ) ; php_stream_copy_to_stream_ex ( fp , sigfile , beforeus - PHAR_GET_32 ( locator . cdir_offset ) , NULL ) ; if ( metadata ) { php_stream_write ( sigfile , metadata , PHAR_GET_16 ( locator . comment_len ) ) ; } php_stream_seek ( fp , sizeof ( phar_zip_file_header ) + entry . header_offset + entry . filename_len + PHAR_GET_16 ( zipentry . extra_len ) , SEEK_SET ) ; sig = ( char * ) emalloc ( entry . uncompressed_filesize ) ; read = php_stream_read ( fp , sig , entry . uncompressed_filesize ) ; <S2SV_StartBug> if ( read != entry . uncompressed_filesize ) { <S2SV_EndBug> php_stream_close ( sigfile ) ; efree ( sig ) ; PHAR_ZIP_FAIL ( "signature<S2SV_blank>cannot<S2SV_blank>be<S2SV_blank>read" ) ; } mydata -> sig_flags = PHAR_GET_32 ( sig ) ; if ( FAILURE == phar_verify_signature ( sigfile , php_stream_tell ( sigfile ) , mydata -> sig_flags , sig + 8 , entry . uncompressed_filesize - 8 , fname , & mydata -> signature , & mydata -> sig_len , error ) ) { efree ( sig ) ; if ( error ) { char * save ; php_stream_close ( sigfile ) ; spprintf ( & save , 4096 , "signature<S2SV_blank>cannot<S2SV_blank>be<S2SV_blank>verified:<S2SV_blank>%s" , * error ) ; efree ( * error ) ; PHAR_ZIP_FAIL_FREE ( save , save ) ; } else { php_stream_close ( sigfile ) ; PHAR_ZIP_FAIL ( "signature<S2SV_blank>cannot<S2SV_blank>be<S2SV_blank>verified" ) ; } } php_stream_close ( sigfile ) ; efree ( sig ) ; if ( i != PHAR_GET_16 ( locator . count ) - 1 ) { PHAR_ZIP_FAIL ( "entries<S2SV_blank>exist<S2SV_blank>after<S2SV_blank>signature,<S2SV_blank>invalid<S2SV_blank>phar" ) ; } continue ; } phar_add_virtual_dirs ( mydata , entry . filename , entry . filename_len ) ; if ( PHAR_GET_16 ( zipentry . extra_len ) ) { zend_off_t loc = php_stream_tell ( fp ) ; if ( FAILURE == phar_zip_process_extra ( fp , & entry , PHAR_GET_16 ( zipentry . extra_len ) ) ) { pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "Unable<S2SV_blank>to<S2SV_blank>process<S2SV_blank>extra<S2SV_blank>field<S2SV_blank>header<S2SV_blank>for<S2SV_blank>file<S2SV_blank>in<S2SV_blank>central<S2SV_blank>directory" ) ; } php_stream_seek ( fp , loc + PHAR_GET_16 ( zipentry . extra_len ) , SEEK_SET ) ; } switch ( PHAR_GET_16 ( zipentry . compressed ) ) { case PHAR_ZIP_COMP_NONE : break ; case PHAR_ZIP_COMP_DEFLATE : entry . flags |= PHAR_ENT_COMPRESSED_GZ ; if ( ! PHAR_G ( has_zlib ) ) { pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "zlib<S2SV_blank>extension<S2SV_blank>is<S2SV_blank>required" ) ; } break ; case PHAR_ZIP_COMP_BZIP2 : entry . flags |= PHAR_ENT_COMPRESSED_BZ2 ; if ( ! PHAR_G ( has_bz2 ) ) { pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "bzip2<S2SV_blank>extension<S2SV_blank>is<S2SV_blank>required" ) ; } break ; case 1 : pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unsupported<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>(Shrunk)<S2SV_blank>used<S2SV_blank>in<S2SV_blank>this<S2SV_blank>zip" ) ; case 2 : case 3 : case 4 : case 5 : pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unsupported<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>(Reduce)<S2SV_blank>used<S2SV_blank>in<S2SV_blank>this<S2SV_blank>zip" ) ; case 6 : pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unsupported<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>(Implode)<S2SV_blank>used<S2SV_blank>in<S2SV_blank>this<S2SV_blank>zip" ) ; case 7 : pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unsupported<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>(Tokenize)<S2SV_blank>used<S2SV_blank>in<S2SV_blank>this<S2SV_blank>zip" ) ; case 9 : pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unsupported<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>(Deflate64)<S2SV_blank>used<S2SV_blank>in<S2SV_blank>this<S2SV_blank>zip" ) ; case 10 : pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unsupported<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>(PKWare<S2SV_blank>Implode/old<S2SV_blank>IBM<S2SV_blank>TERSE)<S2SV_blank>used<S2SV_blank>in<S2SV_blank>this<S2SV_blank>zip" ) ; case 14 : pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unsupported<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>(LZMA)<S2SV_blank>used<S2SV_blank>in<S2SV_blank>this<S2SV_blank>zip" ) ; case 18 : pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unsupported<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>(IBM<S2SV_blank>TERSE)<S2SV_blank>used<S2SV_blank>in<S2SV_blank>this<S2SV_blank>zip" ) ; case 19 : pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unsupported<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>(IBM<S2SV_blank>LZ77)<S2SV_blank>used<S2SV_blank>in<S2SV_blank>this<S2SV_blank>zip" ) ; case 97 : pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unsupported<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>(WavPack)<S2SV_blank>used<S2SV_blank>in<S2SV_blank>this<S2SV_blank>zip" ) ; case 98 : pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unsupported<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>(PPMd)<S2SV_blank>used<S2SV_blank>in<S2SV_blank>this<S2SV_blank>zip" ) ; default : pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unsupported<S2SV_blank>compression<S2SV_blank>method<S2SV_blank>(unknown)<S2SV_blank>used<S2SV_blank>in<S2SV_blank>this<S2SV_blank>zip" ) ; } if ( PHAR_GET_16 ( zipentry . comment_len ) ) { if ( PHAR_GET_16 ( zipentry . comment_len ) != php_stream_read ( fp , buf , PHAR_GET_16 ( zipentry . comment_len ) ) ) { pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unable<S2SV_blank>to<S2SV_blank>read<S2SV_blank>in<S2SV_blank>file<S2SV_blank>comment,<S2SV_blank>truncated" ) ; } p = buf ; entry . metadata_len = PHAR_GET_16 ( zipentry . comment_len ) ; if ( phar_parse_metadata ( & p , & ( entry . metadata ) , PHAR_GET_16 ( zipentry . comment_len ) ) == FAILURE ) { entry . metadata_len = 0 ; ZVAL_NEW_STR ( & entry . metadata , zend_string_init ( buf , PHAR_GET_16 ( zipentry . comment_len ) , entry . is_persistent ) ) ; } } else { ZVAL_UNDEF ( & entry . metadata ) ; } if ( ! actual_alias && entry . filename_len == sizeof ( ".phar/alias.txt" ) - 1 && ! strncmp ( entry . filename , ".phar/alias.txt" , sizeof ( ".phar/alias.txt" ) - 1 ) ) { php_stream_filter * filter ; zend_off_t saveloc ; phar_zip_file_header local ; saveloc = php_stream_tell ( fp ) ; php_stream_seek ( fp , PHAR_GET_32 ( zipentry . offset ) , SEEK_SET ) ; if ( sizeof ( local ) != php_stream_read ( fp , ( char * ) & local , sizeof ( local ) ) ) { pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "phar<S2SV_blank>error:<S2SV_blank>internal<S2SV_blank>corruption<S2SV_blank>of<S2SV_blank>zip-based<S2SV_blank>phar<S2SV_blank>(cannot<S2SV_blank>read<S2SV_blank>local<S2SV_blank>file<S2SV_blank>header<S2SV_blank>for<S2SV_blank>alias)" ) ; } if ( entry . filename_len != PHAR_GET_16 ( local . filename_len ) || entry . crc32 != PHAR_GET_32 ( local . crc32 ) || entry . uncompressed_filesize != PHAR_GET_32 ( local . uncompsize ) || entry . compressed_filesize != PHAR_GET_32 ( local . compsize ) ) { pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "phar<S2SV_blank>error:<S2SV_blank>internal<S2SV_blank>corruption<S2SV_blank>of<S2SV_blank>zip-based<S2SV_blank>phar<S2SV_blank>(local<S2SV_blank>header<S2SV_blank>of<S2SV_blank>alias<S2SV_blank>does<S2SV_blank>not<S2SV_blank>match<S2SV_blank>central<S2SV_blank>directory)" ) ; } entry . offset = entry . offset_abs = sizeof ( local ) + entry . header_offset + PHAR_GET_16 ( local . filename_len ) + PHAR_GET_16 ( local . extra_len ) ; php_stream_seek ( fp , entry . offset , SEEK_SET ) ; fp -> writepos = 0 ; fp -> readpos = 0 ; php_stream_seek ( fp , entry . offset , SEEK_SET ) ; fp -> writepos = 0 ; fp -> readpos = 0 ; mydata -> alias_len = entry . uncompressed_filesize ; if ( entry . flags & PHAR_ENT_COMPRESSED_GZ ) { filter = php_stream_filter_create ( "zlib.inflate" , NULL , php_stream_is_persistent ( fp ) ) ; if ( ! filter ) { pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unable<S2SV_blank>to<S2SV_blank>decompress<S2SV_blank>alias,<S2SV_blank>zlib<S2SV_blank>filter<S2SV_blank>creation<S2SV_blank>failed" ) ; } php_stream_filter_append ( & fp -> readfilters , filter ) ; { zend_string * str = php_stream_copy_to_mem ( fp , entry . uncompressed_filesize , 0 ) ; if ( str ) { entry . uncompressed_filesize = ZSTR_LEN ( str ) ; actual_alias = estrndup ( ZSTR_VAL ( str ) , ZSTR_LEN ( str ) ) ; zend_string_release ( str ) ; } else { actual_alias = NULL ; entry . uncompressed_filesize = 0 ; } } if ( ! entry . uncompressed_filesize || ! actual_alias ) { pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unable<S2SV_blank>to<S2SV_blank>read<S2SV_blank>in<S2SV_blank>alias,<S2SV_blank>truncated" ) ; } php_stream_filter_flush ( filter , 1 ) ; php_stream_filter_remove ( filter , 1 ) ; } else if ( entry . flags & PHAR_ENT_COMPRESSED_BZ2 ) { filter = php_stream_filter_create ( "bzip2.decompress" , NULL , php_stream_is_persistent ( fp ) ) ; if ( ! filter ) { pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unable<S2SV_blank>to<S2SV_blank>read<S2SV_blank>in<S2SV_blank>alias,<S2SV_blank>bzip2<S2SV_blank>filter<S2SV_blank>creation<S2SV_blank>failed" ) ; } php_stream_filter_append ( & fp -> readfilters , filter ) ; { zend_string * str = php_stream_copy_to_mem ( fp , entry . uncompressed_filesize , 0 ) ; if ( str ) { entry . uncompressed_filesize = ZSTR_LEN ( str ) ; actual_alias = estrndup ( ZSTR_VAL ( str ) , ZSTR_LEN ( str ) ) ; zend_string_release ( str ) ; } else { actual_alias = NULL ; entry . uncompressed_filesize = 0 ; } } if ( ! entry . uncompressed_filesize || ! actual_alias ) { pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unable<S2SV_blank>to<S2SV_blank>read<S2SV_blank>in<S2SV_blank>alias,<S2SV_blank>truncated" ) ; } php_stream_filter_flush ( filter , 1 ) ; php_stream_filter_remove ( filter , 1 ) ; } else { { zend_string * str = php_stream_copy_to_mem ( fp , entry . uncompressed_filesize , 0 ) ; if ( str ) { entry . uncompressed_filesize = ZSTR_LEN ( str ) ; actual_alias = estrndup ( ZSTR_VAL ( str ) , ZSTR_LEN ( str ) ) ; zend_string_release ( str ) ; } else { actual_alias = NULL ; entry . uncompressed_filesize = 0 ; } } if ( ! entry . uncompressed_filesize || ! actual_alias ) { pefree ( entry . filename , entry . is_persistent ) ; PHAR_ZIP_FAIL ( "unable<S2SV_blank>to<S2SV_blank>read<S2SV_blank>in<S2SV_blank>alias,<S2SV_blank>truncated" ) ; } } php_stream_seek ( fp , saveloc , SEEK_SET ) ; } phar_set_inode ( & entry ) ; zend_hash_str_add_mem ( & mydata -> manifest , entry . filename , entry . filename_len , ( void * ) & entry , sizeof ( phar_entry_info ) ) ; } mydata -> fp = fp ; if ( zend_hash_str_exists ( & ( mydata -> manifest ) , ".phar/stub.php" , sizeof ( ".phar/stub.php" ) - 1 ) ) { mydata -> is_data = 0 ; } else { mydata -> is_data = 1 ; } zend_hash_str_add_ptr ( & ( PHAR_G ( phar_fname_map ) ) , mydata -> fname , fname_len , mydata ) ; if ( actual_alias ) { phar_archive_data * fd_ptr ; if ( ! phar_validate_alias ( actual_alias , mydata -> alias_len ) ) { if ( error ) { spprintf ( error , 4096 , "phar<S2SV_blank>error:<S2SV_blank>invalid<S2SV_blank>alias<S2SV_blank>\\"%s\\"<S2SV_blank>in<S2SV_blank>zip-based<S2SV_blank>phar<S2SV_blank>\\"%s\\"" , actual_alias , fname ) ; } efree ( actual_alias ) ; zend_hash_str_del ( & ( PHAR_G ( phar_fname_map ) ) , mydata -> fname , fname_len ) ; return FAILURE ; } mydata -> is_temporary_alias = 0 ; if ( NULL != ( fd_ptr = zend_hash_str_find_ptr ( & ( PHAR_G ( phar_alias_map ) ) , actual_alias , mydata -> alias_len ) ) ) { if ( SUCCESS != phar_free_alias ( fd_ptr , actual_alias , mydata -> alias_len ) ) { if ( error ) { spprintf ( error , 4096 , "phar<S2SV_blank>error:<S2SV_blank>Unable<S2SV_blank>to<S2SV_blank>add<S2SV_blank>zip-based<S2SV_blank>phar<S2SV_blank>\\"%s\\"<S2SV_blank>with<S2SV_blank>implicit<S2SV_blank>alias,<S2SV_blank>alias<S2SV_blank>is<S2SV_blank>already<S2SV_blank>in<S2SV_blank>use" , fname ) ; } efree ( actual_alias ) ; zend_hash_str_del ( & ( PHAR_G ( phar_fname_map ) ) , mydata -> fname , fname_len ) ; return FAILURE ; } } mydata -> alias = entry . is_persistent ? pestrndup ( actual_alias , mydata -> alias_len , 1 ) : actual_alias ; if ( entry . is_persistent ) { efree ( actual_alias ) ; } zend_hash_str_add_ptr ( & ( PHAR_G ( phar_alias_map ) ) , actual_alias , mydata -> alias_len , mydata ) ; } else { phar_archive_data * fd_ptr ; if ( alias_len ) { if ( NULL != ( fd_ptr = zend_hash_str_find_ptr ( & ( PHAR_G ( phar_alias_map ) ) , alias , alias_len ) ) ) { if ( SUCCESS != phar_free_alias ( fd_ptr , alias , alias_len ) ) { if ( error ) { spprintf ( error , 4096 , "phar<S2SV_blank>error:<S2SV_blank>Unable<S2SV_blank>to<S2SV_blank>add<S2SV_blank>zip-based<S2SV_blank>phar<S2SV_blank>\\"%s\\"<S2SV_blank>with<S2SV_blank>explicit<S2SV_blank>alias,<S2SV_blank>alias<S2SV_blank>is<S2SV_blank>already<S2SV_blank>in<S2SV_blank>use" , fname ) ; } zend_hash_str_del ( & ( PHAR_G ( phar_fname_map ) ) , mydata -> fname , fname_len ) ; return FAILURE ; } } zend_hash_str_add_ptr ( & ( PHAR_G ( phar_alias_map ) ) , actual_alias , mydata -> alias_len , mydata ) ; mydata -> alias = pestrndup ( alias , alias_len , mydata -> is_persistent ) ; mydata -> alias_len = alias_len ; } else { mydata -> alias = pestrndup ( mydata -> fname , fname_len , mydata -> is_persistent ) ; mydata -> alias_len = fname_len ; } mydata -> is_temporary_alias = 1 ; } if ( pphar ) { * pphar = mydata ; } return SUCCESS ; }
| <S2SV_ModStart> entry . uncompressed_filesize || read <= 8
| php@php-src/0bfb970f43acd1e81d11be1154805f86655f15d5 | CVE-2016-7414 | https://github.com/php/php-src/commit/0bfb970f43acd1e81d11be1154805f86655f15d5 | 2016-09-17T21:59Z |
6,771 | CWE-119 | CWE-119 static int64_t rd_sbuv_dcpred ( const VP9_COMP * cpi , MACROBLOCK * x , int * rate , int * rate_tokenonly , int64_t * distortion , int * skippable , BLOCK_SIZE bsize ) { const VP9_COMMON * cm = & cpi -> common ; int64_t unused ; x -> e_mbd . mi [ 0 ] -> mbmi . uv_mode = DC_PRED ; <S2SV_StartBug> super_block_uvrd ( cpi , x , rate_tokenonly , distortion , <S2SV_EndBug> skippable , & unused , bsize , INT64_MAX ) ; <S2SV_StartBug> * rate = * rate_tokenonly + x -> intra_uv_mode_cost [ cm -> frame_type ] [ DC_PRED ] ; <S2SV_EndBug> return RDCOST ( x -> rdmult , x -> rddiv , * rate , * distortion ) ; }
| <S2SV_ModStart> = DC_PRED ; memset ( x -> skip_txfm , SKIP_TXFM_NONE , sizeof ( x -> skip_txfm ) ) ; <S2SV_ModStart> * rate_tokenonly + cpi <S2SV_ModEnd> -> intra_uv_mode_cost [
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
6,772 | CWE-119 | CWE-119 static int translate_hex_string ( char * s , char * saved_orphan ) { int c1 = * saved_orphan ; char * start = s ; char * t = s ; for ( ; * s ; s ++ ) { <S2SV_StartBug> if ( isspace ( * s ) ) <S2SV_EndBug> continue ; if ( c1 ) { * t ++ = ( hexval ( c1 ) << 4 ) + hexval ( * s ) ; c1 = 0 ; } else c1 = * s ; } * saved_orphan = c1 ; return t - start ; }
| <S2SV_ModStart> ( isspace ( ( unsigned char )
| kohler@t1utils/6b9d1aafcb61a3663c883663eb19ccdbfcde8d33 | CVE-2015-3905 | https://github.com/kohler/t1utils/commit/6b9d1aafcb61a3663c883663eb19ccdbfcde8d33 | 2015-06-08T14:59Z |
6,773 | CWE-119 | CWE-119 static void update_best_mode ( BEST_MODE * best_mode , int this_rd , RATE_DISTORTION * rd , int other_cost , MACROBLOCK * x ) { MB_PREDICTION_MODE this_mode = x -> e_mbd . mode_info_context -> mbmi . mode ; other_cost += x -> ref_frame_cost [ x -> e_mbd . mode_info_context -> mbmi . ref_frame ] ; best_mode -> yrd = RDCOST ( x -> rdmult , x -> rddiv , ( rd -> rate2 - rd -> rate_uv - other_cost ) , ( rd -> distortion2 - rd -> distortion_uv ) ) ; best_mode -> rd = this_rd ; <S2SV_StartBug> vpx_memcpy ( & best_mode -> mbmode , & x -> e_mbd . mode_info_context -> mbmi , sizeof ( MB_MODE_INFO ) ) ; <S2SV_EndBug> <S2SV_StartBug> vpx_memcpy ( & best_mode -> partition , x -> partition_info , sizeof ( PARTITION_INFO ) ) ; <S2SV_EndBug> if ( ( this_mode == B_PRED ) || ( this_mode == SPLITMV ) ) { int i ; for ( i = 0 ; i < 16 ; i ++ ) { best_mode -> bmodes [ i ] = x -> e_mbd . block [ i ] . bmi ; } } }
| <S2SV_ModStart> = this_rd ; memcpy <S2SV_ModEnd> ( & best_mode <S2SV_ModStart> ) ) ; memcpy <S2SV_ModEnd> ( & best_mode
| external@libvpx/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | CVE-2016-1621 | https://android.googlesource.com/platform/external/libvpx/+/5a9753fca56f0eeb9f61e342b2fccffc364f9426 | 2016-03-12T21:59Z |
6,774 | CWE-190 | CWE-190 gdImagePtr gdImageCreate ( int sx , int sy ) { int i ; gdImagePtr im ; if ( overflow2 ( sx , sy ) ) { return NULL ; } if ( overflow2 ( sizeof ( unsigned char * ) , sy ) ) { return NULL ; } <S2SV_StartBug> im = ( gdImage * ) gdCalloc ( 1 , sizeof ( gdImage ) ) ; <S2SV_EndBug> im -> pixels = ( unsigned char * * ) gdMalloc ( sizeof ( unsigned char * ) * sy ) ; im -> AA_opacity = ( unsigned char * * ) gdMalloc ( sizeof ( unsigned char * ) * sy ) ; im -> polyInts = 0 ; im -> polyAllocated = 0 ; im -> brush = 0 ; im -> tile = 0 ; im -> style = 0 ; for ( i = 0 ; i < sy ; i ++ ) { im -> pixels [ i ] = ( unsigned char * ) gdCalloc ( sx , sizeof ( unsigned char ) ) ; im -> AA_opacity [ i ] = ( unsigned char * ) gdCalloc ( sx , sizeof ( unsigned char ) ) ; } im -> sx = sx ; im -> sy = sy ; im -> colorsTotal = 0 ; im -> transparent = ( - 1 ) ; im -> interlace = 0 ; im -> thick = 1 ; im -> AA = 0 ; im -> AA_polygon = 0 ; for ( i = 0 ; i < gdMaxColors ; i ++ ) { im -> open [ i ] = 1 ; im -> red [ i ] = 0 ; im -> green [ i ] = 0 ; im -> blue [ i ] = 0 ; } im -> trueColor = 0 ; im -> tpixels = 0 ; im -> cx1 = 0 ; im -> cy1 = 0 ; im -> cx2 = im -> sx - 1 ; im -> cy2 = im -> sy - 1 ; im -> interpolation = NULL ; im -> interpolation_id = GD_BILINEAR_FIXED ; return im ; }
| <S2SV_ModStart> NULL ; } if ( overflow2 ( sizeof ( unsigned char * ) , sx ) ) { return NULL ; }
| php@php-src/c395c6e5d7e8df37a21265ff76e48fe75ceb5ae6 | CVE-2016-5767 | https://github.com/php/php-src/commit/c395c6e5d7e8df37a21265ff76e48fe75ceb5ae6 | 2016-08-07T10:59Z |
6,775 | CWE-125 | CWE-125 static int match_at ( regex_t * reg , const UChar * str , const UChar * end , # ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE const UChar * right_range , # endif const UChar * sstart , UChar * sprev , OnigMatchArg * msa ) { static UChar FinishCode [ ] = { OP_FINISH } ; int i , n , num_mem , best_len , pop_level ; LengthType tlen , tlen2 ; MemNumType mem ; RelAddrType addr ; UChar * s , * q , * sbegin ; int is_alloca ; char * alloc_base ; OnigStackType * stk_base , * stk , * stk_end ; OnigStackType * stkp ; OnigStackIndex si ; OnigStackIndex * repeat_stk ; OnigStackIndex * mem_start_stk , * mem_end_stk ; # ifdef USE_COMBINATION_EXPLOSION_CHECK int scv ; unsigned char * state_check_buff = msa -> state_check_buff ; int num_comb_exp_check = reg -> num_comb_exp_check ; # endif UChar * p = reg -> p ; OnigOptionType option = reg -> options ; OnigEncoding encode = reg -> enc ; OnigCaseFoldType case_fold_flag = reg -> case_fold_flag ; pop_level = reg -> stack_pop_level ; num_mem = reg -> num_mem ; STACK_INIT ( INIT_MATCH_STACK_SIZE ) ; UPDATE_FOR_STACK_REALLOC ; for ( i = 1 ; i <= num_mem ; i ++ ) { mem_start_stk [ i ] = mem_end_stk [ i ] = INVALID_STACK_INDEX ; } # ifdef ONIG_DEBUG_MATCH fprintf ( stderr , "match_at:<S2SV_blank>str:<S2SV_blank>%d,<S2SV_blank>end:<S2SV_blank>%d,<S2SV_blank>start:<S2SV_blank>%d,<S2SV_blank>sprev:<S2SV_blank>%d\\n" , ( int ) str , ( int ) end , ( int ) sstart , ( int ) sprev ) ; fprintf ( stderr , "size:<S2SV_blank>%d,<S2SV_blank>start<S2SV_blank>offset:<S2SV_blank>%d\\n" , ( int ) ( end - str ) , ( int ) ( sstart - str ) ) ; # endif STACK_PUSH_ENSURED ( STK_ALT , FinishCode ) ; best_len = ONIG_MISMATCH ; s = ( UChar * ) sstart ; while ( 1 ) { # ifdef ONIG_DEBUG_MATCH { UChar * q , * bp , buf [ 50 ] ; int len ; fprintf ( stderr , "%4d><S2SV_blank>\\"" , ( int ) ( s - str ) ) ; bp = buf ; for ( i = 0 , q = s ; i < 7 && q < end ; i ++ ) { len = enclen ( encode , q ) ; while ( len -- > 0 ) * bp ++ = * q ++ ; } if ( q < end ) { xmemcpy ( bp , "...\\"" , 4 ) ; bp += 4 ; } else { xmemcpy ( bp , "\\"" , 1 ) ; bp += 1 ; } * bp = 0 ; fputs ( ( char * ) buf , stderr ) ; for ( i = 0 ; i < 20 - ( bp - buf ) ; i ++ ) fputc ( '<S2SV_blank>' , stderr ) ; onig_print_compiled_byte_code ( stderr , p , NULL , encode ) ; fprintf ( stderr , "\\n" ) ; } # endif sbegin = s ; switch ( * p ++ ) { case OP_END : MOP_IN ( OP_END ) ; n = s - sstart ; if ( n > best_len ) { OnigRegion * region ; # ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE if ( IS_FIND_LONGEST ( option ) ) { if ( n > msa -> best_len ) { msa -> best_len = n ; msa -> best_s = ( UChar * ) sstart ; } else goto end_best_len ; } # endif best_len = n ; region = msa -> region ; if ( region ) { # ifdef USE_POSIX_API_REGION_OPTION if ( IS_POSIX_REGION ( msa -> options ) ) { posix_regmatch_t * rmt = ( posix_regmatch_t * ) region ; rmt [ 0 ] . rm_so = sstart - str ; rmt [ 0 ] . rm_eo = s - str ; for ( i = 1 ; i <= num_mem ; i ++ ) { if ( mem_end_stk [ i ] != INVALID_STACK_INDEX ) { if ( BIT_STATUS_AT ( reg -> bt_mem_start , i ) ) rmt [ i ] . rm_so = STACK_AT ( mem_start_stk [ i ] ) -> u . mem . pstr - str ; else rmt [ i ] . rm_so = ( UChar * ) ( ( void * ) ( mem_start_stk [ i ] ) ) - str ; rmt [ i ] . rm_eo = ( BIT_STATUS_AT ( reg -> bt_mem_end , i ) ? STACK_AT ( mem_end_stk [ i ] ) -> u . mem . pstr : ( UChar * ) ( ( void * ) mem_end_stk [ i ] ) ) - str ; } else { rmt [ i ] . rm_so = rmt [ i ] . rm_eo = ONIG_REGION_NOTPOS ; } } } else { # endif region -> beg [ 0 ] = sstart - str ; region -> end [ 0 ] = s - str ; for ( i = 1 ; i <= num_mem ; i ++ ) { if ( mem_end_stk [ i ] != INVALID_STACK_INDEX ) { if ( BIT_STATUS_AT ( reg -> bt_mem_start , i ) ) region -> beg [ i ] = STACK_AT ( mem_start_stk [ i ] ) -> u . mem . pstr - str ; else region -> beg [ i ] = ( UChar * ) ( ( void * ) mem_start_stk [ i ] ) - str ; region -> end [ i ] = ( BIT_STATUS_AT ( reg -> bt_mem_end , i ) ? STACK_AT ( mem_end_stk [ i ] ) -> u . mem . pstr : ( UChar * ) ( ( void * ) mem_end_stk [ i ] ) ) - str ; } else { region -> beg [ i ] = region -> end [ i ] = ONIG_REGION_NOTPOS ; } } # ifdef USE_CAPTURE_HISTORY if ( reg -> capture_history != 0 ) { int r ; OnigCaptureTreeNode * node ; if ( IS_NULL ( region -> history_root ) ) { region -> history_root = node = history_node_new ( ) ; CHECK_NULL_RETURN_MEMERR ( node ) ; } else { node = region -> history_root ; history_tree_clear ( node ) ; } node -> group = 0 ; node -> beg = sstart - str ; node -> end = s - str ; stkp = stk_base ; r = make_capture_history_tree ( region -> history_root , & stkp , stk , ( UChar * ) str , reg ) ; if ( r < 0 ) { best_len = r ; goto finish ; } } # endif # ifdef USE_POSIX_API_REGION_OPTION } # endif } } # ifdef USE_FIND_LONGEST_SEARCH_ALL_OF_RANGE end_best_len : # endif MOP_OUT ; if ( IS_FIND_CONDITION ( option ) ) { if ( IS_FIND_NOT_EMPTY ( option ) && s == sstart ) { best_len = ONIG_MISMATCH ; goto fail ; } if ( IS_FIND_LONGEST ( option ) && DATA_ENSURE_CHECK1 ) { goto fail ; } } goto finish ; break ; case OP_EXACT1 : MOP_IN ( OP_EXACT1 ) ; <S2SV_StartBug> # if 0 <S2SV_EndBug> DATA_ENSURE ( 1 ) ; if ( * p != * s ) goto fail ; <S2SV_StartBug> p ++ ; s ++ ; <S2SV_EndBug> # endif if ( * p != * s ++ ) goto fail ; DATA_ENSURE ( 0 ) ; p ++ ; MOP_OUT ; break ; case OP_EXACT1_IC : MOP_IN ( OP_EXACT1_IC ) ; { int len ; UChar * q , lowbuf [ ONIGENC_MBC_CASE_FOLD_MAXLEN ] ; DATA_ENSURE ( 1 ) ; len = ONIGENC_MBC_CASE_FOLD ( encode , case_fold_flag , & s , end , lowbuf ) ; DATA_ENSURE ( 0 ) ; q = lowbuf ; while ( len -- > 0 ) { if ( * p != * q ) { goto fail ; } p ++ ; q ++ ; } } MOP_OUT ; break ; case OP_EXACT2 : MOP_IN ( OP_EXACT2 ) ; DATA_ENSURE ( 2 ) ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; sprev = s ; p ++ ; s ++ ; MOP_OUT ; continue ; break ; case OP_EXACT3 : MOP_IN ( OP_EXACT3 ) ; DATA_ENSURE ( 3 ) ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; sprev = s ; p ++ ; s ++ ; MOP_OUT ; continue ; break ; case OP_EXACT4 : MOP_IN ( OP_EXACT4 ) ; DATA_ENSURE ( 4 ) ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; sprev = s ; p ++ ; s ++ ; MOP_OUT ; continue ; break ; case OP_EXACT5 : MOP_IN ( OP_EXACT5 ) ; DATA_ENSURE ( 5 ) ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; sprev = s ; p ++ ; s ++ ; MOP_OUT ; continue ; break ; case OP_EXACTN : MOP_IN ( OP_EXACTN ) ; GET_LENGTH_INC ( tlen , p ) ; DATA_ENSURE ( tlen ) ; while ( tlen -- > 0 ) { if ( * p ++ != * s ++ ) goto fail ; } sprev = s - 1 ; MOP_OUT ; continue ; break ; case OP_EXACTN_IC : MOP_IN ( OP_EXACTN_IC ) ; { int len ; UChar * q , * endp , lowbuf [ ONIGENC_MBC_CASE_FOLD_MAXLEN ] ; GET_LENGTH_INC ( tlen , p ) ; endp = p + tlen ; while ( p < endp ) { sprev = s ; DATA_ENSURE ( 1 ) ; len = ONIGENC_MBC_CASE_FOLD ( encode , case_fold_flag , & s , end , lowbuf ) ; DATA_ENSURE ( 0 ) ; q = lowbuf ; while ( len -- > 0 ) { if ( * p != * q ) goto fail ; p ++ ; q ++ ; } } } MOP_OUT ; continue ; break ; case OP_EXACTMB2N1 : MOP_IN ( OP_EXACTMB2N1 ) ; DATA_ENSURE ( 2 ) ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; MOP_OUT ; break ; case OP_EXACTMB2N2 : MOP_IN ( OP_EXACTMB2N2 ) ; DATA_ENSURE ( 4 ) ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; sprev = s ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; MOP_OUT ; continue ; break ; case OP_EXACTMB2N3 : MOP_IN ( OP_EXACTMB2N3 ) ; DATA_ENSURE ( 6 ) ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; sprev = s ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; MOP_OUT ; continue ; break ; case OP_EXACTMB2N : MOP_IN ( OP_EXACTMB2N ) ; GET_LENGTH_INC ( tlen , p ) ; DATA_ENSURE ( tlen * 2 ) ; while ( tlen -- > 0 ) { if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; } sprev = s - 2 ; MOP_OUT ; continue ; break ; case OP_EXACTMB3N : MOP_IN ( OP_EXACTMB3N ) ; GET_LENGTH_INC ( tlen , p ) ; DATA_ENSURE ( tlen * 3 ) ; while ( tlen -- > 0 ) { if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; if ( * p != * s ) goto fail ; p ++ ; s ++ ; } sprev = s - 3 ; MOP_OUT ; continue ; break ; case OP_EXACTMBN : MOP_IN ( OP_EXACTMBN ) ; GET_LENGTH_INC ( tlen , p ) ; GET_LENGTH_INC ( tlen2 , p ) ; tlen2 *= tlen ; DATA_ENSURE ( tlen2 ) ; while ( tlen2 -- > 0 ) { if ( * p != * s ) goto fail ; p ++ ; s ++ ; } sprev = s - tlen ; MOP_OUT ; continue ; break ; case OP_CCLASS : MOP_IN ( OP_CCLASS ) ; DATA_ENSURE ( 1 ) ; if ( BITSET_AT ( ( ( BitSetRef ) p ) , * s ) == 0 ) goto fail ; p += SIZE_BITSET ; s += enclen ( encode , s ) ; MOP_OUT ; break ; case OP_CCLASS_MB : MOP_IN ( OP_CCLASS_MB ) ; if ( ! ONIGENC_IS_MBC_HEAD ( encode , s ) ) goto fail ; cclass_mb : GET_LENGTH_INC ( tlen , p ) ; { OnigCodePoint code ; UChar * ss ; int mb_len ; DATA_ENSURE ( 1 ) ; mb_len = enclen ( encode , s ) ; DATA_ENSURE ( mb_len ) ; ss = s ; s += mb_len ; code = ONIGENC_MBC_TO_CODE ( encode , ss , s ) ; # ifdef PLATFORM_UNALIGNED_WORD_ACCESS if ( ! onig_is_in_code_range ( p , code ) ) goto fail ; # else q = p ; ALIGNMENT_RIGHT ( q ) ; if ( ! onig_is_in_code_range ( q , code ) ) goto fail ; # endif } p += tlen ; MOP_OUT ; break ; case OP_CCLASS_MIX : MOP_IN ( OP_CCLASS_MIX ) ; DATA_ENSURE ( 1 ) ; if ( ONIGENC_IS_MBC_HEAD ( encode , s ) ) { p += SIZE_BITSET ; goto cclass_mb ; } else { if ( BITSET_AT ( ( ( BitSetRef ) p ) , * s ) == 0 ) goto fail ; p += SIZE_BITSET ; GET_LENGTH_INC ( tlen , p ) ; p += tlen ; s ++ ; } MOP_OUT ; break ; case OP_CCLASS_NOT : MOP_IN ( OP_CCLASS_NOT ) ; DATA_ENSURE ( 1 ) ; if ( BITSET_AT ( ( ( BitSetRef ) p ) , * s ) != 0 ) goto fail ; p += SIZE_BITSET ; s += enclen ( encode , s ) ; MOP_OUT ; break ; case OP_CCLASS_MB_NOT : MOP_IN ( OP_CCLASS_MB_NOT ) ; DATA_ENSURE ( 1 ) ; if ( ! ONIGENC_IS_MBC_HEAD ( encode , s ) ) { s ++ ; GET_LENGTH_INC ( tlen , p ) ; p += tlen ; goto cc_mb_not_success ; } cclass_mb_not : GET_LENGTH_INC ( tlen , p ) ; { OnigCodePoint code ; UChar * ss ; int mb_len = enclen ( encode , s ) ; if ( ! DATA_ENSURE_CHECK ( mb_len ) ) { DATA_ENSURE ( 1 ) ; s = ( UChar * ) end ; p += tlen ; goto cc_mb_not_success ; } ss = s ; s += mb_len ; code = ONIGENC_MBC_TO_CODE ( encode , ss , s ) ; # ifdef PLATFORM_UNALIGNED_WORD_ACCESS if ( onig_is_in_code_range ( p , code ) ) goto fail ; # else q = p ; ALIGNMENT_RIGHT ( q ) ; if ( onig_is_in_code_range ( q , code ) ) goto fail ; # endif } p += tlen ; cc_mb_not_success : MOP_OUT ; break ; case OP_CCLASS_MIX_NOT : MOP_IN ( OP_CCLASS_MIX_NOT ) ; DATA_ENSURE ( 1 ) ; if ( ONIGENC_IS_MBC_HEAD ( encode , s ) ) { p += SIZE_BITSET ; goto cclass_mb_not ; } else { if ( BITSET_AT ( ( ( BitSetRef ) p ) , * s ) != 0 ) goto fail ; p += SIZE_BITSET ; GET_LENGTH_INC ( tlen , p ) ; p += tlen ; s ++ ; } MOP_OUT ; break ; case OP_CCLASS_NODE : MOP_IN ( OP_CCLASS_NODE ) ; { OnigCodePoint code ; void * node ; int mb_len ; UChar * ss ; DATA_ENSURE ( 1 ) ; GET_POINTER_INC ( node , p ) ; mb_len = enclen ( encode , s ) ; ss = s ; s += mb_len ; DATA_ENSURE ( 0 ) ; code = ONIGENC_MBC_TO_CODE ( encode , ss , s ) ; if ( onig_is_code_in_cc_len ( mb_len , code , node ) == 0 ) goto fail ; } MOP_OUT ; break ; case OP_ANYCHAR : MOP_IN ( OP_ANYCHAR ) ; DATA_ENSURE ( 1 ) ; n = enclen ( encode , s ) ; DATA_ENSURE ( n ) ; if ( ONIGENC_IS_MBC_NEWLINE ( encode , s , end ) ) goto fail ; s += n ; MOP_OUT ; break ; case OP_ANYCHAR_ML : MOP_IN ( OP_ANYCHAR_ML ) ; DATA_ENSURE ( 1 ) ; n = enclen ( encode , s ) ; DATA_ENSURE ( n ) ; s += n ; MOP_OUT ; break ; case OP_ANYCHAR_STAR : MOP_IN ( OP_ANYCHAR_STAR ) ; while ( DATA_ENSURE_CHECK1 ) { STACK_PUSH_ALT ( p , s , sprev ) ; n = enclen ( encode , s ) ; DATA_ENSURE ( n ) ; if ( ONIGENC_IS_MBC_NEWLINE ( encode , s , end ) ) goto fail ; sprev = s ; s += n ; } MOP_OUT ; break ; case OP_ANYCHAR_ML_STAR : MOP_IN ( OP_ANYCHAR_ML_STAR ) ; while ( DATA_ENSURE_CHECK1 ) { STACK_PUSH_ALT ( p , s , sprev ) ; n = enclen ( encode , s ) ; if ( n > 1 ) { DATA_ENSURE ( n ) ; sprev = s ; s += n ; } else { sprev = s ; s ++ ; } } MOP_OUT ; break ; case OP_ANYCHAR_STAR_PEEK_NEXT : MOP_IN ( OP_ANYCHAR_STAR_PEEK_NEXT ) ; while ( DATA_ENSURE_CHECK1 ) { if ( * p == * s ) { STACK_PUSH_ALT ( p + 1 , s , sprev ) ; } n = enclen ( encode , s ) ; DATA_ENSURE ( n ) ; if ( ONIGENC_IS_MBC_NEWLINE ( encode , s , end ) ) goto fail ; sprev = s ; s += n ; } p ++ ; MOP_OUT ; break ; case OP_ANYCHAR_ML_STAR_PEEK_NEXT : MOP_IN ( OP_ANYCHAR_ML_STAR_PEEK_NEXT ) ; while ( DATA_ENSURE_CHECK1 ) { if ( * p == * s ) { STACK_PUSH_ALT ( p + 1 , s , sprev ) ; } n = enclen ( encode , s ) ; if ( n > 1 ) { DATA_ENSURE ( n ) ; sprev = s ; s += n ; } else { sprev = s ; s ++ ; } } p ++ ; MOP_OUT ; break ; # ifdef USE_COMBINATION_EXPLOSION_CHECK case OP_STATE_CHECK_ANYCHAR_STAR : MOP_IN ( OP_STATE_CHECK_ANYCHAR_STAR ) ; GET_STATE_CHECK_NUM_INC ( mem , p ) ; while ( DATA_ENSURE_CHECK1 ) { STATE_CHECK_VAL ( scv , mem ) ; if ( scv ) goto fail ; STACK_PUSH_ALT_WITH_STATE_CHECK ( p , s , sprev , mem ) ; n = enclen ( encode , s ) ; DATA_ENSURE ( n ) ; if ( ONIGENC_IS_MBC_NEWLINE ( encode , s , end ) ) goto fail ; sprev = s ; s += n ; } MOP_OUT ; break ; case OP_STATE_CHECK_ANYCHAR_ML_STAR : MOP_IN ( OP_STATE_CHECK_ANYCHAR_ML_STAR ) ; GET_STATE_CHECK_NUM_INC ( mem , p ) ; while ( DATA_ENSURE_CHECK1 ) { STATE_CHECK_VAL ( scv , mem ) ; if ( scv ) goto fail ; STACK_PUSH_ALT_WITH_STATE_CHECK ( p , s , sprev , mem ) ; n = enclen ( encode , s ) ; if ( n > 1 ) { DATA_ENSURE ( n ) ; sprev = s ; s += n ; } else { sprev = s ; s ++ ; } } MOP_OUT ; break ; # endif case OP_WORD : MOP_IN ( OP_WORD ) ; DATA_ENSURE ( 1 ) ; if ( ! ONIGENC_IS_MBC_WORD ( encode , s , end ) ) goto fail ; s += enclen ( encode , s ) ; MOP_OUT ; break ; case OP_NOT_WORD : MOP_IN ( OP_NOT_WORD ) ; DATA_ENSURE ( 1 ) ; if ( ONIGENC_IS_MBC_WORD ( encode , s , end ) ) goto fail ; s += enclen ( encode , s ) ; MOP_OUT ; break ; case OP_WORD_BOUND : MOP_IN ( OP_WORD_BOUND ) ; if ( ON_STR_BEGIN ( s ) ) { DATA_ENSURE ( 1 ) ; if ( ! ONIGENC_IS_MBC_WORD ( encode , s , end ) ) goto fail ; } else if ( ON_STR_END ( s ) ) { if ( ! ONIGENC_IS_MBC_WORD ( encode , sprev , end ) ) goto fail ; } else { if ( ONIGENC_IS_MBC_WORD ( encode , s , end ) == ONIGENC_IS_MBC_WORD ( encode , sprev , end ) ) goto fail ; } MOP_OUT ; continue ; break ; case OP_NOT_WORD_BOUND : MOP_IN ( OP_NOT_WORD_BOUND ) ; if ( ON_STR_BEGIN ( s ) ) { if ( DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD ( encode , s , end ) ) goto fail ; } else if ( ON_STR_END ( s ) ) { if ( ONIGENC_IS_MBC_WORD ( encode , sprev , end ) ) goto fail ; } else { if ( ONIGENC_IS_MBC_WORD ( encode , s , end ) != ONIGENC_IS_MBC_WORD ( encode , sprev , end ) ) goto fail ; } MOP_OUT ; continue ; break ; # ifdef USE_WORD_BEGIN_END case OP_WORD_BEGIN : MOP_IN ( OP_WORD_BEGIN ) ; if ( DATA_ENSURE_CHECK1 && ONIGENC_IS_MBC_WORD ( encode , s , end ) ) { if ( ON_STR_BEGIN ( s ) || ! ONIGENC_IS_MBC_WORD ( encode , sprev , end ) ) { MOP_OUT ; continue ; } } goto fail ; break ; case OP_WORD_END : MOP_IN ( OP_WORD_END ) ; if ( ! ON_STR_BEGIN ( s ) && ONIGENC_IS_MBC_WORD ( encode , sprev , end ) ) { if ( ON_STR_END ( s ) || ! ONIGENC_IS_MBC_WORD ( encode , s , end ) ) { MOP_OUT ; continue ; } } goto fail ; break ; # endif case OP_BEGIN_BUF : MOP_IN ( OP_BEGIN_BUF ) ; if ( ! ON_STR_BEGIN ( s ) ) goto fail ; MOP_OUT ; continue ; break ; case OP_END_BUF : MOP_IN ( OP_END_BUF ) ; if ( ! ON_STR_END ( s ) ) goto fail ; MOP_OUT ; continue ; break ; case OP_BEGIN_LINE : MOP_IN ( OP_BEGIN_LINE ) ; if ( ON_STR_BEGIN ( s ) ) { if ( IS_NOTBOL ( msa -> options ) ) goto fail ; MOP_OUT ; continue ; } else if ( ONIGENC_IS_MBC_NEWLINE ( encode , sprev , end ) && ! ON_STR_END ( s ) ) { MOP_OUT ; continue ; } goto fail ; break ; case OP_END_LINE : MOP_IN ( OP_END_LINE ) ; if ( ON_STR_END ( s ) ) { # ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE if ( IS_EMPTY_STR || ! ONIGENC_IS_MBC_NEWLINE ( encode , sprev , end ) ) { # endif if ( IS_NOTEOL ( msa -> options ) ) goto fail ; MOP_OUT ; continue ; # ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE } # endif } else if ( ONIGENC_IS_MBC_NEWLINE ( encode , s , end ) ) { MOP_OUT ; continue ; } # ifdef USE_CRNL_AS_LINE_TERMINATOR else if ( ONIGENC_IS_MBC_CRNL ( encode , s , end ) ) { MOP_OUT ; continue ; } # endif goto fail ; break ; case OP_SEMI_END_BUF : MOP_IN ( OP_SEMI_END_BUF ) ; if ( ON_STR_END ( s ) ) { # ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE if ( IS_EMPTY_STR || ! ONIGENC_IS_MBC_NEWLINE ( encode , sprev , end ) ) { # endif if ( IS_NOTEOL ( msa -> options ) ) goto fail ; MOP_OUT ; continue ; # ifndef USE_NEWLINE_AT_END_OF_STRING_HAS_EMPTY_LINE } # endif } else if ( ONIGENC_IS_MBC_NEWLINE ( encode , s , end ) && ON_STR_END ( s + enclen ( encode , s ) ) ) { MOP_OUT ; continue ; } # ifdef USE_CRNL_AS_LINE_TERMINATOR else if ( ONIGENC_IS_MBC_CRNL ( encode , s , end ) ) { UChar * ss = s + enclen ( encode , s ) ; ss += enclen ( encode , ss ) ; if ( ON_STR_END ( ss ) ) { MOP_OUT ; continue ; } } # endif goto fail ; break ; case OP_BEGIN_POSITION : MOP_IN ( OP_BEGIN_POSITION ) ; if ( s != msa -> start ) goto fail ; MOP_OUT ; continue ; break ; case OP_MEMORY_START_PUSH : MOP_IN ( OP_MEMORY_START_PUSH ) ; GET_MEMNUM_INC ( mem , p ) ; STACK_PUSH_MEM_START ( mem , s ) ; MOP_OUT ; continue ; break ; case OP_MEMORY_START : MOP_IN ( OP_MEMORY_START ) ; GET_MEMNUM_INC ( mem , p ) ; mem_start_stk [ mem ] = ( OnigStackIndex ) ( ( void * ) s ) ; MOP_OUT ; continue ; break ; case OP_MEMORY_END_PUSH : MOP_IN ( OP_MEMORY_END_PUSH ) ; GET_MEMNUM_INC ( mem , p ) ; STACK_PUSH_MEM_END ( mem , s ) ; MOP_OUT ; continue ; break ; case OP_MEMORY_END : MOP_IN ( OP_MEMORY_END ) ; GET_MEMNUM_INC ( mem , p ) ; mem_end_stk [ mem ] = ( OnigStackIndex ) ( ( void * ) s ) ; MOP_OUT ; continue ; break ; # ifdef USE_SUBEXP_CALL case OP_MEMORY_END_PUSH_REC : MOP_IN ( OP_MEMORY_END_PUSH_REC ) ; GET_MEMNUM_INC ( mem , p ) ; STACK_GET_MEM_START ( mem , stkp ) ; STACK_PUSH_MEM_END ( mem , s ) ; mem_start_stk [ mem ] = GET_STACK_INDEX ( stkp ) ; MOP_OUT ; continue ; break ; case OP_MEMORY_END_REC : MOP_IN ( OP_MEMORY_END_REC ) ; GET_MEMNUM_INC ( mem , p ) ; mem_end_stk [ mem ] = ( OnigStackIndex ) ( ( void * ) s ) ; STACK_GET_MEM_START ( mem , stkp ) ; if ( BIT_STATUS_AT ( reg -> bt_mem_start , mem ) ) mem_start_stk [ mem ] = GET_STACK_INDEX ( stkp ) ; else mem_start_stk [ mem ] = ( OnigStackIndex ) ( ( void * ) stkp -> u . mem . pstr ) ; STACK_PUSH_MEM_END_MARK ( mem ) ; MOP_OUT ; continue ; break ; # endif case OP_BACKREF1 : MOP_IN ( OP_BACKREF1 ) ; mem = 1 ; goto backref ; break ; case OP_BACKREF2 : MOP_IN ( OP_BACKREF2 ) ; mem = 2 ; goto backref ; break ; case OP_BACKREFN : MOP_IN ( OP_BACKREFN ) ; GET_MEMNUM_INC ( mem , p ) ; backref : { int len ; UChar * pstart , * pend ; if ( mem > num_mem ) goto fail ; if ( mem_end_stk [ mem ] == INVALID_STACK_INDEX ) goto fail ; if ( mem_start_stk [ mem ] == INVALID_STACK_INDEX ) goto fail ; if ( BIT_STATUS_AT ( reg -> bt_mem_start , mem ) ) pstart = STACK_AT ( mem_start_stk [ mem ] ) -> u . mem . pstr ; else pstart = ( UChar * ) ( ( void * ) mem_start_stk [ mem ] ) ; pend = ( BIT_STATUS_AT ( reg -> bt_mem_end , mem ) ? STACK_AT ( mem_end_stk [ mem ] ) -> u . mem . pstr : ( UChar * ) ( ( void * ) mem_end_stk [ mem ] ) ) ; n = pend - pstart ; DATA_ENSURE ( n ) ; sprev = s ; STRING_CMP ( pstart , s , n ) ; while ( sprev + ( len = enclen ( encode , sprev ) ) < s ) sprev += len ; MOP_OUT ; continue ; } break ; case OP_BACKREFN_IC : MOP_IN ( OP_BACKREFN_IC ) ; GET_MEMNUM_INC ( mem , p ) ; { int len ; UChar * pstart , * pend ; if ( mem > num_mem ) goto fail ; if ( mem_end_stk [ mem ] == INVALID_STACK_INDEX ) goto fail ; if ( mem_start_stk [ mem ] == INVALID_STACK_INDEX ) goto fail ; if ( BIT_STATUS_AT ( reg -> bt_mem_start , mem ) ) pstart = STACK_AT ( mem_start_stk [ mem ] ) -> u . mem . pstr ; else pstart = ( UChar * ) ( ( void * ) mem_start_stk [ mem ] ) ; pend = ( BIT_STATUS_AT ( reg -> bt_mem_end , mem ) ? STACK_AT ( mem_end_stk [ mem ] ) -> u . mem . pstr : ( UChar * ) ( ( void * ) mem_end_stk [ mem ] ) ) ; n = pend - pstart ; DATA_ENSURE ( n ) ; sprev = s ; STRING_CMP_IC ( case_fold_flag , pstart , & s , n ) ; while ( sprev + ( len = enclen ( encode , sprev ) ) < s ) sprev += len ; MOP_OUT ; continue ; } break ; case OP_BACKREF_MULTI : MOP_IN ( OP_BACKREF_MULTI ) ; { int len , is_fail ; UChar * pstart , * pend , * swork ; GET_LENGTH_INC ( tlen , p ) ; for ( i = 0 ; i < tlen ; i ++ ) { GET_MEMNUM_INC ( mem , p ) ; if ( mem_end_stk [ mem ] == INVALID_STACK_INDEX ) continue ; if ( mem_start_stk [ mem ] == INVALID_STACK_INDEX ) continue ; if ( BIT_STATUS_AT ( reg -> bt_mem_start , mem ) ) pstart = STACK_AT ( mem_start_stk [ mem ] ) -> u . mem . pstr ; else pstart = ( UChar * ) ( ( void * ) mem_start_stk [ mem ] ) ; pend = ( BIT_STATUS_AT ( reg -> bt_mem_end , mem ) ? STACK_AT ( mem_end_stk [ mem ] ) -> u . mem . pstr : ( UChar * ) ( ( void * ) mem_end_stk [ mem ] ) ) ; n = pend - pstart ; DATA_ENSURE ( n ) ; sprev = s ; swork = s ; STRING_CMP_VALUE ( pstart , swork , n , is_fail ) ; if ( is_fail ) continue ; s = swork ; while ( sprev + ( len = enclen ( encode , sprev ) ) < s ) sprev += len ; p += ( SIZE_MEMNUM * ( tlen - i - 1 ) ) ; break ; } if ( i == tlen ) goto fail ; MOP_OUT ; continue ; } break ; case OP_BACKREF_MULTI_IC : MOP_IN ( OP_BACKREF_MULTI_IC ) ; { int len , is_fail ; UChar * pstart , * pend , * swork ; GET_LENGTH_INC ( tlen , p ) ; for ( i = 0 ; i < tlen ; i ++ ) { GET_MEMNUM_INC ( mem , p ) ; if ( mem_end_stk [ mem ] == INVALID_STACK_INDEX ) continue ; if ( mem_start_stk [ mem ] == INVALID_STACK_INDEX ) continue ; if ( BIT_STATUS_AT ( reg -> bt_mem_start , mem ) ) pstart = STACK_AT ( mem_start_stk [ mem ] ) -> u . mem . pstr ; else pstart = ( UChar * ) ( ( void * ) mem_start_stk [ mem ] ) ; pend = ( BIT_STATUS_AT ( reg -> bt_mem_end , mem ) ? STACK_AT ( mem_end_stk [ mem ] ) -> u . mem . pstr : ( UChar * ) ( ( void * ) mem_end_stk [ mem ] ) ) ; n = pend - pstart ; DATA_ENSURE ( n ) ; sprev = s ; swork = s ; STRING_CMP_VALUE_IC ( case_fold_flag , pstart , & swork , n , is_fail ) ; if ( is_fail ) continue ; s = swork ; while ( sprev + ( len = enclen ( encode , sprev ) ) < s ) sprev += len ; p += ( SIZE_MEMNUM * ( tlen - i - 1 ) ) ; break ; } if ( i == tlen ) goto fail ; MOP_OUT ; continue ; } break ; # ifdef USE_BACKREF_WITH_LEVEL case OP_BACKREF_WITH_LEVEL : { int len ; OnigOptionType ic ; LengthType level ; GET_OPTION_INC ( ic , p ) ; GET_LENGTH_INC ( level , p ) ; GET_LENGTH_INC ( tlen , p ) ; sprev = s ; if ( backref_match_at_nested_level ( reg , stk , stk_base , ic , case_fold_flag , ( int ) level , ( int ) tlen , p , & s , end ) ) { while ( sprev + ( len = enclen ( encode , sprev ) ) < s ) sprev += len ; p += ( SIZE_MEMNUM * tlen ) ; } else goto fail ; MOP_OUT ; continue ; } break ; # endif # if 0 case OP_SET_OPTION_PUSH : MOP_IN ( OP_SET_OPTION_PUSH ) ; GET_OPTION_INC ( option , p ) ; STACK_PUSH_ALT ( p , s , sprev ) ; p += SIZE_OP_SET_OPTION + SIZE_OP_FAIL ; MOP_OUT ; continue ; break ; case OP_SET_OPTION : MOP_IN ( OP_SET_OPTION ) ; GET_OPTION_INC ( option , p ) ; MOP_OUT ; continue ; break ; # endif case OP_NULL_CHECK_START : MOP_IN ( OP_NULL_CHECK_START ) ; GET_MEMNUM_INC ( mem , p ) ; STACK_PUSH_NULL_CHECK_START ( mem , s ) ; MOP_OUT ; continue ; break ; case OP_NULL_CHECK_END : MOP_IN ( OP_NULL_CHECK_END ) ; { int isnull ; GET_MEMNUM_INC ( mem , p ) ; STACK_NULL_CHECK ( isnull , mem , s ) ; if ( isnull ) { # ifdef ONIG_DEBUG_MATCH fprintf ( stderr , "NULL_CHECK_END:<S2SV_blank>skip<S2SV_blank><S2SV_blank>id:%d,<S2SV_blank>s:%d\\n" , ( int ) mem , ( int ) s ) ; # endif null_check_found : switch ( * p ++ ) { case OP_JUMP : case OP_PUSH : p += SIZE_RELADDR ; break ; case OP_REPEAT_INC : case OP_REPEAT_INC_NG : case OP_REPEAT_INC_SG : case OP_REPEAT_INC_NG_SG : p += SIZE_MEMNUM ; break ; default : goto unexpected_bytecode_error ; break ; } } } MOP_OUT ; continue ; break ; # ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT case OP_NULL_CHECK_END_MEMST : MOP_IN ( OP_NULL_CHECK_END_MEMST ) ; { int isnull ; GET_MEMNUM_INC ( mem , p ) ; STACK_NULL_CHECK_MEMST ( isnull , mem , s , reg ) ; if ( isnull ) { # ifdef ONIG_DEBUG_MATCH fprintf ( stderr , "NULL_CHECK_END_MEMST:<S2SV_blank>skip<S2SV_blank><S2SV_blank>id:%d,<S2SV_blank>s:%d\\n" , ( int ) mem , ( int ) s ) ; # endif if ( isnull == - 1 ) goto fail ; goto null_check_found ; } } MOP_OUT ; continue ; break ; # endif # ifdef USE_SUBEXP_CALL case OP_NULL_CHECK_END_MEMST_PUSH : MOP_IN ( OP_NULL_CHECK_END_MEMST_PUSH ) ; { int isnull ; GET_MEMNUM_INC ( mem , p ) ; # ifdef USE_MONOMANIAC_CHECK_CAPTURES_IN_ENDLESS_REPEAT STACK_NULL_CHECK_MEMST_REC ( isnull , mem , s , reg ) ; # else STACK_NULL_CHECK_REC ( isnull , mem , s ) ; # endif if ( isnull ) { # ifdef ONIG_DEBUG_MATCH fprintf ( stderr , "NULL_CHECK_END_MEMST_PUSH:<S2SV_blank>skip<S2SV_blank><S2SV_blank>id:%d,<S2SV_blank>s:%d\\n" , ( int ) mem , ( int ) s ) ; # endif if ( isnull == - 1 ) goto fail ; goto null_check_found ; } else { STACK_PUSH_NULL_CHECK_END ( mem ) ; } } MOP_OUT ; continue ; break ; # endif case OP_JUMP : MOP_IN ( OP_JUMP ) ; GET_RELADDR_INC ( addr , p ) ; p += addr ; MOP_OUT ; CHECK_INTERRUPT_IN_MATCH_AT ; continue ; break ; case OP_PUSH : MOP_IN ( OP_PUSH ) ; GET_RELADDR_INC ( addr , p ) ; STACK_PUSH_ALT ( p + addr , s , sprev ) ; MOP_OUT ; continue ; break ; # ifdef USE_COMBINATION_EXPLOSION_CHECK case OP_STATE_CHECK_PUSH : MOP_IN ( OP_STATE_CHECK_PUSH ) ; GET_STATE_CHECK_NUM_INC ( mem , p ) ; STATE_CHECK_VAL ( scv , mem ) ; if ( scv ) goto fail ; GET_RELADDR_INC ( addr , p ) ; STACK_PUSH_ALT_WITH_STATE_CHECK ( p + addr , s , sprev , mem ) ; MOP_OUT ; continue ; break ; case OP_STATE_CHECK_PUSH_OR_JUMP : MOP_IN ( OP_STATE_CHECK_PUSH_OR_JUMP ) ; GET_STATE_CHECK_NUM_INC ( mem , p ) ; GET_RELADDR_INC ( addr , p ) ; STATE_CHECK_VAL ( scv , mem ) ; if ( scv ) { p += addr ; } else { STACK_PUSH_ALT_WITH_STATE_CHECK ( p + addr , s , sprev , mem ) ; } MOP_OUT ; continue ; break ; case OP_STATE_CHECK : MOP_IN ( OP_STATE_CHECK ) ; GET_STATE_CHECK_NUM_INC ( mem , p ) ; STATE_CHECK_VAL ( scv , mem ) ; if ( scv ) goto fail ; STACK_PUSH_STATE_CHECK ( s , mem ) ; MOP_OUT ; continue ; break ; # endif case OP_POP : MOP_IN ( OP_POP ) ; STACK_POP_ONE ; MOP_OUT ; continue ; break ; case OP_PUSH_OR_JUMP_EXACT1 : MOP_IN ( OP_PUSH_OR_JUMP_EXACT1 ) ; GET_RELADDR_INC ( addr , p ) ; if ( * p == * s && DATA_ENSURE_CHECK1 ) { p ++ ; STACK_PUSH_ALT ( p + addr , s , sprev ) ; MOP_OUT ; continue ; } p += ( addr + 1 ) ; MOP_OUT ; continue ; break ; case OP_PUSH_IF_PEEK_NEXT : MOP_IN ( OP_PUSH_IF_PEEK_NEXT ) ; GET_RELADDR_INC ( addr , p ) ; if ( * p == * s ) { p ++ ; STACK_PUSH_ALT ( p + addr , s , sprev ) ; MOP_OUT ; continue ; } p ++ ; MOP_OUT ; continue ; break ; case OP_REPEAT : MOP_IN ( OP_REPEAT ) ; { GET_MEMNUM_INC ( mem , p ) ; GET_RELADDR_INC ( addr , p ) ; STACK_ENSURE ( 1 ) ; repeat_stk [ mem ] = GET_STACK_INDEX ( stk ) ; STACK_PUSH_REPEAT ( mem , p ) ; if ( reg -> repeat_range [ mem ] . lower == 0 ) { STACK_PUSH_ALT ( p + addr , s , sprev ) ; } } MOP_OUT ; continue ; break ; case OP_REPEAT_NG : MOP_IN ( OP_REPEAT_NG ) ; { GET_MEMNUM_INC ( mem , p ) ; GET_RELADDR_INC ( addr , p ) ; STACK_ENSURE ( 1 ) ; repeat_stk [ mem ] = GET_STACK_INDEX ( stk ) ; STACK_PUSH_REPEAT ( mem , p ) ; if ( reg -> repeat_range [ mem ] . lower == 0 ) { STACK_PUSH_ALT ( p , s , sprev ) ; p += addr ; } } MOP_OUT ; continue ; break ; case OP_REPEAT_INC : MOP_IN ( OP_REPEAT_INC ) ; GET_MEMNUM_INC ( mem , p ) ; si = repeat_stk [ mem ] ; stkp = STACK_AT ( si ) ; repeat_inc : stkp -> u . repeat . count ++ ; if ( stkp -> u . repeat . count >= reg -> repeat_range [ mem ] . upper ) { } else if ( stkp -> u . repeat . count >= reg -> repeat_range [ mem ] . lower ) { STACK_PUSH_ALT ( p , s , sprev ) ; p = STACK_AT ( si ) -> u . repeat . pcode ; } else { p = stkp -> u . repeat . pcode ; } STACK_PUSH_REPEAT_INC ( si ) ; MOP_OUT ; CHECK_INTERRUPT_IN_MATCH_AT ; continue ; break ; case OP_REPEAT_INC_SG : MOP_IN ( OP_REPEAT_INC_SG ) ; GET_MEMNUM_INC ( mem , p ) ; STACK_GET_REPEAT ( mem , stkp ) ; si = GET_STACK_INDEX ( stkp ) ; goto repeat_inc ; break ; case OP_REPEAT_INC_NG : MOP_IN ( OP_REPEAT_INC_NG ) ; GET_MEMNUM_INC ( mem , p ) ; si = repeat_stk [ mem ] ; stkp = STACK_AT ( si ) ; repeat_inc_ng : stkp -> u . repeat . count ++ ; if ( stkp -> u . repeat . count < reg -> repeat_range [ mem ] . upper ) { if ( stkp -> u . repeat . count >= reg -> repeat_range [ mem ] . lower ) { UChar * pcode = stkp -> u . repeat . pcode ; STACK_PUSH_REPEAT_INC ( si ) ; STACK_PUSH_ALT ( pcode , s , sprev ) ; } else { p = stkp -> u . repeat . pcode ; STACK_PUSH_REPEAT_INC ( si ) ; } } else if ( stkp -> u . repeat . count == reg -> repeat_range [ mem ] . upper ) { STACK_PUSH_REPEAT_INC ( si ) ; } MOP_OUT ; CHECK_INTERRUPT_IN_MATCH_AT ; continue ; break ; case OP_REPEAT_INC_NG_SG : MOP_IN ( OP_REPEAT_INC_NG_SG ) ; GET_MEMNUM_INC ( mem , p ) ; STACK_GET_REPEAT ( mem , stkp ) ; si = GET_STACK_INDEX ( stkp ) ; goto repeat_inc_ng ; break ; case OP_PUSH_POS : MOP_IN ( OP_PUSH_POS ) ; STACK_PUSH_POS ( s , sprev ) ; MOP_OUT ; continue ; break ; case OP_POP_POS : MOP_IN ( OP_POP_POS ) ; { STACK_POS_END ( stkp ) ; s = stkp -> u . state . pstr ; sprev = stkp -> u . state . pstr_prev ; } MOP_OUT ; continue ; break ; case OP_PUSH_POS_NOT : MOP_IN ( OP_PUSH_POS_NOT ) ; GET_RELADDR_INC ( addr , p ) ; STACK_PUSH_POS_NOT ( p + addr , s , sprev ) ; MOP_OUT ; continue ; break ; case OP_FAIL_POS : MOP_IN ( OP_FAIL_POS ) ; STACK_POP_TIL_POS_NOT ; goto fail ; break ; case OP_PUSH_STOP_BT : MOP_IN ( OP_PUSH_STOP_BT ) ; STACK_PUSH_STOP_BT ; MOP_OUT ; continue ; break ; case OP_POP_STOP_BT : MOP_IN ( OP_POP_STOP_BT ) ; STACK_STOP_BT_END ; MOP_OUT ; continue ; break ; case OP_LOOK_BEHIND : MOP_IN ( OP_LOOK_BEHIND ) ; GET_LENGTH_INC ( tlen , p ) ; s = ( UChar * ) ONIGENC_STEP_BACK ( encode , str , s , ( int ) tlen ) ; if ( IS_NULL ( s ) ) goto fail ; sprev = ( UChar * ) onigenc_get_prev_char_head ( encode , str , s ) ; MOP_OUT ; continue ; break ; case OP_PUSH_LOOK_BEHIND_NOT : MOP_IN ( OP_PUSH_LOOK_BEHIND_NOT ) ; GET_RELADDR_INC ( addr , p ) ; GET_LENGTH_INC ( tlen , p ) ; q = ( UChar * ) ONIGENC_STEP_BACK ( encode , str , s , ( int ) tlen ) ; if ( IS_NULL ( q ) ) { p += addr ; } else { STACK_PUSH_LOOK_BEHIND_NOT ( p + addr , s , sprev ) ; s = q ; sprev = ( UChar * ) onigenc_get_prev_char_head ( encode , str , s ) ; } MOP_OUT ; continue ; break ; case OP_FAIL_LOOK_BEHIND_NOT : MOP_IN ( OP_FAIL_LOOK_BEHIND_NOT ) ; STACK_POP_TIL_LOOK_BEHIND_NOT ; goto fail ; break ; # ifdef USE_SUBEXP_CALL case OP_CALL : MOP_IN ( OP_CALL ) ; GET_ABSADDR_INC ( addr , p ) ; STACK_PUSH_CALL_FRAME ( p ) ; p = reg -> p + addr ; MOP_OUT ; continue ; break ; case OP_RETURN : MOP_IN ( OP_RETURN ) ; STACK_RETURN ( p ) ; STACK_PUSH_RETURN ; MOP_OUT ; continue ; break ; # endif case OP_FINISH : goto finish ; break ; fail : MOP_OUT ; case OP_FAIL : MOP_IN ( OP_FAIL ) ; STACK_POP ; p = stk -> u . state . pcode ; s = stk -> u . state . pstr ; sprev = stk -> u . state . pstr_prev ; # ifdef USE_COMBINATION_EXPLOSION_CHECK if ( stk -> u . state . state_check != 0 ) { stk -> type = STK_STATE_CHECK_MARK ; stk ++ ; } # endif MOP_OUT ; continue ; break ; default : goto bytecode_error ; } sprev = sbegin ; } finish : STACK_SAVE ; return best_len ; # ifdef ONIG_DEBUG stack_error : STACK_SAVE ; return ONIGERR_STACK_BUG ; # endif bytecode_error : STACK_SAVE ; return ONIGERR_UNDEFINED_BYTECODE ; unexpected_bytecode_error : STACK_SAVE ; return ONIGERR_UNEXPECTED_BYTECODE ; }
| <S2SV_ModStart> OP_EXACT1 ) ; <S2SV_ModEnd> DATA_ENSURE ( 1 <S2SV_ModStart> ++ ; s <S2SV_ModEnd> ++ ; MOP_OUT
| kkos@oniguruma/690313a061f7a4fa614ec5cc8368b4f2284e059b | CVE-2017-9224 | https://github.com/kkos/oniguruma/commit/690313a061f7a4fa614ec5cc8368b4f2284e059b | 2017-05-24T15:29Z |