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
null
null
null
https://github.com/chromium/chromium/commit/44a637b47793512bfb1d2589d43b8dc492a97629
44a637b47793512bfb1d2589d43b8dc492a97629
Desist libxml from continuing the parse after a SAX callback has stopped the parse. Attempt 2 -- now with less compile fail on Mac / Clang. BUG=95465 TBR=cdn TEST=covered by existing tests under ASAN Review URL: http://codereview.chromium.org/7892003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100953 0039d316-1c4b-4281-b951-d872f2087c98
xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { int len = 0, l; int c; int count = 0; #ifdef DEBUG nbParseNCNameComplex++; #endif /* * Handler for more complex cases */ GROW; c = CUR_CHAR(l); if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ (!xmlIsNameStartChar(ctxt, c) || (c == ':'))) { return(NULL); } while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ (xmlIsNameChar(ctxt, c) && (c != ':'))) { if (count++ > 100) { count = 0; GROW; } len += l; NEXTL(l); c = CUR_CHAR(l); } return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); }
xmlParseNCNameComplex(xmlParserCtxtPtr ctxt) { int len = 0, l; int c; int count = 0; #ifdef DEBUG nbParseNCNameComplex++; #endif /* * Handler for more complex cases */ GROW; c = CUR_CHAR(l); if ((c == ' ') || (c == '>') || (c == '/') || /* accelerators */ (!xmlIsNameStartChar(ctxt, c) || (c == ':'))) { return(NULL); } while ((c != ' ') && (c != '>') && (c != '/') && /* test bigname.xml */ (xmlIsNameChar(ctxt, c) && (c != ':'))) { if (count++ > 100) { count = 0; GROW; } len += l; NEXTL(l); c = CUR_CHAR(l); } return(xmlDictLookup(ctxt->dict, ctxt->input->cur - len, len)); }
C
Chrome
0
CVE-2018-11376
https://www.cvedetails.com/cve/CVE-2018-11376/
CWE-125
https://github.com/radare/radare2/commit/1f37c04f2a762500222dda2459e6a04646feeedf
1f37c04f2a762500222dda2459e6a04646feeedf
Fix #9904 - crash in r2_hoobr_r_read_le32 (over 9000 entrypoints) and read_le oobread (#9923)
static RBinReloc *reloc_convert(struct Elf_(r_bin_elf_obj_t) *bin, RBinElfReloc *rel, ut64 GOT) { RBinReloc *r = NULL; ut64 B, P; if (!bin || !rel) { return NULL; } B = bin->baddr; P = rel->rva; // rva has taken baddr into account if (!(r = R_NEW0 (RBinReloc))) { return r; } r->import = NULL; r->symbol = NULL; r->is_ifunc = false; r->addend = rel->addend; if (rel->sym) { if (rel->sym < bin->imports_by_ord_size && bin->imports_by_ord[rel->sym]) { r->import = bin->imports_by_ord[rel->sym]; } else if (rel->sym < bin->symbols_by_ord_size && bin->symbols_by_ord[rel->sym]) { r->symbol = bin->symbols_by_ord[rel->sym]; } } r->vaddr = rel->rva; r->paddr = rel->offset; #define SET(T) r->type = R_BIN_RELOC_ ## T; r->additive = 0; return r #define ADD(T, A) r->type = R_BIN_RELOC_ ## T; r->addend += A; r->additive = !rel->is_rela; return r switch (bin->ehdr.e_machine) { case EM_386: switch (rel->type) { case R_386_NONE: break; // malloc then free. meh. then again, there's no real world use for _NONE. case R_386_32: ADD(32, 0); case R_386_PC32: ADD(32,-P); case R_386_GLOB_DAT: SET(32); case R_386_JMP_SLOT: SET(32); case R_386_RELATIVE: ADD(32, B); case R_386_GOTOFF: ADD(32,-GOT); case R_386_GOTPC: ADD(32, GOT-P); case R_386_16: ADD(16, 0); case R_386_PC16: ADD(16,-P); case R_386_8: ADD(8, 0); case R_386_PC8: ADD(8, -P); case R_386_COPY: ADD(64, 0); // XXX: copy symbol at runtime case R_386_IRELATIVE: r->is_ifunc = true; SET(32); default: break; //eprintf("TODO(eddyb): uninmplemented ELF/x86 reloc type %i\n", rel->type); } break; case EM_X86_64: switch (rel->type) { case R_X86_64_NONE: break; // malloc then free. meh. then again, there's no real world use for _NONE. case R_X86_64_64: ADD(64, 0); case R_X86_64_PLT32: ADD(32,-P /* +L */); case R_X86_64_GOT32: ADD(32, GOT); case R_X86_64_PC32: ADD(32,-P); case R_X86_64_GLOB_DAT: r->vaddr -= rel->sto; SET(64); case R_X86_64_JUMP_SLOT: r->vaddr -= rel->sto; SET(64); case R_X86_64_RELATIVE: ADD(64, B); case R_X86_64_32: ADD(32, 0); case R_X86_64_32S: ADD(32, 0); case R_X86_64_16: ADD(16, 0); case R_X86_64_PC16: ADD(16,-P); case R_X86_64_8: ADD(8, 0); case R_X86_64_PC8: ADD(8, -P); case R_X86_64_GOTPCREL: ADD(64, GOT-P); case R_X86_64_COPY: ADD(64, 0); // XXX: copy symbol at runtime case R_X86_64_IRELATIVE: r->is_ifunc = true; SET(64); default: break; ////eprintf("TODO(eddyb): uninmplemented ELF/x64 reloc type %i\n", rel->type); } break; case EM_ARM: switch (rel->type) { case R_ARM_NONE: break; // malloc then free. meh. then again, there's no real world use for _NONE. case R_ARM_ABS32: ADD(32, 0); case R_ARM_REL32: ADD(32,-P); case R_ARM_ABS16: ADD(16, 0); case R_ARM_ABS8: ADD(8, 0); case R_ARM_SBREL32: ADD(32, -B); case R_ARM_GLOB_DAT: ADD(32, 0); case R_ARM_JUMP_SLOT: ADD(32, 0); case R_ARM_RELATIVE: ADD(32, B); case R_ARM_GOTOFF: ADD(32,-GOT); default: ADD(32,GOT); break; // reg relocations } break; default: break; } #undef SET #undef ADD free(r); return 0; }
static RBinReloc *reloc_convert(struct Elf_(r_bin_elf_obj_t) *bin, RBinElfReloc *rel, ut64 GOT) { RBinReloc *r = NULL; ut64 B, P; if (!bin || !rel) { return NULL; } B = bin->baddr; P = rel->rva; // rva has taken baddr into account if (!(r = R_NEW0 (RBinReloc))) { return r; } r->import = NULL; r->symbol = NULL; r->is_ifunc = false; r->addend = rel->addend; if (rel->sym) { if (rel->sym < bin->imports_by_ord_size && bin->imports_by_ord[rel->sym]) { r->import = bin->imports_by_ord[rel->sym]; } else if (rel->sym < bin->symbols_by_ord_size && bin->symbols_by_ord[rel->sym]) { r->symbol = bin->symbols_by_ord[rel->sym]; } } r->vaddr = rel->rva; r->paddr = rel->offset; #define SET(T) r->type = R_BIN_RELOC_ ## T; r->additive = 0; return r #define ADD(T, A) r->type = R_BIN_RELOC_ ## T; r->addend += A; r->additive = !rel->is_rela; return r switch (bin->ehdr.e_machine) { case EM_386: switch (rel->type) { case R_386_NONE: break; // malloc then free. meh. then again, there's no real world use for _NONE. case R_386_32: ADD(32, 0); case R_386_PC32: ADD(32,-P); case R_386_GLOB_DAT: SET(32); case R_386_JMP_SLOT: SET(32); case R_386_RELATIVE: ADD(32, B); case R_386_GOTOFF: ADD(32,-GOT); case R_386_GOTPC: ADD(32, GOT-P); case R_386_16: ADD(16, 0); case R_386_PC16: ADD(16,-P); case R_386_8: ADD(8, 0); case R_386_PC8: ADD(8, -P); case R_386_COPY: ADD(64, 0); // XXX: copy symbol at runtime case R_386_IRELATIVE: r->is_ifunc = true; SET(32); default: break; //eprintf("TODO(eddyb): uninmplemented ELF/x86 reloc type %i\n", rel->type); } break; case EM_X86_64: switch (rel->type) { case R_X86_64_NONE: break; // malloc then free. meh. then again, there's no real world use for _NONE. case R_X86_64_64: ADD(64, 0); case R_X86_64_PLT32: ADD(32,-P /* +L */); case R_X86_64_GOT32: ADD(32, GOT); case R_X86_64_PC32: ADD(32,-P); case R_X86_64_GLOB_DAT: r->vaddr -= rel->sto; SET(64); case R_X86_64_JUMP_SLOT: r->vaddr -= rel->sto; SET(64); case R_X86_64_RELATIVE: ADD(64, B); case R_X86_64_32: ADD(32, 0); case R_X86_64_32S: ADD(32, 0); case R_X86_64_16: ADD(16, 0); case R_X86_64_PC16: ADD(16,-P); case R_X86_64_8: ADD(8, 0); case R_X86_64_PC8: ADD(8, -P); case R_X86_64_GOTPCREL: ADD(64, GOT-P); case R_X86_64_COPY: ADD(64, 0); // XXX: copy symbol at runtime case R_X86_64_IRELATIVE: r->is_ifunc = true; SET(64); default: break; ////eprintf("TODO(eddyb): uninmplemented ELF/x64 reloc type %i\n", rel->type); } break; case EM_ARM: switch (rel->type) { case R_ARM_NONE: break; // malloc then free. meh. then again, there's no real world use for _NONE. case R_ARM_ABS32: ADD(32, 0); case R_ARM_REL32: ADD(32,-P); case R_ARM_ABS16: ADD(16, 0); case R_ARM_ABS8: ADD(8, 0); case R_ARM_SBREL32: ADD(32, -B); case R_ARM_GLOB_DAT: ADD(32, 0); case R_ARM_JUMP_SLOT: ADD(32, 0); case R_ARM_RELATIVE: ADD(32, B); case R_ARM_GOTOFF: ADD(32,-GOT); default: ADD(32,GOT); break; // reg relocations } break; default: break; } #undef SET #undef ADD free(r); return 0; }
C
radare2
0
null
null
null
https://github.com/chromium/chromium/commit/d1a59e4e845a01d7d7b80ef184b672752a9eae4d
d1a59e4e845a01d7d7b80ef184b672752a9eae4d
Fixing cross-process postMessage replies on more than two iterations. When two frames are replying to each other using event.source across processes, after the first two replies, things break down. The root cause is that in RenderViewImpl::GetFrameByMappedID, the lookup was incorrect. It is now properly searching for the remote frame id and returning the local one. BUG=153445 Review URL: https://chromiumcodereview.appspot.com/11040015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159924 0039d316-1c4b-4281-b951-d872f2087c98
WebCookieJar* RenderViewImpl::cookieJar(WebFrame* frame) { return &cookie_jar_; }
WebCookieJar* RenderViewImpl::cookieJar(WebFrame* frame) { return &cookie_jar_; }
C
Chrome
0
CVE-2013-2870
https://www.cvedetails.com/cve/CVE-2013-2870/
CWE-399
https://github.com/chromium/chromium/commit/ca8cc70b2de822b939f87effc7c2b83bac280a44
ca8cc70b2de822b939f87effc7c2b83bac280a44
Revert a workaround commit for a Use-After-Free crash. Revert a workaround commit r20158 for a Use-After-Free issue (http://crbug.com/244746) because a cleaner CL r207218 is landed. URLRequestContext does not inherit SupportsWeakPtr now. R=mmenke BUG=244746 Review URL: https://chromiumcodereview.appspot.com/16870008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207811 0039d316-1c4b-4281-b951-d872f2087c98
int SocketStream::DoResolveProtocol(int result) { DCHECK_EQ(OK, result); if (!delegate_) { next_state_ = STATE_CLOSE; return result; } next_state_ = STATE_RESOLVE_PROTOCOL_COMPLETE; result = delegate_->OnStartOpenConnection(this, io_callback_); if (result == ERR_IO_PENDING) metrics_->OnWaitConnection(); else if (result != OK && result != ERR_PROTOCOL_SWITCHED) next_state_ = STATE_CLOSE; return result; }
int SocketStream::DoResolveProtocol(int result) { DCHECK_EQ(OK, result); if (!delegate_) { next_state_ = STATE_CLOSE; return result; } next_state_ = STATE_RESOLVE_PROTOCOL_COMPLETE; result = delegate_->OnStartOpenConnection(this, io_callback_); if (result == ERR_IO_PENDING) metrics_->OnWaitConnection(); else if (result != OK && result != ERR_PROTOCOL_SWITCHED) next_state_ = STATE_CLOSE; return result; }
C
Chrome
0
CVE-2015-3183
https://www.cvedetails.com/cve/CVE-2015-3183/
CWE-20
https://github.com/apache/httpd/commit/e427c41257957b57036d5a549b260b6185d1dd73
e427c41257957b57036d5a549b260b6185d1dd73
Limit accepted chunk-size to 2^63-1 and be strict about chunk-ext authorized characters. Submitted by: Yann Ylavic git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1684513 13f79535-47bb-0310-9956-ffa450edef68
static int check_header(void *arg, const char *name, const char *val) { struct check_header_ctx *ctx = arg; if (name[0] == '\0') { ctx->error = 1; ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r, APLOGNO(02428) "Empty response header name, aborting request"); return 0; } if (ap_has_cntrl(name)) { ctx->error = 1; ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r, APLOGNO(02429) "Response header name '%s' contains control " "characters, aborting request", name); return 0; } if (ap_has_cntrl(val)) { ctx->error = 1; ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r, APLOGNO(02430) "Response header '%s' contains control characters, " "aborting request: %s", name, val); return 0; } return 1; }
static int check_header(void *arg, const char *name, const char *val) { struct check_header_ctx *ctx = arg; if (name[0] == '\0') { ctx->error = 1; ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r, APLOGNO(02428) "Empty response header name, aborting request"); return 0; } if (ap_has_cntrl(name)) { ctx->error = 1; ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r, APLOGNO(02429) "Response header name '%s' contains control " "characters, aborting request", name); return 0; } if (ap_has_cntrl(val)) { ctx->error = 1; ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, ctx->r, APLOGNO(02430) "Response header '%s' contains control characters, " "aborting request: %s", name, val); return 0; } return 1; }
C
httpd
0
CVE-2018-14358
https://www.cvedetails.com/cve/CVE-2018-14358/
CWE-119
https://github.com/neomutt/neomutt/commit/1b0f0d0988e6df4e32e9f4bf8780846ea95d4485
1b0f0d0988e6df4e32e9f4bf8780846ea95d4485
Don't overflow stack buffer in msg_parse_fetch
static int msg_parse_fetch(struct ImapHeader *h, char *s) { char tmp[SHORT_STRING]; char *ptmp = NULL; if (!s) return -1; while (*s) { SKIPWS(s); if (mutt_str_strncasecmp("FLAGS", s, 5) == 0) { s = msg_parse_flags(h, s); if (!s) return -1; } else if (mutt_str_strncasecmp("UID", s, 3) == 0) { s += 3; SKIPWS(s); if (mutt_str_atoui(s, &h->data->uid) < 0) return -1; s = imap_next_word(s); } else if (mutt_str_strncasecmp("INTERNALDATE", s, 12) == 0) { s += 12; SKIPWS(s); if (*s != '\"') { mutt_debug(1, "bogus INTERNALDATE entry: %s\n", s); return -1; } s++; ptmp = tmp; while (*s && (*s != '\"') && (ptmp != (tmp + sizeof(tmp) - 1))) *ptmp++ = *s++; if (*s != '\"') return -1; s++; /* skip past the trailing " */ *ptmp = '\0'; h->received = mutt_date_parse_imap(tmp); } else if (mutt_str_strncasecmp("RFC822.SIZE", s, 11) == 0) { s += 11; SKIPWS(s); ptmp = tmp; while (isdigit((unsigned char) *s) && (ptmp != (tmp + sizeof(tmp) - 1))) *ptmp++ = *s++; *ptmp = '\0'; if (mutt_str_atol(tmp, &h->content_length) < 0) return -1; } else if ((mutt_str_strncasecmp("BODY", s, 4) == 0) || (mutt_str_strncasecmp("RFC822.HEADER", s, 13) == 0)) { /* handle above, in msg_fetch_header */ return -2; } else if (*s == ')') s++; /* end of request */ else if (*s) { /* got something i don't understand */ imap_error("msg_parse_fetch", s); return -1; } } return 0; }
static int msg_parse_fetch(struct ImapHeader *h, char *s) { char tmp[SHORT_STRING]; char *ptmp = NULL; if (!s) return -1; while (*s) { SKIPWS(s); if (mutt_str_strncasecmp("FLAGS", s, 5) == 0) { s = msg_parse_flags(h, s); if (!s) return -1; } else if (mutt_str_strncasecmp("UID", s, 3) == 0) { s += 3; SKIPWS(s); if (mutt_str_atoui(s, &h->data->uid) < 0) return -1; s = imap_next_word(s); } else if (mutt_str_strncasecmp("INTERNALDATE", s, 12) == 0) { s += 12; SKIPWS(s); if (*s != '\"') { mutt_debug(1, "bogus INTERNALDATE entry: %s\n", s); return -1; } s++; ptmp = tmp; while (*s && *s != '\"') *ptmp++ = *s++; if (*s != '\"') return -1; s++; /* skip past the trailing " */ *ptmp = '\0'; h->received = mutt_date_parse_imap(tmp); } else if (mutt_str_strncasecmp("RFC822.SIZE", s, 11) == 0) { s += 11; SKIPWS(s); ptmp = tmp; while (isdigit((unsigned char) *s)) *ptmp++ = *s++; *ptmp = '\0'; if (mutt_str_atol(tmp, &h->content_length) < 0) return -1; } else if ((mutt_str_strncasecmp("BODY", s, 4) == 0) || (mutt_str_strncasecmp("RFC822.HEADER", s, 13) == 0)) { /* handle above, in msg_fetch_header */ return -2; } else if (*s == ')') s++; /* end of request */ else if (*s) { /* got something i don't understand */ imap_error("msg_parse_fetch", s); return -1; } } return 0; }
C
neomutt
1
CVE-2019-14463
https://www.cvedetails.com/cve/CVE-2019-14463/
CWE-125
https://github.com/stephane/libmodbus/commit/5ccdf5ef79d742640355d1132fa9e2abc7fbaefc
5ccdf5ef79d742640355d1132fa9e2abc7fbaefc
Fix VD-1301 and VD-1302 vulnerabilities This patch was contributed by Maor Vermucht and Or Peles from VDOO Connected Trust.
void modbus_close(modbus_t *ctx) { if (ctx == NULL) return; ctx->backend->close(ctx); }
void modbus_close(modbus_t *ctx) { if (ctx == NULL) return; ctx->backend->close(ctx); }
C
libmodbus
0
CVE-2016-5768
https://www.cvedetails.com/cve/CVE-2016-5768/
CWE-415
https://github.com/php/php-src/commit/5b597a2e5b28e2d5a52fc1be13f425f08f47cb62?w=1
5b597a2e5b28e2d5a52fc1be13f425f08f47cb62?w=1
Fix bug #72402: _php_mb_regex_ereg_replace_exec - double free
PHP_FUNCTION(mb_ereg_search_getpos) { RETVAL_LONG(MBREX(search_pos)); }
PHP_FUNCTION(mb_ereg_search_getpos) { RETVAL_LONG(MBREX(search_pos)); }
C
php-src
0
CVE-2013-7281
https://www.cvedetails.com/cve/CVE-2013-7281/
CWE-200
https://github.com/torvalds/linux/commit/bceaa90240b6019ed73b49965eac7d167610be69
bceaa90240b6019ed73b49965eac7d167610be69
inet: prevent leakage of uninitialized memory to user in recv syscalls Only update *addr_len when we actually fill in sockaddr, otherwise we can return uninitialized memory from the stack to the caller in the recvfrom, recvmmsg and recvmsg syscalls. Drop the the (addr_len == NULL) checks because we only get called with a valid addr_len pointer either from sock_common_recvmsg or inet_recvmsg. If a blocking read waits on a socket which is concurrently shut down we now return zero and set msg_msgnamelen to 0. Reported-by: mpb <[email protected]> Suggested-by: Eric Dumazet <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int do_rawv6_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen) { struct raw6_sock *rp = raw6_sk(sk); int val; if (get_user(val, (int __user *)optval)) return -EFAULT; switch (optname) { case IPV6_CHECKSUM: if (inet_sk(sk)->inet_num == IPPROTO_ICMPV6 && level == IPPROTO_IPV6) { /* * RFC3542 tells that IPV6_CHECKSUM socket * option in the IPPROTO_IPV6 level is not * allowed on ICMPv6 sockets. * If you want to set it, use IPPROTO_RAW * level IPV6_CHECKSUM socket option * (Linux extension). */ return -EINVAL; } /* You may get strange result with a positive odd offset; RFC2292bis agrees with me. */ if (val > 0 && (val&1)) return -EINVAL; if (val < 0) { rp->checksum = 0; } else { rp->checksum = 1; rp->offset = val; } return 0; default: return -ENOPROTOOPT; } }
static int do_rawv6_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen) { struct raw6_sock *rp = raw6_sk(sk); int val; if (get_user(val, (int __user *)optval)) return -EFAULT; switch (optname) { case IPV6_CHECKSUM: if (inet_sk(sk)->inet_num == IPPROTO_ICMPV6 && level == IPPROTO_IPV6) { /* * RFC3542 tells that IPV6_CHECKSUM socket * option in the IPPROTO_IPV6 level is not * allowed on ICMPv6 sockets. * If you want to set it, use IPPROTO_RAW * level IPV6_CHECKSUM socket option * (Linux extension). */ return -EINVAL; } /* You may get strange result with a positive odd offset; RFC2292bis agrees with me. */ if (val > 0 && (val&1)) return -EINVAL; if (val < 0) { rp->checksum = 0; } else { rp->checksum = 1; rp->offset = val; } return 0; default: return -ENOPROTOOPT; } }
C
linux
0
CVE-2019-14763
https://www.cvedetails.com/cve/CVE-2019-14763/
CWE-189
https://github.com/torvalds/linux/commit/c91815b596245fd7da349ecc43c8def670d2269e
c91815b596245fd7da349ecc43c8def670d2269e
usb: dwc3: gadget: never call ->complete() from ->ep_queue() This is a requirement which has always existed but, somehow, wasn't reflected in the documentation and problems weren't found until now when Tuba Yavuz found a possible deadlock happening between dwc3 and f_hid. She described the situation as follows: spin_lock_irqsave(&hidg->write_spinlock, flags); // first acquire /* we our function has been disabled by host */ if (!hidg->req) { free_ep_req(hidg->in_ep, hidg->req); goto try_again; } [...] status = usb_ep_queue(hidg->in_ep, hidg->req, GFP_ATOMIC); => [...] => usb_gadget_giveback_request => f_hidg_req_complete => spin_lock_irqsave(&hidg->write_spinlock, flags); // second acquire Note that this happens because dwc3 would call ->complete() on a failed usb_ep_queue() due to failed Start Transfer command. This is, anyway, a theoretical situation because dwc3 currently uses "No Response Update Transfer" command for Bulk and Interrupt endpoints. It's still good to make this case impossible to happen even if the "No Reponse Update Transfer" command is changed. Reported-by: Tuba Yavuz <[email protected]> Signed-off-by: Felipe Balbi <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
static dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep, struct dwc3_trb *trb) { u32 offset = (char *) trb - (char *) dep->trb_pool; return dep->trb_pool_dma + offset; }
static dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep, struct dwc3_trb *trb) { u32 offset = (char *) trb - (char *) dep->trb_pool; return dep->trb_pool_dma + offset; }
C
linux
0
CVE-2014-3508
https://www.cvedetails.com/cve/CVE-2014-3508/
CWE-200
https://git.openssl.org/gitweb/?p=openssl.git;a=commit;h=0042fb5fd1c9d257d713b15a1f45da05cf5c1c87
0042fb5fd1c9d257d713b15a1f45da05cf5c1c87
null
static int sn_cmp(const ASN1_OBJECT * const *a, const unsigned int *b) { return(strcmp((*a)->sn,nid_objs[*b].sn)); }
static int sn_cmp(const ASN1_OBJECT * const *a, const unsigned int *b) { return(strcmp((*a)->sn,nid_objs[*b].sn)); }
C
openssl
0
CVE-2018-14354
https://www.cvedetails.com/cve/CVE-2018-14354/
CWE-77
https://github.com/neomutt/neomutt/commit/95e80bf9ff10f68cb6443f760b85df4117cb15eb
95e80bf9ff10f68cb6443f760b85df4117cb15eb
Quote path in imap_subscribe
int imap_subscribe(char *path, bool subscribe) { struct ImapData *idata = NULL; char buf[LONG_STRING]; char mbox[LONG_STRING]; char errstr[STRING]; struct Buffer err, token; struct ImapMbox mx; size_t len = 0; if (!mx_is_imap(path) || imap_parse_path(path, &mx) || !mx.mbox) { mutt_error(_("Bad mailbox name")); return -1; } idata = imap_conn_find(&(mx.account), 0); if (!idata) goto fail; imap_fix_path(idata, mx.mbox, buf, sizeof(buf)); if (!*buf) mutt_str_strfcpy(buf, "INBOX", sizeof(buf)); if (ImapCheckSubscribed) { mutt_buffer_init(&token); mutt_buffer_init(&err); err.data = errstr; err.dsize = sizeof(errstr); len = snprintf(mbox, sizeof(mbox), "%smailboxes ", subscribe ? "" : "un"); imap_quote_string(mbox + len, sizeof(mbox) - len, path, true); if (mutt_parse_rc_line(mbox, &token, &err)) mutt_debug(1, "Error adding subscribed mailbox: %s\n", errstr); FREE(&token.data); } if (subscribe) mutt_message(_("Subscribing to %s..."), buf); else mutt_message(_("Unsubscribing from %s..."), buf); imap_munge_mbox_name(idata, mbox, sizeof(mbox), buf); snprintf(buf, sizeof(buf), "%sSUBSCRIBE %s", subscribe ? "" : "UN", mbox); if (imap_exec(idata, buf, 0) < 0) goto fail; imap_unmunge_mbox_name(idata, mx.mbox); if (subscribe) mutt_message(_("Subscribed to %s"), mx.mbox); else mutt_message(_("Unsubscribed from %s"), mx.mbox); FREE(&mx.mbox); return 0; fail: FREE(&mx.mbox); return -1; }
int imap_subscribe(char *path, bool subscribe) { struct ImapData *idata = NULL; char buf[LONG_STRING]; char mbox[LONG_STRING]; char errstr[STRING]; struct Buffer err, token; struct ImapMbox mx; if (!mx_is_imap(path) || imap_parse_path(path, &mx) || !mx.mbox) { mutt_error(_("Bad mailbox name")); return -1; } idata = imap_conn_find(&(mx.account), 0); if (!idata) goto fail; imap_fix_path(idata, mx.mbox, buf, sizeof(buf)); if (!*buf) mutt_str_strfcpy(buf, "INBOX", sizeof(buf)); if (ImapCheckSubscribed) { mutt_buffer_init(&token); mutt_buffer_init(&err); err.data = errstr; err.dsize = sizeof(errstr); snprintf(mbox, sizeof(mbox), "%smailboxes \"%s\"", subscribe ? "" : "un", path); if (mutt_parse_rc_line(mbox, &token, &err)) mutt_debug(1, "Error adding subscribed mailbox: %s\n", errstr); FREE(&token.data); } if (subscribe) mutt_message(_("Subscribing to %s..."), buf); else mutt_message(_("Unsubscribing from %s..."), buf); imap_munge_mbox_name(idata, mbox, sizeof(mbox), buf); snprintf(buf, sizeof(buf), "%sSUBSCRIBE %s", subscribe ? "" : "UN", mbox); if (imap_exec(idata, buf, 0) < 0) goto fail; imap_unmunge_mbox_name(idata, mx.mbox); if (subscribe) mutt_message(_("Subscribed to %s"), mx.mbox); else mutt_message(_("Unsubscribed from %s"), mx.mbox); FREE(&mx.mbox); return 0; fail: FREE(&mx.mbox); return -1; }
C
neomutt
1
CVE-2014-1743
https://www.cvedetails.com/cve/CVE-2014-1743/
CWE-399
https://github.com/chromium/chromium/commit/6d9425ec7badda912555d46ea7abcfab81fdd9b9
6d9425ec7badda912555d46ea7abcfab81fdd9b9
sync compositor: pass simple gfx types by const ref See bug for reasoning BUG=159273 Review URL: https://codereview.chromium.org/1417893006 Cr-Commit-Position: refs/heads/master@{#356653}
void BrowserViewRenderer::CalculateTileMemoryPolicy() { base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); bool client_hard_limit_bytes_overridden = cl->HasSwitch(switches::kForceGpuMemAvailableMb); if (client_hard_limit_bytes_overridden) { base::StringToUint64( base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kForceGpuMemAvailableMb), &g_memory_override_in_bytes); g_memory_override_in_bytes *= 1024 * 1024; } }
void BrowserViewRenderer::CalculateTileMemoryPolicy() { base::CommandLine* cl = base::CommandLine::ForCurrentProcess(); bool client_hard_limit_bytes_overridden = cl->HasSwitch(switches::kForceGpuMemAvailableMb); if (client_hard_limit_bytes_overridden) { base::StringToUint64( base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kForceGpuMemAvailableMb), &g_memory_override_in_bytes); g_memory_override_in_bytes *= 1024 * 1024; } }
C
Chrome
0
CVE-2015-6763
https://www.cvedetails.com/cve/CVE-2015-6763/
null
https://github.com/chromium/chromium/commit/f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
MacViews: Enable secure text input for password Textfields. In Cocoa the NSTextInputContext automatically enables secure text input when activated and it's in the secure text entry mode. RenderWidgetHostViewMac did the similar thing for ages following the WebKit example. views::Textfield needs to do the same thing in a fashion that's sycnrhonized with RenderWidgetHostViewMac, otherwise the race conditions are possible when the Textfield gets focus, activates the secure text input mode and the RWHVM loses focus immediately afterwards and disables the secure text input instead of leaving it in the enabled state. BUG=818133,677220 Change-Id: I6db6c4b59e4a1a72cbb7f8c7056f71b04a3df08b Reviewed-on: https://chromium-review.googlesource.com/943064 Commit-Queue: Michail Pishchagin <[email protected]> Reviewed-by: Pavel Feldman <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Reviewed-by: Peter Kasting <[email protected]> Cr-Commit-Position: refs/heads/master@{#542517}
bool Textfield::ShouldBlinkCursor() const { return ShouldShowCursor() && !Textfield::GetCaretBlinkInterval().is_zero(); }
bool Textfield::ShouldBlinkCursor() const { return ShouldShowCursor() && !Textfield::GetCaretBlinkInterval().is_zero(); }
C
Chrome
0
CVE-2011-2799
https://www.cvedetails.com/cve/CVE-2011-2799/
CWE-399
https://github.com/chromium/chromium/commit/5a2de6455f565783c73e53eae2c8b953e7d48520
5a2de6455f565783c73e53eae2c8b953e7d48520
2011-06-02 Joone Hur <[email protected]> Reviewed by Martin Robinson. [GTK] Only load dictionaries if spell check is enabled https://bugs.webkit.org/show_bug.cgi?id=32879 We don't need to call enchant if enable-spell-checking is false. * webkit/webkitwebview.cpp: (webkit_web_view_update_settings): Skip loading dictionaries when enable-spell-checking is false. (webkit_web_view_settings_notify): Ditto. git-svn-id: svn://svn.chromium.org/blink/trunk@87925 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static void webkit_web_view_drag_leave(GtkWidget* widget, GdkDragContext* context, guint time) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; if (!priv->droppingContexts.contains(context)) return; g_timeout_add(0, reinterpret_cast<GSourceFunc>(doDragLeaveLater), priv->droppingContexts.get(context)); }
static void webkit_web_view_drag_leave(GtkWidget* widget, GdkDragContext* context, guint time) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); WebKitWebViewPrivate* priv = webView->priv; if (!priv->droppingContexts.contains(context)) return; g_timeout_add(0, reinterpret_cast<GSourceFunc>(doDragLeaveLater), priv->droppingContexts.get(context)); }
C
Chrome
0
CVE-2013-2884
https://www.cvedetails.com/cve/CVE-2013-2884/
CWE-399
https://github.com/chromium/chromium/commit/4ac8bc08e3306f38a5ab3e551aef6ad43753579c
4ac8bc08e3306f38a5ab3e551aef6ad43753579c
Set Attr.ownerDocument in Element#setAttributeNode() Attr objects can move across documents by setAttributeNode(). So It needs to reset ownerDocument through TreeScopeAdoptr::adoptIfNeeded(). BUG=248950 TEST=set-attribute-node-from-iframe.html Review URL: https://chromiumcodereview.appspot.com/17583003 git-svn-id: svn://svn.chromium.org/blink/trunk@152938 bbb929c8-8fbe-4397-9dbb-9b2b20218538
int Element::scrollTop() { document()->updateLayoutIgnorePendingStylesheets(); if (RenderBox* rend = renderBox()) return adjustForAbsoluteZoom(rend->scrollTop(), rend); return 0; }
int Element::scrollTop() { document()->updateLayoutIgnorePendingStylesheets(); if (RenderBox* rend = renderBox()) return adjustForAbsoluteZoom(rend->scrollTop(), rend); return 0; }
C
Chrome
0
CVE-2017-1000198
https://www.cvedetails.com/cve/CVE-2017-1000198/
CWE-119
https://github.com/open-iscsi/tcmu-runner/commit/61bd03e600d2abf309173e9186f4d465bb1b7157
61bd03e600d2abf309173e9186f4d465bb1b7157
glfs: discard glfs_check_config Signed-off-by: Prasanna Kumar Kalever <[email protected]>
static void glfs_async_cbk(glfs_fd_t *fd, ssize_t ret, void *data) { glfs_cbk_cookie *cookie = data; struct tcmu_device *dev = cookie->dev; struct tcmulib_cmd *cmd = cookie->cmd; size_t length = cookie->length; if (ret < 0 || ret != length) { /* Read/write/flush failed */ switch (cookie->op) { case TCMU_GLFS_READ: ret = tcmu_set_sense_data(cmd->sense_buf, MEDIUM_ERROR, ASC_READ_ERROR, NULL); break; case TCMU_GLFS_WRITE: case TCMU_GLFS_FLUSH: ret = tcmu_set_sense_data(cmd->sense_buf, MEDIUM_ERROR, ASC_WRITE_ERROR, NULL); break; } } else { ret = SAM_STAT_GOOD; } cmd->done(dev, cmd, ret); free(cookie); }
static void glfs_async_cbk(glfs_fd_t *fd, ssize_t ret, void *data) { glfs_cbk_cookie *cookie = data; struct tcmu_device *dev = cookie->dev; struct tcmulib_cmd *cmd = cookie->cmd; size_t length = cookie->length; if (ret < 0 || ret != length) { /* Read/write/flush failed */ switch (cookie->op) { case TCMU_GLFS_READ: ret = tcmu_set_sense_data(cmd->sense_buf, MEDIUM_ERROR, ASC_READ_ERROR, NULL); break; case TCMU_GLFS_WRITE: case TCMU_GLFS_FLUSH: ret = tcmu_set_sense_data(cmd->sense_buf, MEDIUM_ERROR, ASC_WRITE_ERROR, NULL); break; } } else { ret = SAM_STAT_GOOD; } cmd->done(dev, cmd, ret); free(cookie); }
C
tcmu-runner
0
CVE-2013-2548
https://www.cvedetails.com/cve/CVE-2013-2548/
CWE-310
https://github.com/torvalds/linux/commit/9a5467bf7b6e9e02ec9c3da4e23747c05faeaac6
9a5467bf7b6e9e02ec9c3da4e23747c05faeaac6
crypto: user - fix info leaks in report API Three errors resulting in kernel memory disclosure: 1/ The structures used for the netlink based crypto algorithm report API are located on the stack. As snprintf() does not fill the remainder of the buffer with null bytes, those stack bytes will be disclosed to users of the API. Switch to strncpy() to fix this. 2/ crypto_report_one() does not initialize all field of struct crypto_user_alg. Fix this to fix the heap info leak. 3/ For the module name we should copy only as many bytes as module_name() returns -- not as much as the destination buffer could hold. But the current code does not and therefore copies random data from behind the end of the module name, as the module name is always shorter than CRYPTO_MAX_ALG_NAME. Also switch to use strncpy() to copy the algorithm's name and driver_name. They are strings, after all. Signed-off-by: Mathias Krause <[email protected]> Cc: Steffen Klassert <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
static int __init crypto_user_init(void) { struct netlink_kernel_cfg cfg = { .input = crypto_netlink_rcv, }; crypto_nlsk = netlink_kernel_create(&init_net, NETLINK_CRYPTO, &cfg); if (!crypto_nlsk) return -ENOMEM; return 0; }
static int __init crypto_user_init(void) { struct netlink_kernel_cfg cfg = { .input = crypto_netlink_rcv, }; crypto_nlsk = netlink_kernel_create(&init_net, NETLINK_CRYPTO, &cfg); if (!crypto_nlsk) return -ENOMEM; return 0; }
C
linux
0
CVE-2017-12897
https://www.cvedetails.com/cve/CVE-2017-12897/
CWE-125
https://github.com/the-tcpdump-group/tcpdump/commit/1dcd10aceabbc03bf571ea32b892c522cbe923de
1dcd10aceabbc03bf571ea32b892c522cbe923de
CVE-2017-12897/ISO CLNS: Use ND_TTEST() for the bounds checks in isoclns_print(). This fixes a buffer over-read discovered by Kamil Frankowicz. Don't pass the remaining caplen - that's too hard to get right, and we were getting it wrong in at least one case; just use ND_TTEST(). Add a test using the capture file supplied by the reporter(s).
atm_print(netdissect_options *ndo, u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length, u_int caplen) { if (ndo->ndo_eflag) ND_PRINT((ndo, "VPI:%u VCI:%u ", vpi, vci)); if (vpi == 0) { switch (vci) { case VCI_PPC: sig_print(ndo, p); return; case VCI_BCC: ND_PRINT((ndo, "broadcast sig: ")); return; case VCI_OAMF4SC: /* fall through */ case VCI_OAMF4EC: oam_print(ndo, p, length, ATM_OAM_HEC); return; case VCI_METAC: ND_PRINT((ndo, "meta: ")); return; case VCI_ILMIC: ND_PRINT((ndo, "ilmi: ")); snmp_print(ndo, p, length); return; } } switch (traftype) { case ATM_LLC: default: /* * Assumes traffic is LLC if unknown. */ atm_llc_print(ndo, p, length, caplen); break; case ATM_LANE: lane_print(ndo, p, length, caplen); break; } }
atm_print(netdissect_options *ndo, u_int vpi, u_int vci, u_int traftype, const u_char *p, u_int length, u_int caplen) { if (ndo->ndo_eflag) ND_PRINT((ndo, "VPI:%u VCI:%u ", vpi, vci)); if (vpi == 0) { switch (vci) { case VCI_PPC: sig_print(ndo, p); return; case VCI_BCC: ND_PRINT((ndo, "broadcast sig: ")); return; case VCI_OAMF4SC: /* fall through */ case VCI_OAMF4EC: oam_print(ndo, p, length, ATM_OAM_HEC); return; case VCI_METAC: ND_PRINT((ndo, "meta: ")); return; case VCI_ILMIC: ND_PRINT((ndo, "ilmi: ")); snmp_print(ndo, p, length); return; } } switch (traftype) { case ATM_LLC: default: /* * Assumes traffic is LLC if unknown. */ atm_llc_print(ndo, p, length, caplen); break; case ATM_LANE: lane_print(ndo, p, length, caplen); break; } }
C
tcpdump
0
CVE-2011-3110
https://www.cvedetails.com/cve/CVE-2011-3110/
CWE-119
https://github.com/chromium/chromium/commit/3c036ca040c114c077e13c35baaea78e2ddbaf61
3c036ca040c114c077e13c35baaea78e2ddbaf61
[chromium] We should accelerate all transformations, except when we must blend matrices that cannot be decomposed. https://bugs.webkit.org/show_bug.cgi?id=95855 Reviewed by James Robinson. Source/Platform: WebTransformOperations are now able to report if they can successfully blend. WebTransformationMatrix::blend now returns a bool if blending would fail. * chromium/public/WebTransformOperations.h: (WebTransformOperations): * chromium/public/WebTransformationMatrix.h: (WebTransformationMatrix): Source/WebCore: WebTransformOperations are now able to report if they can successfully blend. WebTransformationMatrix::blend now returns a bool if blending would fail. Unit tests: AnimationTranslationUtilTest.createTransformAnimationWithNonDecomposableMatrix AnimationTranslationUtilTest.createTransformAnimationWithNonInvertibleTransform * platform/chromium/support/WebTransformOperations.cpp: (WebKit::blendTransformOperations): (WebKit::WebTransformOperations::blend): (WebKit::WebTransformOperations::canBlendWith): (WebKit): (WebKit::WebTransformOperations::blendInternal): * platform/chromium/support/WebTransformationMatrix.cpp: (WebKit::WebTransformationMatrix::blend): * platform/graphics/chromium/AnimationTranslationUtil.cpp: (WebCore::WebTransformAnimationCurve): Source/WebKit/chromium: Added the following unit tests: AnimationTranslationUtilTest.createTransformAnimationWithNonDecomposableMatrix AnimationTranslationUtilTest.createTransformAnimationWithNonInvertibleTransform * tests/AnimationTranslationUtilTest.cpp: (WebKit::TEST): (WebKit): git-svn-id: svn://svn.chromium.org/blink/trunk@127868 bbb929c8-8fbe-4397-9dbb-9b2b20218538
static WebTransformationMatrix blendTransformOperations(const WebTransformOperation* from, const WebTransformOperation* to, double progress) static bool blendTransformOperations(const WebTransformOperation* from, const WebTransformOperation* to, double progress, WebTransformationMatrix& result) { if (isIdentity(from) && isIdentity(to)) return true; WebTransformOperation::Type interpolationType = WebTransformOperation::WebTransformOperationIdentity; if (isIdentity(to)) interpolationType = from->type; else interpolationType = to->type; switch (interpolationType) { case WebTransformOperation::WebTransformOperationTranslate: { double fromX = isIdentity(from) ? 0 : from->translate.x; double fromY = isIdentity(from) ? 0 : from->translate.y; double fromZ = isIdentity(from) ? 0 : from->translate.z; double toX = isIdentity(to) ? 0 : to->translate.x; double toY = isIdentity(to) ? 0 : to->translate.y; double toZ = isIdentity(to) ? 0 : to->translate.z; result.translate3d(blendDoubles(fromX, toX, progress), blendDoubles(fromY, toY, progress), blendDoubles(fromZ, toZ, progress)); break; } case WebTransformOperation::WebTransformOperationRotate: { double axisX = 0; double axisY = 0; double axisZ = 1; double fromAngle = 0; double toAngle = isIdentity(to) ? 0 : to->rotate.angle; if (shareSameAxis(from, to, axisX, axisY, axisZ, fromAngle)) result.rotate3d(axisX, axisY, axisZ, blendDoubles(fromAngle, toAngle, progress)); else { WebTransformationMatrix toMatrix; if (!isIdentity(to)) toMatrix = to->matrix; WebTransformationMatrix fromMatrix; if (!isIdentity(from)) fromMatrix = from->matrix; result = toMatrix; if (!result.blend(fromMatrix, progress)) return false; } break; } case WebTransformOperation::WebTransformOperationScale: { double fromX = isIdentity(from) ? 1 : from->scale.x; double fromY = isIdentity(from) ? 1 : from->scale.y; double fromZ = isIdentity(from) ? 1 : from->scale.z; double toX = isIdentity(to) ? 1 : to->scale.x; double toY = isIdentity(to) ? 1 : to->scale.y; double toZ = isIdentity(to) ? 1 : to->scale.z; result.scale3d(blendDoubles(fromX, toX, progress), blendDoubles(fromY, toY, progress), blendDoubles(fromZ, toZ, progress)); break; } case WebTransformOperation::WebTransformOperationSkew: { double fromX = isIdentity(from) ? 0 : from->skew.x; double fromY = isIdentity(from) ? 0 : from->skew.y; double toX = isIdentity(to) ? 0 : to->skew.x; double toY = isIdentity(to) ? 0 : to->skew.y; result.skewX(blendDoubles(fromX, toX, progress)); result.skewY(blendDoubles(fromY, toY, progress)); break; } case WebTransformOperation::WebTransformOperationPerspective: { double fromPerspectiveDepth = isIdentity(from) ? numeric_limits<double>::max() : from->perspectiveDepth; double toPerspectiveDepth = isIdentity(to) ? numeric_limits<double>::max() : to->perspectiveDepth; result.applyPerspective(blendDoubles(fromPerspectiveDepth, toPerspectiveDepth, progress)); break; } case WebTransformOperation::WebTransformOperationMatrix: { WebTransformationMatrix toMatrix; if (!isIdentity(to)) toMatrix = to->matrix; WebTransformationMatrix fromMatrix; if (!isIdentity(from)) fromMatrix = from->matrix; result = toMatrix; if (!result.blend(fromMatrix, progress)) return false; break; } case WebTransformOperation::WebTransformOperationIdentity: break; } return true; }
static WebTransformationMatrix blendTransformOperations(const WebTransformOperation* from, const WebTransformOperation* to, double progress) { WebTransformationMatrix toReturn; if (isIdentity(from) && isIdentity(to)) return toReturn; WebTransformOperation::Type interpolationType = WebTransformOperation::WebTransformOperationIdentity; if (isIdentity(to)) interpolationType = from->type; else interpolationType = to->type; switch (interpolationType) { case WebTransformOperation::WebTransformOperationTranslate: { double fromX = isIdentity(from) ? 0 : from->translate.x; double fromY = isIdentity(from) ? 0 : from->translate.y; double fromZ = isIdentity(from) ? 0 : from->translate.z; double toX = isIdentity(to) ? 0 : to->translate.x; double toY = isIdentity(to) ? 0 : to->translate.y; double toZ = isIdentity(to) ? 0 : to->translate.z; toReturn.translate3d(blendDoubles(fromX, toX, progress), blendDoubles(fromY, toY, progress), blendDoubles(fromZ, toZ, progress)); break; } case WebTransformOperation::WebTransformOperationRotate: { double axisX = 0; double axisY = 0; double axisZ = 1; double fromAngle = 0; double toAngle = isIdentity(to) ? 0 : to->rotate.angle; if (shareSameAxis(from, to, axisX, axisY, axisZ, fromAngle)) toReturn.rotate3d(axisX, axisY, axisZ, blendDoubles(fromAngle, toAngle, progress)); else { WebTransformationMatrix toMatrix; if (!isIdentity(to)) toMatrix = to->matrix; WebTransformationMatrix fromMatrix; if (!isIdentity(from)) fromMatrix = from->matrix; toReturn = toMatrix; toReturn.blend(fromMatrix, progress); } break; } case WebTransformOperation::WebTransformOperationScale: { double fromX = isIdentity(from) ? 1 : from->scale.x; double fromY = isIdentity(from) ? 1 : from->scale.y; double fromZ = isIdentity(from) ? 1 : from->scale.z; double toX = isIdentity(to) ? 1 : to->scale.x; double toY = isIdentity(to) ? 1 : to->scale.y; double toZ = isIdentity(to) ? 1 : to->scale.z; toReturn.scale3d(blendDoubles(fromX, toX, progress), blendDoubles(fromY, toY, progress), blendDoubles(fromZ, toZ, progress)); break; } case WebTransformOperation::WebTransformOperationSkew: { double fromX = isIdentity(from) ? 0 : from->skew.x; double fromY = isIdentity(from) ? 0 : from->skew.y; double toX = isIdentity(to) ? 0 : to->skew.x; double toY = isIdentity(to) ? 0 : to->skew.y; toReturn.skewX(blendDoubles(fromX, toX, progress)); toReturn.skewY(blendDoubles(fromY, toY, progress)); break; } case WebTransformOperation::WebTransformOperationPerspective: { double fromPerspectiveDepth = isIdentity(from) ? numeric_limits<double>::max() : from->perspectiveDepth; double toPerspectiveDepth = isIdentity(to) ? numeric_limits<double>::max() : to->perspectiveDepth; toReturn.applyPerspective(blendDoubles(fromPerspectiveDepth, toPerspectiveDepth, progress)); break; } case WebTransformOperation::WebTransformOperationMatrix: { WebTransformationMatrix toMatrix; if (!isIdentity(to)) toMatrix = to->matrix; WebTransformationMatrix fromMatrix; if (!isIdentity(from)) fromMatrix = from->matrix; toReturn = toMatrix; toReturn.blend(fromMatrix, progress); break; } case WebTransformOperation::WebTransformOperationIdentity: break; } return toReturn; }
C
Chrome
1
CVE-2015-6763
https://www.cvedetails.com/cve/CVE-2015-6763/
null
https://github.com/chromium/chromium/commit/f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
f1574f25e1402e748bf2bd7e28ce3dd96ceb1ca4
MacViews: Enable secure text input for password Textfields. In Cocoa the NSTextInputContext automatically enables secure text input when activated and it's in the secure text entry mode. RenderWidgetHostViewMac did the similar thing for ages following the WebKit example. views::Textfield needs to do the same thing in a fashion that's sycnrhonized with RenderWidgetHostViewMac, otherwise the race conditions are possible when the Textfield gets focus, activates the secure text input mode and the RWHVM loses focus immediately afterwards and disables the secure text input instead of leaving it in the enabled state. BUG=818133,677220 Change-Id: I6db6c4b59e4a1a72cbb7f8c7056f71b04a3df08b Reviewed-on: https://chromium-review.googlesource.com/943064 Commit-Queue: Michail Pishchagin <[email protected]> Reviewed-by: Pavel Feldman <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Reviewed-by: Peter Kasting <[email protected]> Cr-Commit-Position: refs/heads/master@{#542517}
FrameConsole* LocalDOMWindow::GetFrameConsole() const { if (!IsCurrentlyDisplayedInFrame()) return nullptr; return &GetFrame()->Console(); }
FrameConsole* LocalDOMWindow::GetFrameConsole() const { if (!IsCurrentlyDisplayedInFrame()) return nullptr; return &GetFrame()->Console(); }
C
Chrome
0
CVE-2018-6942
https://www.cvedetails.com/cve/CVE-2018-6942/
CWE-476
https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=29c759284e305ec428703c9a5831d0b1fc3497ef
29c759284e305ec428703c9a5831d0b1fc3497ef
null
Ins_MUL( FT_Long* args ) { args[0] = FT_MulDiv( args[0], args[1], 64L ); }
Ins_MUL( FT_Long* args ) { args[0] = FT_MulDiv( args[0], args[1], 64L ); }
C
savannah
0
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]>
static int irda_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct irda_sock *self; struct sk_buff *skb; int err = -EPIPE; pr_debug("%s(), len=%zd\n", __func__, len); /* Note : socket.c set MSG_EOR on SEQPACKET sockets */ if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_EOR | MSG_CMSG_COMPAT | MSG_NOSIGNAL)) { return -EINVAL; } lock_sock(sk); if (sk->sk_shutdown & SEND_SHUTDOWN) goto out_err; if (sk->sk_state != TCP_ESTABLISHED) { err = -ENOTCONN; goto out; } self = irda_sk(sk); /* Check if IrTTP is wants us to slow down */ if (wait_event_interruptible(*(sk_sleep(sk)), (self->tx_flow != FLOW_STOP || sk->sk_state != TCP_ESTABLISHED))) { err = -ERESTARTSYS; goto out; } /* Check if we are still connected */ if (sk->sk_state != TCP_ESTABLISHED) { err = -ENOTCONN; goto out; } /* Check that we don't send out too big frames */ if (len > self->max_data_size) { pr_debug("%s(), Chopping frame from %zd to %d bytes!\n", __func__, len, self->max_data_size); len = self->max_data_size; } skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16, msg->msg_flags & MSG_DONTWAIT, &err); if (!skb) goto out_err; skb_reserve(skb, self->max_header_size + 16); skb_reset_transport_header(skb); skb_put(skb, len); err = memcpy_from_msg(skb_transport_header(skb), msg, len); if (err) { kfree_skb(skb); goto out_err; } /* * Just send the message to TinyTP, and let it deal with possible * errors. No need to duplicate all that here */ err = irttp_data_request(self->tsap, skb); if (err) { pr_debug("%s(), err=%d\n", __func__, err); goto out_err; } release_sock(sk); /* Tell client how much data we actually sent */ return len; out_err: err = sk_stream_error(sk, msg->msg_flags, err); out: release_sock(sk); return err; }
static int irda_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct irda_sock *self; struct sk_buff *skb; int err = -EPIPE; pr_debug("%s(), len=%zd\n", __func__, len); /* Note : socket.c set MSG_EOR on SEQPACKET sockets */ if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_EOR | MSG_CMSG_COMPAT | MSG_NOSIGNAL)) { return -EINVAL; } lock_sock(sk); if (sk->sk_shutdown & SEND_SHUTDOWN) goto out_err; if (sk->sk_state != TCP_ESTABLISHED) { err = -ENOTCONN; goto out; } self = irda_sk(sk); /* Check if IrTTP is wants us to slow down */ if (wait_event_interruptible(*(sk_sleep(sk)), (self->tx_flow != FLOW_STOP || sk->sk_state != TCP_ESTABLISHED))) { err = -ERESTARTSYS; goto out; } /* Check if we are still connected */ if (sk->sk_state != TCP_ESTABLISHED) { err = -ENOTCONN; goto out; } /* Check that we don't send out too big frames */ if (len > self->max_data_size) { pr_debug("%s(), Chopping frame from %zd to %d bytes!\n", __func__, len, self->max_data_size); len = self->max_data_size; } skb = sock_alloc_send_skb(sk, len + self->max_header_size + 16, msg->msg_flags & MSG_DONTWAIT, &err); if (!skb) goto out_err; skb_reserve(skb, self->max_header_size + 16); skb_reset_transport_header(skb); skb_put(skb, len); err = memcpy_from_msg(skb_transport_header(skb), msg, len); if (err) { kfree_skb(skb); goto out_err; } /* * Just send the message to TinyTP, and let it deal with possible * errors. No need to duplicate all that here */ err = irttp_data_request(self->tsap, skb); if (err) { pr_debug("%s(), err=%d\n", __func__, err); goto out_err; } release_sock(sk); /* Tell client how much data we actually sent */ return len; out_err: err = sk_stream_error(sk, msg->msg_flags, err); out: release_sock(sk); return err; }
C
linux
0
CVE-2016-2347
https://www.cvedetails.com/cve/CVE-2016-2347/
CWE-190
https://github.com/fragglet/lhasa/commit/6fcdb8f1f538b9d63e63a5fa199c5514a15d4564
6fcdb8f1f538b9d63e63a5fa199c5514a15d4564
Fix integer underflow vulnerability in L3 decode. Marcin 'Icewall' Noga of Cisco TALOS discovered that the level 3 header decoding routines were vulnerable to an integer underflow, if the 32-bit header length was less than the base level 3 header length. This could lead to an exploitable heap corruption condition. Thanks go to Marcin Noga and Regina Wilson of Cisco TALOS for reporting this vulnerability.
static int process_level0_path(LHAFileHeader *header, uint8_t *data, size_t data_len) { unsigned int i; if (data_len == 0) { return 1; } header->filename = malloc(data_len + 1); if (header->filename == NULL) { return 0; } memcpy(header->filename, data, data_len); header->filename[data_len] = '\0'; for (i = 0; i < data_len; ++i) { if (header->filename[i] == '\\') { header->filename[i] = '/'; } } return split_header_filename(header); }
static int process_level0_path(LHAFileHeader *header, uint8_t *data, size_t data_len) { unsigned int i; if (data_len == 0) { return 1; } header->filename = malloc(data_len + 1); if (header->filename == NULL) { return 0; } memcpy(header->filename, data, data_len); header->filename[data_len] = '\0'; for (i = 0; i < data_len; ++i) { if (header->filename[i] == '\\') { header->filename[i] = '/'; } } return split_header_filename(header); }
C
lhasa
0
CVE-2013-6420
https://www.cvedetails.com/cve/CVE-2013-6420/
CWE-119
https://git.php.net/?p=php-src.git;a=commit;h=c1224573c773b6845e83505f717fbf820fc18415
c1224573c773b6845e83505f717fbf820fc18415
null
static int openssl_x509v3_subjectAltName(BIO *bio, X509_EXTENSION *extension) { GENERAL_NAMES *names; const X509V3_EXT_METHOD *method = NULL; long i, length, num; const unsigned char *p; method = X509V3_EXT_get(extension); if (method == NULL) { return -1; } p = extension->value->data; length = extension->value->length; if (method->it) { names = (GENERAL_NAMES*)(ASN1_item_d2i(NULL, &p, length, ASN1_ITEM_ptr(method->it))); } else { names = (GENERAL_NAMES*)(method->d2i(NULL, &p, length)); } if (names == NULL) { return -1; } num = sk_GENERAL_NAME_num(names); for (i = 0; i < num; i++) { GENERAL_NAME *name; ASN1_STRING *as; name = sk_GENERAL_NAME_value(names, i); switch (name->type) { case GEN_EMAIL: BIO_puts(bio, "email:"); as = name->d.rfc822Name; BIO_write(bio, ASN1_STRING_data(as), ASN1_STRING_length(as)); break; case GEN_DNS: BIO_puts(bio, "DNS:"); as = name->d.dNSName; BIO_write(bio, ASN1_STRING_data(as), ASN1_STRING_length(as)); break; case GEN_URI: BIO_puts(bio, "URI:"); as = name->d.uniformResourceIdentifier; BIO_write(bio, ASN1_STRING_data(as), ASN1_STRING_length(as)); break; default: /* use builtin print for GEN_OTHERNAME, GEN_X400, * GEN_EDIPARTY, GEN_DIRNAME, GEN_IPADD and GEN_RID */ GENERAL_NAME_print(bio, name); } /* trailing ', ' except for last element */ if (i < (num - 1)) { BIO_puts(bio, ", "); } } sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free); return 0; }
static int openssl_x509v3_subjectAltName(BIO *bio, X509_EXTENSION *extension) { GENERAL_NAMES *names; const X509V3_EXT_METHOD *method = NULL; long i, length, num; const unsigned char *p; method = X509V3_EXT_get(extension); if (method == NULL) { return -1; } p = extension->value->data; length = extension->value->length; if (method->it) { names = (GENERAL_NAMES*)(ASN1_item_d2i(NULL, &p, length, ASN1_ITEM_ptr(method->it))); } else { names = (GENERAL_NAMES*)(method->d2i(NULL, &p, length)); } if (names == NULL) { return -1; } num = sk_GENERAL_NAME_num(names); for (i = 0; i < num; i++) { GENERAL_NAME *name; ASN1_STRING *as; name = sk_GENERAL_NAME_value(names, i); switch (name->type) { case GEN_EMAIL: BIO_puts(bio, "email:"); as = name->d.rfc822Name; BIO_write(bio, ASN1_STRING_data(as), ASN1_STRING_length(as)); break; case GEN_DNS: BIO_puts(bio, "DNS:"); as = name->d.dNSName; BIO_write(bio, ASN1_STRING_data(as), ASN1_STRING_length(as)); break; case GEN_URI: BIO_puts(bio, "URI:"); as = name->d.uniformResourceIdentifier; BIO_write(bio, ASN1_STRING_data(as), ASN1_STRING_length(as)); break; default: /* use builtin print for GEN_OTHERNAME, GEN_X400, * GEN_EDIPARTY, GEN_DIRNAME, GEN_IPADD and GEN_RID */ GENERAL_NAME_print(bio, name); } /* trailing ', ' except for last element */ if (i < (num - 1)) { BIO_puts(bio, ", "); } } sk_GENERAL_NAME_pop_free(names, GENERAL_NAME_free); return 0; }
C
php
0
CVE-2012-2890
https://www.cvedetails.com/cve/CVE-2012-2890/
CWE-399
https://github.com/chromium/chromium/commit/a6f7726de20450074a01493e4e85409ce3f2595a
a6f7726de20450074a01493e4e85409ce3f2595a
Unreviewed, rolling out r147402. http://trac.webkit.org/changeset/147402 https://bugs.webkit.org/show_bug.cgi?id=112903 Source/WebCore: * dom/Document.cpp: (WebCore::Document::processHttpEquiv): * loader/DocumentLoader.cpp: (WebCore::DocumentLoader::responseReceived): LayoutTests: * http/tests/security/XFrameOptions/x-frame-options-deny-expected.txt: * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-expected.txt: * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-in-body-expected.txt: * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-in-body.html: * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-parent-same-origin-deny-expected.txt: * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-parent-same-origin-deny.html: * http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag.html: * http/tests/security/XFrameOptions/x-frame-options-deny.html: * http/tests/security/XFrameOptions/x-frame-options-multiple-headers-sameorigin-deny-expected.txt: * http/tests/security/XFrameOptions/x-frame-options-multiple-headers-sameorigin-deny.html: * http/tests/security/XFrameOptions/x-frame-options-parent-same-origin-deny-expected.txt: * http/tests/security/XFrameOptions/x-frame-options-parent-same-origin-deny.html: * platform/chromium/http/tests/security/XFrameOptions/x-frame-options-deny-expected.txt: * platform/chromium/http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-expected.txt: * platform/chromium/http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-in-body-expected.txt: * platform/chromium/http/tests/security/XFrameOptions/x-frame-options-deny-meta-tag-parent-same-origin-deny-expected.txt: * platform/chromium/http/tests/security/XFrameOptions/x-frame-options-multiple-headers-sameorigin-deny-expected.txt: * platform/chromium/http/tests/security/XFrameOptions/x-frame-options-parent-same-origin-deny-expected.txt: git-svn-id: svn://svn.chromium.org/blink/trunk@147450 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void Document::setCompatibilityMode(CompatibilityMode mode) { if (m_compatibilityModeLocked || mode == m_compatibilityMode) return; bool wasInQuirksMode = inQuirksMode(); m_compatibilityMode = mode; selectorQueryCache()->invalidate(); if (inQuirksMode() != wasInQuirksMode) { m_styleSheetCollection->clearPageUserSheet(); m_styleSheetCollection->invalidateInjectedStyleSheetCache(); } }
void Document::setCompatibilityMode(CompatibilityMode mode) { if (m_compatibilityModeLocked || mode == m_compatibilityMode) return; bool wasInQuirksMode = inQuirksMode(); m_compatibilityMode = mode; selectorQueryCache()->invalidate(); if (inQuirksMode() != wasInQuirksMode) { m_styleSheetCollection->clearPageUserSheet(); m_styleSheetCollection->invalidateInjectedStyleSheetCache(); } }
C
Chrome
0
CVE-2010-5332
https://www.cvedetails.com/cve/CVE-2010-5332/
CWE-119
https://github.com/torvalds/linux/commit/0926f91083f34d047abc74f1ca4fa6a9c161f7db
0926f91083f34d047abc74f1ca4fa6a9c161f7db
mlx4_en: Fix out of bounds array access When searching for a free entry in either mlx4_register_vlan() or mlx4_register_mac(), and there is no free entry, the loop terminates without updating the local variable free thus causing out of array bounds access. Fix this by adding a proper check outside the loop. Signed-off-by: Eli Cohen <[email protected]> Signed-off-by: David S. Miller <[email protected]>
void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index) { struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table; if (index < MLX4_VLAN_REGULAR) { mlx4_warn(dev, "Trying to free special vlan index %d\n", index); return; } mutex_lock(&table->mutex); if (!table->refs[index]) { mlx4_warn(dev, "No vlan entry for index %d\n", index); goto out; } if (--table->refs[index]) { mlx4_dbg(dev, "Have more references for index %d," "no need to modify vlan table\n", index); goto out; } table->entries[index] = 0; mlx4_set_port_vlan_table(dev, port, table->entries); --table->total; out: mutex_unlock(&table->mutex); }
void mlx4_unregister_vlan(struct mlx4_dev *dev, u8 port, int index) { struct mlx4_vlan_table *table = &mlx4_priv(dev)->port[port].vlan_table; if (index < MLX4_VLAN_REGULAR) { mlx4_warn(dev, "Trying to free special vlan index %d\n", index); return; } mutex_lock(&table->mutex); if (!table->refs[index]) { mlx4_warn(dev, "No vlan entry for index %d\n", index); goto out; } if (--table->refs[index]) { mlx4_dbg(dev, "Have more references for index %d," "no need to modify vlan table\n", index); goto out; } table->entries[index] = 0; mlx4_set_port_vlan_table(dev, port, table->entries); --table->total; out: mutex_unlock(&table->mutex); }
C
linux
0
CVE-2013-4150
https://www.cvedetails.com/cve/CVE-2013-4150/
CWE-119
https://git.qemu.org/?p=qemu.git;a=commit;h=eea750a5623ddac7a61982eec8f1c93481857578
eea750a5623ddac7a61982eec8f1c93481857578
null
static int virtio_net_has_buffers(VirtIONetQueue *q, int bufsize) { VirtIONet *n = q->n; if (virtio_queue_empty(q->rx_vq) || (n->mergeable_rx_bufs && !virtqueue_avail_bytes(q->rx_vq, bufsize, 0))) { virtio_queue_set_notification(q->rx_vq, 1); /* To avoid a race condition where the guest has made some buffers * available after the above check but before notification was * enabled, check for available buffers again. */ if (virtio_queue_empty(q->rx_vq) || (n->mergeable_rx_bufs && !virtqueue_avail_bytes(q->rx_vq, bufsize, 0))) { return 0; } } virtio_queue_set_notification(q->rx_vq, 0); return 1; }
static int virtio_net_has_buffers(VirtIONetQueue *q, int bufsize) { VirtIONet *n = q->n; if (virtio_queue_empty(q->rx_vq) || (n->mergeable_rx_bufs && !virtqueue_avail_bytes(q->rx_vq, bufsize, 0))) { virtio_queue_set_notification(q->rx_vq, 1); /* To avoid a race condition where the guest has made some buffers * available after the above check but before notification was * enabled, check for available buffers again. */ if (virtio_queue_empty(q->rx_vq) || (n->mergeable_rx_bufs && !virtqueue_avail_bytes(q->rx_vq, bufsize, 0))) { return 0; } } virtio_queue_set_notification(q->rx_vq, 0); return 1; }
C
qemu
0
CVE-2017-15416
https://www.cvedetails.com/cve/CVE-2017-15416/
CWE-119
https://github.com/chromium/chromium/commit/11bd4bc92f3fe704631e3e6ad1dd1a4351641f7c
11bd4bc92f3fe704631e3e6ad1dd1a4351641f7c
[BlobStorage] Fixing potential overflow Bug: 779314 Change-Id: I74612639d20544e4c12230569c7b88fbe669ec03 Reviewed-on: https://chromium-review.googlesource.com/747725 Reviewed-by: Victor Costan <[email protected]> Commit-Queue: Daniel Murphy <[email protected]> Cr-Commit-Position: refs/heads/master@{#512977}
void BlobStorageContext::RunOnConstructionComplete( const std::string& uuid, const BlobStatusCallback& done) { BlobEntry* entry = registry_.GetEntry(uuid); DCHECK(entry); if (BlobStatusIsPending(entry->status())) { entry->building_state_->build_completion_callbacks.push_back(done); return; } done.Run(entry->status()); }
void BlobStorageContext::RunOnConstructionComplete( const std::string& uuid, const BlobStatusCallback& done) { BlobEntry* entry = registry_.GetEntry(uuid); DCHECK(entry); if (BlobStatusIsPending(entry->status())) { entry->building_state_->build_completion_callbacks.push_back(done); return; } done.Run(entry->status()); }
C
Chrome
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_tagged_data(struct krb5_tagged_data *td, size_t max_data_size, const __be32 **_xdr, unsigned int *_toklen) { const __be32 *xdr = *_xdr; unsigned int toklen = *_toklen, len; /* there must be at least one tag and one length word */ if (toklen <= 8) return -EINVAL; _enter(",%zu,{%x,%x},%u", max_data_size, ntohl(xdr[0]), ntohl(xdr[1]), toklen); td->tag = ntohl(*xdr++); len = ntohl(*xdr++); toklen -= 8; if (len > max_data_size) return -EINVAL; td->data_len = len; if (len > 0) { td->data = kmemdup(xdr, len, GFP_KERNEL); if (!td->data) return -ENOMEM; len = (len + 3) & ~3; toklen -= len; xdr += len >> 2; } _debug("tag %x len %x", td->tag, td->data_len); *_xdr = xdr; *_toklen = toklen; _leave(" = 0 [toklen=%u]", toklen); return 0; }
static int rxrpc_krb5_decode_tagged_data(struct krb5_tagged_data *td, size_t max_data_size, const __be32 **_xdr, unsigned int *_toklen) { const __be32 *xdr = *_xdr; unsigned int toklen = *_toklen, len; /* there must be at least one tag and one length word */ if (toklen <= 8) return -EINVAL; _enter(",%zu,{%x,%x},%u", max_data_size, ntohl(xdr[0]), ntohl(xdr[1]), toklen); td->tag = ntohl(*xdr++); len = ntohl(*xdr++); toklen -= 8; if (len > max_data_size) return -EINVAL; td->data_len = len; if (len > 0) { td->data = kmemdup(xdr, len, GFP_KERNEL); if (!td->data) return -ENOMEM; len = (len + 3) & ~3; toklen -= len; xdr += len >> 2; } _debug("tag %x len %x", td->tag, td->data_len); *_xdr = xdr; *_toklen = toklen; _leave(" = 0 [toklen=%u]", toklen); return 0; }
C
linux
0
CVE-2016-7117
https://www.cvedetails.com/cve/CVE-2016-7117/
CWE-19
https://github.com/torvalds/linux/commit/34b88a68f26a75e4fded796f1a49c40f82234b7d
34b88a68f26a75e4fded796f1a49c40f82234b7d
net: Fix use after free in the recvmmsg exit path The syzkaller fuzzer hit the following use-after-free: Call Trace: [<ffffffff8175ea0e>] __asan_report_load8_noabort+0x3e/0x40 mm/kasan/report.c:295 [<ffffffff851cc31a>] __sys_recvmmsg+0x6fa/0x7f0 net/socket.c:2261 [< inline >] SYSC_recvmmsg net/socket.c:2281 [<ffffffff851cc57f>] SyS_recvmmsg+0x16f/0x180 net/socket.c:2270 [<ffffffff86332bb6>] entry_SYSCALL_64_fastpath+0x16/0x7a arch/x86/entry/entry_64.S:185 And, as Dmitry rightly assessed, that is because we can drop the reference and then touch it when the underlying recvmsg calls return some packets and then hit an error, which will make recvmmsg to set sock->sk->sk_err, oops, fix it. Reported-and-Tested-by: Dmitry Vyukov <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Kostya Serebryany <[email protected]> Cc: Sasha Levin <[email protected]> Fixes: a2e2725541fa ("net: Introduce recvmmsg socket syscall") http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: David S. Miller <[email protected]>
SYSCALL_DEFINE3(recvmsg, int, fd, struct user_msghdr __user *, msg, unsigned int, flags) { if (flags & MSG_CMSG_COMPAT) return -EINVAL; return __sys_recvmsg(fd, msg, flags); }
SYSCALL_DEFINE3(recvmsg, int, fd, struct user_msghdr __user *, msg, unsigned int, flags) { if (flags & MSG_CMSG_COMPAT) return -EINVAL; return __sys_recvmsg(fd, msg, flags); }
C
linux
0
CVE-2018-20856
https://www.cvedetails.com/cve/CVE-2018-20856/
CWE-416
https://github.com/torvalds/linux/commit/54648cf1ec2d7f4b6a71767799c45676a138ca24
54648cf1ec2d7f4b6a71767799c45676a138ca24
block: blk_init_allocated_queue() set q->fq as NULL in the fail case We find the memory use-after-free issue in __blk_drain_queue() on the kernel 4.14. After read the latest kernel 4.18-rc6 we think it has the same problem. Memory is allocated for q->fq in the blk_init_allocated_queue(). If the elevator init function called with error return, it will run into the fail case to free the q->fq. Then the __blk_drain_queue() uses the same memory after the free of the q->fq, it will lead to the unpredictable event. The patch is to set q->fq as NULL in the fail case of blk_init_allocated_queue(). Fixes: commit 7c94e1c157a2 ("block: introduce blk_flush_queue to drive flush machinery") Cc: <[email protected]> Reviewed-by: Ming Lei <[email protected]> Reviewed-by: Bart Van Assche <[email protected]> Signed-off-by: xiao jin <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
void part_round_stats(struct request_queue *q, int cpu, struct hd_struct *part) { struct hd_struct *part2 = NULL; unsigned long now = jiffies; unsigned int inflight[2]; int stats = 0; if (part->stamp != now) stats |= 1; if (part->partno) { part2 = &part_to_disk(part)->part0; if (part2->stamp != now) stats |= 2; } if (!stats) return; part_in_flight(q, part, inflight); if (stats & 2) part_round_stats_single(q, cpu, part2, now, inflight[1]); if (stats & 1) part_round_stats_single(q, cpu, part, now, inflight[0]); }
void part_round_stats(struct request_queue *q, int cpu, struct hd_struct *part) { struct hd_struct *part2 = NULL; unsigned long now = jiffies; unsigned int inflight[2]; int stats = 0; if (part->stamp != now) stats |= 1; if (part->partno) { part2 = &part_to_disk(part)->part0; if (part2->stamp != now) stats |= 2; } if (!stats) return; part_in_flight(q, part, inflight); if (stats & 2) part_round_stats_single(q, cpu, part2, now, inflight[1]); if (stats & 1) part_round_stats_single(q, cpu, part, now, inflight[0]); }
C
linux
0
CVE-2016-1691
https://www.cvedetails.com/cve/CVE-2016-1691/
CWE-119
https://github.com/chromium/chromium/commit/e3aa8a56706c4abe208934d5c294f7b594b8b693
e3aa8a56706c4abe208934d5c294f7b594b8b693
Enforce the WebUsbAllowDevicesForUrls policy This change modifies UsbChooserContext to use the UsbAllowDevicesForUrls class to consider devices allowed by the WebUsbAllowDevicesForUrls policy. The WebUsbAllowDevicesForUrls policy overrides the other WebUSB policies. Unit tests are also added to ensure that the policy is being enforced correctly. The design document for this feature is found at: https://docs.google.com/document/d/1MPvsrWiVD_jAC8ELyk8njFpy6j1thfVU5aWT3TCWE8w Bug: 854329 Change-Id: I5f82e662ca9dc544da5918eae766b5535a31296b Reviewed-on: https://chromium-review.googlesource.com/c/1259289 Commit-Queue: Ovidio Henriquez <[email protected]> Reviewed-by: Reilly Grant <[email protected]> Reviewed-by: Julian Pastarmov <[email protected]> Cr-Commit-Position: refs/heads/master@{#597926}
bool UsbChooserContext::IsValidObject(const base::DictionaryValue& object) { return object.size() == 4 && object.HasKey(kDeviceNameKey) && object.HasKey(kVendorIdKey) && object.HasKey(kProductIdKey) && object.HasKey(kSerialNumberKey); }
bool UsbChooserContext::IsValidObject(const base::DictionaryValue& object) { return object.size() == 4 && object.HasKey(kDeviceNameKey) && object.HasKey(kVendorIdKey) && object.HasKey(kProductIdKey) && object.HasKey(kSerialNumberKey); }
C
Chrome
0
CVE-2013-0886
https://www.cvedetails.com/cve/CVE-2013-0886/
null
https://github.com/chromium/chromium/commit/18d67244984a574ba2dd8779faabc0e3e34f4b76
18d67244984a574ba2dd8779faabc0e3e34f4b76
Implement TextureImageTransportSurface using texture mailbox This has a couple of advantages: - allow tearing down and recreating the UI parent context without losing the renderer contexts - do not require a context to be able to generate textures when creating the GLSurfaceHandle - clearer ownership semantics that potentially allows for more robust and easier lost context handling/thumbnailing/etc., since a texture is at any given time owned by either: UI parent, mailbox, or TextureImageTransportSurface - simplify frontbuffer protection logic; the frontbuffer textures are now owned by RWHV where they are refcounted The TextureImageTransportSurface informs RenderWidgetHostView of the mailbox names for the front- and backbuffer textures by associating them with a surface_handle (1 or 2) in the AcceleratedSurfaceNew message. During SwapBuffers() or PostSubBuffer() cycles, it then uses produceTextureCHROMIUM() and consumeTextureCHROMIUM() to transfer ownership between renderer and browser compositor. RWHV sends back the surface_handle of the buffer being returned with the Swap ACK (or 0 if no buffer is being returned in which case TextureImageTransportSurface will allocate a new texture - note that this could be used to simply keep textures for thumbnailing). BUG=154815,139616 [email protected] Review URL: https://chromiumcodereview.appspot.com/11194042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171569 0039d316-1c4b-4281-b951-d872f2087c98
void RenderWidgetHostImpl::OnMsgGetWindowRect(gfx::Rect* results) { if (view_) *results = view_->GetViewBounds(); }
void RenderWidgetHostImpl::OnMsgGetWindowRect(gfx::Rect* results) { if (view_) *results = view_->GetViewBounds(); }
C
Chrome
0
CVE-2015-5289
https://www.cvedetails.com/cve/CVE-2015-5289/
CWE-119
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=08fa47c4850cea32c3116665975bca219fbf2fe6
08fa47c4850cea32c3116665975bca219fbf2fe6
null
add_json(Datum val, bool is_null, StringInfo result, Oid val_type, bool key_scalar) { JsonTypeCategory tcategory; Oid outfuncoid; if (val_type == InvalidOid) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("could not determine input data type"))); if (is_null) { tcategory = JSONTYPE_NULL; outfuncoid = InvalidOid; } else json_categorize_type(val_type, &tcategory, &outfuncoid); datum_to_json(val, is_null, result, tcategory, outfuncoid, key_scalar); }
add_json(Datum val, bool is_null, StringInfo result, Oid val_type, bool key_scalar) { JsonTypeCategory tcategory; Oid outfuncoid; if (val_type == InvalidOid) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("could not determine input data type"))); if (is_null) { tcategory = JSONTYPE_NULL; outfuncoid = InvalidOid; } else json_categorize_type(val_type, &tcategory, &outfuncoid); datum_to_json(val, is_null, result, tcategory, outfuncoid, key_scalar); }
C
postgresql
0
CVE-2012-2896
https://www.cvedetails.com/cve/CVE-2012-2896/
CWE-189
https://github.com/chromium/chromium/commit/3aad1a37affb1ab70d1897f2b03eb8c077264984
3aad1a37affb1ab70d1897f2b03eb8c077264984
Fix SafeAdd and SafeMultiply BUG=145648,145544 Review URL: https://chromiumcodereview.appspot.com/10916165 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155478 0039d316-1c4b-4281-b951-d872f2087c98
TextureManager::TextureInfo::~TextureInfo() { if (manager_) { if (owned_ && manager_->have_context_) { GLuint id = service_id(); glDeleteTextures(1, &id); } MarkAsDeleted(); manager_->StopTracking(this); manager_ = NULL; } }
TextureManager::TextureInfo::~TextureInfo() { if (manager_) { if (owned_ && manager_->have_context_) { GLuint id = service_id(); glDeleteTextures(1, &id); } MarkAsDeleted(); manager_->StopTracking(this); manager_ = NULL; } }
C
Chrome
0
CVE-2017-5112
https://www.cvedetails.com/cve/CVE-2017-5112/
CWE-119
https://github.com/chromium/chromium/commit/f6ac1dba5e36f338a490752a2cbef3339096d9fe
f6ac1dba5e36f338a490752a2cbef3339096d9fe
Reset ES3 pixel pack parameters and PIXEL_PACK_BUFFER binding in DrawingBuffer before ReadPixels() and recover them later. BUG=740603 TEST=new conformance test [email protected],[email protected] Change-Id: I3ea54c6cc34f34e249f7c8b9f792d93c5e1958f4 Reviewed-on: https://chromium-review.googlesource.com/570840 Reviewed-by: Antoine Labour <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Commit-Queue: Zhenyao Mo <[email protected]> Cr-Commit-Position: refs/heads/master@{#486518}
void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { if (isContextLost() || !location) return; if (location->Program() != current_program_) { SynthesizeGLError(GL_INVALID_OPERATION, "uniform4f", "location not for current program"); return; } ContextGL()->Uniform4f(location->Location(), x, y, z, w); }
void WebGLRenderingContextBase::uniform4f(const WebGLUniformLocation* location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { if (isContextLost() || !location) return; if (location->Program() != current_program_) { SynthesizeGLError(GL_INVALID_OPERATION, "uniform4f", "location not for current program"); return; } ContextGL()->Uniform4f(location->Location(), x, y, z, w); }
C
Chrome
0
CVE-2017-12168
https://www.cvedetails.com/cve/CVE-2017-12168/
CWE-617
https://github.com/torvalds/linux/commit/9e3f7a29694049edd728e2400ab57ad7553e5aa9
9e3f7a29694049edd728e2400ab57ad7553e5aa9
arm64: KVM: pmu: Fix AArch32 cycle counter access We're missing the handling code for the cycle counter accessed from a 32bit guest, leading to unexpected results. Cc: [email protected] # 4.6+ Signed-off-by: Wei Huang <[email protected]> Signed-off-by: Marc Zyngier <[email protected]>
static int kvm_handle_cp_64(struct kvm_vcpu *vcpu, const struct sys_reg_desc *global, size_t nr_global, const struct sys_reg_desc *target_specific, size_t nr_specific) { struct sys_reg_params params; u32 hsr = kvm_vcpu_get_hsr(vcpu); int Rt = (hsr >> 5) & 0xf; int Rt2 = (hsr >> 10) & 0xf; params.is_aarch32 = true; params.is_32bit = false; params.CRm = (hsr >> 1) & 0xf; params.is_write = ((hsr & 1) == 0); params.Op0 = 0; params.Op1 = (hsr >> 16) & 0xf; params.Op2 = 0; params.CRn = 0; /* * Make a 64-bit value out of Rt and Rt2. As we use the same trap * backends between AArch32 and AArch64, we get away with it. */ if (params.is_write) { params.regval = vcpu_get_reg(vcpu, Rt) & 0xffffffff; params.regval |= vcpu_get_reg(vcpu, Rt2) << 32; } if (!emulate_cp(vcpu, &params, target_specific, nr_specific)) goto out; if (!emulate_cp(vcpu, &params, global, nr_global)) goto out; unhandled_cp_access(vcpu, &params); out: /* Split up the value between registers for the read side */ if (!params.is_write) { vcpu_set_reg(vcpu, Rt, lower_32_bits(params.regval)); vcpu_set_reg(vcpu, Rt2, upper_32_bits(params.regval)); } return 1; }
static int kvm_handle_cp_64(struct kvm_vcpu *vcpu, const struct sys_reg_desc *global, size_t nr_global, const struct sys_reg_desc *target_specific, size_t nr_specific) { struct sys_reg_params params; u32 hsr = kvm_vcpu_get_hsr(vcpu); int Rt = (hsr >> 5) & 0xf; int Rt2 = (hsr >> 10) & 0xf; params.is_aarch32 = true; params.is_32bit = false; params.CRm = (hsr >> 1) & 0xf; params.is_write = ((hsr & 1) == 0); params.Op0 = 0; params.Op1 = (hsr >> 16) & 0xf; params.Op2 = 0; params.CRn = 0; /* * Make a 64-bit value out of Rt and Rt2. As we use the same trap * backends between AArch32 and AArch64, we get away with it. */ if (params.is_write) { params.regval = vcpu_get_reg(vcpu, Rt) & 0xffffffff; params.regval |= vcpu_get_reg(vcpu, Rt2) << 32; } if (!emulate_cp(vcpu, &params, target_specific, nr_specific)) goto out; if (!emulate_cp(vcpu, &params, global, nr_global)) goto out; unhandled_cp_access(vcpu, &params); out: /* Split up the value between registers for the read side */ if (!params.is_write) { vcpu_set_reg(vcpu, Rt, lower_32_bits(params.regval)); vcpu_set_reg(vcpu, Rt2, upper_32_bits(params.regval)); } return 1; }
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 int airo_set_txpow(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; CapabilityRid cap_rid; /* Card capability info */ int i; int rc = -EINVAL; __le16 v = cpu_to_le16(vwrq->value); readCapabilityRid(local, &cap_rid, 1); if (vwrq->disabled) { set_bit (FLAG_RADIO_OFF, &local->flags); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ } if (vwrq->flags != IW_TXPOW_MWATT) { return -EINVAL; } clear_bit (FLAG_RADIO_OFF, &local->flags); for (i = 0; i < 8 && cap_rid.txPowerLevels[i]; i++) if (v == cap_rid.txPowerLevels[i]) { readConfigRid(local, 1); local->config.txPower = v; set_bit (FLAG_COMMIT, &local->flags); rc = -EINPROGRESS; /* Call commit handler */ break; } return rc; }
static int airo_set_txpow(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; CapabilityRid cap_rid; /* Card capability info */ int i; int rc = -EINVAL; __le16 v = cpu_to_le16(vwrq->value); readCapabilityRid(local, &cap_rid, 1); if (vwrq->disabled) { set_bit (FLAG_RADIO_OFF, &local->flags); set_bit (FLAG_COMMIT, &local->flags); return -EINPROGRESS; /* Call commit handler */ } if (vwrq->flags != IW_TXPOW_MWATT) { return -EINVAL; } clear_bit (FLAG_RADIO_OFF, &local->flags); for (i = 0; i < 8 && cap_rid.txPowerLevels[i]; i++) if (v == cap_rid.txPowerLevels[i]) { readConfigRid(local, 1); local->config.txPower = v; set_bit (FLAG_COMMIT, &local->flags); rc = -EINPROGRESS; /* Call commit handler */ break; } return rc; }
C
linux
0
CVE-2018-20961
https://www.cvedetails.com/cve/CVE-2018-20961/
CWE-415
https://github.com/torvalds/linux/commit/7fafcfdf6377b18b2a726ea554d6e593ba44349f
7fafcfdf6377b18b2a726ea554d6e593ba44349f
USB: gadget: f_midi: fixing a possible double-free in f_midi It looks like there is a possibility of a double-free vulnerability on an error path of the f_midi_set_alt function in the f_midi driver. If the path is feasible then free_ep_req gets called twice: req->complete = f_midi_complete; err = usb_ep_queue(midi->out_ep, req, GFP_ATOMIC); => ... usb_gadget_giveback_request => f_midi_complete (CALLBACK) (inside f_midi_complete, for various cases of status) free_ep_req(ep, req); // first kfree if (err) { ERROR(midi, "%s: couldn't enqueue request: %d\n", midi->out_ep->name, err); free_ep_req(midi->out_ep, req); // second kfree return err; } The double-free possibility was introduced with commit ad0d1a058eac ("usb: gadget: f_midi: fix leak on failed to enqueue out requests"). Found by MOXCAFE tool. Signed-off-by: Tuba Yavuz <[email protected]> Fixes: ad0d1a058eac ("usb: gadget: f_midi: fix leak on failed to enqueue out requests") Acked-by: Felipe Balbi <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
static ssize_t f_midi_opts_id_store(struct config_item *item, const char *page, size_t len) { struct f_midi_opts *opts = to_f_midi_opts(item); int ret; char *c; mutex_lock(&opts->lock); if (opts->refcnt) { ret = -EBUSY; goto end; } c = kstrndup(page, len, GFP_KERNEL); if (!c) { ret = -ENOMEM; goto end; } if (opts->id_allocated) kfree(opts->id); opts->id = c; opts->id_allocated = true; ret = len; end: mutex_unlock(&opts->lock); return ret; }
static ssize_t f_midi_opts_id_store(struct config_item *item, const char *page, size_t len) { struct f_midi_opts *opts = to_f_midi_opts(item); int ret; char *c; mutex_lock(&opts->lock); if (opts->refcnt) { ret = -EBUSY; goto end; } c = kstrndup(page, len, GFP_KERNEL); if (!c) { ret = -ENOMEM; goto end; } if (opts->id_allocated) kfree(opts->id); opts->id = c; opts->id_allocated = true; ret = len; end: mutex_unlock(&opts->lock); return ret; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/fc790462b4f248712bbc8c3734664dd6b05f80f2
fc790462b4f248712bbc8c3734664dd6b05f80f2
Set the job name for the print job on the Mac. BUG=http://crbug.com/29188 TEST=as in bug Review URL: http://codereview.chromium.org/1997016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47056 0039d316-1c4b-4281-b951-d872f2087c98
void ResourceMessageFilter::OnOpenChannelToExtension( int routing_id, const std::string& source_extension_id, const std::string& target_extension_id, const std::string& channel_name, int* port_id) { if (extensions_message_service_.get()) { *port_id = extensions_message_service_-> OpenChannelToExtension(routing_id, source_extension_id, target_extension_id, channel_name, this); } else { *port_id = -1; } }
void ResourceMessageFilter::OnOpenChannelToExtension( int routing_id, const std::string& source_extension_id, const std::string& target_extension_id, const std::string& channel_name, int* port_id) { if (extensions_message_service_.get()) { *port_id = extensions_message_service_-> OpenChannelToExtension(routing_id, source_extension_id, target_extension_id, channel_name, this); } else { *port_id = -1; } }
C
Chrome
0
CVE-2011-3964
https://www.cvedetails.com/cve/CVE-2011-3964/
null
https://github.com/chromium/chromium/commit/0c14577c9905bd8161159ec7eaac810c594508d0
0c14577c9905bd8161159ec7eaac810c594508d0
Change omnibox behavior when stripping javascript schema to navigate after stripping the schema on drag drop. BUG=109245 TEST=N/A Review URL: http://codereview.chromium.org/9116016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@116692 0039d316-1c4b-4281-b951-d872f2087c98
void OmniboxViewWin::Update(const WebContents* tab_for_state_restoring) { const bool visibly_changed_permanent_text = model_->UpdatePermanentText(toolbar_model_->GetText()); const ToolbarModel::SecurityLevel security_level = toolbar_model_->GetSecurityLevel(); const bool changed_security_level = (security_level != security_level_); if (!changed_security_level && !visibly_changed_permanent_text && !tab_for_state_restoring) return; security_level_ = security_level; ScopedFreeze freeze(this, GetTextObjectModel()); if (tab_for_state_restoring) { RevertAll(); const AutocompleteEditState* state = GetStateAccessor()->GetProperty( tab_for_state_restoring->GetPropertyBag()); if (state) { model_->RestoreState(state->model_state); SetSelectionRange(state->view_state.selection); saved_selection_for_focus_change_ = state->view_state.saved_selection_for_focus_change; } } else if (visibly_changed_permanent_text) { CHARRANGE sel; GetSelection(sel); const bool was_reversed = (sel.cpMin > sel.cpMax); const bool was_sel_all = (sel.cpMin != sel.cpMax) && IsSelectAllForRange(sel); RevertAll(); if (was_sel_all) SelectAll(was_reversed); } else if (changed_security_level) { EmphasizeURLComponents(); } }
void OmniboxViewWin::Update(const WebContents* tab_for_state_restoring) { const bool visibly_changed_permanent_text = model_->UpdatePermanentText(toolbar_model_->GetText()); const ToolbarModel::SecurityLevel security_level = toolbar_model_->GetSecurityLevel(); const bool changed_security_level = (security_level != security_level_); if (!changed_security_level && !visibly_changed_permanent_text && !tab_for_state_restoring) return; security_level_ = security_level; ScopedFreeze freeze(this, GetTextObjectModel()); if (tab_for_state_restoring) { RevertAll(); const AutocompleteEditState* state = GetStateAccessor()->GetProperty( tab_for_state_restoring->GetPropertyBag()); if (state) { model_->RestoreState(state->model_state); SetSelectionRange(state->view_state.selection); saved_selection_for_focus_change_ = state->view_state.saved_selection_for_focus_change; } } else if (visibly_changed_permanent_text) { CHARRANGE sel; GetSelection(sel); const bool was_reversed = (sel.cpMin > sel.cpMax); const bool was_sel_all = (sel.cpMin != sel.cpMax) && IsSelectAllForRange(sel); RevertAll(); if (was_sel_all) SelectAll(was_reversed); } else if (changed_security_level) { EmphasizeURLComponents(); } }
C
Chrome
0
CVE-2017-6345
https://www.cvedetails.com/cve/CVE-2017-6345/
CWE-20
https://github.com/torvalds/linux/commit/8b74d439e1697110c5e5c600643e823eb1dd0762
8b74d439e1697110c5e5c600643e823eb1dd0762
net/llc: avoid BUG_ON() in skb_orphan() It seems nobody used LLC since linux-3.12. Fortunately fuzzers like syzkaller still know how to run this code, otherwise it would be no fun. Setting skb->sk without skb->destructor leads to all kinds of bugs, we now prefer to be very strict about it. Ideally here we would use skb_set_owner() but this helper does not exist yet, only CAN seems to have a private helper for that. Fixes: 376c7311bdb6 ("net: add a temporary sanity check in skb_orphan()") Signed-off-by: Eric Dumazet <[email protected]> Reported-by: Andrey Konovalov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb, struct sock *sk) { struct llc_sap_state_ev *ev = llc_sap_ev(skb); ev->type = LLC_SAP_EV_TYPE_PDU; ev->reason = 0; skb_orphan(skb); sock_hold(sk); skb->sk = sk; skb->destructor = sock_efree; llc_sap_state_process(sap, skb); }
static void llc_sap_rcv(struct llc_sap *sap, struct sk_buff *skb, struct sock *sk) { struct llc_sap_state_ev *ev = llc_sap_ev(skb); ev->type = LLC_SAP_EV_TYPE_PDU; ev->reason = 0; skb->sk = sk; llc_sap_state_process(sap, skb); }
C
linux
1
CVE-2017-15393
https://www.cvedetails.com/cve/CVE-2017-15393/
CWE-668
https://github.com/chromium/chromium/commit/a8ef19900d003ff7078fe4fcec8f63496b18f0dc
a8ef19900d003ff7078fe4fcec8f63496b18f0dc
[DevTools] Use no-referrer for DevTools links Bug: 732751 Change-Id: I77753120e2424203dedcc7bc0847fb67f87fe2b2 Reviewed-on: https://chromium-review.googlesource.com/615021 Reviewed-by: Andrey Kosyakov <[email protected]> Commit-Queue: Dmitry Gozman <[email protected]> Cr-Commit-Position: refs/heads/master@{#494413}
void DevToolsWindow::ShowCertificateViewer(const std::string& cert_chain) { std::unique_ptr<base::Value> value = base::JSONReader::Read(cert_chain); if (!value || value->GetType() != base::Value::Type::LIST) { NOTREACHED(); return; } std::unique_ptr<base::ListValue> list = base::ListValue::From(std::move(value)); std::vector<std::string> decoded; for (size_t i = 0; i < list->GetSize(); ++i) { base::Value* item; if (!list->Get(i, &item) || item->GetType() != base::Value::Type::STRING) { NOTREACHED(); return; } std::string temp; if (!item->GetAsString(&temp)) { NOTREACHED(); return; } if (!base::Base64Decode(temp, &temp)) { NOTREACHED(); return; } decoded.push_back(temp); } std::vector<base::StringPiece> cert_string_piece; for (const auto& str : decoded) cert_string_piece.push_back(str); scoped_refptr<net::X509Certificate> cert = net::X509Certificate::CreateFromDERCertChain(cert_string_piece); if (!cert) { NOTREACHED(); return; } WebContents* inspected_contents = is_docked_ ? GetInspectedWebContents() : main_web_contents_; Browser* browser = NULL; int tab = 0; if (!FindInspectedBrowserAndTabIndex(inspected_contents, &browser, &tab)) return; gfx::NativeWindow parent = browser->window()->GetNativeWindow(); ::ShowCertificateViewer(inspected_contents, parent, cert.get()); }
void DevToolsWindow::ShowCertificateViewer(const std::string& cert_chain) { std::unique_ptr<base::Value> value = base::JSONReader::Read(cert_chain); if (!value || value->GetType() != base::Value::Type::LIST) { NOTREACHED(); return; } std::unique_ptr<base::ListValue> list = base::ListValue::From(std::move(value)); std::vector<std::string> decoded; for (size_t i = 0; i < list->GetSize(); ++i) { base::Value* item; if (!list->Get(i, &item) || item->GetType() != base::Value::Type::STRING) { NOTREACHED(); return; } std::string temp; if (!item->GetAsString(&temp)) { NOTREACHED(); return; } if (!base::Base64Decode(temp, &temp)) { NOTREACHED(); return; } decoded.push_back(temp); } std::vector<base::StringPiece> cert_string_piece; for (const auto& str : decoded) cert_string_piece.push_back(str); scoped_refptr<net::X509Certificate> cert = net::X509Certificate::CreateFromDERCertChain(cert_string_piece); if (!cert) { NOTREACHED(); return; } WebContents* inspected_contents = is_docked_ ? GetInspectedWebContents() : main_web_contents_; Browser* browser = NULL; int tab = 0; if (!FindInspectedBrowserAndTabIndex(inspected_contents, &browser, &tab)) return; gfx::NativeWindow parent = browser->window()->GetNativeWindow(); ::ShowCertificateViewer(inspected_contents, parent, cert.get()); }
C
Chrome
0
CVE-2017-13054
https://www.cvedetails.com/cve/CVE-2017-13054/
CWE-125
https://github.com/the-tcpdump-group/tcpdump/commit/e6511cc1a950fe1566b2236329d6b4bd0826cc7a
e6511cc1a950fe1566b2236329d6b4bd0826cc7a
CVE-2017-13054/LLDP: add a missing length check In lldp_private_8023_print() the case block for subtype 4 (Maximum Frame Size TLV, IEEE 802.3bc-2009 Section 79.3.4) did not include the length check and could over-read the input buffer, put it right. This fixes a buffer over-read discovered by Bhargava Shastry, SecT/TU Berlin. Add a test using the capture file supplied by the reporter(s).
lldp_private_8021_print(netdissect_options *ndo, const u_char *tptr, u_int tlv_len) { int subtype, hexdump = FALSE; u_int sublen; u_int tval; u_int i; if (tlv_len < 4) { return hexdump; } subtype = *(tptr+3); ND_PRINT((ndo, "\n\t %s Subtype (%u)", tok2str(lldp_8021_subtype_values, "unknown", subtype), subtype)); switch (subtype) { case LLDP_PRIVATE_8021_SUBTYPE_PORT_VLAN_ID: if (tlv_len < 6) { return hexdump; } ND_PRINT((ndo, "\n\t port vlan id (PVID): %u", EXTRACT_16BITS(tptr + 4))); break; case LLDP_PRIVATE_8021_SUBTYPE_PROTOCOL_VLAN_ID: if (tlv_len < 7) { return hexdump; } ND_PRINT((ndo, "\n\t port and protocol vlan id (PPVID): %u, flags [%s] (0x%02x)", EXTRACT_16BITS(tptr+5), bittok2str(lldp_8021_port_protocol_id_values, "none", *(tptr+4)), *(tptr + 4))); break; case LLDP_PRIVATE_8021_SUBTYPE_VLAN_NAME: if (tlv_len < 6) { return hexdump; } ND_PRINT((ndo, "\n\t vlan id (VID): %u", EXTRACT_16BITS(tptr + 4))); if (tlv_len < 7) { return hexdump; } sublen = *(tptr+6); if (tlv_len < 7+sublen) { return hexdump; } ND_PRINT((ndo, "\n\t vlan name: ")); safeputs(ndo, tptr + 7, sublen); break; case LLDP_PRIVATE_8021_SUBTYPE_PROTOCOL_IDENTITY: if (tlv_len < 5) { return hexdump; } sublen = *(tptr+4); if (tlv_len < 5+sublen) { return hexdump; } ND_PRINT((ndo, "\n\t protocol identity: ")); safeputs(ndo, tptr + 5, sublen); break; case LLDP_PRIVATE_8021_SUBTYPE_CONGESTION_NOTIFICATION: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CONGESTION_NOTIFICATION_LENGTH){ return hexdump; } tval=*(tptr+4); ND_PRINT((ndo, "\n\t Pre-Priority CNPV Indicator")); ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : ")); for(i=0;i<NO_OF_BITS;i++) ND_PRINT((ndo, "%-2d ", (tval >> i) & 0x01)); tval=*(tptr+5); ND_PRINT((ndo, "\n\t Pre-Priority Ready Indicator")); ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : ")); for(i=0;i<NO_OF_BITS;i++) ND_PRINT((ndo, "%-2d ", (tval >> i) & 0x01)); break; case LLDP_PRIVATE_8021_SUBTYPE_ETS_CONFIGURATION: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_ETS_CONFIGURATION_LENGTH) { return hexdump; } tval=*(tptr+4); ND_PRINT((ndo, "\n\t Willing:%d, CBS:%d, RES:%d, Max TCs:%d", tval >> 7, (tval >> 6) & 0x02, (tval >> 3) & 0x07, tval & 0x07)); /*Print Priority Assignment Table*/ print_ets_priority_assignment_table(ndo, tptr + 5); /*Print TC Bandwidth Table*/ print_tc_bandwidth_table(ndo, tptr + 9); /* Print TSA Assignment Table */ print_tsa_assignment_table(ndo, tptr + 17); break; case LLDP_PRIVATE_8021_SUBTYPE_ETS_RECOMMENDATION: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_ETS_RECOMMENDATION_LENGTH) { return hexdump; } ND_PRINT((ndo, "\n\t RES: %d", *(tptr + 4))); /*Print Priority Assignment Table */ print_ets_priority_assignment_table(ndo, tptr + 5); /*Print TC Bandwidth Table */ print_tc_bandwidth_table(ndo, tptr + 9); /* Print TSA Assignment Table */ print_tsa_assignment_table(ndo, tptr + 17); break; case LLDP_PRIVATE_8021_SUBTYPE_PFC_CONFIGURATION: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_PFC_CONFIGURATION_LENGTH) { return hexdump; } tval=*(tptr+4); ND_PRINT((ndo, "\n\t Willing: %d, MBC: %d, RES: %d, PFC cap:%d ", tval >> 7, (tval >> 6) & 0x01, (tval >> 4) & 0x03, (tval & 0x0f))); ND_PRINT((ndo, "\n\t PFC Enable")); tval=*(tptr+5); ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : ")); for(i=0;i<NO_OF_BITS;i++) ND_PRINT((ndo, "%-2d ", (tval >> i) & 0x01)); break; case LLDP_PRIVATE_8021_SUBTYPE_APPLICATION_PRIORITY: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_APPLICATION_PRIORITY_MIN_LENGTH) { return hexdump; } ND_PRINT((ndo, "\n\t RES: %d", *(tptr + 4))); if(tlv_len<=LLDP_PRIVATE_8021_SUBTYPE_APPLICATION_PRIORITY_MIN_LENGTH){ return hexdump; } /* Length of Application Priority Table */ sublen=tlv_len-5; if(sublen%3!=0){ return hexdump; } i=0; ND_PRINT((ndo, "\n\t Application Priority Table")); while(i<sublen) { tval=*(tptr+i+5); ND_PRINT((ndo, "\n\t Priority: %u, RES: %u, Sel: %u, Protocol ID: %u", tval >> 5, (tval >> 3) & 0x03, (tval & 0x07), EXTRACT_16BITS(tptr + i + 5))); i=i+3; } break; case LLDP_PRIVATE_8021_SUBTYPE_EVB: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_EVB_LENGTH){ return hexdump; } ND_PRINT((ndo, "\n\t EVB Bridge Status")); tval=*(tptr+4); ND_PRINT((ndo, "\n\t RES: %d, BGID: %d, RRCAP: %d, RRCTR: %d", tval >> 3, (tval >> 2) & 0x01, (tval >> 1) & 0x01, tval & 0x01)); ND_PRINT((ndo, "\n\t EVB Station Status")); tval=*(tptr+5); ND_PRINT((ndo, "\n\t RES: %d, SGID: %d, RRREQ: %d,RRSTAT: %d", tval >> 4, (tval >> 3) & 0x01, (tval >> 2) & 0x01, tval & 0x03)); tval=*(tptr+6); ND_PRINT((ndo, "\n\t R: %d, RTE: %d, ",tval >> 5, tval & 0x1f)); tval=*(tptr+7); ND_PRINT((ndo, "EVB Mode: %s [%d]", tok2str(lldp_evb_mode_values, "unknown", tval >> 6), tval >> 6)); ND_PRINT((ndo, "\n\t ROL: %d, RWD: %d, ", (tval >> 5) & 0x01, tval & 0x1f)); tval=*(tptr+8); ND_PRINT((ndo, "RES: %d, ROL: %d, RKA: %d", tval >> 6, (tval >> 5) & 0x01, tval & 0x1f)); break; case LLDP_PRIVATE_8021_SUBTYPE_CDCP: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CDCP_MIN_LENGTH){ return hexdump; } tval=*(tptr+4); ND_PRINT((ndo, "\n\t Role: %d, RES: %d, Scomp: %d ", tval >> 7, (tval >> 4) & 0x07, (tval >> 3) & 0x01)); ND_PRINT((ndo, "ChnCap: %d", EXTRACT_16BITS(tptr + 6) & 0x0fff)); sublen=tlv_len-8; if(sublen%3!=0) { return hexdump; } i=0; while(i<sublen) { tval=EXTRACT_24BITS(tptr+i+8); ND_PRINT((ndo, "\n\t SCID: %d, SVID: %d", tval >> 12, tval & 0x000fff)); i=i+3; } break; default: hexdump = TRUE; break; } return hexdump; }
lldp_private_8021_print(netdissect_options *ndo, const u_char *tptr, u_int tlv_len) { int subtype, hexdump = FALSE; u_int sublen; u_int tval; u_int i; if (tlv_len < 4) { return hexdump; } subtype = *(tptr+3); ND_PRINT((ndo, "\n\t %s Subtype (%u)", tok2str(lldp_8021_subtype_values, "unknown", subtype), subtype)); switch (subtype) { case LLDP_PRIVATE_8021_SUBTYPE_PORT_VLAN_ID: if (tlv_len < 6) { return hexdump; } ND_PRINT((ndo, "\n\t port vlan id (PVID): %u", EXTRACT_16BITS(tptr + 4))); break; case LLDP_PRIVATE_8021_SUBTYPE_PROTOCOL_VLAN_ID: if (tlv_len < 7) { return hexdump; } ND_PRINT((ndo, "\n\t port and protocol vlan id (PPVID): %u, flags [%s] (0x%02x)", EXTRACT_16BITS(tptr+5), bittok2str(lldp_8021_port_protocol_id_values, "none", *(tptr+4)), *(tptr + 4))); break; case LLDP_PRIVATE_8021_SUBTYPE_VLAN_NAME: if (tlv_len < 6) { return hexdump; } ND_PRINT((ndo, "\n\t vlan id (VID): %u", EXTRACT_16BITS(tptr + 4))); if (tlv_len < 7) { return hexdump; } sublen = *(tptr+6); if (tlv_len < 7+sublen) { return hexdump; } ND_PRINT((ndo, "\n\t vlan name: ")); safeputs(ndo, tptr + 7, sublen); break; case LLDP_PRIVATE_8021_SUBTYPE_PROTOCOL_IDENTITY: if (tlv_len < 5) { return hexdump; } sublen = *(tptr+4); if (tlv_len < 5+sublen) { return hexdump; } ND_PRINT((ndo, "\n\t protocol identity: ")); safeputs(ndo, tptr + 5, sublen); break; case LLDP_PRIVATE_8021_SUBTYPE_CONGESTION_NOTIFICATION: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CONGESTION_NOTIFICATION_LENGTH){ return hexdump; } tval=*(tptr+4); ND_PRINT((ndo, "\n\t Pre-Priority CNPV Indicator")); ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : ")); for(i=0;i<NO_OF_BITS;i++) ND_PRINT((ndo, "%-2d ", (tval >> i) & 0x01)); tval=*(tptr+5); ND_PRINT((ndo, "\n\t Pre-Priority Ready Indicator")); ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : ")); for(i=0;i<NO_OF_BITS;i++) ND_PRINT((ndo, "%-2d ", (tval >> i) & 0x01)); break; case LLDP_PRIVATE_8021_SUBTYPE_ETS_CONFIGURATION: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_ETS_CONFIGURATION_LENGTH) { return hexdump; } tval=*(tptr+4); ND_PRINT((ndo, "\n\t Willing:%d, CBS:%d, RES:%d, Max TCs:%d", tval >> 7, (tval >> 6) & 0x02, (tval >> 3) & 0x07, tval & 0x07)); /*Print Priority Assignment Table*/ print_ets_priority_assignment_table(ndo, tptr + 5); /*Print TC Bandwidth Table*/ print_tc_bandwidth_table(ndo, tptr + 9); /* Print TSA Assignment Table */ print_tsa_assignment_table(ndo, tptr + 17); break; case LLDP_PRIVATE_8021_SUBTYPE_ETS_RECOMMENDATION: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_ETS_RECOMMENDATION_LENGTH) { return hexdump; } ND_PRINT((ndo, "\n\t RES: %d", *(tptr + 4))); /*Print Priority Assignment Table */ print_ets_priority_assignment_table(ndo, tptr + 5); /*Print TC Bandwidth Table */ print_tc_bandwidth_table(ndo, tptr + 9); /* Print TSA Assignment Table */ print_tsa_assignment_table(ndo, tptr + 17); break; case LLDP_PRIVATE_8021_SUBTYPE_PFC_CONFIGURATION: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_PFC_CONFIGURATION_LENGTH) { return hexdump; } tval=*(tptr+4); ND_PRINT((ndo, "\n\t Willing: %d, MBC: %d, RES: %d, PFC cap:%d ", tval >> 7, (tval >> 6) & 0x01, (tval >> 4) & 0x03, (tval & 0x0f))); ND_PRINT((ndo, "\n\t PFC Enable")); tval=*(tptr+5); ND_PRINT((ndo, "\n\t Priority : 0 1 2 3 4 5 6 7")); ND_PRINT((ndo, "\n\t Value : ")); for(i=0;i<NO_OF_BITS;i++) ND_PRINT((ndo, "%-2d ", (tval >> i) & 0x01)); break; case LLDP_PRIVATE_8021_SUBTYPE_APPLICATION_PRIORITY: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_APPLICATION_PRIORITY_MIN_LENGTH) { return hexdump; } ND_PRINT((ndo, "\n\t RES: %d", *(tptr + 4))); if(tlv_len<=LLDP_PRIVATE_8021_SUBTYPE_APPLICATION_PRIORITY_MIN_LENGTH){ return hexdump; } /* Length of Application Priority Table */ sublen=tlv_len-5; if(sublen%3!=0){ return hexdump; } i=0; ND_PRINT((ndo, "\n\t Application Priority Table")); while(i<sublen) { tval=*(tptr+i+5); ND_PRINT((ndo, "\n\t Priority: %u, RES: %u, Sel: %u, Protocol ID: %u", tval >> 5, (tval >> 3) & 0x03, (tval & 0x07), EXTRACT_16BITS(tptr + i + 5))); i=i+3; } break; case LLDP_PRIVATE_8021_SUBTYPE_EVB: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_EVB_LENGTH){ return hexdump; } ND_PRINT((ndo, "\n\t EVB Bridge Status")); tval=*(tptr+4); ND_PRINT((ndo, "\n\t RES: %d, BGID: %d, RRCAP: %d, RRCTR: %d", tval >> 3, (tval >> 2) & 0x01, (tval >> 1) & 0x01, tval & 0x01)); ND_PRINT((ndo, "\n\t EVB Station Status")); tval=*(tptr+5); ND_PRINT((ndo, "\n\t RES: %d, SGID: %d, RRREQ: %d,RRSTAT: %d", tval >> 4, (tval >> 3) & 0x01, (tval >> 2) & 0x01, tval & 0x03)); tval=*(tptr+6); ND_PRINT((ndo, "\n\t R: %d, RTE: %d, ",tval >> 5, tval & 0x1f)); tval=*(tptr+7); ND_PRINT((ndo, "EVB Mode: %s [%d]", tok2str(lldp_evb_mode_values, "unknown", tval >> 6), tval >> 6)); ND_PRINT((ndo, "\n\t ROL: %d, RWD: %d, ", (tval >> 5) & 0x01, tval & 0x1f)); tval=*(tptr+8); ND_PRINT((ndo, "RES: %d, ROL: %d, RKA: %d", tval >> 6, (tval >> 5) & 0x01, tval & 0x1f)); break; case LLDP_PRIVATE_8021_SUBTYPE_CDCP: if(tlv_len<LLDP_PRIVATE_8021_SUBTYPE_CDCP_MIN_LENGTH){ return hexdump; } tval=*(tptr+4); ND_PRINT((ndo, "\n\t Role: %d, RES: %d, Scomp: %d ", tval >> 7, (tval >> 4) & 0x07, (tval >> 3) & 0x01)); ND_PRINT((ndo, "ChnCap: %d", EXTRACT_16BITS(tptr + 6) & 0x0fff)); sublen=tlv_len-8; if(sublen%3!=0) { return hexdump; } i=0; while(i<sublen) { tval=EXTRACT_24BITS(tptr+i+8); ND_PRINT((ndo, "\n\t SCID: %d, SVID: %d", tval >> 12, tval & 0x000fff)); i=i+3; } break; default: hexdump = TRUE; break; } return hexdump; }
C
tcpdump
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 free_Write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_FreeSpaceBox *ptr = (GF_FreeSpaceBox *)s; if (ptr->original_4cc) { u32 t = s->type; s->type=ptr->original_4cc; e = gf_isom_box_write_header(s, bs); s->type=t; } else { e = gf_isom_box_write_header(s, bs); } if (e) return e; if (ptr->dataSize) { if (ptr->data) { gf_bs_write_data(bs, ptr->data, ptr->dataSize); } else { u32 i = 0; while (i<ptr->dataSize) { gf_bs_write_u8(bs, 0); i++; } } } return GF_OK; }
GF_Err free_Write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_FreeSpaceBox *ptr = (GF_FreeSpaceBox *)s; if (ptr->original_4cc) { u32 t = s->type; s->type=ptr->original_4cc; e = gf_isom_box_write_header(s, bs); s->type=t; } else { e = gf_isom_box_write_header(s, bs); } if (e) return e; if (ptr->dataSize) { if (ptr->data) { gf_bs_write_data(bs, ptr->data, ptr->dataSize); } else { u32 i = 0; while (i<ptr->dataSize) { gf_bs_write_u8(bs, 0); i++; } } } return GF_OK; }
C
gpac
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 GfxICCBasedColorSpace::getGray(GfxColor *color, GfxGray *gray) { #ifdef USE_CMS if (transform != 0 && displayPixelType == PT_GRAY) { Guchar in[gfxColorMaxComps]; Guchar out[gfxColorMaxComps]; for (int i = 0;i < nComps;i++) { in[i] = colToByte(color->c[i]); } transform->doTransform(in,out,1); *gray = byteToCol(out[0]); } else { GfxRGB rgb; getRGB(color,&rgb); *gray = clip01((GfxColorComp)(0.3 * rgb.r + 0.59 * rgb.g + 0.11 * rgb.b + 0.5)); } #else alt->getGray(color, gray); #endif }
void GfxICCBasedColorSpace::getGray(GfxColor *color, GfxGray *gray) { #ifdef USE_CMS if (transform != 0 && displayPixelType == PT_GRAY) { Guchar in[gfxColorMaxComps]; Guchar out[gfxColorMaxComps]; for (int i = 0;i < nComps;i++) { in[i] = colToByte(color->c[i]); } transform->doTransform(in,out,1); *gray = byteToCol(out[0]); } else { GfxRGB rgb; getRGB(color,&rgb); *gray = clip01((GfxColorComp)(0.3 * rgb.r + 0.59 * rgb.g + 0.11 * rgb.b + 0.5)); } #else alt->getGray(color, gray); #endif }
CPP
poppler
0
CVE-2013-7421
https://www.cvedetails.com/cve/CVE-2013-7421/
CWE-264
https://github.com/torvalds/linux/commit/5d26a105b5a73e5635eae0629b42fa0a90e07b7b
5d26a105b5a73e5635eae0629b42fa0a90e07b7b
crypto: prefix module autoloading with "crypto-" This prefixes all crypto module loading with "crypto-" so we never run the risk of exposing module auto-loading to userspace via a crypto API, as demonstrated by Mathias Krause: https://lkml.org/lkml/2013/3/4/70 Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
static void __exit sha512_neon_mod_fini(void) { crypto_unregister_shashes(algs, ARRAY_SIZE(algs)); }
static void __exit sha512_neon_mod_fini(void) { crypto_unregister_shashes(algs, ARRAY_SIZE(algs)); }
C
linux
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 revoke_delegation(struct nfs4_delegation *dp) { struct nfs4_client *clp = dp->dl_stid.sc_client; WARN_ON(!list_empty(&dp->dl_recall_lru)); put_clnt_odstate(dp->dl_clnt_odstate); nfs4_put_deleg_lease(dp->dl_stid.sc_file); if (clp->cl_minorversion == 0) nfs4_put_stid(&dp->dl_stid); else { dp->dl_stid.sc_type = NFS4_REVOKED_DELEG_STID; spin_lock(&clp->cl_lock); list_add(&dp->dl_recall_lru, &clp->cl_revoked); spin_unlock(&clp->cl_lock); } }
static void revoke_delegation(struct nfs4_delegation *dp) { struct nfs4_client *clp = dp->dl_stid.sc_client; WARN_ON(!list_empty(&dp->dl_recall_lru)); put_clnt_odstate(dp->dl_clnt_odstate); nfs4_put_deleg_lease(dp->dl_stid.sc_file); if (clp->cl_minorversion == 0) nfs4_put_stid(&dp->dl_stid); else { dp->dl_stid.sc_type = NFS4_REVOKED_DELEG_STID; spin_lock(&clp->cl_lock); list_add(&dp->dl_recall_lru, &clp->cl_revoked); spin_unlock(&clp->cl_lock); } }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/f2f703241635fa96fa630b83afcc9a330cc21b7e
f2f703241635fa96fa630b83afcc9a330cc21b7e
CrOS Shelf: Get rid of 'split view' mode for shelf background In the new UI, "maximized" and "split view" are treated the same in specs, so there is no more need for a separate "split view" mode. This folds it into the "maximized" mode. Note that the only thing that _seems_ different in shelf_background_animator is ShelfBackgroundAnimator::kMaxAlpha (255) vs kShelfTranslucentMaximizedWindow (254), which should be virtually impossible to distinguish. This CL therefore does not have any visual effect (and doesn't directly fix the linked bug, but is relevant). Bug: 899289 Change-Id: I60947338176ac15ca016b1ba4edf13d16362cb24 Reviewed-on: https://chromium-review.googlesource.com/c/1469741 Commit-Queue: Xiyuan Xia <[email protected]> Reviewed-by: Xiyuan Xia <[email protected]> Auto-Submit: Manu Cornet <[email protected]> Cr-Commit-Position: refs/heads/master@{#631752}
void ShelfBackgroundAnimator::AnimationValues::SetTargetValues( SkColor target_color) { initial_color_ = current_color_; target_color_ = target_color; }
void ShelfBackgroundAnimator::AnimationValues::SetTargetValues( SkColor target_color) { initial_color_ = current_color_; target_color_ = target_color; }
C
Chrome
0
CVE-2013-6636
https://www.cvedetails.com/cve/CVE-2013-6636/
CWE-20
https://github.com/chromium/chromium/commit/5cfe3023574666663d970ce48cdbc8ed15ce61d9
5cfe3023574666663d970ce48cdbc8ed15ce61d9
Clear out some minor TODOs. BUG=none Review URL: https://codereview.chromium.org/1047063002 Cr-Commit-Position: refs/heads/master@{#322959}
void AutofillDialogViews::GetUserInput(DialogSection section, FieldValueMap* output) { DetailsGroup* group = GroupForSection(section); for (TextfieldMap::const_iterator it = group->textfields.begin(); it != group->textfields.end(); ++it) { output->insert(std::make_pair(it->first, it->second->GetText())); } for (ComboboxMap::const_iterator it = group->comboboxes.begin(); it != group->comboboxes.end(); ++it) { output->insert(std::make_pair(it->first, it->second->model()->GetItemAt(it->second->selected_index()))); } }
void AutofillDialogViews::GetUserInput(DialogSection section, FieldValueMap* output) { DetailsGroup* group = GroupForSection(section); for (TextfieldMap::const_iterator it = group->textfields.begin(); it != group->textfields.end(); ++it) { output->insert(std::make_pair(it->first, it->second->GetText())); } for (ComboboxMap::const_iterator it = group->comboboxes.begin(); it != group->comboboxes.end(); ++it) { output->insert(std::make_pair(it->first, it->second->model()->GetItemAt(it->second->selected_index()))); } }
C
Chrome
0
CVE-2012-5155
https://www.cvedetails.com/cve/CVE-2012-5155/
CWE-264
https://github.com/chromium/chromium/commit/0d7717faeaef5b72434632c95c78bee4883e2573
0d7717faeaef5b72434632c95c78bee4883e2573
Fix OS_MACOS typos. Should be OS_MACOSX. BUG=163208 TEST=none Review URL: https://codereview.chromium.org/12829005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@189130 0039d316-1c4b-4281-b951-d872f2087c98
virtual ~WindowedPersonalDataManagerObserver() { if (!infobar_service_) return; InfoBarDelegate* infobar = NULL; if (infobar_service_->GetInfoBarCount() > 0 && (infobar = infobar_service_->GetInfoBarDelegateAt(0))) { infobar_service_->RemoveInfoBar(infobar); } }
virtual ~WindowedPersonalDataManagerObserver() { if (!infobar_service_) return; InfoBarDelegate* infobar = NULL; if (infobar_service_->GetInfoBarCount() > 0 && (infobar = infobar_service_->GetInfoBarDelegateAt(0))) { infobar_service_->RemoveInfoBar(infobar); } }
C
Chrome
0
CVE-2017-5112
https://www.cvedetails.com/cve/CVE-2017-5112/
CWE-119
https://github.com/chromium/chromium/commit/f6ac1dba5e36f338a490752a2cbef3339096d9fe
f6ac1dba5e36f338a490752a2cbef3339096d9fe
Reset ES3 pixel pack parameters and PIXEL_PACK_BUFFER binding in DrawingBuffer before ReadPixels() and recover them later. BUG=740603 TEST=new conformance test [email protected],[email protected] Change-Id: I3ea54c6cc34f34e249f7c8b9f792d93c5e1958f4 Reviewed-on: https://chromium-review.googlesource.com/570840 Reviewed-by: Antoine Labour <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Commit-Queue: Zhenyao Mo <[email protected]> Cr-Commit-Position: refs/heads/master@{#486518}
void WebGL2RenderingContextBase::bufferData( GLenum target, MaybeShared<DOMArrayBufferView> data, GLenum usage) { WebGLRenderingContextBase::bufferData(target, data, usage); }
void WebGL2RenderingContextBase::bufferData( GLenum target, MaybeShared<DOMArrayBufferView> data, GLenum usage) { WebGLRenderingContextBase::bufferData(target, data, usage); }
C
Chrome
0
CVE-2017-11143
https://www.cvedetails.com/cve/CVE-2017-11143/
CWE-502
https://git.php.net/?p=php-src.git;a=commit;h=2aae60461c2ff7b7fbcdd194c789ac841d0747d7
2aae60461c2ff7b7fbcdd194c789ac841d0747d7
null
static void php_wddx_serialize_boolean(wddx_packet *packet, zval *var) { php_wddx_add_chunk(packet, Z_LVAL_P(var) ? WDDX_BOOLEAN_TRUE : WDDX_BOOLEAN_FALSE); }
static void php_wddx_serialize_boolean(wddx_packet *packet, zval *var) { php_wddx_add_chunk(packet, Z_LVAL_P(var) ? WDDX_BOOLEAN_TRUE : WDDX_BOOLEAN_FALSE); }
C
php
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 stringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); TestObjectPythonV8Internal::stringAttributeAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
static void stringAttributeAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter"); TestObjectPythonV8Internal::stringAttributeAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/26917dc40fb9dc7ef74fa9e0e8fd221e9b857993
26917dc40fb9dc7ef74fa9e0e8fd221e9b857993
2011-02-09 Abhishek Arya <[email protected]> Reviewed by James Robinson. [Chromium] Issue 72387: Integer bounds crash in LayerTilerChromium::resizeLayer https://bugs.webkit.org/show_bug.cgi?id=54132 * platform/graphics/chromium/LayerTilerChromium.cpp: (WebCore::LayerTilerChromium::resizeLayer): git-svn-id: svn://svn.chromium.org/blink/trunk@78143 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void LayerTilerChromium::setTileSize(const IntSize& size) { if (m_tileSize == size) return; reset(); m_tileSize = size; m_tilePixels = adoptArrayPtr(new uint8_t[m_tileSize.width() * m_tileSize.height() * 4]); }
void LayerTilerChromium::setTileSize(const IntSize& size) { if (m_tileSize == size) return; reset(); m_tileSize = size; m_tilePixels = adoptArrayPtr(new uint8_t[m_tileSize.width() * m_tileSize.height() * 4]); }
C
Chrome
0
CVE-2018-18350
https://www.cvedetails.com/cve/CVE-2018-18350/
null
https://github.com/chromium/chromium/commit/d683fb12566eaec180ee0e0506288f46cc7a43e7
d683fb12566eaec180ee0e0506288f46cc7a43e7
Inherit CSP when self-navigating to local-scheme URL As the linked bug example shows, we should inherit CSP when we navigate to a local-scheme URL (even if we are in a main browsing context). Bug: 799747 Change-Id: I8413aa8e8049461ebcf0ffbf7b04c41d1340af02 Reviewed-on: https://chromium-review.googlesource.com/c/1234337 Reviewed-by: Mike West <[email protected]> Commit-Queue: Andy Paicu <[email protected]> Cr-Commit-Position: refs/heads/master@{#597889}
static WebHistoryCommitType LoadTypeToCommitType(WebFrameLoadType type) { switch (type) { case WebFrameLoadType::kStandard: return kWebStandardCommit; case WebFrameLoadType::kBackForward: return kWebBackForwardCommit; case WebFrameLoadType::kReload: case WebFrameLoadType::kReplaceCurrentItem: case WebFrameLoadType::kReloadBypassingCache: return kWebHistoryInertCommit; } NOTREACHED(); return kWebHistoryInertCommit; }
static WebHistoryCommitType LoadTypeToCommitType(WebFrameLoadType type) { switch (type) { case WebFrameLoadType::kStandard: return kWebStandardCommit; case WebFrameLoadType::kBackForward: return kWebBackForwardCommit; case WebFrameLoadType::kReload: case WebFrameLoadType::kReplaceCurrentItem: case WebFrameLoadType::kReloadBypassingCache: return kWebHistoryInertCommit; } NOTREACHED(); return kWebHistoryInertCommit; }
C
Chrome
0
CVE-2015-1265
https://www.cvedetails.com/cve/CVE-2015-1265/
null
https://github.com/chromium/chromium/commit/d8fccaec4e73a9120074293c1997f963f810c9dd
d8fccaec4e73a9120074293c1997f963f810c9dd
Always initialize |m_totalWidth| in HarfBuzzShaper::shape. [email protected] BUG=476647 Review URL: https://codereview.chromium.org/1108663003 git-svn-id: svn://svn.chromium.org/blink/trunk@194541 bbb929c8-8fbe-4397-9dbb-9b2b20218538
inline void HarfBuzzShaper::HarfBuzzRun::applyShapeResult(hb_buffer_t* harfBuzzBuffer) { m_numGlyphs = hb_buffer_get_length(harfBuzzBuffer); m_glyphs.resize(m_numGlyphs); m_advances.resize(m_numGlyphs); m_glyphToCharacterIndexes.resize(m_numGlyphs); m_offsets.resize(m_numGlyphs); }
inline void HarfBuzzShaper::HarfBuzzRun::applyShapeResult(hb_buffer_t* harfBuzzBuffer) { m_numGlyphs = hb_buffer_get_length(harfBuzzBuffer); m_glyphs.resize(m_numGlyphs); m_advances.resize(m_numGlyphs); m_glyphToCharacterIndexes.resize(m_numGlyphs); m_offsets.resize(m_numGlyphs); }
C
Chrome
0
CVE-2017-15423
https://www.cvedetails.com/cve/CVE-2017-15423/
CWE-310
https://github.com/chromium/chromium/commit/a263d1cf62a9c75be6aaafdec88aacfcef1e8fd2
a263d1cf62a9c75be6aaafdec88aacfcef1e8fd2
Roll src/third_party/boringssl/src 664e99a64..696c13bd6 https://boringssl.googlesource.com/boringssl/+log/664e99a6486c293728097c661332f92bf2d847c6..696c13bd6ab78011adfe7b775519c8b7cc82b604 BUG=778101 Change-Id: I8dda4f3db952597148e3c7937319584698d00e1c Reviewed-on: https://chromium-review.googlesource.com/747941 Reviewed-by: Avi Drissman <[email protected]> Reviewed-by: David Benjamin <[email protected]> Commit-Queue: Steven Valdez <[email protected]> Cr-Commit-Position: refs/heads/master@{#513774}
void RenderThreadImpl::CreateView(mojom::CreateViewParamsPtr params) { CompositorDependencies* compositor_deps = this; is_scroll_animator_enabled_ = params->web_preferences.enable_scroll_animator; RenderViewImpl::Create(compositor_deps, std::move(params), RenderWidget::ShowCallback()); }
void RenderThreadImpl::CreateView(mojom::CreateViewParamsPtr params) { CompositorDependencies* compositor_deps = this; is_scroll_animator_enabled_ = params->web_preferences.enable_scroll_animator; RenderViewImpl::Create(compositor_deps, std::move(params), RenderWidget::ShowCallback()); }
C
Chrome
0
CVE-2012-2900
https://www.cvedetails.com/cve/CVE-2012-2900/
null
https://github.com/chromium/chromium/commit/9597042cad54926f50d58f5ada39205eb734d7be
9597042cad54926f50d58f5ada39205eb734d7be
Revert 137988 - VAVDA is the hardware video decode accelerator for Chrome on Linux and ChromeOS for Intel CPUs (Sandy Bridge and newer). This CL enables VAVDA acceleration for ChromeOS, both for HTML5 video and Flash. The feature is currently hidden behind a command line flag and can be enabled by adding the --enable-vaapi parameter to command line. BUG=117062 TEST=Manual runs of test streams. Change-Id: I386e16739e2ef2230f52a0a434971b33d8654699 Review URL: https://chromiumcodereview.appspot.com/9814001 This is causing crbug.com/129103 [email protected] Review URL: https://chromiumcodereview.appspot.com/10411066 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138208 0039d316-1c4b-4281-b951-d872f2087c98
void H264DPB::MarkAllUnusedForRef() { for (size_t i = 0; i < pics_.size(); ++i) pics_[i]->ref = false; }
void H264DPB::MarkAllUnusedForRef() { for (size_t i = 0; i < pics_.size(); ++i) pics_[i]->ref = false; }
C
Chrome
0
CVE-2011-3104
https://www.cvedetails.com/cve/CVE-2011-3104/
CWE-119
https://github.com/chromium/chromium/commit/6b5f83842b5edb5d4bd6684b196b3630c6769731
6b5f83842b5edb5d4bd6684b196b3630c6769731
[i18n-fixlet] Make strings branding specific in extension code. IDS_EXTENSIONS_UNINSTALL IDS_EXTENSIONS_INCOGNITO_WARNING IDS_EXTENSION_INSTALLED_HEADING IDS_EXTENSION_ALERT_ITEM_EXTERNAL And fix a $1 $1 bug. IDS_EXTENSION_INLINE_INSTALL_PROMPT_TITLE BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/9107061 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@118018 0039d316-1c4b-4281-b951-d872f2087c98
DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue( ExtensionService* service, const Extension* extension, const std::vector<ExtensionPage>& pages, const ExtensionWarningSet* warnings_set, bool enabled, bool terminated) { DictionaryValue* extension_data = new DictionaryValue(); GURL icon = ExtensionIconSource::GetIconURL(extension, Extension::EXTENSION_ICON_MEDIUM, ExtensionIconSet::MATCH_BIGGER, !enabled, NULL); extension_data->SetString("id", extension->id()); extension_data->SetString("name", extension->name()); extension_data->SetString("description", extension->description()); if (extension->location() == Extension::LOAD) extension_data->SetString("path", extension->path().value()); extension_data->SetString("version", extension->version()->GetString()); extension_data->SetString("icon", icon.spec()); extension_data->SetBoolean("isUnpacked", extension->location() == Extension::LOAD); extension_data->SetBoolean("mayDisable", Extension::UserMayDisable(extension->location())); extension_data->SetBoolean("enabled", enabled); extension_data->SetBoolean("terminated", terminated); extension_data->SetBoolean("enabledIncognito", service ? service->IsIncognitoEnabled(extension->id()) : false); extension_data->SetBoolean("wantsFileAccess", extension->wants_file_access()); extension_data->SetBoolean("allowFileAccess", service ? service->AllowFileAccess(extension) : false); extension_data->SetBoolean("allow_reload", extension->location() == Extension::LOAD); extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app()); if (extension->location() == Extension::LOAD) extension_data->SetInteger("order", 1); else extension_data->SetInteger("order", 2); if (!extension->options_url().is_empty() && enabled) extension_data->SetString("options_url", extension->options_url().spec()); if (service && !service->GetBrowserActionVisibility(extension)) extension_data->SetBoolean("enable_show_button", true); ListValue* views = new ListValue; for (std::vector<ExtensionPage>::const_iterator iter = pages.begin(); iter != pages.end(); ++iter) { DictionaryValue* view_value = new DictionaryValue; if (iter->url.scheme() == chrome::kExtensionScheme) { view_value->SetString("path", iter->url.path().substr(1)); } else { view_value->SetString("path", iter->url.spec()); } view_value->SetInteger("renderViewId", iter->render_view_id); view_value->SetInteger("renderProcessId", iter->render_process_id); view_value->SetBoolean("incognito", iter->incognito); views->Append(view_value); } extension_data->Set("views", views); extension_data->SetBoolean("hasPopupAction", extension->browser_action() || extension->page_action()); extension_data->SetString("homepageUrl", extension->GetHomepageURL().spec()); ListValue* warnings_list = new ListValue; if (warnings_set) { std::set<ExtensionWarningSet::WarningType> warnings; warnings_set->GetWarningsAffectingExtension(extension->id(), &warnings); for (std::set<ExtensionWarningSet::WarningType>::const_iterator iter = warnings.begin(); iter != warnings.end(); ++iter) { string16 warning_string(ExtensionWarningSet::GetLocalizedWarning(*iter)); warnings_list->Append(Value::CreateStringValue(warning_string)); } } extension_data->Set("warnings", warnings_list); return extension_data; }
DictionaryValue* ExtensionSettingsHandler::CreateExtensionDetailValue( ExtensionService* service, const Extension* extension, const std::vector<ExtensionPage>& pages, const ExtensionWarningSet* warnings_set, bool enabled, bool terminated) { DictionaryValue* extension_data = new DictionaryValue(); GURL icon = ExtensionIconSource::GetIconURL(extension, Extension::EXTENSION_ICON_MEDIUM, ExtensionIconSet::MATCH_BIGGER, !enabled, NULL); extension_data->SetString("id", extension->id()); extension_data->SetString("name", extension->name()); extension_data->SetString("description", extension->description()); if (extension->location() == Extension::LOAD) extension_data->SetString("path", extension->path().value()); extension_data->SetString("version", extension->version()->GetString()); extension_data->SetString("icon", icon.spec()); extension_data->SetBoolean("isUnpacked", extension->location() == Extension::LOAD); extension_data->SetBoolean("mayDisable", Extension::UserMayDisable(extension->location())); extension_data->SetBoolean("enabled", enabled); extension_data->SetBoolean("terminated", terminated); extension_data->SetBoolean("enabledIncognito", service ? service->IsIncognitoEnabled(extension->id()) : false); extension_data->SetBoolean("wantsFileAccess", extension->wants_file_access()); extension_data->SetBoolean("allowFileAccess", service ? service->AllowFileAccess(extension) : false); extension_data->SetBoolean("allow_reload", extension->location() == Extension::LOAD); extension_data->SetBoolean("is_hosted_app", extension->is_hosted_app()); if (extension->location() == Extension::LOAD) extension_data->SetInteger("order", 1); else extension_data->SetInteger("order", 2); if (!extension->options_url().is_empty() && enabled) extension_data->SetString("options_url", extension->options_url().spec()); if (service && !service->GetBrowserActionVisibility(extension)) extension_data->SetBoolean("enable_show_button", true); ListValue* views = new ListValue; for (std::vector<ExtensionPage>::const_iterator iter = pages.begin(); iter != pages.end(); ++iter) { DictionaryValue* view_value = new DictionaryValue; if (iter->url.scheme() == chrome::kExtensionScheme) { view_value->SetString("path", iter->url.path().substr(1)); } else { view_value->SetString("path", iter->url.spec()); } view_value->SetInteger("renderViewId", iter->render_view_id); view_value->SetInteger("renderProcessId", iter->render_process_id); view_value->SetBoolean("incognito", iter->incognito); views->Append(view_value); } extension_data->Set("views", views); extension_data->SetBoolean("hasPopupAction", extension->browser_action() || extension->page_action()); extension_data->SetString("homepageUrl", extension->GetHomepageURL().spec()); ListValue* warnings_list = new ListValue; if (warnings_set) { std::set<ExtensionWarningSet::WarningType> warnings; warnings_set->GetWarningsAffectingExtension(extension->id(), &warnings); for (std::set<ExtensionWarningSet::WarningType>::const_iterator iter = warnings.begin(); iter != warnings.end(); ++iter) { string16 warning_string(ExtensionWarningSet::GetLocalizedWarning(*iter)); warnings_list->Append(Value::CreateStringValue(warning_string)); } } extension_data->Set("warnings", warnings_list); return extension_data; }
C
Chrome
0
CVE-2017-5093
https://www.cvedetails.com/cve/CVE-2017-5093/
CWE-20
https://github.com/chromium/chromium/commit/0720b02e4f303ea6b114d4ae9453e3a7ff55f8dc
0720b02e4f303ea6b114d4ae9453e3a7ff55f8dc
If JavaScript shows a dialog, cause the page to lose fullscreen. BUG=670135, 550017, 726761, 728276 Review-Url: https://codereview.chromium.org/2906133004 Cr-Commit-Position: refs/heads/master@{#478884}
void WebContentsImpl::NotifyWebContentsFocused() { for (auto& observer : observers_) observer.OnWebContentsFocused(); }
void WebContentsImpl::NotifyWebContentsFocused() { for (auto& observer : observers_) observer.OnWebContentsFocused(); }
C
Chrome
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::CreateProxiesForNewRenderFrameHost( SiteInstance* old_instance, SiteInstance* new_instance) { if (new_instance->IsRelatedSiteInstance(old_instance)) { CreateOpenerProxies(new_instance, frame_tree_node_); } else if (SiteIsolationPolicy::AreCrossProcessFramesPossible()) { frame_tree_node_->frame_tree()->CreateProxiesForSiteInstance( frame_tree_node_, new_instance); } }
void RenderFrameHostManager::CreateProxiesForNewRenderFrameHost( SiteInstance* old_instance, SiteInstance* new_instance) { if (new_instance->IsRelatedSiteInstance(old_instance)) { CreateOpenerProxies(new_instance, frame_tree_node_); } else if (SiteIsolationPolicy::AreCrossProcessFramesPossible()) { frame_tree_node_->frame_tree()->CreateProxiesForSiteInstance( frame_tree_node_, new_instance); } }
C
Chrome
0
CVE-2014-2673
https://www.cvedetails.com/cve/CVE-2014-2673/
CWE-20
https://github.com/torvalds/linux/commit/621b5060e823301d0cba4cb52a7ee3491922d291
621b5060e823301d0cba4cb52a7ee3491922d291
powerpc/tm: Fix crash when forking inside a transaction When we fork/clone we currently don't copy any of the TM state to the new thread. This results in a TM bad thing (program check) when the new process is switched in as the kernel does a tmrechkpt with TEXASR FS not set. Also, since R1 is from userspace, we trigger the bad kernel stack pointer detection. So we end up with something like this: Bad kernel stack pointer 0 at c0000000000404fc cpu 0x2: Vector: 700 (Program Check) at [c00000003ffefd40] pc: c0000000000404fc: restore_gprs+0xc0/0x148 lr: 0000000000000000 sp: 0 msr: 9000000100201030 current = 0xc000001dd1417c30 paca = 0xc00000000fe00800 softe: 0 irq_happened: 0x01 pid = 0, comm = swapper/2 WARNING: exception is not recoverable, can't continue The below fixes this by flushing the TM state before we copy the task_struct to the clone. To do this we go through the tmreclaim patch, which removes the checkpointed registers from the CPU and transitions the CPU out of TM suspend mode. Hence we need to call tmrechkpt after to restore the checkpointed state and the TM mode for the current task. To make this fail from userspace is simply: tbegin li r0, 2 sc <boom> Kudos to Adhemerval Zanella Neto for finding this. Signed-off-by: Michael Neuling <[email protected]> cc: Adhemerval Zanella Neto <[email protected]> cc: [email protected] Signed-off-by: Benjamin Herrenschmidt <[email protected]>
int set_unalign_ctl(struct task_struct *tsk, unsigned int val) { tsk->thread.align_ctl = val; return 0; }
int set_unalign_ctl(struct task_struct *tsk, unsigned int val) { tsk->thread.align_ctl = val; return 0; }
C
linux
0
CVE-2017-8284
https://www.cvedetails.com/cve/CVE-2017-8284/
CWE-94
https://github.com/qemu/qemu/commit/30663fd26c0307e414622c7a8607fbc04f92ec14
30663fd26c0307e414622c7a8607fbc04f92ec14
tcg/i386: Check the size of instruction being translated This fixes the bug: 'user-to-root privesc inside VM via bad translation caching' reported by Jann Horn here: https://bugs.chromium.org/p/project-zero/issues/detail?id=1122 Reviewed-by: Richard Henderson <[email protected]> CC: Peter Maydell <[email protected]> CC: Paolo Bonzini <[email protected]> Reported-by: Jann Horn <[email protected]> Signed-off-by: Pranith Kumar <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
static inline void gen_ins(DisasContext *s, TCGMemOp ot) { if (s->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_string_movl_A0_EDI(s); /* Note: we must do this dummy write first to be restartable in case of page fault. */ tcg_gen_movi_tl(cpu_T0, 0); gen_op_st_v(s, ot, cpu_T0, cpu_A0); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[R_EDX]); tcg_gen_andi_i32(cpu_tmp2_i32, cpu_tmp2_i32, 0xffff); gen_helper_in_func(ot, cpu_T0, cpu_tmp2_i32); gen_op_st_v(s, ot, cpu_T0, cpu_A0); gen_op_movl_T0_Dshift(ot); gen_op_add_reg_T0(s->aflag, R_EDI); gen_bpt_io(s, cpu_tmp2_i32, ot); if (s->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); } }
static inline void gen_ins(DisasContext *s, TCGMemOp ot) { if (s->tb->cflags & CF_USE_ICOUNT) { gen_io_start(); } gen_string_movl_A0_EDI(s); /* Note: we must do this dummy write first to be restartable in case of page fault. */ tcg_gen_movi_tl(cpu_T0, 0); gen_op_st_v(s, ot, cpu_T0, cpu_A0); tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_regs[R_EDX]); tcg_gen_andi_i32(cpu_tmp2_i32, cpu_tmp2_i32, 0xffff); gen_helper_in_func(ot, cpu_T0, cpu_tmp2_i32); gen_op_st_v(s, ot, cpu_T0, cpu_A0); gen_op_movl_T0_Dshift(ot); gen_op_add_reg_T0(s->aflag, R_EDI); gen_bpt_io(s, cpu_tmp2_i32, ot); if (s->tb->cflags & CF_USE_ICOUNT) { gen_io_end(); } }
C
qemu
0
CVE-2019-5837
https://www.cvedetails.com/cve/CVE-2019-5837/
CWE-200
https://github.com/chromium/chromium/commit/04aaacb936a08d70862d6d9d7e8354721ae46be8
04aaacb936a08d70862d6d9d7e8354721ae46be8
Reland "AppCache: Add padding to cross-origin responses." This is a reland of 85b389caa7d725cdd31f59e9a2b79ff54804b7b7 Initialized CacheRecord::padding_size to 0. Original change's description: > AppCache: Add padding to cross-origin responses. > > Bug: 918293 > Change-Id: I4f16640f06feac009d6bbbb624951da6d2669f6c > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1488059 > Commit-Queue: Staphany Park <[email protected]> > Reviewed-by: Victor Costan <[email protected]> > Reviewed-by: Marijn Kruisselbrink <[email protected]> > Cr-Commit-Position: refs/heads/master@{#644624} Bug: 918293 Change-Id: Ie1d3f99c7e8a854d33255a4d66243da2ce16441c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1539906 Reviewed-by: Victor Costan <[email protected]> Commit-Queue: Staphany Park <[email protected]> Cr-Commit-Position: refs/heads/master@{#644719}
bool AppCacheDatabase::DeleteEntriesForCache(int64_t cache_id) { if (!LazyOpen(kDontCreate)) return false; static const char kSql[] = "DELETE FROM Entries WHERE cache_id = ?"; sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, kSql)); statement.BindInt64(0, cache_id); return statement.Run(); }
bool AppCacheDatabase::DeleteEntriesForCache(int64_t cache_id) { if (!LazyOpen(kDontCreate)) return false; static const char kSql[] = "DELETE FROM Entries WHERE cache_id = ?"; sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, kSql)); statement.BindInt64(0, cache_id); return statement.Run(); }
C
Chrome
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 sha512_ssse3_final(struct shash_desc *desc, u8 *out) { struct sha512_state *sctx = shash_desc_ctx(desc); unsigned int i, index, padlen; __be64 *dst = (__be64 *)out; __be64 bits[2]; static const u8 padding[SHA512_BLOCK_SIZE] = { 0x80, }; /* save number of bits */ bits[1] = cpu_to_be64(sctx->count[0] << 3); bits[0] = cpu_to_be64(sctx->count[1] << 3 | sctx->count[0] >> 61); /* Pad out to 112 mod 128 and append length */ index = sctx->count[0] & 0x7f; padlen = (index < 112) ? (112 - index) : ((128+112) - index); if (!irq_fpu_usable()) { crypto_sha512_update(desc, padding, padlen); crypto_sha512_update(desc, (const u8 *)&bits, sizeof(bits)); } else { kernel_fpu_begin(); /* We need to fill a whole block for __sha512_ssse3_update() */ if (padlen <= 112) { sctx->count[0] += padlen; if (sctx->count[0] < padlen) sctx->count[1]++; memcpy(sctx->buf + index, padding, padlen); } else { __sha512_ssse3_update(desc, padding, padlen, index); } __sha512_ssse3_update(desc, (const u8 *)&bits, sizeof(bits), 112); kernel_fpu_end(); } /* Store state in digest */ for (i = 0; i < 8; i++) dst[i] = cpu_to_be64(sctx->state[i]); /* Wipe context */ memset(sctx, 0, sizeof(*sctx)); return 0; }
static int sha512_ssse3_final(struct shash_desc *desc, u8 *out) { struct sha512_state *sctx = shash_desc_ctx(desc); unsigned int i, index, padlen; __be64 *dst = (__be64 *)out; __be64 bits[2]; static const u8 padding[SHA512_BLOCK_SIZE] = { 0x80, }; /* save number of bits */ bits[1] = cpu_to_be64(sctx->count[0] << 3); bits[0] = cpu_to_be64(sctx->count[1] << 3 | sctx->count[0] >> 61); /* Pad out to 112 mod 128 and append length */ index = sctx->count[0] & 0x7f; padlen = (index < 112) ? (112 - index) : ((128+112) - index); if (!irq_fpu_usable()) { crypto_sha512_update(desc, padding, padlen); crypto_sha512_update(desc, (const u8 *)&bits, sizeof(bits)); } else { kernel_fpu_begin(); /* We need to fill a whole block for __sha512_ssse3_update() */ if (padlen <= 112) { sctx->count[0] += padlen; if (sctx->count[0] < padlen) sctx->count[1]++; memcpy(sctx->buf + index, padding, padlen); } else { __sha512_ssse3_update(desc, padding, padlen, index); } __sha512_ssse3_update(desc, (const u8 *)&bits, sizeof(bits), 112); kernel_fpu_end(); } /* Store state in digest */ for (i = 0; i < 8; i++) dst[i] = cpu_to_be64(sctx->state[i]); /* Wipe context */ memset(sctx, 0, sizeof(*sctx)); return 0; }
C
linux
0
CVE-2017-14054
https://www.cvedetails.com/cve/CVE-2017-14054/
CWE-834
https://github.com/FFmpeg/FFmpeg/commit/124eb202e70678539544f6268efc98131f19fa49
124eb202e70678539544f6268efc98131f19fa49
avformat/rmdec: Fix DoS due to lack of eof check Fixes: loop.ivr Found-by: Xiaohei and Wangchu from Alibaba Security Team Signed-off-by: Michael Niedermayer <[email protected]>
rm_ac3_swap_bytes (AVStream *st, AVPacket *pkt) { uint8_t *ptr; int j; if (st->codecpar->codec_id == AV_CODEC_ID_AC3) { ptr = pkt->data; for (j=0;j<pkt->size;j+=2) { FFSWAP(int, ptr[0], ptr[1]); ptr += 2; } } }
rm_ac3_swap_bytes (AVStream *st, AVPacket *pkt) { uint8_t *ptr; int j; if (st->codecpar->codec_id == AV_CODEC_ID_AC3) { ptr = pkt->data; for (j=0;j<pkt->size;j+=2) { FFSWAP(int, ptr[0], ptr[1]); ptr += 2; } } }
C
FFmpeg
0
CVE-2013-3227
https://www.cvedetails.com/cve/CVE-2013-3227/
CWE-200
https://github.com/torvalds/linux/commit/2d6fbfe733f35c6b355c216644e08e149c61b271
2d6fbfe733f35c6b355c216644e08e149c61b271
caif: Fix missing msg_namelen update in caif_seqpkt_recvmsg() The current code does not fill the msg_name member in case it is set. It also does not set the msg_namelen member to 0 and therefore makes net/socket.c leak the local, uninitialized sockaddr_storage variable to userland -- 128 bytes of kernel stack memory. Fix that by simply setting msg_namelen to 0 as obviously nobody cared about caif_seqpkt_recvmsg() not filling the msg_name in case it was set. Cc: Sjur Braendeland <[email protected]> Signed-off-by: Mathias Krause <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void set_tx_flow_off(struct caifsock *cf_sk) { clear_bit(TX_FLOW_ON_BIT, (void *) &cf_sk->flow_state); }
static void set_tx_flow_off(struct caifsock *cf_sk) { clear_bit(TX_FLOW_ON_BIT, (void *) &cf_sk->flow_state); }
C
linux
0
CVE-2014-3173
https://www.cvedetails.com/cve/CVE-2014-3173/
CWE-119
https://github.com/chromium/chromium/commit/ee7579229ff7e9e5ae28bf53aea069251499d7da
ee7579229ff7e9e5ae28bf53aea069251499d7da
Framebuffer clear() needs to consider the situation some draw buffers are disabled. This is when we expose DrawBuffers extension. BUG=376951 TEST=the attached test case, webgl conformance [email protected],[email protected] Review URL: https://codereview.chromium.org/315283002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@275338 0039d316-1c4b-4281-b951-d872f2087c98
error::Error GLES2DecoderImpl::HandleDrawArraysInstancedANGLE( uint32 immediate_data_size, const cmds::DrawArraysInstancedANGLE& c) { if (!features().angle_instanced_arrays) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glDrawArraysInstancedANGLE", "function not available"); return error::kNoError; } return DoDrawArrays("glDrawArraysIntancedANGLE", true, static_cast<GLenum>(c.mode), static_cast<GLint>(c.first), static_cast<GLsizei>(c.count), static_cast<GLsizei>(c.primcount)); }
error::Error GLES2DecoderImpl::HandleDrawArraysInstancedANGLE( uint32 immediate_data_size, const cmds::DrawArraysInstancedANGLE& c) { if (!features().angle_instanced_arrays) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, "glDrawArraysInstancedANGLE", "function not available"); return error::kNoError; } return DoDrawArrays("glDrawArraysIntancedANGLE", true, static_cast<GLenum>(c.mode), static_cast<GLint>(c.first), static_cast<GLsizei>(c.count), static_cast<GLsizei>(c.primcount)); }
C
Chrome
0
CVE-2014-1446
https://www.cvedetails.com/cve/CVE-2014-1446/
CWE-399
https://github.com/torvalds/linux/commit/8e3fbf870481eb53b2d3a322d1fc395ad8b367ed
8e3fbf870481eb53b2d3a322d1fc395ad8b367ed
hamradio/yam: fix info leak in ioctl The yam_ioctl() code fails to initialise the cmd field of the struct yamdrv_ioctl_cfg. Add an explicit memset(0) before filling the structure to avoid the 4-byte info leak. Signed-off-by: Salva Peiró <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void fpga_reset(int iobase) { outb(0, IER(iobase)); outb(LCR_DLAB | LCR_BIT5, LCR(iobase)); outb(1, DLL(iobase)); outb(0, DLM(iobase)); outb(LCR_BIT5, LCR(iobase)); inb(LSR(iobase)); inb(MSR(iobase)); /* turn off FPGA supply voltage */ outb(MCR_OUT1 | MCR_OUT2, MCR(iobase)); delay(100); /* turn on FPGA supply voltage again */ outb(MCR_DTR | MCR_RTS | MCR_OUT1 | MCR_OUT2, MCR(iobase)); delay(100); }
static void fpga_reset(int iobase) { outb(0, IER(iobase)); outb(LCR_DLAB | LCR_BIT5, LCR(iobase)); outb(1, DLL(iobase)); outb(0, DLM(iobase)); outb(LCR_BIT5, LCR(iobase)); inb(LSR(iobase)); inb(MSR(iobase)); /* turn off FPGA supply voltage */ outb(MCR_OUT1 | MCR_OUT2, MCR(iobase)); delay(100); /* turn on FPGA supply voltage again */ outb(MCR_DTR | MCR_RTS | MCR_OUT1 | MCR_OUT2, MCR(iobase)); delay(100); }
C
linux
0
CVE-2016-6254
https://www.cvedetails.com/cve/CVE-2016-6254/
CWE-119
https://github.com/collectd/collectd/commit/b589096f907052b3a4da2b9ccc9b0e2e888dfc18
b589096f907052b3a4da2b9ccc9b0e2e888dfc18
network plugin: Fix heap overflow in parse_packet(). Emilien Gaspar has identified a heap overflow in parse_packet(), the function used by the network plugin to parse incoming network packets. This is a vulnerability in collectd, though the scope is not clear at this point. At the very least specially crafted network packets can be used to crash the daemon. We can't rule out a potential remote code execution though. Fixes: CVE-2016-6254
static int sockent_client_connect (sockent_t *se) /* {{{ */ { static c_complain_t complaint = C_COMPLAIN_INIT_STATIC; struct sockent_client *client; struct addrinfo ai_hints; struct addrinfo *ai_list = NULL, *ai_ptr; int status; if ((se == NULL) || (se->type != SOCKENT_TYPE_CLIENT)) return (EINVAL); client = &se->data.client; if (client->fd >= 0) /* already connected */ return (0); memset (&ai_hints, 0, sizeof (ai_hints)); #ifdef AI_ADDRCONFIG ai_hints.ai_flags |= AI_ADDRCONFIG; #endif ai_hints.ai_family = AF_UNSPEC; ai_hints.ai_socktype = SOCK_DGRAM; ai_hints.ai_protocol = IPPROTO_UDP; status = getaddrinfo (se->node, (se->service != NULL) ? se->service : NET_DEFAULT_PORT, &ai_hints, &ai_list); if (status != 0) { c_complain (LOG_ERR, &complaint, "network plugin: getaddrinfo (%s, %s) failed: %s", (se->node == NULL) ? "(null)" : se->node, (se->service == NULL) ? "(null)" : se->service, gai_strerror (status)); return (-1); } else { c_release (LOG_NOTICE, &complaint, "network plugin: Successfully resolved \"%s\".", se->node); } for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next) { client->fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol); if (client->fd < 0) { char errbuf[1024]; ERROR ("network plugin: socket(2) failed: %s", sstrerror (errno, errbuf, sizeof (errbuf))); continue; } client->addr = malloc (sizeof (*client->addr)); if (client->addr == NULL) { ERROR ("network plugin: malloc failed."); close (client->fd); client->fd = -1; continue; } memset (client->addr, 0, sizeof (*client->addr)); assert (sizeof (*client->addr) >= ai_ptr->ai_addrlen); memcpy (client->addr, ai_ptr->ai_addr, ai_ptr->ai_addrlen); client->addrlen = ai_ptr->ai_addrlen; network_set_ttl (se, ai_ptr); network_set_interface (se, ai_ptr); /* We don't open more than one write-socket per * node/service pair.. */ break; } freeaddrinfo (ai_list); if (client->fd < 0) return (-1); return (0); } /* }}} int sockent_client_connect */
static int sockent_client_connect (sockent_t *se) /* {{{ */ { static c_complain_t complaint = C_COMPLAIN_INIT_STATIC; struct sockent_client *client; struct addrinfo ai_hints; struct addrinfo *ai_list = NULL, *ai_ptr; int status; if ((se == NULL) || (se->type != SOCKENT_TYPE_CLIENT)) return (EINVAL); client = &se->data.client; if (client->fd >= 0) /* already connected */ return (0); memset (&ai_hints, 0, sizeof (ai_hints)); #ifdef AI_ADDRCONFIG ai_hints.ai_flags |= AI_ADDRCONFIG; #endif ai_hints.ai_family = AF_UNSPEC; ai_hints.ai_socktype = SOCK_DGRAM; ai_hints.ai_protocol = IPPROTO_UDP; status = getaddrinfo (se->node, (se->service != NULL) ? se->service : NET_DEFAULT_PORT, &ai_hints, &ai_list); if (status != 0) { c_complain (LOG_ERR, &complaint, "network plugin: getaddrinfo (%s, %s) failed: %s", (se->node == NULL) ? "(null)" : se->node, (se->service == NULL) ? "(null)" : se->service, gai_strerror (status)); return (-1); } else { c_release (LOG_NOTICE, &complaint, "network plugin: Successfully resolved \"%s\".", se->node); } for (ai_ptr = ai_list; ai_ptr != NULL; ai_ptr = ai_ptr->ai_next) { client->fd = socket (ai_ptr->ai_family, ai_ptr->ai_socktype, ai_ptr->ai_protocol); if (client->fd < 0) { char errbuf[1024]; ERROR ("network plugin: socket(2) failed: %s", sstrerror (errno, errbuf, sizeof (errbuf))); continue; } client->addr = malloc (sizeof (*client->addr)); if (client->addr == NULL) { ERROR ("network plugin: malloc failed."); close (client->fd); client->fd = -1; continue; } memset (client->addr, 0, sizeof (*client->addr)); assert (sizeof (*client->addr) >= ai_ptr->ai_addrlen); memcpy (client->addr, ai_ptr->ai_addr, ai_ptr->ai_addrlen); client->addrlen = ai_ptr->ai_addrlen; network_set_ttl (se, ai_ptr); network_set_interface (se, ai_ptr); /* We don't open more than one write-socket per * node/service pair.. */ break; } freeaddrinfo (ai_list); if (client->fd < 0) return (-1); return (0); } /* }}} int sockent_client_connect */
C
collectd
0
CVE-2016-3861
https://www.cvedetails.com/cve/CVE-2016-3861/
CWE-119
https://android.googlesource.com/platform/frameworks/native/+/1f4b49e64adf4623eefda503bca61e253597b9bf
1f4b49e64adf4623eefda503bca61e253597b9bf
Add bound checks to utf16_to_utf8 Bug: 29250543 Change-Id: I518e7b2fe10aaa3f1c1987586a09b1110aff7e1a (cherry picked from commit 7e93b2ddcb49b5365fbe1dab134ffb38e6f1c719)
status_t Parcel::writeUniqueFileDescriptorVector(const std::vector<ScopedFd>& val) { return writeTypedVector(val, &Parcel::writeUniqueFileDescriptor); }
status_t Parcel::writeUniqueFileDescriptorVector(const std::vector<ScopedFd>& val) { return writeTypedVector(val, &Parcel::writeUniqueFileDescriptor); }
C
Android
0
null
null
null
https://github.com/chromium/chromium/commit/99844692ee805d18d5ee7fd9c62f14d2dffa2e06
99844692ee805d18d5ee7fd9c62f14d2dffa2e06
Removing unnecessary DCHECK from SafeBrowsing interstitial. BUG=30079 TEST=None. Review URL: http://codereview.chromium.org/1131003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42049 0039d316-1c4b-4281-b951-d872f2087c98
void InterstitialPage::Disable() { enabled_ = false; }
void InterstitialPage::Disable() { enabled_ = false; }
C
Chrome
0
CVE-2012-2100
https://www.cvedetails.com/cve/CVE-2012-2100/
CWE-189
https://github.com/torvalds/linux/commit/d50f2ab6f050311dbf7b8f5501b25f0bf64a439b
d50f2ab6f050311dbf7b8f5501b25f0bf64a439b
ext4: fix undefined behavior in ext4_fill_flex_info() Commit 503358ae01b70ce6909d19dd01287093f6b6271c ("ext4: avoid divide by zero when trying to mount a corrupted file system") fixes CVE-2009-4307 by performing a sanity check on s_log_groups_per_flex, since it can be set to a bogus value by an attacker. sbi->s_log_groups_per_flex = sbi->s_es->s_log_groups_per_flex; groups_per_flex = 1 << sbi->s_log_groups_per_flex; if (groups_per_flex < 2) { ... } This patch fixes two potential issues in the previous commit. 1) The sanity check might only work on architectures like PowerPC. On x86, 5 bits are used for the shifting amount. That means, given a large s_log_groups_per_flex value like 36, groups_per_flex = 1 << 36 is essentially 1 << 4 = 16, rather than 0. This will bypass the check, leaving s_log_groups_per_flex and groups_per_flex inconsistent. 2) The sanity check relies on undefined behavior, i.e., oversized shift. A standard-confirming C compiler could rewrite the check in unexpected ways. Consider the following equivalent form, assuming groups_per_flex is unsigned for simplicity. groups_per_flex = 1 << sbi->s_log_groups_per_flex; if (groups_per_flex == 0 || groups_per_flex == 1) { We compile the code snippet using Clang 3.0 and GCC 4.6. Clang will completely optimize away the check groups_per_flex == 0, leaving the patched code as vulnerable as the original. GCC keeps the check, but there is no guarantee that future versions will do the same. Signed-off-by: Xi Wang <[email protected]> Signed-off-by: "Theodore Ts'o" <[email protected]> Cc: [email protected]
static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) { int def_errors; unsigned long def_mount_opts; struct super_block *sb = vfs->mnt_sb; struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_super_block *es = sbi->s_es; def_mount_opts = le32_to_cpu(es->s_default_mount_opts); def_errors = le16_to_cpu(es->s_errors); if (sbi->s_sb_block != 1) seq_printf(seq, ",sb=%llu", sbi->s_sb_block); if (test_opt(sb, MINIX_DF)) seq_puts(seq, ",minixdf"); if (test_opt(sb, GRPID) && !(def_mount_opts & EXT4_DEFM_BSDGROUPS)) seq_puts(seq, ",grpid"); if (!test_opt(sb, GRPID) && (def_mount_opts & EXT4_DEFM_BSDGROUPS)) seq_puts(seq, ",nogrpid"); if (sbi->s_resuid != EXT4_DEF_RESUID || le16_to_cpu(es->s_def_resuid) != EXT4_DEF_RESUID) { seq_printf(seq, ",resuid=%u", sbi->s_resuid); } if (sbi->s_resgid != EXT4_DEF_RESGID || le16_to_cpu(es->s_def_resgid) != EXT4_DEF_RESGID) { seq_printf(seq, ",resgid=%u", sbi->s_resgid); } if (test_opt(sb, ERRORS_RO)) { if (def_errors == EXT4_ERRORS_PANIC || def_errors == EXT4_ERRORS_CONTINUE) { seq_puts(seq, ",errors=remount-ro"); } } if (test_opt(sb, ERRORS_CONT) && def_errors != EXT4_ERRORS_CONTINUE) seq_puts(seq, ",errors=continue"); if (test_opt(sb, ERRORS_PANIC) && def_errors != EXT4_ERRORS_PANIC) seq_puts(seq, ",errors=panic"); if (test_opt(sb, NO_UID32) && !(def_mount_opts & EXT4_DEFM_UID16)) seq_puts(seq, ",nouid32"); if (test_opt(sb, DEBUG) && !(def_mount_opts & EXT4_DEFM_DEBUG)) seq_puts(seq, ",debug"); #ifdef CONFIG_EXT4_FS_XATTR if (test_opt(sb, XATTR_USER)) seq_puts(seq, ",user_xattr"); if (!test_opt(sb, XATTR_USER)) seq_puts(seq, ",nouser_xattr"); #endif #ifdef CONFIG_EXT4_FS_POSIX_ACL if (test_opt(sb, POSIX_ACL) && !(def_mount_opts & EXT4_DEFM_ACL)) seq_puts(seq, ",acl"); if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT4_DEFM_ACL)) seq_puts(seq, ",noacl"); #endif if (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ) { seq_printf(seq, ",commit=%u", (unsigned) (sbi->s_commit_interval / HZ)); } if (sbi->s_min_batch_time != EXT4_DEF_MIN_BATCH_TIME) { seq_printf(seq, ",min_batch_time=%u", (unsigned) sbi->s_min_batch_time); } if (sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME) { seq_printf(seq, ",max_batch_time=%u", (unsigned) sbi->s_max_batch_time); } /* * We're changing the default of barrier mount option, so * let's always display its mount state so it's clear what its * status is. */ seq_puts(seq, ",barrier="); seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0"); if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) seq_puts(seq, ",journal_async_commit"); else if (test_opt(sb, JOURNAL_CHECKSUM)) seq_puts(seq, ",journal_checksum"); if (test_opt(sb, I_VERSION)) seq_puts(seq, ",i_version"); if (!test_opt(sb, DELALLOC) && !(def_mount_opts & EXT4_DEFM_NODELALLOC)) seq_puts(seq, ",nodelalloc"); if (!test_opt(sb, MBLK_IO_SUBMIT)) seq_puts(seq, ",nomblk_io_submit"); if (sbi->s_stripe) seq_printf(seq, ",stripe=%lu", sbi->s_stripe); /* * journal mode get enabled in different ways * So just print the value even if we didn't specify it */ if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) seq_puts(seq, ",data=journal"); else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) seq_puts(seq, ",data=ordered"); else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA) seq_puts(seq, ",data=writeback"); if (sbi->s_inode_readahead_blks != EXT4_DEF_INODE_READAHEAD_BLKS) seq_printf(seq, ",inode_readahead_blks=%u", sbi->s_inode_readahead_blks); if (test_opt(sb, DATA_ERR_ABORT)) seq_puts(seq, ",data_err=abort"); if (test_opt(sb, NO_AUTO_DA_ALLOC)) seq_puts(seq, ",noauto_da_alloc"); if (test_opt(sb, DISCARD) && !(def_mount_opts & EXT4_DEFM_DISCARD)) seq_puts(seq, ",discard"); if (test_opt(sb, NOLOAD)) seq_puts(seq, ",norecovery"); if (test_opt(sb, DIOREAD_NOLOCK)) seq_puts(seq, ",dioread_nolock"); if (test_opt(sb, BLOCK_VALIDITY) && !(def_mount_opts & EXT4_DEFM_BLOCK_VALIDITY)) seq_puts(seq, ",block_validity"); if (!test_opt(sb, INIT_INODE_TABLE)) seq_puts(seq, ",noinit_itable"); else if (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT) seq_printf(seq, ",init_itable=%u", (unsigned) sbi->s_li_wait_mult); ext4_show_quota_options(seq, sb); return 0; }
static int ext4_show_options(struct seq_file *seq, struct vfsmount *vfs) { int def_errors; unsigned long def_mount_opts; struct super_block *sb = vfs->mnt_sb; struct ext4_sb_info *sbi = EXT4_SB(sb); struct ext4_super_block *es = sbi->s_es; def_mount_opts = le32_to_cpu(es->s_default_mount_opts); def_errors = le16_to_cpu(es->s_errors); if (sbi->s_sb_block != 1) seq_printf(seq, ",sb=%llu", sbi->s_sb_block); if (test_opt(sb, MINIX_DF)) seq_puts(seq, ",minixdf"); if (test_opt(sb, GRPID) && !(def_mount_opts & EXT4_DEFM_BSDGROUPS)) seq_puts(seq, ",grpid"); if (!test_opt(sb, GRPID) && (def_mount_opts & EXT4_DEFM_BSDGROUPS)) seq_puts(seq, ",nogrpid"); if (sbi->s_resuid != EXT4_DEF_RESUID || le16_to_cpu(es->s_def_resuid) != EXT4_DEF_RESUID) { seq_printf(seq, ",resuid=%u", sbi->s_resuid); } if (sbi->s_resgid != EXT4_DEF_RESGID || le16_to_cpu(es->s_def_resgid) != EXT4_DEF_RESGID) { seq_printf(seq, ",resgid=%u", sbi->s_resgid); } if (test_opt(sb, ERRORS_RO)) { if (def_errors == EXT4_ERRORS_PANIC || def_errors == EXT4_ERRORS_CONTINUE) { seq_puts(seq, ",errors=remount-ro"); } } if (test_opt(sb, ERRORS_CONT) && def_errors != EXT4_ERRORS_CONTINUE) seq_puts(seq, ",errors=continue"); if (test_opt(sb, ERRORS_PANIC) && def_errors != EXT4_ERRORS_PANIC) seq_puts(seq, ",errors=panic"); if (test_opt(sb, NO_UID32) && !(def_mount_opts & EXT4_DEFM_UID16)) seq_puts(seq, ",nouid32"); if (test_opt(sb, DEBUG) && !(def_mount_opts & EXT4_DEFM_DEBUG)) seq_puts(seq, ",debug"); #ifdef CONFIG_EXT4_FS_XATTR if (test_opt(sb, XATTR_USER)) seq_puts(seq, ",user_xattr"); if (!test_opt(sb, XATTR_USER)) seq_puts(seq, ",nouser_xattr"); #endif #ifdef CONFIG_EXT4_FS_POSIX_ACL if (test_opt(sb, POSIX_ACL) && !(def_mount_opts & EXT4_DEFM_ACL)) seq_puts(seq, ",acl"); if (!test_opt(sb, POSIX_ACL) && (def_mount_opts & EXT4_DEFM_ACL)) seq_puts(seq, ",noacl"); #endif if (sbi->s_commit_interval != JBD2_DEFAULT_MAX_COMMIT_AGE*HZ) { seq_printf(seq, ",commit=%u", (unsigned) (sbi->s_commit_interval / HZ)); } if (sbi->s_min_batch_time != EXT4_DEF_MIN_BATCH_TIME) { seq_printf(seq, ",min_batch_time=%u", (unsigned) sbi->s_min_batch_time); } if (sbi->s_max_batch_time != EXT4_DEF_MAX_BATCH_TIME) { seq_printf(seq, ",max_batch_time=%u", (unsigned) sbi->s_max_batch_time); } /* * We're changing the default of barrier mount option, so * let's always display its mount state so it's clear what its * status is. */ seq_puts(seq, ",barrier="); seq_puts(seq, test_opt(sb, BARRIER) ? "1" : "0"); if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) seq_puts(seq, ",journal_async_commit"); else if (test_opt(sb, JOURNAL_CHECKSUM)) seq_puts(seq, ",journal_checksum"); if (test_opt(sb, I_VERSION)) seq_puts(seq, ",i_version"); if (!test_opt(sb, DELALLOC) && !(def_mount_opts & EXT4_DEFM_NODELALLOC)) seq_puts(seq, ",nodelalloc"); if (!test_opt(sb, MBLK_IO_SUBMIT)) seq_puts(seq, ",nomblk_io_submit"); if (sbi->s_stripe) seq_printf(seq, ",stripe=%lu", sbi->s_stripe); /* * journal mode get enabled in different ways * So just print the value even if we didn't specify it */ if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) seq_puts(seq, ",data=journal"); else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_ORDERED_DATA) seq_puts(seq, ",data=ordered"); else if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_WRITEBACK_DATA) seq_puts(seq, ",data=writeback"); if (sbi->s_inode_readahead_blks != EXT4_DEF_INODE_READAHEAD_BLKS) seq_printf(seq, ",inode_readahead_blks=%u", sbi->s_inode_readahead_blks); if (test_opt(sb, DATA_ERR_ABORT)) seq_puts(seq, ",data_err=abort"); if (test_opt(sb, NO_AUTO_DA_ALLOC)) seq_puts(seq, ",noauto_da_alloc"); if (test_opt(sb, DISCARD) && !(def_mount_opts & EXT4_DEFM_DISCARD)) seq_puts(seq, ",discard"); if (test_opt(sb, NOLOAD)) seq_puts(seq, ",norecovery"); if (test_opt(sb, DIOREAD_NOLOCK)) seq_puts(seq, ",dioread_nolock"); if (test_opt(sb, BLOCK_VALIDITY) && !(def_mount_opts & EXT4_DEFM_BLOCK_VALIDITY)) seq_puts(seq, ",block_validity"); if (!test_opt(sb, INIT_INODE_TABLE)) seq_puts(seq, ",noinit_itable"); else if (sbi->s_li_wait_mult != EXT4_DEF_LI_WAIT_MULT) seq_printf(seq, ",init_itable=%u", (unsigned) sbi->s_li_wait_mult); ext4_show_quota_options(seq, sb); return 0; }
C
linux
0
CVE-2016-7530
https://www.cvedetails.com/cve/CVE-2016-7530/
CWE-369
https://github.com/ImageMagick/ImageMagick/commit/b5ed738f8060266bf4ae521f7e3ed145aa4498a3
b5ed738f8060266bf4ae521f7e3ed145aa4498a3
https://github.com/ImageMagick/ImageMagick/issues/110
MagickPrivate void ResetQuantumState(QuantumInfo *quantum_info) { static const unsigned int mask[32] = { 0x00000000U, 0x00000001U, 0x00000003U, 0x00000007U, 0x0000000fU, 0x0000001fU, 0x0000003fU, 0x0000007fU, 0x000000ffU, 0x000001ffU, 0x000003ffU, 0x000007ffU, 0x00000fffU, 0x00001fffU, 0x00003fffU, 0x00007fffU, 0x0000ffffU, 0x0001ffffU, 0x0003ffffU, 0x0007ffffU, 0x000fffffU, 0x001fffffU, 0x003fffffU, 0x007fffffU, 0x00ffffffU, 0x01ffffffU, 0x03ffffffU, 0x07ffffffU, 0x0fffffffU, 0x1fffffffU, 0x3fffffffU, 0x7fffffffU }; assert(quantum_info != (QuantumInfo *) NULL); assert(quantum_info->signature == MagickSignature); quantum_info->state.inverse_scale=1.0; if (fabs(quantum_info->scale) >= MagickEpsilon) quantum_info->state.inverse_scale/=quantum_info->scale; quantum_info->state.pixel=0U; quantum_info->state.bits=0U; quantum_info->state.mask=mask; }
MagickPrivate void ResetQuantumState(QuantumInfo *quantum_info) { static const unsigned int mask[32] = { 0x00000000U, 0x00000001U, 0x00000003U, 0x00000007U, 0x0000000fU, 0x0000001fU, 0x0000003fU, 0x0000007fU, 0x000000ffU, 0x000001ffU, 0x000003ffU, 0x000007ffU, 0x00000fffU, 0x00001fffU, 0x00003fffU, 0x00007fffU, 0x0000ffffU, 0x0001ffffU, 0x0003ffffU, 0x0007ffffU, 0x000fffffU, 0x001fffffU, 0x003fffffU, 0x007fffffU, 0x00ffffffU, 0x01ffffffU, 0x03ffffffU, 0x07ffffffU, 0x0fffffffU, 0x1fffffffU, 0x3fffffffU, 0x7fffffffU }; assert(quantum_info != (QuantumInfo *) NULL); assert(quantum_info->signature == MagickSignature); quantum_info->state.inverse_scale=1.0; if (fabs(quantum_info->scale) >= MagickEpsilon) quantum_info->state.inverse_scale/=quantum_info->scale; quantum_info->state.pixel=0U; quantum_info->state.bits=0U; quantum_info->state.mask=mask; }
C
ImageMagick
0
CVE-2016-4072
https://www.cvedetails.com/cve/CVE-2016-4072/
CWE-20
https://git.php.net/?p=php-src.git;a=commit;h=1e9b175204e3286d64dfd6c9f09151c31b5e099a
1e9b175204e3286d64dfd6c9f09151c31b5e099a
null
int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int convert, char **error) /* {{{ */ { char halt_stub[] = "__HALT_COMPILER();"; zend_string *newstub; char *tmp; phar_entry_info *entry, *newentry; int halt_offset, restore_alias_len, global_flags = 0, closeoldfile; char *pos, has_dirs = 0; char manifest[18], entry_buffer[24]; zend_off_t manifest_ftell; zend_long offset; size_t wrote; php_uint32 manifest_len, mytime, loc, new_manifest_count; php_uint32 newcrc32; php_stream *file, *oldfile, *newfile, *stubfile; php_stream_filter *filter; php_serialize_data_t metadata_hash; smart_str main_metadata_str = {0}; int free_user_stub, free_fp = 1, free_ufp = 1; int manifest_hack = 0; if (phar->is_persistent) { if (error) { spprintf(error, 0, "internal error: attempt to flush cached zip-based phar \"%s\"", phar->fname); } return EOF; } if (error) { *error = NULL; } if (!zend_hash_num_elements(&phar->manifest) && !user_stub) { return EOF; } zend_hash_clean(&phar->virtual_dirs); if (phar->is_zip) { return phar_zip_flush(phar, user_stub, len, convert, error); } if (phar->is_tar) { return phar_tar_flush(phar, user_stub, len, convert, error); } if (PHAR_G(readonly)) { return EOF; } if (phar->fp && !phar->is_brandnew) { oldfile = phar->fp; closeoldfile = 0; php_stream_rewind(oldfile); } else { oldfile = php_stream_open_wrapper(phar->fname, "rb", 0, NULL); closeoldfile = oldfile != NULL; } newfile = php_stream_fopen_tmpfile(); if (!newfile) { if (error) { spprintf(error, 0, "unable to create temporary file"); } if (closeoldfile) { php_stream_close(oldfile); } return EOF; } if (user_stub) { zend_string *suser_stub; if (len < 0) { /* resource passed in */ if (!(php_stream_from_zval_no_verify(stubfile, (zval *)user_stub))) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to access resource to copy stub to new phar \"%s\"", phar->fname); } return EOF; } if (len == -1) { len = PHP_STREAM_COPY_ALL; } else { len = -len; } user_stub = 0; if (!(suser_stub = php_stream_copy_to_mem(stubfile, len, 0))) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to read resource to copy stub to new phar \"%s\"", phar->fname); } return EOF; } free_user_stub = 1; user_stub = ZSTR_VAL(suser_stub); len = ZSTR_LEN(suser_stub); } else { free_user_stub = 0; } tmp = estrndup(user_stub, len); if ((pos = php_stristr(tmp, halt_stub, len, sizeof(halt_stub) - 1)) == NULL) { efree(tmp); if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "illegal stub for phar \"%s\"", phar->fname); } if (free_user_stub) { zend_string_free(suser_stub); } return EOF; } pos = user_stub + (pos - tmp); efree(tmp); len = pos - user_stub + 18; if ((size_t)len != php_stream_write(newfile, user_stub, len) || 5 != php_stream_write(newfile, " ?>\r\n", 5)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to create stub from string in new phar \"%s\"", phar->fname); } if (free_user_stub) { zend_string_free(suser_stub); } return EOF; } phar->halt_offset = len + 5; if (free_user_stub) { zend_string_free(suser_stub); } } else { size_t written; if (!user_stub && phar->halt_offset && oldfile && !phar->is_brandnew) { php_stream_copy_to_stream_ex(oldfile, newfile, phar->halt_offset, &written); newstub = NULL; } else { /* this is either a brand new phar or a default stub overwrite */ newstub = phar_create_default_stub(NULL, NULL, NULL); phar->halt_offset = ZSTR_LEN(newstub); written = php_stream_write(newfile, ZSTR_VAL(newstub), phar->halt_offset); } if (phar->halt_offset != written) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { if (newstub) { spprintf(error, 0, "unable to create stub in new phar \"%s\"", phar->fname); } else { spprintf(error, 0, "unable to copy stub of old phar to new phar \"%s\"", phar->fname); } } if (newstub) { zend_string_free(newstub); } return EOF; } if (newstub) { zend_string_free(newstub); } } manifest_ftell = php_stream_tell(newfile); halt_offset = manifest_ftell; /* Check whether we can get rid of some of the deleted entries which are * unused. However some might still be in use so even after this clean-up * we need to skip entries marked is_deleted. */ zend_hash_apply(&phar->manifest, phar_flush_clean_deleted_apply); /* compress as necessary, calculate crcs, serialize meta-data, manifest size, and file sizes */ main_metadata_str.s = NULL; if (Z_TYPE(phar->metadata) != IS_UNDEF) { PHP_VAR_SERIALIZE_INIT(metadata_hash); php_var_serialize(&main_metadata_str, &phar->metadata, &metadata_hash); PHP_VAR_SERIALIZE_DESTROY(metadata_hash); } new_manifest_count = 0; offset = 0; for (zend_hash_internal_pointer_reset(&phar->manifest); zend_hash_has_more_elements(&phar->manifest) == SUCCESS; zend_hash_move_forward(&phar->manifest)) { if ((entry = zend_hash_get_current_data_ptr(&phar->manifest)) == NULL) { continue; } if (entry->cfp) { /* did we forget to get rid of cfp last time? */ php_stream_close(entry->cfp); entry->cfp = 0; } if (entry->is_deleted || entry->is_mounted) { /* remove this from the new phar */ continue; } if (!entry->is_modified && entry->fp_refcount) { /* open file pointers refer to this fp, do not free the stream */ switch (entry->fp_type) { case PHAR_FP: free_fp = 0; break; case PHAR_UFP: free_ufp = 0; default: break; } } /* after excluding deleted files, calculate manifest size in bytes and number of entries */ ++new_manifest_count; phar_add_virtual_dirs(phar, entry->filename, entry->filename_len); if (entry->is_dir) { /* we use this to calculate API version, 1.1.1 is used for phars with directories */ has_dirs = 1; } if (Z_TYPE(entry->metadata) != IS_UNDEF) { if (entry->metadata_str.s) { smart_str_free(&entry->metadata_str); } entry->metadata_str.s = NULL; PHP_VAR_SERIALIZE_INIT(metadata_hash); php_var_serialize(&entry->metadata_str, &entry->metadata, &metadata_hash); PHP_VAR_SERIALIZE_DESTROY(metadata_hash); } else { if (entry->metadata_str.s) { smart_str_free(&entry->metadata_str); } entry->metadata_str.s = NULL; } /* 32 bits for filename length, length of filename, manifest + metadata, and add 1 for trailing / if a directory */ offset += 4 + entry->filename_len + sizeof(entry_buffer) + (entry->metadata_str.s ? ZSTR_LEN(entry->metadata_str.s) : 0) + (entry->is_dir ? 1 : 0); /* compress and rehash as necessary */ if ((oldfile && !entry->is_modified) || entry->is_dir) { if (entry->fp_type == PHAR_UFP) { /* reset so we can copy the compressed data over */ entry->fp_type = PHAR_FP; } continue; } if (!phar_get_efp(entry, 0)) { /* re-open internal file pointer just-in-time */ newentry = phar_open_jit(phar, entry, error); if (!newentry) { /* major problem re-opening, so we ignore this file and the error */ efree(*error); *error = NULL; continue; } entry = newentry; } file = phar_get_efp(entry, 0); if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 1)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname); } return EOF; } newcrc32 = ~0; mytime = entry->uncompressed_filesize; for (loc = 0;loc < mytime; ++loc) { CRC32(newcrc32, php_stream_getc(file)); } entry->crc32 = ~newcrc32; entry->is_crc_checked = 1; if (!(entry->flags & PHAR_ENT_COMPRESSION_MASK)) { /* not compressed */ entry->compressed_filesize = entry->uncompressed_filesize; continue; } filter = php_stream_filter_create(phar_compress_filter(entry, 0), NULL, 0); if (!filter) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (entry->flags & PHAR_ENT_COMPRESSED_GZ) { if (error) { spprintf(error, 0, "unable to gzip compress file \"%s\" to new phar \"%s\"", entry->filename, phar->fname); } } else { if (error) { spprintf(error, 0, "unable to bzip2 compress file \"%s\" to new phar \"%s\"", entry->filename, phar->fname); } } return EOF; } /* create new file that holds the compressed version */ /* work around inability to specify freedom in write and strictness in read count */ entry->cfp = php_stream_fopen_tmpfile(); if (!entry->cfp) { if (error) { spprintf(error, 0, "unable to create temporary file"); } if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); return EOF; } php_stream_flush(file); if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname); } return EOF; } php_stream_filter_append((&entry->cfp->writefilters), filter); if (SUCCESS != php_stream_copy_to_stream_ex(file, entry->cfp, entry->uncompressed_filesize, NULL)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to copy compressed file contents of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname); } return EOF; } php_stream_filter_flush(filter, 1); php_stream_flush(entry->cfp); php_stream_filter_remove(filter, 1); php_stream_seek(entry->cfp, 0, SEEK_END); entry->compressed_filesize = (php_uint32) php_stream_tell(entry->cfp); /* generate crc on compressed file */ php_stream_rewind(entry->cfp); entry->old_flags = entry->flags; entry->is_modified = 1; global_flags |= (entry->flags & PHAR_ENT_COMPRESSION_MASK); } global_flags |= PHAR_HDR_SIGNATURE; /* write out manifest pre-header */ /* 4: manifest length * 4: manifest entry count * 2: phar version * 4: phar global flags * 4: alias length * ?: the alias itself * 4: phar metadata length * ?: phar metadata */ restore_alias_len = phar->alias_len; if (phar->is_temporary_alias) { phar->alias_len = 0; } manifest_len = offset + phar->alias_len + sizeof(manifest) + (main_metadata_str.s ? ZSTR_LEN(main_metadata_str.s) : 0); phar_set_32(manifest, manifest_len); /* Hack - see bug #65028, add padding byte to the end of the manifest */ if(manifest[0] == '\r' || manifest[0] == '\n') { manifest_len++; phar_set_32(manifest, manifest_len); manifest_hack = 1; } phar_set_32(manifest+4, new_manifest_count); if (has_dirs) { *(manifest + 8) = (unsigned char) (((PHAR_API_VERSION) >> 8) & 0xFF); *(manifest + 9) = (unsigned char) (((PHAR_API_VERSION) & 0xF0)); } else { *(manifest + 8) = (unsigned char) (((PHAR_API_VERSION_NODIR) >> 8) & 0xFF); *(manifest + 9) = (unsigned char) (((PHAR_API_VERSION_NODIR) & 0xF0)); } phar_set_32(manifest+10, global_flags); phar_set_32(manifest+14, phar->alias_len); /* write the manifest header */ if (sizeof(manifest) != php_stream_write(newfile, manifest, sizeof(manifest)) || (size_t)phar->alias_len != php_stream_write(newfile, phar->alias, phar->alias_len)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); phar->alias_len = restore_alias_len; if (error) { spprintf(error, 0, "unable to write manifest header of new phar \"%s\"", phar->fname); } return EOF; } phar->alias_len = restore_alias_len; phar_set_32(manifest, main_metadata_str.s ? ZSTR_LEN(main_metadata_str.s) : 0); if (4 != php_stream_write(newfile, manifest, 4) || ((main_metadata_str.s ? ZSTR_LEN(main_metadata_str.s) : 0) && ZSTR_LEN(main_metadata_str.s) != php_stream_write(newfile, ZSTR_VAL(main_metadata_str.s), ZSTR_LEN(main_metadata_str.s)))) { smart_str_free(&main_metadata_str); if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); phar->alias_len = restore_alias_len; if (error) { spprintf(error, 0, "unable to write manifest meta-data of new phar \"%s\"", phar->fname); } return EOF; } smart_str_free(&main_metadata_str); /* re-calculate the manifest location to simplify later code */ manifest_ftell = php_stream_tell(newfile); /* now write the manifest */ for (zend_hash_internal_pointer_reset(&phar->manifest); zend_hash_has_more_elements(&phar->manifest) == SUCCESS; zend_hash_move_forward(&phar->manifest)) { if ((entry = zend_hash_get_current_data_ptr(&phar->manifest)) == NULL) { continue; } if (entry->is_deleted || entry->is_mounted) { /* remove this from the new phar if deleted, ignore if mounted */ continue; } if (entry->is_dir) { /* add 1 for trailing slash */ phar_set_32(entry_buffer, entry->filename_len + 1); } else { phar_set_32(entry_buffer, entry->filename_len); } if (4 != php_stream_write(newfile, entry_buffer, 4) || entry->filename_len != php_stream_write(newfile, entry->filename, entry->filename_len) || (entry->is_dir && 1 != php_stream_write(newfile, "/", 1))) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { if (entry->is_dir) { spprintf(error, 0, "unable to write filename of directory \"%s\" to manifest of new phar \"%s\"", entry->filename, phar->fname); } else { spprintf(error, 0, "unable to write filename of file \"%s\" to manifest of new phar \"%s\"", entry->filename, phar->fname); } } return EOF; } /* set the manifest meta-data: 4: uncompressed filesize 4: creation timestamp 4: compressed filesize 4: crc32 4: flags 4: metadata-len +: metadata */ mytime = time(NULL); phar_set_32(entry_buffer, entry->uncompressed_filesize); phar_set_32(entry_buffer+4, mytime); phar_set_32(entry_buffer+8, entry->compressed_filesize); phar_set_32(entry_buffer+12, entry->crc32); phar_set_32(entry_buffer+16, entry->flags); phar_set_32(entry_buffer+20, entry->metadata_str.s ? ZSTR_LEN(entry->metadata_str.s) : 0); if (sizeof(entry_buffer) != php_stream_write(newfile, entry_buffer, sizeof(entry_buffer)) || (entry->metadata_str.s && ZSTR_LEN(entry->metadata_str.s) != php_stream_write(newfile, ZSTR_VAL(entry->metadata_str.s), ZSTR_LEN(entry->metadata_str.s)))) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to write temporary manifest of file \"%s\" to manifest of new phar \"%s\"", entry->filename, phar->fname); } return EOF; } } /* Hack - see bug #65028, add padding byte to the end of the manifest */ if(manifest_hack) { if(1 != php_stream_write(newfile, manifest, 1)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to write manifest padding byte"); } return EOF; } } /* now copy the actual file data to the new phar */ offset = php_stream_tell(newfile); for (zend_hash_internal_pointer_reset(&phar->manifest); zend_hash_has_more_elements(&phar->manifest) == SUCCESS; zend_hash_move_forward(&phar->manifest)) { if ((entry = zend_hash_get_current_data_ptr(&phar->manifest)) == NULL) { continue; } if (entry->is_deleted || entry->is_dir || entry->is_mounted) { continue; } if (entry->cfp) { file = entry->cfp; php_stream_rewind(file); } else { file = phar_get_efp(entry, 0); if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname); } return EOF; } } if (!file) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname); } return EOF; } /* this will have changed for all files that have either changed compression or been modified */ entry->offset = entry->offset_abs = offset; offset += entry->compressed_filesize; if (php_stream_copy_to_stream_ex(file, newfile, entry->compressed_filesize, &wrote) == FAILURE) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to write contents of file \"%s\" to new phar \"%s\"", entry->filename, phar->fname); } return EOF; } entry->is_modified = 0; if (entry->cfp) { php_stream_close(entry->cfp); entry->cfp = NULL; } if (entry->fp_type == PHAR_MOD) { /* this fp is in use by a phar_entry_data returned by phar_get_entry_data, it will be closed when the phar_entry_data is phar_entry_delref'ed */ if (entry->fp_refcount == 0 && entry->fp != phar->fp && entry->fp != phar->ufp) { php_stream_close(entry->fp); } entry->fp = NULL; entry->fp_type = PHAR_FP; } else if (entry->fp_type == PHAR_UFP) { entry->fp_type = PHAR_FP; } } /* append signature */ if (global_flags & PHAR_HDR_SIGNATURE) { char sig_buf[4]; php_stream_rewind(newfile); if (phar->signature) { efree(phar->signature); phar->signature = NULL; } switch(phar->sig_flags) { #ifndef PHAR_HASH_OK case PHAR_SIG_SHA512: case PHAR_SIG_SHA256: if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to write contents of file \"%s\" to new phar \"%s\" with requested hash type", entry->filename, phar->fname); } return EOF; #endif default: { char *digest = NULL; int digest_len; if (FAILURE == phar_create_signature(phar, newfile, &digest, &digest_len, error)) { if (error) { char *save = *error; spprintf(error, 0, "phar error: unable to write signature: %s", save); efree(save); } if (digest) { efree(digest); } if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); return EOF; } php_stream_write(newfile, digest, digest_len); efree(digest); if (phar->sig_flags == PHAR_SIG_OPENSSL) { phar_set_32(sig_buf, digest_len); php_stream_write(newfile, sig_buf, 4); } break; } } phar_set_32(sig_buf, phar->sig_flags); php_stream_write(newfile, sig_buf, 4); php_stream_write(newfile, "GBMB", 4); } /* finally, close the temp file, rename the original phar, move the temp to the old phar, unlink the old phar, and reload it into memory */ if (phar->fp && free_fp) { php_stream_close(phar->fp); } if (phar->ufp) { if (free_ufp) { php_stream_close(phar->ufp); } phar->ufp = NULL; } if (closeoldfile) { php_stream_close(oldfile); } phar->internal_file_start = halt_offset + manifest_len + 4; phar->halt_offset = halt_offset; phar->is_brandnew = 0; php_stream_rewind(newfile); if (phar->donotflush) { /* deferred flush */ phar->fp = newfile; } else { phar->fp = php_stream_open_wrapper(phar->fname, "w+b", IGNORE_URL|STREAM_MUST_SEEK|REPORT_ERRORS, NULL); if (!phar->fp) { phar->fp = newfile; if (error) { spprintf(error, 4096, "unable to open new phar \"%s\" for writing", phar->fname); } return EOF; } if (phar->flags & PHAR_FILE_COMPRESSED_GZ) { /* to properly compress, we have to tell zlib to add a zlib header */ zval filterparams; array_init(&filterparams); add_assoc_long(&filterparams, "window", MAX_WBITS+16); filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp)); zval_dtor(&filterparams); if (!filter) { if (error) { spprintf(error, 4096, "unable to compress all contents of phar \"%s\" using zlib, PHP versions older than 5.2.6 have a buggy zlib", phar->fname); } return EOF; } php_stream_filter_append(&phar->fp->writefilters, filter); php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1); php_stream_close(phar->fp); /* use the temp stream as our base */ phar->fp = newfile; } else if (phar->flags & PHAR_FILE_COMPRESSED_BZ2) { filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp)); php_stream_filter_append(&phar->fp->writefilters, filter); php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1); php_stream_close(phar->fp); /* use the temp stream as our base */ phar->fp = newfile; } else { php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); /* we could also reopen the file in "rb" mode but there is no need for that */ php_stream_close(newfile); } } if (-1 == php_stream_seek(phar->fp, phar->halt_offset, SEEK_SET)) { if (error) { spprintf(error, 0, "unable to seek to __HALT_COMPILER(); in new phar \"%s\"", phar->fname); } return EOF; } return EOF; } /* }}} */
int phar_flush(phar_archive_data *phar, char *user_stub, zend_long len, int convert, char **error) /* {{{ */ { char halt_stub[] = "__HALT_COMPILER();"; zend_string *newstub; char *tmp; phar_entry_info *entry, *newentry; int halt_offset, restore_alias_len, global_flags = 0, closeoldfile; char *pos, has_dirs = 0; char manifest[18], entry_buffer[24]; zend_off_t manifest_ftell; zend_long offset; size_t wrote; php_uint32 manifest_len, mytime, loc, new_manifest_count; php_uint32 newcrc32; php_stream *file, *oldfile, *newfile, *stubfile; php_stream_filter *filter; php_serialize_data_t metadata_hash; smart_str main_metadata_str = {0}; int free_user_stub, free_fp = 1, free_ufp = 1; int manifest_hack = 0; if (phar->is_persistent) { if (error) { spprintf(error, 0, "internal error: attempt to flush cached zip-based phar \"%s\"", phar->fname); } return EOF; } if (error) { *error = NULL; } if (!zend_hash_num_elements(&phar->manifest) && !user_stub) { return EOF; } zend_hash_clean(&phar->virtual_dirs); if (phar->is_zip) { return phar_zip_flush(phar, user_stub, len, convert, error); } if (phar->is_tar) { return phar_tar_flush(phar, user_stub, len, convert, error); } if (PHAR_G(readonly)) { return EOF; } if (phar->fp && !phar->is_brandnew) { oldfile = phar->fp; closeoldfile = 0; php_stream_rewind(oldfile); } else { oldfile = php_stream_open_wrapper(phar->fname, "rb", 0, NULL); closeoldfile = oldfile != NULL; } newfile = php_stream_fopen_tmpfile(); if (!newfile) { if (error) { spprintf(error, 0, "unable to create temporary file"); } if (closeoldfile) { php_stream_close(oldfile); } return EOF; } if (user_stub) { zend_string *suser_stub; if (len < 0) { /* resource passed in */ if (!(php_stream_from_zval_no_verify(stubfile, (zval *)user_stub))) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to access resource to copy stub to new phar \"%s\"", phar->fname); } return EOF; } if (len == -1) { len = PHP_STREAM_COPY_ALL; } else { len = -len; } user_stub = 0; if (!(suser_stub = php_stream_copy_to_mem(stubfile, len, 0))) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to read resource to copy stub to new phar \"%s\"", phar->fname); } return EOF; } free_user_stub = 1; user_stub = ZSTR_VAL(suser_stub); len = ZSTR_LEN(suser_stub); } else { free_user_stub = 0; } tmp = estrndup(user_stub, len); if ((pos = php_stristr(tmp, halt_stub, len, sizeof(halt_stub) - 1)) == NULL) { efree(tmp); if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "illegal stub for phar \"%s\"", phar->fname); } if (free_user_stub) { zend_string_free(suser_stub); } return EOF; } pos = user_stub + (pos - tmp); efree(tmp); len = pos - user_stub + 18; if ((size_t)len != php_stream_write(newfile, user_stub, len) || 5 != php_stream_write(newfile, " ?>\r\n", 5)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to create stub from string in new phar \"%s\"", phar->fname); } if (free_user_stub) { zend_string_free(suser_stub); } return EOF; } phar->halt_offset = len + 5; if (free_user_stub) { zend_string_free(suser_stub); } } else { size_t written; if (!user_stub && phar->halt_offset && oldfile && !phar->is_brandnew) { php_stream_copy_to_stream_ex(oldfile, newfile, phar->halt_offset, &written); newstub = NULL; } else { /* this is either a brand new phar or a default stub overwrite */ newstub = phar_create_default_stub(NULL, NULL, NULL); phar->halt_offset = ZSTR_LEN(newstub); written = php_stream_write(newfile, ZSTR_VAL(newstub), phar->halt_offset); } if (phar->halt_offset != written) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { if (newstub) { spprintf(error, 0, "unable to create stub in new phar \"%s\"", phar->fname); } else { spprintf(error, 0, "unable to copy stub of old phar to new phar \"%s\"", phar->fname); } } if (newstub) { zend_string_free(newstub); } return EOF; } if (newstub) { zend_string_free(newstub); } } manifest_ftell = php_stream_tell(newfile); halt_offset = manifest_ftell; /* Check whether we can get rid of some of the deleted entries which are * unused. However some might still be in use so even after this clean-up * we need to skip entries marked is_deleted. */ zend_hash_apply(&phar->manifest, phar_flush_clean_deleted_apply); /* compress as necessary, calculate crcs, serialize meta-data, manifest size, and file sizes */ main_metadata_str.s = NULL; if (Z_TYPE(phar->metadata) != IS_UNDEF) { PHP_VAR_SERIALIZE_INIT(metadata_hash); php_var_serialize(&main_metadata_str, &phar->metadata, &metadata_hash); PHP_VAR_SERIALIZE_DESTROY(metadata_hash); } new_manifest_count = 0; offset = 0; for (zend_hash_internal_pointer_reset(&phar->manifest); zend_hash_has_more_elements(&phar->manifest) == SUCCESS; zend_hash_move_forward(&phar->manifest)) { if ((entry = zend_hash_get_current_data_ptr(&phar->manifest)) == NULL) { continue; } if (entry->cfp) { /* did we forget to get rid of cfp last time? */ php_stream_close(entry->cfp); entry->cfp = 0; } if (entry->is_deleted || entry->is_mounted) { /* remove this from the new phar */ continue; } if (!entry->is_modified && entry->fp_refcount) { /* open file pointers refer to this fp, do not free the stream */ switch (entry->fp_type) { case PHAR_FP: free_fp = 0; break; case PHAR_UFP: free_ufp = 0; default: break; } } /* after excluding deleted files, calculate manifest size in bytes and number of entries */ ++new_manifest_count; phar_add_virtual_dirs(phar, entry->filename, entry->filename_len); if (entry->is_dir) { /* we use this to calculate API version, 1.1.1 is used for phars with directories */ has_dirs = 1; } if (Z_TYPE(entry->metadata) != IS_UNDEF) { if (entry->metadata_str.s) { smart_str_free(&entry->metadata_str); } entry->metadata_str.s = NULL; PHP_VAR_SERIALIZE_INIT(metadata_hash); php_var_serialize(&entry->metadata_str, &entry->metadata, &metadata_hash); PHP_VAR_SERIALIZE_DESTROY(metadata_hash); } else { if (entry->metadata_str.s) { smart_str_free(&entry->metadata_str); } entry->metadata_str.s = NULL; } /* 32 bits for filename length, length of filename, manifest + metadata, and add 1 for trailing / if a directory */ offset += 4 + entry->filename_len + sizeof(entry_buffer) + (entry->metadata_str.s ? ZSTR_LEN(entry->metadata_str.s) : 0) + (entry->is_dir ? 1 : 0); /* compress and rehash as necessary */ if ((oldfile && !entry->is_modified) || entry->is_dir) { if (entry->fp_type == PHAR_UFP) { /* reset so we can copy the compressed data over */ entry->fp_type = PHAR_FP; } continue; } if (!phar_get_efp(entry, 0)) { /* re-open internal file pointer just-in-time */ newentry = phar_open_jit(phar, entry, error); if (!newentry) { /* major problem re-opening, so we ignore this file and the error */ efree(*error); *error = NULL; continue; } entry = newentry; } file = phar_get_efp(entry, 0); if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 1)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname); } return EOF; } newcrc32 = ~0; mytime = entry->uncompressed_filesize; for (loc = 0;loc < mytime; ++loc) { CRC32(newcrc32, php_stream_getc(file)); } entry->crc32 = ~newcrc32; entry->is_crc_checked = 1; if (!(entry->flags & PHAR_ENT_COMPRESSION_MASK)) { /* not compressed */ entry->compressed_filesize = entry->uncompressed_filesize; continue; } filter = php_stream_filter_create(phar_compress_filter(entry, 0), NULL, 0); if (!filter) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (entry->flags & PHAR_ENT_COMPRESSED_GZ) { if (error) { spprintf(error, 0, "unable to gzip compress file \"%s\" to new phar \"%s\"", entry->filename, phar->fname); } } else { if (error) { spprintf(error, 0, "unable to bzip2 compress file \"%s\" to new phar \"%s\"", entry->filename, phar->fname); } } return EOF; } /* create new file that holds the compressed version */ /* work around inability to specify freedom in write and strictness in read count */ entry->cfp = php_stream_fopen_tmpfile(); if (!entry->cfp) { if (error) { spprintf(error, 0, "unable to create temporary file"); } if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); return EOF; } php_stream_flush(file); if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname); } return EOF; } php_stream_filter_append((&entry->cfp->writefilters), filter); if (SUCCESS != php_stream_copy_to_stream_ex(file, entry->cfp, entry->uncompressed_filesize, NULL)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to copy compressed file contents of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname); } return EOF; } php_stream_filter_flush(filter, 1); php_stream_flush(entry->cfp); php_stream_filter_remove(filter, 1); php_stream_seek(entry->cfp, 0, SEEK_END); entry->compressed_filesize = (php_uint32) php_stream_tell(entry->cfp); /* generate crc on compressed file */ php_stream_rewind(entry->cfp); entry->old_flags = entry->flags; entry->is_modified = 1; global_flags |= (entry->flags & PHAR_ENT_COMPRESSION_MASK); } global_flags |= PHAR_HDR_SIGNATURE; /* write out manifest pre-header */ /* 4: manifest length * 4: manifest entry count * 2: phar version * 4: phar global flags * 4: alias length * ?: the alias itself * 4: phar metadata length * ?: phar metadata */ restore_alias_len = phar->alias_len; if (phar->is_temporary_alias) { phar->alias_len = 0; } manifest_len = offset + phar->alias_len + sizeof(manifest) + (main_metadata_str.s ? ZSTR_LEN(main_metadata_str.s) : 0); phar_set_32(manifest, manifest_len); /* Hack - see bug #65028, add padding byte to the end of the manifest */ if(manifest[0] == '\r' || manifest[0] == '\n') { manifest_len++; phar_set_32(manifest, manifest_len); manifest_hack = 1; } phar_set_32(manifest+4, new_manifest_count); if (has_dirs) { *(manifest + 8) = (unsigned char) (((PHAR_API_VERSION) >> 8) & 0xFF); *(manifest + 9) = (unsigned char) (((PHAR_API_VERSION) & 0xF0)); } else { *(manifest + 8) = (unsigned char) (((PHAR_API_VERSION_NODIR) >> 8) & 0xFF); *(manifest + 9) = (unsigned char) (((PHAR_API_VERSION_NODIR) & 0xF0)); } phar_set_32(manifest+10, global_flags); phar_set_32(manifest+14, phar->alias_len); /* write the manifest header */ if (sizeof(manifest) != php_stream_write(newfile, manifest, sizeof(manifest)) || (size_t)phar->alias_len != php_stream_write(newfile, phar->alias, phar->alias_len)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); phar->alias_len = restore_alias_len; if (error) { spprintf(error, 0, "unable to write manifest header of new phar \"%s\"", phar->fname); } return EOF; } phar->alias_len = restore_alias_len; phar_set_32(manifest, main_metadata_str.s ? ZSTR_LEN(main_metadata_str.s) : 0); if (4 != php_stream_write(newfile, manifest, 4) || ((main_metadata_str.s ? ZSTR_LEN(main_metadata_str.s) : 0) && ZSTR_LEN(main_metadata_str.s) != php_stream_write(newfile, ZSTR_VAL(main_metadata_str.s), ZSTR_LEN(main_metadata_str.s)))) { smart_str_free(&main_metadata_str); if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); phar->alias_len = restore_alias_len; if (error) { spprintf(error, 0, "unable to write manifest meta-data of new phar \"%s\"", phar->fname); } return EOF; } smart_str_free(&main_metadata_str); /* re-calculate the manifest location to simplify later code */ manifest_ftell = php_stream_tell(newfile); /* now write the manifest */ for (zend_hash_internal_pointer_reset(&phar->manifest); zend_hash_has_more_elements(&phar->manifest) == SUCCESS; zend_hash_move_forward(&phar->manifest)) { if ((entry = zend_hash_get_current_data_ptr(&phar->manifest)) == NULL) { continue; } if (entry->is_deleted || entry->is_mounted) { /* remove this from the new phar if deleted, ignore if mounted */ continue; } if (entry->is_dir) { /* add 1 for trailing slash */ phar_set_32(entry_buffer, entry->filename_len + 1); } else { phar_set_32(entry_buffer, entry->filename_len); } if (4 != php_stream_write(newfile, entry_buffer, 4) || entry->filename_len != php_stream_write(newfile, entry->filename, entry->filename_len) || (entry->is_dir && 1 != php_stream_write(newfile, "/", 1))) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { if (entry->is_dir) { spprintf(error, 0, "unable to write filename of directory \"%s\" to manifest of new phar \"%s\"", entry->filename, phar->fname); } else { spprintf(error, 0, "unable to write filename of file \"%s\" to manifest of new phar \"%s\"", entry->filename, phar->fname); } } return EOF; } /* set the manifest meta-data: 4: uncompressed filesize 4: creation timestamp 4: compressed filesize 4: crc32 4: flags 4: metadata-len +: metadata */ mytime = time(NULL); phar_set_32(entry_buffer, entry->uncompressed_filesize); phar_set_32(entry_buffer+4, mytime); phar_set_32(entry_buffer+8, entry->compressed_filesize); phar_set_32(entry_buffer+12, entry->crc32); phar_set_32(entry_buffer+16, entry->flags); phar_set_32(entry_buffer+20, entry->metadata_str.s ? ZSTR_LEN(entry->metadata_str.s) : 0); if (sizeof(entry_buffer) != php_stream_write(newfile, entry_buffer, sizeof(entry_buffer)) || (entry->metadata_str.s && ZSTR_LEN(entry->metadata_str.s) != php_stream_write(newfile, ZSTR_VAL(entry->metadata_str.s), ZSTR_LEN(entry->metadata_str.s)))) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to write temporary manifest of file \"%s\" to manifest of new phar \"%s\"", entry->filename, phar->fname); } return EOF; } } /* Hack - see bug #65028, add padding byte to the end of the manifest */ if(manifest_hack) { if(1 != php_stream_write(newfile, manifest, 1)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to write manifest padding byte"); } return EOF; } } /* now copy the actual file data to the new phar */ offset = php_stream_tell(newfile); for (zend_hash_internal_pointer_reset(&phar->manifest); zend_hash_has_more_elements(&phar->manifest) == SUCCESS; zend_hash_move_forward(&phar->manifest)) { if ((entry = zend_hash_get_current_data_ptr(&phar->manifest)) == NULL) { continue; } if (entry->is_deleted || entry->is_dir || entry->is_mounted) { continue; } if (entry->cfp) { file = entry->cfp; php_stream_rewind(file); } else { file = phar_get_efp(entry, 0); if (-1 == phar_seek_efp(entry, 0, SEEK_SET, 0, 0)) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname); } return EOF; } } if (!file) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to seek to start of file \"%s\" while creating new phar \"%s\"", entry->filename, phar->fname); } return EOF; } /* this will have changed for all files that have either changed compression or been modified */ entry->offset = entry->offset_abs = offset; offset += entry->compressed_filesize; if (php_stream_copy_to_stream_ex(file, newfile, entry->compressed_filesize, &wrote) == FAILURE) { if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to write contents of file \"%s\" to new phar \"%s\"", entry->filename, phar->fname); } return EOF; } entry->is_modified = 0; if (entry->cfp) { php_stream_close(entry->cfp); entry->cfp = NULL; } if (entry->fp_type == PHAR_MOD) { /* this fp is in use by a phar_entry_data returned by phar_get_entry_data, it will be closed when the phar_entry_data is phar_entry_delref'ed */ if (entry->fp_refcount == 0 && entry->fp != phar->fp && entry->fp != phar->ufp) { php_stream_close(entry->fp); } entry->fp = NULL; entry->fp_type = PHAR_FP; } else if (entry->fp_type == PHAR_UFP) { entry->fp_type = PHAR_FP; } } /* append signature */ if (global_flags & PHAR_HDR_SIGNATURE) { char sig_buf[4]; php_stream_rewind(newfile); if (phar->signature) { efree(phar->signature); phar->signature = NULL; } switch(phar->sig_flags) { #ifndef PHAR_HASH_OK case PHAR_SIG_SHA512: case PHAR_SIG_SHA256: if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); if (error) { spprintf(error, 0, "unable to write contents of file \"%s\" to new phar \"%s\" with requested hash type", entry->filename, phar->fname); } return EOF; #endif default: { char *digest = NULL; int digest_len; if (FAILURE == phar_create_signature(phar, newfile, &digest, &digest_len, error)) { if (error) { char *save = *error; spprintf(error, 0, "phar error: unable to write signature: %s", save); efree(save); } if (digest) { efree(digest); } if (closeoldfile) { php_stream_close(oldfile); } php_stream_close(newfile); return EOF; } php_stream_write(newfile, digest, digest_len); efree(digest); if (phar->sig_flags == PHAR_SIG_OPENSSL) { phar_set_32(sig_buf, digest_len); php_stream_write(newfile, sig_buf, 4); } break; } } phar_set_32(sig_buf, phar->sig_flags); php_stream_write(newfile, sig_buf, 4); php_stream_write(newfile, "GBMB", 4); } /* finally, close the temp file, rename the original phar, move the temp to the old phar, unlink the old phar, and reload it into memory */ if (phar->fp && free_fp) { php_stream_close(phar->fp); } if (phar->ufp) { if (free_ufp) { php_stream_close(phar->ufp); } phar->ufp = NULL; } if (closeoldfile) { php_stream_close(oldfile); } phar->internal_file_start = halt_offset + manifest_len + 4; phar->halt_offset = halt_offset; phar->is_brandnew = 0; php_stream_rewind(newfile); if (phar->donotflush) { /* deferred flush */ phar->fp = newfile; } else { phar->fp = php_stream_open_wrapper(phar->fname, "w+b", IGNORE_URL|STREAM_MUST_SEEK|REPORT_ERRORS, NULL); if (!phar->fp) { phar->fp = newfile; if (error) { spprintf(error, 4096, "unable to open new phar \"%s\" for writing", phar->fname); } return EOF; } if (phar->flags & PHAR_FILE_COMPRESSED_GZ) { /* to properly compress, we have to tell zlib to add a zlib header */ zval filterparams; array_init(&filterparams); add_assoc_long(&filterparams, "window", MAX_WBITS+16); filter = php_stream_filter_create("zlib.deflate", &filterparams, php_stream_is_persistent(phar->fp)); zval_dtor(&filterparams); if (!filter) { if (error) { spprintf(error, 4096, "unable to compress all contents of phar \"%s\" using zlib, PHP versions older than 5.2.6 have a buggy zlib", phar->fname); } return EOF; } php_stream_filter_append(&phar->fp->writefilters, filter); php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1); php_stream_close(phar->fp); /* use the temp stream as our base */ phar->fp = newfile; } else if (phar->flags & PHAR_FILE_COMPRESSED_BZ2) { filter = php_stream_filter_create("bzip2.compress", NULL, php_stream_is_persistent(phar->fp)); php_stream_filter_append(&phar->fp->writefilters, filter); php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); php_stream_filter_flush(filter, 1); php_stream_filter_remove(filter, 1); php_stream_close(phar->fp); /* use the temp stream as our base */ phar->fp = newfile; } else { php_stream_copy_to_stream_ex(newfile, phar->fp, PHP_STREAM_COPY_ALL, NULL); /* we could also reopen the file in "rb" mode but there is no need for that */ php_stream_close(newfile); } } if (-1 == php_stream_seek(phar->fp, phar->halt_offset, SEEK_SET)) { if (error) { spprintf(error, 0, "unable to seek to __HALT_COMPILER(); in new phar \"%s\"", phar->fname); } return EOF; } return EOF; } /* }}} */
C
php
0
CVE-2016-10066
https://www.cvedetails.com/cve/CVE-2016-10066/
CWE-119
https://github.com/ImageMagick/ImageMagick/commit/f6e9d0d9955e85bdd7540b251cd50d598dacc5e6
f6e9d0d9955e85bdd7540b251cd50d598dacc5e6
null
static void WriteFourCC(Image *image, const size_t compression, const MagickBooleanType clusterFit, const MagickBooleanType weightByAlpha, ExceptionInfo *exception) { register const PixelPacket *p; register ssize_t x; ssize_t i, y, bx, by; for (y=0; y < (ssize_t) image->rows; y+=4) { for (x=0; x < (ssize_t) image->columns; x+=4) { MagickBooleanType match; DDSVector4 point, points[16]; size_t count = 0, max5 = 0, max7 = 0, min5 = 255, min7 = 255, columns = 4, rows = 4; ssize_t alphas[16], map[16]; unsigned char alpha; if (x + columns >= image->columns) columns = image->columns - x; if (y + rows >= image->rows) rows = image->rows - y; p=GetVirtualPixels(image,x,y,columns,rows,exception); if (p == (const PixelPacket *) NULL) break; for (i=0; i<16; i++) { map[i] = -1; alphas[i] = -1; } for (by=0; by < (ssize_t) rows; by++) { for (bx=0; bx < (ssize_t) columns; bx++) { if (compression == FOURCC_DXT5) alpha = ScaleQuantumToChar(GetPixelAlpha(p)); else alpha = 255; alphas[4*by + bx] = (size_t)alpha; point.x = (float)ScaleQuantumToChar(GetPixelRed(p)) / 255.0f; point.y = (float)ScaleQuantumToChar(GetPixelGreen(p)) / 255.0f; point.z = (float)ScaleQuantumToChar(GetPixelBlue(p)) / 255.0f; point.w = weightByAlpha ? (float)(alpha + 1) / 256.0f : 1.0f; p++; match = MagickFalse; for (i=0; i < (ssize_t) count; i++) { if ((points[i].x == point.x) && (points[i].y == point.y) && (points[i].z == point.z) && (alpha >= 128 || compression == FOURCC_DXT5)) { points[i].w += point.w; map[4*by + bx] = i; match = MagickTrue; break; } } if (match != MagickFalse) continue; points[count].x = point.x; points[count].y = point.y; points[count].z = point.z; points[count].w = point.w; map[4*by + bx] = count; count++; if (compression == FOURCC_DXT5) { if (alpha < min7) min7 = alpha; if (alpha > max7) max7 = alpha; if (alpha != 0 && alpha < min5) min5 = alpha; if (alpha != 255 && alpha > max5) max5 = alpha; } } } for (i=0; i < (ssize_t) count; i++) points[i].w = sqrt(points[i].w); if (compression == FOURCC_DXT5) WriteAlphas(image,alphas,min5,max5,min7,max7); if (count == 1) WriteSingleColorFit(image,points,map); else WriteCompressed(image,count,points,map,clusterFit); } } }
static void WriteFourCC(Image *image, const size_t compression, const MagickBooleanType clusterFit, const MagickBooleanType weightByAlpha, ExceptionInfo *exception) { register const PixelPacket *p; register ssize_t x; ssize_t i, y, bx, by; for (y=0; y < (ssize_t) image->rows; y+=4) { for (x=0; x < (ssize_t) image->columns; x+=4) { MagickBooleanType match; DDSVector4 point, points[16]; size_t count = 0, max5 = 0, max7 = 0, min5 = 255, min7 = 255, columns = 4, rows = 4; ssize_t alphas[16], map[16]; unsigned char alpha; if (x + columns >= image->columns) columns = image->columns - x; if (y + rows >= image->rows) rows = image->rows - y; p=GetVirtualPixels(image,x,y,columns,rows,exception); if (p == (const PixelPacket *) NULL) break; for (i=0; i<16; i++) { map[i] = -1; alphas[i] = -1; } for (by=0; by < (ssize_t) rows; by++) { for (bx=0; bx < (ssize_t) columns; bx++) { if (compression == FOURCC_DXT5) alpha = ScaleQuantumToChar(GetPixelAlpha(p)); else alpha = 255; alphas[4*by + bx] = (size_t)alpha; point.x = (float)ScaleQuantumToChar(GetPixelRed(p)) / 255.0f; point.y = (float)ScaleQuantumToChar(GetPixelGreen(p)) / 255.0f; point.z = (float)ScaleQuantumToChar(GetPixelBlue(p)) / 255.0f; point.w = weightByAlpha ? (float)(alpha + 1) / 256.0f : 1.0f; p++; match = MagickFalse; for (i=0; i < (ssize_t) count; i++) { if ((points[i].x == point.x) && (points[i].y == point.y) && (points[i].z == point.z) && (alpha >= 128 || compression == FOURCC_DXT5)) { points[i].w += point.w; map[4*by + bx] = i; match = MagickTrue; break; } } if (match != MagickFalse) continue; points[count].x = point.x; points[count].y = point.y; points[count].z = point.z; points[count].w = point.w; map[4*by + bx] = count; count++; if (compression == FOURCC_DXT5) { if (alpha < min7) min7 = alpha; if (alpha > max7) max7 = alpha; if (alpha != 0 && alpha < min5) min5 = alpha; if (alpha != 255 && alpha > max5) max5 = alpha; } } } for (i=0; i < (ssize_t) count; i++) points[i].w = sqrt(points[i].w); if (compression == FOURCC_DXT5) WriteAlphas(image,alphas,min5,max5,min7,max7); if (count == 1) WriteSingleColorFit(image,points,map); else WriteCompressed(image,count,points,map,clusterFit); } } }
C
ImageMagick
0
CVE-2016-5199
https://www.cvedetails.com/cve/CVE-2016-5199/
CWE-119
https://github.com/chromium/chromium/commit/c995d4fe5e96f4d6d4a88b7867279b08e72d2579
c995d4fe5e96f4d6d4a88b7867279b08e72d2579
Move IsDataSaverEnabledByUser to be a static method and use it This method now officially becomes the source of truth that everything in the code base eventually calls into to determine whether or not DataSaver is enabled. Bug: 934399 Change-Id: Iae837b710ace8cc3101188f79d02cbc2d4f0fd93 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1537242 Reviewed-by: Joshua Pawlicki <[email protected]> Reviewed-by: Tarun Bansal <[email protected]> Commit-Queue: Robert Ogden <[email protected]> Cr-Commit-Position: refs/heads/master@{#643948}
std::string GetUserAgent() { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kUserAgent)) { std::string ua = command_line->GetSwitchValueASCII(switches::kUserAgent); if (net::HttpUtil::IsValidHeaderValue(ua)) return ua; LOG(WARNING) << "Ignored invalid value for flag --" << switches::kUserAgent; } std::string product = GetProduct(); #if defined(OS_ANDROID) if (command_line->HasSwitch(switches::kUseMobileUserAgent)) product += " Mobile"; #endif return content::BuildUserAgentFromProduct(product); }
std::string GetUserAgent() { base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kUserAgent)) { std::string ua = command_line->GetSwitchValueASCII(switches::kUserAgent); if (net::HttpUtil::IsValidHeaderValue(ua)) return ua; LOG(WARNING) << "Ignored invalid value for flag --" << switches::kUserAgent; } std::string product = GetProduct(); #if defined(OS_ANDROID) if (command_line->HasSwitch(switches::kUseMobileUserAgent)) product += " Mobile"; #endif return content::BuildUserAgentFromProduct(product); }
C
Chrome
0
CVE-2013-2168
https://www.cvedetails.com/cve/CVE-2013-2168/
CWE-20
https://cgit.freedesktop.org/dbus/dbus/commit/?id=954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
954d75b2b64e4799f360d2a6bf9cff6d9fee37e7
null
_dbus_append_keyring_directory_for_credentials (DBusString *directory, DBusCredentials *credentials) { DBusString homedir; DBusString dotdir; const char *homepath; const char *homedrive; _dbus_assert (credentials != NULL); _dbus_assert (!_dbus_credentials_are_anonymous (credentials)); if (!_dbus_string_init (&homedir)) return FALSE; homedrive = _dbus_getenv("HOMEDRIVE"); if (homedrive != NULL && *homedrive != '\0') { _dbus_string_append(&homedir,homedrive); } homepath = _dbus_getenv("HOMEPATH"); if (homepath != NULL && *homepath != '\0') { _dbus_string_append(&homedir,homepath); } #ifdef DBUS_BUILD_TESTS { const char *override; override = _dbus_getenv ("DBUS_TEST_HOMEDIR"); if (override != NULL && *override != '\0') { _dbus_string_set_length (&homedir, 0); if (!_dbus_string_append (&homedir, override)) goto failed; _dbus_verbose ("Using fake homedir for testing: %s\n", _dbus_string_get_const_data (&homedir)); } else { static dbus_bool_t already_warned = FALSE; if (!already_warned) { _dbus_warn ("Using your real home directory for testing, set DBUS_TEST_HOMEDIR to avoid\n"); already_warned = TRUE; } } } #endif #ifdef DBUS_WINCE /* It's not possible to create a .something directory in Windows CE using the file explorer. */ #define KEYRING_DIR "dbus-keyrings" #else #define KEYRING_DIR ".dbus-keyrings" #endif _dbus_string_init_const (&dotdir, KEYRING_DIR); if (!_dbus_concat_dir_and_file (&homedir, &dotdir)) goto failed; if (!_dbus_string_copy (&homedir, 0, directory, _dbus_string_get_length (directory))) { goto failed; } _dbus_string_free (&homedir); return TRUE; failed: _dbus_string_free (&homedir); return FALSE; }
_dbus_append_keyring_directory_for_credentials (DBusString *directory, DBusCredentials *credentials) { DBusString homedir; DBusString dotdir; const char *homepath; const char *homedrive; _dbus_assert (credentials != NULL); _dbus_assert (!_dbus_credentials_are_anonymous (credentials)); if (!_dbus_string_init (&homedir)) return FALSE; homedrive = _dbus_getenv("HOMEDRIVE"); if (homedrive != NULL && *homedrive != '\0') { _dbus_string_append(&homedir,homedrive); } homepath = _dbus_getenv("HOMEPATH"); if (homepath != NULL && *homepath != '\0') { _dbus_string_append(&homedir,homepath); } #ifdef DBUS_BUILD_TESTS { const char *override; override = _dbus_getenv ("DBUS_TEST_HOMEDIR"); if (override != NULL && *override != '\0') { _dbus_string_set_length (&homedir, 0); if (!_dbus_string_append (&homedir, override)) goto failed; _dbus_verbose ("Using fake homedir for testing: %s\n", _dbus_string_get_const_data (&homedir)); } else { static dbus_bool_t already_warned = FALSE; if (!already_warned) { _dbus_warn ("Using your real home directory for testing, set DBUS_TEST_HOMEDIR to avoid\n"); already_warned = TRUE; } } } #endif #ifdef DBUS_WINCE /* It's not possible to create a .something directory in Windows CE using the file explorer. */ #define KEYRING_DIR "dbus-keyrings" #else #define KEYRING_DIR ".dbus-keyrings" #endif _dbus_string_init_const (&dotdir, KEYRING_DIR); if (!_dbus_concat_dir_and_file (&homedir, &dotdir)) goto failed; if (!_dbus_string_copy (&homedir, 0, directory, _dbus_string_get_length (directory))) { goto failed; } _dbus_string_free (&homedir); return TRUE; failed: _dbus_string_free (&homedir); return FALSE; }
C
dbus
0
CVE-2018-16427
https://www.cvedetails.com/cve/CVE-2018-16427/
CWE-125
https://github.com/OpenSC/OpenSC/pull/1447/commits/8fe377e93b4b56060e5bbfb6f3142ceaeca744fa
8fe377e93b4b56060e5bbfb6f3142ceaeca744fa
fixed out of bounds reads Thanks to Eric Sesterhenn from X41 D-SEC GmbH for reporting and suggesting security fixes.
epass2003_select_fid(struct sc_card *card, unsigned int id_hi, unsigned int id_lo, sc_file_t ** file_out) { int r; sc_file_t *file = 0; sc_path_t path; memset(&path, 0, sizeof(path)); path.type = SC_PATH_TYPE_FILE_ID; path.value[0] = id_hi; path.value[1] = id_lo; path.len = 2; r = epass2003_select_fid_(card, &path, &file); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); /* update cache */ if (file && file->type == SC_FILE_TYPE_DF) { card->cache.current_path.type = SC_PATH_TYPE_PATH; card->cache.current_path.value[0] = 0x3f; card->cache.current_path.value[1] = 0x00; if (id_hi == 0x3f && id_lo == 0x00) { card->cache.current_path.len = 2; } else { card->cache.current_path.len = 4; card->cache.current_path.value[2] = id_hi; card->cache.current_path.value[3] = id_lo; } } if (file_out) *file_out = file; LOG_FUNC_RETURN(card->ctx, SC_SUCCESS); }
epass2003_select_fid(struct sc_card *card, unsigned int id_hi, unsigned int id_lo, sc_file_t ** file_out) { int r; sc_file_t *file = 0; sc_path_t path; memset(&path, 0, sizeof(path)); path.type = SC_PATH_TYPE_FILE_ID; path.value[0] = id_hi; path.value[1] = id_lo; path.len = 2; r = epass2003_select_fid_(card, &path, &file); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); /* update cache */ if (file && file->type == SC_FILE_TYPE_DF) { card->cache.current_path.type = SC_PATH_TYPE_PATH; card->cache.current_path.value[0] = 0x3f; card->cache.current_path.value[1] = 0x00; if (id_hi == 0x3f && id_lo == 0x00) { card->cache.current_path.len = 2; } else { card->cache.current_path.len = 4; card->cache.current_path.value[2] = id_hi; card->cache.current_path.value[3] = id_lo; } } if (file_out) *file_out = file; LOG_FUNC_RETURN(card->ctx, SC_SUCCESS); }
C
OpenSC
0
CVE-2013-0886
https://www.cvedetails.com/cve/CVE-2013-0886/
null
https://github.com/chromium/chromium/commit/18d67244984a574ba2dd8779faabc0e3e34f4b76
18d67244984a574ba2dd8779faabc0e3e34f4b76
Implement TextureImageTransportSurface using texture mailbox This has a couple of advantages: - allow tearing down and recreating the UI parent context without losing the renderer contexts - do not require a context to be able to generate textures when creating the GLSurfaceHandle - clearer ownership semantics that potentially allows for more robust and easier lost context handling/thumbnailing/etc., since a texture is at any given time owned by either: UI parent, mailbox, or TextureImageTransportSurface - simplify frontbuffer protection logic; the frontbuffer textures are now owned by RWHV where they are refcounted The TextureImageTransportSurface informs RenderWidgetHostView of the mailbox names for the front- and backbuffer textures by associating them with a surface_handle (1 or 2) in the AcceleratedSurfaceNew message. During SwapBuffers() or PostSubBuffer() cycles, it then uses produceTextureCHROMIUM() and consumeTextureCHROMIUM() to transfer ownership between renderer and browser compositor. RWHV sends back the surface_handle of the buffer being returned with the Swap ACK (or 0 if no buffer is being returned in which case TextureImageTransportSurface will allocate a new texture - note that this could be used to simply keep textures for thumbnailing). BUG=154815,139616 [email protected] Review URL: https://chromiumcodereview.appspot.com/11194042 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171569 0039d316-1c4b-4281-b951-d872f2087c98
bool RenderWidgetHostViewAura::GetTextFromRange( const ui::Range& range, string16* text) { ui::Range selection_text_range(selection_text_offset_, selection_text_offset_ + selection_text_.length()); if (!selection_text_range.Contains(range)) { text->clear(); return false; } if (selection_text_range.EqualsIgnoringDirection(range)) { *text = selection_text_; } else { *text = selection_text_.substr( range.GetMin() - selection_text_offset_, range.length()); } return true; }
bool RenderWidgetHostViewAura::GetTextFromRange( const ui::Range& range, string16* text) { ui::Range selection_text_range(selection_text_offset_, selection_text_offset_ + selection_text_.length()); if (!selection_text_range.Contains(range)) { text->clear(); return false; } if (selection_text_range.EqualsIgnoringDirection(range)) { *text = selection_text_; } else { *text = selection_text_.substr( range.GetMin() - selection_text_offset_, range.length()); } return true; }
C
Chrome
0
CVE-2012-2888
https://www.cvedetails.com/cve/CVE-2012-2888/
CWE-399
https://github.com/chromium/chromium/commit/3b0d77670a0613f409110817455d2137576b485a
3b0d77670a0613f409110817455d2137576b485a
Revert 143656 - Add an IPC channel between the NaCl loader process and the renderer. BUG=116317 TEST=ppapi, nacl tests, manual testing for experimental IPC proxy. Review URL: https://chromiumcodereview.appspot.com/10641016 [email protected] Review URL: https://chromiumcodereview.appspot.com/10625007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@143665 0039d316-1c4b-4281-b951-d872f2087c98
Plugin* Plugin::New(PP_Instance pp_instance) { PLUGIN_PRINTF(("Plugin::New (pp_instance=%"NACL_PRId32")\n", pp_instance)); Plugin* plugin = new Plugin(pp_instance); PLUGIN_PRINTF(("Plugin::New (plugin=%p)\n", static_cast<void*>(plugin))); if (plugin == NULL) { return NULL; } return plugin; }
Plugin* Plugin::New(PP_Instance pp_instance) { PLUGIN_PRINTF(("Plugin::New (pp_instance=%"NACL_PRId32")\n", pp_instance)); Plugin* plugin = new Plugin(pp_instance); PLUGIN_PRINTF(("Plugin::New (plugin=%p)\n", static_cast<void*>(plugin))); if (plugin == NULL) { return NULL; } return plugin; }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/4afa45dfbf11e9334e63aef002cd854ec86f6d44
4afa45dfbf11e9334e63aef002cd854ec86f6d44
Revert 37061 because it caused ui_tests to not finish. TBR=estade TEST=none BUG=none Review URL: http://codereview.chromium.org/549155 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@37075 0039d316-1c4b-4281-b951-d872f2087c98
gfx::Insets BrowserActionButton::GetInsets() const { static gfx::Insets zero_inset; return zero_inset; }
gfx::Insets BrowserActionButton::GetInsets() const { static gfx::Insets zero_inset; return zero_inset; }
C
Chrome
0
CVE-2017-11664
https://www.cvedetails.com/cve/CVE-2017-11664/
CWE-125
https://github.com/Mindwerks/wildmidi/commit/660b513d99bced8783a4a5984ac2f742c74ebbdd
660b513d99bced8783a4a5984ac2f742c74ebbdd
Add a new size parameter to _WM_SetupMidiEvent() so that it knows where to stop reading, and adjust its users properly. Fixes bug #175 (CVE-2017-11661, CVE-2017-11662, CVE-2017-11663, CVE-2017-11664.)
void _WM_do_control_non_registered_param_course(struct _mdi *mdi, struct _event_data *data) { uint8_t ch = data->channel; MIDI_EVENT_DEBUG(__FUNCTION__,ch, data->data.value); mdi->channel[ch].reg_data = (mdi->channel[ch].reg_data & 0x7F) | (data->data.value << 7); mdi->channel[ch].reg_non = 1; }
void _WM_do_control_non_registered_param_course(struct _mdi *mdi, struct _event_data *data) { uint8_t ch = data->channel; MIDI_EVENT_DEBUG(__FUNCTION__,ch, data->data.value); mdi->channel[ch].reg_data = (mdi->channel[ch].reg_data & 0x7F) | (data->data.value << 7); mdi->channel[ch].reg_non = 1; }
C
wildmidi
0
CVE-2018-18352
https://www.cvedetails.com/cve/CVE-2018-18352/
CWE-732
https://github.com/chromium/chromium/commit/a9cbaa7a40e2b2723cfc2f266c42f4980038a949
a9cbaa7a40e2b2723cfc2f266c42f4980038a949
Simplify "WouldTaintOrigin" concept in media/blink Currently WebMediaPlayer has three predicates: - DidGetOpaqueResponseFromServiceWorker - HasSingleSecurityOrigin - DidPassCORSAccessCheck . These are used to determine whether the response body is available for scripts. They are known to be confusing, and actually MediaElementAudioSourceHandler::WouldTaintOrigin misuses them. This CL merges the three predicates to one, WouldTaintOrigin, to remove the confusion. Now the "response type" concept is available and we don't need a custom CORS check, so this CL removes BaseAudioContext::WouldTaintOrigin. This CL also renames URLData::has_opaque_data_ and its (direct and indirect) data accessors to match the spec. Bug: 849942, 875153 Change-Id: I6acf50169d7445c4ff614e80ac606f79ee577d2a Reviewed-on: https://chromium-review.googlesource.com/c/1238098 Reviewed-by: Fredrik Hubinette <[email protected]> Reviewed-by: Kinuko Yasuda <[email protected]> Reviewed-by: Raymond Toy <[email protected]> Commit-Queue: Yutaka Hirano <[email protected]> Cr-Commit-Position: refs/heads/master@{#598258}
bool WebMediaPlayerMS::DidGetOpaqueResponseFromServiceWorker() const { bool WebMediaPlayerMS::WouldTaintOrigin() const { DCHECK(thread_checker_.CalledOnValidThread()); return false; }
bool WebMediaPlayerMS::DidGetOpaqueResponseFromServiceWorker() const { DCHECK(thread_checker_.CalledOnValidThread()); return false; }
C
Chrome
1
CVE-2014-9940
https://www.cvedetails.com/cve/CVE-2014-9940/
CWE-416
https://github.com/torvalds/linux/commit/60a2362f769cf549dc466134efe71c8bf9fbaaba
60a2362f769cf549dc466134efe71c8bf9fbaaba
regulator: core: Fix regualtor_ena_gpio_free not to access pin after freeing After freeing pin from regulator_ena_gpio_free, loop can access the pin. So this patch fixes not to access pin after freeing. Signed-off-by: Seung-Woo Kim <[email protected]> Signed-off-by: Mark Brown <[email protected]>
static int add_regulator_attributes(struct regulator_dev *rdev) { struct device *dev = &rdev->dev; const struct regulator_ops *ops = rdev->desc->ops; int status = 0; /* some attributes need specific methods to be displayed */ if ((ops->get_voltage && ops->get_voltage(rdev) >= 0) || (ops->get_voltage_sel && ops->get_voltage_sel(rdev) >= 0) || (ops->list_voltage && ops->list_voltage(rdev, 0) >= 0) || (rdev->desc->fixed_uV && (rdev->desc->n_voltages == 1))) { status = device_create_file(dev, &dev_attr_microvolts); if (status < 0) return status; } if (ops->get_current_limit) { status = device_create_file(dev, &dev_attr_microamps); if (status < 0) return status; } if (ops->get_mode) { status = device_create_file(dev, &dev_attr_opmode); if (status < 0) return status; } if (rdev->ena_pin || ops->is_enabled) { status = device_create_file(dev, &dev_attr_state); if (status < 0) return status; } if (ops->get_status) { status = device_create_file(dev, &dev_attr_status); if (status < 0) return status; } if (ops->get_bypass) { status = device_create_file(dev, &dev_attr_bypass); if (status < 0) return status; } /* some attributes are type-specific */ if (rdev->desc->type == REGULATOR_CURRENT) { status = device_create_file(dev, &dev_attr_requested_microamps); if (status < 0) return status; } /* all the other attributes exist to support constraints; * don't show them if there are no constraints, or if the * relevant supporting methods are missing. */ if (!rdev->constraints) return status; /* constraints need specific supporting methods */ if (ops->set_voltage || ops->set_voltage_sel) { status = device_create_file(dev, &dev_attr_min_microvolts); if (status < 0) return status; status = device_create_file(dev, &dev_attr_max_microvolts); if (status < 0) return status; } if (ops->set_current_limit) { status = device_create_file(dev, &dev_attr_min_microamps); if (status < 0) return status; status = device_create_file(dev, &dev_attr_max_microamps); if (status < 0) return status; } status = device_create_file(dev, &dev_attr_suspend_standby_state); if (status < 0) return status; status = device_create_file(dev, &dev_attr_suspend_mem_state); if (status < 0) return status; status = device_create_file(dev, &dev_attr_suspend_disk_state); if (status < 0) return status; if (ops->set_suspend_voltage) { status = device_create_file(dev, &dev_attr_suspend_standby_microvolts); if (status < 0) return status; status = device_create_file(dev, &dev_attr_suspend_mem_microvolts); if (status < 0) return status; status = device_create_file(dev, &dev_attr_suspend_disk_microvolts); if (status < 0) return status; } if (ops->set_suspend_mode) { status = device_create_file(dev, &dev_attr_suspend_standby_mode); if (status < 0) return status; status = device_create_file(dev, &dev_attr_suspend_mem_mode); if (status < 0) return status; status = device_create_file(dev, &dev_attr_suspend_disk_mode); if (status < 0) return status; } return status; }
static int add_regulator_attributes(struct regulator_dev *rdev) { struct device *dev = &rdev->dev; const struct regulator_ops *ops = rdev->desc->ops; int status = 0; /* some attributes need specific methods to be displayed */ if ((ops->get_voltage && ops->get_voltage(rdev) >= 0) || (ops->get_voltage_sel && ops->get_voltage_sel(rdev) >= 0) || (ops->list_voltage && ops->list_voltage(rdev, 0) >= 0) || (rdev->desc->fixed_uV && (rdev->desc->n_voltages == 1))) { status = device_create_file(dev, &dev_attr_microvolts); if (status < 0) return status; } if (ops->get_current_limit) { status = device_create_file(dev, &dev_attr_microamps); if (status < 0) return status; } if (ops->get_mode) { status = device_create_file(dev, &dev_attr_opmode); if (status < 0) return status; } if (rdev->ena_pin || ops->is_enabled) { status = device_create_file(dev, &dev_attr_state); if (status < 0) return status; } if (ops->get_status) { status = device_create_file(dev, &dev_attr_status); if (status < 0) return status; } if (ops->get_bypass) { status = device_create_file(dev, &dev_attr_bypass); if (status < 0) return status; } /* some attributes are type-specific */ if (rdev->desc->type == REGULATOR_CURRENT) { status = device_create_file(dev, &dev_attr_requested_microamps); if (status < 0) return status; } /* all the other attributes exist to support constraints; * don't show them if there are no constraints, or if the * relevant supporting methods are missing. */ if (!rdev->constraints) return status; /* constraints need specific supporting methods */ if (ops->set_voltage || ops->set_voltage_sel) { status = device_create_file(dev, &dev_attr_min_microvolts); if (status < 0) return status; status = device_create_file(dev, &dev_attr_max_microvolts); if (status < 0) return status; } if (ops->set_current_limit) { status = device_create_file(dev, &dev_attr_min_microamps); if (status < 0) return status; status = device_create_file(dev, &dev_attr_max_microamps); if (status < 0) return status; } status = device_create_file(dev, &dev_attr_suspend_standby_state); if (status < 0) return status; status = device_create_file(dev, &dev_attr_suspend_mem_state); if (status < 0) return status; status = device_create_file(dev, &dev_attr_suspend_disk_state); if (status < 0) return status; if (ops->set_suspend_voltage) { status = device_create_file(dev, &dev_attr_suspend_standby_microvolts); if (status < 0) return status; status = device_create_file(dev, &dev_attr_suspend_mem_microvolts); if (status < 0) return status; status = device_create_file(dev, &dev_attr_suspend_disk_microvolts); if (status < 0) return status; } if (ops->set_suspend_mode) { status = device_create_file(dev, &dev_attr_suspend_standby_mode); if (status < 0) return status; status = device_create_file(dev, &dev_attr_suspend_mem_mode); if (status < 0) return status; status = device_create_file(dev, &dev_attr_suspend_disk_mode); if (status < 0) return status; } return status; }
C
linux
0
CVE-2014-6269
https://www.cvedetails.com/cve/CVE-2014-6269/
CWE-189
https://git.haproxy.org/?p=haproxy-1.5.git;a=commitdiff;h=b4d05093bc89f71377230228007e69a1434c1a0c
b4d05093bc89f71377230228007e69a1434c1a0c
null
static void stream_int_update_embedded(struct stream_interface *si) { int old_flags = si->flags; DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n", __FUNCTION__, si, si->state, si->ib->flags, si->ob->flags); if (si->state != SI_ST_EST) return; if ((si->ob->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW && channel_is_empty(si->ob)) si_shutw(si); if ((si->ob->flags & (CF_SHUTW|CF_SHUTW_NOW)) == 0 && !channel_full(si->ob)) si->flags |= SI_FL_WAIT_DATA; /* we're almost sure that we need some space if the buffer is not * empty, even if it's not full, because the applets can't fill it. */ if ((si->ib->flags & (CF_SHUTR|CF_DONT_READ)) == 0 && !channel_is_empty(si->ib)) si->flags |= SI_FL_WAIT_ROOM; if (si->ob->flags & CF_WRITE_ACTIVITY) { if (tick_isset(si->ob->wex)) si->ob->wex = tick_add_ifset(now_ms, si->ob->wto); } if (si->ib->flags & CF_READ_ACTIVITY || (si->ob->flags & CF_WRITE_ACTIVITY && !(si->flags & SI_FL_INDEP_STR))) { if (tick_isset(si->ib->rex)) si->ib->rex = tick_add_ifset(now_ms, si->ib->rto); } /* save flags to detect changes */ old_flags = si->flags; if (likely((si->ob->flags & (CF_SHUTW|CF_WRITE_PARTIAL|CF_DONT_READ)) == CF_WRITE_PARTIAL && !channel_full(si->ob) && (si->ob->prod->flags & SI_FL_WAIT_ROOM))) si_chk_rcv(si->ob->prod); if (((si->ib->flags & CF_READ_PARTIAL) && !channel_is_empty(si->ib)) && (si->ib->cons->flags & SI_FL_WAIT_DATA)) { si_chk_snd(si->ib->cons); /* check if the consumer has freed some space */ if (!channel_full(si->ib)) si->flags &= ~SI_FL_WAIT_ROOM; } /* Note that we're trying to wake up in two conditions here : * - special event, which needs the holder task attention * - status indicating that the applet can go on working. This * is rather hard because we might be blocking on output and * don't want to wake up on input and vice-versa. The idea is * to only rely on the changes the chk_* might have performed. */ if (/* check stream interface changes */ ((old_flags & ~si->flags) & (SI_FL_WAIT_ROOM|SI_FL_WAIT_DATA)) || /* changes on the production side */ (si->ib->flags & (CF_READ_NULL|CF_READ_ERROR)) || si->state != SI_ST_EST || (si->flags & SI_FL_ERR) || ((si->ib->flags & CF_READ_PARTIAL) && (!si->ib->to_forward || si->ib->cons->state != SI_ST_EST)) || /* changes on the consumption side */ (si->ob->flags & (CF_WRITE_NULL|CF_WRITE_ERROR)) || ((si->ob->flags & CF_WRITE_ACTIVITY) && ((si->ob->flags & CF_SHUTW) || ((si->ob->flags & CF_WAKE_WRITE) && (si->ob->prod->state != SI_ST_EST || (channel_is_empty(si->ob) && !si->ob->to_forward)))))) { if (!(si->flags & SI_FL_DONT_WAKE) && si->owner) task_wakeup(si->owner, TASK_WOKEN_IO); } if (si->ib->flags & CF_READ_ACTIVITY) si->ib->flags &= ~CF_READ_DONTWAIT; }
static void stream_int_update_embedded(struct stream_interface *si) { int old_flags = si->flags; DPRINTF(stderr, "%s: si=%p, si->state=%d ib->flags=%08x ob->flags=%08x\n", __FUNCTION__, si, si->state, si->ib->flags, si->ob->flags); if (si->state != SI_ST_EST) return; if ((si->ob->flags & (CF_SHUTW|CF_SHUTW_NOW)) == CF_SHUTW_NOW && channel_is_empty(si->ob)) si_shutw(si); if ((si->ob->flags & (CF_SHUTW|CF_SHUTW_NOW)) == 0 && !channel_full(si->ob)) si->flags |= SI_FL_WAIT_DATA; /* we're almost sure that we need some space if the buffer is not * empty, even if it's not full, because the applets can't fill it. */ if ((si->ib->flags & (CF_SHUTR|CF_DONT_READ)) == 0 && !channel_is_empty(si->ib)) si->flags |= SI_FL_WAIT_ROOM; if (si->ob->flags & CF_WRITE_ACTIVITY) { if (tick_isset(si->ob->wex)) si->ob->wex = tick_add_ifset(now_ms, si->ob->wto); } if (si->ib->flags & CF_READ_ACTIVITY || (si->ob->flags & CF_WRITE_ACTIVITY && !(si->flags & SI_FL_INDEP_STR))) { if (tick_isset(si->ib->rex)) si->ib->rex = tick_add_ifset(now_ms, si->ib->rto); } /* save flags to detect changes */ old_flags = si->flags; if (likely((si->ob->flags & (CF_SHUTW|CF_WRITE_PARTIAL|CF_DONT_READ)) == CF_WRITE_PARTIAL && !channel_full(si->ob) && (si->ob->prod->flags & SI_FL_WAIT_ROOM))) si_chk_rcv(si->ob->prod); if (((si->ib->flags & CF_READ_PARTIAL) && !channel_is_empty(si->ib)) && (si->ib->cons->flags & SI_FL_WAIT_DATA)) { si_chk_snd(si->ib->cons); /* check if the consumer has freed some space */ if (!channel_full(si->ib)) si->flags &= ~SI_FL_WAIT_ROOM; } /* Note that we're trying to wake up in two conditions here : * - special event, which needs the holder task attention * - status indicating that the applet can go on working. This * is rather hard because we might be blocking on output and * don't want to wake up on input and vice-versa. The idea is * to only rely on the changes the chk_* might have performed. */ if (/* check stream interface changes */ ((old_flags & ~si->flags) & (SI_FL_WAIT_ROOM|SI_FL_WAIT_DATA)) || /* changes on the production side */ (si->ib->flags & (CF_READ_NULL|CF_READ_ERROR)) || si->state != SI_ST_EST || (si->flags & SI_FL_ERR) || ((si->ib->flags & CF_READ_PARTIAL) && (!si->ib->to_forward || si->ib->cons->state != SI_ST_EST)) || /* changes on the consumption side */ (si->ob->flags & (CF_WRITE_NULL|CF_WRITE_ERROR)) || ((si->ob->flags & CF_WRITE_ACTIVITY) && ((si->ob->flags & CF_SHUTW) || ((si->ob->flags & CF_WAKE_WRITE) && (si->ob->prod->state != SI_ST_EST || (channel_is_empty(si->ob) && !si->ob->to_forward)))))) { if (!(si->flags & SI_FL_DONT_WAKE) && si->owner) task_wakeup(si->owner, TASK_WOKEN_IO); } if (si->ib->flags & CF_READ_ACTIVITY) si->ib->flags &= ~CF_READ_DONTWAIT; }
C
haproxy
0
CVE-2017-18200
https://www.cvedetails.com/cve/CVE-2017-18200/
CWE-20
https://github.com/torvalds/linux/commit/638164a2718f337ea224b747cf5977ef143166a4
638164a2718f337ea224b747cf5977ef143166a4
f2fs: fix potential panic during fstrim As Ju Hyung Park reported: "When 'fstrim' is called for manual trim, a BUG() can be triggered randomly with this patch. I'm seeing this issue on both x86 Desktop and arm64 Android phone. On x86 Desktop, this was caused during Ubuntu boot-up. I have a cronjob installed which calls 'fstrim -v /' during boot. On arm64 Android, this was caused during GC looping with 1ms gc_min_sleep_time & gc_max_sleep_time." Root cause of this issue is that f2fs_wait_discard_bios can only be used by f2fs_put_super, because during put_super there must be no other referrers, so it can ignore discard entry's reference count when removing the entry, otherwise in other caller we will hit bug_on in __remove_discard_cmd as there may be other issuer added reference count in discard entry. Thread A Thread B - issue_discard_thread - f2fs_ioc_fitrim - f2fs_trim_fs - f2fs_wait_discard_bios - __issue_discard_cmd - __submit_discard_cmd - __wait_discard_cmd - dc->ref++ - __wait_one_discard_bio - __wait_discard_cmd - __remove_discard_cmd - f2fs_bug_on(sbi, dc->ref) Fixes: 969d1b180d987c2be02de890d0fff0f66a0e80de Reported-by: Ju Hyung Park <[email protected]> Signed-off-by: Chao Yu <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
void __f2fs_replace_block(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, block_t old_blkaddr, block_t new_blkaddr, bool recover_curseg, bool recover_newaddr) { struct sit_info *sit_i = SIT_I(sbi); struct curseg_info *curseg; unsigned int segno, old_cursegno; struct seg_entry *se; int type; unsigned short old_blkoff; segno = GET_SEGNO(sbi, new_blkaddr); se = get_seg_entry(sbi, segno); type = se->type; if (!recover_curseg) { /* for recovery flow */ if (se->valid_blocks == 0 && !IS_CURSEG(sbi, segno)) { if (old_blkaddr == NULL_ADDR) type = CURSEG_COLD_DATA; else type = CURSEG_WARM_DATA; } } else { if (!IS_CURSEG(sbi, segno)) type = CURSEG_WARM_DATA; } curseg = CURSEG_I(sbi, type); mutex_lock(&curseg->curseg_mutex); mutex_lock(&sit_i->sentry_lock); old_cursegno = curseg->segno; old_blkoff = curseg->next_blkoff; /* change the current segment */ if (segno != curseg->segno) { curseg->next_segno = segno; change_curseg(sbi, type); } curseg->next_blkoff = GET_BLKOFF_FROM_SEG0(sbi, new_blkaddr); __add_sum_entry(sbi, type, sum); if (!recover_curseg || recover_newaddr) update_sit_entry(sbi, new_blkaddr, 1); if (GET_SEGNO(sbi, old_blkaddr) != NULL_SEGNO) update_sit_entry(sbi, old_blkaddr, -1); locate_dirty_segment(sbi, GET_SEGNO(sbi, old_blkaddr)); locate_dirty_segment(sbi, GET_SEGNO(sbi, new_blkaddr)); locate_dirty_segment(sbi, old_cursegno); if (recover_curseg) { if (old_cursegno != curseg->segno) { curseg->next_segno = old_cursegno; change_curseg(sbi, type); } curseg->next_blkoff = old_blkoff; } mutex_unlock(&sit_i->sentry_lock); mutex_unlock(&curseg->curseg_mutex); }
void __f2fs_replace_block(struct f2fs_sb_info *sbi, struct f2fs_summary *sum, block_t old_blkaddr, block_t new_blkaddr, bool recover_curseg, bool recover_newaddr) { struct sit_info *sit_i = SIT_I(sbi); struct curseg_info *curseg; unsigned int segno, old_cursegno; struct seg_entry *se; int type; unsigned short old_blkoff; segno = GET_SEGNO(sbi, new_blkaddr); se = get_seg_entry(sbi, segno); type = se->type; if (!recover_curseg) { /* for recovery flow */ if (se->valid_blocks == 0 && !IS_CURSEG(sbi, segno)) { if (old_blkaddr == NULL_ADDR) type = CURSEG_COLD_DATA; else type = CURSEG_WARM_DATA; } } else { if (!IS_CURSEG(sbi, segno)) type = CURSEG_WARM_DATA; } curseg = CURSEG_I(sbi, type); mutex_lock(&curseg->curseg_mutex); mutex_lock(&sit_i->sentry_lock); old_cursegno = curseg->segno; old_blkoff = curseg->next_blkoff; /* change the current segment */ if (segno != curseg->segno) { curseg->next_segno = segno; change_curseg(sbi, type); } curseg->next_blkoff = GET_BLKOFF_FROM_SEG0(sbi, new_blkaddr); __add_sum_entry(sbi, type, sum); if (!recover_curseg || recover_newaddr) update_sit_entry(sbi, new_blkaddr, 1); if (GET_SEGNO(sbi, old_blkaddr) != NULL_SEGNO) update_sit_entry(sbi, old_blkaddr, -1); locate_dirty_segment(sbi, GET_SEGNO(sbi, old_blkaddr)); locate_dirty_segment(sbi, GET_SEGNO(sbi, new_blkaddr)); locate_dirty_segment(sbi, old_cursegno); if (recover_curseg) { if (old_cursegno != curseg->segno) { curseg->next_segno = old_cursegno; change_curseg(sbi, type); } curseg->next_blkoff = old_blkoff; } mutex_unlock(&sit_i->sentry_lock); mutex_unlock(&curseg->curseg_mutex); }
C
linux
0
CVE-2014-0143
https://www.cvedetails.com/cve/CVE-2014-0143/
CWE-190
https://git.qemu.org/?p=qemu.git;a=commit;h=8f4754ede56e3f9ea3fd7207f4a7c4453e59285b
8f4754ede56e3f9ea3fd7207f4a7c4453e59285b
null
void *bdrv_get_attached_dev(BlockDriverState *bs) { return bs->dev; }
void *bdrv_get_attached_dev(BlockDriverState *bs) { return bs->dev; }
C
qemu
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}
bool IsBrowserInitiated(NavigationParams* pending) { return pending && !pending->common_params.url.SchemeIs(url::kJavaScriptScheme); }
bool IsBrowserInitiated(NavigationParams* pending) { return pending && !pending->common_params.url.SchemeIs(url::kJavaScriptScheme); }
C
Chrome
0
CVE-2016-3751
https://www.cvedetails.com/cve/CVE-2016-3751/
null
https://android.googlesource.com/platform/external/libpng/+/9d4853418ab2f754c2b63e091c29c5529b8b86ca
9d4853418ab2f754c2b63e091c29c5529b8b86ca
DO NOT MERGE Update libpng to 1.6.20 BUG:23265085 Change-Id: I85199805636d771f3597b691b63bc0bf46084833 (cherry picked from commit bbe98b40cda082024b669fa508931042eed18f82)
standard_info_part2(standard_display *dp, png_const_structp pp, png_const_infop pi, int nImages) { /* Record cbRow now that it can be found. */ { png_byte ct = png_get_color_type(pp, pi); png_byte bd = png_get_bit_depth(pp, pi); if (bd >= 8 && (ct == PNG_COLOR_TYPE_RGB || ct == PNG_COLOR_TYPE_GRAY) && dp->filler) ct |= 4; /* handle filler as faked alpha channel */ dp->pixel_size = bit_size(pp, ct, bd); } dp->bit_width = png_get_image_width(pp, pi) * dp->pixel_size; dp->cbRow = png_get_rowbytes(pp, pi); /* Validate the rowbytes here again. */ if (dp->cbRow != (dp->bit_width+7)/8) png_error(pp, "bad png_get_rowbytes calculation"); /* Then ensure there is enough space for the output image(s). */ store_ensure_image(dp->ps, pp, nImages, dp->cbRow, dp->h); }
standard_info_part2(standard_display *dp, png_const_structp pp, png_const_infop pi, int nImages) { /* Record cbRow now that it can be found. */ dp->pixel_size = bit_size(pp, png_get_color_type(pp, pi), png_get_bit_depth(pp, pi)); dp->bit_width = png_get_image_width(pp, pi) * dp->pixel_size; dp->cbRow = png_get_rowbytes(pp, pi); /* Validate the rowbytes here again. */ if (dp->cbRow != (dp->bit_width+7)/8) png_error(pp, "bad png_get_rowbytes calculation"); /* Then ensure there is enough space for the output image(s). */ store_ensure_image(dp->ps, pp, nImages, dp->cbRow, dp->h); }
C
Android
1
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 int pagemap_pte_hole(unsigned long start, unsigned long end, struct mm_walk *walk) { struct pagemapread *pm = walk->private; unsigned long addr; int err = 0; for (addr = start; addr < end; addr += PAGE_SIZE) { err = add_to_pagemap(addr, PM_NOT_PRESENT, pm); if (err) break; } return err; }
static int pagemap_pte_hole(unsigned long start, unsigned long end, struct mm_walk *walk) { struct pagemapread *pm = walk->private; unsigned long addr; int err = 0; for (addr = start; addr < end; addr += PAGE_SIZE) { err = add_to_pagemap(addr, PM_NOT_PRESENT, pm); if (err) break; } return err; }
C
linux
0
CVE-2013-6376
https://www.cvedetails.com/cve/CVE-2013-6376/
CWE-189
https://github.com/torvalds/linux/commit/17d68b763f09a9ce824ae23eb62c9efc57b69271
17d68b763f09a9ce824ae23eb62c9efc57b69271
KVM: x86: fix guest-initiated crash with x2apic (CVE-2013-6376) A guest can cause a BUG_ON() leading to a host kernel crash. When the guest writes to the ICR to request an IPI, while in x2apic mode the following things happen, the destination is read from ICR2, which is a register that the guest can control. kvm_irq_delivery_to_apic_fast uses the high 16 bits of ICR2 as the cluster id. A BUG_ON is triggered, which is a protection against accessing map->logical_map with an out-of-bounds access and manages to avoid that anything really unsafe occurs. The logic in the code is correct from real HW point of view. The problem is that KVM supports only one cluster with ID 0 in clustered mode, but the code that has the bug does not take this into account. Reported-by: Lars Bull <[email protected]> Cc: [email protected] Signed-off-by: Gleb Natapov <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
static inline int apic_enabled(struct kvm_lapic *apic) { return kvm_apic_sw_enabled(apic) && kvm_apic_hw_enabled(apic); }
static inline int apic_enabled(struct kvm_lapic *apic) { return kvm_apic_sw_enabled(apic) && kvm_apic_hw_enabled(apic); }
C
linux
0
CVE-2012-2875
https://www.cvedetails.com/cve/CVE-2012-2875/
null
https://github.com/chromium/chromium/commit/d345af9ed62ee5f431be327967f41c3cc3fe936a
d345af9ed62ee5f431be327967f41c3cc3fe936a
[BlackBerry] Adapt to new BlackBerry::Platform::TouchPoint API https://bugs.webkit.org/show_bug.cgi?id=105143 RIM PR 171941 Reviewed by Rob Buis. Internally reviewed by George Staikos. Source/WebCore: TouchPoint instances now provide document coordinates for the viewport and content position of the touch event. The pixel coordinates stored in the TouchPoint should no longer be needed in WebKit. Also adapt to new method names and encapsulation of TouchPoint data members. No change in behavior, no new tests. * platform/blackberry/PlatformTouchPointBlackBerry.cpp: (WebCore::PlatformTouchPoint::PlatformTouchPoint): Source/WebKit/blackberry: TouchPoint instances now provide document coordinates for the viewport and content position of the touch event. The pixel coordinates stored in the TouchPoint should no longer be needed in WebKit. One exception is when passing events to a full screen plugin. Also adapt to new method names and encapsulation of TouchPoint data members. * Api/WebPage.cpp: (BlackBerry::WebKit::WebPage::touchEvent): (BlackBerry::WebKit::WebPage::touchPointAsMouseEvent): (BlackBerry::WebKit::WebPagePrivate::dispatchTouchEventToFullScreenPlugin): (BlackBerry::WebKit::WebPagePrivate::dispatchTouchPointAsMouseEventToFullScreenPlugin): * WebKitSupport/InputHandler.cpp: (BlackBerry::WebKit::InputHandler::shouldRequestSpellCheckingOptionsForPoint): * WebKitSupport/InputHandler.h: (InputHandler): * WebKitSupport/TouchEventHandler.cpp: (BlackBerry::WebKit::TouchEventHandler::doFatFingers): (BlackBerry::WebKit::TouchEventHandler::handleTouchPoint): * WebKitSupport/TouchEventHandler.h: (TouchEventHandler): Tools: Adapt to new method names and encapsulation of TouchPoint data members. * DumpRenderTree/blackberry/EventSender.cpp: (addTouchPointCallback): (updateTouchPointCallback): (touchEndCallback): (releaseTouchPointCallback): (sendTouchEvent): git-svn-id: svn://svn.chromium.org/blink/trunk@137880 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void WebPagePrivate::init(const BlackBerry::Platform::String& pageGroupName) { ChromeClientBlackBerry* chromeClient = new ChromeClientBlackBerry(this); ContextMenuClientBlackBerry* contextMenuClient = 0; #if ENABLE(CONTEXT_MENUS) contextMenuClient = new ContextMenuClientBlackBerry(); #endif EditorClientBlackBerry* editorClient = new EditorClientBlackBerry(this); DragClientBlackBerry* dragClient = 0; #if ENABLE(DRAG_SUPPORT) dragClient = new DragClientBlackBerry(); #endif #if ENABLE(INSPECTOR) m_inspectorClient = new InspectorClientBlackBerry(this); #endif FrameLoaderClientBlackBerry* frameLoaderClient = new FrameLoaderClientBlackBerry(); Page::PageClients pageClients; pageClients.chromeClient = chromeClient; pageClients.contextMenuClient = contextMenuClient; pageClients.editorClient = editorClient; pageClients.dragClient = dragClient; pageClients.inspectorClient = m_inspectorClient; m_page = new Page(pageClients); #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD if (isRunningDrt()) { GeolocationClientMock* mock = new GeolocationClientMock(); WebCore::provideGeolocationTo(m_page, mock); mock->setController(WebCore::GeolocationController::from(m_page)); } else #endif WebCore::provideGeolocationTo(m_page, new GeolocationClientBlackBerry(this)); #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD if (getenv("drtRun")) WebCore::provideDeviceOrientationTo(m_page, new DeviceOrientationClientMock); else #endif WebCore::provideDeviceOrientationTo(m_page, new DeviceOrientationClientBlackBerry(this)); WebCore::provideDeviceMotionTo(m_page, new DeviceMotionClientBlackBerry(this)); #if ENABLE(VIBRATION) WebCore::provideVibrationTo(m_page, new VibrationClientBlackBerry()); #endif #if ENABLE(BATTERY_STATUS) WebCore::provideBatteryTo(m_page, new WebCore::BatteryClientBlackBerry(this)); #endif #if ENABLE(MEDIA_STREAM) WebCore::provideUserMediaTo(m_page, new UserMediaClientImpl(m_webPage)); #endif #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) WebCore::provideNotification(m_page, new NotificationClientBlackBerry(this)); #endif #if ENABLE(NAVIGATOR_CONTENT_UTILS) WebCore::provideNavigatorContentUtilsTo(m_page, new NavigatorContentUtilsClientBlackBerry(this)); #endif #if ENABLE(NETWORK_INFO) WebCore::provideNetworkInfoTo(m_page, new WebCore::NetworkInfoClientBlackBerry(this)); #endif m_webSettings = WebSettings::createFromStandardSettings(); m_webSettings->setUserAgentString(defaultUserAgent()); m_page->setDeviceScaleFactor(m_webSettings->devicePixelRatio()); m_page->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout); #if USE(ACCELERATED_COMPOSITING) m_tapHighlight = DefaultTapHighlight::create(this); m_selectionOverlay = SelectionOverlay::create(this); m_page->settings()->setAcceleratedCompositingForFixedPositionEnabled(true); #endif m_webSettings->setPageGroupName(pageGroupName); m_webSettings->setDelegate(this); didChangeSettings(m_webSettings); RefPtr<Frame> newFrame = Frame::create(m_page, /* HTMLFrameOwnerElement* */ 0, frameLoaderClient); m_mainFrame = newFrame.get(); frameLoaderClient->setFrame(m_mainFrame, this); m_mainFrame->init(); m_inRegionScroller = adoptPtr(new InRegionScroller(this)); #if ENABLE(WEBGL) m_page->settings()->setWebGLEnabled(true); #endif #if ENABLE(ACCELERATED_2D_CANVAS) m_page->settings()->setCanvasUsesAcceleratedDrawing(true); m_page->settings()->setAccelerated2dCanvasEnabled(true); #endif m_page->settings()->setInteractiveFormValidationEnabled(true); m_page->settings()->setAllowUniversalAccessFromFileURLs(false); m_page->settings()->setAllowFileAccessFromFileURLs(false); m_page->settings()->setFixedPositionCreatesStackingContext(true); m_backingStoreClient = BackingStoreClient::create(m_mainFrame, /* parent frame */ 0, m_webPage); m_backingStore = m_backingStoreClient->backingStore(); m_webkitThreadViewportAccessor = new WebKitThreadViewportAccessor(this); blockClickRadius = int(roundf(0.35 * Platform::Graphics::Screen::primaryScreen()->pixelsPerInch(0).width())); // The clicked rectangle area should be a fixed unit of measurement. m_page->settings()->setDelegateSelectionPaint(true); #if ENABLE(REQUEST_ANIMATION_FRAME) m_page->windowScreenDidChange((PlatformDisplayID)0); #endif #if ENABLE(WEB_TIMING) m_page->settings()->setMemoryInfoEnabled(true); #endif #if USE(ACCELERATED_COMPOSITING) Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage( createMethodCallMessage(&WebPagePrivate::createCompositor, this)); #endif }
void WebPagePrivate::init(const BlackBerry::Platform::String& pageGroupName) { ChromeClientBlackBerry* chromeClient = new ChromeClientBlackBerry(this); ContextMenuClientBlackBerry* contextMenuClient = 0; #if ENABLE(CONTEXT_MENUS) contextMenuClient = new ContextMenuClientBlackBerry(); #endif EditorClientBlackBerry* editorClient = new EditorClientBlackBerry(this); DragClientBlackBerry* dragClient = 0; #if ENABLE(DRAG_SUPPORT) dragClient = new DragClientBlackBerry(); #endif #if ENABLE(INSPECTOR) m_inspectorClient = new InspectorClientBlackBerry(this); #endif FrameLoaderClientBlackBerry* frameLoaderClient = new FrameLoaderClientBlackBerry(); Page::PageClients pageClients; pageClients.chromeClient = chromeClient; pageClients.contextMenuClient = contextMenuClient; pageClients.editorClient = editorClient; pageClients.dragClient = dragClient; pageClients.inspectorClient = m_inspectorClient; m_page = new Page(pageClients); #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD if (isRunningDrt()) { GeolocationClientMock* mock = new GeolocationClientMock(); WebCore::provideGeolocationTo(m_page, mock); mock->setController(WebCore::GeolocationController::from(m_page)); } else #endif WebCore::provideGeolocationTo(m_page, new GeolocationClientBlackBerry(this)); #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD if (getenv("drtRun")) WebCore::provideDeviceOrientationTo(m_page, new DeviceOrientationClientMock); else #endif WebCore::provideDeviceOrientationTo(m_page, new DeviceOrientationClientBlackBerry(this)); WebCore::provideDeviceMotionTo(m_page, new DeviceMotionClientBlackBerry(this)); #if ENABLE(VIBRATION) WebCore::provideVibrationTo(m_page, new VibrationClientBlackBerry()); #endif #if ENABLE(BATTERY_STATUS) WebCore::provideBatteryTo(m_page, new WebCore::BatteryClientBlackBerry(this)); #endif #if ENABLE(MEDIA_STREAM) WebCore::provideUserMediaTo(m_page, new UserMediaClientImpl(m_webPage)); #endif #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) WebCore::provideNotification(m_page, new NotificationClientBlackBerry(this)); #endif #if ENABLE(NAVIGATOR_CONTENT_UTILS) WebCore::provideNavigatorContentUtilsTo(m_page, new NavigatorContentUtilsClientBlackBerry(this)); #endif #if ENABLE(NETWORK_INFO) WebCore::provideNetworkInfoTo(m_page, new WebCore::NetworkInfoClientBlackBerry(this)); #endif m_webSettings = WebSettings::createFromStandardSettings(); m_webSettings->setUserAgentString(defaultUserAgent()); m_page->setDeviceScaleFactor(m_webSettings->devicePixelRatio()); m_page->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout); #if USE(ACCELERATED_COMPOSITING) m_tapHighlight = DefaultTapHighlight::create(this); m_selectionOverlay = SelectionOverlay::create(this); m_page->settings()->setAcceleratedCompositingForFixedPositionEnabled(true); #endif m_webSettings->setPageGroupName(pageGroupName); m_webSettings->setDelegate(this); didChangeSettings(m_webSettings); RefPtr<Frame> newFrame = Frame::create(m_page, /* HTMLFrameOwnerElement* */ 0, frameLoaderClient); m_mainFrame = newFrame.get(); frameLoaderClient->setFrame(m_mainFrame, this); m_mainFrame->init(); m_inRegionScroller = adoptPtr(new InRegionScroller(this)); #if ENABLE(WEBGL) m_page->settings()->setWebGLEnabled(true); #endif #if ENABLE(ACCELERATED_2D_CANVAS) m_page->settings()->setCanvasUsesAcceleratedDrawing(true); m_page->settings()->setAccelerated2dCanvasEnabled(true); #endif m_page->settings()->setInteractiveFormValidationEnabled(true); m_page->settings()->setAllowUniversalAccessFromFileURLs(false); m_page->settings()->setAllowFileAccessFromFileURLs(false); m_page->settings()->setFixedPositionCreatesStackingContext(true); m_backingStoreClient = BackingStoreClient::create(m_mainFrame, /* parent frame */ 0, m_webPage); m_backingStore = m_backingStoreClient->backingStore(); m_webkitThreadViewportAccessor = new WebKitThreadViewportAccessor(this); blockClickRadius = int(roundf(0.35 * Platform::Graphics::Screen::primaryScreen()->pixelsPerInch(0).width())); // The clicked rectangle area should be a fixed unit of measurement. m_page->settings()->setDelegateSelectionPaint(true); #if ENABLE(REQUEST_ANIMATION_FRAME) m_page->windowScreenDidChange((PlatformDisplayID)0); #endif #if ENABLE(WEB_TIMING) m_page->settings()->setMemoryInfoEnabled(true); #endif #if USE(ACCELERATED_COMPOSITING) Platform::userInterfaceThreadMessageClient()->dispatchSyncMessage( createMethodCallMessage(&WebPagePrivate::createCompositor, this)); #endif }
C
Chrome
0
CVE-2014-9663
https://www.cvedetails.com/cve/CVE-2014-9663/
CWE-119
https://git.savannah.gnu.org/cgit/freetype/freetype2.git/commit/?id=9bd20b7304aae61de5d50ac359cf27132bafd4c1
9bd20b7304aae61de5d50ac359cf27132bafd4c1
null
tt_cmap10_validate( FT_Byte* table, FT_Validator valid ) { FT_Byte* p = table + 4; FT_ULong length, count; if ( table + 20 > valid->limit ) FT_INVALID_TOO_SHORT; length = TT_NEXT_ULONG( p ); p = table + 16; count = TT_NEXT_ULONG( p ); if ( length > (FT_ULong)( valid->limit - table ) || /* length < 20 + count * 2 ? */ length < 20 || ( length - 20 ) / 2 < count ) FT_INVALID_TOO_SHORT; /* check glyph indices */ if ( valid->level >= FT_VALIDATE_TIGHT ) { FT_UInt gindex; for ( ; count > 0; count-- ) { gindex = TT_NEXT_USHORT( p ); if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) ) FT_INVALID_GLYPH_ID; } } return FT_Err_Ok; }
tt_cmap10_validate( FT_Byte* table, FT_Validator valid ) { FT_Byte* p = table + 4; FT_ULong length, count; if ( table + 20 > valid->limit ) FT_INVALID_TOO_SHORT; length = TT_NEXT_ULONG( p ); p = table + 16; count = TT_NEXT_ULONG( p ); if ( length > (FT_ULong)( valid->limit - table ) || /* length < 20 + count * 2 ? */ length < 20 || ( length - 20 ) / 2 < count ) FT_INVALID_TOO_SHORT; /* check glyph indices */ if ( valid->level >= FT_VALIDATE_TIGHT ) { FT_UInt gindex; for ( ; count > 0; count-- ) { gindex = TT_NEXT_USHORT( p ); if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) ) FT_INVALID_GLYPH_ID; } } return FT_Err_Ok; }
C
savannah
0
CVE-2018-1116
https://www.cvedetails.com/cve/CVE-2018-1116/
CWE-200
https://cgit.freedesktop.org/polkit/commit/?id=bc7ffad5364
bc7ffad53643a9c80231fc41f5582d6a8931c32c
null
polkit_backend_interactive_authority_check_authorization (PolkitBackendAuthority *authority, PolkitSubject *caller, PolkitSubject *subject, const gchar *action_id, PolkitDetails *details, PolkitCheckAuthorizationFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { PolkitBackendInteractiveAuthority *interactive_authority; PolkitBackendInteractiveAuthorityPrivate *priv; gchar *caller_str; gchar *subject_str; PolkitIdentity *user_of_caller; PolkitIdentity *user_of_subject; gboolean user_of_subject_matches; gchar *user_of_caller_str; gchar *user_of_subject_str; PolkitAuthorizationResult *result; GError *error; GSimpleAsyncResult *simple; gboolean has_details; gchar **detail_keys; interactive_authority = POLKIT_BACKEND_INTERACTIVE_AUTHORITY (authority); priv = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_GET_PRIVATE (interactive_authority); error = NULL; caller_str = NULL; subject_str = NULL; user_of_caller = NULL; user_of_subject = NULL; user_of_caller_str = NULL; user_of_subject_str = NULL; result = NULL; simple = g_simple_async_result_new (G_OBJECT (authority), callback, user_data, polkit_backend_interactive_authority_check_authorization); /* handle being called from ourselves */ if (caller == NULL) { /* TODO: this is kind of a hack */ GDBusConnection *system_bus; system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); caller = polkit_system_bus_name_new (g_dbus_connection_get_unique_name (system_bus)); g_object_unref (system_bus); } caller_str = polkit_subject_to_string (caller); subject_str = polkit_subject_to_string (subject); g_debug ("%s is inquiring whether %s is authorized for %s", caller_str, subject_str, action_id); action_id); user_of_caller = polkit_backend_session_monitor_get_user_for_subject (priv->session_monitor, caller, NULL, &error); if (error != NULL) { g_simple_async_result_complete (simple); g_object_unref (simple); g_error_free (error); goto out; } user_of_caller_str = polkit_identity_to_string (user_of_caller); g_debug (" user of caller is %s", user_of_caller_str); g_debug (" user of caller is %s", user_of_caller_str); user_of_subject = polkit_backend_session_monitor_get_user_for_subject (priv->session_monitor, subject, &user_of_subject_matches, &error); if (error != NULL) { g_simple_async_result_complete (simple); g_object_unref (simple); g_error_free (error); goto out; } user_of_subject_str = polkit_identity_to_string (user_of_subject); g_debug (" user of subject is %s", user_of_subject_str); has_details = FALSE; if (details != NULL) { detail_keys = polkit_details_get_keys (details); if (detail_keys != NULL) { if (g_strv_length (detail_keys) > 0) has_details = TRUE; g_strfreev (detail_keys); } } /* Not anyone is allowed to check that process XYZ is allowed to do ABC. * We only allow this if, and only if, * We only allow this if, and only if, * * - processes may check for another process owned by the *same* user but not * if details are passed (otherwise you'd be able to spoof the dialog); * the caller supplies the user_of_subject value, so we additionally * require it to match at least at one point in time (via * user_of_subject_matches). * * - processes running as uid 0 may check anything and pass any details * if (!polkit_identity_equal (user_of_caller, user_of_subject) || has_details) * then any uid referenced by that annotation is also allowed to check * to check anything and pass any details */ if (!user_of_subject_matches || !polkit_identity_equal (user_of_caller, user_of_subject) || has_details) { if (!may_identity_check_authorization (interactive_authority, action_id, user_of_caller)) { "pass details"); } else { g_simple_async_result_set_error (simple, POLKIT_ERROR, POLKIT_ERROR_NOT_AUTHORIZED, "Only trusted callers (e.g. uid 0 or an action owner) can use CheckAuthorization() for " "subjects belonging to other identities"); } g_simple_async_result_complete (simple); g_object_unref (simple); goto out; } }
polkit_backend_interactive_authority_check_authorization (PolkitBackendAuthority *authority, PolkitSubject *caller, PolkitSubject *subject, const gchar *action_id, PolkitDetails *details, PolkitCheckAuthorizationFlags flags, GCancellable *cancellable, GAsyncReadyCallback callback, gpointer user_data) { PolkitBackendInteractiveAuthority *interactive_authority; PolkitBackendInteractiveAuthorityPrivate *priv; gchar *caller_str; gchar *subject_str; PolkitIdentity *user_of_caller; PolkitIdentity *user_of_subject; gchar *user_of_caller_str; gchar *user_of_subject_str; PolkitAuthorizationResult *result; GError *error; GSimpleAsyncResult *simple; gboolean has_details; gchar **detail_keys; interactive_authority = POLKIT_BACKEND_INTERACTIVE_AUTHORITY (authority); priv = POLKIT_BACKEND_INTERACTIVE_AUTHORITY_GET_PRIVATE (interactive_authority); error = NULL; caller_str = NULL; subject_str = NULL; user_of_caller = NULL; user_of_subject = NULL; user_of_caller_str = NULL; user_of_subject_str = NULL; result = NULL; simple = g_simple_async_result_new (G_OBJECT (authority), callback, user_data, polkit_backend_interactive_authority_check_authorization); /* handle being called from ourselves */ if (caller == NULL) { /* TODO: this is kind of a hack */ GDBusConnection *system_bus; system_bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, NULL); caller = polkit_system_bus_name_new (g_dbus_connection_get_unique_name (system_bus)); g_object_unref (system_bus); } caller_str = polkit_subject_to_string (caller); subject_str = polkit_subject_to_string (subject); g_debug ("%s is inquiring whether %s is authorized for %s", caller_str, subject_str, action_id); action_id); user_of_caller = polkit_backend_session_monitor_get_user_for_subject (priv->session_monitor, caller, &error); if (error != NULL) { g_simple_async_result_complete (simple); g_object_unref (simple); g_error_free (error); goto out; } user_of_caller_str = polkit_identity_to_string (user_of_caller); g_debug (" user of caller is %s", user_of_caller_str); g_debug (" user of caller is %s", user_of_caller_str); user_of_subject = polkit_backend_session_monitor_get_user_for_subject (priv->session_monitor, subject, &error); if (error != NULL) { g_simple_async_result_complete (simple); g_object_unref (simple); g_error_free (error); goto out; } user_of_subject_str = polkit_identity_to_string (user_of_subject); g_debug (" user of subject is %s", user_of_subject_str); has_details = FALSE; if (details != NULL) { detail_keys = polkit_details_get_keys (details); if (detail_keys != NULL) { if (g_strv_length (detail_keys) > 0) has_details = TRUE; g_strfreev (detail_keys); } } /* Not anyone is allowed to check that process XYZ is allowed to do ABC. * We only allow this if, and only if, * We only allow this if, and only if, * * - processes may check for another process owned by the *same* user but not * if details are passed (otherwise you'd be able to spoof the dialog) * * - processes running as uid 0 may check anything and pass any details * if (!polkit_identity_equal (user_of_caller, user_of_subject) || has_details) * then any uid referenced by that annotation is also allowed to check * to check anything and pass any details */ if (!polkit_identity_equal (user_of_caller, user_of_subject) || has_details) { if (!may_identity_check_authorization (interactive_authority, action_id, user_of_caller)) { "pass details"); } else { g_simple_async_result_set_error (simple, POLKIT_ERROR, POLKIT_ERROR_NOT_AUTHORIZED, "Only trusted callers (e.g. uid 0 or an action owner) can use CheckAuthorization() for " "subjects belonging to other identities"); } g_simple_async_result_complete (simple); g_object_unref (simple); goto out; } }
C
polkit
1
CVE-2013-2853
https://www.cvedetails.com/cve/CVE-2013-2853/
null
https://github.com/chromium/chromium/commit/9c18dbcb79e5f700c453d1ac01fb6d8768e4844a
9c18dbcb79e5f700c453d1ac01fb6d8768e4844a
net: don't process truncated headers on HTTPS connections. This change causes us to not process any headers unless they are correctly terminated with a \r\n\r\n sequence. BUG=244260 Review URL: https://chromiumcodereview.appspot.com/15688012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202927 0039d316-1c4b-4281-b951-d872f2087c98
HttpResponseInfo* HttpStreamParser::GetResponseInfo() { return response_; }
HttpResponseInfo* HttpStreamParser::GetResponseInfo() { return response_; }
C
Chrome
0
CVE-2013-4591
https://www.cvedetails.com/cve/CVE-2013-4591/
CWE-119
https://github.com/torvalds/linux/commit/7d3e91a89b7adbc2831334def9e494dd9892f9af
7d3e91a89b7adbc2831334def9e494dd9892f9af
NFSv4: Check for buffer length in __nfs4_get_acl_uncached Commit 1f1ea6c "NFSv4: Fix buffer overflow checking in __nfs4_get_acl_uncached" accidently dropped the checking for too small result buffer length. If someone uses getxattr on "system.nfs4_acl" on an NFSv4 mount supporting ACLs, the ACL has not been cached and the buffer suplied is too short, we still copy the complete ACL, resulting in kernel and user space memory corruption. Signed-off-by: Sven Wegener <[email protected]> Cc: [email protected] Signed-off-by: Trond Myklebust <[email protected]>
static int nfs41_check_session_ready(struct nfs_client *clp) { int ret; if (clp->cl_cons_state == NFS_CS_SESSION_INITING) { ret = nfs4_client_recover_expired_lease(clp); if (ret) return ret; } if (clp->cl_cons_state < NFS_CS_READY) return -EPROTONOSUPPORT; smp_rmb(); return 0; }
static int nfs41_check_session_ready(struct nfs_client *clp) { int ret; if (clp->cl_cons_state == NFS_CS_SESSION_INITING) { ret = nfs4_client_recover_expired_lease(clp); if (ret) return ret; } if (clp->cl_cons_state < NFS_CS_READY) return -EPROTONOSUPPORT; smp_rmb(); return 0; }
C
linux
0
CVE-2016-10165
https://www.cvedetails.com/cve/CVE-2016-10165/
CWE-125
https://github.com/mm2/Little-CMS/commit/5ca71a7bc18b6897ab21d815d15e218e204581e2
5ca71a7bc18b6897ab21d815d15e218e204581e2
Added an extra check to MLU bounds Thanks to Ibrahim el-sayed for spotting the bug
void* Type_MPE_Dup(struct _cms_typehandler_struct* self, const void *Ptr, cmsUInt32Number n) { return (void*) cmsPipelineDup((cmsPipeline*) Ptr); cmsUNUSED_PARAMETER(n); cmsUNUSED_PARAMETER(self); }
void* Type_MPE_Dup(struct _cms_typehandler_struct* self, const void *Ptr, cmsUInt32Number n) { return (void*) cmsPipelineDup((cmsPipeline*) Ptr); cmsUNUSED_PARAMETER(n); cmsUNUSED_PARAMETER(self); }
C
Little-CMS
0