CVE ID
stringlengths
13
43
CVE Page
stringlengths
45
48
CWE ID
stringclasses
90 values
codeLink
stringlengths
46
139
commit_id
stringlengths
6
81
commit_message
stringlengths
3
13.3k
func_after
stringlengths
14
241k
func_before
stringlengths
14
241k
lang
stringclasses
3 values
project
stringclasses
309 values
vul
int8
0
1
CVE-2018-6151
https://www.cvedetails.com/cve/CVE-2018-6151/
CWE-125
https://github.com/chromium/chromium/commit/cbb2c0940d4e3914ccd74f6466ff4cb9e50e0e86
cbb2c0940d4e3914ccd74f6466ff4cb9e50e0e86
Don't downcast DownloadManagerDelegate to ChromeDownloadManagerDelegate. DownloadManager has public SetDelegate method and tests and or other subsystems can install their own implementations of the delegate. Bug: 805905 Change-Id: Iecf1e0aceada0e1048bed1e2d2ceb29ca64295b8 TBR: tests updated to follow the API change. Reviewed-on: https://chromium-review.googlesource.com/894702 Reviewed-by: David Vallet <[email protected]> Reviewed-by: Min Qin <[email protected]> Cr-Commit-Position: refs/heads/master@{#533515}
ClearReportingCacheTester(TestingProfile* profile, bool create_service) : profile_(profile) { if (create_service) service_ = std::make_unique<MockReportingService>(); net::URLRequestContext* request_context = profile_->GetRequestContext()->GetURLRequestContext(); old_service_ = request_context->reporting_service(); request_context->set_reporting_service(service_.get()); }
ClearReportingCacheTester(TestingProfile* profile, bool create_service) : profile_(profile) { if (create_service) service_ = std::make_unique<MockReportingService>(); net::URLRequestContext* request_context = profile_->GetRequestContext()->GetURLRequestContext(); old_service_ = request_context->reporting_service(); request_context->set_reporting_service(service_.get()); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/0b53a1df69a39e0663c9e4d651de402fc3d1d10a
0b53a1df69a39e0663c9e4d651de402fc3d1d10a
Turn on SyncedNotifications for Dev, Canary, and Unknown channel Turning it on in Dev and Canary will allow us to gather feedback during the development process. BUG=22205 Review URL: https://chromiumcodereview.appspot.com/12617010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@190089 0039d316-1c4b-4281-b951-d872f2087c98
ProfileSyncComponentsFactoryImpl::CreateBookmarkSyncComponents( ProfileSyncService* profile_sync_service, DataTypeErrorHandler* error_handler) { BookmarkModel* bookmark_model = BookmarkModelFactory::GetForProfile(profile_sync_service->profile()); syncer::UserShare* user_share = profile_sync_service->GetUserShare(); #if defined(OS_ANDROID) const bool kExpectMobileBookmarksFolder = true; #else const bool kExpectMobileBookmarksFolder = false; #endif BookmarkModelAssociator* model_associator = new BookmarkModelAssociator(bookmark_model, user_share, error_handler, kExpectMobileBookmarksFolder); BookmarkChangeProcessor* change_processor = new BookmarkChangeProcessor(model_associator, error_handler); return SyncComponents(model_associator, change_processor); }
ProfileSyncComponentsFactoryImpl::CreateBookmarkSyncComponents( ProfileSyncService* profile_sync_service, DataTypeErrorHandler* error_handler) { BookmarkModel* bookmark_model = BookmarkModelFactory::GetForProfile(profile_sync_service->profile()); syncer::UserShare* user_share = profile_sync_service->GetUserShare(); #if defined(OS_ANDROID) const bool kExpectMobileBookmarksFolder = true; #else const bool kExpectMobileBookmarksFolder = false; #endif BookmarkModelAssociator* model_associator = new BookmarkModelAssociator(bookmark_model, user_share, error_handler, kExpectMobileBookmarksFolder); BookmarkChangeProcessor* change_processor = new BookmarkChangeProcessor(model_associator, error_handler); return SyncComponents(model_associator, change_processor); }
C
Chrome
0
CVE-2016-2550
https://www.cvedetails.com/cve/CVE-2016-2550/
CWE-399
https://github.com/torvalds/linux/commit/415e3d3e90ce9e18727e8843ae343eda5a58fad6
415e3d3e90ce9e18727e8843ae343eda5a58fad6
unix: correctly track in-flight fds in sending process user_struct The commit referenced in the Fixes tag incorrectly accounted the number of in-flight fds over a unix domain socket to the original opener of the file-descriptor. This allows another process to arbitrary deplete the original file-openers resource limit for the maximum of open files. Instead the sending processes and its struct cred should be credited. To do so, we add a reference counted struct user_struct pointer to the scm_fp_list and use it to account for the number of inflight unix fds. Fixes: 712f4aad406bb1 ("unix: properly account for FDs passed over unix sockets") Reported-by: David Herrmann <[email protected]> Cc: David Herrmann <[email protected]> Cc: Willy Tarreau <[email protected]> Cc: Linus Torvalds <[email protected]> Suggested-by: Linus Torvalds <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void unix_dgram_peer_wake_disconnect_wakeup(struct sock *sk, struct sock *other) { unix_dgram_peer_wake_disconnect(sk, other); wake_up_interruptible_poll(sk_sleep(sk), POLLOUT | POLLWRNORM | POLLWRBAND); }
static void unix_dgram_peer_wake_disconnect_wakeup(struct sock *sk, struct sock *other) { unix_dgram_peer_wake_disconnect(sk, other); wake_up_interruptible_poll(sk_sleep(sk), POLLOUT | POLLWRNORM | POLLWRBAND); }
C
linux
0
CVE-2019-15922
https://www.cvedetails.com/cve/CVE-2019-15922/
CWE-476
https://github.com/torvalds/linux/commit/58ccd2d31e502c37e108b285bf3d343eb00c235b
58ccd2d31e502c37e108b285bf3d343eb00c235b
paride/pf: Fix potential NULL pointer dereference Syzkaller report this: pf: pf version 1.04, major 47, cluster 64, nice 0 pf: No ATAPI disk detected kasan: CONFIG_KASAN_INLINE enabled kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#1] SMP KASAN PTI CPU: 0 PID: 9887 Comm: syz-executor.0 Tainted: G C 5.1.0-rc3+ #8 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 RIP: 0010:pf_init+0x7af/0x1000 [pf] Code: 46 77 d2 48 89 d8 48 c1 e8 03 80 3c 28 00 74 08 48 89 df e8 03 25 a6 d2 4c 8b 23 49 8d bc 24 80 05 00 00 48 89 f8 48 c1 e8 03 <80> 3c 28 00 74 05 e8 e6 24 a6 d2 49 8b bc 24 80 05 00 00 e8 79 34 RSP: 0018:ffff8881abcbf998 EFLAGS: 00010202 RAX: 00000000000000b0 RBX: ffffffffc1e4a8a8 RCX: ffffffffaec50788 RDX: 0000000000039b10 RSI: ffffc9000153c000 RDI: 0000000000000580 RBP: dffffc0000000000 R08: ffffed103ee44e59 R09: ffffed103ee44e59 R10: 0000000000000001 R11: ffffed103ee44e58 R12: 0000000000000000 R13: ffffffffc1e4b028 R14: 0000000000000000 R15: 0000000000000020 FS: 00007f1b78a91700(0000) GS:ffff8881f7200000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00007f6d72b207f8 CR3: 00000001d5790004 CR4: 00000000007606f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 PKRU: 55555554 Call Trace: ? 0xffffffffc1e50000 do_one_initcall+0xbc/0x47d init/main.c:901 do_init_module+0x1b5/0x547 kernel/module.c:3456 load_module+0x6405/0x8c10 kernel/module.c:3804 __do_sys_finit_module+0x162/0x190 kernel/module.c:3898 do_syscall_64+0x9f/0x450 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x462e99 Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f1b78a90c58 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99 RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000003 RBP: 00007f1b78a90c70 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f1b78a916bc R13: 00000000004bcefa R14: 00000000006f6fb0 R15: 0000000000000004 Modules linked in: pf(+) paride gpio_tps65218 tps65218 i2c_cht_wc ati_remote dc395x act_meta_skbtcindex act_ife ife ecdh_generic rc_xbox_dvd sky81452_regulator v4l2_fwnode leds_blinkm snd_usb_hiface comedi(C) aes_ti slhc cfi_cmdset_0020 mtd cfi_util sx8654 mdio_gpio of_mdio fixed_phy mdio_bitbang libphy alcor_pci matrix_keymap hid_uclogic usbhid scsi_transport_fc videobuf2_v4l2 videobuf2_dma_sg snd_soc_pcm179x_spi snd_soc_pcm179x_codec i2c_demux_pinctrl mdev snd_indigodj isl6405 mii enc28j60 cmac adt7316_i2c(C) adt7316(C) fmc_trivial fmc nf_reject_ipv4 authenc rc_dtt200u rtc_ds1672 dvb_usb_dibusb_mc dvb_usb_dibusb_mc_common dib3000mc dibx000_common dvb_usb_dibusb_common dvb_usb dvb_core videobuf2_common videobuf2_vmalloc videobuf2_memops regulator_haptic adf7242 mac802154 ieee802154 s5h1409 da9034_ts snd_intel8x0m wmi cx24120 usbcore sdhci_cadence sdhci_pltfm sdhci mmc_core joydev i2c_algo_bit scsi_transport_iscsi iscsi_boot_sysfs ves1820 lockd grace nfs_acl auth_rpcgss sunrp c ip_vs snd_soc_adau7002 snd_cs4281 snd_rawmidi gameport snd_opl3_lib snd_seq_device snd_hwdep snd_ac97_codec ad7418 hid_primax hid snd_soc_cs4265 snd_soc_core snd_pcm_dmaengine snd_pcm snd_timer ac97_bus snd_compress snd soundcore ti_adc108s102 eeprom_93cx6 i2c_algo_pca mlxreg_hotplug st_pressure st_sensors industrialio_triggered_buffer kfifo_buf industrialio v4l2_common videodev media snd_soc_adau_utils rc_pinnacle_grey rc_core pps_gpio leds_lm3692x nandcore ledtrig_pattern iptable_security iptable_raw iptable_mangle iptable_nat nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 iptable_filter bpfilter ip6_vti ip_vti ip_gre ipip sit tunnel4 ip_tunnel hsr veth netdevsim vxcan batman_adv cfg80211 rfkill chnl_net caif nlmon dummy team bonding vcan bridge stp llc ip6_gre gre ip6_tunnel tunnel6 tun mousedev ppdev tpm kvm_intel kvm irqbypass crct10dif_pclmul crc32_pclmul crc32c_intel ghash_clmulni_intel aesni_intel ide_pci_generic aes_x86_64 piix crypto_simd input_leds psmouse cryp td glue_helper ide_core intel_agp serio_raw intel_gtt agpgart ata_generic i2c_piix4 pata_acpi parport_pc parport rtc_cmos floppy sch_fq_codel ip_tables x_tables sha1_ssse3 sha1_generic ipv6 [last unloaded: paride] Dumping ftrace buffer: (ftrace buffer empty) ---[ end trace 7a818cf5f210d79e ]--- If alloc_disk fails in pf_init_units, pf->disk will be NULL, however in pf_detect and pf_exit, it's not check this before free.It may result a NULL pointer dereference. Also when register_blkdev failed, blk_cleanup_queue() and blk_mq_free_tag_set() should be called to free resources. Reported-by: Hulk Robot <[email protected]> Fixes: 6ce59025f118 ("paride/pf: cleanup queues when detection fails") Signed-off-by: YueHaibing <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
static void __init pf_init_units(void) { struct pf_unit *pf; int unit; pf_drive_count = 0; for (unit = 0, pf = units; unit < PF_UNITS; unit++, pf++) { struct gendisk *disk; disk = alloc_disk(1); if (!disk) continue; disk->queue = blk_mq_init_sq_queue(&pf->tag_set, &pf_mq_ops, 1, BLK_MQ_F_SHOULD_MERGE); if (IS_ERR(disk->queue)) { put_disk(disk); disk->queue = NULL; continue; } INIT_LIST_HEAD(&pf->rq_list); disk->queue->queuedata = pf; blk_queue_max_segments(disk->queue, cluster); blk_queue_bounce_limit(disk->queue, BLK_BOUNCE_HIGH); pf->disk = disk; pf->pi = &pf->pia; pf->media_status = PF_NM; pf->drive = (*drives[unit])[D_SLV]; pf->lun = (*drives[unit])[D_LUN]; snprintf(pf->name, PF_NAMELEN, "%s%d", name, unit); disk->major = major; disk->first_minor = unit; strcpy(disk->disk_name, pf->name); disk->fops = &pf_fops; if (!(*drives[unit])[D_PRT]) pf_drive_count++; } }
static void __init pf_init_units(void) { struct pf_unit *pf; int unit; pf_drive_count = 0; for (unit = 0, pf = units; unit < PF_UNITS; unit++, pf++) { struct gendisk *disk; disk = alloc_disk(1); if (!disk) continue; disk->queue = blk_mq_init_sq_queue(&pf->tag_set, &pf_mq_ops, 1, BLK_MQ_F_SHOULD_MERGE); if (IS_ERR(disk->queue)) { put_disk(disk); disk->queue = NULL; continue; } INIT_LIST_HEAD(&pf->rq_list); disk->queue->queuedata = pf; blk_queue_max_segments(disk->queue, cluster); blk_queue_bounce_limit(disk->queue, BLK_BOUNCE_HIGH); pf->disk = disk; pf->pi = &pf->pia; pf->media_status = PF_NM; pf->drive = (*drives[unit])[D_SLV]; pf->lun = (*drives[unit])[D_LUN]; snprintf(pf->name, PF_NAMELEN, "%s%d", name, unit); disk->major = major; disk->first_minor = unit; strcpy(disk->disk_name, pf->name); disk->fops = &pf_fops; if (!(*drives[unit])[D_PRT]) pf_drive_count++; } }
C
linux
0
CVE-2013-2920
https://www.cvedetails.com/cve/CVE-2013-2920/
CWE-119
https://github.com/chromium/chromium/commit/3ca8e38ff57e83fcce76f9b54cd8f8bfa09c34ad
3ca8e38ff57e83fcce76f9b54cd8f8bfa09c34ad
Fix OOB read when parsing protocol-relative URLs BUG=285742 Review URL: https://chromiumcodereview.appspot.com/23902014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223735 0039d316-1c4b-4281-b951-d872f2087c98
bool DoResolveRelativePath(const char* base_url, const url_parse::Parsed& base_parsed, bool base_is_file, const CHAR* relative_url, const url_parse::Component& relative_component, CharsetConverter* query_converter, CanonOutput* output, url_parse::Parsed* out_parsed) { bool success = true; url_parse::Component path, query, ref; url_parse::ParsePathInternal(relative_url, relative_component, &path, &query, &ref); output->Append(base_url, base_parsed.path.begin); if (path.len > 0) { int true_path_begin = output->length(); int base_path_begin = base_parsed.path.begin; #ifdef WIN32 if (base_is_file) { base_path_begin = CopyBaseDriveSpecIfNecessary( base_url, base_parsed.path.begin, base_parsed.path.end(), relative_url, relative_component.begin, relative_component.end(), output); } #endif // WIN32 if (url_parse::IsURLSlash(relative_url[path.begin])) { success &= CanonicalizePath(relative_url, path, output, &out_parsed->path); } else { int path_begin = output->length(); CopyToLastSlash(base_url, base_path_begin, base_parsed.path.end(), output); success &= CanonicalizePartialPath(relative_url, path, path_begin, output); out_parsed->path = url_parse::MakeRange(path_begin, output->length()); } CanonicalizeQuery(relative_url, query, query_converter, output, &out_parsed->query); CanonicalizeRef(relative_url, ref, output, &out_parsed->ref); out_parsed->path = url_parse::MakeRange(true_path_begin, out_parsed->path.end()); return success; } CopyOneComponent(base_url, base_parsed.path, output, &out_parsed->path); if (query.is_valid()) { CanonicalizeQuery(relative_url, query, query_converter, output, &out_parsed->query); CanonicalizeRef(relative_url, ref, output, &out_parsed->ref); return success; } if (base_parsed.query.is_valid()) output->push_back('?'); CopyOneComponent(base_url, base_parsed.query, output, &out_parsed->query); if (ref.is_valid()) { CanonicalizeRef(relative_url, ref, output, &out_parsed->ref); return success; } DCHECK(false) << "Not reached"; return success; }
bool DoResolveRelativePath(const char* base_url, const url_parse::Parsed& base_parsed, bool base_is_file, const CHAR* relative_url, const url_parse::Component& relative_component, CharsetConverter* query_converter, CanonOutput* output, url_parse::Parsed* out_parsed) { bool success = true; url_parse::Component path, query, ref; url_parse::ParsePathInternal(relative_url, relative_component, &path, &query, &ref); output->Append(base_url, base_parsed.path.begin); if (path.len > 0) { int true_path_begin = output->length(); int base_path_begin = base_parsed.path.begin; #ifdef WIN32 if (base_is_file) { base_path_begin = CopyBaseDriveSpecIfNecessary( base_url, base_parsed.path.begin, base_parsed.path.end(), relative_url, relative_component.begin, relative_component.end(), output); } #endif // WIN32 if (url_parse::IsURLSlash(relative_url[path.begin])) { success &= CanonicalizePath(relative_url, path, output, &out_parsed->path); } else { int path_begin = output->length(); CopyToLastSlash(base_url, base_path_begin, base_parsed.path.end(), output); success &= CanonicalizePartialPath(relative_url, path, path_begin, output); out_parsed->path = url_parse::MakeRange(path_begin, output->length()); } CanonicalizeQuery(relative_url, query, query_converter, output, &out_parsed->query); CanonicalizeRef(relative_url, ref, output, &out_parsed->ref); out_parsed->path = url_parse::MakeRange(true_path_begin, out_parsed->path.end()); return success; } CopyOneComponent(base_url, base_parsed.path, output, &out_parsed->path); if (query.is_valid()) { CanonicalizeQuery(relative_url, query, query_converter, output, &out_parsed->query); CanonicalizeRef(relative_url, ref, output, &out_parsed->ref); return success; } if (base_parsed.query.is_valid()) output->push_back('?'); CopyOneComponent(base_url, base_parsed.query, output, &out_parsed->query); if (ref.is_valid()) { CanonicalizeRef(relative_url, ref, output, &out_parsed->ref); return success; } DCHECK(false) << "Not reached"; return success; }
C
Chrome
0
CVE-2018-11590
https://www.cvedetails.com/cve/CVE-2018-11590/
CWE-190
https://github.com/espruino/Espruino/commit/a0d7f432abee692402c00e8b615ff5982dde9780
a0d7f432abee692402c00e8b615ff5982dde9780
Fix stack size detection on Linux (fix #1427)
bool isWhitespace(char ch) { return (ch==0x09) || // \t - tab (ch==0x0B) || // vertical tab (ch==0x0C) || // form feed (ch==0x20) || // space (ch=='\n') || (ch=='\r'); }
bool isWhitespace(char ch) { return (ch==0x09) || // \t - tab (ch==0x0B) || // vertical tab (ch==0x0C) || // form feed (ch==0x20) || // space (ch=='\n') || (ch=='\r'); }
C
Espruino
0
CVE-2016-5093
https://www.cvedetails.com/cve/CVE-2016-5093/
CWE-125
https://github.com/php/php-src/commit/97eff7eb57fc2320c267a949cffd622c38712484?w=1
97eff7eb57fc2320c267a949cffd622c38712484?w=1
Fix bug #72241: get_icu_value_internal out-of-bounds read
PHP_NAMED_FUNCTION(zif_locale_get_default) { RETURN_STRING( intl_locale_get_default( TSRMLS_C ), TRUE ); }
PHP_NAMED_FUNCTION(zif_locale_get_default) { RETURN_STRING( intl_locale_get_default( TSRMLS_C ), TRUE ); }
C
php-src
0
CVE-2016-5199
https://www.cvedetails.com/cve/CVE-2016-5199/
CWE-119
https://github.com/chromium/chromium/commit/c995d4fe5e96f4d6d4a88b7867279b08e72d2579
c995d4fe5e96f4d6d4a88b7867279b08e72d2579
Move IsDataSaverEnabledByUser to be a static method and use it This method now officially becomes the source of truth that everything in the code base eventually calls into to determine whether or not DataSaver is enabled. Bug: 934399 Change-Id: Iae837b710ace8cc3101188f79d02cbc2d4f0fd93 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1537242 Reviewed-by: Joshua Pawlicki <[email protected]> Reviewed-by: Tarun Bansal <[email protected]> Commit-Queue: Robert Ogden <[email protected]> Cr-Commit-Position: refs/heads/master@{#643948}
PrefService* DataReductionProxySettings::GetOriginalProfilePrefs() { PrefService* DataReductionProxySettings::GetOriginalProfilePrefs() const { DCHECK(thread_checker_.CalledOnValidThread()); return prefs_; }
PrefService* DataReductionProxySettings::GetOriginalProfilePrefs() { DCHECK(thread_checker_.CalledOnValidThread()); return prefs_; }
C
Chrome
1
CVE-2016-1679
https://www.cvedetails.com/cve/CVE-2016-1679/
null
https://github.com/chromium/chromium/commit/b5bdf3778209179111c9f865af00940e74aa20e7
b5bdf3778209179111c9f865af00940e74aa20e7
V8ValueConverter::ToV8Value should not trigger setters BUG=606390 Review URL: https://codereview.chromium.org/1918793003 Cr-Commit-Position: refs/heads/master@{#390045}
bool HasReachedMaxRecursionDepth() { return max_recursion_depth_ < 0; }
bool HasReachedMaxRecursionDepth() { return max_recursion_depth_ < 0; }
C
Chrome
0
CVE-2018-14395
https://www.cvedetails.com/cve/CVE-2018-14395/
CWE-369
https://github.com/FFmpeg/FFmpeg/commit/fa19fbcf712a6a6cc5a5cfdc3254a97b9bce6582
fa19fbcf712a6a6cc5a5cfdc3254a97b9bce6582
avformat/movenc: Write version 2 of audio atom if channels is not known The version 1 needs the channel count and would divide by 0 Fixes: division by 0 Fixes: fpe_movenc.c_1108_1.ogg Fixes: fpe_movenc.c_1108_2.ogg Fixes: fpe_movenc.c_1108_3.wav Found-by: #CHEN HONGXU# <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]>
static int mov_write_trailer(AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; AVIOContext *pb = s->pb; int res = 0; int i; int64_t moov_pos; if (mov->need_rewrite_extradata) { for (i = 0; i < s->nb_streams; i++) { MOVTrack *track = &mov->tracks[i]; AVCodecParameters *par = track->par; track->vos_len = par->extradata_size; track->vos_data = av_malloc(track->vos_len); if (!track->vos_data) return AVERROR(ENOMEM); memcpy(track->vos_data, par->extradata, track->vos_len); } mov->need_rewrite_extradata = 0; } /* * Before actually writing the trailer, make sure that there are no * dangling subtitles, that need a terminating sample. */ for (i = 0; i < mov->nb_streams; i++) { MOVTrack *trk = &mov->tracks[i]; if (trk->par->codec_id == AV_CODEC_ID_MOV_TEXT && !trk->last_sample_is_subtitle_end) { mov_write_subtitle_end_packet(s, i, trk->track_duration); trk->last_sample_is_subtitle_end = 1; } } if (!mov->chapter_track && !(mov->flags & FF_MOV_FLAG_FRAGMENT)) { if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters) { mov->chapter_track = mov->nb_streams++; if ((res = mov_create_chapter_track(s, mov->chapter_track)) < 0) return res; } } if (!(mov->flags & FF_MOV_FLAG_FRAGMENT)) { moov_pos = avio_tell(pb); /* Write size of mdat tag */ if (mov->mdat_size + 8 <= UINT32_MAX) { avio_seek(pb, mov->mdat_pos, SEEK_SET); avio_wb32(pb, mov->mdat_size + 8); } else { /* overwrite 'wide' placeholder atom */ avio_seek(pb, mov->mdat_pos - 8, SEEK_SET); /* special value: real atom size will be 64 bit value after * tag field */ avio_wb32(pb, 1); ffio_wfourcc(pb, "mdat"); avio_wb64(pb, mov->mdat_size + 16); } avio_seek(pb, mov->reserved_moov_size > 0 ? mov->reserved_header_pos : moov_pos, SEEK_SET); if (mov->flags & FF_MOV_FLAG_FASTSTART) { av_log(s, AV_LOG_INFO, "Starting second pass: moving the moov atom to the beginning of the file\n"); res = shift_data(s); if (res < 0) return res; avio_seek(pb, mov->reserved_header_pos, SEEK_SET); if ((res = mov_write_moov_tag(pb, mov, s)) < 0) return res; } else if (mov->reserved_moov_size > 0) { int64_t size; if ((res = mov_write_moov_tag(pb, mov, s)) < 0) return res; size = mov->reserved_moov_size - (avio_tell(pb) - mov->reserved_header_pos); if (size < 8){ av_log(s, AV_LOG_ERROR, "reserved_moov_size is too small, needed %"PRId64" additional\n", 8-size); return AVERROR(EINVAL); } avio_wb32(pb, size); ffio_wfourcc(pb, "free"); ffio_fill(pb, 0, size - 8); avio_seek(pb, moov_pos, SEEK_SET); } else { if ((res = mov_write_moov_tag(pb, mov, s)) < 0) return res; } res = 0; } else { mov_auto_flush_fragment(s, 1); for (i = 0; i < mov->nb_streams; i++) mov->tracks[i].data_offset = 0; if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) { int64_t end; av_log(s, AV_LOG_INFO, "Starting second pass: inserting sidx atoms\n"); res = shift_data(s); if (res < 0) return res; end = avio_tell(pb); avio_seek(pb, mov->reserved_header_pos, SEEK_SET); mov_write_sidx_tags(pb, mov, -1, 0); avio_seek(pb, end, SEEK_SET); avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_TRAILER); mov_write_mfra_tag(pb, mov); } else if (!(mov->flags & FF_MOV_FLAG_SKIP_TRAILER)) { avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_TRAILER); mov_write_mfra_tag(pb, mov); } } return res; }
static int mov_write_trailer(AVFormatContext *s) { MOVMuxContext *mov = s->priv_data; AVIOContext *pb = s->pb; int res = 0; int i; int64_t moov_pos; if (mov->need_rewrite_extradata) { for (i = 0; i < s->nb_streams; i++) { MOVTrack *track = &mov->tracks[i]; AVCodecParameters *par = track->par; track->vos_len = par->extradata_size; track->vos_data = av_malloc(track->vos_len); if (!track->vos_data) return AVERROR(ENOMEM); memcpy(track->vos_data, par->extradata, track->vos_len); } mov->need_rewrite_extradata = 0; } /* * Before actually writing the trailer, make sure that there are no * dangling subtitles, that need a terminating sample. */ for (i = 0; i < mov->nb_streams; i++) { MOVTrack *trk = &mov->tracks[i]; if (trk->par->codec_id == AV_CODEC_ID_MOV_TEXT && !trk->last_sample_is_subtitle_end) { mov_write_subtitle_end_packet(s, i, trk->track_duration); trk->last_sample_is_subtitle_end = 1; } } if (!mov->chapter_track && !(mov->flags & FF_MOV_FLAG_FRAGMENT)) { if (mov->mode & (MODE_MP4|MODE_MOV|MODE_IPOD) && s->nb_chapters) { mov->chapter_track = mov->nb_streams++; if ((res = mov_create_chapter_track(s, mov->chapter_track)) < 0) return res; } } if (!(mov->flags & FF_MOV_FLAG_FRAGMENT)) { moov_pos = avio_tell(pb); /* Write size of mdat tag */ if (mov->mdat_size + 8 <= UINT32_MAX) { avio_seek(pb, mov->mdat_pos, SEEK_SET); avio_wb32(pb, mov->mdat_size + 8); } else { /* overwrite 'wide' placeholder atom */ avio_seek(pb, mov->mdat_pos - 8, SEEK_SET); /* special value: real atom size will be 64 bit value after * tag field */ avio_wb32(pb, 1); ffio_wfourcc(pb, "mdat"); avio_wb64(pb, mov->mdat_size + 16); } avio_seek(pb, mov->reserved_moov_size > 0 ? mov->reserved_header_pos : moov_pos, SEEK_SET); if (mov->flags & FF_MOV_FLAG_FASTSTART) { av_log(s, AV_LOG_INFO, "Starting second pass: moving the moov atom to the beginning of the file\n"); res = shift_data(s); if (res < 0) return res; avio_seek(pb, mov->reserved_header_pos, SEEK_SET); if ((res = mov_write_moov_tag(pb, mov, s)) < 0) return res; } else if (mov->reserved_moov_size > 0) { int64_t size; if ((res = mov_write_moov_tag(pb, mov, s)) < 0) return res; size = mov->reserved_moov_size - (avio_tell(pb) - mov->reserved_header_pos); if (size < 8){ av_log(s, AV_LOG_ERROR, "reserved_moov_size is too small, needed %"PRId64" additional\n", 8-size); return AVERROR(EINVAL); } avio_wb32(pb, size); ffio_wfourcc(pb, "free"); ffio_fill(pb, 0, size - 8); avio_seek(pb, moov_pos, SEEK_SET); } else { if ((res = mov_write_moov_tag(pb, mov, s)) < 0) return res; } res = 0; } else { mov_auto_flush_fragment(s, 1); for (i = 0; i < mov->nb_streams; i++) mov->tracks[i].data_offset = 0; if (mov->flags & FF_MOV_FLAG_GLOBAL_SIDX) { int64_t end; av_log(s, AV_LOG_INFO, "Starting second pass: inserting sidx atoms\n"); res = shift_data(s); if (res < 0) return res; end = avio_tell(pb); avio_seek(pb, mov->reserved_header_pos, SEEK_SET); mov_write_sidx_tags(pb, mov, -1, 0); avio_seek(pb, end, SEEK_SET); avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_TRAILER); mov_write_mfra_tag(pb, mov); } else if (!(mov->flags & FF_MOV_FLAG_SKIP_TRAILER)) { avio_write_marker(s->pb, AV_NOPTS_VALUE, AVIO_DATA_MARKER_TRAILER); mov_write_mfra_tag(pb, mov); } } return res; }
C
FFmpeg
0
CVE-2011-4621
https://www.cvedetails.com/cve/CVE-2011-4621/
null
https://github.com/torvalds/linux/commit/f26f9aff6aaf67e9a430d16c266f91b13a5bff64
f26f9aff6aaf67e9a430d16c266f91b13a5bff64
Sched: fix skip_clock_update optimization idle_balance() drops/retakes rq->lock, leaving the previous task vulnerable to set_tsk_need_resched(). Clear it after we return from balancing instead, and in setup_thread_stack() as well, so no successfully descheduled or never scheduled task has it set. Need resched confused the skip_clock_update logic, which assumes that the next call to update_rq_clock() will come nearly immediately after being set. Make the optimization robust against the waking a sleeper before it sucessfully deschedules case by checking that the current task has not been dequeued before setting the flag, since it is that useless clock update we're trying to save, and clear unconditionally in schedule() proper instead of conditionally in put_prev_task(). Signed-off-by: Mike Galbraith <[email protected]> Reported-by: Bjoern B. Brandenburg <[email protected]> Tested-by: Yong Zhang <[email protected]> Signed-off-by: Peter Zijlstra <[email protected]> Cc: [email protected] LKML-Reference: <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
static inline struct cpuacct *cgroup_ca(struct cgroup *cgrp) { return container_of(cgroup_subsys_state(cgrp, cpuacct_subsys_id), struct cpuacct, css); }
static inline struct cpuacct *cgroup_ca(struct cgroup *cgrp) { return container_of(cgroup_subsys_state(cgrp, cpuacct_subsys_id), struct cpuacct, css); }
C
linux
0
CVE-2014-9718
https://www.cvedetails.com/cve/CVE-2014-9718/
CWE-399
https://git.qemu.org/?p=qemu.git;a=commit;h=3251bdcf1c67427d964517053c3d185b46e618e8
3251bdcf1c67427d964517053c3d185b46e618e8
null
static bool cmd_read_pio(IDEState *s, uint8_t cmd) { bool lba48 = (cmd == WIN_READ_EXT); if (s->drive_kind == IDE_CD) { ide_set_signature(s); /* odd, but ATA4 8.27.5.2 requires it */ ide_abort_command(s); return true; } if (!s->blk) { ide_abort_command(s); return true; } ide_cmd_lba48_transform(s, lba48); s->req_nb_sectors = 1; ide_sector_read(s); return false; }
static bool cmd_read_pio(IDEState *s, uint8_t cmd) { bool lba48 = (cmd == WIN_READ_EXT); if (s->drive_kind == IDE_CD) { ide_set_signature(s); /* odd, but ATA4 8.27.5.2 requires it */ ide_abort_command(s); return true; } if (!s->blk) { ide_abort_command(s); return true; } ide_cmd_lba48_transform(s, lba48); s->req_nb_sectors = 1; ide_sector_read(s); return false; }
C
qemu
0
CVE-2014-3173
https://www.cvedetails.com/cve/CVE-2014-3173/
CWE-119
https://github.com/chromium/chromium/commit/ee7579229ff7e9e5ae28bf53aea069251499d7da
ee7579229ff7e9e5ae28bf53aea069251499d7da
Framebuffer clear() needs to consider the situation some draw buffers are disabled. This is when we expose DrawBuffers extension. BUG=376951 TEST=the attached test case, webgl conformance [email protected],[email protected] Review URL: https://codereview.chromium.org/315283002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275338 0039d316-1c4b-4281-b951-d872f2087c98
void GLES2DecoderImpl::DoDidUseTexImageIfNeeded( Texture* texture, GLenum textarget) { if (texture && !texture->IsAttachedToFramebuffer()) { gfx::GLImage* image = texture->GetLevelImage(textarget, 0); if (image) { ScopedGLErrorSuppressor suppressor( "GLES2DecoderImpl::DoDidUseTexImageIfNeeded", GetErrorState()); glBindTexture(textarget, texture->service_id()); image->DidUseTexImage(); RestoreCurrentTextureBindings(&state_, textarget); } } }
void GLES2DecoderImpl::DoDidUseTexImageIfNeeded( Texture* texture, GLenum textarget) { if (texture && !texture->IsAttachedToFramebuffer()) { gfx::GLImage* image = texture->GetLevelImage(textarget, 0); if (image) { ScopedGLErrorSuppressor suppressor( "GLES2DecoderImpl::DoDidUseTexImageIfNeeded", GetErrorState()); glBindTexture(textarget, texture->service_id()); image->DidUseTexImage(); RestoreCurrentTextureBindings(&state_, textarget); } } }
C
Chrome
0
CVE-2019-13225
https://www.cvedetails.com/cve/CVE-2019-13225/
CWE-476
https://github.com/kkos/oniguruma/commit/c509265c5f6ae7264f7b8a8aae1cfa5fc59d108c
c509265c5f6ae7264f7b8a8aae1cfa5fc59d108c
Fix CVE-2019-13225: problem in converting if-then-else pattern to bytecode.
expand_case_fold_make_rem_string(Node** rnode, UChar *s, UChar *end, regex_t* reg) { int r; Node *node; node = onig_node_new_str(s, end); if (IS_NULL(node)) return ONIGERR_MEMORY; r = update_string_node_case_fold(reg, node); if (r != 0) { onig_node_free(node); return r; } NODE_STRING_SET_AMBIG(node); NODE_STRING_SET_DONT_GET_OPT_INFO(node); *rnode = node; return 0; }
expand_case_fold_make_rem_string(Node** rnode, UChar *s, UChar *end, regex_t* reg) { int r; Node *node; node = onig_node_new_str(s, end); if (IS_NULL(node)) return ONIGERR_MEMORY; r = update_string_node_case_fold(reg, node); if (r != 0) { onig_node_free(node); return r; } NODE_STRING_SET_AMBIG(node); NODE_STRING_SET_DONT_GET_OPT_INFO(node); *rnode = node; return 0; }
C
oniguruma
0
CVE-2013-4516
https://www.cvedetails.com/cve/CVE-2013-4516/
CWE-200
https://github.com/torvalds/linux/commit/a8b33654b1e3b0c74d4a1fed041c9aae50b3c427
a8b33654b1e3b0c74d4a1fed041c9aae50b3c427
Staging: sb105x: info leak in mp_get_count() The icount.reserved[] array isn't initialized so it leaks stack information to userspace. Reported-by: Nico Golde <[email protected]> Reported-by: Fabian Yamaguchi <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Cc: [email protected] Signed-off-by: Linus Torvalds <[email protected]>
static inline void mp_update_mctrl(struct sb_uart_port *port, unsigned int set, unsigned int clear) { unsigned int old; old = port->mctrl; port->mctrl = (old & ~clear) | set; if (old != port->mctrl) port->ops->set_mctrl(port, port->mctrl); }
static inline void mp_update_mctrl(struct sb_uart_port *port, unsigned int set, unsigned int clear) { unsigned int old; old = port->mctrl; port->mctrl = (old & ~clear) | set; if (old != port->mctrl) port->ops->set_mctrl(port, port->mctrl); }
C
linux
0
CVE-2016-1583
https://www.cvedetails.com/cve/CVE-2016-1583/
CWE-119
https://github.com/torvalds/linux/commit/f5364c150aa645b3d7daa21b5c0b9feaa1c9cd6d
f5364c150aa645b3d7daa21b5c0b9feaa1c9cd6d
Merge branch 'stacking-fixes' (vfs stacking fixes from Jann) Merge filesystem stacking fixes from Jann Horn. * emailed patches from Jann Horn <[email protected]>: sched: panic on corrupted stack end ecryptfs: forbid opening files without mmap handler proc: prevent stacking filesystems on top
static void ttwu_queue(struct task_struct *p, int cpu, int wake_flags) { struct rq *rq = cpu_rq(cpu); struct pin_cookie cookie; #if defined(CONFIG_SMP) if (sched_feat(TTWU_QUEUE) && !cpus_share_cache(smp_processor_id(), cpu)) { sched_clock_cpu(cpu); /* sync clocks x-cpu */ ttwu_queue_remote(p, cpu, wake_flags); return; } #endif raw_spin_lock(&rq->lock); cookie = lockdep_pin_lock(&rq->lock); ttwu_do_activate(rq, p, wake_flags, cookie); lockdep_unpin_lock(&rq->lock, cookie); raw_spin_unlock(&rq->lock); }
static void ttwu_queue(struct task_struct *p, int cpu, int wake_flags) { struct rq *rq = cpu_rq(cpu); struct pin_cookie cookie; #if defined(CONFIG_SMP) if (sched_feat(TTWU_QUEUE) && !cpus_share_cache(smp_processor_id(), cpu)) { sched_clock_cpu(cpu); /* sync clocks x-cpu */ ttwu_queue_remote(p, cpu, wake_flags); return; } #endif raw_spin_lock(&rq->lock); cookie = lockdep_pin_lock(&rq->lock); ttwu_do_activate(rq, p, wake_flags, cookie); lockdep_unpin_lock(&rq->lock, cookie); raw_spin_unlock(&rq->lock); }
C
linux
0
CVE-2011-2793
https://www.cvedetails.com/cve/CVE-2011-2793/
CWE-399
https://github.com/chromium/chromium/commit/a6e146b4a369b31afa4c4323cc813dcbe0ef0c2b
a6e146b4a369b31afa4c4323cc813dcbe0ef0c2b
Use URLFetcher::Create instead of new in http_bridge.cc. This change modified http_bridge so that it uses a factory to construct the URLFetcher. Moreover, it modified sync_backend_host_unittest.cc to use an URLFetcher factory which will prevent access to www.example.com during the test. BUG=none TEST=sync_backend_host_unittest.cc Review URL: http://codereview.chromium.org/7053011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@87227 0039d316-1c4b-4281-b951-d872f2087c98
void HttpBridge::SetUserAgent(const char* user_agent) { DCHECK_EQ(MessageLoop::current(), created_on_loop_); if (DCHECK_IS_ON()) { base::AutoLock lock(fetch_state_lock_); DCHECK(!fetch_state_.request_completed); } context_getter_for_request_->set_user_agent(user_agent); }
void HttpBridge::SetUserAgent(const char* user_agent) { DCHECK_EQ(MessageLoop::current(), created_on_loop_); if (DCHECK_IS_ON()) { base::AutoLock lock(fetch_state_lock_); DCHECK(!fetch_state_.request_completed); } context_getter_for_request_->set_user_agent(user_agent); }
C
Chrome
0
CVE-2011-2351
https://www.cvedetails.com/cve/CVE-2011-2351/
CWE-399
https://github.com/chromium/chromium/commit/bf381d8a02c3d272d4dd879ac719d8993dfb5ad6
bf381d8a02c3d272d4dd879ac719d8993dfb5ad6
Enable HistoryModelWorker by default, now that bug 69561 is fixed. BUG=69561 TEST=Run sync manually and run integration tests, sync should not crash. Review URL: http://codereview.chromium.org/7016007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85211 0039d316-1c4b-4281-b951-d872f2087c98
virtual void DoneRunOnMainThread() {}
virtual void DoneRunOnMainThread() {}
C
Chrome
0
CVE-2017-9059
https://www.cvedetails.com/cve/CVE-2017-9059/
CWE-404
https://github.com/torvalds/linux/commit/c70422f760c120480fee4de6c38804c72aa26bc1
c70422f760c120480fee4de6c38804c72aa26bc1
Merge tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux Pull nfsd updates from Bruce Fields: "Another RDMA update from Chuck Lever, and a bunch of miscellaneous bugfixes" * tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux: (26 commits) nfsd: Fix up the "supattr_exclcreat" attributes nfsd: encoders mustn't use unitialized values in error cases nfsd: fix undefined behavior in nfsd4_layout_verify lockd: fix lockd shutdown race NFSv4: Fix callback server shutdown SUNRPC: Refactor svc_set_num_threads() NFSv4.x/callback: Create the callback service through svc_create_pooled lockd: remove redundant check on block svcrdma: Clean out old XDR encoders svcrdma: Remove the req_map cache svcrdma: Remove unused RDMA Write completion handler svcrdma: Reduce size of sge array in struct svc_rdma_op_ctxt svcrdma: Clean up RPC-over-RDMA backchannel reply processing svcrdma: Report Write/Reply chunk overruns svcrdma: Clean up RDMA_ERROR path svcrdma: Use rdma_rw API in RPC reply path svcrdma: Introduce local rdma_rw API helpers svcrdma: Clean up svc_rdma_get_inv_rkey() svcrdma: Add helper to save pages under I/O svcrdma: Eliminate RPCRDMA_SQ_DEPTH_MULT ...
decode_fh(__be32 *p, struct svc_fh *fhp) { unsigned int size; fh_init(fhp, NFS3_FHSIZE); size = ntohl(*p++); if (size > NFS3_FHSIZE) return NULL; memcpy(&fhp->fh_handle.fh_base, p, size); fhp->fh_handle.fh_size = size; return p + XDR_QUADLEN(size); }
decode_fh(__be32 *p, struct svc_fh *fhp) { unsigned int size; fh_init(fhp, NFS3_FHSIZE); size = ntohl(*p++); if (size > NFS3_FHSIZE) return NULL; memcpy(&fhp->fh_handle.fh_base, p, size); fhp->fh_handle.fh_size = size; return p + XDR_QUADLEN(size); }
C
linux
0
CVE-2013-7456
https://www.cvedetails.com/cve/CVE-2013-7456/
CWE-125
https://github.com/php/php-src/commit/7a1aac3343af85b4af4df5f8844946eaa27394ab?w=1
7a1aac3343af85b4af4df5f8844946eaa27394ab?w=1
Fixed bug #72227: imagescale out-of-bounds read Ported from https://github.com/libgd/libgd/commit/4f65a3e4eedaffa1efcf9ee1eb08f0b504fbc31a
gdImagePtr Scale(const gdImagePtr src, const unsigned int src_width, const unsigned int src_height, const gdImagePtr dst, const unsigned int new_width, const unsigned int new_height) { gdImagePtr tmp_im; tmp_im = gdImageCreateTrueColor(new_width, src_height); if (tmp_im == NULL) { return NULL; } gdImageSetInterpolationMethod(tmp_im, src->interpolation_id); _gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height); _gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height); gdFree(tmp_im); return dst; }
gdImagePtr Scale(const gdImagePtr src, const unsigned int src_width, const unsigned int src_height, const gdImagePtr dst, const unsigned int new_width, const unsigned int new_height) { gdImagePtr tmp_im; tmp_im = gdImageCreateTrueColor(new_width, src_height); if (tmp_im == NULL) { return NULL; } gdImageSetInterpolationMethod(tmp_im, src->interpolation_id); _gdScaleHoriz(src, src_width, src_height, tmp_im, new_width, src_height); _gdScaleVert(tmp_im, new_width, src_height, dst, new_width, new_height); gdFree(tmp_im); return dst; }
C
libgd
0
CVE-2014-9922
https://www.cvedetails.com/cve/CVE-2014-9922/
CWE-264
https://github.com/torvalds/linux/commit/69c433ed2ecd2d3264efd7afec4439524b319121
69c433ed2ecd2d3264efd7afec4439524b319121
fs: limit filesystem stacking depth Add a simple read-only counter to super_block that indicates how deep this is in the stack of filesystems. Previously ecryptfs was the only stackable filesystem and it explicitly disallowed multiple layers of itself. Overlayfs, however, can be stacked recursively and also may be stacked on top of ecryptfs or vice versa. To limit the kernel stack usage we must limit the depth of the filesystem stack. Initially the limit is set to 2. Signed-off-by: Miklos Szeredi <[email protected]>
static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *raw_data) { struct super_block *s; struct ecryptfs_sb_info *sbi; struct ecryptfs_dentry_info *root_info; const char *err = "Getting sb failed"; struct inode *inode; struct path path; uid_t check_ruid; int rc; sbi = kmem_cache_zalloc(ecryptfs_sb_info_cache, GFP_KERNEL); if (!sbi) { rc = -ENOMEM; goto out; } rc = ecryptfs_parse_options(sbi, raw_data, &check_ruid); if (rc) { err = "Error parsing options"; goto out; } s = sget(fs_type, NULL, set_anon_super, flags, NULL); if (IS_ERR(s)) { rc = PTR_ERR(s); goto out; } rc = bdi_setup_and_register(&sbi->bdi, "ecryptfs", BDI_CAP_MAP_COPY); if (rc) goto out1; ecryptfs_set_superblock_private(s, sbi); s->s_bdi = &sbi->bdi; /* ->kill_sb() will take care of sbi after that point */ sbi = NULL; s->s_op = &ecryptfs_sops; s->s_d_op = &ecryptfs_dops; err = "Reading sb failed"; rc = kern_path(dev_name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path); if (rc) { ecryptfs_printk(KERN_WARNING, "kern_path() failed\n"); goto out1; } if (path.dentry->d_sb->s_type == &ecryptfs_fs_type) { rc = -EINVAL; printk(KERN_ERR "Mount on filesystem of type " "eCryptfs explicitly disallowed due to " "known incompatibilities\n"); goto out_free; } if (check_ruid && !uid_eq(path.dentry->d_inode->i_uid, current_uid())) { rc = -EPERM; printk(KERN_ERR "Mount of device (uid: %d) not owned by " "requested user (uid: %d)\n", i_uid_read(path.dentry->d_inode), from_kuid(&init_user_ns, current_uid())); goto out_free; } ecryptfs_set_superblock_lower(s, path.dentry->d_sb); /** * Set the POSIX ACL flag based on whether they're enabled in the lower * mount. Force a read-only eCryptfs mount if the lower mount is ro. * Allow a ro eCryptfs mount even when the lower mount is rw. */ s->s_flags = flags & ~MS_POSIXACL; s->s_flags |= path.dentry->d_sb->s_flags & (MS_RDONLY | MS_POSIXACL); s->s_maxbytes = path.dentry->d_sb->s_maxbytes; s->s_blocksize = path.dentry->d_sb->s_blocksize; s->s_magic = ECRYPTFS_SUPER_MAGIC; s->s_stack_depth = path.dentry->d_sb->s_stack_depth + 1; rc = -EINVAL; if (s->s_stack_depth > FILESYSTEM_MAX_STACK_DEPTH) { pr_err("eCryptfs: maximum fs stacking depth exceeded\n"); goto out_free; } inode = ecryptfs_get_inode(path.dentry->d_inode, s); rc = PTR_ERR(inode); if (IS_ERR(inode)) goto out_free; s->s_root = d_make_root(inode); if (!s->s_root) { rc = -ENOMEM; goto out_free; } rc = -ENOMEM; root_info = kmem_cache_zalloc(ecryptfs_dentry_info_cache, GFP_KERNEL); if (!root_info) goto out_free; /* ->kill_sb() will take care of root_info */ ecryptfs_set_dentry_private(s->s_root, root_info); root_info->lower_path = path; s->s_flags |= MS_ACTIVE; return dget(s->s_root); out_free: path_put(&path); out1: deactivate_locked_super(s); out: if (sbi) { ecryptfs_destroy_mount_crypt_stat(&sbi->mount_crypt_stat); kmem_cache_free(ecryptfs_sb_info_cache, sbi); } printk(KERN_ERR "%s; rc = [%d]\n", err, rc); return ERR_PTR(rc); }
static struct dentry *ecryptfs_mount(struct file_system_type *fs_type, int flags, const char *dev_name, void *raw_data) { struct super_block *s; struct ecryptfs_sb_info *sbi; struct ecryptfs_dentry_info *root_info; const char *err = "Getting sb failed"; struct inode *inode; struct path path; uid_t check_ruid; int rc; sbi = kmem_cache_zalloc(ecryptfs_sb_info_cache, GFP_KERNEL); if (!sbi) { rc = -ENOMEM; goto out; } rc = ecryptfs_parse_options(sbi, raw_data, &check_ruid); if (rc) { err = "Error parsing options"; goto out; } s = sget(fs_type, NULL, set_anon_super, flags, NULL); if (IS_ERR(s)) { rc = PTR_ERR(s); goto out; } rc = bdi_setup_and_register(&sbi->bdi, "ecryptfs", BDI_CAP_MAP_COPY); if (rc) goto out1; ecryptfs_set_superblock_private(s, sbi); s->s_bdi = &sbi->bdi; /* ->kill_sb() will take care of sbi after that point */ sbi = NULL; s->s_op = &ecryptfs_sops; s->s_d_op = &ecryptfs_dops; err = "Reading sb failed"; rc = kern_path(dev_name, LOOKUP_FOLLOW | LOOKUP_DIRECTORY, &path); if (rc) { ecryptfs_printk(KERN_WARNING, "kern_path() failed\n"); goto out1; } if (path.dentry->d_sb->s_type == &ecryptfs_fs_type) { rc = -EINVAL; printk(KERN_ERR "Mount on filesystem of type " "eCryptfs explicitly disallowed due to " "known incompatibilities\n"); goto out_free; } if (check_ruid && !uid_eq(path.dentry->d_inode->i_uid, current_uid())) { rc = -EPERM; printk(KERN_ERR "Mount of device (uid: %d) not owned by " "requested user (uid: %d)\n", i_uid_read(path.dentry->d_inode), from_kuid(&init_user_ns, current_uid())); goto out_free; } ecryptfs_set_superblock_lower(s, path.dentry->d_sb); /** * Set the POSIX ACL flag based on whether they're enabled in the lower * mount. Force a read-only eCryptfs mount if the lower mount is ro. * Allow a ro eCryptfs mount even when the lower mount is rw. */ s->s_flags = flags & ~MS_POSIXACL; s->s_flags |= path.dentry->d_sb->s_flags & (MS_RDONLY | MS_POSIXACL); s->s_maxbytes = path.dentry->d_sb->s_maxbytes; s->s_blocksize = path.dentry->d_sb->s_blocksize; s->s_magic = ECRYPTFS_SUPER_MAGIC; inode = ecryptfs_get_inode(path.dentry->d_inode, s); rc = PTR_ERR(inode); if (IS_ERR(inode)) goto out_free; s->s_root = d_make_root(inode); if (!s->s_root) { rc = -ENOMEM; goto out_free; } rc = -ENOMEM; root_info = kmem_cache_zalloc(ecryptfs_dentry_info_cache, GFP_KERNEL); if (!root_info) goto out_free; /* ->kill_sb() will take care of root_info */ ecryptfs_set_dentry_private(s->s_root, root_info); root_info->lower_path = path; s->s_flags |= MS_ACTIVE; return dget(s->s_root); out_free: path_put(&path); out1: deactivate_locked_super(s); out: if (sbi) { ecryptfs_destroy_mount_crypt_stat(&sbi->mount_crypt_stat); kmem_cache_free(ecryptfs_sb_info_cache, sbi); } printk(KERN_ERR "%s; rc = [%d]\n", err, rc); return ERR_PTR(rc); }
C
linux
1
CVE-2015-9016
https://www.cvedetails.com/cve/CVE-2015-9016/
CWE-362
https://github.com/torvalds/linux/commit/0048b4837affd153897ed1222283492070027aa9
0048b4837affd153897ed1222283492070027aa9
blk-mq: fix race between timeout and freeing request Inside timeout handler, blk_mq_tag_to_rq() is called to retrieve the request from one tag. This way is obviously wrong because the request can be freed any time and some fiedds of the request can't be trusted, then kernel oops might be triggered[1]. Currently wrt. blk_mq_tag_to_rq(), the only special case is that the flush request can share same tag with the request cloned from, and the two requests can't be active at the same time, so this patch fixes the above issue by updating tags->rqs[tag] with the active request(either flush rq or the request cloned from) of the tag. Also blk_mq_tag_to_rq() gets much simplified with this patch. Given blk_mq_tag_to_rq() is mainly for drivers and the caller must make sure the request can't be freed, so in bt_for_each() this helper is replaced with tags->rqs[tag]. [1] kernel oops log [ 439.696220] BUG: unable to handle kernel NULL pointer dereference at 0000000000000158^M [ 439.697162] IP: [<ffffffff812d89ba>] blk_mq_tag_to_rq+0x21/0x6e^M [ 439.700653] PGD 7ef765067 PUD 7ef764067 PMD 0 ^M [ 439.700653] Oops: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC ^M [ 439.700653] Dumping ftrace buffer:^M [ 439.700653] (ftrace buffer empty)^M [ 439.700653] Modules linked in: nbd ipv6 kvm_intel kvm serio_raw^M [ 439.700653] CPU: 6 PID: 2779 Comm: stress-ng-sigfd Not tainted 4.2.0-rc5-next-20150805+ #265^M [ 439.730500] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011^M [ 439.730500] task: ffff880605308000 ti: ffff88060530c000 task.ti: ffff88060530c000^M [ 439.730500] RIP: 0010:[<ffffffff812d89ba>] [<ffffffff812d89ba>] blk_mq_tag_to_rq+0x21/0x6e^M [ 439.730500] RSP: 0018:ffff880819203da0 EFLAGS: 00010283^M [ 439.730500] RAX: ffff880811b0e000 RBX: ffff8800bb465f00 RCX: 0000000000000002^M [ 439.730500] RDX: 0000000000000000 RSI: 0000000000000202 RDI: 0000000000000000^M [ 439.730500] RBP: ffff880819203db0 R08: 0000000000000002 R09: 0000000000000000^M [ 439.730500] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000202^M [ 439.730500] R13: ffff880814104800 R14: 0000000000000002 R15: ffff880811a2ea00^M [ 439.730500] FS: 00007f165b3f5740(0000) GS:ffff880819200000(0000) knlGS:0000000000000000^M [ 439.730500] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b^M [ 439.730500] CR2: 0000000000000158 CR3: 00000007ef766000 CR4: 00000000000006e0^M [ 439.730500] Stack:^M [ 439.730500] 0000000000000008 ffff8808114eed90 ffff880819203e00 ffffffff812dc104^M [ 439.755663] ffff880819203e40 ffffffff812d9f5e 0000020000000000 ffff8808114eed80^M [ 439.755663] Call Trace:^M [ 439.755663] <IRQ> ^M [ 439.755663] [<ffffffff812dc104>] bt_for_each+0x6e/0xc8^M [ 439.755663] [<ffffffff812d9f5e>] ? blk_mq_rq_timed_out+0x6a/0x6a^M [ 439.755663] [<ffffffff812d9f5e>] ? blk_mq_rq_timed_out+0x6a/0x6a^M [ 439.755663] [<ffffffff812dc1b3>] blk_mq_tag_busy_iter+0x55/0x5e^M [ 439.755663] [<ffffffff812d88b4>] ? blk_mq_bio_to_request+0x38/0x38^M [ 439.755663] [<ffffffff812d8911>] blk_mq_rq_timer+0x5d/0xd4^M [ 439.755663] [<ffffffff810a3e10>] call_timer_fn+0xf7/0x284^M [ 439.755663] [<ffffffff810a3d1e>] ? call_timer_fn+0x5/0x284^M [ 439.755663] [<ffffffff812d88b4>] ? blk_mq_bio_to_request+0x38/0x38^M [ 439.755663] [<ffffffff810a46d6>] run_timer_softirq+0x1ce/0x1f8^M [ 439.755663] [<ffffffff8104c367>] __do_softirq+0x181/0x3a4^M [ 439.755663] [<ffffffff8104c76e>] irq_exit+0x40/0x94^M [ 439.755663] [<ffffffff81031482>] smp_apic_timer_interrupt+0x33/0x3e^M [ 439.755663] [<ffffffff815559a4>] apic_timer_interrupt+0x84/0x90^M [ 439.755663] <EOI> ^M [ 439.755663] [<ffffffff81554350>] ? _raw_spin_unlock_irq+0x32/0x4a^M [ 439.755663] [<ffffffff8106a98b>] finish_task_switch+0xe0/0x163^M [ 439.755663] [<ffffffff8106a94d>] ? finish_task_switch+0xa2/0x163^M [ 439.755663] [<ffffffff81550066>] __schedule+0x469/0x6cd^M [ 439.755663] [<ffffffff8155039b>] schedule+0x82/0x9a^M [ 439.789267] [<ffffffff8119b28b>] signalfd_read+0x186/0x49a^M [ 439.790911] [<ffffffff8106d86a>] ? wake_up_q+0x47/0x47^M [ 439.790911] [<ffffffff811618c2>] __vfs_read+0x28/0x9f^M [ 439.790911] [<ffffffff8117a289>] ? __fget_light+0x4d/0x74^M [ 439.790911] [<ffffffff811620a7>] vfs_read+0x7a/0xc6^M [ 439.790911] [<ffffffff8116292b>] SyS_read+0x49/0x7f^M [ 439.790911] [<ffffffff81554c17>] entry_SYSCALL_64_fastpath+0x12/0x6f^M [ 439.790911] Code: 48 89 e5 e8 a9 b8 e7 ff 5d c3 0f 1f 44 00 00 55 89 f2 48 89 e5 41 54 41 89 f4 53 48 8b 47 60 48 8b 1c d0 48 8b 7b 30 48 8b 53 38 <48> 8b 87 58 01 00 00 48 85 c0 75 09 48 8b 97 88 0c 00 00 eb 10 ^M [ 439.790911] RIP [<ffffffff812d89ba>] blk_mq_tag_to_rq+0x21/0x6e^M [ 439.790911] RSP <ffff880819203da0>^M [ 439.790911] CR2: 0000000000000158^M [ 439.790911] ---[ end trace d40af58949325661 ]---^M Cc: <[email protected]> Signed-off-by: Ming Lei <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
static void __blk_mq_free_request(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx, struct request *rq) { const int tag = rq->tag; struct request_queue *q = rq->q; if (rq->cmd_flags & REQ_MQ_INFLIGHT) atomic_dec(&hctx->nr_active); rq->cmd_flags = 0; clear_bit(REQ_ATOM_STARTED, &rq->atomic_flags); blk_mq_put_tag(hctx, tag, &ctx->last_tag); blk_mq_queue_exit(q); }
static void __blk_mq_free_request(struct blk_mq_hw_ctx *hctx, struct blk_mq_ctx *ctx, struct request *rq) { const int tag = rq->tag; struct request_queue *q = rq->q; if (rq->cmd_flags & REQ_MQ_INFLIGHT) atomic_dec(&hctx->nr_active); rq->cmd_flags = 0; clear_bit(REQ_ATOM_STARTED, &rq->atomic_flags); blk_mq_put_tag(hctx, tag, &ctx->last_tag); blk_mq_queue_exit(q); }
C
linux
0
CVE-2015-1274
https://www.cvedetails.com/cve/CVE-2015-1274/
CWE-254
https://github.com/chromium/chromium/commit/d27468a832d5316884bd02f459cbf493697fd7e1
d27468a832d5316884bd02f459cbf493697fd7e1
Switch to equalIgnoringASCIICase throughout modules/accessibility BUG=627682 Review-Url: https://codereview.chromium.org/2793913007 Cr-Commit-Position: refs/heads/master@{#461858}
AXLayoutObject::~AXLayoutObject() { ASSERT(isDetached()); }
AXLayoutObject::~AXLayoutObject() { ASSERT(isDetached()); }
C
Chrome
0
CVE-2018-6111
https://www.cvedetails.com/cve/CVE-2018-6111/
CWE-20
https://github.com/chromium/chromium/commit/3c8e4852477d5b1e2da877808c998dc57db9460f
3c8e4852477d5b1e2da877808c998dc57db9460f
DevTools: speculative fix for crash in NetworkHandler::Disable This keeps BrowserContext* and StoragePartition* instead of RenderProcessHost* in an attemp to resolve UAF of RenderProcessHost upon closure of DevTools front-end. Bug: 801117, 783067, 780694 Change-Id: I6c2cca60cc0c29f0949d189cf918769059f80c1b Reviewed-on: https://chromium-review.googlesource.com/876657 Commit-Queue: Andrey Kosyakov <[email protected]> Reviewed-by: Dmitry Gozman <[email protected]> Cr-Commit-Position: refs/heads/master@{#531157}
void ServiceWorkerDevToolsAgentHost::AttachSession(DevToolsSession* session) { if (state_ == WORKER_READY) { if (sessions().size() == 1) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::BindOnce(&SetDevToolsAttachedOnIO, context_weak_, version_id_, true)); } session->SetRenderer(worker_process_id_, nullptr); session->AttachToAgent(agent_ptr_); } session->AddHandler(base::WrapUnique(new protocol::InspectorHandler())); session->AddHandler(base::WrapUnique(new protocol::NetworkHandler(GetId()))); session->AddHandler(base::WrapUnique(new protocol::SchemaHandler())); }
void ServiceWorkerDevToolsAgentHost::AttachSession(DevToolsSession* session) { if (state_ == WORKER_READY) { if (sessions().size() == 1) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::BindOnce(&SetDevToolsAttachedOnIO, context_weak_, version_id_, true)); } session->SetRenderer(RenderProcessHost::FromID(worker_process_id_), nullptr); session->AttachToAgent(agent_ptr_); } session->AddHandler(base::WrapUnique(new protocol::InspectorHandler())); session->AddHandler(base::WrapUnique(new protocol::NetworkHandler(GetId()))); session->AddHandler(base::WrapUnique(new protocol::SchemaHandler())); }
C
Chrome
1
CVE-2017-7277
https://www.cvedetails.com/cve/CVE-2017-7277/
CWE-125
https://github.com/torvalds/linux/commit/8605330aac5a5785630aec8f64378a54891937cc
8605330aac5a5785630aec8f64378a54891937cc
tcp: fix SCM_TIMESTAMPING_OPT_STATS for normal skbs __sock_recv_timestamp can be called for both normal skbs (for receive timestamps) and for skbs on the error queue (for transmit timestamps). Commit 1c885808e456 (tcp: SOF_TIMESTAMPING_OPT_STATS option for SO_TIMESTAMPING) assumes any skb passed to __sock_recv_timestamp are from the error queue, containing OPT_STATS in the content of the skb. This results in accessing invalid memory or generating junk data. To fix this, set skb->pkt_type to PACKET_OUTGOING for packets on the error queue. This is safe because on the receive path on local sockets skb->pkt_type is never set to PACKET_OUTGOING. With that, copy OPT_STATS from a packet, only if its pkt_type is PACKET_OUTGOING. Fixes: 1c885808e456 ("tcp: SOF_TIMESTAMPING_OPT_STATS option for SO_TIMESTAMPING") Reported-by: JongHwan Kim <[email protected]> Signed-off-by: Soheil Hassas Yeganeh <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: Willem de Bruijn <[email protected]> Signed-off-by: David S. Miller <[email protected]>
struct sk_buff *alloc_skb_with_frags(unsigned long header_len, unsigned long data_len, int max_page_order, int *errcode, gfp_t gfp_mask) { int npages = (data_len + (PAGE_SIZE - 1)) >> PAGE_SHIFT; unsigned long chunk; struct sk_buff *skb; struct page *page; gfp_t gfp_head; int i; *errcode = -EMSGSIZE; /* Note this test could be relaxed, if we succeed to allocate * high order pages... */ if (npages > MAX_SKB_FRAGS) return NULL; gfp_head = gfp_mask; if (gfp_head & __GFP_DIRECT_RECLAIM) gfp_head |= __GFP_REPEAT; *errcode = -ENOBUFS; skb = alloc_skb(header_len, gfp_head); if (!skb) return NULL; skb->truesize += npages << PAGE_SHIFT; for (i = 0; npages > 0; i++) { int order = max_page_order; while (order) { if (npages >= 1 << order) { page = alloc_pages((gfp_mask & ~__GFP_DIRECT_RECLAIM) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, order); if (page) goto fill_page; /* Do not retry other high order allocations */ order = 1; max_page_order = 0; } order--; } page = alloc_page(gfp_mask); if (!page) goto failure; fill_page: chunk = min_t(unsigned long, data_len, PAGE_SIZE << order); skb_fill_page_desc(skb, i, page, 0, chunk); data_len -= chunk; npages -= 1 << order; } return skb; failure: kfree_skb(skb); return NULL; }
struct sk_buff *alloc_skb_with_frags(unsigned long header_len, unsigned long data_len, int max_page_order, int *errcode, gfp_t gfp_mask) { int npages = (data_len + (PAGE_SIZE - 1)) >> PAGE_SHIFT; unsigned long chunk; struct sk_buff *skb; struct page *page; gfp_t gfp_head; int i; *errcode = -EMSGSIZE; /* Note this test could be relaxed, if we succeed to allocate * high order pages... */ if (npages > MAX_SKB_FRAGS) return NULL; gfp_head = gfp_mask; if (gfp_head & __GFP_DIRECT_RECLAIM) gfp_head |= __GFP_REPEAT; *errcode = -ENOBUFS; skb = alloc_skb(header_len, gfp_head); if (!skb) return NULL; skb->truesize += npages << PAGE_SHIFT; for (i = 0; npages > 0; i++) { int order = max_page_order; while (order) { if (npages >= 1 << order) { page = alloc_pages((gfp_mask & ~__GFP_DIRECT_RECLAIM) | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, order); if (page) goto fill_page; /* Do not retry other high order allocations */ order = 1; max_page_order = 0; } order--; } page = alloc_page(gfp_mask); if (!page) goto failure; fill_page: chunk = min_t(unsigned long, data_len, PAGE_SIZE << order); skb_fill_page_desc(skb, i, page, 0, chunk); data_len -= chunk; npages -= 1 << order; } return skb; failure: kfree_skb(skb); return NULL; }
C
linux
0
CVE-2016-1613
https://www.cvedetails.com/cve/CVE-2016-1613/
null
https://github.com/chromium/chromium/commit/7394cf6f43d7a86630d3eb1c728fd63c621b5530
7394cf6f43d7a86630d3eb1c728fd63c621b5530
Connect the LocalDB to TabManager. Bug: 773382 Change-Id: Iec8fe5226ee175105d51f300f30b4865478ac099 Reviewed-on: https://chromium-review.googlesource.com/1118611 Commit-Queue: Sébastien Marchand <[email protected]> Reviewed-by: François Doray <[email protected]> Cr-Commit-Position: refs/heads/master@{#572871}
void PrepareTabs(const char* url1 = kTestUrl, const char* url2 = kTestUrl, const char* url3 = kTestUrl) { contents1_ = CreateTestWebContents(); ResourceCoordinatorTabHelper::CreateForWebContents(contents1_.get()); nav_handle1_ = CreateTabAndNavigation(url1, contents1_.get()); contents2_ = CreateTestWebContents(); ResourceCoordinatorTabHelper::CreateForWebContents(contents2_.get()); nav_handle2_ = CreateTabAndNavigation(url2, contents2_.get()); contents3_ = CreateTestWebContents(); ResourceCoordinatorTabHelper::CreateForWebContents(contents3_.get()); nav_handle3_ = CreateTabAndNavigation(url3, contents3_.get()); contents1_->WasHidden(); contents2_->WasHidden(); contents3_->WasHidden(); throttle1_ = std::make_unique<NonResumingBackgroundTabNavigationThrottle>( nav_handle1_.get()); throttle2_ = std::make_unique<NonResumingBackgroundTabNavigationThrottle>( nav_handle2_.get()); throttle3_ = std::make_unique<NonResumingBackgroundTabNavigationThrottle>( nav_handle3_.get()); }
void PrepareTabs(const char* url1 = kTestUrl, const char* url2 = kTestUrl, const char* url3 = kTestUrl) { contents1_ = CreateTestWebContents(); ResourceCoordinatorTabHelper::CreateForWebContents(contents1_.get()); nav_handle1_ = CreateTabAndNavigation(url1, contents1_.get()); contents2_ = CreateTestWebContents(); ResourceCoordinatorTabHelper::CreateForWebContents(contents2_.get()); nav_handle2_ = CreateTabAndNavigation(url2, contents2_.get()); contents3_ = CreateTestWebContents(); ResourceCoordinatorTabHelper::CreateForWebContents(contents3_.get()); nav_handle3_ = CreateTabAndNavigation(url3, contents3_.get()); contents1_->WasHidden(); contents2_->WasHidden(); contents3_->WasHidden(); throttle1_ = std::make_unique<NonResumingBackgroundTabNavigationThrottle>( nav_handle1_.get()); throttle2_ = std::make_unique<NonResumingBackgroundTabNavigationThrottle>( nav_handle2_.get()); throttle3_ = std::make_unique<NonResumingBackgroundTabNavigationThrottle>( nav_handle3_.get()); }
C
Chrome
0
CVE-2018-9507
https://www.cvedetails.com/cve/CVE-2018-9507/
CWE-125
https://android.googlesource.com/platform/system/bt/+/30cec963095366536ca0b1306089154e09bfe1a9
30cec963095366536ca0b1306089154e09bfe1a9
Check packet length in bta_av_proc_meta_cmd Bug: 111893951 Test: manual - connect A2DP Change-Id: Ibbf347863dfd29ea3385312e9dde1082bc90d2f3 (cherry picked from commit ed51887f921263219bcd2fbf6650ead5ec8d334e)
tBTA_AV_EVT bta_av_proc_meta_cmd(tAVRC_RESPONSE* p_rc_rsp, tBTA_AV_RC_MSG* p_msg, uint8_t* p_ctype) { tBTA_AV_EVT evt = BTA_AV_META_MSG_EVT; uint8_t u8, pdu, *p; uint16_t u16; tAVRC_MSG_VENDOR* p_vendor = &p_msg->msg.vendor; pdu = *(p_vendor->p_vendor_data); p_rc_rsp->pdu = pdu; *p_ctype = AVRC_RSP_REJ; /* Check to ansure a valid minimum meta data length */ if ((AVRC_MIN_META_CMD_LEN + p_vendor->vendor_len) > AVRC_META_CMD_BUF_SIZE) { /* reject it */ p_rc_rsp->rsp.status = AVRC_STS_BAD_PARAM; APPL_TRACE_ERROR("%s: Invalid meta-command length: %d", __func__, p_vendor->vendor_len); return 0; } /* Metadata messages only use PANEL sub-unit type */ if (p_vendor->hdr.subunit_type != AVRC_SUB_PANEL) { APPL_TRACE_DEBUG("%s: SUBUNIT must be PANEL", __func__); /* reject it */ evt = 0; p_vendor->hdr.ctype = AVRC_RSP_NOT_IMPL; p_vendor->vendor_len = 0; p_rc_rsp->rsp.status = AVRC_STS_BAD_PARAM; } else if (!AVRC_IsValidAvcType(pdu, p_vendor->hdr.ctype)) { APPL_TRACE_DEBUG("%s: Invalid pdu/ctype: 0x%x, %d", __func__, pdu, p_vendor->hdr.ctype); /* reject invalid message without reporting to app */ evt = 0; p_rc_rsp->rsp.status = AVRC_STS_BAD_CMD; } else { switch (pdu) { case AVRC_PDU_GET_CAPABILITIES: /* process GetCapabilities command without reporting the event to app */ evt = 0; if (p_vendor->vendor_len != 5) { android_errorWriteLog(0x534e4554, "111893951"); p_rc_rsp->get_caps.status = AVRC_STS_INTERNAL_ERR; break; } u8 = *(p_vendor->p_vendor_data + 4); p = p_vendor->p_vendor_data + 2; p_rc_rsp->get_caps.capability_id = u8; BE_STREAM_TO_UINT16(u16, p); if (u16 != 1) { p_rc_rsp->get_caps.status = AVRC_STS_INTERNAL_ERR; } else { p_rc_rsp->get_caps.status = AVRC_STS_NO_ERROR; if (u8 == AVRC_CAP_COMPANY_ID) { *p_ctype = AVRC_RSP_IMPL_STBL; p_rc_rsp->get_caps.count = p_bta_av_cfg->num_co_ids; memcpy(p_rc_rsp->get_caps.param.company_id, p_bta_av_cfg->p_meta_co_ids, (p_bta_av_cfg->num_co_ids << 2)); } else if (u8 == AVRC_CAP_EVENTS_SUPPORTED) { *p_ctype = AVRC_RSP_IMPL_STBL; p_rc_rsp->get_caps.count = p_bta_av_cfg->num_evt_ids; memcpy(p_rc_rsp->get_caps.param.event_id, p_bta_av_cfg->p_meta_evt_ids, p_bta_av_cfg->num_evt_ids); } else { APPL_TRACE_DEBUG("%s: Invalid capability ID: 0x%x", __func__, u8); /* reject - unknown capability ID */ p_rc_rsp->get_caps.status = AVRC_STS_BAD_PARAM; } } break; case AVRC_PDU_REGISTER_NOTIFICATION: /* make sure the event_id is implemented */ p_rc_rsp->rsp.status = bta_av_chk_notif_evt_id(p_vendor); if (p_rc_rsp->rsp.status != BTA_AV_STS_NO_RSP) evt = 0; break; } } return evt; }
tBTA_AV_EVT bta_av_proc_meta_cmd(tAVRC_RESPONSE* p_rc_rsp, tBTA_AV_RC_MSG* p_msg, uint8_t* p_ctype) { tBTA_AV_EVT evt = BTA_AV_META_MSG_EVT; uint8_t u8, pdu, *p; uint16_t u16; tAVRC_MSG_VENDOR* p_vendor = &p_msg->msg.vendor; pdu = *(p_vendor->p_vendor_data); p_rc_rsp->pdu = pdu; *p_ctype = AVRC_RSP_REJ; /* Check to ansure a valid minimum meta data length */ if ((AVRC_MIN_META_CMD_LEN + p_vendor->vendor_len) > AVRC_META_CMD_BUF_SIZE) { /* reject it */ p_rc_rsp->rsp.status = AVRC_STS_BAD_PARAM; APPL_TRACE_ERROR("%s: Invalid meta-command length: %d", __func__, p_vendor->vendor_len); return 0; } /* Metadata messages only use PANEL sub-unit type */ if (p_vendor->hdr.subunit_type != AVRC_SUB_PANEL) { APPL_TRACE_DEBUG("%s: SUBUNIT must be PANEL", __func__); /* reject it */ evt = 0; p_vendor->hdr.ctype = AVRC_RSP_NOT_IMPL; p_vendor->vendor_len = 0; p_rc_rsp->rsp.status = AVRC_STS_BAD_PARAM; } else if (!AVRC_IsValidAvcType(pdu, p_vendor->hdr.ctype)) { APPL_TRACE_DEBUG("%s: Invalid pdu/ctype: 0x%x, %d", __func__, pdu, p_vendor->hdr.ctype); /* reject invalid message without reporting to app */ evt = 0; p_rc_rsp->rsp.status = AVRC_STS_BAD_CMD; } else { switch (pdu) { case AVRC_PDU_GET_CAPABILITIES: /* process GetCapabilities command without reporting the event to app */ evt = 0; u8 = *(p_vendor->p_vendor_data + 4); p = p_vendor->p_vendor_data + 2; p_rc_rsp->get_caps.capability_id = u8; BE_STREAM_TO_UINT16(u16, p); if ((u16 != 1) || (p_vendor->vendor_len != 5)) { p_rc_rsp->get_caps.status = AVRC_STS_INTERNAL_ERR; } else { p_rc_rsp->get_caps.status = AVRC_STS_NO_ERROR; if (u8 == AVRC_CAP_COMPANY_ID) { *p_ctype = AVRC_RSP_IMPL_STBL; p_rc_rsp->get_caps.count = p_bta_av_cfg->num_co_ids; memcpy(p_rc_rsp->get_caps.param.company_id, p_bta_av_cfg->p_meta_co_ids, (p_bta_av_cfg->num_co_ids << 2)); } else if (u8 == AVRC_CAP_EVENTS_SUPPORTED) { *p_ctype = AVRC_RSP_IMPL_STBL; p_rc_rsp->get_caps.count = p_bta_av_cfg->num_evt_ids; memcpy(p_rc_rsp->get_caps.param.event_id, p_bta_av_cfg->p_meta_evt_ids, p_bta_av_cfg->num_evt_ids); } else { APPL_TRACE_DEBUG("%s: Invalid capability ID: 0x%x", __func__, u8); /* reject - unknown capability ID */ p_rc_rsp->get_caps.status = AVRC_STS_BAD_PARAM; } } break; case AVRC_PDU_REGISTER_NOTIFICATION: /* make sure the event_id is implemented */ p_rc_rsp->rsp.status = bta_av_chk_notif_evt_id(p_vendor); if (p_rc_rsp->rsp.status != BTA_AV_STS_NO_RSP) evt = 0; break; } } return evt; }
C
Android
1
CVE-2017-14604
https://www.cvedetails.com/cve/CVE-2017-14604/
CWE-20
https://github.com/GNOME/nautilus/commit/1630f53481f445ada0a455e9979236d31a8d3bb0
1630f53481f445ada0a455e9979236d31a8d3bb0
mime-actions: use file metadata for trusting desktop files Currently we only trust desktop files that have the executable bit set, and don't replace the displayed icon or the displayed name until it's trusted, which prevents for running random programs by a malicious desktop file. However, the executable permission is preserved if the desktop file comes from a compressed file. To prevent this, add a metadata::trusted metadata to the file once the user acknowledges the file as trusted. This adds metadata to the file, which cannot be added unless it has access to the computer. Also remove the SHEBANG "trusted" content we were putting inside the desktop file, since that doesn't add more security since it can come with the file itself. https://bugzilla.gnome.org/show_bug.cgi?id=777991
nautilus_directory_force_reload_internal (NautilusDirectory *directory, NautilusFileAttributes file_attributes) { nautilus_profile_start (NULL); /* invalidate attributes that are getting reloaded for all files */ nautilus_directory_invalidate_file_attributes (directory, file_attributes); /* Start a new directory load. */ file_list_cancel (directory); directory->details->directory_loaded = FALSE; /* Start a new directory count. */ nautilus_directory_invalidate_count_and_mime_list (directory); add_all_files_to_work_queue (directory); nautilus_directory_async_state_changed (directory); nautilus_profile_end (NULL); }
nautilus_directory_force_reload_internal (NautilusDirectory *directory, NautilusFileAttributes file_attributes) { nautilus_profile_start (NULL); /* invalidate attributes that are getting reloaded for all files */ nautilus_directory_invalidate_file_attributes (directory, file_attributes); /* Start a new directory load. */ file_list_cancel (directory); directory->details->directory_loaded = FALSE; /* Start a new directory count. */ nautilus_directory_invalidate_count_and_mime_list (directory); add_all_files_to_work_queue (directory); nautilus_directory_async_state_changed (directory); nautilus_profile_end (NULL); }
C
nautilus
0
CVE-2018-1000524
https://www.cvedetails.com/cve/CVE-2018-1000524/
CWE-190
https://github.com/fatcerberus/minisphere/commit/252c1ca184cb38e1acb917aa0e451c5f08519996
252c1ca184cb38e1acb917aa0e451c5f08519996
Fix integer overflow in layer_resize in map_engine.c (#268) * Fix integer overflow in layer_resize in map_engine.c There's a buffer overflow bug in the function layer_resize. It allocates a buffer `tilemap` with size `x_size * y_size * sizeof(struct map_tile)`. But it didn't check for integer overflow, so if x_size and y_size are very large, it's possible that the buffer size is smaller than needed, causing a buffer overflow later. PoC: `SetLayerSize(0, 0x7FFFFFFF, 0x7FFFFFFF);` * move malloc to a separate line
layer_set_visible(int layer, bool visible) { s_map->layers[layer].is_visible = visible; }
layer_set_visible(int layer, bool visible) { s_map->layers[layer].is_visible = visible; }
C
minisphere
0
CVE-2016-5770
https://www.cvedetails.com/cve/CVE-2016-5770/
CWE-190
https://github.com/php/php-src/commit/7245bff300d3fa8bacbef7897ff080a6f1c23eba?w=1
7245bff300d3fa8bacbef7897ff080a6f1c23eba?w=1
Fix bug #72262 - do not overflow int
SPL_METHOD(SplFileObject, fgets) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (zend_parse_parameters_none() == FAILURE) { return; } if (spl_filesystem_file_read(intern, 0 TSRMLS_CC) == FAILURE) { RETURN_FALSE; } RETURN_STRINGL(intern->u.file.current_line, intern->u.file.current_line_len, 1); } /* }}} */ /* {{{ proto string SplFileObject::current()
SPL_METHOD(SplFileObject, fgets) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (zend_parse_parameters_none() == FAILURE) { return; } if (spl_filesystem_file_read(intern, 0 TSRMLS_CC) == FAILURE) { RETURN_FALSE; } RETURN_STRINGL(intern->u.file.current_line, intern->u.file.current_line_len, 1); } /* }}} */ /* {{{ proto string SplFileObject::current()
C
php-src
1
CVE-2018-6111
https://www.cvedetails.com/cve/CVE-2018-6111/
CWE-20
https://github.com/chromium/chromium/commit/3c8e4852477d5b1e2da877808c998dc57db9460f
3c8e4852477d5b1e2da877808c998dc57db9460f
DevTools: speculative fix for crash in NetworkHandler::Disable This keeps BrowserContext* and StoragePartition* instead of RenderProcessHost* in an attemp to resolve UAF of RenderProcessHost upon closure of DevTools front-end. Bug: 801117, 783067, 780694 Change-Id: I6c2cca60cc0c29f0949d189cf918769059f80c1b Reviewed-on: https://chromium-review.googlesource.com/876657 Commit-Queue: Andrey Kosyakov <[email protected]> Reviewed-by: Dmitry Gozman <[email protected]> Cr-Commit-Position: refs/heads/master@{#531157}
bool InputHandler::PointIsWithinContents(gfx::PointF point) const { gfx::Rect bounds = host_->GetView()->GetViewBounds(); bounds -= bounds.OffsetFromOrigin(); // Translate the bounds to (0,0). return bounds.Contains(point.x(), point.y()); }
bool InputHandler::PointIsWithinContents(gfx::PointF point) const { gfx::Rect bounds = host_->GetView()->GetViewBounds(); bounds -= bounds.OffsetFromOrigin(); // Translate the bounds to (0,0). return bounds.Contains(point.x(), point.y()); }
C
Chrome
0
CVE-2013-0886
https://www.cvedetails.com/cve/CVE-2013-0886/
null
https://github.com/chromium/chromium/commit/18d67244984a574ba2dd8779faabc0e3e34f4b76
18d67244984a574ba2dd8779faabc0e3e34f4b76
Implement TextureImageTransportSurface using texture mailbox This has a couple of advantages: - allow tearing down and recreating the UI parent context without losing the renderer contexts - do not require a context to be able to generate textures when creating the GLSurfaceHandle - clearer ownership semantics that potentially allows for more robust and easier lost context handling/thumbnailing/etc., since a texture is at any given time owned by either: UI parent, mailbox, or TextureImageTransportSurface - simplify frontbuffer protection logic; the frontbuffer textures are now owned by RWHV where they are refcounted The TextureImageTransportSurface informs RenderWidgetHostView of the mailbox names for the front- and backbuffer textures by associating them with a surface_handle (1 or 2) in the AcceleratedSurfaceNew message. During SwapBuffers() or PostSubBuffer() cycles, it then uses produceTextureCHROMIUM() and consumeTextureCHROMIUM() to transfer ownership between renderer and browser compositor. RWHV sends back the surface_handle of the buffer being returned with the Swap ACK (or 0 if no buffer is being returned in which case TextureImageTransportSurface will allocate a new texture - note that this could be used to simply keep textures for thumbnailing). BUG=154815,139616 [email protected] Review URL: https://chromiumcodereview.appspot.com/11194042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171569 0039d316-1c4b-4281-b951-d872f2087c98
void RenderWidgetHostViewAndroid::ProcessAckedTouchEvent( const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) { if (content_view_core_) content_view_core_->ConfirmTouchEvent(ack_result); }
void RenderWidgetHostViewAndroid::ProcessAckedTouchEvent( const WebKit::WebTouchEvent& touch_event, InputEventAckState ack_result) { if (content_view_core_) content_view_core_->ConfirmTouchEvent(ack_result); }
C
Chrome
0
CVE-2017-15420
https://www.cvedetails.com/cve/CVE-2017-15420/
CWE-20
https://github.com/chromium/chromium/commit/56a84aa67bb071a33a48ac1481b555c48e0a9a59
56a84aa67bb071a33a48ac1481b555c48e0a9a59
Do not use NavigationEntry to block history navigations. This is no longer necessary after r477371. BUG=777419 TEST=See bug for repro steps. Cq-Include-Trybots: master.tryserver.chromium.linux:linux_site_isolation Change-Id: I701e4d4853858281b43e3743b12274dbeadfbf18 Reviewed-on: https://chromium-review.googlesource.com/733959 Reviewed-by: Devlin <[email protected]> Reviewed-by: Nasko Oskov <[email protected]> Commit-Queue: Charlie Reis <[email protected]> Cr-Commit-Position: refs/heads/master@{#511942}
~ScopedPluginRegister() { std::vector<WebPluginInfo> plugins; plugin_service_->GetInternalPlugins(&plugins); EXPECT_EQ(1u, plugins.size()); plugin_service_->UnregisterInternalPlugin(plugins[0].path); plugin_service_->RefreshPlugins(); plugins.clear(); plugin_service_->GetInternalPlugins(&plugins); EXPECT_TRUE(plugins.empty()); }
~ScopedPluginRegister() { std::vector<WebPluginInfo> plugins; plugin_service_->GetInternalPlugins(&plugins); EXPECT_EQ(1u, plugins.size()); plugin_service_->UnregisterInternalPlugin(plugins[0].path); plugin_service_->RefreshPlugins(); plugins.clear(); plugin_service_->GetInternalPlugins(&plugins); EXPECT_TRUE(plugins.empty()); }
C
Chrome
0
CVE-2015-8898
https://www.cvedetails.com/cve/CVE-2015-8898/
CWE-476
https://github.com/ImageMagick/ImageMagick/commit/5b4bebaa91849c592a8448bc353ab25a54ff8c44
5b4bebaa91849c592a8448bc353ab25a54ff8c44
https://github.com/ImageMagick/ImageMagick/pull/34
MagickExport Image *ReadInlineImage(const ImageInfo *image_info, const char *content,ExceptionInfo *exception) { Image *image; ImageInfo *read_info; unsigned char *blob; size_t length; register const char *p; /* Skip over header (e.g. data:image/gif;base64,). */ image=NewImageList(); for (p=content; (*p != ',') && (*p != '\0'); p++) ; if (*p == '\0') ThrowReaderException(CorruptImageError,"CorruptImage"); p++; length=0; blob=Base64Decode(p,&length); if (length == 0) ThrowReaderException(CorruptImageError,"CorruptImage"); read_info=CloneImageInfo(image_info); (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL, (void *) NULL); *read_info->filename='\0'; *read_info->magick='\0'; image=BlobToImage(read_info,blob,length,exception); blob=(unsigned char *) RelinquishMagickMemory(blob); read_info=DestroyImageInfo(read_info); return(image); }
MagickExport Image *ReadInlineImage(const ImageInfo *image_info, const char *content,ExceptionInfo *exception) { Image *image; ImageInfo *read_info; unsigned char *blob; size_t length; register const char *p; /* Skip over header (e.g. data:image/gif;base64,). */ image=NewImageList(); for (p=content; (*p != ',') && (*p != '\0'); p++) ; if (*p == '\0') ThrowReaderException(CorruptImageError,"CorruptImage"); p++; length=0; blob=Base64Decode(p,&length); if (length == 0) ThrowReaderException(CorruptImageError,"CorruptImage"); read_info=CloneImageInfo(image_info); (void) SetImageInfoProgressMonitor(read_info,(MagickProgressMonitor) NULL, (void *) NULL); *read_info->filename='\0'; *read_info->magick='\0'; image=BlobToImage(read_info,blob,length,exception); blob=(unsigned char *) RelinquishMagickMemory(blob); read_info=DestroyImageInfo(read_info); return(image); }
C
ImageMagick
0
CVE-2016-1615
https://www.cvedetails.com/cve/CVE-2016-1615/
CWE-254
https://github.com/chromium/chromium/commit/b399a05453d7b3e2dfdec67865fefe6953bcc59e
b399a05453d7b3e2dfdec67865fefe6953bcc59e
Allocate a FrameSinkId for RenderWidgetHostViewAura in mus+ash RenderWidgetHostViewChildFrame expects its parent to have a valid FrameSinkId. Make sure RenderWidgetHostViewAura has a FrameSinkId even if DelegatedFrameHost is not used (in mus+ash). BUG=706553 [email protected] Review-Url: https://codereview.chromium.org/2847253003 Cr-Commit-Position: refs/heads/master@{#468179}
void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) { #if defined(OS_WIN) if (legacy_render_widget_host_HWND_) { legacy_render_widget_host_HWND_->set_host(NULL); legacy_render_widget_host_HWND_->Destroy(); legacy_render_widget_host_HWND_ = NULL; } #endif DetachFromInputMethod(); if (overscroll_controller_) overscroll_controller_->Reset(); }
void RenderWidgetHostViewAura::OnWindowDestroying(aura::Window* window) { #if defined(OS_WIN) if (legacy_render_widget_host_HWND_) { legacy_render_widget_host_HWND_->set_host(NULL); legacy_render_widget_host_HWND_->Destroy(); legacy_render_widget_host_HWND_ = NULL; } #endif DetachFromInputMethod(); if (overscroll_controller_) overscroll_controller_->Reset(); }
C
Chrome
0
CVE-2017-6074
https://www.cvedetails.com/cve/CVE-2017-6074/
CWE-415
https://github.com/torvalds/linux/commit/5edabca9d4cff7f1f2b68f0bac55ef99d9798ba4
5edabca9d4cff7f1f2b68f0bac55ef99d9798ba4
dccp: fix freeing skb too early for IPV6_RECVPKTINFO In the current DCCP implementation an skb for a DCCP_PKT_REQUEST packet is forcibly freed via __kfree_skb in dccp_rcv_state_process if dccp_v6_conn_request successfully returns. However, if IPV6_RECVPKTINFO is set on a socket, the address of the skb is saved to ireq->pktopts and the ref count for skb is incremented in dccp_v6_conn_request, so skb is still in use. Nevertheless, it gets freed in dccp_rcv_state_process. Fix by calling consume_skb instead of doing goto discard and therefore calling __kfree_skb. Similar fixes for TCP: fb7e2399ec17f1004c0e0ccfd17439f8759ede01 [TCP]: skb is unexpectedly freed. 0aea76d35c9651d55bbaf746e7914e5f9ae5a25d tcp: SYN packets are now simply consumed Signed-off-by: Andrey Konovalov <[email protected]> Acked-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int dccp_rcv_respond_partopen_state_process(struct sock *sk, struct sk_buff *skb, const struct dccp_hdr *dh, const unsigned int len) { struct dccp_sock *dp = dccp_sk(sk); u32 sample = dp->dccps_options_received.dccpor_timestamp_echo; int queued = 0; switch (dh->dccph_type) { case DCCP_PKT_RESET: inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); break; case DCCP_PKT_DATA: if (sk->sk_state == DCCP_RESPOND) break; case DCCP_PKT_DATAACK: case DCCP_PKT_ACK: /* * FIXME: we should be resetting the PARTOPEN (DELACK) timer * here but only if we haven't used the DELACK timer for * something else, like sending a delayed ack for a TIMESTAMP * echo, etc, for now were not clearing it, sending an extra * ACK when there is nothing else to do in DELACK is not a big * deal after all. */ /* Stop the PARTOPEN timer */ if (sk->sk_state == DCCP_PARTOPEN) inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); /* Obtain usec RTT sample from SYN exchange (used by TFRC). */ if (likely(sample)) { long delta = dccp_timestamp() - sample; dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * delta); } dp->dccps_osr = DCCP_SKB_CB(skb)->dccpd_seq; dccp_set_state(sk, DCCP_OPEN); if (dh->dccph_type == DCCP_PKT_DATAACK || dh->dccph_type == DCCP_PKT_DATA) { __dccp_rcv_established(sk, skb, dh, len); queued = 1; /* packet was queued (by __dccp_rcv_established) */ } break; } return queued; }
static int dccp_rcv_respond_partopen_state_process(struct sock *sk, struct sk_buff *skb, const struct dccp_hdr *dh, const unsigned int len) { struct dccp_sock *dp = dccp_sk(sk); u32 sample = dp->dccps_options_received.dccpor_timestamp_echo; int queued = 0; switch (dh->dccph_type) { case DCCP_PKT_RESET: inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); break; case DCCP_PKT_DATA: if (sk->sk_state == DCCP_RESPOND) break; case DCCP_PKT_DATAACK: case DCCP_PKT_ACK: /* * FIXME: we should be resetting the PARTOPEN (DELACK) timer * here but only if we haven't used the DELACK timer for * something else, like sending a delayed ack for a TIMESTAMP * echo, etc, for now were not clearing it, sending an extra * ACK when there is nothing else to do in DELACK is not a big * deal after all. */ /* Stop the PARTOPEN timer */ if (sk->sk_state == DCCP_PARTOPEN) inet_csk_clear_xmit_timer(sk, ICSK_TIME_DACK); /* Obtain usec RTT sample from SYN exchange (used by TFRC). */ if (likely(sample)) { long delta = dccp_timestamp() - sample; dp->dccps_syn_rtt = dccp_sample_rtt(sk, 10 * delta); } dp->dccps_osr = DCCP_SKB_CB(skb)->dccpd_seq; dccp_set_state(sk, DCCP_OPEN); if (dh->dccph_type == DCCP_PKT_DATAACK || dh->dccph_type == DCCP_PKT_DATA) { __dccp_rcv_established(sk, skb, dh, len); queued = 1; /* packet was queued (by __dccp_rcv_established) */ } break; } return queued; }
C
linux
0
CVE-2014-2038
https://www.cvedetails.com/cve/CVE-2014-2038/
CWE-20
https://github.com/torvalds/linux/commit/263b4509ec4d47e0da3e753f85a39ea12d1eff24
263b4509ec4d47e0da3e753f85a39ea12d1eff24
nfs: always make sure page is up-to-date before extending a write to cover the entire page We should always make sure the cached page is up-to-date when we're determining whether we can extend a write to cover the full page -- even if we've received a write delegation from the server. Commit c7559663 added logic to skip this check if we have a write delegation, which can lead to data corruption such as the following scenario if client B receives a write delegation from the NFS server: Client A: # echo 123456789 > /mnt/file Client B: # echo abcdefghi >> /mnt/file # cat /mnt/file 0�D0�abcdefghi Just because we hold a write delegation doesn't mean that we've read in the entire page contents. Cc: <[email protected]> # v3.11+ Signed-off-by: Scott Mayhew <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
void nfs_pageio_reset_write_mds(struct nfs_pageio_descriptor *pgio) { pgio->pg_ops = &nfs_pageio_write_ops; pgio->pg_bsize = NFS_SERVER(pgio->pg_inode)->wsize; }
void nfs_pageio_reset_write_mds(struct nfs_pageio_descriptor *pgio) { pgio->pg_ops = &nfs_pageio_write_ops; pgio->pg_bsize = NFS_SERVER(pgio->pg_inode)->wsize; }
C
linux
0
CVE-2016-7513
https://www.cvedetails.com/cve/CVE-2016-7513/
CWE-189
https://github.com/ImageMagick/ImageMagick/commit/a54fe0e8600eaf3dc6fe717d3c0398001507f723
a54fe0e8600eaf3dc6fe717d3c0398001507f723
null
static Cache GetImagePixelCache(Image *image,const MagickBooleanType clone, ExceptionInfo *exception) { CacheInfo *restrict cache_info; MagickBooleanType destroy, status; static MagickSizeType cpu_throttle = 0, cycles = 0, time_limit = 0; static time_t cache_timestamp = 0; status=MagickTrue; LockSemaphoreInfo(image->semaphore); if (cpu_throttle == 0) cpu_throttle=GetMagickResourceLimit(ThrottleResource); if ((cpu_throttle != MagickResourceInfinity) && ((cycles++ % 32) == 0)) MagickDelay(cpu_throttle); if (time_limit == 0) { /* Set the expire time in seconds. */ time_limit=GetMagickResourceLimit(TimeResource); cache_timestamp=time((time_t *) NULL); } if ((time_limit != MagickResourceInfinity) && ((MagickSizeType) (time((time_t *) NULL)-cache_timestamp) >= time_limit)) { #if defined(ECANCELED) errno=ECANCELED; #endif ThrowFatalException(ResourceLimitFatalError,"TimeLimitExceeded"); } assert(image->cache != (Cache) NULL); cache_info=(CacheInfo *) image->cache; destroy=MagickFalse; if ((cache_info->reference_count > 1) || (cache_info->mode == ReadMode)) { LockSemaphoreInfo(cache_info->semaphore); if ((cache_info->reference_count > 1) || (cache_info->mode == ReadMode)) { CacheInfo *clone_info; Image clone_image; /* Clone pixel cache. */ clone_image=(*image); clone_image.semaphore=AllocateSemaphoreInfo(); clone_image.reference_count=1; clone_image.cache=ClonePixelCache(cache_info); clone_info=(CacheInfo *) clone_image.cache; status=OpenPixelCache(&clone_image,IOMode,exception); if (status != MagickFalse) { if (clone != MagickFalse) status=ClonePixelCacheRepository(clone_info,cache_info, exception); if (status != MagickFalse) { if (cache_info->reference_count == 1) cache_info->nexus_info=(NexusInfo **) NULL; destroy=MagickTrue; image->cache=clone_image.cache; } } DestroySemaphoreInfo(&clone_image.semaphore); } UnlockSemaphoreInfo(cache_info->semaphore); } if (destroy != MagickFalse) cache_info=(CacheInfo *) DestroyPixelCache(cache_info); if (status != MagickFalse) { /* Ensure the image matches the pixel cache morphology. */ image->type=UndefinedType; if (ValidatePixelCacheMorphology(image) == MagickFalse) { status=OpenPixelCache(image,IOMode,exception); cache_info=(CacheInfo *) image->cache; if (cache_info->type == DiskCache) (void) ClosePixelCacheOnDisk(cache_info); } } UnlockSemaphoreInfo(image->semaphore); if (status == MagickFalse) return((Cache) NULL); return(image->cache); }
static Cache GetImagePixelCache(Image *image,const MagickBooleanType clone, ExceptionInfo *exception) { CacheInfo *restrict cache_info; MagickBooleanType destroy, status; static MagickSizeType cpu_throttle = 0, cycles = 0, time_limit = 0; static time_t cache_timestamp = 0; status=MagickTrue; LockSemaphoreInfo(image->semaphore); if (cpu_throttle == 0) cpu_throttle=GetMagickResourceLimit(ThrottleResource); if ((cpu_throttle != MagickResourceInfinity) && ((cycles++ % 32) == 0)) MagickDelay(cpu_throttle); if (time_limit == 0) { /* Set the expire time in seconds. */ time_limit=GetMagickResourceLimit(TimeResource); cache_timestamp=time((time_t *) NULL); } if ((time_limit != MagickResourceInfinity) && ((MagickSizeType) (time((time_t *) NULL)-cache_timestamp) >= time_limit)) { #if defined(ECANCELED) errno=ECANCELED; #endif ThrowFatalException(ResourceLimitFatalError,"TimeLimitExceeded"); } assert(image->cache != (Cache) NULL); cache_info=(CacheInfo *) image->cache; destroy=MagickFalse; if ((cache_info->reference_count > 1) || (cache_info->mode == ReadMode)) { LockSemaphoreInfo(cache_info->semaphore); if ((cache_info->reference_count > 1) || (cache_info->mode == ReadMode)) { CacheInfo *clone_info; Image clone_image; /* Clone pixel cache. */ clone_image=(*image); clone_image.semaphore=AllocateSemaphoreInfo(); clone_image.reference_count=1; clone_image.cache=ClonePixelCache(cache_info); clone_info=(CacheInfo *) clone_image.cache; status=OpenPixelCache(&clone_image,IOMode,exception); if (status != MagickFalse) { if (clone != MagickFalse) status=ClonePixelCacheRepository(clone_info,cache_info, exception); if (status != MagickFalse) { if (cache_info->reference_count == 1) cache_info->nexus_info=(NexusInfo **) NULL; destroy=MagickTrue; image->cache=clone_image.cache; } } DestroySemaphoreInfo(&clone_image.semaphore); } UnlockSemaphoreInfo(cache_info->semaphore); } if (destroy != MagickFalse) cache_info=(CacheInfo *) DestroyPixelCache(cache_info); if (status != MagickFalse) { /* Ensure the image matches the pixel cache morphology. */ image->type=UndefinedType; if (ValidatePixelCacheMorphology(image) == MagickFalse) { status=OpenPixelCache(image,IOMode,exception); cache_info=(CacheInfo *) image->cache; if (cache_info->type == DiskCache) (void) ClosePixelCacheOnDisk(cache_info); } } UnlockSemaphoreInfo(image->semaphore); if (status == MagickFalse) return((Cache) NULL); return(image->cache); }
C
ImageMagick
0
CVE-2014-0203
https://www.cvedetails.com/cve/CVE-2014-0203/
CWE-20
https://github.com/torvalds/linux/commit/86acdca1b63e6890540fa19495cfc708beff3d8b
86acdca1b63e6890540fa19495cfc708beff3d8b
fix autofs/afs/etc. magic mountpoint breakage We end up trying to kfree() nd.last.name on open("/mnt/tmp", O_CREAT) if /mnt/tmp is an autofs direct mount. The reason is that nd.last_type is bogus here; we want LAST_BIND for everything of that kind and we get LAST_NORM left over from finding parent directory. So make sure that it *is* set properly; set to LAST_BIND before doing ->follow_link() - for normal symlinks it will be changed by __vfs_follow_link() and everything else needs it set that way. Signed-off-by: Al Viro <[email protected]>
static int pid_delete_dentry(struct dentry * dentry) { /* Is the task we represent dead? * If so, then don't put the dentry on the lru list, * kill it immediately. */ return !proc_pid(dentry->d_inode)->tasks[PIDTYPE_PID].first; }
static int pid_delete_dentry(struct dentry * dentry) { /* Is the task we represent dead? * If so, then don't put the dentry on the lru list, * kill it immediately. */ return !proc_pid(dentry->d_inode)->tasks[PIDTYPE_PID].first; }
C
linux
0
CVE-2016-5170
https://www.cvedetails.com/cve/CVE-2016-5170/
CWE-416
https://github.com/chromium/chromium/commit/c3957448cfc6e299165196a33cd954b790875fdb
c3957448cfc6e299165196a33cd954b790875fdb
Cleanup and remove dead code in SetFocusedElement This early-out was added in: https://crrev.com/ce8ea3446283965c7eabab592cbffe223b1cf2bc Back then, we applied fragment focus in LayoutUpdated() which could cause this issue. This got cleaned up in: https://crrev.com/45236fd563e9df53dc45579be1f3d0b4784885a2 so that focus is no longer applied after layout. +Cleanup: Goto considered harmful Bug: 795381 Change-Id: Ifeb4d2e03e872fd48cca6720b1d4de36ad1ecbb7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1524417 Commit-Queue: David Bokan <[email protected]> Reviewed-by: Stefan Zager <[email protected]> Cr-Commit-Position: refs/heads/master@{#641101}
bool Document::NextFrameHasPendingRAF() const { return scripted_animation_controller_ && scripted_animation_controller_->NextFrameHasPendingRAF(); }
bool Document::NextFrameHasPendingRAF() const { return scripted_animation_controller_ && scripted_animation_controller_->NextFrameHasPendingRAF(); }
C
Chrome
0
CVE-2017-5112
https://www.cvedetails.com/cve/CVE-2017-5112/
CWE-119
https://github.com/chromium/chromium/commit/f6ac1dba5e36f338a490752a2cbef3339096d9fe
f6ac1dba5e36f338a490752a2cbef3339096d9fe
Reset ES3 pixel pack parameters and PIXEL_PACK_BUFFER binding in DrawingBuffer before ReadPixels() and recover them later. BUG=740603 TEST=new conformance test [email protected],[email protected] Change-Id: I3ea54c6cc34f34e249f7c8b9f792d93c5e1958f4 Reviewed-on: https://chromium-review.googlesource.com/570840 Reviewed-by: Antoine Labour <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Commit-Queue: Zhenyao Mo <[email protected]> Cr-Commit-Position: refs/heads/master@{#486518}
void WebGL2RenderingContextBase::endQuery(GLenum target) { if (isContextLost()) return; switch (target) { case GL_ANY_SAMPLES_PASSED: case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: { if (current_boolean_occlusion_query_ && current_boolean_occlusion_query_->GetTarget() == target) { current_boolean_occlusion_query_->ResetCachedResult(); current_boolean_occlusion_query_ = nullptr; } else { SynthesizeGLError(GL_INVALID_OPERATION, "endQuery", "target query is not active"); return; } } break; case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: { if (current_transform_feedback_primitives_written_query_) { current_transform_feedback_primitives_written_query_ ->ResetCachedResult(); current_transform_feedback_primitives_written_query_ = nullptr; } else { SynthesizeGLError(GL_INVALID_OPERATION, "endQuery", "target query is not active"); return; } } break; case GL_TIME_ELAPSED_EXT: { if (!ExtensionEnabled(kEXTDisjointTimerQueryWebGL2Name)) { SynthesizeGLError(GL_INVALID_ENUM, "endQuery", "invalid target"); return; } if (current_elapsed_query_) { current_elapsed_query_->ResetCachedResult(); current_elapsed_query_ = nullptr; } else { SynthesizeGLError(GL_INVALID_OPERATION, "endQuery", "target query is not active"); return; } } break; default: SynthesizeGLError(GL_INVALID_ENUM, "endQuery", "invalid target"); return; } ContextGL()->EndQueryEXT(target); }
void WebGL2RenderingContextBase::endQuery(GLenum target) { if (isContextLost()) return; switch (target) { case GL_ANY_SAMPLES_PASSED: case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: { if (current_boolean_occlusion_query_ && current_boolean_occlusion_query_->GetTarget() == target) { current_boolean_occlusion_query_->ResetCachedResult(); current_boolean_occlusion_query_ = nullptr; } else { SynthesizeGLError(GL_INVALID_OPERATION, "endQuery", "target query is not active"); return; } } break; case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: { if (current_transform_feedback_primitives_written_query_) { current_transform_feedback_primitives_written_query_ ->ResetCachedResult(); current_transform_feedback_primitives_written_query_ = nullptr; } else { SynthesizeGLError(GL_INVALID_OPERATION, "endQuery", "target query is not active"); return; } } break; case GL_TIME_ELAPSED_EXT: { if (!ExtensionEnabled(kEXTDisjointTimerQueryWebGL2Name)) { SynthesizeGLError(GL_INVALID_ENUM, "endQuery", "invalid target"); return; } if (current_elapsed_query_) { current_elapsed_query_->ResetCachedResult(); current_elapsed_query_ = nullptr; } else { SynthesizeGLError(GL_INVALID_OPERATION, "endQuery", "target query is not active"); return; } } break; default: SynthesizeGLError(GL_INVALID_ENUM, "endQuery", "invalid target"); return; } ContextGL()->EndQueryEXT(target); }
C
Chrome
0
CVE-2014-8323
https://www.cvedetails.com/cve/CVE-2014-8323/
CWE-20
https://github.com/aircrack-ng/aircrack-ng/commit/da087238963c1239fdabd47dc1b65279605aca70
da087238963c1239fdabd47dc1b65279605aca70
Buddy-ng: Fixed segmentation fault (Closes #15 on GitHub). git-svn-id: http://svn.aircrack-ng.org/trunk@2418 28c6078b-6c39-48e3-add9-af49d547ecab
void usage() { printf("\n" " %s - (C) 2007,2008 Andrea Bittau\n" " http://www.aircrack-ng.org\n" "\n" " Usage: buddy-ng <options>\n" "\n" " Options:\n" "\n" " -h : This help screen\n" " -p : Don't drop privileges\n" "\n", getVersion("Buddy-ng", _MAJ, _MIN, _SUB_MIN, _REVISION, _BETA, _RC)); exit(1); }
void usage() { printf("\n" " %s - (C) 2007,2008 Andrea Bittau\n" " http://www.aircrack-ng.org\n" "\n" " Usage: buddy-ng <options>\n" "\n" " Options:\n" "\n" " -h : This help screen\n" " -p : Don't drop privileges\n" "\n", getVersion("Buddy-ng", _MAJ, _MIN, _SUB_MIN, _REVISION, _BETA, _RC)); exit(1); }
C
aircrack-ng
0
CVE-2013-1790
https://www.cvedetails.com/cve/CVE-2013-1790/
CWE-119
https://cgit.freedesktop.org/poppler/poppler/commit/?h=poppler-0.22&id=b1026b5978c385328f2a15a2185c599a563edf91
b1026b5978c385328f2a15a2185c599a563edf91
null
void CCITTFaxStream::reset() { int code1; ccittReset(gFalse); if (codingLine != NULL && refLine != NULL) { eof = gFalse; codingLine[0] = columns; } else { eof = gTrue; } while ((code1 = lookBits(12)) == 0) { eatBits(1); } if (code1 == 0x001) { eatBits(12); endOfLine = gTrue; } if (encoding > 0) { nextLine2D = !lookBits(1); eatBits(1); } }
void CCITTFaxStream::reset() { int code1; ccittReset(gFalse); if (codingLine != NULL && refLine != NULL) { eof = gFalse; codingLine[0] = columns; } else { eof = gTrue; } while ((code1 = lookBits(12)) == 0) { eatBits(1); } if (code1 == 0x001) { eatBits(12); endOfLine = gTrue; } if (encoding > 0) { nextLine2D = !lookBits(1); eatBits(1); } }
CPP
poppler
0
CVE-2011-3102
https://www.cvedetails.com/cve/CVE-2011-3102/
CWE-189
https://github.com/chromium/chromium/commit/4c46d7a5b0af9b7d320e709291b270ab7cf07e83
4c46d7a5b0af9b7d320e709291b270ab7cf07e83
Fix XPointer bug. BUG=125462 [email protected] [email protected] Review URL: https://chromiumcodereview.appspot.com/10344022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@135174 0039d316-1c4b-4281-b951-d872f2087c98
xmlXPtrErr(xmlXPathParserContextPtr ctxt, int error, const char * msg, const xmlChar *extra) { if (ctxt != NULL) ctxt->error = error; if ((ctxt == NULL) || (ctxt->context == NULL)) { __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_XPOINTER, error, XML_ERR_ERROR, NULL, 0, (const char *) extra, NULL, NULL, 0, 0, msg, extra); return; } ctxt->context->lastError.domain = XML_FROM_XPOINTER; ctxt->context->lastError.code = error; ctxt->context->lastError.level = XML_ERR_ERROR; ctxt->context->lastError.str1 = (char *) xmlStrdup(ctxt->base); ctxt->context->lastError.int1 = ctxt->cur - ctxt->base; ctxt->context->lastError.node = ctxt->context->debugNode; if (ctxt->context->error != NULL) { ctxt->context->error(ctxt->context->userData, &ctxt->context->lastError); } else { __xmlRaiseError(NULL, NULL, NULL, NULL, ctxt->context->debugNode, XML_FROM_XPOINTER, error, XML_ERR_ERROR, NULL, 0, (const char *) extra, (const char *) ctxt->base, NULL, ctxt->cur - ctxt->base, 0, msg, extra); } }
xmlXPtrErr(xmlXPathParserContextPtr ctxt, int error, const char * msg, const xmlChar *extra) { if (ctxt != NULL) ctxt->error = error; if ((ctxt == NULL) || (ctxt->context == NULL)) { __xmlRaiseError(NULL, NULL, NULL, NULL, NULL, XML_FROM_XPOINTER, error, XML_ERR_ERROR, NULL, 0, (const char *) extra, NULL, NULL, 0, 0, msg, extra); return; } ctxt->context->lastError.domain = XML_FROM_XPOINTER; ctxt->context->lastError.code = error; ctxt->context->lastError.level = XML_ERR_ERROR; ctxt->context->lastError.str1 = (char *) xmlStrdup(ctxt->base); ctxt->context->lastError.int1 = ctxt->cur - ctxt->base; ctxt->context->lastError.node = ctxt->context->debugNode; if (ctxt->context->error != NULL) { ctxt->context->error(ctxt->context->userData, &ctxt->context->lastError); } else { __xmlRaiseError(NULL, NULL, NULL, NULL, ctxt->context->debugNode, XML_FROM_XPOINTER, error, XML_ERR_ERROR, NULL, 0, (const char *) extra, (const char *) ctxt->base, NULL, ctxt->cur - ctxt->base, 0, msg, extra); } }
C
Chrome
0
CVE-2018-16425
https://www.cvedetails.com/cve/CVE-2018-16425/
CWE-415
https://github.com/OpenSC/OpenSC/commit/360e95d45ac4123255a4c796db96337f332160ad#diff-d643a0fa169471dbf2912f4866dc49c5
360e95d45ac4123255a4c796db96337f332160ad#diff-d643a0fa169471dbf2912f4866dc49c5
fixed out of bounds writes Thanks to Eric Sesterhenn from X41 D-SEC GmbH for reporting the problems.
static int list_keys(void) { int r, idx = 0; sc_path_t path; u8 buf[2048], *p = buf; size_t keysize, i; int mod_lens[] = { 512, 768, 1024, 2048 }; size_t sizes[] = { 167, 247, 327, 647 }; r = select_app_df(); if (r) return 1; sc_format_path("I1012", &path); r = sc_select_file(card, &path, NULL); if (r) { fprintf(stderr, "Unable to select public key file: %s\n", sc_strerror(r)); return 2; } do { int mod_len = -1; r = sc_read_binary(card, idx, buf, 3, 0); if (r < 0) { fprintf(stderr, "Unable to read public key file: %s\n", sc_strerror(r)); return 2; } keysize = (p[0] << 8) | p[1]; if (keysize == 0) break; idx += keysize; for (i = 0; i < sizeof(sizes)/sizeof(sizes[ 0]); i++) if (sizes[i] == keysize) mod_len = mod_lens[i]; if (mod_len < 0) printf("Key %d -- unknown modulus length\n", p[2] & 0x0F); else printf("Key %d -- Modulus length %d\n", p[2] & 0x0F, mod_len); } while (1); return 0; }
static int list_keys(void) { int r, idx = 0; sc_path_t path; u8 buf[2048], *p = buf; size_t keysize, i; int mod_lens[] = { 512, 768, 1024, 2048 }; size_t sizes[] = { 167, 247, 327, 647 }; r = select_app_df(); if (r) return 1; sc_format_path("I1012", &path); r = sc_select_file(card, &path, NULL); if (r) { fprintf(stderr, "Unable to select public key file: %s\n", sc_strerror(r)); return 2; } do { int mod_len = -1; r = sc_read_binary(card, idx, buf, 3, 0); if (r < 0) { fprintf(stderr, "Unable to read public key file: %s\n", sc_strerror(r)); return 2; } keysize = (p[0] << 8) | p[1]; if (keysize == 0) break; idx += keysize; for (i = 0; i < sizeof(sizes)/sizeof(sizes[ 0]); i++) if (sizes[i] == keysize) mod_len = mod_lens[i]; if (mod_len < 0) printf("Key %d -- unknown modulus length\n", p[2] & 0x0F); else printf("Key %d -- Modulus length %d\n", p[2] & 0x0F, mod_len); } while (1); return 0; }
C
OpenSC
0
CVE-2012-2890
https://www.cvedetails.com/cve/CVE-2012-2890/
CWE-399
https://github.com/chromium/chromium/commit/a6f7726de20450074a01493e4e85409ce3f2595a
a6f7726de20450074a01493e4e85409ce3f2595a
Unreviewed, rolling out r147402. http://trac.webkit.org/changeset/147402 https://bugs.webkit.org/show_bug.cgi?id=112903 Source/WebCore: * dom/Document.cpp: (WebCore::Document::processHttpEquiv): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): LayoutTests: * http/tests/security/XFrameOptions/x-frame-options-deny-expected.txt: * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-expected.txt: * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-in-body-expected.txt: * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-in-body.html: * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-parent-same-origin-deny-expected.txt: * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-parent-same-origin-deny.html: * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag.html: * http/tests/security/XFrameOptions/x-frame-options-deny.html: * http/tests/security/XFrameOptions/x-frame-options-multiple-headers-sameorigin-deny-expected.txt: * http/tests/security/XFrameOptions/x-frame-options-multiple-headers-sameorigin-deny.html: * http/tests/security/XFrameOptions/x-frame-options-parent-same-origin-deny-expected.txt: * http/tests/security/XFrameOptions/x-frame-options-parent-same-origin-deny.html: * platform/chromium/http/tests/security/XFrameOptions/x-frame-options-deny-expected.txt: * platform/chromium/http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-expected.txt: * platform/chromium/http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-in-body-expected.txt: * platform/chromium/http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-parent-same-origin-deny-expected.txt: * platform/chromium/http/tests/security/XFrameOptions/x-frame-options-multiple-headers-sameorigin-deny-expected.txt: * platform/chromium/http/tests/security/XFrameOptions/x-frame-options-parent-same-origin-deny-expected.txt: git-svn-id: svn://svn.chromium.org/blink/trunk@147450 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void DocumentLoader::addSubresourceLoader(ResourceLoader* loader) { if (!m_gotFirstByte) return; ASSERT(!m_subresourceLoaders.contains(loader)); ASSERT(!mainResourceLoader() || mainResourceLoader() != loader); m_subresourceLoaders.add(loader); }
void DocumentLoader::addSubresourceLoader(ResourceLoader* loader) { if (!m_gotFirstByte) return; ASSERT(!m_subresourceLoaders.contains(loader)); ASSERT(!mainResourceLoader() || mainResourceLoader() != loader); m_subresourceLoaders.add(loader); }
C
Chrome
0
CVE-2018-7492
https://www.cvedetails.com/cve/CVE-2018-7492/
CWE-476
https://github.com/torvalds/linux/commit/f3069c6d33f6ae63a1668737bc78aaaa51bff7ca
f3069c6d33f6ae63a1668737bc78aaaa51bff7ca
rds: Fix NULL pointer dereference in __rds_rdma_map This is a fix for syzkaller719569, where memory registration was attempted without any underlying transport being loaded. Analysis of the case reveals that it is the setsockopt() RDS_GET_MR (2) and RDS_GET_MR_FOR_DEST (7) that are vulnerable. Here is an example stack trace when the bug is hit: BUG: unable to handle kernel NULL pointer dereference at 00000000000000c0 IP: __rds_rdma_map+0x36/0x440 [rds] PGD 2f93d03067 P4D 2f93d03067 PUD 2f93d02067 PMD 0 Oops: 0000 [#1] SMP Modules linked in: bridge stp llc tun rpcsec_gss_krb5 nfsv4 dns_resolver nfs fscache rds binfmt_misc sb_edac intel_powerclamp coretemp kvm_intel kvm irqbypass crct10dif_pclmul c rc32_pclmul ghash_clmulni_intel pcbc aesni_intel crypto_simd glue_helper cryptd iTCO_wdt mei_me sg iTCO_vendor_support ipmi_si mei ipmi_devintf nfsd shpchp pcspkr i2c_i801 ioatd ma ipmi_msghandler wmi lpc_ich mfd_core auth_rpcgss nfs_acl lockd grace sunrpc ip_tables ext4 mbcache jbd2 mgag200 i2c_algo_bit drm_kms_helper ixgbe syscopyarea ahci sysfillrect sysimgblt libahci mdio fb_sys_fops ttm ptp libata sd_mod mlx4_core drm crc32c_intel pps_core megaraid_sas i2c_core dca dm_mirror dm_region_hash dm_log dm_mod CPU: 48 PID: 45787 Comm: repro_set2 Not tainted 4.14.2-3.el7uek.x86_64 #2 Hardware name: Oracle Corporation ORACLE SERVER X5-2L/ASM,MOBO TRAY,2U, BIOS 31110000 03/03/2017 task: ffff882f9190db00 task.stack: ffffc9002b994000 RIP: 0010:__rds_rdma_map+0x36/0x440 [rds] RSP: 0018:ffffc9002b997df0 EFLAGS: 00010202 RAX: 0000000000000000 RBX: ffff882fa2182580 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffc9002b997e40 RDI: ffff882fa2182580 RBP: ffffc9002b997e30 R08: 0000000000000000 R09: 0000000000000002 R10: ffff885fb29e3838 R11: 0000000000000000 R12: ffff882fa2182580 R13: ffff882fa2182580 R14: 0000000000000002 R15: 0000000020000ffc FS: 00007fbffa20b700(0000) GS:ffff882fbfb80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000000000c0 CR3: 0000002f98a66006 CR4: 00000000001606e0 Call Trace: rds_get_mr+0x56/0x80 [rds] rds_setsockopt+0x172/0x340 [rds] ? __fget_light+0x25/0x60 ? __fdget+0x13/0x20 SyS_setsockopt+0x80/0xe0 do_syscall_64+0x67/0x1b0 entry_SYSCALL64_slow_path+0x25/0x25 RIP: 0033:0x7fbff9b117f9 RSP: 002b:00007fbffa20aed8 EFLAGS: 00000293 ORIG_RAX: 0000000000000036 RAX: ffffffffffffffda RBX: 00000000000c84a4 RCX: 00007fbff9b117f9 RDX: 0000000000000002 RSI: 0000400000000114 RDI: 000000000000109b RBP: 00007fbffa20af10 R08: 0000000000000020 R09: 00007fbff9dd7860 R10: 0000000020000ffc R11: 0000000000000293 R12: 0000000000000000 R13: 00007fbffa20b9c0 R14: 00007fbffa20b700 R15: 0000000000000021 Code: 41 56 41 55 49 89 fd 41 54 53 48 83 ec 18 8b 87 f0 02 00 00 48 89 55 d0 48 89 4d c8 85 c0 0f 84 2d 03 00 00 48 8b 87 00 03 00 00 <48> 83 b8 c0 00 00 00 00 0f 84 25 03 00 0 0 48 8b 06 48 8b 56 08 The fix is to check the existence of an underlying transport in __rds_rdma_map(). Signed-off-by: Håkon Bugge <[email protected]> Reported-by: syzbot <[email protected]> Acked-by: Santosh Shilimkar <[email protected]> Signed-off-by: David S. Miller <[email protected]>
void rds_rdma_drop_keys(struct rds_sock *rs) { struct rds_mr *mr; struct rb_node *node; unsigned long flags; /* Release any MRs associated with this socket */ spin_lock_irqsave(&rs->rs_rdma_lock, flags); while ((node = rb_first(&rs->rs_rdma_keys))) { mr = rb_entry(node, struct rds_mr, r_rb_node); if (mr->r_trans == rs->rs_transport) mr->r_invalidate = 0; rb_erase(&mr->r_rb_node, &rs->rs_rdma_keys); RB_CLEAR_NODE(&mr->r_rb_node); spin_unlock_irqrestore(&rs->rs_rdma_lock, flags); rds_destroy_mr(mr); rds_mr_put(mr); spin_lock_irqsave(&rs->rs_rdma_lock, flags); } spin_unlock_irqrestore(&rs->rs_rdma_lock, flags); if (rs->rs_transport && rs->rs_transport->flush_mrs) rs->rs_transport->flush_mrs(); }
void rds_rdma_drop_keys(struct rds_sock *rs) { struct rds_mr *mr; struct rb_node *node; unsigned long flags; /* Release any MRs associated with this socket */ spin_lock_irqsave(&rs->rs_rdma_lock, flags); while ((node = rb_first(&rs->rs_rdma_keys))) { mr = rb_entry(node, struct rds_mr, r_rb_node); if (mr->r_trans == rs->rs_transport) mr->r_invalidate = 0; rb_erase(&mr->r_rb_node, &rs->rs_rdma_keys); RB_CLEAR_NODE(&mr->r_rb_node); spin_unlock_irqrestore(&rs->rs_rdma_lock, flags); rds_destroy_mr(mr); rds_mr_put(mr); spin_lock_irqsave(&rs->rs_rdma_lock, flags); } spin_unlock_irqrestore(&rs->rs_rdma_lock, flags); if (rs->rs_transport && rs->rs_transport->flush_mrs) rs->rs_transport->flush_mrs(); }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/dde871628c04863cf5992cb17e3e40f2ba576279
dde871628c04863cf5992cb17e3e40f2ba576279
Add a setDebugDirtyRegion() feature to the client. Calling remoting.clientSession.setDebugDirtyRegion(true) enables rendering of each frame's dirty region with an purple, translucent overlay. Currently the dirty region is re-rendered immediately for each frame, with no linger nor fade-out behaviour. BUG=427659 Review URL: https://codereview.chromium.org/932013002 Cr-Commit-Position: refs/heads/master@{#317496}
void ChromotingInstance::DeliverHostMessage( const protocol::ExtensionMessage& message) { scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->SetString("type", message.type()); data->SetString("data", message.data()); PostLegacyJsonMessage("extensionMessage", data.Pass()); }
void ChromotingInstance::DeliverHostMessage( const protocol::ExtensionMessage& message) { scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->SetString("type", message.type()); data->SetString("data", message.data()); PostLegacyJsonMessage("extensionMessage", data.Pass()); }
C
Chrome
0
CVE-2015-8324
https://www.cvedetails.com/cve/CVE-2015-8324/
null
https://github.com/torvalds/linux/commit/744692dc059845b2a3022119871846e74d4f6e11
744692dc059845b2a3022119871846e74d4f6e11
ext4: use ext4_get_block_write in buffer write Allocate uninitialized extent before ext4 buffer write and convert the extent to initialized after io completes. The purpose is to make sure an extent can only be marked initialized after it has been written with new data so we can safely drop the i_mutex lock in ext4 DIO read without exposing stale data. This helps to improve multi-thread DIO read performance on high-speed disks. Skip the nobh and data=journal mount cases to make things simple for now. Signed-off-by: Jiaying Zhang <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]>
static void ext4_init_journal_params(struct super_block *sb, journal_t *journal) { struct ext4_sb_info *sbi = EXT4_SB(sb); journal->j_commit_interval = sbi->s_commit_interval; journal->j_min_batch_time = sbi->s_min_batch_time; journal->j_max_batch_time = sbi->s_max_batch_time; spin_lock(&journal->j_state_lock); if (test_opt(sb, BARRIER)) journal->j_flags |= JBD2_BARRIER; else journal->j_flags &= ~JBD2_BARRIER; if (test_opt(sb, DATA_ERR_ABORT)) journal->j_flags |= JBD2_ABORT_ON_SYNCDATA_ERR; else journal->j_flags &= ~JBD2_ABORT_ON_SYNCDATA_ERR; spin_unlock(&journal->j_state_lock); }
static void ext4_init_journal_params(struct super_block *sb, journal_t *journal) { struct ext4_sb_info *sbi = EXT4_SB(sb); journal->j_commit_interval = sbi->s_commit_interval; journal->j_min_batch_time = sbi->s_min_batch_time; journal->j_max_batch_time = sbi->s_max_batch_time; spin_lock(&journal->j_state_lock); if (test_opt(sb, BARRIER)) journal->j_flags |= JBD2_BARRIER; else journal->j_flags &= ~JBD2_BARRIER; if (test_opt(sb, DATA_ERR_ABORT)) journal->j_flags |= JBD2_ABORT_ON_SYNCDATA_ERR; else journal->j_flags &= ~JBD2_ABORT_ON_SYNCDATA_ERR; spin_unlock(&journal->j_state_lock); }
C
linux
0
CVE-2014-3186
https://www.cvedetails.com/cve/CVE-2014-3186/
CWE-119
https://github.com/torvalds/linux/commit/844817e47eef14141cf59b8d5ac08dd11c0a9189
844817e47eef14141cf59b8d5ac08dd11c0a9189
HID: picolcd: sanity check report size in raw_event() callback The report passed to us from transport driver could potentially be arbitrarily large, therefore we better sanity-check it so that raw_data that we hold in picolcd_pending structure are always kept within proper bounds. Cc: [email protected] Reported-by: Steven Vittitoe <[email protected]> Signed-off-by: Jiri Kosina <[email protected]>
static int picolcd_probe_bootloader(struct hid_device *hdev, struct picolcd_data *data) { picolcd_init_devfs(data, NULL, NULL, picolcd_out_report(REPORT_BL_READ_MEMORY, hdev), picolcd_out_report(REPORT_BL_WRITE_MEMORY, hdev), NULL); return 0; }
static int picolcd_probe_bootloader(struct hid_device *hdev, struct picolcd_data *data) { picolcd_init_devfs(data, NULL, NULL, picolcd_out_report(REPORT_BL_READ_MEMORY, hdev), picolcd_out_report(REPORT_BL_WRITE_MEMORY, hdev), NULL); return 0; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/9d02cda7a634fbd6e53d98091f618057f0174387
9d02cda7a634fbd6e53d98091f618057f0174387
Coverity: Fixing pass by value. CID=101462, 101458, 101437, 101471, 101467 BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/9006023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115257 0039d316-1c4b-4281-b951-d872f2087c98
void ExtensionPrefs::SetExtensionPrefPermissionSet( const std::string& extension_id, const std::string& pref_key, const ExtensionPermissionSet* new_value) { ListValue* api_values = new ListValue(); ExtensionAPIPermissionSet apis = new_value->apis(); ExtensionPermissionsInfo* info = ExtensionPermissionsInfo::GetInstance(); std::string api_pref = JoinPrefs(pref_key, kPrefAPIs); for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); i != apis.end(); ++i) { ExtensionAPIPermission* perm = info->GetByID(*i); if (perm) api_values->Append(Value::CreateStringValue(perm->name())); } UpdateExtensionPref(extension_id, api_pref, api_values); if (!new_value->explicit_hosts().is_empty()) { SetExtensionPrefURLPatternSet(extension_id, JoinPrefs(pref_key, kPrefExplicitHosts), new_value->explicit_hosts()); } if (!new_value->scriptable_hosts().is_empty()) { SetExtensionPrefURLPatternSet(extension_id, JoinPrefs(pref_key, kPrefScriptableHosts), new_value->scriptable_hosts()); } }
void ExtensionPrefs::SetExtensionPrefPermissionSet( const std::string& extension_id, const std::string& pref_key, const ExtensionPermissionSet* new_value) { ListValue* api_values = new ListValue(); ExtensionAPIPermissionSet apis = new_value->apis(); ExtensionPermissionsInfo* info = ExtensionPermissionsInfo::GetInstance(); std::string api_pref = JoinPrefs(pref_key, kPrefAPIs); for (ExtensionAPIPermissionSet::const_iterator i = apis.begin(); i != apis.end(); ++i) { ExtensionAPIPermission* perm = info->GetByID(*i); if (perm) api_values->Append(Value::CreateStringValue(perm->name())); } UpdateExtensionPref(extension_id, api_pref, api_values); if (!new_value->explicit_hosts().is_empty()) { SetExtensionPrefURLPatternSet(extension_id, JoinPrefs(pref_key, kPrefExplicitHosts), new_value->explicit_hosts()); } if (!new_value->scriptable_hosts().is_empty()) { SetExtensionPrefURLPatternSet(extension_id, JoinPrefs(pref_key, kPrefScriptableHosts), new_value->scriptable_hosts()); } }
C
Chrome
0
CVE-2013-4516
https://www.cvedetails.com/cve/CVE-2013-4516/
CWE-200
https://github.com/torvalds/linux/commit/a8b33654b1e3b0c74d4a1fed041c9aae50b3c427
a8b33654b1e3b0c74d4a1fed041c9aae50b3c427
Staging: sb105x: info leak in mp_get_count() The icount.reserved[] array isn't initialized so it leaks stack information to userspace. Reported-by: Nico Golde <[email protected]> Reported-by: Fabian Yamaguchi <[email protected]> Signed-off-by: Dan Carpenter <[email protected]> Cc: [email protected] Signed-off-by: Linus Torvalds <[email protected]>
static unsigned int multi_get_mctrl(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; unsigned char status; unsigned int ret; status = serial_in(mtpt, UART_MSR); ret = 0; if (status & UART_MSR_DCD) ret |= TIOCM_CAR; if (status & UART_MSR_RI) ret |= TIOCM_RNG; if (status & UART_MSR_DSR) ret |= TIOCM_DSR; if (status & UART_MSR_CTS) ret |= TIOCM_CTS; return ret; }
static unsigned int multi_get_mctrl(struct sb_uart_port *port) { struct mp_port *mtpt = (struct mp_port *)port; unsigned char status; unsigned int ret; status = serial_in(mtpt, UART_MSR); ret = 0; if (status & UART_MSR_DCD) ret |= TIOCM_CAR; if (status & UART_MSR_RI) ret |= TIOCM_RNG; if (status & UART_MSR_DSR) ret |= TIOCM_DSR; if (status & UART_MSR_CTS) ret |= TIOCM_CTS; return ret; }
C
linux
0
CVE-2018-16077
https://www.cvedetails.com/cve/CVE-2018-16077/
CWE-285
https://github.com/chromium/chromium/commit/90f878780cce9c4b0475fcea14d91b8f510cce11
90f878780cce9c4b0475fcea14d91b8f510cce11
Prevent sandboxed documents from reusing the default window Bug: 377995 Change-Id: Iff66c6d214dfd0cb7ea9c80f83afeedfff703541 Reviewed-on: https://chromium-review.googlesource.com/983558 Commit-Queue: Andy Paicu <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Cr-Commit-Position: refs/heads/master@{#567663}
String LocalFrame::GetLayerTreeAsTextForTesting(unsigned flags) const { if (!ContentLayoutObject()) return String(); std::unique_ptr<JSONObject> layers; if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { layers = View()->CompositedLayersAsJSON(static_cast<LayerTreeFlags>(flags)); } else { if (const auto* root_layer = ContentLayoutObject()->Compositor()->RootGraphicsLayer()) { if (flags & kLayerTreeIncludesRootLayer && IsMainFrame()) { while (root_layer->Parent()) root_layer = root_layer->Parent(); } layers = root_layer->LayerTreeAsJSON(static_cast<LayerTreeFlags>(flags)); } } if (flags & kLayerTreeIncludesPaintInvalidations) { std::unique_ptr<JSONArray> object_paint_invalidations = view_->TrackedObjectPaintInvalidationsAsJSON(); if (object_paint_invalidations && object_paint_invalidations->size()) { if (!layers) layers = JSONObject::Create(); layers->SetArray("objectPaintInvalidations", std::move(object_paint_invalidations)); } } return layers ? layers->ToPrettyJSONString() : String(); }
String LocalFrame::GetLayerTreeAsTextForTesting(unsigned flags) const { if (!ContentLayoutObject()) return String(); std::unique_ptr<JSONObject> layers; if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled()) { layers = View()->CompositedLayersAsJSON(static_cast<LayerTreeFlags>(flags)); } else { if (const auto* root_layer = ContentLayoutObject()->Compositor()->RootGraphicsLayer()) { if (flags & kLayerTreeIncludesRootLayer && IsMainFrame()) { while (root_layer->Parent()) root_layer = root_layer->Parent(); } layers = root_layer->LayerTreeAsJSON(static_cast<LayerTreeFlags>(flags)); } } if (flags & kLayerTreeIncludesPaintInvalidations) { std::unique_ptr<JSONArray> object_paint_invalidations = view_->TrackedObjectPaintInvalidationsAsJSON(); if (object_paint_invalidations && object_paint_invalidations->size()) { if (!layers) layers = JSONObject::Create(); layers->SetArray("objectPaintInvalidations", std::move(object_paint_invalidations)); } } return layers ? layers->ToPrettyJSONString() : String(); }
C
Chrome
0
CVE-2017-14172
https://www.cvedetails.com/cve/CVE-2017-14172/
CWE-834
https://github.com/ImageMagick/ImageMagick/commit/8598a497e2d1f556a34458cf54b40ba40674734c
8598a497e2d1f556a34458cf54b40ba40674734c
https://github.com/ImageMagick/ImageMagick/issues/715
static int MagickDLLCall PostscriptDelegateMessage(void *handle, const char *message,int length) { char **messages; ssize_t offset; offset=0; messages=(char **) handle; if (*messages == (char *) NULL) *messages=(char *) AcquireQuantumMemory(length+1,sizeof(char *)); else { offset=strlen(*messages); *messages=(char *) ResizeQuantumMemory(*messages,offset+length+1, sizeof(char *)); } (void) memcpy(*messages+offset,message,length); (*messages)[length+offset] ='\0'; return(length); }
static int MagickDLLCall PostscriptDelegateMessage(void *handle, const char *message,int length) { char **messages; ssize_t offset; offset=0; messages=(char **) handle; if (*messages == (char *) NULL) *messages=(char *) AcquireQuantumMemory(length+1,sizeof(char *)); else { offset=strlen(*messages); *messages=(char *) ResizeQuantumMemory(*messages,offset+length+1, sizeof(char *)); } (void) memcpy(*messages+offset,message,length); (*messages)[length+offset] ='\0'; return(length); }
C
ImageMagick
0
null
null
null
https://github.com/chromium/chromium/commit/1161a49d663dd395bd639549c2dfe7324f847938
1161a49d663dd395bd639549c2dfe7324f847938
Don't populate URL data in WebDropData when dragging files. This is considered a potential security issue as well, since it leaks filesystem paths. BUG=332579 Review URL: https://codereview.chromium.org/135633002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244538 0039d316-1c4b-4281-b951-d872f2087c98
void PrepareDragData(const DropData& drop_data, ui::OSExchangeData::Provider* provider, WebContentsImpl* web_contents) { #if defined(OS_WIN) if (!drop_data.download_metadata.empty()) PrepareDragForDownload(drop_data, provider, web_contents); if (!drop_data.file_contents.empty()) PrepareDragForFileContents(drop_data, provider); #endif if (!drop_data.text.string().empty()) provider->SetString(drop_data.text.string()); if (drop_data.url.is_valid()) provider->SetURL(drop_data.url, drop_data.url_title); if (!drop_data.html.string().empty()) provider->SetHtml(drop_data.html.string(), drop_data.html_base_url); if (!drop_data.filenames.empty()) { std::vector<ui::OSExchangeData::FileInfo> filenames; for (std::vector<DropData::FileInfo>::const_iterator it = drop_data.filenames.begin(); it != drop_data.filenames.end(); ++it) { filenames.push_back( ui::OSExchangeData::FileInfo( base::FilePath::FromUTF8Unsafe(base::UTF16ToUTF8(it->path)), base::FilePath::FromUTF8Unsafe( base::UTF16ToUTF8(it->display_name)))); } provider->SetFilenames(filenames); } if (!drop_data.custom_data.empty()) { Pickle pickle; ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle); provider->SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(), pickle); } }
void PrepareDragData(const DropData& drop_data, ui::OSExchangeData::Provider* provider, WebContentsImpl* web_contents) { #if defined(OS_WIN) if (!drop_data.download_metadata.empty()) PrepareDragForDownload(drop_data, provider, web_contents); if (!drop_data.file_contents.empty()) PrepareDragForFileContents(drop_data, provider); #endif if (!drop_data.text.string().empty()) provider->SetString(drop_data.text.string()); if (drop_data.url.is_valid()) provider->SetURL(drop_data.url, drop_data.url_title); if (!drop_data.html.string().empty()) provider->SetHtml(drop_data.html.string(), drop_data.html_base_url); if (!drop_data.filenames.empty()) { std::vector<ui::OSExchangeData::FileInfo> filenames; for (std::vector<DropData::FileInfo>::const_iterator it = drop_data.filenames.begin(); it != drop_data.filenames.end(); ++it) { filenames.push_back( ui::OSExchangeData::FileInfo( base::FilePath::FromUTF8Unsafe(base::UTF16ToUTF8(it->path)), base::FilePath::FromUTF8Unsafe( base::UTF16ToUTF8(it->display_name)))); } provider->SetFilenames(filenames); } if (!drop_data.custom_data.empty()) { Pickle pickle; ui::WriteCustomDataToPickle(drop_data.custom_data, &pickle); provider->SetPickledData(ui::Clipboard::GetWebCustomDataFormatType(), pickle); } }
C
Chrome
0
CVE-2015-3215
https://www.cvedetails.com/cve/CVE-2015-3215/
CWE-20
https://github.com/YanVugenfirer/kvm-guest-drivers-windows/commit/fbfa4d1083ea84c5429992ca3e996d7d4fbc8238
fbfa4d1083ea84c5429992ca3e996d7d4fbc8238
NetKVM: BZ#1169718: More rigoruous testing of incoming packet Signed-off-by: Joseph Hindin <[email protected]>
VOID AnalyzeL3Proto( USHORT L3Proto, PNET_PACKET_INFO packetInfo) { packetInfo->isIP4 = (L3Proto == RtlUshortByteSwap(ETH_PROTO_IP4)); packetInfo->isIP6 = (L3Proto == RtlUshortByteSwap(ETH_PROTO_IP6)); }
VOID AnalyzeL3Proto( USHORT L3Proto, PNET_PACKET_INFO packetInfo) { packetInfo->isIP4 = (L3Proto == RtlUshortByteSwap(ETH_PROTO_IP4)); packetInfo->isIP6 = (L3Proto == RtlUshortByteSwap(ETH_PROTO_IP6)); }
C
kvm-guest-drivers-windows
0
CVE-2016-1667
https://www.cvedetails.com/cve/CVE-2016-1667/
CWE-284
https://github.com/chromium/chromium/commit/350f7d4b2c76950c8e7271284de84a9756b796e1
350f7d4b2c76950c8e7271284de84a9756b796e1
P2PQuicStream write functionality. This adds the P2PQuicStream::WriteData function and adds tests. It also adds the concept of a write buffered amount, enforcing this at the P2PQuicStreamImpl. Bug: 874296 Change-Id: Id02c8aa8d5368a87bb24a2e50dab5ef94bcae131 Reviewed-on: https://chromium-review.googlesource.com/c/1315534 Commit-Queue: Seth Hampson <[email protected]> Reviewed-by: Henrik Boström <[email protected]> Cr-Commit-Position: refs/heads/master@{#605766}
void P2PQuicStreamImpl::OnStreamReset(const quic::QuicRstStreamFrame& frame) { quic::QuicStream::OnStreamReset(frame); delegate_->OnRemoteReset(); }
void P2PQuicStreamImpl::OnStreamReset(const quic::QuicRstStreamFrame& frame) { quic::QuicStream::OnStreamReset(frame); delegate_->OnRemoteReset(); }
C
Chrome
1
CVE-2014-1700
https://www.cvedetails.com/cve/CVE-2014-1700/
CWE-399
https://github.com/chromium/chromium/commit/685c3980d31b5199924086b8c93a1ce751d24733
685c3980d31b5199924086b8c93a1ce751d24733
content: Rename webkit_test_helpers.{cc,h} to blink_test_helpers.{cc,h} Now that webkit/ is gone, we are preparing ourselves for the merge of third_party/WebKit into //blink. BUG=None BUG=content_shell && content_unittests [email protected] Review URL: https://codereview.chromium.org/1118183003 Cr-Commit-Position: refs/heads/master@{#328202}
void RegisterSideloadedTypefaces(SkFontMgr* fontmgr) { std::vector<std::string> files = GetSideloadFontFiles(); for (std::vector<std::string>::const_iterator i(files.begin()); i != files.end(); ++i) { SkTypeface* typeface = fontmgr->createFromFile(i->c_str()); DoPreSandboxWarmupForTypeface(typeface); blink::WebFontRendering::addSideloadedFontForTesting(typeface); } }
void RegisterSideloadedTypefaces(SkFontMgr* fontmgr) { std::vector<std::string> files = GetSideloadFontFiles(); for (std::vector<std::string>::const_iterator i(files.begin()); i != files.end(); ++i) { SkTypeface* typeface = fontmgr->createFromFile(i->c_str()); DoPreSandboxWarmupForTypeface(typeface); blink::WebFontRendering::addSideloadedFontForTesting(typeface); } }
C
Chrome
0
CVE-2015-8104
https://www.cvedetails.com/cve/CVE-2015-8104/
CWE-399
https://github.com/torvalds/linux/commit/cbdb967af3d54993f5814f1cee0ed311a055377d
cbdb967af3d54993f5814f1cee0ed311a055377d
KVM: svm: unconditionally intercept #DB This is needed to avoid the possibility that the guest triggers an infinite stream of #DB exceptions (CVE-2015-8104). VMX is not affected: because it does not save DR6 in the VMCS, it already intercepts #DB unconditionally. Reported-by: Jan Beulich <[email protected]> Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
static int svm_check_intercept(struct kvm_vcpu *vcpu, struct x86_instruction_info *info, enum x86_intercept_stage stage) { struct vcpu_svm *svm = to_svm(vcpu); int vmexit, ret = X86EMUL_CONTINUE; struct __x86_intercept icpt_info; struct vmcb *vmcb = svm->vmcb; if (info->intercept >= ARRAY_SIZE(x86_intercept_map)) goto out; icpt_info = x86_intercept_map[info->intercept]; if (stage != icpt_info.stage) goto out; switch (icpt_info.exit_code) { case SVM_EXIT_READ_CR0: if (info->intercept == x86_intercept_cr_read) icpt_info.exit_code += info->modrm_reg; break; case SVM_EXIT_WRITE_CR0: { unsigned long cr0, val; u64 intercept; if (info->intercept == x86_intercept_cr_write) icpt_info.exit_code += info->modrm_reg; if (icpt_info.exit_code != SVM_EXIT_WRITE_CR0 || info->intercept == x86_intercept_clts) break; intercept = svm->nested.intercept; if (!(intercept & (1ULL << INTERCEPT_SELECTIVE_CR0))) break; cr0 = vcpu->arch.cr0 & ~SVM_CR0_SELECTIVE_MASK; val = info->src_val & ~SVM_CR0_SELECTIVE_MASK; if (info->intercept == x86_intercept_lmsw) { cr0 &= 0xfUL; val &= 0xfUL; /* lmsw can't clear PE - catch this here */ if (cr0 & X86_CR0_PE) val |= X86_CR0_PE; } if (cr0 ^ val) icpt_info.exit_code = SVM_EXIT_CR0_SEL_WRITE; break; } case SVM_EXIT_READ_DR0: case SVM_EXIT_WRITE_DR0: icpt_info.exit_code += info->modrm_reg; break; case SVM_EXIT_MSR: if (info->intercept == x86_intercept_wrmsr) vmcb->control.exit_info_1 = 1; else vmcb->control.exit_info_1 = 0; break; case SVM_EXIT_PAUSE: /* * We get this for NOP only, but pause * is rep not, check this here */ if (info->rep_prefix != REPE_PREFIX) goto out; case SVM_EXIT_IOIO: { u64 exit_info; u32 bytes; if (info->intercept == x86_intercept_in || info->intercept == x86_intercept_ins) { exit_info = ((info->src_val & 0xffff) << 16) | SVM_IOIO_TYPE_MASK; bytes = info->dst_bytes; } else { exit_info = (info->dst_val & 0xffff) << 16; bytes = info->src_bytes; } if (info->intercept == x86_intercept_outs || info->intercept == x86_intercept_ins) exit_info |= SVM_IOIO_STR_MASK; if (info->rep_prefix) exit_info |= SVM_IOIO_REP_MASK; bytes = min(bytes, 4u); exit_info |= bytes << SVM_IOIO_SIZE_SHIFT; exit_info |= (u32)info->ad_bytes << (SVM_IOIO_ASIZE_SHIFT - 1); vmcb->control.exit_info_1 = exit_info; vmcb->control.exit_info_2 = info->next_rip; break; } default: break; } /* TODO: Advertise NRIPS to guest hypervisor unconditionally */ if (static_cpu_has(X86_FEATURE_NRIPS)) vmcb->control.next_rip = info->next_rip; vmcb->control.exit_code = icpt_info.exit_code; vmexit = nested_svm_exit_handled(svm); ret = (vmexit == NESTED_EXIT_DONE) ? X86EMUL_INTERCEPTED : X86EMUL_CONTINUE; out: return ret; }
static int svm_check_intercept(struct kvm_vcpu *vcpu, struct x86_instruction_info *info, enum x86_intercept_stage stage) { struct vcpu_svm *svm = to_svm(vcpu); int vmexit, ret = X86EMUL_CONTINUE; struct __x86_intercept icpt_info; struct vmcb *vmcb = svm->vmcb; if (info->intercept >= ARRAY_SIZE(x86_intercept_map)) goto out; icpt_info = x86_intercept_map[info->intercept]; if (stage != icpt_info.stage) goto out; switch (icpt_info.exit_code) { case SVM_EXIT_READ_CR0: if (info->intercept == x86_intercept_cr_read) icpt_info.exit_code += info->modrm_reg; break; case SVM_EXIT_WRITE_CR0: { unsigned long cr0, val; u64 intercept; if (info->intercept == x86_intercept_cr_write) icpt_info.exit_code += info->modrm_reg; if (icpt_info.exit_code != SVM_EXIT_WRITE_CR0 || info->intercept == x86_intercept_clts) break; intercept = svm->nested.intercept; if (!(intercept & (1ULL << INTERCEPT_SELECTIVE_CR0))) break; cr0 = vcpu->arch.cr0 & ~SVM_CR0_SELECTIVE_MASK; val = info->src_val & ~SVM_CR0_SELECTIVE_MASK; if (info->intercept == x86_intercept_lmsw) { cr0 &= 0xfUL; val &= 0xfUL; /* lmsw can't clear PE - catch this here */ if (cr0 & X86_CR0_PE) val |= X86_CR0_PE; } if (cr0 ^ val) icpt_info.exit_code = SVM_EXIT_CR0_SEL_WRITE; break; } case SVM_EXIT_READ_DR0: case SVM_EXIT_WRITE_DR0: icpt_info.exit_code += info->modrm_reg; break; case SVM_EXIT_MSR: if (info->intercept == x86_intercept_wrmsr) vmcb->control.exit_info_1 = 1; else vmcb->control.exit_info_1 = 0; break; case SVM_EXIT_PAUSE: /* * We get this for NOP only, but pause * is rep not, check this here */ if (info->rep_prefix != REPE_PREFIX) goto out; case SVM_EXIT_IOIO: { u64 exit_info; u32 bytes; if (info->intercept == x86_intercept_in || info->intercept == x86_intercept_ins) { exit_info = ((info->src_val & 0xffff) << 16) | SVM_IOIO_TYPE_MASK; bytes = info->dst_bytes; } else { exit_info = (info->dst_val & 0xffff) << 16; bytes = info->src_bytes; } if (info->intercept == x86_intercept_outs || info->intercept == x86_intercept_ins) exit_info |= SVM_IOIO_STR_MASK; if (info->rep_prefix) exit_info |= SVM_IOIO_REP_MASK; bytes = min(bytes, 4u); exit_info |= bytes << SVM_IOIO_SIZE_SHIFT; exit_info |= (u32)info->ad_bytes << (SVM_IOIO_ASIZE_SHIFT - 1); vmcb->control.exit_info_1 = exit_info; vmcb->control.exit_info_2 = info->next_rip; break; } default: break; } /* TODO: Advertise NRIPS to guest hypervisor unconditionally */ if (static_cpu_has(X86_FEATURE_NRIPS)) vmcb->control.next_rip = info->next_rip; vmcb->control.exit_code = icpt_info.exit_code; vmexit = nested_svm_exit_handled(svm); ret = (vmexit == NESTED_EXIT_DONE) ? X86EMUL_INTERCEPTED : X86EMUL_CONTINUE; out: return ret; }
C
linux
0
CVE-2013-6368
https://www.cvedetails.com/cve/CVE-2013-6368/
CWE-20
https://github.com/torvalds/linux/commit/fda4e2e85589191b123d31cdc21fd33ee70f50fd
fda4e2e85589191b123d31cdc21fd33ee70f50fd
KVM: x86: Convert vapic synchronization to _cached functions (CVE-2013-6368) In kvm_lapic_sync_from_vapic and kvm_lapic_sync_to_vapic there is the potential to corrupt kernel memory if userspace provides an address that is at the end of a page. This patches concerts those functions to use kvm_write_guest_cached and kvm_read_guest_cached. It also checks the vapic_address specified by userspace during ioctl processing and returns an error to userspace if the address is not a valid GPA. This is generally not guest triggerable, because the required write is done by firmware that runs before the guest. Also, it only affects AMD processors and oldish Intel that do not have the FlexPriority feature (unless you disable FlexPriority, of course; then newer processors are also affected). Fixes: b93463aa59d6 ('KVM: Accelerated apic support') Reported-by: Andrew Honig <[email protected]> Cc: [email protected] Signed-off-by: Andrew Honig <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
void kvm_arch_unregister_noncoherent_dma(struct kvm *kvm) { atomic_dec(&kvm->arch.noncoherent_dma_count); }
void kvm_arch_unregister_noncoherent_dma(struct kvm *kvm) { atomic_dec(&kvm->arch.noncoherent_dma_count); }
C
linux
0
CVE-2019-12981
https://www.cvedetails.com/cve/CVE-2019-12981/
CWE-119
https://github.com/libming/libming/pull/179/commits/3dc0338e4a36a3092720ebaa5b908ba3dca467d9
3dc0338e4a36a3092720ebaa5b908ba3dca467d9
SWFShape_setLeftFillStyle: prevent fill overflow
static int addFillStyle(SWFShape shape, SWFFillStyle fill) { int i; for ( i=0; i<shape->nFills; ++i ) { if ( SWFFillStyle_equals(fill, shape->fills[i]) ) return i; } if ( shape->isEnded ) return -1; if ( shape->nFills%STYLE_INCREMENT == 0 ) { int size = (shape->nFills+STYLE_INCREMENT) * sizeof(SWFFillStyle); shape->fills = (SWFFillStyle*)realloc(shape->fills, size); } shape->fills[shape->nFills] = fill; ++shape->nFills; return shape->nFills; }
static int addFillStyle(SWFShape shape, SWFFillStyle fill) { int i; for ( i=0; i<shape->nFills; ++i ) { if ( SWFFillStyle_equals(fill, shape->fills[i]) ) return i; } if ( shape->isEnded ) return -1; if ( shape->nFills%STYLE_INCREMENT == 0 ) { int size = (shape->nFills+STYLE_INCREMENT) * sizeof(SWFFillStyle); shape->fills = (SWFFillStyle*)realloc(shape->fills, size); } shape->fills[shape->nFills] = fill; ++shape->nFills; return shape->nFills; }
C
libming
0
CVE-2012-2867
https://www.cvedetails.com/cve/CVE-2012-2867/
null
https://github.com/chromium/chromium/commit/b7a161633fd7ecb59093c2c56ed908416292d778
b7a161633fd7ecb59093c2c56ed908416292d778
[GTK][WTR] Implement AccessibilityUIElement::stringValue https://bugs.webkit.org/show_bug.cgi?id=102951 Reviewed by Martin Robinson. Implement AccessibilityUIElement::stringValue in the ATK backend in the same manner it is implemented in DumpRenderTree. * WebKitTestRunner/InjectedBundle/atk/AccessibilityUIElementAtk.cpp: (WTR::replaceCharactersForResults): (WTR): (WTR::AccessibilityUIElement::stringValue): git-svn-id: svn://svn.chromium.org/blink/trunk@135485 bbb929c8-8fbe-4397-9dbb-9b2b20218538
JSRetainPtr<JSStringRef> AccessibilityUIElement::speak() { return JSStringCreateWithCharacters(0, 0); }
JSRetainPtr<JSStringRef> AccessibilityUIElement::speak() { return JSStringCreateWithCharacters(0, 0); }
C
Chrome
0
CVE-2018-12714
https://www.cvedetails.com/cve/CVE-2018-12714/
CWE-787
https://github.com/torvalds/linux/commit/81f9c4e4177d31ced6f52a89bb70e93bfb77ca03
81f9c4e4177d31ced6f52a89bb70e93bfb77ca03
Merge tag 'trace-v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace Pull tracing fixes from Steven Rostedt: "This contains a few fixes and a clean up. - a bad merge caused an "endif" to go in the wrong place in scripts/Makefile.build - softirq tracing fix for tracing that corrupts lockdep and causes a false splat - histogram documentation typo fixes - fix a bad memory reference when passing in no filter to the filter code - simplify code by using the swap macro instead of open coding the swap" * tag 'trace-v4.18-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Fix SKIP_STACK_VALIDATION=1 build due to bad merge with -mrecord-mcount tracing: Fix some errors in histogram documentation tracing: Use swap macro in update_max_tr softirq: Reorder trace_softirqs_on to prevent lockdep splat tracing: Check for no filter when processing event filters
trace_event_setup(struct ring_buffer_event *event, int type, unsigned long flags, int pc) { struct trace_entry *ent = ring_buffer_event_data(event); tracing_generic_entry_update(ent, flags, pc); ent->type = type; }
trace_event_setup(struct ring_buffer_event *event, int type, unsigned long flags, int pc) { struct trace_entry *ent = ring_buffer_event_data(event); tracing_generic_entry_update(ent, flags, pc); ent->type = type; }
C
linux
0
CVE-2017-5112
https://www.cvedetails.com/cve/CVE-2017-5112/
CWE-119
https://github.com/chromium/chromium/commit/f6ac1dba5e36f338a490752a2cbef3339096d9fe
f6ac1dba5e36f338a490752a2cbef3339096d9fe
Reset ES3 pixel pack parameters and PIXEL_PACK_BUFFER binding in DrawingBuffer before ReadPixels() and recover them later. BUG=740603 TEST=new conformance test [email protected],[email protected] Change-Id: I3ea54c6cc34f34e249f7c8b9f792d93c5e1958f4 Reviewed-on: https://chromium-review.googlesource.com/570840 Reviewed-by: Antoine Labour <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Commit-Queue: Zhenyao Mo <[email protected]> Cr-Commit-Position: refs/heads/master@{#486518}
void WebGLRenderingContextBase::bindRenderbuffer( GLenum target, WebGLRenderbuffer* render_buffer) { bool deleted; if (!CheckObjectToBeBound("bindRenderbuffer", render_buffer, deleted)) return; if (deleted) { SynthesizeGLError(GL_INVALID_OPERATION, "bindRenderbuffer", "attempt to bind a deleted renderbuffer"); return; } if (target != GL_RENDERBUFFER) { SynthesizeGLError(GL_INVALID_ENUM, "bindRenderbuffer", "invalid target"); return; } renderbuffer_binding_ = render_buffer; ContextGL()->BindRenderbuffer(target, ObjectOrZero(render_buffer)); if (render_buffer) render_buffer->SetHasEverBeenBound(); }
void WebGLRenderingContextBase::bindRenderbuffer( GLenum target, WebGLRenderbuffer* render_buffer) { bool deleted; if (!CheckObjectToBeBound("bindRenderbuffer", render_buffer, deleted)) return; if (deleted) { SynthesizeGLError(GL_INVALID_OPERATION, "bindRenderbuffer", "attempt to bind a deleted renderbuffer"); return; } if (target != GL_RENDERBUFFER) { SynthesizeGLError(GL_INVALID_ENUM, "bindRenderbuffer", "invalid target"); return; } renderbuffer_binding_ = render_buffer; ContextGL()->BindRenderbuffer(target, ObjectOrZero(render_buffer)); if (render_buffer) render_buffer->SetHasEverBeenBound(); }
C
Chrome
0
CVE-2018-17407
https://www.cvedetails.com/cve/CVE-2018-17407/
CWE-119
https://github.com/TeX-Live/texlive-source/commit/6ed0077520e2b0da1fd060c7f88db7b2e6068e4c
6ed0077520e2b0da1fd060c7f88db7b2e6068e4c
writet1 protection against buffer overflow git-svn-id: svn://tug.org/texlive/trunk/Build/source@48697 c570f23f-e606-0410-a88d-b1316a301751
void writet1(PDF pdf, fd_entry * fd) { /*tex |fd_cur| is global inside |writet1.c|. */ fd_cur = fd; assert(fd_cur->fm != NULL); assert(is_type1(fd->fm)); assert(is_included(fd->fm)); t1_save_offset = 0; if (!is_subsetted(fd_cur->fm)) { /*tex Include entire font. */ if (!(fd->ff_found = t1_open_fontfile(filetype_font))) return; t1_include(pdf); t1_close_font_file(filetype_font); xfree(t1_buffer); return; } /*tex Partial downloading. */ if (!(fd->ff_found = t1_open_fontfile(filetype_subset))) return; t1_subset_ascii_part(pdf); t1_start_eexec(pdf); cc_init(); cs_init(); t1_read_subrs(pdf); t1_subset_charstrings(pdf); t1_subset_end(pdf); t1_close_font_file(filetype_subset); xfree(t1_buffer); }
void writet1(PDF pdf, fd_entry * fd) { /*tex |fd_cur| is global inside |writet1.c|. */ fd_cur = fd; assert(fd_cur->fm != NULL); assert(is_type1(fd->fm)); assert(is_included(fd->fm)); t1_save_offset = 0; if (!is_subsetted(fd_cur->fm)) { /*tex Include entire font. */ if (!(fd->ff_found = t1_open_fontfile(filetype_font))) return; t1_include(pdf); t1_close_font_file(filetype_font); xfree(t1_buffer); return; } /*tex Partial downloading. */ if (!(fd->ff_found = t1_open_fontfile(filetype_subset))) return; t1_subset_ascii_part(pdf); t1_start_eexec(pdf); cc_init(); cs_init(); t1_read_subrs(pdf); t1_subset_charstrings(pdf); t1_subset_end(pdf); t1_close_font_file(filetype_subset); xfree(t1_buffer); }
C
texlive-source
0
null
null
null
https://github.com/chromium/chromium/commit/30f5bc981921d9c0221c82f38d80bd2d5c86a022
30f5bc981921d9c0221c82f38d80bd2d5c86a022
browser: Extract AutocompleteProvider from autocomplete.* This is the first part of splitting autocomplete.* into small pieces, one for each class. BUG=94842 [email protected] [email protected] Review URL: https://chromiumcodereview.appspot.com/10663015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144107 0039d316-1c4b-4281-b951-d872f2087c98
AutocompleteController* GetAutocompleteController() const { return GetLocationBar()->GetLocationEntry()->model()->popup_model()-> autocomplete_controller(); }
AutocompleteController* GetAutocompleteController() const { return GetLocationBar()->GetLocationEntry()->model()->popup_model()-> autocomplete_controller(); }
C
Chrome
0
CVE-2013-0839
https://www.cvedetails.com/cve/CVE-2013-0839/
CWE-399
https://github.com/chromium/chromium/commit/dd3b6fe574edad231c01c78e4647a74c38dc4178
dd3b6fe574edad231c01c78e4647a74c38dc4178
Remove parent* arg from GDataEntry ctor. * Remove static FromDocumentEntry from GDataEntry, GDataFile, GDataDirectory. Replace with InitFromDocumentEntry. * Move common code from GDataFile::InitFromDocumentEntry and GDataDirectory::InitFromDocumentEntry to GDataEntry::InitFromDocumentEntry. * Add GDataDirectoryService::FromDocumentEntry and use this everywhere. * Make ctors of GDataFile, GDataDirectory private, so these must be created by GDataDirectoryService's CreateGDataFile and CreateGDataDirectory. Make GDataEntry ctor protected. BUG=141494 TEST=unit tests. Review URL: https://chromiumcodereview.appspot.com/10854083 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@151008 0039d316-1c4b-4281-b951-d872f2087c98
void GDataFileSystem::OnFileDownloadedAndSpaceChecked( const GetFileFromCacheParams& params, GDataErrorCode status, const GURL& content_url, const FilePath& downloaded_file_path, bool* has_enough_space) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); GDataFileError error = util::GDataToGDataFileError(status); if (error == GDATA_FILE_OK) { if (*has_enough_space) { cache_->StoreOnUIThread( params.resource_id, params.md5, downloaded_file_path, GDataCache::FILE_OPERATION_MOVE, base::Bind(&GDataFileSystem::OnDownloadStoredToCache, ui_weak_ptr_)); } else { util::PostBlockingPoolSequencedTask( FROM_HERE, blocking_task_runner_, base::Bind(base::IgnoreResult(&file_util::Delete), downloaded_file_path, false /* recursive*/)); error = GDATA_FILE_ERROR_NO_SPACE; } } if (!params.get_file_callback.is_null()) { params.get_file_callback.Run(error, downloaded_file_path, params.mime_type, REGULAR_FILE); } }
void GDataFileSystem::OnFileDownloadedAndSpaceChecked( const GetFileFromCacheParams& params, GDataErrorCode status, const GURL& content_url, const FilePath& downloaded_file_path, bool* has_enough_space) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); GDataFileError error = util::GDataToGDataFileError(status); if (error == GDATA_FILE_OK) { if (*has_enough_space) { cache_->StoreOnUIThread( params.resource_id, params.md5, downloaded_file_path, GDataCache::FILE_OPERATION_MOVE, base::Bind(&GDataFileSystem::OnDownloadStoredToCache, ui_weak_ptr_)); } else { util::PostBlockingPoolSequencedTask( FROM_HERE, blocking_task_runner_, base::Bind(base::IgnoreResult(&file_util::Delete), downloaded_file_path, false /* recursive*/)); error = GDATA_FILE_ERROR_NO_SPACE; } } if (!params.get_file_callback.is_null()) { params.get_file_callback.Run(error, downloaded_file_path, params.mime_type, REGULAR_FILE); } }
C
Chrome
0
CVE-2016-3924
https://www.cvedetails.com/cve/CVE-2016-3924/
CWE-200
https://android.googlesource.com/platform/frameworks/av/+/c894aa36be535886a8e5ff02cdbcd07dd24618f6
c894aa36be535886a8e5ff02cdbcd07dd24618f6
Add EFFECT_CMD_SET_PARAM parameter checking Bug: 30204301 Change-Id: Ib9c3ee1c2f23c96f8f7092dd9e146bc453d7a290 (cherry picked from commit e4a1d91501d47931dbae19c47815952378787ab6)
status_t AudioFlinger::EffectModule::setOffloaded(bool offloaded, audio_io_handle_t io) { Mutex::Autolock _l(mLock); if (mStatus != NO_ERROR) { return mStatus; } status_t status = NO_ERROR; if ((mDescriptor.flags & EFFECT_FLAG_OFFLOAD_SUPPORTED) != 0) { status_t cmdStatus; uint32_t size = sizeof(status_t); effect_offload_param_t cmd; cmd.isOffload = offloaded; cmd.ioHandle = io; status = (*mEffectInterface)->command(mEffectInterface, EFFECT_CMD_OFFLOAD, sizeof(effect_offload_param_t), &cmd, &size, &cmdStatus); if (status == NO_ERROR) { status = cmdStatus; } mOffloaded = (status == NO_ERROR) ? offloaded : false; } else { if (offloaded) { status = INVALID_OPERATION; } mOffloaded = false; } ALOGV("setOffloaded() offloaded %d io %d status %d", offloaded, io, status); return status; }
status_t AudioFlinger::EffectModule::setOffloaded(bool offloaded, audio_io_handle_t io) { Mutex::Autolock _l(mLock); if (mStatus != NO_ERROR) { return mStatus; } status_t status = NO_ERROR; if ((mDescriptor.flags & EFFECT_FLAG_OFFLOAD_SUPPORTED) != 0) { status_t cmdStatus; uint32_t size = sizeof(status_t); effect_offload_param_t cmd; cmd.isOffload = offloaded; cmd.ioHandle = io; status = (*mEffectInterface)->command(mEffectInterface, EFFECT_CMD_OFFLOAD, sizeof(effect_offload_param_t), &cmd, &size, &cmdStatus); if (status == NO_ERROR) { status = cmdStatus; } mOffloaded = (status == NO_ERROR) ? offloaded : false; } else { if (offloaded) { status = INVALID_OPERATION; } mOffloaded = false; } ALOGV("setOffloaded() offloaded %d io %d status %d", offloaded, io, status); return status; }
C
Android
0
CVE-2018-17470
https://www.cvedetails.com/cve/CVE-2018-17470/
CWE-119
https://github.com/chromium/chromium/commit/385508dc888ef15d272cdd2705b17996abc519d6
385508dc888ef15d272cdd2705b17996abc519d6
Implement immutable texture base/max level clamping It seems some drivers fail to handle that gracefully, so let's always clamp to be on the safe side. BUG=877874 TEST=test case in the bug, gpu_unittests [email protected] Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel Change-Id: I6d93cb9389ea70525df4604112223604577582a2 Reviewed-on: https://chromium-review.googlesource.com/1194994 Reviewed-by: Kenneth Russell <[email protected]> Commit-Queue: Zhenyao Mo <[email protected]> Cr-Commit-Position: refs/heads/master@{#587264}
void GLES2DecoderImpl::CopySubTextureHelper(const char* function_name, GLuint source_id, GLint source_level, GLenum dest_target, GLuint dest_id, GLint dest_level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, GLboolean unpack_flip_y, GLboolean unpack_premultiply_alpha, GLboolean unpack_unmultiply_alpha, GLboolean dither) { TextureRef* source_texture_ref = GetTexture(source_id); TextureRef* dest_texture_ref = GetTexture(dest_id); if (!ValidateCopyTextureCHROMIUMTextures( function_name, dest_target, source_texture_ref, dest_texture_ref)) { return; } if (source_level < 0 || dest_level < 0 || (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "source_level or dest_level out of range"); return; } Texture* source_texture = source_texture_ref->texture(); Texture* dest_texture = dest_texture_ref->texture(); GLenum source_target = source_texture->target(); GLenum dest_binding_target = dest_texture->target(); int source_width = 0; int source_height = 0; gl::GLImage* image = source_texture->GetLevelImage(source_target, source_level); if (image) { gfx::Size size = image->GetSize(); source_width = size.width(); source_height = size.height(); if (source_width <= 0 || source_height <= 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid image size"); return; } int32_t max_x; int32_t max_y; if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y) || x < 0 || y < 0 || max_x > source_width || max_y > source_height) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "source texture bad dimensions"); return; } } else { if (!source_texture->GetLevelSize(source_target, source_level, &source_width, &source_height, nullptr)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "source texture has no data for level"); return; } if (!texture_manager()->ValidForTarget(source_target, source_level, source_width, source_height, 1)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "source texture bad dimensions"); return; } if (!source_texture->ValidForTexture(source_target, source_level, x, y, 0, width, height, 1)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "source texture bad dimensions."); return; } } GLenum source_type = 0; GLenum source_internal_format = 0; source_texture->GetLevelType(source_target, source_level, &source_type, &source_internal_format); GLenum dest_type = 0; GLenum dest_internal_format = 0; bool dest_level_defined = dest_texture->GetLevelType( dest_target, dest_level, &dest_type, &dest_internal_format); if (!dest_level_defined) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "destination texture is not defined"); return; } if (!dest_texture->ValidForTexture(dest_target, dest_level, xoffset, yoffset, 0, width, height, 1)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "destination texture bad dimensions."); return; } std::string output_error_msg; if (!ValidateCopyTextureCHROMIUMInternalFormats( GetFeatureInfo(), source_internal_format, dest_internal_format, &output_error_msg)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, output_error_msg.c_str()); return; } if (feature_info_->feature_flags().desktop_srgb_support) { bool enable_framebuffer_srgb = GLES2Util::GetColorEncodingFromInternalFormat(source_internal_format) == GL_SRGB || GLES2Util::GetColorEncodingFromInternalFormat(dest_internal_format) == GL_SRGB; state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); } if (!texture_manager()->ClearTextureLevel(this, source_texture_ref, source_target, source_level)) { LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, function_name, "source texture dimensions too big"); return; } if (!InitializeCopyTextureCHROMIUM(function_name)) return; int dest_width = 0; int dest_height = 0; bool ok = dest_texture->GetLevelSize(dest_target, dest_level, &dest_width, &dest_height, nullptr); DCHECK(ok); if (xoffset != 0 || yoffset != 0 || width != dest_width || height != dest_height) { gfx::Rect cleared_rect; if (TextureManager::CombineAdjacentRects( dest_texture->GetLevelClearedRect(dest_target, dest_level), gfx::Rect(xoffset, yoffset, width, height), &cleared_rect)) { DCHECK_GE(cleared_rect.size().GetArea(), dest_texture->GetLevelClearedRect(dest_target, dest_level) .size() .GetArea()); texture_manager()->SetLevelClearedRect(dest_texture_ref, dest_target, dest_level, cleared_rect); } else { if (!texture_manager()->ClearTextureLevel(this, dest_texture_ref, dest_target, dest_level)) { LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, function_name, "destination texture dimensions too big"); return; } } } else { texture_manager()->SetLevelCleared(dest_texture_ref, dest_target, dest_level, true); } bool unpack_premultiply_alpha_change = (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; if (image && dest_internal_format == source_internal_format && dest_level == 0 && !unpack_flip_y && !unpack_premultiply_alpha_change && !dither) { ScopedTextureBinder binder(&state_, dest_texture->service_id(), dest_binding_target); if (image->CopyTexSubImage(dest_target, gfx::Point(xoffset, yoffset), gfx::Rect(x, y, width, height))) { return; } } DoBindOrCopyTexImageIfNeeded(source_texture, source_target, 0); if (source_target == GL_TEXTURE_EXTERNAL_OES) { if (GLStreamTextureImage* image = source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, source_level)) { GLfloat transform_matrix[16]; image->GetTextureMatrix(transform_matrix); copy_texture_chromium_->DoCopySubTextureWithTransform( this, source_target, source_texture->service_id(), source_level, source_internal_format, dest_target, dest_texture->service_id(), dest_level, dest_internal_format, xoffset, yoffset, x, y, width, height, dest_width, dest_height, source_width, source_height, unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, dither == GL_TRUE, transform_matrix, copy_tex_image_blit_.get()); return; } } CopyTextureMethod method = GetCopyTextureCHROMIUMMethod( GetFeatureInfo(), source_target, source_level, source_internal_format, source_type, dest_binding_target, dest_level, dest_internal_format, unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, dither == GL_TRUE); #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) if (Texture::ColorRenderable(GetFeatureInfo(), dest_internal_format, dest_texture->IsImmutable()) && method == CopyTextureMethod::DIRECT_COPY) { method = CopyTextureMethod::DIRECT_DRAW; } #endif copy_texture_chromium_->DoCopySubTexture( this, source_target, source_texture->service_id(), source_level, source_internal_format, dest_target, dest_texture->service_id(), dest_level, dest_internal_format, xoffset, yoffset, x, y, width, height, dest_width, dest_height, source_width, source_height, unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, dither == GL_TRUE, method, copy_tex_image_blit_.get()); }
void GLES2DecoderImpl::CopySubTextureHelper(const char* function_name, GLuint source_id, GLint source_level, GLenum dest_target, GLuint dest_id, GLint dest_level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height, GLboolean unpack_flip_y, GLboolean unpack_premultiply_alpha, GLboolean unpack_unmultiply_alpha, GLboolean dither) { TextureRef* source_texture_ref = GetTexture(source_id); TextureRef* dest_texture_ref = GetTexture(dest_id); if (!ValidateCopyTextureCHROMIUMTextures( function_name, dest_target, source_texture_ref, dest_texture_ref)) { return; } if (source_level < 0 || dest_level < 0 || (feature_info_->IsWebGL1OrES2Context() && source_level > 0)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "source_level or dest_level out of range"); return; } Texture* source_texture = source_texture_ref->texture(); Texture* dest_texture = dest_texture_ref->texture(); GLenum source_target = source_texture->target(); GLenum dest_binding_target = dest_texture->target(); int source_width = 0; int source_height = 0; gl::GLImage* image = source_texture->GetLevelImage(source_target, source_level); if (image) { gfx::Size size = image->GetSize(); source_width = size.width(); source_height = size.height(); if (source_width <= 0 || source_height <= 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "invalid image size"); return; } int32_t max_x; int32_t max_y; if (!SafeAddInt32(x, width, &max_x) || !SafeAddInt32(y, height, &max_y) || x < 0 || y < 0 || max_x > source_width || max_y > source_height) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "source texture bad dimensions"); return; } } else { if (!source_texture->GetLevelSize(source_target, source_level, &source_width, &source_height, nullptr)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "source texture has no data for level"); return; } if (!texture_manager()->ValidForTarget(source_target, source_level, source_width, source_height, 1)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "source texture bad dimensions"); return; } if (!source_texture->ValidForTexture(source_target, source_level, x, y, 0, width, height, 1)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "source texture bad dimensions."); return; } } GLenum source_type = 0; GLenum source_internal_format = 0; source_texture->GetLevelType(source_target, source_level, &source_type, &source_internal_format); GLenum dest_type = 0; GLenum dest_internal_format = 0; bool dest_level_defined = dest_texture->GetLevelType( dest_target, dest_level, &dest_type, &dest_internal_format); if (!dest_level_defined) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "destination texture is not defined"); return; } if (!dest_texture->ValidForTexture(dest_target, dest_level, xoffset, yoffset, 0, width, height, 1)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "destination texture bad dimensions."); return; } std::string output_error_msg; if (!ValidateCopyTextureCHROMIUMInternalFormats( GetFeatureInfo(), source_internal_format, dest_internal_format, &output_error_msg)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, output_error_msg.c_str()); return; } if (feature_info_->feature_flags().desktop_srgb_support) { bool enable_framebuffer_srgb = GLES2Util::GetColorEncodingFromInternalFormat(source_internal_format) == GL_SRGB || GLES2Util::GetColorEncodingFromInternalFormat(dest_internal_format) == GL_SRGB; state_.EnableDisableFramebufferSRGB(enable_framebuffer_srgb); } if (!texture_manager()->ClearTextureLevel(this, source_texture_ref, source_target, source_level)) { LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, function_name, "source texture dimensions too big"); return; } if (!InitializeCopyTextureCHROMIUM(function_name)) return; int dest_width = 0; int dest_height = 0; bool ok = dest_texture->GetLevelSize(dest_target, dest_level, &dest_width, &dest_height, nullptr); DCHECK(ok); if (xoffset != 0 || yoffset != 0 || width != dest_width || height != dest_height) { gfx::Rect cleared_rect; if (TextureManager::CombineAdjacentRects( dest_texture->GetLevelClearedRect(dest_target, dest_level), gfx::Rect(xoffset, yoffset, width, height), &cleared_rect)) { DCHECK_GE(cleared_rect.size().GetArea(), dest_texture->GetLevelClearedRect(dest_target, dest_level) .size() .GetArea()); texture_manager()->SetLevelClearedRect(dest_texture_ref, dest_target, dest_level, cleared_rect); } else { if (!texture_manager()->ClearTextureLevel(this, dest_texture_ref, dest_target, dest_level)) { LOCAL_SET_GL_ERROR(GL_OUT_OF_MEMORY, function_name, "destination texture dimensions too big"); return; } } } else { texture_manager()->SetLevelCleared(dest_texture_ref, dest_target, dest_level, true); } bool unpack_premultiply_alpha_change = (unpack_premultiply_alpha ^ unpack_unmultiply_alpha) != 0; if (image && dest_internal_format == source_internal_format && dest_level == 0 && !unpack_flip_y && !unpack_premultiply_alpha_change && !dither) { ScopedTextureBinder binder(&state_, dest_texture->service_id(), dest_binding_target); if (image->CopyTexSubImage(dest_target, gfx::Point(xoffset, yoffset), gfx::Rect(x, y, width, height))) { return; } } DoBindOrCopyTexImageIfNeeded(source_texture, source_target, 0); if (source_target == GL_TEXTURE_EXTERNAL_OES) { if (GLStreamTextureImage* image = source_texture->GetLevelStreamTextureImage(GL_TEXTURE_EXTERNAL_OES, source_level)) { GLfloat transform_matrix[16]; image->GetTextureMatrix(transform_matrix); copy_texture_chromium_->DoCopySubTextureWithTransform( this, source_target, source_texture->service_id(), source_level, source_internal_format, dest_target, dest_texture->service_id(), dest_level, dest_internal_format, xoffset, yoffset, x, y, width, height, dest_width, dest_height, source_width, source_height, unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, dither == GL_TRUE, transform_matrix, copy_tex_image_blit_.get()); return; } } CopyTextureMethod method = GetCopyTextureCHROMIUMMethod( GetFeatureInfo(), source_target, source_level, source_internal_format, source_type, dest_binding_target, dest_level, dest_internal_format, unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, dither == GL_TRUE); #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) if (Texture::ColorRenderable(GetFeatureInfo(), dest_internal_format, dest_texture->IsImmutable()) && method == CopyTextureMethod::DIRECT_COPY) { method = CopyTextureMethod::DIRECT_DRAW; } #endif copy_texture_chromium_->DoCopySubTexture( this, source_target, source_texture->service_id(), source_level, source_internal_format, dest_target, dest_texture->service_id(), dest_level, dest_internal_format, xoffset, yoffset, x, y, width, height, dest_width, dest_height, source_width, source_height, unpack_flip_y == GL_TRUE, unpack_premultiply_alpha == GL_TRUE, unpack_unmultiply_alpha == GL_TRUE, dither == GL_TRUE, method, copy_tex_image_blit_.get()); }
C
Chrome
0
CVE-2011-2840
https://www.cvedetails.com/cve/CVE-2011-2840/
CWE-20
https://github.com/chromium/chromium/commit/2db5a2048dfcacfe5ad4311c2b1e435c4c67febc
2db5a2048dfcacfe5ad4311c2b1e435c4c67febc
chromeos: fix bug where "aw snap" page replaces first tab if it was a NTP when closing window with > 1 tab. BUG=chromium-os:12088 TEST=verify bug per bug report. Review URL: http://codereview.chromium.org/6882058 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83031 0039d316-1c4b-4281-b951-d872f2087c98
void TabStripModel::GetIndicesWithSameOpener(int index, std::vector<int>* indices) { NavigationController* opener = contents_data_[index]->group; if (!opener) { opener = &(GetTabContentsAt(index)->controller()); if (!opener) return; } for (int i = 0; i < count(); ++i) { if (i == index) continue; if (contents_data_[i]->group == opener || &(GetTabContentsAt(i)->controller()) == opener) { indices->push_back(i); } } }
void TabStripModel::GetIndicesWithSameOpener(int index, std::vector<int>* indices) { NavigationController* opener = contents_data_[index]->group; if (!opener) { opener = &(GetTabContentsAt(index)->controller()); if (!opener) return; } for (int i = 0; i < count(); ++i) { if (i == index) continue; if (contents_data_[i]->group == opener || &(GetTabContentsAt(i)->controller()) == opener) { indices->push_back(i); } } }
C
Chrome
0
CVE-2016-5219
https://www.cvedetails.com/cve/CVE-2016-5219/
CWE-416
https://github.com/chromium/chromium/commit/a4150b688a754d3d10d2ca385155b1c95d77d6ae
a4150b688a754d3d10d2ca385155b1c95d77d6ae
Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630 Commit-Queue: Kenneth Russell <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Geoff Lang <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Cr-Commit-Position: refs/heads/master@{#657568}
gpu::gles2::ErrorState* GLES2DecoderPassthroughImpl::GetErrorState() { return nullptr; }
gpu::gles2::ErrorState* GLES2DecoderPassthroughImpl::GetErrorState() { return nullptr; }
C
Chrome
0
CVE-2014-9710
https://www.cvedetails.com/cve/CVE-2014-9710/
CWE-362
https://github.com/torvalds/linux/commit/5f5bc6b1e2d5a6f827bc860ef2dc5b6f365d1339
5f5bc6b1e2d5a6f827bc860ef2dc5b6f365d1339
Btrfs: make xattr replace operations atomic Replacing a xattr consists of doing a lookup for its existing value, delete the current value from the respective leaf, release the search path and then finally insert the new value. This leaves a time window where readers (getxattr, listxattrs) won't see any value for the xattr. Xattrs are used to store ACLs, so this has security implications. This change also fixes 2 other existing issues which were: *) Deleting the old xattr value without verifying first if the new xattr will fit in the existing leaf item (in case multiple xattrs are packed in the same item due to name hash collision); *) Returning -EEXIST when the flag XATTR_CREATE is given and the xattr doesn't exist but we have have an existing item that packs muliple xattrs with the same name hash as the input xattr. In this case we should return ENOSPC. A test case for xfstests follows soon. Thanks to Alexandre Oliva for reporting the non-atomicity of the xattr replace implementation. Reported-by: Alexandre Oliva <[email protected]> Signed-off-by: Filipe Manana <[email protected]> Signed-off-by: Chris Mason <[email protected]>
int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path, struct btrfs_key *key, int level, u64 min_trans) { int slot; struct extent_buffer *c; WARN_ON(!path->keep_locks); while (level < BTRFS_MAX_LEVEL) { if (!path->nodes[level]) return 1; slot = path->slots[level] + 1; c = path->nodes[level]; next: if (slot >= btrfs_header_nritems(c)) { int ret; int orig_lowest; struct btrfs_key cur_key; if (level + 1 >= BTRFS_MAX_LEVEL || !path->nodes[level + 1]) return 1; if (path->locks[level + 1]) { level++; continue; } slot = btrfs_header_nritems(c) - 1; if (level == 0) btrfs_item_key_to_cpu(c, &cur_key, slot); else btrfs_node_key_to_cpu(c, &cur_key, slot); orig_lowest = path->lowest_level; btrfs_release_path(path); path->lowest_level = level; ret = btrfs_search_slot(NULL, root, &cur_key, path, 0, 0); path->lowest_level = orig_lowest; if (ret < 0) return ret; c = path->nodes[level]; slot = path->slots[level]; if (ret == 0) slot++; goto next; } if (level == 0) btrfs_item_key_to_cpu(c, key, slot); else { u64 gen = btrfs_node_ptr_generation(c, slot); if (gen < min_trans) { slot++; goto next; } btrfs_node_key_to_cpu(c, key, slot); } return 0; } return 1; }
int btrfs_find_next_key(struct btrfs_root *root, struct btrfs_path *path, struct btrfs_key *key, int level, u64 min_trans) { int slot; struct extent_buffer *c; WARN_ON(!path->keep_locks); while (level < BTRFS_MAX_LEVEL) { if (!path->nodes[level]) return 1; slot = path->slots[level] + 1; c = path->nodes[level]; next: if (slot >= btrfs_header_nritems(c)) { int ret; int orig_lowest; struct btrfs_key cur_key; if (level + 1 >= BTRFS_MAX_LEVEL || !path->nodes[level + 1]) return 1; if (path->locks[level + 1]) { level++; continue; } slot = btrfs_header_nritems(c) - 1; if (level == 0) btrfs_item_key_to_cpu(c, &cur_key, slot); else btrfs_node_key_to_cpu(c, &cur_key, slot); orig_lowest = path->lowest_level; btrfs_release_path(path); path->lowest_level = level; ret = btrfs_search_slot(NULL, root, &cur_key, path, 0, 0); path->lowest_level = orig_lowest; if (ret < 0) return ret; c = path->nodes[level]; slot = path->slots[level]; if (ret == 0) slot++; goto next; } if (level == 0) btrfs_item_key_to_cpu(c, key, slot); else { u64 gen = btrfs_node_ptr_generation(c, slot); if (gen < min_trans) { slot++; goto next; } btrfs_node_key_to_cpu(c, key, slot); } return 0; } return 1; }
C
linux
0
CVE-2011-2495
https://www.cvedetails.com/cve/CVE-2011-2495/
CWE-264
https://github.com/torvalds/linux/commit/1d1221f375c94ef961ba8574ac4f85c8870ddd51
1d1221f375c94ef961ba8574ac4f85c8870ddd51
proc: restrict access to /proc/PID/io /proc/PID/io may be used for gathering private information. E.g. for openssh and vsftpd daemons wchars/rchars may be used to learn the precise password length. Restrict it to processes being able to ptrace the target process. ptrace_may_access() is needed to prevent keeping open file descriptor of "io" file, executing setuid binary and gathering io information of the setuid'ed process. Signed-off-by: Vasiliy Kulikov <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static int proc_cwd_link(struct inode *inode, struct path *path) { struct task_struct *task = get_proc_task(inode); int result = -ENOENT; if (task) { task_lock(task); if (task->fs) { get_fs_pwd(task->fs, path); result = 0; } task_unlock(task); put_task_struct(task); } return result; }
static int proc_cwd_link(struct inode *inode, struct path *path) { struct task_struct *task = get_proc_task(inode); int result = -ENOENT; if (task) { task_lock(task); if (task->fs) { get_fs_pwd(task->fs, path); result = 0; } task_unlock(task); put_task_struct(task); } return result; }
C
linux
0
CVE-2015-0272
https://www.cvedetails.com/cve/CVE-2015-0272/
CWE-20
https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=d5fc88e573fa58b93034b04d35a2454f5d28cad9
d5fc88e573fa58b93034b04d35a2454f5d28cad9
null
nm_ip4_config_new (int ifindex) { g_return_val_if_fail (ifindex >= -1, NULL); return (NMIP4Config *) g_object_new (NM_TYPE_IP4_CONFIG, NM_IP4_CONFIG_IFINDEX, ifindex, NULL); }
nm_ip4_config_new (int ifindex) { g_return_val_if_fail (ifindex >= -1, NULL); return (NMIP4Config *) g_object_new (NM_TYPE_IP4_CONFIG, NM_IP4_CONFIG_IFINDEX, ifindex, NULL); }
C
NetworkManager
0
CVE-2017-5009
https://www.cvedetails.com/cve/CVE-2017-5009/
CWE-119
https://github.com/chromium/chromium/commit/1c40f9042ae2d6ee7483d72998aabb5e73b2ff60
1c40f9042ae2d6ee7483d72998aabb5e73b2ff60
DevTools: send proper resource type in Network.RequestWillBeSent This patch plumbs resoure type into the DispatchWillSendRequest instrumenation. This allows us to report accurate type in Network.RequestWillBeSent event, instead of "Other", that we report today. BUG=765501 R=dgozman Change-Id: I0134c08b841e8dd247fdc8ff208bfd51e462709c Reviewed-on: https://chromium-review.googlesource.com/667504 Reviewed-by: Pavel Feldman <[email protected]> Reviewed-by: Dmitry Gozman <[email protected]> Commit-Queue: Andrey Lushnikov <[email protected]> Cr-Commit-Position: refs/heads/master@{#507936}
void BaseFetchContext::AddAdditionalRequestHeaders(ResourceRequest& request, FetchResourceType type) { bool is_main_resource = type == kFetchMainResource; if (!is_main_resource) { if (!request.DidSetHTTPReferrer()) { request.SetHTTPReferrer(SecurityPolicy::GenerateReferrer( GetReferrerPolicy(), request.Url(), GetOutgoingReferrer())); request.AddHTTPOriginIfNeeded(GetSecurityOrigin()); } else { DCHECK_EQ(SecurityPolicy::GenerateReferrer(request.GetReferrerPolicy(), request.Url(), request.HttpReferrer()) .referrer, request.HttpReferrer()); request.AddHTTPOriginIfNeeded(request.HttpReferrer()); } } auto address_space = GetAddressSpace(); if (address_space) request.SetExternalRequestStateFromRequestorAddressSpace(*address_space); }
void BaseFetchContext::AddAdditionalRequestHeaders(ResourceRequest& request, FetchResourceType type) { bool is_main_resource = type == kFetchMainResource; if (!is_main_resource) { if (!request.DidSetHTTPReferrer()) { request.SetHTTPReferrer(SecurityPolicy::GenerateReferrer( GetReferrerPolicy(), request.Url(), GetOutgoingReferrer())); request.AddHTTPOriginIfNeeded(GetSecurityOrigin()); } else { DCHECK_EQ(SecurityPolicy::GenerateReferrer(request.GetReferrerPolicy(), request.Url(), request.HttpReferrer()) .referrer, request.HttpReferrer()); request.AddHTTPOriginIfNeeded(request.HttpReferrer()); } } auto address_space = GetAddressSpace(); if (address_space) request.SetExternalRequestStateFromRequestorAddressSpace(*address_space); }
C
Chrome
0
CVE-2016-5199
https://www.cvedetails.com/cve/CVE-2016-5199/
CWE-119
https://github.com/chromium/chromium/commit/c995d4fe5e96f4d6d4a88b7867279b08e72d2579
c995d4fe5e96f4d6d4a88b7867279b08e72d2579
Move IsDataSaverEnabledByUser to be a static method and use it This method now officially becomes the source of truth that everything in the code base eventually calls into to determine whether or not DataSaver is enabled. Bug: 934399 Change-Id: Iae837b710ace8cc3101188f79d02cbc2d4f0fd93 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1537242 Reviewed-by: Joshua Pawlicki <[email protected]> Reviewed-by: Tarun Bansal <[email protected]> Commit-Queue: Robert Ogden <[email protected]> Cr-Commit-Position: refs/heads/master@{#643948}
bool ChromeContentBrowserClient::AllowPepperSocketAPI( content::BrowserContext* browser_context, const GURL& url, bool private_api, const content::SocketPermissionRequest* params) { #if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS) return ChromeContentBrowserClientPluginsPart::AllowPepperSocketAPI( browser_context, url, private_api, params, allowed_socket_origins_); #else return false; #endif }
bool ChromeContentBrowserClient::AllowPepperSocketAPI( content::BrowserContext* browser_context, const GURL& url, bool private_api, const content::SocketPermissionRequest* params) { #if BUILDFLAG(ENABLE_PLUGINS) && BUILDFLAG(ENABLE_EXTENSIONS) return ChromeContentBrowserClientPluginsPart::AllowPepperSocketAPI( browser_context, url, private_api, params, allowed_socket_origins_); #else return false; #endif }
C
Chrome
0
CVE-2012-3552
https://www.cvedetails.com/cve/CVE-2012-3552/
CWE-362
https://github.com/torvalds/linux/commit/f6d8bd051c391c1c0458a30b2a7abcd939329259
f6d8bd051c391c1c0458a30b2a7abcd939329259
inet: add RCU protection to inet->opt We lack proper synchronization to manipulate inet->opt ip_options Problem is ip_make_skb() calls ip_setup_cork() and ip_setup_cork() possibly makes a copy of ipc->opt (struct ip_options), without any protection against another thread manipulating inet->opt. Another thread can change inet->opt pointer and free old one under us. Use RCU to protect inet->opt (changed to inet->inet_opt). Instead of handling atomic refcounts, just copy ip_options when necessary, to avoid cache line dirtying. We cant insert an rcu_head in struct ip_options since its included in skb->cb[], so this patch is large because I had to introduce a new ip_options_rcu structure. Signed-off-by: Eric Dumazet <[email protected]> Cc: Herbert Xu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static struct sk_buff *inet_gso_segment(struct sk_buff *skb, u32 features) { struct sk_buff *segs = ERR_PTR(-EINVAL); struct iphdr *iph; const struct net_protocol *ops; int proto; int ihl; int id; unsigned int offset = 0; if (!(features & NETIF_F_V4_CSUM)) features &= ~NETIF_F_SG; if (unlikely(skb_shinfo(skb)->gso_type & ~(SKB_GSO_TCPV4 | SKB_GSO_UDP | SKB_GSO_DODGY | SKB_GSO_TCP_ECN | 0))) goto out; if (unlikely(!pskb_may_pull(skb, sizeof(*iph)))) goto out; iph = ip_hdr(skb); ihl = iph->ihl * 4; if (ihl < sizeof(*iph)) goto out; if (unlikely(!pskb_may_pull(skb, ihl))) goto out; __skb_pull(skb, ihl); skb_reset_transport_header(skb); iph = ip_hdr(skb); id = ntohs(iph->id); proto = iph->protocol & (MAX_INET_PROTOS - 1); segs = ERR_PTR(-EPROTONOSUPPORT); rcu_read_lock(); ops = rcu_dereference(inet_protos[proto]); if (likely(ops && ops->gso_segment)) segs = ops->gso_segment(skb, features); rcu_read_unlock(); if (!segs || IS_ERR(segs)) goto out; skb = segs; do { iph = ip_hdr(skb); if (proto == IPPROTO_UDP) { iph->id = htons(id); iph->frag_off = htons(offset >> 3); if (skb->next != NULL) iph->frag_off |= htons(IP_MF); offset += (skb->len - skb->mac_len - iph->ihl * 4); } else iph->id = htons(id++); iph->tot_len = htons(skb->len - skb->mac_len); iph->check = 0; iph->check = ip_fast_csum(skb_network_header(skb), iph->ihl); } while ((skb = skb->next)); out: return segs; }
static struct sk_buff *inet_gso_segment(struct sk_buff *skb, u32 features) { struct sk_buff *segs = ERR_PTR(-EINVAL); struct iphdr *iph; const struct net_protocol *ops; int proto; int ihl; int id; unsigned int offset = 0; if (!(features & NETIF_F_V4_CSUM)) features &= ~NETIF_F_SG; if (unlikely(skb_shinfo(skb)->gso_type & ~(SKB_GSO_TCPV4 | SKB_GSO_UDP | SKB_GSO_DODGY | SKB_GSO_TCP_ECN | 0))) goto out; if (unlikely(!pskb_may_pull(skb, sizeof(*iph)))) goto out; iph = ip_hdr(skb); ihl = iph->ihl * 4; if (ihl < sizeof(*iph)) goto out; if (unlikely(!pskb_may_pull(skb, ihl))) goto out; __skb_pull(skb, ihl); skb_reset_transport_header(skb); iph = ip_hdr(skb); id = ntohs(iph->id); proto = iph->protocol & (MAX_INET_PROTOS - 1); segs = ERR_PTR(-EPROTONOSUPPORT); rcu_read_lock(); ops = rcu_dereference(inet_protos[proto]); if (likely(ops && ops->gso_segment)) segs = ops->gso_segment(skb, features); rcu_read_unlock(); if (!segs || IS_ERR(segs)) goto out; skb = segs; do { iph = ip_hdr(skb); if (proto == IPPROTO_UDP) { iph->id = htons(id); iph->frag_off = htons(offset >> 3); if (skb->next != NULL) iph->frag_off |= htons(IP_MF); offset += (skb->len - skb->mac_len - iph->ihl * 4); } else iph->id = htons(id++); iph->tot_len = htons(skb->len - skb->mac_len); iph->check = 0; iph->check = ip_fast_csum(skb_network_header(skb), iph->ihl); } while ((skb = skb->next)); out: return segs; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/ea3d1d84be3d6f97bf50e76511c9e26af6895533
ea3d1d84be3d6f97bf50e76511c9e26af6895533
Fix passing pointers between processes. BUG=31880 Review URL: http://codereview.chromium.org/558036 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37555 0039d316-1c4b-4281-b951-d872f2087c98
NPError PluginInstance::NPP_SetWindow(NPWindow *window) { DCHECK(npp_functions_ != 0); DCHECK(npp_functions_->setwindow != 0); if (npp_functions_->setwindow != 0) { return npp_functions_->setwindow(npp_, window); } return NPERR_INVALID_FUNCTABLE_ERROR; }
NPError PluginInstance::NPP_SetWindow(NPWindow *window) { DCHECK(npp_functions_ != 0); DCHECK(npp_functions_->setwindow != 0); if (npp_functions_->setwindow != 0) { return npp_functions_->setwindow(npp_, window); } return NPERR_INVALID_FUNCTABLE_ERROR; }
C
Chrome
0
CVE-2016-7912
https://www.cvedetails.com/cve/CVE-2016-7912/
CWE-416
https://github.com/torvalds/linux/commit/38740a5b87d53ceb89eb2c970150f6e94e00373a
38740a5b87d53ceb89eb2c970150f6e94e00373a
usb: gadget: f_fs: Fix use-after-free When using asynchronous read or write operations on the USB endpoints the issuer of the IO request is notified by calling the ki_complete() callback of the submitted kiocb when the URB has been completed. Calling this ki_complete() callback will free kiocb. Make sure that the structure is no longer accessed beyond that point, otherwise undefined behaviour might occur. Fixes: 2e4c7553cd6f ("usb: gadget: f_fs: add aio support") Cc: <[email protected]> # v3.15+ Signed-off-by: Lars-Peter Clausen <[email protected]> Signed-off-by: Felipe Balbi <[email protected]>
static int _ffs_name_dev(struct ffs_dev *dev, const char *name) { struct ffs_dev *existing; existing = _ffs_do_find_dev(name); if (existing) return -EBUSY; dev->name = name; return 0; }
static int _ffs_name_dev(struct ffs_dev *dev, const char *name) { struct ffs_dev *existing; existing = _ffs_do_find_dev(name); if (existing) return -EBUSY; dev->name = name; return 0; }
C
linux
0
CVE-2018-12904
https://www.cvedetails.com/cve/CVE-2018-12904/
null
https://github.com/torvalds/linux/commit/727ba748e110b4de50d142edca9d6a9b7e6111d8
727ba748e110b4de50d142edca9d6a9b7e6111d8
kvm: nVMX: Enforce cpl=0 for VMX instructions VMX instructions executed inside a L1 VM will always trigger a VM exit even when executed with cpl 3. This means we must perform the privilege check in software. Fixes: 70f3aac964ae("kvm: nVMX: Remove superfluous VMX instruction fault checks") Cc: [email protected] Signed-off-by: Felix Wilhelm <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
static __always_inline void vmcs_write16(unsigned long field, u16 value) { vmcs_check16(field); if (static_branch_unlikely(&enable_evmcs)) return evmcs_write16(field, value); __vmcs_writel(field, value); }
static __always_inline void vmcs_write16(unsigned long field, u16 value) { vmcs_check16(field); if (static_branch_unlikely(&enable_evmcs)) return evmcs_write16(field, value); __vmcs_writel(field, value); }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/df831400bcb63db4259b5858281b1727ba972a2a
df831400bcb63db4259b5858281b1727ba972a2a
WebKit2: Support window bounce when panning. https://bugs.webkit.org/show_bug.cgi?id=58065 <rdar://problem/9244367> Reviewed by Adam Roben. Make gestureDidScroll synchronous, as once we scroll, we need to know whether or not we are at the beginning or end of the scrollable document. If we are at either end of the scrollable document, we call the Windows 7 API to bounce the window to give an indication that you are past an end of the document. * UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::gestureDidScroll): Pass a boolean for the reply, and return it. * UIProcess/WebPageProxy.h: * UIProcess/win/WebView.cpp: (WebKit::WebView::WebView): Inititalize a new variable. (WebKit::WebView::onGesture): Once we send the message to scroll, check if have gone to an end of the document, and if we have, bounce the window. * UIProcess/win/WebView.h: * WebProcess/WebPage/WebPage.h: * WebProcess/WebPage/WebPage.messages.in: GestureDidScroll is now sync. * WebProcess/WebPage/win/WebPageWin.cpp: (WebKit::WebPage::gestureDidScroll): When we are done scrolling, check if we have a vertical scrollbar and if we are at the beginning or the end of the scrollable document. git-svn-id: svn://svn.chromium.org/blink/trunk@83197 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void WebPageProxy::hideFindUI() { process()->send(Messages::WebPage::HideFindUI(), m_pageID); }
void WebPageProxy::hideFindUI() { process()->send(Messages::WebPage::HideFindUI(), m_pageID); }
C
Chrome
0
CVE-2015-8767
https://www.cvedetails.com/cve/CVE-2015-8767/
CWE-362
https://github.com/torvalds/linux/commit/635682a14427d241bab7bbdeebb48a7d7b91638e
635682a14427d241bab7bbdeebb48a7d7b91638e
sctp: Prevent soft lockup when sctp_accept() is called during a timeout event A case can occur when sctp_accept() is called by the user during a heartbeat timeout event after the 4-way handshake. Since sctp_assoc_migrate() changes both assoc->base.sk and assoc->ep, the bh_sock_lock in sctp_generate_heartbeat_event() will be taken with the listening socket but released with the new association socket. The result is a deadlock on any future attempts to take the listening socket lock. Note that this race can occur with other SCTP timeouts that take the bh_lock_sock() in the event sctp_accept() is called. BUG: soft lockup - CPU#9 stuck for 67s! [swapper:0] ... RIP: 0010:[<ffffffff8152d48e>] [<ffffffff8152d48e>] _spin_lock+0x1e/0x30 RSP: 0018:ffff880028323b20 EFLAGS: 00000206 RAX: 0000000000000002 RBX: ffff880028323b20 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffff880028323be0 RDI: ffff8804632c4b48 RBP: ffffffff8100bb93 R08: 0000000000000000 R09: 0000000000000000 R10: ffff880610662280 R11: 0000000000000100 R12: ffff880028323aa0 R13: ffff8804383c3880 R14: ffff880028323a90 R15: ffffffff81534225 FS: 0000000000000000(0000) GS:ffff880028320000(0000) knlGS:0000000000000000 CS: 0010 DS: 0018 ES: 0018 CR0: 000000008005003b CR2: 00000000006df528 CR3: 0000000001a85000 CR4: 00000000000006e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process swapper (pid: 0, threadinfo ffff880616b70000, task ffff880616b6cab0) Stack: ffff880028323c40 ffffffffa01c2582 ffff880614cfb020 0000000000000000 <d> 0100000000000000 00000014383a6c44 ffff8804383c3880 ffff880614e93c00 <d> ffff880614e93c00 0000000000000000 ffff8804632c4b00 ffff8804383c38b8 Call Trace: <IRQ> [<ffffffffa01c2582>] ? sctp_rcv+0x492/0xa10 [sctp] [<ffffffff8148c559>] ? nf_iterate+0x69/0xb0 [<ffffffff814974a0>] ? ip_local_deliver_finish+0x0/0x2d0 [<ffffffff8148c716>] ? nf_hook_slow+0x76/0x120 [<ffffffff814974a0>] ? ip_local_deliver_finish+0x0/0x2d0 [<ffffffff8149757d>] ? ip_local_deliver_finish+0xdd/0x2d0 [<ffffffff81497808>] ? ip_local_deliver+0x98/0xa0 [<ffffffff81496ccd>] ? ip_rcv_finish+0x12d/0x440 [<ffffffff81497255>] ? ip_rcv+0x275/0x350 [<ffffffff8145cfeb>] ? __netif_receive_skb+0x4ab/0x750 ... With lockdep debugging: ===================================== [ BUG: bad unlock balance detected! ] ------------------------------------- CslRx/12087 is trying to release lock (slock-AF_INET) at: [<ffffffffa01bcae0>] sctp_generate_timeout_event+0x40/0xe0 [sctp] but there are no more locks to release! other info that might help us debug this: 2 locks held by CslRx/12087: #0: (&asoc->timers[i]){+.-...}, at: [<ffffffff8108ce1f>] run_timer_softirq+0x16f/0x3e0 #1: (slock-AF_INET){+.-...}, at: [<ffffffffa01bcac3>] sctp_generate_timeout_event+0x23/0xe0 [sctp] Ensure the socket taken is also the same one that is released by saving a copy of the socket before entering the timeout event critical section. Signed-off-by: Karl Heiss <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void sctp_generate_sack_event(unsigned long data) { struct sctp_association *asoc = (struct sctp_association *) data; sctp_generate_timeout_event(asoc, SCTP_EVENT_TIMEOUT_SACK); }
static void sctp_generate_sack_event(unsigned long data) { struct sctp_association *asoc = (struct sctp_association *) data; sctp_generate_timeout_event(asoc, SCTP_EVENT_TIMEOUT_SACK); }
C
linux
0
CVE-2017-6850
https://www.cvedetails.com/cve/CVE-2017-6850/
CWE-476
https://github.com/mdadams/jasper/commit/e96fc4fdd525fa0ede28074a7e2b1caf94b58b0d
e96fc4fdd525fa0ede28074a7e2b1caf94b58b0d
Fixed bugs due to uninitialized data in the JP2 decoder. Also, added some comments marking I/O stream interfaces that probably need to be changed (in the long term) to fix integer overflow problems.
long jas_stream_setrwcount(jas_stream_t *stream, long rwcnt) { int old; old = stream->rwcnt_; stream->rwcnt_ = rwcnt; return old; }
long jas_stream_setrwcount(jas_stream_t *stream, long rwcnt) { int old; old = stream->rwcnt_; stream->rwcnt_ = rwcnt; return old; }
C
jasper
0
CVE-2006-5331
https://www.cvedetails.com/cve/CVE-2006-5331/
CWE-19
https://github.com/torvalds/linux/commit/6c4841c2b6c32a134f9f36e5e08857138cc12b10
6c4841c2b6c32a134f9f36e5e08857138cc12b10
[POWERPC] Never panic when taking altivec exceptions from userspace At the moment we rely on a cpu feature bit or a firmware property to detect altivec. If we dont have either of these and the cpu does in fact support altivec we can cause a panic from userspace. It seems safer to always send a signal if we manage to get an 0xf20 exception from userspace. Signed-off-by: Anton Blanchard <[email protected]> Signed-off-by: Paul Mackerras <[email protected]>
static int check_bug_trap(struct pt_regs *regs) { struct bug_entry *bug; unsigned long addr; if (regs->msr & MSR_PR) return 0; /* not in kernel */ addr = regs->nip; /* address of trap instruction */ if (addr < PAGE_OFFSET) return 0; bug = find_bug(regs->nip); if (bug == NULL) return 0; if (bug->line & BUG_WARNING_TRAP) { /* this is a WARN_ON rather than BUG/BUG_ON */ printk(KERN_ERR "Badness in %s at %s:%ld\n", bug->function, bug->file, bug->line & ~BUG_WARNING_TRAP); dump_stack(); return 1; } printk(KERN_CRIT "kernel BUG in %s at %s:%ld!\n", bug->function, bug->file, bug->line); return 0; }
static int check_bug_trap(struct pt_regs *regs) { struct bug_entry *bug; unsigned long addr; if (regs->msr & MSR_PR) return 0; /* not in kernel */ addr = regs->nip; /* address of trap instruction */ if (addr < PAGE_OFFSET) return 0; bug = find_bug(regs->nip); if (bug == NULL) return 0; if (bug->line & BUG_WARNING_TRAP) { /* this is a WARN_ON rather than BUG/BUG_ON */ printk(KERN_ERR "Badness in %s at %s:%ld\n", bug->function, bug->file, bug->line & ~BUG_WARNING_TRAP); dump_stack(); return 1; } printk(KERN_CRIT "kernel BUG in %s at %s:%ld!\n", bug->function, bug->file, bug->line); return 0; }
C
linux
0
CVE-2016-3900
https://www.cvedetails.com/cve/CVE-2016-3900/
CWE-264
https://android.googlesource.com/platform/frameworks/native/+/047eec456943dc082e33220d28abb7df4e089f69
047eec456943dc082e33220d28abb7df4e089f69
ServiceManager: Allow system services running as secondary users to add services This should be reverted when all system services have been cleaned up to not do this. A process looking up a service while running in the background will see the service registered by the active user (assuming the service is registered on every user switch), not the service registered by the user that the process itself belongs to. BUG: 30795333 Change-Id: I1b74d58be38ed358f43c163692f9e704f8f31dbe (cherry picked from commit e6bbe69ba739c8a08837134437aaccfea5f1d943)
int main() { struct binder_state *bs; bs = binder_open(128*1024); if (!bs) { ALOGE("failed to open binder driver\n"); return -1; } if (binder_become_context_manager(bs)) { ALOGE("cannot become context manager (%s)\n", strerror(errno)); return -1; } selinux_enabled = is_selinux_enabled(); sehandle = selinux_android_service_context_handle(); selinux_status_open(true); if (selinux_enabled > 0) { if (sehandle == NULL) { ALOGE("SELinux: Failed to acquire sehandle. Aborting.\n"); abort(); } if (getcon(&service_manager_context) != 0) { ALOGE("SELinux: Failed to acquire service_manager context. Aborting.\n"); abort(); } } union selinux_callback cb; cb.func_audit = audit_callback; selinux_set_callback(SELINUX_CB_AUDIT, cb); cb.func_log = selinux_log_callback; selinux_set_callback(SELINUX_CB_LOG, cb); binder_loop(bs, svcmgr_handler); return 0; }
int main() { struct binder_state *bs; bs = binder_open(128*1024); if (!bs) { ALOGE("failed to open binder driver\n"); return -1; } if (binder_become_context_manager(bs)) { ALOGE("cannot become context manager (%s)\n", strerror(errno)); return -1; } selinux_enabled = is_selinux_enabled(); sehandle = selinux_android_service_context_handle(); selinux_status_open(true); if (selinux_enabled > 0) { if (sehandle == NULL) { ALOGE("SELinux: Failed to acquire sehandle. Aborting.\n"); abort(); } if (getcon(&service_manager_context) != 0) { ALOGE("SELinux: Failed to acquire service_manager context. Aborting.\n"); abort(); } } union selinux_callback cb; cb.func_audit = audit_callback; selinux_set_callback(SELINUX_CB_AUDIT, cb); cb.func_log = selinux_log_callback; selinux_set_callback(SELINUX_CB_LOG, cb); binder_loop(bs, svcmgr_handler); return 0; }
C
Android
0
null
null
null
https://github.com/chromium/chromium/commit/51dfe5e3b332bcea02fb4d4c7493ae841106dd9b
51dfe5e3b332bcea02fb4d4c7493ae841106dd9b
Add ALSA support to volume keys If PulseAudio is running, everything should behave as before, otherwise use ALSA API for adjusting volume. The previous PulseAudioMixer was split into AudioMixerBase and audioMixerPusle, then AudioMixerAlsa was added. BUG=chromium-os:10470 TEST=Volume keys should work even if pulseaudio disabled Review URL: http://codereview.chromium.org/5859003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71115 0039d316-1c4b-4281-b951-d872f2087c98
bool PulseAudioMixer::GetVolumeDbAsync(GetVolumeCallback* callback, bool AudioMixerPulse::GetVolumeLimits(double* vol_min, double* vol_max) { if (vol_min) *vol_min = kMinVolumeDb; if (vol_max) *vol_max = kMaxVolumeDb; return true; }
bool PulseAudioMixer::GetVolumeDbAsync(GetVolumeCallback* callback, void* user) { if (CheckState() != READY) return false; thread_->message_loop()->PostTask(FROM_HERE, NewRunnableMethod(this, &PulseAudioMixer::DoGetVolume, callback, user)); return true; }
C
Chrome
1
CVE-2012-2882
https://www.cvedetails.com/cve/CVE-2012-2882/
CWE-20
https://github.com/chromium/chromium/commit/3fe224d430d863880df0050faaa037b0eb00d3c0
3fe224d430d863880df0050faaa037b0eb00d3c0
Removed requirement for ash::Window::transient_parent() presence for system modal dialogs. BUG=130420 TEST=SystemModalContainerLayoutManagerTest.ModalTransientAndNonTransient Review URL: https://chromiumcodereview.appspot.com/10514012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@140647 0039d316-1c4b-4281-b951-d872f2087c98
bool destroyed() const { return destroyed_; }
bool destroyed() const { return destroyed_; }
C
Chrome
0
CVE-2016-9137
https://www.cvedetails.com/cve/CVE-2016-9137/
CWE-416
https://git.php.net/?p=php-src.git;a=commit;h=0e6fe3a4c96be2d3e88389a5776f878021b4c59f
0e6fe3a4c96be2d3e88389a5776f878021b4c59f
null
static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, const char **spec, char **error, int *severity TSRMLS_DC) /* {{{ */ { const char *spec_walk = *spec; char c = *spec_walk++; int check_null = 0; /* scan through modifiers */ while (1) { if (*spec_walk == '/') { SEPARATE_ZVAL_IF_NOT_REF(arg); } else if (*spec_walk == '!') { check_null = 1; } else { break; } spec_walk++; } switch (c) { case 'l': case 'L': { long *p = va_arg(*va, long *); if (check_null) { zend_bool *p = va_arg(*va, zend_bool *); *p = (Z_TYPE_PP(arg) == IS_NULL); } switch (Z_TYPE_PP(arg)) { case IS_STRING: { double d; int type; if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), p, &d, -1)) == 0) { return "long"; } else if (type == IS_DOUBLE) { if (c == 'L') { if (d > LONG_MAX) { *p = LONG_MAX; break; } else if (d < LONG_MIN) { *p = LONG_MIN; break; } } *p = zend_dval_to_lval(d); } } break; case IS_DOUBLE: if (c == 'L') { if (Z_DVAL_PP(arg) > LONG_MAX) { *p = LONG_MAX; break; } else if (Z_DVAL_PP(arg) < LONG_MIN) { *p = LONG_MIN; break; } } case IS_NULL: case IS_LONG: case IS_BOOL: convert_to_long_ex(arg); *p = Z_LVAL_PP(arg); break; case IS_ARRAY: case IS_OBJECT: case IS_RESOURCE: default: return "long"; } } break; case 'd': { double *p = va_arg(*va, double *); if (check_null) { zend_bool *p = va_arg(*va, zend_bool *); *p = (Z_TYPE_PP(arg) == IS_NULL); } switch (Z_TYPE_PP(arg)) { case IS_STRING: { long l; int type; if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &l, p, -1)) == 0) { return "double"; } else if (type == IS_LONG) { *p = (double) l; } } break; case IS_NULL: case IS_LONG: case IS_DOUBLE: case IS_BOOL: convert_to_double_ex(arg); *p = Z_DVAL_PP(arg); break; case IS_ARRAY: case IS_OBJECT: case IS_RESOURCE: default: return "double"; } } break; case 'p': case 's': { char **p = va_arg(*va, char **); int *pl = va_arg(*va, int *); switch (Z_TYPE_PP(arg)) { case IS_NULL: if (check_null) { *p = NULL; *pl = 0; break; } /* break omitted intentionally */ case IS_STRING: case IS_LONG: case IS_DOUBLE: case IS_BOOL: convert_to_string_ex(arg); if (UNEXPECTED(Z_ISREF_PP(arg) != 0)) { /* it's dangerous to return pointers to string buffer of referenced variable, because it can be clobbered throug magic callbacks */ SEPARATE_ZVAL(arg); } *p = Z_STRVAL_PP(arg); *pl = Z_STRLEN_PP(arg); if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) { return "a valid path"; } break; case IS_OBJECT: if (parse_arg_object_to_string(arg, p, pl, IS_STRING TSRMLS_CC) == SUCCESS) { if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) { return "a valid path"; } break; } case IS_ARRAY: case IS_RESOURCE: default: return c == 's' ? "string" : "a valid path"; } } break; case 'b': { zend_bool *p = va_arg(*va, zend_bool *); if (check_null) { zend_bool *p = va_arg(*va, zend_bool *); *p = (Z_TYPE_PP(arg) == IS_NULL); } switch (Z_TYPE_PP(arg)) { case IS_NULL: case IS_STRING: case IS_LONG: case IS_DOUBLE: case IS_BOOL: convert_to_boolean_ex(arg); *p = Z_BVAL_PP(arg); break; case IS_ARRAY: case IS_OBJECT: case IS_RESOURCE: default: return "boolean"; } } break; case 'r': { zval **p = va_arg(*va, zval **); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; break; } if (Z_TYPE_PP(arg) == IS_RESOURCE) { *p = *arg; } else { return "resource"; } } break; case 'A': case 'a': { zval **p = va_arg(*va, zval **); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; break; } if (Z_TYPE_PP(arg) == IS_ARRAY || (c == 'A' && Z_TYPE_PP(arg) == IS_OBJECT)) { *p = *arg; } else { return "array"; } } break; case 'H': case 'h': { HashTable **p = va_arg(*va, HashTable **); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; break; } if (Z_TYPE_PP(arg) == IS_ARRAY) { *p = Z_ARRVAL_PP(arg); } else if(c == 'H' && Z_TYPE_PP(arg) == IS_OBJECT) { *p = HASH_OF(*arg); if(*p == NULL) { return "array"; } } else { return "array"; } } break; case 'o': { zval **p = va_arg(*va, zval **); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; break; } if (Z_TYPE_PP(arg) == IS_OBJECT) { *p = *arg; } else { return "object"; } } break; case 'O': { zval **p = va_arg(*va, zval **); zend_class_entry *ce = va_arg(*va, zend_class_entry *); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; break; } if (Z_TYPE_PP(arg) == IS_OBJECT && (!ce || instanceof_function(Z_OBJCE_PP(arg), ce TSRMLS_CC))) { *p = *arg; } else { if (ce) { return ce->name; } else { return "object"; } } } break; case 'C': { zend_class_entry **lookup, **pce = va_arg(*va, zend_class_entry **); zend_class_entry *ce_base = *pce; if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *pce = NULL; break; } convert_to_string_ex(arg); if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &lookup TSRMLS_CC) == FAILURE) { *pce = NULL; } else { *pce = *lookup; } if (ce_base) { if ((!*pce || !instanceof_function(*pce, ce_base TSRMLS_CC))) { zend_spprintf(error, 0, "to be a class name derived from %s, '%s' given", ce_base->name, Z_STRVAL_PP(arg)); *pce = NULL; return ""; } } if (!*pce) { zend_spprintf(error, 0, "to be a valid class name, '%s' given", Z_STRVAL_PP(arg)); return ""; } break; } break; case 'f': { zend_fcall_info *fci = va_arg(*va, zend_fcall_info *); zend_fcall_info_cache *fcc = va_arg(*va, zend_fcall_info_cache *); char *is_callable_error = NULL; if (check_null && Z_TYPE_PP(arg) == IS_NULL) { fci->size = 0; fcc->initialized = 0; break; } if (zend_fcall_info_init(*arg, 0, fci, fcc, NULL, &is_callable_error TSRMLS_CC) == SUCCESS) { if (is_callable_error) { *severity = E_STRICT; zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error); efree(is_callable_error); *spec = spec_walk; return ""; } break; } else { if (is_callable_error) { *severity = E_WARNING; zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error); efree(is_callable_error); return ""; } else { return "valid callback"; } } } case 'z': { zval **p = va_arg(*va, zval **); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; } else { *p = *arg; } } break; case 'Z': { zval ***p = va_arg(*va, zval ***); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; } else { *p = arg; } } break; default: return "unknown"; } *spec = spec_walk; return NULL; } /* }}} */
static const char *zend_parse_arg_impl(int arg_num, zval **arg, va_list *va, const char **spec, char **error, int *severity TSRMLS_DC) /* {{{ */ { const char *spec_walk = *spec; char c = *spec_walk++; int check_null = 0; /* scan through modifiers */ while (1) { if (*spec_walk == '/') { SEPARATE_ZVAL_IF_NOT_REF(arg); } else if (*spec_walk == '!') { check_null = 1; } else { break; } spec_walk++; } switch (c) { case 'l': case 'L': { long *p = va_arg(*va, long *); if (check_null) { zend_bool *p = va_arg(*va, zend_bool *); *p = (Z_TYPE_PP(arg) == IS_NULL); } switch (Z_TYPE_PP(arg)) { case IS_STRING: { double d; int type; if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), p, &d, -1)) == 0) { return "long"; } else if (type == IS_DOUBLE) { if (c == 'L') { if (d > LONG_MAX) { *p = LONG_MAX; break; } else if (d < LONG_MIN) { *p = LONG_MIN; break; } } *p = zend_dval_to_lval(d); } } break; case IS_DOUBLE: if (c == 'L') { if (Z_DVAL_PP(arg) > LONG_MAX) { *p = LONG_MAX; break; } else if (Z_DVAL_PP(arg) < LONG_MIN) { *p = LONG_MIN; break; } } case IS_NULL: case IS_LONG: case IS_BOOL: convert_to_long_ex(arg); *p = Z_LVAL_PP(arg); break; case IS_ARRAY: case IS_OBJECT: case IS_RESOURCE: default: return "long"; } } break; case 'd': { double *p = va_arg(*va, double *); if (check_null) { zend_bool *p = va_arg(*va, zend_bool *); *p = (Z_TYPE_PP(arg) == IS_NULL); } switch (Z_TYPE_PP(arg)) { case IS_STRING: { long l; int type; if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &l, p, -1)) == 0) { return "double"; } else if (type == IS_LONG) { *p = (double) l; } } break; case IS_NULL: case IS_LONG: case IS_DOUBLE: case IS_BOOL: convert_to_double_ex(arg); *p = Z_DVAL_PP(arg); break; case IS_ARRAY: case IS_OBJECT: case IS_RESOURCE: default: return "double"; } } break; case 'p': case 's': { char **p = va_arg(*va, char **); int *pl = va_arg(*va, int *); switch (Z_TYPE_PP(arg)) { case IS_NULL: if (check_null) { *p = NULL; *pl = 0; break; } /* break omitted intentionally */ case IS_STRING: case IS_LONG: case IS_DOUBLE: case IS_BOOL: convert_to_string_ex(arg); if (UNEXPECTED(Z_ISREF_PP(arg) != 0)) { /* it's dangerous to return pointers to string buffer of referenced variable, because it can be clobbered throug magic callbacks */ SEPARATE_ZVAL(arg); } *p = Z_STRVAL_PP(arg); *pl = Z_STRLEN_PP(arg); if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) { return "a valid path"; } break; case IS_OBJECT: if (parse_arg_object_to_string(arg, p, pl, IS_STRING TSRMLS_CC) == SUCCESS) { if (c == 'p' && CHECK_ZVAL_NULL_PATH(*arg)) { return "a valid path"; } break; } case IS_ARRAY: case IS_RESOURCE: default: return c == 's' ? "string" : "a valid path"; } } break; case 'b': { zend_bool *p = va_arg(*va, zend_bool *); if (check_null) { zend_bool *p = va_arg(*va, zend_bool *); *p = (Z_TYPE_PP(arg) == IS_NULL); } switch (Z_TYPE_PP(arg)) { case IS_NULL: case IS_STRING: case IS_LONG: case IS_DOUBLE: case IS_BOOL: convert_to_boolean_ex(arg); *p = Z_BVAL_PP(arg); break; case IS_ARRAY: case IS_OBJECT: case IS_RESOURCE: default: return "boolean"; } } break; case 'r': { zval **p = va_arg(*va, zval **); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; break; } if (Z_TYPE_PP(arg) == IS_RESOURCE) { *p = *arg; } else { return "resource"; } } break; case 'A': case 'a': { zval **p = va_arg(*va, zval **); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; break; } if (Z_TYPE_PP(arg) == IS_ARRAY || (c == 'A' && Z_TYPE_PP(arg) == IS_OBJECT)) { *p = *arg; } else { return "array"; } } break; case 'H': case 'h': { HashTable **p = va_arg(*va, HashTable **); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; break; } if (Z_TYPE_PP(arg) == IS_ARRAY) { *p = Z_ARRVAL_PP(arg); } else if(c == 'H' && Z_TYPE_PP(arg) == IS_OBJECT) { *p = HASH_OF(*arg); if(*p == NULL) { return "array"; } } else { return "array"; } } break; case 'o': { zval **p = va_arg(*va, zval **); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; break; } if (Z_TYPE_PP(arg) == IS_OBJECT) { *p = *arg; } else { return "object"; } } break; case 'O': { zval **p = va_arg(*va, zval **); zend_class_entry *ce = va_arg(*va, zend_class_entry *); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; break; } if (Z_TYPE_PP(arg) == IS_OBJECT && (!ce || instanceof_function(Z_OBJCE_PP(arg), ce TSRMLS_CC))) { *p = *arg; } else { if (ce) { return ce->name; } else { return "object"; } } } break; case 'C': { zend_class_entry **lookup, **pce = va_arg(*va, zend_class_entry **); zend_class_entry *ce_base = *pce; if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *pce = NULL; break; } convert_to_string_ex(arg); if (zend_lookup_class(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &lookup TSRMLS_CC) == FAILURE) { *pce = NULL; } else { *pce = *lookup; } if (ce_base) { if ((!*pce || !instanceof_function(*pce, ce_base TSRMLS_CC))) { zend_spprintf(error, 0, "to be a class name derived from %s, '%s' given", ce_base->name, Z_STRVAL_PP(arg)); *pce = NULL; return ""; } } if (!*pce) { zend_spprintf(error, 0, "to be a valid class name, '%s' given", Z_STRVAL_PP(arg)); return ""; } break; } break; case 'f': { zend_fcall_info *fci = va_arg(*va, zend_fcall_info *); zend_fcall_info_cache *fcc = va_arg(*va, zend_fcall_info_cache *); char *is_callable_error = NULL; if (check_null && Z_TYPE_PP(arg) == IS_NULL) { fci->size = 0; fcc->initialized = 0; break; } if (zend_fcall_info_init(*arg, 0, fci, fcc, NULL, &is_callable_error TSRMLS_CC) == SUCCESS) { if (is_callable_error) { *severity = E_STRICT; zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error); efree(is_callable_error); *spec = spec_walk; return ""; } break; } else { if (is_callable_error) { *severity = E_WARNING; zend_spprintf(error, 0, "to be a valid callback, %s", is_callable_error); efree(is_callable_error); return ""; } else { return "valid callback"; } } } case 'z': { zval **p = va_arg(*va, zval **); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; } else { *p = *arg; } } break; case 'Z': { zval ***p = va_arg(*va, zval ***); if (check_null && Z_TYPE_PP(arg) == IS_NULL) { *p = NULL; } else { *p = arg; } } break; default: return "unknown"; } *spec = spec_walk; return NULL; } /* }}} */
C
php
0
CVE-2018-13006
https://www.cvedetails.com/cve/CVE-2018-13006/
CWE-125
https://github.com/gpac/gpac/commit/bceb03fd2be95097a7b409ea59914f332fb6bc86
bceb03fd2be95097a7b409ea59914f332fb6bc86
fixed 2 possible heap overflows (inc. #1088)
GF_Err stsf_Read(GF_Box *s, GF_BitStream *bs) { u32 entries, i; u32 nb_entries; GF_StsfEntry *p; GF_SampleFragmentBox *ptr = (GF_SampleFragmentBox *)s; p = NULL; if (!ptr) return GF_BAD_PARAM; nb_entries = gf_bs_read_u32(bs); p = NULL; for ( entries = 0; entries < nb_entries; entries++ ) { p = (GF_StsfEntry *) gf_malloc(sizeof(GF_StsfEntry)); if (!p) return GF_OUT_OF_MEM; p->SampleNumber = gf_bs_read_u32(bs); p->fragmentCount = gf_bs_read_u32(bs); p->fragmentSizes = (u16*)gf_malloc(sizeof(GF_StsfEntry) * p->fragmentCount); for (i=0; i<p->fragmentCount; i++) { p->fragmentSizes[i] = gf_bs_read_u16(bs); } gf_list_add(ptr->entryList, p); } #ifndef GPAC_DISABLE_ISOM_WRITE ptr->w_currentEntry = p; ptr->w_currentEntryIndex = nb_entries-1; #endif return GF_OK; }
GF_Err stsf_Read(GF_Box *s, GF_BitStream *bs) { u32 entries, i; u32 nb_entries; GF_StsfEntry *p; GF_SampleFragmentBox *ptr = (GF_SampleFragmentBox *)s; p = NULL; if (!ptr) return GF_BAD_PARAM; nb_entries = gf_bs_read_u32(bs); p = NULL; for ( entries = 0; entries < nb_entries; entries++ ) { p = (GF_StsfEntry *) gf_malloc(sizeof(GF_StsfEntry)); if (!p) return GF_OUT_OF_MEM; p->SampleNumber = gf_bs_read_u32(bs); p->fragmentCount = gf_bs_read_u32(bs); p->fragmentSizes = (u16*)gf_malloc(sizeof(GF_StsfEntry) * p->fragmentCount); for (i=0; i<p->fragmentCount; i++) { p->fragmentSizes[i] = gf_bs_read_u16(bs); } gf_list_add(ptr->entryList, p); } #ifndef GPAC_DISABLE_ISOM_WRITE ptr->w_currentEntry = p; ptr->w_currentEntryIndex = nb_entries-1; #endif return GF_OK; }
C
gpac
0
CVE-2016-5194
null
null
https://github.com/chromium/chromium/commit/d4e0a7273cd8d7a9ee667ad5b5c8aad0f5f59251
d4e0a7273cd8d7a9ee667ad5b5c8aad0f5f59251
Clear Shill stub config in offline file manager tests The Shill stub client fakes ethernet and wifi connections during testing. Clear its config during offline tests to simulate a lack of network connectivity. As a side effect, fileManagerPrivate.getDriveConnectionState will no longer need to be stubbed out, as it will now think the device is offline and return the appropriate result. Bug: 925272 Change-Id: Idd6cb44325cfde4991d3b1e64185a28e8655c733 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1578149 Commit-Queue: Austin Tankiang <[email protected]> Reviewed-by: Sam McNally <[email protected]> Cr-Commit-Position: refs/heads/master@{#654782}
TestEntryInfo& SetPinned(bool is_pinned) { pinned = is_pinned; return *this; }
TestEntryInfo& SetPinned(bool is_pinned) { pinned = is_pinned; return *this; }
C
Chrome
0
CVE-2016-9436
https://www.cvedetails.com/cve/CVE-2016-9436/
CWE-20
https://github.com/tats/w3m/commit/33509cc81ec5f2ba44eb6fd98bd5c1b5873e46bd
33509cc81ec5f2ba44eb6fd98bd5c1b5873e46bd
Fix uninitialised values for <i> and <dd> Bug-Debian: https://github.com/tats/w3m/issues/16
AuthBasicCred(struct http_auth *ha, Str uname, Str pw, ParsedURL *pu, HRequest *hr, FormList *request) { Str s = Strdup(uname); Strcat_char(s, ':'); Strcat(s, pw); return Strnew_m_charp("Basic ", encodeB(s->ptr)->ptr, NULL); }
AuthBasicCred(struct http_auth *ha, Str uname, Str pw, ParsedURL *pu, HRequest *hr, FormList *request) { Str s = Strdup(uname); Strcat_char(s, ':'); Strcat(s, pw); return Strnew_m_charp("Basic ", encodeB(s->ptr)->ptr, NULL); }
C
w3m
0
CVE-2013-2168
https://www.cvedetails.com/cve/CVE-2013-2168/
CWE-20
https://cgit.freedesktop.org/dbus/dbus/commit/?id=954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
null
_dbus_credentials_add_from_user (DBusCredentials *credentials, const DBusString *username) { return _dbus_credentials_add_windows_sid (credentials, _dbus_string_get_const_data(username)); }
_dbus_credentials_add_from_user (DBusCredentials *credentials, const DBusString *username) { return _dbus_credentials_add_windows_sid (credentials, _dbus_string_get_const_data(username)); }
C
dbus
0
CVE-2018-16541
https://www.cvedetails.com/cve/CVE-2018-16541/
CWE-416
http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=241d91112771a6104de10b3948c3f350d6690c1d
241d91112771a6104de10b3948c3f350d6690c1d
null
gs_main_lib_open(gs_main_instance * minst, const char *file_name, ref * pfile) { /* This is a separate procedure only to avoid tying up */ /* extra stack space while running the file. */ i_ctx_t *i_ctx_p = minst->i_ctx_p; #define maxfn 2048 char fn[maxfn]; uint len; return lib_file_open(&minst->lib_path, imemory, NULL, /* Don't check permissions here, because permlist isn't ready running init files. */ file_name, strlen(file_name), fn, maxfn, &len, pfile); }
gs_main_lib_open(gs_main_instance * minst, const char *file_name, ref * pfile) { /* This is a separate procedure only to avoid tying up */ /* extra stack space while running the file. */ i_ctx_t *i_ctx_p = minst->i_ctx_p; #define maxfn 2048 char fn[maxfn]; uint len; return lib_file_open(&minst->lib_path, imemory, NULL, /* Don't check permissions here, because permlist isn't ready running init files. */ file_name, strlen(file_name), fn, maxfn, &len, pfile); }
C
ghostscript
0
CVE-2015-1536
https://www.cvedetails.com/cve/CVE-2015-1536/
CWE-189
https://android.googlesource.com/platform/frameworks/base/+/d44e5bde18a41beda39d49189bef7f2ba7c8f3cb
d44e5bde18a41beda39d49189bef7f2ba7c8f3cb
Make Bitmap_createFromParcel check the color count. DO NOT MERGE When reading from the parcel, if the number of colors is invalid, early exit. Add two more checks: setInfo must return true, and Parcel::readInplace must return non-NULL. The former ensures that the previously read values (width, height, etc) were valid, and the latter checks that the Parcel had enough data even if the number of colors was reasonable. Also use an auto-deleter to handle deletion of the SkBitmap. Cherry pick from change-Id: Icbd562d6d1f131a723724883fd31822d337cf5a6 BUG=19666945 Change-Id: Iab0d218c41ae0c39606e333e44cda078eef32291
static void Bitmap_destructor(JNIEnv* env, jobject, jlong bitmapHandle) { SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle); #ifdef USE_OPENGL_RENDERER if (android::uirenderer::ResourceCache::hasInstance()) { android::uirenderer::ResourceCache::getInstance().destructor(bitmap); return; } #endif // USE_OPENGL_RENDERER delete bitmap; }
static void Bitmap_destructor(JNIEnv* env, jobject, jlong bitmapHandle) { SkBitmap* bitmap = reinterpret_cast<SkBitmap*>(bitmapHandle); #ifdef USE_OPENGL_RENDERER if (android::uirenderer::ResourceCache::hasInstance()) { android::uirenderer::ResourceCache::getInstance().destructor(bitmap); return; } #endif // USE_OPENGL_RENDERER delete bitmap; }
C
Android
0
CVE-2016-6136
https://www.cvedetails.com/cve/CVE-2016-6136/
CWE-362
https://github.com/torvalds/linux/commit/43761473c254b45883a64441dd0bc85a42f3645c
43761473c254b45883a64441dd0bc85a42f3645c
audit: fix a double fetch in audit_log_single_execve_arg() There is a double fetch problem in audit_log_single_execve_arg() where we first check the execve(2) argumnets for any "bad" characters which would require hex encoding and then re-fetch the arguments for logging in the audit record[1]. Of course this leaves a window of opportunity for an unsavory application to munge with the data. This patch reworks things by only fetching the argument data once[2] into a buffer where it is scanned and logged into the audit records(s). In addition to fixing the double fetch, this patch improves on the original code in a few other ways: better handling of large arguments which require encoding, stricter record length checking, and some performance improvements (completely unverified, but we got rid of some strlen() calls, that's got to be a good thing). As part of the development of this patch, I've also created a basic regression test for the audit-testsuite, the test can be tracked on GitHub at the following link: * https://github.com/linux-audit/audit-testsuite/issues/25 [1] If you pay careful attention, there is actually a triple fetch problem due to a strnlen_user() call at the top of the function. [2] This is a tiny white lie, we do make a call to strnlen_user() prior to fetching the argument data. I don't like it, but due to the way the audit record is structured we really have no choice unless we copy the entire argument at once (which would require a rather wasteful allocation). The good news is that with this patch the kernel no longer relies on this strnlen_user() value for anything beyond recording it in the log, we also update it with a trustworthy value whenever possible. Reported-by: Pengfei Wang <[email protected]> Cc: <[email protected]> Signed-off-by: Paul Moore <[email protected]>
void __audit_fd_pair(int fd1, int fd2) { struct audit_context *context = current->audit_context; context->fds[0] = fd1; context->fds[1] = fd2; }
void __audit_fd_pair(int fd1, int fd2) { struct audit_context *context = current->audit_context; context->fds[0] = fd1; context->fds[1] = fd2; }
C
linux
0
CVE-2013-0881
https://www.cvedetails.com/cve/CVE-2013-0881/
CWE-20
https://github.com/chromium/chromium/commit/634c5943f46abe8c6280079f6d394dfee08c3c8f
634c5943f46abe8c6280079f6d394dfee08c3c8f
Disable some more query compositingState asserts. This gets the tests passing again on Mac. See the bug for the stacktrace. A future patch will need to actually fix the incorrect reading of compositingState. BUG=343179 Review URL: https://codereview.chromium.org/162153002 git-svn-id: svn://svn.chromium.org/blink/trunk@167069 bbb929c8-8fbe-4397-9dbb-9b2b20218538
bool RenderLayerCompositor::canRender3DTransforms() const { return hasAcceleratedCompositing() && (m_compositingTriggers & ChromeClient::ThreeDTransformTrigger); }
bool RenderLayerCompositor::canRender3DTransforms() const { return hasAcceleratedCompositing() && (m_compositingTriggers & ChromeClient::ThreeDTransformTrigger); }
C
Chrome
0
CVE-2013-2877
https://www.cvedetails.com/cve/CVE-2013-2877/
CWE-119
https://github.com/chromium/chromium/commit/d0947db40187f4708c58e64cbd6013faf9eddeed
d0947db40187f4708c58e64cbd6013faf9eddeed
libxml: XML_PARSER_EOF checks from upstream BUG=229019 TBR=cpu Review URL: https://chromiumcodereview.appspot.com/14053009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196804 0039d316-1c4b-4281-b951-d872f2087c98
xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { xmlChar limit = 0; xmlChar *buf = NULL; xmlChar *rep = NULL; int len = 0; int buf_size = 0; int c, l, in_space = 0; xmlChar *current = NULL; xmlEntityPtr ent; if (NXT(0) == '"') { ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE; limit = '"'; NEXT; } else if (NXT(0) == '\'') { limit = '\''; ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE; NEXT; } else { xmlFatalErr(ctxt, XML_ERR_ATTRIBUTE_NOT_STARTED, NULL); return(NULL); } /* * allocate a translation buffer. */ buf_size = XML_PARSER_BUFFER_SIZE; buf = (xmlChar *) xmlMallocAtomic(buf_size * sizeof(xmlChar)); if (buf == NULL) goto mem_error; /* * OK loop until we reach one of the ending char or a size limit. */ c = CUR_CHAR(l); while (((NXT(0) != limit) && /* checked */ (IS_CHAR(c)) && (c != '<')) && (ctxt->instate != XML_PARSER_EOF)) { if (c == 0) break; if (c == '&') { in_space = 0; if (NXT(1) == '#') { int val = xmlParseCharRef(ctxt); if (val == '&') { if (ctxt->replaceEntities) { if (len > buf_size - 10) { growBuffer(buf, 10); } buf[len++] = '&'; } else { /* * The reparsing will be done in xmlStringGetNodeList() * called by the attribute() function in SAX.c */ if (len > buf_size - 10) { growBuffer(buf, 10); } buf[len++] = '&'; buf[len++] = '#'; buf[len++] = '3'; buf[len++] = '8'; buf[len++] = ';'; } } else if (val != 0) { if (len > buf_size - 10) { growBuffer(buf, 10); } len += xmlCopyChar(0, &buf[len], val); } } else { ent = xmlParseEntityRef(ctxt); ctxt->nbentities++; if (ent != NULL) ctxt->nbentities += ent->owner; if ((ent != NULL) && (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { if (len > buf_size - 10) { growBuffer(buf, 10); } if ((ctxt->replaceEntities == 0) && (ent->content[0] == '&')) { buf[len++] = '&'; buf[len++] = '#'; buf[len++] = '3'; buf[len++] = '8'; buf[len++] = ';'; } else { buf[len++] = ent->content[0]; } } else if ((ent != NULL) && (ctxt->replaceEntities != 0)) { if (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) { rep = xmlStringDecodeEntities(ctxt, ent->content, XML_SUBSTITUTE_REF, 0, 0, 0); if (rep != NULL) { current = rep; while (*current != 0) { /* non input consuming */ if ((*current == 0xD) || (*current == 0xA) || (*current == 0x9)) { buf[len++] = 0x20; current++; } else buf[len++] = *current++; if (len > buf_size - 10) { growBuffer(buf, 10); } } xmlFree(rep); rep = NULL; } } else { if (len > buf_size - 10) { growBuffer(buf, 10); } if (ent->content != NULL) buf[len++] = ent->content[0]; } } else if (ent != NULL) { int i = xmlStrlen(ent->name); const xmlChar *cur = ent->name; /* * This may look absurd but is needed to detect * entities problems */ if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && (ent->content != NULL)) { rep = xmlStringDecodeEntities(ctxt, ent->content, XML_SUBSTITUTE_REF, 0, 0, 0); if (rep != NULL) { xmlFree(rep); rep = NULL; } } /* * Just output the reference */ buf[len++] = '&'; while (len > buf_size - i - 10) { growBuffer(buf, i + 10); } for (;i > 0;i--) buf[len++] = *cur++; buf[len++] = ';'; } } } else { if ((c == 0x20) || (c == 0xD) || (c == 0xA) || (c == 0x9)) { if ((len != 0) || (!normalize)) { if ((!normalize) || (!in_space)) { COPY_BUF(l,buf,len,0x20); while (len > buf_size - 10) { growBuffer(buf, 10); } } in_space = 1; } } else { in_space = 0; COPY_BUF(l,buf,len,c); if (len > buf_size - 10) { growBuffer(buf, 10); } } NEXTL(l); } GROW; c = CUR_CHAR(l); } if (ctxt->instate == XML_PARSER_EOF) goto error; if ((in_space) && (normalize)) { while ((len > 0) && (buf[len - 1] == 0x20)) len--; } buf[len] = 0; if (RAW == '<') { xmlFatalErr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, NULL); } else if (RAW != limit) { if ((c != 0) && (!IS_CHAR(c))) { xmlFatalErrMsg(ctxt, XML_ERR_INVALID_CHAR, "invalid character in attribute value\n"); } else { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, "AttValue: ' expected\n"); } } else NEXT; if (attlen != NULL) *attlen = len; return(buf); mem_error: xmlErrMemory(ctxt, NULL); error: if (buf != NULL) xmlFree(buf); if (rep != NULL) xmlFree(rep); return(NULL); }
xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { xmlChar limit = 0; xmlChar *buf = NULL; xmlChar *rep = NULL; int len = 0; int buf_size = 0; int c, l, in_space = 0; xmlChar *current = NULL; xmlEntityPtr ent; if (NXT(0) == '"') { ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE; limit = '"'; NEXT; } else if (NXT(0) == '\'') { limit = '\''; ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE; NEXT; } else { xmlFatalErr(ctxt, XML_ERR_ATTRIBUTE_NOT_STARTED, NULL); return(NULL); } /* * allocate a translation buffer. */ buf_size = XML_PARSER_BUFFER_SIZE; buf = (xmlChar *) xmlMallocAtomic(buf_size * sizeof(xmlChar)); if (buf == NULL) goto mem_error; /* * OK loop until we reach one of the ending char or a size limit. */ c = CUR_CHAR(l); while ((NXT(0) != limit) && /* checked */ (IS_CHAR(c)) && (c != '<')) { if (c == 0) break; if (c == '&') { in_space = 0; if (NXT(1) == '#') { int val = xmlParseCharRef(ctxt); if (val == '&') { if (ctxt->replaceEntities) { if (len > buf_size - 10) { growBuffer(buf, 10); } buf[len++] = '&'; } else { /* * The reparsing will be done in xmlStringGetNodeList() * called by the attribute() function in SAX.c */ if (len > buf_size - 10) { growBuffer(buf, 10); } buf[len++] = '&'; buf[len++] = '#'; buf[len++] = '3'; buf[len++] = '8'; buf[len++] = ';'; } } else if (val != 0) { if (len > buf_size - 10) { growBuffer(buf, 10); } len += xmlCopyChar(0, &buf[len], val); } } else { ent = xmlParseEntityRef(ctxt); ctxt->nbentities++; if (ent != NULL) ctxt->nbentities += ent->owner; if ((ent != NULL) && (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { if (len > buf_size - 10) { growBuffer(buf, 10); } if ((ctxt->replaceEntities == 0) && (ent->content[0] == '&')) { buf[len++] = '&'; buf[len++] = '#'; buf[len++] = '3'; buf[len++] = '8'; buf[len++] = ';'; } else { buf[len++] = ent->content[0]; } } else if ((ent != NULL) && (ctxt->replaceEntities != 0)) { if (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) { rep = xmlStringDecodeEntities(ctxt, ent->content, XML_SUBSTITUTE_REF, 0, 0, 0); if (rep != NULL) { current = rep; while (*current != 0) { /* non input consuming */ if ((*current == 0xD) || (*current == 0xA) || (*current == 0x9)) { buf[len++] = 0x20; current++; } else buf[len++] = *current++; if (len > buf_size - 10) { growBuffer(buf, 10); } } xmlFree(rep); rep = NULL; } } else { if (len > buf_size - 10) { growBuffer(buf, 10); } if (ent->content != NULL) buf[len++] = ent->content[0]; } } else if (ent != NULL) { int i = xmlStrlen(ent->name); const xmlChar *cur = ent->name; /* * This may look absurd but is needed to detect * entities problems */ if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && (ent->content != NULL)) { rep = xmlStringDecodeEntities(ctxt, ent->content, XML_SUBSTITUTE_REF, 0, 0, 0); if (rep != NULL) { xmlFree(rep); rep = NULL; } } /* * Just output the reference */ buf[len++] = '&'; while (len > buf_size - i - 10) { growBuffer(buf, i + 10); } for (;i > 0;i--) buf[len++] = *cur++; buf[len++] = ';'; } } } else { if ((c == 0x20) || (c == 0xD) || (c == 0xA) || (c == 0x9)) { if ((len != 0) || (!normalize)) { if ((!normalize) || (!in_space)) { COPY_BUF(l,buf,len,0x20); while (len > buf_size - 10) { growBuffer(buf, 10); } } in_space = 1; } } else { in_space = 0; COPY_BUF(l,buf,len,c); if (len > buf_size - 10) { growBuffer(buf, 10); } } NEXTL(l); } GROW; c = CUR_CHAR(l); } if ((in_space) && (normalize)) { while ((len > 0) && (buf[len - 1] == 0x20)) len--; } buf[len] = 0; if (RAW == '<') { xmlFatalErr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, NULL); } else if (RAW != limit) { if ((c != 0) && (!IS_CHAR(c))) { xmlFatalErrMsg(ctxt, XML_ERR_INVALID_CHAR, "invalid character in attribute value\n"); } else { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, "AttValue: ' expected\n"); } } else NEXT; if (attlen != NULL) *attlen = len; return(buf); mem_error: xmlErrMemory(ctxt, NULL); if (buf != NULL) xmlFree(buf); if (rep != NULL) xmlFree(rep); return(NULL); }
C
Chrome
1
CVE-2018-6033
https://www.cvedetails.com/cve/CVE-2018-6033/
CWE-20
https://github.com/chromium/chromium/commit/a8d6ae61d266d8bc44c3dd2d08bda32db701e359
a8d6ae61d266d8bc44c3dd2d08bda32db701e359
Downloads : Fixed an issue of opening incorrect download file When one download overwrites another completed download, calling download.open in the old download causes the new download to open, which could be dangerous and undesirable. In this CL, we are trying to avoid this by blocking the opening of the old download. Bug: 793620 Change-Id: Ic948175756700ad7c08489c3cc347330daedb6f8 Reviewed-on: https://chromium-review.googlesource.com/826477 Reviewed-by: David Trainor <[email protected]> Reviewed-by: Xing Liu <[email protected]> Reviewed-by: John Abd-El-Malek <[email protected]> Commit-Queue: Shakti Sahu <[email protected]> Cr-Commit-Position: refs/heads/master@{#525810}
DownloadFileFactory* DownloadManagerImpl::GetDownloadFileFactoryForTesting() { return file_factory_.get(); }
DownloadFileFactory* DownloadManagerImpl::GetDownloadFileFactoryForTesting() { return file_factory_.get(); }
C
Chrome
0
CVE-2015-1274
https://www.cvedetails.com/cve/CVE-2015-1274/
CWE-254
https://github.com/chromium/chromium/commit/d27468a832d5316884bd02f459cbf493697fd7e1
d27468a832d5316884bd02f459cbf493697fd7e1
Switch to equalIgnoringASCIICase throughout modules/accessibility BUG=627682 Review-Url: https://codereview.chromium.org/2793913007 Cr-Commit-Position: refs/heads/master@{#461858}
AXObject::AXRange AXLayoutObject::selection() const { AXRange textSelection = textControlSelection(); if (textSelection.isValid()) return textSelection; if (!getLayoutObject() || !getLayoutObject()->frame()) return AXRange(); VisibleSelection selection = getLayoutObject() ->frame() ->selection() .computeVisibleSelectionInDOMTreeDeprecated(); if (selection.isNone()) return AXRange(); VisiblePosition visibleStart = selection.visibleStart(); Position start = visibleStart.toParentAnchoredPosition(); TextAffinity startAffinity = visibleStart.affinity(); VisiblePosition visibleEnd = selection.visibleEnd(); Position end = visibleEnd.toParentAnchoredPosition(); TextAffinity endAffinity = visibleEnd.affinity(); Node* anchorNode = start.anchorNode(); ASSERT(anchorNode); AXLayoutObject* anchorObject = nullptr; while (anchorNode) { anchorObject = getUnignoredObjectFromNode(*anchorNode); if (anchorObject) break; if (anchorNode->nextSibling()) anchorNode = anchorNode->nextSibling(); else anchorNode = anchorNode->parentNode(); } Node* focusNode = end.anchorNode(); ASSERT(focusNode); AXLayoutObject* focusObject = nullptr; while (focusNode) { focusObject = getUnignoredObjectFromNode(*focusNode); if (focusObject) break; if (focusNode->previousSibling()) focusNode = focusNode->previousSibling(); else focusNode = focusNode->parentNode(); } if (!anchorObject || !focusObject) return AXRange(); int anchorOffset = anchorObject->indexForVisiblePosition(visibleStart); ASSERT(anchorOffset >= 0); int focusOffset = focusObject->indexForVisiblePosition(visibleEnd); ASSERT(focusOffset >= 0); return AXRange(anchorObject, anchorOffset, startAffinity, focusObject, focusOffset, endAffinity); }
AXObject::AXRange AXLayoutObject::selection() const { AXRange textSelection = textControlSelection(); if (textSelection.isValid()) return textSelection; if (!getLayoutObject() || !getLayoutObject()->frame()) return AXRange(); VisibleSelection selection = getLayoutObject() ->frame() ->selection() .computeVisibleSelectionInDOMTreeDeprecated(); if (selection.isNone()) return AXRange(); VisiblePosition visibleStart = selection.visibleStart(); Position start = visibleStart.toParentAnchoredPosition(); TextAffinity startAffinity = visibleStart.affinity(); VisiblePosition visibleEnd = selection.visibleEnd(); Position end = visibleEnd.toParentAnchoredPosition(); TextAffinity endAffinity = visibleEnd.affinity(); Node* anchorNode = start.anchorNode(); ASSERT(anchorNode); AXLayoutObject* anchorObject = nullptr; while (anchorNode) { anchorObject = getUnignoredObjectFromNode(*anchorNode); if (anchorObject) break; if (anchorNode->nextSibling()) anchorNode = anchorNode->nextSibling(); else anchorNode = anchorNode->parentNode(); } Node* focusNode = end.anchorNode(); ASSERT(focusNode); AXLayoutObject* focusObject = nullptr; while (focusNode) { focusObject = getUnignoredObjectFromNode(*focusNode); if (focusObject) break; if (focusNode->previousSibling()) focusNode = focusNode->previousSibling(); else focusNode = focusNode->parentNode(); } if (!anchorObject || !focusObject) return AXRange(); int anchorOffset = anchorObject->indexForVisiblePosition(visibleStart); ASSERT(anchorOffset >= 0); int focusOffset = focusObject->indexForVisiblePosition(visibleEnd); ASSERT(focusOffset >= 0); return AXRange(anchorObject, anchorOffset, startAffinity, focusObject, focusOffset, endAffinity); }
C
Chrome
0
CVE-2012-2100
https://www.cvedetails.com/cve/CVE-2012-2100/
CWE-189
https://github.com/torvalds/linux/commit/d50f2ab6f050311dbf7b8f5501b25f0bf64a439b
d50f2ab6f050311dbf7b8f5501b25f0bf64a439b
ext4: fix undefined behavior in ext4_fill_flex_info() Commit 503358ae01b70ce6909d19dd01287093f6b6271c ("ext4: avoid divide by zero when trying to mount a corrupted file system") fixes CVE-2009-4307 by performing a sanity check on s_log_groups_per_flex, since it can be set to a bogus value by an attacker. sbi->s_log_groups_per_flex = sbi->s_es->s_log_groups_per_flex; groups_per_flex = 1 << sbi->s_log_groups_per_flex; if (groups_per_flex < 2) { ... } This patch fixes two potential issues in the previous commit. 1) The sanity check might only work on architectures like PowerPC. On x86, 5 bits are used for the shifting amount. That means, given a large s_log_groups_per_flex value like 36, groups_per_flex = 1 << 36 is essentially 1 << 4 = 16, rather than 0. This will bypass the check, leaving s_log_groups_per_flex and groups_per_flex inconsistent. 2) The sanity check relies on undefined behavior, i.e., oversized shift. A standard-confirming C compiler could rewrite the check in unexpected ways. Consider the following equivalent form, assuming groups_per_flex is unsigned for simplicity. groups_per_flex = 1 << sbi->s_log_groups_per_flex; if (groups_per_flex == 0 || groups_per_flex == 1) { We compile the code snippet using Clang 3.0 and GCC 4.6. Clang will completely optimize away the check groups_per_flex == 0, leaving the patched code as vulnerable as the original. GCC keeps the check, but there is no guarantee that future versions will do the same. Signed-off-by: Xi Wang <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
static int ext4_check_descriptors(struct super_block *sb, ext4_group_t *first_not_zeroed) { struct ext4_sb_info *sbi = EXT4_SB(sb); ext4_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block); ext4_fsblk_t last_block; ext4_fsblk_t block_bitmap; ext4_fsblk_t inode_bitmap; ext4_fsblk_t inode_table; int flexbg_flag = 0; ext4_group_t i, grp = sbi->s_groups_count; if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) flexbg_flag = 1; ext4_debug("Checking group descriptors"); for (i = 0; i < sbi->s_groups_count; i++) { struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL); if (i == sbi->s_groups_count - 1 || flexbg_flag) last_block = ext4_blocks_count(sbi->s_es) - 1; else last_block = first_block + (EXT4_BLOCKS_PER_GROUP(sb) - 1); if ((grp == sbi->s_groups_count) && !(gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED))) grp = i; block_bitmap = ext4_block_bitmap(sb, gdp); if (block_bitmap < first_block || block_bitmap > last_block) { ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " "Block bitmap for group %u not in group " "(block %llu)!", i, block_bitmap); return 0; } inode_bitmap = ext4_inode_bitmap(sb, gdp); if (inode_bitmap < first_block || inode_bitmap > last_block) { ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " "Inode bitmap for group %u not in group " "(block %llu)!", i, inode_bitmap); return 0; } inode_table = ext4_inode_table(sb, gdp); if (inode_table < first_block || inode_table + sbi->s_itb_per_group - 1 > last_block) { ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " "Inode table for group %u not in group " "(block %llu)!", i, inode_table); return 0; } ext4_lock_group(sb, i); if (!ext4_group_desc_csum_verify(sbi, i, gdp)) { ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " "Checksum for group %u failed (%u!=%u)", i, le16_to_cpu(ext4_group_desc_csum(sbi, i, gdp)), le16_to_cpu(gdp->bg_checksum)); if (!(sb->s_flags & MS_RDONLY)) { ext4_unlock_group(sb, i); return 0; } } ext4_unlock_group(sb, i); if (!flexbg_flag) first_block += EXT4_BLOCKS_PER_GROUP(sb); } if (NULL != first_not_zeroed) *first_not_zeroed = grp; ext4_free_blocks_count_set(sbi->s_es, EXT4_C2B(sbi, ext4_count_free_clusters(sb))); sbi->s_es->s_free_inodes_count =cpu_to_le32(ext4_count_free_inodes(sb)); return 1; }
static int ext4_check_descriptors(struct super_block *sb, ext4_group_t *first_not_zeroed) { struct ext4_sb_info *sbi = EXT4_SB(sb); ext4_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block); ext4_fsblk_t last_block; ext4_fsblk_t block_bitmap; ext4_fsblk_t inode_bitmap; ext4_fsblk_t inode_table; int flexbg_flag = 0; ext4_group_t i, grp = sbi->s_groups_count; if (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) flexbg_flag = 1; ext4_debug("Checking group descriptors"); for (i = 0; i < sbi->s_groups_count; i++) { struct ext4_group_desc *gdp = ext4_get_group_desc(sb, i, NULL); if (i == sbi->s_groups_count - 1 || flexbg_flag) last_block = ext4_blocks_count(sbi->s_es) - 1; else last_block = first_block + (EXT4_BLOCKS_PER_GROUP(sb) - 1); if ((grp == sbi->s_groups_count) && !(gdp->bg_flags & cpu_to_le16(EXT4_BG_INODE_ZEROED))) grp = i; block_bitmap = ext4_block_bitmap(sb, gdp); if (block_bitmap < first_block || block_bitmap > last_block) { ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " "Block bitmap for group %u not in group " "(block %llu)!", i, block_bitmap); return 0; } inode_bitmap = ext4_inode_bitmap(sb, gdp); if (inode_bitmap < first_block || inode_bitmap > last_block) { ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " "Inode bitmap for group %u not in group " "(block %llu)!", i, inode_bitmap); return 0; } inode_table = ext4_inode_table(sb, gdp); if (inode_table < first_block || inode_table + sbi->s_itb_per_group - 1 > last_block) { ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " "Inode table for group %u not in group " "(block %llu)!", i, inode_table); return 0; } ext4_lock_group(sb, i); if (!ext4_group_desc_csum_verify(sbi, i, gdp)) { ext4_msg(sb, KERN_ERR, "ext4_check_descriptors: " "Checksum for group %u failed (%u!=%u)", i, le16_to_cpu(ext4_group_desc_csum(sbi, i, gdp)), le16_to_cpu(gdp->bg_checksum)); if (!(sb->s_flags & MS_RDONLY)) { ext4_unlock_group(sb, i); return 0; } } ext4_unlock_group(sb, i); if (!flexbg_flag) first_block += EXT4_BLOCKS_PER_GROUP(sb); } if (NULL != first_not_zeroed) *first_not_zeroed = grp; ext4_free_blocks_count_set(sbi->s_es, EXT4_C2B(sbi, ext4_count_free_clusters(sb))); sbi->s_es->s_free_inodes_count =cpu_to_le32(ext4_count_free_inodes(sb)); return 1; }
C
linux
0