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-2016-4998
https://www.cvedetails.com/cve/CVE-2016-4998/
CWE-119
https://github.com/torvalds/linux/commit/6e94e0cfb0887e4013b3b930fa6ab1fe6bb6ba91
6e94e0cfb0887e4013b3b930fa6ab1fe6bb6ba91
netfilter: x_tables: make sure e->next_offset covers remaining blob size Otherwise this function may read data beyond the ruleset blob. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
static int do_arpt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) { int ret; if (!ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN)) return -EPERM; switch (cmd) { case ARPT_SO_SET_REPLACE: ret = do_replace(sock_net(sk), user, len); break; case ARPT_SO_SET_ADD_COUNTERS: ret = do_add_counters(sock_net(sk), user, len, 0); break; default: duprintf("do_arpt_set_ctl: unknown request %i\n", cmd); ret = -EINVAL; } return ret; }
static int do_arpt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) { int ret; if (!ns_capable(sock_net(sk)->user_ns, CAP_NET_ADMIN)) return -EPERM; switch (cmd) { case ARPT_SO_SET_REPLACE: ret = do_replace(sock_net(sk), user, len); break; case ARPT_SO_SET_ADD_COUNTERS: ret = do_add_counters(sock_net(sk), user, len, 0); break; default: duprintf("do_arpt_set_ctl: unknown request %i\n", cmd); ret = -EINVAL; } return ret; }
C
linux
0
CVE-2013-2015
https://www.cvedetails.com/cve/CVE-2013-2015/
CWE-399
https://github.com/torvalds/linux/commit/0e9a9a1ad619e7e987815d20262d36a2f95717ca
0e9a9a1ad619e7e987815d20262d36a2f95717ca
ext4: avoid hang when mounting non-journal filesystems with orphan list When trying to mount a file system which does not contain a journal, but which does have a orphan list containing an inode which needs to be truncated, the mount call with hang forever in ext4_orphan_cleanup() because ext4_orphan_del() will return immediately without removing the inode from the orphan list, leading to an uninterruptible loop in kernel code which will busy out one of the CPU's on the system. This can be trivially reproduced by trying to mount the file system found in tests/f_orphan_extents_inode/image.gz from the e2fsprogs source tree. If a malicious user were to put this on a USB stick, and mount it on a Linux desktop which has automatic mounts enabled, this could be considered a potential denial of service attack. (Not a big deal in practice, but professional paranoids worry about such things, and have even been known to allocate CVE numbers for such problems.) Signed-off-by: "Theodore Ts'o" <[email protected]> Reviewed-by: Zheng Liu <[email protected]> Cc: [email protected]
static int ext4_add_entry(handle_t *handle, struct dentry *dentry, struct inode *inode) { struct inode *dir = dentry->d_parent->d_inode; struct buffer_head *bh; struct ext4_dir_entry_2 *de; struct ext4_dir_entry_tail *t; struct super_block *sb; int retval; int dx_fallback=0; unsigned blocksize; ext4_lblk_t block, blocks; int csum_size = 0; if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) csum_size = sizeof(struct ext4_dir_entry_tail); sb = dir->i_sb; blocksize = sb->s_blocksize; if (!dentry->d_name.len) return -EINVAL; if (ext4_has_inline_data(dir)) { retval = ext4_try_add_inline_entry(handle, dentry, inode); if (retval < 0) return retval; if (retval == 1) { retval = 0; return retval; } } if (is_dx(dir)) { retval = ext4_dx_add_entry(handle, dentry, inode); if (!retval || (retval != ERR_BAD_DX_DIR)) return retval; ext4_clear_inode_flag(dir, EXT4_INODE_INDEX); dx_fallback++; ext4_mark_inode_dirty(handle, dir); } blocks = dir->i_size >> sb->s_blocksize_bits; for (block = 0; block < blocks; block++) { if (!(bh = ext4_bread(handle, dir, block, 0, &retval))) { if (!retval) { retval = -EIO; ext4_error(inode->i_sb, "Directory hole detected on inode %lu\n", inode->i_ino); } return retval; } if (!buffer_verified(bh) && !ext4_dirent_csum_verify(dir, (struct ext4_dir_entry *)bh->b_data)) return -EIO; set_buffer_verified(bh); retval = add_dirent_to_buf(handle, dentry, inode, NULL, bh); if (retval != -ENOSPC) { brelse(bh); return retval; } if (blocks == 1 && !dx_fallback && EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX)) return make_indexed_dir(handle, dentry, inode, bh); brelse(bh); } bh = ext4_append(handle, dir, &block, &retval); if (!bh) return retval; de = (struct ext4_dir_entry_2 *) bh->b_data; de->inode = 0; de->rec_len = ext4_rec_len_to_disk(blocksize - csum_size, blocksize); if (csum_size) { t = EXT4_DIRENT_TAIL(bh->b_data, blocksize); initialize_dirent_tail(t, blocksize); } retval = add_dirent_to_buf(handle, dentry, inode, de, bh); brelse(bh); if (retval == 0) ext4_set_inode_state(inode, EXT4_STATE_NEWENTRY); return retval; }
static int ext4_add_entry(handle_t *handle, struct dentry *dentry, struct inode *inode) { struct inode *dir = dentry->d_parent->d_inode; struct buffer_head *bh; struct ext4_dir_entry_2 *de; struct ext4_dir_entry_tail *t; struct super_block *sb; int retval; int dx_fallback=0; unsigned blocksize; ext4_lblk_t block, blocks; int csum_size = 0; if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) csum_size = sizeof(struct ext4_dir_entry_tail); sb = dir->i_sb; blocksize = sb->s_blocksize; if (!dentry->d_name.len) return -EINVAL; if (ext4_has_inline_data(dir)) { retval = ext4_try_add_inline_entry(handle, dentry, inode); if (retval < 0) return retval; if (retval == 1) { retval = 0; return retval; } } if (is_dx(dir)) { retval = ext4_dx_add_entry(handle, dentry, inode); if (!retval || (retval != ERR_BAD_DX_DIR)) return retval; ext4_clear_inode_flag(dir, EXT4_INODE_INDEX); dx_fallback++; ext4_mark_inode_dirty(handle, dir); } blocks = dir->i_size >> sb->s_blocksize_bits; for (block = 0; block < blocks; block++) { if (!(bh = ext4_bread(handle, dir, block, 0, &retval))) { if (!retval) { retval = -EIO; ext4_error(inode->i_sb, "Directory hole detected on inode %lu\n", inode->i_ino); } return retval; } if (!buffer_verified(bh) && !ext4_dirent_csum_verify(dir, (struct ext4_dir_entry *)bh->b_data)) return -EIO; set_buffer_verified(bh); retval = add_dirent_to_buf(handle, dentry, inode, NULL, bh); if (retval != -ENOSPC) { brelse(bh); return retval; } if (blocks == 1 && !dx_fallback && EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX)) return make_indexed_dir(handle, dentry, inode, bh); brelse(bh); } bh = ext4_append(handle, dir, &block, &retval); if (!bh) return retval; de = (struct ext4_dir_entry_2 *) bh->b_data; de->inode = 0; de->rec_len = ext4_rec_len_to_disk(blocksize - csum_size, blocksize); if (csum_size) { t = EXT4_DIRENT_TAIL(bh->b_data, blocksize); initialize_dirent_tail(t, blocksize); } retval = add_dirent_to_buf(handle, dentry, inode, de, bh); brelse(bh); if (retval == 0) ext4_set_inode_state(inode, EXT4_STATE_NEWENTRY); return retval; }
C
linux
0
CVE-2016-1683
https://www.cvedetails.com/cve/CVE-2016-1683/
CWE-119
https://github.com/chromium/chromium/commit/96dbafe288dbe2f0cc45fa3c39daf6d0c37acbab
96dbafe288dbe2f0cc45fa3c39daf6d0c37acbab
Roll libxslt to 891681e3e948f31732229f53cb6db7215f740fc7 BUG=583156,583171 Review URL: https://codereview.chromium.org/1853083002 Cr-Commit-Position: refs/heads/master@{#385338}
xsltCompilationCtxtCreate(xsltStylesheetPtr style) { xsltCompilerCtxtPtr ret; ret = (xsltCompilerCtxtPtr) xmlMalloc(sizeof(xsltCompilerCtxt)); if (ret == NULL) { xsltTransformError(NULL, style, NULL, "xsltCompilerCreate: allocation of compiler " "context failed.\n"); return(NULL); } memset(ret, 0, sizeof(xsltCompilerCtxt)); ret->errSeverity = XSLT_ERROR_SEVERITY_ERROR; ret->tmpList = xsltPointerListCreate(20); if (ret->tmpList == NULL) { goto internal_err; } #ifdef XSLT_REFACTORED_XPATHCOMP /* * Create the XPath compilation context in order * to speed up precompilation of XPath expressions. */ ret->xpathCtxt = xmlXPathNewContext(NULL); if (ret->xpathCtxt == NULL) goto internal_err; #endif return(ret); internal_err: xsltCompilationCtxtFree(ret); return(NULL); }
xsltCompilationCtxtCreate(xsltStylesheetPtr style) { xsltCompilerCtxtPtr ret; ret = (xsltCompilerCtxtPtr) xmlMalloc(sizeof(xsltCompilerCtxt)); if (ret == NULL) { xsltTransformError(NULL, style, NULL, "xsltCompilerCreate: allocation of compiler " "context failed.\n"); return(NULL); } memset(ret, 0, sizeof(xsltCompilerCtxt)); ret->errSeverity = XSLT_ERROR_SEVERITY_ERROR; ret->tmpList = xsltPointerListCreate(20); if (ret->tmpList == NULL) { goto internal_err; } #ifdef XSLT_REFACTORED_XPATHCOMP /* * Create the XPath compilation context in order * to speed up precompilation of XPath expressions. */ ret->xpathCtxt = xmlXPathNewContext(NULL); if (ret->xpathCtxt == NULL) goto internal_err; #endif return(ret); internal_err: xsltCompilationCtxtFree(ret); return(NULL); }
C
Chrome
0
CVE-2017-13054
https://www.cvedetails.com/cve/CVE-2017-13054/
CWE-125
https://github.com/the-tcpdump-group/tcpdump/commit/e6511cc1a950fe1566b2236329d6b4bd0826cc7a
e6511cc1a950fe1566b2236329d6b4bd0826cc7a
CVE-2017-13054/LLDP: add a missing length check In lldp_private_8023_print() the case block for subtype 4 (Maximum Frame Size TLV, IEEE 802.3bc-2009 Section 79.3.4) did not include the length check and could over-read the input buffer, put it right. This fixes a buffer over-read discovered by Bhargava Shastry, SecT/TU Berlin. Add a test using the capture file supplied by the reporter(s).
print_tc_bandwidth_table(netdissect_options *ndo, const u_char *ptr) { ND_PRINT((ndo, "\n\t TC Bandwidth Table")); ND_PRINT((ndo, "\n\t TC%% : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : %-3d %-3d %-3d %-3d %-3d %-3d %-3d %-3d", ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], ptr[6], ptr[7])); }
print_tc_bandwidth_table(netdissect_options *ndo, const u_char *ptr) { ND_PRINT((ndo, "\n\t TC Bandwidth Table")); ND_PRINT((ndo, "\n\t TC%% : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : %-3d %-3d %-3d %-3d %-3d %-3d %-3d %-3d", ptr[0], ptr[1], ptr[2], ptr[3], ptr[4], ptr[5], ptr[6], ptr[7])); }
C
tcpdump
0
CVE-2018-18350
https://www.cvedetails.com/cve/CVE-2018-18350/
null
https://github.com/chromium/chromium/commit/d683fb12566eaec180ee0e0506288f46cc7a43e7
d683fb12566eaec180ee0e0506288f46cc7a43e7
Inherit CSP when self-navigating to local-scheme URL As the linked bug example shows, we should inherit CSP when we navigate to a local-scheme URL (even if we are in a main browsing context). Bug: 799747 Change-Id: I8413aa8e8049461ebcf0ffbf7b04c41d1340af02 Reviewed-on: https://chromium-review.googlesource.com/c/1234337 Reviewed-by: Mike West <[email protected]> Commit-Queue: Andy Paicu <[email protected]> Cr-Commit-Position: refs/heads/master@{#597889}
void Document::FinishedParsing() { DCHECK(!GetScriptableDocumentParser() || !parser_->IsParsing()); DCHECK(!GetScriptableDocumentParser() || ready_state_ != kLoading); SetParsingState(kInDOMContentLoaded); DocumentParserTiming::From(*this).MarkParserStop(); if (document_timing_.DomContentLoadedEventStart().is_null()) document_timing_.MarkDomContentLoadedEventStart(); DispatchEvent(*Event::CreateBubble(EventTypeNames::DOMContentLoaded)); if (document_timing_.DomContentLoadedEventEnd().is_null()) document_timing_.MarkDomContentLoadedEventEnd(); SetParsingState(kFinishedParsing); Microtask::PerformCheckpoint(V8PerIsolateData::MainThreadIsolate()); ScriptableDocumentParser* parser = GetScriptableDocumentParser(); well_formed_ = parser && parser->WellFormed(); if (LocalFrame* frame = GetFrame()) { if (title_.IsEmpty()) DispatchDidReceiveTitle(); const bool main_resource_was_already_requested = frame->Loader().StateMachine()->CommittedFirstRealDocumentLoad(); if (main_resource_was_already_requested) UpdateStyleAndLayoutTree(); BeginLifecycleUpdatesIfRenderingReady(); frame->Loader().FinishedParsing(); TRACE_EVENT_INSTANT1("devtools.timeline", "MarkDOMContent", TRACE_EVENT_SCOPE_THREAD, "data", InspectorMarkLoadEvent::Data(frame)); probe::domContentLoadedEventFired(frame); frame->GetIdlenessDetector()->DomContentLoadedEventFired(); } element_data_cache_clear_timer_.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); fetcher_->ClearPreloads(ResourceFetcher::kClearSpeculativeMarkupPreloads); if (!frame_ || frame_->GetSettings()->GetSavePreviousDocumentResources() == SavePreviousDocumentResources::kUntilOnDOMContentLoaded) { fetcher_->ClearResourcesFromPreviousFetcher(); } if (IsPrefetchOnly()) WebPrerenderingSupport::Current()->PrefetchFinished(); }
void Document::FinishedParsing() { DCHECK(!GetScriptableDocumentParser() || !parser_->IsParsing()); DCHECK(!GetScriptableDocumentParser() || ready_state_ != kLoading); SetParsingState(kInDOMContentLoaded); DocumentParserTiming::From(*this).MarkParserStop(); if (document_timing_.DomContentLoadedEventStart().is_null()) document_timing_.MarkDomContentLoadedEventStart(); DispatchEvent(*Event::CreateBubble(EventTypeNames::DOMContentLoaded)); if (document_timing_.DomContentLoadedEventEnd().is_null()) document_timing_.MarkDomContentLoadedEventEnd(); SetParsingState(kFinishedParsing); Microtask::PerformCheckpoint(V8PerIsolateData::MainThreadIsolate()); ScriptableDocumentParser* parser = GetScriptableDocumentParser(); well_formed_ = parser && parser->WellFormed(); if (LocalFrame* frame = GetFrame()) { if (title_.IsEmpty()) DispatchDidReceiveTitle(); const bool main_resource_was_already_requested = frame->Loader().StateMachine()->CommittedFirstRealDocumentLoad(); if (main_resource_was_already_requested) UpdateStyleAndLayoutTree(); BeginLifecycleUpdatesIfRenderingReady(); frame->Loader().FinishedParsing(); TRACE_EVENT_INSTANT1("devtools.timeline", "MarkDOMContent", TRACE_EVENT_SCOPE_THREAD, "data", InspectorMarkLoadEvent::Data(frame)); probe::domContentLoadedEventFired(frame); frame->GetIdlenessDetector()->DomContentLoadedEventFired(); } element_data_cache_clear_timer_.StartOneShot(TimeDelta::FromSeconds(10), FROM_HERE); fetcher_->ClearPreloads(ResourceFetcher::kClearSpeculativeMarkupPreloads); if (!frame_ || frame_->GetSettings()->GetSavePreviousDocumentResources() == SavePreviousDocumentResources::kUntilOnDOMContentLoaded) { fetcher_->ClearResourcesFromPreviousFetcher(); } if (IsPrefetchOnly()) WebPrerenderingSupport::Current()->PrefetchFinished(); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/21d4d15a81b030f522fef29a0429f08a70220f68
21d4d15a81b030f522fef29a0429f08a70220f68
Moved guest_view_registry to GuestViewManager and made it an instance map This change allows for the change towards moving GuestViewManager to components and implementing an extensions specific GuestViewManager that installs extensions-specific guest types. BUG=444869 Review URL: https://codereview.chromium.org/1096623002 Cr-Commit-Position: refs/heads/master@{#325919}
bool GuestViewBase::ShouldFocusPageAfterCrash() { return false; }
bool GuestViewBase::ShouldFocusPageAfterCrash() { return false; }
C
Chrome
0
CVE-2017-13686
https://www.cvedetails.com/cve/CVE-2017-13686/
CWE-476
https://github.com/torvalds/linux/commit/bc3aae2bbac46dd894c89db5d5e98f7f0ef9e205
bc3aae2bbac46dd894c89db5d5e98f7f0ef9e205
net: check and errout if res->fi is NULL when RTM_F_FIB_MATCH is set Syzkaller hit 'general protection fault in fib_dump_info' bug on commit 4.13-rc5.. Guilty file: net/ipv4/fib_semantics.c kasan: GPF could be caused by NULL-ptr deref or user memory access general protection fault: 0000 [#1] SMP KASAN Modules linked in: CPU: 0 PID: 2808 Comm: syz-executor0 Not tainted 4.13.0-rc5 #1 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Ubuntu-1.8.2-1ubuntu1 04/01/2014 task: ffff880078562700 task.stack: ffff880078110000 RIP: 0010:fib_dump_info+0x388/0x1170 net/ipv4/fib_semantics.c:1314 RSP: 0018:ffff880078117010 EFLAGS: 00010206 RAX: dffffc0000000000 RBX: 00000000000000fe RCX: 0000000000000002 RDX: 0000000000000006 RSI: ffff880078117084 RDI: 0000000000000030 RBP: ffff880078117268 R08: 000000000000000c R09: ffff8800780d80c8 R10: 0000000058d629b4 R11: 0000000067fce681 R12: 0000000000000000 R13: ffff8800784bd540 R14: ffff8800780d80b5 R15: ffff8800780d80a4 FS: 00000000022fa940(0000) GS:ffff88007fc00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000004387d0 CR3: 0000000079135000 CR4: 00000000000006f0 Call Trace: inet_rtm_getroute+0xc89/0x1f50 net/ipv4/route.c:2766 rtnetlink_rcv_msg+0x288/0x680 net/core/rtnetlink.c:4217 netlink_rcv_skb+0x340/0x470 net/netlink/af_netlink.c:2397 rtnetlink_rcv+0x28/0x30 net/core/rtnetlink.c:4223 netlink_unicast_kernel net/netlink/af_netlink.c:1265 [inline] netlink_unicast+0x4c4/0x6e0 net/netlink/af_netlink.c:1291 netlink_sendmsg+0x8c4/0xca0 net/netlink/af_netlink.c:1854 sock_sendmsg_nosec net/socket.c:633 [inline] sock_sendmsg+0xca/0x110 net/socket.c:643 ___sys_sendmsg+0x779/0x8d0 net/socket.c:2035 __sys_sendmsg+0xd1/0x170 net/socket.c:2069 SYSC_sendmsg net/socket.c:2080 [inline] SyS_sendmsg+0x2d/0x50 net/socket.c:2076 entry_SYSCALL_64_fastpath+0x1a/0xa5 RIP: 0033:0x4512e9 RSP: 002b:00007ffc75584cc8 EFLAGS: 00000216 ORIG_RAX: 000000000000002e RAX: ffffffffffffffda RBX: 0000000000000002 RCX: 00000000004512e9 RDX: 0000000000000000 RSI: 0000000020f2cfc8 RDI: 0000000000000003 RBP: 000000000000000e R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000216 R12: fffffffffffffffe R13: 0000000000718000 R14: 0000000020c44ff0 R15: 0000000000000000 Code: 00 0f b6 8d ec fd ff ff 48 8b 85 f0 fd ff ff 88 48 17 48 8b 45 28 48 8d 78 30 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e cb 0c 00 00 48 8b 45 28 44 RIP: fib_dump_info+0x388/0x1170 net/ipv4/fib_semantics.c:1314 RSP: ffff880078117010 ---[ end trace 254a7af28348f88b ]--- This patch adds a res->fi NULL check. example run: $ip route get 0.0.0.0 iif virt1-0 broadcast 0.0.0.0 dev lo cache <local,brd> iif virt1-0 $ip route get 0.0.0.0 iif virt1-0 fibmatch RTNETLINK answers: No route to host Reported-by: idaifish <[email protected]> Reported-by: Dmitry Vyukov <[email protected]> Fixes: b61798130f1b ("net: ipv4: RTM_GETROUTE: return matched fib result when requested") Signed-off-by: Roopa Prabhu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, int oif, u32 mark, u8 protocol, int flow_flags) { const struct iphdr *iph = (const struct iphdr *) skb->data; struct flowi4 fl4; struct rtable *rt; if (!mark) mark = IP4_REPLY_MARK(net, skb->mark); __build_flow_key(net, &fl4, NULL, iph, oif, RT_TOS(iph->tos), protocol, mark, flow_flags); rt = __ip_route_output_key(net, &fl4); if (!IS_ERR(rt)) { __ip_rt_update_pmtu(rt, &fl4, mtu); ip_rt_put(rt); } }
void ipv4_update_pmtu(struct sk_buff *skb, struct net *net, u32 mtu, int oif, u32 mark, u8 protocol, int flow_flags) { const struct iphdr *iph = (const struct iphdr *) skb->data; struct flowi4 fl4; struct rtable *rt; if (!mark) mark = IP4_REPLY_MARK(net, skb->mark); __build_flow_key(net, &fl4, NULL, iph, oif, RT_TOS(iph->tos), protocol, mark, flow_flags); rt = __ip_route_output_key(net, &fl4); if (!IS_ERR(rt)) { __ip_rt_update_pmtu(rt, &fl4, mtu); ip_rt_put(rt); } }
C
linux
0
CVE-2017-7533
https://www.cvedetails.com/cve/CVE-2017-7533/
CWE-362
https://github.com/torvalds/linux/commit/49d31c2f389acfe83417083e1208422b4091cd9e
49d31c2f389acfe83417083e1208422b4091cd9e
dentry name snapshots take_dentry_name_snapshot() takes a safe snapshot of dentry name; if the name is a short one, it gets copied into caller-supplied structure, otherwise an extra reference to external name is grabbed (those are never modified). In either case the pointer to stable string is stored into the same structure. dentry must be held by the caller of take_dentry_name_snapshot(), but may be freely dropped afterwards - the snapshot will stay until destroyed by release_dentry_name_snapshot(). Intended use: struct name_snapshot s; take_dentry_name_snapshot(&s, dentry); ... access s.name ... release_dentry_name_snapshot(&s); Replaces fsnotify_oldname_...(), gets used in fsnotify to obtain the name to pass down with event. Signed-off-by: Al Viro <[email protected]>
int d_instantiate_no_diralias(struct dentry *entry, struct inode *inode) { BUG_ON(!hlist_unhashed(&entry->d_u.d_alias)); security_d_instantiate(entry, inode); spin_lock(&inode->i_lock); if (S_ISDIR(inode->i_mode) && !hlist_empty(&inode->i_dentry)) { spin_unlock(&inode->i_lock); iput(inode); return -EBUSY; } __d_instantiate(entry, inode); spin_unlock(&inode->i_lock); return 0; }
int d_instantiate_no_diralias(struct dentry *entry, struct inode *inode) { BUG_ON(!hlist_unhashed(&entry->d_u.d_alias)); security_d_instantiate(entry, inode); spin_lock(&inode->i_lock); if (S_ISDIR(inode->i_mode) && !hlist_empty(&inode->i_dentry)) { spin_unlock(&inode->i_lock); iput(inode); return -EBUSY; } __d_instantiate(entry, inode); spin_unlock(&inode->i_lock); return 0; }
C
linux
0
CVE-2017-15868
https://www.cvedetails.com/cve/CVE-2017-15868/
CWE-20
https://github.com/torvalds/linux/commit/71bb99a02b32b4cc4265118e85f6035ca72923f0
71bb99a02b32b4cc4265118e85f6035ca72923f0
Bluetooth: bnep: bnep_add_connection() should verify that it's dealing with l2cap socket same story as cmtp Signed-off-by: Al Viro <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
static void __exit bnep_exit(void) { bnep_sock_cleanup(); }
static void __exit bnep_exit(void) { bnep_sock_cleanup(); }
C
linux
0
CVE-2019-1010208
https://www.cvedetails.com/cve/CVE-2019-1010208/
CWE-119
https://github.com/veracrypt/VeraCrypt/commit/f30f9339c9a0b9bbcc6f5ad38804af39db1f479e
f30f9339c9a0b9bbcc6f5ad38804af39db1f479e
Windows: fix low severity vulnerability in driver that allowed reading 3 bytes of kernel stack memory (with a rare possibility of 25 additional bytes). Reported by Tim Harrison.
BOOL IsVolumeAccessibleByCurrentUser (PEXTENSION volumeDeviceExtension) { SECURITY_SUBJECT_CONTEXT subContext; PACCESS_TOKEN accessToken; PTOKEN_USER tokenUser; BOOL result = FALSE; if (IoIsSystemThread (PsGetCurrentThread()) || UserCanAccessDriveDevice() || !volumeDeviceExtension->UserSid || (volumeDeviceExtension->SystemFavorite && !NonAdminSystemFavoritesAccessDisabled)) { return TRUE; } SeCaptureSubjectContext (&subContext); SeLockSubjectContext(&subContext); if (subContext.ClientToken && subContext.ImpersonationLevel >= SecurityImpersonation) accessToken = subContext.ClientToken; else accessToken = subContext.PrimaryToken; if (!accessToken) goto ret; if (SeTokenIsAdmin (accessToken)) { result = TRUE; goto ret; } if (!NT_SUCCESS (SeQueryInformationToken (accessToken, TokenUser, &tokenUser))) goto ret; result = RtlEqualSid (volumeDeviceExtension->UserSid, tokenUser->User.Sid); ExFreePool (tokenUser); // Documented in newer versions of WDK ret: SeUnlockSubjectContext(&subContext); SeReleaseSubjectContext (&subContext); return result; }
BOOL IsVolumeAccessibleByCurrentUser (PEXTENSION volumeDeviceExtension) { SECURITY_SUBJECT_CONTEXT subContext; PACCESS_TOKEN accessToken; PTOKEN_USER tokenUser; BOOL result = FALSE; if (IoIsSystemThread (PsGetCurrentThread()) || UserCanAccessDriveDevice() || !volumeDeviceExtension->UserSid || (volumeDeviceExtension->SystemFavorite && !NonAdminSystemFavoritesAccessDisabled)) { return TRUE; } SeCaptureSubjectContext (&subContext); SeLockSubjectContext(&subContext); if (subContext.ClientToken && subContext.ImpersonationLevel >= SecurityImpersonation) accessToken = subContext.ClientToken; else accessToken = subContext.PrimaryToken; if (!accessToken) goto ret; if (SeTokenIsAdmin (accessToken)) { result = TRUE; goto ret; } if (!NT_SUCCESS (SeQueryInformationToken (accessToken, TokenUser, &tokenUser))) goto ret; result = RtlEqualSid (volumeDeviceExtension->UserSid, tokenUser->User.Sid); ExFreePool (tokenUser); // Documented in newer versions of WDK ret: SeUnlockSubjectContext(&subContext); SeReleaseSubjectContext (&subContext); return result; }
C
VeraCrypt
0
CVE-2012-5156
https://www.cvedetails.com/cve/CVE-2012-5156/
CWE-399
https://github.com/chromium/chromium/commit/b15c87071f906301bccc824ce013966ca93998c7
b15c87071f906301bccc824ce013966ca93998c7
Validate and report peer's PID to WorkerProcessIpcDelegate so it will be able to duplicate handles to and from the worker process. As a side effect WorkerProcessLauncher::Delegate is now responsible for retrieving the client's PID and deciding whether a launch failed due to a permanent error condition. BUG=134694 Review URL: https://chromiumcodereview.appspot.com/11143025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@162778 0039d316-1c4b-4281-b951-d872f2087c98
void WorkerProcessLauncher::Core::OnChannelConnected(int32 peer_pid) { DCHECK(caller_task_runner_->BelongsToCurrentThread()); if (!ipc_enabled_) return; // Verify |peer_pid| because it is controlled by the client and cannot be // trusted. DWORD actual_pid = launcher_delegate_->GetProcessId(); if (peer_pid != static_cast<int32>(actual_pid)) { LOG(ERROR) << "The actual client PID " << actual_pid << " does not match the one reported by the client: " << peer_pid; StopWorker(); return; } worker_delegate_->OnChannelConnected(peer_pid); }
void WorkerProcessLauncher::Core::OnChannelConnected(int32 peer_pid) { DCHECK(caller_task_runner_->BelongsToCurrentThread()); if (ipc_enabled_) worker_delegate_->OnChannelConnected(); }
C
Chrome
1
CVE-2017-5118
https://www.cvedetails.com/cve/CVE-2017-5118/
CWE-732
https://github.com/chromium/chromium/commit/0ab2412a104d2f235d7b9fe19d30ef605a410832
0ab2412a104d2f235d7b9fe19d30ef605a410832
Inherit CSP when we inherit the security origin This prevents attacks that use main window navigation to get out of the existing csp constraints such as the related bug Bug: 747847 Change-Id: I1e57b50da17f65d38088205b0a3c7c49ef2ae4d8 Reviewed-on: https://chromium-review.googlesource.com/592027 Reviewed-by: Mike West <[email protected]> Commit-Queue: Andy Paicu <[email protected]> Cr-Commit-Position: refs/heads/master@{#492333}
Document* Document::ParentDocument() const { if (!frame_) return 0; Frame* parent = frame_->Tree().Parent(); if (!parent || !parent->IsLocalFrame()) return 0; return ToLocalFrame(parent)->GetDocument(); }
Document* Document::ParentDocument() const { if (!frame_) return 0; Frame* parent = frame_->Tree().Parent(); if (!parent || !parent->IsLocalFrame()) return 0; return ToLocalFrame(parent)->GetDocument(); }
C
Chrome
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 InspectorNetworkAgent::DocumentThreadableLoaderStartedLoadingForClient( unsigned long identifier, ThreadableLoaderClient* client) { if (!client) return; if (client != pending_request_) { DCHECK(!pending_request_); return; } known_request_id_map_.Set(client, identifier); String request_id = IdentifiersFactory::RequestId(identifier); resources_data_->SetResourceType(request_id, pending_request_type_); if (pending_request_type_ == InspectorPageAgent::kXHRResource) { resources_data_->SetXHRReplayData(request_id, pending_xhr_replay_data_.Get()); } ClearPendingRequestData(); }
void InspectorNetworkAgent::DocumentThreadableLoaderStartedLoadingForClient( unsigned long identifier, ThreadableLoaderClient* client) { if (!client) return; if (client != pending_request_) { DCHECK(!pending_request_); return; } known_request_id_map_.Set(client, identifier); String request_id = IdentifiersFactory::RequestId(identifier); resources_data_->SetResourceType(request_id, pending_request_type_); if (pending_request_type_ == InspectorPageAgent::kXHRResource) { resources_data_->SetXHRReplayData(request_id, pending_xhr_replay_data_.Get()); } ClearPendingRequestData(); }
C
Chrome
0
CVE-2017-7177
https://www.cvedetails.com/cve/CVE-2017-7177/
CWE-358
https://github.com/inliniac/suricata/commit/4a04f814b15762eb446a5ead4d69d021512df6f8
4a04f814b15762eb446a5ead4d69d021512df6f8
defrag - take protocol into account during re-assembly The IP protocol was not being used to match fragments with their packets allowing a carefully constructed packet with a different protocol to be matched, allowing re-assembly to complete, creating a packet that would not be re-assembled by the destination host.
static DefragTracker *DefragTrackerGetNew(Packet *p) { DefragTracker *dt = NULL; /* get a tracker from the spare queue */ dt = DefragTrackerDequeue(&defragtracker_spare_q); if (dt == NULL) { /* If we reached the max memcap, we get a used tracker */ if (!(DEFRAG_CHECK_MEMCAP(sizeof(DefragTracker)))) { /* declare state of emergency */ /* under high load, waking up the flow mgr each time leads * to high cpu usage. Flows are not timed out much faster if * we check a 1000 times a second. */ dt = DefragTrackerGetUsedDefragTracker(); if (dt == NULL) { return NULL; } /* freed a tracker, but it's unlocked */ } else { /* now see if we can alloc a new tracker */ dt = DefragTrackerAlloc(); if (dt == NULL) { return NULL; } /* tracker is initialized but *unlocked* */ } } else { /* tracker has been recycled before it went into the spare queue */ /* tracker is initialized (recylced) but *unlocked* */ } (void) SC_ATOMIC_ADD(defragtracker_counter, 1); SCMutexLock(&dt->lock); return dt; }
static DefragTracker *DefragTrackerGetNew(Packet *p) { DefragTracker *dt = NULL; /* get a tracker from the spare queue */ dt = DefragTrackerDequeue(&defragtracker_spare_q); if (dt == NULL) { /* If we reached the max memcap, we get a used tracker */ if (!(DEFRAG_CHECK_MEMCAP(sizeof(DefragTracker)))) { /* declare state of emergency */ /* under high load, waking up the flow mgr each time leads * to high cpu usage. Flows are not timed out much faster if * we check a 1000 times a second. */ dt = DefragTrackerGetUsedDefragTracker(); if (dt == NULL) { return NULL; } /* freed a tracker, but it's unlocked */ } else { /* now see if we can alloc a new tracker */ dt = DefragTrackerAlloc(); if (dt == NULL) { return NULL; } /* tracker is initialized but *unlocked* */ } } else { /* tracker has been recycled before it went into the spare queue */ /* tracker is initialized (recylced) but *unlocked* */ } (void) SC_ATOMIC_ADD(defragtracker_counter, 1); SCMutexLock(&dt->lock); return dt; }
C
suricata
0
CVE-2016-5768
https://www.cvedetails.com/cve/CVE-2016-5768/
CWE-415
https://github.com/php/php-src/commit/5b597a2e5b28e2d5a52fc1be13f425f08f47cb62?w=1
5b597a2e5b28e2d5a52fc1be13f425f08f47cb62?w=1
Fix bug #72402: _php_mb_regex_ereg_replace_exec - double free
PHP_FUNCTION(mb_ereg_search_regs) { _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2); }
PHP_FUNCTION(mb_ereg_search_regs) { _php_mb_regex_ereg_search_exec(INTERNAL_FUNCTION_PARAM_PASSTHRU, 2); }
C
php-src
0
CVE-2016-1620
https://www.cvedetails.com/cve/CVE-2016-1620/
null
https://github.com/chromium/chromium/commit/b90c7c8c335a2e2a4abdd7bde17a44f92c8b3a54
b90c7c8c335a2e2a4abdd7bde17a44f92c8b3a54
Fix GPU process fallback logic. 1. In GpuProcessHost::OnProcessCrashed() record the process crash first. This means the GPU mode fallback will happen before a new GPU process is started. 2. Don't call FallBackToNextGpuMode() if GPU process initialization fails for an unsandboxed GPU process. The unsandboxed GPU is only used for collect information and it's failure doesn't indicate a need to change GPU modes. Bug: 869419 Change-Id: I8bd0a03268f0ea8809f3df8458d4e6a92db9391f Reviewed-on: https://chromium-review.googlesource.com/1157164 Reviewed-by: Zhenyao Mo <[email protected]> Commit-Queue: kylechar <[email protected]> Cr-Commit-Position: refs/heads/master@{#579625}
void BindDiscardableMemoryRequestOnIO( discardable_memory::mojom::DiscardableSharedMemoryManagerRequest request, discardable_memory::DiscardableSharedMemoryManager* manager) { DCHECK_CURRENTLY_ON(BrowserThread::IO); service_manager::BindSourceInfo source_info; manager->Bind(std::move(request), source_info); }
void BindDiscardableMemoryRequestOnIO( discardable_memory::mojom::DiscardableSharedMemoryManagerRequest request, discardable_memory::DiscardableSharedMemoryManager* manager) { DCHECK_CURRENTLY_ON(BrowserThread::IO); service_manager::BindSourceInfo source_info; manager->Bind(std::move(request), source_info); }
C
Chrome
0
CVE-2018-7186
https://www.cvedetails.com/cve/CVE-2018-7186/
CWE-119
https://github.com/DanBloomberg/leptonica/commit/ee301cb2029db8a6289c5295daa42bba7715e99a
ee301cb2029db8a6289c5295daa42bba7715e99a
Security fixes: expect final changes for release 1.75.3. * Fixed a debian security issue with fscanf() reading a string with possible buffer overflow. * There were also a few similar situations with sscanf().
selGetName(SEL *sel) { PROCNAME("selGetName"); if (!sel) return (char *)ERROR_PTR("sel not defined", procName, NULL); return sel->name; }
selGetName(SEL *sel) { PROCNAME("selGetName"); if (!sel) return (char *)ERROR_PTR("sel not defined", procName, NULL); return sel->name; }
C
leptonica
0
CVE-2016-1641
https://www.cvedetails.com/cve/CVE-2016-1641/
null
https://github.com/chromium/chromium/commit/75ca8ffd7bd7c58ace1144df05e1307d8d707662
75ca8ffd7bd7c58ace1144df05e1307d8d707662
Don't call WebContents::DownloadImage() callback if the WebContents were deleted BUG=583718 Review URL: https://codereview.chromium.org/1685343004 Cr-Commit-Position: refs/heads/master@{#375700}
WebContentsImpl* WebContentsImpl::GetOpener() const { FrameTreeNode* opener_ftn = frame_tree_.root()->opener(); return opener_ftn ? FromFrameTreeNode(opener_ftn) : nullptr; }
WebContentsImpl* WebContentsImpl::GetOpener() const { FrameTreeNode* opener_ftn = frame_tree_.root()->opener(); return opener_ftn ? FromFrameTreeNode(opener_ftn) : nullptr; }
C
Chrome
0
CVE-2015-1573
https://www.cvedetails.com/cve/CVE-2015-1573/
CWE-19
https://github.com/torvalds/linux/commit/a2f18db0c68fec96631c10cad9384c196e9008ac
a2f18db0c68fec96631c10cad9384c196e9008ac
netfilter: nf_tables: fix flush ruleset chain dependencies Jumping between chains doesn't mix well with flush ruleset. Rules from a different chain and set elements may still refer to us. [ 353.373791] ------------[ cut here ]------------ [ 353.373845] kernel BUG at net/netfilter/nf_tables_api.c:1159! [ 353.373896] invalid opcode: 0000 [#1] SMP [ 353.373942] Modules linked in: intel_powerclamp uas iwldvm iwlwifi [ 353.374017] CPU: 0 PID: 6445 Comm: 31c3.nft Not tainted 3.18.0 #98 [ 353.374069] Hardware name: LENOVO 5129CTO/5129CTO, BIOS 6QET47WW (1.17 ) 07/14/2010 [...] [ 353.375018] Call Trace: [ 353.375046] [<ffffffff81964c31>] ? nf_tables_commit+0x381/0x540 [ 353.375101] [<ffffffff81949118>] nfnetlink_rcv+0x3d8/0x4b0 [ 353.375150] [<ffffffff81943fc5>] netlink_unicast+0x105/0x1a0 [ 353.375200] [<ffffffff8194438e>] netlink_sendmsg+0x32e/0x790 [ 353.375253] [<ffffffff818f398e>] sock_sendmsg+0x8e/0xc0 [ 353.375300] [<ffffffff818f36b9>] ? move_addr_to_kernel.part.20+0x19/0x70 [ 353.375357] [<ffffffff818f44f9>] ? move_addr_to_kernel+0x19/0x30 [ 353.375410] [<ffffffff819016d2>] ? verify_iovec+0x42/0xd0 [ 353.375459] [<ffffffff818f3e10>] ___sys_sendmsg+0x3f0/0x400 [ 353.375510] [<ffffffff810615fa>] ? native_sched_clock+0x2a/0x90 [ 353.375563] [<ffffffff81176697>] ? acct_account_cputime+0x17/0x20 [ 353.375616] [<ffffffff8110dc78>] ? account_user_time+0x88/0xa0 [ 353.375667] [<ffffffff818f4bbd>] __sys_sendmsg+0x3d/0x80 [ 353.375719] [<ffffffff81b184f4>] ? int_check_syscall_exit_work+0x34/0x3d [ 353.375776] [<ffffffff818f4c0d>] SyS_sendmsg+0xd/0x20 [ 353.375823] [<ffffffff81b1826d>] system_call_fastpath+0x16/0x1b Release objects in this order: rules -> sets -> chains -> tables, to make sure no references to chains are held anymore. Reported-by: Asbjoern Sloth Toennesen <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
static struct nft_trans *nft_trans_alloc(struct nft_ctx *ctx, int msg_type, u32 size) { struct nft_trans *trans; trans = kzalloc(sizeof(struct nft_trans) + size, GFP_KERNEL); if (trans == NULL) return NULL; trans->msg_type = msg_type; trans->ctx = *ctx; return trans; }
static struct nft_trans *nft_trans_alloc(struct nft_ctx *ctx, int msg_type, u32 size) { struct nft_trans *trans; trans = kzalloc(sizeof(struct nft_trans) + size, GFP_KERNEL); if (trans == NULL) return NULL; trans->msg_type = msg_type; trans->ctx = *ctx; return trans; }
C
linux
0
CVE-2019-11811
https://www.cvedetails.com/cve/CVE-2019-11811/
CWE-416
https://github.com/torvalds/linux/commit/401e7e88d4ef80188ffa07095ac00456f901b8c4
401e7e88d4ef80188ffa07095ac00456f901b8c4
ipmi_si: fix use-after-free of resource->name When we excute the following commands, we got oops rmmod ipmi_si cat /proc/ioports [ 1623.482380] Unable to handle kernel paging request at virtual address ffff00000901d478 [ 1623.482382] Mem abort info: [ 1623.482383] ESR = 0x96000007 [ 1623.482385] Exception class = DABT (current EL), IL = 32 bits [ 1623.482386] SET = 0, FnV = 0 [ 1623.482387] EA = 0, S1PTW = 0 [ 1623.482388] Data abort info: [ 1623.482389] ISV = 0, ISS = 0x00000007 [ 1623.482390] CM = 0, WnR = 0 [ 1623.482393] swapper pgtable: 4k pages, 48-bit VAs, pgdp = 00000000d7d94a66 [ 1623.482395] [ffff00000901d478] pgd=000000dffbfff003, pud=000000dffbffe003, pmd=0000003f5d06e003, pte=0000000000000000 [ 1623.482399] Internal error: Oops: 96000007 [#1] SMP [ 1623.487407] Modules linked in: ipmi_si(E) nls_utf8 isofs rpcrdma ib_iser ib_srpt target_core_mod ib_srp scsi_transport_srp ib_ipoib rdma_ucm ib_umad rdma_cm ib_cm dm_mirror dm_region_hash dm_log iw_cm dm_mod aes_ce_blk crypto_simd cryptd aes_ce_cipher ses ghash_ce sha2_ce enclosure sha256_arm64 sg sha1_ce hisi_sas_v2_hw hibmc_drm sbsa_gwdt hisi_sas_main ip_tables mlx5_ib ib_uverbs marvell ib_core mlx5_core ixgbe mdio hns_dsaf ipmi_devintf hns_enet_drv ipmi_msghandler hns_mdio [last unloaded: ipmi_si] [ 1623.532410] CPU: 30 PID: 11438 Comm: cat Kdump: loaded Tainted: G E 5.0.0-rc3+ #168 [ 1623.541498] Hardware name: Huawei TaiShan 2280 /BC11SPCD, BIOS 1.37 11/21/2017 [ 1623.548822] pstate: a0000005 (NzCv daif -PAN -UAO) [ 1623.553684] pc : string+0x28/0x98 [ 1623.557040] lr : vsnprintf+0x368/0x5e8 [ 1623.560837] sp : ffff000013213a80 [ 1623.564191] x29: ffff000013213a80 x28: ffff00001138abb5 [ 1623.569577] x27: ffff000013213c18 x26: ffff805f67d06049 [ 1623.574963] x25: 0000000000000000 x24: ffff00001138abb5 [ 1623.580349] x23: 0000000000000fb7 x22: ffff0000117ed000 [ 1623.585734] x21: ffff000011188fd8 x20: ffff805f67d07000 [ 1623.591119] x19: ffff805f67d06061 x18: ffffffffffffffff [ 1623.596505] x17: 0000000000000200 x16: 0000000000000000 [ 1623.601890] x15: ffff0000117ed748 x14: ffff805f67d07000 [ 1623.607276] x13: ffff805f67d0605e x12: 0000000000000000 [ 1623.612661] x11: 0000000000000000 x10: 0000000000000000 [ 1623.618046] x9 : 0000000000000000 x8 : 000000000000000f [ 1623.623432] x7 : ffff805f67d06061 x6 : fffffffffffffffe [ 1623.628817] x5 : 0000000000000012 x4 : ffff00000901d478 [ 1623.634203] x3 : ffff0a00ffffff04 x2 : ffff805f67d07000 [ 1623.639588] x1 : ffff805f67d07000 x0 : ffffffffffffffff [ 1623.644974] Process cat (pid: 11438, stack limit = 0x000000008d4cbc10) [ 1623.651592] Call trace: [ 1623.654068] string+0x28/0x98 [ 1623.657071] vsnprintf+0x368/0x5e8 [ 1623.660517] seq_vprintf+0x70/0x98 [ 1623.668009] seq_printf+0x7c/0xa0 [ 1623.675530] r_show+0xc8/0xf8 [ 1623.682558] seq_read+0x330/0x440 [ 1623.689877] proc_reg_read+0x78/0xd0 [ 1623.697346] __vfs_read+0x60/0x1a0 [ 1623.704564] vfs_read+0x94/0x150 [ 1623.711339] ksys_read+0x6c/0xd8 [ 1623.717939] __arm64_sys_read+0x24/0x30 [ 1623.725077] el0_svc_common+0x120/0x148 [ 1623.732035] el0_svc_handler+0x30/0x40 [ 1623.738757] el0_svc+0x8/0xc [ 1623.744520] Code: d1000406 aa0103e2 54000149 b4000080 (39400085) [ 1623.753441] ---[ end trace f91b6a4937de9835 ]--- [ 1623.760871] Kernel panic - not syncing: Fatal exception [ 1623.768935] SMP: stopping secondary CPUs [ 1623.775718] Kernel Offset: disabled [ 1623.781998] CPU features: 0x002,21006008 [ 1623.788777] Memory Limit: none [ 1623.798329] Starting crashdump kernel... [ 1623.805202] Bye! If io_setup is called successful in try_smi_init() but try_smi_init() goes out_err before calling ipmi_register_smi(), so ipmi_unregister_smi() will not be called while removing module. It leads to the resource that allocated in io_setup() can not be freed, but the name(DEVICE_NAME) of resource is freed while removing the module. It causes use-after-free when cat /proc/ioports. Fix this by calling io_cleanup() while try_smi_init() goes to out_err. and don't call io_cleanup() until io_setup() returns successful to avoid warning prints. Fixes: 93c303d2045b ("ipmi_si: Clean up shutdown a bit") Cc: [email protected] Reported-by: NuoHan Qiao <[email protected]> Suggested-by: Corey Minyard <[email protected]> Signed-off-by: Yang Yingliang <[email protected]> Signed-off-by: Corey Minyard <[email protected]>
static void start_getting_msg_queue(struct smi_info *smi_info) { smi_info->curr_msg->data[0] = (IPMI_NETFN_APP_REQUEST << 2); smi_info->curr_msg->data[1] = IPMI_GET_MSG_CMD; smi_info->curr_msg->data_size = 2; start_new_msg(smi_info, smi_info->curr_msg->data, smi_info->curr_msg->data_size); smi_info->si_state = SI_GETTING_MESSAGES; }
static void start_getting_msg_queue(struct smi_info *smi_info) { smi_info->curr_msg->data[0] = (IPMI_NETFN_APP_REQUEST << 2); smi_info->curr_msg->data[1] = IPMI_GET_MSG_CMD; smi_info->curr_msg->data_size = 2; start_new_msg(smi_info, smi_info->curr_msg->data, smi_info->curr_msg->data_size); smi_info->si_state = SI_GETTING_MESSAGES; }
C
linux
0
CVE-2011-0530
https://www.cvedetails.com/cve/CVE-2011-0530/
CWE-119
https://github.com/yoe/nbd/commit/3ef52043861ab16352d49af89e048ba6339d6df8
3ef52043861ab16352d49af89e048ba6339d6df8
Fix buffer size checking Yes, this means we've re-introduced CVE-2005-3534. Sigh.
void serveconnection(CLIENT *client) { if(do_run(client->server->prerun, client->exportname)) { exit(EXIT_FAILURE); } setupexport(client); if (client->server->flags & F_COPYONWRITE) { copyonwrite_prepare(client); } setmysockopt(client->net); mainloop(client); do_run(client->server->postrun, client->exportname); }
void serveconnection(CLIENT *client) { if(do_run(client->server->prerun, client->exportname)) { exit(EXIT_FAILURE); } setupexport(client); if (client->server->flags & F_COPYONWRITE) { copyonwrite_prepare(client); } setmysockopt(client->net); mainloop(client); do_run(client->server->postrun, client->exportname); }
C
nbd
0
CVE-2014-3171
https://www.cvedetails.com/cve/CVE-2014-3171/
null
https://github.com/chromium/chromium/commit/d10a8dac48d3a9467e81c62cb45208344f4542db
d10a8dac48d3a9467e81c62cb45208344f4542db
Replace further questionable HashMap::add usages in bindings BUG=390928 [email protected] Review URL: https://codereview.chromium.org/411273002 git-svn-id: svn://svn.chromium.org/blink/trunk@178823 bbb929c8-8fbe-4397-9dbb-9b2b20218538
PassRefPtrWillBeRawPtr<File> readFileIndexHelper() { if (m_version < 3) return nullptr; ASSERT(m_blobInfo); uint32_t index; if (!doReadUint32(&index) || index >= m_blobInfo->size()) return nullptr; const blink::WebBlobInfo& info = (*m_blobInfo)[index]; return File::createFromIndexedSerialization(info.filePath(), info.fileName(), info.size(), info.lastModified(), getOrCreateBlobDataHandle(info.uuid(), info.type(), info.size())); }
PassRefPtrWillBeRawPtr<File> readFileIndexHelper() { if (m_version < 3) return nullptr; ASSERT(m_blobInfo); uint32_t index; if (!doReadUint32(&index) || index >= m_blobInfo->size()) return nullptr; const blink::WebBlobInfo& info = (*m_blobInfo)[index]; return File::createFromIndexedSerialization(info.filePath(), info.fileName(), info.size(), info.lastModified(), getOrCreateBlobDataHandle(info.uuid(), info.type(), info.size())); }
C
Chrome
0
CVE-2016-10197
https://www.cvedetails.com/cve/CVE-2016-10197/
CWE-125
https://github.com/libevent/libevent/commit/ec65c42052d95d2c23d1d837136d1cf1d9ecef9e
ec65c42052d95d2c23d1d837136d1cf1d9ecef9e
evdns: fix searching empty hostnames From #332: Here follows a bug report by **Guido Vranken** via the _Tor bug bounty program_. Please credit Guido accordingly. ## Bug report The DNS code of Libevent contains this rather obvious OOB read: ```c static char * search_make_new(const struct search_state *const state, int n, const char *const base_name) { const size_t base_len = strlen(base_name); const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1; ``` If the length of ```base_name``` is 0, then line 3125 reads 1 byte before the buffer. This will trigger a crash on ASAN-protected builds. To reproduce: Build libevent with ASAN: ``` $ CFLAGS='-fomit-frame-pointer -fsanitize=address' ./configure && make -j4 ``` Put the attached ```resolv.conf``` and ```poc.c``` in the source directory and then do: ``` $ gcc -fsanitize=address -fomit-frame-pointer poc.c .libs/libevent.a $ ./a.out ================================================================= ==22201== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60060000efdf at pc 0x4429da bp 0x7ffe1ed47300 sp 0x7ffe1ed472f8 READ of size 1 at 0x60060000efdf thread T0 ``` P.S. we can add a check earlier, but since this is very uncommon, I didn't add it. Fixes: #332
evdns_base_search_clear(struct evdns_base *base) { EVDNS_LOCK(base); search_postfix_clear(base); EVDNS_UNLOCK(base); }
evdns_base_search_clear(struct evdns_base *base) { EVDNS_LOCK(base); search_postfix_clear(base); EVDNS_UNLOCK(base); }
C
libevent
0
CVE-2014-7842
https://www.cvedetails.com/cve/CVE-2014-7842/
CWE-362
https://github.com/torvalds/linux/commit/a2b9e6c1a35afcc0973acb72e591c714e78885ff
a2b9e6c1a35afcc0973acb72e591c714e78885ff
KVM: x86: Don't report guest userspace emulation error to userspace Commit fc3a9157d314 ("KVM: X86: Don't report L2 emulation failures to user-space") disabled the reporting of L2 (nested guest) emulation failures to userspace due to race-condition between a vmexit and the instruction emulator. The same rational applies also to userspace applications that are permitted by the guest OS to access MMIO area or perform PIO. This patch extends the current behavior - of injecting a #UD instead of reporting it to userspace - also for guest userspace code. Signed-off-by: Nadav Amit <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
static void kvm_update_dr6(struct kvm_vcpu *vcpu) { if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP)) kvm_x86_ops->set_dr6(vcpu, vcpu->arch.dr6); }
static void kvm_update_dr6(struct kvm_vcpu *vcpu) { if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP)) kvm_x86_ops->set_dr6(vcpu, vcpu->arch.dr6); }
C
linux
0
CVE-2015-0288
https://www.cvedetails.com/cve/CVE-2015-0288/
null
https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=28a00bcd8e318da18031b2ac8778c64147cd54f9
28a00bcd8e318da18031b2ac8778c64147cd54f9
null
int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos) { return X509at_get_attr_by_NID(req->req_info->attributes, nid, lastpos); }
int X509_REQ_get_attr_by_NID(const X509_REQ *req, int nid, int lastpos) { return X509at_get_attr_by_NID(req->req_info->attributes, nid, lastpos); }
C
openssl
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}
Response EmulationHandler::SetGeolocationOverride( Maybe<double> latitude, Maybe<double> longitude, Maybe<double> accuracy) { if (!GetWebContents()) return Response::InternalError(); auto* geolocation_context = GetWebContents()->GetGeolocationContext(); auto geoposition = device::mojom::Geoposition::New(); if (latitude.isJust() && longitude.isJust() && accuracy.isJust()) { geoposition->latitude = latitude.fromJust(); geoposition->longitude = longitude.fromJust(); geoposition->accuracy = accuracy.fromJust(); geoposition->timestamp = base::Time::Now(); if (!device::ValidateGeoposition(*geoposition)) return Response::Error("Invalid geolocation"); } else { geoposition->error_code = device::mojom::Geoposition::ErrorCode::POSITION_UNAVAILABLE; } geolocation_context->SetOverride(std::move(geoposition)); return Response::OK(); }
Response EmulationHandler::SetGeolocationOverride( Maybe<double> latitude, Maybe<double> longitude, Maybe<double> accuracy) { if (!GetWebContents()) return Response::InternalError(); auto* geolocation_context = GetWebContents()->GetGeolocationContext(); auto geoposition = device::mojom::Geoposition::New(); if (latitude.isJust() && longitude.isJust() && accuracy.isJust()) { geoposition->latitude = latitude.fromJust(); geoposition->longitude = longitude.fromJust(); geoposition->accuracy = accuracy.fromJust(); geoposition->timestamp = base::Time::Now(); if (!device::ValidateGeoposition(*geoposition)) return Response::Error("Invalid geolocation"); } else { geoposition->error_code = device::mojom::Geoposition::ErrorCode::POSITION_UNAVAILABLE; } geolocation_context->SetOverride(std::move(geoposition)); return Response::OK(); }
C
Chrome
0
CVE-2018-21028
https://www.cvedetails.com/cve/CVE-2018-21028/
null
https://github.com/gpg/boa/pull/1/commits/e139b87835994d007fbd64eead6c1455d7b8cf4e
e139b87835994d007fbd64eead6c1455d7b8cf4e
misc oom and possible memory leak fix
void open_logs(void) { int access_log; /* if error_log_name is set, dup2 stderr to it */ /* otherwise, leave stderr alone */ /* we don't want to tie stderr to /dev/null */ if (error_log_name) { int error_log; /* open the log file */ error_log = open_gen_fd(error_log_name); if (error_log < 0) { DIE("unable to open error log"); } /* redirect stderr to error_log */ if (dup2(error_log, STDERR_FILENO) == -1) { DIE("unable to dup2 the error log"); } close(error_log); } if (access_log_name) { access_log = open_gen_fd(access_log_name); } else { access_log = open("/dev/null", 0); } if (access_log < 0) { DIE("unable to open access log"); } if (dup2(access_log, STDOUT_FILENO) == -1) { DIE("can't dup2 /dev/null to STDOUT_FILENO"); } if (fcntl(access_log, F_SETFD, 1) == -1) { DIE("unable to set close-on-exec flag for access_log"); } close(access_log); if (cgi_log_name) { cgi_log_fd = open_gen_fd(cgi_log_name); if (cgi_log_fd == -1) { WARN("open cgi_log"); free(cgi_log_name); cgi_log_name = NULL; cgi_log_fd = 0; } else { if (fcntl(cgi_log_fd, F_SETFD, 1) == -1) { WARN("unable to set close-on-exec flag for cgi_log"); free(cgi_log_name); cgi_log_name = NULL; close(cgi_log_fd); cgi_log_fd = 0; } } } #ifdef SETVBUF_REVERSED setvbuf(stderr, _IONBF, (char *) NULL, 0); setvbuf(stdout, _IOLBF, (char *) NULL, 0); #else setvbuf(stderr, (char *) NULL, _IONBF, 0); setvbuf(stdout, (char *) NULL, _IOLBF, 0); #endif }
void open_logs(void) { int access_log; /* if error_log_name is set, dup2 stderr to it */ /* otherwise, leave stderr alone */ /* we don't want to tie stderr to /dev/null */ if (error_log_name) { int error_log; /* open the log file */ error_log = open_gen_fd(error_log_name); if (error_log < 0) { DIE("unable to open error log"); } /* redirect stderr to error_log */ if (dup2(error_log, STDERR_FILENO) == -1) { DIE("unable to dup2 the error log"); } close(error_log); } if (access_log_name) { access_log = open_gen_fd(access_log_name); } else { access_log = open("/dev/null", 0); } if (access_log < 0) { DIE("unable to open access log"); } if (dup2(access_log, STDOUT_FILENO) == -1) { DIE("can't dup2 /dev/null to STDOUT_FILENO"); } if (fcntl(access_log, F_SETFD, 1) == -1) { DIE("unable to set close-on-exec flag for access_log"); } close(access_log); if (cgi_log_name) { cgi_log_fd = open_gen_fd(cgi_log_name); if (cgi_log_fd == -1) { WARN("open cgi_log"); free(cgi_log_name); cgi_log_name = NULL; cgi_log_fd = 0; } else { if (fcntl(cgi_log_fd, F_SETFD, 1) == -1) { WARN("unable to set close-on-exec flag for cgi_log"); free(cgi_log_name); cgi_log_name = NULL; close(cgi_log_fd); cgi_log_fd = 0; } } } #ifdef SETVBUF_REVERSED setvbuf(stderr, _IONBF, (char *) NULL, 0); setvbuf(stdout, _IOLBF, (char *) NULL, 0); #else setvbuf(stderr, (char *) NULL, _IONBF, 0); setvbuf(stdout, (char *) NULL, _IOLBF, 0); #endif }
C
boa
0
CVE-2015-8631
https://www.cvedetails.com/cve/CVE-2015-8631/
CWE-119
https://github.com/krb5/krb5/commit/83ed75feba32e46f736fcce0d96a0445f29b96c2
83ed75feba32e46f736fcce0d96a0445f29b96c2
Fix leaks in kadmin server stubs [CVE-2015-8631] In each kadmind server stub, initialize the client_name and server_name variables, and release them in the cleanup handler. Many of the stubs will otherwise leak the client and server name if krb5_unparse_name() fails. Also make sure to free the prime_arg variables in rename_principal_2_svc(), or we can leak the first one if unparsing the second one fails. Discovered by Simo Sorce. CVE-2015-8631: In all versions of MIT krb5, an authenticated attacker can cause kadmind to leak memory by supplying a null principal name in a request which uses one. Repeating these requests will eventually cause kadmind to exhaust all available memory. CVSSv2 Vector: AV:N/AC:L/Au:S/C:N/I:N/A:C/E:POC/RL:OF/RC:C ticket: 8343 (new) target_version: 1.14-next target_version: 1.13-next tags: pullup
get_princs_2_svc(gprincs_arg *arg, struct svc_req *rqstp) { static gprincs_ret ret; char *prime_arg; gss_buffer_desc client_name = GSS_C_EMPTY_BUFFER; gss_buffer_desc service_name = GSS_C_EMPTY_BUFFER; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; xdr_free(xdr_gprincs_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } prime_arg = arg->exp; if (prime_arg == NULL) prime_arg = "*"; if (CHANGEPW_SERVICE(rqstp) || !kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_LIST, NULL, NULL)) { ret.code = KADM5_AUTH_LIST; log_unauth("kadm5_get_principals", prime_arg, &client_name, &service_name, rqstp); } else { ret.code = kadm5_get_principals((void *)handle, arg->exp, &ret.princs, &ret.count); if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done("kadm5_get_principals", prime_arg, errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } exit_func: gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); free_server_handle(handle); return &ret; }
get_princs_2_svc(gprincs_arg *arg, struct svc_req *rqstp) { static gprincs_ret ret; char *prime_arg; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; xdr_free(xdr_gprincs_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } prime_arg = arg->exp; if (prime_arg == NULL) prime_arg = "*"; if (CHANGEPW_SERVICE(rqstp) || !kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_LIST, NULL, NULL)) { ret.code = KADM5_AUTH_LIST; log_unauth("kadm5_get_principals", prime_arg, &client_name, &service_name, rqstp); } else { ret.code = kadm5_get_principals((void *)handle, arg->exp, &ret.princs, &ret.count); if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done("kadm5_get_principals", prime_arg, errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; }
C
krb5
1
CVE-2011-4112
https://www.cvedetails.com/cve/CVE-2011-4112/
CWE-264
https://github.com/torvalds/linux/commit/550fd08c2cebad61c548def135f67aba284c6162
550fd08c2cebad61c548def135f67aba284c6162
net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared After the last patch, We are left in a state in which only drivers calling ether_setup have IFF_TX_SKB_SHARING set (we assume that drivers touching real hardware call ether_setup for their net_devices and don't hold any state in their skbs. There are a handful of drivers that violate this assumption of course, and need to be fixed up. This patch identifies those drivers, and marks them as not being able to support the safe transmission of skbs by clearning the IFF_TX_SKB_SHARING flag in priv_flags Signed-off-by: Neil Horman <[email protected]> CC: Karsten Keil <[email protected]> CC: "David S. Miller" <[email protected]> CC: Jay Vosburgh <[email protected]> CC: Andy Gospodarek <[email protected]> CC: Patrick McHardy <[email protected]> CC: Krzysztof Halasa <[email protected]> CC: "John W. Linville" <[email protected]> CC: Greg Kroah-Hartman <[email protected]> CC: Marcel Holtmann <[email protected]> CC: Johannes Berg <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void try_auto_wep(struct airo_info *ai) { if (auto_wep && !(ai->flags & FLAG_RADIO_DOWN)) { ai->expires = RUN_AT(3*HZ); wake_up_interruptible(&ai->thr_wait); } }
static void try_auto_wep(struct airo_info *ai) { if (auto_wep && !(ai->flags & FLAG_RADIO_DOWN)) { ai->expires = RUN_AT(3*HZ); wake_up_interruptible(&ai->thr_wait); } }
C
linux
0
CVE-2017-2584
https://www.cvedetails.com/cve/CVE-2017-2584/
CWE-416
https://github.com/torvalds/linux/commit/129a72a0d3c8e139a04512325384fe5ac119e74d
129a72a0d3c8e139a04512325384fe5ac119e74d
KVM: x86: Introduce segmented_write_std Introduces segemented_write_std. Switches from emulated reads/writes to standard read/writes in fxsave, fxrstor, sgdt, and sidt. This fixes CVE-2017-2584, a longstanding kernel memory leak. Since commit 283c95d0e389 ("KVM: x86: emulate FXSAVE and FXRSTOR", 2016-11-09), which is luckily not yet in any final release, this would also be an exploitable kernel memory *write*! Reported-by: Dmitry Vyukov <[email protected]> Cc: [email protected] Fixes: 96051572c819194c37a8367624b285be10297eca Fixes: 283c95d0e3891b64087706b344a4b545d04a6e62 Suggested-by: Paolo Bonzini <[email protected]> Signed-off-by: Steve Rutherford <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
static __always_inline int __linearize(struct x86_emulate_ctxt *ctxt, struct segmented_address addr, unsigned *max_size, unsigned size, bool write, bool fetch, enum x86emul_mode mode, ulong *linear) { struct desc_struct desc; bool usable; ulong la; u32 lim; u16 sel; la = seg_base(ctxt, addr.seg) + addr.ea; *max_size = 0; switch (mode) { case X86EMUL_MODE_PROT64: *linear = la; if (is_noncanonical_address(la)) goto bad; *max_size = min_t(u64, ~0u, (1ull << 48) - la); if (size > *max_size) goto bad; break; default: *linear = la = (u32)la; usable = ctxt->ops->get_segment(ctxt, &sel, &desc, NULL, addr.seg); if (!usable) goto bad; /* code segment in protected mode or read-only data segment */ if ((((ctxt->mode != X86EMUL_MODE_REAL) && (desc.type & 8)) || !(desc.type & 2)) && write) goto bad; /* unreadable code segment */ if (!fetch && (desc.type & 8) && !(desc.type & 2)) goto bad; lim = desc_limit_scaled(&desc); if (!(desc.type & 8) && (desc.type & 4)) { /* expand-down segment */ if (addr.ea <= lim) goto bad; lim = desc.d ? 0xffffffff : 0xffff; } if (addr.ea > lim) goto bad; if (lim == 0xffffffff) *max_size = ~0u; else { *max_size = (u64)lim + 1 - addr.ea; if (size > *max_size) goto bad; } break; } if (la & (insn_alignment(ctxt, size) - 1)) return emulate_gp(ctxt, 0); return X86EMUL_CONTINUE; bad: if (addr.seg == VCPU_SREG_SS) return emulate_ss(ctxt, 0); else return emulate_gp(ctxt, 0); }
static __always_inline int __linearize(struct x86_emulate_ctxt *ctxt, struct segmented_address addr, unsigned *max_size, unsigned size, bool write, bool fetch, enum x86emul_mode mode, ulong *linear) { struct desc_struct desc; bool usable; ulong la; u32 lim; u16 sel; la = seg_base(ctxt, addr.seg) + addr.ea; *max_size = 0; switch (mode) { case X86EMUL_MODE_PROT64: *linear = la; if (is_noncanonical_address(la)) goto bad; *max_size = min_t(u64, ~0u, (1ull << 48) - la); if (size > *max_size) goto bad; break; default: *linear = la = (u32)la; usable = ctxt->ops->get_segment(ctxt, &sel, &desc, NULL, addr.seg); if (!usable) goto bad; /* code segment in protected mode or read-only data segment */ if ((((ctxt->mode != X86EMUL_MODE_REAL) && (desc.type & 8)) || !(desc.type & 2)) && write) goto bad; /* unreadable code segment */ if (!fetch && (desc.type & 8) && !(desc.type & 2)) goto bad; lim = desc_limit_scaled(&desc); if (!(desc.type & 8) && (desc.type & 4)) { /* expand-down segment */ if (addr.ea <= lim) goto bad; lim = desc.d ? 0xffffffff : 0xffff; } if (addr.ea > lim) goto bad; if (lim == 0xffffffff) *max_size = ~0u; else { *max_size = (u64)lim + 1 - addr.ea; if (size > *max_size) goto bad; } break; } if (la & (insn_alignment(ctxt, size) - 1)) return emulate_gp(ctxt, 0); return X86EMUL_CONTINUE; bad: if (addr.seg == VCPU_SREG_SS) return emulate_ss(ctxt, 0); else return emulate_gp(ctxt, 0); }
C
linux
0
CVE-2017-13011
https://www.cvedetails.com/cve/CVE-2017-13011/
CWE-119
https://github.com/the-tcpdump-group/tcpdump/commit/9f0730bee3eb65d07b49fd468bc2f269173352fe
9f0730bee3eb65d07b49fd468bc2f269173352fe
CVE-2017-13011/Properly check for buffer overflow in bittok2str_internal(). Also, make the buffer bigger. This fixes a buffer overflow discovered by Bhargava Shastry, SecT/TU Berlin. Add a test using the capture file supplied by the reporter(s), modified so the capture file won't be rejected as an invalid capture.
bittok2str(register const struct tok *lp, register const char *fmt, register u_int v) { return (bittok2str_internal(lp, fmt, v, ", ")); }
bittok2str(register const struct tok *lp, register const char *fmt, register u_int v) { return (bittok2str_internal(lp, fmt, v, ", ")); }
C
tcpdump
0
CVE-2016-10196
https://www.cvedetails.com/cve/CVE-2016-10196/
CWE-119
https://github.com/libevent/libevent/commit/329acc18a0768c21ba22522f01a5c7f46cacc4d5
329acc18a0768c21ba22522f01a5c7f46cacc4d5
evutil_parse_sockaddr_port(): fix buffer overflow @asn-the-goblin-slayer: "Length between '[' and ']' is cast to signed 32 bit integer on line 1815. Is the length is more than 2<<31 (INT_MAX), len will hold a negative value. Consequently, it will pass the check at line 1816. Segfault happens at line 1819. Generate a resolv.conf with generate-resolv.conf, then compile and run poc.c. See entry-functions.txt for functions in tor that might be vulnerable. Please credit 'Guido Vranken' for this discovery through the Tor bug bounty program." Reproducer for gdb (https://gist.github.com/azat/be2b0d5e9417ba0dfe2c): start p (1ULL<<31)+1ULL # $1 = 2147483649 p malloc(sizeof(struct sockaddr)) # $2 = (void *) 0x646010 p malloc(sizeof(int)) # $3 = (void *) 0x646030 p malloc($1) # $4 = (void *) 0x7fff76a2a010 p memset($4, 1, $1) # $5 = 1990369296 p (char *)$4 # $6 = 0x7fff76a2a010 '\001' <repeats 200 times>... set $6[0]='[' set $6[$1]=']' p evutil_parse_sockaddr_port($4, $2, $3) # $7 = -1 Before: $ gdb bin/http-connect < gdb (gdb) $1 = 2147483649 (gdb) (gdb) $2 = (void *) 0x646010 (gdb) (gdb) $3 = (void *) 0x646030 (gdb) (gdb) $4 = (void *) 0x7fff76a2a010 (gdb) (gdb) $5 = 1990369296 (gdb) (gdb) $6 = 0x7fff76a2a010 '\001' <repeats 200 times>... (gdb) (gdb) (gdb) (gdb) Program received signal SIGSEGV, Segmentation fault. __memcpy_sse2_unaligned () at memcpy-sse2-unaligned.S:36 After: $ gdb bin/http-connect < gdb (gdb) $1 = 2147483649 (gdb) (gdb) $2 = (void *) 0x646010 (gdb) (gdb) $3 = (void *) 0x646030 (gdb) (gdb) $4 = (void *) 0x7fff76a2a010 (gdb) (gdb) $5 = 1990369296 (gdb) (gdb) $6 = 0x7fff76a2a010 '\001' <repeats 200 times>... (gdb) (gdb) (gdb) (gdb) $7 = -1 (gdb) (gdb) quit Fixes: #318
eq_cached_sock_errs(const struct cached_sock_errs_entry *a, const struct cached_sock_errs_entry *b) { return a->code == b->code; }
eq_cached_sock_errs(const struct cached_sock_errs_entry *a, const struct cached_sock_errs_entry *b) { return a->code == b->code; }
C
libevent
0
CVE-2014-7904
https://www.cvedetails.com/cve/CVE-2014-7904/
CWE-119
https://github.com/chromium/chromium/commit/9965adea952e84c925de418e971b204dfda7d6e0
9965adea952e84c925de418e971b204dfda7d6e0
Replace fixed string uses of AddHeaderFromString Uses of AddHeaderFromString() with a static string may as well be replaced with SetHeader(). Do so. BUG=None Review-Url: https://codereview.chromium.org/2236933005 Cr-Commit-Position: refs/heads/master@{#418161}
void MockNetworkLayer::TransactionStopCaching() { stop_caching_called_ = true; }
void MockNetworkLayer::TransactionStopCaching() { stop_caching_called_ = true; }
C
Chrome
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}
LoadResourceTraceData(unsigned long identifier, const KURL& url, int priority) { String request_id = IdentifiersFactory::RequestId(identifier); std::unique_ptr<TracedValue> value = TracedValue::Create(); value->SetString("requestId", request_id); value->SetString("url", url.GetString()); value->SetInteger("priority", priority); return value; }
LoadResourceTraceData(unsigned long identifier, const KURL& url, int priority) { String request_id = IdentifiersFactory::RequestId(identifier); std::unique_ptr<TracedValue> value = TracedValue::Create(); value->SetString("requestId", request_id); value->SetString("url", url.GetString()); value->SetInteger("priority", priority); return value; }
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}
void APIENTRY PassthroughGLDebugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const GLvoid* user_param) { DCHECK(user_param != nullptr); GLES2DecoderPassthroughImpl* command_decoder = static_cast<GLES2DecoderPassthroughImpl*>(const_cast<void*>(user_param)); command_decoder->OnDebugMessage(source, type, id, severity, length, message); LogGLDebugMessage(source, type, id, severity, length, message, command_decoder->GetLogger()); }
void APIENTRY PassthroughGLDebugMessageCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar* message, const GLvoid* user_param) { DCHECK(user_param != nullptr); GLES2DecoderPassthroughImpl* command_decoder = static_cast<GLES2DecoderPassthroughImpl*>(const_cast<void*>(user_param)); command_decoder->OnDebugMessage(source, type, id, severity, length, message); LogGLDebugMessage(source, type, id, severity, length, message, command_decoder->GetLogger()); }
C
Chrome
0
CVE-2015-1302
https://www.cvedetails.com/cve/CVE-2015-1302/
CWE-20
https://github.com/chromium/chromium/commit/fff450abc4e2fb330ba700547a8e6a7b0fb90a6e
fff450abc4e2fb330ba700547a8e6a7b0fb90a6e
Prevent leaking PDF data cross-origin BUG=520422 Review URL: https://codereview.chromium.org/1311973002 Cr-Commit-Position: refs/heads/master@{#345267}
void OutOfProcessInstance::NavigateTo(const std::string& url, bool open_in_new_tab) { pp::VarDictionary message; message.Set(kType, kJSNavigateType); message.Set(kJSNavigateUrl, url); message.Set(kJSNavigateNewTab, open_in_new_tab); PostMessage(message); }
void OutOfProcessInstance::NavigateTo(const std::string& url, bool open_in_new_tab) { pp::VarDictionary message; message.Set(kType, kJSNavigateType); message.Set(kJSNavigateUrl, url); message.Set(kJSNavigateNewTab, open_in_new_tab); PostMessage(message); }
C
Chrome
0
CVE-2018-6091
https://www.cvedetails.com/cve/CVE-2018-6091/
null
https://github.com/chromium/chromium/commit/59ad2dcbe6dd5c5d846944258e6cd26a700ade83
59ad2dcbe6dd5c5d846944258e6cd26a700ade83
service worker: Disable interception when OBJECT/EMBED uses ImageLoader. Per the specification, service worker should not intercept requests for OBJECT/EMBED elements. R=kinuko Bug: 771933 Change-Id: Ia6da6107dc5c68aa2c2efffde14bd2c51251fbd4 Reviewed-on: https://chromium-review.googlesource.com/927303 Reviewed-by: Kinuko Yasuda <[email protected]> Commit-Queue: Matt Falkenhagen <[email protected]> Cr-Commit-Position: refs/heads/master@{#538027}
inline void ImageLoader::DispatchErrorEvent() { pending_error_event_ = PostCancellableTask( *GetElement()->GetDocument().GetTaskRunner(TaskType::kDOMManipulation), FROM_HERE, WTF::Bind(&ImageLoader::DispatchPendingErrorEvent, WrapPersistent(this), WTF::Passed(IncrementLoadEventDelayCount::Create( GetElement()->GetDocument())))); }
inline void ImageLoader::DispatchErrorEvent() { pending_error_event_ = PostCancellableTask( *GetElement()->GetDocument().GetTaskRunner(TaskType::kDOMManipulation), FROM_HERE, WTF::Bind(&ImageLoader::DispatchPendingErrorEvent, WrapPersistent(this), WTF::Passed(IncrementLoadEventDelayCount::Create( GetElement()->GetDocument())))); }
C
Chrome
0
CVE-2010-2520
https://www.cvedetails.com/cve/CVE-2010-2520/
CWE-119
https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=888cd1843e935fe675cf2ac303116d4ed5b9d54b
888cd1843e935fe675cf2ac303116d4ed5b9d54b
null
Round_Down_To_Grid( EXEC_OP_ FT_F26Dot6 distance, FT_F26Dot6 compensation ) { FT_F26Dot6 val; FT_UNUSED_EXEC; if ( distance >= 0 ) { val = distance + compensation; if ( distance && val > 0 ) val &= ~63; else val = 0; } else { val = -( ( compensation - distance ) & -64 ); if ( val > 0 ) val = 0; } return val; }
Round_Down_To_Grid( EXEC_OP_ FT_F26Dot6 distance, FT_F26Dot6 compensation ) { FT_F26Dot6 val; FT_UNUSED_EXEC; if ( distance >= 0 ) { val = distance + compensation; if ( distance && val > 0 ) val &= ~63; else val = 0; } else { val = -( ( compensation - distance ) & -64 ); if ( val > 0 ) val = 0; } return val; }
C
savannah
0
CVE-2016-3913
https://www.cvedetails.com/cve/CVE-2016-3913/
CWE-264
https://android.googlesource.com/platform/frameworks/av/+/0c3b93c8c2027e74af642967eee5c142c8fd185d
0c3b93c8c2027e74af642967eee5c142c8fd185d
MediaPlayerService: avoid invalid static cast Bug: 30204103 Change-Id: Ie0dd3568a375f1e9fed8615ad3d85184bcc99028 (cherry picked from commit ee0a0e39acdcf8f97e0d6945c31ff36a06a36e9d)
sp<IOMX> MediaPlayerService::getOMX() { ALOGI("MediaPlayerService::getOMX"); Mutex::Autolock autoLock(mLock); if (mOMX.get() == NULL) { mOMX = new OMX; } return mOMX; }
sp<IOMX> MediaPlayerService::getOMX() { ALOGI("MediaPlayerService::getOMX"); Mutex::Autolock autoLock(mLock); if (mOMX.get() == NULL) { mOMX = new OMX; } return mOMX; }
C
Android
0
CVE-2016-6309
https://www.cvedetails.com/cve/CVE-2016-6309/
CWE-416
https://git.openssl.org/?p=openssl.git;a=commit;h=acacbfa7565c78d2273c0b2a2e5e803f44afefeb
acacbfa7565c78d2273c0b2a2e5e803f44afefeb
null
void ossl_statem_set_hello_verify_done(SSL *s) { s->statem.state = MSG_FLOW_UNINITED; s->statem.in_init = 1; /* * This will get reset (briefly) back to TLS_ST_BEFORE when we enter * state_machine() because |state| is MSG_FLOW_UNINITED, but until then any * calls to SSL_in_before() will return false. Also calls to * SSL_state_string() and SSL_state_string_long() will return something * sensible. */ s->statem.hand_state = TLS_ST_SR_CLNT_HELLO; }
void ossl_statem_set_hello_verify_done(SSL *s) { s->statem.state = MSG_FLOW_UNINITED; s->statem.in_init = 1; /* * This will get reset (briefly) back to TLS_ST_BEFORE when we enter * state_machine() because |state| is MSG_FLOW_UNINITED, but until then any * calls to SSL_in_before() will return false. Also calls to * SSL_state_string() and SSL_state_string_long() will return something * sensible. */ s->statem.hand_state = TLS_ST_SR_CLNT_HELLO; }
C
openssl
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}
void NavigationControllerImpl::RendererDidNavigateToSamePage( RenderFrameHostImpl* rfh, const FrameHostMsg_DidCommitProvisionalLoad_Params& params, NavigationHandleImpl* handle) { NavigationEntryImpl* existing_entry = GetLastCommittedEntry(); CHECK_EQ(existing_entry->site_instance(), rfh->GetSiteInstance()); DCHECK_EQ(pending_entry_->GetUniqueID(), params.nav_entry_id); existing_entry->set_unique_id(pending_entry_->GetUniqueID()); existing_entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR : PAGE_TYPE_NORMAL); if (existing_entry->update_virtual_url_with_url()) UpdateVirtualURLToURL(existing_entry, params.url); existing_entry->SetURL(params.url); existing_entry->GetSSL() = handle->ssl_status(); if (existing_entry->GetURL().SchemeIs(url::kHttpsScheme) && !rfh->GetParent() && handle->GetNetErrorCode() == net::OK) { UMA_HISTOGRAM_BOOLEAN("Navigation.SecureSchemeHasSSLStatus.SamePage", !!existing_entry->GetSSL().certificate); } existing_entry->set_extra_headers(pending_entry_->extra_headers()); existing_entry->AddOrUpdateFrameEntry( rfh->frame_tree_node(), params.item_sequence_number, params.document_sequence_number, rfh->GetSiteInstance(), nullptr, params.url, params.referrer, params.redirects, params.page_state, params.method, params.post_id); DiscardNonCommittedEntries(); }
void NavigationControllerImpl::RendererDidNavigateToSamePage( RenderFrameHostImpl* rfh, const FrameHostMsg_DidCommitProvisionalLoad_Params& params, NavigationHandleImpl* handle) { NavigationEntryImpl* existing_entry = GetLastCommittedEntry(); CHECK_EQ(existing_entry->site_instance(), rfh->GetSiteInstance()); DCHECK_EQ(pending_entry_->GetUniqueID(), params.nav_entry_id); existing_entry->set_unique_id(pending_entry_->GetUniqueID()); existing_entry->set_page_type(params.url_is_unreachable ? PAGE_TYPE_ERROR : PAGE_TYPE_NORMAL); if (existing_entry->update_virtual_url_with_url()) UpdateVirtualURLToURL(existing_entry, params.url); existing_entry->SetURL(params.url); existing_entry->GetSSL() = handle->ssl_status(); if (existing_entry->GetURL().SchemeIs(url::kHttpsScheme) && !rfh->GetParent() && handle->GetNetErrorCode() == net::OK) { UMA_HISTOGRAM_BOOLEAN("Navigation.SecureSchemeHasSSLStatus.SamePage", !!existing_entry->GetSSL().certificate); } existing_entry->set_extra_headers(pending_entry_->extra_headers()); existing_entry->AddOrUpdateFrameEntry( rfh->frame_tree_node(), params.item_sequence_number, params.document_sequence_number, rfh->GetSiteInstance(), nullptr, params.url, params.referrer, params.redirects, params.page_state, params.method, params.post_id); DiscardNonCommittedEntries(); }
C
Chrome
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 void init_sched_groups_power(int cpu, struct sched_domain *sd) { struct sched_domain *child; struct sched_group *group; long power; int weight; WARN_ON(!sd || !sd->groups); if (cpu != group_first_cpu(sd->groups)) return; sd->groups->group_weight = cpumask_weight(sched_group_cpus(sd->groups)); child = sd->child; sd->groups->cpu_power = 0; if (!child) { power = SCHED_LOAD_SCALE; weight = cpumask_weight(sched_domain_span(sd)); /* * SMT siblings share the power of a single core. * Usually multiple threads get a better yield out of * that one core than a single thread would have, * reflect that in sd->smt_gain. */ if ((sd->flags & SD_SHARE_CPUPOWER) && weight > 1) { power *= sd->smt_gain; power /= weight; power >>= SCHED_LOAD_SHIFT; } sd->groups->cpu_power += power; return; } /* * Add cpu_power of each child group to this groups cpu_power. */ group = child->groups; do { sd->groups->cpu_power += group->cpu_power; group = group->next; } while (group != child->groups); }
static void init_sched_groups_power(int cpu, struct sched_domain *sd) { struct sched_domain *child; struct sched_group *group; long power; int weight; WARN_ON(!sd || !sd->groups); if (cpu != group_first_cpu(sd->groups)) return; sd->groups->group_weight = cpumask_weight(sched_group_cpus(sd->groups)); child = sd->child; sd->groups->cpu_power = 0; if (!child) { power = SCHED_LOAD_SCALE; weight = cpumask_weight(sched_domain_span(sd)); /* * SMT siblings share the power of a single core. * Usually multiple threads get a better yield out of * that one core than a single thread would have, * reflect that in sd->smt_gain. */ if ((sd->flags & SD_SHARE_CPUPOWER) && weight > 1) { power *= sd->smt_gain; power /= weight; power >>= SCHED_LOAD_SHIFT; } sd->groups->cpu_power += power; return; } /* * Add cpu_power of each child group to this groups cpu_power. */ group = child->groups; do { sd->groups->cpu_power += group->cpu_power; group = group->next; } while (group != child->groups); }
C
linux
0
CVE-2019-5759
https://www.cvedetails.com/cve/CVE-2019-5759/
CWE-416
https://github.com/chromium/chromium/commit/5405341d5cc268a0b2ff0678bd78ddda0892e7ea
5405341d5cc268a0b2ff0678bd78ddda0892e7ea
Fix crashes in RenderFrameImpl::OnSelectPopupMenuItem(s) ExternalPopupMenu::DidSelectItem(s) can delete the RenderFrameImpl. We need to reset external_popup_menu_ before calling it. Bug: 912211 Change-Id: Ia9a628e144464a2ebb14ab77d3a693fd5cead6fc Reviewed-on: https://chromium-review.googlesource.com/c/1381325 Commit-Queue: Kent Tamura <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Cr-Commit-Position: refs/heads/master@{#618026}
RenderFrameImpl::MakeDidCommitProvisionalLoadParams( blink::WebHistoryCommitType commit_type, ui::PageTransition transition) { WebDocumentLoader* document_loader = frame_->GetDocumentLoader(); const WebURLRequest& request = document_loader->GetRequest(); const WebURLResponse& response = document_loader->GetResponse(); InternalDocumentStateData* internal_data = InternalDocumentStateData::FromDocumentLoader( frame_->GetDocumentLoader()); NavigationState* navigation_state = internal_data->navigation_state(); std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params = std::make_unique<FrameHostMsg_DidCommitProvisionalLoad_Params>(); params->http_status_code = response.HttpStatusCode(); params->url_is_unreachable = document_loader->HasUnreachableURL(); params->method = "GET"; params->intended_as_new_entry = navigation_state->request_params().intended_as_new_entry; params->should_replace_current_entry = document_loader->ReplacesCurrentHistoryItem(); params->post_id = -1; params->nav_entry_id = navigation_state->request_params().nav_entry_id; params->render_view_routing_id = render_view_->routing_id(); params->did_create_new_entry = (commit_type == blink::kWebStandardCommit) || (commit_type == blink::kWebHistoryInertCommit && !frame_->Parent() && params->should_replace_current_entry && !navigation_state->WasWithinSameDocument()); WebDocument frame_document = frame_->GetDocument(); WebSecurityOrigin frame_origin = frame_document.GetSecurityOrigin(); params->origin = frame_origin; params->insecure_request_policy = frame_->GetInsecureRequestPolicy(); params->insecure_navigations_set = frame_->GetInsecureRequestToUpgrade(); params->has_potentially_trustworthy_unique_origin = frame_origin.IsUnique() && frame_origin.IsPotentiallyTrustworthy(); params->url = GetLoadingUrl(); if (GURL(frame_document.BaseURL()) != params->url) params->base_url = frame_document.BaseURL(); GetRedirectChain(document_loader, &params->redirects); params->should_update_history = !document_loader->HasUnreachableURL() && response.HttpStatusCode() != 404; params->gesture = document_loader->HadUserGesture() ? NavigationGestureUser : NavigationGestureAuto; params->page_state = SingleHistoryItemToPageState(current_history_item_); params->content_source_id = GetRenderWidget()->GetContentSourceId(); params->method = request.HttpMethod().Latin1(); if (params->method == "POST") params->post_id = ExtractPostId(current_history_item_); params->item_sequence_number = current_history_item_.ItemSequenceNumber(); params->document_sequence_number = current_history_item_.DocumentSequenceNumber(); if (document_loader->IsClientRedirect()) { params->referrer = Referrer(params->redirects[0], document_loader->GetRequest().GetReferrerPolicy()); } else { params->referrer = RenderViewImpl::GetReferrerFromRequest( frame_, document_loader->GetRequest()); } if (!frame_->Parent()) { params->contents_mime_type = document_loader->GetResponse().MimeType().Utf8(); params->transition = transition; DCHECK(ui::PageTransitionIsMainFrame(params->transition)); if (document_loader->IsClientRedirect()) { params->transition = ui::PageTransitionFromInt( params->transition | ui::PAGE_TRANSITION_CLIENT_REDIRECT); } params->is_overriding_user_agent = internal_data->is_overriding_user_agent(); params->original_request_url = GetOriginalRequestURL(document_loader); params->history_list_was_cleared = navigation_state->request_params().should_clear_history_list; } else { if (commit_type == blink::kWebStandardCommit) params->transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME; else params->transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; DCHECK(!navigation_state->request_params().should_clear_history_list); params->history_list_was_cleared = false; } if (!params->origin.opaque() && params->url.IsStandard() && render_view_->GetWebkitPreferences().web_security_enabled) { if (params->origin.scheme() != url::kFileScheme || !render_view_->GetWebkitPreferences() .allow_universal_access_from_file_urls) { CHECK(params->origin.IsSameOriginWith(url::Origin::Create(params->url))) << " url:" << params->url << " origin:" << params->origin; } } params->request_id = response.RequestId(); return params; }
RenderFrameImpl::MakeDidCommitProvisionalLoadParams( blink::WebHistoryCommitType commit_type, ui::PageTransition transition) { WebDocumentLoader* document_loader = frame_->GetDocumentLoader(); const WebURLRequest& request = document_loader->GetRequest(); const WebURLResponse& response = document_loader->GetResponse(); InternalDocumentStateData* internal_data = InternalDocumentStateData::FromDocumentLoader( frame_->GetDocumentLoader()); NavigationState* navigation_state = internal_data->navigation_state(); std::unique_ptr<FrameHostMsg_DidCommitProvisionalLoad_Params> params = std::make_unique<FrameHostMsg_DidCommitProvisionalLoad_Params>(); params->http_status_code = response.HttpStatusCode(); params->url_is_unreachable = document_loader->HasUnreachableURL(); params->method = "GET"; params->intended_as_new_entry = navigation_state->request_params().intended_as_new_entry; params->should_replace_current_entry = document_loader->ReplacesCurrentHistoryItem(); params->post_id = -1; params->nav_entry_id = navigation_state->request_params().nav_entry_id; params->render_view_routing_id = render_view_->routing_id(); params->did_create_new_entry = (commit_type == blink::kWebStandardCommit) || (commit_type == blink::kWebHistoryInertCommit && !frame_->Parent() && params->should_replace_current_entry && !navigation_state->WasWithinSameDocument()); WebDocument frame_document = frame_->GetDocument(); WebSecurityOrigin frame_origin = frame_document.GetSecurityOrigin(); params->origin = frame_origin; params->insecure_request_policy = frame_->GetInsecureRequestPolicy(); params->insecure_navigations_set = frame_->GetInsecureRequestToUpgrade(); params->has_potentially_trustworthy_unique_origin = frame_origin.IsUnique() && frame_origin.IsPotentiallyTrustworthy(); params->url = GetLoadingUrl(); if (GURL(frame_document.BaseURL()) != params->url) params->base_url = frame_document.BaseURL(); GetRedirectChain(document_loader, &params->redirects); params->should_update_history = !document_loader->HasUnreachableURL() && response.HttpStatusCode() != 404; params->gesture = document_loader->HadUserGesture() ? NavigationGestureUser : NavigationGestureAuto; params->page_state = SingleHistoryItemToPageState(current_history_item_); params->content_source_id = GetRenderWidget()->GetContentSourceId(); params->method = request.HttpMethod().Latin1(); if (params->method == "POST") params->post_id = ExtractPostId(current_history_item_); params->item_sequence_number = current_history_item_.ItemSequenceNumber(); params->document_sequence_number = current_history_item_.DocumentSequenceNumber(); if (document_loader->IsClientRedirect()) { params->referrer = Referrer(params->redirects[0], document_loader->GetRequest().GetReferrerPolicy()); } else { params->referrer = RenderViewImpl::GetReferrerFromRequest( frame_, document_loader->GetRequest()); } if (!frame_->Parent()) { params->contents_mime_type = document_loader->GetResponse().MimeType().Utf8(); params->transition = transition; DCHECK(ui::PageTransitionIsMainFrame(params->transition)); if (document_loader->IsClientRedirect()) { params->transition = ui::PageTransitionFromInt( params->transition | ui::PAGE_TRANSITION_CLIENT_REDIRECT); } params->is_overriding_user_agent = internal_data->is_overriding_user_agent(); params->original_request_url = GetOriginalRequestURL(document_loader); params->history_list_was_cleared = navigation_state->request_params().should_clear_history_list; } else { if (commit_type == blink::kWebStandardCommit) params->transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME; else params->transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; DCHECK(!navigation_state->request_params().should_clear_history_list); params->history_list_was_cleared = false; } if (!params->origin.opaque() && params->url.IsStandard() && render_view_->GetWebkitPreferences().web_security_enabled) { if (params->origin.scheme() != url::kFileScheme || !render_view_->GetWebkitPreferences() .allow_universal_access_from_file_urls) { CHECK(params->origin.IsSameOriginWith(url::Origin::Create(params->url))) << " url:" << params->url << " origin:" << params->origin; } } params->request_id = response.RequestId(); return params; }
C
Chrome
0
CVE-2016-10197
https://www.cvedetails.com/cve/CVE-2016-10197/
CWE-125
https://github.com/libevent/libevent/commit/ec65c42052d95d2c23d1d837136d1cf1d9ecef9e
ec65c42052d95d2c23d1d837136d1cf1d9ecef9e
evdns: fix searching empty hostnames From #332: Here follows a bug report by **Guido Vranken** via the _Tor bug bounty program_. Please credit Guido accordingly. ## Bug report The DNS code of Libevent contains this rather obvious OOB read: ```c static char * search_make_new(const struct search_state *const state, int n, const char *const base_name) { const size_t base_len = strlen(base_name); const char need_to_append_dot = base_name[base_len - 1] == '.' ? 0 : 1; ``` If the length of ```base_name``` is 0, then line 3125 reads 1 byte before the buffer. This will trigger a crash on ASAN-protected builds. To reproduce: Build libevent with ASAN: ``` $ CFLAGS='-fomit-frame-pointer -fsanitize=address' ./configure && make -j4 ``` Put the attached ```resolv.conf``` and ```poc.c``` in the source directory and then do: ``` $ gcc -fsanitize=address -fomit-frame-pointer poc.c .libs/libevent.a $ ./a.out ================================================================= ==22201== ERROR: AddressSanitizer: heap-buffer-overflow on address 0x60060000efdf at pc 0x4429da bp 0x7ffe1ed47300 sp 0x7ffe1ed472f8 READ of size 1 at 0x60060000efdf thread T0 ``` P.S. we can add a check earlier, but since this is very uncommon, I didn't add it. Fixes: #332
evdns_request_transmit_to(struct request *req, struct nameserver *server) { int r; ASSERT_LOCKED(req->base); ASSERT_VALID_REQUEST(req); if (server->requests_inflight == 1 && req->base->disable_when_inactive && event_add(&server->event, NULL) < 0) { return 1; } r = sendto(server->socket, (void*)req->request, req->request_len, 0, (struct sockaddr *)&server->address, server->addrlen); if (r < 0) { int err = evutil_socket_geterror(server->socket); if (EVUTIL_ERR_RW_RETRIABLE(err)) return 1; nameserver_failed(req->ns, evutil_socket_error_to_string(err)); return 2; } else if (r != (int)req->request_len) { return 1; /* short write */ } else { return 0; } }
evdns_request_transmit_to(struct request *req, struct nameserver *server) { int r; ASSERT_LOCKED(req->base); ASSERT_VALID_REQUEST(req); if (server->requests_inflight == 1 && req->base->disable_when_inactive && event_add(&server->event, NULL) < 0) { return 1; } r = sendto(server->socket, (void*)req->request, req->request_len, 0, (struct sockaddr *)&server->address, server->addrlen); if (r < 0) { int err = evutil_socket_geterror(server->socket); if (EVUTIL_ERR_RW_RETRIABLE(err)) return 1; nameserver_failed(req->ns, evutil_socket_error_to_string(err)); return 2; } else if (r != (int)req->request_len) { return 1; /* short write */ } else { return 0; } }
C
libevent
0
CVE-2016-9794
https://www.cvedetails.com/cve/CVE-2016-9794/
CWE-416
https://github.com/torvalds/linux/commit/3aa02cb664c5fb1042958c8d1aa8c35055a2ebc4
3aa02cb664c5fb1042958c8d1aa8c35055a2ebc4
ALSA: pcm : Call kill_fasync() in stream lock Currently kill_fasync() is called outside the stream lock in snd_pcm_period_elapsed(). This is potentially racy, since the stream may get released even during the irq handler is running. Although snd_pcm_release_substream() calls snd_pcm_drop(), this doesn't guarantee that the irq handler finishes, thus the kill_fasync() call outside the stream spin lock may be invoked after the substream is detached, as recently reported by KASAN. As a quick workaround, move kill_fasync() call inside the stream lock. The fasync is rarely used interface, so this shouldn't have a big impact from the performance POV. Ideally, we should implement some sync mechanism for the proper finish of stream and irq handler. But this oneliner should suffice for most cases, so far. Reported-by: Baozeng Ding <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
static int snd_pcm_hw_rule_step(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) { unsigned long step = (unsigned long) rule->private; return snd_interval_step(hw_param_interval(params, rule->var), step); }
static int snd_pcm_hw_rule_step(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) { unsigned long step = (unsigned long) rule->private; return snd_interval_step(hw_param_interval(params, rule->var), step); }
C
linux
0
CVE-2013-6626
https://www.cvedetails.com/cve/CVE-2013-6626/
null
https://github.com/chromium/chromium/commit/90fb08ed0146c9beacfd4dde98a20fc45419fff3
90fb08ed0146c9beacfd4dde98a20fc45419fff3
Cancel JavaScript dialogs when an interstitial appears. BUG=295695 TEST=See bug for repro steps. Review URL: https://chromiumcodereview.appspot.com/24360011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225026 0039d316-1c4b-4281-b951-d872f2087c98
bool WebContentsImpl::FocusLocationBarByDefault() { NavigationEntry* entry = controller_.GetActiveEntry(); if (entry && entry->GetURL() == GURL(kAboutBlankURL)) return true; return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); }
bool WebContentsImpl::FocusLocationBarByDefault() { NavigationEntry* entry = controller_.GetActiveEntry(); if (entry && entry->GetURL() == GURL(kAboutBlankURL)) return true; return delegate_ && delegate_->ShouldFocusLocationBarByDefault(this); }
C
Chrome
0
CVE-2010-3702
https://www.cvedetails.com/cve/CVE-2010-3702/
CWE-20
https://cgit.freedesktop.org/poppler/poppler/commit/?id=e853106b58d6b4b0467dbd6436c9bb1cfbd372cf
e853106b58d6b4b0467dbd6436c9bb1cfbd372cf
null
void Gfx::doAxialShFill(GfxAxialShading *shading) { double xMin, yMin, xMax, yMax; double x0, y0, x1, y1; double dx, dy, mul; GBool dxZero, dyZero; double bboxIntersections[4]; double tMin, tMax, tx, ty; double s[4], sMin, sMax, tmp; double ux0, uy0, ux1, uy1, vx0, vy0, vx1, vy1; double t0, t1, tt; double ta[axialMaxSplits + 1]; int next[axialMaxSplits + 1]; GfxColor color0, color1; int nComps; int i, j, k; GBool needExtend = gTrue; state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax); shading->getCoords(&x0, &y0, &x1, &y1); dx = x1 - x0; dy = y1 - y0; dxZero = fabs(dx) < 0.01; dyZero = fabs(dy) < 0.01; if (dxZero && dyZero) { tMin = tMax = 0; } else { mul = 1 / (dx * dx + dy * dy); bboxIntersections[0] = ((xMin - x0) * dx + (yMin - y0) * dy) * mul; bboxIntersections[1] = ((xMin - x0) * dx + (yMax - y0) * dy) * mul; bboxIntersections[2] = ((xMax - x0) * dx + (yMin - y0) * dy) * mul; bboxIntersections[3] = ((xMax - x0) * dx + (yMax - y0) * dy) * mul; bubbleSort(bboxIntersections); tMin = bboxIntersections[0]; tMax = bboxIntersections[3]; if (tMin < 0 && !shading->getExtend0()) { tMin = 0; } if (tMax > 1 && !shading->getExtend1()) { tMax = 1; } } if (out->useShadedFills() && out->axialShadedFill(state, shading, tMin, tMax)) { return; } t0 = shading->getDomain0(); t1 = shading->getDomain1(); nComps = shading->getColorSpace()->getNComps(); ta[0] = tMin; next[0] = axialMaxSplits / 2; ta[axialMaxSplits / 2] = 0.5 * (tMin + tMax); next[axialMaxSplits / 2] = axialMaxSplits; ta[axialMaxSplits] = tMax; if (tMin < 0) { tt = t0; } else if (tMin > 1) { tt = t1; } else { tt = t0 + (t1 - t0) * tMin; } shading->getColor(tt, &color0); if (out->useFillColorStop()) { state->setFillColor(&color0); out->updateFillColorStop(state, 0); } tx = x0 + tMin * dx; ty = y0 + tMin * dy; if (dxZero && dyZero) { sMin = sMax = 0; } else if (dxZero) { sMin = (xMin - tx) / -dy; sMax = (xMax - tx) / -dy; if (sMin > sMax) { tmp = sMin; sMin = sMax; sMax = tmp; } } else if (dyZero) { sMin = (yMin - ty) / dx; sMax = (yMax - ty) / dx; if (sMin > sMax) { tmp = sMin; sMin = sMax; sMax = tmp; } } else { s[0] = (yMin - ty) / dx; s[1] = (yMax - ty) / dx; s[2] = (xMin - tx) / -dy; s[3] = (xMax - tx) / -dy; bubbleSort(s); sMin = s[1]; sMax = s[2]; } ux0 = tx - sMin * dy; uy0 = ty + sMin * dx; vx0 = tx - sMax * dy; vy0 = ty + sMax * dx; i = 0; bool doneBBox1, doneBBox2; if (dxZero && dyZero) { doneBBox1 = doneBBox2 = true; } else { doneBBox1 = bboxIntersections[1] < tMin; doneBBox2 = bboxIntersections[2] > tMax; } needExtend = !out->axialShadedSupportExtend(state, shading); while (i < axialMaxSplits) { j = next[i]; while (j > i + 1) { if (ta[j] < 0) { tt = t0; } else if (ta[j] > 1) { tt = t1; } else { tt = t0 + (t1 - t0) * ta[j]; } shading->getColor(tt, &color1); if (isSameGfxColor(color1, color0, nComps, axialColorDelta)) { if (!doneBBox1 && ta[i] < bboxIntersections[1] && ta[j] > bboxIntersections[1]) { int teoricalj = (int) ((bboxIntersections[1] - tMin) * axialMaxSplits / (tMax - tMin)); if (teoricalj <= i) teoricalj = i + 1; if (teoricalj < j) { next[i] = teoricalj; next[teoricalj] = j; } else { teoricalj = j; } ta[teoricalj] = bboxIntersections[1]; j = teoricalj; doneBBox1 = true; } if (!doneBBox2 && ta[i] < bboxIntersections[2] && ta[j] > bboxIntersections[2]) { int teoricalj = (int) ((bboxIntersections[2] - tMin) * axialMaxSplits / (tMax - tMin)); if (teoricalj <= i) teoricalj = i + 1; if (teoricalj < j) { next[i] = teoricalj; next[teoricalj] = j; } else { teoricalj = j; } ta[teoricalj] = bboxIntersections[2]; j = teoricalj; doneBBox2 = true; } break; } k = (i + j) / 2; ta[k] = 0.5 * (ta[i] + ta[j]); next[i] = k; next[k] = j; j = k; } for (k = 0; k < nComps; ++k) { color0.c[k] = (color0.c[k] + color1.c[k]) / 2; } tx = x0 + ta[j] * dx; ty = y0 + ta[j] * dy; if (dxZero && dyZero) { sMin = sMax = 0; } else if (dxZero) { sMin = (xMin - tx) / -dy; sMax = (xMax - tx) / -dy; if (sMin > sMax) { tmp = sMin; sMin = sMax; sMax = tmp; } } else if (dyZero) { sMin = (yMin - ty) / dx; sMax = (yMax - ty) / dx; if (sMin > sMax) { tmp = sMin; sMin = sMax; sMax = tmp; } } else { s[0] = (yMin - ty) / dx; s[1] = (yMax - ty) / dx; s[2] = (xMin - tx) / -dy; s[3] = (xMax - tx) / -dy; bubbleSort(s); sMin = s[1]; sMax = s[2]; } ux1 = tx - sMin * dy; uy1 = ty + sMin * dx; vx1 = tx - sMax * dy; vy1 = ty + sMax * dx; state->setFillColor(&color0); if (out->useFillColorStop()) out->updateFillColorStop(state, (ta[j] - tMin)/(tMax - tMin)); else out->updateFillColor(state); if (needExtend) { state->moveTo(ux0, uy0); state->lineTo(vx0, vy0); state->lineTo(vx1, vy1); state->lineTo(ux1, uy1); state->closePath(); } if (!out->useFillColorStop()) { if (!contentIsHidden()) out->fill(state); state->clearPath(); } ux0 = ux1; uy0 = uy1; vx0 = vx1; vy0 = vy1; color0 = color1; i = next[i]; } if (out->useFillColorStop()) { if (!needExtend) { state->moveTo(xMin, yMin); state->lineTo(xMin, yMax); state->lineTo(xMax, yMax); state->lineTo(xMax, yMin); state->closePath(); } if (!contentIsHidden()) out->fill(state); state->clearPath(); } }
void Gfx::doAxialShFill(GfxAxialShading *shading) { double xMin, yMin, xMax, yMax; double x0, y0, x1, y1; double dx, dy, mul; GBool dxZero, dyZero; double bboxIntersections[4]; double tMin, tMax, tx, ty; double s[4], sMin, sMax, tmp; double ux0, uy0, ux1, uy1, vx0, vy0, vx1, vy1; double t0, t1, tt; double ta[axialMaxSplits + 1]; int next[axialMaxSplits + 1]; GfxColor color0, color1; int nComps; int i, j, k; GBool needExtend = gTrue; state->getUserClipBBox(&xMin, &yMin, &xMax, &yMax); shading->getCoords(&x0, &y0, &x1, &y1); dx = x1 - x0; dy = y1 - y0; dxZero = fabs(dx) < 0.01; dyZero = fabs(dy) < 0.01; if (dxZero && dyZero) { tMin = tMax = 0; } else { mul = 1 / (dx * dx + dy * dy); bboxIntersections[0] = ((xMin - x0) * dx + (yMin - y0) * dy) * mul; bboxIntersections[1] = ((xMin - x0) * dx + (yMax - y0) * dy) * mul; bboxIntersections[2] = ((xMax - x0) * dx + (yMin - y0) * dy) * mul; bboxIntersections[3] = ((xMax - x0) * dx + (yMax - y0) * dy) * mul; bubbleSort(bboxIntersections); tMin = bboxIntersections[0]; tMax = bboxIntersections[3]; if (tMin < 0 && !shading->getExtend0()) { tMin = 0; } if (tMax > 1 && !shading->getExtend1()) { tMax = 1; } } if (out->useShadedFills() && out->axialShadedFill(state, shading, tMin, tMax)) { return; } t0 = shading->getDomain0(); t1 = shading->getDomain1(); nComps = shading->getColorSpace()->getNComps(); ta[0] = tMin; next[0] = axialMaxSplits / 2; ta[axialMaxSplits / 2] = 0.5 * (tMin + tMax); next[axialMaxSplits / 2] = axialMaxSplits; ta[axialMaxSplits] = tMax; if (tMin < 0) { tt = t0; } else if (tMin > 1) { tt = t1; } else { tt = t0 + (t1 - t0) * tMin; } shading->getColor(tt, &color0); if (out->useFillColorStop()) { state->setFillColor(&color0); out->updateFillColorStop(state, 0); } tx = x0 + tMin * dx; ty = y0 + tMin * dy; if (dxZero && dyZero) { sMin = sMax = 0; } else if (dxZero) { sMin = (xMin - tx) / -dy; sMax = (xMax - tx) / -dy; if (sMin > sMax) { tmp = sMin; sMin = sMax; sMax = tmp; } } else if (dyZero) { sMin = (yMin - ty) / dx; sMax = (yMax - ty) / dx; if (sMin > sMax) { tmp = sMin; sMin = sMax; sMax = tmp; } } else { s[0] = (yMin - ty) / dx; s[1] = (yMax - ty) / dx; s[2] = (xMin - tx) / -dy; s[3] = (xMax - tx) / -dy; bubbleSort(s); sMin = s[1]; sMax = s[2]; } ux0 = tx - sMin * dy; uy0 = ty + sMin * dx; vx0 = tx - sMax * dy; vy0 = ty + sMax * dx; i = 0; bool doneBBox1, doneBBox2; if (dxZero && dyZero) { doneBBox1 = doneBBox2 = true; } else { doneBBox1 = bboxIntersections[1] < tMin; doneBBox2 = bboxIntersections[2] > tMax; } needExtend = !out->axialShadedSupportExtend(state, shading); while (i < axialMaxSplits) { j = next[i]; while (j > i + 1) { if (ta[j] < 0) { tt = t0; } else if (ta[j] > 1) { tt = t1; } else { tt = t0 + (t1 - t0) * ta[j]; } shading->getColor(tt, &color1); if (isSameGfxColor(color1, color0, nComps, axialColorDelta)) { if (!doneBBox1 && ta[i] < bboxIntersections[1] && ta[j] > bboxIntersections[1]) { int teoricalj = (int) ((bboxIntersections[1] - tMin) * axialMaxSplits / (tMax - tMin)); if (teoricalj <= i) teoricalj = i + 1; if (teoricalj < j) { next[i] = teoricalj; next[teoricalj] = j; } else { teoricalj = j; } ta[teoricalj] = bboxIntersections[1]; j = teoricalj; doneBBox1 = true; } if (!doneBBox2 && ta[i] < bboxIntersections[2] && ta[j] > bboxIntersections[2]) { int teoricalj = (int) ((bboxIntersections[2] - tMin) * axialMaxSplits / (tMax - tMin)); if (teoricalj <= i) teoricalj = i + 1; if (teoricalj < j) { next[i] = teoricalj; next[teoricalj] = j; } else { teoricalj = j; } ta[teoricalj] = bboxIntersections[2]; j = teoricalj; doneBBox2 = true; } break; } k = (i + j) / 2; ta[k] = 0.5 * (ta[i] + ta[j]); next[i] = k; next[k] = j; j = k; } for (k = 0; k < nComps; ++k) { color0.c[k] = (color0.c[k] + color1.c[k]) / 2; } tx = x0 + ta[j] * dx; ty = y0 + ta[j] * dy; if (dxZero && dyZero) { sMin = sMax = 0; } else if (dxZero) { sMin = (xMin - tx) / -dy; sMax = (xMax - tx) / -dy; if (sMin > sMax) { tmp = sMin; sMin = sMax; sMax = tmp; } } else if (dyZero) { sMin = (yMin - ty) / dx; sMax = (yMax - ty) / dx; if (sMin > sMax) { tmp = sMin; sMin = sMax; sMax = tmp; } } else { s[0] = (yMin - ty) / dx; s[1] = (yMax - ty) / dx; s[2] = (xMin - tx) / -dy; s[3] = (xMax - tx) / -dy; bubbleSort(s); sMin = s[1]; sMax = s[2]; } ux1 = tx - sMin * dy; uy1 = ty + sMin * dx; vx1 = tx - sMax * dy; vy1 = ty + sMax * dx; state->setFillColor(&color0); if (out->useFillColorStop()) out->updateFillColorStop(state, (ta[j] - tMin)/(tMax - tMin)); else out->updateFillColor(state); if (needExtend) { state->moveTo(ux0, uy0); state->lineTo(vx0, vy0); state->lineTo(vx1, vy1); state->lineTo(ux1, uy1); state->closePath(); } if (!out->useFillColorStop()) { if (!contentIsHidden()) out->fill(state); state->clearPath(); } ux0 = ux1; uy0 = uy1; vx0 = vx1; vy0 = vy1; color0 = color1; i = next[i]; } if (out->useFillColorStop()) { if (!needExtend) { state->moveTo(xMin, yMin); state->lineTo(xMin, yMax); state->lineTo(xMax, yMax); state->lineTo(xMax, yMin); state->closePath(); } if (!contentIsHidden()) out->fill(state); state->clearPath(); } }
CPP
poppler
0
CVE-2017-5330
https://www.cvedetails.com/cve/CVE-2017-5330/
CWE-78
https://cgit.kde.org/ark.git/commit/?id=82fdfd24d46966a117fa625b68784735a40f9065
82fdfd24d46966a117fa625b68784735a40f9065
null
Part::~Part() { qDeleteAll(m_tmpExtractDirList); if (m_showInfoPanelAction->isChecked()) { ArkSettings::setSplitterSizes(m_splitter->sizes()); } ArkSettings::setShowInfoPanel(m_showInfoPanelAction->isChecked()); ArkSettings::self()->save(); m_extractArchiveAction->menu()->deleteLater(); m_extractAction->menu()->deleteLater(); }
Part::~Part() { qDeleteAll(m_tmpExtractDirList); if (m_showInfoPanelAction->isChecked()) { ArkSettings::setSplitterSizes(m_splitter->sizes()); } ArkSettings::setShowInfoPanel(m_showInfoPanelAction->isChecked()); ArkSettings::self()->save(); m_extractArchiveAction->menu()->deleteLater(); m_extractAction->menu()->deleteLater(); }
CPP
kde
0
CVE-2016-2429
https://www.cvedetails.com/cve/CVE-2016-2429/
CWE-119
https://android.googlesource.com/platform/external/flac/+/b499389da21d89d32deff500376c5ee4f8f0b04c
b499389da21d89d32deff500376c5ee4f8f0b04c
Avoid free-before-initialize vulnerability in heap Bug: 27211885 Change-Id: Ib9c93bd9ffdde2a5f8d31a86f06e267dc9c152db
FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void) { FLAC__StreamDecoder *decoder; unsigned i; FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ decoder = calloc(1, sizeof(FLAC__StreamDecoder)); if(decoder == 0) { return 0; } decoder->protected_ = calloc(1, sizeof(FLAC__StreamDecoderProtected)); if(decoder->protected_ == 0) { free(decoder); return 0; } decoder->private_ = calloc(1, sizeof(FLAC__StreamDecoderPrivate)); if(decoder->private_ == 0) { free(decoder->protected_); free(decoder); return 0; } decoder->private_->input = FLAC__bitreader_new(); if(decoder->private_->input == 0) { free(decoder->private_); free(decoder->protected_); free(decoder); return 0; } decoder->private_->metadata_filter_ids_capacity = 16; if(0 == (decoder->private_->metadata_filter_ids = malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) { FLAC__bitreader_delete(decoder->private_->input); free(decoder->private_); free(decoder->protected_); free(decoder); return 0; } for(i = 0; i < FLAC__MAX_CHANNELS; i++) { decoder->private_->output[i] = 0; decoder->private_->residual_unaligned[i] = decoder->private_->residual[i] = 0; } decoder->private_->output_capacity = 0; decoder->private_->output_channels = 0; decoder->private_->has_seek_table = false; for(i = 0; i < FLAC__MAX_CHANNELS; i++) FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&decoder->private_->partitioned_rice_contents[i]); decoder->private_->file = 0; set_defaults_(decoder); decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED; return decoder; }
FLAC_API FLAC__StreamDecoder *FLAC__stream_decoder_new(void) { FLAC__StreamDecoder *decoder; unsigned i; FLAC__ASSERT(sizeof(int) >= 4); /* we want to die right away if this is not true */ decoder = calloc(1, sizeof(FLAC__StreamDecoder)); if(decoder == 0) { return 0; } decoder->protected_ = calloc(1, sizeof(FLAC__StreamDecoderProtected)); if(decoder->protected_ == 0) { free(decoder); return 0; } decoder->private_ = calloc(1, sizeof(FLAC__StreamDecoderPrivate)); if(decoder->private_ == 0) { free(decoder->protected_); free(decoder); return 0; } decoder->private_->input = FLAC__bitreader_new(); if(decoder->private_->input == 0) { free(decoder->private_); free(decoder->protected_); free(decoder); return 0; } decoder->private_->metadata_filter_ids_capacity = 16; if(0 == (decoder->private_->metadata_filter_ids = malloc((FLAC__STREAM_METADATA_APPLICATION_ID_LEN/8) * decoder->private_->metadata_filter_ids_capacity))) { FLAC__bitreader_delete(decoder->private_->input); free(decoder->private_); free(decoder->protected_); free(decoder); return 0; } for(i = 0; i < FLAC__MAX_CHANNELS; i++) { decoder->private_->output[i] = 0; decoder->private_->residual_unaligned[i] = decoder->private_->residual[i] = 0; } decoder->private_->output_capacity = 0; decoder->private_->output_channels = 0; decoder->private_->has_seek_table = false; for(i = 0; i < FLAC__MAX_CHANNELS; i++) FLAC__format_entropy_coding_method_partitioned_rice_contents_init(&decoder->private_->partitioned_rice_contents[i]); decoder->private_->file = 0; set_defaults_(decoder); decoder->protected_->state = FLAC__STREAM_DECODER_UNINITIALIZED; return decoder; }
C
Android
0
CVE-2015-0228
https://www.cvedetails.com/cve/CVE-2015-0228/
CWE-20
https://github.com/apache/httpd/commit/643f0fcf3b8ab09a68f0ecd2aa37aafeda3e63ef
643f0fcf3b8ab09a68f0ecd2aa37aafeda3e63ef
*) SECURITY: CVE-2015-0228 (cve.mitre.org) mod_lua: A maliciously crafted websockets PING after a script calls r:wsupgrade() can cause a child process crash. [Edward Lu <Chaosed0 gmail.com>] Discovered by Guido Vranken <guidovranken gmail.com> Submitted by: Edward Lu Committed by: covener git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1657261 13f79535-47bb-0310-9956-ffa450edef68
static req_table_t* req_subprocess_env(request_rec *r) { req_table_t* t = apr_palloc(r->pool, sizeof(req_table_t)); t->r = r; t->t = r->subprocess_env; t->n = "subprocess_env"; return t; }
static req_table_t* req_subprocess_env(request_rec *r) { req_table_t* t = apr_palloc(r->pool, sizeof(req_table_t)); t->r = r; t->t = r->subprocess_env; t->n = "subprocess_env"; return t; }
C
httpd
0
CVE-2010-4819
https://www.cvedetails.com/cve/CVE-2010-4819/
CWE-20
https://cgit.freedesktop.org/xorg/xserver/commit/render/render.c?id=5725849a1b427cd4a72b84e57f211edb35838718
5725849a1b427cd4a72b84e57f211edb35838718
null
ProcRenderFreeGlyphs (ClientPtr client) { REQUEST(xRenderFreeGlyphsReq); GlyphSetPtr glyphSet; int rc, nglyph; CARD32 *gids; CARD32 glyph; REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType, client, DixRemoveAccess); if (rc != Success) { client->errorValue = stuff->glyphset; return rc; } nglyph = bytes_to_int32((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)); gids = (CARD32 *) (stuff + 1); while (nglyph-- > 0) { glyph = *gids++; if (!DeleteGlyph (glyphSet, glyph)) { client->errorValue = glyph; return RenderErrBase + BadGlyph; } } return Success; }
ProcRenderFreeGlyphs (ClientPtr client) { REQUEST(xRenderFreeGlyphsReq); GlyphSetPtr glyphSet; int rc, nglyph; CARD32 *gids; CARD32 glyph; REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType, client, DixRemoveAccess); if (rc != Success) { client->errorValue = stuff->glyphset; return rc; } nglyph = bytes_to_int32((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)); gids = (CARD32 *) (stuff + 1); while (nglyph-- > 0) { glyph = *gids++; if (!DeleteGlyph (glyphSet, glyph)) { client->errorValue = glyph; return RenderErrBase + BadGlyph; } } return Success; }
C
xserver
0
CVE-2017-5061
https://www.cvedetails.com/cve/CVE-2017-5061/
CWE-362
https://github.com/chromium/chromium/commit/5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
(Reland) Discard compositor frames from unloaded web content This is a reland of https://codereview.chromium.org/2707243005/ with a small change to fix an uninitialized memory error that fails on MSAN bots. BUG=672847 [email protected], [email protected] CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2731283003 Cr-Commit-Position: refs/heads/master@{#454954}
void LayerTreeHostImpl::SetDebugState( const LayerTreeDebugState& new_debug_state) { if (LayerTreeDebugState::Equal(debug_state_, new_debug_state)) return; debug_state_ = new_debug_state; UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); SetFullViewportDamage(); }
void LayerTreeHostImpl::SetDebugState( const LayerTreeDebugState& new_debug_state) { if (LayerTreeDebugState::Equal(debug_state_, new_debug_state)) return; debug_state_ = new_debug_state; UpdateTileManagerMemoryPolicy(ActualManagedMemoryPolicy()); SetFullViewportDamage(); }
C
Chrome
0
CVE-2017-15128
https://www.cvedetails.com/cve/CVE-2017-15128/
CWE-119
https://github.com/torvalds/linux/commit/1e3921471354244f70fe268586ff94a97a6dd4df
1e3921471354244f70fe268586ff94a97a6dd4df
userfaultfd: hugetlbfs: prevent UFFDIO_COPY to fill beyond the end of i_size This oops: kernel BUG at fs/hugetlbfs/inode.c:484! RIP: remove_inode_hugepages+0x3d0/0x410 Call Trace: hugetlbfs_setattr+0xd9/0x130 notify_change+0x292/0x410 do_truncate+0x65/0xa0 do_sys_ftruncate.constprop.3+0x11a/0x180 SyS_ftruncate+0xe/0x10 tracesys+0xd9/0xde was caused by the lack of i_size check in hugetlb_mcopy_atomic_pte. mmap() can still succeed beyond the end of the i_size after vmtruncate zapped vmas in those ranges, but the faults must not succeed, and that includes UFFDIO_COPY. We could differentiate the retval to userland to represent a SIGBUS like a page fault would do (vs SIGSEGV), but it doesn't seem very useful and we'd need to pick a random retval as there's no meaningful syscall retval that would differentiate from SIGSEGV and SIGBUS, there's just -EFAULT. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Andrea Arcangeli <[email protected]> Reviewed-by: Mike Kravetz <[email protected]> Cc: Mike Rapoport <[email protected]> Cc: "Dr. David Alan Gilbert" <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static void set_vma_resv_flags(struct vm_area_struct *vma, unsigned long flags) { VM_BUG_ON_VMA(!is_vm_hugetlb_page(vma), vma); VM_BUG_ON_VMA(vma->vm_flags & VM_MAYSHARE, vma); set_vma_private_data(vma, get_vma_private_data(vma) | flags); }
static void set_vma_resv_flags(struct vm_area_struct *vma, unsigned long flags) { VM_BUG_ON_VMA(!is_vm_hugetlb_page(vma), vma); VM_BUG_ON_VMA(vma->vm_flags & VM_MAYSHARE, vma); set_vma_private_data(vma, get_vma_private_data(vma) | flags); }
C
linux
0
CVE-2014-3668
https://www.cvedetails.com/cve/CVE-2014-3668/
CWE-119
https://git.php.net/?p=php-src.git;a=commit;h=88412772d295ebf7dd34409534507dc9bcac726e
88412772d295ebf7dd34409534507dc9bcac726e
null
XMLRPC_VALUE XMLRPC_CreateValueDateTime(const char* id, time_t time) { XMLRPC_VALUE val = XMLRPC_CreateValueEmpty(); if(val) { XMLRPC_SetValueDateTime(val, time); if(id) { XMLRPC_SetValueID(val, id, 0); } } return val; }
XMLRPC_VALUE XMLRPC_CreateValueDateTime(const char* id, time_t time) { XMLRPC_VALUE val = XMLRPC_CreateValueEmpty(); if(val) { XMLRPC_SetValueDateTime(val, time); if(id) { XMLRPC_SetValueID(val, id, 0); } } return val; }
C
php
0
CVE-2017-15951
https://www.cvedetails.com/cve/CVE-2017-15951/
CWE-20
https://github.com/torvalds/linux/commit/363b02dab09b3226f3bd1420dad9c72b79a42a76
363b02dab09b3226f3bd1420dad9c72b79a42a76
KEYS: Fix race between updating and finding a negative key Consolidate KEY_FLAG_INSTANTIATED, KEY_FLAG_NEGATIVE and the rejection error into one field such that: (1) The instantiation state can be modified/read atomically. (2) The error can be accessed atomically with the state. (3) The error isn't stored unioned with the payload pointers. This deals with the problem that the state is spread over three different objects (two bits and a separate variable) and reading or updating them atomically isn't practical, given that not only can uninstantiated keys change into instantiated or rejected keys, but rejected keys can also turn into instantiated keys - and someone accessing the key might not be using any locking. The main side effect of this problem is that what was held in the payload may change, depending on the state. For instance, you might observe the key to be in the rejected state. You then read the cached error, but if the key semaphore wasn't locked, the key might've become instantiated between the two reads - and you might now have something in hand that isn't actually an error code. The state is now KEY_IS_UNINSTANTIATED, KEY_IS_POSITIVE or a negative error code if the key is negatively instantiated. The key_is_instantiated() function is replaced with key_is_positive() to avoid confusion as negative keys are also 'instantiated'. Additionally, barriering is included: (1) Order payload-set before state-set during instantiation. (2) Order state-read before payload-read when using the key. Further separate barriering is necessary if RCU is being used to access the payload content after reading the payload pointers. Fixes: 146aa8b1453b ("KEYS: Merge the type-specific data with the payload data") Cc: [email protected] # v4.4+ Reported-by: Eric Biggers <[email protected]> Signed-off-by: David Howells <[email protected]> Reviewed-by: Eric Biggers <[email protected]>
int wait_for_key_construction(struct key *key, bool intr) { int ret; ret = wait_on_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT, intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); if (ret) return -ERESTARTSYS; ret = key_read_state(key); if (ret < 0) return ret; return key_validate(key); }
int wait_for_key_construction(struct key *key, bool intr) { int ret; ret = wait_on_bit(&key->flags, KEY_FLAG_USER_CONSTRUCT, intr ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE); if (ret) return -ERESTARTSYS; if (test_bit(KEY_FLAG_NEGATIVE, &key->flags)) { smp_rmb(); return key->reject_error; } return key_validate(key); }
C
linux
1
CVE-2013-2876
https://www.cvedetails.com/cve/CVE-2013-2876/
CWE-264
https://github.com/chromium/chromium/commit/016da29386308754274675e65fdb73cf9d59dc2d
016da29386308754274675e65fdb73cf9d59dc2d
Don't allow extensions to take screenshots of interstitial pages. Branched from https://codereview.chromium.org/14885004/ which is trying to test it. BUG=229504 Review URL: https://chromiumcodereview.appspot.com/14954004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@198297 0039d316-1c4b-4281-b951-d872f2087c98
void TabsDetectLanguageFunction::GotLanguage(const std::string& language) { SetResult(Value::CreateStringValue(language.c_str())); SendResponse(true); Release(); // Balanced in Run() }
void TabsDetectLanguageFunction::GotLanguage(const std::string& language) { SetResult(Value::CreateStringValue(language.c_str())); SendResponse(true); Release(); // Balanced in Run() }
C
Chrome
0
CVE-2011-3209
https://www.cvedetails.com/cve/CVE-2011-3209/
CWE-189
https://github.com/torvalds/linux/commit/f8bd2258e2d520dff28c855658bd24bdafb5102d
f8bd2258e2d520dff28c855658bd24bdafb5102d
remove div_long_long_rem x86 is the only arch right now, which provides an optimized for div_long_long_rem and it has the downside that one has to be very careful that the divide doesn't overflow. The API is a little akward, as the arguments for the unsigned divide are signed. The signed version also doesn't handle a negative divisor and produces worse code on 64bit archs. There is little incentive to keep this API alive, so this converts the few users to the new API. Signed-off-by: Roman Zippel <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: john stultz <[email protected]> Cc: Christoph Lameter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
u64 current_tick_length(void) { return tick_length; }
u64 current_tick_length(void) { return tick_length; }
C
linux
0
CVE-2018-10124
https://www.cvedetails.com/cve/CVE-2018-10124/
CWE-119
https://github.com/torvalds/linux/commit/4ea77014af0d6205b05503d1c7aac6eace11d473
4ea77014af0d6205b05503d1c7aac6eace11d473
kernel/signal.c: avoid undefined behaviour in kill_something_info When running kill(72057458746458112, 0) in userspace I hit the following issue. UBSAN: Undefined behaviour in kernel/signal.c:1462:11 negation of -2147483648 cannot be represented in type 'int': CPU: 226 PID: 9849 Comm: test Tainted: G B ---- ------- 3.10.0-327.53.58.70.x86_64_ubsan+ #116 Hardware name: Huawei Technologies Co., Ltd. RH8100 V3/BC61PBIA, BIOS BLHSV028 11/11/2014 Call Trace: dump_stack+0x19/0x1b ubsan_epilogue+0xd/0x50 __ubsan_handle_negate_overflow+0x109/0x14e SYSC_kill+0x43e/0x4d0 SyS_kill+0xe/0x10 system_call_fastpath+0x16/0x1b Add code to avoid the UBSAN detection. [[email protected]: tweak comment] Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: zhongjiang <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: Xishi Qiu <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
struct sighand_struct *__lock_task_sighand(struct task_struct *tsk, unsigned long *flags) { struct sighand_struct *sighand; for (;;) { /* * Disable interrupts early to avoid deadlocks. * See rcu_read_unlock() comment header for details. */ local_irq_save(*flags); rcu_read_lock(); sighand = rcu_dereference(tsk->sighand); if (unlikely(sighand == NULL)) { rcu_read_unlock(); local_irq_restore(*flags); break; } /* * This sighand can be already freed and even reused, but * we rely on SLAB_TYPESAFE_BY_RCU and sighand_ctor() which * initializes ->siglock: this slab can't go away, it has * the same object type, ->siglock can't be reinitialized. * * We need to ensure that tsk->sighand is still the same * after we take the lock, we can race with de_thread() or * __exit_signal(). In the latter case the next iteration * must see ->sighand == NULL. */ spin_lock(&sighand->siglock); if (likely(sighand == tsk->sighand)) { rcu_read_unlock(); break; } spin_unlock(&sighand->siglock); rcu_read_unlock(); local_irq_restore(*flags); } return sighand; }
struct sighand_struct *__lock_task_sighand(struct task_struct *tsk, unsigned long *flags) { struct sighand_struct *sighand; for (;;) { /* * Disable interrupts early to avoid deadlocks. * See rcu_read_unlock() comment header for details. */ local_irq_save(*flags); rcu_read_lock(); sighand = rcu_dereference(tsk->sighand); if (unlikely(sighand == NULL)) { rcu_read_unlock(); local_irq_restore(*flags); break; } /* * This sighand can be already freed and even reused, but * we rely on SLAB_TYPESAFE_BY_RCU and sighand_ctor() which * initializes ->siglock: this slab can't go away, it has * the same object type, ->siglock can't be reinitialized. * * We need to ensure that tsk->sighand is still the same * after we take the lock, we can race with de_thread() or * __exit_signal(). In the latter case the next iteration * must see ->sighand == NULL. */ spin_lock(&sighand->siglock); if (likely(sighand == tsk->sighand)) { rcu_read_unlock(); break; } spin_unlock(&sighand->siglock); rcu_read_unlock(); local_irq_restore(*flags); } return sighand; }
C
linux
0
CVE-2018-20856
https://www.cvedetails.com/cve/CVE-2018-20856/
CWE-416
https://github.com/torvalds/linux/commit/54648cf1ec2d7f4b6a71767799c45676a138ca24
54648cf1ec2d7f4b6a71767799c45676a138ca24
block: blk_init_allocated_queue() set q->fq as NULL in the fail case We find the memory use-after-free issue in __blk_drain_queue() on the kernel 4.14. After read the latest kernel 4.18-rc6 we think it has the same problem. Memory is allocated for q->fq in the blk_init_allocated_queue(). If the elevator init function called with error return, it will run into the fail case to free the q->fq. Then the __blk_drain_queue() uses the same memory after the free of the q->fq, it will lead to the unpredictable event. The patch is to set q->fq as NULL in the fail case of blk_init_allocated_queue(). Fixes: commit 7c94e1c157a2 ("block: introduce blk_flush_queue to drive flush machinery") Cc: <[email protected]> Reviewed-by: Ming Lei <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: xiao jin <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
static struct request *elv_next_request(struct request_queue *q) { struct request *rq; struct blk_flush_queue *fq = blk_get_flush_queue(q, NULL); WARN_ON_ONCE(q->mq_ops); while (1) { list_for_each_entry(rq, &q->queue_head, queuelist) { if (blk_pm_allow_request(rq)) return rq; if (rq->rq_flags & RQF_SOFTBARRIER) break; } /* * Flush request is running and flush request isn't queueable * in the drive, we can hold the queue till flush request is * finished. Even we don't do this, driver can't dispatch next * requests and will requeue them. And this can improve * throughput too. For example, we have request flush1, write1, * flush 2. flush1 is dispatched, then queue is hold, write1 * isn't inserted to queue. After flush1 is finished, flush2 * will be dispatched. Since disk cache is already clean, * flush2 will be finished very soon, so looks like flush2 is * folded to flush1. * Since the queue is hold, a flag is set to indicate the queue * should be restarted later. Please see flush_end_io() for * details. */ if (fq->flush_pending_idx != fq->flush_running_idx && !queue_flush_queueable(q)) { fq->flush_queue_delayed = 1; return NULL; } if (unlikely(blk_queue_bypass(q)) || !q->elevator->type->ops.sq.elevator_dispatch_fn(q, 0)) return NULL; } }
static struct request *elv_next_request(struct request_queue *q) { struct request *rq; struct blk_flush_queue *fq = blk_get_flush_queue(q, NULL); WARN_ON_ONCE(q->mq_ops); while (1) { list_for_each_entry(rq, &q->queue_head, queuelist) { if (blk_pm_allow_request(rq)) return rq; if (rq->rq_flags & RQF_SOFTBARRIER) break; } /* * Flush request is running and flush request isn't queueable * in the drive, we can hold the queue till flush request is * finished. Even we don't do this, driver can't dispatch next * requests and will requeue them. And this can improve * throughput too. For example, we have request flush1, write1, * flush 2. flush1 is dispatched, then queue is hold, write1 * isn't inserted to queue. After flush1 is finished, flush2 * will be dispatched. Since disk cache is already clean, * flush2 will be finished very soon, so looks like flush2 is * folded to flush1. * Since the queue is hold, a flag is set to indicate the queue * should be restarted later. Please see flush_end_io() for * details. */ if (fq->flush_pending_idx != fq->flush_running_idx && !queue_flush_queueable(q)) { fq->flush_queue_delayed = 1; return NULL; } if (unlikely(blk_queue_bypass(q)) || !q->elevator->type->ops.sq.elevator_dispatch_fn(q, 0)) return NULL; } }
C
linux
0
CVE-2016-1620
https://www.cvedetails.com/cve/CVE-2016-1620/
null
https://github.com/chromium/chromium/commit/b90c7c8c335a2e2a4abdd7bde17a44f92c8b3a54
b90c7c8c335a2e2a4abdd7bde17a44f92c8b3a54
Fix GPU process fallback logic. 1. In GpuProcessHost::OnProcessCrashed() record the process crash first. This means the GPU mode fallback will happen before a new GPU process is started. 2. Don't call FallBackToNextGpuMode() if GPU process initialization fails for an unsandboxed GPU process. The unsandboxed GPU is only used for collect information and it's failure doesn't indicate a need to change GPU modes. Bug: 869419 Change-Id: I8bd0a03268f0ea8809f3df8458d4e6a92db9391f Reviewed-on: https://chromium-review.googlesource.com/1157164 Reviewed-by: Zhenyao Mo <[email protected]> Commit-Queue: kylechar <[email protected]> Cr-Commit-Position: refs/heads/master@{#579625}
void GpuProcessHost::SetChildSurface(gpu::SurfaceHandle parent_handle, gpu::SurfaceHandle window_handle) { #if defined(OS_WIN) constexpr char kBadMessageError[] = "Bad parenting request from gpu process."; if (!in_process_) { DCHECK(process_); DWORD parent_process_id = 0; DWORD parent_thread_id = GetWindowThreadProcessId(parent_handle, &parent_process_id); if (!parent_thread_id || parent_process_id != ::GetCurrentProcessId()) { LOG(ERROR) << kBadMessageError; return; } DWORD child_process_id = 0; DWORD child_thread_id = GetWindowThreadProcessId(window_handle, &child_process_id); if (!child_thread_id || child_process_id != process_->GetProcess().Pid()) { LOG(ERROR) << kBadMessageError; return; } } if (!gfx::RenderingWindowManager::GetInstance()->RegisterChild( parent_handle, window_handle)) { LOG(ERROR) << kBadMessageError; } #endif }
void GpuProcessHost::SetChildSurface(gpu::SurfaceHandle parent_handle, gpu::SurfaceHandle window_handle) { #if defined(OS_WIN) constexpr char kBadMessageError[] = "Bad parenting request from gpu process."; if (!in_process_) { DCHECK(process_); DWORD parent_process_id = 0; DWORD parent_thread_id = GetWindowThreadProcessId(parent_handle, &parent_process_id); if (!parent_thread_id || parent_process_id != ::GetCurrentProcessId()) { LOG(ERROR) << kBadMessageError; return; } DWORD child_process_id = 0; DWORD child_thread_id = GetWindowThreadProcessId(window_handle, &child_process_id); if (!child_thread_id || child_process_id != process_->GetProcess().Pid()) { LOG(ERROR) << kBadMessageError; return; } } if (!gfx::RenderingWindowManager::GetInstance()->RegisterChild( parent_handle, window_handle)) { LOG(ERROR) << kBadMessageError; } #endif }
C
Chrome
0
CVE-2017-5077
https://www.cvedetails.com/cve/CVE-2017-5077/
CWE-125
https://github.com/chromium/chromium/commit/fec26ff33bf372476a70326f3669a35f34a9d474
fec26ff33bf372476a70326f3669a35f34a9d474
Origins should be represented as url::Origin (not as GURL). As pointed out in //docs/security/origin-vs-url.md, origins should be represented as url::Origin (not as GURL). This CL applies this guideline to predictor-related code and changes the type of the following fields from GURL to url::Origin: - OriginRequestSummary::origin - PreconnectedRequestStats::origin - PreconnectRequest::origin The old code did not depend on any non-origin parts of GURL (like path and/or query). Therefore, this CL has no intended behavior change. Bug: 973885 Change-Id: Idd14590b4834cb9d50c74ed747b595fe1a4ba357 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895167 Commit-Queue: Łukasz Anforowicz <[email protected]> Reviewed-by: Alex Ilin <[email protected]> Cr-Commit-Position: refs/heads/master@{#716311}
LoadingDataCollector* LoadingPredictor::loading_data_collector() { return loading_data_collector_.get(); }
LoadingDataCollector* LoadingPredictor::loading_data_collector() { return loading_data_collector_.get(); }
C
Chrome
0
CVE-2018-13093
https://www.cvedetails.com/cve/CVE-2018-13093/
CWE-476
https://github.com/torvalds/linux/commit/afca6c5b2595fc44383919fba740c194b0b76aff
afca6c5b2595fc44383919fba740c194b0b76aff
xfs: validate cached inodes are free when allocated A recent fuzzed filesystem image cached random dcache corruption when the reproducer was run. This often showed up as panics in lookup_slow() on a null inode->i_ops pointer when doing pathwalks. BUG: unable to handle kernel NULL pointer dereference at 0000000000000000 .... Call Trace: lookup_slow+0x44/0x60 walk_component+0x3dd/0x9f0 link_path_walk+0x4a7/0x830 path_lookupat+0xc1/0x470 filename_lookup+0x129/0x270 user_path_at_empty+0x36/0x40 path_listxattr+0x98/0x110 SyS_listxattr+0x13/0x20 do_syscall_64+0xf5/0x280 entry_SYSCALL_64_after_hwframe+0x42/0xb7 but had many different failure modes including deadlocks trying to lock the inode that was just allocated or KASAN reports of use-after-free violations. The cause of the problem was a corrupt INOBT on a v4 fs where the root inode was marked as free in the inobt record. Hence when we allocated an inode, it chose the root inode to allocate, found it in the cache and re-initialised it. We recently fixed a similar inode allocation issue caused by inobt record corruption problem in xfs_iget_cache_miss() in commit ee457001ed6c ("xfs: catch inode allocation state mismatch corruption"). This change adds similar checks to the cache-hit path to catch it, and turns the reproducer into a corruption shutdown situation. Reported-by: Wen Xu <[email protected]> Signed-Off-By: Dave Chinner <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Reviewed-by: Carlos Maiolino <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> [darrick: fix typos in comment] Signed-off-by: Darrick J. Wong <[email protected]>
int lock_flags) __releases(RCU) { struct inode *inode = VFS_I(ip); struct xfs_mount *mp = ip->i_mount; int error; /* * check for re-use of an inode within an RCU grace period due to the * radix tree nodes not being updated yet. We monitor for this by * setting the inode number to zero before freeing the inode structure. * If the inode has been reallocated and set up, then the inode number * will not match, so check for that, too. */ spin_lock(&ip->i_flags_lock); if (ip->i_ino != ino) { trace_xfs_iget_skip(ip); XFS_STATS_INC(mp, xs_ig_frecycle); error = -EAGAIN; goto out_error; } /* * If we are racing with another cache hit that is currently * instantiating this inode or currently recycling it out of * reclaimabe state, wait for the initialisation to complete * before continuing. * * XXX(hch): eventually we should do something equivalent to * wait_on_inode to wait for these flags to be cleared * instead of polling for it. */ if (ip->i_flags & (XFS_INEW|XFS_IRECLAIM)) { trace_xfs_iget_skip(ip); XFS_STATS_INC(mp, xs_ig_frecycle); error = -EAGAIN; goto out_error; } /* * Check the inode free state is valid. This also detects lookup * racing with unlinks. */ error = xfs_iget_check_free_state(ip, flags); if (error) goto out_error; /* * If IRECLAIMABLE is set, we've torn down the VFS inode already. * Need to carefully get it back into useable state. */ if (ip->i_flags & XFS_IRECLAIMABLE) { trace_xfs_iget_reclaim(ip); if (flags & XFS_IGET_INCORE) { error = -EAGAIN; goto out_error; } /* * We need to set XFS_IRECLAIM to prevent xfs_reclaim_inode * from stomping over us while we recycle the inode. We can't * clear the radix tree reclaimable tag yet as it requires * pag_ici_lock to be held exclusive. */ ip->i_flags |= XFS_IRECLAIM; spin_unlock(&ip->i_flags_lock); rcu_read_unlock(); error = xfs_reinit_inode(mp, inode); if (error) { bool wake; /* * Re-initializing the inode failed, and we are in deep * trouble. Try to re-add it to the reclaim list. */ rcu_read_lock(); spin_lock(&ip->i_flags_lock); wake = !!__xfs_iflags_test(ip, XFS_INEW); ip->i_flags &= ~(XFS_INEW | XFS_IRECLAIM); if (wake) wake_up_bit(&ip->i_flags, __XFS_INEW_BIT); ASSERT(ip->i_flags & XFS_IRECLAIMABLE); trace_xfs_iget_reclaim_fail(ip); goto out_error; } spin_lock(&pag->pag_ici_lock); spin_lock(&ip->i_flags_lock); /* * Clear the per-lifetime state in the inode as we are now * effectively a new inode and need to return to the initial * state before reuse occurs. */ ip->i_flags &= ~XFS_IRECLAIM_RESET_FLAGS; ip->i_flags |= XFS_INEW; xfs_inode_clear_reclaim_tag(pag, ip->i_ino); inode->i_state = I_NEW; ASSERT(!rwsem_is_locked(&inode->i_rwsem)); init_rwsem(&inode->i_rwsem); spin_unlock(&ip->i_flags_lock); spin_unlock(&pag->pag_ici_lock); } else { /* If the VFS inode is being torn down, pause and try again. */ if (!igrab(inode)) { trace_xfs_iget_skip(ip); error = -EAGAIN; goto out_error; } /* We've got a live one. */ spin_unlock(&ip->i_flags_lock); rcu_read_unlock(); trace_xfs_iget_hit(ip); } if (lock_flags != 0) xfs_ilock(ip, lock_flags); if (!(flags & XFS_IGET_INCORE)) xfs_iflags_clear(ip, XFS_ISTALE | XFS_IDONTCACHE); XFS_STATS_INC(mp, xs_ig_found); return 0; out_error: spin_unlock(&ip->i_flags_lock); rcu_read_unlock(); return error; }
int lock_flags) __releases(RCU) { struct inode *inode = VFS_I(ip); struct xfs_mount *mp = ip->i_mount; int error; /* * check for re-use of an inode within an RCU grace period due to the * radix tree nodes not being updated yet. We monitor for this by * setting the inode number to zero before freeing the inode structure. * If the inode has been reallocated and set up, then the inode number * will not match, so check for that, too. */ spin_lock(&ip->i_flags_lock); if (ip->i_ino != ino) { trace_xfs_iget_skip(ip); XFS_STATS_INC(mp, xs_ig_frecycle); error = -EAGAIN; goto out_error; } /* * If we are racing with another cache hit that is currently * instantiating this inode or currently recycling it out of * reclaimabe state, wait for the initialisation to complete * before continuing. * * XXX(hch): eventually we should do something equivalent to * wait_on_inode to wait for these flags to be cleared * instead of polling for it. */ if (ip->i_flags & (XFS_INEW|XFS_IRECLAIM)) { trace_xfs_iget_skip(ip); XFS_STATS_INC(mp, xs_ig_frecycle); error = -EAGAIN; goto out_error; } /* * If lookup is racing with unlink return an error immediately. */ if (VFS_I(ip)->i_mode == 0 && !(flags & XFS_IGET_CREATE)) { error = -ENOENT; goto out_error; } /* * If IRECLAIMABLE is set, we've torn down the VFS inode already. * Need to carefully get it back into useable state. */ if (ip->i_flags & XFS_IRECLAIMABLE) { trace_xfs_iget_reclaim(ip); if (flags & XFS_IGET_INCORE) { error = -EAGAIN; goto out_error; } /* * We need to set XFS_IRECLAIM to prevent xfs_reclaim_inode * from stomping over us while we recycle the inode. We can't * clear the radix tree reclaimable tag yet as it requires * pag_ici_lock to be held exclusive. */ ip->i_flags |= XFS_IRECLAIM; spin_unlock(&ip->i_flags_lock); rcu_read_unlock(); error = xfs_reinit_inode(mp, inode); if (error) { bool wake; /* * Re-initializing the inode failed, and we are in deep * trouble. Try to re-add it to the reclaim list. */ rcu_read_lock(); spin_lock(&ip->i_flags_lock); wake = !!__xfs_iflags_test(ip, XFS_INEW); ip->i_flags &= ~(XFS_INEW | XFS_IRECLAIM); if (wake) wake_up_bit(&ip->i_flags, __XFS_INEW_BIT); ASSERT(ip->i_flags & XFS_IRECLAIMABLE); trace_xfs_iget_reclaim_fail(ip); goto out_error; } spin_lock(&pag->pag_ici_lock); spin_lock(&ip->i_flags_lock); /* * Clear the per-lifetime state in the inode as we are now * effectively a new inode and need to return to the initial * state before reuse occurs. */ ip->i_flags &= ~XFS_IRECLAIM_RESET_FLAGS; ip->i_flags |= XFS_INEW; xfs_inode_clear_reclaim_tag(pag, ip->i_ino); inode->i_state = I_NEW; ASSERT(!rwsem_is_locked(&inode->i_rwsem)); init_rwsem(&inode->i_rwsem); spin_unlock(&ip->i_flags_lock); spin_unlock(&pag->pag_ici_lock); } else { /* If the VFS inode is being torn down, pause and try again. */ if (!igrab(inode)) { trace_xfs_iget_skip(ip); error = -EAGAIN; goto out_error; } /* We've got a live one. */ spin_unlock(&ip->i_flags_lock); rcu_read_unlock(); trace_xfs_iget_hit(ip); } if (lock_flags != 0) xfs_ilock(ip, lock_flags); if (!(flags & XFS_IGET_INCORE)) xfs_iflags_clear(ip, XFS_ISTALE | XFS_IDONTCACHE); XFS_STATS_INC(mp, xs_ig_found); return 0; out_error: spin_unlock(&ip->i_flags_lock); rcu_read_unlock(); return error; }
C
linux
1
CVE-2012-5517
https://www.cvedetails.com/cve/CVE-2012-5517/
null
https://github.com/torvalds/linux/commit/08dff7b7d629807dbb1f398c68dd9cd58dd657a1
08dff7b7d629807dbb1f398c68dd9cd58dd657a1
mm/hotplug: correctly add new zone to all other nodes' zone lists When online_pages() is called to add new memory to an empty zone, it rebuilds all zone lists by calling build_all_zonelists(). But there's a bug which prevents the new zone to be added to other nodes' zone lists. online_pages() { build_all_zonelists() ..... node_set_state(zone_to_nid(zone), N_HIGH_MEMORY) } Here the node of the zone is put into N_HIGH_MEMORY state after calling build_all_zonelists(), but build_all_zonelists() only adds zones from nodes in N_HIGH_MEMORY state to the fallback zone lists. build_all_zonelists() ->__build_all_zonelists() ->build_zonelists() ->find_next_best_node() ->for_each_node_state(n, N_HIGH_MEMORY) So memory in the new zone will never be used by other nodes, and it may cause strange behavor when system is under memory pressure. So put node into N_HIGH_MEMORY state before calling build_all_zonelists(). Signed-off-by: Jianguo Wu <[email protected]> Signed-off-by: Jiang Liu <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Rusty Russell <[email protected]> Cc: Yinghai Lu <[email protected]> Cc: Tony Luck <[email protected]> Cc: KAMEZAWA Hiroyuki <[email protected]> Cc: KOSAKI Motohiro <[email protected]> Cc: David Rientjes <[email protected]> Cc: Keping Chen <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
int remove_memory(u64 start, u64 size) { unsigned long start_pfn, end_pfn; start_pfn = PFN_DOWN(start); end_pfn = start_pfn + PFN_DOWN(size); return offline_pages(start_pfn, end_pfn, 120 * HZ); }
int remove_memory(u64 start, u64 size) { unsigned long start_pfn, end_pfn; start_pfn = PFN_DOWN(start); end_pfn = start_pfn + PFN_DOWN(size); return offline_pages(start_pfn, end_pfn, 120 * HZ); }
C
linux
0
CVE-2016-1647
https://www.cvedetails.com/cve/CVE-2016-1647/
null
https://github.com/chromium/chromium/commit/e5787005a9004d7be289cc649c6ae4f3051996cd
e5787005a9004d7be289cc649c6ae4f3051996cd
Check that RWHI isn't deleted manually while owned by a scoped_ptr in RVHI BUG=590284 Review URL: https://codereview.chromium.org/1747183002 Cr-Commit-Position: refs/heads/master@{#378844}
void RenderWidgetHostImpl::SetInitialRenderSizeParams( const ResizeParams& resize_params) { resize_ack_pending_ = resize_params.needs_resize_ack; old_resize_params_ = make_scoped_ptr(new ResizeParams(resize_params)); }
void RenderWidgetHostImpl::SetInitialRenderSizeParams( const ResizeParams& resize_params) { resize_ack_pending_ = resize_params.needs_resize_ack; old_resize_params_ = make_scoped_ptr(new ResizeParams(resize_params)); }
C
Chrome
0
CVE-2016-6294
https://www.cvedetails.com/cve/CVE-2016-6294/
CWE-125
https://git.php.net/?p=php-src.git;a=commit;h=aa82e99ed8003c01f1ef4f0940e56b85c5b032d4
aa82e99ed8003c01f1ef4f0940e56b85c5b032d4
null
PHP_FUNCTION(locale_parse) { const char* loc_name = NULL; int loc_name_len = 0; int grOffset = 0; intl_error_reset( NULL TSRMLS_CC ); if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s", &loc_name, &loc_name_len ) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_parse: unable to parse input params", 0 TSRMLS_CC ); RETURN_FALSE; } if(loc_name_len == 0) { loc_name = intl_locale_get_default(TSRMLS_C); } array_init( return_value ); grOffset = findOffset( LOC_GRANDFATHERED , loc_name ); if( grOffset >= 0 ){ add_assoc_string( return_value , LOC_GRANDFATHERED_LANG_TAG , estrdup(loc_name) ,FALSE ); } else{ /* Not grandfathered */ add_array_entry( loc_name , return_value , LOC_LANG_TAG TSRMLS_CC); add_array_entry( loc_name , return_value , LOC_SCRIPT_TAG TSRMLS_CC); add_array_entry( loc_name , return_value , LOC_REGION_TAG TSRMLS_CC); add_array_entry( loc_name , return_value , LOC_VARIANT_TAG TSRMLS_CC); add_array_entry( loc_name , return_value , LOC_PRIVATE_TAG TSRMLS_CC); } }
PHP_FUNCTION(locale_parse) { const char* loc_name = NULL; int loc_name_len = 0; int grOffset = 0; intl_error_reset( NULL TSRMLS_CC ); if(zend_parse_parameters( ZEND_NUM_ARGS() TSRMLS_CC, "s", &loc_name, &loc_name_len ) == FAILURE) { intl_error_set( NULL, U_ILLEGAL_ARGUMENT_ERROR, "locale_parse: unable to parse input params", 0 TSRMLS_CC ); RETURN_FALSE; } if(loc_name_len == 0) { loc_name = intl_locale_get_default(TSRMLS_C); } array_init( return_value ); grOffset = findOffset( LOC_GRANDFATHERED , loc_name ); if( grOffset >= 0 ){ add_assoc_string( return_value , LOC_GRANDFATHERED_LANG_TAG , estrdup(loc_name) ,FALSE ); } else{ /* Not grandfathered */ add_array_entry( loc_name , return_value , LOC_LANG_TAG TSRMLS_CC); add_array_entry( loc_name , return_value , LOC_SCRIPT_TAG TSRMLS_CC); add_array_entry( loc_name , return_value , LOC_REGION_TAG TSRMLS_CC); add_array_entry( loc_name , return_value , LOC_VARIANT_TAG TSRMLS_CC); add_array_entry( loc_name , return_value , LOC_PRIVATE_TAG TSRMLS_CC); } }
C
php
0
CVE-2012-5136
https://www.cvedetails.com/cve/CVE-2012-5136/
CWE-20
https://github.com/chromium/chromium/commit/401d30ef93030afbf7e81e53a11b68fc36194502
401d30ef93030afbf7e81e53a11b68fc36194502
Refactoring: Move m_mayDisplaySeamlesslyWithParent down to Document The member is used only in Document, thus no reason to stay in SecurityContext. TEST=none BUG=none [email protected], abarth, haraken, hayato Review URL: https://codereview.chromium.org/27615003 git-svn-id: svn://svn.chromium.org/blink/trunk@159829 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer) { ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer); if (!frame() || !frame()->page()) return; Vector<RefPtr<Element> > associatedFormControls; copyToVector(m_associatedFormControls, associatedFormControls); frame()->page()->chrome().client().didAssociateFormControls(associatedFormControls); m_associatedFormControls.clear(); }
void Document::didAssociateFormControlsTimerFired(Timer<Document>* timer) { ASSERT_UNUSED(timer, timer == &m_didAssociateFormControlsTimer); if (!frame() || !frame()->page()) return; Vector<RefPtr<Element> > associatedFormControls; copyToVector(m_associatedFormControls, associatedFormControls); frame()->page()->chrome().client().didAssociateFormControls(associatedFormControls); m_associatedFormControls.clear(); }
C
Chrome
0
CVE-2018-20784
https://www.cvedetails.com/cve/CVE-2018-20784/
CWE-400
https://github.com/torvalds/linux/commit/c40f7d74c741a907cfaeb73a7697081881c497d0
c40f7d74c741a907cfaeb73a7697081881c497d0
sched/fair: Fix infinite loop in update_blocked_averages() by reverting a9e7f6544b9c Zhipeng Xie, Xie XiuQi and Sargun Dhillon reported lockups in the scheduler under high loads, starting at around the v4.18 time frame, and Zhipeng Xie tracked it down to bugs in the rq->leaf_cfs_rq_list manipulation. Do a (manual) revert of: a9e7f6544b9c ("sched/fair: Fix O(nr_cgroups) in load balance path") It turns out that the list_del_leaf_cfs_rq() introduced by this commit is a surprising property that was not considered in followup commits such as: 9c2791f936ef ("sched/fair: Fix hierarchical order in rq->leaf_cfs_rq_list") As Vincent Guittot explains: "I think that there is a bigger problem with commit a9e7f6544b9c and cfs_rq throttling: Let take the example of the following topology TG2 --> TG1 --> root: 1) The 1st time a task is enqueued, we will add TG2 cfs_rq then TG1 cfs_rq to leaf_cfs_rq_list and we are sure to do the whole branch in one path because it has never been used and can't be throttled so tmp_alone_branch will point to leaf_cfs_rq_list at the end. 2) Then TG1 is throttled 3) and we add TG3 as a new child of TG1. 4) The 1st enqueue of a task on TG3 will add TG3 cfs_rq just before TG1 cfs_rq and tmp_alone_branch will stay on rq->leaf_cfs_rq_list. With commit a9e7f6544b9c, we can del a cfs_rq from rq->leaf_cfs_rq_list. So if the load of TG1 cfs_rq becomes NULL before step 2) above, TG1 cfs_rq is removed from the list. Then at step 4), TG3 cfs_rq is added at the beginning of rq->leaf_cfs_rq_list but tmp_alone_branch still points to TG3 cfs_rq because its throttled parent can't be enqueued when the lock is released. tmp_alone_branch doesn't point to rq->leaf_cfs_rq_list whereas it should. So if TG3 cfs_rq is removed or destroyed before tmp_alone_branch points on another TG cfs_rq, the next TG cfs_rq that will be added, will be linked outside rq->leaf_cfs_rq_list - which is bad. In addition, we can break the ordering of the cfs_rq in rq->leaf_cfs_rq_list but this ordering is used to update and propagate the update from leaf down to root." Instead of trying to work through all these cases and trying to reproduce the very high loads that produced the lockup to begin with, simplify the code temporarily by reverting a9e7f6544b9c - which change was clearly not thought through completely. This (hopefully) gives us a kernel that doesn't lock up so people can continue to enjoy their holidays without worrying about regressions. ;-) [ mingo: Wrote changelog, fixed weird spelling in code comment while at it. ] Analyzed-by: Xie XiuQi <[email protected]> Analyzed-by: Vincent Guittot <[email protected]> Reported-by: Zhipeng Xie <[email protected]> Reported-by: Sargun Dhillon <[email protected]> Reported-by: Xie XiuQi <[email protected]> Tested-by: Zhipeng Xie <[email protected]> Tested-by: Sargun Dhillon <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Acked-by: Vincent Guittot <[email protected]> Cc: <[email protected]> # v4.13+ Cc: Bin Li <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Tejun Heo <[email protected]> Cc: Thomas Gleixner <[email protected]> Fixes: a9e7f6544b9c ("sched/fair: Fix O(nr_cgroups) in load balance path") Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
static void set_next_buddy(struct sched_entity *se) { if (entity_is_task(se) && unlikely(task_has_idle_policy(task_of(se)))) return; for_each_sched_entity(se) { if (SCHED_WARN_ON(!se->on_rq)) return; cfs_rq_of(se)->next = se; } }
static void set_next_buddy(struct sched_entity *se) { if (entity_is_task(se) && unlikely(task_has_idle_policy(task_of(se)))) return; for_each_sched_entity(se) { if (SCHED_WARN_ON(!se->on_rq)) return; cfs_rq_of(se)->next = se; } }
C
linux
0
CVE-2018-6140
https://www.cvedetails.com/cve/CVE-2018-6140/
CWE-20
https://github.com/chromium/chromium/commit/2aec794f26098c7a361c27d7c8f57119631cca8a
2aec794f26098c7a361c27d7c8f57119631cca8a
[DevTools] Do not allow chrome.debugger to attach to web ui pages If the page navigates to web ui, we force detach the debugger extension. [email protected] Bug: 798222 Change-Id: Idb46c2f59e839388397a8dfa6ce2e2a897698df3 Reviewed-on: https://chromium-review.googlesource.com/935961 Commit-Queue: Dmitry Gozman <[email protected]> Reviewed-by: Devlin <[email protected]> Reviewed-by: Pavel Feldman <[email protected]> Reviewed-by: Nasko Oskov <[email protected]> Cr-Commit-Position: refs/heads/master@{#540916}
void DebuggerSendCommandFunction::SendResponseBody( base::DictionaryValue* response) { base::Value* error_body; if (response->Get("error", &error_body)) { base::JSONWriter::Write(*error_body, &error_); SendResponse(false); return; } base::DictionaryValue* result_body; SendCommand::Results::Result result; if (response->GetDictionary("result", &result_body)) result.additional_properties.Swap(result_body); results_ = SendCommand::Results::Create(result); SendResponse(true); }
void DebuggerSendCommandFunction::SendResponseBody( base::DictionaryValue* response) { base::Value* error_body; if (response->Get("error", &error_body)) { base::JSONWriter::Write(*error_body, &error_); SendResponse(false); return; } base::DictionaryValue* result_body; SendCommand::Results::Result result; if (response->GetDictionary("result", &result_body)) result.additional_properties.Swap(result_body); results_ = SendCommand::Results::Create(result); SendResponse(true); }
C
Chrome
0
CVE-2017-15397
https://www.cvedetails.com/cve/CVE-2017-15397/
CWE-311
https://github.com/chromium/chromium/commit/0579ed631fb37de5704b54ed2ee466bf29630ad0
0579ed631fb37de5704b54ed2ee466bf29630ad0
Replace base::MakeUnique with std::make_unique in net/. base/memory/ptr_util.h includes will be cleaned up later. Bug: 755727 Change-Id: Ibaf46f05c9b02b76f9a91e819984b087a8c0d434 Reviewed-on: https://chromium-review.googlesource.com/627300 Commit-Queue: Jeremy Roman <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Bence Béky <[email protected]> Cr-Commit-Position: refs/heads/master@{#498123}
void NetworkChangeNotifierMac::ReachabilityCallback( SCNetworkReachabilityRef target, SCNetworkConnectionFlags flags, void* notifier) { NetworkChangeNotifierMac* notifier_mac = static_cast<NetworkChangeNotifierMac*>(notifier); DCHECK_EQ(notifier_mac->run_loop_.get(), CFRunLoopGetCurrent()); ConnectionType new_type = CalculateConnectionType(flags); ConnectionType old_type; { base::AutoLock lock(notifier_mac->connection_type_lock_); old_type = notifier_mac->connection_type_; notifier_mac->connection_type_ = new_type; } if (old_type != new_type) { NotifyObserversOfConnectionTypeChange(); double max_bandwidth_mbps = NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype( new_type == CONNECTION_NONE ? SUBTYPE_NONE : SUBTYPE_UNKNOWN); NotifyObserversOfMaxBandwidthChange(max_bandwidth_mbps, new_type); } #if defined(OS_IOS) NotifyObserversOfIPAddressChange(); #endif // defined(OS_IOS) }
void NetworkChangeNotifierMac::ReachabilityCallback( SCNetworkReachabilityRef target, SCNetworkConnectionFlags flags, void* notifier) { NetworkChangeNotifierMac* notifier_mac = static_cast<NetworkChangeNotifierMac*>(notifier); DCHECK_EQ(notifier_mac->run_loop_.get(), CFRunLoopGetCurrent()); ConnectionType new_type = CalculateConnectionType(flags); ConnectionType old_type; { base::AutoLock lock(notifier_mac->connection_type_lock_); old_type = notifier_mac->connection_type_; notifier_mac->connection_type_ = new_type; } if (old_type != new_type) { NotifyObserversOfConnectionTypeChange(); double max_bandwidth_mbps = NetworkChangeNotifier::GetMaxBandwidthForConnectionSubtype( new_type == CONNECTION_NONE ? SUBTYPE_NONE : SUBTYPE_UNKNOWN); NotifyObserversOfMaxBandwidthChange(max_bandwidth_mbps, new_type); } #if defined(OS_IOS) NotifyObserversOfIPAddressChange(); #endif // defined(OS_IOS) }
C
Chrome
0
CVE-2016-1691
https://www.cvedetails.com/cve/CVE-2016-1691/
CWE-119
https://github.com/chromium/chromium/commit/e3aa8a56706c4abe208934d5c294f7b594b8b693
e3aa8a56706c4abe208934d5c294f7b594b8b693
Enforce the WebUsbAllowDevicesForUrls policy This change modifies UsbChooserContext to use the UsbAllowDevicesForUrls class to consider devices allowed by the WebUsbAllowDevicesForUrls policy. The WebUsbAllowDevicesForUrls policy overrides the other WebUSB policies. Unit tests are also added to ensure that the policy is being enforced correctly. The design document for this feature is found at: https://docs.google.com/document/d/1MPvsrWiVD_jAC8ELyk8njFpy6j1thfVU5aWT3TCWE8w Bug: 854329 Change-Id: I5f82e662ca9dc544da5918eae766b5535a31296b Reviewed-on: https://chromium-review.googlesource.com/c/1259289 Commit-Queue: Ovidio Henriquez <[email protected]> Reviewed-by: Reilly Grant <[email protected]> Reviewed-by: Julian Pastarmov <[email protected]> Cr-Commit-Position: refs/heads/master@{#597926}
uint32_t num_requests() { return num_requests_; }
uint32_t num_requests() { return num_requests_; }
C
Chrome
0
CVE-2016-5158
https://www.cvedetails.com/cve/CVE-2016-5158/
CWE-190
https://github.com/chromium/chromium/commit/6a310d99a741f9ba5e4e537c5ec49d3adbe5876f
6a310d99a741f9ba5e4e537c5ec49d3adbe5876f
Position info (item n of m) incorrect if hidden focusable items in list Bug: 836997 Change-Id: I971fa7076f72d51829b36af8e379260d48ca25ec Reviewed-on: https://chromium-review.googlesource.com/c/1450235 Commit-Queue: Aaron Leventhal <[email protected]> Reviewed-by: Nektarios Paisios <[email protected]> Cr-Commit-Position: refs/heads/master@{#628890}
AXTree::~AXTree() { if (root_) DestroyNodeAndSubtree(root_, nullptr); for (auto& entry : table_info_map_) delete entry.second; table_info_map_.clear(); }
AXTree::~AXTree() { if (root_) DestroyNodeAndSubtree(root_, nullptr); for (auto& entry : table_info_map_) delete entry.second; table_info_map_.clear(); }
C
Chrome
0
CVE-2012-2375
https://www.cvedetails.com/cve/CVE-2012-2375/
CWE-189
https://github.com/torvalds/linux/commit/20e0fa98b751facf9a1101edaefbc19c82616a68
20e0fa98b751facf9a1101edaefbc19c82616a68
Fix length of buffer copied in __nfs4_get_acl_uncached _copy_from_pages() used to copy data from the temporary buffer to the user passed buffer is passed the wrong size parameter when copying data. res.acl_len contains both the bitmap and acl lenghts while acl_len contains the acl length after adjusting for the bitmap size. Signed-off-by: Sachin Prabhu <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
static void nfs41_call_sync_done(struct rpc_task *task, void *calldata) { struct nfs41_call_sync_data *data = calldata; nfs41_sequence_done(task, data->seq_res); }
static void nfs41_call_sync_done(struct rpc_task *task, void *calldata) { struct nfs41_call_sync_data *data = calldata; nfs41_sequence_done(task, data->seq_res); }
C
linux
0
CVE-2012-6540
https://www.cvedetails.com/cve/CVE-2012-6540/
CWE-200
https://github.com/torvalds/linux/commit/2d8a041b7bfe1097af21441cb77d6af95f4f4680
2d8a041b7bfe1097af21441cb77d6af95f4f4680
ipvs: fix info leak in getsockopt(IP_VS_SO_GET_TIMEOUT) If at least one of CONFIG_IP_VS_PROTO_TCP or CONFIG_IP_VS_PROTO_UDP is not set, __ip_vs_get_timeouts() does not fully initialize the structure that gets copied to userland and that for leaks up to 12 bytes of kernel stack. Add an explicit memset(0) before passing the structure to __ip_vs_get_timeouts() to avoid the info leak. Signed-off-by: Mathias Krause <[email protected]> Cc: Wensong Zhang <[email protected]> Cc: Simon Horman <[email protected]> Cc: Julian Anastasov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u, struct ip_vs_service **svc_p) { int ret = 0; struct ip_vs_scheduler *sched = NULL; struct ip_vs_pe *pe = NULL; struct ip_vs_service *svc = NULL; struct netns_ipvs *ipvs = net_ipvs(net); /* increase the module use count */ ip_vs_use_count_inc(); /* Lookup the scheduler by 'u->sched_name' */ sched = ip_vs_scheduler_get(u->sched_name); if (sched == NULL) { pr_info("Scheduler module ip_vs_%s not found\n", u->sched_name); ret = -ENOENT; goto out_err; } if (u->pe_name && *u->pe_name) { pe = ip_vs_pe_getbyname(u->pe_name); if (pe == NULL) { pr_info("persistence engine module ip_vs_pe_%s " "not found\n", u->pe_name); ret = -ENOENT; goto out_err; } } #ifdef CONFIG_IP_VS_IPV6 if (u->af == AF_INET6 && (u->netmask < 1 || u->netmask > 128)) { ret = -EINVAL; goto out_err; } #endif svc = kzalloc(sizeof(struct ip_vs_service), GFP_KERNEL); if (svc == NULL) { IP_VS_DBG(1, "%s(): no memory\n", __func__); ret = -ENOMEM; goto out_err; } svc->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); if (!svc->stats.cpustats) goto out_err; /* I'm the first user of the service */ atomic_set(&svc->usecnt, 0); atomic_set(&svc->refcnt, 0); svc->af = u->af; svc->protocol = u->protocol; ip_vs_addr_copy(svc->af, &svc->addr, &u->addr); svc->port = u->port; svc->fwmark = u->fwmark; svc->flags = u->flags; svc->timeout = u->timeout * HZ; svc->netmask = u->netmask; svc->net = net; INIT_LIST_HEAD(&svc->destinations); rwlock_init(&svc->sched_lock); spin_lock_init(&svc->stats.lock); /* Bind the scheduler */ ret = ip_vs_bind_scheduler(svc, sched); if (ret) goto out_err; sched = NULL; /* Bind the ct retriever */ ip_vs_bind_pe(svc, pe); pe = NULL; /* Update the virtual service counters */ if (svc->port == FTPPORT) atomic_inc(&ipvs->ftpsvc_counter); else if (svc->port == 0) atomic_inc(&ipvs->nullsvc_counter); ip_vs_start_estimator(net, &svc->stats); /* Count only IPv4 services for old get/setsockopt interface */ if (svc->af == AF_INET) ipvs->num_services++; /* Hash the service into the service table */ write_lock_bh(&__ip_vs_svc_lock); ip_vs_svc_hash(svc); write_unlock_bh(&__ip_vs_svc_lock); *svc_p = svc; /* Now there is a service - full throttle */ ipvs->enable = 1; return 0; out_err: if (svc != NULL) { ip_vs_unbind_scheduler(svc); if (svc->inc) { local_bh_disable(); ip_vs_app_inc_put(svc->inc); local_bh_enable(); } if (svc->stats.cpustats) free_percpu(svc->stats.cpustats); kfree(svc); } ip_vs_scheduler_put(sched); ip_vs_pe_put(pe); /* decrease the module use count */ ip_vs_use_count_dec(); return ret; }
ip_vs_add_service(struct net *net, struct ip_vs_service_user_kern *u, struct ip_vs_service **svc_p) { int ret = 0; struct ip_vs_scheduler *sched = NULL; struct ip_vs_pe *pe = NULL; struct ip_vs_service *svc = NULL; struct netns_ipvs *ipvs = net_ipvs(net); /* increase the module use count */ ip_vs_use_count_inc(); /* Lookup the scheduler by 'u->sched_name' */ sched = ip_vs_scheduler_get(u->sched_name); if (sched == NULL) { pr_info("Scheduler module ip_vs_%s not found\n", u->sched_name); ret = -ENOENT; goto out_err; } if (u->pe_name && *u->pe_name) { pe = ip_vs_pe_getbyname(u->pe_name); if (pe == NULL) { pr_info("persistence engine module ip_vs_pe_%s " "not found\n", u->pe_name); ret = -ENOENT; goto out_err; } } #ifdef CONFIG_IP_VS_IPV6 if (u->af == AF_INET6 && (u->netmask < 1 || u->netmask > 128)) { ret = -EINVAL; goto out_err; } #endif svc = kzalloc(sizeof(struct ip_vs_service), GFP_KERNEL); if (svc == NULL) { IP_VS_DBG(1, "%s(): no memory\n", __func__); ret = -ENOMEM; goto out_err; } svc->stats.cpustats = alloc_percpu(struct ip_vs_cpu_stats); if (!svc->stats.cpustats) goto out_err; /* I'm the first user of the service */ atomic_set(&svc->usecnt, 0); atomic_set(&svc->refcnt, 0); svc->af = u->af; svc->protocol = u->protocol; ip_vs_addr_copy(svc->af, &svc->addr, &u->addr); svc->port = u->port; svc->fwmark = u->fwmark; svc->flags = u->flags; svc->timeout = u->timeout * HZ; svc->netmask = u->netmask; svc->net = net; INIT_LIST_HEAD(&svc->destinations); rwlock_init(&svc->sched_lock); spin_lock_init(&svc->stats.lock); /* Bind the scheduler */ ret = ip_vs_bind_scheduler(svc, sched); if (ret) goto out_err; sched = NULL; /* Bind the ct retriever */ ip_vs_bind_pe(svc, pe); pe = NULL; /* Update the virtual service counters */ if (svc->port == FTPPORT) atomic_inc(&ipvs->ftpsvc_counter); else if (svc->port == 0) atomic_inc(&ipvs->nullsvc_counter); ip_vs_start_estimator(net, &svc->stats); /* Count only IPv4 services for old get/setsockopt interface */ if (svc->af == AF_INET) ipvs->num_services++; /* Hash the service into the service table */ write_lock_bh(&__ip_vs_svc_lock); ip_vs_svc_hash(svc); write_unlock_bh(&__ip_vs_svc_lock); *svc_p = svc; /* Now there is a service - full throttle */ ipvs->enable = 1; return 0; out_err: if (svc != NULL) { ip_vs_unbind_scheduler(svc); if (svc->inc) { local_bh_disable(); ip_vs_app_inc_put(svc->inc); local_bh_enable(); } if (svc->stats.cpustats) free_percpu(svc->stats.cpustats); kfree(svc); } ip_vs_scheduler_put(sched); ip_vs_pe_put(pe); /* decrease the module use count */ ip_vs_use_count_dec(); return ret; }
C
linux
0
CVE-2016-2476
https://www.cvedetails.com/cve/CVE-2016-2476/
CWE-119
https://android.googlesource.com/platform/frameworks/av/+/94d9e646454f6246bf823b6897bd6aea5f08eda3
94d9e646454f6246bf823b6897bd6aea5f08eda3
Fix initialization of AAC presentation struct Otherwise the new size checks trip on this. Bug: 27207275 Change-Id: I1f8f01097e3a88ff041b69279a6121be842f1766
status_t ACodec::setupH263EncoderParameters(const sp<AMessage> &msg) { int32_t bitrate, iFrameInterval; if (!msg->findInt32("bitrate", &bitrate) || !msg->findInt32("i-frame-interval", &iFrameInterval)) { return INVALID_OPERATION; } OMX_VIDEO_CONTROLRATETYPE bitrateMode = getBitrateMode(msg); float frameRate; if (!msg->findFloat("frame-rate", &frameRate)) { int32_t tmp; if (!msg->findInt32("frame-rate", &tmp)) { return INVALID_OPERATION; } frameRate = (float)tmp; } OMX_VIDEO_PARAM_H263TYPE h263type; InitOMXParams(&h263type); h263type.nPortIndex = kPortIndexOutput; status_t err = mOMX->getParameter( mNode, OMX_IndexParamVideoH263, &h263type, sizeof(h263type)); if (err != OK) { return err; } h263type.nAllowedPictureTypes = OMX_VIDEO_PictureTypeI | OMX_VIDEO_PictureTypeP; h263type.nPFrames = setPFramesSpacing(iFrameInterval, frameRate); if (h263type.nPFrames == 0) { h263type.nAllowedPictureTypes = OMX_VIDEO_PictureTypeI; } h263type.nBFrames = 0; int32_t profile; if (msg->findInt32("profile", &profile)) { int32_t level; if (!msg->findInt32("level", &level)) { return INVALID_OPERATION; } err = verifySupportForProfileAndLevel(profile, level); if (err != OK) { return err; } h263type.eProfile = static_cast<OMX_VIDEO_H263PROFILETYPE>(profile); h263type.eLevel = static_cast<OMX_VIDEO_H263LEVELTYPE>(level); } h263type.bPLUSPTYPEAllowed = OMX_FALSE; h263type.bForceRoundingTypeToZero = OMX_FALSE; h263type.nPictureHeaderRepetition = 0; h263type.nGOBHeaderInterval = 0; err = mOMX->setParameter( mNode, OMX_IndexParamVideoH263, &h263type, sizeof(h263type)); if (err != OK) { return err; } err = configureBitrate(bitrate, bitrateMode); if (err != OK) { return err; } return setupErrorCorrectionParameters(); }
status_t ACodec::setupH263EncoderParameters(const sp<AMessage> &msg) { int32_t bitrate, iFrameInterval; if (!msg->findInt32("bitrate", &bitrate) || !msg->findInt32("i-frame-interval", &iFrameInterval)) { return INVALID_OPERATION; } OMX_VIDEO_CONTROLRATETYPE bitrateMode = getBitrateMode(msg); float frameRate; if (!msg->findFloat("frame-rate", &frameRate)) { int32_t tmp; if (!msg->findInt32("frame-rate", &tmp)) { return INVALID_OPERATION; } frameRate = (float)tmp; } OMX_VIDEO_PARAM_H263TYPE h263type; InitOMXParams(&h263type); h263type.nPortIndex = kPortIndexOutput; status_t err = mOMX->getParameter( mNode, OMX_IndexParamVideoH263, &h263type, sizeof(h263type)); if (err != OK) { return err; } h263type.nAllowedPictureTypes = OMX_VIDEO_PictureTypeI | OMX_VIDEO_PictureTypeP; h263type.nPFrames = setPFramesSpacing(iFrameInterval, frameRate); if (h263type.nPFrames == 0) { h263type.nAllowedPictureTypes = OMX_VIDEO_PictureTypeI; } h263type.nBFrames = 0; int32_t profile; if (msg->findInt32("profile", &profile)) { int32_t level; if (!msg->findInt32("level", &level)) { return INVALID_OPERATION; } err = verifySupportForProfileAndLevel(profile, level); if (err != OK) { return err; } h263type.eProfile = static_cast<OMX_VIDEO_H263PROFILETYPE>(profile); h263type.eLevel = static_cast<OMX_VIDEO_H263LEVELTYPE>(level); } h263type.bPLUSPTYPEAllowed = OMX_FALSE; h263type.bForceRoundingTypeToZero = OMX_FALSE; h263type.nPictureHeaderRepetition = 0; h263type.nGOBHeaderInterval = 0; err = mOMX->setParameter( mNode, OMX_IndexParamVideoH263, &h263type, sizeof(h263type)); if (err != OK) { return err; } err = configureBitrate(bitrate, bitrateMode); if (err != OK) { return err; } return setupErrorCorrectionParameters(); }
C
Android
0
CVE-2013-0837
https://www.cvedetails.com/cve/CVE-2013-0837/
CWE-20
https://github.com/chromium/chromium/commit/d333e22282bd4bdaa2864980cd45c272f206a44c
d333e22282bd4bdaa2864980cd45c272f206a44c
[BlackBerry] GraphicsLayer: rename notifySyncRequired to notifyFlushRequired https://bugs.webkit.org/show_bug.cgi?id=111997 Patch by Alberto Garcia <[email protected]> on 2013-03-11 Reviewed by Rob Buis. This changed in r130439 but the old name was introduced again by mistake in r144465. * platform/graphics/blackberry/GraphicsLayerBlackBerry.h: (WebCore::GraphicsLayerBlackBerry::notifyFlushRequired): * platform/graphics/blackberry/LayerWebKitThread.cpp: (WebCore::LayerWebKitThread::setNeedsCommit): git-svn-id: svn://svn.chromium.org/blink/trunk@145363 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void LayerWebKitThread::notifyAnimationsStarted(double time) { if (m_didStartAnimations) { m_didStartAnimations = false; if (m_owner) m_owner->notifyAnimationStarted(time); } size_t listSize = m_sublayers.size(); for (size_t i = 0; i < listSize; ++i) m_sublayers[i]->notifyAnimationsStarted(time); listSize = m_overlays.size(); for (size_t i = 0; i < listSize; ++i) m_overlays[i]->notifyAnimationsStarted(time); }
void LayerWebKitThread::notifyAnimationsStarted(double time) { if (m_didStartAnimations) { m_didStartAnimations = false; if (m_owner) m_owner->notifyAnimationStarted(time); } size_t listSize = m_sublayers.size(); for (size_t i = 0; i < listSize; ++i) m_sublayers[i]->notifyAnimationsStarted(time); listSize = m_overlays.size(); for (size_t i = 0; i < listSize; ++i) m_overlays[i]->notifyAnimationsStarted(time); }
C
Chrome
0
CVE-2012-3520
https://www.cvedetails.com/cve/CVE-2012-3520/
CWE-287
https://github.com/torvalds/linux/commit/e0e3cea46d31d23dc40df0a49a7a2c04fe8edfea
e0e3cea46d31d23dc40df0a49a7a2c04fe8edfea
af_netlink: force credentials passing [CVE-2012-3520] Pablo Neira Ayuso discovered that avahi and potentially NetworkManager accept spoofed Netlink messages because of a kernel bug. The kernel passes all-zero SCM_CREDENTIALS ancillary data to the receiver if the sender did not provide such data, instead of not including any such data at all or including the correct data from the peer (as it is the case with AF_UNIX). This bug was introduced in commit 16e572626961 (af_unix: dont send SCM_CREDENTIALS by default) This patch forces passing credentials for netlink, as before the regression. Another fix would be to not add SCM_CREDENTIALS in netlink messages if not provided by the sender, but it might break some programs. With help from Florian Weimer & Petr Matousek This issue is designated as CVE-2012-3520 Signed-off-by: Eric Dumazet <[email protected]> Cc: Petr Matousek <[email protected]> Cc: Florian Weimer <[email protected]> Cc: Pablo Neira Ayuso <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, poll_table *wait) { struct sock *sk = sock->sk, *other; unsigned int mask, writable; sock_poll_wait(file, sk_sleep(sk), wait); mask = 0; /* exceptional events? */ if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) mask |= POLLERR; if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= POLLRDHUP | POLLIN | POLLRDNORM; if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= POLLHUP; /* readable? */ if (!skb_queue_empty(&sk->sk_receive_queue)) mask |= POLLIN | POLLRDNORM; /* Connection-based need to check for termination and startup */ if (sk->sk_type == SOCK_SEQPACKET) { if (sk->sk_state == TCP_CLOSE) mask |= POLLHUP; /* connection hasn't started yet? */ if (sk->sk_state == TCP_SYN_SENT) return mask; } /* No write status requested, avoid expensive OUT tests. */ if (!(poll_requested_events(wait) & (POLLWRBAND|POLLWRNORM|POLLOUT))) return mask; writable = unix_writable(sk); other = unix_peer_get(sk); if (other) { if (unix_peer(other) != sk) { sock_poll_wait(file, &unix_sk(other)->peer_wait, wait); if (unix_recvq_full(other)) writable = 0; } sock_put(other); } if (writable) mask |= POLLOUT | POLLWRNORM | POLLWRBAND; else set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); return mask; }
static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, poll_table *wait) { struct sock *sk = sock->sk, *other; unsigned int mask, writable; sock_poll_wait(file, sk_sleep(sk), wait); mask = 0; /* exceptional events? */ if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) mask |= POLLERR; if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= POLLRDHUP | POLLIN | POLLRDNORM; if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= POLLHUP; /* readable? */ if (!skb_queue_empty(&sk->sk_receive_queue)) mask |= POLLIN | POLLRDNORM; /* Connection-based need to check for termination and startup */ if (sk->sk_type == SOCK_SEQPACKET) { if (sk->sk_state == TCP_CLOSE) mask |= POLLHUP; /* connection hasn't started yet? */ if (sk->sk_state == TCP_SYN_SENT) return mask; } /* No write status requested, avoid expensive OUT tests. */ if (!(poll_requested_events(wait) & (POLLWRBAND|POLLWRNORM|POLLOUT))) return mask; writable = unix_writable(sk); other = unix_peer_get(sk); if (other) { if (unix_peer(other) != sk) { sock_poll_wait(file, &unix_sk(other)->peer_wait, wait); if (unix_recvq_full(other)) writable = 0; } sock_put(other); } if (writable) mask |= POLLOUT | POLLWRNORM | POLLWRBAND; else set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); return mask; }
C
linux
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
GLenum GLES2DecoderImpl::DoCheckFramebufferStatus(GLenum target) { Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); if (!framebuffer) { return GL_FRAMEBUFFER_COMPLETE; } GLenum completeness = framebuffer->IsPossiblyComplete(); if (completeness != GL_FRAMEBUFFER_COMPLETE) { return completeness; } return framebuffer->GetStatus(texture_manager(), target); }
GLenum GLES2DecoderImpl::DoCheckFramebufferStatus(GLenum target) { Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); if (!framebuffer) { return GL_FRAMEBUFFER_COMPLETE; } GLenum completeness = framebuffer->IsPossiblyComplete(); if (completeness != GL_FRAMEBUFFER_COMPLETE) { return completeness; } return framebuffer->GetStatus(texture_manager(), target); }
C
Chrome
0
CVE-2011-5321
https://www.cvedetails.com/cve/CVE-2011-5321/
null
https://github.com/torvalds/linux/commit/c290f8358acaeffd8e0c551ddcc24d1206143376
c290f8358acaeffd8e0c551ddcc24d1206143376
TTY: drop driver reference in tty_open fail path When tty_driver_lookup_tty fails in tty_open, we forget to drop a reference to the tty driver. This was added by commit 4a2b5fddd5 (Move tty lookup/reopen to caller). Fix that by adding tty_driver_kref_put to the fail path. I will refactor the code later. This is for the ease of backporting to stable. Introduced-in: v2.6.28-rc2 Signed-off-by: Jiri Slaby <[email protected]> Cc: stable <[email protected]> Cc: Alan Cox <[email protected]> Acked-by: Sukadev Bhattiprolu <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
void disassociate_ctty(int on_exit) { struct tty_struct *tty; struct pid *tty_pgrp = NULL; if (!current->signal->leader) return; tty = get_current_tty(); if (tty) { tty_pgrp = get_pid(tty->pgrp); if (on_exit) { if (tty->driver->type != TTY_DRIVER_TYPE_PTY) tty_vhangup(tty); } tty_kref_put(tty); } else if (on_exit) { struct pid *old_pgrp; spin_lock_irq(&current->sighand->siglock); old_pgrp = current->signal->tty_old_pgrp; current->signal->tty_old_pgrp = NULL; spin_unlock_irq(&current->sighand->siglock); if (old_pgrp) { kill_pgrp(old_pgrp, SIGHUP, on_exit); kill_pgrp(old_pgrp, SIGCONT, on_exit); put_pid(old_pgrp); } return; } if (tty_pgrp) { kill_pgrp(tty_pgrp, SIGHUP, on_exit); if (!on_exit) kill_pgrp(tty_pgrp, SIGCONT, on_exit); put_pid(tty_pgrp); } spin_lock_irq(&current->sighand->siglock); put_pid(current->signal->tty_old_pgrp); current->signal->tty_old_pgrp = NULL; spin_unlock_irq(&current->sighand->siglock); tty = get_current_tty(); if (tty) { unsigned long flags; spin_lock_irqsave(&tty->ctrl_lock, flags); put_pid(tty->session); put_pid(tty->pgrp); tty->session = NULL; tty->pgrp = NULL; spin_unlock_irqrestore(&tty->ctrl_lock, flags); tty_kref_put(tty); } else { #ifdef TTY_DEBUG_HANGUP printk(KERN_DEBUG "error attempted to write to tty [0x%p]" " = NULL", tty); #endif } /* Now clear signal->tty under the lock */ read_lock(&tasklist_lock); session_clear_tty(task_session(current)); read_unlock(&tasklist_lock); }
void disassociate_ctty(int on_exit) { struct tty_struct *tty; struct pid *tty_pgrp = NULL; if (!current->signal->leader) return; tty = get_current_tty(); if (tty) { tty_pgrp = get_pid(tty->pgrp); if (on_exit) { if (tty->driver->type != TTY_DRIVER_TYPE_PTY) tty_vhangup(tty); } tty_kref_put(tty); } else if (on_exit) { struct pid *old_pgrp; spin_lock_irq(&current->sighand->siglock); old_pgrp = current->signal->tty_old_pgrp; current->signal->tty_old_pgrp = NULL; spin_unlock_irq(&current->sighand->siglock); if (old_pgrp) { kill_pgrp(old_pgrp, SIGHUP, on_exit); kill_pgrp(old_pgrp, SIGCONT, on_exit); put_pid(old_pgrp); } return; } if (tty_pgrp) { kill_pgrp(tty_pgrp, SIGHUP, on_exit); if (!on_exit) kill_pgrp(tty_pgrp, SIGCONT, on_exit); put_pid(tty_pgrp); } spin_lock_irq(&current->sighand->siglock); put_pid(current->signal->tty_old_pgrp); current->signal->tty_old_pgrp = NULL; spin_unlock_irq(&current->sighand->siglock); tty = get_current_tty(); if (tty) { unsigned long flags; spin_lock_irqsave(&tty->ctrl_lock, flags); put_pid(tty->session); put_pid(tty->pgrp); tty->session = NULL; tty->pgrp = NULL; spin_unlock_irqrestore(&tty->ctrl_lock, flags); tty_kref_put(tty); } else { #ifdef TTY_DEBUG_HANGUP printk(KERN_DEBUG "error attempted to write to tty [0x%p]" " = NULL", tty); #endif } /* Now clear signal->tty under the lock */ read_lock(&tasklist_lock); session_clear_tty(task_session(current)); read_unlock(&tasklist_lock); }
C
linux
0
CVE-2013-6630
https://www.cvedetails.com/cve/CVE-2013-6630/
CWE-189
https://github.com/chromium/chromium/commit/805eabb91d386c86bd64336c7643f6dfa864151d
805eabb91d386c86bd64336c7643f6dfa864151d
Convert ARRAYSIZE_UNSAFE -> arraysize in base/. [email protected] BUG=423134 Review URL: https://codereview.chromium.org/656033009 Cr-Commit-Position: refs/heads/master@{#299835}
const FilePath& test_dir_path() const { return dir_.path(); }
const FilePath& test_dir_path() const { return dir_.path(); }
C
Chrome
0
CVE-2018-1066
https://www.cvedetails.com/cve/CVE-2018-1066/
CWE-476
https://github.com/torvalds/linux/commit/cabfb3680f78981d26c078a26e5c748531257ebb
cabfb3680f78981d26c078a26e5c748531257ebb
CIFS: Enable encryption during session setup phase In order to allow encryption on SMB connection we need to exchange a session key and generate encryption and decryption keys. Signed-off-by: Pavel Shilovsky <[email protected]>
sess_auth_kerberos(struct sess_data *sess_data) { int rc = 0; struct smb_hdr *smb_buf; SESSION_SETUP_ANDX *pSMB; char *bcc_ptr; struct cifs_ses *ses = sess_data->ses; __u32 capabilities; __u16 bytes_remaining; struct key *spnego_key = NULL; struct cifs_spnego_msg *msg; u16 blob_len; /* extended security */ /* wct = 12 */ rc = sess_alloc_buffer(sess_data, 12); if (rc) goto out; pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; bcc_ptr = sess_data->iov[2].iov_base; capabilities = cifs_ssetup_hdr(ses, pSMB); spnego_key = cifs_get_spnego_key(ses); if (IS_ERR(spnego_key)) { rc = PTR_ERR(spnego_key); spnego_key = NULL; goto out; } msg = spnego_key->payload.data[0]; /* * check version field to make sure that cifs.upcall is * sending us a response in an expected form */ if (msg->version != CIFS_SPNEGO_UPCALL_VERSION) { cifs_dbg(VFS, "incorrect version of cifs.upcall (expected %d but got %d)", CIFS_SPNEGO_UPCALL_VERSION, msg->version); rc = -EKEYREJECTED; goto out_put_spnego_key; } ses->auth_key.response = kmemdup(msg->data, msg->sesskey_len, GFP_KERNEL); if (!ses->auth_key.response) { cifs_dbg(VFS, "Kerberos can't allocate (%u bytes) memory", msg->sesskey_len); rc = -ENOMEM; goto out_put_spnego_key; } ses->auth_key.len = msg->sesskey_len; pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC; capabilities |= CAP_EXTENDED_SECURITY; pSMB->req.Capabilities = cpu_to_le32(capabilities); sess_data->iov[1].iov_base = msg->data + msg->sesskey_len; sess_data->iov[1].iov_len = msg->secblob_len; pSMB->req.SecurityBlobLength = cpu_to_le16(sess_data->iov[1].iov_len); if (ses->capabilities & CAP_UNICODE) { /* unicode strings must be word aligned */ if ((sess_data->iov[0].iov_len + sess_data->iov[1].iov_len) % 2) { *bcc_ptr = 0; bcc_ptr++; } unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp); unicode_domain_string(&bcc_ptr, ses, sess_data->nls_cp); } else { /* BB: is this right? */ ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); } sess_data->iov[2].iov_len = (long) bcc_ptr - (long) sess_data->iov[2].iov_base; rc = sess_sendreceive(sess_data); if (rc) goto out_put_spnego_key; pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; if (smb_buf->WordCount != 4) { rc = -EIO; cifs_dbg(VFS, "bad word count %d\n", smb_buf->WordCount); goto out_put_spnego_key; } if (le16_to_cpu(pSMB->resp.Action) & GUEST_LOGIN) cifs_dbg(FYI, "Guest login\n"); /* BB mark SesInfo struct? */ ses->Suid = smb_buf->Uid; /* UID left in wire format (le) */ cifs_dbg(FYI, "UID = %llu\n", ses->Suid); bytes_remaining = get_bcc(smb_buf); bcc_ptr = pByteArea(smb_buf); blob_len = le16_to_cpu(pSMB->resp.SecurityBlobLength); if (blob_len > bytes_remaining) { cifs_dbg(VFS, "bad security blob length %d\n", blob_len); rc = -EINVAL; goto out_put_spnego_key; } bcc_ptr += blob_len; bytes_remaining -= blob_len; /* BB check if Unicode and decode strings */ if (bytes_remaining == 0) { /* no string area to decode, do nothing */ } else if (smb_buf->Flags2 & SMBFLG2_UNICODE) { /* unicode string area must be word-aligned */ if (((unsigned long) bcc_ptr - (unsigned long) smb_buf) % 2) { ++bcc_ptr; --bytes_remaining; } decode_unicode_ssetup(&bcc_ptr, bytes_remaining, ses, sess_data->nls_cp); } else { decode_ascii_ssetup(&bcc_ptr, bytes_remaining, ses, sess_data->nls_cp); } rc = sess_establish_session(sess_data); out_put_spnego_key: key_invalidate(spnego_key); key_put(spnego_key); out: sess_data->result = rc; sess_data->func = NULL; sess_free_buffer(sess_data); kfree(ses->auth_key.response); ses->auth_key.response = NULL; }
sess_auth_kerberos(struct sess_data *sess_data) { int rc = 0; struct smb_hdr *smb_buf; SESSION_SETUP_ANDX *pSMB; char *bcc_ptr; struct cifs_ses *ses = sess_data->ses; __u32 capabilities; __u16 bytes_remaining; struct key *spnego_key = NULL; struct cifs_spnego_msg *msg; u16 blob_len; /* extended security */ /* wct = 12 */ rc = sess_alloc_buffer(sess_data, 12); if (rc) goto out; pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; bcc_ptr = sess_data->iov[2].iov_base; capabilities = cifs_ssetup_hdr(ses, pSMB); spnego_key = cifs_get_spnego_key(ses); if (IS_ERR(spnego_key)) { rc = PTR_ERR(spnego_key); spnego_key = NULL; goto out; } msg = spnego_key->payload.data[0]; /* * check version field to make sure that cifs.upcall is * sending us a response in an expected form */ if (msg->version != CIFS_SPNEGO_UPCALL_VERSION) { cifs_dbg(VFS, "incorrect version of cifs.upcall (expected %d but got %d)", CIFS_SPNEGO_UPCALL_VERSION, msg->version); rc = -EKEYREJECTED; goto out_put_spnego_key; } ses->auth_key.response = kmemdup(msg->data, msg->sesskey_len, GFP_KERNEL); if (!ses->auth_key.response) { cifs_dbg(VFS, "Kerberos can't allocate (%u bytes) memory", msg->sesskey_len); rc = -ENOMEM; goto out_put_spnego_key; } ses->auth_key.len = msg->sesskey_len; pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC; capabilities |= CAP_EXTENDED_SECURITY; pSMB->req.Capabilities = cpu_to_le32(capabilities); sess_data->iov[1].iov_base = msg->data + msg->sesskey_len; sess_data->iov[1].iov_len = msg->secblob_len; pSMB->req.SecurityBlobLength = cpu_to_le16(sess_data->iov[1].iov_len); if (ses->capabilities & CAP_UNICODE) { /* unicode strings must be word aligned */ if ((sess_data->iov[0].iov_len + sess_data->iov[1].iov_len) % 2) { *bcc_ptr = 0; bcc_ptr++; } unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp); unicode_domain_string(&bcc_ptr, ses, sess_data->nls_cp); } else { /* BB: is this right? */ ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); } sess_data->iov[2].iov_len = (long) bcc_ptr - (long) sess_data->iov[2].iov_base; rc = sess_sendreceive(sess_data); if (rc) goto out_put_spnego_key; pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; if (smb_buf->WordCount != 4) { rc = -EIO; cifs_dbg(VFS, "bad word count %d\n", smb_buf->WordCount); goto out_put_spnego_key; } if (le16_to_cpu(pSMB->resp.Action) & GUEST_LOGIN) cifs_dbg(FYI, "Guest login\n"); /* BB mark SesInfo struct? */ ses->Suid = smb_buf->Uid; /* UID left in wire format (le) */ cifs_dbg(FYI, "UID = %llu\n", ses->Suid); bytes_remaining = get_bcc(smb_buf); bcc_ptr = pByteArea(smb_buf); blob_len = le16_to_cpu(pSMB->resp.SecurityBlobLength); if (blob_len > bytes_remaining) { cifs_dbg(VFS, "bad security blob length %d\n", blob_len); rc = -EINVAL; goto out_put_spnego_key; } bcc_ptr += blob_len; bytes_remaining -= blob_len; /* BB check if Unicode and decode strings */ if (bytes_remaining == 0) { /* no string area to decode, do nothing */ } else if (smb_buf->Flags2 & SMBFLG2_UNICODE) { /* unicode string area must be word-aligned */ if (((unsigned long) bcc_ptr - (unsigned long) smb_buf) % 2) { ++bcc_ptr; --bytes_remaining; } decode_unicode_ssetup(&bcc_ptr, bytes_remaining, ses, sess_data->nls_cp); } else { decode_ascii_ssetup(&bcc_ptr, bytes_remaining, ses, sess_data->nls_cp); } rc = sess_establish_session(sess_data); out_put_spnego_key: key_invalidate(spnego_key); key_put(spnego_key); out: sess_data->result = rc; sess_data->func = NULL; sess_free_buffer(sess_data); kfree(ses->auth_key.response); ses->auth_key.response = NULL; }
C
linux
0
CVE-2018-17204
https://www.cvedetails.com/cve/CVE-2018-17204/
CWE-617
https://github.com/openvswitch/ovs/commit/4af6da3b275b764b1afe194df6499b33d2bf4cde
4af6da3b275b764b1afe194df6499b33d2bf4cde
ofp-group: Don't assert-fail decoding bad OF1.5 group mod type or command. When decoding a group mod, the current code validates the group type and command after the whole group mod has been decoded. The OF1.5 decoder, however, tries to use the type and command earlier, when it might still be invalid. This caused an assertion failure (via OVS_NOT_REACHED). This commit fixes the problem. ovs-vswitchd does not enable support for OpenFlow 1.5 by default. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9249 Signed-off-by: Ben Pfaff <[email protected]> Reviewed-by: Yifeng Sun <[email protected]>
ofputil_decode_ofp13_table_stats(struct ofpbuf *msg, struct ofputil_table_stats *stats, struct ofputil_table_features *features) { struct ofp13_table_stats *ots; ots = ofpbuf_try_pull(msg, sizeof *ots); if (!ots) { return OFPERR_OFPBRC_BAD_LEN; } features->table_id = ots->table_id; stats->table_id = ots->table_id; stats->active_count = ntohl(ots->active_count); stats->lookup_count = ntohll(ots->lookup_count); stats->matched_count = ntohll(ots->matched_count); return 0; }
ofputil_decode_ofp13_table_stats(struct ofpbuf *msg, struct ofputil_table_stats *stats, struct ofputil_table_features *features) { struct ofp13_table_stats *ots; ots = ofpbuf_try_pull(msg, sizeof *ots); if (!ots) { return OFPERR_OFPBRC_BAD_LEN; } features->table_id = ots->table_id; stats->table_id = ots->table_id; stats->active_count = ntohl(ots->active_count); stats->lookup_count = ntohll(ots->lookup_count); stats->matched_count = ntohll(ots->matched_count); return 0; }
C
ovs
0
CVE-2014-8109
https://www.cvedetails.com/cve/CVE-2014-8109/
CWE-264
https://github.com/apache/httpd/commit/3f1693d558d0758f829c8b53993f1749ddf6ffcb
3f1693d558d0758f829c8b53993f1749ddf6ffcb
Merge r1642499 from trunk: *) SECURITY: CVE-2014-8109 (cve.mitre.org) mod_lua: Fix handling of the Require line when a LuaAuthzProvider is used in multiple Require directives with different arguments. PR57204 [Edward Lu <Chaosed0 gmail.com>] Submitted By: Edward Lu Committed By: covener Submitted by: covener Reviewed/backported by: jim git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1642861 13f79535-47bb-0310-9956-ffa450edef68
static int lua_map_handler(request_rec *r) { int rc, n = 0; apr_pool_t *pool; lua_State *L; const char *filename, *function_name; const char *values[10]; ap_lua_vm_spec *spec; ap_regmatch_t match[10]; ap_lua_server_cfg *server_cfg = ap_get_module_config(r->server->module_config, &lua_module); const ap_lua_dir_cfg *cfg = ap_get_module_config(r->per_dir_config, &lua_module); for (n = 0; n < cfg->mapped_handlers->nelts; n++) { ap_lua_mapped_handler_spec *hook_spec = ((ap_lua_mapped_handler_spec **) cfg->mapped_handlers->elts)[n]; if (hook_spec == NULL) { continue; } if (!ap_regexec(hook_spec->uri_pattern, r->uri, 10, match, 0)) { int i; for (i=0 ; i < 10; i++) { if (match[i].rm_eo >= 0) { values[i] = apr_pstrndup(r->pool, r->uri+match[i].rm_so, match[i].rm_eo - match[i].rm_so); } else values[i] = ""; } filename = ap_lua_interpolate_string(r->pool, hook_spec->file_name, values); function_name = ap_lua_interpolate_string(r->pool, hook_spec->function_name, values); spec = create_vm_spec(&pool, r, cfg, server_cfg, filename, hook_spec->bytecode, hook_spec->bytecode_len, function_name, "mapped handler"); L = ap_lua_get_lua_state(pool, spec, r); if (!L) { ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, APLOGNO(02330) "lua: Failed to obtain Lua interpreter for entry function '%s' in %s", function_name, filename); ap_lua_release_state(L, spec, r); return HTTP_INTERNAL_SERVER_ERROR; } if (function_name != NULL) { lua_getglobal(L, function_name); if (!lua_isfunction(L, -1)) { ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, APLOGNO(02331) "lua: Unable to find entry function '%s' in %s (not a valid function)", function_name, filename); ap_lua_release_state(L, spec, r); return HTTP_INTERNAL_SERVER_ERROR; } ap_lua_run_lua_request(L, r); } else { int t; ap_lua_run_lua_request(L, r); t = lua_gettop(L); lua_setglobal(L, "r"); lua_settop(L, t); } if (lua_pcall(L, 1, 1, 0)) { report_lua_error(L, r); ap_lua_release_state(L, spec, r); return HTTP_INTERNAL_SERVER_ERROR; } rc = DECLINED; if (lua_isnumber(L, -1)) { rc = lua_tointeger(L, -1); } else { ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02483) "lua: Lua handler %s in %s did not return a value, assuming apache2.OK", function_name, filename); rc = OK; } ap_lua_release_state(L, spec, r); if (rc != DECLINED) { return rc; } } } return DECLINED; }
static int lua_map_handler(request_rec *r) { int rc, n = 0; apr_pool_t *pool; lua_State *L; const char *filename, *function_name; const char *values[10]; ap_lua_vm_spec *spec; ap_regmatch_t match[10]; ap_lua_server_cfg *server_cfg = ap_get_module_config(r->server->module_config, &lua_module); const ap_lua_dir_cfg *cfg = ap_get_module_config(r->per_dir_config, &lua_module); for (n = 0; n < cfg->mapped_handlers->nelts; n++) { ap_lua_mapped_handler_spec *hook_spec = ((ap_lua_mapped_handler_spec **) cfg->mapped_handlers->elts)[n]; if (hook_spec == NULL) { continue; } if (!ap_regexec(hook_spec->uri_pattern, r->uri, 10, match, 0)) { int i; for (i=0 ; i < 10; i++) { if (match[i].rm_eo >= 0) { values[i] = apr_pstrndup(r->pool, r->uri+match[i].rm_so, match[i].rm_eo - match[i].rm_so); } else values[i] = ""; } filename = ap_lua_interpolate_string(r->pool, hook_spec->file_name, values); function_name = ap_lua_interpolate_string(r->pool, hook_spec->function_name, values); spec = create_vm_spec(&pool, r, cfg, server_cfg, filename, hook_spec->bytecode, hook_spec->bytecode_len, function_name, "mapped handler"); L = ap_lua_get_lua_state(pool, spec, r); if (!L) { ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, APLOGNO(02330) "lua: Failed to obtain Lua interpreter for entry function '%s' in %s", function_name, filename); ap_lua_release_state(L, spec, r); return HTTP_INTERNAL_SERVER_ERROR; } if (function_name != NULL) { lua_getglobal(L, function_name); if (!lua_isfunction(L, -1)) { ap_log_rerror(APLOG_MARK, APLOG_CRIT, 0, r, APLOGNO(02331) "lua: Unable to find entry function '%s' in %s (not a valid function)", function_name, filename); ap_lua_release_state(L, spec, r); return HTTP_INTERNAL_SERVER_ERROR; } ap_lua_run_lua_request(L, r); } else { int t; ap_lua_run_lua_request(L, r); t = lua_gettop(L); lua_setglobal(L, "r"); lua_settop(L, t); } if (lua_pcall(L, 1, 1, 0)) { report_lua_error(L, r); ap_lua_release_state(L, spec, r); return HTTP_INTERNAL_SERVER_ERROR; } rc = DECLINED; if (lua_isnumber(L, -1)) { rc = lua_tointeger(L, -1); } else { ap_log_rerror(APLOG_MARK, APLOG_WARNING, 0, r, APLOGNO(02483) "lua: Lua handler %s in %s did not return a value, assuming apache2.OK", function_name, filename); rc = OK; } ap_lua_release_state(L, spec, r); if (rc != DECLINED) { return rc; } } } return DECLINED; }
C
httpd
0
CVE-2017-15115
https://www.cvedetails.com/cve/CVE-2017-15115/
CWE-416
https://github.com/torvalds/linux/commit/df80cd9b28b9ebaa284a41df611dbf3a2d05ca74
df80cd9b28b9ebaa284a41df611dbf3a2d05ca74
sctp: do not peel off an assoc from one netns to another one Now when peeling off an association to the sock in another netns, all transports in this assoc are not to be rehashed and keep use the old key in hashtable. As a transport uses sk->net as the hash key to insert into hashtable, it would miss removing these transports from hashtable due to the new netns when closing the sock and all transports are being freeed, then later an use-after-free issue could be caused when looking up an asoc and dereferencing those transports. This is a very old issue since very beginning, ChunYu found it with syzkaller fuzz testing with this series: socket$inet6_sctp() bind$inet6() sendto$inet6() unshare(0x40000000) getsockopt$inet_sctp6_SCTP_GET_ASSOC_ID_LIST() getsockopt$inet_sctp6_SCTP_SOCKOPT_PEELOFF() This patch is to block this call when peeling one assoc off from one netns to another one, so that the netns of all transport would not go out-sync with the key in hashtable. Note that this patch didn't fix it by rehashing transports, as it's difficult to handle the situation when the tuple is already in use in the new netns. Besides, no one would like to peel off one assoc to another netns, considering ipaddrs, ifaces, etc. are usually different. Reported-by: ChunYu Wang <[email protected]> Signed-off-by: Xin Long <[email protected]> Acked-by: Marcelo Ricardo Leitner <[email protected]> Acked-by: Neil Horman <[email protected]> Signed-off-by: David S. Miller <[email protected]>
int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc, struct sctp_info *info) { struct sctp_transport *prim; struct list_head *pos; int mask; memset(info, 0, sizeof(*info)); if (!asoc) { struct sctp_sock *sp = sctp_sk(sk); info->sctpi_s_autoclose = sp->autoclose; info->sctpi_s_adaptation_ind = sp->adaptation_ind; info->sctpi_s_pd_point = sp->pd_point; info->sctpi_s_nodelay = sp->nodelay; info->sctpi_s_disable_fragments = sp->disable_fragments; info->sctpi_s_v4mapped = sp->v4mapped; info->sctpi_s_frag_interleave = sp->frag_interleave; info->sctpi_s_type = sp->type; return 0; } info->sctpi_tag = asoc->c.my_vtag; info->sctpi_state = asoc->state; info->sctpi_rwnd = asoc->a_rwnd; info->sctpi_unackdata = asoc->unack_data; info->sctpi_penddata = sctp_tsnmap_pending(&asoc->peer.tsn_map); info->sctpi_instrms = asoc->stream.incnt; info->sctpi_outstrms = asoc->stream.outcnt; list_for_each(pos, &asoc->base.inqueue.in_chunk_list) info->sctpi_inqueue++; list_for_each(pos, &asoc->outqueue.out_chunk_list) info->sctpi_outqueue++; info->sctpi_overall_error = asoc->overall_error_count; info->sctpi_max_burst = asoc->max_burst; info->sctpi_maxseg = asoc->frag_point; info->sctpi_peer_rwnd = asoc->peer.rwnd; info->sctpi_peer_tag = asoc->c.peer_vtag; mask = asoc->peer.ecn_capable << 1; mask = (mask | asoc->peer.ipv4_address) << 1; mask = (mask | asoc->peer.ipv6_address) << 1; mask = (mask | asoc->peer.hostname_address) << 1; mask = (mask | asoc->peer.asconf_capable) << 1; mask = (mask | asoc->peer.prsctp_capable) << 1; mask = (mask | asoc->peer.auth_capable); info->sctpi_peer_capable = mask; mask = asoc->peer.sack_needed << 1; mask = (mask | asoc->peer.sack_generation) << 1; mask = (mask | asoc->peer.zero_window_announced); info->sctpi_peer_sack = mask; info->sctpi_isacks = asoc->stats.isacks; info->sctpi_osacks = asoc->stats.osacks; info->sctpi_opackets = asoc->stats.opackets; info->sctpi_ipackets = asoc->stats.ipackets; info->sctpi_rtxchunks = asoc->stats.rtxchunks; info->sctpi_outofseqtsns = asoc->stats.outofseqtsns; info->sctpi_idupchunks = asoc->stats.idupchunks; info->sctpi_gapcnt = asoc->stats.gapcnt; info->sctpi_ouodchunks = asoc->stats.ouodchunks; info->sctpi_iuodchunks = asoc->stats.iuodchunks; info->sctpi_oodchunks = asoc->stats.oodchunks; info->sctpi_iodchunks = asoc->stats.iodchunks; info->sctpi_octrlchunks = asoc->stats.octrlchunks; info->sctpi_ictrlchunks = asoc->stats.ictrlchunks; prim = asoc->peer.primary_path; memcpy(&info->sctpi_p_address, &prim->ipaddr, sizeof(prim->ipaddr)); info->sctpi_p_state = prim->state; info->sctpi_p_cwnd = prim->cwnd; info->sctpi_p_srtt = prim->srtt; info->sctpi_p_rto = jiffies_to_msecs(prim->rto); info->sctpi_p_hbinterval = prim->hbinterval; info->sctpi_p_pathmaxrxt = prim->pathmaxrxt; info->sctpi_p_sackdelay = jiffies_to_msecs(prim->sackdelay); info->sctpi_p_ssthresh = prim->ssthresh; info->sctpi_p_partial_bytes_acked = prim->partial_bytes_acked; info->sctpi_p_flight_size = prim->flight_size; info->sctpi_p_error = prim->error_count; return 0; }
int sctp_get_sctp_info(struct sock *sk, struct sctp_association *asoc, struct sctp_info *info) { struct sctp_transport *prim; struct list_head *pos; int mask; memset(info, 0, sizeof(*info)); if (!asoc) { struct sctp_sock *sp = sctp_sk(sk); info->sctpi_s_autoclose = sp->autoclose; info->sctpi_s_adaptation_ind = sp->adaptation_ind; info->sctpi_s_pd_point = sp->pd_point; info->sctpi_s_nodelay = sp->nodelay; info->sctpi_s_disable_fragments = sp->disable_fragments; info->sctpi_s_v4mapped = sp->v4mapped; info->sctpi_s_frag_interleave = sp->frag_interleave; info->sctpi_s_type = sp->type; return 0; } info->sctpi_tag = asoc->c.my_vtag; info->sctpi_state = asoc->state; info->sctpi_rwnd = asoc->a_rwnd; info->sctpi_unackdata = asoc->unack_data; info->sctpi_penddata = sctp_tsnmap_pending(&asoc->peer.tsn_map); info->sctpi_instrms = asoc->stream.incnt; info->sctpi_outstrms = asoc->stream.outcnt; list_for_each(pos, &asoc->base.inqueue.in_chunk_list) info->sctpi_inqueue++; list_for_each(pos, &asoc->outqueue.out_chunk_list) info->sctpi_outqueue++; info->sctpi_overall_error = asoc->overall_error_count; info->sctpi_max_burst = asoc->max_burst; info->sctpi_maxseg = asoc->frag_point; info->sctpi_peer_rwnd = asoc->peer.rwnd; info->sctpi_peer_tag = asoc->c.peer_vtag; mask = asoc->peer.ecn_capable << 1; mask = (mask | asoc->peer.ipv4_address) << 1; mask = (mask | asoc->peer.ipv6_address) << 1; mask = (mask | asoc->peer.hostname_address) << 1; mask = (mask | asoc->peer.asconf_capable) << 1; mask = (mask | asoc->peer.prsctp_capable) << 1; mask = (mask | asoc->peer.auth_capable); info->sctpi_peer_capable = mask; mask = asoc->peer.sack_needed << 1; mask = (mask | asoc->peer.sack_generation) << 1; mask = (mask | asoc->peer.zero_window_announced); info->sctpi_peer_sack = mask; info->sctpi_isacks = asoc->stats.isacks; info->sctpi_osacks = asoc->stats.osacks; info->sctpi_opackets = asoc->stats.opackets; info->sctpi_ipackets = asoc->stats.ipackets; info->sctpi_rtxchunks = asoc->stats.rtxchunks; info->sctpi_outofseqtsns = asoc->stats.outofseqtsns; info->sctpi_idupchunks = asoc->stats.idupchunks; info->sctpi_gapcnt = asoc->stats.gapcnt; info->sctpi_ouodchunks = asoc->stats.ouodchunks; info->sctpi_iuodchunks = asoc->stats.iuodchunks; info->sctpi_oodchunks = asoc->stats.oodchunks; info->sctpi_iodchunks = asoc->stats.iodchunks; info->sctpi_octrlchunks = asoc->stats.octrlchunks; info->sctpi_ictrlchunks = asoc->stats.ictrlchunks; prim = asoc->peer.primary_path; memcpy(&info->sctpi_p_address, &prim->ipaddr, sizeof(prim->ipaddr)); info->sctpi_p_state = prim->state; info->sctpi_p_cwnd = prim->cwnd; info->sctpi_p_srtt = prim->srtt; info->sctpi_p_rto = jiffies_to_msecs(prim->rto); info->sctpi_p_hbinterval = prim->hbinterval; info->sctpi_p_pathmaxrxt = prim->pathmaxrxt; info->sctpi_p_sackdelay = jiffies_to_msecs(prim->sackdelay); info->sctpi_p_ssthresh = prim->ssthresh; info->sctpi_p_partial_bytes_acked = prim->partial_bytes_acked; info->sctpi_p_flight_size = prim->flight_size; info->sctpi_p_error = prim->error_count; return 0; }
C
linux
0
CVE-2017-11144
https://www.cvedetails.com/cve/CVE-2017-11144/
CWE-754
https://git.php.net/?p=php-src.git;a=commit;h=89637c6b41b510c20d262c17483f582f115c66d6
89637c6b41b510c20d262c17483f582f115c66d6
null
PHP_FUNCTION(openssl_decrypt) { long options = 0; char *data, *method, *password, *iv = ""; int data_len, method_len, password_len, iv_len = 0; const EVP_CIPHER *cipher_type; EVP_CIPHER_CTX cipher_ctx; int i, outlen, keylen; unsigned char *outbuf, *key; int base64_str_len; char *base64_str = NULL; zend_bool free_iv; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ls", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) { return; } if (!method_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm"); RETURN_FALSE; } cipher_type = EVP_get_cipherbyname(method); if (!cipher_type) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm"); RETURN_FALSE; } if (!(options & OPENSSL_RAW_DATA)) { base64_str = (char*)php_base64_decode((unsigned char*)data, data_len, &base64_str_len); if (!base64_str) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to base64 decode the input"); RETURN_FALSE; } data_len = base64_str_len; data = base64_str; } keylen = EVP_CIPHER_key_length(cipher_type); if (keylen > password_len) { key = emalloc(keylen); memset(key, 0, keylen); memcpy(key, password, password_len); } else { key = (unsigned char*)password; } free_iv = php_openssl_validate_iv(&iv, &iv_len, EVP_CIPHER_iv_length(cipher_type) TSRMLS_CC); outlen = data_len + EVP_CIPHER_block_size(cipher_type); outbuf = emalloc(outlen + 1); EVP_DecryptInit(&cipher_ctx, cipher_type, NULL, NULL); if (password_len > keylen) { EVP_CIPHER_CTX_set_key_length(&cipher_ctx, password_len); } EVP_DecryptInit_ex(&cipher_ctx, NULL, NULL, key, (unsigned char *)iv); if (options & OPENSSL_ZERO_PADDING) { EVP_CIPHER_CTX_set_padding(&cipher_ctx, 0); } EVP_DecryptUpdate(&cipher_ctx, outbuf, &i, (unsigned char *)data, data_len); outlen = i; if (EVP_DecryptFinal(&cipher_ctx, (unsigned char *)outbuf + i, &i)) { outlen += i; outbuf[outlen] = '\0'; RETVAL_STRINGL((char *)outbuf, outlen, 0); } else { efree(outbuf); RETVAL_FALSE; } if (key != (unsigned char*)password) { efree(key); } if (free_iv) { efree(iv); } if (base64_str) { efree(base64_str); } EVP_CIPHER_CTX_cleanup(&cipher_ctx); }
PHP_FUNCTION(openssl_decrypt) { long options = 0; char *data, *method, *password, *iv = ""; int data_len, method_len, password_len, iv_len = 0; const EVP_CIPHER *cipher_type; EVP_CIPHER_CTX cipher_ctx; int i, outlen, keylen; unsigned char *outbuf, *key; int base64_str_len; char *base64_str = NULL; zend_bool free_iv; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sss|ls", &data, &data_len, &method, &method_len, &password, &password_len, &options, &iv, &iv_len) == FAILURE) { return; } if (!method_len) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm"); RETURN_FALSE; } cipher_type = EVP_get_cipherbyname(method); if (!cipher_type) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown cipher algorithm"); RETURN_FALSE; } if (!(options & OPENSSL_RAW_DATA)) { base64_str = (char*)php_base64_decode((unsigned char*)data, data_len, &base64_str_len); if (!base64_str) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to base64 decode the input"); RETURN_FALSE; } data_len = base64_str_len; data = base64_str; } keylen = EVP_CIPHER_key_length(cipher_type); if (keylen > password_len) { key = emalloc(keylen); memset(key, 0, keylen); memcpy(key, password, password_len); } else { key = (unsigned char*)password; } free_iv = php_openssl_validate_iv(&iv, &iv_len, EVP_CIPHER_iv_length(cipher_type) TSRMLS_CC); outlen = data_len + EVP_CIPHER_block_size(cipher_type); outbuf = emalloc(outlen + 1); EVP_DecryptInit(&cipher_ctx, cipher_type, NULL, NULL); if (password_len > keylen) { EVP_CIPHER_CTX_set_key_length(&cipher_ctx, password_len); } EVP_DecryptInit_ex(&cipher_ctx, NULL, NULL, key, (unsigned char *)iv); if (options & OPENSSL_ZERO_PADDING) { EVP_CIPHER_CTX_set_padding(&cipher_ctx, 0); } EVP_DecryptUpdate(&cipher_ctx, outbuf, &i, (unsigned char *)data, data_len); outlen = i; if (EVP_DecryptFinal(&cipher_ctx, (unsigned char *)outbuf + i, &i)) { outlen += i; outbuf[outlen] = '\0'; RETVAL_STRINGL((char *)outbuf, outlen, 0); } else { efree(outbuf); RETVAL_FALSE; } if (key != (unsigned char*)password) { efree(key); } if (free_iv) { efree(iv); } if (base64_str) { efree(base64_str); } EVP_CIPHER_CTX_cleanup(&cipher_ctx); }
C
php
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 ExtensionHelper::DidCreateDocumentElement(WebFrame* frame) { extension_dispatcher_->user_script_slave()->InjectScripts( frame, UserScript::DOCUMENT_START); }
void ExtensionHelper::DidCreateDocumentElement(WebFrame* frame) { extension_dispatcher_->user_script_slave()->InjectScripts( frame, UserScript::DOCUMENT_START); }
C
Chrome
0
CVE-2019-5799
https://www.cvedetails.com/cve/CVE-2019-5799/
CWE-20
https://github.com/chromium/chromium/commit/108147dfd1ea159fd3632ef92ccc4ab8952980c7
108147dfd1ea159fd3632ef92ccc4ab8952980c7
Inherit the navigation initiator when navigating instead of the parent/opener Spec PR: https://github.com/w3c/webappsec-csp/pull/358 Bug: 905301, 894228, 836148 Change-Id: I43ada2266d42d1cd56dbe3c6dd89d115e878a83a Reviewed-on: https://chromium-review.googlesource.com/c/1314633 Commit-Queue: Andy Paicu <[email protected]> Reviewed-by: Mike West <[email protected]> Cr-Commit-Position: refs/heads/master@{#610850}
static void GatherSecurityPolicyViolationEventData( SecurityPolicyViolationEventInit* init, ExecutionContext* context, const String& directive_text, const ContentSecurityPolicy::DirectiveType& effective_type, const KURL& blocked_url, const String& header, RedirectStatus redirect_status, ContentSecurityPolicyHeaderType header_type, ContentSecurityPolicy::ViolationType violation_type, std::unique_ptr<SourceLocation> source_location, const String& script_source) { if (effective_type == ContentSecurityPolicy::DirectiveType::kFrameAncestors) { String stripped_url = StripURLForUseInReport( context, blocked_url, RedirectStatus::kNoRedirect, ContentSecurityPolicy::DirectiveType::kDefaultSrc); init->setDocumentURI(stripped_url); init->setBlockedURI(stripped_url); } else { String stripped_url = StripURLForUseInReport( context, context->Url(), RedirectStatus::kNoRedirect, ContentSecurityPolicy::DirectiveType::kDefaultSrc); init->setDocumentURI(stripped_url); switch (violation_type) { case ContentSecurityPolicy::kInlineViolation: init->setBlockedURI("inline"); break; case ContentSecurityPolicy::kEvalViolation: init->setBlockedURI("eval"); break; case ContentSecurityPolicy::kURLViolation: init->setBlockedURI(StripURLForUseInReport( context, blocked_url, redirect_status, effective_type)); break; } } String effective_directive = ContentSecurityPolicy::GetDirectiveName(effective_type); init->setViolatedDirective(effective_directive); init->setEffectiveDirective(effective_directive); init->setOriginalPolicy(header); init->setDisposition(header_type == kContentSecurityPolicyHeaderTypeEnforce ? "enforce" : "report"); init->setStatusCode(0); if (auto* document = DynamicTo<Document>(*context)) { init->setReferrer(document->referrer()); if (!SecurityOrigin::IsSecure(context->Url()) && document->Loader()) init->setStatusCode(document->Loader()->GetResponse().HttpStatusCode()); } if (!source_location) source_location = SourceLocation::Capture(context); if (source_location->LineNumber()) { KURL source = KURL(source_location->Url()); init->setSourceFile(StripURLForUseInReport(context, source, redirect_status, effective_type)); init->setLineNumber(source_location->LineNumber()); init->setColumnNumber(source_location->ColumnNumber()); } else { init->setSourceFile(String()); init->setLineNumber(0); init->setColumnNumber(0); } if (!script_source.IsEmpty()) { init->setSample(script_source.StripWhiteSpace().Left( ContentSecurityPolicy::kMaxSampleLength)); } }
static void GatherSecurityPolicyViolationEventData( SecurityPolicyViolationEventInit* init, ExecutionContext* context, const String& directive_text, const ContentSecurityPolicy::DirectiveType& effective_type, const KURL& blocked_url, const String& header, RedirectStatus redirect_status, ContentSecurityPolicyHeaderType header_type, ContentSecurityPolicy::ViolationType violation_type, std::unique_ptr<SourceLocation> source_location, const String& script_source) { if (effective_type == ContentSecurityPolicy::DirectiveType::kFrameAncestors) { String stripped_url = StripURLForUseInReport( context, blocked_url, RedirectStatus::kNoRedirect, ContentSecurityPolicy::DirectiveType::kDefaultSrc); init->setDocumentURI(stripped_url); init->setBlockedURI(stripped_url); } else { String stripped_url = StripURLForUseInReport( context, context->Url(), RedirectStatus::kNoRedirect, ContentSecurityPolicy::DirectiveType::kDefaultSrc); init->setDocumentURI(stripped_url); switch (violation_type) { case ContentSecurityPolicy::kInlineViolation: init->setBlockedURI("inline"); break; case ContentSecurityPolicy::kEvalViolation: init->setBlockedURI("eval"); break; case ContentSecurityPolicy::kURLViolation: init->setBlockedURI(StripURLForUseInReport( context, blocked_url, redirect_status, effective_type)); break; } } String effective_directive = ContentSecurityPolicy::GetDirectiveName(effective_type); init->setViolatedDirective(effective_directive); init->setEffectiveDirective(effective_directive); init->setOriginalPolicy(header); init->setDisposition(header_type == kContentSecurityPolicyHeaderTypeEnforce ? "enforce" : "report"); init->setStatusCode(0); if (auto* document = DynamicTo<Document>(*context)) { init->setReferrer(document->referrer()); if (!SecurityOrigin::IsSecure(context->Url()) && document->Loader()) init->setStatusCode(document->Loader()->GetResponse().HttpStatusCode()); } if (!source_location) source_location = SourceLocation::Capture(context); if (source_location->LineNumber()) { KURL source = KURL(source_location->Url()); init->setSourceFile(StripURLForUseInReport(context, source, redirect_status, effective_type)); init->setLineNumber(source_location->LineNumber()); init->setColumnNumber(source_location->ColumnNumber()); } else { init->setSourceFile(String()); init->setLineNumber(0); init->setColumnNumber(0); } if (!script_source.IsEmpty()) { init->setSample(script_source.StripWhiteSpace().Left( ContentSecurityPolicy::kMaxSampleLength)); } }
C
Chrome
0
CVE-2017-7501
https://www.cvedetails.com/cve/CVE-2017-7501/
CWE-59
https://github.com/rpm-software-management/rpm/commit/404ef011c300207cdb1e531670384564aae04bdc
404ef011c300207cdb1e531670384564aae04bdc
Don't follow symlinks on file creation (CVE-2017-7501) Open newly created files with O_EXCL to prevent symlink tricks. When reopening hardlinks for writing the actual content, use append mode instead. This is compatible with the write-only permissions but is not destructive in case we got redirected to somebody elses file, verify the target before actually writing anything. As these are files with the temporary suffix, errors mean a local user with sufficient privileges to break the installation of the package anyway is trying to goof us on purpose, don't bother trying to mend it (we couldn't fix the hardlink case anyhow) but just bail out. Based on a patch by Florian Festi.
int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files, rpmpsm psm, char ** failedFile) { FD_t payload = rpmtePayload(te); rpmfi fi = rpmfiNewArchiveReader(payload, files, RPMFI_ITER_READ_ARCHIVE); rpmfs fs = rpmteGetFileStates(te); rpmPlugins plugins = rpmtsPlugins(ts); struct stat sb; int saveerrno = errno; int rc = 0; int nodigest = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOFILEDIGEST) ? 1 : 0; int nofcaps = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCAPS) ? 1 : 0; int firsthardlink = -1; int skip; rpmFileAction action; char *tid = NULL; const char *suffix; char *fpath = NULL; if (fi == NULL) { rc = RPMERR_BAD_MAGIC; goto exit; } /* transaction id used for temporary path suffix while installing */ rasprintf(&tid, ";%08x", (unsigned)rpmtsGetTid(ts)); /* Detect and create directories not explicitly in package. */ rc = fsmMkdirs(files, fs, plugins); while (!rc) { /* Read next payload header. */ rc = rpmfiNext(fi); if (rc < 0) { if (rc == RPMERR_ITER_END) rc = 0; break; } action = rpmfsGetAction(fs, rpmfiFX(fi)); skip = XFA_SKIPPING(action); suffix = S_ISDIR(rpmfiFMode(fi)) ? NULL : tid; if (action != FA_TOUCH) { fpath = fsmFsPath(fi, suffix); } else { fpath = fsmFsPath(fi, ""); } /* Remap file perms, owner, and group. */ rc = rpmfiStat(fi, 1, &sb); fsmDebug(fpath, action, &sb); /* Exit on error. */ if (rc) break; /* Run fsm file pre hook for all plugins */ rc = rpmpluginsCallFsmFilePre(plugins, fi, fpath, sb.st_mode, action); if (rc) { skip = 1; } else { setFileState(fs, rpmfiFX(fi)); } if (!skip) { int setmeta = 1; /* Directories replacing something need early backup */ if (!suffix) { rc = fsmBackup(fi, action); } /* Assume file does't exist when tmp suffix is in use */ if (!suffix) { rc = fsmVerify(fpath, fi); } else { rc = (action == FA_TOUCH) ? 0 : RPMERR_ENOENT; } if (S_ISREG(sb.st_mode)) { if (rc == RPMERR_ENOENT) { rc = fsmMkfile(fi, fpath, files, psm, nodigest, &setmeta, &firsthardlink); } } else if (S_ISDIR(sb.st_mode)) { if (rc == RPMERR_ENOENT) { mode_t mode = sb.st_mode; mode &= ~07777; mode |= 00700; rc = fsmMkdir(fpath, mode); } } else if (S_ISLNK(sb.st_mode)) { if (rc == RPMERR_ENOENT) { rc = fsmSymlink(rpmfiFLink(fi), fpath); } } else if (S_ISFIFO(sb.st_mode)) { /* This mimics cpio S_ISSOCK() behavior but probably isn't right */ if (rc == RPMERR_ENOENT) { rc = fsmMkfifo(fpath, 0000); } } else if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode) || S_ISSOCK(sb.st_mode)) { if (rc == RPMERR_ENOENT) { rc = fsmMknod(fpath, sb.st_mode, sb.st_rdev); } } else { /* XXX Special case /dev/log, which shouldn't be packaged anyways */ if (!IS_DEV_LOG(fpath)) rc = RPMERR_UNKNOWN_FILETYPE; } /* Set permissions, timestamps etc for non-hardlink entries */ if (!rc && setmeta) { rc = fsmSetmeta(fpath, fi, plugins, action, &sb, nofcaps); } } else if (firsthardlink >= 0 && rpmfiArchiveHasContent(fi)) { /* we skip the hard linked file containing the content */ /* write the content to the first used instead */ char *fn = rpmfilesFN(files, firsthardlink); rc = expandRegular(fi, fn, psm, 0, nodigest, 0); firsthardlink = -1; free(fn); } if (rc) { if (!skip) { /* XXX only erase if temp fn w suffix is in use */ if (suffix && (action != FA_TOUCH)) { (void) fsmRemove(fpath, sb.st_mode); } errno = saveerrno; } } else { /* Notify on success. */ rpmpsmNotify(psm, RPMCALLBACK_INST_PROGRESS, rpmfiArchiveTell(fi)); if (!skip) { /* Backup file if needed. Directories are handled earlier */ if (suffix) rc = fsmBackup(fi, action); if (!rc) rc = fsmCommit(&fpath, fi, action, suffix); } } if (rc) *failedFile = xstrdup(fpath); /* Run fsm file post hook for all plugins */ rpmpluginsCallFsmFilePost(plugins, fi, fpath, sb.st_mode, action, rc); fpath = _free(fpath); } rpmswAdd(rpmtsOp(ts, RPMTS_OP_UNCOMPRESS), fdOp(payload, FDSTAT_READ)); rpmswAdd(rpmtsOp(ts, RPMTS_OP_DIGEST), fdOp(payload, FDSTAT_DIGEST)); exit: /* No need to bother with close errors on read */ rpmfiArchiveClose(fi); rpmfiFree(fi); Fclose(payload); free(tid); free(fpath); return rc; }
int rpmPackageFilesInstall(rpmts ts, rpmte te, rpmfiles files, rpmpsm psm, char ** failedFile) { FD_t payload = rpmtePayload(te); rpmfi fi = rpmfiNewArchiveReader(payload, files, RPMFI_ITER_READ_ARCHIVE); rpmfs fs = rpmteGetFileStates(te); rpmPlugins plugins = rpmtsPlugins(ts); struct stat sb; int saveerrno = errno; int rc = 0; int nodigest = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOFILEDIGEST) ? 1 : 0; int nofcaps = (rpmtsFlags(ts) & RPMTRANS_FLAG_NOCAPS) ? 1 : 0; int firsthardlink = -1; int skip; rpmFileAction action; char *tid = NULL; const char *suffix; char *fpath = NULL; if (fi == NULL) { rc = RPMERR_BAD_MAGIC; goto exit; } /* transaction id used for temporary path suffix while installing */ rasprintf(&tid, ";%08x", (unsigned)rpmtsGetTid(ts)); /* Detect and create directories not explicitly in package. */ rc = fsmMkdirs(files, fs, plugins); while (!rc) { /* Read next payload header. */ rc = rpmfiNext(fi); if (rc < 0) { if (rc == RPMERR_ITER_END) rc = 0; break; } action = rpmfsGetAction(fs, rpmfiFX(fi)); skip = XFA_SKIPPING(action); suffix = S_ISDIR(rpmfiFMode(fi)) ? NULL : tid; if (action != FA_TOUCH) { fpath = fsmFsPath(fi, suffix); } else { fpath = fsmFsPath(fi, ""); } /* Remap file perms, owner, and group. */ rc = rpmfiStat(fi, 1, &sb); fsmDebug(fpath, action, &sb); /* Exit on error. */ if (rc) break; /* Run fsm file pre hook for all plugins */ rc = rpmpluginsCallFsmFilePre(plugins, fi, fpath, sb.st_mode, action); if (rc) { skip = 1; } else { setFileState(fs, rpmfiFX(fi)); } if (!skip) { int setmeta = 1; /* Directories replacing something need early backup */ if (!suffix) { rc = fsmBackup(fi, action); } /* Assume file does't exist when tmp suffix is in use */ if (!suffix) { rc = fsmVerify(fpath, fi); } else { rc = (action == FA_TOUCH) ? 0 : RPMERR_ENOENT; } if (S_ISREG(sb.st_mode)) { if (rc == RPMERR_ENOENT) { rc = fsmMkfile(fi, fpath, files, psm, nodigest, &setmeta, &firsthardlink); } } else if (S_ISDIR(sb.st_mode)) { if (rc == RPMERR_ENOENT) { mode_t mode = sb.st_mode; mode &= ~07777; mode |= 00700; rc = fsmMkdir(fpath, mode); } } else if (S_ISLNK(sb.st_mode)) { if (rc == RPMERR_ENOENT) { rc = fsmSymlink(rpmfiFLink(fi), fpath); } } else if (S_ISFIFO(sb.st_mode)) { /* This mimics cpio S_ISSOCK() behavior but probably isn't right */ if (rc == RPMERR_ENOENT) { rc = fsmMkfifo(fpath, 0000); } } else if (S_ISCHR(sb.st_mode) || S_ISBLK(sb.st_mode) || S_ISSOCK(sb.st_mode)) { if (rc == RPMERR_ENOENT) { rc = fsmMknod(fpath, sb.st_mode, sb.st_rdev); } } else { /* XXX Special case /dev/log, which shouldn't be packaged anyways */ if (!IS_DEV_LOG(fpath)) rc = RPMERR_UNKNOWN_FILETYPE; } /* Set permissions, timestamps etc for non-hardlink entries */ if (!rc && setmeta) { rc = fsmSetmeta(fpath, fi, plugins, action, &sb, nofcaps); } } else if (firsthardlink >= 0 && rpmfiArchiveHasContent(fi)) { /* we skip the hard linked file containing the content */ /* write the content to the first used instead */ char *fn = rpmfilesFN(files, firsthardlink); rc = expandRegular(fi, fn, psm, nodigest, 0); firsthardlink = -1; free(fn); } if (rc) { if (!skip) { /* XXX only erase if temp fn w suffix is in use */ if (suffix && (action != FA_TOUCH)) { (void) fsmRemove(fpath, sb.st_mode); } errno = saveerrno; } } else { /* Notify on success. */ rpmpsmNotify(psm, RPMCALLBACK_INST_PROGRESS, rpmfiArchiveTell(fi)); if (!skip) { /* Backup file if needed. Directories are handled earlier */ if (suffix) rc = fsmBackup(fi, action); if (!rc) rc = fsmCommit(&fpath, fi, action, suffix); } } if (rc) *failedFile = xstrdup(fpath); /* Run fsm file post hook for all plugins */ rpmpluginsCallFsmFilePost(plugins, fi, fpath, sb.st_mode, action, rc); fpath = _free(fpath); } rpmswAdd(rpmtsOp(ts, RPMTS_OP_UNCOMPRESS), fdOp(payload, FDSTAT_READ)); rpmswAdd(rpmtsOp(ts, RPMTS_OP_DIGEST), fdOp(payload, FDSTAT_DIGEST)); exit: /* No need to bother with close errors on read */ rpmfiArchiveClose(fi); rpmfiFree(fi); Fclose(payload); free(tid); free(fpath); return rc; }
C
rpm
1
CVE-2017-5061
https://www.cvedetails.com/cve/CVE-2017-5061/
CWE-362
https://github.com/chromium/chromium/commit/5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
(Reland) Discard compositor frames from unloaded web content This is a reland of https://codereview.chromium.org/2707243005/ with a small change to fix an uninitialized memory error that fails on MSAN bots. BUG=672847 [email protected], [email protected] CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2731283003 Cr-Commit-Position: refs/heads/master@{#454954}
bool LayerTreeHost::UpdateLayers() { if (!root_layer()) { property_trees_.clear(); return false; } DCHECK(!root_layer()->parent()); base::ElapsedTimer timer; bool result = DoUpdateLayers(root_layer()); micro_benchmark_controller_.DidUpdateLayers(); if (const char* client_name = GetClientNameForMetrics()) { std::string histogram_name = base::StringPrintf("Compositing.%s.LayersUpdateTime.%d", client_name, GetLayersUpdateTimeHistogramBucket(NumLayers())); base::Histogram::FactoryGet(histogram_name, 0, 10000000, 50, base::HistogramBase::kUmaTargetedHistogramFlag) ->Add(timer.Elapsed().InMicroseconds()); } return result || next_commit_forces_redraw_; }
bool LayerTreeHost::UpdateLayers() { if (!root_layer()) { property_trees_.clear(); return false; } DCHECK(!root_layer()->parent()); base::ElapsedTimer timer; bool result = DoUpdateLayers(root_layer()); micro_benchmark_controller_.DidUpdateLayers(); if (const char* client_name = GetClientNameForMetrics()) { std::string histogram_name = base::StringPrintf("Compositing.%s.LayersUpdateTime.%d", client_name, GetLayersUpdateTimeHistogramBucket(NumLayers())); base::Histogram::FactoryGet(histogram_name, 0, 10000000, 50, base::HistogramBase::kUmaTargetedHistogramFlag) ->Add(timer.Elapsed().InMicroseconds()); } return result || next_commit_forces_redraw_; }
C
Chrome
0
CVE-2013-2929
https://www.cvedetails.com/cve/CVE-2013-2929/
CWE-264
https://github.com/torvalds/linux/commit/d049f74f2dbe71354d43d393ac3a188947811348
d049f74f2dbe71354d43d393ac3a188947811348
exec/ptrace: fix get_dumpable() incorrect tests The get_dumpable() return value is not boolean. Most users of the function actually want to be testing for non-SUID_DUMP_USER(1) rather than SUID_DUMP_DISABLE(0). The SUID_DUMP_ROOT(2) is also considered a protected state. Almost all places did this correctly, excepting the two places fixed in this patch. Wrong logic: if (dumpable == SUID_DUMP_DISABLE) { /* be protective */ } or if (dumpable == 0) { /* be protective */ } or if (!dumpable) { /* be protective */ } Correct logic: if (dumpable != SUID_DUMP_USER) { /* be protective */ } or if (dumpable != 1) { /* be protective */ } Without this patch, if the system had set the sysctl fs/suid_dumpable=2, a user was able to ptrace attach to processes that had dropped privileges to that user. (This may have been partially mitigated if Yama was enabled.) The macros have been moved into the file that declares get/set_dumpable(), which means things like the ia64 code can see them too. CVE-2013-2929 Reported-by: Vasily Kulikov <[email protected]> Signed-off-by: Kees Cook <[email protected]> Cc: "Luck, Tony" <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: "Eric W. Biederman" <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static int ptrace_has_cap(struct user_namespace *ns, unsigned int mode) { if (mode & PTRACE_MODE_NOAUDIT) return has_ns_capability_noaudit(current, ns, CAP_SYS_PTRACE); else return has_ns_capability(current, ns, CAP_SYS_PTRACE); }
static int ptrace_has_cap(struct user_namespace *ns, unsigned int mode) { if (mode & PTRACE_MODE_NOAUDIT) return has_ns_capability_noaudit(current, ns, CAP_SYS_PTRACE); else return has_ns_capability(current, ns, CAP_SYS_PTRACE); }
C
linux
0
CVE-2018-13785
https://www.cvedetails.com/cve/CVE-2018-13785/
CWE-190
https://github.com/glennrp/libpng/commit/8a05766cb74af05c04c53e6c9d60c13fc4d59bf2
8a05766cb74af05c04c53e6c9d60c13fc4d59bf2
[libpng16] Fix the calculation of row_factor in png_check_chunk_length (Bug report by Thuan Pham, SourceForge issue #278)
png_init_filter_functions(png_structrp pp) /* This function is called once for every PNG image (except for PNG images * that only use PNG_FILTER_VALUE_NONE for all rows) to set the * implementations required to reverse the filtering of PNG rows. Reversing * the filter is the first transformation performed on the row data. It is * performed in place, therefore an implementation can be selected based on * the image pixel format. If the implementation depends on image width then * take care to ensure that it works correctly if the image is interlaced - * interlacing causes the actual row width to vary. */ { unsigned int bpp = (pp->pixel_depth + 7) >> 3; pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub; pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up; pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg; if (bpp == 1) pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth_1byte_pixel; else pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth_multibyte_pixel; #ifdef PNG_FILTER_OPTIMIZATIONS /* To use this define PNG_FILTER_OPTIMIZATIONS as the name of a function to * call to install hardware optimizations for the above functions; simply * replace whatever elements of the pp->read_filter[] array with a hardware * specific (or, for that matter, generic) optimization. * * To see an example of this examine what configure.ac does when * --enable-arm-neon is specified on the command line. */ PNG_FILTER_OPTIMIZATIONS(pp, bpp); #endif }
png_init_filter_functions(png_structrp pp) /* This function is called once for every PNG image (except for PNG images * that only use PNG_FILTER_VALUE_NONE for all rows) to set the * implementations required to reverse the filtering of PNG rows. Reversing * the filter is the first transformation performed on the row data. It is * performed in place, therefore an implementation can be selected based on * the image pixel format. If the implementation depends on image width then * take care to ensure that it works correctly if the image is interlaced - * interlacing causes the actual row width to vary. */ { unsigned int bpp = (pp->pixel_depth + 7) >> 3; pp->read_filter[PNG_FILTER_VALUE_SUB-1] = png_read_filter_row_sub; pp->read_filter[PNG_FILTER_VALUE_UP-1] = png_read_filter_row_up; pp->read_filter[PNG_FILTER_VALUE_AVG-1] = png_read_filter_row_avg; if (bpp == 1) pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth_1byte_pixel; else pp->read_filter[PNG_FILTER_VALUE_PAETH-1] = png_read_filter_row_paeth_multibyte_pixel; #ifdef PNG_FILTER_OPTIMIZATIONS /* To use this define PNG_FILTER_OPTIMIZATIONS as the name of a function to * call to install hardware optimizations for the above functions; simply * replace whatever elements of the pp->read_filter[] array with a hardware * specific (or, for that matter, generic) optimization. * * To see an example of this examine what configure.ac does when * --enable-arm-neon is specified on the command line. */ PNG_FILTER_OPTIMIZATIONS(pp, bpp); #endif }
C
libpng
0
CVE-2016-1586
https://www.cvedetails.com/cve/CVE-2016-1586/
CWE-20
https://git.launchpad.net/oxide/commit/?id=29014da83e5fc358d6bff0f574e9ed45e61a35ac
29014da83e5fc358d6bff0f574e9ed45e61a35ac
null
int WebContext::getCookies(const QUrl& url) { int request_id = GetNextCookieRequestId(); context_->GetCookieStore()->GetAllCookiesForURLAsync( GURL(url.toString().toStdString()), base::Bind(&WebContext::GetCookiesCallback, weak_factory_.GetWeakPtr(), request_id)); return request_id; }
int WebContext::getCookies(const QUrl& url) { int request_id = GetNextCookieRequestId(); context_->GetCookieStore()->GetAllCookiesForURLAsync( GURL(url.toString().toStdString()), base::Bind(&WebContext::GetCookiesCallback, weak_factory_.GetWeakPtr(), request_id)); return request_id; }
CPP
launchpad
0
CVE-2013-0892
https://www.cvedetails.com/cve/CVE-2013-0892/
null
https://github.com/chromium/chromium/commit/da5e5f78f02bc0af5ddc5694090defbef7853af1
da5e5f78f02bc0af5ddc5694090defbef7853af1
DevTools: remove references to modules/device_orientation from core BUG=340221 Review URL: https://codereview.chromium.org/150913003 git-svn-id: svn://svn.chromium.org/blink/trunk@166493 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void InspectorPageAgent::setShowFPSCounter(ErrorString* errorString, bool show) { m_state->setBoolean(PageAgentState::pageAgentShowFPSCounter, show); if (show && !forceCompositingMode(errorString)) return; m_client->setShowFPSCounter(show && !m_deviceMetricsOverridden); }
void InspectorPageAgent::setShowFPSCounter(ErrorString* errorString, bool show) { m_state->setBoolean(PageAgentState::pageAgentShowFPSCounter, show); if (show && !forceCompositingMode(errorString)) return; m_client->setShowFPSCounter(show && !m_deviceMetricsOverridden); }
C
Chrome
0
CVE-2015-7515
https://www.cvedetails.com/cve/CVE-2015-7515/
null
https://github.com/torvalds/linux/commit/8e20cf2bce122ce9262d6034ee5d5b76fbb92f96
8e20cf2bce122ce9262d6034ee5d5b76fbb92f96
Input: aiptek - fix crash on detecting device without endpoints The aiptek driver crashes in aiptek_probe() when a specially crafted USB device without endpoints is detected. This fix adds a check that the device has proper configuration expected by the driver. Also an error return value is changed to more matching one in one of the error paths. Reported-by: Ralf Spenneberg <[email protected]> Signed-off-by: Vladis Dronov <[email protected]> Signed-off-by: Dmitry Torokhov <[email protected]>
static void aiptek_disconnect(struct usb_interface *intf) { struct aiptek *aiptek = usb_get_intfdata(intf); /* Disassociate driver's struct with usb interface */ usb_set_intfdata(intf, NULL); if (aiptek != NULL) { /* Free & unhook everything from the system. */ usb_kill_urb(aiptek->urb); input_unregister_device(aiptek->inputdev); sysfs_remove_group(&intf->dev.kobj, &aiptek_attribute_group); usb_free_urb(aiptek->urb); usb_free_coherent(interface_to_usbdev(intf), AIPTEK_PACKET_LENGTH, aiptek->data, aiptek->data_dma); kfree(aiptek); } }
static void aiptek_disconnect(struct usb_interface *intf) { struct aiptek *aiptek = usb_get_intfdata(intf); /* Disassociate driver's struct with usb interface */ usb_set_intfdata(intf, NULL); if (aiptek != NULL) { /* Free & unhook everything from the system. */ usb_kill_urb(aiptek->urb); input_unregister_device(aiptek->inputdev); sysfs_remove_group(&intf->dev.kobj, &aiptek_attribute_group); usb_free_urb(aiptek->urb); usb_free_coherent(interface_to_usbdev(intf), AIPTEK_PACKET_LENGTH, aiptek->data, aiptek->data_dma); kfree(aiptek); } }
C
linux
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
static void spl_filesystem_dir_it_move_forward(zend_object_iterator *iter TSRMLS_DC) { spl_filesystem_object *object = spl_filesystem_iterator_to_object((spl_filesystem_iterator *)iter); object->u.dir.index++; spl_filesystem_dir_read(object TSRMLS_CC); if (object->file_name) { efree(object->file_name); object->file_name = NULL; } }
static void spl_filesystem_dir_it_move_forward(zend_object_iterator *iter TSRMLS_DC) { spl_filesystem_object *object = spl_filesystem_iterator_to_object((spl_filesystem_iterator *)iter); object->u.dir.index++; spl_filesystem_dir_read(object TSRMLS_CC); if (object->file_name) { efree(object->file_name); object->file_name = NULL; } }
C
php-src
1
CVE-2017-12993
https://www.cvedetails.com/cve/CVE-2017-12993/
CWE-125
https://github.com/the-tcpdump-group/tcpdump/commit/b534e304568585707c4a92422aeca25cf908ff02
b534e304568585707c4a92422aeca25cf908ff02
CVE-2017-12993/Juniper: Add more bounds checks. This fixes a buffer over-read discovered by Kamil Frankowicz. Add tests using the capture files supplied by the reporter(s).
juniper_ppp_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { struct juniper_l2info_t l2info; l2info.pictype = DLT_JUNIPER_PPP; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; p+=l2info.header_len; /* this DLT contains nothing but raw ppp frames */ ppp_print(ndo, p, l2info.length); return l2info.header_len; }
juniper_ppp_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { struct juniper_l2info_t l2info; l2info.pictype = DLT_JUNIPER_PPP; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; p+=l2info.header_len; /* this DLT contains nothing but raw ppp frames */ ppp_print(ndo, p, l2info.length); return l2info.header_len; }
C
tcpdump
0
CVE-2011-1019
https://www.cvedetails.com/cve/CVE-2011-1019/
CWE-264
https://github.com/torvalds/linux/commit/8909c9ad8ff03611c9c96c9a92656213e4bb495b
8909c9ad8ff03611c9c96c9a92656213e4bb495b
net: don't allow CAP_NET_ADMIN to load non-netdev kernel modules Since a8f80e8ff94ecba629542d9b4b5f5a8ee3eb565c any process with CAP_NET_ADMIN may load any module from /lib/modules/. This doesn't mean that CAP_NET_ADMIN is a superset of CAP_SYS_MODULE as modules are limited to /lib/modules/**. However, CAP_NET_ADMIN capability shouldn't allow anybody load any module not related to networking. This patch restricts an ability of autoloading modules to netdev modules with explicit aliases. This fixes CVE-2011-1019. Arnd Bergmann suggested to leave untouched the old pre-v2.6.32 behavior of loading netdev modules by name (without any prefix) for processes with CAP_SYS_MODULE to maintain the compatibility with network scripts that use autoloading netdev modules by aliases like "eth0", "wlan0". Currently there are only three users of the feature in the upstream kernel: ipip, ip_gre and sit. root@albatros:~# capsh --drop=$(seq -s, 0 11),$(seq -s, 13 34) -- root@albatros:~# grep Cap /proc/$$/status CapInh: 0000000000000000 CapPrm: fffffff800001000 CapEff: fffffff800001000 CapBnd: fffffff800001000 root@albatros:~# modprobe xfs FATAL: Error inserting xfs (/lib/modules/2.6.38-rc6-00001-g2bf4ca3/kernel/fs/xfs/xfs.ko): Operation not permitted root@albatros:~# lsmod | grep xfs root@albatros:~# ifconfig xfs xfs: error fetching interface information: Device not found root@albatros:~# lsmod | grep xfs root@albatros:~# lsmod | grep sit root@albatros:~# ifconfig sit sit: error fetching interface information: Device not found root@albatros:~# lsmod | grep sit root@albatros:~# ifconfig sit0 sit0 Link encap:IPv6-in-IPv4 NOARP MTU:1480 Metric:1 root@albatros:~# lsmod | grep sit sit 10457 0 tunnel4 2957 1 sit For CAP_SYS_MODULE module loading is still relaxed: root@albatros:~# grep Cap /proc/$$/status CapInh: 0000000000000000 CapPrm: ffffffffffffffff CapEff: ffffffffffffffff CapBnd: ffffffffffffffff root@albatros:~# ifconfig xfs xfs: error fetching interface information: Device not found root@albatros:~# lsmod | grep xfs xfs 745319 0 Reference: https://lkml.org/lkml/2011/2/24/203 Signed-off-by: Vasiliy Kulikov <[email protected]> Signed-off-by: Michael Tokarev <[email protected]> Acked-by: David S. Miller <[email protected]> Acked-by: Kees Cook <[email protected]> Signed-off-by: James Morris <[email protected]>
static struct ip_tunnel * ipip_tunnel_lookup(struct net *net, __be32 remote, __be32 local) { unsigned int h0 = HASH(remote); unsigned int h1 = HASH(local); struct ip_tunnel *t; struct ipip_net *ipn = net_generic(net, ipip_net_id); for_each_ip_tunnel_rcu(ipn->tunnels_r_l[h0 ^ h1]) if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr && (t->dev->flags&IFF_UP)) return t; for_each_ip_tunnel_rcu(ipn->tunnels_r[h0]) if (remote == t->parms.iph.daddr && (t->dev->flags&IFF_UP)) return t; for_each_ip_tunnel_rcu(ipn->tunnels_l[h1]) if (local == t->parms.iph.saddr && (t->dev->flags&IFF_UP)) return t; t = rcu_dereference(ipn->tunnels_wc[0]); if (t && (t->dev->flags&IFF_UP)) return t; return NULL; }
static struct ip_tunnel * ipip_tunnel_lookup(struct net *net, __be32 remote, __be32 local) { unsigned int h0 = HASH(remote); unsigned int h1 = HASH(local); struct ip_tunnel *t; struct ipip_net *ipn = net_generic(net, ipip_net_id); for_each_ip_tunnel_rcu(ipn->tunnels_r_l[h0 ^ h1]) if (local == t->parms.iph.saddr && remote == t->parms.iph.daddr && (t->dev->flags&IFF_UP)) return t; for_each_ip_tunnel_rcu(ipn->tunnels_r[h0]) if (remote == t->parms.iph.daddr && (t->dev->flags&IFF_UP)) return t; for_each_ip_tunnel_rcu(ipn->tunnels_l[h1]) if (local == t->parms.iph.saddr && (t->dev->flags&IFF_UP)) return t; t = rcu_dereference(ipn->tunnels_wc[0]); if (t && (t->dev->flags&IFF_UP)) return t; return NULL; }
C
linux
0
CVE-2013-7421
https://www.cvedetails.com/cve/CVE-2013-7421/
CWE-264
https://github.com/torvalds/linux/commit/5d26a105b5a73e5635eae0629b42fa0a90e07b7b
5d26a105b5a73e5635eae0629b42fa0a90e07b7b
crypto: prefix module autoloading with "crypto-" This prefixes all crypto module loading with "crypto-" so we never run the risk of exposing module auto-loading to userspace via a crypto API, as demonstrated by Mathias Krause: https://lkml.org/lkml/2013/3/4/70 Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
static void rmd256_transform(u32 *state, const __le32 *in) { u32 aa, bb, cc, dd, aaa, bbb, ccc, ddd, tmp; /* Initialize left lane */ aa = state[0]; bb = state[1]; cc = state[2]; dd = state[3]; /* Initialize right lane */ aaa = state[4]; bbb = state[5]; ccc = state[6]; ddd = state[7]; /* round 1: left lane */ ROUND(aa, bb, cc, dd, F1, K1, in[0], 11); ROUND(dd, aa, bb, cc, F1, K1, in[1], 14); ROUND(cc, dd, aa, bb, F1, K1, in[2], 15); ROUND(bb, cc, dd, aa, F1, K1, in[3], 12); ROUND(aa, bb, cc, dd, F1, K1, in[4], 5); ROUND(dd, aa, bb, cc, F1, K1, in[5], 8); ROUND(cc, dd, aa, bb, F1, K1, in[6], 7); ROUND(bb, cc, dd, aa, F1, K1, in[7], 9); ROUND(aa, bb, cc, dd, F1, K1, in[8], 11); ROUND(dd, aa, bb, cc, F1, K1, in[9], 13); ROUND(cc, dd, aa, bb, F1, K1, in[10], 14); ROUND(bb, cc, dd, aa, F1, K1, in[11], 15); ROUND(aa, bb, cc, dd, F1, K1, in[12], 6); ROUND(dd, aa, bb, cc, F1, K1, in[13], 7); ROUND(cc, dd, aa, bb, F1, K1, in[14], 9); ROUND(bb, cc, dd, aa, F1, K1, in[15], 8); /* round 1: right lane */ ROUND(aaa, bbb, ccc, ddd, F4, KK1, in[5], 8); ROUND(ddd, aaa, bbb, ccc, F4, KK1, in[14], 9); ROUND(ccc, ddd, aaa, bbb, F4, KK1, in[7], 9); ROUND(bbb, ccc, ddd, aaa, F4, KK1, in[0], 11); ROUND(aaa, bbb, ccc, ddd, F4, KK1, in[9], 13); ROUND(ddd, aaa, bbb, ccc, F4, KK1, in[2], 15); ROUND(ccc, ddd, aaa, bbb, F4, KK1, in[11], 15); ROUND(bbb, ccc, ddd, aaa, F4, KK1, in[4], 5); ROUND(aaa, bbb, ccc, ddd, F4, KK1, in[13], 7); ROUND(ddd, aaa, bbb, ccc, F4, KK1, in[6], 7); ROUND(ccc, ddd, aaa, bbb, F4, KK1, in[15], 8); ROUND(bbb, ccc, ddd, aaa, F4, KK1, in[8], 11); ROUND(aaa, bbb, ccc, ddd, F4, KK1, in[1], 14); ROUND(ddd, aaa, bbb, ccc, F4, KK1, in[10], 14); ROUND(ccc, ddd, aaa, bbb, F4, KK1, in[3], 12); ROUND(bbb, ccc, ddd, aaa, F4, KK1, in[12], 6); /* Swap contents of "a" registers */ tmp = aa; aa = aaa; aaa = tmp; /* round 2: left lane */ ROUND(aa, bb, cc, dd, F2, K2, in[7], 7); ROUND(dd, aa, bb, cc, F2, K2, in[4], 6); ROUND(cc, dd, aa, bb, F2, K2, in[13], 8); ROUND(bb, cc, dd, aa, F2, K2, in[1], 13); ROUND(aa, bb, cc, dd, F2, K2, in[10], 11); ROUND(dd, aa, bb, cc, F2, K2, in[6], 9); ROUND(cc, dd, aa, bb, F2, K2, in[15], 7); ROUND(bb, cc, dd, aa, F2, K2, in[3], 15); ROUND(aa, bb, cc, dd, F2, K2, in[12], 7); ROUND(dd, aa, bb, cc, F2, K2, in[0], 12); ROUND(cc, dd, aa, bb, F2, K2, in[9], 15); ROUND(bb, cc, dd, aa, F2, K2, in[5], 9); ROUND(aa, bb, cc, dd, F2, K2, in[2], 11); ROUND(dd, aa, bb, cc, F2, K2, in[14], 7); ROUND(cc, dd, aa, bb, F2, K2, in[11], 13); ROUND(bb, cc, dd, aa, F2, K2, in[8], 12); /* round 2: right lane */ ROUND(aaa, bbb, ccc, ddd, F3, KK2, in[6], 9); ROUND(ddd, aaa, bbb, ccc, F3, KK2, in[11], 13); ROUND(ccc, ddd, aaa, bbb, F3, KK2, in[3], 15); ROUND(bbb, ccc, ddd, aaa, F3, KK2, in[7], 7); ROUND(aaa, bbb, ccc, ddd, F3, KK2, in[0], 12); ROUND(ddd, aaa, bbb, ccc, F3, KK2, in[13], 8); ROUND(ccc, ddd, aaa, bbb, F3, KK2, in[5], 9); ROUND(bbb, ccc, ddd, aaa, F3, KK2, in[10], 11); ROUND(aaa, bbb, ccc, ddd, F3, KK2, in[14], 7); ROUND(ddd, aaa, bbb, ccc, F3, KK2, in[15], 7); ROUND(ccc, ddd, aaa, bbb, F3, KK2, in[8], 12); ROUND(bbb, ccc, ddd, aaa, F3, KK2, in[12], 7); ROUND(aaa, bbb, ccc, ddd, F3, KK2, in[4], 6); ROUND(ddd, aaa, bbb, ccc, F3, KK2, in[9], 15); ROUND(ccc, ddd, aaa, bbb, F3, KK2, in[1], 13); ROUND(bbb, ccc, ddd, aaa, F3, KK2, in[2], 11); /* Swap contents of "b" registers */ tmp = bb; bb = bbb; bbb = tmp; /* round 3: left lane */ ROUND(aa, bb, cc, dd, F3, K3, in[3], 11); ROUND(dd, aa, bb, cc, F3, K3, in[10], 13); ROUND(cc, dd, aa, bb, F3, K3, in[14], 6); ROUND(bb, cc, dd, aa, F3, K3, in[4], 7); ROUND(aa, bb, cc, dd, F3, K3, in[9], 14); ROUND(dd, aa, bb, cc, F3, K3, in[15], 9); ROUND(cc, dd, aa, bb, F3, K3, in[8], 13); ROUND(bb, cc, dd, aa, F3, K3, in[1], 15); ROUND(aa, bb, cc, dd, F3, K3, in[2], 14); ROUND(dd, aa, bb, cc, F3, K3, in[7], 8); ROUND(cc, dd, aa, bb, F3, K3, in[0], 13); ROUND(bb, cc, dd, aa, F3, K3, in[6], 6); ROUND(aa, bb, cc, dd, F3, K3, in[13], 5); ROUND(dd, aa, bb, cc, F3, K3, in[11], 12); ROUND(cc, dd, aa, bb, F3, K3, in[5], 7); ROUND(bb, cc, dd, aa, F3, K3, in[12], 5); /* round 3: right lane */ ROUND(aaa, bbb, ccc, ddd, F2, KK3, in[15], 9); ROUND(ddd, aaa, bbb, ccc, F2, KK3, in[5], 7); ROUND(ccc, ddd, aaa, bbb, F2, KK3, in[1], 15); ROUND(bbb, ccc, ddd, aaa, F2, KK3, in[3], 11); ROUND(aaa, bbb, ccc, ddd, F2, KK3, in[7], 8); ROUND(ddd, aaa, bbb, ccc, F2, KK3, in[14], 6); ROUND(ccc, ddd, aaa, bbb, F2, KK3, in[6], 6); ROUND(bbb, ccc, ddd, aaa, F2, KK3, in[9], 14); ROUND(aaa, bbb, ccc, ddd, F2, KK3, in[11], 12); ROUND(ddd, aaa, bbb, ccc, F2, KK3, in[8], 13); ROUND(ccc, ddd, aaa, bbb, F2, KK3, in[12], 5); ROUND(bbb, ccc, ddd, aaa, F2, KK3, in[2], 14); ROUND(aaa, bbb, ccc, ddd, F2, KK3, in[10], 13); ROUND(ddd, aaa, bbb, ccc, F2, KK3, in[0], 13); ROUND(ccc, ddd, aaa, bbb, F2, KK3, in[4], 7); ROUND(bbb, ccc, ddd, aaa, F2, KK3, in[13], 5); /* Swap contents of "c" registers */ tmp = cc; cc = ccc; ccc = tmp; /* round 4: left lane */ ROUND(aa, bb, cc, dd, F4, K4, in[1], 11); ROUND(dd, aa, bb, cc, F4, K4, in[9], 12); ROUND(cc, dd, aa, bb, F4, K4, in[11], 14); ROUND(bb, cc, dd, aa, F4, K4, in[10], 15); ROUND(aa, bb, cc, dd, F4, K4, in[0], 14); ROUND(dd, aa, bb, cc, F4, K4, in[8], 15); ROUND(cc, dd, aa, bb, F4, K4, in[12], 9); ROUND(bb, cc, dd, aa, F4, K4, in[4], 8); ROUND(aa, bb, cc, dd, F4, K4, in[13], 9); ROUND(dd, aa, bb, cc, F4, K4, in[3], 14); ROUND(cc, dd, aa, bb, F4, K4, in[7], 5); ROUND(bb, cc, dd, aa, F4, K4, in[15], 6); ROUND(aa, bb, cc, dd, F4, K4, in[14], 8); ROUND(dd, aa, bb, cc, F4, K4, in[5], 6); ROUND(cc, dd, aa, bb, F4, K4, in[6], 5); ROUND(bb, cc, dd, aa, F4, K4, in[2], 12); /* round 4: right lane */ ROUND(aaa, bbb, ccc, ddd, F1, KK4, in[8], 15); ROUND(ddd, aaa, bbb, ccc, F1, KK4, in[6], 5); ROUND(ccc, ddd, aaa, bbb, F1, KK4, in[4], 8); ROUND(bbb, ccc, ddd, aaa, F1, KK4, in[1], 11); ROUND(aaa, bbb, ccc, ddd, F1, KK4, in[3], 14); ROUND(ddd, aaa, bbb, ccc, F1, KK4, in[11], 14); ROUND(ccc, ddd, aaa, bbb, F1, KK4, in[15], 6); ROUND(bbb, ccc, ddd, aaa, F1, KK4, in[0], 14); ROUND(aaa, bbb, ccc, ddd, F1, KK4, in[5], 6); ROUND(ddd, aaa, bbb, ccc, F1, KK4, in[12], 9); ROUND(ccc, ddd, aaa, bbb, F1, KK4, in[2], 12); ROUND(bbb, ccc, ddd, aaa, F1, KK4, in[13], 9); ROUND(aaa, bbb, ccc, ddd, F1, KK4, in[9], 12); ROUND(ddd, aaa, bbb, ccc, F1, KK4, in[7], 5); ROUND(ccc, ddd, aaa, bbb, F1, KK4, in[10], 15); ROUND(bbb, ccc, ddd, aaa, F1, KK4, in[14], 8); /* Swap contents of "d" registers */ tmp = dd; dd = ddd; ddd = tmp; /* combine results */ state[0] += aa; state[1] += bb; state[2] += cc; state[3] += dd; state[4] += aaa; state[5] += bbb; state[6] += ccc; state[7] += ddd; return; }
static void rmd256_transform(u32 *state, const __le32 *in) { u32 aa, bb, cc, dd, aaa, bbb, ccc, ddd, tmp; /* Initialize left lane */ aa = state[0]; bb = state[1]; cc = state[2]; dd = state[3]; /* Initialize right lane */ aaa = state[4]; bbb = state[5]; ccc = state[6]; ddd = state[7]; /* round 1: left lane */ ROUND(aa, bb, cc, dd, F1, K1, in[0], 11); ROUND(dd, aa, bb, cc, F1, K1, in[1], 14); ROUND(cc, dd, aa, bb, F1, K1, in[2], 15); ROUND(bb, cc, dd, aa, F1, K1, in[3], 12); ROUND(aa, bb, cc, dd, F1, K1, in[4], 5); ROUND(dd, aa, bb, cc, F1, K1, in[5], 8); ROUND(cc, dd, aa, bb, F1, K1, in[6], 7); ROUND(bb, cc, dd, aa, F1, K1, in[7], 9); ROUND(aa, bb, cc, dd, F1, K1, in[8], 11); ROUND(dd, aa, bb, cc, F1, K1, in[9], 13); ROUND(cc, dd, aa, bb, F1, K1, in[10], 14); ROUND(bb, cc, dd, aa, F1, K1, in[11], 15); ROUND(aa, bb, cc, dd, F1, K1, in[12], 6); ROUND(dd, aa, bb, cc, F1, K1, in[13], 7); ROUND(cc, dd, aa, bb, F1, K1, in[14], 9); ROUND(bb, cc, dd, aa, F1, K1, in[15], 8); /* round 1: right lane */ ROUND(aaa, bbb, ccc, ddd, F4, KK1, in[5], 8); ROUND(ddd, aaa, bbb, ccc, F4, KK1, in[14], 9); ROUND(ccc, ddd, aaa, bbb, F4, KK1, in[7], 9); ROUND(bbb, ccc, ddd, aaa, F4, KK1, in[0], 11); ROUND(aaa, bbb, ccc, ddd, F4, KK1, in[9], 13); ROUND(ddd, aaa, bbb, ccc, F4, KK1, in[2], 15); ROUND(ccc, ddd, aaa, bbb, F4, KK1, in[11], 15); ROUND(bbb, ccc, ddd, aaa, F4, KK1, in[4], 5); ROUND(aaa, bbb, ccc, ddd, F4, KK1, in[13], 7); ROUND(ddd, aaa, bbb, ccc, F4, KK1, in[6], 7); ROUND(ccc, ddd, aaa, bbb, F4, KK1, in[15], 8); ROUND(bbb, ccc, ddd, aaa, F4, KK1, in[8], 11); ROUND(aaa, bbb, ccc, ddd, F4, KK1, in[1], 14); ROUND(ddd, aaa, bbb, ccc, F4, KK1, in[10], 14); ROUND(ccc, ddd, aaa, bbb, F4, KK1, in[3], 12); ROUND(bbb, ccc, ddd, aaa, F4, KK1, in[12], 6); /* Swap contents of "a" registers */ tmp = aa; aa = aaa; aaa = tmp; /* round 2: left lane */ ROUND(aa, bb, cc, dd, F2, K2, in[7], 7); ROUND(dd, aa, bb, cc, F2, K2, in[4], 6); ROUND(cc, dd, aa, bb, F2, K2, in[13], 8); ROUND(bb, cc, dd, aa, F2, K2, in[1], 13); ROUND(aa, bb, cc, dd, F2, K2, in[10], 11); ROUND(dd, aa, bb, cc, F2, K2, in[6], 9); ROUND(cc, dd, aa, bb, F2, K2, in[15], 7); ROUND(bb, cc, dd, aa, F2, K2, in[3], 15); ROUND(aa, bb, cc, dd, F2, K2, in[12], 7); ROUND(dd, aa, bb, cc, F2, K2, in[0], 12); ROUND(cc, dd, aa, bb, F2, K2, in[9], 15); ROUND(bb, cc, dd, aa, F2, K2, in[5], 9); ROUND(aa, bb, cc, dd, F2, K2, in[2], 11); ROUND(dd, aa, bb, cc, F2, K2, in[14], 7); ROUND(cc, dd, aa, bb, F2, K2, in[11], 13); ROUND(bb, cc, dd, aa, F2, K2, in[8], 12); /* round 2: right lane */ ROUND(aaa, bbb, ccc, ddd, F3, KK2, in[6], 9); ROUND(ddd, aaa, bbb, ccc, F3, KK2, in[11], 13); ROUND(ccc, ddd, aaa, bbb, F3, KK2, in[3], 15); ROUND(bbb, ccc, ddd, aaa, F3, KK2, in[7], 7); ROUND(aaa, bbb, ccc, ddd, F3, KK2, in[0], 12); ROUND(ddd, aaa, bbb, ccc, F3, KK2, in[13], 8); ROUND(ccc, ddd, aaa, bbb, F3, KK2, in[5], 9); ROUND(bbb, ccc, ddd, aaa, F3, KK2, in[10], 11); ROUND(aaa, bbb, ccc, ddd, F3, KK2, in[14], 7); ROUND(ddd, aaa, bbb, ccc, F3, KK2, in[15], 7); ROUND(ccc, ddd, aaa, bbb, F3, KK2, in[8], 12); ROUND(bbb, ccc, ddd, aaa, F3, KK2, in[12], 7); ROUND(aaa, bbb, ccc, ddd, F3, KK2, in[4], 6); ROUND(ddd, aaa, bbb, ccc, F3, KK2, in[9], 15); ROUND(ccc, ddd, aaa, bbb, F3, KK2, in[1], 13); ROUND(bbb, ccc, ddd, aaa, F3, KK2, in[2], 11); /* Swap contents of "b" registers */ tmp = bb; bb = bbb; bbb = tmp; /* round 3: left lane */ ROUND(aa, bb, cc, dd, F3, K3, in[3], 11); ROUND(dd, aa, bb, cc, F3, K3, in[10], 13); ROUND(cc, dd, aa, bb, F3, K3, in[14], 6); ROUND(bb, cc, dd, aa, F3, K3, in[4], 7); ROUND(aa, bb, cc, dd, F3, K3, in[9], 14); ROUND(dd, aa, bb, cc, F3, K3, in[15], 9); ROUND(cc, dd, aa, bb, F3, K3, in[8], 13); ROUND(bb, cc, dd, aa, F3, K3, in[1], 15); ROUND(aa, bb, cc, dd, F3, K3, in[2], 14); ROUND(dd, aa, bb, cc, F3, K3, in[7], 8); ROUND(cc, dd, aa, bb, F3, K3, in[0], 13); ROUND(bb, cc, dd, aa, F3, K3, in[6], 6); ROUND(aa, bb, cc, dd, F3, K3, in[13], 5); ROUND(dd, aa, bb, cc, F3, K3, in[11], 12); ROUND(cc, dd, aa, bb, F3, K3, in[5], 7); ROUND(bb, cc, dd, aa, F3, K3, in[12], 5); /* round 3: right lane */ ROUND(aaa, bbb, ccc, ddd, F2, KK3, in[15], 9); ROUND(ddd, aaa, bbb, ccc, F2, KK3, in[5], 7); ROUND(ccc, ddd, aaa, bbb, F2, KK3, in[1], 15); ROUND(bbb, ccc, ddd, aaa, F2, KK3, in[3], 11); ROUND(aaa, bbb, ccc, ddd, F2, KK3, in[7], 8); ROUND(ddd, aaa, bbb, ccc, F2, KK3, in[14], 6); ROUND(ccc, ddd, aaa, bbb, F2, KK3, in[6], 6); ROUND(bbb, ccc, ddd, aaa, F2, KK3, in[9], 14); ROUND(aaa, bbb, ccc, ddd, F2, KK3, in[11], 12); ROUND(ddd, aaa, bbb, ccc, F2, KK3, in[8], 13); ROUND(ccc, ddd, aaa, bbb, F2, KK3, in[12], 5); ROUND(bbb, ccc, ddd, aaa, F2, KK3, in[2], 14); ROUND(aaa, bbb, ccc, ddd, F2, KK3, in[10], 13); ROUND(ddd, aaa, bbb, ccc, F2, KK3, in[0], 13); ROUND(ccc, ddd, aaa, bbb, F2, KK3, in[4], 7); ROUND(bbb, ccc, ddd, aaa, F2, KK3, in[13], 5); /* Swap contents of "c" registers */ tmp = cc; cc = ccc; ccc = tmp; /* round 4: left lane */ ROUND(aa, bb, cc, dd, F4, K4, in[1], 11); ROUND(dd, aa, bb, cc, F4, K4, in[9], 12); ROUND(cc, dd, aa, bb, F4, K4, in[11], 14); ROUND(bb, cc, dd, aa, F4, K4, in[10], 15); ROUND(aa, bb, cc, dd, F4, K4, in[0], 14); ROUND(dd, aa, bb, cc, F4, K4, in[8], 15); ROUND(cc, dd, aa, bb, F4, K4, in[12], 9); ROUND(bb, cc, dd, aa, F4, K4, in[4], 8); ROUND(aa, bb, cc, dd, F4, K4, in[13], 9); ROUND(dd, aa, bb, cc, F4, K4, in[3], 14); ROUND(cc, dd, aa, bb, F4, K4, in[7], 5); ROUND(bb, cc, dd, aa, F4, K4, in[15], 6); ROUND(aa, bb, cc, dd, F4, K4, in[14], 8); ROUND(dd, aa, bb, cc, F4, K4, in[5], 6); ROUND(cc, dd, aa, bb, F4, K4, in[6], 5); ROUND(bb, cc, dd, aa, F4, K4, in[2], 12); /* round 4: right lane */ ROUND(aaa, bbb, ccc, ddd, F1, KK4, in[8], 15); ROUND(ddd, aaa, bbb, ccc, F1, KK4, in[6], 5); ROUND(ccc, ddd, aaa, bbb, F1, KK4, in[4], 8); ROUND(bbb, ccc, ddd, aaa, F1, KK4, in[1], 11); ROUND(aaa, bbb, ccc, ddd, F1, KK4, in[3], 14); ROUND(ddd, aaa, bbb, ccc, F1, KK4, in[11], 14); ROUND(ccc, ddd, aaa, bbb, F1, KK4, in[15], 6); ROUND(bbb, ccc, ddd, aaa, F1, KK4, in[0], 14); ROUND(aaa, bbb, ccc, ddd, F1, KK4, in[5], 6); ROUND(ddd, aaa, bbb, ccc, F1, KK4, in[12], 9); ROUND(ccc, ddd, aaa, bbb, F1, KK4, in[2], 12); ROUND(bbb, ccc, ddd, aaa, F1, KK4, in[13], 9); ROUND(aaa, bbb, ccc, ddd, F1, KK4, in[9], 12); ROUND(ddd, aaa, bbb, ccc, F1, KK4, in[7], 5); ROUND(ccc, ddd, aaa, bbb, F1, KK4, in[10], 15); ROUND(bbb, ccc, ddd, aaa, F1, KK4, in[14], 8); /* Swap contents of "d" registers */ tmp = dd; dd = ddd; ddd = tmp; /* combine results */ state[0] += aa; state[1] += bb; state[2] += cc; state[3] += dd; state[4] += aaa; state[5] += bbb; state[6] += ccc; state[7] += ddd; return; }
C
linux
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
RunLengthEncoder::~RunLengthEncoder() { if (str->isEncoder()) delete str; }
RunLengthEncoder::~RunLengthEncoder() { if (str->isEncoder()) delete str; }
CPP
poppler
0
CVE-2014-9140
https://www.cvedetails.com/cve/CVE-2014-9140/
CWE-119
https://github.com/the-tcpdump-group/tcpdump/commit/0f95d441e4b5d7512cc5c326c8668a120e048eda
0f95d441e4b5d7512cc5c326c8668a120e048eda
Do bounds checking when unescaping PPP. Clean up a const issue while we're at it.
handle_ppp(netdissect_options *ndo, u_int proto, const u_char *p, int length) { if ((proto & 0xff00) == 0x7e00) { /* is this an escape code ? */ ppp_hdlc(ndo, p - 1, length); return; } switch (proto) { case PPP_LCP: /* fall through */ case PPP_IPCP: case PPP_OSICP: case PPP_MPLSCP: case PPP_IPV6CP: case PPP_CCP: case PPP_BACP: handle_ctrl_proto(ndo, proto, p, length); break; case PPP_ML: handle_mlppp(ndo, p, length); break; case PPP_CHAP: handle_chap(ndo, p, length); break; case PPP_PAP: handle_pap(ndo, p, length); break; case PPP_BAP: /* XXX: not yet completed */ handle_bap(ndo, p, length); break; case ETHERTYPE_IP: /*XXX*/ case PPP_VJNC: case PPP_IP: ip_print(ndo, p, length); break; case ETHERTYPE_IPV6: /*XXX*/ case PPP_IPV6: ip6_print(ndo, p, length); break; case ETHERTYPE_IPX: /*XXX*/ case PPP_IPX: ipx_print(ndo, p, length); break; case PPP_OSI: isoclns_print(ndo, p, length, length); break; case PPP_MPLS_UCAST: case PPP_MPLS_MCAST: mpls_print(ndo, p, length); break; case PPP_COMP: ND_PRINT((ndo, "compressed PPP data")); break; default: ND_PRINT((ndo, "%s ", tok2str(ppptype2str, "unknown PPP protocol (0x%04x)", proto))); print_unknown_data(ndo, p, "\n\t", length); break; } }
handle_ppp(netdissect_options *ndo, u_int proto, const u_char *p, int length) { if ((proto & 0xff00) == 0x7e00) { /* is this an escape code ? */ ppp_hdlc(ndo, p - 1, length); return; } switch (proto) { case PPP_LCP: /* fall through */ case PPP_IPCP: case PPP_OSICP: case PPP_MPLSCP: case PPP_IPV6CP: case PPP_CCP: case PPP_BACP: handle_ctrl_proto(ndo, proto, p, length); break; case PPP_ML: handle_mlppp(ndo, p, length); break; case PPP_CHAP: handle_chap(ndo, p, length); break; case PPP_PAP: handle_pap(ndo, p, length); break; case PPP_BAP: /* XXX: not yet completed */ handle_bap(ndo, p, length); break; case ETHERTYPE_IP: /*XXX*/ case PPP_VJNC: case PPP_IP: ip_print(ndo, p, length); break; case ETHERTYPE_IPV6: /*XXX*/ case PPP_IPV6: ip6_print(ndo, p, length); break; case ETHERTYPE_IPX: /*XXX*/ case PPP_IPX: ipx_print(ndo, p, length); break; case PPP_OSI: isoclns_print(ndo, p, length, length); break; case PPP_MPLS_UCAST: case PPP_MPLS_MCAST: mpls_print(ndo, p, length); break; case PPP_COMP: ND_PRINT((ndo, "compressed PPP data")); break; default: ND_PRINT((ndo, "%s ", tok2str(ppptype2str, "unknown PPP protocol (0x%04x)", proto))); print_unknown_data(ndo, p, "\n\t", length); break; } }
C
tcpdump
0
CVE-2019-11810
https://www.cvedetails.com/cve/CVE-2019-11810/
CWE-476
https://github.com/torvalds/linux/commit/bcf3b67d16a4c8ffae0aa79de5853435e683945c
bcf3b67d16a4c8ffae0aa79de5853435e683945c
scsi: megaraid_sas: return error when create DMA pool failed when create DMA pool for cmd frames failed, we should return -ENOMEM, instead of 0. In some case in: megasas_init_adapter_fusion() -->megasas_alloc_cmds() -->megasas_create_frame_pool create DMA pool failed, --> megasas_free_cmds() [1] -->megasas_alloc_cmds_fusion() failed, then goto fail_alloc_cmds. -->megasas_free_cmds() [2] we will call megasas_free_cmds twice, [1] will kfree cmd_list, [2] will use cmd_list.it will cause a problem: Unable to handle kernel NULL pointer dereference at virtual address 00000000 pgd = ffffffc000f70000 [00000000] *pgd=0000001fbf893003, *pud=0000001fbf893003, *pmd=0000001fbf894003, *pte=006000006d000707 Internal error: Oops: 96000005 [#1] SMP Modules linked in: CPU: 18 PID: 1 Comm: swapper/0 Not tainted task: ffffffdfb9290000 ti: ffffffdfb923c000 task.ti: ffffffdfb923c000 PC is at megasas_free_cmds+0x30/0x70 LR is at megasas_free_cmds+0x24/0x70 ... Call trace: [<ffffffc0005b779c>] megasas_free_cmds+0x30/0x70 [<ffffffc0005bca74>] megasas_init_adapter_fusion+0x2f4/0x4d8 [<ffffffc0005b926c>] megasas_init_fw+0x2dc/0x760 [<ffffffc0005b9ab0>] megasas_probe_one+0x3c0/0xcd8 [<ffffffc0004a5abc>] local_pci_probe+0x4c/0xb4 [<ffffffc0004a5c40>] pci_device_probe+0x11c/0x14c [<ffffffc00053a5e4>] driver_probe_device+0x1ec/0x430 [<ffffffc00053a92c>] __driver_attach+0xa8/0xb0 [<ffffffc000538178>] bus_for_each_dev+0x74/0xc8 [<ffffffc000539e88>] driver_attach+0x28/0x34 [<ffffffc000539a18>] bus_add_driver+0x16c/0x248 [<ffffffc00053b234>] driver_register+0x6c/0x138 [<ffffffc0004a5350>] __pci_register_driver+0x5c/0x6c [<ffffffc000ce3868>] megasas_init+0xc0/0x1a8 [<ffffffc000082a58>] do_one_initcall+0xe8/0x1ec [<ffffffc000ca7be8>] kernel_init_freeable+0x1c8/0x284 [<ffffffc0008d90b8>] kernel_init+0x1c/0xe4 Signed-off-by: Jason Yan <[email protected]> Acked-by: Sumit Saxena <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
static int megasas_get_ld_vf_affiliation(struct megasas_instance *instance, int initial) { int retval; if (instance->PlasmaFW111) retval = megasas_get_ld_vf_affiliation_111(instance, initial); else retval = megasas_get_ld_vf_affiliation_12(instance, initial); return retval; }
static int megasas_get_ld_vf_affiliation(struct megasas_instance *instance, int initial) { int retval; if (instance->PlasmaFW111) retval = megasas_get_ld_vf_affiliation_111(instance, initial); else retval = megasas_get_ld_vf_affiliation_12(instance, initial); return retval; }
C
linux
0