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-2014-9730
https://www.cvedetails.com/cve/CVE-2014-9730/
null
https://github.com/torvalds/linux/commit/e237ec37ec154564f8690c5bd1795339955eeef9
e237ec37ec154564f8690c5bd1795339955eeef9
udf: Check component length before reading it Check that length specified in a component of a symlink fits in the input buffer we are reading. Also properly ignore component length for component types that do not use it. Otherwise we read memory after end of buffer for corrupted udf image. Reported-by: Carl Henrik Lunde <[email protected]> CC: [email protected] Signed-off-by: Jan Kara <[email protected]>
static int udf_pc_to_char(struct super_block *sb, unsigned char *from, int fromlen, unsigned char *to, int tolen) { struct pathComponent *pc; int elen = 0; int comp_len; unsigned char *p = to; /* Reserve one byte for terminating \0 */ tolen--; while (elen < fromlen) { pc = (struct pathComponent *)(from + elen); elen += sizeof(struct pathComponent); switch (pc->componentType) { case 1: /* * Symlink points to some place which should be agreed * upon between originator and receiver of the media. Ignore. */ if (pc->lengthComponentIdent > 0) { elen += pc->lengthComponentIdent; break; } /* Fall through */ case 2: if (tolen == 0) return -ENAMETOOLONG; p = to; *p++ = '/'; tolen--; break; case 3: if (tolen < 3) return -ENAMETOOLONG; memcpy(p, "../", 3); p += 3; tolen -= 3; break; case 4: if (tolen < 2) return -ENAMETOOLONG; memcpy(p, "./", 2); p += 2; tolen -= 2; /* that would be . - just ignore */ break; case 5: elen += pc->lengthComponentIdent; if (elen > fromlen) return -EIO; comp_len = udf_get_filename(sb, pc->componentIdent, pc->lengthComponentIdent, p, tolen); p += comp_len; tolen -= comp_len; if (tolen == 0) return -ENAMETOOLONG; *p++ = '/'; tolen--; break; } } if (p > to + 1) p[-1] = '\0'; else p[0] = '\0'; return 0; }
static int udf_pc_to_char(struct super_block *sb, unsigned char *from, int fromlen, unsigned char *to, int tolen) { struct pathComponent *pc; int elen = 0; int comp_len; unsigned char *p = to; /* Reserve one byte for terminating \0 */ tolen--; while (elen < fromlen) { pc = (struct pathComponent *)(from + elen); switch (pc->componentType) { case 1: /* * Symlink points to some place which should be agreed * upon between originator and receiver of the media. Ignore. */ if (pc->lengthComponentIdent > 0) break; /* Fall through */ case 2: if (tolen == 0) return -ENAMETOOLONG; p = to; *p++ = '/'; tolen--; break; case 3: if (tolen < 3) return -ENAMETOOLONG; memcpy(p, "../", 3); p += 3; tolen -= 3; break; case 4: if (tolen < 2) return -ENAMETOOLONG; memcpy(p, "./", 2); p += 2; tolen -= 2; /* that would be . - just ignore */ break; case 5: comp_len = udf_get_filename(sb, pc->componentIdent, pc->lengthComponentIdent, p, tolen); p += comp_len; tolen -= comp_len; if (tolen == 0) return -ENAMETOOLONG; *p++ = '/'; tolen--; break; } elen += sizeof(struct pathComponent) + pc->lengthComponentIdent; } if (p > to + 1) p[-1] = '\0'; else p[0] = '\0'; return 0; }
C
linux
1
CVE-2016-1696
https://www.cvedetails.com/cve/CVE-2016-1696/
CWE-284
https://github.com/chromium/chromium/commit/c0569cc04741cccf6548c2169fcc1609d958523f
c0569cc04741cccf6548c2169fcc1609d958523f
[Extensions] Expand bindings access checks BUG=601149 BUG=601073 Review URL: https://codereview.chromium.org/1866103002 Cr-Commit-Position: refs/heads/master@{#387710}
void ChromeExtensionsDispatcherDelegate::InitOriginPermissions( const extensions::Extension* extension, bool is_extension_active) { if (is_extension_active && extension->permissions_data()->HasAPIPermission( extensions::APIPermission::kManagement)) { blink::WebSecurityPolicy::addOriginAccessWhitelistEntry( extension->url(), blink::WebString::fromUTF8(content::kChromeUIScheme), blink::WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), false); } }
void ChromeExtensionsDispatcherDelegate::InitOriginPermissions( const extensions::Extension* extension, bool is_extension_active) { if (is_extension_active && extension->permissions_data()->HasAPIPermission( extensions::APIPermission::kManagement)) { blink::WebSecurityPolicy::addOriginAccessWhitelistEntry( extension->url(), blink::WebString::fromUTF8(content::kChromeUIScheme), blink::WebString::fromUTF8(chrome::kChromeUIExtensionIconHost), false); } }
C
Chrome
0
CVE-2016-3839
https://www.cvedetails.com/cve/CVE-2016-3839/
CWE-284
https://android.googlesource.com/platform/system/bt/+/472271b153c5dc53c28beac55480a8d8434b2d5c
472271b153c5dc53c28beac55480a8d8434b2d5c
DO NOT MERGE Fix potential DoS caused by delivering signal to BT process Bug: 28885210 Change-Id: I63866d894bfca47464d6e42e3fb0357c4f94d360 Conflicts: btif/co/bta_hh_co.c btif/src/btif_core.c Merge conflict resolution of ag/1161415 (referencing ag/1164670) - Directly into mnc-mr2-release
static void btif_hl_stop_timer_using_handle( tBTA_HL_MCL_HANDLE mcl_handle){ btif_hl_app_cb_t *p_acb; UINT8 i,j; for (i=0; i<BTA_HL_NUM_APPS; i++) { p_acb =BTIF_HL_GET_APP_CB_PTR(i); for (j=0; j < BTA_HL_NUM_MCLS ; j++) { if (p_acb->mcb[j].in_use && (p_acb->mcb[j].mcl_handle == mcl_handle)) { btif_hl_stop_cch_timer(i, j); } } } }
static void btif_hl_stop_timer_using_handle( tBTA_HL_MCL_HANDLE mcl_handle){ btif_hl_app_cb_t *p_acb; UINT8 i,j; for (i=0; i<BTA_HL_NUM_APPS; i++) { p_acb =BTIF_HL_GET_APP_CB_PTR(i); for (j=0; j < BTA_HL_NUM_MCLS ; j++) { if (p_acb->mcb[j].in_use && (p_acb->mcb[j].mcl_handle == mcl_handle)) { btif_hl_stop_cch_timer(i, j); } } } }
C
Android
0
CVE-2016-8740
https://www.cvedetails.com/cve/CVE-2016-8740/
CWE-20
https://github.com/apache/httpd/commit/29c63b786ae028d82405421585e91283c8fa0da3
29c63b786ae028d82405421585e91283c8fa0da3
SECURITY: CVE-2016-8740 mod_http2: properly crafted, endless HTTP/2 CONTINUATION frames could be used to exhaust all server's memory. Reported by: Naveen Tiwari <[email protected]> and CDF/SEFCOM at Arizona State University git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1772576 13f79535-47bb-0310-9956-ffa450edef68
static void prep_output(h2_stream *stream) { conn_rec *c = stream->session->c; if (!stream->out_buffer) { stream->out_buffer = apr_brigade_create(stream->pool, c->bucket_alloc); } }
static void prep_output(h2_stream *stream) { conn_rec *c = stream->session->c; if (!stream->out_buffer) { stream->out_buffer = apr_brigade_create(stream->pool, c->bucket_alloc); } }
C
httpd
0
CVE-2019-12818
https://www.cvedetails.com/cve/CVE-2019-12818/
CWE-476
https://github.com/torvalds/linux/commit/58bdd544e2933a21a51eecf17c3f5f94038261b5
58bdd544e2933a21a51eecf17c3f5f94038261b5
net: nfc: Fix NULL dereference on nfc_llcp_build_tlv fails KASAN report this: BUG: KASAN: null-ptr-deref in nfc_llcp_build_gb+0x37f/0x540 [nfc] Read of size 3 at addr 0000000000000000 by task syz-executor.0/5401 CPU: 0 PID: 5401 Comm: syz-executor.0 Not tainted 5.0.0-rc7+ #45 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xfa/0x1ce lib/dump_stack.c:113 kasan_report+0x171/0x18d mm/kasan/report.c:321 memcpy+0x1f/0x50 mm/kasan/common.c:130 nfc_llcp_build_gb+0x37f/0x540 [nfc] nfc_llcp_register_device+0x6eb/0xb50 [nfc] nfc_register_device+0x50/0x1d0 [nfc] nfcsim_device_new+0x394/0x67d [nfcsim] ? 0xffffffffc1080000 nfcsim_init+0x6b/0x1000 [nfcsim] do_one_initcall+0xfa/0x5ca init/main.c:887 do_init_module+0x204/0x5f6 kernel/module.c:3460 load_module+0x66b2/0x8570 kernel/module.c:3808 __do_sys_finit_module+0x238/0x2a0 kernel/module.c:3902 do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x462e99 Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f9cb79dcc58 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99 RDX: 0000000000000000 RSI: 0000000020000280 RDI: 0000000000000003 RBP: 00007f9cb79dcc70 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f9cb79dd6bc R13: 00000000004bcefb R14: 00000000006f7030 R15: 0000000000000004 nfc_llcp_build_tlv will return NULL on fails, caller should check it, otherwise will trigger a NULL dereference. Reported-by: Hulk Robot <[email protected]> Fixes: eda21f16a5ed ("NFC: Set MIU and RW values from CONNECT and CC LLCP frames") Fixes: d646960f7986 ("NFC: Initial LLCP support") Signed-off-by: YueHaibing <[email protected]> Signed-off-by: David S. Miller <[email protected]>
void nfc_llcp_recv(void *data, struct sk_buff *skb, int err) { struct nfc_llcp_local *local = (struct nfc_llcp_local *) data; pr_debug("Received an LLCP PDU\n"); if (err < 0) { pr_err("err %d\n", err); return; } __nfc_llcp_recv(local, skb); }
void nfc_llcp_recv(void *data, struct sk_buff *skb, int err) { struct nfc_llcp_local *local = (struct nfc_llcp_local *) data; pr_debug("Received an LLCP PDU\n"); if (err < 0) { pr_err("err %d\n", err); return; } __nfc_llcp_recv(local, skb); }
C
linux
0
CVE-2009-3605
https://www.cvedetails.com/cve/CVE-2009-3605/
CWE-189
https://cgit.freedesktop.org/poppler/poppler/commit/?id=7b2d314a61fd0e12f47c62996cb49ec0d1ba747a
7b2d314a61fd0e12f47c62996cb49ec0d1ba747a
null
void GfxState::setStrokePattern(GfxPattern *pattern) { if (strokePattern) { delete strokePattern; } strokePattern = pattern; }
void GfxState::setStrokePattern(GfxPattern *pattern) { if (strokePattern) { delete strokePattern; } strokePattern = pattern; }
CPP
poppler
0
CVE-2018-14568
https://www.cvedetails.com/cve/CVE-2018-14568/
null
https://github.com/OISF/suricata/pull/3428/commits/843d0b7a10bb45627f94764a6c5d468a24143345
843d0b7a10bb45627f94764a6c5d468a24143345
stream: support RST getting lost/ignored In case of a valid RST on a SYN, the state is switched to 'TCP_CLOSED'. However, the target of the RST may not have received it, or may not have accepted it. Also, the RST may have been injected, so the supposed sender may not actually be aware of the RST that was sent in it's name. In this case the previous behavior was to switch the state to CLOSED and accept no further TCP updates or stream reassembly. This patch changes this. It still switches the state to CLOSED, as this is by far the most likely to be correct. However, it will reconsider the state if the receiver continues to talk. To do this on each state change the previous state will be recorded in TcpSession::pstate. If a non-RST packet is received after a RST, this TcpSession::pstate is used to try to continue the conversation. If the (supposed) sender of the RST is also continueing the conversation as normal, it's highly likely it didn't send the RST. In this case a stream event is generated. Ticket: #2501 Reported-By: Kirill Shipulin
static int StreamTcpSessionPoolInit(void *data, void* initdata) { memset(data, 0, sizeof(TcpSession)); StreamTcpIncrMemuse((uint64_t)sizeof(TcpSession)); return 1; }
static int StreamTcpSessionPoolInit(void *data, void* initdata) { memset(data, 0, sizeof(TcpSession)); StreamTcpIncrMemuse((uint64_t)sizeof(TcpSession)); return 1; }
C
suricata
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}
xsltShutdownExt(xsltExtDataPtr data, xsltStylesheetPtr style, const xmlChar * URI) { xsltExtModulePtr module; if ((data == NULL) || (style == NULL) || (URI == NULL)) return; module = data->extModule; if ((module == NULL) || (module->styleShutdownFunc == NULL)) return; #ifdef WITH_XSLT_DEBUG_EXTENSIONS xsltGenericDebug(xsltGenericDebugContext, "Shutting down module : %s\n", URI); #endif module->styleShutdownFunc(style, URI, data->extData); /* * Don't remove the entry from the hash table here, since * this will produce segfaults - this fixes bug #340624. * * xmlHashRemoveEntry(style->extInfos, URI, * (xmlHashDeallocator) xsltFreeExtData); */ }
xsltShutdownExt(xsltExtDataPtr data, xsltStylesheetPtr style, const xmlChar * URI) { xsltExtModulePtr module; if ((data == NULL) || (style == NULL) || (URI == NULL)) return; module = data->extModule; if ((module == NULL) || (module->styleShutdownFunc == NULL)) return; #ifdef WITH_XSLT_DEBUG_EXTENSIONS xsltGenericDebug(xsltGenericDebugContext, "Shutting down module : %s\n", URI); #endif module->styleShutdownFunc(style, URI, data->extData); /* * Don't remove the entry from the hash table here, since * this will produce segfaults - this fixes bug #340624. * * xmlHashRemoveEntry(style->extInfos, URI, * (xmlHashDeallocator) xsltFreeExtData); */ }
C
Chrome
0
CVE-2012-3552
https://www.cvedetails.com/cve/CVE-2012-3552/
CWE-362
https://github.com/torvalds/linux/commit/f6d8bd051c391c1c0458a30b2a7abcd939329259
f6d8bd051c391c1c0458a30b2a7abcd939329259
inet: add RCU protection to inet->opt We lack proper synchronization to manipulate inet->opt ip_options Problem is ip_make_skb() calls ip_setup_cork() and ip_setup_cork() possibly makes a copy of ipc->opt (struct ip_options), without any protection against another thread manipulating inet->opt. Another thread can change inet->opt pointer and free old one under us. Use RCU to protect inet->opt (changed to inet->inet_opt). Instead of handling atomic refcounts, just copy ip_options when necessary, to avoid cache line dirtying. We cant insert an rcu_head in struct ip_options since its included in skb->cb[], so this patch is large because I had to introduce a new ip_options_rcu structure. Signed-off-by: Eric Dumazet <[email protected]> Cc: Herbert Xu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, struct request_values *rv_unused) { struct inet6_request_sock *ireq6 = inet6_rsk(req); struct ipv6_pinfo *np = inet6_sk(sk); struct sk_buff *skb; struct ipv6_txoptions *opt = NULL; struct in6_addr *final_p, final; struct flowi6 fl6; int err = -1; struct dst_entry *dst; memset(&fl6, 0, sizeof(fl6)); fl6.flowi6_proto = IPPROTO_DCCP; ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr); ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr); fl6.flowlabel = 0; fl6.flowi6_oif = ireq6->iif; fl6.fl6_dport = inet_rsk(req)->rmt_port; fl6.fl6_sport = inet_rsk(req)->loc_port; security_req_classify_flow(req, flowi6_to_flowi(&fl6)); opt = np->opt; final_p = fl6_update_dst(&fl6, opt, &final); dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); if (IS_ERR(dst)) { err = PTR_ERR(dst); dst = NULL; goto done; } skb = dccp_make_response(sk, dst, req); if (skb != NULL) { struct dccp_hdr *dh = dccp_hdr(skb); dh->dccph_checksum = dccp_v6_csum_finish(skb, &ireq6->loc_addr, &ireq6->rmt_addr); ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr); err = ip6_xmit(sk, skb, &fl6, opt); err = net_xmit_eval(err); } done: if (opt != NULL && opt != np->opt) sock_kfree_s(sk, opt, opt->tot_len); dst_release(dst); return err; }
static int dccp_v6_send_response(struct sock *sk, struct request_sock *req, struct request_values *rv_unused) { struct inet6_request_sock *ireq6 = inet6_rsk(req); struct ipv6_pinfo *np = inet6_sk(sk); struct sk_buff *skb; struct ipv6_txoptions *opt = NULL; struct in6_addr *final_p, final; struct flowi6 fl6; int err = -1; struct dst_entry *dst; memset(&fl6, 0, sizeof(fl6)); fl6.flowi6_proto = IPPROTO_DCCP; ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr); ipv6_addr_copy(&fl6.saddr, &ireq6->loc_addr); fl6.flowlabel = 0; fl6.flowi6_oif = ireq6->iif; fl6.fl6_dport = inet_rsk(req)->rmt_port; fl6.fl6_sport = inet_rsk(req)->loc_port; security_req_classify_flow(req, flowi6_to_flowi(&fl6)); opt = np->opt; final_p = fl6_update_dst(&fl6, opt, &final); dst = ip6_dst_lookup_flow(sk, &fl6, final_p, false); if (IS_ERR(dst)) { err = PTR_ERR(dst); dst = NULL; goto done; } skb = dccp_make_response(sk, dst, req); if (skb != NULL) { struct dccp_hdr *dh = dccp_hdr(skb); dh->dccph_checksum = dccp_v6_csum_finish(skb, &ireq6->loc_addr, &ireq6->rmt_addr); ipv6_addr_copy(&fl6.daddr, &ireq6->rmt_addr); err = ip6_xmit(sk, skb, &fl6, opt); err = net_xmit_eval(err); } done: if (opt != NULL && opt != np->opt) sock_kfree_s(sk, opt, opt->tot_len); dst_release(dst); return err; }
C
linux
0
CVE-2017-15906
https://www.cvedetails.com/cve/CVE-2017-15906/
CWE-269
https://github.com/openbsd/src/commit/a6981567e8e215acc1ef690c8dbb30f2d9b00a19
a6981567e8e215acc1ef690c8dbb30f2d9b00a19
disallow creation (of empty files) in read-only mode; reported by Michal Zalewski, feedback & ok deraadt@
handle_update_write(int handle, ssize_t bytes) { if (handle_is_ok(handle, HANDLE_FILE) && bytes > 0) handles[handle].bytes_write += bytes; }
handle_update_write(int handle, ssize_t bytes) { if (handle_is_ok(handle, HANDLE_FILE) && bytes > 0) handles[handle].bytes_write += bytes; }
C
src
0
CVE-2015-1274
https://www.cvedetails.com/cve/CVE-2015-1274/
CWE-254
https://github.com/chromium/chromium/commit/d27468a832d5316884bd02f459cbf493697fd7e1
d27468a832d5316884bd02f459cbf493697fd7e1
Switch to equalIgnoringASCIICase throughout modules/accessibility BUG=627682 Review-Url: https://codereview.chromium.org/2793913007 Cr-Commit-Position: refs/heads/master@{#461858}
bool AXLayoutObject::isLinked() const { if (!isLinkable(*this)) return false; Element* anchor = anchorElement(); if (!isHTMLAnchorElement(anchor)) return false; return !toHTMLAnchorElement(*anchor).href().isEmpty(); }
bool AXLayoutObject::isLinked() const { if (!isLinkable(*this)) return false; Element* anchor = anchorElement(); if (!isHTMLAnchorElement(anchor)) return false; return !toHTMLAnchorElement(*anchor).href().isEmpty(); }
C
Chrome
0
CVE-2016-1665
https://www.cvedetails.com/cve/CVE-2016-1665/
CWE-20
https://github.com/chromium/chromium/commit/282f53ffdc3b1902da86f6a0791af736837efbf8
282f53ffdc3b1902da86f6a0791af736837efbf8
[signin] Add metrics to track the source for refresh token updated events This CL add a source for update and revoke credentials operations. It then surfaces the source in the chrome://signin-internals page. This CL also records the following histograms that track refresh token events: * Signin.RefreshTokenUpdated.ToValidToken.Source * Signin.RefreshTokenUpdated.ToInvalidToken.Source * Signin.RefreshTokenRevoked.Source These histograms are needed to validate the assumptions of how often tokens are revoked by the browser and the sources for the token revocations. Bug: 896182 Change-Id: I2fcab80ee8e5699708e695bc3289fa6d34859a90 Reviewed-on: https://chromium-review.googlesource.com/c/1286464 Reviewed-by: Jochen Eisinger <[email protected]> Reviewed-by: David Roger <[email protected]> Reviewed-by: Ilya Sherman <[email protected]> Commit-Queue: Mihai Sardarescu <[email protected]> Cr-Commit-Position: refs/heads/master@{#606181}
DiceResponseHandler* DiceResponseHandler::GetForProfile(Profile* profile) { return DiceResponseHandlerFactory::GetForProfile(profile); }
DiceResponseHandler* DiceResponseHandler::GetForProfile(Profile* profile) { return DiceResponseHandlerFactory::GetForProfile(profile); }
C
Chrome
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
static int cmp_gss_names_rel_1(gss_name_t n1, gss_name_t n2) { OM_uint32 min_stat; int ret; ret = cmp_gss_names(n1, n2); if (n1) (void) gss_release_name(&min_stat, &n1); return ret; }
static int cmp_gss_names_rel_1(gss_name_t n1, gss_name_t n2) { OM_uint32 min_stat; int ret; ret = cmp_gss_names(n1, n2); if (n1) (void) gss_release_name(&min_stat, &n1); return ret; }
C
krb5
0
CVE-2017-6542
https://www.cvedetails.com/cve/CVE-2017-6542/
CWE-119
https://git.tartarus.org/?p=simon/putty.git;a=commitdiff;h=4ff22863d895cb7ebfced4cf923a012a614adaa8
4ff22863d895cb7ebfced4cf923a012a614adaa8
null
static int ssh_channelcmp(void *av, void *bv) { struct ssh_channel *a = (struct ssh_channel *) av; struct ssh_channel *b = (struct ssh_channel *) bv; if (a->localid < b->localid) return -1; if (a->localid > b->localid) return +1; return 0; }
static int ssh_channelcmp(void *av, void *bv) { struct ssh_channel *a = (struct ssh_channel *) av; struct ssh_channel *b = (struct ssh_channel *) bv; if (a->localid < b->localid) return -1; if (a->localid > b->localid) return +1; return 0; }
C
tartarus
0
CVE-2017-5014
https://www.cvedetails.com/cve/CVE-2017-5014/
CWE-119
https://github.com/chromium/chromium/commit/35eb28748d45b87695a69eceffaff73a0be476af
35eb28748d45b87695a69eceffaff73a0be476af
Remove unused histograms from the background loader offliner. Bug: 975512 Change-Id: I87b0a91bed60e3a9e8a1fd9ae9b18cac27a0859f Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1683361 Reviewed-by: Cathy Li <[email protected]> Reviewed-by: Steven Holte <[email protected]> Commit-Queue: Peter Williamson <[email protected]> Cr-Commit-Position: refs/heads/master@{#675332}
void CompleteSavingAsAlreadyExists() { DCHECK(mock_saving_); mock_saving_ = false; base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(save_page_callback_), SavePageResult::ALREADY_EXISTS, 123456)); }
void CompleteSavingAsAlreadyExists() { DCHECK(mock_saving_); mock_saving_ = false; base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(save_page_callback_), SavePageResult::ALREADY_EXISTS, 123456)); }
C
Chrome
0
CVE-2018-1091
https://www.cvedetails.com/cve/CVE-2018-1091/
CWE-119
https://github.com/torvalds/linux/commit/c1fa0768a8713b135848f78fd43ffc208d8ded70
c1fa0768a8713b135848f78fd43ffc208d8ded70
powerpc/tm: Flush TM only if CPU has TM feature Commit cd63f3c ("powerpc/tm: Fix saving of TM SPRs in core dump") added code to access TM SPRs in flush_tmregs_to_thread(). However flush_tmregs_to_thread() does not check if TM feature is available on CPU before trying to access TM SPRs in order to copy live state to thread structures. flush_tmregs_to_thread() is indeed guarded by CONFIG_PPC_TRANSACTIONAL_MEM but it might be the case that kernel was compiled with CONFIG_PPC_TRANSACTIONAL_MEM enabled and ran on a CPU without TM feature available, thus rendering the execution of TM instructions that are treated by the CPU as illegal instructions. The fix is just to add proper checking in flush_tmregs_to_thread() if CPU has the TM feature before accessing any TM-specific resource, returning immediately if TM is no available on the CPU. Adding that checking in flush_tmregs_to_thread() instead of in places where it is called, like in vsr_get() and vsr_set(), is better because avoids the same problem cropping up elsewhere. Cc: [email protected] # v4.13+ Fixes: cd63f3c ("powerpc/tm: Fix saving of TM SPRs in core dump") Signed-off-by: Gustavo Romero <[email protected]> Reviewed-by: Cyril Bur <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
static int vr_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) { int ret; flush_altivec_to_thread(target); BUILD_BUG_ON(offsetof(struct thread_vr_state, vscr) != offsetof(struct thread_vr_state, vr[32])); ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &target->thread.vr_state, 0, 33 * sizeof(vector128)); if (!ret) { /* * Copy out only the low-order word of vrsave. */ union { elf_vrreg_t reg; u32 word; } vrsave; memset(&vrsave, 0, sizeof(vrsave)); vrsave.word = target->thread.vrsave; ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &vrsave, 33 * sizeof(vector128), -1); } return ret; }
static int vr_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) { int ret; flush_altivec_to_thread(target); BUILD_BUG_ON(offsetof(struct thread_vr_state, vscr) != offsetof(struct thread_vr_state, vr[32])); ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &target->thread.vr_state, 0, 33 * sizeof(vector128)); if (!ret) { /* * Copy out only the low-order word of vrsave. */ union { elf_vrreg_t reg; u32 word; } vrsave; memset(&vrsave, 0, sizeof(vrsave)); vrsave.word = target->thread.vrsave; ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &vrsave, 33 * sizeof(vector128), -1); } return ret; }
C
linux
0
CVE-2018-15857
https://www.cvedetails.com/cve/CVE-2018-15857/
CWE-416
https://github.com/xkbcommon/libxkbcommon/commit/c1e5ac16e77a21f87bdf3bc4dea61b037a17dddb
c1e5ac16e77a21f87bdf3bc4dea61b037a17dddb
xkbcomp: fix pointer value for FreeStmt Signed-off-by: Peter Hutterer <[email protected]>
ExprCreateBinary(enum expr_op_type op, ExprDef *left, ExprDef *right) { EXPR_CREATE(ExprBinary, expr, op, EXPR_TYPE_UNKNOWN); if (op == EXPR_ASSIGN || left->expr.value_type == EXPR_TYPE_UNKNOWN) expr->expr.value_type = right->expr.value_type; else if (left->expr.value_type == right->expr.value_type || right->expr.value_type == EXPR_TYPE_UNKNOWN) expr->expr.value_type = left->expr.value_type; expr->binary.left = left; expr->binary.right = right; return expr; }
ExprCreateBinary(enum expr_op_type op, ExprDef *left, ExprDef *right) { EXPR_CREATE(ExprBinary, expr, op, EXPR_TYPE_UNKNOWN); if (op == EXPR_ASSIGN || left->expr.value_type == EXPR_TYPE_UNKNOWN) expr->expr.value_type = right->expr.value_type; else if (left->expr.value_type == right->expr.value_type || right->expr.value_type == EXPR_TYPE_UNKNOWN) expr->expr.value_type = left->expr.value_type; expr->binary.left = left; expr->binary.right = right; return expr; }
C
libxkbcommon
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 GLES2Implementation::VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void* ptr) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribIPointer(" << index << ", " << size << ", " << GLES2Util::GetStringVertexAttribIType(type) << ", " << stride << ", " << ptr << ")"); if (!vertex_array_object_manager_->SetAttribPointer( bound_array_buffer_, index, size, type, GL_FALSE, stride, ptr, GL_TRUE)) { SetGLError(GL_INVALID_OPERATION, "glVertexAttribIPointer", "client side arrays are not allowed in vertex array objects."); return; } if (!support_client_side_arrays_ || bound_array_buffer_ != 0) { if (!ValidateOffset("glVertexAttribIPointer", reinterpret_cast<GLintptr>(ptr))) { return; } helper_->VertexAttribIPointer(index, size, type, stride, ToGLuint(ptr)); } CheckGLError(); }
void GLES2Implementation::VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void* ptr) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glVertexAttribIPointer(" << index << ", " << size << ", " << GLES2Util::GetStringVertexAttribIType(type) << ", " << stride << ", " << ptr << ")"); if (!vertex_array_object_manager_->SetAttribPointer( bound_array_buffer_, index, size, type, GL_FALSE, stride, ptr, GL_TRUE)) { SetGLError(GL_INVALID_OPERATION, "glVertexAttribIPointer", "client side arrays are not allowed in vertex array objects."); return; } if (!support_client_side_arrays_ || bound_array_buffer_ != 0) { if (!ValidateOffset("glVertexAttribIPointer", reinterpret_cast<GLintptr>(ptr))) { return; } helper_->VertexAttribIPointer(index, size, type, stride, ToGLuint(ptr)); } CheckGLError(); }
C
Chrome
0
CVE-2011-2486
https://www.cvedetails.com/cve/CVE-2011-2486/
CWE-264
https://github.com/davidben/nspluginwrapper/commit/7e4ab8e1189846041f955e6c83f72bc1624e7a98
7e4ab8e1189846041f955e6c83f72bc1624e7a98
Support all the new variables added
g_NPP_SetWindow(NPP instance, NPWindow *np_window) { if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; PluginInstance *plugin = PLUGIN_INSTANCE(instance); if (plugin == NULL) return NPERR_INVALID_INSTANCE_ERROR; if (plugin_funcs.setwindow == NULL) return NPERR_INVALID_FUNCTABLE_ERROR; plugin->is_windowless = np_window && np_window->type == NPWindowTypeDrawable; NPWindow *window = np_window; if (window && (window->window || plugin->is_windowless)) { if (plugin->toolkit_data) { if (update_window(plugin, window) < 0) return NPERR_GENERIC_ERROR; } else { if (create_window(plugin, window) < 0) return NPERR_GENERIC_ERROR; } window = &plugin->window; } D(bugiI("NPP_SetWindow instance=%p, window=%p\n", instance, window ? window->window : NULL)); NPError ret = plugin_funcs.setwindow(instance, window); D(bugiD("NPP_SetWindow return: %d [%s]\n", ret, string_of_NPError(ret))); if (np_window == NULL || (np_window->window == NULL && !plugin->is_windowless)) destroy_window(plugin); return ret; }
g_NPP_SetWindow(NPP instance, NPWindow *np_window) { if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; PluginInstance *plugin = PLUGIN_INSTANCE(instance); if (plugin == NULL) return NPERR_INVALID_INSTANCE_ERROR; if (plugin_funcs.setwindow == NULL) return NPERR_INVALID_FUNCTABLE_ERROR; plugin->is_windowless = np_window && np_window->type == NPWindowTypeDrawable; NPWindow *window = np_window; if (window && (window->window || plugin->is_windowless)) { if (plugin->toolkit_data) { if (update_window(plugin, window) < 0) return NPERR_GENERIC_ERROR; } else { if (create_window(plugin, window) < 0) return NPERR_GENERIC_ERROR; } window = &plugin->window; } D(bugiI("NPP_SetWindow instance=%p, window=%p\n", instance, window ? window->window : NULL)); NPError ret = plugin_funcs.setwindow(instance, window); D(bugiD("NPP_SetWindow return: %d [%s]\n", ret, string_of_NPError(ret))); if (np_window == NULL || (np_window->window == NULL && !plugin->is_windowless)) destroy_window(plugin); return ret; }
C
nspluginwrapper
0
CVE-2017-2671
https://www.cvedetails.com/cve/CVE-2017-2671/
null
https://github.com/torvalds/linux/commit/43a6684519ab0a6c52024b5e25322476cabad893
43a6684519ab0a6c52024b5e25322476cabad893
ping: implement proper locking We got a report of yet another bug in ping http://www.openwall.com/lists/oss-security/2017/03/24/6 ->disconnect() is not called with socket lock held. Fix this by acquiring ping rwlock earlier. Thanks to Daniel, Alexander and Andrey for letting us know this problem. Fixes: c319b4d76b9e ("net: ipv4: add IPPROTO_ICMP socket kind") Signed-off-by: Eric Dumazet <[email protected]> Reported-by: Daniel Jiang <[email protected]> Reported-by: Solar Designer <[email protected]> Reported-by: Andrey Konovalov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
int ping_getfrag(void *from, char *to, int offset, int fraglen, int odd, struct sk_buff *skb) { struct pingfakehdr *pfh = (struct pingfakehdr *)from; if (offset == 0) { fraglen -= sizeof(struct icmphdr); if (fraglen < 0) BUG(); if (!csum_and_copy_from_iter_full(to + sizeof(struct icmphdr), fraglen, &pfh->wcheck, &pfh->msg->msg_iter)) return -EFAULT; } else if (offset < sizeof(struct icmphdr)) { BUG(); } else { if (!csum_and_copy_from_iter_full(to, fraglen, &pfh->wcheck, &pfh->msg->msg_iter)) return -EFAULT; } #if IS_ENABLED(CONFIG_IPV6) /* For IPv6, checksum each skb as we go along, as expected by * icmpv6_push_pending_frames. For IPv4, accumulate the checksum in * wcheck, it will be finalized in ping_v4_push_pending_frames. */ if (pfh->family == AF_INET6) { skb->csum = pfh->wcheck; skb->ip_summed = CHECKSUM_NONE; pfh->wcheck = 0; } #endif return 0; }
int ping_getfrag(void *from, char *to, int offset, int fraglen, int odd, struct sk_buff *skb) { struct pingfakehdr *pfh = (struct pingfakehdr *)from; if (offset == 0) { fraglen -= sizeof(struct icmphdr); if (fraglen < 0) BUG(); if (!csum_and_copy_from_iter_full(to + sizeof(struct icmphdr), fraglen, &pfh->wcheck, &pfh->msg->msg_iter)) return -EFAULT; } else if (offset < sizeof(struct icmphdr)) { BUG(); } else { if (!csum_and_copy_from_iter_full(to, fraglen, &pfh->wcheck, &pfh->msg->msg_iter)) return -EFAULT; } #if IS_ENABLED(CONFIG_IPV6) /* For IPv6, checksum each skb as we go along, as expected by * icmpv6_push_pending_frames. For IPv4, accumulate the checksum in * wcheck, it will be finalized in ping_v4_push_pending_frames. */ if (pfh->family == AF_INET6) { skb->csum = pfh->wcheck; skb->ip_summed = CHECKSUM_NONE; pfh->wcheck = 0; } #endif return 0; }
C
linux
0
CVE-2013-6368
https://www.cvedetails.com/cve/CVE-2013-6368/
CWE-20
https://github.com/torvalds/linux/commit/fda4e2e85589191b123d31cdc21fd33ee70f50fd
fda4e2e85589191b123d31cdc21fd33ee70f50fd
KVM: x86: Convert vapic synchronization to _cached functions (CVE-2013-6368) In kvm_lapic_sync_from_vapic and kvm_lapic_sync_to_vapic there is the potential to corrupt kernel memory if userspace provides an address that is at the end of a page. This patches concerts those functions to use kvm_write_guest_cached and kvm_read_guest_cached. It also checks the vapic_address specified by userspace during ioctl processing and returns an error to userspace if the address is not a valid GPA. This is generally not guest triggerable, because the required write is done by firmware that runs before the guest. Also, it only affects AMD processors and oldish Intel that do not have the FlexPriority feature (unless you disable FlexPriority, of course; then newer processors are also affected). Fixes: b93463aa59d6 ('KVM: Accelerated apic support') Reported-by: Andrew Honig <[email protected]> Cc: [email protected] Signed-off-by: Andrew Honig <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) { unsigned long nr, a0, a1, a2, a3, ret; int r = 1; if (kvm_hv_hypercall_enabled(vcpu->kvm)) return kvm_hv_hypercall(vcpu); nr = kvm_register_read(vcpu, VCPU_REGS_RAX); a0 = kvm_register_read(vcpu, VCPU_REGS_RBX); a1 = kvm_register_read(vcpu, VCPU_REGS_RCX); a2 = kvm_register_read(vcpu, VCPU_REGS_RDX); a3 = kvm_register_read(vcpu, VCPU_REGS_RSI); trace_kvm_hypercall(nr, a0, a1, a2, a3); if (!is_long_mode(vcpu)) { nr &= 0xFFFFFFFF; a0 &= 0xFFFFFFFF; a1 &= 0xFFFFFFFF; a2 &= 0xFFFFFFFF; a3 &= 0xFFFFFFFF; } if (kvm_x86_ops->get_cpl(vcpu) != 0) { ret = -KVM_EPERM; goto out; } switch (nr) { case KVM_HC_VAPIC_POLL_IRQ: ret = 0; break; case KVM_HC_KICK_CPU: kvm_pv_kick_cpu_op(vcpu->kvm, a0, a1); ret = 0; break; default: ret = -KVM_ENOSYS; break; } out: kvm_register_write(vcpu, VCPU_REGS_RAX, ret); ++vcpu->stat.hypercalls; return r; }
int kvm_emulate_hypercall(struct kvm_vcpu *vcpu) { unsigned long nr, a0, a1, a2, a3, ret; int r = 1; if (kvm_hv_hypercall_enabled(vcpu->kvm)) return kvm_hv_hypercall(vcpu); nr = kvm_register_read(vcpu, VCPU_REGS_RAX); a0 = kvm_register_read(vcpu, VCPU_REGS_RBX); a1 = kvm_register_read(vcpu, VCPU_REGS_RCX); a2 = kvm_register_read(vcpu, VCPU_REGS_RDX); a3 = kvm_register_read(vcpu, VCPU_REGS_RSI); trace_kvm_hypercall(nr, a0, a1, a2, a3); if (!is_long_mode(vcpu)) { nr &= 0xFFFFFFFF; a0 &= 0xFFFFFFFF; a1 &= 0xFFFFFFFF; a2 &= 0xFFFFFFFF; a3 &= 0xFFFFFFFF; } if (kvm_x86_ops->get_cpl(vcpu) != 0) { ret = -KVM_EPERM; goto out; } switch (nr) { case KVM_HC_VAPIC_POLL_IRQ: ret = 0; break; case KVM_HC_KICK_CPU: kvm_pv_kick_cpu_op(vcpu->kvm, a0, a1); ret = 0; break; default: ret = -KVM_ENOSYS; break; } out: kvm_register_write(vcpu, VCPU_REGS_RAX, ret); ++vcpu->stat.hypercalls; return r; }
C
linux
0
CVE-2018-17570
https://www.cvedetails.com/cve/CVE-2018-17570/
CWE-190
https://github.com/viabtc/viabtc_exchange_server/commit/4a7c27bfe98f409623d4d857894d017ff0672cc9#diff-515c81af848352583bff286d6224875f
4a7c27bfe98f409623d4d857894d017ff0672cc9#diff-515c81af848352583bff286d6224875f
Merge pull request #131 from benjaminchodroff/master fix memory corruption and other 32bit overflows
size_t nw_buf_list_append(nw_buf_list *list, const void *data, size_t len) { if (list->limit && list->count >= list->limit) return 0; nw_buf *buf = nw_buf_alloc(list->pool); if (buf == NULL) return 0; if (len > buf->size) { nw_buf_free(list->pool, buf); return 0; } nw_buf_write(buf, data, len); if (list->head == NULL) list->head = buf; if (list->tail != NULL) list->tail->next = buf; list->tail = buf; list->count++; return len; }
size_t nw_buf_list_append(nw_buf_list *list, const void *data, size_t len) { if (list->limit && list->count >= list->limit) return 0; nw_buf *buf = nw_buf_alloc(list->pool); if (buf == NULL) return 0; if (len > buf->size) { nw_buf_free(list->pool, buf); return 0; } nw_buf_write(buf, data, len); if (list->head == NULL) list->head = buf; if (list->tail != NULL) list->tail->next = buf; list->tail = buf; list->count++; return len; }
C
viabtc_exchange_server
0
CVE-2011-2918
https://www.cvedetails.com/cve/CVE-2011-2918/
CWE-399
https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
a8b0ca17b80e92faab46ee7179ba9e99ccb61233
perf: Remove the nmi parameter from the swevent and overflow interface The nmi parameter indicated if we could do wakeups from the current context, if not, we would set some state and self-IPI and let the resulting interrupt do the wakeup. For the various event classes: - hardware: nmi=0; PMI is in fact an NMI or we run irq_work_run from the PMI-tail (ARM etc.) - tracepoint: nmi=0; since tracepoint could be from NMI context. - software: nmi=[0,1]; some, like the schedule thing cannot perform wakeups, and hence need 0. As one can see, there is very little nmi=1 usage, and the down-side of not using it is that on some platforms some software events can have a jiffy delay in wakeup (when arch_irq_work_raise isn't implemented). The up-side however is that we can remove the nmi parameter and save a bunch of conditionals in fast paths. Signed-off-by: Peter Zijlstra <[email protected]> Cc: Michael Cree <[email protected]> Cc: Will Deacon <[email protected]> Cc: Deng-Cheng Zhu <[email protected]> Cc: Anton Blanchard <[email protected]> Cc: Eric B Munson <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Paul Mundt <[email protected]> Cc: David S. Miller <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jason Wessel <[email protected]> Cc: Don Zickus <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
kgdb_set_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype) { int i; for (i = 0; i < HBP_NUM; i++) if (!breakinfo[i].enabled) break; if (i == HBP_NUM) return -1; switch (bptype) { case BP_HARDWARE_BREAKPOINT: len = 1; breakinfo[i].type = X86_BREAKPOINT_EXECUTE; break; case BP_WRITE_WATCHPOINT: breakinfo[i].type = X86_BREAKPOINT_WRITE; break; case BP_ACCESS_WATCHPOINT: breakinfo[i].type = X86_BREAKPOINT_RW; break; default: return -1; } switch (len) { case 1: breakinfo[i].len = X86_BREAKPOINT_LEN_1; break; case 2: breakinfo[i].len = X86_BREAKPOINT_LEN_2; break; case 4: breakinfo[i].len = X86_BREAKPOINT_LEN_4; break; #ifdef CONFIG_X86_64 case 8: breakinfo[i].len = X86_BREAKPOINT_LEN_8; break; #endif default: return -1; } breakinfo[i].addr = addr; if (hw_break_reserve_slot(i)) { breakinfo[i].addr = 0; return -1; } breakinfo[i].enabled = 1; return 0; }
kgdb_set_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype) { int i; for (i = 0; i < HBP_NUM; i++) if (!breakinfo[i].enabled) break; if (i == HBP_NUM) return -1; switch (bptype) { case BP_HARDWARE_BREAKPOINT: len = 1; breakinfo[i].type = X86_BREAKPOINT_EXECUTE; break; case BP_WRITE_WATCHPOINT: breakinfo[i].type = X86_BREAKPOINT_WRITE; break; case BP_ACCESS_WATCHPOINT: breakinfo[i].type = X86_BREAKPOINT_RW; break; default: return -1; } switch (len) { case 1: breakinfo[i].len = X86_BREAKPOINT_LEN_1; break; case 2: breakinfo[i].len = X86_BREAKPOINT_LEN_2; break; case 4: breakinfo[i].len = X86_BREAKPOINT_LEN_4; break; #ifdef CONFIG_X86_64 case 8: breakinfo[i].len = X86_BREAKPOINT_LEN_8; break; #endif default: return -1; } breakinfo[i].addr = addr; if (hw_break_reserve_slot(i)) { breakinfo[i].addr = 0; return -1; } breakinfo[i].enabled = 1; return 0; }
C
linux
0
CVE-2011-2918
https://www.cvedetails.com/cve/CVE-2011-2918/
CWE-399
https://github.com/torvalds/linux/commit/a8b0ca17b80e92faab46ee7179ba9e99ccb61233
a8b0ca17b80e92faab46ee7179ba9e99ccb61233
perf: Remove the nmi parameter from the swevent and overflow interface The nmi parameter indicated if we could do wakeups from the current context, if not, we would set some state and self-IPI and let the resulting interrupt do the wakeup. For the various event classes: - hardware: nmi=0; PMI is in fact an NMI or we run irq_work_run from the PMI-tail (ARM etc.) - tracepoint: nmi=0; since tracepoint could be from NMI context. - software: nmi=[0,1]; some, like the schedule thing cannot perform wakeups, and hence need 0. As one can see, there is very little nmi=1 usage, and the down-side of not using it is that on some platforms some software events can have a jiffy delay in wakeup (when arch_irq_work_raise isn't implemented). The up-side however is that we can remove the nmi parameter and save a bunch of conditionals in fast paths. Signed-off-by: Peter Zijlstra <[email protected]> Cc: Michael Cree <[email protected]> Cc: Will Deacon <[email protected]> Cc: Deng-Cheng Zhu <[email protected]> Cc: Anton Blanchard <[email protected]> Cc: Eric B Munson <[email protected]> Cc: Heiko Carstens <[email protected]> Cc: Paul Mundt <[email protected]> Cc: David S. Miller <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Jason Wessel <[email protected]> Cc: Don Zickus <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
static int store_updates_sp(struct pt_regs *regs) { unsigned int inst; if (get_user(inst, (unsigned int __user *)regs->nip)) return 0; /* check for 1 in the rA field */ if (((inst >> 16) & 0x1f) != 1) return 0; /* check major opcode */ switch (inst >> 26) { case 37: /* stwu */ case 39: /* stbu */ case 45: /* sthu */ case 53: /* stfsu */ case 55: /* stfdu */ return 1; case 62: /* std or stdu */ return (inst & 3) == 1; case 31: /* check minor opcode */ switch ((inst >> 1) & 0x3ff) { case 181: /* stdux */ case 183: /* stwux */ case 247: /* stbux */ case 439: /* sthux */ case 695: /* stfsux */ case 759: /* stfdux */ return 1; } } return 0; }
static int store_updates_sp(struct pt_regs *regs) { unsigned int inst; if (get_user(inst, (unsigned int __user *)regs->nip)) return 0; /* check for 1 in the rA field */ if (((inst >> 16) & 0x1f) != 1) return 0; /* check major opcode */ switch (inst >> 26) { case 37: /* stwu */ case 39: /* stbu */ case 45: /* sthu */ case 53: /* stfsu */ case 55: /* stfdu */ return 1; case 62: /* std or stdu */ return (inst & 3) == 1; case 31: /* check minor opcode */ switch ((inst >> 1) & 0x3ff) { case 181: /* stdux */ case 183: /* stwux */ case 247: /* stbux */ case 439: /* sthux */ case 695: /* stfsux */ case 759: /* stfdux */ return 1; } } return 0; }
C
linux
0
CVE-2016-1690
https://www.cvedetails.com/cve/CVE-2016-1690/
null
https://github.com/chromium/chromium/commit/9de81f45c73a8f9f215fc234a6adfe087b0eab74
9de81f45c73a8f9f215fc234a6adfe087b0eab74
Remove WeakPtrFactory from PasswordAutofillAgent Unlike in AutofillAgent, the factory is no longer used in PAA. [email protected] BUG=609010,609007,608100,608101,433486 Review-Url: https://codereview.chromium.org/1945723003 Cr-Commit-Position: refs/heads/master@{#391475}
bool PasswordAutofillAgent::TextFieldDidEndEditing( const blink::WebInputElement& element) { WebInputToPasswordInfoMap::const_iterator iter = web_input_to_password_info_.find(element); if (iter == web_input_to_password_info_.end()) return false; const PasswordInfo& password_info = iter->second; if (password_info.password_was_edited_last) return false; const PasswordFormFillData& fill_data = password_info.fill_data; if (!fill_data.wait_for_username) return false; blink::WebInputElement password = password_info.password_field; if (!IsElementEditable(password)) return false; blink::WebInputElement username = element; // We need a non-const. FillUserNameAndPassword(&username, &password, fill_data, true, false, &nonscript_modified_values_, base::Bind(&PasswordValueGatekeeper::RegisterElement, base::Unretained(&gatekeeper_)), nullptr); return true; }
bool PasswordAutofillAgent::TextFieldDidEndEditing( const blink::WebInputElement& element) { WebInputToPasswordInfoMap::const_iterator iter = web_input_to_password_info_.find(element); if (iter == web_input_to_password_info_.end()) return false; const PasswordInfo& password_info = iter->second; if (password_info.password_was_edited_last) return false; const PasswordFormFillData& fill_data = password_info.fill_data; if (!fill_data.wait_for_username) return false; blink::WebInputElement password = password_info.password_field; if (!IsElementEditable(password)) return false; blink::WebInputElement username = element; // We need a non-const. FillUserNameAndPassword(&username, &password, fill_data, true, false, &nonscript_modified_values_, base::Bind(&PasswordValueGatekeeper::RegisterElement, base::Unretained(&gatekeeper_)), nullptr); return true; }
C
Chrome
0
CVE-2011-3103
https://www.cvedetails.com/cve/CVE-2011-3103/
CWE-399
https://github.com/chromium/chromium/commit/b2dfe7c175fb21263f06eb586f1ed235482a3281
b2dfe7c175fb21263f06eb586f1ed235482a3281
[EFL] fast/frames/frame-crash-with-page-cache.html is crashing https://bugs.webkit.org/show_bug.cgi?id=85879 Patch by Mikhail Pozdnyakov <[email protected]> on 2012-05-17 Reviewed by Noam Rosenthal. Source/WebKit/efl: _ewk_frame_smart_del() is considering now that the frame can be present in cache. loader()->detachFromParent() is only applied for the main frame. loader()->cancelAndClear() is not used anymore. * ewk/ewk_frame.cpp: (_ewk_frame_smart_del): LayoutTests: * platform/efl/test_expectations.txt: Removed fast/frames/frame-crash-with-page-cache.html. git-svn-id: svn://svn.chromium.org/blink/trunk@117409 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void ewk_frame_paint_full_set(Evas_Object* ewkFrame, Eina_Bool flag) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData); EINA_SAFETY_ON_NULL_RETURN(smartData->frame); EINA_SAFETY_ON_NULL_RETURN(smartData->frame->view()); smartData->frame->view()->setPaintsEntireContents(flag); }
void ewk_frame_paint_full_set(Evas_Object* ewkFrame, Eina_Bool flag) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData); EINA_SAFETY_ON_NULL_RETURN(smartData->frame); EINA_SAFETY_ON_NULL_RETURN(smartData->frame->view()); smartData->frame->view()->setPaintsEntireContents(flag); }
C
Chrome
0
CVE-2017-8326
https://www.cvedetails.com/cve/CVE-2017-8326/
CWE-682
https://github.com/jsummers/imageworsener/commit/a00183107d4b84bc8a714290e824ca9c68dac738
a00183107d4b84bc8a714290e824ca9c68dac738
Trying to fix some invalid left shift operations Fixes issue #16
IW_IMPL(int) iw_max_color_to_bitdepth(unsigned int mc) { unsigned int bd; for(bd=1;bd<=15;bd++) { if(mc < (1U<<bd)) return bd; } return 16; }
IW_IMPL(int) iw_max_color_to_bitdepth(unsigned int mc) { unsigned int bd; for(bd=1;bd<=15;bd++) { if(mc < (1U<<bd)) return bd; } return 16; }
C
imageworsener
0
CVE-2017-8849
https://www.cvedetails.com/cve/CVE-2017-8849/
CWE-20
https://cgit.kde.org/smb4k.git/commit/?id=a90289b0962663bc1d247bbbd31b9e65b2ca000e
a90289b0962663bc1d247bbbd31b9e65b2ca000e
null
const QString Smb4KGlobal::winsServer() { QMap<QString,QString> global_opts = p->globalSambaOptions(false); QString wins_server; if (global_opts.contains("wins server")) { wins_server = global_opts.value("wins server"); } else { if (global_opts.contains("wins support") && (QString::compare(global_opts.value("wins support"), "yes", Qt::CaseInsensitive) == 0 || QString::compare(global_opts.value("wins support"), "true", Qt::CaseInsensitive) == 0)) { wins_server = "127.0.0.1"; } else { } } return wins_server; }
const QString Smb4KGlobal::winsServer() { QMap<QString,QString> global_opts = p->globalSambaOptions(false); QString wins_server; if (global_opts.contains("wins server")) { wins_server = global_opts.value("wins server"); } else { if (global_opts.contains("wins support") && (QString::compare(global_opts.value("wins support"), "yes", Qt::CaseInsensitive) == 0 || QString::compare(global_opts.value("wins support"), "true", Qt::CaseInsensitive) == 0)) { wins_server = "127.0.0.1"; } else { } } return wins_server; }
CPP
kde
0
CVE-2014-1713
https://www.cvedetails.com/cve/CVE-2014-1713/
CWE-399
https://github.com/chromium/chromium/commit/f85a87ec670ad0fce9d98d90c9a705b72a288154
f85a87ec670ad0fce9d98d90c9a705b72a288154
document.location bindings fix BUG=352374 [email protected] Review URL: https://codereview.chromium.org/196343011 git-svn-id: svn://svn.chromium.org/blink/trunk@169176 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); TestObjectV8Internal::attrWithGetterExceptionAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
static void attrWithGetterExceptionAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); TestObjectV8Internal::attrWithGetterExceptionAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
C
Chrome
0
CVE-2013-1929
https://www.cvedetails.com/cve/CVE-2013-1929/
CWE-119
https://github.com/torvalds/linux/commit/715230a44310a8cf66fbfb5a46f9a62a9b2de424
715230a44310a8cf66fbfb5a46f9a62a9b2de424
tg3: fix length overflow in VPD firmware parsing Commit 184b89044fb6e2a74611dafa69b1dce0d98612c6 ("tg3: Use VPD fw version when present") introduced VPD parsing that contained a potential length overflow. Limit the hardware's reported firmware string length (max 255 bytes) to stay inside the driver's firmware string length (32 bytes). On overflow, truncate the formatted firmware string instead of potentially overwriting portions of the tg3 struct. http://cansecwest.com/slides/2013/PrivateCore%20CSW%202013.pdf Signed-off-by: Kees Cook <[email protected]> Reported-by: Oded Horovitz <[email protected]> Reported-by: Brad Spengler <[email protected]> Cc: [email protected] Cc: Matt Carlson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int tg3_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct tg3 *tp = netdev_priv(dev); struct hwtstamp_config stmpconf; if (!tg3_flag(tp, PTP_CAPABLE)) return -EINVAL; if (copy_from_user(&stmpconf, ifr->ifr_data, sizeof(stmpconf))) return -EFAULT; if (stmpconf.flags) return -EINVAL; switch (stmpconf.tx_type) { case HWTSTAMP_TX_ON: tg3_flag_set(tp, TX_TSTAMP_EN); break; case HWTSTAMP_TX_OFF: tg3_flag_clear(tp, TX_TSTAMP_EN); break; default: return -ERANGE; } switch (stmpconf.rx_filter) { case HWTSTAMP_FILTER_NONE: tp->rxptpctl = 0; break; case HWTSTAMP_FILTER_PTP_V1_L4_EVENT: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V1_EN | TG3_RX_PTP_CTL_ALL_V1_EVENTS; break; case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V1_EN | TG3_RX_PTP_CTL_SYNC_EVNT; break; case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V1_EN | TG3_RX_PTP_CTL_DELAY_REQ; break; case HWTSTAMP_FILTER_PTP_V2_EVENT: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_EN | TG3_RX_PTP_CTL_ALL_V2_EVENTS; break; case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_L2_EN | TG3_RX_PTP_CTL_ALL_V2_EVENTS; break; case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_L4_EN | TG3_RX_PTP_CTL_ALL_V2_EVENTS; break; case HWTSTAMP_FILTER_PTP_V2_SYNC: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_EN | TG3_RX_PTP_CTL_SYNC_EVNT; break; case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_L2_EN | TG3_RX_PTP_CTL_SYNC_EVNT; break; case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_L4_EN | TG3_RX_PTP_CTL_SYNC_EVNT; break; case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_EN | TG3_RX_PTP_CTL_DELAY_REQ; break; case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_L2_EN | TG3_RX_PTP_CTL_DELAY_REQ; break; case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_L4_EN | TG3_RX_PTP_CTL_DELAY_REQ; break; default: return -ERANGE; } if (netif_running(dev) && tp->rxptpctl) tw32(TG3_RX_PTP_CTL, tp->rxptpctl | TG3_RX_PTP_CTL_HWTS_INTERLOCK); return copy_to_user(ifr->ifr_data, &stmpconf, sizeof(stmpconf)) ? -EFAULT : 0; }
static int tg3_hwtstamp_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) { struct tg3 *tp = netdev_priv(dev); struct hwtstamp_config stmpconf; if (!tg3_flag(tp, PTP_CAPABLE)) return -EINVAL; if (copy_from_user(&stmpconf, ifr->ifr_data, sizeof(stmpconf))) return -EFAULT; if (stmpconf.flags) return -EINVAL; switch (stmpconf.tx_type) { case HWTSTAMP_TX_ON: tg3_flag_set(tp, TX_TSTAMP_EN); break; case HWTSTAMP_TX_OFF: tg3_flag_clear(tp, TX_TSTAMP_EN); break; default: return -ERANGE; } switch (stmpconf.rx_filter) { case HWTSTAMP_FILTER_NONE: tp->rxptpctl = 0; break; case HWTSTAMP_FILTER_PTP_V1_L4_EVENT: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V1_EN | TG3_RX_PTP_CTL_ALL_V1_EVENTS; break; case HWTSTAMP_FILTER_PTP_V1_L4_SYNC: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V1_EN | TG3_RX_PTP_CTL_SYNC_EVNT; break; case HWTSTAMP_FILTER_PTP_V1_L4_DELAY_REQ: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V1_EN | TG3_RX_PTP_CTL_DELAY_REQ; break; case HWTSTAMP_FILTER_PTP_V2_EVENT: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_EN | TG3_RX_PTP_CTL_ALL_V2_EVENTS; break; case HWTSTAMP_FILTER_PTP_V2_L2_EVENT: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_L2_EN | TG3_RX_PTP_CTL_ALL_V2_EVENTS; break; case HWTSTAMP_FILTER_PTP_V2_L4_EVENT: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_L4_EN | TG3_RX_PTP_CTL_ALL_V2_EVENTS; break; case HWTSTAMP_FILTER_PTP_V2_SYNC: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_EN | TG3_RX_PTP_CTL_SYNC_EVNT; break; case HWTSTAMP_FILTER_PTP_V2_L2_SYNC: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_L2_EN | TG3_RX_PTP_CTL_SYNC_EVNT; break; case HWTSTAMP_FILTER_PTP_V2_L4_SYNC: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_L4_EN | TG3_RX_PTP_CTL_SYNC_EVNT; break; case HWTSTAMP_FILTER_PTP_V2_DELAY_REQ: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_EN | TG3_RX_PTP_CTL_DELAY_REQ; break; case HWTSTAMP_FILTER_PTP_V2_L2_DELAY_REQ: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_L2_EN | TG3_RX_PTP_CTL_DELAY_REQ; break; case HWTSTAMP_FILTER_PTP_V2_L4_DELAY_REQ: tp->rxptpctl = TG3_RX_PTP_CTL_RX_PTP_V2_L4_EN | TG3_RX_PTP_CTL_DELAY_REQ; break; default: return -ERANGE; } if (netif_running(dev) && tp->rxptpctl) tw32(TG3_RX_PTP_CTL, tp->rxptpctl | TG3_RX_PTP_CTL_HWTS_INTERLOCK); return copy_to_user(ifr->ifr_data, &stmpconf, sizeof(stmpconf)) ? -EFAULT : 0; }
C
linux
0
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 veth_dev_free(struct net_device *dev) { struct veth_priv *priv; priv = netdev_priv(dev); free_percpu(priv->stats); free_netdev(dev); }
static void veth_dev_free(struct net_device *dev) { struct veth_priv *priv; priv = netdev_priv(dev); free_percpu(priv->stats); free_netdev(dev); }
C
linux
0
CVE-2015-1265
https://www.cvedetails.com/cve/CVE-2015-1265/
null
https://github.com/chromium/chromium/commit/04ff52bb66284467ccb43d90800013b89ee8db75
04ff52bb66284467ccb43d90800013b89ee8db75
Switching AudioOutputAuthorizationHandler from using AudioManager interface to AudioSystem one. BUG=672468 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel Review-Url: https://codereview.chromium.org/2692203003 Cr-Commit-Position: refs/heads/master@{#450939}
void RenderProcessHostImpl::ReleaseOnCloseACK( RenderProcessHost* host, const SessionStorageNamespaceMap& sessions, int view_route_id) { DCHECK(host); if (sessions.empty()) return; SessionStorageHolder* holder = static_cast<SessionStorageHolder*>( host->GetUserData(kSessionStorageHolderKey)); if (!holder) { holder = new SessionStorageHolder(); host->SetUserData(kSessionStorageHolderKey, holder); } holder->Hold(sessions, view_route_id); }
void RenderProcessHostImpl::ReleaseOnCloseACK( RenderProcessHost* host, const SessionStorageNamespaceMap& sessions, int view_route_id) { DCHECK(host); if (sessions.empty()) return; SessionStorageHolder* holder = static_cast<SessionStorageHolder*>( host->GetUserData(kSessionStorageHolderKey)); if (!holder) { holder = new SessionStorageHolder(); host->SetUserData(kSessionStorageHolderKey, holder); } holder->Hold(sessions, view_route_id); }
C
Chrome
0
CVE-2011-2358
https://www.cvedetails.com/cve/CVE-2011-2358/
CWE-20
https://github.com/chromium/chromium/commit/9eb1fd426a04adac0906c81ed88f1089969702ba
9eb1fd426a04adac0906c81ed88f1089969702ba
Adding tests for new webstore beginInstallWithManifest method. BUG=75821 TEST=none Review URL: http://codereview.chromium.org/6900059 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@83080 0039d316-1c4b-4281-b951-d872f2087c98
DictionaryValue* CreateLoginResult(Profile* profile) { DictionaryValue* dictionary = new DictionaryValue(); std::string username = GetBrowserSignin(profile)->GetSignedInUsername(); dictionary->SetString(kLoginKey, username); if (!username.empty()) { CommandLine* cmdline = CommandLine::ForCurrentProcess(); TokenService* token_service = profile->GetTokenService(); if (cmdline->HasSwitch(switches::kAppsGalleryReturnTokens) && token_service->HasTokenForService(GaiaConstants::kGaiaService)) { dictionary->SetString(kTokenKey, token_service->GetTokenForService( GaiaConstants::kGaiaService)); } } return dictionary; }
DictionaryValue* CreateLoginResult(Profile* profile) { DictionaryValue* dictionary = new DictionaryValue(); std::string username = GetBrowserSignin(profile)->GetSignedInUsername(); dictionary->SetString(kLoginKey, username); if (!username.empty()) { CommandLine* cmdline = CommandLine::ForCurrentProcess(); TokenService* token_service = profile->GetTokenService(); if (cmdline->HasSwitch(switches::kAppsGalleryReturnTokens) && token_service->HasTokenForService(GaiaConstants::kGaiaService)) { dictionary->SetString(kTokenKey, token_service->GetTokenForService( GaiaConstants::kGaiaService)); } } return dictionary; }
C
Chrome
0
CVE-2011-4930
https://www.cvedetails.com/cve/CVE-2011-4930/
CWE-134
https://htcondor-git.cs.wisc.edu/?p=condor.git;a=commitdiff;h=5e5571d1a431eb3c61977b6dd6ec90186ef79867
5e5571d1a431eb3c61977b6dd6ec90186ef79867
null
CStarter::StarterExit( int code ) { FinalCleanup(); #if !defined(WIN32) if ( GetEnv( "CONDOR_GLEXEC_STARTER_CLEANUP_FLAG" ) ) { exitAfterGlexec( code ); } #endif DC_Exit( code ); }
CStarter::StarterExit( int code ) { FinalCleanup(); #if !defined(WIN32) if ( GetEnv( "CONDOR_GLEXEC_STARTER_CLEANUP_FLAG" ) ) { exitAfterGlexec( code ); } #endif DC_Exit( code ); }
CPP
htcondor
0
CVE-2012-2875
https://www.cvedetails.com/cve/CVE-2012-2875/
null
https://github.com/chromium/chromium/commit/1266ba494530a267ec8a21442ea1b5cae94da4fb
1266ba494530a267ec8a21442ea1b5cae94da4fb
Introduce XGetImage() for GrabWindowSnapshot() in ChromeOS. BUG=119492 TEST=manually done Review URL: https://chromiumcodereview.appspot.com/10386124 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137556 0039d316-1c4b-4281-b951-d872f2087c98
void RootWindow::PostMouseMoveEventAfterWindowChange() { if (synthesize_mouse_move_) return; synthesize_mouse_move_ = true; MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&RootWindow::SynthesizeMouseMoveEvent, event_factory_.GetWeakPtr())); }
void RootWindow::PostMouseMoveEventAfterWindowChange() { if (synthesize_mouse_move_) return; synthesize_mouse_move_ = true; MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&RootWindow::SynthesizeMouseMoveEvent, event_factory_.GetWeakPtr())); }
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_resolve_ipv6(struct evdns_base *base, const char *name, int flags, evdns_callback_type callback, void *ptr) { struct evdns_request *handle; struct request *req; log(EVDNS_LOG_DEBUG, "Resolve requested for %s", name); handle = mm_calloc(1, sizeof(*handle)); if (handle == NULL) return NULL; EVDNS_LOCK(base); if (flags & DNS_QUERY_NO_SEARCH) { req = request_new(base, handle, TYPE_AAAA, name, flags, callback, ptr); if (req) request_submit(req); } else { search_request_new(base, handle, TYPE_AAAA, name, flags, callback, ptr); } if (handle->current_req == NULL) { mm_free(handle); handle = NULL; } EVDNS_UNLOCK(base); return handle; }
evdns_base_resolve_ipv6(struct evdns_base *base, const char *name, int flags, evdns_callback_type callback, void *ptr) { struct evdns_request *handle; struct request *req; log(EVDNS_LOG_DEBUG, "Resolve requested for %s", name); handle = mm_calloc(1, sizeof(*handle)); if (handle == NULL) return NULL; EVDNS_LOCK(base); if (flags & DNS_QUERY_NO_SEARCH) { req = request_new(base, handle, TYPE_AAAA, name, flags, callback, ptr); if (req) request_submit(req); } else { search_request_new(base, handle, TYPE_AAAA, name, flags, callback, ptr); } if (handle->current_req == NULL) { mm_free(handle); handle = NULL; } EVDNS_UNLOCK(base); return handle; }
C
libevent
0
CVE-2017-5120
https://www.cvedetails.com/cve/CVE-2017-5120/
null
https://github.com/chromium/chromium/commit/b7277af490d28ac7f802c015bb0ff31395768556
b7277af490d28ac7f802c015bb0ff31395768556
bindings: Support "attribute FrozenArray<T>?" Adds a quick hack to support a case of "attribute FrozenArray<T>?". Bug: 1028047 Change-Id: Ib3cecc4beb6bcc0fb0dbc667aca595454cc90c86 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1933866 Reviewed-by: Hitoshi Yoshida <[email protected]> Commit-Queue: Yuki Shiino <[email protected]> Cr-Commit-Position: refs/heads/master@{#718676}
static void LocationAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueFast(info, WTF::GetPtr(impl->location()), impl); }
static void LocationAttributeGetter(const v8::FunctionCallbackInfo<v8::Value>& info) { v8::Local<v8::Object> holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueFast(info, WTF::GetPtr(impl->location()), impl); }
C
Chrome
0
CVE-2011-3084
https://www.cvedetails.com/cve/CVE-2011-3084/
CWE-264
https://github.com/chromium/chromium/commit/744c2a2d90c3c9a33c818e1ea4b7ccb5010663a0
744c2a2d90c3c9a33c818e1ea4b7ccb5010663a0
Allow browser to handle all WebUI navigations. BUG=113496 TEST="Google Dashboard" link in Sync settings loads in new process. Review URL: http://codereview.chromium.org/9663045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126949 0039d316-1c4b-4281-b951-d872f2087c98
base::StringPiece ShellContentClient::GetDataResource(int resource_id) const { return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); }
base::StringPiece ShellContentClient::GetDataResource(int resource_id) const { return ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id); }
C
Chrome
0
CVE-2016-1633
https://www.cvedetails.com/cve/CVE-2016-1633/
null
https://github.com/chromium/chromium/commit/eb750a539e4856ba9042abdf39ae9da58fa3ae63
eb750a539e4856ba9042abdf39ae9da58fa3ae63
Fix detached Attr nodes interaction with NodeIterator - Don't register NodeIterator to document when attaching to Attr node. -- NodeIterator is registered to its document to receive updateForNodeRemoval notifications. -- However it wouldn't make sense on Attr nodes, as they never have children. BUG=572537 Review URL: https://codereview.chromium.org/1577213003 Cr-Commit-Position: refs/heads/master@{#369687}
void NodeIterator::NodePointer::clear() { node.clear(); }
void NodeIterator::NodePointer::clear() { node.clear(); }
C
Chrome
0
CVE-2013-2887
https://www.cvedetails.com/cve/CVE-2013-2887/
null
https://github.com/chromium/chromium/commit/01924fbe6c0e0f059ca46a03f9f6b2670ae3e0fa
01924fbe6c0e0f059ca46a03f9f6b2670ae3e0fa
Pass ui::LatencyInfo correct with unified gesture detector on Aura. BUG=379812 TEST=GestureRecognizerTest.LatencyPassedFromTouchEvent Review URL: https://codereview.chromium.org/309823002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@274602 0039d316-1c4b-4281-b951-d872f2087c98
void ReceivedAckImpl(bool prevent_defaulted) { scoped_ptr<ui::TouchEvent> event(queue_.front()); dispatcher_->ProcessedTouchEvent(event.get(), window_, prevent_defaulted ? ui::ER_HANDLED : ui::ER_UNHANDLED); queue_.pop(); }
void ReceivedAckImpl(bool prevent_defaulted) { scoped_ptr<ui::TouchEvent> event(queue_.front()); dispatcher_->ProcessedTouchEvent(event.get(), window_, prevent_defaulted ? ui::ER_HANDLED : ui::ER_UNHANDLED); queue_.pop(); }
C
Chrome
0
CVE-2015-4178
https://www.cvedetails.com/cve/CVE-2015-4178/
null
https://github.com/torvalds/linux/commit/820f9f147dcce2602eefd9b575bbbd9ea14f0953
820f9f147dcce2602eefd9b575bbbd9ea14f0953
fs_pin: Allow for the possibility that m_list or s_list go unused. This is needed to support lazily umounting locked mounts. Because the entire unmounted subtree needs to stay together until there are no users with references to any part of the subtree. To support this guarantee that the fs_pin m_list and s_list nodes are initialized by initializing them in init_fs_pin allowing for the possibility that pin_insert_group does not touch them. Further use hlist_del_init in pin_remove so that there is a hlist_unhashed test before the list we attempt to update the previous list item. Signed-off-by: "Eric W. Biederman" <[email protected]>
void pin_remove(struct fs_pin *pin) { spin_lock(&pin_lock); hlist_del_init(&pin->m_list); hlist_del_init(&pin->s_list); spin_unlock(&pin_lock); spin_lock_irq(&pin->wait.lock); pin->done = 1; wake_up_locked(&pin->wait); spin_unlock_irq(&pin->wait.lock); }
void pin_remove(struct fs_pin *pin) { spin_lock(&pin_lock); hlist_del(&pin->m_list); hlist_del(&pin->s_list); spin_unlock(&pin_lock); spin_lock_irq(&pin->wait.lock); pin->done = 1; wake_up_locked(&pin->wait); spin_unlock_irq(&pin->wait.lock); }
C
linux
1
CVE-2011-4086
https://www.cvedetails.com/cve/CVE-2011-4086/
CWE-119
https://github.com/torvalds/linux/commit/15291164b22a357cb211b618adfef4fa82fc0de3
15291164b22a357cb211b618adfef4fa82fc0de3
jbd2: clear BH_Delay & BH_Unwritten in journal_unmap_buffer journal_unmap_buffer()'s zap_buffer: code clears a lot of buffer head state ala discard_buffer(), but does not touch _Delay or _Unwritten as discard_buffer() does. This can be problematic in some areas of the ext4 code which assume that if they have found a buffer marked unwritten or delay, then it's a live one. Perhaps those spots should check whether it is mapped as well, but if jbd2 is going to tear down a buffer, let's really tear it down completely. Without this I get some fsx failures on sub-page-block filesystems up until v3.2, at which point 4e96b2dbbf1d7e81f22047a50f862555a6cb87cb and 189e868fa8fdca702eb9db9d8afc46b5cb9144c9 make the failures go away, because buried within that large change is some more flag clearing. I still think it's worth doing in jbd2, since ->invalidatepage leads here directly, and it's the right place to clear away these flags. Signed-off-by: Eric Sandeen <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
void jbd2_journal_set_triggers(struct buffer_head *bh, struct jbd2_buffer_trigger_type *type) { struct journal_head *jh = bh2jh(bh); jh->b_triggers = type; }
void jbd2_journal_set_triggers(struct buffer_head *bh, struct jbd2_buffer_trigger_type *type) { struct journal_head *jh = bh2jh(bh); jh->b_triggers = type; }
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 int wp512_final(struct shash_desc *desc, u8 *out) { struct wp512_ctx *wctx = shash_desc_ctx(desc); int i; u8 *buffer = wctx->buffer; u8 *bitLength = wctx->bitLength; int bufferBits = wctx->bufferBits; int bufferPos = wctx->bufferPos; __be64 *digest = (__be64 *)out; buffer[bufferPos] |= 0x80U >> (bufferBits & 7); bufferPos++; if (bufferPos > WP512_BLOCK_SIZE - WP512_LENGTHBYTES) { if (bufferPos < WP512_BLOCK_SIZE) { memset(&buffer[bufferPos], 0, WP512_BLOCK_SIZE - bufferPos); } wp512_process_buffer(wctx); bufferPos = 0; } if (bufferPos < WP512_BLOCK_SIZE - WP512_LENGTHBYTES) { memset(&buffer[bufferPos], 0, (WP512_BLOCK_SIZE - WP512_LENGTHBYTES) - bufferPos); } bufferPos = WP512_BLOCK_SIZE - WP512_LENGTHBYTES; memcpy(&buffer[WP512_BLOCK_SIZE - WP512_LENGTHBYTES], bitLength, WP512_LENGTHBYTES); wp512_process_buffer(wctx); for (i = 0; i < WP512_DIGEST_SIZE/8; i++) digest[i] = cpu_to_be64(wctx->hash[i]); wctx->bufferBits = bufferBits; wctx->bufferPos = bufferPos; return 0; }
static int wp512_final(struct shash_desc *desc, u8 *out) { struct wp512_ctx *wctx = shash_desc_ctx(desc); int i; u8 *buffer = wctx->buffer; u8 *bitLength = wctx->bitLength; int bufferBits = wctx->bufferBits; int bufferPos = wctx->bufferPos; __be64 *digest = (__be64 *)out; buffer[bufferPos] |= 0x80U >> (bufferBits & 7); bufferPos++; if (bufferPos > WP512_BLOCK_SIZE - WP512_LENGTHBYTES) { if (bufferPos < WP512_BLOCK_SIZE) { memset(&buffer[bufferPos], 0, WP512_BLOCK_SIZE - bufferPos); } wp512_process_buffer(wctx); bufferPos = 0; } if (bufferPos < WP512_BLOCK_SIZE - WP512_LENGTHBYTES) { memset(&buffer[bufferPos], 0, (WP512_BLOCK_SIZE - WP512_LENGTHBYTES) - bufferPos); } bufferPos = WP512_BLOCK_SIZE - WP512_LENGTHBYTES; memcpy(&buffer[WP512_BLOCK_SIZE - WP512_LENGTHBYTES], bitLength, WP512_LENGTHBYTES); wp512_process_buffer(wctx); for (i = 0; i < WP512_DIGEST_SIZE/8; i++) digest[i] = cpu_to_be64(wctx->hash[i]); wctx->bufferBits = bufferBits; wctx->bufferPos = bufferPos; return 0; }
C
linux
0
CVE-2012-2669
https://www.cvedetails.com/cve/CVE-2012-2669/
CWE-20
https://github.com/torvalds/linux/commit/bcc2c9c3fff859e0eb019fe6fec26f9b8eba795c
bcc2c9c3fff859e0eb019fe6fec26f9b8eba795c
Tools: hv: verify origin of netlink connector message The SuSE security team suggested to use recvfrom instead of recv to be certain that the connector message is originated from kernel. CVE-2012-2669 Signed-off-by: Olaf Hering <[email protected]> Signed-off-by: Marcus Meissner <[email protected]> Signed-off-by: Sebastian Krahmer <[email protected]> Signed-off-by: K. Y. Srinivasan <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
static void kvp_update_mem_state(int pool) { FILE *filep; size_t records_read = 0; struct kvp_record *record = kvp_file_info[pool].records; struct kvp_record *readp; int num_blocks = kvp_file_info[pool].num_blocks; int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK; kvp_acquire_lock(pool); filep = fopen(kvp_file_info[pool].fname, "r"); if (!filep) { kvp_release_lock(pool); syslog(LOG_ERR, "Failed to open file, pool: %d", pool); exit(-1); } while (!feof(filep)) { readp = &record[records_read]; records_read += fread(readp, sizeof(struct kvp_record), ENTRIES_PER_BLOCK * num_blocks, filep); if (!feof(filep)) { /* * We have more data to read. */ num_blocks++; record = realloc(record, alloc_unit * num_blocks); if (record == NULL) { syslog(LOG_ERR, "malloc failed"); exit(-1); } continue; } break; } kvp_file_info[pool].num_blocks = num_blocks; kvp_file_info[pool].records = record; kvp_file_info[pool].num_records = records_read; kvp_release_lock(pool); }
static void kvp_update_mem_state(int pool) { FILE *filep; size_t records_read = 0; struct kvp_record *record = kvp_file_info[pool].records; struct kvp_record *readp; int num_blocks = kvp_file_info[pool].num_blocks; int alloc_unit = sizeof(struct kvp_record) * ENTRIES_PER_BLOCK; kvp_acquire_lock(pool); filep = fopen(kvp_file_info[pool].fname, "r"); if (!filep) { kvp_release_lock(pool); syslog(LOG_ERR, "Failed to open file, pool: %d", pool); exit(-1); } while (!feof(filep)) { readp = &record[records_read]; records_read += fread(readp, sizeof(struct kvp_record), ENTRIES_PER_BLOCK * num_blocks, filep); if (!feof(filep)) { /* * We have more data to read. */ num_blocks++; record = realloc(record, alloc_unit * num_blocks); if (record == NULL) { syslog(LOG_ERR, "malloc failed"); exit(-1); } continue; } break; } kvp_file_info[pool].num_blocks = num_blocks; kvp_file_info[pool].records = record; kvp_file_info[pool].num_records = records_read; kvp_release_lock(pool); }
C
linux
0
CVE-2012-2880
https://www.cvedetails.com/cve/CVE-2012-2880/
CWE-362
https://github.com/chromium/chromium/commit/fcd3a7a671ecf2d5f46ea34787d27507a914d2f5
fcd3a7a671ecf2d5f46ea34787d27507a914d2f5
[Sync] Cleanup all tab sync enabling logic now that its on by default. BUG=none TEST= Review URL: https://chromiumcodereview.appspot.com/10443046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139462 0039d316-1c4b-4281-b951-d872f2087c98
void SyncManager::SyncInternal::FinishSetPassphrase( bool success, const std::string& bootstrap_token, bool is_explicit, WriteTransaction* trans, WriteNode* nigori_node) { Cryptographer* cryptographer = trans->GetCryptographer(); NotifyCryptographerState(cryptographer); if (!bootstrap_token.empty()) { DVLOG(1) << "Bootstrap token updated."; FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnBootstrapTokenUpdated(bootstrap_token)); } if (!success) { if (cryptographer->is_ready()) { LOG(ERROR) << "Attempt to change passphrase failed while cryptographer " << "was ready."; } else if (cryptographer->has_pending_keys()) { FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnPassphraseRequired(sync_api::REASON_DECRYPTION, cryptographer->GetPendingKeys())); } else { FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnPassphraseRequired(sync_api::REASON_ENCRYPTION, sync_pb::EncryptedData())); } return; } FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnPassphraseAccepted()); DCHECK(cryptographer->is_ready()); sync_pb::NigoriSpecifics specifics(nigori_node->GetNigoriSpecifics()); if (!cryptographer->GetKeys(specifics.mutable_encrypted())) { NOTREACHED(); return; } specifics.set_using_explicit_passphrase(is_explicit); nigori_node->SetNigoriSpecifics(specifics); ReEncryptEverything(trans); }
void SyncManager::SyncInternal::FinishSetPassphrase( bool success, const std::string& bootstrap_token, bool is_explicit, WriteTransaction* trans, WriteNode* nigori_node) { Cryptographer* cryptographer = trans->GetCryptographer(); NotifyCryptographerState(cryptographer); if (!bootstrap_token.empty()) { DVLOG(1) << "Bootstrap token updated."; FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnBootstrapTokenUpdated(bootstrap_token)); } if (!success) { if (cryptographer->is_ready()) { LOG(ERROR) << "Attempt to change passphrase failed while cryptographer " << "was ready."; } else if (cryptographer->has_pending_keys()) { FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnPassphraseRequired(sync_api::REASON_DECRYPTION, cryptographer->GetPendingKeys())); } else { FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnPassphraseRequired(sync_api::REASON_ENCRYPTION, sync_pb::EncryptedData())); } return; } FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnPassphraseAccepted()); DCHECK(cryptographer->is_ready()); sync_pb::NigoriSpecifics specifics(nigori_node->GetNigoriSpecifics()); if (!cryptographer->GetKeys(specifics.mutable_encrypted())) { NOTREACHED(); return; } specifics.set_using_explicit_passphrase(is_explicit); nigori_node->SetNigoriSpecifics(specifics); ReEncryptEverything(trans); }
C
Chrome
0
CVE-2009-3605
https://www.cvedetails.com/cve/CVE-2009-3605/
CWE-189
https://cgit.freedesktop.org/poppler/poppler/commit/?id=7b2d314a61fd0e12f47c62996cb49ec0d1ba747a
7b2d314a61fd0e12f47c62996cb49ec0d1ba747a
null
void GfxDeviceRGBColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length) { Guchar *p; int i; for (i = 0, p = in; i < length; i++, p += 3) out[i] = (p[0] << 16) | (p[1] << 8) | (p[2] << 0); }
void GfxDeviceRGBColorSpace::getRGBLine(Guchar *in, unsigned int *out, int length) { Guchar *p; int i; for (i = 0, p = in; i < length; i++, p += 3) out[i] = (p[0] << 16) | (p[1] << 8) | (p[2] << 0); }
CPP
poppler
0
CVE-2018-19044
https://www.cvedetails.com/cve/CVE-2018-19044/
CWE-59
https://github.com/acassen/keepalived/commit/04f2d32871bb3b11d7dc024039952f2fe2750306
04f2d32871bb3b11d7dc024039952f2fe2750306
When opening files for write, ensure they aren't symbolic links Issue #1048 identified that if, for example, a non privileged user created a symbolic link from /etc/keepalvied.data to /etc/passwd, writing to /etc/keepalived.data (which could be invoked via DBus) would cause /etc/passwd to be overwritten. This commit stops keepalived writing to pathnames where the ultimate component is a symbolic link, by setting O_NOFOLLOW whenever opening a file for writing. This might break some setups, where, for example, /etc/keepalived.data was a symbolic link to /home/fred/keepalived.data. If this was the case, instead create a symbolic link from /home/fred/keepalived.data to /tmp/keepalived.data, so that the file is still accessible via /home/fred/keepalived.data. There doesn't appear to be a way around this backward incompatibility, since even checking if the pathname is a symbolic link prior to opening for writing would create a race condition. Signed-off-by: Quentin Armitage <[email protected]>
vrrp_version_handler(vector_t *strvec) { vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp); int version; if (!read_int_strvec(strvec, 1, &version, 2, 3, true)) { report_config_error(CONFIG_GENERAL_ERROR, "(%s): Version must be either 2 or 3", vrrp->iname); return; } if ((vrrp->version && vrrp->version != version) || (version == VRRP_VERSION_2 && vrrp->family == AF_INET6)) { report_config_error(CONFIG_GENERAL_ERROR, "(%s) vrrp_version %d conflicts with configured or deduced version %d; ignoring.", vrrp->iname, version, vrrp->version); return; } vrrp->version = version; }
vrrp_version_handler(vector_t *strvec) { vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp); int version; if (!read_int_strvec(strvec, 1, &version, 2, 3, true)) { report_config_error(CONFIG_GENERAL_ERROR, "(%s): Version must be either 2 or 3", vrrp->iname); return; } if ((vrrp->version && vrrp->version != version) || (version == VRRP_VERSION_2 && vrrp->family == AF_INET6)) { report_config_error(CONFIG_GENERAL_ERROR, "(%s) vrrp_version %d conflicts with configured or deduced version %d; ignoring.", vrrp->iname, version, vrrp->version); return; } vrrp->version = version; }
C
keepalived
0
CVE-2018-6096
https://www.cvedetails.com/cve/CVE-2018-6096/
null
https://github.com/chromium/chromium/commit/36f801fdbec07d116a6f4f07bb363f10897d6a51
36f801fdbec07d116a6f4f07bb363f10897d6a51
If a page calls |window.focus()|, kick it out of fullscreen. BUG=776418, 800056 Change-Id: I1880fe600e4814c073f247c43b1c1ac80c8fc017 Reviewed-on: https://chromium-review.googlesource.com/852378 Reviewed-by: Nasko Oskov <[email protected]> Reviewed-by: Philip Jägenstedt <[email protected]> Commit-Queue: Avi Drissman <[email protected]> Cr-Commit-Position: refs/heads/master@{#533790}
void RenderFrameImpl::OnReload(bool bypass_cache) { frame_->Reload(bypass_cache ? WebFrameLoadType::kReloadBypassingCache : WebFrameLoadType::kReload); }
void RenderFrameImpl::OnReload(bool bypass_cache) { frame_->Reload(bypass_cache ? WebFrameLoadType::kReloadBypassingCache : WebFrameLoadType::kReload); }
C
Chrome
0
CVE-2011-3094
https://www.cvedetails.com/cve/CVE-2011-3094/
CWE-20
https://github.com/chromium/chromium/commit/b8573aa643b03a59f4e2c99c72d3511a11cfb0b6
b8573aa643b03a59f4e2c99c72d3511a11cfb0b6
Add setters for the aura gesture recognizer constants. BUG=113227 TEST=none Review URL: http://codereview.chromium.org/9372040 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@122586 0039d316-1c4b-4281-b951-d872f2087c98
void GestureSequence::AppendClickGestureEvent(const GesturePoint& point, Gestures* gestures) { gestures->push_back(linked_ptr<GestureEvent>(new GestureEvent( ui::ET_GESTURE_TAP, point.first_touch_position().x(), point.first_touch_position().y(), flags_, base::Time::FromDoubleT(point.last_touch_time()), 0.f, 0.f))); }
void GestureSequence::AppendClickGestureEvent(const GesturePoint& point, Gestures* gestures) { gestures->push_back(linked_ptr<GestureEvent>(new GestureEvent( ui::ET_GESTURE_TAP, point.first_touch_position().x(), point.first_touch_position().y(), flags_, base::Time::FromDoubleT(point.last_touch_time()), 0.f, 0.f))); }
C
Chrome
0
CVE-2013-3225
https://www.cvedetails.com/cve/CVE-2013-3225/
CWE-200
https://github.com/torvalds/linux/commit/e11e0455c0d7d3d62276a0c55d9dfbc16779d691
e11e0455c0d7d3d62276a0c55d9dfbc16779d691
Bluetooth: RFCOMM - Fix missing msg_namelen update in rfcomm_sock_recvmsg() If RFCOMM_DEFER_SETUP is set in the flags, rfcomm_sock_recvmsg() returns early with 0 without updating the possibly set msg_namelen member. This, in turn, leads to a 128 byte kernel stack leak in net/socket.c. Fix this by updating msg_namelen in this case. For all other cases it will be handled in bt_sock_stream_recvmsg(). Cc: Marcel Holtmann <[email protected]> Cc: Gustavo Padovan <[email protected]> Cc: Johan Hedberg <[email protected]> Signed-off-by: Mathias Krause <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void rfcomm_sock_cleanup_listen(struct sock *parent) { struct sock *sk; BT_DBG("parent %p", parent); /* Close not yet accepted dlcs */ while ((sk = bt_accept_dequeue(parent, NULL))) { rfcomm_sock_close(sk); rfcomm_sock_kill(sk); } parent->sk_state = BT_CLOSED; sock_set_flag(parent, SOCK_ZAPPED); }
static void rfcomm_sock_cleanup_listen(struct sock *parent) { struct sock *sk; BT_DBG("parent %p", parent); /* Close not yet accepted dlcs */ while ((sk = bt_accept_dequeue(parent, NULL))) { rfcomm_sock_close(sk); rfcomm_sock_kill(sk); } parent->sk_state = BT_CLOSED; sock_set_flag(parent, SOCK_ZAPPED); }
C
linux
0
CVE-2011-4930
https://www.cvedetails.com/cve/CVE-2011-4930/
CWE-134
https://htcondor-git.cs.wisc.edu/?p=condor.git;a=commitdiff;h=5e5571d1a431eb3c61977b6dd6ec90186ef79867
5e5571d1a431eb3c61977b6dd6ec90186ef79867
null
CronTab::nextRunTime( ) { return ( this->nextRunTime( (long)time( NULL ) ) ); }
CronTab::nextRunTime( ) { return ( this->nextRunTime( (long)time( NULL ) ) ); }
CPP
htcondor
0
CVE-2015-3412
https://www.cvedetails.com/cve/CVE-2015-3412/
CWE-254
https://git.php.net/?p=php-src.git;a=commit;h=4435b9142ff9813845d5c97ab29a5d637bedb257
4435b9142ff9813845d5c97ab29a5d637bedb257
null
static PHP_FUNCTION(xmlwriter_start_dtd_attlist) { php_xmlwriter_string_arg(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextWriterStartDTDAttlist, "Invalid Element Name"); }
static PHP_FUNCTION(xmlwriter_start_dtd_attlist) { php_xmlwriter_string_arg(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextWriterStartDTDAttlist, "Invalid Element Name"); }
C
php
0
CVE-2017-2647
https://www.cvedetails.com/cve/CVE-2017-2647/
CWE-476
https://github.com/torvalds/linux/commit/c06cfb08b88dfbe13be44a69ae2fdc3a7c902d81
c06cfb08b88dfbe13be44a69ae2fdc3a7c902d81
KEYS: Remove key_type::match in favour of overriding default by match_preparse A previous patch added a ->match_preparse() method to the key type. This is allowed to override the function called by the iteration algorithm. Therefore, we can just set a default that simply checks for an exact match of the key description with the original criterion data and allow match_preparse to override it as needed. The key_type::match op is then redundant and can be removed, as can the user_match() function. Signed-off-by: David Howells <[email protected]> Acked-by: Vivek Goyal <[email protected]>
static int rxrpc_krb5_decode_principal(struct krb5_principal *princ, const __be32 **_xdr, unsigned int *_toklen) { const __be32 *xdr = *_xdr; unsigned int toklen = *_toklen, n_parts, loop, tmp; /* there must be at least one name, and at least #names+1 length * words */ if (toklen <= 12) return -EINVAL; _enter(",{%x,%x,%x},%u", ntohl(xdr[0]), ntohl(xdr[1]), ntohl(xdr[2]), toklen); n_parts = ntohl(*xdr++); toklen -= 4; if (n_parts <= 0 || n_parts > AFSTOKEN_K5_COMPONENTS_MAX) return -EINVAL; princ->n_name_parts = n_parts; if (toklen <= (n_parts + 1) * 4) return -EINVAL; princ->name_parts = kcalloc(n_parts, sizeof(char *), GFP_KERNEL); if (!princ->name_parts) return -ENOMEM; for (loop = 0; loop < n_parts; loop++) { if (toklen < 4) return -EINVAL; tmp = ntohl(*xdr++); toklen -= 4; if (tmp <= 0 || tmp > AFSTOKEN_STRING_MAX) return -EINVAL; if (tmp > toklen) return -EINVAL; princ->name_parts[loop] = kmalloc(tmp + 1, GFP_KERNEL); if (!princ->name_parts[loop]) return -ENOMEM; memcpy(princ->name_parts[loop], xdr, tmp); princ->name_parts[loop][tmp] = 0; tmp = (tmp + 3) & ~3; toklen -= tmp; xdr += tmp >> 2; } if (toklen < 4) return -EINVAL; tmp = ntohl(*xdr++); toklen -= 4; if (tmp <= 0 || tmp > AFSTOKEN_K5_REALM_MAX) return -EINVAL; if (tmp > toklen) return -EINVAL; princ->realm = kmalloc(tmp + 1, GFP_KERNEL); if (!princ->realm) return -ENOMEM; memcpy(princ->realm, xdr, tmp); princ->realm[tmp] = 0; tmp = (tmp + 3) & ~3; toklen -= tmp; xdr += tmp >> 2; _debug("%s/...@%s", princ->name_parts[0], princ->realm); *_xdr = xdr; *_toklen = toklen; _leave(" = 0 [toklen=%u]", toklen); return 0; }
static int rxrpc_krb5_decode_principal(struct krb5_principal *princ, const __be32 **_xdr, unsigned int *_toklen) { const __be32 *xdr = *_xdr; unsigned int toklen = *_toklen, n_parts, loop, tmp; /* there must be at least one name, and at least #names+1 length * words */ if (toklen <= 12) return -EINVAL; _enter(",{%x,%x,%x},%u", ntohl(xdr[0]), ntohl(xdr[1]), ntohl(xdr[2]), toklen); n_parts = ntohl(*xdr++); toklen -= 4; if (n_parts <= 0 || n_parts > AFSTOKEN_K5_COMPONENTS_MAX) return -EINVAL; princ->n_name_parts = n_parts; if (toklen <= (n_parts + 1) * 4) return -EINVAL; princ->name_parts = kcalloc(n_parts, sizeof(char *), GFP_KERNEL); if (!princ->name_parts) return -ENOMEM; for (loop = 0; loop < n_parts; loop++) { if (toklen < 4) return -EINVAL; tmp = ntohl(*xdr++); toklen -= 4; if (tmp <= 0 || tmp > AFSTOKEN_STRING_MAX) return -EINVAL; if (tmp > toklen) return -EINVAL; princ->name_parts[loop] = kmalloc(tmp + 1, GFP_KERNEL); if (!princ->name_parts[loop]) return -ENOMEM; memcpy(princ->name_parts[loop], xdr, tmp); princ->name_parts[loop][tmp] = 0; tmp = (tmp + 3) & ~3; toklen -= tmp; xdr += tmp >> 2; } if (toklen < 4) return -EINVAL; tmp = ntohl(*xdr++); toklen -= 4; if (tmp <= 0 || tmp > AFSTOKEN_K5_REALM_MAX) return -EINVAL; if (tmp > toklen) return -EINVAL; princ->realm = kmalloc(tmp + 1, GFP_KERNEL); if (!princ->realm) return -ENOMEM; memcpy(princ->realm, xdr, tmp); princ->realm[tmp] = 0; tmp = (tmp + 3) & ~3; toklen -= tmp; xdr += tmp >> 2; _debug("%s/...@%s", princ->name_parts[0], princ->realm); *_xdr = xdr; *_toklen = toklen; _leave(" = 0 [toklen=%u]", toklen); return 0; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/610f904d8215075c4681be4eb413f4348860bf9f
610f904d8215075c4681be4eb413f4348860bf9f
Retrieve per host storage usage from QuotaManager. [email protected] BUG=none TEST=QuotaManagerTest.GetUsage Review URL: http://codereview.chromium.org/8079004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@103921 0039d316-1c4b-4281-b951-d872f2087c98
void DidDumpQuotaTable(const QuotaTableEntries& entries) { quota_entries_ = entries; }
void DidDumpQuotaTable(const QuotaTableEntries& entries) { quota_entries_ = entries; }
C
Chrome
0
CVE-2015-3849
https://www.cvedetails.com/cve/CVE-2015-3849/
CWE-264
https://android.googlesource.com/platform/frameworks/base/+/4cff1f49ff95d990d6c2614da5d5a23d02145885
4cff1f49ff95d990d6c2614da5d5a23d02145885
Check that the parcel contained the expected amount of region data. DO NOT MERGE bug:20883006 Change-Id: Ib47a8ec8696dbc37e958b8dbceb43fcbabf6605b
static jboolean Region_getBounds(JNIEnv* env, jobject, jlong regionHandle, jobject rectBounds) { SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle); GraphicsJNI::irect_to_jrect(region->getBounds(), env, rectBounds); bool result = !region->isEmpty(); return boolTojboolean(result); }
static jboolean Region_getBounds(JNIEnv* env, jobject, jlong regionHandle, jobject rectBounds) { SkRegion* region = reinterpret_cast<SkRegion*>(regionHandle); GraphicsJNI::irect_to_jrect(region->getBounds(), env, rectBounds); bool result = !region->isEmpty(); return boolTojboolean(result); }
C
Android
0
CVE-2019-17547
https://www.cvedetails.com/cve/CVE-2019-17547/
null
https://github.com/ImageMagick/ImageMagick/commit/ecf7c6b288e11e7e7f75387c5e9e93e423b98397
ecf7c6b288e11e7e7f75387c5e9e93e423b98397
...
static MagickBooleanType DrawDashPolygon(const DrawInfo *draw_info, const PrimitiveInfo *primitive_info,Image *image,ExceptionInfo *exception) { double length, maximum_length, offset, scale, total_length; DrawInfo *clone_info; MagickStatusType status; PrimitiveInfo *dash_polygon; register double dx, dy; register ssize_t i; size_t number_vertices; ssize_t j, n; assert(draw_info != (const DrawInfo *) NULL); if (image->debug != MagickFalse) (void) LogMagickEvent(DrawEvent,GetMagickModule()," begin draw-dash"); for (i=0; primitive_info[i].primitive != UndefinedPrimitive; i++) ; number_vertices=(size_t) i; dash_polygon=(PrimitiveInfo *) AcquireQuantumMemory((size_t) (2UL*number_vertices+32UL),sizeof(*dash_polygon)); if (dash_polygon == (PrimitiveInfo *) NULL) return(MagickFalse); (void) memset(dash_polygon,0,(2UL*number_vertices+32UL)* sizeof(*dash_polygon)); clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info); clone_info->miterlimit=0; dash_polygon[0]=primitive_info[0]; scale=ExpandAffine(&draw_info->affine); length=scale*draw_info->dash_pattern[0]; offset=fabs(draw_info->dash_offset) >= MagickEpsilon ? scale*draw_info->dash_offset : 0.0; j=1; for (n=0; offset > 0.0; j=0) { if (draw_info->dash_pattern[n] <= 0.0) break; length=scale*(draw_info->dash_pattern[n]+(n == 0 ? -0.5 : 0.5)); if (offset > length) { offset-=length; n++; length=scale*draw_info->dash_pattern[n]; continue; } if (offset < length) { length-=offset; offset=0.0; break; } offset=0.0; n++; } status=MagickTrue; maximum_length=0.0; total_length=0.0; for (i=1; (i < (ssize_t) number_vertices) && (length >= 0.0); i++) { dx=primitive_info[i].point.x-primitive_info[i-1].point.x; dy=primitive_info[i].point.y-primitive_info[i-1].point.y; maximum_length=hypot(dx,dy); if (maximum_length > MaxBezierCoordinates) break; if (fabs(length) < MagickEpsilon) { if (fabs(draw_info->dash_pattern[n]) >= MagickEpsilon) n++; if (fabs(draw_info->dash_pattern[n]) < MagickEpsilon) n=0; length=scale*draw_info->dash_pattern[n]; } for (total_length=0.0; (length >= 0.0) && (maximum_length >= (total_length+length)); ) { total_length+=length; if ((n & 0x01) != 0) { dash_polygon[0]=primitive_info[0]; dash_polygon[0].point.x=(double) (primitive_info[i-1].point.x+dx* total_length*PerceptibleReciprocal(maximum_length)); dash_polygon[0].point.y=(double) (primitive_info[i-1].point.y+dy* total_length*PerceptibleReciprocal(maximum_length)); j=1; } else { if ((j+1) > (ssize_t) number_vertices) break; dash_polygon[j]=primitive_info[i-1]; dash_polygon[j].point.x=(double) (primitive_info[i-1].point.x+dx* total_length*PerceptibleReciprocal(maximum_length)); dash_polygon[j].point.y=(double) (primitive_info[i-1].point.y+dy* total_length*PerceptibleReciprocal(maximum_length)); dash_polygon[j].coordinates=1; j++; dash_polygon[0].coordinates=(size_t) j; dash_polygon[j].primitive=UndefinedPrimitive; status&=DrawStrokePolygon(image,clone_info,dash_polygon,exception); if (status == MagickFalse) break; } if (fabs(draw_info->dash_pattern[n]) >= MagickEpsilon) n++; if (fabs(draw_info->dash_pattern[n]) < MagickEpsilon) n=0; length=scale*draw_info->dash_pattern[n]; } length-=(maximum_length-total_length); if ((n & 0x01) != 0) continue; dash_polygon[j]=primitive_info[i]; dash_polygon[j].coordinates=1; j++; } if ((status != MagickFalse) && (total_length < maximum_length) && ((n & 0x01) == 0) && (j > 1)) { dash_polygon[j]=primitive_info[i-1]; dash_polygon[j].point.x+=MagickEpsilon; dash_polygon[j].point.y+=MagickEpsilon; dash_polygon[j].coordinates=1; j++; dash_polygon[0].coordinates=(size_t) j; dash_polygon[j].primitive=UndefinedPrimitive; status&=DrawStrokePolygon(image,clone_info,dash_polygon,exception); } dash_polygon=(PrimitiveInfo *) RelinquishMagickMemory(dash_polygon); clone_info=DestroyDrawInfo(clone_info); if (image->debug != MagickFalse) (void) LogMagickEvent(DrawEvent,GetMagickModule()," end draw-dash"); return(status != 0 ? MagickTrue : MagickFalse); }
static MagickBooleanType DrawDashPolygon(const DrawInfo *draw_info, const PrimitiveInfo *primitive_info,Image *image,ExceptionInfo *exception) { double length, maximum_length, offset, scale, total_length; DrawInfo *clone_info; MagickStatusType status; PrimitiveInfo *dash_polygon; register double dx, dy; register ssize_t i; size_t number_vertices; ssize_t j, n; assert(draw_info != (const DrawInfo *) NULL); if (image->debug != MagickFalse) (void) LogMagickEvent(DrawEvent,GetMagickModule()," begin draw-dash"); for (i=0; primitive_info[i].primitive != UndefinedPrimitive; i++) ; number_vertices=(size_t) i; dash_polygon=(PrimitiveInfo *) AcquireQuantumMemory((size_t) (2UL*number_vertices+32UL),sizeof(*dash_polygon)); if (dash_polygon == (PrimitiveInfo *) NULL) return(MagickFalse); (void) memset(dash_polygon,0,(2UL*number_vertices+32UL)* sizeof(*dash_polygon)); clone_info=CloneDrawInfo((ImageInfo *) NULL,draw_info); clone_info->miterlimit=0; dash_polygon[0]=primitive_info[0]; scale=ExpandAffine(&draw_info->affine); length=scale*draw_info->dash_pattern[0]; offset=fabs(draw_info->dash_offset) >= MagickEpsilon ? scale*draw_info->dash_offset : 0.0; j=1; for (n=0; offset > 0.0; j=0) { if (draw_info->dash_pattern[n] <= 0.0) break; length=scale*(draw_info->dash_pattern[n]+(n == 0 ? -0.5 : 0.5)); if (offset > length) { offset-=length; n++; length=scale*draw_info->dash_pattern[n]; continue; } if (offset < length) { length-=offset; offset=0.0; break; } offset=0.0; n++; } status=MagickTrue; maximum_length=0.0; total_length=0.0; for (i=1; (i < (ssize_t) number_vertices) && (length >= 0.0); i++) { dx=primitive_info[i].point.x-primitive_info[i-1].point.x; dy=primitive_info[i].point.y-primitive_info[i-1].point.y; maximum_length=hypot(dx,dy); if (maximum_length > MaxBezierCoordinates) break; if (fabs(length) < MagickEpsilon) { if (fabs(draw_info->dash_pattern[n]) >= MagickEpsilon) n++; if (fabs(draw_info->dash_pattern[n]) < MagickEpsilon) n=0; length=scale*draw_info->dash_pattern[n]; } for (total_length=0.0; (length >= 0.0) && (maximum_length >= (total_length+length)); ) { total_length+=length; if ((n & 0x01) != 0) { dash_polygon[0]=primitive_info[0]; dash_polygon[0].point.x=(double) (primitive_info[i-1].point.x+dx* total_length*PerceptibleReciprocal(maximum_length)); dash_polygon[0].point.y=(double) (primitive_info[i-1].point.y+dy* total_length*PerceptibleReciprocal(maximum_length)); j=1; } else { if ((j+1) > (ssize_t) number_vertices) break; dash_polygon[j]=primitive_info[i-1]; dash_polygon[j].point.x=(double) (primitive_info[i-1].point.x+dx* total_length*PerceptibleReciprocal(maximum_length)); dash_polygon[j].point.y=(double) (primitive_info[i-1].point.y+dy* total_length*PerceptibleReciprocal(maximum_length)); dash_polygon[j].coordinates=1; j++; dash_polygon[0].coordinates=(size_t) j; dash_polygon[j].primitive=UndefinedPrimitive; status&=DrawStrokePolygon(image,clone_info,dash_polygon,exception); if (status == MagickFalse) break; } if (fabs(draw_info->dash_pattern[n]) >= MagickEpsilon) n++; if (fabs(draw_info->dash_pattern[n]) < MagickEpsilon) n=0; length=scale*draw_info->dash_pattern[n]; } length-=(maximum_length-total_length); if ((n & 0x01) != 0) continue; dash_polygon[j]=primitive_info[i]; dash_polygon[j].coordinates=1; j++; } if ((status != MagickFalse) && (total_length < maximum_length) && ((n & 0x01) == 0) && (j > 1)) { dash_polygon[j]=primitive_info[i-1]; dash_polygon[j].point.x+=MagickEpsilon; dash_polygon[j].point.y+=MagickEpsilon; dash_polygon[j].coordinates=1; j++; dash_polygon[0].coordinates=(size_t) j; dash_polygon[j].primitive=UndefinedPrimitive; status&=DrawStrokePolygon(image,clone_info,dash_polygon,exception); } dash_polygon=(PrimitiveInfo *) RelinquishMagickMemory(dash_polygon); clone_info=DestroyDrawInfo(clone_info); if (image->debug != MagickFalse) (void) LogMagickEvent(DrawEvent,GetMagickModule()," end draw-dash"); return(status != 0 ? MagickTrue : MagickFalse); }
C
ImageMagick
0
CVE-2010-1166
https://www.cvedetails.com/cve/CVE-2010-1166/
CWE-189
https://cgit.freedesktop.org/xorg/xserver/commit/?id=d2f813f7db
d2f813f7db157fc83abc4b3726821c36ee7e40b1
null
fbCombineConjointAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineAAtop); }
fbCombineConjointAtopC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineConjointGeneralC (dest, src, mask, width, CombineAAtop); }
C
xserver
0
CVE-2014-3191
https://www.cvedetails.com/cve/CVE-2014-3191/
CWE-416
https://github.com/chromium/chromium/commit/11a4cc4a6d6e665d9a118fada4b7c658d6f70d95
11a4cc4a6d6e665d9a118fada4b7c658d6f70d95
Defer call to updateWidgetPositions() outside of RenderLayerScrollableArea. updateWidgetPositions() can destroy the render tree, so it should never be called from inside RenderLayerScrollableArea. Leaving it there allows for the potential of use-after-free bugs. BUG=402407 [email protected] Review URL: https://codereview.chromium.org/490473003 git-svn-id: svn://svn.chromium.org/blink/trunk@180681 bbb929c8-8fbe-4397-9dbb-9b2b20218538
bool RenderLayerScrollableArea::isActive() const { Page* page = box().frame()->page(); return page && page->focusController().isActive(); }
bool RenderLayerScrollableArea::isActive() const { Page* page = box().frame()->page(); return page && page->focusController().isActive(); }
C
Chrome
0
CVE-2013-2871
https://www.cvedetails.com/cve/CVE-2013-2871/
CWE-20
https://github.com/chromium/chromium/commit/bb9cfb0aba25f4b13e57bdd4a9fac80ba071e7b9
bb9cfb0aba25f4b13e57bdd4a9fac80ba071e7b9
Setting input.x-webkit-speech should not cause focus change In r150866, we introduced element()->focus() in destroyShadowSubtree() to retain focus on <input> when its type attribute gets changed. But when x-webkit-speech attribute is changed, the element is detached before calling destroyShadowSubtree() and element()->focus() failed This patch moves detach() after destroyShadowSubtree() to fix the problem. BUG=243818 TEST=fast/forms/input-type-change-focusout.html NOTRY=true Review URL: https://chromiumcodereview.appspot.com/16084005 git-svn-id: svn://svn.chromium.org/blink/trunk@151444 bbb929c8-8fbe-4397-9dbb-9b2b20218538
HTMLElement* HTMLInputElement::list() const { return dataList(); }
HTMLElement* HTMLInputElement::list() const { return dataList(); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/ec14f31eca3a51f665432973552ee575635132b3
ec14f31eca3a51f665432973552ee575635132b3
[EFL] Change the behavior of ewk_view_scale_set. https://bugs.webkit.org/show_bug.cgi?id=70078 Reviewed by Eric Seidel. Remove center point basis zoom alignment from ewk_view_scale_set to call Page::setPageScaleFactor without any adjustment. * ewk/ewk_view.cpp: (ewk_view_scale_set): * ewk/ewk_view.h: git-svn-id: svn://svn.chromium.org/blink/trunk@103288 bbb929c8-8fbe-4397-9dbb-9b2b20218538
Eina_Bool ewk_view_navigate_possible(Evas_Object* ewkView, int steps) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); return ewk_frame_navigate_possible(smartData->main_frame, steps); }
Eina_Bool ewk_view_navigate_possible(Evas_Object* ewkView, int steps) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); return ewk_frame_navigate_possible(smartData->main_frame, steps); }
C
Chrome
0
CVE-2015-5283
https://www.cvedetails.com/cve/CVE-2015-5283/
CWE-119
https://github.com/torvalds/linux/commit/8e2d61e0aed2b7c4ecb35844fe07e0b2b762dee4
8e2d61e0aed2b7c4ecb35844fe07e0b2b762dee4
sctp: fix race on protocol/netns initialization Consider sctp module is unloaded and is being requested because an user is creating a sctp socket. During initialization, sctp will add the new protocol type and then initialize pernet subsys: status = sctp_v4_protosw_init(); if (status) goto err_protosw_init; status = sctp_v6_protosw_init(); if (status) goto err_v6_protosw_init; status = register_pernet_subsys(&sctp_net_ops); The problem is that after those calls to sctp_v{4,6}_protosw_init(), it is possible for userspace to create SCTP sockets like if the module is already fully loaded. If that happens, one of the possible effects is that we will have readers for net->sctp.local_addr_list list earlier than expected and sctp_net_init() does not take precautions while dealing with that list, leading to a potential panic but not limited to that, as sctp_sock_init() will copy a bunch of blank/partially initialized values from net->sctp. The race happens like this: CPU 0 | CPU 1 socket() | __sock_create | socket() inet_create | __sock_create list_for_each_entry_rcu( | answer, &inetsw[sock->type], | list) { | inet_create /* no hits */ | if (unlikely(err)) { | ... | request_module() | /* socket creation is blocked | * the module is fully loaded | */ | sctp_init | sctp_v4_protosw_init | inet_register_protosw | list_add_rcu(&p->list, | last_perm); | | list_for_each_entry_rcu( | answer, &inetsw[sock->type], sctp_v6_protosw_init | list) { | /* hit, so assumes protocol | * is already loaded | */ | /* socket creation continues | * before netns is initialized | */ register_pernet_subsys | Simply inverting the initialization order between register_pernet_subsys() and sctp_v4_protosw_init() is not possible because register_pernet_subsys() will create a control sctp socket, so the protocol must be already visible by then. Deferring the socket creation to a work-queue is not good specially because we loose the ability to handle its errors. So, as suggested by Vlad, the fix is to split netns initialization in two moments: defaults and control socket, so that the defaults are already loaded by when we register the protocol, while control socket initialization is kept at the same moment it is today. Fixes: 4db67e808640 ("sctp: Make the address lists per network namespace") Signed-off-by: Vlad Yasevich <[email protected]> Signed-off-by: Marcelo Ricardo Leitner <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp) { struct net *net = sock_net(&sp->inet.sk); int ret = inet_addr_type(net, addr->v4.sin_addr.s_addr); if (addr->v4.sin_addr.s_addr != htonl(INADDR_ANY) && ret != RTN_LOCAL && !sp->inet.freebind && !net->ipv4.sysctl_ip_nonlocal_bind) return 0; if (ipv6_only_sock(sctp_opt2sk(sp))) return 0; return 1; }
static int sctp_v4_available(union sctp_addr *addr, struct sctp_sock *sp) { struct net *net = sock_net(&sp->inet.sk); int ret = inet_addr_type(net, addr->v4.sin_addr.s_addr); if (addr->v4.sin_addr.s_addr != htonl(INADDR_ANY) && ret != RTN_LOCAL && !sp->inet.freebind && !net->ipv4.sysctl_ip_nonlocal_bind) return 0; if (ipv6_only_sock(sctp_opt2sk(sp))) return 0; return 1; }
C
linux
0
CVE-2018-20815
https://www.cvedetails.com/cve/CVE-2018-20815/
CWE-119
https://git.qemu.org/?p=qemu.git;a=commitdiff;h=da885fe1ee8b4589047484bd7fa05a4905b52b17
da885fe1ee8b4589047484bd7fa05a4905b52b17
null
void *create_device_tree(int *sizep) { void *fdt; int ret; *sizep = FDT_MAX_SIZE; fdt = g_malloc0(FDT_MAX_SIZE); ret = fdt_create(fdt, FDT_MAX_SIZE); if (ret < 0) { goto fail; } ret = fdt_finish_reservemap(fdt); if (ret < 0) { goto fail; } ret = fdt_begin_node(fdt, ""); if (ret < 0) { goto fail; } ret = fdt_end_node(fdt); if (ret < 0) { goto fail; } ret = fdt_finish(fdt); if (ret < 0) { goto fail; } ret = fdt_open_into(fdt, fdt, *sizep); if (ret) { error_report("Unable to copy device tree in memory"); exit(1); } return fdt; fail: error_report("%s Couldn't create dt: %s", __func__, fdt_strerror(ret)); exit(1); }
void *create_device_tree(int *sizep) { void *fdt; int ret; *sizep = FDT_MAX_SIZE; fdt = g_malloc0(FDT_MAX_SIZE); ret = fdt_create(fdt, FDT_MAX_SIZE); if (ret < 0) { goto fail; } ret = fdt_finish_reservemap(fdt); if (ret < 0) { goto fail; } ret = fdt_begin_node(fdt, ""); if (ret < 0) { goto fail; } ret = fdt_end_node(fdt); if (ret < 0) { goto fail; } ret = fdt_finish(fdt); if (ret < 0) { goto fail; } ret = fdt_open_into(fdt, fdt, *sizep); if (ret) { error_report("Unable to copy device tree in memory"); exit(1); } return fdt; fail: error_report("%s Couldn't create dt: %s", __func__, fdt_strerror(ret)); exit(1); }
C
qemu
0
CVE-2018-6791
https://www.cvedetails.com/cve/CVE-2018-6791/
CWE-78
https://cgit.kde.org/plasma-workspace.git/commit/?id=9db872df82c258315c6ebad800af59e81ffb9212
9db872df82c258315c6ebad800af59e81ffb9212
null
MacroExpander(const Solid::Device &device) : KMacroExpanderBase('%'), m_device(device) {}
MacroExpander(const Solid::Device &device) : KMacroExpanderBase('%'), m_device(device) {}
CPP
kde
0
CVE-2011-3353
https://www.cvedetails.com/cve/CVE-2011-3353/
CWE-119
https://github.com/torvalds/linux/commit/c2183d1e9b3f313dd8ba2b1b0197c8d9fb86a7ae
c2183d1e9b3f313dd8ba2b1b0197c8d9fb86a7ae
fuse: check size of FUSE_NOTIFY_INVAL_ENTRY message FUSE_NOTIFY_INVAL_ENTRY didn't check the length of the write so the message processing could overrun and result in a "kernel BUG at fs/fuse/dev.c:629!" Reported-by: Han-Wen Nienhuys <[email protected]> Signed-off-by: Miklos Szeredi <[email protected]> CC: [email protected]
void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req) { if (atomic_dec_and_test(&req->count)) { if (req->waiting) atomic_dec(&fc->num_waiting); if (req->stolen_file) put_reserved_req(fc, req); else fuse_request_free(req); } }
void fuse_put_request(struct fuse_conn *fc, struct fuse_req *req) { if (atomic_dec_and_test(&req->count)) { if (req->waiting) atomic_dec(&fc->num_waiting); if (req->stolen_file) put_reserved_req(fc, req); else fuse_request_free(req); } }
C
linux
0
CVE-2017-14604
https://www.cvedetails.com/cve/CVE-2017-14604/
CWE-20
https://github.com/GNOME/nautilus/commit/1630f53481f445ada0a455e9979236d31a8d3bb0
1630f53481f445ada0a455e9979236d31a8d3bb0
mime-actions: use file metadata for trusting desktop files Currently we only trust desktop files that have the executable bit set, and don't replace the displayed icon or the displayed name until it's trusted, which prevents for running random programs by a malicious desktop file. However, the executable permission is preserved if the desktop file comes from a compressed file. To prevent this, add a metadata::trusted metadata to the file once the user acknowledges the file as trusted. This adds metadata to the file, which cannot be added unless it has access to the computer. Also remove the SHEBANG "trusted" content we were putting inside the desktop file, since that doesn't add more security since it can come with the file itself. https://bugzilla.gnome.org/show_bug.cgi?id=777991
lacks_info (NautilusFile *file) { return !file->details->file_info_is_up_to_date && !file->details->is_gone; }
lacks_info (NautilusFile *file) { return !file->details->file_info_is_up_to_date && !file->details->is_gone; }
C
nautilus
0
CVE-2017-5019
https://www.cvedetails.com/cve/CVE-2017-5019/
CWE-416
https://github.com/chromium/chromium/commit/f03ea5a5c2ff26e239dfd23e263b15da2d9cee93
f03ea5a5c2ff26e239dfd23e263b15da2d9cee93
Convert FrameHostMsg_DidAddMessageToConsole to Mojo. Note: Since this required changing the test RenderViewImplTest.DispatchBeforeUnloadCanDetachFrame, I manually re-introduced https://crbug.com/666714 locally (the bug the test was added for), and reran the test to confirm that it still covers the bug. Bug: 786836 Change-Id: I110668fa6f0f261fd2ac36bb91a8d8b31c99f4f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1526270 Commit-Queue: Lowell Manners <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#653137}
ServiceWorkerContextCore::GetClientProviderHostIterator( const GURL& origin, bool include_reserved_clients) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); return base::WrapUnique(new ProviderHostIterator( providers_.get(), base::BindRepeating(IsSameOriginClientProviderHost, origin, include_reserved_clients))); }
ServiceWorkerContextCore::GetClientProviderHostIterator( const GURL& origin, bool include_reserved_clients) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); return base::WrapUnique(new ProviderHostIterator( providers_.get(), base::BindRepeating(IsSameOriginClientProviderHost, origin, include_reserved_clients))); }
C
Chrome
0
CVE-2014-9683
https://www.cvedetails.com/cve/CVE-2014-9683/
CWE-189
https://github.com/torvalds/linux/commit/942080643bce061c3dd9d5718d3b745dcb39a8bc
942080643bce061c3dd9d5718d3b745dcb39a8bc
eCryptfs: Remove buggy and unnecessary write in file name decode routine Dmitry Chernenkov used KASAN to discover that eCryptfs writes past the end of the allocated buffer during encrypted filename decoding. This fix corrects the issue by getting rid of the unnecessary 0 write when the current bit offset is 2. Signed-off-by: Michael Halcrow <[email protected]> Reported-by: Dmitry Chernenkov <[email protected]> Suggested-by: Kees Cook <[email protected]> Cc: [email protected] # v2.6.29+: 51ca58d eCryptfs: Filename Encryption: Encoding and encryption functions Signed-off-by: Tyler Hicks <[email protected]>
int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode) { struct dentry *lower_dentry = ecryptfs_inode_to_private(ecryptfs_inode)->lower_file->f_dentry; ssize_t size; int rc = 0; size = ecryptfs_getxattr_lower(lower_dentry, ECRYPTFS_XATTR_NAME, page_virt, ECRYPTFS_DEFAULT_EXTENT_SIZE); if (size < 0) { if (unlikely(ecryptfs_verbosity > 0)) printk(KERN_INFO "Error attempting to read the [%s] " "xattr from the lower file; return value = " "[%zd]\n", ECRYPTFS_XATTR_NAME, size); rc = -EINVAL; goto out; } out: return rc; }
int ecryptfs_read_xattr_region(char *page_virt, struct inode *ecryptfs_inode) { struct dentry *lower_dentry = ecryptfs_inode_to_private(ecryptfs_inode)->lower_file->f_dentry; ssize_t size; int rc = 0; size = ecryptfs_getxattr_lower(lower_dentry, ECRYPTFS_XATTR_NAME, page_virt, ECRYPTFS_DEFAULT_EXTENT_SIZE); if (size < 0) { if (unlikely(ecryptfs_verbosity > 0)) printk(KERN_INFO "Error attempting to read the [%s] " "xattr from the lower file; return value = " "[%zd]\n", ECRYPTFS_XATTR_NAME, size); rc = -EINVAL; goto out; } out: return rc; }
C
linux
0
CVE-2017-14222
https://www.cvedetails.com/cve/CVE-2017-14222/
CWE-834
https://github.com/FFmpeg/FFmpeg/commit/9cb4eb772839c5e1de2855d126bf74ff16d13382
9cb4eb772839c5e1de2855d126bf74ff16d13382
avformat/mov: Fix DoS in read_tfra() Fixes: Missing EOF check in loop No testcase Found-by: Xiaohei and Wangchu from Alibaba Security Team Signed-off-by: Michael Niedermayer <[email protected]>
static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc, int64_t size) { int ret; if (st->codecpar->codec_tag == MKTAG('t','m','c','d')) { if ((int)size != size) return AVERROR(ENOMEM); ret = ff_get_extradata(c->fc, st->codecpar, pb, size); if (ret < 0) return ret; if (size > 16) { MOVStreamContext *tmcd_ctx = st->priv_data; int val; val = AV_RB32(st->codecpar->extradata + 4); tmcd_ctx->tmcd_flags = val; st->avg_frame_rate.num = st->codecpar->extradata[16]; /* number of frame */ st->avg_frame_rate.den = 1; #if FF_API_LAVF_AVCTX FF_DISABLE_DEPRECATION_WARNINGS st->codec->time_base = av_inv_q(st->avg_frame_rate); FF_ENABLE_DEPRECATION_WARNINGS #endif /* adjust for per frame dur in counter mode */ if (tmcd_ctx->tmcd_flags & 0x0008) { int timescale = AV_RB32(st->codecpar->extradata + 8); int framedur = AV_RB32(st->codecpar->extradata + 12); st->avg_frame_rate.num *= timescale; st->avg_frame_rate.den *= framedur; #if FF_API_LAVF_AVCTX FF_DISABLE_DEPRECATION_WARNINGS st->codec->time_base.den *= timescale; st->codec->time_base.num *= framedur; FF_ENABLE_DEPRECATION_WARNINGS #endif } if (size > 30) { uint32_t len = AV_RB32(st->codecpar->extradata + 18); /* name atom length */ uint32_t format = AV_RB32(st->codecpar->extradata + 22); if (format == AV_RB32("name") && (int64_t)size >= (int64_t)len + 18) { uint16_t str_size = AV_RB16(st->codecpar->extradata + 26); /* string length */ if (str_size > 0 && size >= (int)str_size + 26) { char *reel_name = av_malloc(str_size + 1); if (!reel_name) return AVERROR(ENOMEM); memcpy(reel_name, st->codecpar->extradata + 30, str_size); reel_name[str_size] = 0; /* Add null terminator */ /* don't add reel_name if emtpy string */ if (*reel_name == 0) { av_free(reel_name); } else { av_dict_set(&st->metadata, "reel_name", reel_name, AV_DICT_DONT_STRDUP_VAL); } } } } } } else { /* other codec type, just skip (rtp, mp4s ...) */ avio_skip(pb, size); } return 0; }
static int mov_parse_stsd_data(MOVContext *c, AVIOContext *pb, AVStream *st, MOVStreamContext *sc, int64_t size) { int ret; if (st->codecpar->codec_tag == MKTAG('t','m','c','d')) { if ((int)size != size) return AVERROR(ENOMEM); ret = ff_get_extradata(c->fc, st->codecpar, pb, size); if (ret < 0) return ret; if (size > 16) { MOVStreamContext *tmcd_ctx = st->priv_data; int val; val = AV_RB32(st->codecpar->extradata + 4); tmcd_ctx->tmcd_flags = val; st->avg_frame_rate.num = st->codecpar->extradata[16]; /* number of frame */ st->avg_frame_rate.den = 1; #if FF_API_LAVF_AVCTX FF_DISABLE_DEPRECATION_WARNINGS st->codec->time_base = av_inv_q(st->avg_frame_rate); FF_ENABLE_DEPRECATION_WARNINGS #endif /* adjust for per frame dur in counter mode */ if (tmcd_ctx->tmcd_flags & 0x0008) { int timescale = AV_RB32(st->codecpar->extradata + 8); int framedur = AV_RB32(st->codecpar->extradata + 12); st->avg_frame_rate.num *= timescale; st->avg_frame_rate.den *= framedur; #if FF_API_LAVF_AVCTX FF_DISABLE_DEPRECATION_WARNINGS st->codec->time_base.den *= timescale; st->codec->time_base.num *= framedur; FF_ENABLE_DEPRECATION_WARNINGS #endif } if (size > 30) { uint32_t len = AV_RB32(st->codecpar->extradata + 18); /* name atom length */ uint32_t format = AV_RB32(st->codecpar->extradata + 22); if (format == AV_RB32("name") && (int64_t)size >= (int64_t)len + 18) { uint16_t str_size = AV_RB16(st->codecpar->extradata + 26); /* string length */ if (str_size > 0 && size >= (int)str_size + 26) { char *reel_name = av_malloc(str_size + 1); if (!reel_name) return AVERROR(ENOMEM); memcpy(reel_name, st->codecpar->extradata + 30, str_size); reel_name[str_size] = 0; /* Add null terminator */ /* don't add reel_name if emtpy string */ if (*reel_name == 0) { av_free(reel_name); } else { av_dict_set(&st->metadata, "reel_name", reel_name, AV_DICT_DONT_STRDUP_VAL); } } } } } } else { /* other codec type, just skip (rtp, mp4s ...) */ avio_skip(pb, size); } return 0; }
C
FFmpeg
0
CVE-2014-0224
https://www.cvedetails.com/cve/CVE-2014-0224/
CWE-310
https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=bc8923b1ec9c467755cd86f7848c50ee8812e441
bc8923b1ec9c467755cd86f7848c50ee8812e441
null
int ssl3_connect(SSL *s) { BUF_MEM *buf=NULL; unsigned long Time=(unsigned long)time(NULL); void (*cb)(const SSL *ssl,int type,int val)=NULL; int ret= -1; int new_state,state,skip=0; RAND_add(&Time,sizeof(Time),0); ERR_clear_error(); clear_sys_error(); if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; s->in_handshake++; if (!SSL_in_init(s) || SSL_in_before(s)) SSL_clear(s); #ifndef OPENSSL_NO_HEARTBEATS /* If we're awaiting a HeartbeatResponse, pretend we * already got and don't await it anymore, because * Heartbeats don't make sense during handshakes anyway. */ if (s->tlsext_hb_pending) { s->tlsext_hb_pending = 0; s->tlsext_hb_seq++; } #endif for (;;) { state=s->state; switch(s->state) { case SSL_ST_RENEGOTIATE: s->renegotiate=1; s->state=SSL_ST_CONNECT; s->ctx->stats.sess_connect_renegotiate++; /* break */ case SSL_ST_BEFORE: case SSL_ST_CONNECT: case SSL_ST_BEFORE|SSL_ST_CONNECT: case SSL_ST_OK|SSL_ST_CONNECT: s->server=0; if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1); if ((s->version & 0xff00 ) != 0x0300) { SSLerr(SSL_F_SSL3_CONNECT, ERR_R_INTERNAL_ERROR); ret = -1; goto end; } /* s->version=SSL3_VERSION; */ s->type=SSL_ST_CONNECT; if (s->init_buf == NULL) { if ((buf=BUF_MEM_new()) == NULL) { ret= -1; goto end; } if (!BUF_MEM_grow(buf,SSL3_RT_MAX_PLAIN_LENGTH)) { ret= -1; goto end; } s->init_buf=buf; buf=NULL; } if (!ssl3_setup_buffers(s)) { ret= -1; goto end; } /* setup buffing BIO */ if (!ssl_init_wbio_buffer(s,0)) { ret= -1; goto end; } /* don't push the buffering BIO quite yet */ ssl3_init_finished_mac(s); s->state=SSL3_ST_CW_CLNT_HELLO_A; s->ctx->stats.sess_connect++; s->init_num=0; break; case SSL3_ST_CW_CLNT_HELLO_A: case SSL3_ST_CW_CLNT_HELLO_B: s->shutdown=0; ret=ssl3_client_hello(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_SRVR_HELLO_A; s->init_num=0; /* turn on buffering for the next lot of output */ if (s->bbio != s->wbio) s->wbio=BIO_push(s->bbio,s->wbio); break; case SSL3_ST_CR_SRVR_HELLO_A: case SSL3_ST_CR_SRVR_HELLO_B: ret=ssl3_get_server_hello(s); if (ret <= 0) goto end; if (s->hit) { s->state=SSL3_ST_CR_FINISHED_A; #ifndef OPENSSL_NO_TLSEXT if (s->tlsext_ticket_expected) { /* receive renewed session ticket */ s->state=SSL3_ST_CR_SESSION_TICKET_A; } #endif } else s->state=SSL3_ST_CR_CERT_A; s->init_num=0; break; case SSL3_ST_CR_CERT_A: case SSL3_ST_CR_CERT_B: #ifndef OPENSSL_NO_TLSEXT ret=ssl3_check_finished(s); if (ret <= 0) goto end; if (ret == 2) { s->hit = 1; if (s->tlsext_ticket_expected) s->state=SSL3_ST_CR_SESSION_TICKET_A; else s->state=SSL3_ST_CR_FINISHED_A; s->init_num=0; break; } #endif /* Check if it is anon DH/ECDH */ /* or PSK */ if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL) && !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK)) { ret=ssl3_get_server_certificate(s); if (ret <= 0) goto end; #ifndef OPENSSL_NO_TLSEXT if (s->tlsext_status_expected) s->state=SSL3_ST_CR_CERT_STATUS_A; else s->state=SSL3_ST_CR_KEY_EXCH_A; } else { skip = 1; s->state=SSL3_ST_CR_KEY_EXCH_A; } #else } else skip=1; s->state=SSL3_ST_CR_KEY_EXCH_A; #endif s->init_num=0; break; case SSL3_ST_CR_KEY_EXCH_A: case SSL3_ST_CR_KEY_EXCH_B: ret=ssl3_get_key_exchange(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_CERT_REQ_A; s->init_num=0; /* at this point we check that we have the * required stuff from the server */ if (!ssl3_check_cert_and_algorithm(s)) { ret= -1; goto end; } break; case SSL3_ST_CR_CERT_REQ_A: case SSL3_ST_CR_CERT_REQ_B: ret=ssl3_get_certificate_request(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_SRVR_DONE_A; s->init_num=0; break; case SSL3_ST_CR_SRVR_DONE_A: case SSL3_ST_CR_SRVR_DONE_B: ret=ssl3_get_server_done(s); if (ret <= 0) goto end; #ifndef OPENSSL_NO_SRP if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kSRP) { if ((ret = SRP_Calc_A_param(s))<=0) { SSLerr(SSL_F_SSL3_CONNECT,SSL_R_SRP_A_CALC); ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_INTERNAL_ERROR); goto end; } } #endif if (s->s3->tmp.cert_req) s->state=SSL3_ST_CW_CERT_A; else s->state=SSL3_ST_CW_KEY_EXCH_A; s->init_num=0; break; case SSL3_ST_CW_CERT_A: case SSL3_ST_CW_CERT_B: case SSL3_ST_CW_CERT_C: case SSL3_ST_CW_CERT_D: ret=ssl3_send_client_certificate(s); if (ret <= 0) goto end; s->state=SSL3_ST_CW_KEY_EXCH_A; s->init_num=0; break; case SSL3_ST_CW_KEY_EXCH_A: case SSL3_ST_CW_KEY_EXCH_B: ret=ssl3_send_client_key_exchange(s); if (ret <= 0) goto end; /* EAY EAY EAY need to check for DH fix cert * sent back */ /* For TLS, cert_req is set to 2, so a cert chain * of nothing is sent, but no verify packet is sent */ /* XXX: For now, we do not support client * authentication in ECDH cipher suites with * ECDH (rather than ECDSA) certificates. * We need to skip the certificate verify * message when client's ECDH public key is sent * inside the client certificate. */ if (s->s3->tmp.cert_req == 1) { s->state=SSL3_ST_CW_CERT_VRFY_A; } else { s->state=SSL3_ST_CW_CHANGE_A; s->s3->change_cipher_spec=0; } if (s->s3->flags & TLS1_FLAGS_SKIP_CERT_VERIFY) { s->state=SSL3_ST_CW_CHANGE_A; s->s3->change_cipher_spec=0; } s->init_num=0; break; case SSL3_ST_CW_CERT_VRFY_A: case SSL3_ST_CW_CERT_VRFY_B: ret=ssl3_send_client_verify(s); if (ret <= 0) goto end; s->state=SSL3_ST_CW_CHANGE_A; s->init_num=0; s->s3->change_cipher_spec=0; break; case SSL3_ST_CW_CHANGE_A: case SSL3_ST_CW_CHANGE_B: ret=ssl3_send_change_cipher_spec(s, SSL3_ST_CW_CHANGE_A,SSL3_ST_CW_CHANGE_B); if (ret <= 0) goto end; #if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG) s->state=SSL3_ST_CW_FINISHED_A; #else if (s->s3->next_proto_neg_seen) s->state=SSL3_ST_CW_NEXT_PROTO_A; else s->state=SSL3_ST_CW_FINISHED_A; #endif s->init_num=0; s->session->cipher=s->s3->tmp.new_cipher; #ifdef OPENSSL_NO_COMP s->session->compress_meth=0; #else if (s->s3->tmp.new_compression == NULL) s->session->compress_meth=0; else s->session->compress_meth= s->s3->tmp.new_compression->id; #endif if (!s->method->ssl3_enc->setup_key_block(s)) { ret= -1; goto end; } if (!s->method->ssl3_enc->change_cipher_state(s, SSL3_CHANGE_CIPHER_CLIENT_WRITE)) { ret= -1; goto end; } break; #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) case SSL3_ST_CW_NEXT_PROTO_A: case SSL3_ST_CW_NEXT_PROTO_B: ret=ssl3_send_next_proto(s); if (ret <= 0) goto end; s->state=SSL3_ST_CW_FINISHED_A; break; #endif case SSL3_ST_CW_FINISHED_A: case SSL3_ST_CW_FINISHED_B: ret=ssl3_send_finished(s, SSL3_ST_CW_FINISHED_A,SSL3_ST_CW_FINISHED_B, s->method->ssl3_enc->client_finished_label, s->method->ssl3_enc->client_finished_label_len); if (ret <= 0) goto end; s->state=SSL3_ST_CW_FLUSH; /* clear flags */ s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER; if (s->hit) { s->s3->tmp.next_state=SSL_ST_OK; if (s->s3->flags & SSL3_FLAGS_DELAY_CLIENT_FINISHED) { s->state=SSL_ST_OK; s->s3->flags|=SSL3_FLAGS_POP_BUFFER; s->s3->delay_buf_pop_ret=0; } } else { #ifndef OPENSSL_NO_TLSEXT /* Allow NewSessionTicket if ticket expected */ if (s->tlsext_ticket_expected) s->s3->tmp.next_state=SSL3_ST_CR_SESSION_TICKET_A; else #endif s->s3->tmp.next_state=SSL3_ST_CR_FINISHED_A; } s->init_num=0; break; #ifndef OPENSSL_NO_TLSEXT case SSL3_ST_CR_SESSION_TICKET_A: case SSL3_ST_CR_SESSION_TICKET_B: ret=ssl3_get_new_session_ticket(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_FINISHED_A; s->init_num=0; break; case SSL3_ST_CR_CERT_STATUS_A: case SSL3_ST_CR_CERT_STATUS_B: ret=ssl3_get_cert_status(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_KEY_EXCH_A; s->init_num=0; break; #endif case SSL3_ST_CR_FINISHED_A: case SSL3_ST_CR_FINISHED_B: s->s3->flags |= SSL3_FLAGS_CCS_OK; ret=ssl3_get_finished(s,SSL3_ST_CR_FINISHED_A, SSL3_ST_CR_FINISHED_B); if (ret <= 0) goto end; if (s->hit) s->state=SSL3_ST_CW_CHANGE_A; else s->state=SSL_ST_OK; s->init_num=0; break; case SSL3_ST_CW_FLUSH: s->rwstate=SSL_WRITING; if (BIO_flush(s->wbio) <= 0) { ret= -1; goto end; } s->rwstate=SSL_NOTHING; s->state=s->s3->tmp.next_state; break; case SSL_ST_OK: /* clean a few things up */ ssl3_cleanup_key_block(s); if (s->init_buf != NULL) { BUF_MEM_free(s->init_buf); s->init_buf=NULL; } /* If we are not 'joining' the last two packets, * remove the buffering now */ if (!(s->s3->flags & SSL3_FLAGS_POP_BUFFER)) ssl_free_wbio_buffer(s); /* else do it later in ssl3_write */ s->init_num=0; s->renegotiate=0; s->new_session=0; ssl_update_cache(s,SSL_SESS_CACHE_CLIENT); if (s->hit) s->ctx->stats.sess_hit++; ret=1; /* s->server=0; */ s->handshake_func=ssl3_connect; s->ctx->stats.sess_connect_good++; if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_DONE,1); goto end; /* break; */ default: SSLerr(SSL_F_SSL3_CONNECT,SSL_R_UNKNOWN_STATE); ret= -1; goto end; /* break; */ } /* did we do anything */ if (!s->s3->tmp.reuse_message && !skip) { if (s->debug) { if ((ret=BIO_flush(s->wbio)) <= 0) goto end; } if ((cb != NULL) && (s->state != state)) { new_state=s->state; s->state=state; cb(s,SSL_CB_CONNECT_LOOP,1); s->state=new_state; } } skip=0; }
int ssl3_connect(SSL *s) { BUF_MEM *buf=NULL; unsigned long Time=(unsigned long)time(NULL); void (*cb)(const SSL *ssl,int type,int val)=NULL; int ret= -1; int new_state,state,skip=0; RAND_add(&Time,sizeof(Time),0); ERR_clear_error(); clear_sys_error(); if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; s->in_handshake++; if (!SSL_in_init(s) || SSL_in_before(s)) SSL_clear(s); #ifndef OPENSSL_NO_HEARTBEATS /* If we're awaiting a HeartbeatResponse, pretend we * already got and don't await it anymore, because * Heartbeats don't make sense during handshakes anyway. */ if (s->tlsext_hb_pending) { s->tlsext_hb_pending = 0; s->tlsext_hb_seq++; } #endif for (;;) { state=s->state; switch(s->state) { case SSL_ST_RENEGOTIATE: s->renegotiate=1; s->state=SSL_ST_CONNECT; s->ctx->stats.sess_connect_renegotiate++; /* break */ case SSL_ST_BEFORE: case SSL_ST_CONNECT: case SSL_ST_BEFORE|SSL_ST_CONNECT: case SSL_ST_OK|SSL_ST_CONNECT: s->server=0; if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1); if ((s->version & 0xff00 ) != 0x0300) { SSLerr(SSL_F_SSL3_CONNECT, ERR_R_INTERNAL_ERROR); ret = -1; goto end; } /* s->version=SSL3_VERSION; */ s->type=SSL_ST_CONNECT; if (s->init_buf == NULL) { if ((buf=BUF_MEM_new()) == NULL) { ret= -1; goto end; } if (!BUF_MEM_grow(buf,SSL3_RT_MAX_PLAIN_LENGTH)) { ret= -1; goto end; } s->init_buf=buf; buf=NULL; } if (!ssl3_setup_buffers(s)) { ret= -1; goto end; } /* setup buffing BIO */ if (!ssl_init_wbio_buffer(s,0)) { ret= -1; goto end; } /* don't push the buffering BIO quite yet */ ssl3_init_finished_mac(s); s->state=SSL3_ST_CW_CLNT_HELLO_A; s->ctx->stats.sess_connect++; s->init_num=0; break; case SSL3_ST_CW_CLNT_HELLO_A: case SSL3_ST_CW_CLNT_HELLO_B: s->shutdown=0; ret=ssl3_client_hello(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_SRVR_HELLO_A; s->init_num=0; /* turn on buffering for the next lot of output */ if (s->bbio != s->wbio) s->wbio=BIO_push(s->bbio,s->wbio); break; case SSL3_ST_CR_SRVR_HELLO_A: case SSL3_ST_CR_SRVR_HELLO_B: ret=ssl3_get_server_hello(s); if (ret <= 0) goto end; if (s->hit) { s->state=SSL3_ST_CR_FINISHED_A; #ifndef OPENSSL_NO_TLSEXT if (s->tlsext_ticket_expected) { /* receive renewed session ticket */ s->state=SSL3_ST_CR_SESSION_TICKET_A; } #endif } else s->state=SSL3_ST_CR_CERT_A; s->init_num=0; break; case SSL3_ST_CR_CERT_A: case SSL3_ST_CR_CERT_B: #ifndef OPENSSL_NO_TLSEXT ret=ssl3_check_finished(s); if (ret <= 0) goto end; if (ret == 2) { s->hit = 1; if (s->tlsext_ticket_expected) s->state=SSL3_ST_CR_SESSION_TICKET_A; else s->state=SSL3_ST_CR_FINISHED_A; s->init_num=0; break; } #endif /* Check if it is anon DH/ECDH */ /* or PSK */ if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL) && !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK)) { ret=ssl3_get_server_certificate(s); if (ret <= 0) goto end; #ifndef OPENSSL_NO_TLSEXT if (s->tlsext_status_expected) s->state=SSL3_ST_CR_CERT_STATUS_A; else s->state=SSL3_ST_CR_KEY_EXCH_A; } else { skip = 1; s->state=SSL3_ST_CR_KEY_EXCH_A; } #else } else skip=1; s->state=SSL3_ST_CR_KEY_EXCH_A; #endif s->init_num=0; break; case SSL3_ST_CR_KEY_EXCH_A: case SSL3_ST_CR_KEY_EXCH_B: ret=ssl3_get_key_exchange(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_CERT_REQ_A; s->init_num=0; /* at this point we check that we have the * required stuff from the server */ if (!ssl3_check_cert_and_algorithm(s)) { ret= -1; goto end; } break; case SSL3_ST_CR_CERT_REQ_A: case SSL3_ST_CR_CERT_REQ_B: ret=ssl3_get_certificate_request(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_SRVR_DONE_A; s->init_num=0; break; case SSL3_ST_CR_SRVR_DONE_A: case SSL3_ST_CR_SRVR_DONE_B: ret=ssl3_get_server_done(s); if (ret <= 0) goto end; #ifndef OPENSSL_NO_SRP if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kSRP) { if ((ret = SRP_Calc_A_param(s))<=0) { SSLerr(SSL_F_SSL3_CONNECT,SSL_R_SRP_A_CALC); ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_INTERNAL_ERROR); goto end; } } #endif if (s->s3->tmp.cert_req) s->state=SSL3_ST_CW_CERT_A; else s->state=SSL3_ST_CW_KEY_EXCH_A; s->init_num=0; break; case SSL3_ST_CW_CERT_A: case SSL3_ST_CW_CERT_B: case SSL3_ST_CW_CERT_C: case SSL3_ST_CW_CERT_D: ret=ssl3_send_client_certificate(s); if (ret <= 0) goto end; s->state=SSL3_ST_CW_KEY_EXCH_A; s->init_num=0; break; case SSL3_ST_CW_KEY_EXCH_A: case SSL3_ST_CW_KEY_EXCH_B: ret=ssl3_send_client_key_exchange(s); if (ret <= 0) goto end; /* EAY EAY EAY need to check for DH fix cert * sent back */ /* For TLS, cert_req is set to 2, so a cert chain * of nothing is sent, but no verify packet is sent */ /* XXX: For now, we do not support client * authentication in ECDH cipher suites with * ECDH (rather than ECDSA) certificates. * We need to skip the certificate verify * message when client's ECDH public key is sent * inside the client certificate. */ if (s->s3->tmp.cert_req == 1) { s->state=SSL3_ST_CW_CERT_VRFY_A; } else { s->state=SSL3_ST_CW_CHANGE_A; s->s3->change_cipher_spec=0; } if (s->s3->flags & TLS1_FLAGS_SKIP_CERT_VERIFY) { s->state=SSL3_ST_CW_CHANGE_A; s->s3->change_cipher_spec=0; } s->init_num=0; break; case SSL3_ST_CW_CERT_VRFY_A: case SSL3_ST_CW_CERT_VRFY_B: ret=ssl3_send_client_verify(s); if (ret <= 0) goto end; s->state=SSL3_ST_CW_CHANGE_A; s->init_num=0; s->s3->change_cipher_spec=0; break; case SSL3_ST_CW_CHANGE_A: case SSL3_ST_CW_CHANGE_B: ret=ssl3_send_change_cipher_spec(s, SSL3_ST_CW_CHANGE_A,SSL3_ST_CW_CHANGE_B); if (ret <= 0) goto end; #if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG) s->state=SSL3_ST_CW_FINISHED_A; #else if (s->s3->next_proto_neg_seen) s->state=SSL3_ST_CW_NEXT_PROTO_A; else s->state=SSL3_ST_CW_FINISHED_A; #endif s->init_num=0; s->session->cipher=s->s3->tmp.new_cipher; #ifdef OPENSSL_NO_COMP s->session->compress_meth=0; #else if (s->s3->tmp.new_compression == NULL) s->session->compress_meth=0; else s->session->compress_meth= s->s3->tmp.new_compression->id; #endif if (!s->method->ssl3_enc->setup_key_block(s)) { ret= -1; goto end; } if (!s->method->ssl3_enc->change_cipher_state(s, SSL3_CHANGE_CIPHER_CLIENT_WRITE)) { ret= -1; goto end; } break; #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) case SSL3_ST_CW_NEXT_PROTO_A: case SSL3_ST_CW_NEXT_PROTO_B: ret=ssl3_send_next_proto(s); if (ret <= 0) goto end; s->state=SSL3_ST_CW_FINISHED_A; break; #endif case SSL3_ST_CW_FINISHED_A: case SSL3_ST_CW_FINISHED_B: ret=ssl3_send_finished(s, SSL3_ST_CW_FINISHED_A,SSL3_ST_CW_FINISHED_B, s->method->ssl3_enc->client_finished_label, s->method->ssl3_enc->client_finished_label_len); if (ret <= 0) goto end; s->state=SSL3_ST_CW_FLUSH; /* clear flags */ s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER; if (s->hit) { s->s3->tmp.next_state=SSL_ST_OK; if (s->s3->flags & SSL3_FLAGS_DELAY_CLIENT_FINISHED) { s->state=SSL_ST_OK; s->s3->flags|=SSL3_FLAGS_POP_BUFFER; s->s3->delay_buf_pop_ret=0; } } else { #ifndef OPENSSL_NO_TLSEXT /* Allow NewSessionTicket if ticket expected */ if (s->tlsext_ticket_expected) s->s3->tmp.next_state=SSL3_ST_CR_SESSION_TICKET_A; else #endif s->s3->tmp.next_state=SSL3_ST_CR_FINISHED_A; } s->init_num=0; break; #ifndef OPENSSL_NO_TLSEXT case SSL3_ST_CR_SESSION_TICKET_A: case SSL3_ST_CR_SESSION_TICKET_B: ret=ssl3_get_new_session_ticket(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_FINISHED_A; s->init_num=0; break; case SSL3_ST_CR_CERT_STATUS_A: case SSL3_ST_CR_CERT_STATUS_B: ret=ssl3_get_cert_status(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_KEY_EXCH_A; s->init_num=0; break; #endif case SSL3_ST_CR_FINISHED_A: case SSL3_ST_CR_FINISHED_B: ret=ssl3_get_finished(s,SSL3_ST_CR_FINISHED_A, SSL3_ST_CR_FINISHED_B); if (ret <= 0) goto end; if (s->hit) s->state=SSL3_ST_CW_CHANGE_A; else s->state=SSL_ST_OK; s->init_num=0; break; case SSL3_ST_CW_FLUSH: s->rwstate=SSL_WRITING; if (BIO_flush(s->wbio) <= 0) { ret= -1; goto end; } s->rwstate=SSL_NOTHING; s->state=s->s3->tmp.next_state; break; case SSL_ST_OK: /* clean a few things up */ ssl3_cleanup_key_block(s); if (s->init_buf != NULL) { BUF_MEM_free(s->init_buf); s->init_buf=NULL; } /* If we are not 'joining' the last two packets, * remove the buffering now */ if (!(s->s3->flags & SSL3_FLAGS_POP_BUFFER)) ssl_free_wbio_buffer(s); /* else do it later in ssl3_write */ s->init_num=0; s->renegotiate=0; s->new_session=0; ssl_update_cache(s,SSL_SESS_CACHE_CLIENT); if (s->hit) s->ctx->stats.sess_hit++; ret=1; /* s->server=0; */ s->handshake_func=ssl3_connect; s->ctx->stats.sess_connect_good++; if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_DONE,1); goto end; /* break; */ default: SSLerr(SSL_F_SSL3_CONNECT,SSL_R_UNKNOWN_STATE); ret= -1; goto end; /* break; */ } /* did we do anything */ if (!s->s3->tmp.reuse_message && !skip) { if (s->debug) { if ((ret=BIO_flush(s->wbio)) <= 0) goto end; } if ((cb != NULL) && (s->state != state)) { new_state=s->state; s->state=state; cb(s,SSL_CB_CONNECT_LOOP,1); s->state=new_state; } } skip=0; }
C
openssl
1
CVE-2013-0310
https://www.cvedetails.com/cve/CVE-2013-0310/
CWE-119
https://github.com/torvalds/linux/commit/89d7ae34cdda4195809a5a987f697a517a2a3177
89d7ae34cdda4195809a5a987f697a517a2a3177
cipso: don't follow a NULL pointer when setsockopt() is called As reported by Alan Cox, and verified by Lin Ming, when a user attempts to add a CIPSO option to a socket using the CIPSO_V4_TAG_LOCAL tag the kernel dies a terrible death when it attempts to follow a NULL pointer (the skb argument to cipso_v4_validate() is NULL when called via the setsockopt() syscall). This patch fixes this by first checking to ensure that the skb is non-NULL before using it to find the incoming network interface. In the unlikely case where the skb is NULL and the user attempts to add a CIPSO option with the _TAG_LOCAL tag we return an error as this is not something we want to allow. A simple reproducer, kindly supplied by Lin Ming, although you must have the CIPSO DOI #3 configure on the system first or you will be caught early in cipso_v4_validate(): #include <sys/types.h> #include <sys/socket.h> #include <linux/ip.h> #include <linux/in.h> #include <string.h> struct local_tag { char type; char length; char info[4]; }; struct cipso { char type; char length; char doi[4]; struct local_tag local; }; int main(int argc, char **argv) { int sockfd; struct cipso cipso = { .type = IPOPT_CIPSO, .length = sizeof(struct cipso), .local = { .type = 128, .length = sizeof(struct local_tag), }, }; memset(cipso.doi, 0, 4); cipso.doi[3] = 3; sockfd = socket(AF_INET, SOCK_DGRAM, 0); #define SOL_IP 0 setsockopt(sockfd, SOL_IP, IP_OPTIONS, &cipso, sizeof(struct cipso)); return 0; } CC: Lin Ming <[email protected]> Reported-by: Alan Cox <[email protected]> Signed-off-by: Paul Moore <[email protected]> Signed-off-by: David S. Miller <[email protected]>
void cipso_v4_sock_delattr(struct sock *sk) { int hdr_delta; struct ip_options_rcu *opt; struct inet_sock *sk_inet; sk_inet = inet_sk(sk); opt = rcu_dereference_protected(sk_inet->inet_opt, 1); if (opt == NULL || opt->opt.cipso == 0) return; hdr_delta = cipso_v4_delopt(&sk_inet->inet_opt); if (sk_inet->is_icsk && hdr_delta > 0) { struct inet_connection_sock *sk_conn = inet_csk(sk); sk_conn->icsk_ext_hdr_len -= hdr_delta; sk_conn->icsk_sync_mss(sk, sk_conn->icsk_pmtu_cookie); } }
void cipso_v4_sock_delattr(struct sock *sk) { int hdr_delta; struct ip_options_rcu *opt; struct inet_sock *sk_inet; sk_inet = inet_sk(sk); opt = rcu_dereference_protected(sk_inet->inet_opt, 1); if (opt == NULL || opt->opt.cipso == 0) return; hdr_delta = cipso_v4_delopt(&sk_inet->inet_opt); if (sk_inet->is_icsk && hdr_delta > 0) { struct inet_connection_sock *sk_conn = inet_csk(sk); sk_conn->icsk_ext_hdr_len -= hdr_delta; sk_conn->icsk_sync_mss(sk, sk_conn->icsk_pmtu_cookie); } }
C
linux
0
CVE-2017-5019
https://www.cvedetails.com/cve/CVE-2017-5019/
CWE-416
https://github.com/chromium/chromium/commit/f03ea5a5c2ff26e239dfd23e263b15da2d9cee93
f03ea5a5c2ff26e239dfd23e263b15da2d9cee93
Convert FrameHostMsg_DidAddMessageToConsole to Mojo. Note: Since this required changing the test RenderViewImplTest.DispatchBeforeUnloadCanDetachFrame, I manually re-introduced https://crbug.com/666714 locally (the bug the test was added for), and reran the test to confirm that it still covers the bug. Bug: 786836 Change-Id: I110668fa6f0f261fd2ac36bb91a8d8b31c99f4f1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1526270 Commit-Queue: Lowell Manners <[email protected]> Reviewed-by: Daniel Cheng <[email protected]> Reviewed-by: Camille Lamy <[email protected]> Cr-Commit-Position: refs/heads/master@{#653137}
void ServiceWorkerContextCore::HasMainFrameProviderHost( const GURL& origin, BoolCallback callback) const { DCHECK_CURRENTLY_ON(BrowserThread::IO); ProviderHostIterator provider_host_iterator( providers_.get(), base::BindRepeating(IsSameOriginWindowProviderHost, origin)); if (provider_host_iterator.IsAtEnd()) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), false)); return; } std::unique_ptr<std::vector<std::pair<int, int>>> render_frames( new std::vector<std::pair<int, int>>()); while (!provider_host_iterator.IsAtEnd()) { ServiceWorkerProviderHost* provider_host = provider_host_iterator.GetProviderHost(); render_frames->push_back( std::make_pair(provider_host->process_id(), provider_host->frame_id())); provider_host_iterator.Advance(); } base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, {BrowserThread::UI}, base::BindOnce(&FrameListContainsMainFrameOnUI, std::move(render_frames)), std::move(callback)); }
void ServiceWorkerContextCore::HasMainFrameProviderHost( const GURL& origin, BoolCallback callback) const { DCHECK_CURRENTLY_ON(BrowserThread::IO); ProviderHostIterator provider_host_iterator( providers_.get(), base::BindRepeating(IsSameOriginWindowProviderHost, origin)); if (provider_host_iterator.IsAtEnd()) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), false)); return; } std::unique_ptr<std::vector<std::pair<int, int>>> render_frames( new std::vector<std::pair<int, int>>()); while (!provider_host_iterator.IsAtEnd()) { ServiceWorkerProviderHost* provider_host = provider_host_iterator.GetProviderHost(); render_frames->push_back( std::make_pair(provider_host->process_id(), provider_host->frame_id())); provider_host_iterator.Advance(); } base::PostTaskWithTraitsAndReplyWithResult( FROM_HERE, {BrowserThread::UI}, base::BindOnce(&FrameListContainsMainFrameOnUI, std::move(render_frames)), std::move(callback)); }
C
Chrome
0
CVE-2016-1632
https://www.cvedetails.com/cve/CVE-2016-1632/
CWE-264
https://github.com/chromium/chromium/commit/3f38b2253b19f9f9595f79fb92bfb5077e7b1959
3f38b2253b19f9f9595f79fb92bfb5077e7b1959
Remove UMA.CreatePersistentHistogram.Result This histogram isn't showing anything meaningful and the problems it could show are better observed by looking at the allocators directly. Bug: 831013 Change-Id: Ibe968597758230192e53a7675e7390e968c9e5b9 Reviewed-on: https://chromium-review.googlesource.com/1008047 Commit-Queue: Brian White <[email protected]> Reviewed-by: Alexei Svitkine <[email protected]> Cr-Commit-Position: refs/heads/master@{#549986}
void PersistentHistogramAllocator::RecordCreateHistogramResult(
void PersistentHistogramAllocator::RecordCreateHistogramResult( CreateHistogramResultType result) { HistogramBase* result_histogram = GetCreateHistogramResultHistogram(); if (result_histogram) result_histogram->Add(result); }
C
Chrome
1
CVE-2018-9336
https://www.cvedetails.com/cve/CVE-2018-9336/
CWE-415
https://github.com/OpenVPN/openvpn/commit/1394192b210cb3c6624a7419bcf3ff966742e79b
1394192b210cb3c6624a7419bcf3ff966742e79b
Fix potential double-free() in Interactive Service (CVE-2018-9336) Malformed input data on the service pipe towards the OpenVPN interactive service (normally used by the OpenVPN GUI to request openvpn instances from the service) can result in a double free() in the error handling code. This usually only leads to a process crash (DoS by an unprivileged local account) but since it could possibly lead to memory corruption if happening while multiple other threads are active at the same time, CVE-2018-9336 has been assigned to acknowledge this risk. Fix by ensuring that sud->directory is set to NULL in GetStartUpData() for all error cases (thus not being free()ed in FreeStartupData()). Rewrite control flow to use explicit error label for error exit. Discovered and reported by Jacob Baines <[email protected]>. CVE: 2018-9336 Signed-off-by: Gert Doering <[email protected]> Acked-by: Selva Nair <[email protected]> Message-Id: <[email protected]> URL: https://www.mail-archive.com/search?l=mid&[email protected] Signed-off-by: Gert Doering <[email protected]>
CreateClientPipeInstance(VOID) { TCHAR pipe_name[256]; /* The entire pipe name string can be up to 256 characters long according to MSDN. */ HANDLE pipe = NULL; PACL old_dacl, new_dacl; PSECURITY_DESCRIPTOR sd; static EXPLICIT_ACCESS ea[2]; static BOOL initialized = FALSE; DWORD flags = PIPE_ACCESS_DUPLEX | WRITE_DAC | FILE_FLAG_OVERLAPPED; if (!initialized) { PSID everyone, anonymous; ConvertStringSidToSid(TEXT("S-1-1-0"), &everyone); ConvertStringSidToSid(TEXT("S-1-5-7"), &anonymous); ea[0].grfAccessPermissions = FILE_GENERIC_WRITE; ea[0].grfAccessMode = GRANT_ACCESS; ea[0].grfInheritance = NO_INHERITANCE; ea[0].Trustee.pMultipleTrustee = NULL; ea[0].Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID; ea[0].Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; ea[0].Trustee.ptstrName = (LPTSTR) everyone; ea[1].grfAccessPermissions = 0; ea[1].grfAccessMode = REVOKE_ACCESS; ea[1].grfInheritance = NO_INHERITANCE; ea[1].Trustee.pMultipleTrustee = NULL; ea[1].Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; ea[1].Trustee.TrusteeForm = TRUSTEE_IS_SID; ea[1].Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; ea[1].Trustee.ptstrName = (LPTSTR) anonymous; flags |= FILE_FLAG_FIRST_PIPE_INSTANCE; initialized = TRUE; } openvpn_sntprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\" PACKAGE "%s\\service"), service_instance); pipe = CreateNamedPipe(pipe_name, flags, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, 1024, 1024, 0, NULL); if (pipe == INVALID_HANDLE_VALUE) { MsgToEventLog(M_SYSERR, TEXT("Could not create named pipe")); return INVALID_HANDLE_VALUE; } if (GetSecurityInfo(pipe, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, &old_dacl, NULL, &sd) != ERROR_SUCCESS) { MsgToEventLog(M_SYSERR, TEXT("Could not get pipe security info")); return CloseHandleEx(&pipe); } if (SetEntriesInAcl(2, ea, old_dacl, &new_dacl) != ERROR_SUCCESS) { MsgToEventLog(M_SYSERR, TEXT("Could not set entries in new acl")); return CloseHandleEx(&pipe); } if (SetSecurityInfo(pipe, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, new_dacl, NULL) != ERROR_SUCCESS) { MsgToEventLog(M_SYSERR, TEXT("Could not set pipe security info")); return CloseHandleEx(&pipe); } return pipe; }
CreateClientPipeInstance(VOID) { TCHAR pipe_name[256]; /* The entire pipe name string can be up to 256 characters long according to MSDN. */ HANDLE pipe = NULL; PACL old_dacl, new_dacl; PSECURITY_DESCRIPTOR sd; static EXPLICIT_ACCESS ea[2]; static BOOL initialized = FALSE; DWORD flags = PIPE_ACCESS_DUPLEX | WRITE_DAC | FILE_FLAG_OVERLAPPED; if (!initialized) { PSID everyone, anonymous; ConvertStringSidToSid(TEXT("S-1-1-0"), &everyone); ConvertStringSidToSid(TEXT("S-1-5-7"), &anonymous); ea[0].grfAccessPermissions = FILE_GENERIC_WRITE; ea[0].grfAccessMode = GRANT_ACCESS; ea[0].grfInheritance = NO_INHERITANCE; ea[0].Trustee.pMultipleTrustee = NULL; ea[0].Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID; ea[0].Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; ea[0].Trustee.ptstrName = (LPTSTR) everyone; ea[1].grfAccessPermissions = 0; ea[1].grfAccessMode = REVOKE_ACCESS; ea[1].grfInheritance = NO_INHERITANCE; ea[1].Trustee.pMultipleTrustee = NULL; ea[1].Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; ea[1].Trustee.TrusteeForm = TRUSTEE_IS_SID; ea[1].Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; ea[1].Trustee.ptstrName = (LPTSTR) anonymous; flags |= FILE_FLAG_FIRST_PIPE_INSTANCE; initialized = TRUE; } openvpn_sntprintf(pipe_name, _countof(pipe_name), TEXT("\\\\.\\pipe\\" PACKAGE "%s\\service"), service_instance); pipe = CreateNamedPipe(pipe_name, flags, PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE, PIPE_UNLIMITED_INSTANCES, 1024, 1024, 0, NULL); if (pipe == INVALID_HANDLE_VALUE) { MsgToEventLog(M_SYSERR, TEXT("Could not create named pipe")); return INVALID_HANDLE_VALUE; } if (GetSecurityInfo(pipe, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, &old_dacl, NULL, &sd) != ERROR_SUCCESS) { MsgToEventLog(M_SYSERR, TEXT("Could not get pipe security info")); return CloseHandleEx(&pipe); } if (SetEntriesInAcl(2, ea, old_dacl, &new_dacl) != ERROR_SUCCESS) { MsgToEventLog(M_SYSERR, TEXT("Could not set entries in new acl")); return CloseHandleEx(&pipe); } if (SetSecurityInfo(pipe, SE_KERNEL_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, new_dacl, NULL) != ERROR_SUCCESS) { MsgToEventLog(M_SYSERR, TEXT("Could not set pipe security info")); return CloseHandleEx(&pipe); } return pipe; }
C
openvpn
0
CVE-2011-3084
https://www.cvedetails.com/cve/CVE-2011-3084/
CWE-264
https://github.com/chromium/chromium/commit/744c2a2d90c3c9a33c818e1ea4b7ccb5010663a0
744c2a2d90c3c9a33c818e1ea4b7ccb5010663a0
Allow browser to handle all WebUI navigations. BUG=113496 TEST="Google Dashboard" link in Sync settings loads in new process. Review URL: http://codereview.chromium.org/9663045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@126949 0039d316-1c4b-4281-b951-d872f2087c98
void ExtensionDevToolsClientHost::DispatchOnInspectorFrontend( const std::string& message) { Profile* profile = Profile::FromBrowserContext(web_contents_->GetBrowserContext()); if (profile == NULL || !profile->GetExtensionEventRouter()) return; scoped_ptr<Value> result(base::JSONReader::Read(message, false)); if (!result->IsType(Value::TYPE_DICTIONARY)) return; DictionaryValue* dictionary = static_cast<DictionaryValue*>(result.get()); int id; if (!dictionary->GetInteger("id", &id)) { std::string method_name; if (!dictionary->GetString("method", &method_name)) return; ListValue args; args.Append(CreateDebuggeeId(tab_id_)); args.Append(Value::CreateStringValue(method_name)); Value* params_value; if (dictionary->Get("params", &params_value)) args.Append(params_value->DeepCopy()); std::string json_args; base::JSONWriter::Write(&args, false, &json_args); profile->GetExtensionEventRouter()->DispatchEventToExtension( extension_id_, keys::kOnEvent, json_args, profile, GURL()); } else { SendCommandDebuggerFunction* function = pending_requests_[id]; if (!function) return; function->SendResponseBody(dictionary); pending_requests_.erase(id); } }
void ExtensionDevToolsClientHost::DispatchOnInspectorFrontend( const std::string& message) { Profile* profile = Profile::FromBrowserContext(web_contents_->GetBrowserContext()); if (profile == NULL || !profile->GetExtensionEventRouter()) return; scoped_ptr<Value> result(base::JSONReader::Read(message, false)); if (!result->IsType(Value::TYPE_DICTIONARY)) return; DictionaryValue* dictionary = static_cast<DictionaryValue*>(result.get()); int id; if (!dictionary->GetInteger("id", &id)) { std::string method_name; if (!dictionary->GetString("method", &method_name)) return; ListValue args; args.Append(CreateDebuggeeId(tab_id_)); args.Append(Value::CreateStringValue(method_name)); Value* params_value; if (dictionary->Get("params", &params_value)) args.Append(params_value->DeepCopy()); std::string json_args; base::JSONWriter::Write(&args, false, &json_args); profile->GetExtensionEventRouter()->DispatchEventToExtension( extension_id_, keys::kOnEvent, json_args, profile, GURL()); } else { SendCommandDebuggerFunction* function = pending_requests_[id]; if (!function) return; function->SendResponseBody(dictionary); pending_requests_.erase(id); } }
C
Chrome
0
CVE-2017-9059
https://www.cvedetails.com/cve/CVE-2017-9059/
CWE-404
https://github.com/torvalds/linux/commit/c70422f760c120480fee4de6c38804c72aa26bc1
c70422f760c120480fee4de6c38804c72aa26bc1
Merge tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux Pull nfsd updates from Bruce Fields: "Another RDMA update from Chuck Lever, and a bunch of miscellaneous bugfixes" * tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux: (26 commits) nfsd: Fix up the "supattr_exclcreat" attributes nfsd: encoders mustn't use unitialized values in error cases nfsd: fix undefined behavior in nfsd4_layout_verify lockd: fix lockd shutdown race NFSv4: Fix callback server shutdown SUNRPC: Refactor svc_set_num_threads() NFSv4.x/callback: Create the callback service through svc_create_pooled lockd: remove redundant check on block svcrdma: Clean out old XDR encoders svcrdma: Remove the req_map cache svcrdma: Remove unused RDMA Write completion handler svcrdma: Reduce size of sge array in struct svc_rdma_op_ctxt svcrdma: Clean up RPC-over-RDMA backchannel reply processing svcrdma: Report Write/Reply chunk overruns svcrdma: Clean up RDMA_ERROR path svcrdma: Use rdma_rw API in RPC reply path svcrdma: Introduce local rdma_rw API helpers svcrdma: Clean up svc_rdma_get_inv_rkey() svcrdma: Add helper to save pages under I/O svcrdma: Eliminate RPCRDMA_SQ_DEPTH_MULT ...
static void rdma_build_arg_xdr(struct svc_rqst *rqstp, struct svc_rdma_op_ctxt *ctxt, u32 byte_count) { struct rpcrdma_msg *rmsgp; struct page *page; u32 bc; int sge_no; /* Swap the page in the SGE with the page in argpages */ page = ctxt->pages[0]; put_page(rqstp->rq_pages[0]); rqstp->rq_pages[0] = page; /* Set up the XDR head */ rqstp->rq_arg.head[0].iov_base = page_address(page); rqstp->rq_arg.head[0].iov_len = min_t(size_t, byte_count, ctxt->sge[0].length); rqstp->rq_arg.len = byte_count; rqstp->rq_arg.buflen = byte_count; /* Compute bytes past head in the SGL */ bc = byte_count - rqstp->rq_arg.head[0].iov_len; /* If data remains, store it in the pagelist */ rqstp->rq_arg.page_len = bc; rqstp->rq_arg.page_base = 0; /* RDMA_NOMSG: RDMA READ data should land just after RDMA RECV data */ rmsgp = (struct rpcrdma_msg *)rqstp->rq_arg.head[0].iov_base; if (rmsgp->rm_type == rdma_nomsg) rqstp->rq_arg.pages = &rqstp->rq_pages[0]; else rqstp->rq_arg.pages = &rqstp->rq_pages[1]; sge_no = 1; while (bc && sge_no < ctxt->count) { page = ctxt->pages[sge_no]; put_page(rqstp->rq_pages[sge_no]); rqstp->rq_pages[sge_no] = page; bc -= min_t(u32, bc, ctxt->sge[sge_no].length); rqstp->rq_arg.buflen += ctxt->sge[sge_no].length; sge_no++; } rqstp->rq_respages = &rqstp->rq_pages[sge_no]; rqstp->rq_next_page = rqstp->rq_respages + 1; /* If not all pages were used from the SGL, free the remaining ones */ bc = sge_no; while (sge_no < ctxt->count) { page = ctxt->pages[sge_no++]; put_page(page); } ctxt->count = bc; /* Set up tail */ rqstp->rq_arg.tail[0].iov_base = NULL; rqstp->rq_arg.tail[0].iov_len = 0; }
static void rdma_build_arg_xdr(struct svc_rqst *rqstp, struct svc_rdma_op_ctxt *ctxt, u32 byte_count) { struct rpcrdma_msg *rmsgp; struct page *page; u32 bc; int sge_no; /* Swap the page in the SGE with the page in argpages */ page = ctxt->pages[0]; put_page(rqstp->rq_pages[0]); rqstp->rq_pages[0] = page; /* Set up the XDR head */ rqstp->rq_arg.head[0].iov_base = page_address(page); rqstp->rq_arg.head[0].iov_len = min_t(size_t, byte_count, ctxt->sge[0].length); rqstp->rq_arg.len = byte_count; rqstp->rq_arg.buflen = byte_count; /* Compute bytes past head in the SGL */ bc = byte_count - rqstp->rq_arg.head[0].iov_len; /* If data remains, store it in the pagelist */ rqstp->rq_arg.page_len = bc; rqstp->rq_arg.page_base = 0; /* RDMA_NOMSG: RDMA READ data should land just after RDMA RECV data */ rmsgp = (struct rpcrdma_msg *)rqstp->rq_arg.head[0].iov_base; if (rmsgp->rm_type == rdma_nomsg) rqstp->rq_arg.pages = &rqstp->rq_pages[0]; else rqstp->rq_arg.pages = &rqstp->rq_pages[1]; sge_no = 1; while (bc && sge_no < ctxt->count) { page = ctxt->pages[sge_no]; put_page(rqstp->rq_pages[sge_no]); rqstp->rq_pages[sge_no] = page; bc -= min_t(u32, bc, ctxt->sge[sge_no].length); rqstp->rq_arg.buflen += ctxt->sge[sge_no].length; sge_no++; } rqstp->rq_respages = &rqstp->rq_pages[sge_no]; rqstp->rq_next_page = rqstp->rq_respages + 1; /* If not all pages were used from the SGL, free the remaining ones */ bc = sge_no; while (sge_no < ctxt->count) { page = ctxt->pages[sge_no++]; put_page(page); } ctxt->count = bc; /* Set up tail */ rqstp->rq_arg.tail[0].iov_base = NULL; rqstp->rq_arg.tail[0].iov_len = 0; }
C
linux
0
CVE-2011-3097
https://www.cvedetails.com/cve/CVE-2011-3097/
CWE-20
https://github.com/chromium/chromium/commit/027429ee5abe6e2fb5e3b2b4542f0a6fe0dbc12d
027429ee5abe6e2fb5e3b2b4542f0a6fe0dbc12d
Metrics for measuring how much overhead reading compressed content states adds. BUG=104293 TEST=NONE Review URL: https://chromiumcodereview.appspot.com/9426039 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123733 0039d316-1c4b-4281-b951-d872f2087c98
void SessionService::AddTabsToWindows(std::map<int, SessionTab*>* tabs, std::map<int, SessionWindow*>* windows) { std::map<int, SessionTab*>::iterator i = tabs->begin(); while (i != tabs->end()) { SessionTab* tab = i->second; if (tab->window_id.id() && !tab->navigations.empty()) { SessionWindow* window = GetWindow(tab->window_id.id(), windows); window->tabs.push_back(tab); tabs->erase(i++); std::vector<TabNavigation>::iterator j = FindClosestNavigationWithIndex(&(tab->navigations), tab->current_navigation_index); if (j == tab->navigations.end()) { tab->current_navigation_index = static_cast<int>(tab->navigations.size() - 1); } else { tab->current_navigation_index = static_cast<int>(j - tab->navigations.begin()); } } else { ++i; } } }
void SessionService::AddTabsToWindows(std::map<int, SessionTab*>* tabs, std::map<int, SessionWindow*>* windows) { std::map<int, SessionTab*>::iterator i = tabs->begin(); while (i != tabs->end()) { SessionTab* tab = i->second; if (tab->window_id.id() && !tab->navigations.empty()) { SessionWindow* window = GetWindow(tab->window_id.id(), windows); window->tabs.push_back(tab); tabs->erase(i++); std::vector<TabNavigation>::iterator j = FindClosestNavigationWithIndex(&(tab->navigations), tab->current_navigation_index); if (j == tab->navigations.end()) { tab->current_navigation_index = static_cast<int>(tab->navigations.size() - 1); } else { tab->current_navigation_index = static_cast<int>(j - tab->navigations.begin()); } } else { ++i; } } }
C
Chrome
0
CVE-2014-3690
https://www.cvedetails.com/cve/CVE-2014-3690/
CWE-399
https://github.com/torvalds/linux/commit/d974baa398f34393db76be45f7d4d04fbdbb4a0a
d974baa398f34393db76be45f7d4d04fbdbb4a0a
x86,kvm,vmx: Preserve CR4 across VM entry CR4 isn't constant; at least the TSD and PCE bits can vary. TBH, treating CR0 and CR3 as constant scares me a bit, too, but it looks like it's correct. This adds a branch and a read from cr4 to each vm entry. Because it is extremely likely that consecutive entries into the same vcpu will have the same host cr4 value, this fixes up the vmcs instead of restoring cr4 after the fact. A subsequent patch will add a kernel-wide cr4 shadow, reducing the overhead in the common case to just two memory reads and a branch. Signed-off-by: Andy Lutomirski <[email protected]> Acked-by: Paolo Bonzini <[email protected]> Cc: [email protected] Cc: Petr Matousek <[email protected]> Cc: Gleb Natapov <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static inline bool cpu_has_vmx_virtualize_x2apic_mode(void) { return vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE; }
static inline bool cpu_has_vmx_virtualize_x2apic_mode(void) { return vmcs_config.cpu_based_2nd_exec_ctrl & SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE; }
C
linux
0
CVE-2011-2486
https://www.cvedetails.com/cve/CVE-2011-2486/
CWE-264
https://github.com/davidben/nspluginwrapper/commit/7e4ab8e1189846041f955e6c83f72bc1624e7a98
7e4ab8e1189846041f955e6c83f72bc1624e7a98
Support all the new variables added
invoke_NPN_GetProperty(PluginInstance *plugin, NPObject *npobj, NPIdentifier propertyName, NPVariant *result) { npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), false); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_GET_PROPERTY, RPC_TYPE_NPW_PLUGIN_INSTANCE, plugin, RPC_TYPE_NP_OBJECT, npobj, RPC_TYPE_NP_IDENTIFIER, &propertyName, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_GetProperty() invoke", error); return false; } uint32_t ret; error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_UINT32, &ret, RPC_TYPE_NP_VARIANT, result, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_GetProperty() wait for reply", error); return false; } return ret; }
invoke_NPN_GetProperty(PluginInstance *plugin, NPObject *npobj, NPIdentifier propertyName, NPVariant *result) { npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), false); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_GET_PROPERTY, RPC_TYPE_NPW_PLUGIN_INSTANCE, plugin, RPC_TYPE_NP_OBJECT, npobj, RPC_TYPE_NP_IDENTIFIER, &propertyName, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_GetProperty() invoke", error); return false; } uint32_t ret; error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_UINT32, &ret, RPC_TYPE_NP_VARIANT, result, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPN_GetProperty() wait for reply", error); return false; } return ret; }
C
nspluginwrapper
0
CVE-2013-1929
https://www.cvedetails.com/cve/CVE-2013-1929/
CWE-119
https://github.com/torvalds/linux/commit/715230a44310a8cf66fbfb5a46f9a62a9b2de424
715230a44310a8cf66fbfb5a46f9a62a9b2de424
tg3: fix length overflow in VPD firmware parsing Commit 184b89044fb6e2a74611dafa69b1dce0d98612c6 ("tg3: Use VPD fw version when present") introduced VPD parsing that contained a potential length overflow. Limit the hardware's reported firmware string length (max 255 bytes) to stay inside the driver's firmware string length (32 bytes). On overflow, truncate the formatted firmware string instead of potentially overwriting portions of the tg3 struct. http://cansecwest.com/slides/2013/PrivateCore%20CSW%202013.pdf Signed-off-by: Kees Cook <[email protected]> Reported-by: Oded Horovitz <[email protected]> Reported-by: Brad Spengler <[email protected]> Cc: [email protected] Cc: Matt Carlson <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int tg3_mem_tx_acquire(struct tg3 *tp) { int i; struct tg3_napi *tnapi = &tp->napi[0]; /* If multivector TSS is enabled, vector 0 does not handle * tx interrupts. Don't allocate any resources for it. */ if (tg3_flag(tp, ENABLE_TSS)) tnapi++; for (i = 0; i < tp->txq_cnt; i++, tnapi++) { tnapi->tx_buffers = kzalloc(sizeof(struct tg3_tx_ring_info) * TG3_TX_RING_SIZE, GFP_KERNEL); if (!tnapi->tx_buffers) goto err_out; tnapi->tx_ring = dma_alloc_coherent(&tp->pdev->dev, TG3_TX_RING_BYTES, &tnapi->tx_desc_mapping, GFP_KERNEL); if (!tnapi->tx_ring) goto err_out; } return 0; err_out: tg3_mem_tx_release(tp); return -ENOMEM; }
static int tg3_mem_tx_acquire(struct tg3 *tp) { int i; struct tg3_napi *tnapi = &tp->napi[0]; /* If multivector TSS is enabled, vector 0 does not handle * tx interrupts. Don't allocate any resources for it. */ if (tg3_flag(tp, ENABLE_TSS)) tnapi++; for (i = 0; i < tp->txq_cnt; i++, tnapi++) { tnapi->tx_buffers = kzalloc(sizeof(struct tg3_tx_ring_info) * TG3_TX_RING_SIZE, GFP_KERNEL); if (!tnapi->tx_buffers) goto err_out; tnapi->tx_ring = dma_alloc_coherent(&tp->pdev->dev, TG3_TX_RING_BYTES, &tnapi->tx_desc_mapping, GFP_KERNEL); if (!tnapi->tx_ring) goto err_out; } return 0; err_out: tg3_mem_tx_release(tp); return -ENOMEM; }
C
linux
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]>
xfs_inode_ag_iterator_tag( struct xfs_mount *mp, int (*execute)(struct xfs_inode *ip, int flags, void *args), int flags, void *args, int tag) { struct xfs_perag *pag; int error = 0; int last_error = 0; xfs_agnumber_t ag; ag = 0; while ((pag = xfs_perag_get_tag(mp, ag, tag))) { ag = pag->pag_agno + 1; error = xfs_inode_ag_walk(mp, pag, execute, flags, args, tag, 0); xfs_perag_put(pag); if (error) { last_error = error; if (error == -EFSCORRUPTED) break; } } return last_error; }
xfs_inode_ag_iterator_tag( struct xfs_mount *mp, int (*execute)(struct xfs_inode *ip, int flags, void *args), int flags, void *args, int tag) { struct xfs_perag *pag; int error = 0; int last_error = 0; xfs_agnumber_t ag; ag = 0; while ((pag = xfs_perag_get_tag(mp, ag, tag))) { ag = pag->pag_agno + 1; error = xfs_inode_ag_walk(mp, pag, execute, flags, args, tag, 0); xfs_perag_put(pag); if (error) { last_error = error; if (error == -EFSCORRUPTED) break; } } return last_error; }
C
linux
0
CVE-2017-5008
https://www.cvedetails.com/cve/CVE-2017-5008/
CWE-79
https://github.com/chromium/chromium/commit/c093b7a74ddce32dd3b0e0be60f31becc6ce32f9
c093b7a74ddce32dd3b0e0be60f31becc6ce32f9
Don't touch the prototype chain to get the private script controller. Prior to this patch, private scripts attempted to get the "privateScriptController" property off the global object without verifying if the property actually exists on the global. If the property hasn't been set yet, this operation could descend into the prototype chain and potentially return a named property from the WindowProperties object, leading to release asserts and general confusion. BUG=668552 Review-Url: https://codereview.chromium.org/2529163002 Cr-Commit-Position: refs/heads/master@{#434627}
v8::Local<v8::Value> PrivateScriptRunner::runDOMAttributeGetter( ScriptState* scriptState, ScriptState* scriptStateInUserScript, const char* className, const char* attributeName, v8::Local<v8::Value> holder) { v8::Isolate* isolate = scriptState->isolate(); v8::Local<v8::Object> classObject = classObjectOfPrivateScript(scriptState, className); v8::Local<v8::Value> descriptor; if (!classObject ->GetOwnPropertyDescriptor(scriptState->context(), v8String(isolate, attributeName)) .ToLocal(&descriptor) || !descriptor->IsObject()) { LOG(FATAL) << "Private script error: Target DOM attribute getter was not found. " "(Class name = " << className << ", Attribute name = " << attributeName << ")"; } v8::Local<v8::Value> getter; if (!v8::Local<v8::Object>::Cast(descriptor) ->Get(scriptState->context(), v8String(isolate, "get")) .ToLocal(&getter) || !getter->IsFunction()) { LOG(FATAL) << "Private script error: Target DOM attribute getter was not found. " "(Class name = " << className << ", Attribute name = " << attributeName << ")"; } initializeHolderIfNeeded(scriptState, classObject, holder); v8::TryCatch block(isolate); v8::Local<v8::Value> result; if (!V8ScriptRunner::callInternalFunction( v8::Local<v8::Function>::Cast(getter), holder, 0, 0, isolate) .ToLocal(&result)) { rethrowExceptionInPrivateScript(isolate, block, scriptStateInUserScript, ExceptionState::GetterContext, attributeName, className); block.ReThrow(); return v8::Local<v8::Value>(); } return result; }
v8::Local<v8::Value> PrivateScriptRunner::runDOMAttributeGetter( ScriptState* scriptState, ScriptState* scriptStateInUserScript, const char* className, const char* attributeName, v8::Local<v8::Value> holder) { v8::Isolate* isolate = scriptState->isolate(); v8::Local<v8::Object> classObject = classObjectOfPrivateScript(scriptState, className); v8::Local<v8::Value> descriptor; if (!classObject ->GetOwnPropertyDescriptor(scriptState->context(), v8String(isolate, attributeName)) .ToLocal(&descriptor) || !descriptor->IsObject()) { LOG(FATAL) << "Private script error: Target DOM attribute getter was not found. " "(Class name = " << className << ", Attribute name = " << attributeName << ")"; } v8::Local<v8::Value> getter; if (!v8::Local<v8::Object>::Cast(descriptor) ->Get(scriptState->context(), v8String(isolate, "get")) .ToLocal(&getter) || !getter->IsFunction()) { LOG(FATAL) << "Private script error: Target DOM attribute getter was not found. " "(Class name = " << className << ", Attribute name = " << attributeName << ")"; } initializeHolderIfNeeded(scriptState, classObject, holder); v8::TryCatch block(isolate); v8::Local<v8::Value> result; if (!V8ScriptRunner::callInternalFunction( v8::Local<v8::Function>::Cast(getter), holder, 0, 0, isolate) .ToLocal(&result)) { rethrowExceptionInPrivateScript(isolate, block, scriptStateInUserScript, ExceptionState::GetterContext, attributeName, className); block.ReThrow(); return v8::Local<v8::Value>(); } return result; }
C
Chrome
0
CVE-2017-6903
https://www.cvedetails.com/cve/CVE-2017-6903/
CWE-269
https://github.com/iortcw/iortcw/commit/b6ff2bcb1e4e6976d61e316175c6d7c99860fe20
b6ff2bcb1e4e6976d61e316175c6d7c99860fe20
All: Don't load .pk3s as .dlls, and don't load user config files from .pk3s
void FS_SV_Rename( const char *from, const char *to, qboolean safe ) { char *from_ospath, *to_ospath; if ( !fs_searchpaths ) { Com_Error( ERR_FATAL, "Filesystem call made without initialization" ); } from_ospath = FS_BuildOSPath( fs_homepath->string, from, "" ); to_ospath = FS_BuildOSPath( fs_homepath->string, to, "" ); from_ospath[strlen( from_ospath ) - 1] = '\0'; to_ospath[strlen( to_ospath ) - 1] = '\0'; if ( fs_debug->integer ) { Com_Printf( "FS_SV_Rename: %s --> %s\n", from_ospath, to_ospath ); } if ( safe ) { FS_CheckFilenameIsMutable( to_ospath, __func__ ); } if ( rename( from_ospath, to_ospath ) ) { FS_CopyFile( from_ospath, to_ospath ); FS_Remove( from_ospath ); } }
void FS_SV_Rename( const char *from, const char *to, qboolean safe ) { char *from_ospath, *to_ospath; if ( !fs_searchpaths ) { Com_Error( ERR_FATAL, "Filesystem call made without initialization" ); } from_ospath = FS_BuildOSPath( fs_homepath->string, from, "" ); to_ospath = FS_BuildOSPath( fs_homepath->string, to, "" ); from_ospath[strlen( from_ospath ) - 1] = '\0'; to_ospath[strlen( to_ospath ) - 1] = '\0'; if ( fs_debug->integer ) { Com_Printf( "FS_SV_Rename: %s --> %s\n", from_ospath, to_ospath ); } if ( safe ) { FS_CheckFilenameIsMutable( to_ospath, __func__ ); } if ( rename( from_ospath, to_ospath ) ) { FS_CopyFile( from_ospath, to_ospath ); FS_Remove( from_ospath ); } }
C
OpenJK
0
null
null
null
https://github.com/chromium/chromium/commit/e93dc535728da259ec16d1c3cc393f80b25f64ae
e93dc535728da259ec16d1c3cc393f80b25f64ae
Add a unit test that filenames aren't unintentionally converted to URLs. Also fixes two issues in OSExchangeDataProviderWin: - It used a disjoint set of clipboard formats when handling GetUrl(..., true /* filename conversion */) vs GetFilenames(...), so the actual returned results would vary depending on which one was called. - It incorrectly used ::DragFinish() instead of ::ReleaseStgMedium(). ::DragFinish() is only meant to be used in conjunction with WM_DROPFILES. BUG=346135 Review URL: https://codereview.chromium.org/380553002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@283226 0039d316-1c4b-4281-b951-d872f2087c98
bool OSExchangeDataProviderWin::GetPickledData( const OSExchangeData::CustomFormat& format, Pickle* data) const { DCHECK(data); bool success = false; STGMEDIUM medium; FORMATETC format_etc = format.ToFormatEtc(); if (SUCCEEDED(source_object_->GetData(&format_etc, &medium))) { if (medium.tymed & TYMED_HGLOBAL) { base::win::ScopedHGlobal<char*> c_data(medium.hGlobal); DCHECK_GT(c_data.Size(), 0u); *data = Pickle(c_data.get(), static_cast<int>(c_data.Size())); success = true; } ReleaseStgMedium(&medium); } return success; }
bool OSExchangeDataProviderWin::GetPickledData( const OSExchangeData::CustomFormat& format, Pickle* data) const { DCHECK(data); bool success = false; STGMEDIUM medium; FORMATETC format_etc = format.ToFormatEtc(); if (SUCCEEDED(source_object_->GetData(&format_etc, &medium))) { if (medium.tymed & TYMED_HGLOBAL) { base::win::ScopedHGlobal<char> c_data(medium.hGlobal); DCHECK_GT(c_data.Size(), 0u); *data = Pickle(c_data.get(), static_cast<int>(c_data.Size())); success = true; } ReleaseStgMedium(&medium); } return success; }
C
Chrome
1
CVE-2015-8543
https://www.cvedetails.com/cve/CVE-2015-8543/
null
https://github.com/torvalds/linux/commit/79462ad02e861803b3840cc782248c7359451cd9
79462ad02e861803b3840cc782248c7359451cd9
net: add validation for the socket syscall protocol argument 郭永刚 reported that one could simply crash the kernel as root by using a simple program: int socket_fd; struct sockaddr_in addr; addr.sin_port = 0; addr.sin_addr.s_addr = INADDR_ANY; addr.sin_family = 10; socket_fd = socket(10,3,0x40000000); connect(socket_fd , &addr,16); AF_INET, AF_INET6 sockets actually only support 8-bit protocol identifiers. inet_sock's skc_protocol field thus is sized accordingly, thus larger protocol identifiers simply cut off the higher bits and store a zero in the protocol fields. This could lead to e.g. NULL function pointer because as a result of the cut off inet_num is zero and we call down to inet_autobind, which is NULL for raw sockets. kernel: Call Trace: kernel: [<ffffffff816db90e>] ? inet_autobind+0x2e/0x70 kernel: [<ffffffff816db9a4>] inet_dgram_connect+0x54/0x80 kernel: [<ffffffff81645069>] SYSC_connect+0xd9/0x110 kernel: [<ffffffff810ac51b>] ? ptrace_notify+0x5b/0x80 kernel: [<ffffffff810236d8>] ? syscall_trace_enter_phase2+0x108/0x200 kernel: [<ffffffff81645e0e>] SyS_connect+0xe/0x10 kernel: [<ffffffff81779515>] tracesys_phase2+0x84/0x89 I found no particular commit which introduced this problem. CVE: CVE-2015-8543 Cc: Cong Wang <[email protected]> Reported-by: 郭永刚 <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
int inet6_sk_rebuild_header(struct sock *sk) { struct ipv6_pinfo *np = inet6_sk(sk); struct dst_entry *dst; dst = __sk_dst_check(sk, np->dst_cookie); if (!dst) { struct inet_sock *inet = inet_sk(sk); struct in6_addr *final_p, final; struct flowi6 fl6; memset(&fl6, 0, sizeof(fl6)); fl6.flowi6_proto = sk->sk_protocol; fl6.daddr = sk->sk_v6_daddr; fl6.saddr = np->saddr; fl6.flowlabel = np->flow_label; fl6.flowi6_oif = sk->sk_bound_dev_if; fl6.flowi6_mark = sk->sk_mark; fl6.fl6_dport = inet->inet_dport; fl6.fl6_sport = inet->inet_sport; security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); rcu_read_lock(); final_p = fl6_update_dst(&fl6, rcu_dereference(np->opt), &final); rcu_read_unlock(); dst = ip6_dst_lookup_flow(sk, &fl6, final_p); if (IS_ERR(dst)) { sk->sk_route_caps = 0; sk->sk_err_soft = -PTR_ERR(dst); return PTR_ERR(dst); } ip6_dst_store(sk, dst, NULL, NULL); } return 0; }
int inet6_sk_rebuild_header(struct sock *sk) { struct ipv6_pinfo *np = inet6_sk(sk); struct dst_entry *dst; dst = __sk_dst_check(sk, np->dst_cookie); if (!dst) { struct inet_sock *inet = inet_sk(sk); struct in6_addr *final_p, final; struct flowi6 fl6; memset(&fl6, 0, sizeof(fl6)); fl6.flowi6_proto = sk->sk_protocol; fl6.daddr = sk->sk_v6_daddr; fl6.saddr = np->saddr; fl6.flowlabel = np->flow_label; fl6.flowi6_oif = sk->sk_bound_dev_if; fl6.flowi6_mark = sk->sk_mark; fl6.fl6_dport = inet->inet_dport; fl6.fl6_sport = inet->inet_sport; security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); rcu_read_lock(); final_p = fl6_update_dst(&fl6, rcu_dereference(np->opt), &final); rcu_read_unlock(); dst = ip6_dst_lookup_flow(sk, &fl6, final_p); if (IS_ERR(dst)) { sk->sk_route_caps = 0; sk->sk_err_soft = -PTR_ERR(dst); return PTR_ERR(dst); } ip6_dst_store(sk, dst, NULL, NULL); } return 0; }
C
linux
0
CVE-2013-4247
https://www.cvedetails.com/cve/CVE-2013-4247/
CWE-189
https://github.com/torvalds/linux/commit/1fc29bacedeabb278080e31bb9c1ecb49f143c3b
1fc29bacedeabb278080e31bb9c1ecb49f143c3b
cifs: fix off-by-one bug in build_unc_path_to_root commit 839db3d10a (cifs: fix up handling of prefixpath= option) changed the code such that the vol->prepath no longer contained a leading delimiter and then fixed up the places that accessed that field to account for that change. One spot in build_unc_path_to_root was missed however. When doing the pointer addition on pos, that patch failed to account for the fact that we had already incremented "pos" by one when adding the length of the prepath. This caused a buffer overrun by one byte. This patch fixes the problem by correcting the handling of "pos". Cc: <[email protected]> # v3.8+ Reported-by: Marcus Moeller <[email protected]> Reported-by: Ken Fallon <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
handle_mid(struct mid_q_entry *mid, struct TCP_Server_Info *server, char *buf, int malformed) { if (server->ops->check_trans2 && server->ops->check_trans2(mid, server, buf, malformed)) return; mid->resp_buf = buf; mid->large_buf = server->large_buf; /* Was previous buf put in mpx struct for multi-rsp? */ if (!mid->multiRsp) { /* smb buffer will be freed by user thread */ if (server->large_buf) server->bigbuf = NULL; else server->smallbuf = NULL; } dequeue_mid(mid, malformed); }
handle_mid(struct mid_q_entry *mid, struct TCP_Server_Info *server, char *buf, int malformed) { if (server->ops->check_trans2 && server->ops->check_trans2(mid, server, buf, malformed)) return; mid->resp_buf = buf; mid->large_buf = server->large_buf; /* Was previous buf put in mpx struct for multi-rsp? */ if (!mid->multiRsp) { /* smb buffer will be freed by user thread */ if (server->large_buf) server->bigbuf = NULL; else server->smallbuf = NULL; } dequeue_mid(mid, malformed); }
C
linux
0
CVE-2018-16435
https://www.cvedetails.com/cve/CVE-2018-16435/
CWE-190
https://github.com/mm2/Little-CMS/commit/768f70ca405cd3159d990e962d54456773bb8cf8
768f70ca405cd3159d990e962d54456773bb8cf8
Upgrade Visual studio 2017 15.8 - Upgrade to 15.8 - Add check on CGATS memory allocation (thanks to Quang Nguyen for pointing out this)
cmsFloat64Number CMSEXPORT cmsIT8GetDataDbl(cmsHANDLE it8, const char* cPatch, const char* cSample) { const char* Buffer; Buffer = cmsIT8GetData(it8, cPatch, cSample); return ParseFloatNumber(Buffer); }
cmsFloat64Number CMSEXPORT cmsIT8GetDataDbl(cmsHANDLE it8, const char* cPatch, const char* cSample) { const char* Buffer; Buffer = cmsIT8GetData(it8, cPatch, cSample); return ParseFloatNumber(Buffer); }
C
Little-CMS
0
CVE-2019-7308
https://www.cvedetails.com/cve/CVE-2019-7308/
CWE-189
https://github.com/torvalds/linux/commit/d3bd7413e0ca40b60cf60d4003246d067cafdeda
d3bd7413e0ca40b60cf60d4003246d067cafdeda
bpf: fix sanitation of alu op with pointer / scalar type from different paths While 979d63d50c0c ("bpf: prevent out of bounds speculation on pointer arithmetic") took care of rejecting alu op on pointer when e.g. pointer came from two different map values with different map properties such as value size, Jann reported that a case was not covered yet when a given alu op is used in both "ptr_reg += reg" and "numeric_reg += reg" from different branches where we would incorrectly try to sanitize based on the pointer's limit. Catch this corner case and reject the program instead. Fixes: 979d63d50c0c ("bpf: prevent out of bounds speculation on pointer arithmetic") Reported-by: Jann Horn <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
static bool reg_type_mismatch(enum bpf_reg_type src, enum bpf_reg_type prev) { return src != prev && (!reg_type_mismatch_ok(src) || !reg_type_mismatch_ok(prev)); }
static bool reg_type_mismatch(enum bpf_reg_type src, enum bpf_reg_type prev) { return src != prev && (!reg_type_mismatch_ok(src) || !reg_type_mismatch_ok(prev)); }
C
linux
0
CVE-2017-5068
https://www.cvedetails.com/cve/CVE-2017-5068/
CWE-362
https://github.com/chromium/chromium/commit/13e1002277287ed0090b2ca76c2d01545e677935
13e1002277287ed0090b2ca76c2d01545e677935
Fix the crash after clamshell -> tablet transition in overview mode. This CL just reverted some changes that were made in https://chromium-review.googlesource.com/c/chromium/src/+/1658955. In that CL, we changed the clamshell <-> tablet transition when clamshell split view mode is enabled, however, we should keep the old behavior unchanged if the feature is not enabled, i.e., overview should be ended if it's active before the transition. Otherwise, it will cause a nullptr dereference crash since |split_view_drag_indicators_| is not created in clamshell overview and will be used in tablet overview. Bug: 982507 Change-Id: I238fe9472648a446cff4ab992150658c228714dd Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1705474 Commit-Queue: Xiaoqian Dai <[email protected]> Reviewed-by: Mitsuru Oshima (Slow - on/off site) <[email protected]> Cr-Commit-Position: refs/heads/master@{#679306}
bool TabletModeWindowManager::IsContainerWindow(aura::Window* window) { return base::Contains(observed_container_windows_, window); }
bool TabletModeWindowManager::IsContainerWindow(aura::Window* window) { return base::Contains(observed_container_windows_, window); }
C
Chrome
0
CVE-2019-5809
https://www.cvedetails.com/cve/CVE-2019-5809/
CWE-416
https://github.com/chromium/chromium/commit/4a3482693491ac6bb3dd27d591efa3de1d1f1fcf
4a3482693491ac6bb3dd27d591efa3de1d1f1fcf
Fix a crash on FileChooserImpl If a renderer process is compromised, and it calls both of FileChooserImpl::OpenFileChooser() and EnumerateChosenDirectory() via Mojo, the browser process could crash because ResetOwner() for the first FileChooserImpl::proxy_ instance was not called. We should check nullness of proxy_ before updating it. Bug: 941008 Change-Id: Ie0c1895ec46ce78d40594b543e49e43b420af675 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1520509 Reviewed-by: Avi Drissman <[email protected]> Commit-Queue: Kent Tamura <[email protected]> Cr-Commit-Position: refs/heads/master@{#640580}
static void CreateLoaderAndStart( RenderFrameHost* frame, network::mojom::URLLoaderRequest request, int route_id, int request_id, const network::ResourceRequest& resource_request, network::mojom::URLLoaderClientPtrInfo client) { network::mojom::URLLoaderFactoryPtr factory; frame->GetProcess()->CreateURLLoaderFactory(frame->GetLastCommittedOrigin(), nullptr /* header_client */, mojo::MakeRequest(&factory)); factory->CreateLoaderAndStart( std::move(request), route_id, request_id, network::mojom::kURLLoadOptionNone, resource_request, network::mojom::URLLoaderClientPtr(std::move(client)), net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS)); }
static void CreateLoaderAndStart( RenderFrameHost* frame, network::mojom::URLLoaderRequest request, int route_id, int request_id, const network::ResourceRequest& resource_request, network::mojom::URLLoaderClientPtrInfo client) { network::mojom::URLLoaderFactoryPtr factory; frame->GetProcess()->CreateURLLoaderFactory(frame->GetLastCommittedOrigin(), nullptr /* header_client */, mojo::MakeRequest(&factory)); factory->CreateLoaderAndStart( std::move(request), route_id, request_id, network::mojom::kURLLoadOptionNone, resource_request, network::mojom::URLLoaderClientPtr(std::move(client)), net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS)); }
C
Chrome
0
CVE-2013-1826
https://www.cvedetails.com/cve/CVE-2013-1826/
null
https://github.com/torvalds/linux/commit/864745d291b5ba80ea0bd0edcbe67273de368836
864745d291b5ba80ea0bd0edcbe67273de368836
xfrm_user: return error pointer instead of NULL When dump_one_state() returns an error, e.g. because of a too small buffer to dump the whole xfrm state, xfrm_state_netlink() returns NULL instead of an error pointer. But its callers expect an error pointer and therefore continue to operate on a NULL skbuff. This could lead to a privilege escalation (execution of user code in kernel context) if the attacker has CAP_NET_ADMIN and is able to map address 0. Signed-off-by: Mathias Krause <[email protected]> Acked-by: Steffen Klassert <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void __net_exit xfrm_user_net_exit(struct list_head *net_exit_list) { struct net *net; list_for_each_entry(net, net_exit_list, exit_list) RCU_INIT_POINTER(net->xfrm.nlsk, NULL); synchronize_net(); list_for_each_entry(net, net_exit_list, exit_list) netlink_kernel_release(net->xfrm.nlsk_stash); }
static void __net_exit xfrm_user_net_exit(struct list_head *net_exit_list) { struct net *net; list_for_each_entry(net, net_exit_list, exit_list) RCU_INIT_POINTER(net->xfrm.nlsk, NULL); synchronize_net(); list_for_each_entry(net, net_exit_list, exit_list) netlink_kernel_release(net->xfrm.nlsk_stash); }
C
linux
0
CVE-2014-3194
https://www.cvedetails.com/cve/CVE-2014-3194/
CWE-416
https://github.com/chromium/chromium/commit/05c619eb6e7dac046afc72c0d5381856f87fb421
05c619eb6e7dac046afc72c0d5381856f87fb421
exo: Reduce side-effects of dynamic activation code. This code exists for clients that need to managed their own system modal dialogs. Since the addition of the remote surface API we can limit the impact of this to surfaces created for system modal container. BUG=29528396 Review-Url: https://codereview.chromium.org/2084023003 Cr-Commit-Position: refs/heads/master@{#401115}
void ShellSurface::OnSurfaceDestroying(Surface* surface) { if (resizer_) EndDrag(false /* revert */); if (widget_) SetMainSurface(widget_->GetNativeWindow(), nullptr); surface->RemoveSurfaceObserver(this); surface_ = nullptr; if (widget_) widget_->Hide(); if (!surface_destroyed_callback_.is_null()) surface_destroyed_callback_.Run(); }
void ShellSurface::OnSurfaceDestroying(Surface* surface) { if (resizer_) EndDrag(false /* revert */); if (widget_) SetMainSurface(widget_->GetNativeWindow(), nullptr); surface->RemoveSurfaceObserver(this); surface_ = nullptr; if (widget_) widget_->Hide(); if (!surface_destroyed_callback_.is_null()) surface_destroyed_callback_.Run(); }
C
Chrome
0
CVE-2016-10066
https://www.cvedetails.com/cve/CVE-2016-10066/
CWE-119
https://github.com/ImageMagick/ImageMagick/commit/f6e9d0d9955e85bdd7540b251cd50d598dacc5e6
f6e9d0d9955e85bdd7540b251cd50d598dacc5e6
null
static inline float MaxF(float one, float two) { if (one > two) return one; return two; }
static inline float MaxF(float one, float two) { if (one > two) return one; return two; }
C
ImageMagick
0
CVE-2013-4160
https://www.cvedetails.com/cve/CVE-2013-4160/
null
https://github.com/mm2/Little-CMS/commit/91c2db7f2559be504211b283bc3a2c631d6f06d9
91c2db7f2559be504211b283bc3a2c631d6f06d9
Non happy-path fixes
void CMSEXPORT cmsFreeNamedColorList(cmsNAMEDCOLORLIST* v) { if (v == NULL) return; if (v ->List) _cmsFree(v ->ContextID, v ->List); _cmsFree(v ->ContextID, v); }
void CMSEXPORT cmsFreeNamedColorList(cmsNAMEDCOLORLIST* v) { if (v == NULL) return; if (v ->List) _cmsFree(v ->ContextID, v ->List); _cmsFree(v ->ContextID, v); }
C
Little-CMS
0
CVE-2018-13006
https://www.cvedetails.com/cve/CVE-2018-13006/
CWE-125
https://github.com/gpac/gpac/commit/bceb03fd2be95097a7b409ea59914f332fb6bc86
bceb03fd2be95097a7b409ea59914f332fb6bc86
fixed 2 possible heap overflows (inc. #1088)
GF_Err iSFM_dump(GF_Box *a, FILE * trace) { GF_ISMASampleFormatBox *p; const char *name = (a->type==GF_ISOM_BOX_TYPE_ISFM) ? "ISMASampleFormat" : "OMADRMAUFormatBox"; p = (GF_ISMASampleFormatBox *)a; gf_isom_box_dump_start(a, name, trace); fprintf(trace, "selective_encryption=\"%d\" key_indicator_length=\"%d\" IV_length=\"%d\">\n", p->selective_encryption, p->key_indicator_length, p->IV_length); gf_isom_box_dump_done(name, a, trace); return GF_OK; }
GF_Err iSFM_dump(GF_Box *a, FILE * trace) { GF_ISMASampleFormatBox *p; const char *name = (a->type==GF_ISOM_BOX_TYPE_ISFM) ? "ISMASampleFormat" : "OMADRMAUFormatBox"; p = (GF_ISMASampleFormatBox *)a; gf_isom_box_dump_start(a, name, trace); fprintf(trace, "selective_encryption=\"%d\" key_indicator_length=\"%d\" IV_length=\"%d\">\n", p->selective_encryption, p->key_indicator_length, p->IV_length); gf_isom_box_dump_done(name, a, trace); return GF_OK; }
C
gpac
0
CVE-2010-1635
https://www.cvedetails.com/cve/CVE-2010-1635/
null
https://git.samba.org/?p=samba.git;a=commit;h=25452a2268ac7013da28125f3df22085139af12d
25452a2268ac7013da28125f3df22085139af12d
null
static bool valid_smb_header(const uint8_t *inbuf) { if (is_encrypted_packet(inbuf)) { return true; } /* * This used to be (strncmp(smb_base(inbuf),"\377SMB",4) == 0) * but it just looks weird to call strncmp for this one. */ return (IVAL(smb_base(inbuf), 0) == 0x424D53FF); }
static bool valid_smb_header(const uint8_t *inbuf) { if (is_encrypted_packet(inbuf)) { return true; } /* * This used to be (strncmp(smb_base(inbuf),"\377SMB",4) == 0) * but it just looks weird to call strncmp for this one. */ return (IVAL(smb_base(inbuf), 0) == 0x424D53FF); }
C
samba
0
null
null
null
https://github.com/chromium/chromium/commit/fc3c351a3d995f73ead5c92354396a7ec2b14e3f
fc3c351a3d995f73ead5c92354396a7ec2b14e3f
Split infobars.{cc,h} into separate pieces for the different classes defined within, so that each piece is shorter and clearer. BUG=none TEST=none Review URL: http://codereview.chromium.org/6250057 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73235 0039d316-1c4b-4281-b951-d872f2087c98
void InfoBar::AnimationProgressed(const ui::Animation* animation) { if (container_) container_->InfoBarAnimated(true); }
void InfoBar::AnimationProgressed(const ui::Animation* animation) { if (container_) container_->InfoBarAnimated(true); }
C
Chrome
0
CVE-2018-1000040
https://www.cvedetails.com/cve/CVE-2018-1000040/
CWE-20
http://git.ghostscript.com/?p=mupdf.git;a=commitdiff;h=83d4dae44c71816c084a635550acc1a51529b881;hp=f597300439e62f5e921f0d7b1e880b5c1a1f1607
83d4dae44c71816c084a635550acc1a51529b881
null
fast_cmyk_to_rgb_ARM(unsigned char *dst, unsigned char *src, int n) { asm volatile( ENTER_ARM "stmfd r13!,{r4-r11,r14} \n" "@ r0 = dst \n" "@ r1 = src \n" "@ r2 = n \n" "mov r12, #0 @ r12= CMYK = 0 \n" "b 2f @ enter loop \n" "1: @ White or Black \n" "@ Cunning trick: On entry r11 = 0 if black, r11 = FF if white \n" "eor r12,r11,#0xFF @ r12= FF if black, 0 if white \n" "ldrb r7, [r1],#1 @ r8 = s[4] \n" "strb r11,[r0],#1 @ d[0] = r \n" "strb r11,[r0],#1 @ d[1] = g \n" "strb r11,[r0],#1 @ d[2] = b \n" "strb r7, [r0],#1 @ d[3] = s[4] \n" "mov r12,r12,LSL #24 @ r12 = CMYK \n" "subs r2, r2, #1 @ r2 = n-- \n" "beq 9f \n" "2: @ Main loop starts here \n" "ldrb r3, [r1], #4 @ r3 = c \n" "ldrb r6, [r1, #-1] @ r6 = k \n" "ldrb r5, [r1, #-2] @ r5 = y \n" "ldrb r4, [r1, #-3] @ r4 = m \n" "eors r11,r6, #0xFF @ if (k == 255) \n" "beq 1b @ goto black \n" "orr r7, r3, r4, LSL #8 \n" "orr r14,r5, r6, LSL #8 \n" "orrs r7, r7, r14,LSL #16 @ r7 = cmyk \n" "beq 1b @ if (cmyk == 0) white \n" "@ At this point, we have to decode a new pixel \n" "@ r0 = dst r1 = src r2 = n r7 = cmyk \n" "3: @ unmatched \n" "stmfd r13!,{r0-r1,r7} @ stash regs for space \n" "add r3, r3, r3, LSR #7 @ r3 = c += c>>7 \n" "add r4, r4, r4, LSR #7 @ r4 = m += m>>7 \n" "add r5, r5, r5, LSR #7 @ r5 = y += y>>7 \n" "add r6, r6, r6, LSR #7 @ r6 = k += k>>7 \n" "mov r5, r5, LSR #1 @ sacrifice 1 bit of Y \n" "mul r8, r3, r4 @ r8 = cm = c * m \n" "rsb r9, r8, r4, LSL #8 @ r9 = c1m = (m<<8) - cm \n" "rsb r3, r8, r3, LSL #8 @ r3 = cm1 = (c<<8) - cm \n" "rsb r4, r4, #0x100 @ r4 = 256-m \n" "rsb r4, r3, r4, LSL #8 @ r4 = c1m1 =((256-m)<<8)-cm1 \n" "mul r7, r4, r5 @ r7 = c1m1y = c1m1 * y \n" "rsb r4, r7, r4, LSL #7 @ r4 = c1m1y1 = (c1m1<<7)-c1m1y \n" "mul r10,r9, r5 @ r10= c1my = c1m * y \n" "rsb r9, r10,r9, LSL #7 @ r9 = c1my1 = (c1m<<7) - c1my \n" "mul r11,r3, r5 @ r11= cm1y = cm1 * y \n" "rsb r3, r11,r3, LSL #7 @ r3 = cm1y1 = (cm1<<7) - cm1y \n" "mul r5, r8, r5 @ r5 = cmy = cm * y \n" "rsb r8, r5, r8, LSL #7 @ r8 = cmy1 = (cm<<7) - cmy \n" "@ Register recap: \n" "@ r3 = cm1y1 \n" "@ r4 = c1m1y1 \n" "@ r5 = cmy \n" "@ r6 = k \n" "@ r7 = c1m1y \n" "@ r8 = cmy1 \n" "@ r9 = c1my1 \n" "@ r10= c1my \n" "@ r11= cm1y \n" "@ The actual matrix multiplication \n" "mul r14,r4, r6 @ r14= x1 = c1m1y1 * k \n" "rsb r4, r14,r4, LSL #8 @ r4 = x0 = (c1m1y1<<8) - x1 \n" "add r4, r4, r14,LSR #8-5 @ r4 = b = x0 + 32*(x1>>8) \n" "sub r1, r4, r14,LSR #8 @ r1 = g = x0 + 31*(x1>>8) \n" "add r0, r1, r14,LSR #8-2 @ r0 = r = x0 + 35*(x1>>8) \n" " \n" "mul r14,r7, r6 @ r14= x1 = c1m1y * k \n" "rsb r7, r14,r7, LSL #8 @ r7 = x0 = (c1m1y<<8) - x1 \n" "add r0, r0, r7 @ r0 = r += x0 \n" "add r1, r1, r7 @ r1 = g += (x0>>8 * 256) \n" "sub r1, r1, r7, LSR #8-3 @ 248 \n" "sub r1, r1, r7, LSR #8-2 @ 244 \n" "sub r1, r1, r7, LSR #8 @ 243 \n" "sub r7, r14,r14,LSR #3 @ r7 = 28*(x1>>5) \n" "add r0, r0, r7, LSR #8-5 @ r0 = r += 28 * x1 \n" "sub r7, r7, r14,LSR #4 @ r7 = 26*(x1>>5) \n" "add r1, r1, r7, LSR #8-5 @ r1 = g += 26 * x1 \n" " \n" "mul r14,r9, r6 @ r14= x1 = c1my1 * k \n" "sub r9, r9, r14,LSR #8 @ r9 = x0>>8 = c1my1 - (x1>>8) \n" "add r0, r0, r14,LSR #8-5 @ r0 = r += (x1>>8)*32 \n" "add r0, r0, r14,LSR #8-2 @ r0 = r += (x1>>8)*36 \n" "mov r14,#237 @ r14= 237 \n" "mla r0,r14,r9,r0 @ r14= r += x0*237 \n" "mov r14,#141 @ r14= 141 \n" "mla r4,r14,r9,r4 @ r14= b += x0*141 \n" " \n" "mul r14,r10,r6 @ r14= x1 = c1my * k \n" "sub r10,r10,r14,LSR #8 @ r10= x0>>8 = c1my - (x1>>8) \n" "add r0, r0, r14,LSR #8-5 @ r0 = r += 32 * x1 \n" "add r0, r0, r14,LSR #8-1 @ r0 = r += 34 * x1 \n" "mov r14,#238 @ r14= 238 \n" "mla r0,r14,r10,r0 @ r0 = r += 238 * x0 \n" "mov r14,#28 @ r14= 28 \n" "mla r1,r14,r10,r1 @ r1 = g += 28 * x0 \n" "mov r14,#36 @ r14= 36 \n" "mla r4,r14,r10,r4 @ r4 = b += 36 * x0 \n" " \n" "mul r14,r3, r6 @ r14= x1 = cm1y1 * k \n" "sub r3, r3, r14,LSR #8 @ r3 = x1>>8 = cm1y1 - (x1>>8) \n" "add r1, r1, r14,LSR #8-4 @ r1 = g += 16*x1 \n" "sub r1, r1, r14,LSR #8 @ 15*x1 \n" "add r4, r4, r14,LSR #8-5 @ r4 = b += 32*x1 \n" "add r4, r4, r14,LSR #8-2 @ 36*x1 \n" "mov r14,#174 @ r14= 174 \n" "mla r1, r14,r3, r1 @ r1 = g += 174 * x0 \n" "mov r14,#240 @ r14= 240 \n" "mla r4, r14,r3, r4 @ r4 = b += 240 * x0 \n" " \n" "mul r14,r11,r6 @ r14= x1 = cm1y * k \n" "sub r11,r11,r14,LSR #8 @ r11= x0>>8 = cm1y - (x1>>8) \n" "add r1, r1, r14,LSR #8-4 @ r1 = g += x1 * 16 \n" "add r1, r1, r14,LSR #8 @ x1 * 17 \n" "add r1, r1, r14,LSR #8-1 @ x1 * 19 \n" "mov r14,#167 @ r14 = 167 \n" "mla r1, r14,r11,r1 @ r1 = g += 167 * x0 \n" "mov r14,#80 @ r14 = 80 \n" "mla r4, r14,r11,r4 @ r4 = b += 80 * x0 \n" " \n" "mul r14,r8, r6 @ r14= x1 = cmy1 * k \n" "sub r8, r8, r14,LSR #8 @ r8 = x0>>8 = cmy1 - (x1>>8) \n" "add r4, r4, r14,LSR #8-1 @ r4 = b += x1 * 2 \n" "mov r14,#46 @ r14=46 \n" "mla r0, r14,r8, r0 @ r0 = r += 46 * x0 \n" "mov r14,#49 @ r14=49 \n" "mla r1, r14,r8, r1 @ r1 = g += 49 * x0 \n" "mov r14,#147 @ r14=147 \n" "mla r4, r14,r8, r4 @ r4 = b += 147 * x0 \n" " \n" "rsb r6, r6, #256 @ r6 = k = 256-k \n" "mul r14,r5, r6 @ r14= x0 = cmy * (256-k) \n" "mov r11,#54 @ r11= 54 \n" "mov r14,r14,LSR #8 @ r14= (x0>>8) \n" "mov r8,#57 @ r8 = 57 \n" "mla r0,r14,r11,r0 @ r0 = r += 54*x0 \n" "mla r1,r14,r11,r1 @ r1 = g += 54*x0 \n" "mla r4,r14,r8, r4 @ r4 = b += 57*x0 \n" " \n" "sub r8, r0, r0, LSR #8 @ r8 = r -= (r>>8) \n" "sub r9, r1, r1, LSR #8 @ r9 = g -= (r>>8) \n" "sub r10,r4, r4, LSR #8 @ r10= b -= (r>>8) \n" "ldmfd r13!,{r0-r1,r12} \n" "mov r8, r8, LSR #23 @ r8 = r>>23 \n" "mov r9, r9, LSR #23 @ r9 = g>>23 \n" "mov r10,r10,LSR #23 @ r10= b>>23 \n" "ldrb r14,[r1],#1 @ r8 = s[4] \n" "strb r8, [r0],#1 @ d[0] = r \n" "strb r9, [r0],#1 @ d[1] = g \n" "strb r10,[r0],#1 @ d[2] = b \n" "strb r14,[r0],#1 @ d[3] = s[4] \n" "subs r2, r2, #1 @ r2 = n-- \n" "beq 9f \n" "@ At this point, we've just decoded a pixel \n" "@ r0 = dst r1 = src r2 = n r8 = r r9 = g r10= b r12= CMYK \n" "4: \n" "ldrb r3, [r1], #4 @ r3 = c \n" "ldrb r6, [r1, #-1] @ r6 = k \n" "ldrb r5, [r1, #-2] @ r5 = y \n" "ldrb r4, [r1, #-3] @ r4 = m \n" "eors r11,r6, #0xFF @ if (k == 255) \n" "beq 1b @ goto black \n" "orr r7, r3, r4, LSL #8 \n" "orr r14,r5, r6, LSL #8 \n" "orrs r7, r7, r14,LSL #16 @ r7 = cmyk \n" "beq 1b @ if (cmyk == 0) white \n" "cmp r7, r12 @ if (cmyk != CMYK) \n" "bne 3b @ not the same, loop \n" "@ If we get here, we just matched a pixel we have just decoded \n" "ldrb r3, [r1],#1 @ r8 = s[4] \n" "strb r8, [r0],#1 @ d[0] = r \n" "strb r9, [r0],#1 @ d[1] = g \n" "strb r10,[r0],#1 @ d[2] = b \n" "strb r3, [r0],#1 @ d[3] = s[4] \n" "subs r2, r2, #1 @ r2 = n-- \n" "bne 4b \n" "9: \n" "ldmfd r13!,{r4-r11,PC} @ pop, return to thumb \n" ENTER_THUMB ); }
fast_cmyk_to_rgb_ARM(unsigned char *dst, unsigned char *src, int n) { asm volatile( ENTER_ARM "stmfd r13!,{r4-r11,r14} \n" "@ r0 = dst \n" "@ r1 = src \n" "@ r2 = n \n" "mov r12, #0 @ r12= CMYK = 0 \n" "b 2f @ enter loop \n" "1: @ White or Black \n" "@ Cunning trick: On entry r11 = 0 if black, r11 = FF if white \n" "eor r12,r11,#0xFF @ r12= FF if black, 0 if white \n" "ldrb r7, [r1],#1 @ r8 = s[4] \n" "strb r11,[r0],#1 @ d[0] = r \n" "strb r11,[r0],#1 @ d[1] = g \n" "strb r11,[r0],#1 @ d[2] = b \n" "strb r7, [r0],#1 @ d[3] = s[4] \n" "mov r12,r12,LSL #24 @ r12 = CMYK \n" "subs r2, r2, #1 @ r2 = n-- \n" "beq 9f \n" "2: @ Main loop starts here \n" "ldrb r3, [r1], #4 @ r3 = c \n" "ldrb r6, [r1, #-1] @ r6 = k \n" "ldrb r5, [r1, #-2] @ r5 = y \n" "ldrb r4, [r1, #-3] @ r4 = m \n" "eors r11,r6, #0xFF @ if (k == 255) \n" "beq 1b @ goto black \n" "orr r7, r3, r4, LSL #8 \n" "orr r14,r5, r6, LSL #8 \n" "orrs r7, r7, r14,LSL #16 @ r7 = cmyk \n" "beq 1b @ if (cmyk == 0) white \n" "@ At this point, we have to decode a new pixel \n" "@ r0 = dst r1 = src r2 = n r7 = cmyk \n" "3: @ unmatched \n" "stmfd r13!,{r0-r1,r7} @ stash regs for space \n" "add r3, r3, r3, LSR #7 @ r3 = c += c>>7 \n" "add r4, r4, r4, LSR #7 @ r4 = m += m>>7 \n" "add r5, r5, r5, LSR #7 @ r5 = y += y>>7 \n" "add r6, r6, r6, LSR #7 @ r6 = k += k>>7 \n" "mov r5, r5, LSR #1 @ sacrifice 1 bit of Y \n" "mul r8, r3, r4 @ r8 = cm = c * m \n" "rsb r9, r8, r4, LSL #8 @ r9 = c1m = (m<<8) - cm \n" "rsb r3, r8, r3, LSL #8 @ r3 = cm1 = (c<<8) - cm \n" "rsb r4, r4, #0x100 @ r4 = 256-m \n" "rsb r4, r3, r4, LSL #8 @ r4 = c1m1 =((256-m)<<8)-cm1 \n" "mul r7, r4, r5 @ r7 = c1m1y = c1m1 * y \n" "rsb r4, r7, r4, LSL #7 @ r4 = c1m1y1 = (c1m1<<7)-c1m1y \n" "mul r10,r9, r5 @ r10= c1my = c1m * y \n" "rsb r9, r10,r9, LSL #7 @ r9 = c1my1 = (c1m<<7) - c1my \n" "mul r11,r3, r5 @ r11= cm1y = cm1 * y \n" "rsb r3, r11,r3, LSL #7 @ r3 = cm1y1 = (cm1<<7) - cm1y \n" "mul r5, r8, r5 @ r5 = cmy = cm * y \n" "rsb r8, r5, r8, LSL #7 @ r8 = cmy1 = (cm<<7) - cmy \n" "@ Register recap: \n" "@ r3 = cm1y1 \n" "@ r4 = c1m1y1 \n" "@ r5 = cmy \n" "@ r6 = k \n" "@ r7 = c1m1y \n" "@ r8 = cmy1 \n" "@ r9 = c1my1 \n" "@ r10= c1my \n" "@ r11= cm1y \n" "@ The actual matrix multiplication \n" "mul r14,r4, r6 @ r14= x1 = c1m1y1 * k \n" "rsb r4, r14,r4, LSL #8 @ r4 = x0 = (c1m1y1<<8) - x1 \n" "add r4, r4, r14,LSR #8-5 @ r4 = b = x0 + 32*(x1>>8) \n" "sub r1, r4, r14,LSR #8 @ r1 = g = x0 + 31*(x1>>8) \n" "add r0, r1, r14,LSR #8-2 @ r0 = r = x0 + 35*(x1>>8) \n" " \n" "mul r14,r7, r6 @ r14= x1 = c1m1y * k \n" "rsb r7, r14,r7, LSL #8 @ r7 = x0 = (c1m1y<<8) - x1 \n" "add r0, r0, r7 @ r0 = r += x0 \n" "add r1, r1, r7 @ r1 = g += (x0>>8 * 256) \n" "sub r1, r1, r7, LSR #8-3 @ 248 \n" "sub r1, r1, r7, LSR #8-2 @ 244 \n" "sub r1, r1, r7, LSR #8 @ 243 \n" "sub r7, r14,r14,LSR #3 @ r7 = 28*(x1>>5) \n" "add r0, r0, r7, LSR #8-5 @ r0 = r += 28 * x1 \n" "sub r7, r7, r14,LSR #4 @ r7 = 26*(x1>>5) \n" "add r1, r1, r7, LSR #8-5 @ r1 = g += 26 * x1 \n" " \n" "mul r14,r9, r6 @ r14= x1 = c1my1 * k \n" "sub r9, r9, r14,LSR #8 @ r9 = x0>>8 = c1my1 - (x1>>8) \n" "add r0, r0, r14,LSR #8-5 @ r0 = r += (x1>>8)*32 \n" "add r0, r0, r14,LSR #8-2 @ r0 = r += (x1>>8)*36 \n" "mov r14,#237 @ r14= 237 \n" "mla r0,r14,r9,r0 @ r14= r += x0*237 \n" "mov r14,#141 @ r14= 141 \n" "mla r4,r14,r9,r4 @ r14= b += x0*141 \n" " \n" "mul r14,r10,r6 @ r14= x1 = c1my * k \n" "sub r10,r10,r14,LSR #8 @ r10= x0>>8 = c1my - (x1>>8) \n" "add r0, r0, r14,LSR #8-5 @ r0 = r += 32 * x1 \n" "add r0, r0, r14,LSR #8-1 @ r0 = r += 34 * x1 \n" "mov r14,#238 @ r14= 238 \n" "mla r0,r14,r10,r0 @ r0 = r += 238 * x0 \n" "mov r14,#28 @ r14= 28 \n" "mla r1,r14,r10,r1 @ r1 = g += 28 * x0 \n" "mov r14,#36 @ r14= 36 \n" "mla r4,r14,r10,r4 @ r4 = b += 36 * x0 \n" " \n" "mul r14,r3, r6 @ r14= x1 = cm1y1 * k \n" "sub r3, r3, r14,LSR #8 @ r3 = x1>>8 = cm1y1 - (x1>>8) \n" "add r1, r1, r14,LSR #8-4 @ r1 = g += 16*x1 \n" "sub r1, r1, r14,LSR #8 @ 15*x1 \n" "add r4, r4, r14,LSR #8-5 @ r4 = b += 32*x1 \n" "add r4, r4, r14,LSR #8-2 @ 36*x1 \n" "mov r14,#174 @ r14= 174 \n" "mla r1, r14,r3, r1 @ r1 = g += 174 * x0 \n" "mov r14,#240 @ r14= 240 \n" "mla r4, r14,r3, r4 @ r4 = b += 240 * x0 \n" " \n" "mul r14,r11,r6 @ r14= x1 = cm1y * k \n" "sub r11,r11,r14,LSR #8 @ r11= x0>>8 = cm1y - (x1>>8) \n" "add r1, r1, r14,LSR #8-4 @ r1 = g += x1 * 16 \n" "add r1, r1, r14,LSR #8 @ x1 * 17 \n" "add r1, r1, r14,LSR #8-1 @ x1 * 19 \n" "mov r14,#167 @ r14 = 167 \n" "mla r1, r14,r11,r1 @ r1 = g += 167 * x0 \n" "mov r14,#80 @ r14 = 80 \n" "mla r4, r14,r11,r4 @ r4 = b += 80 * x0 \n" " \n" "mul r14,r8, r6 @ r14= x1 = cmy1 * k \n" "sub r8, r8, r14,LSR #8 @ r8 = x0>>8 = cmy1 - (x1>>8) \n" "add r4, r4, r14,LSR #8-1 @ r4 = b += x1 * 2 \n" "mov r14,#46 @ r14=46 \n" "mla r0, r14,r8, r0 @ r0 = r += 46 * x0 \n" "mov r14,#49 @ r14=49 \n" "mla r1, r14,r8, r1 @ r1 = g += 49 * x0 \n" "mov r14,#147 @ r14=147 \n" "mla r4, r14,r8, r4 @ r4 = b += 147 * x0 \n" " \n" "rsb r6, r6, #256 @ r6 = k = 256-k \n" "mul r14,r5, r6 @ r14= x0 = cmy * (256-k) \n" "mov r11,#54 @ r11= 54 \n" "mov r14,r14,LSR #8 @ r14= (x0>>8) \n" "mov r8,#57 @ r8 = 57 \n" "mla r0,r14,r11,r0 @ r0 = r += 54*x0 \n" "mla r1,r14,r11,r1 @ r1 = g += 54*x0 \n" "mla r4,r14,r8, r4 @ r4 = b += 57*x0 \n" " \n" "sub r8, r0, r0, LSR #8 @ r8 = r -= (r>>8) \n" "sub r9, r1, r1, LSR #8 @ r9 = g -= (r>>8) \n" "sub r10,r4, r4, LSR #8 @ r10= b -= (r>>8) \n" "ldmfd r13!,{r0-r1,r12} \n" "mov r8, r8, LSR #23 @ r8 = r>>23 \n" "mov r9, r9, LSR #23 @ r9 = g>>23 \n" "mov r10,r10,LSR #23 @ r10= b>>23 \n" "ldrb r14,[r1],#1 @ r8 = s[4] \n" "strb r8, [r0],#1 @ d[0] = r \n" "strb r9, [r0],#1 @ d[1] = g \n" "strb r10,[r0],#1 @ d[2] = b \n" "strb r14,[r0],#1 @ d[3] = s[4] \n" "subs r2, r2, #1 @ r2 = n-- \n" "beq 9f \n" "@ At this point, we've just decoded a pixel \n" "@ r0 = dst r1 = src r2 = n r8 = r r9 = g r10= b r12= CMYK \n" "4: \n" "ldrb r3, [r1], #4 @ r3 = c \n" "ldrb r6, [r1, #-1] @ r6 = k \n" "ldrb r5, [r1, #-2] @ r5 = y \n" "ldrb r4, [r1, #-3] @ r4 = m \n" "eors r11,r6, #0xFF @ if (k == 255) \n" "beq 1b @ goto black \n" "orr r7, r3, r4, LSL #8 \n" "orr r14,r5, r6, LSL #8 \n" "orrs r7, r7, r14,LSL #16 @ r7 = cmyk \n" "beq 1b @ if (cmyk == 0) white \n" "cmp r7, r12 @ if (cmyk != CMYK) \n" "bne 3b @ not the same, loop \n" "@ If we get here, we just matched a pixel we have just decoded \n" "ldrb r3, [r1],#1 @ r8 = s[4] \n" "strb r8, [r0],#1 @ d[0] = r \n" "strb r9, [r0],#1 @ d[1] = g \n" "strb r10,[r0],#1 @ d[2] = b \n" "strb r3, [r0],#1 @ d[3] = s[4] \n" "subs r2, r2, #1 @ r2 = n-- \n" "bne 4b \n" "9: \n" "ldmfd r13!,{r4-r11,PC} @ pop, return to thumb \n" ENTER_THUMB ); }
C
ghostscript
0
CVE-2017-5104
https://www.cvedetails.com/cve/CVE-2017-5104/
CWE-20
https://github.com/chromium/chromium/commit/adca986a53b31b6da4cb22f8e755f6856daea89a
adca986a53b31b6da4cb22f8e755f6856daea89a
Don't show current RenderWidgetHostView while interstitial is showing. Also moves interstitial page tracking from RenderFrameHostManager to WebContents, since interstitial pages are not frame-specific. This was necessary for subframes to detect if an interstitial page is showing. BUG=729105 TEST=See comment 13 of bug for repro steps CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2938313002 Cr-Commit-Position: refs/heads/master@{#480117}
void RenderFrameHostManager::CommitPending() { TRACE_EVENT1("navigation", "RenderFrameHostManager::CommitPending", "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); DCHECK(pending_render_frame_host_ || speculative_render_frame_host_); bool is_main_frame = frame_tree_node_->IsMainFrame(); bool will_focus_location_bar = is_main_frame && delegate_->FocusLocationBarByDefault(); bool focus_render_view = !will_focus_location_bar && render_frame_host_->GetView() && render_frame_host_->GetView()->HasFocus(); frame_tree_node_->ResetForNewProcess(); std::unique_ptr<RenderFrameHostImpl> old_render_frame_host; if (!IsBrowserSideNavigationEnabled()) { DCHECK(!speculative_render_frame_host_); old_render_frame_host = SetRenderFrameHost(std::move(pending_render_frame_host_)); } else { DCHECK(speculative_render_frame_host_); old_render_frame_host = SetRenderFrameHost(std::move(speculative_render_frame_host_)); } SkColor old_background_color = SK_ColorWHITE; bool has_old_background_color = false; if (old_render_frame_host->GetView()) { has_old_background_color = true; old_background_color = old_render_frame_host->GetView()->background_color(); } bool new_rfh_has_view = !!render_frame_host_->GetView(); if (!delegate_->IsHidden() && new_rfh_has_view) { render_frame_host_->GetView()->Show(); } render_frame_host_->GetProcess()->RemovePendingView(); if (!new_rfh_has_view) { DCHECK(!render_frame_host_->IsRenderFrameLive()); DCHECK(!render_frame_host_->render_view_host()->IsRenderViewLive()); render_frame_host_->ResetLoadingState(); delegate_->RenderProcessGoneFromRenderManager( render_frame_host_->render_view_host()); } if (is_main_frame && old_render_frame_host->render_view_host()->GetWidget()->GetView()) { old_render_frame_host->render_view_host()->GetWidget()->GetView()->Hide(); } delegate_->UpdateRenderViewSizeForRenderManager(); if (will_focus_location_bar) { delegate_->SetFocusToLocationBar(false); } else if (focus_render_view && render_frame_host_->GetView()) { if (is_main_frame) { render_frame_host_->GetView()->Focus(); } else { frame_tree_node_->frame_tree()->SetPageFocus( render_frame_host_->GetSiteInstance(), true); } } delegate_->NotifySwappedFromRenderManager( old_render_frame_host.get(), render_frame_host_.get(), is_main_frame); if (has_old_background_color && render_frame_host_->GetView()) render_frame_host_->GetView()->SetBackgroundColor(old_background_color); if (is_main_frame) { RenderViewHostImpl* rvh = render_frame_host_->render_view_host(); rvh->set_main_frame_routing_id(render_frame_host_->routing_id()); if (!rvh->is_active()) rvh->PostRenderViewReady(); rvh->set_is_active(true); rvh->set_is_swapped_out(false); old_render_frame_host->render_view_host()->set_main_frame_routing_id( MSG_ROUTING_NONE); } SwapOutOldFrame(std::move(old_render_frame_host)); DeleteRenderFrameProxyHost(render_frame_host_->GetSiteInstance()); RenderFrameProxyHost* proxy_to_parent = GetProxyToParent(); if (proxy_to_parent) { CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); proxy_to_parent->SetChildRWHView(render_frame_host_->GetView()); } CHECK(!GetRenderFrameProxyHost(render_frame_host_->GetSiteInstance())); }
void RenderFrameHostManager::CommitPending() { TRACE_EVENT1("navigation", "RenderFrameHostManager::CommitPending", "FrameTreeNode id", frame_tree_node_->frame_tree_node_id()); DCHECK(pending_render_frame_host_ || speculative_render_frame_host_); bool is_main_frame = frame_tree_node_->IsMainFrame(); bool will_focus_location_bar = is_main_frame && delegate_->FocusLocationBarByDefault(); bool focus_render_view = !will_focus_location_bar && render_frame_host_->GetView() && render_frame_host_->GetView()->HasFocus(); frame_tree_node_->ResetForNewProcess(); std::unique_ptr<RenderFrameHostImpl> old_render_frame_host; if (!IsBrowserSideNavigationEnabled()) { DCHECK(!speculative_render_frame_host_); old_render_frame_host = SetRenderFrameHost(std::move(pending_render_frame_host_)); } else { DCHECK(speculative_render_frame_host_); old_render_frame_host = SetRenderFrameHost(std::move(speculative_render_frame_host_)); } SkColor old_background_color = SK_ColorWHITE; bool has_old_background_color = false; if (old_render_frame_host->GetView()) { has_old_background_color = true; old_background_color = old_render_frame_host->GetView()->background_color(); } bool new_rfh_has_view = !!render_frame_host_->GetView(); if (!delegate_->IsHidden() && new_rfh_has_view) { render_frame_host_->GetView()->Show(); } render_frame_host_->GetProcess()->RemovePendingView(); if (!new_rfh_has_view) { DCHECK(!render_frame_host_->IsRenderFrameLive()); DCHECK(!render_frame_host_->render_view_host()->IsRenderViewLive()); render_frame_host_->ResetLoadingState(); delegate_->RenderProcessGoneFromRenderManager( render_frame_host_->render_view_host()); } if (is_main_frame && old_render_frame_host->render_view_host()->GetWidget()->GetView()) { old_render_frame_host->render_view_host()->GetWidget()->GetView()->Hide(); } delegate_->UpdateRenderViewSizeForRenderManager(); if (will_focus_location_bar) { delegate_->SetFocusToLocationBar(false); } else if (focus_render_view && render_frame_host_->GetView()) { if (is_main_frame) { render_frame_host_->GetView()->Focus(); } else { frame_tree_node_->frame_tree()->SetPageFocus( render_frame_host_->GetSiteInstance(), true); } } delegate_->NotifySwappedFromRenderManager( old_render_frame_host.get(), render_frame_host_.get(), is_main_frame); if (has_old_background_color && render_frame_host_->GetView()) render_frame_host_->GetView()->SetBackgroundColor(old_background_color); if (is_main_frame) { RenderViewHostImpl* rvh = render_frame_host_->render_view_host(); rvh->set_main_frame_routing_id(render_frame_host_->routing_id()); if (!rvh->is_active()) rvh->PostRenderViewReady(); rvh->set_is_active(true); rvh->set_is_swapped_out(false); old_render_frame_host->render_view_host()->set_main_frame_routing_id( MSG_ROUTING_NONE); } SwapOutOldFrame(std::move(old_render_frame_host)); DeleteRenderFrameProxyHost(render_frame_host_->GetSiteInstance()); RenderFrameProxyHost* proxy_to_parent = GetProxyToParent(); if (proxy_to_parent) { CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); proxy_to_parent->SetChildRWHView(render_frame_host_->GetView()); } CHECK(!GetRenderFrameProxyHost(render_frame_host_->GetSiteInstance())); }
C
Chrome
0
CVE-2017-9330
https://www.cvedetails.com/cve/CVE-2017-9330/
CWE-835
https://git.qemu.org/?p=qemu.git;a=commit;h=26f670a244982335cc08943fb1ec099a2c81e42d
26f670a244982335cc08943fb1ec099a2c81e42d
null
static int ohci_bus_start(OHCIState *ohci) { trace_usb_ohci_start(ohci->name); /* Delay the first SOF event by one frame time as * linux driver is not ready to receive it and * can meet some race conditions */ ohci_eof_timer(ohci); return 1; }
static int ohci_bus_start(OHCIState *ohci) { trace_usb_ohci_start(ohci->name); /* Delay the first SOF event by one frame time as * linux driver is not ready to receive it and * can meet some race conditions */ ohci_eof_timer(ohci); return 1; }
C
qemu
0
CVE-2012-1179
https://www.cvedetails.com/cve/CVE-2012-1179/
CWE-264
https://github.com/torvalds/linux/commit/4a1d704194a441bf83c636004a479e01360ec850
4a1d704194a441bf83c636004a479e01360ec850
mm: thp: fix pmd_bad() triggering in code paths holding mmap_sem read mode commit 1a5a9906d4e8d1976b701f889d8f35d54b928f25 upstream. In some cases it may happen that pmd_none_or_clear_bad() is called with the mmap_sem hold in read mode. In those cases the huge page faults can allocate hugepmds under pmd_none_or_clear_bad() and that can trigger a false positive from pmd_bad() that will not like to see a pmd materializing as trans huge. It's not khugepaged causing the problem, khugepaged holds the mmap_sem in write mode (and all those sites must hold the mmap_sem in read mode to prevent pagetables to go away from under them, during code review it seems vm86 mode on 32bit kernels requires that too unless it's restricted to 1 thread per process or UP builds). The race is only with the huge pagefaults that can convert a pmd_none() into a pmd_trans_huge(). Effectively all these pmd_none_or_clear_bad() sites running with mmap_sem in read mode are somewhat speculative with the page faults, and the result is always undefined when they run simultaneously. This is probably why it wasn't common to run into this. For example if the madvise(MADV_DONTNEED) runs zap_page_range() shortly before the page fault, the hugepage will not be zapped, if the page fault runs first it will be zapped. Altering pmd_bad() not to error out if it finds hugepmds won't be enough to fix this, because zap_pmd_range would then proceed to call zap_pte_range (which would be incorrect if the pmd become a pmd_trans_huge()). The simplest way to fix this is to read the pmd in the local stack (regardless of what we read, no need of actual CPU barriers, only compiler barrier needed), and be sure it is not changing under the code that computes its value. Even if the real pmd is changing under the value we hold on the stack, we don't care. If we actually end up in zap_pte_range it means the pmd was not none already and it was not huge, and it can't become huge from under us (khugepaged locking explained above). All we need is to enforce that there is no way anymore that in a code path like below, pmd_trans_huge can be false, but pmd_none_or_clear_bad can run into a hugepmd. The overhead of a barrier() is just a compiler tweak and should not be measurable (I only added it for THP builds). I don't exclude different compiler versions may have prevented the race too by caching the value of *pmd on the stack (that hasn't been verified, but it wouldn't be impossible considering pmd_none_or_clear_bad, pmd_bad, pmd_trans_huge, pmd_none are all inlines and there's no external function called in between pmd_trans_huge and pmd_none_or_clear_bad). if (pmd_trans_huge(*pmd)) { if (next-addr != HPAGE_PMD_SIZE) { VM_BUG_ON(!rwsem_is_locked(&tlb->mm->mmap_sem)); split_huge_page_pmd(vma->vm_mm, pmd); } else if (zap_huge_pmd(tlb, vma, pmd, addr)) continue; /* fall through */ } if (pmd_none_or_clear_bad(pmd)) Because this race condition could be exercised without special privileges this was reported in CVE-2012-1179. The race was identified and fully explained by Ulrich who debugged it. I'm quoting his accurate explanation below, for reference. ====== start quote ======= mapcount 0 page_mapcount 1 kernel BUG at mm/huge_memory.c:1384! At some point prior to the panic, a "bad pmd ..." message similar to the following is logged on the console: mm/memory.c:145: bad pmd ffff8800376e1f98(80000000314000e7). The "bad pmd ..." message is logged by pmd_clear_bad() before it clears the page's PMD table entry. 143 void pmd_clear_bad(pmd_t *pmd) 144 { -> 145 pmd_ERROR(*pmd); 146 pmd_clear(pmd); 147 } After the PMD table entry has been cleared, there is an inconsistency between the actual number of PMD table entries that are mapping the page and the page's map count (_mapcount field in struct page). When the page is subsequently reclaimed, __split_huge_page() detects this inconsistency. 1381 if (mapcount != page_mapcount(page)) 1382 printk(KERN_ERR "mapcount %d page_mapcount %d\n", 1383 mapcount, page_mapcount(page)); -> 1384 BUG_ON(mapcount != page_mapcount(page)); The root cause of the problem is a race of two threads in a multithreaded process. Thread B incurs a page fault on a virtual address that has never been accessed (PMD entry is zero) while Thread A is executing an madvise() system call on a virtual address within the same 2 MB (huge page) range. virtual address space .---------------------. | | | | .-|---------------------| | | | | | |<-- B(fault) | | | 2 MB | |/////////////////////|-. huge < |/////////////////////| > A(range) page | |/////////////////////|-' | | | | | | '-|---------------------| | | | | '---------------------' - Thread A is executing an madvise(..., MADV_DONTNEED) system call on the virtual address range "A(range)" shown in the picture. sys_madvise // Acquire the semaphore in shared mode. down_read(&current->mm->mmap_sem) ... madvise_vma switch (behavior) case MADV_DONTNEED: madvise_dontneed zap_page_range unmap_vmas unmap_page_range zap_pud_range zap_pmd_range // // Assume that this huge page has never been accessed. // I.e. content of the PMD entry is zero (not mapped). // if (pmd_trans_huge(*pmd)) { // We don't get here due to the above assumption. } // // Assume that Thread B incurred a page fault and .---------> // sneaks in here as shown below. | // | if (pmd_none_or_clear_bad(pmd)) | { | if (unlikely(pmd_bad(*pmd))) | pmd_clear_bad | { | pmd_ERROR | // Log "bad pmd ..." message here. | pmd_clear | // Clear the page's PMD entry. | // Thread B incremented the map count | // in page_add_new_anon_rmap(), but | // now the page is no longer mapped | // by a PMD entry (-> inconsistency). | } | } | v - Thread B is handling a page fault on virtual address "B(fault)" shown in the picture. ... do_page_fault __do_page_fault // Acquire the semaphore in shared mode. down_read_trylock(&mm->mmap_sem) ... handle_mm_fault if (pmd_none(*pmd) && transparent_hugepage_enabled(vma)) // We get here due to the above assumption (PMD entry is zero). do_huge_pmd_anonymous_page alloc_hugepage_vma // Allocate a new transparent huge page here. ... __do_huge_pmd_anonymous_page ... spin_lock(&mm->page_table_lock) ... page_add_new_anon_rmap // Here we increment the page's map count (starts at -1). atomic_set(&page->_mapcount, 0) set_pmd_at // Here we set the page's PMD entry which will be cleared // when Thread A calls pmd_clear_bad(). ... spin_unlock(&mm->page_table_lock) The mmap_sem does not prevent the race because both threads are acquiring it in shared mode (down_read). Thread B holds the page_table_lock while the page's map count and PMD table entry are updated. However, Thread A does not synchronize on that lock. ====== end quote ======= [[email protected]: checkpatch fixes] Reported-by: Ulrich Obergfell <[email protected]> Signed-off-by: Andrea Arcangeli <[email protected]> Acked-by: Johannes Weiner <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Dave Jones <[email protected]> Acked-by: Larry Woodman <[email protected]> Acked-by: Rik van Riel <[email protected]> Cc: Mark Salter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
static inline void set_vflags_long(unsigned long flags, struct kernel_vm86_regs *regs) { set_flags(VEFLAGS, flags, current->thread.v86mask); set_flags(regs->pt.flags, flags, SAFE_MASK); if (flags & X86_EFLAGS_IF) set_IF(regs); else clear_IF(regs); }
static inline void set_vflags_long(unsigned long flags, struct kernel_vm86_regs *regs) { set_flags(VEFLAGS, flags, current->thread.v86mask); set_flags(regs->pt.flags, flags, SAFE_MASK); if (flags & X86_EFLAGS_IF) set_IF(regs); else clear_IF(regs); }
C
linux
0