CVE ID
stringlengths
13
43
CVE Page
stringlengths
45
48
CWE ID
stringclasses
90 values
codeLink
stringlengths
46
139
commit_id
stringlengths
6
81
commit_message
stringlengths
3
13.3k
func_after
stringlengths
14
241k
func_before
stringlengths
14
241k
lang
stringclasses
3 values
project
stringclasses
309 values
vul
int8
0
1
CVE-2013-0920
https://www.cvedetails.com/cve/CVE-2013-0920/
CWE-399
https://github.com/chromium/chromium/commit/12baa2097220e33c12b60aa5e6da6701637761bf
12baa2097220e33c12b60aa5e6da6701637761bf
Fix heap-use-after-free in BookmarksIOFunction::ShowSelectFileDialog. BUG=177410 Review URL: https://chromiumcodereview.appspot.com/12326086 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184586 0039d316-1c4b-4281-b951-d872f2087c98
void BookmarksAPI::Shutdown() { ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); }
void BookmarksAPI::Shutdown() { ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); }
C
Chrome
0
CVE-2016-6720
https://www.cvedetails.com/cve/CVE-2016-6720/
CWE-200
https://android.googlesource.com/platform/frameworks/av/+/2c75e1c3b98e4e94f50c63e2b7694be5f948477c
2c75e1c3b98e4e94f50c63e2b7694be5f948477c
IOMX: do not convert ANWB to gralloc source in emptyBuffer Bug: 29422020 Bug: 31412859 Change-Id: If48e3e0b6f1af99a459fdc3f6f03744bbf0dc375 (cherry picked from commit 534bb6132a6a664f90b42b3ef81298b42efb3dc2)
status_t OMXNodeInstance::useBuffer( OMX_U32 portIndex, const sp<IMemory> &params, OMX::buffer_id *buffer, OMX_U32 allottedSize) { if (params == NULL || buffer == NULL) { ALOGE("b/25884056"); return BAD_VALUE; } Mutex::Autolock autoLock(mLock); if (allottedSize > params->size() || portIndex >= NELEM(mNumPortBuffers)) { return BAD_VALUE; } BufferMeta *buffer_meta; bool useBackup = mMetadataType[portIndex] != kMetadataBufferTypeInvalid; OMX_U8 *data = static_cast<OMX_U8 *>(params->pointer()); if (useBackup) { data = new (std::nothrow) OMX_U8[allottedSize]; if (data == NULL) { return NO_MEMORY; } memset(data, 0, allottedSize); if (allottedSize != params->size()) { CLOG_ERROR(useBuffer, BAD_VALUE, SIMPLE_BUFFER(portIndex, (size_t)allottedSize, data)); delete[] data; return BAD_VALUE; } buffer_meta = new BufferMeta( params, portIndex, false /* copyToOmx */, false /* copyFromOmx */, data); } else { buffer_meta = new BufferMeta( params, portIndex, false /* copyToOmx */, false /* copyFromOmx */, NULL); } OMX_BUFFERHEADERTYPE *header; OMX_ERRORTYPE err = OMX_UseBuffer( mHandle, &header, portIndex, buffer_meta, allottedSize, data); if (err != OMX_ErrorNone) { CLOG_ERROR(useBuffer, err, SIMPLE_BUFFER( portIndex, (size_t)allottedSize, data)); delete buffer_meta; buffer_meta = NULL; *buffer = 0; return StatusFromOMXError(err); } CHECK_EQ(header->pAppPrivate, buffer_meta); *buffer = makeBufferID(header); addActiveBuffer(portIndex, *buffer); sp<GraphicBufferSource> bufferSource(getGraphicBufferSource()); if (bufferSource != NULL && portIndex == kPortIndexInput) { bufferSource->addCodecBuffer(header); } CLOG_BUFFER(useBuffer, NEW_BUFFER_FMT( *buffer, portIndex, "%u(%zu)@%p", allottedSize, params->size(), params->pointer())); return OK; }
status_t OMXNodeInstance::useBuffer( OMX_U32 portIndex, const sp<IMemory> &params, OMX::buffer_id *buffer, OMX_U32 allottedSize) { if (params == NULL || buffer == NULL) { ALOGE("b/25884056"); return BAD_VALUE; } Mutex::Autolock autoLock(mLock); if (allottedSize > params->size() || portIndex >= NELEM(mNumPortBuffers)) { return BAD_VALUE; } BufferMeta *buffer_meta; bool useBackup = mMetadataType[portIndex] != kMetadataBufferTypeInvalid; OMX_U8 *data = static_cast<OMX_U8 *>(params->pointer()); if (useBackup) { data = new (std::nothrow) OMX_U8[allottedSize]; if (data == NULL) { return NO_MEMORY; } memset(data, 0, allottedSize); if (allottedSize != params->size()) { CLOG_ERROR(useBuffer, BAD_VALUE, SIMPLE_BUFFER(portIndex, (size_t)allottedSize, data)); delete[] data; return BAD_VALUE; } buffer_meta = new BufferMeta( params, portIndex, false /* copyToOmx */, false /* copyFromOmx */, data); } else { buffer_meta = new BufferMeta( params, portIndex, false /* copyFromOmx */, false /* copyToOmx */, NULL); } OMX_BUFFERHEADERTYPE *header; OMX_ERRORTYPE err = OMX_UseBuffer( mHandle, &header, portIndex, buffer_meta, allottedSize, data); if (err != OMX_ErrorNone) { CLOG_ERROR(useBuffer, err, SIMPLE_BUFFER( portIndex, (size_t)allottedSize, data)); delete buffer_meta; buffer_meta = NULL; *buffer = 0; return StatusFromOMXError(err); } CHECK_EQ(header->pAppPrivate, buffer_meta); *buffer = makeBufferID(header); addActiveBuffer(portIndex, *buffer); sp<GraphicBufferSource> bufferSource(getGraphicBufferSource()); if (bufferSource != NULL && portIndex == kPortIndexInput) { bufferSource->addCodecBuffer(header); } CLOG_BUFFER(useBuffer, NEW_BUFFER_FMT( *buffer, portIndex, "%u(%zu)@%p", allottedSize, params->size(), params->pointer())); return OK; }
C
Android
1
CVE-2017-18218
https://www.cvedetails.com/cve/CVE-2017-18218/
CWE-416
https://github.com/torvalds/linux/commit/27463ad99f738ed93c7c8b3e2e5bc8c4853a2ff2
27463ad99f738ed93c7c8b3e2e5bc8c4853a2ff2
net: hns: Fix a skb used after free bug skb maybe freed in hns_nic_net_xmit_hw() and return NETDEV_TX_OK, which cause hns_nic_net_xmit to use a freed skb. BUG: KASAN: use-after-free in hns_nic_net_xmit_hw+0x62c/0x940... [17659.112635] alloc_debug_processing+0x18c/0x1a0 [17659.117208] __slab_alloc+0x52c/0x560 [17659.120909] kmem_cache_alloc_node+0xac/0x2c0 [17659.125309] __alloc_skb+0x6c/0x260 [17659.128837] tcp_send_ack+0x8c/0x280 [17659.132449] __tcp_ack_snd_check+0x9c/0xf0 [17659.136587] tcp_rcv_established+0x5a4/0xa70 [17659.140899] tcp_v4_do_rcv+0x27c/0x620 [17659.144687] tcp_prequeue_process+0x108/0x170 [17659.149085] tcp_recvmsg+0x940/0x1020 [17659.152787] inet_recvmsg+0x124/0x180 [17659.156488] sock_recvmsg+0x64/0x80 [17659.160012] SyS_recvfrom+0xd8/0x180 [17659.163626] __sys_trace_return+0x0/0x4 [17659.167506] INFO: Freed in kfree_skbmem+0xa0/0xb0 age=23 cpu=1 pid=13 [17659.174000] free_debug_processing+0x1d4/0x2c0 [17659.178486] __slab_free+0x240/0x390 [17659.182100] kmem_cache_free+0x24c/0x270 [17659.186062] kfree_skbmem+0xa0/0xb0 [17659.189587] __kfree_skb+0x28/0x40 [17659.193025] napi_gro_receive+0x168/0x1c0 [17659.197074] hns_nic_rx_up_pro+0x58/0x90 [17659.201038] hns_nic_rx_poll_one+0x518/0xbc0 [17659.205352] hns_nic_common_poll+0x94/0x140 [17659.209576] net_rx_action+0x458/0x5e0 [17659.213363] __do_softirq+0x1b8/0x480 [17659.217062] run_ksoftirqd+0x64/0x80 [17659.220679] smpboot_thread_fn+0x224/0x310 [17659.224821] kthread+0x150/0x170 [17659.228084] ret_from_fork+0x10/0x40 BUG: KASAN: use-after-free in hns_nic_net_xmit+0x8c/0xc0... [17751.080490] __slab_alloc+0x52c/0x560 [17751.084188] kmem_cache_alloc+0x244/0x280 [17751.088238] __build_skb+0x40/0x150 [17751.091764] build_skb+0x28/0x100 [17751.095115] __alloc_rx_skb+0x94/0x150 [17751.098900] __napi_alloc_skb+0x34/0x90 [17751.102776] hns_nic_rx_poll_one+0x180/0xbc0 [17751.107097] hns_nic_common_poll+0x94/0x140 [17751.111333] net_rx_action+0x458/0x5e0 [17751.115123] __do_softirq+0x1b8/0x480 [17751.118823] run_ksoftirqd+0x64/0x80 [17751.122437] smpboot_thread_fn+0x224/0x310 [17751.126575] kthread+0x150/0x170 [17751.129838] ret_from_fork+0x10/0x40 [17751.133454] INFO: Freed in kfree_skbmem+0xa0/0xb0 age=19 cpu=7 pid=43 [17751.139951] free_debug_processing+0x1d4/0x2c0 [17751.144436] __slab_free+0x240/0x390 [17751.148051] kmem_cache_free+0x24c/0x270 [17751.152014] kfree_skbmem+0xa0/0xb0 [17751.155543] __kfree_skb+0x28/0x40 [17751.159022] napi_gro_receive+0x168/0x1c0 [17751.163074] hns_nic_rx_up_pro+0x58/0x90 [17751.167041] hns_nic_rx_poll_one+0x518/0xbc0 [17751.171358] hns_nic_common_poll+0x94/0x140 [17751.175585] net_rx_action+0x458/0x5e0 [17751.179373] __do_softirq+0x1b8/0x480 [17751.183076] run_ksoftirqd+0x64/0x80 [17751.186691] smpboot_thread_fn+0x224/0x310 [17751.190826] kthread+0x150/0x170 [17751.194093] ret_from_fork+0x10/0x40 Fixes: 13ac695e7ea1 ("net:hns: Add support of Hip06 SoC to the Hislicon Network Subsystem") Signed-off-by: Yunsheng Lin <[email protected]> Signed-off-by: lipeng <[email protected]> Reported-by: Jun He <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static netdev_features_t hns_nic_fix_features( struct net_device *netdev, netdev_features_t features) { struct hns_nic_priv *priv = netdev_priv(netdev); switch (priv->enet_ver) { case AE_VERSION_1: features &= ~(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_FILTER); break; default: break; } return features; }
static netdev_features_t hns_nic_fix_features( struct net_device *netdev, netdev_features_t features) { struct hns_nic_priv *priv = netdev_priv(netdev); switch (priv->enet_ver) { case AE_VERSION_1: features &= ~(NETIF_F_TSO | NETIF_F_TSO6 | NETIF_F_HW_VLAN_CTAG_FILTER); break; default: break; } return features; }
C
linux
0
CVE-2015-6790
https://www.cvedetails.com/cve/CVE-2015-6790/
CWE-20
https://github.com/chromium/chromium/commit/b770d85e37b2d0e248f04cf20606a2f3871ef039
b770d85e37b2d0e248f04cf20606a2f3871ef039
Make WebPageSerializerImpl to escape URL attribute values in result. This patch makes |WebPageSerializerImpl| to escape URL attribute values rather than directly output URL attribute values into result. BUG=542054 TEST=webkit_unit_tests --gtest_filter=WebPageSerializerTest.URLAttributeValues Review URL: https://codereview.chromium.org/1398453005 Cr-Commit-Position: refs/heads/master@{#353712}
void WebPageSerializerImpl::endTagToString(Element* element, SerializeDomParam* param) { bool needSkip; StringBuilder result; result.append(preActionBeforeSerializeEndTag(element, param, &needSkip)); if (needSkip) return; if (element->hasChildren() || param->haveAddedContentsBeforeEnd) { result.appendLiteral("</"); result.append(element->nodeName().lower()); result.append('>'); } else { if (param->isHTMLDocument) { result.append('>'); if (!element->isHTMLElement() || !toHTMLElement(element)->ieForbidsInsertHTML()) { result.appendLiteral("</"); result.append(element->nodeName().lower()); result.append('>'); } } else { result.appendLiteral(" />"); } } result.append(postActionAfterSerializeEndTag(element, param)); saveHTMLContentToBuffer(result.toString(), param); }
void WebPageSerializerImpl::endTagToString(Element* element, SerializeDomParam* param) { bool needSkip; StringBuilder result; result.append(preActionBeforeSerializeEndTag(element, param, &needSkip)); if (needSkip) return; if (element->hasChildren() || param->haveAddedContentsBeforeEnd) { result.appendLiteral("</"); result.append(element->nodeName().lower()); result.append('>'); } else { if (param->isHTMLDocument) { result.append('>'); if (!element->isHTMLElement() || !toHTMLElement(element)->ieForbidsInsertHTML()) { result.appendLiteral("</"); result.append(element->nodeName().lower()); result.append('>'); } } else { result.appendLiteral(" />"); } } result.append(postActionAfterSerializeEndTag(element, param)); saveHTMLContentToBuffer(result.toString(), param); }
C
Chrome
0
CVE-2014-9904
https://www.cvedetails.com/cve/CVE-2014-9904/
null
https://github.com/torvalds/linux/commit/6217e5ede23285ddfee10d2e4ba0cc2d4c046205
6217e5ede23285ddfee10d2e4ba0cc2d4c046205
ALSA: compress: fix an integer overflow check I previously added an integer overflow check here but looking at it now, it's still buggy. The bug happens in snd_compr_allocate_buffer(). We multiply ".fragments" and ".fragment_size" and that doesn't overflow but then we save it in an unsigned int so it truncates the high bits away and we allocate a smaller than expected size. Fixes: b35cc8225845 ('ALSA: compress_core: integer overflow in snd_compr_allocate_buffer()') Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
static int snd_compress_check_input(struct snd_compr_params *params) { /* first let's check the buffer parameter's */ if (params->buffer.fragment_size == 0 || params->buffer.fragments > INT_MAX / params->buffer.fragment_size) return -EINVAL; /* now codec parameters */ if (params->codec.id == 0 || params->codec.id > SND_AUDIOCODEC_MAX) return -EINVAL; if (params->codec.ch_in == 0 || params->codec.ch_out == 0) return -EINVAL; return 0; }
static int snd_compress_check_input(struct snd_compr_params *params) { /* first let's check the buffer parameter's */ if (params->buffer.fragment_size == 0 || params->buffer.fragments > SIZE_MAX / params->buffer.fragment_size) return -EINVAL; /* now codec parameters */ if (params->codec.id == 0 || params->codec.id > SND_AUDIOCODEC_MAX) return -EINVAL; if (params->codec.ch_in == 0 || params->codec.ch_out == 0) return -EINVAL; return 0; }
C
linux
1
CVE-2017-5940
https://www.cvedetails.com/cve/CVE-2017-5940/
CWE-269
https://github.com/netblue30/firejail/commit/38d418505e9ee2d326557e5639e8da49c298858f
38d418505e9ee2d326557e5639e8da49c298858f
security fix
static char *check_dir_or_file(const char *name) { assert(name); struct stat s; invalid_filename(name); if (arg_debug) printf("Private home: checking %s\n", name); char *fname = expand_home(name, cfg.homedir); if (!fname) { fprintf(stderr, "Error: file %s not found.\n", name); exit(1); } if (fname[0] != '/') { char* tmp; if (asprintf(&tmp, "%s/%s", cfg.homedir, fname) == -1) errExit("asprintf"); free(fname); fname = tmp; } char *rname = realpath(fname, NULL); if (!rname) { fprintf(stderr, "Error: invalid file %s\n", name); exit(1); } if (strncmp(rname, cfg.homedir, strlen(cfg.homedir)) != 0) { fprintf(stderr, "Error: file %s is not in user home directory\n", name); exit(1); } if (strcmp(rname, cfg.homedir) == 0) { fprintf(stderr, "Error: invalid directory %s\n", rname); exit(1); } char *ptr = rname + strlen(cfg.homedir); if (*ptr == '\0') { fprintf(stderr, "Error: invalid file %s\n", name); exit(1); } ptr++; ptr = strchr(ptr, '/'); if (ptr) { if (*ptr != '\0') { fprintf(stderr, "Error: only top files and directories in user home are allowed\n"); exit(1); } } if (stat(fname, &s) == -1) { fprintf(stderr, "Error: file %s not found.\n", fname); exit(1); } uid_t uid = getuid(); gid_t gid = getgid(); if (s.st_uid != uid || s.st_gid != gid) { fprintf(stderr, "Error: only files or directories created by the current user are allowed.\n"); exit(1); } if (S_ISDIR(s.st_mode) || S_ISREG(s.st_mode)) { free(fname); return rname; // regular exit from the function } fprintf(stderr, "Error: invalid file type, %s.\n", fname); exit(1); }
static char *check_dir_or_file(const char *name) { assert(name); struct stat s; invalid_filename(name); if (arg_debug) printf("Private home: checking %s\n", name); char *fname = expand_home(name, cfg.homedir); if (!fname) { fprintf(stderr, "Error: file %s not found.\n", name); exit(1); } if (fname[0] != '/') { char* tmp; if (asprintf(&tmp, "%s/%s", cfg.homedir, fname) == -1) errExit("asprintf"); free(fname); fname = tmp; } char *rname = realpath(fname, NULL); if (!rname) { fprintf(stderr, "Error: invalid file %s\n", name); exit(1); } if (strncmp(rname, cfg.homedir, strlen(cfg.homedir)) != 0) { fprintf(stderr, "Error: file %s is not in user home directory\n", name); exit(1); } if (strcmp(rname, cfg.homedir) == 0) { fprintf(stderr, "Error: invalid directory %s\n", rname); exit(1); } char *ptr = rname + strlen(cfg.homedir); if (*ptr == '\0') { fprintf(stderr, "Error: invalid file %s\n", name); exit(1); } ptr++; ptr = strchr(ptr, '/'); if (ptr) { if (*ptr != '\0') { fprintf(stderr, "Error: only top files and directories in user home are allowed\n"); exit(1); } } if (stat(fname, &s) == -1) { fprintf(stderr, "Error: file %s not found.\n", fname); exit(1); } uid_t uid = getuid(); gid_t gid = getgid(); if (s.st_uid != uid || s.st_gid != gid) { fprintf(stderr, "Error: only files or directories created by the current user are allowed.\n"); exit(1); } if (S_ISDIR(s.st_mode) || S_ISREG(s.st_mode)) { free(fname); return rname; // regular exit from the function } fprintf(stderr, "Error: invalid file type, %s.\n", fname); exit(1); }
C
firejail
0
CVE-2014-3610
https://www.cvedetails.com/cve/CVE-2014-3610/
CWE-264
https://github.com/torvalds/linux/commit/854e8bb1aa06c578c2c9145fa6bfe3680ef63b23
854e8bb1aa06c578c2c9145fa6bfe3680ef63b23
KVM: x86: Check non-canonical addresses upon WRMSR Upon WRMSR, the CPU should inject #GP if a non-canonical value (address) is written to certain MSRs. The behavior is "almost" identical for AMD and Intel (ignoring MSRs that are not implemented in either architecture since they would anyhow #GP). However, IA32_SYSENTER_ESP and IA32_SYSENTER_EIP cause #GP if non-canonical address is written on Intel but not on AMD (which ignores the top 32-bits). Accordingly, this patch injects a #GP on the MSRs which behave identically on Intel and AMD. To eliminate the differences between the architecutres, the value which is written to IA32_SYSENTER_ESP and IA32_SYSENTER_EIP is turned to canonical value before writing instead of injecting a #GP. Some references from Intel and AMD manuals: According to Intel SDM description of WRMSR instruction #GP is expected on WRMSR "If the source register contains a non-canonical address and ECX specifies one of the following MSRs: IA32_DS_AREA, IA32_FS_BASE, IA32_GS_BASE, IA32_KERNEL_GS_BASE, IA32_LSTAR, IA32_SYSENTER_EIP, IA32_SYSENTER_ESP." According to AMD manual instruction manual: LSTAR/CSTAR (SYSCALL): "The WRMSR instruction loads the target RIP into the LSTAR and CSTAR registers. If an RIP written by WRMSR is not in canonical form, a general-protection exception (#GP) occurs." IA32_GS_BASE and IA32_FS_BASE (WRFSBASE/WRGSBASE): "The address written to the base field must be in canonical form or a #GP fault will occur." IA32_KERNEL_GS_BASE (SWAPGS): "The address stored in the KernelGSbase MSR must be in canonical form." This patch fixes CVE-2014-3610. Cc: [email protected] Signed-off-by: Nadav Amit <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
static void svm_set_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg) { struct vcpu_svm *svm = to_svm(vcpu); struct vmcb_seg *s = svm_seg(vcpu, seg); s->base = var->base; s->limit = var->limit; s->selector = var->selector; if (var->unusable) s->attrib = 0; else { s->attrib = (var->type & SVM_SELECTOR_TYPE_MASK); s->attrib |= (var->s & 1) << SVM_SELECTOR_S_SHIFT; s->attrib |= (var->dpl & 3) << SVM_SELECTOR_DPL_SHIFT; s->attrib |= (var->present & 1) << SVM_SELECTOR_P_SHIFT; s->attrib |= (var->avl & 1) << SVM_SELECTOR_AVL_SHIFT; s->attrib |= (var->l & 1) << SVM_SELECTOR_L_SHIFT; s->attrib |= (var->db & 1) << SVM_SELECTOR_DB_SHIFT; s->attrib |= (var->g & 1) << SVM_SELECTOR_G_SHIFT; } /* * This is always accurate, except if SYSRET returned to a segment * with SS.DPL != 3. Intel does not have this quirk, and always * forces SS.DPL to 3 on sysret, so we ignore that case; fixing it * would entail passing the CPL to userspace and back. */ if (seg == VCPU_SREG_SS) svm->vmcb->save.cpl = (s->attrib >> SVM_SELECTOR_DPL_SHIFT) & 3; mark_dirty(svm->vmcb, VMCB_SEG); }
static void svm_set_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg) { struct vcpu_svm *svm = to_svm(vcpu); struct vmcb_seg *s = svm_seg(vcpu, seg); s->base = var->base; s->limit = var->limit; s->selector = var->selector; if (var->unusable) s->attrib = 0; else { s->attrib = (var->type & SVM_SELECTOR_TYPE_MASK); s->attrib |= (var->s & 1) << SVM_SELECTOR_S_SHIFT; s->attrib |= (var->dpl & 3) << SVM_SELECTOR_DPL_SHIFT; s->attrib |= (var->present & 1) << SVM_SELECTOR_P_SHIFT; s->attrib |= (var->avl & 1) << SVM_SELECTOR_AVL_SHIFT; s->attrib |= (var->l & 1) << SVM_SELECTOR_L_SHIFT; s->attrib |= (var->db & 1) << SVM_SELECTOR_DB_SHIFT; s->attrib |= (var->g & 1) << SVM_SELECTOR_G_SHIFT; } /* * This is always accurate, except if SYSRET returned to a segment * with SS.DPL != 3. Intel does not have this quirk, and always * forces SS.DPL to 3 on sysret, so we ignore that case; fixing it * would entail passing the CPL to userspace and back. */ if (seg == VCPU_SREG_SS) svm->vmcb->save.cpl = (s->attrib >> SVM_SELECTOR_DPL_SHIFT) & 3; mark_dirty(svm->vmcb, VMCB_SEG); }
C
linux
0
CVE-2017-5061
https://www.cvedetails.com/cve/CVE-2017-5061/
CWE-362
https://github.com/chromium/chromium/commit/5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
(Reland) Discard compositor frames from unloaded web content This is a reland of https://codereview.chromium.org/2707243005/ with a small change to fix an uninitialized memory error that fails on MSAN bots. BUG=672847 [email protected], [email protected] CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2731283003 Cr-Commit-Position: refs/heads/master@{#454954}
void LayerTreeHostImpl::RemoveVideoFrameController( VideoFrameController* controller) { video_frame_controllers_.erase(controller); if (video_frame_controllers_.empty()) client_->SetVideoNeedsBeginFrames(false); }
void LayerTreeHostImpl::RemoveVideoFrameController( VideoFrameController* controller) { video_frame_controllers_.erase(controller); if (video_frame_controllers_.empty()) client_->SetVideoNeedsBeginFrames(false); }
C
Chrome
0
CVE-2016-5209
https://www.cvedetails.com/cve/CVE-2016-5209/
CWE-787
https://github.com/chromium/chromium/commit/d59a4441697f6253e7dc3f7ae5caad6e5fd2c778
d59a4441697f6253e7dc3f7ae5caad6e5fd2c778
Prevent bad casting in ImageBitmap when calling ArrayBuffer::createOrNull Currently when ImageBitmap's constructor is invoked, we check whether dstSize will overflow size_t or not. The problem comes when we call ArrayBuffer::createOrNull some times in the code. Both parameters of ArrayBuffer::createOrNull are unsigned. In ImageBitmap when we call this method, the first parameter is usually width * height. This could overflow unsigned even if it has been checked safe with size_t, the reason is that unsigned is a 32-bit value on 64-bit systems, while size_t is a 64-bit value. This CL makes a change such that we check whether the dstSize will overflow unsigned or not. In this case, we can guarantee that createOrNull will not have any crash. BUG=664139 Review-Url: https://codereview.chromium.org/2500493002 Cr-Commit-Position: refs/heads/master@{#431936}
bool ImageBitmap::isAccelerated() const { return m_image && (m_image->isTextureBacked() || m_image->hasMailbox()); }
bool ImageBitmap::isAccelerated() const { return m_image && (m_image->isTextureBacked() || m_image->hasMailbox()); }
C
Chrome
0
CVE-2013-7014
https://www.cvedetails.com/cve/CVE-2013-7014/
CWE-189
https://github.com/FFmpeg/FFmpeg/commit/86736f59d6a527d8bc807d09b93f971c0fe0bb07
86736f59d6a527d8bc807d09b93f971c0fe0bb07
avcodec/pngdsp: fix (un)signed type in end comparission Fixes out of array accesses Fixes Ticket2919 Found_by: ami_stuff Signed-off-by: Michael Niedermayer <[email protected]>
static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w) { long i; for (i = 0; i <= w - (int)sizeof(long); i += sizeof(long)) { long a = *(long *)(src1 + i); long b = *(long *)(src2 + i); *(long *)(dst + i) = ((a & pb_7f) + (b & pb_7f)) ^ ((a ^ b) & pb_80); } for (; i < w; i++) dst[i] = src1[i] + src2[i]; }
static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w) { long i; for (i = 0; i <= w - sizeof(long); i += sizeof(long)) { long a = *(long *)(src1 + i); long b = *(long *)(src2 + i); *(long *)(dst + i) = ((a & pb_7f) + (b & pb_7f)) ^ ((a ^ b) & pb_80); } for (; i < w; i++) dst[i] = src1[i] + src2[i]; }
C
FFmpeg
1
CVE-2017-9949
https://www.cvedetails.com/cve/CVE-2017-9949/
CWE-787
https://github.com/radare/radare2/commit/796dd28aaa6b9fa76d99c42c4d5ff8b257cc2191
796dd28aaa6b9fa76d99c42c4d5ff8b257cc2191
Fix ext2 buffer overflow in r2_sbu_grub_memmove
static int _server_handle_vCont(libgdbr_t *g, int (*cmd_cb) (void*, const char*, char*, size_t), void *core_ptr) { char *action = NULL; if (send_ack (g) < 0) { return -1; } g->data[g->data_len] = '\0'; if (g->data[5] == '?') { return send_msg (g, "vCont;c;s"); } if (!(action = strtok (g->data, ";"))) { return send_msg (g, "E01"); } while (action = strtok (NULL, ";")) { eprintf ("action: %s\n", action); switch (action[0]) { case 's': if (cmd_cb (core_ptr, "ds", NULL, 0) < 0) { send_msg (g, "E01"); return -1; } return send_msg (g, "OK"); case 'c': if (cmd_cb (core_ptr, "dc", NULL, 0) < 0) { send_msg (g, "E01"); return -1; } return send_msg (g, "OK"); default: return send_msg (g, "E01"); } } return -1; }
static int _server_handle_vCont(libgdbr_t *g, int (*cmd_cb) (void*, const char*, char*, size_t), void *core_ptr) { char *action = NULL; if (send_ack (g) < 0) { return -1; } g->data[g->data_len] = '\0'; if (g->data[5] == '?') { return send_msg (g, "vCont;c;s"); } if (!(action = strtok (g->data, ";"))) { return send_msg (g, "E01"); } while (action = strtok (NULL, ";")) { eprintf ("action: %s\n", action); switch (action[0]) { case 's': if (cmd_cb (core_ptr, "ds", NULL, 0) < 0) { send_msg (g, "E01"); return -1; } return send_msg (g, "OK"); case 'c': if (cmd_cb (core_ptr, "dc", NULL, 0) < 0) { send_msg (g, "E01"); return -1; } return send_msg (g, "OK"); default: return send_msg (g, "E01"); } } }
C
radare2
1
CVE-2018-16073
https://www.cvedetails.com/cve/CVE-2018-16073/
CWE-285
https://github.com/chromium/chromium/commit/0bb3f5c715eb66bb5c1fb05fd81d902ca57f33ca
0bb3f5c715eb66bb5c1fb05fd81d902ca57f33ca
Use unique processes for data URLs on restore. Data URLs are usually put into the process that created them, but this info is not tracked after a tab restore. Ensure that they do not end up in the parent frame's process (or each other's process), in case they are malicious. BUG=863069 Change-Id: Ib391f90c7bdf28a0a9c057c5cc7918c10aed968b Reviewed-on: https://chromium-review.googlesource.com/1150767 Reviewed-by: Alex Moshchuk <[email protected]> Reviewed-by: Lei Zhang <[email protected]> Commit-Queue: Charlie Reis <[email protected]> Cr-Commit-Position: refs/heads/master@{#581023}
void RenderFrameHostManager::DiscardUnusedFrame( std::unique_ptr<RenderFrameHostImpl> render_frame_host) { SiteInstanceImpl* site_instance = render_frame_host->GetSiteInstance(); RenderViewHostImpl* rvh = render_frame_host->render_view_host(); RenderFrameProxyHost* proxy = nullptr; if (site_instance->HasSite() && site_instance->active_frame_count() > 1) { proxy = GetRenderFrameProxyHost(site_instance); if (!proxy) proxy = CreateRenderFrameProxyHost(site_instance, rvh); } if (frame_tree_node_->IsMainFrame()) { rvh->set_main_frame_routing_id(MSG_ROUTING_NONE); rvh->SetIsActive(false); rvh->set_is_swapped_out(true); } render_frame_host.reset(); if (proxy && !proxy->is_render_frame_proxy_live()) proxy->InitRenderFrameProxy(); }
void RenderFrameHostManager::DiscardUnusedFrame( std::unique_ptr<RenderFrameHostImpl> render_frame_host) { SiteInstanceImpl* site_instance = render_frame_host->GetSiteInstance(); RenderViewHostImpl* rvh = render_frame_host->render_view_host(); RenderFrameProxyHost* proxy = nullptr; if (site_instance->HasSite() && site_instance->active_frame_count() > 1) { proxy = GetRenderFrameProxyHost(site_instance); if (!proxy) proxy = CreateRenderFrameProxyHost(site_instance, rvh); } if (frame_tree_node_->IsMainFrame()) { rvh->set_main_frame_routing_id(MSG_ROUTING_NONE); rvh->SetIsActive(false); rvh->set_is_swapped_out(true); } render_frame_host.reset(); if (proxy && !proxy->is_render_frame_proxy_live()) proxy->InitRenderFrameProxy(); }
C
Chrome
0
CVE-2016-1583
https://www.cvedetails.com/cve/CVE-2016-1583/
CWE-119
https://github.com/torvalds/linux/commit/f5364c150aa645b3d7daa21b5c0b9feaa1c9cd6d
f5364c150aa645b3d7daa21b5c0b9feaa1c9cd6d
Merge branch 'stacking-fixes' (vfs stacking fixes from Jann) Merge filesystem stacking fixes from Jann Horn. * emailed patches from Jann Horn <[email protected]>: sched: panic on corrupted stack end ecryptfs: forbid opening files without mmap handler proc: prevent stacking filesystems on top
bool find_numa_distance(int distance) { int i; if (distance == node_distance(0, 0)) return true; for (i = 0; i < sched_domains_numa_levels; i++) { if (sched_domains_numa_distance[i] == distance) return true; } return false; }
bool find_numa_distance(int distance) { int i; if (distance == node_distance(0, 0)) return true; for (i = 0; i < sched_domains_numa_levels; i++) { if (sched_domains_numa_distance[i] == distance) return true; } return false; }
C
linux
0
CVE-2012-5136
https://www.cvedetails.com/cve/CVE-2012-5136/
CWE-20
https://github.com/chromium/chromium/commit/401d30ef93030afbf7e81e53a11b68fc36194502
401d30ef93030afbf7e81e53a11b68fc36194502
Refactoring: Move m_mayDisplaySeamlesslyWithParent down to Document The member is used only in Document, thus no reason to stay in SecurityContext. TEST=none BUG=none [email protected], abarth, haraken, hayato Review URL: https://codereview.chromium.org/27615003 git-svn-id: svn://svn.chromium.org/blink/trunk@159829 bbb929c8-8fbe-4397-9dbb-9b2b20218538
PassRefPtr<HTMLCollection> Document::embeds() { return ensureCachedCollection(DocEmbeds); }
PassRefPtr<HTMLCollection> Document::embeds() { return ensureCachedCollection(DocEmbeds); }
C
Chrome
0
CVE-2016-5844
https://www.cvedetails.com/cve/CVE-2016-5844/
CWE-190
https://github.com/libarchive/libarchive/commit/3ad08e01b4d253c66ae56414886089684155af22
3ad08e01b4d253c66ae56414886089684155af22
Issue 717: Fix integer overflow when computing location of volume descriptor The multiplication here defaulted to 'int' but calculations of file positions should always use int64_t. A simple cast suffices to fix this since the base location is always 32 bits for ISO, so multiplying by the sector size will never overflow a 64-bit integer.
read_CE(struct archive_read *a, struct iso9660 *iso9660) { struct read_ce_queue *heap; const unsigned char *b, *p, *end; struct file_info *file; size_t step; int r; /* Read data which RRIP "CE" extension points. */ heap = &(iso9660->read_ce_req); step = iso9660->logical_block_size; while (heap->cnt && heap->reqs[0].offset == iso9660->current_position) { b = __archive_read_ahead(a, step, NULL); if (b == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Failed to read full block when scanning " "ISO9660 directory list"); return (ARCHIVE_FATAL); } do { file = heap->reqs[0].file; if (file->ce_offset + file->ce_size > step) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Malformed CE information"); return (ARCHIVE_FATAL); } p = b + file->ce_offset; end = p + file->ce_size; next_CE(heap); r = parse_rockridge(a, file, p, end); if (r != ARCHIVE_OK) return (ARCHIVE_FATAL); } while (heap->cnt && heap->reqs[0].offset == iso9660->current_position); /* NOTE: Do not move this consume's code to fron of * do-while loop. Registration of nested CE extension * might cause error because of current position. */ __archive_read_consume(a, step); iso9660->current_position += step; } return (ARCHIVE_OK); }
read_CE(struct archive_read *a, struct iso9660 *iso9660) { struct read_ce_queue *heap; const unsigned char *b, *p, *end; struct file_info *file; size_t step; int r; /* Read data which RRIP "CE" extension points. */ heap = &(iso9660->read_ce_req); step = iso9660->logical_block_size; while (heap->cnt && heap->reqs[0].offset == iso9660->current_position) { b = __archive_read_ahead(a, step, NULL); if (b == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Failed to read full block when scanning " "ISO9660 directory list"); return (ARCHIVE_FATAL); } do { file = heap->reqs[0].file; if (file->ce_offset + file->ce_size > step) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, "Malformed CE information"); return (ARCHIVE_FATAL); } p = b + file->ce_offset; end = p + file->ce_size; next_CE(heap); r = parse_rockridge(a, file, p, end); if (r != ARCHIVE_OK) return (ARCHIVE_FATAL); } while (heap->cnt && heap->reqs[0].offset == iso9660->current_position); /* NOTE: Do not move this consume's code to fron of * do-while loop. Registration of nested CE extension * might cause error because of current position. */ __archive_read_consume(a, step); iso9660->current_position += step; } return (ARCHIVE_OK); }
C
libarchive
0
CVE-2016-5221
https://www.cvedetails.com/cve/CVE-2016-5221/
CWE-190
https://github.com/chromium/chromium/commit/2a1d9fff62718d7175bf47c7903dda127ee0228c
2a1d9fff62718d7175bf47c7903dda127ee0228c
[SendTabToSelf] Added logic to display an infobar for the feature. This CL is one of many to come. It covers: * Creation of the infobar from the SendTabToSelfInfoBarController * Plumbed the call to create the infobar to the native code. * Open the link when user taps on the link In follow-up CLs, the following will be done: * Instantiate the InfobarController in the ChromeActivity * Listen for Model changes in the Controller Bug: 949233,963193 Change-Id: I5df1359debb5f0f35c32c2df3b691bf9129cdeb8 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1604406 Reviewed-by: Tommy Nyquist <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Reviewed-by: Mikel Astiz <[email protected]> Reviewed-by: sebsg <[email protected]> Reviewed-by: Jeffrey Cohen <[email protected]> Reviewed-by: Matthew Jones <[email protected]> Commit-Queue: Tanya Gupta <[email protected]> Cr-Commit-Position: refs/heads/master@{#660854}
JNI_SendTabToSelfAndroidBridge_GetEntryByGUID( JNIEnv* env, const JavaParamRef<jobject>& j_profile, const JavaParamRef<jstring>& j_guid) { SendTabToSelfModel* model = GetModel(j_profile); if (!model->IsReady()) { return nullptr; } const std::string guid = ConvertJavaStringToUTF8(env, j_guid); const SendTabToSelfEntry* found_entry = model->GetEntryByGUID(guid); if (found_entry == nullptr) { return nullptr; } return CreateJavaSendTabToSelfEntry(env, found_entry); }
JNI_SendTabToSelfAndroidBridge_GetEntryByGUID( JNIEnv* env, const JavaParamRef<jobject>& j_profile, const JavaParamRef<jstring>& j_guid) { SendTabToSelfModel* model = GetModel(j_profile); if (!model->IsReady()) { return nullptr; } const std::string guid = ConvertJavaStringToUTF8(env, j_guid); const SendTabToSelfEntry* found_entry = model->GetEntryByGUID(guid); if (found_entry == nullptr) { return nullptr; } return CreateJavaSendTabToSelfEntry(env, found_entry); }
C
Chrome
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 odkm_dump(GF_Box *a, FILE * trace) { GF_OMADRMKMSBox *ptr = (GF_OMADRMKMSBox*)a; gf_isom_box_dump_start(a, "OMADRMKMSBox", trace); fprintf(trace, ">\n"); if (ptr->hdr) gf_isom_box_dump((GF_Box *)ptr->hdr, trace); if (ptr->fmt) gf_isom_box_dump((GF_Box *)ptr->fmt, trace); gf_isom_box_dump_done("OMADRMKMSBox", a, trace); return GF_OK; }
GF_Err odkm_dump(GF_Box *a, FILE * trace) { GF_OMADRMKMSBox *ptr = (GF_OMADRMKMSBox*)a; gf_isom_box_dump_start(a, "OMADRMKMSBox", trace); fprintf(trace, ">\n"); if (ptr->hdr) gf_isom_box_dump((GF_Box *)ptr->hdr, trace); if (ptr->fmt) gf_isom_box_dump((GF_Box *)ptr->fmt, trace); gf_isom_box_dump_done("OMADRMKMSBox", a, trace); return GF_OK; }
C
gpac
0
CVE-2011-4324
https://www.cvedetails.com/cve/CVE-2011-4324/
null
https://github.com/torvalds/linux/commit/dc0b027dfadfcb8a5504f7d8052754bf8d501ab9
dc0b027dfadfcb8a5504f7d8052754bf8d501ab9
NFSv4: Convert the open and close ops to use fmode Signed-off-by: Trond Myklebust <[email protected]>
static int nfs4_init_client(struct nfs_client *clp, struct rpc_cred *cred) { int status = nfs4_proc_setclientid(clp, NFS4_CALLBACK, nfs_callback_tcpport, cred); if (status == 0) status = nfs4_proc_setclientid_confirm(clp, cred); if (status == 0) nfs4_schedule_state_renewal(clp); return status; }
static int nfs4_init_client(struct nfs_client *clp, struct rpc_cred *cred) { int status = nfs4_proc_setclientid(clp, NFS4_CALLBACK, nfs_callback_tcpport, cred); if (status == 0) status = nfs4_proc_setclientid_confirm(clp, cred); if (status == 0) nfs4_schedule_state_renewal(clp); return status; }
C
linux
0
CVE-2015-4036
https://www.cvedetails.com/cve/CVE-2015-4036/
CWE-119
https://github.com/torvalds/linux/commit/59c816c1f24df0204e01851431d3bab3eb76719c
59c816c1f24df0204e01851431d3bab3eb76719c
vhost/scsi: potential memory corruption This code in vhost_scsi_make_tpg() is confusing because we limit "tpgt" to UINT_MAX but the data type of "tpg->tport_tpgt" and that is a u16. I looked at the context and it turns out that in vhost_scsi_set_endpoint(), "tpg->tport_tpgt" is used as an offset into the vs_tpg[] array which has VHOST_SCSI_MAX_TARGET (256) elements so anything higher than 255 then it is invalid. I have made that the limit now. In vhost_scsi_send_evt() we mask away values higher than 255, but now that the limit has changed, we don't need the mask. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
static void vhost_scsi_drop_nodeacl(struct se_node_acl *se_acl) { struct vhost_scsi_nacl *nacl = container_of(se_acl, struct vhost_scsi_nacl, se_node_acl); core_tpg_del_initiator_node_acl(se_acl->se_tpg, se_acl, 1); kfree(nacl); }
static void vhost_scsi_drop_nodeacl(struct se_node_acl *se_acl) { struct vhost_scsi_nacl *nacl = container_of(se_acl, struct vhost_scsi_nacl, se_node_acl); core_tpg_del_initiator_node_acl(se_acl->se_tpg, se_acl, 1); kfree(nacl); }
C
linux
0
CVE-2017-9375
https://www.cvedetails.com/cve/CVE-2017-9375/
CWE-835
https://git.qemu.org/?p=qemu.git;a=commit;h=96d87bdda3919bb16f754b3d3fd1227e1f38f13c
96d87bdda3919bb16f754b3d3fd1227e1f38f13c
null
static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v) { XHCIInterrupter *intr; dma_addr_t erdp; unsigned int dp_idx; if (v >= xhci->numintrs) { DPRINTF("intr nr out of range (%d >= %d)\n", v, xhci->numintrs); return; } intr = &xhci->intr[v]; if (intr->er_full) { DPRINTF("xhci_event(): ER full, queueing\n"); if (((intr->ev_buffer_put+1) % EV_QUEUE) == intr->ev_buffer_get) { DPRINTF("xhci: event queue full, dropping event!\n"); return; } intr->ev_buffer[intr->ev_buffer_put++] = *event; if (intr->ev_buffer_put == EV_QUEUE) { intr->ev_buffer_put = 0; } return; } erdp = xhci_addr64(intr->erdp_low, intr->erdp_high); if (erdp < intr->er_start || erdp >= (intr->er_start + TRB_SIZE*intr->er_size)) { DPRINTF("xhci: ERDP out of bounds: "DMA_ADDR_FMT"\n", erdp); DPRINTF("xhci: ER[%d] at "DMA_ADDR_FMT" len %d\n", v, intr->er_start, intr->er_size); xhci_die(xhci); return; } dp_idx = (erdp - intr->er_start) / TRB_SIZE; assert(dp_idx < intr->er_size); if ((intr->er_ep_idx+1) % intr->er_size == dp_idx) { DPRINTF("xhci_event(): ER full, queueing\n"); #ifndef ER_FULL_HACK XHCIEvent full = {ER_HOST_CONTROLLER, CC_EVENT_RING_FULL_ERROR}; xhci_write_event(xhci, &full); #endif intr->er_full = 1; if (((intr->ev_buffer_put+1) % EV_QUEUE) == intr->ev_buffer_get) { DPRINTF("xhci: event queue full, dropping event!\n"); return; } intr->ev_buffer[intr->ev_buffer_put++] = *event; if (intr->ev_buffer_put == EV_QUEUE) { intr->ev_buffer_put = 0; } } else { xhci_write_event(xhci, event, v); } xhci_intr_raise(xhci, v); }
static void xhci_event(XHCIState *xhci, XHCIEvent *event, int v) { XHCIInterrupter *intr; dma_addr_t erdp; unsigned int dp_idx; if (v >= xhci->numintrs) { DPRINTF("intr nr out of range (%d >= %d)\n", v, xhci->numintrs); return; } intr = &xhci->intr[v]; if (intr->er_full) { DPRINTF("xhci_event(): ER full, queueing\n"); if (((intr->ev_buffer_put+1) % EV_QUEUE) == intr->ev_buffer_get) { DPRINTF("xhci: event queue full, dropping event!\n"); return; } intr->ev_buffer[intr->ev_buffer_put++] = *event; if (intr->ev_buffer_put == EV_QUEUE) { intr->ev_buffer_put = 0; } return; } erdp = xhci_addr64(intr->erdp_low, intr->erdp_high); if (erdp < intr->er_start || erdp >= (intr->er_start + TRB_SIZE*intr->er_size)) { DPRINTF("xhci: ERDP out of bounds: "DMA_ADDR_FMT"\n", erdp); DPRINTF("xhci: ER[%d] at "DMA_ADDR_FMT" len %d\n", v, intr->er_start, intr->er_size); xhci_die(xhci); return; } dp_idx = (erdp - intr->er_start) / TRB_SIZE; assert(dp_idx < intr->er_size); if ((intr->er_ep_idx+1) % intr->er_size == dp_idx) { DPRINTF("xhci_event(): ER full, queueing\n"); #ifndef ER_FULL_HACK XHCIEvent full = {ER_HOST_CONTROLLER, CC_EVENT_RING_FULL_ERROR}; xhci_write_event(xhci, &full); #endif intr->er_full = 1; if (((intr->ev_buffer_put+1) % EV_QUEUE) == intr->ev_buffer_get) { DPRINTF("xhci: event queue full, dropping event!\n"); return; } intr->ev_buffer[intr->ev_buffer_put++] = *event; if (intr->ev_buffer_put == EV_QUEUE) { intr->ev_buffer_put = 0; } } else { xhci_write_event(xhci, event, v); } xhci_intr_raise(xhci, v); }
C
qemu
0
CVE-2017-5061
https://www.cvedetails.com/cve/CVE-2017-5061/
CWE-362
https://github.com/chromium/chromium/commit/5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
5d78b84d39bd34bc9fce9d01c0dcd5a22a330d34
(Reland) Discard compositor frames from unloaded web content This is a reland of https://codereview.chromium.org/2707243005/ with a small change to fix an uninitialized memory error that fails on MSAN bots. BUG=672847 [email protected], [email protected] CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_site_isolation Review-Url: https://codereview.chromium.org/2731283003 Cr-Commit-Position: refs/heads/master@{#454954}
void LayerTreeHost::DidInitializeCompositorFrameSink() { DCHECK(new_compositor_frame_sink_); current_compositor_frame_sink_ = std::move(new_compositor_frame_sink_); client_->DidInitializeCompositorFrameSink(); }
void LayerTreeHost::DidInitializeCompositorFrameSink() { DCHECK(new_compositor_frame_sink_); current_compositor_frame_sink_ = std::move(new_compositor_frame_sink_); client_->DidInitializeCompositorFrameSink(); }
C
Chrome
0
CVE-2013-7271
https://www.cvedetails.com/cve/CVE-2013-7271/
CWE-20
https://github.com/torvalds/linux/commit/f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
net: rework recvmsg handler msg_name and msg_namelen logic This patch now always passes msg->msg_namelen as 0. recvmsg handlers must set msg_namelen to the proper size <= sizeof(struct sockaddr_storage) to return msg_name to the user. This prevents numerous uninitialized memory leaks we had in the recvmsg handlers and makes it harder for new code to accidentally leak uninitialized memory. Optimize for the case recvfrom is called with NULL as address. We don't need to copy the address at all, so set it to NULL before invoking the recvmsg handler. We can do so, because all the recvmsg handlers must cope with the case a plain read() is called on them. read() also sets msg_name to NULL. Also document these changes in include/linux/net.h as suggested by David Miller. Changes since RFC: Set msg->msg_name = NULL if user specified a NULL in msg_name but had a non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't affect sendto as it would bail out earlier while trying to copy-in the address. It also more naturally reflects the logic by the callers of verify_iovec. With this change in place I could remove " if (!uaddr || msg_sys->msg_namelen == 0) msg->msg_name = NULL ". This change does not alter the user visible error logic as we ignore msg_namelen as long as msg_name is NULL. Also remove two unnecessary curly brackets in ___sys_recvmsg and change comments to netdev style. Cc: David Miller <[email protected]> Suggested-by: Eric Dumazet <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
int tipc_sock_create_local(int type, struct socket **res) { int rc; struct sock *sk; rc = sock_create_lite(AF_TIPC, type, 0, res); if (rc < 0) { pr_err("Failed to create kernel socket\n"); return rc; } tipc_sk_create(&init_net, *res, 0, 1); sk = (*res)->sk; return 0; }
int tipc_sock_create_local(int type, struct socket **res) { int rc; struct sock *sk; rc = sock_create_lite(AF_TIPC, type, 0, res); if (rc < 0) { pr_err("Failed to create kernel socket\n"); return rc; } tipc_sk_create(&init_net, *res, 0, 1); sk = (*res)->sk; return 0; }
C
linux
0
CVE-2016-5104
https://www.cvedetails.com/cve/CVE-2016-5104/
CWE-284
https://github.com/libimobiledevice/libusbmuxd/commit/4397b3376dc4e4cb1c991d0aed61ce6482614196
4397b3376dc4e4cb1c991d0aed61ce6482614196
common: [security fix] Make sure sockets only listen locally
int socket_connect_unix(const char *filename) { struct sockaddr_un name; int sfd = -1; size_t size; struct stat fst; #ifdef SO_NOSIGPIPE int yes = 1; #endif if (stat(filename, &fst) != 0) { if (verbose >= 2) fprintf(stderr, "%s: stat '%s': %s\n", __func__, filename, strerror(errno)); return -1; } if (!S_ISSOCK(fst.st_mode)) { if (verbose >= 2) fprintf(stderr, "%s: File '%s' is not a socket!\n", __func__, filename); return -1; } if ((sfd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) { if (verbose >= 2) fprintf(stderr, "%s: socket: %s\n", __func__, strerror(errno)); return -1; } #ifdef SO_NOSIGPIPE if (setsockopt(sfd, SOL_SOCKET, SO_NOSIGPIPE, (void*)&yes, sizeof(int)) == -1) { perror("setsockopt()"); socket_close(sfd); return -1; } #endif name.sun_family = AF_LOCAL; strncpy(name.sun_path, filename, sizeof(name.sun_path)); name.sun_path[sizeof(name.sun_path) - 1] = 0; size = (offsetof(struct sockaddr_un, sun_path) + strlen(name.sun_path) + 1); if (connect(sfd, (struct sockaddr *) &name, size) < 0) { socket_close(sfd); if (verbose >= 2) fprintf(stderr, "%s: connect: %s\n", __func__, strerror(errno)); return -1; } return sfd; }
int socket_connect_unix(const char *filename) { struct sockaddr_un name; int sfd = -1; size_t size; struct stat fst; #ifdef SO_NOSIGPIPE int yes = 1; #endif if (stat(filename, &fst) != 0) { if (verbose >= 2) fprintf(stderr, "%s: stat '%s': %s\n", __func__, filename, strerror(errno)); return -1; } if (!S_ISSOCK(fst.st_mode)) { if (verbose >= 2) fprintf(stderr, "%s: File '%s' is not a socket!\n", __func__, filename); return -1; } if ((sfd = socket(PF_LOCAL, SOCK_STREAM, 0)) < 0) { if (verbose >= 2) fprintf(stderr, "%s: socket: %s\n", __func__, strerror(errno)); return -1; } #ifdef SO_NOSIGPIPE if (setsockopt(sfd, SOL_SOCKET, SO_NOSIGPIPE, (void*)&yes, sizeof(int)) == -1) { perror("setsockopt()"); socket_close(sfd); return -1; } #endif name.sun_family = AF_LOCAL; strncpy(name.sun_path, filename, sizeof(name.sun_path)); name.sun_path[sizeof(name.sun_path) - 1] = 0; size = (offsetof(struct sockaddr_un, sun_path) + strlen(name.sun_path) + 1); if (connect(sfd, (struct sockaddr *) &name, size) < 0) { socket_close(sfd); if (verbose >= 2) fprintf(stderr, "%s: connect: %s\n", __func__, strerror(errno)); return -1; } return sfd; }
C
libimobiledevice
0
CVE-2017-5077
https://www.cvedetails.com/cve/CVE-2017-5077/
CWE-125
https://github.com/chromium/chromium/commit/fec26ff33bf372476a70326f3669a35f34a9d474
fec26ff33bf372476a70326f3669a35f34a9d474
Origins should be represented as url::Origin (not as GURL). As pointed out in //docs/security/origin-vs-url.md, origins should be represented as url::Origin (not as GURL). This CL applies this guideline to predictor-related code and changes the type of the following fields from GURL to url::Origin: - OriginRequestSummary::origin - PreconnectedRequestStats::origin - PreconnectRequest::origin The old code did not depend on any non-origin parts of GURL (like path and/or query). Therefore, this CL has no intended behavior change. Bug: 973885 Change-Id: Idd14590b4834cb9d50c74ed747b595fe1a4ba357 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1895167 Commit-Queue: Łukasz Anforowicz <[email protected]> Reviewed-by: Alex Ilin <[email protected]> Cr-Commit-Position: refs/heads/master@{#716311}
void PageRequestSummary::UpdateOrAddToOrigins( const url::Origin& origin, const content::mojom::CommonNetworkInfoPtr& network_info) { if (origin.opaque()) return; auto it = origins.find(origin); if (it == origins.end()) { OriginRequestSummary summary; summary.origin = origin; summary.first_occurrence = origins.size(); it = origins.insert({origin, summary}).first; } it->second.always_access_network |= network_info->always_access_network; it->second.accessed_network |= network_info->network_accessed; }
void PageRequestSummary::UpdateOrAddToOrigins( const GURL& url, const content::mojom::CommonNetworkInfoPtr& network_info) { GURL origin = url.GetOrigin(); if (!origin.is_valid()) return; auto it = origins.find(origin); if (it == origins.end()) { OriginRequestSummary summary; summary.origin = origin; summary.first_occurrence = origins.size(); it = origins.insert({origin, summary}).first; } it->second.always_access_network |= network_info->always_access_network; it->second.accessed_network |= network_info->network_accessed; }
C
Chrome
1
CVE-2016-5216
https://www.cvedetails.com/cve/CVE-2016-5216/
CWE-416
https://github.com/chromium/chromium/commit/bf6a6765d44b09c64b8c75d749efb84742a250e7
bf6a6765d44b09c64b8c75d749efb84742a250e7
[pdf] Defer page unloading in JS callback. One of the callbacks from PDFium JavaScript into the embedder is to get the current page number. In Chromium, this will trigger a call to CalculateMostVisiblePage that method will determine the visible pages and unload any non-visible pages. But, if the originating JS is on a non-visible page we'll delete the page and annotations associated with that page. This will cause issues as we are currently working with those objects when the JavaScript returns. This Cl defers the page unloading triggered by getting the most visible page until the next event is handled by the Chromium embedder. BUG=chromium:653090 Review-Url: https://codereview.chromium.org/2418533002 Cr-Commit-Position: refs/heads/master@{#424781}
int PDFiumEngine::Form_GetFilePath(IPDF_JSPLATFORM* param, void* file_path, int length) { PDFiumEngine* engine = static_cast<PDFiumEngine*>(param); std::string rv = engine->client_->GetURL(); if (file_path && rv.size() <= static_cast<size_t>(length)) memcpy(file_path, rv.c_str(), rv.size()); return rv.size(); }
int PDFiumEngine::Form_GetFilePath(IPDF_JSPLATFORM* param, void* file_path, int length) { PDFiumEngine* engine = static_cast<PDFiumEngine*>(param); std::string rv = engine->client_->GetURL(); if (file_path && rv.size() <= static_cast<size_t>(length)) memcpy(file_path, rv.c_str(), rv.size()); return rv.size(); }
C
Chrome
0
CVE-2017-12154
https://www.cvedetails.com/cve/CVE-2017-12154/
null
https://github.com/torvalds/linux/commit/51aa68e7d57e3217192d88ce90fd5b8ef29ec94f
51aa68e7d57e3217192d88ce90fd5b8ef29ec94f
kvm: nVMX: Don't allow L2 to access the hardware CR8 If L1 does not specify the "use TPR shadow" VM-execution control in vmcs12, then L0 must specify the "CR8-load exiting" and "CR8-store exiting" VM-execution controls in vmcs02. Failure to do so will give the L2 VM unrestricted read/write access to the hardware CR8. This fixes CVE-2017-12154. Signed-off-by: Jim Mattson <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
static int vmx_write_pml_buffer(struct kvm_vcpu *vcpu) { struct vmcs12 *vmcs12; struct vcpu_vmx *vmx = to_vmx(vcpu); gpa_t gpa; struct page *page = NULL; u64 *pml_address; if (is_guest_mode(vcpu)) { WARN_ON_ONCE(vmx->nested.pml_full); /* * Check if PML is enabled for the nested guest. * Whether eptp bit 6 is set is already checked * as part of A/D emulation. */ vmcs12 = get_vmcs12(vcpu); if (!nested_cpu_has_pml(vmcs12)) return 0; if (vmcs12->guest_pml_index >= PML_ENTITY_NUM) { vmx->nested.pml_full = true; return 1; } gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS) & ~0xFFFull; page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->pml_address); if (is_error_page(page)) return 0; pml_address = kmap(page); pml_address[vmcs12->guest_pml_index--] = gpa; kunmap(page); kvm_release_page_clean(page); } return 0; }
static int vmx_write_pml_buffer(struct kvm_vcpu *vcpu) { struct vmcs12 *vmcs12; struct vcpu_vmx *vmx = to_vmx(vcpu); gpa_t gpa; struct page *page = NULL; u64 *pml_address; if (is_guest_mode(vcpu)) { WARN_ON_ONCE(vmx->nested.pml_full); /* * Check if PML is enabled for the nested guest. * Whether eptp bit 6 is set is already checked * as part of A/D emulation. */ vmcs12 = get_vmcs12(vcpu); if (!nested_cpu_has_pml(vmcs12)) return 0; if (vmcs12->guest_pml_index >= PML_ENTITY_NUM) { vmx->nested.pml_full = true; return 1; } gpa = vmcs_read64(GUEST_PHYSICAL_ADDRESS) & ~0xFFFull; page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->pml_address); if (is_error_page(page)) return 0; pml_address = kmap(page); pml_address[vmcs12->guest_pml_index--] = gpa; kunmap(page); kvm_release_page_clean(page); } return 0; }
C
linux
0
CVE-2011-2350
https://www.cvedetails.com/cve/CVE-2011-2350/
CWE-20
https://github.com/chromium/chromium/commit/b944f670bb7a8a919daac497a4ea0536c954c201
b944f670bb7a8a919daac497a4ea0536c954c201
[JSC] Implement a helper method createNotEnoughArgumentsError() https://bugs.webkit.org/show_bug.cgi?id=85102 Reviewed by Geoffrey Garen. In bug 84787, kbr@ requested to avoid hard-coding createTypeError(exec, "Not enough arguments") here and there. This patch implements createNotEnoughArgumentsError(exec) and uses it in JSC bindings. c.f. a corresponding bug for V8 bindings is bug 85097. Source/JavaScriptCore: * runtime/Error.cpp: (JSC::createNotEnoughArgumentsError): (JSC): * runtime/Error.h: (JSC): Source/WebCore: Test: bindings/scripts/test/TestObj.idl * bindings/scripts/CodeGeneratorJS.pm: Modified as described above. (GenerateArgumentsCountCheck): * bindings/js/JSDataViewCustom.cpp: Ditto. (WebCore::getDataViewMember): (WebCore::setDataViewMember): * bindings/js/JSDeprecatedPeerConnectionCustom.cpp: (WebCore::JSDeprecatedPeerConnectionConstructor::constructJSDeprecatedPeerConnection): * bindings/js/JSDirectoryEntryCustom.cpp: (WebCore::JSDirectoryEntry::getFile): (WebCore::JSDirectoryEntry::getDirectory): * bindings/js/JSSharedWorkerCustom.cpp: (WebCore::JSSharedWorkerConstructor::constructJSSharedWorker): * bindings/js/JSWebKitMutationObserverCustom.cpp: (WebCore::JSWebKitMutationObserverConstructor::constructJSWebKitMutationObserver): (WebCore::JSWebKitMutationObserver::observe): * bindings/js/JSWorkerCustom.cpp: (WebCore::JSWorkerConstructor::constructJSWorker): * bindings/scripts/test/JS/JSFloat64Array.cpp: Updated run-bindings-tests. (WebCore::jsFloat64ArrayPrototypeFunctionFoo): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction): (WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage): * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: (WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::jsTestEventTargetPrototypeFunctionItem): (WebCore::jsTestEventTargetPrototypeFunctionAddEventListener): (WebCore::jsTestEventTargetPrototypeFunctionRemoveEventListener): (WebCore::jsTestEventTargetPrototypeFunctionDispatchEvent): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::JSTestInterfaceConstructor::constructJSTestInterface): (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2): * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::JSTestNamedConstructorNamedConstructor::constructJSTestNamedConstructor): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObjConstructor::constructJSTestObj): (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionMethodWithSequenceArg): (WebCore::jsTestObjPrototypeFunctionMethodReturningSequence): (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows): (WebCore::jsTestObjPrototypeFunctionSerializedValue): (WebCore::jsTestObjPrototypeFunctionIdbKey): (WebCore::jsTestObjPrototypeFunctionOptionsObject): (WebCore::jsTestObjPrototypeFunctionAddEventListener): (WebCore::jsTestObjPrototypeFunctionRemoveEventListener): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg): (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod5): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod6): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7): (WebCore::jsTestObjConstructorFunctionClassMethod2): (WebCore::jsTestObjConstructorFunctionOverloadedMethod11): (WebCore::jsTestObjConstructorFunctionOverloadedMethod12): (WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongArray): (WebCore::jsTestObjPrototypeFunctionConvert1): (WebCore::jsTestObjPrototypeFunctionConvert2): (WebCore::jsTestObjPrototypeFunctionConvert3): (WebCore::jsTestObjPrototypeFunctionConvert4): (WebCore::jsTestObjPrototypeFunctionConvert5): (WebCore::jsTestObjPrototypeFunctionStrictFunction): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::JSTestSerializedScriptValueInterfaceConstructor::constructJSTestSerializedScriptValueInterface): (WebCore::jsTestSerializedScriptValueInterfacePrototypeFunctionAcceptTransferList): git-svn-id: svn://svn.chromium.org/blink/trunk@115536 bbb929c8-8fbe-4397-9dbb-9b2b20218538
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert4(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwVMTypeError(exec); JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createNotEnoughArgumentsError(exec)); d* (tod(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined))); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl->convert4(); return JSValue::encode(jsUndefined()); }
EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionConvert4(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwVMTypeError(exec); JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); if (exec->argumentCount() < 1) return throwVMError(exec, createTypeError(exec, "Not enough arguments")); d* (tod(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined))); if (exec->hadException()) return JSValue::encode(jsUndefined()); impl->convert4(); return JSValue::encode(jsUndefined()); }
C
Chrome
1
CVE-2011-2906
https://www.cvedetails.com/cve/CVE-2011-2906/
CWE-189
https://github.com/torvalds/linux/commit/b5b515445f4f5a905c5dd27e6e682868ccd6c09d
b5b515445f4f5a905c5dd27e6e682868ccd6c09d
[SCSI] pmcraid: reject negative request size There's a code path in pmcraid that can be reached via device ioctl that causes all sorts of ugliness, including heap corruption or triggering the OOM killer due to consecutive allocation of large numbers of pages. First, the user can call pmcraid_chr_ioctl(), with a type PMCRAID_PASSTHROUGH_IOCTL. This calls through to pmcraid_ioctl_passthrough(). Next, a pmcraid_passthrough_ioctl_buffer is copied in, and the request_size variable is set to buffer->ioarcb.data_transfer_length, which is an arbitrary 32-bit signed value provided by the user. If a negative value is provided here, bad things can happen. For example, pmcraid_build_passthrough_ioadls() is called with this request_size, which immediately calls pmcraid_alloc_sglist() with a negative size. The resulting math on allocating a scatter list can result in an overflow in the kzalloc() call (if num_elem is 0, the sglist will be smaller than expected), or if num_elem is unexpectedly large the subsequent loop will call alloc_pages() repeatedly, a high number of pages will be allocated and the OOM killer might be invoked. It looks like preventing this value from being negative in pmcraid_ioctl_passthrough() would be sufficient. Signed-off-by: Dan Rosenberg <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: James Bottomley <[email protected]>
static void pmcraid_cancel_all(struct pmcraid_cmd *cmd, u32 sense) { struct scsi_cmnd *scsi_cmd = cmd->scsi_cmd; struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; struct pmcraid_resource_entry *res = scsi_cmd->device->hostdata; void (*cmd_done) (struct pmcraid_cmd *) = sense ? pmcraid_erp_done : pmcraid_request_sense; memset(ioarcb->cdb, 0, PMCRAID_MAX_CDB_LEN); ioarcb->request_flags0 = SYNC_OVERRIDE; ioarcb->request_type = REQ_TYPE_IOACMD; ioarcb->cdb[0] = PMCRAID_CANCEL_ALL_REQUESTS; if (RES_IS_GSCSI(res->cfg_entry)) ioarcb->cdb[1] = PMCRAID_SYNC_COMPLETE_AFTER_CANCEL; ioarcb->ioadl_bus_addr = 0; ioarcb->ioadl_length = 0; ioarcb->data_transfer_length = 0; ioarcb->ioarcb_bus_addr &= (~0x1FULL); /* writing to IOARRIN must be protected by host_lock, as mid-layer * schedule queuecommand while we are doing this */ pmcraid_send_cmd(cmd, cmd_done, PMCRAID_REQUEST_SENSE_TIMEOUT, pmcraid_timeout_handler); }
static void pmcraid_cancel_all(struct pmcraid_cmd *cmd, u32 sense) { struct scsi_cmnd *scsi_cmd = cmd->scsi_cmd; struct pmcraid_ioarcb *ioarcb = &cmd->ioa_cb->ioarcb; struct pmcraid_resource_entry *res = scsi_cmd->device->hostdata; void (*cmd_done) (struct pmcraid_cmd *) = sense ? pmcraid_erp_done : pmcraid_request_sense; memset(ioarcb->cdb, 0, PMCRAID_MAX_CDB_LEN); ioarcb->request_flags0 = SYNC_OVERRIDE; ioarcb->request_type = REQ_TYPE_IOACMD; ioarcb->cdb[0] = PMCRAID_CANCEL_ALL_REQUESTS; if (RES_IS_GSCSI(res->cfg_entry)) ioarcb->cdb[1] = PMCRAID_SYNC_COMPLETE_AFTER_CANCEL; ioarcb->ioadl_bus_addr = 0; ioarcb->ioadl_length = 0; ioarcb->data_transfer_length = 0; ioarcb->ioarcb_bus_addr &= (~0x1FULL); /* writing to IOARRIN must be protected by host_lock, as mid-layer * schedule queuecommand while we are doing this */ pmcraid_send_cmd(cmd, cmd_done, PMCRAID_REQUEST_SENSE_TIMEOUT, pmcraid_timeout_handler); }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/76f36a8362a3e817cc3ec721d591f2f8878dc0c7
76f36a8362a3e817cc3ec721d591f2f8878dc0c7
Scheduler/child/TimeSource could be replaced with base/time/DefaultTickClock. They both are totally same and TimeSource is removed. BUG=494892 [email protected], [email protected] Review URL: https://codereview.chromium.org/1163143002 Cr-Commit-Position: refs/heads/master@{#333035}
TaskQueueManager::TaskQueueManager( size_t task_queue_count, scoped_refptr<NestableSingleThreadTaskRunner> main_task_runner, TaskQueueSelector* selector, const char* disabled_by_default_tracing_category) : main_task_runner_(main_task_runner), selector_(selector), task_was_run_bitmap_(0), pending_dowork_count_(0), work_batch_size_(1), time_source_(new base::DefaultTickClock), disabled_by_default_tracing_category_( disabled_by_default_tracing_category), deletion_sentinel_(new DeletionSentinel()), weak_factory_(this) { DCHECK(main_task_runner->RunsTasksOnCurrentThread()); DCHECK_LE(task_queue_count, sizeof(task_was_run_bitmap_) * CHAR_BIT) << "You need a bigger int for task_was_run_bitmap_"; TRACE_EVENT_OBJECT_CREATED_WITH_ID(disabled_by_default_tracing_category, "TaskQueueManager", this); for (size_t i = 0; i < task_queue_count; i++) { scoped_refptr<internal::TaskQueue> queue(make_scoped_refptr( new internal::TaskQueue(this, disabled_by_default_tracing_category))); queues_.push_back(queue); } std::vector<const base::TaskQueue*> work_queues; for (const auto& queue : queues_) work_queues.push_back(&queue->work_queue()); selector_->RegisterWorkQueues(work_queues); selector_->SetTaskQueueSelectorObserver(this); do_work_from_main_thread_closure_ = base::Bind(&TaskQueueManager::DoWork, weak_factory_.GetWeakPtr(), true); do_work_from_other_thread_closure_ = base::Bind(&TaskQueueManager::DoWork, weak_factory_.GetWeakPtr(), false); }
TaskQueueManager::TaskQueueManager( size_t task_queue_count, scoped_refptr<NestableSingleThreadTaskRunner> main_task_runner, TaskQueueSelector* selector, const char* disabled_by_default_tracing_category) : main_task_runner_(main_task_runner), selector_(selector), task_was_run_bitmap_(0), pending_dowork_count_(0), work_batch_size_(1), time_source_(new TimeSource), disabled_by_default_tracing_category_( disabled_by_default_tracing_category), deletion_sentinel_(new DeletionSentinel()), weak_factory_(this) { DCHECK(main_task_runner->RunsTasksOnCurrentThread()); DCHECK_LE(task_queue_count, sizeof(task_was_run_bitmap_) * CHAR_BIT) << "You need a bigger int for task_was_run_bitmap_"; TRACE_EVENT_OBJECT_CREATED_WITH_ID(disabled_by_default_tracing_category, "TaskQueueManager", this); for (size_t i = 0; i < task_queue_count; i++) { scoped_refptr<internal::TaskQueue> queue(make_scoped_refptr( new internal::TaskQueue(this, disabled_by_default_tracing_category))); queues_.push_back(queue); } std::vector<const base::TaskQueue*> work_queues; for (const auto& queue : queues_) work_queues.push_back(&queue->work_queue()); selector_->RegisterWorkQueues(work_queues); selector_->SetTaskQueueSelectorObserver(this); do_work_from_main_thread_closure_ = base::Bind(&TaskQueueManager::DoWork, weak_factory_.GetWeakPtr(), true); do_work_from_other_thread_closure_ = base::Bind(&TaskQueueManager::DoWork, weak_factory_.GetWeakPtr(), false); }
C
Chrome
1
CVE-2016-10133
https://www.cvedetails.com/cve/CVE-2016-10133/
CWE-119
http://git.ghostscript.com/?p=mujs.git;a=commit;h=77ab465f1c394bb77f00966cd950650f3f53cb24
77ab465f1c394bb77f00966cd950650f3f53cb24
null
void js_pushstring(js_State *J, const char *v) { int n = strlen(v); CHECKSTACK(1); if (n <= soffsetof(js_Value, type)) { char *s = STACK[TOP].u.shrstr; while (n--) *s++ = *v++; *s = 0; STACK[TOP].type = JS_TSHRSTR; } else { STACK[TOP].type = JS_TMEMSTR; STACK[TOP].u.memstr = jsV_newmemstring(J, v, n); } ++TOP; }
void js_pushstring(js_State *J, const char *v) { int n = strlen(v); CHECKSTACK(1); if (n <= soffsetof(js_Value, type)) { char *s = STACK[TOP].u.shrstr; while (n--) *s++ = *v++; *s = 0; STACK[TOP].type = JS_TSHRSTR; } else { STACK[TOP].type = JS_TMEMSTR; STACK[TOP].u.memstr = jsV_newmemstring(J, v, n); } ++TOP; }
C
ghostscript
0
CVE-2016-2508
https://www.cvedetails.com/cve/CVE-2016-2508/
CWE-119
https://android.googlesource.com/platform/frameworks/av/+/f81038006b4c59a5a148dcad887371206033c28f
f81038006b4c59a5a148dcad887371206033c28f
MPEG4Extractor: ensure kKeyTrackID exists before creating an MPEG4Source as track. GenericSource: return error when no track exists. SampleIterator: make sure mSamplesPerChunk is not zero before using it as divisor. Bug: 21657957 Bug: 23705695 Bug: 22802344 Bug: 28799341 Change-Id: I7664992ade90b935d3f255dcd43ecc2898f30b04 (cherry picked from commit 0386c91b8a910a134e5898ffa924c1b6c7560b13)
void NuPlayer::GenericSource::restartPollBuffering() { if (mIsStreaming) { cancelPollBuffering(); onPollBuffering(); } }
void NuPlayer::GenericSource::restartPollBuffering() { if (mIsStreaming) { cancelPollBuffering(); onPollBuffering(); } }
C
Android
0
CVE-2012-2828
https://www.cvedetails.com/cve/CVE-2012-2828/
CWE-189
https://github.com/chromium/chromium/commit/d560c6f5a89c582c9e12000adcebb4d4538a665d
d560c6f5a89c582c9e12000adcebb4d4538a665d
Disable OutOfProcessPPAPITest.VarDeprecated on Mac due to timeouts. BUG=121107 [email protected],[email protected] Review URL: https://chromiumcodereview.appspot.com/9950017 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@129857 0039d316-1c4b-4281-b951-d872f2087c98
bool PPAPITestBase::GetHTTPDocumentRoot(FilePath* document_root) { FilePath exe_dir = CommandLine::ForCurrentProcess()->GetProgram().DirName(); FilePath src_dir; if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)) return false; if (!exe_dir.IsAbsolute()) file_util::AbsolutePath(&exe_dir); if (!src_dir.IsAbsolute()) file_util::AbsolutePath(&src_dir); if (!exe_dir.IsAbsolute()) return false; if (!src_dir.IsAbsolute()) return false; size_t match, exe_size, src_size; std::vector<FilePath::StringType> src_parts, exe_parts; exe_dir.GetComponents(&exe_parts); src_dir.GetComponents(&src_parts); exe_size = exe_parts.size(); src_size = src_parts.size(); for (match = 0; match < exe_size && match < src_size; ++match) { if (exe_parts[match] != src_parts[match]) break; } for (size_t tmp_itr = match; tmp_itr < src_size; ++tmp_itr) { *document_root = document_root->Append(FILE_PATH_LITERAL("..")); } for (; match < exe_size; ++match) { *document_root = document_root->Append(exe_parts[match]); } return true; }
bool PPAPITestBase::GetHTTPDocumentRoot(FilePath* document_root) { FilePath exe_dir = CommandLine::ForCurrentProcess()->GetProgram().DirName(); FilePath src_dir; if (!PathService::Get(base::DIR_SOURCE_ROOT, &src_dir)) return false; if (!exe_dir.IsAbsolute()) file_util::AbsolutePath(&exe_dir); if (!src_dir.IsAbsolute()) file_util::AbsolutePath(&src_dir); if (!exe_dir.IsAbsolute()) return false; if (!src_dir.IsAbsolute()) return false; size_t match, exe_size, src_size; std::vector<FilePath::StringType> src_parts, exe_parts; exe_dir.GetComponents(&exe_parts); src_dir.GetComponents(&src_parts); exe_size = exe_parts.size(); src_size = src_parts.size(); for (match = 0; match < exe_size && match < src_size; ++match) { if (exe_parts[match] != src_parts[match]) break; } for (size_t tmp_itr = match; tmp_itr < src_size; ++tmp_itr) { *document_root = document_root->Append(FILE_PATH_LITERAL("..")); } for (; match < exe_size; ++match) { *document_root = document_root->Append(exe_parts[match]); } return true; }
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
get_object_end(void *state) { GetState *_state = (GetState *) state; int lex_level = _state->lex->lex_level; if (lex_level == 0 && _state->npath == 0) { /* Special case: return the entire object */ char *start = _state->result_start; int len = _state->lex->prev_token_terminator - start; _state->tresult = cstring_to_text_with_len(start, len); } }
get_object_end(void *state) { GetState *_state = (GetState *) state; int lex_level = _state->lex->lex_level; if (lex_level == 0 && _state->npath == 0) { /* Special case: return the entire object */ char *start = _state->result_start; int len = _state->lex->prev_token_terminator - start; _state->tresult = cstring_to_text_with_len(start, len); } }
C
postgresql
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_path_is_absolute (const DBusString *filename) { if (_dbus_string_get_length (filename) > 0) return _dbus_string_get_byte (filename, 1) == ':' || _dbus_string_get_byte (filename, 0) == '\\' || _dbus_string_get_byte (filename, 0) == '/'; else return FALSE; }
_dbus_path_is_absolute (const DBusString *filename) { if (_dbus_string_get_length (filename) > 0) return _dbus_string_get_byte (filename, 1) == ':' || _dbus_string_get_byte (filename, 0) == '\\' || _dbus_string_get_byte (filename, 0) == '/'; else return FALSE; }
C
dbus
0
CVE-2014-0131
https://www.cvedetails.com/cve/CVE-2014-0131/
CWE-416
https://github.com/torvalds/linux/commit/1fd819ecb90cc9b822cd84d3056ddba315d3340f
1fd819ecb90cc9b822cd84d3056ddba315d3340f
skbuff: skb_segment: orphan frags before copying skb_segment copies frags around, so we need to copy them carefully to avoid accessing user memory after reporting completion to userspace through a callback. skb_segment doesn't normally happen on datapath: TSO needs to be disabled - so disabling zero copy in this case does not look like a big deal. Signed-off-by: Michael S. Tsirkin <[email protected]> Acked-by: Herbert Xu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) { __copy_skb_header(new, old); skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size; skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs; skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type; }
static void copy_skb_header(struct sk_buff *new, const struct sk_buff *old) { __copy_skb_header(new, old); skb_shinfo(new)->gso_size = skb_shinfo(old)->gso_size; skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs; skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/a0fe4d88137213aa24fbb16fd7eec34533345c9b
a0fe4d88137213aa24fbb16fd7eec34533345c9b
Move supports-high-dpi flag into registry. Calls to SetProcessDpiAwareness need to happen immediately when the app starts. Specifically, before user profile settings have been initialized. This patch moves the --supports-high-dpi into the registry. BUG=339152, 149881, 160457 Review URL: https://codereview.chromium.org/153403003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@256811 0039d316-1c4b-4281-b951-d872f2087c98
bool IsInHighDPIMode() { return GetDPIScale() > 1.0; }
bool IsInHighDPIMode() { return GetDPIScale() > 1.0; }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/1a113d35a19c0ed6500fb5c0acdc35730617fb3f
1a113d35a19c0ed6500fb5c0acdc35730617fb3f
Gracefully deal with clearing content settings for unregistered extensions. BUG=128652 Review URL: https://chromiumcodereview.appspot.com/10907093 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155341 0039d316-1c4b-4281-b951-d872f2087c98
void ContentSettingsStore::NotifyOfContentSettingChanged( const std::string& extension_id, bool incognito) { FOR_EACH_OBSERVER( ContentSettingsStore::Observer, observers_, OnContentSettingChanged(extension_id, incognito)); }
void ContentSettingsStore::NotifyOfContentSettingChanged( const std::string& extension_id, bool incognito) { FOR_EACH_OBSERVER( ContentSettingsStore::Observer, observers_, OnContentSettingChanged(extension_id, incognito)); }
C
Chrome
0
CVE-2013-0892
https://www.cvedetails.com/cve/CVE-2013-0892/
null
https://github.com/chromium/chromium/commit/0ab5fab4939150bd0f30ada8a4bf6eb0f69d66c1
0ab5fab4939150bd0f30ada8a4bf6eb0f69d66c1
Sizes going across an IPC should be uint32. BUG=164946 Review URL: https://chromiumcodereview.appspot.com/11472038 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@171944 0039d316-1c4b-4281-b951-d872f2087c98
void GpuCommandBufferStub::OnEnsureBackbuffer() { TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEnsureBackbuffer"); if (!surface_) return; if (surface_->DeferDraws()) { DCHECK(!IsScheduled()); channel_->RequeueMessage(); } else { surface_->SetBackbufferAllocation(true); } }
void GpuCommandBufferStub::OnEnsureBackbuffer() { TRACE_EVENT0("gpu", "GpuCommandBufferStub::OnEnsureBackbuffer"); if (!surface_) return; if (surface_->DeferDraws()) { DCHECK(!IsScheduled()); channel_->RequeueMessage(); } else { surface_->SetBackbufferAllocation(true); } }
C
Chrome
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::OnEstablishGpuChannel() { GpuProcessHost::Get()->EstablishGpuChannel(id(), this); }
void ResourceMessageFilter::OnEstablishGpuChannel() { GpuProcessHost::Get()->EstablishGpuChannel(id(), this); }
C
Chrome
0
CVE-2019-10664
https://www.cvedetails.com/cve/CVE-2019-10664/
CWE-89
https://github.com/domoticz/domoticz/commit/ee70db46f81afa582c96b887b73bcd2a86feda00
ee70db46f81afa582c96b887b73bcd2a86feda00
Fixed possible SQL Injection Vulnerability (Thanks to Fabio Carretto!)
void CWebServer::SetWebCompressionMode(const _eWebCompressionMode gzmode) { if (m_pWebEm == NULL) return; m_pWebEm->SetWebCompressionMode(gzmode); }
void CWebServer::SetWebCompressionMode(const _eWebCompressionMode gzmode) { if (m_pWebEm == NULL) return; m_pWebEm->SetWebCompressionMode(gzmode); }
C
domoticz
0
CVE-2016-10150
https://www.cvedetails.com/cve/CVE-2016-10150/
CWE-416
https://github.com/torvalds/linux/commit/a0f1d21c1ccb1da66629627a74059dd7f5ac9c61
a0f1d21c1ccb1da66629627a74059dd7f5ac9c61
KVM: use after free in kvm_ioctl_create_device() We should move the ops->destroy(dev) after the list_del(&dev->vm_node) so that we don't use "dev" after freeing it. Fixes: a28ebea2adc4 ("KVM: Protect device ops->create and list_add with kvm->lock") Signed-off-by: Dan Carpenter <[email protected]> Reviewed-by: David Hildenbrand <[email protected]> Signed-off-by: Radim Krčmář <[email protected]>
static int vm_stat_get(void *_offset, u64 *val) { unsigned offset = (long)_offset; struct kvm *kvm; struct kvm_stat_data stat_tmp = {.offset = offset}; u64 tmp_val; *val = 0; spin_lock(&kvm_lock); list_for_each_entry(kvm, &vm_list, vm_list) { stat_tmp.kvm = kvm; vm_stat_get_per_vm((void *)&stat_tmp, &tmp_val); *val += tmp_val; } spin_unlock(&kvm_lock); return 0; }
static int vm_stat_get(void *_offset, u64 *val) { unsigned offset = (long)_offset; struct kvm *kvm; struct kvm_stat_data stat_tmp = {.offset = offset}; u64 tmp_val; *val = 0; spin_lock(&kvm_lock); list_for_each_entry(kvm, &vm_list, vm_list) { stat_tmp.kvm = kvm; vm_stat_get_per_vm((void *)&stat_tmp, &tmp_val); *val += tmp_val; } spin_unlock(&kvm_lock); return 0; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/a44b00c88bc5ea35b5b150217c5fd6e4ce168e58
a44b00c88bc5ea35b5b150217c5fd6e4ce168e58
Apply behaviour change fix from upstream for previous XPath change. BUG=58731 TEST=NONE Review URL: http://codereview.chromium.org/4027006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@63572 0039d316-1c4b-4281-b951-d872f2087c98
xmlXPathMultValues(xmlXPathParserContextPtr ctxt) { xmlXPathObjectPtr arg; double val; arg = valuePop(ctxt); if (arg == NULL) XP_ERROR(XPATH_INVALID_OPERAND); val = xmlXPathCastToNumber(arg); xmlXPathReleaseObject(ctxt->context, arg); CAST_TO_NUMBER; CHECK_TYPE(XPATH_NUMBER); ctxt->value->floatval *= val; }
xmlXPathMultValues(xmlXPathParserContextPtr ctxt) { xmlXPathObjectPtr arg; double val; arg = valuePop(ctxt); if (arg == NULL) XP_ERROR(XPATH_INVALID_OPERAND); val = xmlXPathCastToNumber(arg); xmlXPathReleaseObject(ctxt->context, arg); CAST_TO_NUMBER; CHECK_TYPE(XPATH_NUMBER); ctxt->value->floatval *= val; }
C
Chrome
0
CVE-2017-9059
https://www.cvedetails.com/cve/CVE-2017-9059/
CWE-404
https://github.com/torvalds/linux/commit/c70422f760c120480fee4de6c38804c72aa26bc1
c70422f760c120480fee4de6c38804c72aa26bc1
Merge tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux Pull nfsd updates from Bruce Fields: "Another RDMA update from Chuck Lever, and a bunch of miscellaneous bugfixes" * tag 'nfsd-4.12' of git://linux-nfs.org/~bfields/linux: (26 commits) nfsd: Fix up the "supattr_exclcreat" attributes nfsd: encoders mustn't use unitialized values in error cases nfsd: fix undefined behavior in nfsd4_layout_verify lockd: fix lockd shutdown race NFSv4: Fix callback server shutdown SUNRPC: Refactor svc_set_num_threads() NFSv4.x/callback: Create the callback service through svc_create_pooled lockd: remove redundant check on block svcrdma: Clean out old XDR encoders svcrdma: Remove the req_map cache svcrdma: Remove unused RDMA Write completion handler svcrdma: Reduce size of sge array in struct svc_rdma_op_ctxt svcrdma: Clean up RPC-over-RDMA backchannel reply processing svcrdma: Report Write/Reply chunk overruns svcrdma: Clean up RDMA_ERROR path svcrdma: Use rdma_rw API in RPC reply path svcrdma: Introduce local rdma_rw API helpers svcrdma: Clean up svc_rdma_get_inv_rkey() svcrdma: Add helper to save pages under I/O svcrdma: Eliminate RPCRDMA_SQ_DEPTH_MULT ...
nfsd_inject_print_delegations(void) { struct nfs4_client *clp; u64 count = 0; struct nfsd_net *nn = net_generic(current->nsproxy->net_ns, nfsd_net_id); if (!nfsd_netns_ready(nn)) return 0; spin_lock(&nn->client_lock); list_for_each_entry(clp, &nn->client_lru, cl_lru) count += nfsd_print_client_delegations(clp); spin_unlock(&nn->client_lock); return count; }
nfsd_inject_print_delegations(void) { struct nfs4_client *clp; u64 count = 0; struct nfsd_net *nn = net_generic(current->nsproxy->net_ns, nfsd_net_id); if (!nfsd_netns_ready(nn)) return 0; spin_lock(&nn->client_lock); list_for_each_entry(clp, &nn->client_lru, cl_lru) count += nfsd_print_client_delegations(clp); spin_unlock(&nn->client_lock); return count; }
C
linux
0
CVE-2013-4162
https://www.cvedetails.com/cve/CVE-2013-4162/
CWE-399
https://github.com/torvalds/linux/commit/8822b64a0fa64a5dd1dfcf837c5b0be83f8c05d1
8822b64a0fa64a5dd1dfcf837c5b0be83f8c05d1
ipv6: call udp_push_pending_frames when uncorking a socket with AF_INET pending data We accidentally call down to ip6_push_pending_frames when uncorking pending AF_INET data on a ipv6 socket. This results in the following splat (from Dave Jones): skbuff: skb_under_panic: text:ffffffff816765f6 len:48 put:40 head:ffff88013deb6df0 data:ffff88013deb6dec tail:0x2c end:0xc0 dev:<NULL> ------------[ cut here ]------------ kernel BUG at net/core/skbuff.c:126! invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC Modules linked in: dccp_ipv4 dccp 8021q garp bridge stp dlci mpoa snd_seq_dummy sctp fuse hidp tun bnep nfnetlink scsi_transport_iscsi rfcomm can_raw can_bcm af_802154 appletalk caif_socket can caif ipt_ULOG x25 rose af_key pppoe pppox ipx phonet irda llc2 ppp_generic slhc p8023 psnap p8022 llc crc_ccitt atm bluetooth +netrom ax25 nfc rfkill rds af_rxrpc coretemp hwmon kvm_intel kvm crc32c_intel snd_hda_codec_realtek ghash_clmulni_intel microcode pcspkr snd_hda_codec_hdmi snd_hda_intel snd_hda_codec snd_hwdep usb_debug snd_seq snd_seq_device snd_pcm e1000e snd_page_alloc snd_timer ptp snd pps_core soundcore xfs libcrc32c CPU: 2 PID: 8095 Comm: trinity-child2 Not tainted 3.10.0-rc7+ #37 task: ffff8801f52c2520 ti: ffff8801e6430000 task.ti: ffff8801e6430000 RIP: 0010:[<ffffffff816e759c>] [<ffffffff816e759c>] skb_panic+0x63/0x65 RSP: 0018:ffff8801e6431de8 EFLAGS: 00010282 RAX: 0000000000000086 RBX: ffff8802353d3cc0 RCX: 0000000000000006 RDX: 0000000000003b90 RSI: ffff8801f52c2ca0 RDI: ffff8801f52c2520 RBP: ffff8801e6431e08 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000001 R12: ffff88022ea0c800 R13: ffff88022ea0cdf8 R14: ffff8802353ecb40 R15: ffffffff81cc7800 FS: 00007f5720a10740(0000) GS:ffff880244c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000005862000 CR3: 000000022843c000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffff88013deb6dec 000000000000002c 00000000000000c0 ffffffff81a3f6e4 ffff8801e6431e18 ffffffff8159a9aa ffff8801e6431e90 ffffffff816765f6 ffffffff810b756b 0000000700000002 ffff8801e6431e40 0000fea9292aa8c0 Call Trace: [<ffffffff8159a9aa>] skb_push+0x3a/0x40 [<ffffffff816765f6>] ip6_push_pending_frames+0x1f6/0x4d0 [<ffffffff810b756b>] ? mark_held_locks+0xbb/0x140 [<ffffffff81694919>] udp_v6_push_pending_frames+0x2b9/0x3d0 [<ffffffff81694660>] ? udplite_getfrag+0x20/0x20 [<ffffffff8162092a>] udp_lib_setsockopt+0x1aa/0x1f0 [<ffffffff811cc5e7>] ? fget_light+0x387/0x4f0 [<ffffffff816958a4>] udpv6_setsockopt+0x34/0x40 [<ffffffff815949f4>] sock_common_setsockopt+0x14/0x20 [<ffffffff81593c31>] SyS_setsockopt+0x71/0xd0 [<ffffffff816f5d54>] tracesys+0xdd/0xe2 Code: 00 00 48 89 44 24 10 8b 87 d8 00 00 00 48 89 44 24 08 48 8b 87 e8 00 00 00 48 c7 c7 c0 04 aa 81 48 89 04 24 31 c0 e8 e1 7e ff ff <0f> 0b 55 48 89 e5 0f 0b 55 48 89 e5 0f 0b 55 48 89 e5 0f 0b 55 RIP [<ffffffff816e759c>] skb_panic+0x63/0x65 RSP <ffff8801e6431de8> This patch adds a check if the pending data is of address family AF_INET and directly calls udp_push_ending_frames from udp_v6_push_pending_frames if that is the case. This bug was found by Dave Jones with trinity. (Also move the initialization of fl6 below the AF_INET check, even if not strictly necessary.) Cc: Dave Jones <[email protected]> Cc: YOSHIFUJI Hideaki <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
int udp_seq_open(struct inode *inode, struct file *file) { struct udp_seq_afinfo *afinfo = PDE_DATA(inode); struct udp_iter_state *s; int err; err = seq_open_net(inode, file, &afinfo->seq_ops, sizeof(struct udp_iter_state)); if (err < 0) return err; s = ((struct seq_file *)file->private_data)->private; s->family = afinfo->family; s->udp_table = afinfo->udp_table; return err; }
int udp_seq_open(struct inode *inode, struct file *file) { struct udp_seq_afinfo *afinfo = PDE_DATA(inode); struct udp_iter_state *s; int err; err = seq_open_net(inode, file, &afinfo->seq_ops, sizeof(struct udp_iter_state)); if (err < 0) return err; s = ((struct seq_file *)file->private_data)->private; s->family = afinfo->family; s->udp_table = afinfo->udp_table; return err; }
C
linux
0
CVE-2013-4162
https://www.cvedetails.com/cve/CVE-2013-4162/
CWE-399
https://github.com/torvalds/linux/commit/8822b64a0fa64a5dd1dfcf837c5b0be83f8c05d1
8822b64a0fa64a5dd1dfcf837c5b0be83f8c05d1
ipv6: call udp_push_pending_frames when uncorking a socket with AF_INET pending data We accidentally call down to ip6_push_pending_frames when uncorking pending AF_INET data on a ipv6 socket. This results in the following splat (from Dave Jones): skbuff: skb_under_panic: text:ffffffff816765f6 len:48 put:40 head:ffff88013deb6df0 data:ffff88013deb6dec tail:0x2c end:0xc0 dev:<NULL> ------------[ cut here ]------------ kernel BUG at net/core/skbuff.c:126! invalid opcode: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC Modules linked in: dccp_ipv4 dccp 8021q garp bridge stp dlci mpoa snd_seq_dummy sctp fuse hidp tun bnep nfnetlink scsi_transport_iscsi rfcomm can_raw can_bcm af_802154 appletalk caif_socket can caif ipt_ULOG x25 rose af_key pppoe pppox ipx phonet irda llc2 ppp_generic slhc p8023 psnap p8022 llc crc_ccitt atm bluetooth +netrom ax25 nfc rfkill rds af_rxrpc coretemp hwmon kvm_intel kvm crc32c_intel snd_hda_codec_realtek ghash_clmulni_intel microcode pcspkr snd_hda_codec_hdmi snd_hda_intel snd_hda_codec snd_hwdep usb_debug snd_seq snd_seq_device snd_pcm e1000e snd_page_alloc snd_timer ptp snd pps_core soundcore xfs libcrc32c CPU: 2 PID: 8095 Comm: trinity-child2 Not tainted 3.10.0-rc7+ #37 task: ffff8801f52c2520 ti: ffff8801e6430000 task.ti: ffff8801e6430000 RIP: 0010:[<ffffffff816e759c>] [<ffffffff816e759c>] skb_panic+0x63/0x65 RSP: 0018:ffff8801e6431de8 EFLAGS: 00010282 RAX: 0000000000000086 RBX: ffff8802353d3cc0 RCX: 0000000000000006 RDX: 0000000000003b90 RSI: ffff8801f52c2ca0 RDI: ffff8801f52c2520 RBP: ffff8801e6431e08 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000001 R11: 0000000000000001 R12: ffff88022ea0c800 R13: ffff88022ea0cdf8 R14: ffff8802353ecb40 R15: ffffffff81cc7800 FS: 00007f5720a10740(0000) GS:ffff880244c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000005862000 CR3: 000000022843c000 CR4: 00000000001407e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000600 Stack: ffff88013deb6dec 000000000000002c 00000000000000c0 ffffffff81a3f6e4 ffff8801e6431e18 ffffffff8159a9aa ffff8801e6431e90 ffffffff816765f6 ffffffff810b756b 0000000700000002 ffff8801e6431e40 0000fea9292aa8c0 Call Trace: [<ffffffff8159a9aa>] skb_push+0x3a/0x40 [<ffffffff816765f6>] ip6_push_pending_frames+0x1f6/0x4d0 [<ffffffff810b756b>] ? mark_held_locks+0xbb/0x140 [<ffffffff81694919>] udp_v6_push_pending_frames+0x2b9/0x3d0 [<ffffffff81694660>] ? udplite_getfrag+0x20/0x20 [<ffffffff8162092a>] udp_lib_setsockopt+0x1aa/0x1f0 [<ffffffff811cc5e7>] ? fget_light+0x387/0x4f0 [<ffffffff816958a4>] udpv6_setsockopt+0x34/0x40 [<ffffffff815949f4>] sock_common_setsockopt+0x14/0x20 [<ffffffff81593c31>] SyS_setsockopt+0x71/0xd0 [<ffffffff816f5d54>] tracesys+0xdd/0xe2 Code: 00 00 48 89 44 24 10 8b 87 d8 00 00 00 48 89 44 24 08 48 8b 87 e8 00 00 00 48 c7 c7 c0 04 aa 81 48 89 04 24 31 c0 e8 e1 7e ff ff <0f> 0b 55 48 89 e5 0f 0b 55 48 89 e5 0f 0b 55 48 89 e5 0f 0b 55 RIP [<ffffffff816e759c>] skb_panic+0x63/0x65 RSP <ffff8801e6431de8> This patch adds a check if the pending data is of address family AF_INET and directly calls udp_push_ending_frames from udp_v6_push_pending_frames if that is the case. This bug was found by Dave Jones with trinity. (Also move the initialization of fl6 below the AF_INET check, even if not strictly necessary.) Cc: Dave Jones <[email protected]> Cc: YOSHIFUJI Hideaki <[email protected]> Signed-off-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, size_t len) { struct ipv6_txoptions opt_space; struct udp_sock *up = udp_sk(sk); struct inet_sock *inet = inet_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk); struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) msg->msg_name; struct in6_addr *daddr, *final_p, final; struct ipv6_txoptions *opt = NULL; struct ip6_flowlabel *flowlabel = NULL; struct flowi6 fl6; struct dst_entry *dst; int addr_len = msg->msg_namelen; int ulen = len; int hlimit = -1; int tclass = -1; int dontfrag = -1; int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; int err; int connected = 0; int is_udplite = IS_UDPLITE(sk); int (*getfrag)(void *, char *, int, int, int, struct sk_buff *); /* destination address check */ if (sin6) { if (addr_len < offsetof(struct sockaddr, sa_data)) return -EINVAL; switch (sin6->sin6_family) { case AF_INET6: if (addr_len < SIN6_LEN_RFC2133) return -EINVAL; daddr = &sin6->sin6_addr; break; case AF_INET: goto do_udp_sendmsg; case AF_UNSPEC: msg->msg_name = sin6 = NULL; msg->msg_namelen = addr_len = 0; daddr = NULL; break; default: return -EINVAL; } } else if (!up->pending) { if (sk->sk_state != TCP_ESTABLISHED) return -EDESTADDRREQ; daddr = &np->daddr; } else daddr = NULL; if (daddr) { if (ipv6_addr_v4mapped(daddr)) { struct sockaddr_in sin; sin.sin_family = AF_INET; sin.sin_port = sin6 ? sin6->sin6_port : inet->inet_dport; sin.sin_addr.s_addr = daddr->s6_addr32[3]; msg->msg_name = &sin; msg->msg_namelen = sizeof(sin); do_udp_sendmsg: if (__ipv6_only_sock(sk)) return -ENETUNREACH; return udp_sendmsg(iocb, sk, msg, len); } } if (up->pending == AF_INET) return udp_sendmsg(iocb, sk, msg, len); /* Rough check on arithmetic overflow, better check is made in ip6_append_data(). */ if (len > INT_MAX - sizeof(struct udphdr)) return -EMSGSIZE; if (up->pending) { /* * There are pending frames. * The socket lock must be held while it's corked. */ lock_sock(sk); if (likely(up->pending)) { if (unlikely(up->pending != AF_INET6)) { release_sock(sk); return -EAFNOSUPPORT; } dst = NULL; goto do_append_data; } release_sock(sk); } ulen += sizeof(struct udphdr); memset(&fl6, 0, sizeof(fl6)); if (sin6) { if (sin6->sin6_port == 0) return -EINVAL; fl6.fl6_dport = sin6->sin6_port; daddr = &sin6->sin6_addr; if (np->sndflow) { fl6.flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK; if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) { flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); if (flowlabel == NULL) return -EINVAL; daddr = &flowlabel->dst; } } /* * Otherwise it will be difficult to maintain * sk->sk_dst_cache. */ if (sk->sk_state == TCP_ESTABLISHED && ipv6_addr_equal(daddr, &np->daddr)) daddr = &np->daddr; if (addr_len >= sizeof(struct sockaddr_in6) && sin6->sin6_scope_id && __ipv6_addr_needs_scope_id(__ipv6_addr_type(daddr))) fl6.flowi6_oif = sin6->sin6_scope_id; } else { if (sk->sk_state != TCP_ESTABLISHED) return -EDESTADDRREQ; fl6.fl6_dport = inet->inet_dport; daddr = &np->daddr; fl6.flowlabel = np->flow_label; connected = 1; } if (!fl6.flowi6_oif) fl6.flowi6_oif = sk->sk_bound_dev_if; if (!fl6.flowi6_oif) fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; fl6.flowi6_mark = sk->sk_mark; if (msg->msg_controllen) { opt = &opt_space; memset(opt, 0, sizeof(struct ipv6_txoptions)); opt->tot_len = sizeof(*opt); err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, &hlimit, &tclass, &dontfrag); if (err < 0) { fl6_sock_release(flowlabel); return err; } if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) { flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); if (flowlabel == NULL) return -EINVAL; } if (!(opt->opt_nflen|opt->opt_flen)) opt = NULL; connected = 0; } if (opt == NULL) opt = np->opt; if (flowlabel) opt = fl6_merge_options(&opt_space, flowlabel, opt); opt = ipv6_fixup_options(&opt_space, opt); fl6.flowi6_proto = sk->sk_protocol; if (!ipv6_addr_any(daddr)) fl6.daddr = *daddr; else fl6.daddr.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */ if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr)) fl6.saddr = np->saddr; fl6.fl6_sport = inet->inet_sport; final_p = fl6_update_dst(&fl6, opt, &final); if (final_p) connected = 0; if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) { fl6.flowi6_oif = np->mcast_oif; connected = 0; } else if (!fl6.flowi6_oif) fl6.flowi6_oif = np->ucast_oif; security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); dst = ip6_sk_dst_lookup_flow(sk, &fl6, final_p, true); if (IS_ERR(dst)) { err = PTR_ERR(dst); dst = NULL; goto out; } if (hlimit < 0) { if (ipv6_addr_is_multicast(&fl6.daddr)) hlimit = np->mcast_hops; else hlimit = np->hop_limit; if (hlimit < 0) hlimit = ip6_dst_hoplimit(dst); } if (tclass < 0) tclass = np->tclass; if (dontfrag < 0) dontfrag = np->dontfrag; if (msg->msg_flags&MSG_CONFIRM) goto do_confirm; back_from_confirm: lock_sock(sk); if (unlikely(up->pending)) { /* The socket is already corked while preparing it. */ /* ... which is an evident application bug. --ANK */ release_sock(sk); LIMIT_NETDEBUG(KERN_DEBUG "udp cork app bug 2\n"); err = -EINVAL; goto out; } up->pending = AF_INET6; do_append_data: up->len += ulen; getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag; err = ip6_append_data(sk, getfrag, msg->msg_iov, ulen, sizeof(struct udphdr), hlimit, tclass, opt, &fl6, (struct rt6_info*)dst, corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags, dontfrag); if (err) udp_v6_flush_pending_frames(sk); else if (!corkreq) err = udp_v6_push_pending_frames(sk); else if (unlikely(skb_queue_empty(&sk->sk_write_queue))) up->pending = 0; if (dst) { if (connected) { ip6_dst_store(sk, dst, ipv6_addr_equal(&fl6.daddr, &np->daddr) ? &np->daddr : NULL, #ifdef CONFIG_IPV6_SUBTREES ipv6_addr_equal(&fl6.saddr, &np->saddr) ? &np->saddr : #endif NULL); } else { dst_release(dst); } dst = NULL; } if (err > 0) err = np->recverr ? net_xmit_errno(err) : 0; release_sock(sk); out: dst_release(dst); fl6_sock_release(flowlabel); if (!err) return len; /* * ENOBUFS = no kernel mem, SOCK_NOSPACE = no sndbuf space. Reporting * ENOBUFS might not be good (it's not tunable per se), but otherwise * we don't have a good statistic (IpOutDiscards but it can be too many * things). We could add another new stat but at least for now that * seems like overkill. */ if (err == -ENOBUFS || test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) { UDP6_INC_STATS_USER(sock_net(sk), UDP_MIB_SNDBUFERRORS, is_udplite); } return err; do_confirm: dst_confirm(dst); if (!(msg->msg_flags&MSG_PROBE) || len) goto back_from_confirm; err = 0; goto out; }
int udpv6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, size_t len) { struct ipv6_txoptions opt_space; struct udp_sock *up = udp_sk(sk); struct inet_sock *inet = inet_sk(sk); struct ipv6_pinfo *np = inet6_sk(sk); struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) msg->msg_name; struct in6_addr *daddr, *final_p, final; struct ipv6_txoptions *opt = NULL; struct ip6_flowlabel *flowlabel = NULL; struct flowi6 fl6; struct dst_entry *dst; int addr_len = msg->msg_namelen; int ulen = len; int hlimit = -1; int tclass = -1; int dontfrag = -1; int corkreq = up->corkflag || msg->msg_flags&MSG_MORE; int err; int connected = 0; int is_udplite = IS_UDPLITE(sk); int (*getfrag)(void *, char *, int, int, int, struct sk_buff *); /* destination address check */ if (sin6) { if (addr_len < offsetof(struct sockaddr, sa_data)) return -EINVAL; switch (sin6->sin6_family) { case AF_INET6: if (addr_len < SIN6_LEN_RFC2133) return -EINVAL; daddr = &sin6->sin6_addr; break; case AF_INET: goto do_udp_sendmsg; case AF_UNSPEC: msg->msg_name = sin6 = NULL; msg->msg_namelen = addr_len = 0; daddr = NULL; break; default: return -EINVAL; } } else if (!up->pending) { if (sk->sk_state != TCP_ESTABLISHED) return -EDESTADDRREQ; daddr = &np->daddr; } else daddr = NULL; if (daddr) { if (ipv6_addr_v4mapped(daddr)) { struct sockaddr_in sin; sin.sin_family = AF_INET; sin.sin_port = sin6 ? sin6->sin6_port : inet->inet_dport; sin.sin_addr.s_addr = daddr->s6_addr32[3]; msg->msg_name = &sin; msg->msg_namelen = sizeof(sin); do_udp_sendmsg: if (__ipv6_only_sock(sk)) return -ENETUNREACH; return udp_sendmsg(iocb, sk, msg, len); } } if (up->pending == AF_INET) return udp_sendmsg(iocb, sk, msg, len); /* Rough check on arithmetic overflow, better check is made in ip6_append_data(). */ if (len > INT_MAX - sizeof(struct udphdr)) return -EMSGSIZE; if (up->pending) { /* * There are pending frames. * The socket lock must be held while it's corked. */ lock_sock(sk); if (likely(up->pending)) { if (unlikely(up->pending != AF_INET6)) { release_sock(sk); return -EAFNOSUPPORT; } dst = NULL; goto do_append_data; } release_sock(sk); } ulen += sizeof(struct udphdr); memset(&fl6, 0, sizeof(fl6)); if (sin6) { if (sin6->sin6_port == 0) return -EINVAL; fl6.fl6_dport = sin6->sin6_port; daddr = &sin6->sin6_addr; if (np->sndflow) { fl6.flowlabel = sin6->sin6_flowinfo&IPV6_FLOWINFO_MASK; if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) { flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); if (flowlabel == NULL) return -EINVAL; daddr = &flowlabel->dst; } } /* * Otherwise it will be difficult to maintain * sk->sk_dst_cache. */ if (sk->sk_state == TCP_ESTABLISHED && ipv6_addr_equal(daddr, &np->daddr)) daddr = &np->daddr; if (addr_len >= sizeof(struct sockaddr_in6) && sin6->sin6_scope_id && __ipv6_addr_needs_scope_id(__ipv6_addr_type(daddr))) fl6.flowi6_oif = sin6->sin6_scope_id; } else { if (sk->sk_state != TCP_ESTABLISHED) return -EDESTADDRREQ; fl6.fl6_dport = inet->inet_dport; daddr = &np->daddr; fl6.flowlabel = np->flow_label; connected = 1; } if (!fl6.flowi6_oif) fl6.flowi6_oif = sk->sk_bound_dev_if; if (!fl6.flowi6_oif) fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; fl6.flowi6_mark = sk->sk_mark; if (msg->msg_controllen) { opt = &opt_space; memset(opt, 0, sizeof(struct ipv6_txoptions)); opt->tot_len = sizeof(*opt); err = ip6_datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, &hlimit, &tclass, &dontfrag); if (err < 0) { fl6_sock_release(flowlabel); return err; } if ((fl6.flowlabel&IPV6_FLOWLABEL_MASK) && !flowlabel) { flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); if (flowlabel == NULL) return -EINVAL; } if (!(opt->opt_nflen|opt->opt_flen)) opt = NULL; connected = 0; } if (opt == NULL) opt = np->opt; if (flowlabel) opt = fl6_merge_options(&opt_space, flowlabel, opt); opt = ipv6_fixup_options(&opt_space, opt); fl6.flowi6_proto = sk->sk_protocol; if (!ipv6_addr_any(daddr)) fl6.daddr = *daddr; else fl6.daddr.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */ if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr)) fl6.saddr = np->saddr; fl6.fl6_sport = inet->inet_sport; final_p = fl6_update_dst(&fl6, opt, &final); if (final_p) connected = 0; if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) { fl6.flowi6_oif = np->mcast_oif; connected = 0; } else if (!fl6.flowi6_oif) fl6.flowi6_oif = np->ucast_oif; security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); dst = ip6_sk_dst_lookup_flow(sk, &fl6, final_p, true); if (IS_ERR(dst)) { err = PTR_ERR(dst); dst = NULL; goto out; } if (hlimit < 0) { if (ipv6_addr_is_multicast(&fl6.daddr)) hlimit = np->mcast_hops; else hlimit = np->hop_limit; if (hlimit < 0) hlimit = ip6_dst_hoplimit(dst); } if (tclass < 0) tclass = np->tclass; if (dontfrag < 0) dontfrag = np->dontfrag; if (msg->msg_flags&MSG_CONFIRM) goto do_confirm; back_from_confirm: lock_sock(sk); if (unlikely(up->pending)) { /* The socket is already corked while preparing it. */ /* ... which is an evident application bug. --ANK */ release_sock(sk); LIMIT_NETDEBUG(KERN_DEBUG "udp cork app bug 2\n"); err = -EINVAL; goto out; } up->pending = AF_INET6; do_append_data: up->len += ulen; getfrag = is_udplite ? udplite_getfrag : ip_generic_getfrag; err = ip6_append_data(sk, getfrag, msg->msg_iov, ulen, sizeof(struct udphdr), hlimit, tclass, opt, &fl6, (struct rt6_info*)dst, corkreq ? msg->msg_flags|MSG_MORE : msg->msg_flags, dontfrag); if (err) udp_v6_flush_pending_frames(sk); else if (!corkreq) err = udp_v6_push_pending_frames(sk); else if (unlikely(skb_queue_empty(&sk->sk_write_queue))) up->pending = 0; if (dst) { if (connected) { ip6_dst_store(sk, dst, ipv6_addr_equal(&fl6.daddr, &np->daddr) ? &np->daddr : NULL, #ifdef CONFIG_IPV6_SUBTREES ipv6_addr_equal(&fl6.saddr, &np->saddr) ? &np->saddr : #endif NULL); } else { dst_release(dst); } dst = NULL; } if (err > 0) err = np->recverr ? net_xmit_errno(err) : 0; release_sock(sk); out: dst_release(dst); fl6_sock_release(flowlabel); if (!err) return len; /* * ENOBUFS = no kernel mem, SOCK_NOSPACE = no sndbuf space. Reporting * ENOBUFS might not be good (it's not tunable per se), but otherwise * we don't have a good statistic (IpOutDiscards but it can be too many * things). We could add another new stat but at least for now that * seems like overkill. */ if (err == -ENOBUFS || test_bit(SOCK_NOSPACE, &sk->sk_socket->flags)) { UDP6_INC_STATS_USER(sock_net(sk), UDP_MIB_SNDBUFERRORS, is_udplite); } return err; do_confirm: dst_confirm(dst); if (!(msg->msg_flags&MSG_PROBE) || len) goto back_from_confirm; err = 0; goto out; }
C
linux
0
CVE-2018-6085
https://www.cvedetails.com/cve/CVE-2018-6085/
CWE-20
https://github.com/chromium/chromium/commit/df5b1e1f88e013bc96107cc52c4a4f33a8238444
df5b1e1f88e013bc96107cc52c4a4f33a8238444
Blockfile cache: fix long-standing sparse + evict reentrancy problem Thanks to nedwilliamson@ (on gmail) for an alternative perspective plus a reduction to make fixing this much easier. Bug: 826626, 518908, 537063, 802886 Change-Id: Ibfa01416f9a8e7f7b361e4f93b4b6b134728b85f Reviewed-on: https://chromium-review.googlesource.com/985052 Reviewed-by: Matt Menke <[email protected]> Commit-Queue: Maks Orlovich <[email protected]> Cr-Commit-Position: refs/heads/master@{#547103}
BackendIO::BackendIO(InFlightIO* controller, BackendImpl* backend, const net::CompletionCallback& callback) : BackgroundIO(controller), backend_(backend), callback_(callback), operation_(OP_NONE), entry_ptr_(NULL), iterator_(NULL), entry_(NULL), index_(0), offset_(0), buf_len_(0), truncate_(false), offset64_(0), start_(NULL) { start_time_ = base::TimeTicks::Now(); }
BackendIO::BackendIO(InFlightIO* controller, BackendImpl* backend, const net::CompletionCallback& callback) : BackgroundIO(controller), backend_(backend), callback_(callback), operation_(OP_NONE), entry_ptr_(NULL), iterator_(NULL), entry_(NULL), index_(0), offset_(0), buf_len_(0), truncate_(false), offset64_(0), start_(NULL) { start_time_ = base::TimeTicks::Now(); }
C
Chrome
0
CVE-2018-17206
https://www.cvedetails.com/cve/CVE-2018-17206/
null
https://github.com/openvswitch/ovs/commit/9237a63c47bd314b807cda0bd2216264e82edbe8
9237a63c47bd314b807cda0bd2216264e82edbe8
ofp-actions: Avoid buffer overread in BUNDLE action decoding. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9052 Signed-off-by: Ben Pfaff <[email protected]> Acked-by: Justin Pettit <[email protected]>
parse_NOTE(const char *arg, struct ofpbuf *ofpacts, enum ofputil_protocol *usable_protocols OVS_UNUSED) { size_t start_ofs = ofpacts->size; ofpact_put_NOTE(ofpacts); arg = ofpbuf_put_hex(ofpacts, arg, NULL); if (arg[0]) { return xstrdup("bad hex digit in `note' argument"); } struct ofpact_note *note = ofpbuf_at_assert(ofpacts, start_ofs, sizeof *note); note->length = ofpacts->size - (start_ofs + sizeof *note); ofpact_finish_NOTE(ofpacts, &note); return NULL; }
parse_NOTE(const char *arg, struct ofpbuf *ofpacts, enum ofputil_protocol *usable_protocols OVS_UNUSED) { size_t start_ofs = ofpacts->size; ofpact_put_NOTE(ofpacts); arg = ofpbuf_put_hex(ofpacts, arg, NULL); if (arg[0]) { return xstrdup("bad hex digit in `note' argument"); } struct ofpact_note *note = ofpbuf_at_assert(ofpacts, start_ofs, sizeof *note); note->length = ofpacts->size - (start_ofs + sizeof *note); ofpact_finish_NOTE(ofpacts, &note); return NULL; }
C
ovs
0
null
null
null
https://github.com/chromium/chromium/commit/6a13a6c2fbae0b3269743e6a141fdfe0d9ec9793
6a13a6c2fbae0b3269743e6a141fdfe0d9ec9793
Don't delete the current NavigationEntry when leaving an interstitial page. BUG=107182 TEST=See bug Review URL: http://codereview.chromium.org/8976014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115189 0039d316-1c4b-4281-b951-d872f2087c98
explicit TestTabContentsDelegate() : navigation_state_change_count_(0) {}
explicit TestTabContentsDelegate() : navigation_state_change_count_(0) {}
C
Chrome
0
CVE-2015-1274
https://www.cvedetails.com/cve/CVE-2015-1274/
CWE-254
https://github.com/chromium/chromium/commit/d27468a832d5316884bd02f459cbf493697fd7e1
d27468a832d5316884bd02f459cbf493697fd7e1
Switch to equalIgnoringASCIICase throughout modules/accessibility BUG=627682 Review-Url: https://codereview.chromium.org/2793913007 Cr-Commit-Position: refs/heads/master@{#461858}
bool AXNodeObject::isNativeCheckboxInMixedState() const { if (!isHTMLInputElement(m_node)) return false; HTMLInputElement* input = toHTMLInputElement(m_node); return input->type() == InputTypeNames::checkbox && input->shouldAppearIndeterminate(); }
bool AXNodeObject::isNativeCheckboxInMixedState() const { if (!isHTMLInputElement(m_node)) return false; HTMLInputElement* input = toHTMLInputElement(m_node); return input->type() == InputTypeNames::checkbox && input->shouldAppearIndeterminate(); }
C
Chrome
0
CVE-2012-2880
https://www.cvedetails.com/cve/CVE-2012-2880/
CWE-362
https://github.com/chromium/chromium/commit/fcd3a7a671ecf2d5f46ea34787d27507a914d2f5
fcd3a7a671ecf2d5f46ea34787d27507a914d2f5
[Sync] Cleanup all tab sync enabling logic now that its on by default. BUG=none TEST= Review URL: https://chromiumcodereview.appspot.com/10443046 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@139462 0039d316-1c4b-4281-b951-d872f2087c98
void SyncManager::SyncInternal::RequestNudgeForDataTypes( const tracked_objects::Location& nudge_location, ModelTypeSet types) { if (!scheduler()) { NOTREACHED(); return; } debug_info_event_listener_.OnNudgeFromDatatype(types.First().Get()); base::TimeDelta nudge_delay = NudgeStrategy::GetNudgeDelayTimeDelta( types.First().Get(), this); scheduler()->ScheduleNudge(nudge_delay, browser_sync::NUDGE_SOURCE_LOCAL, types, nudge_location); }
void SyncManager::SyncInternal::RequestNudgeForDataTypes( const tracked_objects::Location& nudge_location, ModelTypeSet types) { if (!scheduler()) { NOTREACHED(); return; } debug_info_event_listener_.OnNudgeFromDatatype(types.First().Get()); base::TimeDelta nudge_delay = NudgeStrategy::GetNudgeDelayTimeDelta( types.First().Get(), this); scheduler()->ScheduleNudge(nudge_delay, browser_sync::NUDGE_SOURCE_LOCAL, types, nudge_location); }
C
Chrome
0
null
null
null
https://github.com/chromium/chromium/commit/1161a49d663dd395bd639549c2dfe7324f847938
1161a49d663dd395bd639549c2dfe7324f847938
Don't populate URL data in WebDropData when dragging files. This is considered a potential security issue as well, since it leaks filesystem paths. BUG=332579 Review URL: https://codereview.chromium.org/135633002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244538 0039d316-1c4b-4281-b951-d872f2087c98
void WebContentsViewAura::ShowContextMenu(const ContextMenuParams& params) { if (touch_editable_) touch_editable_->EndTouchEditing(); if (delegate_) { delegate_->ShowContextMenu(params); } }
void WebContentsViewAura::ShowContextMenu(const ContextMenuParams& params) { if (touch_editable_) touch_editable_->EndTouchEditing(); if (delegate_) { delegate_->ShowContextMenu(params); } }
C
Chrome
0
CVE-2015-5296
https://www.cvedetails.com/cve/CVE-2015-5296/
CWE-20
https://git.samba.org/?p=samba.git;a=commit;h=a819d2b440aafa3138d95ff6e8b824da885a70e9
a819d2b440aafa3138d95ff6e8b824da885a70e9
null
struct smbXcli_session *smbXcli_session_create(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn) { struct smbXcli_session *session; session = talloc_zero(mem_ctx, struct smbXcli_session); if (session == NULL) { return NULL; } session->smb2 = talloc_zero(session, struct smb2cli_session); if (session->smb2 == NULL) { talloc_free(session); return NULL; } talloc_set_destructor(session, smbXcli_session_destructor); DLIST_ADD_END(conn->sessions, session, struct smbXcli_session *); session->conn = conn; memcpy(session->smb2_channel.preauth_sha512, conn->smb2.preauth_sha512, sizeof(session->smb2_channel.preauth_sha512)); return session; }
struct smbXcli_session *smbXcli_session_create(TALLOC_CTX *mem_ctx, struct smbXcli_conn *conn) { struct smbXcli_session *session; session = talloc_zero(mem_ctx, struct smbXcli_session); if (session == NULL) { return NULL; } session->smb2 = talloc_zero(session, struct smb2cli_session); if (session->smb2 == NULL) { talloc_free(session); return NULL; } talloc_set_destructor(session, smbXcli_session_destructor); DLIST_ADD_END(conn->sessions, session, struct smbXcli_session *); session->conn = conn; memcpy(session->smb2_channel.preauth_sha512, conn->smb2.preauth_sha512, sizeof(session->smb2_channel.preauth_sha512)); return session; }
C
samba
0
CVE-2011-2350
https://www.cvedetails.com/cve/CVE-2011-2350/
CWE-20
https://github.com/chromium/chromium/commit/b944f670bb7a8a919daac497a4ea0536c954c201
b944f670bb7a8a919daac497a4ea0536c954c201
[JSC] Implement a helper method createNotEnoughArgumentsError() https://bugs.webkit.org/show_bug.cgi?id=85102 Reviewed by Geoffrey Garen. In bug 84787, kbr@ requested to avoid hard-coding createTypeError(exec, "Not enough arguments") here and there. This patch implements createNotEnoughArgumentsError(exec) and uses it in JSC bindings. c.f. a corresponding bug for V8 bindings is bug 85097. Source/JavaScriptCore: * runtime/Error.cpp: (JSC::createNotEnoughArgumentsError): (JSC): * runtime/Error.h: (JSC): Source/WebCore: Test: bindings/scripts/test/TestObj.idl * bindings/scripts/CodeGeneratorJS.pm: Modified as described above. (GenerateArgumentsCountCheck): * bindings/js/JSDataViewCustom.cpp: Ditto. (WebCore::getDataViewMember): (WebCore::setDataViewMember): * bindings/js/JSDeprecatedPeerConnectionCustom.cpp: (WebCore::JSDeprecatedPeerConnectionConstructor::constructJSDeprecatedPeerConnection): * bindings/js/JSDirectoryEntryCustom.cpp: (WebCore::JSDirectoryEntry::getFile): (WebCore::JSDirectoryEntry::getDirectory): * bindings/js/JSSharedWorkerCustom.cpp: (WebCore::JSSharedWorkerConstructor::constructJSSharedWorker): * bindings/js/JSWebKitMutationObserverCustom.cpp: (WebCore::JSWebKitMutationObserverConstructor::constructJSWebKitMutationObserver): (WebCore::JSWebKitMutationObserver::observe): * bindings/js/JSWorkerCustom.cpp: (WebCore::JSWorkerConstructor::constructJSWorker): * bindings/scripts/test/JS/JSFloat64Array.cpp: Updated run-bindings-tests. (WebCore::jsFloat64ArrayPrototypeFunctionFoo): * bindings/scripts/test/JS/JSTestActiveDOMObject.cpp: (WebCore::jsTestActiveDOMObjectPrototypeFunctionExcitingFunction): (WebCore::jsTestActiveDOMObjectPrototypeFunctionPostMessage): * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp: (WebCore::jsTestCustomNamedGetterPrototypeFunctionAnotherFunction): * bindings/scripts/test/JS/JSTestEventTarget.cpp: (WebCore::jsTestEventTargetPrototypeFunctionItem): (WebCore::jsTestEventTargetPrototypeFunctionAddEventListener): (WebCore::jsTestEventTargetPrototypeFunctionRemoveEventListener): (WebCore::jsTestEventTargetPrototypeFunctionDispatchEvent): * bindings/scripts/test/JS/JSTestInterface.cpp: (WebCore::JSTestInterfaceConstructor::constructJSTestInterface): (WebCore::jsTestInterfacePrototypeFunctionSupplementalMethod2): * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: (WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod): * bindings/scripts/test/JS/JSTestNamedConstructor.cpp: (WebCore::JSTestNamedConstructorNamedConstructor::constructJSTestNamedConstructor): * bindings/scripts/test/JS/JSTestObj.cpp: (WebCore::JSTestObjConstructor::constructJSTestObj): (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs): (WebCore::jsTestObjPrototypeFunctionMethodWithSequenceArg): (WebCore::jsTestObjPrototypeFunctionMethodReturningSequence): (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows): (WebCore::jsTestObjPrototypeFunctionSerializedValue): (WebCore::jsTestObjPrototypeFunctionIdbKey): (WebCore::jsTestObjPrototypeFunctionOptionsObject): (WebCore::jsTestObjPrototypeFunctionAddEventListener): (WebCore::jsTestObjPrototypeFunctionRemoveEventListener): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg): (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs): (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg): (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod5): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod6): (WebCore::jsTestObjPrototypeFunctionOverloadedMethod7): (WebCore::jsTestObjConstructorFunctionClassMethod2): (WebCore::jsTestObjConstructorFunctionOverloadedMethod11): (WebCore::jsTestObjConstructorFunctionOverloadedMethod12): (WebCore::jsTestObjPrototypeFunctionMethodWithUnsignedLongArray): (WebCore::jsTestObjPrototypeFunctionConvert1): (WebCore::jsTestObjPrototypeFunctionConvert2): (WebCore::jsTestObjPrototypeFunctionConvert3): (WebCore::jsTestObjPrototypeFunctionConvert4): (WebCore::jsTestObjPrototypeFunctionConvert5): (WebCore::jsTestObjPrototypeFunctionStrictFunction): * bindings/scripts/test/JS/JSTestSerializedScriptValueInterface.cpp: (WebCore::JSTestSerializedScriptValueInterfaceConstructor::constructJSTestSerializedScriptValueInterface): (WebCore::jsTestSerializedScriptValueInterfacePrototypeFunctionAcceptTransferList): git-svn-id: svn://svn.chromium.org/blink/trunk@115536 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void setJSTestObjUnsignedLongLongSequenceAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); impl->setUnsignedLongLongSequenceAttr(toNativeArray<unsigned long long>(exec, value)); }
void setJSTestObjUnsignedLongLongSequenceAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); impl->setUnsignedLongLongSequenceAttr(toNativeArray<unsigned long long>(exec, value)); }
C
Chrome
0
CVE-2016-1691
https://www.cvedetails.com/cve/CVE-2016-1691/
CWE-119
https://github.com/chromium/chromium/commit/e3aa8a56706c4abe208934d5c294f7b594b8b693
e3aa8a56706c4abe208934d5c294f7b594b8b693
Enforce the WebUsbAllowDevicesForUrls policy This change modifies UsbChooserContext to use the UsbAllowDevicesForUrls class to consider devices allowed by the WebUsbAllowDevicesForUrls policy. The WebUsbAllowDevicesForUrls policy overrides the other WebUSB policies. Unit tests are also added to ensure that the policy is being enforced correctly. The design document for this feature is found at: https://docs.google.com/document/d/1MPvsrWiVD_jAC8ELyk8njFpy6j1thfVU5aWT3TCWE8w Bug: 854329 Change-Id: I5f82e662ca9dc544da5918eae766b5535a31296b Reviewed-on: https://chromium-review.googlesource.com/c/1259289 Commit-Queue: Ovidio Henriquez <[email protected]> Reviewed-by: Reilly Grant <[email protected]> Reviewed-by: Julian Pastarmov <[email protected]> Cr-Commit-Position: refs/heads/master@{#597926}
void ComponentUpdaterPolicyTest::DisabledPolicy_GroupPolicySupported() { SetEnableComponentUpdates(false); UpdateComponent(MakeCrxComponent(true)); }
void ComponentUpdaterPolicyTest::DisabledPolicy_GroupPolicySupported() { SetEnableComponentUpdates(false); UpdateComponent(MakeCrxComponent(true)); }
C
Chrome
0
CVE-2011-3209
https://www.cvedetails.com/cve/CVE-2011-3209/
CWE-189
https://github.com/torvalds/linux/commit/f8bd2258e2d520dff28c855658bd24bdafb5102d
f8bd2258e2d520dff28c855658bd24bdafb5102d
remove div_long_long_rem x86 is the only arch right now, which provides an optimized for div_long_long_rem and it has the downside that one has to be very careful that the divide doesn't overflow. The API is a little akward, as the arguments for the unsigned divide are signed. The signed version also doesn't handle a negative divisor and produces worse code on 64bit archs. There is little incentive to keep this API alive, so this converts the few users to the new API. Signed-off-by: Roman Zippel <[email protected]> Cc: Ralf Baechle <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Thomas Gleixner <[email protected]> Cc: john stultz <[email protected]> Cc: Christoph Lameter <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx, cputime_t *newval, cputime_t *oldval) { union cpu_time_count now; struct list_head *head; BUG_ON(clock_idx == CPUCLOCK_SCHED); cpu_clock_sample_group_locked(clock_idx, tsk, &now); if (oldval) { if (!cputime_eq(*oldval, cputime_zero)) { if (cputime_le(*oldval, now.cpu)) { /* Just about to fire. */ *oldval = jiffies_to_cputime(1); } else { *oldval = cputime_sub(*oldval, now.cpu); } } if (cputime_eq(*newval, cputime_zero)) return; *newval = cputime_add(*newval, now.cpu); /* * If the RLIMIT_CPU timer will expire before the * ITIMER_PROF timer, we have nothing else to do. */ if (tsk->signal->rlim[RLIMIT_CPU].rlim_cur < cputime_to_secs(*newval)) return; } /* * Check whether there are any process timers already set to fire * before this one. If so, we don't have anything more to do. */ head = &tsk->signal->cpu_timers[clock_idx]; if (list_empty(head) || cputime_ge(list_first_entry(head, struct cpu_timer_list, entry)->expires.cpu, *newval)) { /* * Rejigger each thread's expiry time so that one will * notice before we hit the process-cumulative expiry time. */ union cpu_time_count expires = { .sched = 0 }; expires.cpu = *newval; process_timer_rebalance(tsk, clock_idx, expires, now); } }
void set_process_cpu_timer(struct task_struct *tsk, unsigned int clock_idx, cputime_t *newval, cputime_t *oldval) { union cpu_time_count now; struct list_head *head; BUG_ON(clock_idx == CPUCLOCK_SCHED); cpu_clock_sample_group_locked(clock_idx, tsk, &now); if (oldval) { if (!cputime_eq(*oldval, cputime_zero)) { if (cputime_le(*oldval, now.cpu)) { /* Just about to fire. */ *oldval = jiffies_to_cputime(1); } else { *oldval = cputime_sub(*oldval, now.cpu); } } if (cputime_eq(*newval, cputime_zero)) return; *newval = cputime_add(*newval, now.cpu); /* * If the RLIMIT_CPU timer will expire before the * ITIMER_PROF timer, we have nothing else to do. */ if (tsk->signal->rlim[RLIMIT_CPU].rlim_cur < cputime_to_secs(*newval)) return; } /* * Check whether there are any process timers already set to fire * before this one. If so, we don't have anything more to do. */ head = &tsk->signal->cpu_timers[clock_idx]; if (list_empty(head) || cputime_ge(list_first_entry(head, struct cpu_timer_list, entry)->expires.cpu, *newval)) { /* * Rejigger each thread's expiry time so that one will * notice before we hit the process-cumulative expiry time. */ union cpu_time_count expires = { .sched = 0 }; expires.cpu = *newval; process_timer_rebalance(tsk, clock_idx, expires, now); } }
C
linux
0
CVE-2016-3062
https://www.cvedetails.com/cve/CVE-2016-3062/
CWE-119
https://github.com/FFmpeg/FFmpeg/commit/689e59b7ffed34eba6159dcc78e87133862e3746
689e59b7ffed34eba6159dcc78e87133862e3746
mov: reset dref_count on realloc to keep values consistent. This fixes a potential crash. Signed-off-by: Michael Niedermayer <[email protected]>
static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, int flags) { MOVStreamContext *sc = st->priv_data; int sample, time_sample; int i; sample = av_index_search_timestamp(st, timestamp, flags); av_dlog(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample); if (sample < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp) sample = 0; if (sample < 0) /* not sure what to do */ return AVERROR_INVALIDDATA; sc->current_sample = sample; av_dlog(s, "stream %d, found sample %d\n", st->index, sc->current_sample); /* adjust ctts index */ if (sc->ctts_data) { time_sample = 0; for (i = 0; i < sc->ctts_count; i++) { int next = time_sample + sc->ctts_data[i].count; if (next > sc->current_sample) { sc->ctts_index = i; sc->ctts_sample = sc->current_sample - time_sample; break; } time_sample = next; } } return sample; }
static int mov_seek_stream(AVFormatContext *s, AVStream *st, int64_t timestamp, int flags) { MOVStreamContext *sc = st->priv_data; int sample, time_sample; int i; sample = av_index_search_timestamp(st, timestamp, flags); av_dlog(s, "stream %d, timestamp %"PRId64", sample %d\n", st->index, timestamp, sample); if (sample < 0 && st->nb_index_entries && timestamp < st->index_entries[0].timestamp) sample = 0; if (sample < 0) /* not sure what to do */ return AVERROR_INVALIDDATA; sc->current_sample = sample; av_dlog(s, "stream %d, found sample %d\n", st->index, sc->current_sample); /* adjust ctts index */ if (sc->ctts_data) { time_sample = 0; for (i = 0; i < sc->ctts_count; i++) { int next = time_sample + sc->ctts_data[i].count; if (next > sc->current_sample) { sc->ctts_index = i; sc->ctts_sample = sc->current_sample - time_sample; break; } time_sample = next; } } return sample; }
C
FFmpeg
0
CVE-2019-16347
https://www.cvedetails.com/cve/CVE-2019-16347/
CWE-119
https://github.com/miniupnp/ngiflib/commit/37d939a6f511d16d4c95678025c235fe62e6417a
37d939a6f511d16d4c95678025c235fe62e6417a
fix deinterlacing for small pictures fixes #12
int LoadGif(struct ngiflib_gif * g) { struct ngiflib_gce gce; u8 sign; u8 tmp; int i; if(!g) return -1; gce.gce_present = 0; if(g->nimg==0) { GetByteStr(g, g->signature, 6); g->signature[6] = '\0'; if( g->signature[0] != 'G' || g->signature[1] != 'I' || g->signature[2] != 'F' || g->signature[3] != '8') { return -1; } #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "%s\n", g->signature); #endif /* !defined(NGIFLIB_NO_FILE) */ g->width = GetWord(g); g->height = GetWord(g); /* allocate frame buffer */ #ifndef NGIFLIB_INDEXED_ONLY if((g->mode & NGIFLIB_MODE_INDEXED)==0) g->frbuff.p32 = ngiflib_malloc(4*(long)g->height*(long)g->width); else #endif /* NGIFLIB_INDEXED_ONLY */ g->frbuff.p8 = ngiflib_malloc((long)g->height*(long)g->width); tmp = GetByte(g);/* <Packed Fields> = Global Color Table Flag 1 Bit Color Resolution 3 Bits Sort Flag 1 Bit Size of Global Color Table 3 Bits */ g->colorresolution = ((tmp & 0x70) >> 4) + 1; g->sort_flag = (tmp & 8) >> 3; g->imgbits = (tmp & 7) + 1; /* Global Palette color resolution */ g->ncolors = 1 << g->imgbits; g->backgroundindex = GetByte(g); #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "%hux%hu %hhubits %hu couleurs bg=%hhu\n", g->width, g->height, g->imgbits, g->ncolors, g->backgroundindex); #endif /* NGIFLIB_INDEXED_ONLY */ g->pixaspectratio = GetByte(g); /* pixel aspect ratio (0 : unspecified) */ if(tmp&0x80) { /* la palette globale suit. */ g->palette = (struct ngiflib_rgb *)ngiflib_malloc(sizeof(struct ngiflib_rgb)*g->ncolors); for(i=0; i<g->ncolors; i++) { g->palette[i].r = GetByte(g); g->palette[i].g = GetByte(g); g->palette[i].b = GetByte(g); #if defined(DEBUG) && !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "%3d %02X %02X %02X\n", i, g->palette[i].r,g->palette[i].g,g->palette[i].b); #endif /* defined(DEBUG) && !defined(NGIFLIB_NO_FILE) */ } #ifdef NGIFLIB_ENABLE_CALLBACKS if(g->palette_cb) g->palette_cb(g, g->palette, g->ncolors); #endif /* NGIFLIB_ENABLE_CALLBACKS */ } else { g->palette = NULL; } g->netscape_loop_count = -1; } for(;;) { char appid_auth[11]; u8 id,size; int blockindex; sign = GetByte(g); /* signature du prochain bloc */ #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "BLOCK SIGNATURE 0x%02X '%c'\n", sign, (sign >= 32) ? sign : '.'); #endif /* NGIFLIB_INDEXED_ONLY */ switch(sign) { case 0x3B: /* END OF GIF */ return 0; case '!': /* Extension introducer 0x21 */ id = GetByte(g); blockindex = 0; #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "extension (id=0x%02hhx)\n", id); #endif /* NGIFLIB_NO_FILE */ while( (size = GetByte(g)) ) { u8 ext[256]; GetByteStr(g, ext, size); switch(id) { case 0xF9: /* Graphic Control Extension */ /* The scope of this extension is the first graphic * rendering block to follow. */ gce.gce_present = 1; gce.disposal_method = (ext[0] >> 2) & 7; gce.transparent_flag = ext[0] & 1; gce.user_input_flag = (ext[0] >> 1) & 1; gce.delay_time = ext[1] | (ext[2]<<8); gce.transparent_color = ext[3]; #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "disposal_method=%hhu delay_time=%hu (transp=%hhu)transparent_color=0x%02hhX\n", gce.disposal_method, gce.delay_time, gce.transparent_flag, gce.transparent_color); #endif /* NGIFLIB_INDEXED_ONLY */ /* this propably should be adjusted depending on the disposal_method * of the _previous_ image. */ if(gce.transparent_flag && ((g->nimg == 0) || gce.disposal_method == 2)) { FillGifBackGround(g); } break; case 0xFE: /* Comment Extension. */ #if !defined(NGIFLIB_NO_FILE) if(g->log) { if(blockindex==0) fprintf(g->log, "-------------------- Comment extension --------------------\n"); ext[size] = '\0'; fputs((char *)ext, g->log); } #endif /* NGIFLIB_NO_FILE */ break; case 0xFF: /* application extension */ /* NETSCAPE2.0 extension : * http://www.vurdalakov.net/misc/gif/netscape-looping-application-extension */ if(blockindex==0) { ngiflib_memcpy(appid_auth, ext, 11); #if !defined(NGIFLIB_NO_FILE) if(g->log) { fprintf(g->log, "---------------- Application extension ---------------\n"); fprintf(g->log, "Application identifier : '%.8s', auth code : %02X %02X %02X (", appid_auth, ext[8], ext[9], ext[10]); fputc((ext[8]<32)?' ':ext[8], g->log); fputc((ext[9]<32)?' ':ext[9], g->log); fputc((ext[10]<32)?' ':ext[10], g->log); fprintf(g->log, ")\n"); } #endif /* NGIFLIB_INDEXED_ONLY */ } else { #if !defined(NGIFLIB_NO_FILE) if(g->log) { fprintf(g->log, "Datas (as hex) : "); for(i=0; i<size; i++) { fprintf(g->log, "%02x ", ext[i]); } fprintf(g->log, "\nDatas (as text) : '"); for(i=0; i<size; i++) { putc((ext[i]<32)?' ':ext[i], g->log); } fprintf(g->log, "'\n"); } #endif /* NGIFLIB_INDEXED_ONLY */ if(0 == ngiflib_memcmp(appid_auth, "NETSCAPE2.0", 11)) { /* ext[0] : Sub-block ID */ if(ext[0] == 1) { /* 1 : Netscape Looping Extension. */ g->netscape_loop_count = (int)ext[1] | ((int)ext[2] << 8); #if !defined(NGIFLIB_NO_FILE) if(g->log) { fprintf(g->log, "NETSCAPE loop_count = %d\n", g->netscape_loop_count); } #endif /* NGIFLIB_NO_FILE */ } } } break; case 0x01: /* plain text extension */ #if !defined(NGIFLIB_NO_FILE) if(g->log) { fprintf(g->log, "Plain text extension blockindex=%d\n", blockindex); for(i=0; i<size; i++) { putc((ext[i]<32)?' ':ext[i], g->log); } putc('\n', g->log); } #endif /* NGIFLIB_INDEXED_ONLY */ break; } blockindex++; } switch(id) { case 0x01: /* plain text extension */ case 0xFE: /* Comment Extension. */ case 0xFF: /* application extension */ #if !defined(NGIFLIB_NO_FILE) if(g->log) { fprintf(g->log, "-----------------------------------------------------------\n"); } #endif /* NGIFLIB_NO_FILE */ break; } break; case 0x2C: /* Image separator */ if(g->nimg==0) { g->cur_img = ngiflib_malloc(sizeof(struct ngiflib_img)); if(g->cur_img == NULL) return -2; /* memory error */ g->first_img = g->cur_img; } else { g->cur_img->next = ngiflib_malloc(sizeof(struct ngiflib_img)); if(g->cur_img->next == NULL) return -2; /* memory error */ g->cur_img = g->cur_img->next; } ngiflib_memset(g->cur_img, 0, sizeof(struct ngiflib_img)); g->cur_img->parent = g; if(gce.gce_present) { ngiflib_memcpy(&g->cur_img->gce, &gce, sizeof(struct ngiflib_gce)); } else { ngiflib_memset(&g->cur_img->gce, 0, sizeof(struct ngiflib_gce)); } if (DecodeGifImg(g->cur_img) < 0) return -1; g->nimg++; tmp = GetByte(g);/* 0 final */ #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "ZERO TERMINATOR 0x%02X\n", tmp); #endif /* NGIFLIB_INDEXED_ONLY */ return 1; /* image decode */ default: /* unexpected byte */ #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "unexpected signature 0x%02X\n", sign); #endif /* NGIFLIB_INDEXED_ONLY */ return -1; } } }
int LoadGif(struct ngiflib_gif * g) { struct ngiflib_gce gce; u8 sign; u8 tmp; int i; if(!g) return -1; gce.gce_present = 0; if(g->nimg==0) { GetByteStr(g, g->signature, 6); g->signature[6] = '\0'; if( g->signature[0] != 'G' || g->signature[1] != 'I' || g->signature[2] != 'F' || g->signature[3] != '8') { return -1; } #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "%s\n", g->signature); #endif /* !defined(NGIFLIB_NO_FILE) */ g->width = GetWord(g); g->height = GetWord(g); /* allocate frame buffer */ #ifndef NGIFLIB_INDEXED_ONLY if((g->mode & NGIFLIB_MODE_INDEXED)==0) g->frbuff.p32 = ngiflib_malloc(4*(long)g->height*(long)g->width); else #endif /* NGIFLIB_INDEXED_ONLY */ g->frbuff.p8 = ngiflib_malloc((long)g->height*(long)g->width); tmp = GetByte(g);/* <Packed Fields> = Global Color Table Flag 1 Bit Color Resolution 3 Bits Sort Flag 1 Bit Size of Global Color Table 3 Bits */ g->colorresolution = ((tmp & 0x70) >> 4) + 1; g->sort_flag = (tmp & 8) >> 3; g->imgbits = (tmp & 7) + 1; /* Global Palette color resolution */ g->ncolors = 1 << g->imgbits; g->backgroundindex = GetByte(g); #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "%hux%hu %hhubits %hu couleurs bg=%hhu\n", g->width, g->height, g->imgbits, g->ncolors, g->backgroundindex); #endif /* NGIFLIB_INDEXED_ONLY */ g->pixaspectratio = GetByte(g); /* pixel aspect ratio (0 : unspecified) */ if(tmp&0x80) { /* la palette globale suit. */ g->palette = (struct ngiflib_rgb *)ngiflib_malloc(sizeof(struct ngiflib_rgb)*g->ncolors); for(i=0; i<g->ncolors; i++) { g->palette[i].r = GetByte(g); g->palette[i].g = GetByte(g); g->palette[i].b = GetByte(g); #if defined(DEBUG) && !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "%3d %02X %02X %02X\n", i, g->palette[i].r,g->palette[i].g,g->palette[i].b); #endif /* defined(DEBUG) && !defined(NGIFLIB_NO_FILE) */ } #ifdef NGIFLIB_ENABLE_CALLBACKS if(g->palette_cb) g->palette_cb(g, g->palette, g->ncolors); #endif /* NGIFLIB_ENABLE_CALLBACKS */ } else { g->palette = NULL; } g->netscape_loop_count = -1; } for(;;) { char appid_auth[11]; u8 id,size; int blockindex; sign = GetByte(g); /* signature du prochain bloc */ #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "BLOCK SIGNATURE 0x%02X '%c'\n", sign, (sign >= 32) ? sign : '.'); #endif /* NGIFLIB_INDEXED_ONLY */ switch(sign) { case 0x3B: /* END OF GIF */ return 0; case '!': /* Extension introducer 0x21 */ id = GetByte(g); blockindex = 0; #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "extension (id=0x%02hhx)\n", id); #endif /* NGIFLIB_NO_FILE */ while( (size = GetByte(g)) ) { u8 ext[256]; GetByteStr(g, ext, size); switch(id) { case 0xF9: /* Graphic Control Extension */ /* The scope of this extension is the first graphic * rendering block to follow. */ gce.gce_present = 1; gce.disposal_method = (ext[0] >> 2) & 7; gce.transparent_flag = ext[0] & 1; gce.user_input_flag = (ext[0] >> 1) & 1; gce.delay_time = ext[1] | (ext[2]<<8); gce.transparent_color = ext[3]; #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "disposal_method=%hhu delay_time=%hu (transp=%hhu)transparent_color=0x%02hhX\n", gce.disposal_method, gce.delay_time, gce.transparent_flag, gce.transparent_color); #endif /* NGIFLIB_INDEXED_ONLY */ /* this propably should be adjusted depending on the disposal_method * of the _previous_ image. */ if(gce.transparent_flag && ((g->nimg == 0) || gce.disposal_method == 2)) { FillGifBackGround(g); } break; case 0xFE: /* Comment Extension. */ #if !defined(NGIFLIB_NO_FILE) if(g->log) { if(blockindex==0) fprintf(g->log, "-------------------- Comment extension --------------------\n"); ext[size] = '\0'; fputs((char *)ext, g->log); } #endif /* NGIFLIB_NO_FILE */ break; case 0xFF: /* application extension */ /* NETSCAPE2.0 extension : * http://www.vurdalakov.net/misc/gif/netscape-looping-application-extension */ if(blockindex==0) { ngiflib_memcpy(appid_auth, ext, 11); #if !defined(NGIFLIB_NO_FILE) if(g->log) { fprintf(g->log, "---------------- Application extension ---------------\n"); fprintf(g->log, "Application identifier : '%.8s', auth code : %02X %02X %02X (", appid_auth, ext[8], ext[9], ext[10]); fputc((ext[8]<32)?' ':ext[8], g->log); fputc((ext[9]<32)?' ':ext[9], g->log); fputc((ext[10]<32)?' ':ext[10], g->log); fprintf(g->log, ")\n"); } #endif /* NGIFLIB_INDEXED_ONLY */ } else { #if !defined(NGIFLIB_NO_FILE) if(g->log) { fprintf(g->log, "Datas (as hex) : "); for(i=0; i<size; i++) { fprintf(g->log, "%02x ", ext[i]); } fprintf(g->log, "\nDatas (as text) : '"); for(i=0; i<size; i++) { putc((ext[i]<32)?' ':ext[i], g->log); } fprintf(g->log, "'\n"); } #endif /* NGIFLIB_INDEXED_ONLY */ if(0 == ngiflib_memcmp(appid_auth, "NETSCAPE2.0", 11)) { /* ext[0] : Sub-block ID */ if(ext[0] == 1) { /* 1 : Netscape Looping Extension. */ g->netscape_loop_count = (int)ext[1] | ((int)ext[2] << 8); #if !defined(NGIFLIB_NO_FILE) if(g->log) { fprintf(g->log, "NETSCAPE loop_count = %d\n", g->netscape_loop_count); } #endif /* NGIFLIB_NO_FILE */ } } } break; case 0x01: /* plain text extension */ #if !defined(NGIFLIB_NO_FILE) if(g->log) { fprintf(g->log, "Plain text extension blockindex=%d\n", blockindex); for(i=0; i<size; i++) { putc((ext[i]<32)?' ':ext[i], g->log); } putc('\n', g->log); } #endif /* NGIFLIB_INDEXED_ONLY */ break; } blockindex++; } switch(id) { case 0x01: /* plain text extension */ case 0xFE: /* Comment Extension. */ case 0xFF: /* application extension */ #if !defined(NGIFLIB_NO_FILE) if(g->log) { fprintf(g->log, "-----------------------------------------------------------\n"); } #endif /* NGIFLIB_NO_FILE */ break; } break; case 0x2C: /* Image separator */ if(g->nimg==0) { g->cur_img = ngiflib_malloc(sizeof(struct ngiflib_img)); if(g->cur_img == NULL) return -2; /* memory error */ g->first_img = g->cur_img; } else { g->cur_img->next = ngiflib_malloc(sizeof(struct ngiflib_img)); if(g->cur_img->next == NULL) return -2; /* memory error */ g->cur_img = g->cur_img->next; } ngiflib_memset(g->cur_img, 0, sizeof(struct ngiflib_img)); g->cur_img->parent = g; if(gce.gce_present) { ngiflib_memcpy(&g->cur_img->gce, &gce, sizeof(struct ngiflib_gce)); } else { ngiflib_memset(&g->cur_img->gce, 0, sizeof(struct ngiflib_gce)); } if (DecodeGifImg(g->cur_img) < 0) return -1; g->nimg++; tmp = GetByte(g);/* 0 final */ #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "ZERO TERMINATOR 0x%02X\n", tmp); #endif /* NGIFLIB_INDEXED_ONLY */ return 1; /* image decode */ default: /* unexpected byte */ #if !defined(NGIFLIB_NO_FILE) if(g->log) fprintf(g->log, "unexpected signature 0x%02X\n", sign); #endif /* NGIFLIB_INDEXED_ONLY */ return -1; } } }
C
ngiflib
0
CVE-2016-5219
https://www.cvedetails.com/cve/CVE-2016-5219/
CWE-416
https://github.com/chromium/chromium/commit/a4150b688a754d3d10d2ca385155b1c95d77d6ae
a4150b688a754d3d10d2ca385155b1c95d77d6ae
Add GL_PROGRAM_COMPLETION_QUERY_CHROMIUM This makes the query of GL_COMPLETION_STATUS_KHR to programs much cheaper by minimizing the round-trip to the GPU thread. Bug: 881152, 957001 Change-Id: Iadfa798af29225e752c710ca5c25f50b3dd3101a Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1586630 Commit-Queue: Kenneth Russell <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Geoff Lang <[email protected]> Reviewed-by: Kenneth Russell <[email protected]> Cr-Commit-Position: refs/heads/master@{#657568}
void GLES2Implementation::MultiDrawElementsWEBGLHelper(GLenum mode, const GLsizei* counts, GLenum type, const GLsizei* offsets, GLsizei drawcount) { DCHECK_GT(drawcount, 0); uint32_t buffer_size = ComputeCombinedCopySize(drawcount, counts, offsets); ScopedTransferBufferPtr buffer(buffer_size, helper_, transfer_buffer_); helper_->MultiDrawBeginCHROMIUM(drawcount); auto DoMultiDraw = [&](const std::array<uint32_t, 2>& offsets, uint32_t, uint32_t copy_count) { helper_->MultiDrawElementsCHROMIUM( mode, buffer.shm_id(), buffer.offset() + offsets[0], type, buffer.shm_id(), buffer.offset() + offsets[1], copy_count); }; if (!TransferArraysAndExecute(drawcount, &buffer, DoMultiDraw, counts, offsets)) { SetGLError(GL_OUT_OF_MEMORY, "glMultiDrawElementsWEBGL", "out of memory"); } helper_->MultiDrawEndCHROMIUM(); }
void GLES2Implementation::MultiDrawElementsWEBGLHelper(GLenum mode, const GLsizei* counts, GLenum type, const GLsizei* offsets, GLsizei drawcount) { DCHECK_GT(drawcount, 0); uint32_t buffer_size = ComputeCombinedCopySize(drawcount, counts, offsets); ScopedTransferBufferPtr buffer(buffer_size, helper_, transfer_buffer_); helper_->MultiDrawBeginCHROMIUM(drawcount); auto DoMultiDraw = [&](const std::array<uint32_t, 2>& offsets, uint32_t, uint32_t copy_count) { helper_->MultiDrawElementsCHROMIUM( mode, buffer.shm_id(), buffer.offset() + offsets[0], type, buffer.shm_id(), buffer.offset() + offsets[1], copy_count); }; if (!TransferArraysAndExecute(drawcount, &buffer, DoMultiDraw, counts, offsets)) { SetGLError(GL_OUT_OF_MEMORY, "glMultiDrawElementsWEBGL", "out of memory"); } helper_->MultiDrawEndCHROMIUM(); }
C
Chrome
0
CVE-2013-1643
https://www.cvedetails.com/cve/CVE-2013-1643/
CWE-200
https://git.php.net/?p=php-src.git;a=commit;h=8e76d0404b7f664ee6719fd98f0483f0ac4669d6
8e76d0404b7f664ee6719fd98f0483f0ac4669d6
null
static int php_libxml_unregister_node(xmlNodePtr nodep TSRMLS_DC) { php_libxml_node_object *wrapper; php_libxml_node_ptr *nodeptr = nodep->_private; if (nodeptr != NULL) { wrapper = nodeptr->_private; if (wrapper) { php_libxml_clear_object(wrapper TSRMLS_CC); } else { if (nodeptr->node != NULL && nodeptr->node->type != XML_DOCUMENT_NODE) { nodeptr->node->_private = NULL; } nodeptr->node = NULL; } } return -1; }
static int php_libxml_unregister_node(xmlNodePtr nodep TSRMLS_DC) { php_libxml_node_object *wrapper; php_libxml_node_ptr *nodeptr = nodep->_private; if (nodeptr != NULL) { wrapper = nodeptr->_private; if (wrapper) { php_libxml_clear_object(wrapper TSRMLS_CC); } else { if (nodeptr->node != NULL && nodeptr->node->type != XML_DOCUMENT_NODE) { nodeptr->node->_private = NULL; } nodeptr->node = NULL; } } return -1; }
C
php
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 inline void *alloc_stateowner(struct kmem_cache *slab, struct xdr_netobj *owner, struct nfs4_client *clp) { struct nfs4_stateowner *sop; sop = kmem_cache_alloc(slab, GFP_KERNEL); if (!sop) return NULL; sop->so_owner.data = kmemdup(owner->data, owner->len, GFP_KERNEL); if (!sop->so_owner.data) { kmem_cache_free(slab, sop); return NULL; } sop->so_owner.len = owner->len; INIT_LIST_HEAD(&sop->so_stateids); sop->so_client = clp; init_nfs4_replay(&sop->so_replay); atomic_set(&sop->so_count, 1); return sop; }
static inline void *alloc_stateowner(struct kmem_cache *slab, struct xdr_netobj *owner, struct nfs4_client *clp) { struct nfs4_stateowner *sop; sop = kmem_cache_alloc(slab, GFP_KERNEL); if (!sop) return NULL; sop->so_owner.data = kmemdup(owner->data, owner->len, GFP_KERNEL); if (!sop->so_owner.data) { kmem_cache_free(slab, sop); return NULL; } sop->so_owner.len = owner->len; INIT_LIST_HEAD(&sop->so_stateids); sop->so_client = clp; init_nfs4_replay(&sop->so_replay); atomic_set(&sop->so_count, 1); return sop; }
C
linux
0
CVE-2017-16530
https://www.cvedetails.com/cve/CVE-2017-16530/
CWE-125
https://github.com/torvalds/linux/commit/786de92b3cb26012d3d0f00ee37adf14527f35c4
786de92b3cb26012d3d0f00ee37adf14527f35c4
USB: uas: fix bug in handling of alternate settings The uas driver has a subtle bug in the way it handles alternate settings. The uas_find_uas_alt_setting() routine returns an altsetting value (the bAlternateSetting number in the descriptor), but uas_use_uas_driver() then treats that value as an index to the intf->altsetting array, which it isn't. Normally this doesn't cause any problems because the various alternate settings have bAlternateSetting values 0, 1, 2, ..., so the value is equal to the index in the array. But this is not guaranteed, and Andrey Konovalov used the syzkaller fuzzer with KASAN to get a slab-out-of-bounds error by violating this assumption. This patch fixes the bug by making uas_find_uas_alt_setting() return a pointer to the altsetting entry rather than either the value or the index. Pointers are less subject to misinterpretation. Signed-off-by: Alan Stern <[email protected]> Reported-by: Andrey Konovalov <[email protected]> Tested-by: Andrey Konovalov <[email protected]> CC: Oliver Neukum <[email protected]> CC: <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
static int uas_switch_interface(struct usb_device *udev, struct usb_interface *intf) { struct usb_host_interface *alt; alt = uas_find_uas_alt_setting(intf); if (!alt) return -ENODEV; return usb_set_interface(udev, alt->desc.bInterfaceNumber, alt->desc.bAlternateSetting); }
static int uas_switch_interface(struct usb_device *udev, struct usb_interface *intf) { int alt; alt = uas_find_uas_alt_setting(intf); if (alt < 0) return alt; return usb_set_interface(udev, intf->altsetting[0].desc.bInterfaceNumber, alt); }
C
linux
1
null
null
null
https://github.com/chromium/chromium/commit/1161a49d663dd395bd639549c2dfe7324f847938
1161a49d663dd395bd639549c2dfe7324f847938
Don't populate URL data in WebDropData when dragging files. This is considered a potential security issue as well, since it leaks filesystem paths. BUG=332579 Review URL: https://codereview.chromium.org/135633002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@244538 0039d316-1c4b-4281-b951-d872f2087c98
void TabStrip::UpdateLayoutTypeFromMouseEvent(views::View* source, const ui::MouseEvent& event) { if (!GetAdjustLayout()) return; switch (event.type()) { case ui::ET_MOUSE_PRESSED: mouse_move_count_ = 0; last_mouse_move_time_ = base::TimeTicks(); SetResetToShrinkOnExit((event.flags() & ui::EF_FROM_TOUCH) == 0); if (reset_to_shrink_on_exit_ && touch_layout_.get()) { gfx::Point tab_strip_point(event.location()); views::View::ConvertPointToTarget(source, this, &tab_strip_point); Tab* tab = FindTabForEvent(tab_strip_point); if (tab && touch_layout_->IsStacked(GetModelIndexOfTab(tab))) { SetLayoutType(TAB_STRIP_LAYOUT_SHRINK, true); controller_->LayoutTypeMaybeChanged(); } } break; case ui::ET_MOUSE_MOVED: { #if defined(USE_ASH) SetResetToShrinkOnExit(true); #else gfx::Point location(event.location()); ConvertPointToTarget(source, this, &location); if (location == last_mouse_move_location_) return; // Ignore spurious moves. last_mouse_move_location_ = location; if ((event.flags() & ui::EF_FROM_TOUCH) == 0 && (event.flags() & ui::EF_IS_SYNTHESIZED) == 0) { if ((base::TimeTicks::Now() - last_mouse_move_time_).InMilliseconds() < kMouseMoveTimeMS) { if (mouse_move_count_++ == kMouseMoveCountBeforeConsiderReal) SetResetToShrinkOnExit(true); } else { mouse_move_count_ = 1; last_mouse_move_time_ = base::TimeTicks::Now(); } } else { last_mouse_move_time_ = base::TimeTicks(); } #endif break; } case ui::ET_MOUSE_RELEASED: { gfx::Point location(event.location()); ConvertPointToTarget(source, this, &location); last_mouse_move_location_ = location; mouse_move_count_ = 0; last_mouse_move_time_ = base::TimeTicks(); if ((event.flags() & ui::EF_FROM_TOUCH) == ui::EF_FROM_TOUCH) { SetLayoutType(TAB_STRIP_LAYOUT_STACKED, true); controller_->LayoutTypeMaybeChanged(); } break; } default: break; } }
void TabStrip::UpdateLayoutTypeFromMouseEvent(views::View* source, const ui::MouseEvent& event) { if (!GetAdjustLayout()) return; switch (event.type()) { case ui::ET_MOUSE_PRESSED: mouse_move_count_ = 0; last_mouse_move_time_ = base::TimeTicks(); SetResetToShrinkOnExit((event.flags() & ui::EF_FROM_TOUCH) == 0); if (reset_to_shrink_on_exit_ && touch_layout_.get()) { gfx::Point tab_strip_point(event.location()); views::View::ConvertPointToTarget(source, this, &tab_strip_point); Tab* tab = FindTabForEvent(tab_strip_point); if (tab && touch_layout_->IsStacked(GetModelIndexOfTab(tab))) { SetLayoutType(TAB_STRIP_LAYOUT_SHRINK, true); controller_->LayoutTypeMaybeChanged(); } } break; case ui::ET_MOUSE_MOVED: { #if defined(USE_ASH) SetResetToShrinkOnExit(true); #else gfx::Point location(event.location()); ConvertPointToTarget(source, this, &location); if (location == last_mouse_move_location_) return; // Ignore spurious moves. last_mouse_move_location_ = location; if ((event.flags() & ui::EF_FROM_TOUCH) == 0 && (event.flags() & ui::EF_IS_SYNTHESIZED) == 0) { if ((base::TimeTicks::Now() - last_mouse_move_time_).InMilliseconds() < kMouseMoveTimeMS) { if (mouse_move_count_++ == kMouseMoveCountBeforeConsiderReal) SetResetToShrinkOnExit(true); } else { mouse_move_count_ = 1; last_mouse_move_time_ = base::TimeTicks::Now(); } } else { last_mouse_move_time_ = base::TimeTicks(); } #endif break; } case ui::ET_MOUSE_RELEASED: { gfx::Point location(event.location()); ConvertPointToTarget(source, this, &location); last_mouse_move_location_ = location; mouse_move_count_ = 0; last_mouse_move_time_ = base::TimeTicks(); if ((event.flags() & ui::EF_FROM_TOUCH) == ui::EF_FROM_TOUCH) { SetLayoutType(TAB_STRIP_LAYOUT_STACKED, true); controller_->LayoutTypeMaybeChanged(); } break; } default: break; } }
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
void BrowserActionsContainer::AnimationEnded(const Animation* animation) { container_size_.set_width(animation_target_size_); animation_target_size_ = 0; resize_amount_ = 0; OnBrowserActionVisibilityChanged(); suppress_chevron_ = false; profile_->GetPrefs()->SetInteger(prefs::kBrowserActionContainerWidth, container_size_.width()); }
void BrowserActionsContainer::AnimationEnded(const Animation* animation) { container_size_.set_width(animation_target_size_); animation_target_size_ = 0; resize_amount_ = 0; OnBrowserActionVisibilityChanged(); suppress_chevron_ = false; profile_->GetPrefs()->SetInteger(prefs::kBrowserActionContainerWidth, container_size_.width()); }
C
Chrome
0
CVE-2012-2133
https://www.cvedetails.com/cve/CVE-2012-2133/
CWE-399
https://github.com/torvalds/linux/commit/90481622d75715bfcb68501280a917dbfe516029
90481622d75715bfcb68501280a917dbfe516029
hugepages: fix use after free bug in "quota" handling hugetlbfs_{get,put}_quota() are badly named. They don't interact with the general quota handling code, and they don't much resemble its behaviour. Rather than being about maintaining limits on on-disk block usage by particular users, they are instead about maintaining limits on in-memory page usage (including anonymous MAP_PRIVATE copied-on-write pages) associated with a particular hugetlbfs filesystem instance. Worse, they work by having callbacks to the hugetlbfs filesystem code from the low-level page handling code, in particular from free_huge_page(). This is a layering violation of itself, but more importantly, if the kernel does a get_user_pages() on hugepages (which can happen from KVM amongst others), then the free_huge_page() can be delayed until after the associated inode has already been freed. If an unmount occurs at the wrong time, even the hugetlbfs superblock where the "quota" limits are stored may have been freed. Andrew Barry proposed a patch to fix this by having hugepages, instead of storing a pointer to their address_space and reaching the superblock from there, had the hugepages store pointers directly to the superblock, bumping the reference count as appropriate to avoid it being freed. Andrew Morton rejected that version, however, on the grounds that it made the existing layering violation worse. This is a reworked version of Andrew's patch, which removes the extra, and some of the existing, layering violation. It works by introducing the concept of a hugepage "subpool" at the lower hugepage mm layer - that is a finite logical pool of hugepages to allocate from. hugetlbfs now creates a subpool for each filesystem instance with a page limit set, and a pointer to the subpool gets added to each allocated hugepage, instead of the address_space pointer used now. The subpool has its own lifetime and is only freed once all pages in it _and_ all other references to it (i.e. superblocks) are gone. subpools are optional - a NULL subpool pointer is taken by the code to mean that no subpool limits are in effect. Previous discussion of this bug found in: "Fix refcounting in hugetlbfs quota handling.". See: https://lkml.org/lkml/2011/8/11/28 or http://marc.info/?l=linux-mm&m=126928970510627&w=1 v2: Fixed a bug spotted by Hillf Danton, and removed the extra parameter to alloc_huge_page() - since it already takes the vma, it is not necessary. Signed-off-by: Andrew Barry <[email protected]> Signed-off-by: David Gibson <[email protected]> Cc: Hugh Dickins <[email protected]> Cc: Mel Gorman <[email protected]> Cc: Minchan Kim <[email protected]> Cc: Hillf Danton <[email protected]> Cc: Paul Mackerras <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
int hugetlb_get_quota(struct address_space *mapping, long delta)
int hugetlb_get_quota(struct address_space *mapping, long delta) { int ret = 0; struct hugetlbfs_sb_info *sbinfo = HUGETLBFS_SB(mapping->host->i_sb); if (sbinfo->free_blocks > -1) { spin_lock(&sbinfo->stat_lock); if (sbinfo->free_blocks - delta >= 0) sbinfo->free_blocks -= delta; else ret = -ENOMEM; spin_unlock(&sbinfo->stat_lock); } return ret; }
C
linux
1
CVE-2013-0838
https://www.cvedetails.com/cve/CVE-2013-0838/
CWE-264
https://github.com/chromium/chromium/commit/0bd1a6ddb5fb23dfea3e72d60e5e8df4cf5826bc
0bd1a6ddb5fb23dfea3e72d60e5e8df4cf5826bc
Make shared memory segments writable only by their rightful owners. BUG=143859 TEST=Chrome's UI still works on Linux and Chrome OS Review URL: https://chromiumcodereview.appspot.com/10854242 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158289 0039d316-1c4b-4281-b951-d872f2087c98
bool ChangeWindowDesktop(XID window, XID destination) { int desktop; if (!GetWindowDesktop(destination, &desktop)) return false; if (desktop == kAllDesktops && !GetCurrentDesktop(&desktop)) return false; XEvent event; event.xclient.type = ClientMessage; event.xclient.window = window; event.xclient.message_type = GetAtom("_NET_WM_DESKTOP"); event.xclient.format = 32; event.xclient.data.l[0] = desktop; event.xclient.data.l[1] = 1; // source indication int result = XSendEvent(GetXDisplay(), GetX11RootWindow(), False, SubstructureNotifyMask, &event); return result == Success; }
bool ChangeWindowDesktop(XID window, XID destination) { int desktop; if (!GetWindowDesktop(destination, &desktop)) return false; if (desktop == kAllDesktops && !GetCurrentDesktop(&desktop)) return false; XEvent event; event.xclient.type = ClientMessage; event.xclient.window = window; event.xclient.message_type = GetAtom("_NET_WM_DESKTOP"); event.xclient.format = 32; event.xclient.data.l[0] = desktop; event.xclient.data.l[1] = 1; // source indication int result = XSendEvent(GetXDisplay(), GetX11RootWindow(), False, SubstructureNotifyMask, &event); return result == Success; }
C
Chrome
0
CVE-2015-2925
https://www.cvedetails.com/cve/CVE-2015-2925/
CWE-254
https://github.com/torvalds/linux/commit/397d425dc26da728396e66d392d5dcb8dac30c37
397d425dc26da728396e66d392d5dcb8dac30c37
vfs: Test for and handle paths that are unreachable from their mnt_root In rare cases a directory can be renamed out from under a bind mount. In those cases without special handling it becomes possible to walk up the directory tree to the root dentry of the filesystem and down from the root dentry to every other file or directory on the filesystem. Like division by zero .. from an unconnected path can not be given a useful semantic as there is no predicting at which path component the code will realize it is unconnected. We certainly can not match the current behavior as the current behavior is a security hole. Therefore when encounting .. when following an unconnected path return -ENOENT. - Add a function path_connected to verify path->dentry is reachable from path->mnt.mnt_root. AKA to validate that rename did not do something nasty to the bind mount. To avoid races path_connected must be called after following a path component to it's next path component. Signed-off-by: "Eric W. Biederman" <[email protected]> Signed-off-by: Al Viro <[email protected]>
mountpoint_last(struct nameidata *nd, struct path *path) { int error = 0; struct dentry *dentry; struct dentry *dir = nd->path.dentry; /* If we're in rcuwalk, drop out of it to handle last component */ if (nd->flags & LOOKUP_RCU) { if (unlazy_walk(nd, NULL, 0)) return -ECHILD; } nd->flags &= ~LOOKUP_PARENT; if (unlikely(nd->last_type != LAST_NORM)) { error = handle_dots(nd, nd->last_type); if (error) return error; dentry = dget(nd->path.dentry); goto done; } mutex_lock(&dir->d_inode->i_mutex); dentry = d_lookup(dir, &nd->last); if (!dentry) { /* * No cached dentry. Mounted dentries are pinned in the cache, * so that means that this dentry is probably a symlink or the * path doesn't actually point to a mounted dentry. */ dentry = d_alloc(dir, &nd->last); if (!dentry) { mutex_unlock(&dir->d_inode->i_mutex); return -ENOMEM; } dentry = lookup_real(dir->d_inode, dentry, nd->flags); if (IS_ERR(dentry)) { mutex_unlock(&dir->d_inode->i_mutex); return PTR_ERR(dentry); } } mutex_unlock(&dir->d_inode->i_mutex); done: if (d_is_negative(dentry)) { dput(dentry); return -ENOENT; } if (nd->depth) put_link(nd); path->dentry = dentry; path->mnt = nd->path.mnt; error = should_follow_link(nd, path, nd->flags & LOOKUP_FOLLOW, d_backing_inode(dentry), 0); if (unlikely(error)) return error; mntget(path->mnt); follow_mount(path); return 0; }
mountpoint_last(struct nameidata *nd, struct path *path) { int error = 0; struct dentry *dentry; struct dentry *dir = nd->path.dentry; /* If we're in rcuwalk, drop out of it to handle last component */ if (nd->flags & LOOKUP_RCU) { if (unlazy_walk(nd, NULL, 0)) return -ECHILD; } nd->flags &= ~LOOKUP_PARENT; if (unlikely(nd->last_type != LAST_NORM)) { error = handle_dots(nd, nd->last_type); if (error) return error; dentry = dget(nd->path.dentry); goto done; } mutex_lock(&dir->d_inode->i_mutex); dentry = d_lookup(dir, &nd->last); if (!dentry) { /* * No cached dentry. Mounted dentries are pinned in the cache, * so that means that this dentry is probably a symlink or the * path doesn't actually point to a mounted dentry. */ dentry = d_alloc(dir, &nd->last); if (!dentry) { mutex_unlock(&dir->d_inode->i_mutex); return -ENOMEM; } dentry = lookup_real(dir->d_inode, dentry, nd->flags); if (IS_ERR(dentry)) { mutex_unlock(&dir->d_inode->i_mutex); return PTR_ERR(dentry); } } mutex_unlock(&dir->d_inode->i_mutex); done: if (d_is_negative(dentry)) { dput(dentry); return -ENOENT; } if (nd->depth) put_link(nd); path->dentry = dentry; path->mnt = nd->path.mnt; error = should_follow_link(nd, path, nd->flags & LOOKUP_FOLLOW, d_backing_inode(dentry), 0); if (unlikely(error)) return error; mntget(path->mnt); follow_mount(path); return 0; }
C
linux
0
null
null
null
https://github.com/chromium/chromium/commit/a3e2afaedd8190398ae45ccef34fcdee00fb19aa
a3e2afaedd8190398ae45ccef34fcdee00fb19aa
Fixed crash related to cellular network payment plan retreival. BUG=chromium-os:8864 TEST=none Review URL: http://codereview.chromium.org/4690002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@65405 0039d316-1c4b-4281-b951-d872f2087c98
void WirelessNetwork::Clear() { Network::Clear(); name_.clear(); strength_ = 0; auto_connect_ = false; favorite_ = false; }
void WirelessNetwork::Clear() { Network::Clear(); name_.clear(); strength_ = 0; auto_connect_ = false; favorite_ = false; }
C
Chrome
0
CVE-2018-7191
https://www.cvedetails.com/cve/CVE-2018-7191/
CWE-476
https://github.com/torvalds/linux/commit/0ad646c81b2182f7fa67ec0c8c825e0ee165696d
0ad646c81b2182f7fa67ec0c8c825e0ee165696d
tun: call dev_get_valid_name() before register_netdevice() register_netdevice() could fail early when we have an invalid dev name, in which case ->ndo_uninit() is not called. For tun device, this is a problem because a timer etc. are already initialized and it expects ->ndo_uninit() to clean them up. We could move these initializations into a ->ndo_init() so that register_netdevice() knows better, however this is still complicated due to the logic in tun_detach(). Therefore, I choose to just call dev_get_valid_name() before register_netdevice(), which is quicker and much easier to audit. And for this specific case, it is already enough. Fixes: 96442e42429e ("tuntap: choose the txq based on rxq") Reported-by: Dmitry Alexeev <[email protected]> Cc: Jason Wang <[email protected]> Cc: "Michael S. Tsirkin" <[email protected]> Signed-off-by: Cong Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev, struct list_head **iter) { struct netdev_adjacent *lower; lower = list_entry_rcu((*iter)->next, struct netdev_adjacent, list); if (&lower->list == &dev->adj_list.lower) return NULL; *iter = &lower->list; return lower->dev; }
static struct net_device *netdev_next_lower_dev_rcu(struct net_device *dev, struct list_head **iter) { struct netdev_adjacent *lower; lower = list_entry_rcu((*iter)->next, struct netdev_adjacent, list); if (&lower->list == &dev->adj_list.lower) return NULL; *iter = &lower->list; return lower->dev; }
C
linux
0
CVE-2016-10218
https://www.cvedetails.com/cve/CVE-2016-10218/
CWE-476
http://git.ghostscript.com/?p=ghostpdl.git;a=commit;h=d621292fb2c8157d9899dcd83fd04dd250e30fe4
d621292fb2c8157d9899dcd83fd04dd250e30fe4
null
c_pdf14trans_get_cropping(const gs_composite_t *pcte, int *ry, int *rheight, int cropping_min, int cropping_max) { gs_pdf14trans_t * pdf14pct = (gs_pdf14trans_t *) pcte; switch (pdf14pct->params.pdf14_op) { case PDF14_PUSH_DEVICE: return ALLBANDS; /* Applies to all bands. */ case PDF14_POP_DEVICE: return ALLBANDS; /* Applies to all bands. */ case PDF14_ABORT_DEVICE: return ALLBANDS; /* Applies to all bands */ case PDF14_BEGIN_TRANS_GROUP: { gs_int_rect rect; pdf14_compute_group_device_int_rect(&pdf14pct->params.ctm, &pdf14pct->params.bbox, &rect); /* We have to crop this by the parent object. */ *ry = max(rect.p.y, cropping_min); *rheight = min(rect.q.y, cropping_max) - *ry; return PUSHCROP; /* Push cropping. */ } case PDF14_BEGIN_TRANS_MASK: { gs_int_rect rect; pdf14_compute_group_device_int_rect(&pdf14pct->params.ctm, &pdf14pct->params.bbox, &rect); /* We have to crop this by the parent object and worry about the BC outside the range, except for image SMask which don't affect areas outside the image */ if ( pdf14pct->params.GrayBackground == 1.0 || pdf14pct->params.mask_is_image) { /* In this case there will not be a background effect to worry about. The mask will not have any effect outside the bounding box. This is NOT the default or common case. */ *ry = max(rect.p.y, cropping_min); *rheight = min(rect.q.y, cropping_max) - *ry; return PUSHCROP; /* Push cropping. */ } else { /* We need to make the soft mask range as large as the parent due to the fact that the background color can have an impact OUTSIDE the bounding box of the soft mask */ *ry = cropping_min; *rheight = cropping_max - cropping_min; if (pdf14pct->params.subtype == TRANSPARENCY_MASK_None) return SAMEAS_PUSHCROP_BUTNOPUSH; else return PUSHCROP; /* Push cropping. */ } } case PDF14_END_TRANS_GROUP: return POPCROP; /* Pop cropping. */ case PDF14_END_TRANS_MASK: return POPCROP; /* Pop the cropping */ case PDF14_PUSH_TRANS_STATE: return CURRBANDS; case PDF14_POP_TRANS_STATE: return CURRBANDS; case PDF14_SET_BLEND_PARAMS: return ALLBANDS; case PDF14_PUSH_SMASK_COLOR: return POPCROP; /* Pop cropping. */ case PDF14_POP_SMASK_COLOR: return POPCROP; /* Pop the cropping */ } return ALLBANDS; }
c_pdf14trans_get_cropping(const gs_composite_t *pcte, int *ry, int *rheight, int cropping_min, int cropping_max) { gs_pdf14trans_t * pdf14pct = (gs_pdf14trans_t *) pcte; switch (pdf14pct->params.pdf14_op) { case PDF14_PUSH_DEVICE: return ALLBANDS; /* Applies to all bands. */ case PDF14_POP_DEVICE: return ALLBANDS; /* Applies to all bands. */ case PDF14_ABORT_DEVICE: return ALLBANDS; /* Applies to all bands */ case PDF14_BEGIN_TRANS_GROUP: { gs_int_rect rect; pdf14_compute_group_device_int_rect(&pdf14pct->params.ctm, &pdf14pct->params.bbox, &rect); /* We have to crop this by the parent object. */ *ry = max(rect.p.y, cropping_min); *rheight = min(rect.q.y, cropping_max) - *ry; return PUSHCROP; /* Push cropping. */ } case PDF14_BEGIN_TRANS_MASK: { gs_int_rect rect; pdf14_compute_group_device_int_rect(&pdf14pct->params.ctm, &pdf14pct->params.bbox, &rect); /* We have to crop this by the parent object and worry about the BC outside the range, except for image SMask which don't affect areas outside the image */ if ( pdf14pct->params.GrayBackground == 1.0 || pdf14pct->params.mask_is_image) { /* In this case there will not be a background effect to worry about. The mask will not have any effect outside the bounding box. This is NOT the default or common case. */ *ry = max(rect.p.y, cropping_min); *rheight = min(rect.q.y, cropping_max) - *ry; return PUSHCROP; /* Push cropping. */ } else { /* We need to make the soft mask range as large as the parent due to the fact that the background color can have an impact OUTSIDE the bounding box of the soft mask */ *ry = cropping_min; *rheight = cropping_max - cropping_min; if (pdf14pct->params.subtype == TRANSPARENCY_MASK_None) return SAMEAS_PUSHCROP_BUTNOPUSH; else return PUSHCROP; /* Push cropping. */ } } case PDF14_END_TRANS_GROUP: return POPCROP; /* Pop cropping. */ case PDF14_END_TRANS_MASK: return POPCROP; /* Pop the cropping */ case PDF14_PUSH_TRANS_STATE: return CURRBANDS; case PDF14_POP_TRANS_STATE: return CURRBANDS; case PDF14_SET_BLEND_PARAMS: return ALLBANDS; case PDF14_PUSH_SMASK_COLOR: return POPCROP; /* Pop cropping. */ case PDF14_POP_SMASK_COLOR: return POPCROP; /* Pop the cropping */ } return ALLBANDS; }
C
ghostscript
0
CVE-2015-1294
https://www.cvedetails.com/cve/CVE-2015-1294/
null
https://github.com/chromium/chromium/commit/3ff403eecdd23a39853a4ebca52023fbba6c5d00
3ff403eecdd23a39853a4ebca52023fbba6c5d00
Introduce RunLoop::Type::NESTABLE_TASKS_ALLOWED to replace MessageLoop::ScopedNestableTaskAllower. (as well as MessageLoop::SetNestableTasksAllowed()) Surveying usage: the scoped object is always instantiated right before RunLoop().Run(). The intent is really to allow nestable tasks in that RunLoop so it's better to explicitly label that RunLoop as such and it allows us to break the last dependency that forced some RunLoop users to use MessageLoop APIs. There's also the odd case of allowing nestable tasks for loops that are reentrant from a native task (without going through RunLoop), these are the minority but will have to be handled (after cleaning up the majority of cases that are RunLoop induced). As highlighted by robliao@ in https://chromium-review.googlesource.com/c/600517 (which was merged in this CL). [email protected] Bug: 750779 Change-Id: I43d122c93ec903cff3a6fe7b77ec461ea0656448 Reviewed-on: https://chromium-review.googlesource.com/594713 Commit-Queue: Gabriel Charette <[email protected]> Reviewed-by: Robert Liao <[email protected]> Reviewed-by: danakj <[email protected]> Cr-Commit-Position: refs/heads/master@{#492263}
void QuitWhenIdleTask(RunLoop* run_loop, int* counter) { run_loop->QuitWhenIdle(); ++(*counter); }
void QuitWhenIdleTask(RunLoop* run_loop, int* counter) { run_loop->QuitWhenIdle(); ++(*counter); }
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}
void Textfield::ApplyColor(SkColor value, const gfx::Range& range) { GetRenderText()->ApplyColor(value, range); SchedulePaint(); }
void Textfield::ApplyColor(SkColor value, const gfx::Range& range) { GetRenderText()->ApplyColor(value, range); SchedulePaint(); }
C
Chrome
0
CVE-2016-2420
https://www.cvedetails.com/cve/CVE-2016-2420/
CWE-264
https://android.googlesource.com/platform/system/core/+/81df1cc77722000f8d0025c1ab00ced123aa573c
81df1cc77722000f8d0025c1ab00ced123aa573c
Don't create tombstone directory. Partial backport of cf79748. Bug: http://b/26403620 Change-Id: Ib877ab6cfab6aef079830c5a50ba81141ead35ee
static char* find_and_open_tombstone(int* fd) { char path[128]; int oldest = -1; struct stat oldest_sb; for (int i = 0; i < MAX_TOMBSTONES; i++) { snprintf(path, sizeof(path), TOMBSTONE_TEMPLATE, i); struct stat sb; if (!stat(path, &sb)) { if (oldest < 0 || sb.st_mtime < oldest_sb.st_mtime) { oldest = i; oldest_sb.st_mtime = sb.st_mtime; } continue; } if (errno != ENOENT) continue; *fd = open(path, O_CREAT | O_EXCL | O_WRONLY | O_NOFOLLOW | O_CLOEXEC, 0600); if (*fd < 0) continue; // raced ? fchown(*fd, AID_SYSTEM, AID_SYSTEM); return strdup(path); } if (oldest < 0) { ALOGE("Failed to find a valid tombstone, default to using tombstone 0.\n"); oldest = 0; } snprintf(path, sizeof(path), TOMBSTONE_TEMPLATE, oldest); *fd = open(path, O_CREAT | O_TRUNC | O_WRONLY | O_NOFOLLOW | O_CLOEXEC, 0600); if (*fd < 0) { ALOGE("failed to open tombstone file '%s': %s\n", path, strerror(errno)); return NULL; } fchown(*fd, AID_SYSTEM, AID_SYSTEM); return strdup(path); }
static char* find_and_open_tombstone(int* fd) { char path[128]; int oldest = -1; struct stat oldest_sb; for (int i = 0; i < MAX_TOMBSTONES; i++) { snprintf(path, sizeof(path), TOMBSTONE_TEMPLATE, i); struct stat sb; if (!stat(path, &sb)) { if (oldest < 0 || sb.st_mtime < oldest_sb.st_mtime) { oldest = i; oldest_sb.st_mtime = sb.st_mtime; } continue; } if (errno != ENOENT) continue; *fd = open(path, O_CREAT | O_EXCL | O_WRONLY | O_NOFOLLOW | O_CLOEXEC, 0600); if (*fd < 0) continue; // raced ? fchown(*fd, AID_SYSTEM, AID_SYSTEM); return strdup(path); } if (oldest < 0) { ALOGE("Failed to find a valid tombstone, default to using tombstone 0.\n"); oldest = 0; } snprintf(path, sizeof(path), TOMBSTONE_TEMPLATE, oldest); *fd = open(path, O_CREAT | O_TRUNC | O_WRONLY | O_NOFOLLOW | O_CLOEXEC, 0600); if (*fd < 0) { ALOGE("failed to open tombstone file '%s': %s\n", path, strerror(errno)); return NULL; } fchown(*fd, AID_SYSTEM, AID_SYSTEM); return strdup(path); }
C
Android
0
null
null
null
https://github.com/chromium/chromium/commit/9d02cda7a634fbd6e53d98091f618057f0174387
9d02cda7a634fbd6e53d98091f618057f0174387
Coverity: Fixing pass by value. CID=101462, 101458, 101437, 101471, 101467 BUG=NONE TEST=NONE Review URL: http://codereview.chromium.org/9006023 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@115257 0039d316-1c4b-4281-b951-d872f2087c98
void ExtensionPrefs::SetExtensionPrefURLPatternSet( const std::string& extension_id, const std::string& pref_key, const URLPatternSet& new_value) { ListValue* value = new ListValue(); for (URLPatternSet::const_iterator i = new_value.begin(); i != new_value.end(); ++i) value->AppendIfNotPresent(Value::CreateStringValue(i->GetAsString())); UpdateExtensionPref(extension_id, pref_key, value); }
void ExtensionPrefs::SetExtensionPrefURLPatternSet( const std::string& extension_id, const std::string& pref_key, const URLPatternSet& new_value) { ListValue* value = new ListValue(); for (URLPatternSet::const_iterator i = new_value.begin(); i != new_value.end(); ++i) value->AppendIfNotPresent(Value::CreateStringValue(i->GetAsString())); UpdateExtensionPref(extension_id, pref_key, value); }
C
Chrome
0
CVE-2010-1172
https://www.cvedetails.com/cve/CVE-2010-1172/
CWE-264
https://cgit.freedesktop.org/dbus/dbus-glib/commit/?h=rhel5&id=9a6bce9b615abca6068348c1606ba8eaf13d9ae0
9a6bce9b615abca6068348c1606ba8eaf13d9ae0
null
increment_received_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer data) { GError *error; guint val; g_assert (!strcmp (data, "moo")); error = NULL; if (!dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_UINT, &val, G_TYPE_INVALID)) lose_gerror ("Failed to complete (async) Increment call", error); if (val != 43) lose ("Increment call returned %d, should be 43", val); g_print ("Async increment gave \"%d\"\n", val); g_main_loop_quit (loop); g_source_remove (exit_timeout); }
increment_received_cb (DBusGProxy *proxy, DBusGProxyCall *call, gpointer data) { GError *error; guint val; g_assert (!strcmp (data, "moo")); error = NULL; if (!dbus_g_proxy_end_call (proxy, call, &error, G_TYPE_UINT, &val, G_TYPE_INVALID)) lose_gerror ("Failed to complete (async) Increment call", error); if (val != 43) lose ("Increment call returned %d, should be 43", val); g_print ("Async increment gave \"%d\"\n", val); g_main_loop_quit (loop); g_source_remove (exit_timeout); }
C
dbus
0
CVE-2015-5156
https://www.cvedetails.com/cve/CVE-2015-5156/
CWE-119
https://github.com/torvalds/linux/commit/48900cb6af4282fa0fb6ff4d72a81aa3dadb5c39
48900cb6af4282fa0fb6ff4d72a81aa3dadb5c39
virtio-net: drop NETIF_F_FRAGLIST virtio declares support for NETIF_F_FRAGLIST, but assumes that there are at most MAX_SKB_FRAGS + 2 fragments which isn't always true with a fraglist. A longer fraglist in the skb will make the call to skb_to_sgvec overflow the sg array, leading to memory corruption. Drop NETIF_F_FRAGLIST so we only get what we can handle. Cc: Michael S. Tsirkin <[email protected]> Signed-off-by: Jason Wang <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static unsigned int mergeable_ctx_to_buf_truesize(unsigned long mrg_ctx) { unsigned int truesize = mrg_ctx & (MERGEABLE_BUFFER_ALIGN - 1); return (truesize + 1) * MERGEABLE_BUFFER_ALIGN; }
static unsigned int mergeable_ctx_to_buf_truesize(unsigned long mrg_ctx) { unsigned int truesize = mrg_ctx & (MERGEABLE_BUFFER_ALIGN - 1); return (truesize + 1) * MERGEABLE_BUFFER_ALIGN; }
C
linux
0
CVE-2015-7510
https://www.cvedetails.com/cve/CVE-2015-7510/
CWE-119
https://github.com/keszybz/systemd/commit/cb31827d62066a04b02111df3052949fda4b6888
cb31827d62066a04b02111df3052949fda4b6888
nss-mymachines: do not allow overlong machine names https://github.com/systemd/systemd/issues/2002
enum nss_status _nss_mymachines_getgrnam_r( const char *name, struct group *gr, char *buffer, size_t buflen, int *errnop) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_bus_message_unref_ sd_bus_message* reply = NULL; _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL; const char *p, *e, *machine; uint32_t mapped; uid_t gid; size_t l; int r; assert(name); assert(gr); p = startswith(name, "vg-"); if (!p) goto not_found; e = strrchr(p, '-'); if (!e || e == p) goto not_found; if (e - p > HOST_NAME_MAX - 1) /* -1 for the last dash */ goto not_found; r = parse_gid(e + 1, &gid); if (r < 0) goto not_found; machine = strndupa(p, e - p); if (!machine_name_is_valid(machine)) goto not_found; r = sd_bus_open_system(&bus); if (r < 0) goto fail; r = sd_bus_call_method(bus, "org.freedesktop.machine1", "/org/freedesktop/machine1", "org.freedesktop.machine1.Manager", "MapFromMachineGroup", &error, &reply, "su", machine, (uint32_t) gid); if (r < 0) { if (sd_bus_error_has_name(&error, BUS_ERROR_NO_SUCH_GROUP_MAPPING)) goto not_found; goto fail; } r = sd_bus_message_read(reply, "u", &mapped); if (r < 0) goto fail; l = sizeof(char*) + strlen(name) + 1; if (buflen < l) { *errnop = ENOMEM; return NSS_STATUS_TRYAGAIN; } memzero(buffer, sizeof(char*)); strcpy(buffer + sizeof(char*), name); gr->gr_name = buffer + sizeof(char*); gr->gr_gid = gid; gr->gr_passwd = (char*) "*"; /* locked */ gr->gr_mem = (char**) buffer; *errnop = 0; return NSS_STATUS_SUCCESS; not_found: *errnop = 0; return NSS_STATUS_NOTFOUND; fail: *errnop = -r; return NSS_STATUS_UNAVAIL; }
enum nss_status _nss_mymachines_getgrnam_r( const char *name, struct group *gr, char *buffer, size_t buflen, int *errnop) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_bus_message_unref_ sd_bus_message* reply = NULL; _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL; const char *p, *e, *machine; uint32_t mapped; uid_t gid; size_t l; int r; assert(name); assert(gr); p = startswith(name, "vg-"); if (!p) goto not_found; e = strrchr(p, '-'); if (!e || e == p) goto not_found; r = parse_gid(e + 1, &gid); if (r < 0) goto not_found; machine = strndupa(p, e - p); if (!machine_name_is_valid(machine)) goto not_found; r = sd_bus_open_system(&bus); if (r < 0) goto fail; r = sd_bus_call_method(bus, "org.freedesktop.machine1", "/org/freedesktop/machine1", "org.freedesktop.machine1.Manager", "MapFromMachineGroup", &error, &reply, "su", machine, (uint32_t) gid); if (r < 0) { if (sd_bus_error_has_name(&error, BUS_ERROR_NO_SUCH_GROUP_MAPPING)) goto not_found; goto fail; } r = sd_bus_message_read(reply, "u", &mapped); if (r < 0) goto fail; l = sizeof(char*) + strlen(name) + 1; if (buflen < l) { *errnop = ENOMEM; return NSS_STATUS_TRYAGAIN; } memzero(buffer, sizeof(char*)); strcpy(buffer + sizeof(char*), name); gr->gr_name = buffer + sizeof(char*); gr->gr_gid = gid; gr->gr_passwd = (char*) "*"; /* locked */ gr->gr_mem = (char**) buffer; *errnop = 0; return NSS_STATUS_SUCCESS; not_found: *errnop = 0; return NSS_STATUS_NOTFOUND; fail: *errnop = -r; return NSS_STATUS_UNAVAIL; }
C
systemd
1
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.
gpk_match_card(sc_card_t *card) { int i; i = _sc_match_atr(card, gpk_atrs, &card->type); if (i < 0) { const u8 *hist_bytes = card->reader->atr_info.hist_bytes; /* Gemplus GPK docs say we can use just the * FMN and PRN fields of the historical bytes * to recognize a GPK card * See Table 43, pp. 188 * We'll use the first 2 bytes as well */ if ((card->reader->atr_info.hist_bytes_len >= 7) && (hist_bytes[0] == 0x80) && (hist_bytes[1] == 0x65) && (hist_bytes[2] == 0xa2)) { /* FMN */ if (hist_bytes[3] == 0x08) { /* PRN? */ card->type = SC_CARD_TYPE_GPK_GPK8000; return 1; } if (hist_bytes[3] == 0x09) { /* PRN? */ card->type = SC_CARD_TYPE_GPK_GPK16000; return 1; } } return 0; } return 1; }
gpk_match_card(sc_card_t *card) { int i; i = _sc_match_atr(card, gpk_atrs, &card->type); if (i < 0) { const u8 *hist_bytes = card->reader->atr_info.hist_bytes; /* Gemplus GPK docs say we can use just the * FMN and PRN fields of the historical bytes * to recognize a GPK card * See Table 43, pp. 188 * We'll use the first 2 bytes as well */ if ((card->reader->atr_info.hist_bytes_len >= 7) && (hist_bytes[0] == 0x80) && (hist_bytes[1] == 0x65) && (hist_bytes[2] == 0xa2)) { /* FMN */ if (hist_bytes[3] == 0x08) { /* PRN? */ card->type = SC_CARD_TYPE_GPK_GPK8000; return 1; } if (hist_bytes[3] == 0x09) { /* PRN? */ card->type = SC_CARD_TYPE_GPK_GPK16000; return 1; } } return 0; } return 1; }
C
OpenSC
0
null
null
null
https://github.com/chromium/chromium/commit/3a353ebdb7753a3fbeb401c4c0e0f3358ccbb90b
3a353ebdb7753a3fbeb401c4c0e0f3358ccbb90b
Support pausing media when a context is frozen. Media is resumed when the context is unpaused. This feature will be used for bfcache and pausing iframes feature policy. BUG=907125 Change-Id: Ic3925ea1a4544242b7bf0b9ad8c9cb9f63976bbd Reviewed-on: https://chromium-review.googlesource.com/c/1410126 Commit-Queue: Dave Tapuska <[email protected]> Reviewed-by: Kentaro Hara <[email protected]> Reviewed-by: Mounir Lamouri <[email protected]> Cr-Commit-Position: refs/heads/master@{#623319}
bool HTMLMediaElement::MediaShouldBeOpaque() const { return !IsMediaDataCorsSameOrigin() && ready_state_ < kHaveMetadata && !FastGetAttribute(kSrcAttr).IsEmpty() && EffectivePreloadType() != WebMediaPlayer::kPreloadNone; }
bool HTMLMediaElement::MediaShouldBeOpaque() const { return !IsMediaDataCorsSameOrigin() && ready_state_ < kHaveMetadata && !FastGetAttribute(kSrcAttr).IsEmpty() && EffectivePreloadType() != WebMediaPlayer::kPreloadNone; }
C
Chrome
0
CVE-2015-6761
https://www.cvedetails.com/cve/CVE-2015-6761/
CWE-362
https://github.com/chromium/chromium/commit/fd506b0ac6c7846ae45b5034044fe85c28ee68ac
fd506b0ac6c7846ae45b5034044fe85c28ee68ac
Fix detach with open()ed document leaving parent loading indefinitely Change-Id: I26c2a054b9f1e5eb076acd677e1223058825f6d6 Bug: 803416 Test: fast/loader/document-open-iframe-then-detach.html Change-Id: I26c2a054b9f1e5eb076acd677e1223058825f6d6 Reviewed-on: https://chromium-review.googlesource.com/887298 Reviewed-by: Mike West <[email protected]> Commit-Queue: Nate Chapin <[email protected]> Cr-Commit-Position: refs/heads/master@{#532967}
void FrameLoader::DetachDocumentLoader(Member<DocumentLoader>& loader) { if (!loader) return; FrameNavigationDisabler navigation_disabler(*frame_); loader->DetachFromFrame(); loader = nullptr; }
void FrameLoader::DetachDocumentLoader(Member<DocumentLoader>& loader) { if (!loader) return; FrameNavigationDisabler navigation_disabler(*frame_); loader->DetachFromFrame(); loader = nullptr; }
C
Chrome
0
CVE-2012-3552
https://www.cvedetails.com/cve/CVE-2012-3552/
CWE-362
https://github.com/torvalds/linux/commit/f6d8bd051c391c1c0458a30b2a7abcd939329259
f6d8bd051c391c1c0458a30b2a7abcd939329259
inet: add RCU protection to inet->opt We lack proper synchronization to manipulate inet->opt ip_options Problem is ip_make_skb() calls ip_setup_cork() and ip_setup_cork() possibly makes a copy of ipc->opt (struct ip_options), without any protection against another thread manipulating inet->opt. Another thread can change inet->opt pointer and free old one under us. Use RCU to protect inet->opt (changed to inet->inet_opt). Instead of handling atomic refcounts, just copy ip_options when necessary, to avoid cache line dirtying. We cant insert an rcu_head in struct ip_options since its included in skb->cb[], so this patch is large because I had to introduce a new ip_options_rcu structure. Signed-off-by: Eric Dumazet <[email protected]> Cc: Herbert Xu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
int udp_lib_get_port(struct sock *sk, unsigned short snum, int (*saddr_comp)(const struct sock *sk1, const struct sock *sk2), unsigned int hash2_nulladdr) { struct udp_hslot *hslot, *hslot2; struct udp_table *udptable = sk->sk_prot->h.udp_table; int error = 1; struct net *net = sock_net(sk); if (!snum) { int low, high, remaining; unsigned rand; unsigned short first, last; DECLARE_BITMAP(bitmap, PORTS_PER_CHAIN); inet_get_local_port_range(&low, &high); remaining = (high - low) + 1; rand = net_random(); first = (((u64)rand * remaining) >> 32) + low; /* * force rand to be an odd multiple of UDP_HTABLE_SIZE */ rand = (rand | 1) * (udptable->mask + 1); last = first + udptable->mask + 1; do { hslot = udp_hashslot(udptable, net, first); bitmap_zero(bitmap, PORTS_PER_CHAIN); spin_lock_bh(&hslot->lock); udp_lib_lport_inuse(net, snum, hslot, bitmap, sk, saddr_comp, udptable->log); snum = first; /* * Iterate on all possible values of snum for this hash. * Using steps of an odd multiple of UDP_HTABLE_SIZE * give us randomization and full range coverage. */ do { if (low <= snum && snum <= high && !test_bit(snum >> udptable->log, bitmap) && !inet_is_reserved_local_port(snum)) goto found; snum += rand; } while (snum != first); spin_unlock_bh(&hslot->lock); } while (++first != last); goto fail; } else { hslot = udp_hashslot(udptable, net, snum); spin_lock_bh(&hslot->lock); if (hslot->count > 10) { int exist; unsigned int slot2 = udp_sk(sk)->udp_portaddr_hash ^ snum; slot2 &= udptable->mask; hash2_nulladdr &= udptable->mask; hslot2 = udp_hashslot2(udptable, slot2); if (hslot->count < hslot2->count) goto scan_primary_hash; exist = udp_lib_lport_inuse2(net, snum, hslot2, sk, saddr_comp); if (!exist && (hash2_nulladdr != slot2)) { hslot2 = udp_hashslot2(udptable, hash2_nulladdr); exist = udp_lib_lport_inuse2(net, snum, hslot2, sk, saddr_comp); } if (exist) goto fail_unlock; else goto found; } scan_primary_hash: if (udp_lib_lport_inuse(net, snum, hslot, NULL, sk, saddr_comp, 0)) goto fail_unlock; } found: inet_sk(sk)->inet_num = snum; udp_sk(sk)->udp_port_hash = snum; udp_sk(sk)->udp_portaddr_hash ^= snum; if (sk_unhashed(sk)) { sk_nulls_add_node_rcu(sk, &hslot->head); hslot->count++; sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); hslot2 = udp_hashslot2(udptable, udp_sk(sk)->udp_portaddr_hash); spin_lock(&hslot2->lock); hlist_nulls_add_head_rcu(&udp_sk(sk)->udp_portaddr_node, &hslot2->head); hslot2->count++; spin_unlock(&hslot2->lock); } error = 0; fail_unlock: spin_unlock_bh(&hslot->lock); fail: return error; }
int udp_lib_get_port(struct sock *sk, unsigned short snum, int (*saddr_comp)(const struct sock *sk1, const struct sock *sk2), unsigned int hash2_nulladdr) { struct udp_hslot *hslot, *hslot2; struct udp_table *udptable = sk->sk_prot->h.udp_table; int error = 1; struct net *net = sock_net(sk); if (!snum) { int low, high, remaining; unsigned rand; unsigned short first, last; DECLARE_BITMAP(bitmap, PORTS_PER_CHAIN); inet_get_local_port_range(&low, &high); remaining = (high - low) + 1; rand = net_random(); first = (((u64)rand * remaining) >> 32) + low; /* * force rand to be an odd multiple of UDP_HTABLE_SIZE */ rand = (rand | 1) * (udptable->mask + 1); last = first + udptable->mask + 1; do { hslot = udp_hashslot(udptable, net, first); bitmap_zero(bitmap, PORTS_PER_CHAIN); spin_lock_bh(&hslot->lock); udp_lib_lport_inuse(net, snum, hslot, bitmap, sk, saddr_comp, udptable->log); snum = first; /* * Iterate on all possible values of snum for this hash. * Using steps of an odd multiple of UDP_HTABLE_SIZE * give us randomization and full range coverage. */ do { if (low <= snum && snum <= high && !test_bit(snum >> udptable->log, bitmap) && !inet_is_reserved_local_port(snum)) goto found; snum += rand; } while (snum != first); spin_unlock_bh(&hslot->lock); } while (++first != last); goto fail; } else { hslot = udp_hashslot(udptable, net, snum); spin_lock_bh(&hslot->lock); if (hslot->count > 10) { int exist; unsigned int slot2 = udp_sk(sk)->udp_portaddr_hash ^ snum; slot2 &= udptable->mask; hash2_nulladdr &= udptable->mask; hslot2 = udp_hashslot2(udptable, slot2); if (hslot->count < hslot2->count) goto scan_primary_hash; exist = udp_lib_lport_inuse2(net, snum, hslot2, sk, saddr_comp); if (!exist && (hash2_nulladdr != slot2)) { hslot2 = udp_hashslot2(udptable, hash2_nulladdr); exist = udp_lib_lport_inuse2(net, snum, hslot2, sk, saddr_comp); } if (exist) goto fail_unlock; else goto found; } scan_primary_hash: if (udp_lib_lport_inuse(net, snum, hslot, NULL, sk, saddr_comp, 0)) goto fail_unlock; } found: inet_sk(sk)->inet_num = snum; udp_sk(sk)->udp_port_hash = snum; udp_sk(sk)->udp_portaddr_hash ^= snum; if (sk_unhashed(sk)) { sk_nulls_add_node_rcu(sk, &hslot->head); hslot->count++; sock_prot_inuse_add(sock_net(sk), sk->sk_prot, 1); hslot2 = udp_hashslot2(udptable, udp_sk(sk)->udp_portaddr_hash); spin_lock(&hslot2->lock); hlist_nulls_add_head_rcu(&udp_sk(sk)->udp_portaddr_node, &hslot2->head); hslot2->count++; spin_unlock(&hslot2->lock); } error = 0; fail_unlock: spin_unlock_bh(&hslot->lock); fail: return error; }
C
linux
0
CVE-2019-12981
https://www.cvedetails.com/cve/CVE-2019-12981/
CWE-119
https://github.com/libming/libming/pull/179/commits/3dc0338e4a36a3092720ebaa5b908ba3dca467d9
3dc0338e4a36a3092720ebaa5b908ba3dca467d9
SWFShape_setLeftFillStyle: prevent fill overflow
newShapeRecord(SWFShape shape, shapeRecordType type) { if ( shape->nRecords % SHAPERECORD_INCREMENT == 0 ) { shape->records = (ShapeRecord*) realloc(shape->records, sizeof(ShapeRecord) * (shape->nRecords + SHAPERECORD_INCREMENT)); } switch ( type ) { case SHAPERECORD_STATECHANGE: { StateChangeRecord change = (StateChangeRecord)calloc(1,sizeof(struct stateChangeRecord)); shape->records[shape->nRecords].record.stateChange = change; break; } case SHAPERECORD_LINETO: { LineToRecord lineTo = (LineToRecord) calloc(1,sizeof(struct lineToRecord)); shape->records[shape->nRecords].record.lineTo = lineTo; break; } case SHAPERECORD_CURVETO: { CurveToRecord curveTo = (CurveToRecord) calloc(1,sizeof(struct curveToRecord)); shape->records[shape->nRecords].record.curveTo = curveTo; break; } } shape->records[shape->nRecords].type = type; shape->nRecords++; return shape->records[shape->nRecords-1]; }
newShapeRecord(SWFShape shape, shapeRecordType type) { if ( shape->nRecords % SHAPERECORD_INCREMENT == 0 ) { shape->records = (ShapeRecord*) realloc(shape->records, sizeof(ShapeRecord) * (shape->nRecords + SHAPERECORD_INCREMENT)); } switch ( type ) { case SHAPERECORD_STATECHANGE: { StateChangeRecord change = (StateChangeRecord)calloc(1,sizeof(struct stateChangeRecord)); shape->records[shape->nRecords].record.stateChange = change; break; } case SHAPERECORD_LINETO: { LineToRecord lineTo = (LineToRecord) calloc(1,sizeof(struct lineToRecord)); shape->records[shape->nRecords].record.lineTo = lineTo; break; } case SHAPERECORD_CURVETO: { CurveToRecord curveTo = (CurveToRecord) calloc(1,sizeof(struct curveToRecord)); shape->records[shape->nRecords].record.curveTo = curveTo; break; } } shape->records[shape->nRecords].type = type; shape->nRecords++; return shape->records[shape->nRecords-1]; }
C
libming
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 ...
nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd3_readdirargs *args) { p = decode_fh(p, &args->fh); if (!p) return 0; p = xdr_decode_hyper(p, &args->cookie); args->verf = p; p += 2; args->dircount = ~0; args->count = ntohl(*p++); if (!xdr_argsize_check(rqstp, p)) return 0; args->count = min_t(u32, args->count, PAGE_SIZE); args->buffer = page_address(*(rqstp->rq_next_page++)); return 1; }
nfs3svc_decode_readdirargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd3_readdirargs *args) { p = decode_fh(p, &args->fh); if (!p) return 0; p = xdr_decode_hyper(p, &args->cookie); args->verf = p; p += 2; args->dircount = ~0; args->count = ntohl(*p++); args->count = min_t(u32, args->count, PAGE_SIZE); args->buffer = page_address(*(rqstp->rq_next_page++)); return xdr_argsize_check(rqstp, p); }
C
linux
1
CVE-2013-0904
https://www.cvedetails.com/cve/CVE-2013-0904/
CWE-119
https://github.com/chromium/chromium/commit/b2b21468c1f7f08b30a7c1755316f6026c50eb2a
b2b21468c1f7f08b30a7c1755316f6026c50eb2a
Separate repaint and layout requirements of StyleDifference (Step 1) Previously StyleDifference was an enum that proximately bigger values imply smaller values (e.g. StyleDifferenceLayout implies StyleDifferenceRepaint). This causes unnecessary repaints in some cases on layout change. Convert StyleDifference to a structure containing relatively independent flags. This change doesn't directly improve the result, but can make further repaint optimizations possible. Step 1 doesn't change any functionality. RenderStyle still generate the legacy StyleDifference enum when comparing styles and convert the result to the new StyleDifference. Implicit requirements are not handled during the conversion. Converted call sites to use the new StyleDifference according to the following conversion rules: - diff == StyleDifferenceEqual (&& !context) => diff.hasNoChange() - diff == StyleDifferenceRepaint => diff.needsRepaintObjectOnly() - diff == StyleDifferenceRepaintLayer => diff.needsRepaintLayer() - diff == StyleDifferenceRepaint || diff == StyleDifferenceRepaintLayer => diff.needsRepaintLayer() - diff >= StyleDifferenceRepaint => diff.needsRepaint() || diff.needsLayout() - diff >= StyleDifferenceRepaintLayer => diff.needsRepaintLayer() || diff.needsLayout() - diff > StyleDifferenceRepaintLayer => diff.needsLayout() - diff == StyleDifferencePositionedMovementLayoutOnly => diff.needsPositionedMovementLayoutOnly() - diff == StyleDifferenceLayout => diff.needsFullLayout() BUG=358460 TEST=All existing layout tests. [email protected], [email protected], [email protected] Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=171983 Review URL: https://codereview.chromium.org/236203020 git-svn-id: svn://svn.chromium.org/blink/trunk@172331 bbb929c8-8fbe-4397-9dbb-9b2b20218538
void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength, const RenderBoxModelObject* containerBlock, LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit logicalHeight, Length logicalTop, Length logicalBottom, Length marginBefore, Length marginAfter, LogicalExtentComputedValues& computedValues) const { ASSERT(!(logicalTop.isAuto() && logicalBottom.isAuto())); LayoutUnit logicalHeightValue; LayoutUnit contentLogicalHeight = logicalHeight - bordersPlusPadding; const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, false); LayoutUnit logicalTopValue = 0; bool logicalHeightIsAuto = logicalHeightLength.isAuto(); bool logicalTopIsAuto = logicalTop.isAuto(); bool logicalBottomIsAuto = logicalBottom.isAuto(); LayoutUnit resolvedLogicalHeight; if (isTable()) { resolvedLogicalHeight = contentLogicalHeight; logicalHeightIsAuto = false; } else { if (logicalHeightLength.isIntrinsic()) resolvedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(logicalHeightLength, contentLogicalHeight, bordersPlusPadding); else resolvedLogicalHeight = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight)); } if (!logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) { /*-----------------------------------------------------------------------*\ * If none of the three are 'auto': If both 'margin-top' and 'margin- * bottom' are 'auto', solve the equation under the extra constraint that * the two margins get equal values. If one of 'margin-top' or 'margin- * bottom' is 'auto', solve the equation for that value. If the values * are over-constrained, ignore the value for 'bottom' and solve for that * value. \*-----------------------------------------------------------------------*/ logicalHeightValue = resolvedLogicalHeight; logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight) + bordersPlusPadding); if (marginBefore.isAuto() && marginAfter.isAuto()) { computedValues.m_margins.m_before = availableSpace / 2; // split the difference computedValues.m_margins.m_after = availableSpace - computedValues.m_margins.m_before; // account for odd valued differences } else if (marginBefore.isAuto()) { computedValues.m_margins.m_after = valueForLength(marginAfter, containerRelativeLogicalWidth); computedValues.m_margins.m_before = availableSpace - computedValues.m_margins.m_after; } else if (marginAfter.isAuto()) { computedValues.m_margins.m_before = valueForLength(marginBefore, containerRelativeLogicalWidth); computedValues.m_margins.m_after = availableSpace - computedValues.m_margins.m_before; } else { computedValues.m_margins.m_before = valueForLength(marginBefore, containerRelativeLogicalWidth); computedValues.m_margins.m_after = valueForLength(marginAfter, containerRelativeLogicalWidth); } } else { /*--------------------------------------------------------------------*\ * Otherwise, set 'auto' values for 'margin-top' and 'margin-bottom' * to 0, and pick the one of the following six rules that applies. * * 1. 'top' and 'height' are 'auto' and 'bottom' is not 'auto', then * the height is based on the content, and solve for 'top'. * * OMIT RULE 2 AS IT SHOULD NEVER BE HIT * ------------------------------------------------------------------ * 2. 'top' and 'bottom' are 'auto' and 'height' is not 'auto', then * set 'top' to the static position, and solve for 'bottom'. * ------------------------------------------------------------------ * * 3. 'height' and 'bottom' are 'auto' and 'top' is not 'auto', then * the height is based on the content, and solve for 'bottom'. * 4. 'top' is 'auto', 'height' and 'bottom' are not 'auto', and * solve for 'top'. * 5. 'height' is 'auto', 'top' and 'bottom' are not 'auto', and * solve for 'height'. * 6. 'bottom' is 'auto', 'top' and 'height' are not 'auto', and * solve for 'bottom'. \*--------------------------------------------------------------------*/ computedValues.m_margins.m_before = minimumValueForLength(marginBefore, containerRelativeLogicalWidth); computedValues.m_margins.m_after = minimumValueForLength(marginAfter, containerRelativeLogicalWidth); const LayoutUnit availableSpace = containerLogicalHeight - (computedValues.m_margins.m_before + computedValues.m_margins.m_after + bordersPlusPadding); if (logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) { logicalHeightValue = contentLogicalHeight; logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight)); } else if (!logicalTopIsAuto && logicalHeightIsAuto && logicalBottomIsAuto) { logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); logicalHeightValue = contentLogicalHeight; } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) { logicalHeightValue = resolvedLogicalHeight; logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight)); } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) { logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + valueForLength(logicalBottom, containerLogicalHeight))); } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsAuto) { logicalHeightValue = resolvedLogicalHeight; logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); } } computedValues.m_extent = logicalHeightValue; computedValues.m_position = logicalTopValue + computedValues.m_margins.m_before; computeLogicalTopPositionedOffset(computedValues.m_position, this, logicalHeightValue, containerBlock, containerLogicalHeight); }
void RenderBox::computePositionedLogicalHeightUsing(Length logicalHeightLength, const RenderBoxModelObject* containerBlock, LayoutUnit containerLogicalHeight, LayoutUnit bordersPlusPadding, LayoutUnit logicalHeight, Length logicalTop, Length logicalBottom, Length marginBefore, Length marginAfter, LogicalExtentComputedValues& computedValues) const { ASSERT(!(logicalTop.isAuto() && logicalBottom.isAuto())); LayoutUnit logicalHeightValue; LayoutUnit contentLogicalHeight = logicalHeight - bordersPlusPadding; const LayoutUnit containerRelativeLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock, false); LayoutUnit logicalTopValue = 0; bool logicalHeightIsAuto = logicalHeightLength.isAuto(); bool logicalTopIsAuto = logicalTop.isAuto(); bool logicalBottomIsAuto = logicalBottom.isAuto(); LayoutUnit resolvedLogicalHeight; if (isTable()) { resolvedLogicalHeight = contentLogicalHeight; logicalHeightIsAuto = false; } else { if (logicalHeightLength.isIntrinsic()) resolvedLogicalHeight = computeIntrinsicLogicalContentHeightUsing(logicalHeightLength, contentLogicalHeight, bordersPlusPadding); else resolvedLogicalHeight = adjustContentBoxLogicalHeightForBoxSizing(valueForLength(logicalHeightLength, containerLogicalHeight)); } if (!logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) { /*-----------------------------------------------------------------------*\ * If none of the three are 'auto': If both 'margin-top' and 'margin- * bottom' are 'auto', solve the equation under the extra constraint that * the two margins get equal values. If one of 'margin-top' or 'margin- * bottom' is 'auto', solve the equation for that value. If the values * are over-constrained, ignore the value for 'bottom' and solve for that * value. \*-----------------------------------------------------------------------*/ logicalHeightValue = resolvedLogicalHeight; logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); const LayoutUnit availableSpace = containerLogicalHeight - (logicalTopValue + logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight) + bordersPlusPadding); if (marginBefore.isAuto() && marginAfter.isAuto()) { computedValues.m_margins.m_before = availableSpace / 2; // split the difference computedValues.m_margins.m_after = availableSpace - computedValues.m_margins.m_before; // account for odd valued differences } else if (marginBefore.isAuto()) { computedValues.m_margins.m_after = valueForLength(marginAfter, containerRelativeLogicalWidth); computedValues.m_margins.m_before = availableSpace - computedValues.m_margins.m_after; } else if (marginAfter.isAuto()) { computedValues.m_margins.m_before = valueForLength(marginBefore, containerRelativeLogicalWidth); computedValues.m_margins.m_after = availableSpace - computedValues.m_margins.m_before; } else { computedValues.m_margins.m_before = valueForLength(marginBefore, containerRelativeLogicalWidth); computedValues.m_margins.m_after = valueForLength(marginAfter, containerRelativeLogicalWidth); } } else { /*--------------------------------------------------------------------*\ * Otherwise, set 'auto' values for 'margin-top' and 'margin-bottom' * to 0, and pick the one of the following six rules that applies. * * 1. 'top' and 'height' are 'auto' and 'bottom' is not 'auto', then * the height is based on the content, and solve for 'top'. * * OMIT RULE 2 AS IT SHOULD NEVER BE HIT * ------------------------------------------------------------------ * 2. 'top' and 'bottom' are 'auto' and 'height' is not 'auto', then * set 'top' to the static position, and solve for 'bottom'. * ------------------------------------------------------------------ * * 3. 'height' and 'bottom' are 'auto' and 'top' is not 'auto', then * the height is based on the content, and solve for 'bottom'. * 4. 'top' is 'auto', 'height' and 'bottom' are not 'auto', and * solve for 'top'. * 5. 'height' is 'auto', 'top' and 'bottom' are not 'auto', and * solve for 'height'. * 6. 'bottom' is 'auto', 'top' and 'height' are not 'auto', and * solve for 'bottom'. \*--------------------------------------------------------------------*/ computedValues.m_margins.m_before = minimumValueForLength(marginBefore, containerRelativeLogicalWidth); computedValues.m_margins.m_after = minimumValueForLength(marginAfter, containerRelativeLogicalWidth); const LayoutUnit availableSpace = containerLogicalHeight - (computedValues.m_margins.m_before + computedValues.m_margins.m_after + bordersPlusPadding); if (logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) { logicalHeightValue = contentLogicalHeight; logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight)); } else if (!logicalTopIsAuto && logicalHeightIsAuto && logicalBottomIsAuto) { logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); logicalHeightValue = contentLogicalHeight; } else if (logicalTopIsAuto && !logicalHeightIsAuto && !logicalBottomIsAuto) { logicalHeightValue = resolvedLogicalHeight; logicalTopValue = availableSpace - (logicalHeightValue + valueForLength(logicalBottom, containerLogicalHeight)); } else if (!logicalTopIsAuto && logicalHeightIsAuto && !logicalBottomIsAuto) { logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); logicalHeightValue = max<LayoutUnit>(0, availableSpace - (logicalTopValue + valueForLength(logicalBottom, containerLogicalHeight))); } else if (!logicalTopIsAuto && !logicalHeightIsAuto && logicalBottomIsAuto) { logicalHeightValue = resolvedLogicalHeight; logicalTopValue = valueForLength(logicalTop, containerLogicalHeight); } } computedValues.m_extent = logicalHeightValue; computedValues.m_position = logicalTopValue + computedValues.m_margins.m_before; computeLogicalTopPositionedOffset(computedValues.m_position, this, logicalHeightValue, containerBlock, containerLogicalHeight); }
C
Chrome
0
CVE-2018-17206
https://www.cvedetails.com/cve/CVE-2018-17206/
null
https://github.com/openvswitch/ovs/commit/9237a63c47bd314b807cda0bd2216264e82edbe8
9237a63c47bd314b807cda0bd2216264e82edbe8
ofp-actions: Avoid buffer overread in BUNDLE action decoding. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9052 Signed-off-by: Ben Pfaff <[email protected]> Acked-by: Justin Pettit <[email protected]>
decode_NXAST_RAW_NAT(const struct nx_action_nat *nan, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { struct ofpact_nat *nat; uint16_t range_present = ntohs(nan->range_present); const char *opts = (char *)(nan + 1); uint16_t len = ntohs(nan->len) - sizeof *nan; nat = ofpact_put_NAT(out); nat->flags = ntohs(nan->flags); /* Check for unknown or mutually exclusive flags. */ if ((nat->flags & ~NX_NAT_F_MASK) || (nat->flags & NX_NAT_F_SRC && nat->flags & NX_NAT_F_DST) || (nat->flags & NX_NAT_F_PROTO_HASH && nat->flags & NX_NAT_F_PROTO_RANDOM)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } #define NX_NAT_GET_OPT(DST, SRC, LEN, TYPE) \ (LEN >= sizeof(TYPE) \ ? (memcpy(DST, SRC, sizeof(TYPE)), LEN -= sizeof(TYPE), \ SRC += sizeof(TYPE)) \ : NULL) nat->range_af = AF_UNSPEC; if (range_present & NX_NAT_RANGE_IPV4_MIN) { if (range_present & (NX_NAT_RANGE_IPV6_MIN | NX_NAT_RANGE_IPV6_MAX)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (!NX_NAT_GET_OPT(&nat->range.addr.ipv4.min, opts, len, ovs_be32) || !nat->range.addr.ipv4.min) { return OFPERR_OFPBAC_BAD_ARGUMENT; } nat->range_af = AF_INET; if (range_present & NX_NAT_RANGE_IPV4_MAX) { if (!NX_NAT_GET_OPT(&nat->range.addr.ipv4.max, opts, len, ovs_be32)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (ntohl(nat->range.addr.ipv4.max) < ntohl(nat->range.addr.ipv4.min)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } } } else if (range_present & NX_NAT_RANGE_IPV4_MAX) { return OFPERR_OFPBAC_BAD_ARGUMENT; } else if (range_present & NX_NAT_RANGE_IPV6_MIN) { if (!NX_NAT_GET_OPT(&nat->range.addr.ipv6.min, opts, len, struct in6_addr) || ipv6_mask_is_any(&nat->range.addr.ipv6.min)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } nat->range_af = AF_INET6; if (range_present & NX_NAT_RANGE_IPV6_MAX) { if (!NX_NAT_GET_OPT(&nat->range.addr.ipv6.max, opts, len, struct in6_addr)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (memcmp(&nat->range.addr.ipv6.max, &nat->range.addr.ipv6.min, sizeof(struct in6_addr)) < 0) { return OFPERR_OFPBAC_BAD_ARGUMENT; } } } else if (range_present & NX_NAT_RANGE_IPV6_MAX) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (range_present & NX_NAT_RANGE_PROTO_MIN) { ovs_be16 proto; if (nat->range_af == AF_UNSPEC) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (!NX_NAT_GET_OPT(&proto, opts, len, ovs_be16) || proto == 0) { return OFPERR_OFPBAC_BAD_ARGUMENT; } nat->range.proto.min = ntohs(proto); if (range_present & NX_NAT_RANGE_PROTO_MAX) { if (!NX_NAT_GET_OPT(&proto, opts, len, ovs_be16)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } nat->range.proto.max = ntohs(proto); if (nat->range.proto.max < nat->range.proto.min) { return OFPERR_OFPBAC_BAD_ARGUMENT; } } } else if (range_present & NX_NAT_RANGE_PROTO_MAX) { return OFPERR_OFPBAC_BAD_ARGUMENT; } return 0; }
decode_NXAST_RAW_NAT(const struct nx_action_nat *nan, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { struct ofpact_nat *nat; uint16_t range_present = ntohs(nan->range_present); const char *opts = (char *)(nan + 1); uint16_t len = ntohs(nan->len) - sizeof *nan; nat = ofpact_put_NAT(out); nat->flags = ntohs(nan->flags); /* Check for unknown or mutually exclusive flags. */ if ((nat->flags & ~NX_NAT_F_MASK) || (nat->flags & NX_NAT_F_SRC && nat->flags & NX_NAT_F_DST) || (nat->flags & NX_NAT_F_PROTO_HASH && nat->flags & NX_NAT_F_PROTO_RANDOM)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } #define NX_NAT_GET_OPT(DST, SRC, LEN, TYPE) \ (LEN >= sizeof(TYPE) \ ? (memcpy(DST, SRC, sizeof(TYPE)), LEN -= sizeof(TYPE), \ SRC += sizeof(TYPE)) \ : NULL) nat->range_af = AF_UNSPEC; if (range_present & NX_NAT_RANGE_IPV4_MIN) { if (range_present & (NX_NAT_RANGE_IPV6_MIN | NX_NAT_RANGE_IPV6_MAX)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (!NX_NAT_GET_OPT(&nat->range.addr.ipv4.min, opts, len, ovs_be32) || !nat->range.addr.ipv4.min) { return OFPERR_OFPBAC_BAD_ARGUMENT; } nat->range_af = AF_INET; if (range_present & NX_NAT_RANGE_IPV4_MAX) { if (!NX_NAT_GET_OPT(&nat->range.addr.ipv4.max, opts, len, ovs_be32)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (ntohl(nat->range.addr.ipv4.max) < ntohl(nat->range.addr.ipv4.min)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } } } else if (range_present & NX_NAT_RANGE_IPV4_MAX) { return OFPERR_OFPBAC_BAD_ARGUMENT; } else if (range_present & NX_NAT_RANGE_IPV6_MIN) { if (!NX_NAT_GET_OPT(&nat->range.addr.ipv6.min, opts, len, struct in6_addr) || ipv6_mask_is_any(&nat->range.addr.ipv6.min)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } nat->range_af = AF_INET6; if (range_present & NX_NAT_RANGE_IPV6_MAX) { if (!NX_NAT_GET_OPT(&nat->range.addr.ipv6.max, opts, len, struct in6_addr)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (memcmp(&nat->range.addr.ipv6.max, &nat->range.addr.ipv6.min, sizeof(struct in6_addr)) < 0) { return OFPERR_OFPBAC_BAD_ARGUMENT; } } } else if (range_present & NX_NAT_RANGE_IPV6_MAX) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (range_present & NX_NAT_RANGE_PROTO_MIN) { ovs_be16 proto; if (nat->range_af == AF_UNSPEC) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (!NX_NAT_GET_OPT(&proto, opts, len, ovs_be16) || proto == 0) { return OFPERR_OFPBAC_BAD_ARGUMENT; } nat->range.proto.min = ntohs(proto); if (range_present & NX_NAT_RANGE_PROTO_MAX) { if (!NX_NAT_GET_OPT(&proto, opts, len, ovs_be16)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } nat->range.proto.max = ntohs(proto); if (nat->range.proto.max < nat->range.proto.min) { return OFPERR_OFPBAC_BAD_ARGUMENT; } } } else if (range_present & NX_NAT_RANGE_PROTO_MAX) { return OFPERR_OFPBAC_BAD_ARGUMENT; } return 0; }
C
ovs
0
CVE-2017-7533
https://www.cvedetails.com/cve/CVE-2017-7533/
CWE-362
https://github.com/torvalds/linux/commit/49d31c2f389acfe83417083e1208422b4091cd9e
49d31c2f389acfe83417083e1208422b4091cd9e
dentry name snapshots take_dentry_name_snapshot() takes a safe snapshot of dentry name; if the name is a short one, it gets copied into caller-supplied structure, otherwise an extra reference to external name is grabbed (those are never modified). In either case the pointer to stable string is stored into the same structure. dentry must be held by the caller of take_dentry_name_snapshot(), but may be freely dropped afterwards - the snapshot will stay until destroyed by release_dentry_name_snapshot(). Intended use: struct name_snapshot s; take_dentry_name_snapshot(&s, dentry); ... access s.name ... release_dentry_name_snapshot(&s); Replaces fsnotify_oldname_...(), gets used in fsnotify to obtain the name to pass down with event. Signed-off-by: Al Viro <[email protected]>
static int debug_fill_super(struct super_block *sb, void *data, int silent) { static const struct tree_descr debug_files[] = {{""}}; struct debugfs_fs_info *fsi; int err; save_mount_options(sb, data); fsi = kzalloc(sizeof(struct debugfs_fs_info), GFP_KERNEL); sb->s_fs_info = fsi; if (!fsi) { err = -ENOMEM; goto fail; } err = debugfs_parse_options(data, &fsi->mount_opts); if (err) goto fail; err = simple_fill_super(sb, DEBUGFS_MAGIC, debug_files); if (err) goto fail; sb->s_op = &debugfs_super_operations; sb->s_d_op = &debugfs_dops; debugfs_apply_options(sb); return 0; fail: kfree(fsi); sb->s_fs_info = NULL; return err; }
static int debug_fill_super(struct super_block *sb, void *data, int silent) { static const struct tree_descr debug_files[] = {{""}}; struct debugfs_fs_info *fsi; int err; save_mount_options(sb, data); fsi = kzalloc(sizeof(struct debugfs_fs_info), GFP_KERNEL); sb->s_fs_info = fsi; if (!fsi) { err = -ENOMEM; goto fail; } err = debugfs_parse_options(data, &fsi->mount_opts); if (err) goto fail; err = simple_fill_super(sb, DEBUGFS_MAGIC, debug_files); if (err) goto fail; sb->s_op = &debugfs_super_operations; sb->s_d_op = &debugfs_dops; debugfs_apply_options(sb); return 0; fail: kfree(fsi); sb->s_fs_info = NULL; return err; }
C
linux
0
CVE-2013-7421
https://www.cvedetails.com/cve/CVE-2013-7421/
CWE-264
https://github.com/torvalds/linux/commit/5d26a105b5a73e5635eae0629b42fa0a90e07b7b
5d26a105b5a73e5635eae0629b42fa0a90e07b7b
crypto: prefix module autoloading with "crypto-" This prefixes all crypto module loading with "crypto-" so we never run the risk of exposing module auto-loading to userspace via a crypto API, as demonstrated by Mathias Krause: https://lkml.org/lkml/2013/3/4/70 Signed-off-by: Kees Cook <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
static void lz4hc_exit(struct crypto_tfm *tfm) { struct lz4hc_ctx *ctx = crypto_tfm_ctx(tfm); vfree(ctx->lz4hc_comp_mem); }
static void lz4hc_exit(struct crypto_tfm *tfm) { struct lz4hc_ctx *ctx = crypto_tfm_ctx(tfm); vfree(ctx->lz4hc_comp_mem); }
C
linux
0
CVE-2017-2616
https://www.cvedetails.com/cve/CVE-2017-2616/
CWE-362
https://github.com/karelzak/util-linux/commit/dffab154d29a288aa171ff50263ecc8f2e14a891
dffab154d29a288aa171ff50263ecc8f2e14a891
su: properly clear child PID Reported-by: Tobias Stöckmann <[email protected]> Signed-off-by: Karel Zak <[email protected]>
static void log_btmp(struct passwd const *pw) { struct utmpx ut; struct timeval tv; const char *tty_name, *tty_num; memset(&ut, 0, sizeof(ut)); strncpy(ut.ut_user, pw && pw->pw_name ? pw->pw_name : "(unknown)", sizeof(ut.ut_user)); get_terminal_name(NULL, &tty_name, &tty_num); if (tty_num) xstrncpy(ut.ut_id, tty_num, sizeof(ut.ut_id)); if (tty_name) xstrncpy(ut.ut_line, tty_name, sizeof(ut.ut_line)); gettimeofday(&tv, NULL); ut.ut_tv.tv_sec = tv.tv_sec; ut.ut_tv.tv_usec = tv.tv_usec; ut.ut_type = LOGIN_PROCESS; /* XXX doesn't matter */ ut.ut_pid = getpid(); updwtmpx(_PATH_BTMP, &ut); }
static void log_btmp(struct passwd const *pw) { struct utmpx ut; struct timeval tv; const char *tty_name, *tty_num; memset(&ut, 0, sizeof(ut)); strncpy(ut.ut_user, pw && pw->pw_name ? pw->pw_name : "(unknown)", sizeof(ut.ut_user)); get_terminal_name(NULL, &tty_name, &tty_num); if (tty_num) xstrncpy(ut.ut_id, tty_num, sizeof(ut.ut_id)); if (tty_name) xstrncpy(ut.ut_line, tty_name, sizeof(ut.ut_line)); gettimeofday(&tv, NULL); ut.ut_tv.tv_sec = tv.tv_sec; ut.ut_tv.tv_usec = tv.tv_usec; ut.ut_type = LOGIN_PROCESS; /* XXX doesn't matter */ ut.ut_pid = getpid(); updwtmpx(_PATH_BTMP, &ut); }
C
util-linux
0
CVE-2019-14980
https://www.cvedetails.com/cve/CVE-2019-14980/
CWE-416
https://github.com/ImageMagick/ImageMagick6/commit/614a257295bdcdeda347086761062ac7658b6830
614a257295bdcdeda347086761062ac7658b6830
https://github.com/ImageMagick/ImageMagick6/issues/43
MagickExport ssize_t WriteBlobString(Image *image,const char *string) { assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); assert(string != (const char *) NULL); return(WriteBlobStream(image,strlen(string),(const unsigned char *) string)); }
MagickExport ssize_t WriteBlobString(Image *image,const char *string) { assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); assert(string != (const char *) NULL); return(WriteBlobStream(image,strlen(string),(const unsigned char *) string)); }
C
ImageMagick6
0
CVE-2017-9374
https://www.cvedetails.com/cve/CVE-2017-9374/
CWE-772
https://git.qemu.org/?p=qemu.git;a=commit;h=d710e1e7bd3d5bfc26b631f02ae87901ebe646b0
d710e1e7bd3d5bfc26b631f02ae87901ebe646b0
null
static void usb_ehci_pci_init(Object *obj) { DeviceClass *dc = OBJECT_GET_CLASS(DeviceClass, obj, TYPE_DEVICE); EHCIPCIState *i = PCI_EHCI(obj); EHCIState *s = &i->ehci; s->caps[0x09] = 0x68; /* EECP */ s->capsbase = 0x00; s->opregbase = 0x20; s->portscbase = 0x44; s->portnr = NB_PORTS; if (!dc->hotpluggable) { s->companion_enable = true; } usb_ehci_init(s, DEVICE(obj)); }
static void usb_ehci_pci_init(Object *obj) { DeviceClass *dc = OBJECT_GET_CLASS(DeviceClass, obj, TYPE_DEVICE); EHCIPCIState *i = PCI_EHCI(obj); EHCIState *s = &i->ehci; s->caps[0x09] = 0x68; /* EECP */ s->capsbase = 0x00; s->opregbase = 0x20; s->portscbase = 0x44; s->portnr = NB_PORTS; if (!dc->hotpluggable) { s->companion_enable = true; } usb_ehci_init(s, DEVICE(obj)); }
C
qemu
0
CVE-2017-5118
https://www.cvedetails.com/cve/CVE-2017-5118/
CWE-732
https://github.com/chromium/chromium/commit/0ab2412a104d2f235d7b9fe19d30ef605a410832
0ab2412a104d2f235d7b9fe19d30ef605a410832
Inherit CSP when we inherit the security origin This prevents attacks that use main window navigation to get out of the existing csp constraints such as the related bug Bug: 747847 Change-Id: I1e57b50da17f65d38088205b0a3c7c49ef2ae4d8 Reviewed-on: https://chromium-review.googlesource.com/592027 Reviewed-by: Mike West <[email protected]> Commit-Queue: Andy Paicu <[email protected]> Cr-Commit-Position: refs/heads/master@{#492333}
void WebLocalFrameImpl::RequestExecuteScriptAndReturnValue( const WebScriptSource& source, bool user_gesture, WebScriptExecutionCallback* callback) { DCHECK(GetFrame()); RefPtr<DOMWrapperWorld> main_world = &DOMWrapperWorld::MainWorld(); SuspendableScriptExecutor* executor = SuspendableScriptExecutor::Create( GetFrame(), std::move(main_world), CreateSourcesVector(&source, 1), user_gesture, callback); executor->Run(); }
void WebLocalFrameImpl::RequestExecuteScriptAndReturnValue( const WebScriptSource& source, bool user_gesture, WebScriptExecutionCallback* callback) { DCHECK(GetFrame()); RefPtr<DOMWrapperWorld> main_world = &DOMWrapperWorld::MainWorld(); SuspendableScriptExecutor* executor = SuspendableScriptExecutor::Create( GetFrame(), std::move(main_world), CreateSourcesVector(&source, 1), user_gesture, callback); executor->Run(); }
C
Chrome
0
CVE-2014-1714
https://www.cvedetails.com/cve/CVE-2014-1714/
CWE-20
https://github.com/chromium/chromium/commit/5b0d76edd5d6d4054b2e1263e23c852226c5f701
5b0d76edd5d6d4054b2e1263e23c852226c5f701
Refactor ui::Clipboard::ObjectMap sanitization in ClipboardMsgFilter. BUG=352395 [email protected] [email protected] Review URL: https://codereview.chromium.org/200523004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@257164 0039d316-1c4b-4281-b951-d872f2087c98
void ClipboardMessageFilter::OnReadRTF(ui::ClipboardType type, std::string* result) { GetClipboard()->ReadRTF(type, result); }
void ClipboardMessageFilter::OnReadRTF(ui::ClipboardType type, std::string* result) { GetClipboard()->ReadRTF(type, result); }
C
Chrome
0
CVE-2017-5009
https://www.cvedetails.com/cve/CVE-2017-5009/
CWE-119
https://github.com/chromium/chromium/commit/1c40f9042ae2d6ee7483d72998aabb5e73b2ff60
1c40f9042ae2d6ee7483d72998aabb5e73b2ff60
DevTools: send proper resource type in Network.RequestWillBeSent This patch plumbs resoure type into the DispatchWillSendRequest instrumenation. This allows us to report accurate type in Network.RequestWillBeSent event, instead of "Other", that we report today. BUG=765501 R=dgozman Change-Id: I0134c08b841e8dd247fdc8ff208bfd51e462709c Reviewed-on: https://chromium-review.googlesource.com/667504 Reviewed-by: Pavel Feldman <[email protected]> Reviewed-by: Dmitry Gozman <[email protected]> Commit-Queue: Andrey Lushnikov <[email protected]> Cr-Commit-Position: refs/heads/master@{#507936}
void InspectorNetworkAgent::DidReceiveResourceResponse( unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, Resource* cached_resource) { String request_id = IdentifiersFactory::RequestId(identifier); bool is_not_modified = response.HttpStatusCode() == 304; bool resource_is_empty = true; std::unique_ptr<protocol::Network::Response> resource_response = BuildObjectForResourceResponse(response, cached_resource, &resource_is_empty); InspectorPageAgent::ResourceType type = cached_resource ? InspectorPageAgent::ToResourceType(cached_resource->GetType()) : InspectorPageAgent::kOtherResource; InspectorPageAgent::ResourceType saved_type = resources_data_->GetResourceType(request_id); if (saved_type == InspectorPageAgent::kScriptResource || saved_type == InspectorPageAgent::kXHRResource || saved_type == InspectorPageAgent::kDocumentResource || saved_type == InspectorPageAgent::kFetchResource || saved_type == InspectorPageAgent::kEventSourceResource) { type = saved_type; } if (type == InspectorPageAgent::kDocumentResource && loader && loader->GetSubstituteData().IsValid()) return; if (cached_resource) resources_data_->AddResource(request_id, cached_resource); String frame_id = loader && loader->GetFrame() ? IdentifiersFactory::FrameId(loader->GetFrame()) : ""; String loader_id = loader ? IdentifiersFactory::LoaderId(loader) : ""; resources_data_->ResponseReceived(request_id, frame_id, response); resources_data_->SetResourceType(request_id, type); if (response.GetSecurityStyle() != ResourceResponse::kSecurityStyleUnknown && response.GetSecurityStyle() != ResourceResponse::kSecurityStyleUnauthenticated) { const ResourceResponse::SecurityDetails* response_security_details = response.GetSecurityDetails(); resources_data_->SetCertificate(request_id, response_security_details->certificate); } if (resource_response && !resource_is_empty) { Maybe<String> maybe_frame_id; if (!frame_id.IsEmpty()) maybe_frame_id = frame_id; GetFrontend()->responseReceived( request_id, loader_id, MonotonicallyIncreasingTime(), InspectorPageAgent::ResourceTypeJson(type), std::move(resource_response), std::move(maybe_frame_id)); } if (is_not_modified && cached_resource && cached_resource->EncodedSize()) DidReceiveData(identifier, loader, 0, cached_resource->EncodedSize()); }
void InspectorNetworkAgent::DidReceiveResourceResponse( unsigned long identifier, DocumentLoader* loader, const ResourceResponse& response, Resource* cached_resource) { String request_id = IdentifiersFactory::RequestId(identifier); bool is_not_modified = response.HttpStatusCode() == 304; bool resource_is_empty = true; std::unique_ptr<protocol::Network::Response> resource_response = BuildObjectForResourceResponse(response, cached_resource, &resource_is_empty); InspectorPageAgent::ResourceType type = cached_resource ? InspectorPageAgent::CachedResourceType(*cached_resource) : InspectorPageAgent::kOtherResource; InspectorPageAgent::ResourceType saved_type = resources_data_->GetResourceType(request_id); if (saved_type == InspectorPageAgent::kScriptResource || saved_type == InspectorPageAgent::kXHRResource || saved_type == InspectorPageAgent::kDocumentResource || saved_type == InspectorPageAgent::kFetchResource || saved_type == InspectorPageAgent::kEventSourceResource) { type = saved_type; } if (type == InspectorPageAgent::kDocumentResource && loader && loader->GetSubstituteData().IsValid()) return; if (cached_resource) resources_data_->AddResource(request_id, cached_resource); String frame_id = loader && loader->GetFrame() ? IdentifiersFactory::FrameId(loader->GetFrame()) : ""; String loader_id = loader ? IdentifiersFactory::LoaderId(loader) : ""; resources_data_->ResponseReceived(request_id, frame_id, response); resources_data_->SetResourceType(request_id, type); if (response.GetSecurityStyle() != ResourceResponse::kSecurityStyleUnknown && response.GetSecurityStyle() != ResourceResponse::kSecurityStyleUnauthenticated) { const ResourceResponse::SecurityDetails* response_security_details = response.GetSecurityDetails(); resources_data_->SetCertificate(request_id, response_security_details->certificate); } if (resource_response && !resource_is_empty) { Maybe<String> maybe_frame_id; if (!frame_id.IsEmpty()) maybe_frame_id = frame_id; GetFrontend()->responseReceived( request_id, loader_id, MonotonicallyIncreasingTime(), InspectorPageAgent::ResourceTypeJson(type), std::move(resource_response), std::move(maybe_frame_id)); } if (is_not_modified && cached_resource && cached_resource->EncodedSize()) DidReceiveData(identifier, loader, 0, cached_resource->EncodedSize()); }
C
Chrome
1
CVE-2016-5384
https://www.cvedetails.com/cve/CVE-2016-5384/
CWE-415
https://cgit.freedesktop.org/fontconfig/commit/?id=7a4a5bd7897d216f0794ca9dbce0a4a5c9d14940
7a4a5bd7897d216f0794ca9dbce0a4a5c9d14940
null
lock_cache (void) { FcMutex *lock; retry: lock = fc_atomic_ptr_get (&cache_lock); if (!lock) { lock = (FcMutex *) malloc (sizeof (FcMutex)); FcMutexInit (lock); if (!fc_atomic_ptr_cmpexch (&cache_lock, NULL, lock)) { FcMutexFinish (lock); goto retry; } FcMutexLock (lock); /* Initialize random state */ FcRandom (); return; } FcMutexLock (lock); }
lock_cache (void) { FcMutex *lock; retry: lock = fc_atomic_ptr_get (&cache_lock); if (!lock) { lock = (FcMutex *) malloc (sizeof (FcMutex)); FcMutexInit (lock); if (!fc_atomic_ptr_cmpexch (&cache_lock, NULL, lock)) { FcMutexFinish (lock); goto retry; } FcMutexLock (lock); /* Initialize random state */ FcRandom (); return; } FcMutexLock (lock); }
C
fontconfig
0
CVE-2016-5770
https://www.cvedetails.com/cve/CVE-2016-5770/
CWE-190
https://github.com/php/php-src/commit/7245bff300d3fa8bacbef7897ff080a6f1c23eba?w=1
7245bff300d3fa8bacbef7897ff080a6f1c23eba?w=1
Fix bug #72262 - do not overflow int
SPL_METHOD(SplFileObject, current) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (zend_parse_parameters_none() == FAILURE) { return; } if (!intern->u.file.current_line && !intern->u.file.current_zval) { spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC); } if (intern->u.file.current_line && (!SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_CSV) || !intern->u.file.current_zval)) { RETURN_STRINGL(intern->u.file.current_line, intern->u.file.current_line_len, 1); } else if (intern->u.file.current_zval) { RETURN_ZVAL(intern->u.file.current_zval, 1, 0); } RETURN_FALSE; } /* }}} */ /* {{{ proto int SplFileObject::key()
SPL_METHOD(SplFileObject, current) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); if (zend_parse_parameters_none() == FAILURE) { return; } if (!intern->u.file.current_line && !intern->u.file.current_zval) { spl_filesystem_file_read_line(getThis(), intern, 1 TSRMLS_CC); } if (intern->u.file.current_line && (!SPL_HAS_FLAG(intern->flags, SPL_FILE_OBJECT_READ_CSV) || !intern->u.file.current_zval)) { RETURN_STRINGL(intern->u.file.current_line, intern->u.file.current_line_len, 1); } else if (intern->u.file.current_zval) { RETURN_ZVAL(intern->u.file.current_zval, 1, 0); } RETURN_FALSE; } /* }}} */ /* {{{ proto int SplFileObject::key()
C
php-src
1
null
null
null
https://github.com/chromium/chromium/commit/9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f
9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f
Fix crash if utterance is garbage-collected before speech ends. BUG=359130,348863 Review URL: https://codereview.chromium.org/228133002 git-svn-id: svn://svn.chromium.org/blink/trunk@171077 bbb929c8-8fbe-4397-9dbb-9b2b20218538
SpeechSynthesisUtterance* SpeechSynthesis::currentSpeechUtterance() const { if (!m_utteranceQueue.isEmpty()) return m_utteranceQueue.first().get(); return 0; }
SpeechSynthesisUtterance* SpeechSynthesis::currentSpeechUtterance() const { if (!m_utteranceQueue.isEmpty()) return m_utteranceQueue.first().get(); return 0; }
C
Chrome
0
CVE-2018-12248
https://www.cvedetails.com/cve/CVE-2018-12248/
CWE-125
https://github.com/mruby/mruby/commit/778500563a9f7ceba996937dc886bd8cde29b42b
778500563a9f7ceba996937dc886bd8cde29b42b
Extend stack when pushing arguments that does not fit in; fix #4038
fiber_switch_context(mrb_state *mrb, struct mrb_context *c) { c->status = MRB_FIBER_RUNNING; mrb->c = c; }
fiber_switch_context(mrb_state *mrb, struct mrb_context *c) { c->status = MRB_FIBER_RUNNING; mrb->c = c; }
C
mruby
0
CVE-2013-0268
https://www.cvedetails.com/cve/CVE-2013-0268/
CWE-264
https://github.com/torvalds/linux/commit/c903f0456bc69176912dee6dd25c6a66ee1aed00
c903f0456bc69176912dee6dd25c6a66ee1aed00
x86/msr: Add capabilities check At the moment the MSR driver only relies upon file system checks. This means that anything as root with any capability set can write to MSRs. Historically that wasn't very interesting but on modern processors the MSRs are such that writing to them provides several ways to execute arbitary code in kernel space. Sample code and documentation on doing this is circulating and MSR attacks are used on Windows 64bit rootkits already. In the Linux case you still need to be able to open the device file so the impact is fairly limited and reduces the security of some capability and security model based systems down towards that of a generic "root owns the box" setup. Therefore they should require CAP_SYS_RAWIO to prevent an elevation of capabilities. The impact of this is fairly minimal on most setups because they don't have heavy use of capabilities. Those using SELinux, SMACK or AppArmor rules might want to consider if their rulesets on the MSR driver could be tighter. Signed-off-by: Alan Cox <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Andrew Morton <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Horses <[email protected]> Signed-off-by: Ingo Molnar <[email protected]>
static int __init msr_init(void) { int i, err = 0; i = 0; if (__register_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr", &msr_fops)) { printk(KERN_ERR "msr: unable to get major %d for msr\n", MSR_MAJOR); err = -EBUSY; goto out; } msr_class = class_create(THIS_MODULE, "msr"); if (IS_ERR(msr_class)) { err = PTR_ERR(msr_class); goto out_chrdev; } msr_class->devnode = msr_devnode; get_online_cpus(); for_each_online_cpu(i) { err = msr_device_create(i); if (err != 0) goto out_class; } register_hotcpu_notifier(&msr_class_cpu_notifier); put_online_cpus(); err = 0; goto out; out_class: i = 0; for_each_online_cpu(i) msr_device_destroy(i); put_online_cpus(); class_destroy(msr_class); out_chrdev: __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr"); out: return err; }
static int __init msr_init(void) { int i, err = 0; i = 0; if (__register_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr", &msr_fops)) { printk(KERN_ERR "msr: unable to get major %d for msr\n", MSR_MAJOR); err = -EBUSY; goto out; } msr_class = class_create(THIS_MODULE, "msr"); if (IS_ERR(msr_class)) { err = PTR_ERR(msr_class); goto out_chrdev; } msr_class->devnode = msr_devnode; get_online_cpus(); for_each_online_cpu(i) { err = msr_device_create(i); if (err != 0) goto out_class; } register_hotcpu_notifier(&msr_class_cpu_notifier); put_online_cpus(); err = 0; goto out; out_class: i = 0; for_each_online_cpu(i) msr_device_destroy(i); put_online_cpus(); class_destroy(msr_class); out_chrdev: __unregister_chrdev(MSR_MAJOR, 0, NR_CPUS, "cpu/msr"); out: return err; }
C
linux
0
CVE-2016-10011
https://www.cvedetails.com/cve/CVE-2016-10011/
CWE-320
https://github.com/openbsd/src/commit/ac8147a06ed2e2403fb6b9a0c03e618a9333c0e9
ac8147a06ed2e2403fb6b9a0c03e618a9333c0e9
use sshbuf_allocate() to pre-allocate the buffer used for loading keys. This avoids implicit realloc inside the buffer code, which might theoretically leave fragments of the key on the heap. This doesn't appear to happen in practice for normal sized keys, but was observed for novelty oversize ones. Pointed out by Jann Horn of Project Zero; ok markus@
sshkey_save_private(struct sshkey *key, const char *filename, const char *passphrase, const char *comment, int force_new_format, const char *new_format_cipher, int new_format_rounds) { struct sshbuf *keyblob = NULL; int r; if ((keyblob = sshbuf_new()) == NULL) return SSH_ERR_ALLOC_FAIL; if ((r = sshkey_private_to_fileblob(key, keyblob, passphrase, comment, force_new_format, new_format_cipher, new_format_rounds)) != 0) goto out; if ((r = sshkey_save_private_blob(keyblob, filename)) != 0) goto out; r = 0; out: sshbuf_free(keyblob); return r; }
sshkey_save_private(struct sshkey *key, const char *filename, const char *passphrase, const char *comment, int force_new_format, const char *new_format_cipher, int new_format_rounds) { struct sshbuf *keyblob = NULL; int r; if ((keyblob = sshbuf_new()) == NULL) return SSH_ERR_ALLOC_FAIL; if ((r = sshkey_private_to_fileblob(key, keyblob, passphrase, comment, force_new_format, new_format_cipher, new_format_rounds)) != 0) goto out; if ((r = sshkey_save_private_blob(keyblob, filename)) != 0) goto out; r = 0; out: sshbuf_free(keyblob); return r; }
C
src
0
CVE-2016-10065
https://www.cvedetails.com/cve/CVE-2016-10065/
CWE-284
https://github.com/ImageMagick/ImageMagick/commit/134463b926fa965571aa4febd61b810be5e7da05
134463b926fa965571aa4febd61b810be5e7da05
https://github.com/ImageMagick/ImageMagick/issues/129
static void ImportRGBOQuantum(const Image *image,QuantumInfo *quantum_info, const MagickSizeType number_pixels,const unsigned char *magick_restrict p, Quantum *magick_restrict q,ExceptionInfo *exception) { QuantumAny range; register ssize_t x; unsigned int pixel; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); switch (quantum_info->depth) { case 8: { unsigned char pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushCharPixel(p,&pixel); SetPixelRed(image,ScaleCharToQuantum(pixel),q); p=PushCharPixel(p,&pixel); SetPixelGreen(image,ScaleCharToQuantum(pixel),q); p=PushCharPixel(p,&pixel); SetPixelBlue(image,ScaleCharToQuantum(pixel),q); p=PushCharPixel(p,&pixel); SetPixelOpacity(image,ScaleCharToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 10: { pixel=0; if (quantum_info->pack == MagickFalse) { register ssize_t i; size_t quantum; ssize_t n; n=0; quantum=0; for (x=0; x < (ssize_t) number_pixels; x++) { for (i=0; i < 4; i++) { switch (n % 3) { case 0: { p=PushLongPixel(quantum_info->endian,p,&pixel); quantum=(size_t) (ScaleShortToQuantum((unsigned short) (((pixel >> 22) & 0x3ff) << 6))); break; } case 1: { quantum=(size_t) (ScaleShortToQuantum((unsigned short) (((pixel >> 12) & 0x3ff) << 6))); break; } case 2: { quantum=(size_t) (ScaleShortToQuantum((unsigned short) (((pixel >> 2) & 0x3ff) << 6))); break; } } switch (i) { case 0: SetPixelRed(image,(Quantum) quantum,q); break; case 1: SetPixelGreen(image,(Quantum) quantum,q); break; case 2: SetPixelBlue(image,(Quantum) quantum,q); break; case 3: SetPixelOpacity(image,(Quantum) quantum,q); break; } n++; } p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelRed(image,ScaleShortToQuantum((unsigned short) (pixel << 6)),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelGreen(image,ScaleShortToQuantum((unsigned short) (pixel << 6)), q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelBlue(image,ScaleShortToQuantum((unsigned short) (pixel << 6)), q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelOpacity(image,ScaleShortToQuantum((unsigned short) (pixel << 6)), q); q+=GetPixelChannels(image); } break; } case 16: { unsigned short pixel; if (quantum_info->format == FloatingPointQuantumFormat) { for (x=0; x < (ssize_t) number_pixels; x++) { p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelRed(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGreen(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelBlue(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelOpacity(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelRed(image,ScaleShortToQuantum(pixel),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGreen(image,ScaleShortToQuantum(pixel),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelBlue(image,ScaleShortToQuantum(pixel),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelOpacity(image,ScaleShortToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 32: { unsigned int pixel; if (quantum_info->format == FloatingPointQuantumFormat) { float pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushFloatPixel(quantum_info,p,&pixel); SetPixelRed(image,ClampToQuantum(pixel),q); p=PushFloatPixel(quantum_info,p,&pixel); SetPixelGreen(image,ClampToQuantum(pixel),q); p=PushFloatPixel(quantum_info,p,&pixel); SetPixelBlue(image,ClampToQuantum(pixel),q); p=PushFloatPixel(quantum_info,p,&pixel); SetPixelOpacity(image,ClampToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelRed(image,ScaleLongToQuantum(pixel),q); p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelGreen(image,ScaleLongToQuantum(pixel),q); p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelBlue(image,ScaleLongToQuantum(pixel),q); p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelOpacity(image,ScaleLongToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 64: { if (quantum_info->format == FloatingPointQuantumFormat) { double pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushDoublePixel(quantum_info,p,&pixel); SetPixelRed(image,ClampToQuantum(pixel),q); p=PushDoublePixel(quantum_info,p,&pixel); SetPixelGreen(image,ClampToQuantum(pixel),q); p=PushDoublePixel(quantum_info,p,&pixel); SetPixelBlue(image,ClampToQuantum(pixel),q); p=PushDoublePixel(quantum_info,p,&pixel); SetPixelOpacity(image,ClampToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } } default: { range=GetQuantumRange(quantum_info->depth); for (x=0; x < (ssize_t) number_pixels; x++) { p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelRed(image,ScaleAnyToQuantum(pixel,range),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelGreen(image,ScaleAnyToQuantum(pixel,range),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelBlue(image,ScaleAnyToQuantum(pixel,range),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelOpacity(image,ScaleAnyToQuantum(pixel,range),q); q+=GetPixelChannels(image); } break; } } }
static void ImportRGBOQuantum(const Image *image,QuantumInfo *quantum_info, const MagickSizeType number_pixels,const unsigned char *magick_restrict p, Quantum *magick_restrict q,ExceptionInfo *exception) { QuantumAny range; register ssize_t x; unsigned int pixel; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); switch (quantum_info->depth) { case 8: { unsigned char pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushCharPixel(p,&pixel); SetPixelRed(image,ScaleCharToQuantum(pixel),q); p=PushCharPixel(p,&pixel); SetPixelGreen(image,ScaleCharToQuantum(pixel),q); p=PushCharPixel(p,&pixel); SetPixelBlue(image,ScaleCharToQuantum(pixel),q); p=PushCharPixel(p,&pixel); SetPixelOpacity(image,ScaleCharToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 10: { pixel=0; if (quantum_info->pack == MagickFalse) { register ssize_t i; size_t quantum; ssize_t n; n=0; quantum=0; for (x=0; x < (ssize_t) number_pixels; x++) { for (i=0; i < 4; i++) { switch (n % 3) { case 0: { p=PushLongPixel(quantum_info->endian,p,&pixel); quantum=(size_t) (ScaleShortToQuantum((unsigned short) (((pixel >> 22) & 0x3ff) << 6))); break; } case 1: { quantum=(size_t) (ScaleShortToQuantum((unsigned short) (((pixel >> 12) & 0x3ff) << 6))); break; } case 2: { quantum=(size_t) (ScaleShortToQuantum((unsigned short) (((pixel >> 2) & 0x3ff) << 6))); break; } } switch (i) { case 0: SetPixelRed(image,(Quantum) quantum,q); break; case 1: SetPixelGreen(image,(Quantum) quantum,q); break; case 2: SetPixelBlue(image,(Quantum) quantum,q); break; case 3: SetPixelOpacity(image,(Quantum) quantum,q); break; } n++; } p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelRed(image,ScaleShortToQuantum((unsigned short) (pixel << 6)),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelGreen(image,ScaleShortToQuantum((unsigned short) (pixel << 6)), q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelBlue(image,ScaleShortToQuantum((unsigned short) (pixel << 6)), q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelOpacity(image,ScaleShortToQuantum((unsigned short) (pixel << 6)), q); q+=GetPixelChannels(image); } break; } case 16: { unsigned short pixel; if (quantum_info->format == FloatingPointQuantumFormat) { for (x=0; x < (ssize_t) number_pixels; x++) { p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelRed(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGreen(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelBlue(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelOpacity(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelRed(image,ScaleShortToQuantum(pixel),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGreen(image,ScaleShortToQuantum(pixel),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelBlue(image,ScaleShortToQuantum(pixel),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelOpacity(image,ScaleShortToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 32: { unsigned int pixel; if (quantum_info->format == FloatingPointQuantumFormat) { float pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushFloatPixel(quantum_info,p,&pixel); SetPixelRed(image,ClampToQuantum(pixel),q); p=PushFloatPixel(quantum_info,p,&pixel); SetPixelGreen(image,ClampToQuantum(pixel),q); p=PushFloatPixel(quantum_info,p,&pixel); SetPixelBlue(image,ClampToQuantum(pixel),q); p=PushFloatPixel(quantum_info,p,&pixel); SetPixelOpacity(image,ClampToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelRed(image,ScaleLongToQuantum(pixel),q); p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelGreen(image,ScaleLongToQuantum(pixel),q); p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelBlue(image,ScaleLongToQuantum(pixel),q); p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelOpacity(image,ScaleLongToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 64: { if (quantum_info->format == FloatingPointQuantumFormat) { double pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushDoublePixel(quantum_info,p,&pixel); SetPixelRed(image,ClampToQuantum(pixel),q); p=PushDoublePixel(quantum_info,p,&pixel); SetPixelGreen(image,ClampToQuantum(pixel),q); p=PushDoublePixel(quantum_info,p,&pixel); SetPixelBlue(image,ClampToQuantum(pixel),q); p=PushDoublePixel(quantum_info,p,&pixel); SetPixelOpacity(image,ClampToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } } default: { range=GetQuantumRange(quantum_info->depth); for (x=0; x < (ssize_t) number_pixels; x++) { p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelRed(image,ScaleAnyToQuantum(pixel,range),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelGreen(image,ScaleAnyToQuantum(pixel,range),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelBlue(image,ScaleAnyToQuantum(pixel,range),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelOpacity(image,ScaleAnyToQuantum(pixel,range),q); q+=GetPixelChannels(image); } break; } } }
C
ImageMagick
0
CVE-2013-6381
https://www.cvedetails.com/cve/CVE-2013-6381/
CWE-119
https://github.com/torvalds/linux/commit/6fb392b1a63ae36c31f62bc3fc8630b49d602b62
6fb392b1a63ae36c31f62bc3fc8630b49d602b62
qeth: avoid buffer overflow in snmp ioctl Check user-defined length in snmp ioctl request and allow request only if it fits into a qeth command buffer. Signed-off-by: Ursula Braun <[email protected]> Signed-off-by: Frank Blaschka <[email protected]> Reviewed-by: Heiko Carstens <[email protected]> Reported-by: Nico Golde <[email protected]> Reported-by: Fabian Yamaguchi <[email protected]> Cc: <[email protected]> Signed-off-by: David S. Miller <[email protected]>
void qeth_core_free_discipline(struct qeth_card *card) { if (card->options.layer2) symbol_put(qeth_l2_discipline); else symbol_put(qeth_l3_discipline); card->discipline = NULL; }
void qeth_core_free_discipline(struct qeth_card *card) { if (card->options.layer2) symbol_put(qeth_l2_discipline); else symbol_put(qeth_l3_discipline); card->discipline = NULL; }
C
linux
0